diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc85e3b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +js/dist/ +js/node_modules/ diff --git a/Makefile b/Makefile index 253c373..58eeb0f 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,9 @@ appstore_build_directory=$(CURDIR)/build/artifacts/appstore appstore_package_name=$(appstore_build_directory)/$(app_name) npm=$(shell which npm 2> /dev/null) composer=$(shell which composer 2> /dev/null) +php=$(shell which php-8.2 2> /dev/null) -dallow_url_fopen=On + +COMPOSER_ARGS=--prefer-dist --no-dev all: build @@ -72,20 +75,20 @@ composer: ifeq (, $(composer)) @echo "No composer command available, downloading a copy from the web" mkdir -p $(build_tools_directory) - curl -sS https://getcomposer.org/installer | php-7.2 + curl -sS https://getcomposer.org/installer | $(php) mv composer.phar $(build_tools_directory) - php-7.2 $(build_tools_directory)/composer.phar install --prefer-dist - php-7.2 $(build_tools_directory)/composer.phar update --prefer-dist + $(php) $(build_tools_directory)/composer.phar install $(COMPOSER_ARGS) + $(php) $(build_tools_directory)/composer.phar update $(COMPOSER_ARGS) else - composer install --prefer-dist - composer update --prefer-dist + composer install $(COMPOSER_ARGS) + composer update $(COMPOSER_ARGS) endif # Installs npm dependencies .PHONY: npm npm: ifeq (,$(wildcard $(CURDIR)/package.json)) - cd js && $(npm) run build + cd js && $(npm) install && $(npm) run build else npm run build endif @@ -131,6 +134,7 @@ appstore: echo $(app_name) pwd gtar \ + --owner=0 --group=0 \ --exclude-vcs \ --exclude="$(app_name)/build" \ --exclude="$(app_name)/tests" \ @@ -153,7 +157,7 @@ appstore: --exclude="$(app_name)/.*" \ --exclude="$(app_name)/.git" \ --exclude="$(app_name)/js/.*" \ - -cvzf $(appstore_package_name).tar.gz ../$(app_name) + -czf $(appstore_package_name).tar.gz ../$(app_name) .PHONY: test test: composer diff --git a/appinfo/database.xml b/appinfo/database.xml deleted file mode 100644 index edbc7f4..0000000 --- a/appinfo/database.xml +++ /dev/null @@ -1,517 +0,0 @@ - - - *dbname* - true - false - utf8 - - *dbprefix*timetracker_client - - - - id - integer - 0 - true - 1 - 4 - - - name - text - true - 64 - - - created_at - integer - true - 4 - - -
- - - - *dbprefix*timetracker_project - - - - id - integer - 0 - true - 1 - 4 - - - name - text - true - 64 - - - client_id - integer - false - 4 - - - created_by_user_uid - text - true - 128 - - - locked - integer - false - 0 - 4 - - - archived - integer - false - 0 - 4 - - - created_at - integer - true - 4 - - -
- - *dbprefix*timetracker_user_to_project - - - - id - integer - 0 - true - 1 - 4 - - - user_uid - text - true - 128 - - - project_id - integer - true - 4 - - - admin - integer - true - 4 - 0 - - - access - integer - true - 4 - 1 - - - created_at - integer - true - 4 - - -
- - - *dbprefix*timetracker_user_to_client - - - - id - integer - 0 - true - 1 - 4 - - - user_uid - text - true - 128 - - - client_id - integer - true - 4 - - - admin - integer - true - 4 - 0 - - - access - integer - true - 4 - 1 - - - created_at - integer - true - 4 - - -
- - - - *dbprefix*timetracker_work_interval - - - id - integer - 0 - true - 1 - 4 - - - name - text - true - 256 - - - details - text - true - - 1024 - - - project_id - integer - false - 4 - - - user_uid - text - true - 128 - - - start - integer - true - 4 - - - duration - integer - false - 4 - - - running - integer - true - 4 - - -
- - - - *dbprefix*timetracker_tag - - - - id - integer - 0 - true - 1 - 4 - - - name - text - true - 64 - - - user_uid - text - true - 128 - - - created_at - integer - true - 4 - - -
- - - *dbprefix*timetracker_locked_project_allowed_tag - - - - id - integer - 0 - true - 1 - 4 - - - - project_id - integer - false - 4 - - - - - tag_id - integer - true - 4 - - - - created_at - integer - true - 4 - - -
- - - - - - *dbprefix*timetracker_workinterval_to_tag - - - - id - integer - 0 - true - 1 - 4 - - - work_interval_id - integer - true - 4 - - - tag_id - integer - true - 4 - - - created_at - integer - true - 4 - - -
- - - - *dbprefix*timetracker_timeline_entry - - - - id - integer - 0 - true - 1 - 4 - - - timeline_id - integer - 4 - - - user_uid - text - true - 128 - - - name - text - true - 64 - - - project_name - text - true - 64 - - - client_name - text - true - 64 - - - time_interval - text - true - 64 - - - total_duration - text - true - 64 - - - created_at - integer - true - 4 - - -
- - - - *dbprefix*timetracker_timeline - - - - id - integer - 0 - true - 1 - 4 - - - status - text - true - 64 - - - user_uid - text - true - 128 - - - group1 - text - false - 64 - - - group2 - text - false - 64 - - - time_group - text - false - 64 - - - filter_projects - text - false - 64 - - - filter_clients - text - false - 64 - - - time_interval - text - false - 64 - - - total_duration - text - true - 64 - - - created_at - integer - true - 4 - - -
- - -
\ No newline at end of file diff --git a/appinfo/info.xml b/appinfo/info.xml index 40e197b..c02f44e 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -3,9 +3,39 @@ xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd"> timetracker Time Tracker - Time Tracker App - - 0.0.40 + Track your time spent with different tasks, aggregate by project or clients! + Ein Zeitmesser für tägliche Aufgaben, mit Übersichten für Projekte oder Kunden! + +Track your time spent with different tasks each day using this time tracker app! Features include: + +# Adding entries +With the integrated timer, you only need to press start and stop! Times will be stored automatically, with 1-second-precision. Forgot to press start? Just use the manual editor, to add entries from the past. Or edit existing ones in case you need to change something! + +# Projects, Clients and Tags +Assign tasks to projects and clients! This allows you to display aggregated durations for each project or client, or filter for tasks by projects or clients. You need some more categorization? That's what tags are made for! Create tags to categorize tasks independently from projects or clients. + +# Lost track of your work time? +No problem! Just use the Dashboard view to display a nice donut / pie chart of your tasks! Or filter for tasks in the Reports or Timeline view to display total or aggregated values. + +This app is still under development, so stay tuned for updates and additional features! If you have any suggestions, bug reports or feature requests, feel free to head over to our [GitHub project page](https://github.com/mtierltd/timetracker) and search through the existing issues, maybe your topic is already under discussion! And if it's not, feel free to file a new issue for it. + +And for now, start making your time tracking easier by using this app! + + +Behalte den Überblick über den Zeitaufwand täglicher Aufgaben mit dieser Time Tracker-App! Folgende Features erwarten dich: + +# Einträge anlegen +Ein integrierter Timer macht es Dir leicht, neue Einträge hinzuzufügen. Mit einem Klick auf Start und Stopp werden die Zeiten automatisch aufgezeichnet! Vergessen, den Startknopf zu drücken? Kein Problem! Mit dem Manuellen Editor können Einträge auch nachträglich erstellt werden. Oder Einträge bearbeitet werden, falls die Zeiten nochmal angepasst werden müssen. + +# Projekte, Kunden und Tags +Aufgaben können Projekten und Kunden zugeordnet werden. Dadurch lässt sich später einfach herausfinden, wie viel Zeit für ein spezifisches Projekt oder einen Kunden verwendet wurden. Und wenn das noch nicht genug ist, gibt es Tags, um Aufgaben auch Projekt- und Kundenübergreifend zu kategorisieren! + +# Den Überblick behalten +Mit dem integrierten Dashboard lässt sich anhand eines Kuchen-/Donut-Diagramms leicht ein Gesamtbild bekommen, wie viel Zeit für ein bestimmtes Projekt verwendet wurde. Mit der Berichts- oder Timeline-Ansicht lassen sich zudem Aufgaben filtern, um Zeiten zu aggregieren! + +Diese App wird aktuell noch weiterentwickelt, also: Augen offen halten für neue Features! Und falls Dir irgendwelche Verbesserungsvorschläge, Probleme oder neue Features einfallen, schau mal auf unserem [GitHub Projekt](https://github.com/mtierltd/timetracker) vorbei, vielleicht wird Dein Thema bereits diskutiert! Und falls nicht, starte gerne eine neue Diskussion, wir freuen uns auf Dein Feedback! + + 0.0.85 agpl MTier Ltd. TimeTracker @@ -14,8 +44,16 @@ tools https://github.com/mtierltd/timetracker/issues + https://abload.de/img/bildschirmfotoam2021-u7j37.png + https://abload.de/img/bildschirmfotoam2021-m0jq9.png + https://abload.de/img/bildschirmfotoam2021-6dj9p.png + https://abload.de/img/bildschirmfotoam2021-otj7x.png + https://abload.de/img/bildschirmfotoam2021-kykd8.png + https://abload.de/img/bildschirmfotoam2021-nbk8s.png + https://abload.de/img/bildschirmfotoam2021-vuk8t.png + https://abload.de/img/bildschirmfotoam2021-03kxw.png - + diff --git a/appinfo/routes.php b/appinfo/routes.php index 1cdf421..ebb203b 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -8,7 +8,7 @@ * it's instantiated in there */ - + return [ 'routes' => [ ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], @@ -18,9 +18,11 @@ ['name' => 'dashboard#index', 'url' => '/dashboard', 'verb' => 'GET'], ['name' => 'reports#index', 'url' => '/reports', 'verb' => 'GET'], ['name' => 'timelines#index', 'url' => '/timelines', 'verb' => 'GET'], + ['name' => 'timelinesAdmin#index', 'url' => '/timelines-admin', 'verb' => 'GET'], - + ['name' => 'tags#index', 'url' => '/tags', 'verb' => 'GET'], + ['name' => 'goals#index', 'url' => '/goals', 'verb' => 'GET'], ['name' => 'ajax#start_timer', 'url' => '/ajax/start-timer/{name}', 'verb' => 'POST'], ['name' => 'ajax#stop_timer', 'url' => '/ajax/stop-timer/{name}', 'verb' => 'POST'], @@ -29,8 +31,10 @@ ['name' => 'ajax#update_work_interval', 'url' => '/ajax/update-work-interval/{id}', 'verb' => 'POST'], ['name' => 'ajax#add_work_interval', 'url' => '/ajax/add-work-interval/{name}', 'verb' => 'POST'], ['name' => 'ajax#delete_work_interval', 'url' => '/ajax/delete-work-interval/{id}', 'verb' => 'POST'], + ['name' => 'ajax#add_cost', 'url' => '/ajax/add-cost/{id}', 'verb' => 'POST'], - ['name' => 'ajax#get_clients', 'url' => '/ajax/clients', 'verb' => 'GET'], + + ['name' => 'ajax#get_clients', 'url' => '/ajax/clients', 'verb' => 'GET'], ['name' => 'ajax#add_client', 'url' => '/ajax/add-client/{name}', 'verb' => 'POST'], ['name' => 'ajax#edit_client', 'url' => '/ajax/edit-client/{id}', 'verb' => 'POST'], ['name' => 'ajax#delete_client', 'url' => '/ajax/delete-client/{id}', 'verb' => 'POST'], @@ -40,6 +44,7 @@ ['name' => 'ajax#add_project', 'url' => '/ajax/add-project/{name}', 'verb' => 'POST'], ['name' => 'ajax#edit_project', 'url' => '/ajax/edit-project/{id}', 'verb' => 'POST'], ['name' => 'ajax#delete_project', 'url' => '/ajax/delete-project/{id}', 'verb' => 'POST'], + ['name' => 'ajax#delete_project_with_data', 'url' => '/ajax/delete-project-with-data/{id}', 'verb' => 'POST'], ['name' => 'ajax#get_tags', 'url' => '/ajax/tags', 'verb' => 'GET'], @@ -47,11 +52,18 @@ ['name' => 'ajax#edit_tag', 'url' => '/ajax/edit-tag/{id}', 'verb' => 'POST'], ['name' => 'ajax#delete_tag', 'url' => '/ajax/delete-tag/{id}', 'verb' => 'POST'], + ['name' => 'ajax#get_goals', 'url' => '/ajax/goals', 'verb' => 'GET'], + ['name' => 'ajax#add_goal', 'url' => '/ajax/add-goal', 'verb' => 'POST'], + ['name' => 'ajax#delete_goal', 'url' => '/ajax/delete-goal/{id}', 'verb' => 'POST'], + + ['name' => 'ajax#get_report', 'url' => '/ajax/report', 'verb' => 'GET'], ['name' => 'ajax#post_timeline', 'url' => '/ajax/timeline', 'verb' => 'POST'], ['name' => 'ajax#get_timelines', 'url' => '/ajax/timelines', 'verb' => 'GET'], ['name' => 'ajax#get_timelines_admin', 'url' => '/ajax/timelines-admin', 'verb' => 'GET'], ['name' => 'ajax#download_timeline', 'url' => '/ajax/download-timeline/{id}', 'verb' => 'GET'], ['name' => 'ajax#edit_timeline', 'url' => '/ajax/edit-timeline/{id}', 'verb' => 'POST'], + ['name' => 'ajax#delete_timeline', 'url' => '/ajax/delete-timeline/{id}', 'verb' => 'POST'], + ['name' => 'ajax#email_timeline', 'url' => '/ajax/email-timeline/{id}', 'verb' => 'POST'], ] ]; diff --git a/composer.json b/composer.json index cedc284..b142981 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "Time Tracker", + "name": "mtierltd/timetracker", "description": "Time Tracker App", "type": "project", "license": "AGPL", @@ -10,6 +10,6 @@ ], "require": {}, "require-dev": { - "phpunit/phpunit": "^5.4" + "christophwurst/nextcloud": "^24.0" } } diff --git a/composer.lock b/composer.lock index 8c5a34f..cffd205 100644 --- a/composer.lock +++ b/composer.lock @@ -4,146 +4,74 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "935d1758cd573be7e4115940804c215e", + "content-hash": "296f87db0439fa6556d383ab1bd9038b", "packages": [], "packages-dev": [ { - "name": "doctrine/instantiator", - "version": "1.2.0", + "name": "christophwurst/nextcloud", + "version": "v24.0.1", "source": { "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" + "url": "https://github.com/ChristophWurst/nextcloud_composer.git", + "reference": "f032acdff1502a7323f95a6524d163290f43b446" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "url": "https://api.github.com/repos/ChristophWurst/nextcloud_composer/zipball/f032acdff1502a7323f95a6524d163290f43b446", + "reference": "f032acdff1502a7323f95a6524d163290f43b446", "shasum": "" }, "require": { - "php": "^7.1" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "php": "^7.4 || ~8.0 || ~8.1", + "psr/container": "^1.1.1", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + "dev-master": "24.0.0-dev" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "AGPL-3.0-or-later" ], "authors": [ { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" } ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2019-03-17T17:37:11+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.9.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "78af75148f9fdd34ea727c8b529a9b4a8f7b740c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/78af75148f9fdd34ea727c8b529a9b4a8f7b740c", - "reference": "78af75148f9fdd34ea727c8b529a9b4a8f7b740c", - "shasum": "" + "description": "Composer package containing Nextcloud's public API (classes, interfaces)", + "support": { + "issues": "https://github.com/ChristophWurst/nextcloud_composer/issues", + "source": "https://github.com/ChristophWurst/nextcloud_composer/tree/v24.0.1" }, - "require": { - "php": "^7.2" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpstan/phpstan": "^0.9.2", - "phpstan/phpstan-phpunit": "^0.9.4", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2018-10-30T00:14:44+00:00" + "abandoned": "nextcloud/ocp", + "time": "2022-06-02T14:16:47+00:00" }, { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "name": "psr/container", + "version": "1.1.2", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" + "php": ">=7.4.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "Psr\\Container\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -152,93 +80,41 @@ ], "authors": [ { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" ], - "time": "2017-09-11T18:02:19+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30T07:14:17+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { - "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "name": "psr/event-dispatcher", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "php": ">=7.2.0" }, "type": "library", "extra": { @@ -248,57 +124,7 @@ }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2017-07-14T14:27:02+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.8.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "Psr\\EventDispatcher\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -307,1098 +133,71 @@ ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2018-08-05T17:53:17+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "4.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" - }, - "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" - }, - "suggest": { - "ext-xdebug": "^2.5.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2017-04-02T07:44:40+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2017-11-27T13:52:08+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "description": "Standard interfaces for event handling.", "keywords": [ - "template" + "events", + "psr", + "psr-14" ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2019-01-08T18:20:26+00:00" }, { - "name": "phpunit/php-token-stream", - "version": "2.0.2", + "name": "psr/log", + "version": "1.1.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2.4" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-11-27T05:48:46+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "5.7.27", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "^1.0.6|^2.0.1", - "symfony/yaml": "~2.1|~3.0|~4.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.7.x-dev" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, - "autoload": { - "classmap": [ - "src/" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "phpunit", - "testing", - "xunit" + "log", + "psr", + "psr-3" ], - "time": "2018-02-01T05:50:59+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "abandoned": true, - "time": "2017-06-30T09:13:00+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-05-22T07:24:03+00:00" - }, - { - "name": "sebastian/environment", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-11-26T07:53:53+00:00" - }, - { - "name": "sebastian/exporter", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-11-19T08:54:04+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", - "shasum": "" - }, - "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.11.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "82ebae02209c21113908c229e9883c419720738a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", - "reference": "82ebae02209c21113908c229e9883c419720738a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, - { - "name": "Gert de Pagter", - "email": "backendtea@gmail.com" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2019-02-06T07:57:58+00:00" - }, - { - "name": "symfony/yaml", - "version": "v4.2.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "6712daf03ee25b53abb14e7e8e0ede1a770efdb1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/6712daf03ee25b53abb14e7e8e0ede1a770efdb1", - "reference": "6712daf03ee25b53abb14e7e8e0ede1a770efdb1", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2019-03-30T15:58:42+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2018-12-25T11:19:39+00:00" + "time": "2021-05-03T11:20:27+00:00" } ], "aliases": [], @@ -1407,5 +206,6 @@ "prefer-stable": false, "prefer-lowest": false, "platform": [], - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.3.0" } diff --git a/css/daterangepicker.css b/css/daterangepicker.css index e6490a5..62c21cb 100644 --- a/css/daterangepicker.css +++ b/css/daterangepicker.css @@ -386,3 +386,36 @@ float: right; } .daterangepicker .drp-calendar.left { clear: none !important; } } +.daterangepicker { + background-color: var(--color-main-background); +} +.daterangepicker .calendar-table { + border: 1px solid var(--color-main-background); + border-radius: 4px; + background-color: var(--color-main-background); +} +.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect { + width: 50px; + margin: 0 auto; + background:var(--color-background-dark); + border: 1px solid var(--color-background-dark); + padding: 2px; + outline: 0; + font-size: 12px; +} + +.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date { + background-color:var(--color-main-background); + border-color: transparent; + color: var(--color-background-darker); +} + +.daterangepicker td.available:hover, .daterangepicker th.available:hover { + background-color: var(--color-background-darker); + border-color: transparent; + color: inherit; +} +.daterangepicker .ranges li:hover { + background-color: var(--color-background-darker); +} + diff --git a/css/fonts/open-iconic.svg b/css/fonts/open-iconic.svg index 32b2c4e..5772192 100644 --- a/css/fonts/open-iconic.svg +++ b/css/fonts/open-iconic.svg @@ -1,543 +1 @@ - - - - - -Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014 - By P.J. Onori -Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014 By P.J. Onori Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net) \ No newline at end of file diff --git a/css/piklor.css b/css/piklor.css new file mode 100644 index 0000000..a43d6c9 --- /dev/null +++ b/css/piklor.css @@ -0,0 +1,67 @@ +/* +header, footer { + color: white; + background: #303F9F; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.51); +} + +h1.title { + font-size: 4em; + font-weight: bold; +} + +pre { + background: #212121; + color: white; +} + +header p { + font-size: 1.4em; +} + +footer { + padding: 50px 0; + text-align: center; + font-size: 1.1em; + margin-top: 3em; +} + +footer a { + color: white; +} + +footer a:hover { + color: white; +} +*/ +/* picker */ +.color-picker { + background: rgba(255, 255, 255, 0.75); + padding: 10px; + border: 1px solid rgba(203, 203, 203, 0.6); + border-radius: 2px; + position: absolute; + margin-left: -120px; + width: 300px; + z-index: 10; + margin-top: 35px; +} + +.color-picker > div { + width: 20px; + display: inline-block; + height: 20px; + margin: 3px; + border-radius: 100%; + opacity: 0.7; + +} + +.picker-wrapper { + padding: 20px; + display: inline; +} + +.color-picker > div:hover { + opacity: 1; +} \ No newline at end of file diff --git a/css/style-compat.css b/css/style-compat.css new file mode 100644 index 0000000..2617a68 --- /dev/null +++ b/css/style-compat.css @@ -0,0 +1,74 @@ +#app-navigation:not(.vue) > ul { + position: relative; + height: 100%; + width: 100%; + overflow-x: hidden; + overflow-y: auto; + box-sizing: border-box; + display: flex; + flex-direction: column; + padding: calc(var(--default-grid-baseline) * 2); +} + +#app-navigation:not(.vue) > ul > li, +#app-navigation:not(.vue) > ul > li > ul > li { + position: relative; + box-sizing: border-box; +} + +#app-navigation:not(.vue) > ul > li { + display: inline-flex; + flex-wrap: wrap; + order: 1; + flex-shrink: 0; + margin: 0; + margin-bottom: 3px; + width: 100%; + border-radius: var(--border-radius-pill); +} + +#app-navigation:not(.vue) > ul > li.active, +#app-navigation:not(.vue) > ul > li.active > a, +#app-navigation:not(.vue) > ul > li a:active, +#app-navigation:not(.vue) > ul > li a:active > a, +#app-navigation:not(.vue) > ul > li a.selected, +#app-navigation:not(.vue) > ul > li a.selected > a, +#app-navigation:not(.vue) > ul > li a.active, +#app-navigation:not(.vue) > ul > li a.active > a { + background-color: var(--color-primary-light); +} + +#app-navigation:not(.vue) > ul > li > a, +#app-navigation:not(.vue) > ul > li > ul > li > a { + background-size: 16px 16px; + background-position: 14px center; + background-repeat: no-repeat; + display: block; + justify-content: space-between; + line-height: 44px; + min-height: 44px; + padding: 0 12px 0 14px; + overflow: hidden; + box-sizing: border-box; + white-space: nowrap; + text-overflow: ellipsis; + border-radius: var(--border-radius-pill); + color: var(--color-main-text); + flex: 1 1 0px; + z-index: 100; +} + +#app-navigation:not(.vue) > ul > li a:hover, +#app-navigation:not(.vue) > ul > li a:hover > a, +#app-navigation:not(.vue) > ul > li a:focus, +#app-navigation:not(.vue) > ul > li a:focus > a { + background-color: var(--color-background-hover); +} + +#app-navigation:not(.vue) > ul > li > a:first-child img, +#app-navigation:not(.vue) > ul > li > ul > li > a:first-child img { + margin-right: 11px; + width: 16px; + height: 16px; + filter: var(--background-invert-if-dark); +} diff --git a/css/style.css b/css/style.css index c67fff6..e3c356a 100644 --- a/css/style.css +++ b/css/style.css @@ -88,6 +88,7 @@ html[xmlns] .clearfix { display: block;} .wi-child-element { display: flex; border-bottom: #eee solid 1px; + flex-direction:row; } .wi-child-duration { padding: 10px; @@ -207,7 +208,9 @@ html[xmlns] .clearfix { display: block;} .project-name{ flex:0.3; } - +button.redButton { + background-color: red; +} .king-table-region .pagination-bar { height: 50px; margin: 20px 0px 20px 0px; @@ -271,6 +274,14 @@ td.ε_row { margin: 40px; flex-wrap: wrap; } +#timetracker-goals { + width: 100%; + /* display: block; */ + /*background-color: rgb(250, 251, 252);*/ + display: inline-block; + margin: 40px; + padding: 20px; +} .set-project{ line-height: 32px; min-width: 200px; @@ -344,6 +355,10 @@ td.ε_row { background-image: var(--icon-folder-000); } +.nav-icon-timer { + + background-image: var(--icon-play-000); + } .nav-icon-clients { background-image: var(--icon-contacts-000); } @@ -356,6 +371,9 @@ td.ε_row { .nav-icon-dashboard { background-image: var(--icon-desktop-000); } +.nav-icon-goals { + background-image: var(--icon-monitoring-000); +} /* .ui-button.primary { background-color: red; } @@ -455,4 +473,93 @@ td.ε_row { .ui-widget-header { background: var(--color-background-dark); color: var(--color-text-lighter); +} +.select2-search { background-color: var(--color-main-background); color: var(--color-text-darker)} +.select2-search input { background-color: var(--color-main-background); color: var(--color-text-darker)} +.select2-results { background-color: var(--color-main-background); color: var(--color-text-darker)} +.select2-selection { background-color: var(--color-main-background); color: var(--color-text-darker)} +.select2-container--default .select2-selection--single { + background-color: var(--color-main-background); + color: var(--color-text-darker) +} +.select2-container--default .select2-selection--single .select2-selection__rendered{ + line-height: 26px; + background-color: var(--color-main-background); + color: var(--color-text-darker) +} + +.select2-container--default .select2-selection--single .select2-selection__placeholder{ + background-color: var(--color-main-background); + color: var(--color-text-lighter) +} +.select2-container--default .select2-selection--multiple .select2-selection__choice { + background-color: var(--color-main-background); + color: var(--color-text-lighter); +} +.select2-container--default .select2-selection--multiple { + background-color: var(--color-main-background); +} +.select2-container--default.select2-container--focus .select2-selection--multiple { + border: solid var(--color-text-lighter) 1px; +} + +#report-range{ + /*var(--color-background-dark);*/ + +} +.select2-dropdown { + background-color: var(--color-background-dark); +} +.ui-button{ + background-color: var(--color-main-background); + color: var(--color-text-normal); +} +.ui-widget-content { + background-color: var(--color-main-background); + color: var(--color-text-normal); +} +.select-project-color { + display: inline-block; + width: 9px; + height: 5px; + margin: 3px; + border-radius: 100%; +} + +.select-project { + /*font-size: 24px;*/ +} +.tags-select { + width:200px; +} +.project-select { + width:200px; +} +@media screen and (max-width: 700px) { + .wi-child-element { + display: inline-flex; + flex-direction:column; + width: 100%; + } + .wi-trash { + display: inline; + } + .wi-child-duration { + text-align: left; + } + .wi-child{ + border-bottom: 2px var(--color-background-darker) solid; + } + .tags-select { + width:auto; + } + .project-select { + width:auto; + } + .wi-play{ + display:table; + margin: 0 auto; + } + + } \ No newline at end of file diff --git a/img/app.svg b/img/app.svg index fe370f8..df62f45 100644 --- a/img/app.svg +++ b/img/app.svg @@ -7,50 +7,50 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - height="32" - width="32" - version="1" - viewBox="0 0 32 32" - id="svg4" + version="1.1" + id="Capa_1" + x="0px" + y="0px" + viewBox="0 0 16 16" + style="enable-background:new 0 0 16 16;" + xml:space="preserve" sodipodi:docname="app.svg" - inkscape:version="0.92.1 r"> - - - - image/svg+xml - - - - - - - + inkscape:version="1.0.2 (e86c870879, 2021-01-15)">image/svg+xml + + + + + + diff --git a/img/play-button.svg b/img/play-button.svg index 9f46031..218d9a5 100644 --- a/img/play-button.svg +++ b/img/play-button.svg @@ -1,41 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/img/stop-button.svg b/img/stop-button.svg index d64c4ee..ffa7b97 100644 --- a/img/stop-button.svg +++ b/img/stop-button.svg @@ -1,39 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/js/Chart.min.js b/js/Chart.min.js deleted file mode 100644 index 653e7cf..0000000 --- a/js/Chart.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/*! - * Chart.js - * http://chartjs.org/ - * Version: 2.7.3 - * - * Copyright 2018 Chart.js Contributors - * Released under the MIT license - * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md - */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Chart=t()}}(function(){return function o(r,s,l){function u(e,t){if(!s[e]){if(!r[e]){var i="function"==typeof require&&require;if(!t&&i)return i(e,!0);if(d)return d(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var a=s[e]={exports:{}};r[e][0].call(a.exports,function(t){return u(r[e][1][t]||t)},a,a.exports,o,r,s,l)}return s[e].exports}for(var d="function"==typeof require&&require,t=0;t');var i=t.data,n=i.datasets,a=i.labels;if(n.length)for(var o=0;o'),a[o]&&e.push(a[o]),e.push("");return e.push(""),e.join("")},legend:{labels:{generateLabels:function(l){var u=l.data;return u.labels.length&&u.datasets.length?u.labels.map(function(t,e){var i=l.getDatasetMeta(0),n=u.datasets[0],a=i.data[e],o=a&&a.custom||{},r=A.valueAtIndexOrDefault,s=l.options.elements.arc;return{text:t,fillStyle:o.backgroundColor?o.backgroundColor:r(n.backgroundColor,e,s.backgroundColor),strokeStyle:o.borderColor?o.borderColor:r(n.borderColor,e,s.borderColor),lineWidth:o.borderWidth?o.borderWidth:r(n.borderWidth,e,s.borderWidth),hidden:isNaN(n.data[e])||i.data[e].hidden,index:e}}):[]}},onClick:function(t,e){var i,n,a,o=e.index,r=this.chart;for(i=0,n=(r.data.datasets||[]).length;i=Math.PI?-1:f<-Math.PI?1:0))+h,p=Math.cos(f),m=Math.sin(f),v=Math.cos(g),b=Math.sin(g),x=f<=0&&0<=g||f<=2*Math.PI&&2*Math.PI<=g,y=f<=.5*Math.PI&&.5*Math.PI<=g||f<=2.5*Math.PI&&2.5*Math.PI<=g,k=f<=-Math.PI&&-Math.PI<=g||f<=Math.PI&&Math.PI<=g,M=f<=.5*-Math.PI&&.5*-Math.PI<=g||f<=1.5*Math.PI&&1.5*Math.PI<=g,w=c/100,C=k?-1:Math.min(p*(p<0?1:w),v*(v<0?1:w)),S=M?-1:Math.min(m*(m<0?1:w),b*(b<0?1:w)),_=x?1:Math.max(p*(0');var i=t.data,n=i.datasets,a=i.labels;if(n.length)for(var o=0;o'),a[o]&&e.push(a[o]),e.push("");return e.push(""),e.join("")},legend:{labels:{generateLabels:function(s){var l=s.data;return l.labels.length&&l.datasets.length?l.labels.map(function(t,e){var i=s.getDatasetMeta(0),n=l.datasets[0],a=i.data[e].custom||{},o=k.valueAtIndexOrDefault,r=s.options.elements.arc;return{text:t,fillStyle:a.backgroundColor?a.backgroundColor:o(n.backgroundColor,e,r.backgroundColor),strokeStyle:a.borderColor?a.borderColor:o(n.borderColor,e,r.borderColor),lineWidth:a.borderWidth?a.borderWidth:o(n.borderWidth,e,r.borderWidth),hidden:isNaN(n.data[e])||i.data[e].hidden,index:e}}):[]}},onClick:function(t,e){var i,n,a,o=e.index,r=this.chart;for(i=0,n=(r.data.datasets||[]).length;i=e.numSteps?(o.callback(e.onAnimationComplete,[e],i),i.animating=!1,n.splice(a,1)):++a}}},{26:26,46:46}],24:[function(t,e,i){"use strict";var s=t(22),l=t(23),c=t(26),h=t(46),a=t(29),o=t(31),f=t(49),g=t(32),p=t(34),n=t(36);e.exports=function(u){function d(t){return"top"===t||"bottom"===t}u.types={},u.instances={},u.controllers={},h.extend(u.prototype,{construct:function(t,e){var i,n,a=this;(n=(i=(i=e)||{}).data=i.data||{}).datasets=n.datasets||[],n.labels=n.labels||[],i.options=h.configMerge(c.global,c[i.type],i.options||{}),e=i;var o=f.acquireContext(t,e),r=o&&o.canvas,s=r&&r.height,l=r&&r.width;a.id=h.uid(),a.ctx=o,a.canvas=r,a.config=e,a.width=l,a.height=s,a.aspectRatio=s?l/s:null,a.options=e.options,a._bufferedRender=!1,(a.chart=a).controller=a,u.instances[a.id]=a,Object.defineProperty(a,"data",{get:function(){return a.config.data},set:function(t){a.config.data=t}}),o&&r?(a.initialize(),a.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return g.notify(t,"beforeInit"),h.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.ensureScalesHaveIDs(),t.buildOrUpdateScales(),t.initToolTip(),g.notify(t,"afterInit"),t},clear:function(){return h.canvas.clear(this),this},stop:function(){return l.cancelAnimation(this),this},resize:function(t){var e=this,i=e.options,n=e.canvas,a=i.maintainAspectRatio&&e.aspectRatio||null,o=Math.max(0,Math.floor(h.getMaximumWidth(n))),r=Math.max(0,Math.floor(a?o/a:h.getMaximumHeight(n)));if((e.width!==o||e.height!==r)&&(n.width=e.width=o,n.height=e.height=r,n.style.width=o+"px",n.style.height=r+"px",h.retinaScale(e,i.devicePixelRatio),!t)){var s={width:o,height:r};g.notify(e,"resize",[s]),e.options.onResize&&e.options.onResize(e,s),e.stop(),e.update({duration:e.options.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},i=t.scale;h.each(e.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),h.each(e.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),i&&(i.id=i.id||"scale")},buildOrUpdateScales:function(){var r=this,t=r.options,s=r.scales||{},e=[],l=Object.keys(s).reduce(function(t,e){return t[e]=!1,t},{});t.scales&&(e=e.concat((t.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category",dposition:"bottom"}}),(t.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear",dposition:"left"}}))),t.scale&&e.push({options:t.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),h.each(e,function(t){var e=t.options,i=e.id,n=h.valueOrDefault(e.type,t.dtype);d(e.position)!==d(t.dposition)&&(e.position=t.dposition),l[i]=!0;var a=null;if(i in s&&s[i].type===n)(a=s[i]).options=e,a.ctx=r.ctx,a.chart=r;else{var o=p.getScaleConstructor(n);if(!o)return;a=new o({id:i,type:n,options:e,ctx:r.ctx,chart:r}),s[a.id]=a}a.mergeTicksOptions(),t.isDefault&&(r.scale=a)}),h.each(l,function(t,e){t||delete s[e]}),r.scales=s,p.addScalesToLayout(this)},buildOrUpdateControllers:function(){var o=this,r=[],s=[];return h.each(o.data.datasets,function(t,e){var i=o.getDatasetMeta(e),n=t.type||o.config.type;if(i.type&&i.type!==n&&(o.destroyDatasetMeta(e),i=o.getDatasetMeta(e)),i.type=n,r.push(i.type),i.controller)i.controller.updateIndex(e),i.controller.linkScales();else{var a=u.controllers[i.type];if(void 0===a)throw new Error('"'+i.type+'" is not a chart type.');i.controller=new a(o,e),s.push(i.controller)}},o),s},resetElements:function(){var i=this;h.each(i.data.datasets,function(t,e){i.getDatasetMeta(e).controller.reset()},i)},reset:function(){this.resetElements(),this.tooltip.initialize()},update:function(t){var e,i,n=this;if(t&&"object"==typeof t||(t={duration:t,lazy:arguments[1]}),i=(e=n).options,h.each(e.scales,function(t){o.removeBox(e,t)}),i=h.configMerge(u.defaults.global,u.defaults[e.config.type],i),e.options=e.config.options=i,e.ensureScalesHaveIDs(),e.buildOrUpdateScales(),e.tooltip._options=i.tooltips,e.tooltip.initialize(),g._invalidate(n),!1!==g.notify(n,"beforeUpdate")){n.tooltip._data=n.data;var a=n.buildOrUpdateControllers();h.each(n.data.datasets,function(t,e){n.getDatasetMeta(e).controller.buildOrUpdateElements()},n),n.updateLayout(),n.options.animation&&n.options.animation.duration&&h.each(a,function(t){t.reset()}),n.updateDatasets(),n.tooltip.initialize(),n.lastActive=[],g.notify(n,"afterUpdate"),n._bufferedRender?n._bufferedRequest={duration:t.duration,easing:t.easing,lazy:t.lazy}:n.render(t)}},updateLayout:function(){!1!==g.notify(this,"beforeLayout")&&(o.update(this,this.width,this.height),g.notify(this,"afterScaleUpdate"),g.notify(this,"afterLayout"))},updateDatasets:function(){if(!1!==g.notify(this,"beforeDatasetsUpdate")){for(var t=0,e=this.data.datasets.length;t=e[t].length&&e[t].push({}),!e[t][a].type||r.type&&r.type!==e[t][a].type?g.merge(e[t][a],[l.getScaleDefaults(o),r]):g.merge(e[t][a],r)}else g._merger(t,e,i,n)}})},g.where=function(t,e){if(g.isArray(t)&&Array.prototype.filter)return t.filter(e);var i=[];return g.each(t,function(t){e(t)&&i.push(t)}),i},g.findIndex=Array.prototype.findIndex?function(t,e,i){return t.findIndex(e,i)}:function(t,e,i){i=void 0===i?t:i;for(var n=0,a=t.length;n=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},g.previousItem=function(t,e,i){return i?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},g.niceNum=function(t,e){var i=Math.floor(g.log10(t)),n=t/Math.pow(10,i);return(e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10)*Math.pow(10,i)},g.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},g.getRelativePosition=function(t,e){var i,n,a=t.originalEvent||t,o=t.target||t.srcElement,r=o.getBoundingClientRect(),s=a.touches;n=s&&0i.length){for(var l=0;le&&(e=t.length)}),e},g.color=n?function(t){return t instanceof CanvasGradient&&(t=a.global.defaultColor),n(t)}:function(t){return console.error("Color.js not found!"),t},g.getHoverColor=function(t){return t instanceof CanvasPattern?t:g.color(t).saturate(.5).darken(.1).rgbString()}}},{26:26,3:3,34:34,46:46}],29:[function(t,e,i){"use strict";var n=t(46);function s(t,e){return t.native?{x:t.x,y:t.y}:n.getRelativePosition(t,e)}function l(t,e){var i,n,a,o,r;for(n=0,o=t.data.datasets.length;nt.maxHeight){o--;break}o++,l=r*s}t.labelRotation=o},afterCalculateTickRotation:function(){H.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){H.callback(this.options.beforeFit,[this])},fit:function(){var t=this,e=t.minSize={width:0,height:0},i=k(t._ticks),n=t.options,a=n.ticks,o=n.scaleLabel,r=n.gridLines,s=n.display,l=t.isHorizontal(),u=w(a),d=n.gridLines.tickMarkLength;if(e.width=l?t.isFullWidth()?t.maxWidth-t.margins.left-t.margins.right:t.maxWidth:s&&r.drawTicks?d:0,e.height=l?s&&r.drawTicks?d:0:t.maxHeight,o.display&&s){var c=C(o)+H.options.toPadding(o.padding).height;l?e.height+=c:e.width+=c}if(a.display&&s){var h=H.longestText(t.ctx,u.font,i,t.longestTextCache),f=H.numberOfLabelLines(i),g=.5*u.size,p=t.options.ticks.padding;if(l){t.longestLabelWidth=h;var m=H.toRadians(t.labelRotation),v=Math.cos(m),b=Math.sin(m)*h+u.size*f+g*(f-1)+g;e.height=Math.min(t.maxHeight,e.height+b+p),t.ctx.font=u.font;var x=M(t.ctx,i[0],u.font),y=M(t.ctx,i[i.length-1],u.font);0!==t.labelRotation?(t.paddingLeft="bottom"===n.position?v*x+3:v*g+3,t.paddingRight="bottom"===n.position?v*g+3:v*y+3):(t.paddingLeft=x/2+3,t.paddingRight=y/2+3)}else a.mirror?h=0:h+=p+g,e.width=Math.min(t.maxWidth,e.width+h),t.paddingTop=u.size/2,t.paddingBottom=u.size/2}t.handleMargins(),t.width=e.width,t.height=e.height},handleMargins:function(){var t=this;t.margins&&(t.paddingLeft=Math.max(t.paddingLeft-t.margins.left,0),t.paddingTop=Math.max(t.paddingTop-t.margins.top,0),t.paddingRight=Math.max(t.paddingRight-t.margins.right,0),t.paddingBottom=Math.max(t.paddingBottom-t.margins.bottom,0))},afterFit:function(){H.callback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(H.isNullOrUndef(t))return NaN;if("number"==typeof t&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},getLabelForIndex:H.noop,getPixelForValue:H.noop,getValueForPixel:H.noop,getPixelForTick:function(t){var e=this,i=e.options.offset;if(e.isHorizontal()){var n=(e.width-(e.paddingLeft+e.paddingRight))/Math.max(e._ticks.length-(i?0:1),1),a=n*t+e.paddingLeft;i&&(a+=n/2);var o=e.left+Math.round(a);return o+=e.isFullWidth()?e.margins.left:0}var r=e.height-(e.paddingTop+e.paddingBottom);return e.top+t*(r/(e._ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var i=(e.width-(e.paddingLeft+e.paddingRight))*t+e.paddingLeft,n=e.left+Math.round(i);return n+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this.min,e=this.max;return this.beginAtZero?0:t<0&&e<0?e:0o.width-(o.paddingLeft+o.paddingRight)&&(e=1+Math.floor((c+s.autoSkipPadding)*l/(o.width-(o.paddingLeft+o.paddingRight)))),a&&al.height-e.height&&(c="bottom");var h=(u.left+u.right)/2,f=(u.top+u.bottom)/2;n="center"===c?(i=function(t){return t<=h},function(t){return h=l.width-e.width/2}),a=function(t){return t+e.width+s.caretSize+s.caretPadding>l.width},o=function(t){return t-e.width-s.caretSize-s.caretPadding<0},r=function(t){return t<=f?"top":"bottom"},i(s.x)?(d="left",a(s.x)&&(d="center",c=r(s.y))):n(s.x)&&(d="right",o(s.x)&&(d="center",c=r(s.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:d,yAlign:g.yAlign?g.yAlign:c}}(this,I=function(t,e){var i=t._chart.ctx,n=2*e.yPadding,a=0,o=e.body,r=o.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);r+=e.beforeBody.length+e.afterBody.length;var s=e.title.length,l=e.footer.length,u=e.titleFontSize,d=e.bodyFontSize,c=e.footerFontSize;n+=s*u,n+=s?(s-1)*e.titleSpacing:0,n+=s?e.titleMarginBottom:0,n+=r*d,n+=r?(r-1)*e.bodySpacing:0,n+=l?e.footerMarginTop:0,n+=l*c,n+=l?(l-1)*e.footerSpacing:0;var h=0,f=function(t){a=Math.max(a,i.measureText(t).width+h)};return i.font=R.fontString(u,e._titleFontStyle,e._titleFontFamily),R.each(e.title,f),i.font=R.fontString(d,e._bodyFontStyle,e._bodyFontFamily),R.each(e.beforeBody.concat(e.afterBody),f),h=e.displayColors?d+2:0,R.each(o,function(t){R.each(t.before,f),R.each(t.lines,f),R.each(t.after,f)}),h=0,i.font=R.fontString(c,e._footerFontStyle,e._footerFontFamily),R.each(e.footer,f),{width:a+=2*e.xPadding,height:n}}(this,C)),n=C,a=I,o=D,r=k._chart,s=n.x,l=n.y,u=n.caretSize,d=n.caretPadding,c=n.cornerRadius,h=o.xAlign,f=o.yAlign,g=u+d,p=c+d,"right"===h?s-=a.width:"center"===h&&((s-=a.width/2)+a.width>r.width&&(s=r.width-a.width),s<0&&(s=0)),"top"===f?l+=g:l-="bottom"===f?a.height+g:a.height/2,"center"===f?"left"===h?s+=g:"right"===h&&(s-=g):"left"===h?s-=p:"right"===h&&(s+=p),P={x:s,y:l}}else C.opacity=0;return C.xAlign=D.xAlign,C.yAlign=D.yAlign,C.x=P.x,C.y=P.y,C.width=I.width,C.height=I.height,C.caretX=A.x,C.caretY=A.y,k._model=C,t&&M.custom&&M.custom.call(k,C),k},drawCaret:function(t,e){var i=this._chart.ctx,n=this._view,a=this.getCaretPosition(t,e,n);i.lineTo(a.x1,a.y1),i.lineTo(a.x2,a.y2),i.lineTo(a.x3,a.y3)},getCaretPosition:function(t,e,i){var n,a,o,r,s,l,u=i.caretSize,d=i.cornerRadius,c=i.xAlign,h=i.yAlign,f=t.x,g=t.y,p=e.width,m=e.height;if("center"===h)s=g+m/2,l="left"===c?(a=(n=f)-u,o=n,r=s+u,s-u):(a=(n=f+p)+u,o=n,r=s-u,s+u);else if(o=(n="left"===c?(a=f+d+u)-u:"right"===c?(a=f+p-d-u)-u:(a=i.caretX)-u,a+u),"top"===h)s=(r=g)-u,l=r;else{s=(r=g+m)+u,l=r;var v=o;o=n,n=v}return{x1:n,x2:a,x3:o,y1:r,y2:s,y3:l}},drawTitle:function(t,e,i,n){var a=e.title;if(a.length){i.textAlign=e._titleAlign,i.textBaseline="top";var o,r,s=e.titleFontSize,l=e.titleSpacing;for(i.fillStyle=h(e.titleFontColor,n),i.font=R.fontString(s,e._titleFontStyle,e._titleFontFamily),o=0,r=a.length;o=i.innerRadius&&o<=i.outerRadius;return l&&u}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,i=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*i,y:t.y+Math.sin(e)*i}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,i=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*i,y:t.y+Math.sin(e)*i}},draw:function(){var t=this._chart.ctx,e=this._view,i=e.startAngle,n=e.endAngle;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,i,n),t.arc(e.x,e.y,e.innerRadius,n,i,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})},{26:26,27:27,46:46}],38:[function(t,e,i){"use strict";var n=t(26),a=t(27),d=t(46),c=n.global;n._set("global",{elements:{line:{tension:.4,backgroundColor:c.defaultColor,borderWidth:3,borderColor:c.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0}}}),e.exports=a.extend({draw:function(){var t,e,i,n,a=this._view,o=this._chart.ctx,r=a.spanGaps,s=this._children.slice(),l=c.elements.line,u=-1;for(this._loop&&s.length&&s.push(s[0]),o.save(),o.lineCap=a.borderCapStyle||l.borderCapStyle,o.setLineDash&&o.setLineDash(a.borderDash||l.borderDash),o.lineDashOffset=a.borderDashOffset||l.borderDashOffset,o.lineJoin=a.borderJoinStyle||l.borderJoinStyle,o.lineWidth=a.borderWidth||l.borderWidth,o.strokeStyle=a.borderColor||c.defaultColor,o.beginPath(),u=-1,t=0;t=t.left&&1.01*t.right>=i.x&&i.y>=t.top&&1.01*t.bottom>=i.y)&&(n.strokeStyle=e.borderColor||c,n.lineWidth=d.valueOrDefault(e.borderWidth,u.global.elements.point.borderWidth),n.fillStyle=e.backgroundColor||c,d.canvas.drawPoint(n,a,r,s,l,o))}})},{26:26,27:27,46:46}],40:[function(t,e,i){"use strict";var n=t(26),a=t(27);function l(t){return void 0!==t._view.width}function o(t){var e,i,n,a,o=t._view;if(l(t)){var r=o.width/2;e=o.x-r,i=o.x+r,n=Math.min(o.y,o.base),a=Math.max(o.y,o.base)}else{var s=o.height/2;e=Math.min(o.x,o.base),i=Math.max(o.x,o.base),n=o.y-s,a=o.y+s}return{left:e,top:n,right:i,bottom:a}}n._set("global",{elements:{rectangle:{backgroundColor:n.global.defaultColor,borderColor:n.global.defaultColor,borderSkipped:"bottom",borderWidth:0}}}),e.exports=a.extend({draw:function(){var t,e,i,n,a,o,r,s=this._chart.ctx,l=this._view,u=l.borderWidth;if(r=l.horizontal?(t=l.base,e=l.x,i=l.y-l.height/2,n=l.y+l.height/2,a=t=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}return i},inLabelRange:function(t,e){if(!this._view)return!1;var i=o(this);return l(this)?t>=i.left&&t<=i.right:e>=i.top&&e<=i.bottom},inXRange:function(t){var e=o(this);return t>=e.left&&t<=e.right},inYRange:function(t){var e=o(this);return t>=e.top&&t<=e.bottom},getCenterPoint:function(){var t,e,i=this._view;return e=l(this)?(t=i.x,(i.y+i.base)/2):(t=(i.x+i.base)/2,i.y),{x:t,y:e}},getArea:function(){var t=this._view;return t.width*Math.abs(t.y-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}})},{26:26,27:27}],41:[function(t,e,i){"use strict";e.exports={},e.exports.Arc=t(37),e.exports.Line=t(38),e.exports.Point=t(39),e.exports.Rectangle=t(40)},{37:37,38:38,39:39,40:40}],42:[function(t,e,i){"use strict";var n=t(43);i=e.exports={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,i,n,a,o){if(o){var r=Math.min(o,a/2-1e-7,n/2-1e-7);t.moveTo(e+r,i),t.lineTo(e+n-r,i),t.arcTo(e+n,i,e+n,i+r,r),t.lineTo(e+n,i+a-r),t.arcTo(e+n,i+a,e+n-r,i+a,r),t.lineTo(e+r,i+a),t.arcTo(e,i+a,e,i+a-r,r),t.lineTo(e,i+r),t.arcTo(e,i,e+r,i,r),t.closePath(),t.moveTo(e,i)}else t.rect(e,i,n,a)},drawPoint:function(t,e,i,n,a,o){var r,s,l,u,d,c;if(o=o||0,!e||"object"!=typeof e||"[object HTMLImageElement]"!==(r=e.toString())&&"[object HTMLCanvasElement]"!==r){if(!(isNaN(i)||i<=0)){switch(t.save(),t.translate(n,a),t.rotate(o*Math.PI/180),t.beginPath(),e){default:t.arc(0,0,i,0,2*Math.PI),t.closePath();break;case"triangle":d=(s=3*i/Math.sqrt(3))*Math.sqrt(3)/2,t.moveTo(-s/2,d/3),t.lineTo(s/2,d/3),t.lineTo(0,-2*d/3),t.closePath();break;case"rect":c=1/Math.SQRT2*i,t.rect(-c,-c,2*c,2*c);break;case"rectRounded":var h=i/Math.SQRT2,f=-h,g=-h,p=Math.SQRT2*i;this.roundedRect(t,f,g,p,p,.425*i);break;case"rectRot":c=1/Math.SQRT2*i,t.moveTo(-c,0),t.lineTo(0,c),t.lineTo(c,0),t.lineTo(0,-c),t.closePath();break;case"cross":t.moveTo(0,i),t.lineTo(0,-i),t.moveTo(-i,0),t.lineTo(i,0);break;case"crossRot":l=Math.cos(Math.PI/4)*i,u=Math.sin(Math.PI/4)*i,t.moveTo(-l,-u),t.lineTo(l,u),t.moveTo(-l,u),t.lineTo(l,-u);break;case"star":t.moveTo(0,i),t.lineTo(0,-i),t.moveTo(-i,0),t.lineTo(i,0),l=Math.cos(Math.PI/4)*i,u=Math.sin(Math.PI/4)*i,t.moveTo(-l,-u),t.lineTo(l,u),t.moveTo(-l,u),t.lineTo(l,-u);break;case"line":t.moveTo(-i,0),t.lineTo(i,0);break;case"dash":t.moveTo(0,0),t.lineTo(i,0)}t.fill(),t.stroke(),t.restore()}}else t.drawImage(e,n-e.width/2,a-e.height/2,e.width,e.height)},clipArea:function(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()},unclipArea:function(t){t.restore()},lineTo:function(t,e,i,n){if(i.steppedLine)return"after"===i.steppedLine&&!n||"after"!==i.steppedLine&&n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y),void t.lineTo(i.x,i.y);i.tension?t.bezierCurveTo(n?e.controlPointPreviousX:e.controlPointNextX,n?e.controlPointPreviousY:e.controlPointNextY,n?i.controlPointNextX:i.controlPointPreviousX,n?i.controlPointNextY:i.controlPointPreviousY,i.x,i.y):t.lineTo(i.x,i.y)}};n.clear=i.clear,n.drawRoundedRectangle=function(t){t.beginPath(),i.roundedRect.apply(i,arguments)}},{43:43}],43:[function(t,e,i){"use strict";var n,d={noop:function(){},uid:(n=0,function(){return n++}),isNullOrUndef:function(t){return null==t},isArray:Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},isObject:function(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)},valueOrDefault:function(t,e){return void 0===t?e:t},valueAtIndexOrDefault:function(t,e,i){return d.valueOrDefault(d.isArray(t)?t[e]:t,i)},callback:function(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)},each:function(t,e,i,n){var a,o,r;if(d.isArray(t))if(o=t.length,n)for(a=o-1;0<=a;a--)e.call(i,t[a],a);else for(a=0;a
';var a=e.childNodes[0],o=e.childNodes[1];e._reset=function(){a.scrollLeft=1e6,a.scrollTop=1e6,o.scrollLeft=1e6,o.scrollTop=1e6};var r=function(){e._reset(),t()};return x(a,"scroll",r.bind(a,"expand")),x(o,"scroll",r.bind(o,"shrink")),e}((o=!(n=function(){if(c.resizer)return t(y("resize",i))}),r=[],function(){r=Array.prototype.slice.call(arguments),a=a||this,o||(o=!0,f.requestAnimFrame.call(window,function(){o=!1,n.apply(a,r)}))}));l=function(){if(c.resizer){var t=e.parentNode;t&&t!==h.parentNode&&t.insertBefore(h,t.firstChild),h._reset()}},u=(s=e)[g]||(s[g]={}),d=u.renderProxy=function(t){t.animationName===v&&l()},f.each(b,function(t){x(s,t,d)}),u.reflow=!!s.offsetParent,s.classList.add(m)}function o(t){var e,i,n,a=t[g]||{},o=a.resizer;delete a.resizer,i=(e=t)[g]||{},(n=i.renderProxy)&&(f.each(b,function(t){r(e,t,n)}),delete i.renderProxy),e.classList.remove(m),o&&o.parentNode&&o.parentNode.removeChild(o)}e.exports={_enabled:"undefined"!=typeof window&&"undefined"!=typeof document,initialize:function(){var t,e,i,n="from{opacity:0.99}to{opacity:1}";e="@-webkit-keyframes "+v+"{"+n+"}@keyframes "+v+"{"+n+"}."+m+"{-webkit-animation:"+v+" 0.001s;animation:"+v+" 0.001s;}",i=(t=this)._style||document.createElement("style"),t._style||(e="/* Chart.js */\n"+e,(t._style=i).setAttribute("type","text/css"),document.getElementsByTagName("head")[0].appendChild(i)),i.appendChild(document.createTextNode(e))},acquireContext:function(t,e){"string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas);var i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){var i=t.style,n=t.getAttribute("height"),a=t.getAttribute("width");if(t[g]={initial:{height:n,width:a,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",null===a||""===a){var o=l(t,"width");void 0!==o&&(t.width=o)}if(null===n||""===n)if(""===t.style.height)t.height=t.width/(e.options.aspectRatio||2);else{var r=l(t,"height");void 0!==o&&(t.height=r)}}(t,e),i):null},releaseContext:function(t){var i=t.canvas;if(i[g]){var n=i[g].initial;["height","width"].forEach(function(t){var e=n[t];f.isNullOrUndef(e)?i.removeAttribute(t):i.setAttribute(t,e)}),f.each(n.style||{},function(t,e){i.style[e]=t}),i.width=i.width,delete i[g]}},addEventListener:function(o,t,r){var e=o.canvas;if("resize"!==t){var i=r[g]||(r[g]={});x(e,t,(i.proxies||(i.proxies={}))[o.id+"_"+t]=function(t){var e,i,n,a;r((i=o,n=s[(e=t).type]||e.type,a=f.getRelativePosition(e,i),y(n,i,a.x,a.y,e)))})}else a(e,r,o)},removeEventListener:function(t,e,i){var n=t.canvas;if("resize"!==e){var a=((i[g]||{}).proxies||{})[t.id+"_"+e];a&&r(n,e,a)}else o(n)}},f.addEvent=x,f.removeEvent=r},{46:46}],49:[function(t,e,i){"use strict";var n=t(46),a=t(47),o=t(48),r=o._enabled?o:a;e.exports=n.extend({initialize:function(){},acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},r)},{46:46,47:47,48:48}],50:[function(t,e,i){"use strict";e.exports={},e.exports.filler=t(51),e.exports.legend=t(52),e.exports.title=t(53)},{51:51,52:52,53:53}],51:[function(t,e,i){"use strict";var u=t(26),h=t(41),d=t(46);u._set("global",{plugins:{filler:{propagate:!0}}});var f={dataset:function(t){var e=t.fill,i=t.chart,n=i.getDatasetMeta(e),a=n&&i.isDatasetVisible(e)&&n.dataset._children||[],o=a.length||0;return o?function(t,e){return e');for(var i=0;i'),t.data.datasets[i].label&&e.push(t.data.datasets[i].label),e.push("");return e.push(""),e.join("")}});var r=n.extend({initialize:function(t){D.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:o,update:function(t,e,i){var n=this;return n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n.margins=i,n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeBuildLabels(),n.buildLabels(),n.afterBuildLabels(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate(),n.minSize},afterUpdate:o,beforeSetDimensions:o,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:o,beforeBuildLabels:o,buildLabels:function(){var e=this,i=e.options.labels||{},t=D.callback(i.generateLabels,[e.chart],e)||[];i.filter&&(t=t.filter(function(t){return i.filter(t,e.chart.data)})),e.options.reverse&&t.reverse(),e.legendItems=t},afterBuildLabels:o,beforeFit:o,fit:function(){var n=this,t=n.options,a=t.labels,e=t.display,o=n.ctx,i=_.global,r=D.valueOrDefault,s=r(a.fontSize,i.defaultFontSize),l=r(a.fontStyle,i.defaultFontStyle),u=r(a.fontFamily,i.defaultFontFamily),d=D.fontString(s,l,u),c=n.legendHitBoxes=[],h=n.minSize,f=n.isHorizontal();if(h.height=f?(h.width=n.maxWidth,e?10:0):(h.width=e?10:0,n.maxHeight),e)if(o.font=d,f){var g=n.lineWidths=[0],p=n.legendItems.length?s+a.padding:0;o.textAlign="left",o.textBaseline="top",D.each(n.legendItems,function(t,e){var i=P(a,s)+s/2+o.measureText(t.text).width;g[g.length-1]+i+a.padding>=n.width&&(p+=s+a.padding,g[g.length]=n.left),c[e]={left:0,top:0,width:i,height:s},g[g.length-1]+=i+a.padding}),h.height+=p}else{var m=a.padding,v=n.columnWidths=[],b=a.padding,x=0,y=0,k=s+m;D.each(n.legendItems,function(t,e){var i=P(a,s)+s/2+o.measureText(t.text).width;y+k>h.height&&(b+=x+a.padding,v.push(x),y=x=0),x=Math.max(x,i),y+=k,c[e]={left:0,top:0,width:i,height:s}}),b+=x,v.push(x),h.width+=b}n.width=h.width,n.height=h.height},afterFit:o,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var c=this,h=c.options,f=h.labels,g=_.global,p=g.elements.line,m=c.width,v=c.lineWidths;if(h.display){var b,x=c.ctx,y=D.valueOrDefault,t=y(f.fontColor,g.defaultFontColor),k=y(f.fontSize,g.defaultFontSize),e=y(f.fontStyle,g.defaultFontStyle),i=y(f.fontFamily,g.defaultFontFamily),n=D.fontString(k,e,i);x.textAlign="left",x.textBaseline="middle",x.lineWidth=.5,x.strokeStyle=t,x.fillStyle=t,x.font=n;var M=P(f,k),w=c.legendHitBoxes,C=c.isHorizontal();b=C?{x:c.left+(m-v[0])/2,y:c.top+f.padding,line:0}:{x:c.left+f.padding,y:c.top+f.padding,line:0};var S=k+f.padding;D.each(c.legendItems,function(t,e){var i,n,a,o,r,s=x.measureText(t.text).width,l=M+k/2+s,u=b.x,d=b.y;C?m<=u+l&&(d=b.y+=S,b.line++,u=b.x=c.left+(m-v[b.line])/2):d+S>c.bottom&&(u=b.x=u+c.columnWidths[b.line]+f.padding,d=b.y=c.top+f.padding,b.line++),function(t,e,i){if(!(isNaN(M)||M<=0)){x.save(),x.fillStyle=y(i.fillStyle,g.defaultColor),x.lineCap=y(i.lineCap,p.borderCapStyle),x.lineDashOffset=y(i.lineDashOffset,p.borderDashOffset),x.lineJoin=y(i.lineJoin,p.borderJoinStyle),x.lineWidth=y(i.lineWidth,p.borderWidth),x.strokeStyle=y(i.strokeStyle,g.defaultColor);var n=0===y(i.lineWidth,p.borderWidth);if(x.setLineDash&&x.setLineDash(y(i.lineDash,p.borderDash)),h.labels&&h.labels.usePointStyle){var a=k*Math.SQRT2/2,o=a/Math.SQRT2,r=t+o,s=e+o;D.canvas.drawPoint(x,i.pointStyle,a,r,s)}else n||x.strokeRect(t,e,M,k),x.fillRect(t,e,M,k);x.restore()}}(u,d,t),w[e].left=u,w[e].top=d,i=t,n=s,o=M+(a=k/2)+u,r=d+a,x.fillText(i.text,o,r),i.hidden&&(x.beginPath(),x.lineWidth=2,x.moveTo(o,r),x.lineTo(o+n,r),x.stroke()),C?b.x+=l+f.padding:b.y+=S})}},handleEvent:function(t){var e=this,i=e.options,n="mouseup"===t.type?"click":t.type,a=!1;if("mousemove"===n){if(!i.onHover)return}else{if("click"!==n)return;if(!i.onClick)return}var o=t.x,r=t.y;if(o>=e.left&&o<=e.right&&r>=e.top&&r<=e.bottom)for(var s=e.legendHitBoxes,l=0;l=u.left&&o<=u.left+u.width&&r>=u.top&&r<=u.top+u.height){if("click"===n){i.onClick.call(e,t.native,e.legendItems[l]),a=!0;break}if("mousemove"===n){i.onHover.call(e,t.native,e.legendItems[l]),a=!0;break}}}return a}});function s(t,e){var i=new r({ctx:t.ctx,options:e,chart:t});a.configure(t,i,e),a.addBox(t,i),t.legend=i}e.exports={id:"legend",_element:r,beforeInit:function(t){var e=t.options.legend;e&&s(t,e)},beforeUpdate:function(t){var e=t.options.legend,i=t.legend;e?(D.mergeIf(e,_.global.legend),i?(a.configure(t,i,e),i.options=e):s(t,e)):i&&(a.removeBox(t,i),delete t.legend)},afterEvent:function(t,e){var i=t.legend;i&&i.handleEvent(e)}}},{26:26,27:27,31:31,46:46}],53:[function(t,e,i){"use strict";var M=t(26),n=t(27),w=t(46),a=t(31),o=w.noop;M._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,lineHeight:1.2,padding:10,position:"top",text:"",weight:2e3}});var r=n.extend({initialize:function(t){w.extend(this,t),this.legendHitBoxes=[]},beforeUpdate:o,update:function(t,e,i){var n=this;return n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n.margins=i,n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeBuildLabels(),n.buildLabels(),n.afterBuildLabels(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate(),n.minSize},afterUpdate:o,beforeSetDimensions:o,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:o,beforeBuildLabels:o,buildLabels:o,afterBuildLabels:o,beforeFit:o,fit:function(){var t=this,e=w.valueOrDefault,i=t.options,n=i.display,a=e(i.fontSize,M.global.defaultFontSize),o=t.minSize,r=w.isArray(i.text)?i.text.length:1,s=w.options.toLineHeight(i.lineHeight,a),l=n?r*s+2*i.padding:0;t.isHorizontal()?(o.width=t.maxWidth,o.height=l):(o.width=l,o.height=t.maxHeight),t.width=o.width,t.height=o.height},afterFit:o,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,i=w.valueOrDefault,n=t.options,a=M.global;if(n.display){var o,r,s,l=i(n.fontSize,a.defaultFontSize),u=i(n.fontStyle,a.defaultFontStyle),d=i(n.fontFamily,a.defaultFontFamily),c=w.fontString(l,u,d),h=w.options.toLineHeight(n.lineHeight,l),f=h/2+n.padding,g=0,p=t.top,m=t.left,v=t.bottom,b=t.right;e.fillStyle=i(n.fontColor,a.defaultFontColor),e.font=c,t.isHorizontal()?(r=m+(b-m)/2,s=p+f,o=b-m):(r="left"===n.position?m+f:b-f,s=p+(v-p)/2,o=v-p,g=Math.PI*("left"===n.position?-.5:.5)),e.save(),e.translate(r,s),e.rotate(g),e.textAlign="center",e.textBaseline="middle";var x=n.text;if(w.isArray(x))for(var y=0,k=0;kr.max&&(r.max=i))})});r.min=isFinite(r.min)&&!isNaN(r.min)?r.min:0,r.max=isFinite(r.max)&&!isNaN(r.max)?r.max:1,this.handleTickRangeOptions()},getTickLimit:function(){var t,e=this.options.ticks;if(this.isHorizontal())t=Math.min(e.maxTicksLimit?e.maxTicksLimit:11,Math.ceil(this.width/50));else{var i=c.valueOrDefault(e.fontSize,n.global.defaultFontSize);t=Math.min(e.maxTicksLimit?e.maxTicksLimit:11,Math.ceil(this.height/(2*i)))}return t},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e=this,i=e.start,n=+e.getRightValue(t),a=e.end-i;return e.isHorizontal()?e.left+e.width/a*(n-i):e.bottom-e.height/a*(n-i)},getValueForPixel:function(t){var e=this,i=e.isHorizontal(),n=i?e.width:e.height,a=(i?t-e.left:e.bottom-t)/n;return e.start+(e.end-e.start)*a},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});a.registerScaleType("linear",i,e)}},{26:26,34:34,35:35,46:46}],56:[function(t,e,i){"use strict";var c=t(46),n=t(33);e.exports=function(t){var e=c.noop;t.LinearScaleBase=n.extend({getRightValue:function(t){return"string"==typeof t?+t:n.prototype.getRightValue.call(this,t)},handleTickRangeOptions:function(){var t=this,e=t.options.ticks;if(e.beginAtZero){var i=c.sign(t.min),n=c.sign(t.max);i<0&&n<0?t.max=0:0=t.max&&(a?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:e,handleDirectionalChanges:e,buildTicks:function(){var t=this,e=t.options.ticks,i=t.getTickLimit(),n={maxTicks:i=Math.max(2,i),min:e.min,max:e.max,precision:e.precision,stepSize:c.valueOrDefault(e.fixedStepSize,e.stepSize)},a=t.ticks=function(t,e){var i,n,a,o=[];if(t.stepSize&&0r.max&&(r.max=i),0!==i&&(null===r.minNotZero||ir.r&&(r.r=g.end,s.r=h),p.startr.b&&(r.b=p.end,s.b=h)}t.setReductions(o,r,s)}(this):(t=this,e=Math.min(t.height/2,t.width/2),t.drawingArea=Math.round(e),t.setCenterPoint(0,0,0,0))},setReductions:function(t,e,i){var n=e.l/Math.sin(i.l),a=Math.max(e.r-this.width,0)/Math.sin(i.r),o=-e.t/Math.cos(i.t),r=-Math.max(e.b-this.height,0)/Math.cos(i.b);n=s(n),a=s(a),o=s(o),r=s(r),this.drawingArea=Math.min(Math.round(t-(n+a)/2),Math.round(t-(o+r)/2)),this.setCenterPoint(n,a,o,r)},setCenterPoint:function(t,e,i,n){var a=this,o=a.width-e-a.drawingArea,r=t+a.drawingArea,s=i+a.drawingArea,l=a.height-n-a.drawingArea;a.xCenter=Math.round((r+o)/2+a.left),a.yCenter=Math.round((s+l)/2+a.top)},getIndexAngle:function(t){return t*(2*Math.PI/b(this))+(this.chart.options&&this.chart.options.startAngle?this.chart.options.startAngle:0)*Math.PI*2/360},getDistanceFromCenterForValue:function(t){var e=this;if(null===t)return 0;var i=e.drawingArea/(e.max-e.min);return e.options.ticks.reverse?(e.max-t)*i:(t-e.min)*i},getPointPosition:function(t,e){var i=this.getIndexAngle(t)-Math.PI/2;return{x:Math.round(Math.cos(i)*e)+this.xCenter,y:Math.round(Math.sin(i)*e)+this.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(){var t=this.min,e=this.max;return this.getPointPositionForValue(0,this.beginAtZero?0:t<0&&e<0?e:0>1)-1]||null,o=t[n],!a)return{lo:null,hi:o};if(o[e]i))return{lo:a,hi:o};s=n-1}}return{lo:o,hi:null}}(t,e,i),o=a.lo?a.hi?a.lo:t[t.length-2]:t[0],r=a.lo?a.hi?a.hi:t[t.length-1]:t[1],s=r[e]-o[e],l=s?(i-o[e])/s:0,u=(r[n]-o[n])*l;return o[n]+u}function C(t,e){var i=e.parser,n=e.parser||e.format;return"function"==typeof i?i(t):"string"==typeof t&&"string"==typeof n?x(t,n):(t instanceof x||(t=x(t)),t.isValid()?t:"function"==typeof n?n(t):t)}function S(t,e){if(m.isNullOrUndef(t))return null;var i=e.options.time,n=C(e.getRightValue(t),i);return n.isValid()?(i.round&&n.startOf(i.round),n.valueOf()):null}function _(t){for(var e=k.indexOf(t)+1,i=k.length;e=k.indexOf(e);a--)if(o=k[a],y[o].common&&r.as(o)>=t.length)return o;return k[e?k.indexOf(e):0]}(b,m.minUnit,h.min,h.max),h._majorUnit=_(h._unit),h._table=function(t,e,i,n){if("linear"===n||!t.length)return[{time:e,pos:0},{time:i,pos:1}];var a,o,r,s,l,u=[],d=[e];for(a=0,o=t.length;a'+o+"";this.showCustomRangeLabel&&(m+='
  • '+this.locale.customRangeLabel+"
  • "),m+="",this.container.find(".ranges").prepend(m)}"function"==typeof a&&(this.callback=a),this.timePicker||(this.startDate=this.startDate.startOf("day"),this.endDate=this.endDate.endOf("day"),this.container.find(".calendar-time").hide()),this.timePicker&&this.autoApply&&(this.autoApply=!1),this.autoApply&&this.container.addClass("auto-apply"),"object"==typeof e.ranges&&this.container.addClass("show-ranges"),this.singleDatePicker&&(this.container.addClass("single"),this.container.find(".drp-calendar.left").addClass("single"),this.container.find(".drp-calendar.left").show(),this.container.find(".drp-calendar.right").hide(),this.timePicker||this.container.addClass("auto-apply")),(void 0===e.ranges&&!this.singleDatePicker||this.alwaysShowCalendars)&&this.container.addClass("show-calendar"),this.container.addClass("opens"+this.opens),this.container.find(".applyBtn, .cancelBtn").addClass(this.buttonClasses),this.applyButtonClasses.length&&this.container.find(".applyBtn").addClass(this.applyButtonClasses),this.cancelButtonClasses.length&&this.container.find(".cancelBtn").addClass(this.cancelButtonClasses),this.container.find(".applyBtn").html(this.locale.applyLabel),this.container.find(".cancelBtn").html(this.locale.cancelLabel),this.container.find(".drp-calendar").on("click.daterangepicker",".prev",R.proxy(this.clickPrev,this)).on("click.daterangepicker",".next",R.proxy(this.clickNext,this)).on("mousedown.daterangepicker","td.available",R.proxy(this.clickDate,this)).on("mouseenter.daterangepicker","td.available",R.proxy(this.hoverDate,this)).on("change.daterangepicker","select.yearselect",R.proxy(this.monthOrYearChanged,this)).on("change.daterangepicker","select.monthselect",R.proxy(this.monthOrYearChanged,this)).on("change.daterangepicker","select.hourselect,select.minuteselect,select.secondselect,select.ampmselect",R.proxy(this.timeChanged,this)),this.container.find(".ranges").on("click.daterangepicker","li",R.proxy(this.clickRange,this)),this.container.find(".drp-buttons").on("click.daterangepicker","button.applyBtn",R.proxy(this.clickApply,this)).on("click.daterangepicker","button.cancelBtn",R.proxy(this.clickCancel,this)),this.element.is("input")||this.element.is("button")?this.element.on({"click.daterangepicker":R.proxy(this.show,this),"focus.daterangepicker":R.proxy(this.show,this),"keyup.daterangepicker":R.proxy(this.elementChanged,this),"keydown.daterangepicker":R.proxy(this.keydown,this)}):(this.element.on("click.daterangepicker",R.proxy(this.toggle,this)),this.element.on("keydown.daterangepicker",R.proxy(this.toggle,this))),this.updateElement()};return i.prototype={constructor:i,setStartDate:function(t){"string"==typeof t&&(this.startDate=H(t,this.locale.format)),"object"==typeof t&&(this.startDate=H(t)),this.timePicker||(this.startDate=this.startDate.startOf("day")),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement),this.minDate&&this.startDate.isBefore(this.minDate)&&(this.startDate=this.minDate.clone(),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement)),this.maxDate&&this.startDate.isAfter(this.maxDate)&&(this.startDate=this.maxDate.clone(),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.floor(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement)),this.isShowing||this.updateElement(),this.updateMonthsInView()},setEndDate:function(t){"string"==typeof t&&(this.endDate=H(t,this.locale.format)),"object"==typeof t&&(this.endDate=H(t)),this.timePicker||(this.endDate=this.endDate.add(1,"d").startOf("day").subtract(1,"second")),this.timePicker&&this.timePickerIncrement&&this.endDate.minute(Math.round(this.endDate.minute()/this.timePickerIncrement)*this.timePickerIncrement),this.endDate.isBefore(this.startDate)&&(this.endDate=this.startDate.clone()),this.maxDate&&this.endDate.isAfter(this.maxDate)&&(this.endDate=this.maxDate.clone()),this.maxSpan&&this.startDate.clone().add(this.maxSpan).isBefore(this.endDate)&&(this.endDate=this.startDate.clone().add(this.maxSpan)),this.previousRightTime=this.endDate.clone(),this.container.find(".drp-selected").html(this.startDate.format(this.locale.format)+this.locale.separator+this.endDate.format(this.locale.format)),this.isShowing||this.updateElement(),this.updateMonthsInView()},isInvalidDate:function(){return!1},isCustomDate:function(){return!1},updateView:function(){this.timePicker&&(this.renderTimePicker("left"),this.renderTimePicker("right"),this.endDate?this.container.find(".right .calendar-time select").removeAttr("disabled").removeClass("disabled"):this.container.find(".right .calendar-time select").attr("disabled","disabled").addClass("disabled")),this.endDate&&this.container.find(".drp-selected").html(this.startDate.format(this.locale.format)+this.locale.separator+this.endDate.format(this.locale.format)),this.updateMonthsInView(),this.updateCalendars(),this.updateFormInputs()},updateMonthsInView:function(){if(this.endDate){if(!this.singleDatePicker&&this.leftCalendar.month&&this.rightCalendar.month&&(this.startDate.format("YYYY-MM")==this.leftCalendar.month.format("YYYY-MM")||this.startDate.format("YYYY-MM")==this.rightCalendar.month.format("YYYY-MM"))&&(this.endDate.format("YYYY-MM")==this.leftCalendar.month.format("YYYY-MM")||this.endDate.format("YYYY-MM")==this.rightCalendar.month.format("YYYY-MM")))return;this.leftCalendar.month=this.startDate.clone().date(2),this.linkedCalendars||this.endDate.month()==this.startDate.month()&&this.endDate.year()==this.startDate.year()?this.rightCalendar.month=this.startDate.clone().date(2).add(1,"month"):this.rightCalendar.month=this.endDate.clone().date(2)}else this.leftCalendar.month.format("YYYY-MM")!=this.startDate.format("YYYY-MM")&&this.rightCalendar.month.format("YYYY-MM")!=this.startDate.format("YYYY-MM")&&(this.leftCalendar.month=this.startDate.clone().date(2),this.rightCalendar.month=this.startDate.clone().date(2).add(1,"month"));this.maxDate&&this.linkedCalendars&&!this.singleDatePicker&&this.rightCalendar.month>this.maxDate&&(this.rightCalendar.month=this.maxDate.clone().date(2),this.leftCalendar.month=this.maxDate.clone().date(2).subtract(1,"month"))},updateCalendars:function(){if(this.timePicker){var t,e,a,i;if(this.endDate){if(t=parseInt(this.container.find(".left .hourselect").val(),10),e=parseInt(this.container.find(".left .minuteselect").val(),10),a=this.timePickerSeconds?parseInt(this.container.find(".left .secondselect").val(),10):0,!this.timePicker24Hour)"PM"===(i=this.container.find(".left .ampmselect").val())&&t<12&&(t+=12),"AM"===i&&12===t&&(t=0)}else if(t=parseInt(this.container.find(".right .hourselect").val(),10),e=parseInt(this.container.find(".right .minuteselect").val(),10),a=this.timePickerSeconds?parseInt(this.container.find(".right .secondselect").val(),10):0,!this.timePicker24Hour)"PM"===(i=this.container.find(".right .ampmselect").val())&&t<12&&(t+=12),"AM"===i&&12===t&&(t=0);this.leftCalendar.month.hour(t).minute(e).second(a),this.rightCalendar.month.hour(t).minute(e).second(a)}this.renderCalendar("left"),this.renderCalendar("right"),this.container.find(".ranges li").removeClass("active"),null!=this.endDate&&this.calculateChosenLabel()},renderCalendar:function(t){var e,a=(e="left"==t?this.leftCalendar:this.rightCalendar).month.month(),i=e.month.year(),s=e.month.hour(),n=e.month.minute(),r=e.month.second(),o=H([i,a]).daysInMonth(),h=H([i,a,1]),l=H([i,a,o]),c=H(h).subtract(1,"month").month(),d=H(h).subtract(1,"month").year(),m=H([d,c]).daysInMonth(),f=h.day();(e=[]).firstDay=h,e.lastDay=l;for(var p=0;p<6;p++)e[p]=[];var u=m-f+this.locale.firstDay+1;m');C+="",C+="",(this.showWeekNumbers||this.showISOWeekNumbers)&&(C+=""),k&&!k.isBefore(e.firstDay)||this.linkedCalendars&&"left"!=t?C+="":C+='';var v=this.locale.monthNames[e[1][1].month()]+e[1][1].format(" YYYY");if(this.showDropdowns){for(var Y=e[1][1].month(),w=e[1][1].year(),P=b&&b.year()||this.maxYear,x=k&&k.year()||this.minYear,M=w==x,S=w==P,I='";for(var A='")}if(C+=''+v+"",b&&!b.isAfter(e.lastDay)||this.linkedCalendars&&"right"!=t&&!this.singleDatePicker?C+="":C+='',C+="",C+="",(this.showWeekNumbers||this.showISOWeekNumbers)&&(C+=''+this.locale.weekLabel+""),R.each(this.locale.daysOfWeek,function(t,e){C+=""+e+""}),C+="",C+="",C+="",null==this.endDate&&this.maxSpan){var E=this.startDate.clone().add(this.maxSpan).endOf("day");b&&!E.isBefore(b)||(b=E)}for(y=0;y<6;y++){C+="",this.showWeekNumbers?C+=''+e[y][0].week()+"":this.showISOWeekNumbers&&(C+=''+e[y][0].isoWeek()+"");for(g=0;g<7;g++){var W=[];e[y][g].isSame(new Date,"day")&&W.push("today"),5this.startDate&&e[y][g]'+e[y][g].date()+""}C+=""}C+="",C+="",this.container.find(".drp-calendar."+t+" .calendar-table").html(C)},renderTimePicker:function(t){if("right"!=t||this.endDate){var e,a,i,s=this.maxDate;if(!this.maxSpan||this.maxDate&&!this.startDate.clone().add(this.maxSpan).isAfter(this.maxDate)||(s=this.startDate.clone().add(this.maxSpan)),"left"==t)a=this.startDate.clone(),i=this.minDate;else if("right"==t){a=this.endDate.clone(),i=this.startDate;var n=this.container.find(".drp-calendar.right .calendar-time");if(""!=n.html()&&(a.hour(a.hour()||n.find(".hourselect option:selected").val()),a.minute(a.minute()||n.find(".minuteselect option:selected").val()),a.second(a.second()||n.find(".secondselect option:selected").val()),!this.timePicker24Hour)){var r=n.find(".ampmselect option:selected").val();"PM"===r&&a.hour()<12&&a.hour(a.hour()+12),"AM"===r&&12===a.hour()&&a.hour(0)}a.isBefore(this.startDate)&&(a=this.startDate.clone()),s&&a.isAfter(s)&&(a=s.clone())}e=' ",e+=': ",this.timePickerSeconds){e+=': "}if(!this.timePicker24Hour){e+='"}this.container.find(".drp-calendar."+t+" .calendar-time").html(e)}},updateFormInputs:function(){this.singleDatePicker||this.endDate&&(this.startDate.isBefore(this.endDate)||this.startDate.isSame(this.endDate))?this.container.find("button.applyBtn").removeAttr("disabled"):this.container.find("button.applyBtn").attr("disabled","disabled")},move:function(){var t,e={top:0,left:0},a=R(window).width();this.parentEl.is("body")||(e={top:this.parentEl.offset().top-this.parentEl.scrollTop(),left:this.parentEl.offset().left-this.parentEl.scrollLeft()},a=this.parentEl[0].clientWidth+this.parentEl.offset().left),t="up"==this.drops?this.element.offset().top-this.container.outerHeight()-e.top:this.element.offset().top+this.element.outerHeight()-e.top,this.container["up"==this.drops?"addClass":"removeClass"]("drop-up"),"left"==this.opens?(this.container.css({top:t,right:a-this.element.offset().left-this.element.outerWidth(),left:"auto"}),this.container.offset().left<0&&this.container.css({right:"auto",left:9})):"center"==this.opens?(this.container.css({top:t,left:this.element.offset().left-e.left+this.element.outerWidth()/2-this.container.outerWidth()/2,right:"auto"}),this.container.offset().left<0&&this.container.css({right:"auto",left:9})):(this.container.css({top:t,left:this.element.offset().left-e.left,right:"auto"}),this.container.offset().left+this.container.outerWidth()>R(window).width()&&this.container.css({left:"auto",right:0}))},show:function(t){this.isShowing||(this._outsideClickProxy=R.proxy(function(t){this.outsideClick(t)},this),R(document).on("mousedown.daterangepicker",this._outsideClickProxy).on("touchend.daterangepicker",this._outsideClickProxy).on("click.daterangepicker","[data-toggle=dropdown]",this._outsideClickProxy).on("focusin.daterangepicker",this._outsideClickProxy),R(window).on("resize.daterangepicker",R.proxy(function(t){this.move(t)},this)),this.oldStartDate=this.startDate.clone(),this.oldEndDate=this.endDate.clone(),this.previousRightTime=this.endDate.clone(),this.updateView(),this.container.show(),this.move(),this.element.trigger("show.daterangepicker",this),this.isShowing=!0)},hide:function(t){this.isShowing&&(this.endDate||(this.startDate=this.oldStartDate.clone(),this.endDate=this.oldEndDate.clone()),this.startDate.isSame(this.oldStartDate)&&this.endDate.isSame(this.oldEndDate)||this.callback(this.startDate.clone(),this.endDate.clone(),this.chosenLabel),this.updateElement(),R(document).off(".daterangepicker"),R(window).off(".daterangepicker"),this.container.hide(),this.element.trigger("hide.daterangepicker",this),this.isShowing=!1)},toggle:function(t){this.isShowing?this.hide():this.show()},outsideClick:function(t){var e=R(t.target);"focusin"==t.type||e.closest(this.element).length||e.closest(this.container).length||e.closest(".calendar-table").length||(this.hide(),this.element.trigger("outsideClick.daterangepicker",this))},showCalendars:function(){this.container.addClass("show-calendar"),this.move(),this.element.trigger("showCalendar.daterangepicker",this)},hideCalendars:function(){this.container.removeClass("show-calendar"),this.element.trigger("hideCalendar.daterangepicker",this)},clickRange:function(t){var e=t.target.getAttribute("data-range-key");if((this.chosenLabel=e)==this.locale.customRangeLabel)this.showCalendars();else{var a=this.ranges[e];this.startDate=a[0],this.endDate=a[1],this.timePicker||(this.startDate.startOf("day"),this.endDate.endOf("day")),this.alwaysShowCalendars||this.hideCalendars(),this.clickApply()}},clickPrev:function(t){R(t.target).parents(".drp-calendar").hasClass("left")?(this.leftCalendar.month.subtract(1,"month"),this.linkedCalendars&&this.rightCalendar.month.subtract(1,"month")):this.rightCalendar.month.subtract(1,"month"),this.updateCalendars()},clickNext:function(t){R(t.target).parents(".drp-calendar").hasClass("left")?this.leftCalendar.month.add(1,"month"):(this.rightCalendar.month.add(1,"month"),this.linkedCalendars&&this.leftCalendar.month.add(1,"month")),this.updateCalendars()},hoverDate:function(t){if(R(t.target).hasClass("available")){var e=R(t.target).attr("data-title"),a=e.substr(1,1),i=e.substr(3,1),r=R(t.target).parents(".drp-calendar").hasClass("left")?this.leftCalendar.calendar[a][i]:this.rightCalendar.calendar[a][i],o=this.leftCalendar,h=this.rightCalendar,l=this.startDate;this.endDate||this.container.find(".drp-calendar tbody td").each(function(t,e){if(!R(e).hasClass("week")){var a=R(e).attr("data-title"),i=a.substr(1,1),s=a.substr(3,1),n=R(e).parents(".drp-calendar").hasClass("left")?o.calendar[i][s]:h.calendar[i][s];n.isAfter(l)&&n.isBefore(r)||n.isSame(r,"day")?R(e).addClass("in-range"):R(e).removeClass("in-range")}})}},clickDate:function(t){if(R(t.target).hasClass("available")){var e=R(t.target).attr("data-title"),a=e.substr(1,1),i=e.substr(3,1),s=R(t.target).parents(".drp-calendar").hasClass("left")?this.leftCalendar.calendar[a][i]:this.rightCalendar.calendar[a][i];if(this.endDate||s.isBefore(this.startDate,"day")){if(this.timePicker){var n=parseInt(this.container.find(".left .hourselect").val(),10);if(!this.timePicker24Hour)"PM"===(h=this.container.find(".left .ampmselect").val())&&n<12&&(n+=12),"AM"===h&&12===n&&(n=0);var r=parseInt(this.container.find(".left .minuteselect").val(),10),o=this.timePickerSeconds?parseInt(this.container.find(".left .secondselect").val(),10):0;s=s.clone().hour(n).minute(r).second(o)}this.endDate=null,this.setStartDate(s.clone())}else if(!this.endDate&&s.isBefore(this.startDate))this.setEndDate(this.startDate.clone());else{if(this.timePicker){var h;n=parseInt(this.container.find(".right .hourselect").val(),10);if(!this.timePicker24Hour)"PM"===(h=this.container.find(".right .ampmselect").val())&&n<12&&(n+=12),"AM"===h&&12===n&&(n=0);r=parseInt(this.container.find(".right .minuteselect").val(),10),o=this.timePickerSeconds?parseInt(this.container.find(".right .secondselect").val(),10):0;s=s.clone().hour(n).minute(r).second(o)}this.setEndDate(s.clone()),this.autoApply&&(this.calculateChosenLabel(),this.clickApply())}this.singleDatePicker&&(this.setEndDate(this.startDate),this.timePicker||this.clickApply()),this.updateView(),t.stopPropagation()}},calculateChosenLabel:function(){var t=!0,e=0;for(var a in this.ranges){if(this.timePicker){var i=this.timePickerSeconds?"YYYY-MM-DD hh:mm:ss":"YYYY-MM-DD hh:mm";if(this.startDate.format(i)==this.ranges[a][0].format(i)&&this.endDate.format(i)==this.ranges[a][1].format(i)){t=!1,this.chosenLabel=this.container.find(".ranges li:eq("+e+")").addClass("active").attr("data-range-key");break}}else if(this.startDate.format("YYYY-MM-DD")==this.ranges[a][0].format("YYYY-MM-DD")&&this.endDate.format("YYYY-MM-DD")==this.ranges[a][1].format("YYYY-MM-DD")){t=!1,this.chosenLabel=this.container.find(".ranges li:eq("+e+")").addClass("active").attr("data-range-key");break}e++}t&&(this.showCustomRangeLabel?this.chosenLabel=this.container.find(".ranges li:last").addClass("active").attr("data-range-key"):this.chosenLabel=null,this.showCalendars())},clickApply:function(t){this.hide(),this.element.trigger("apply.daterangepicker",this)},clickCancel:function(t){this.startDate=this.oldStartDate,this.endDate=this.oldEndDate,this.hide(),this.element.trigger("cancel.daterangepicker",this)},monthOrYearChanged:function(t){var e=R(t.target).closest(".drp-calendar").hasClass("left"),a=e?"left":"right",i=this.container.find(".drp-calendar."+a),s=parseInt(i.find(".monthselect").val(),10),n=i.find(".yearselect").val();e||(nthis.maxDate.year()||n==this.maxDate.year()&&s>this.maxDate.month())&&(s=this.maxDate.month(),n=this.maxDate.year()),e?(this.leftCalendar.month.month(s).year(n),this.linkedCalendars&&(this.rightCalendar.month=this.leftCalendar.month.clone().add(1,"month"))):(this.rightCalendar.month.month(s).year(n),this.linkedCalendars&&(this.leftCalendar.month=this.rightCalendar.month.clone().subtract(1,"month"))),this.updateCalendars()},timeChanged:function(t){var e=R(t.target).closest(".drp-calendar"),a=e.hasClass("left"),i=parseInt(e.find(".hourselect").val(),10),s=parseInt(e.find(".minuteselect").val(),10),n=this.timePickerSeconds?parseInt(e.find(".secondselect").val(),10):0;if(!this.timePicker24Hour){var r=e.find(".ampmselect").val();"PM"===r&&i<12&&(i+=12),"AM"===r&&12===i&&(i=0)}if(a){var o=this.startDate.clone();o.hour(i),o.minute(s),o.second(n),this.setStartDate(o),this.singleDatePicker?this.endDate=this.startDate.clone():this.endDate&&this.endDate.format("YYYY-MM-DD")==o.format("YYYY-MM-DD")&&this.endDate.isBefore(o)&&this.setEndDate(o.clone())}else if(this.endDate){var h=this.endDate.clone();h.hour(i),h.minute(s),h.second(n),this.setEndDate(h)}this.updateCalendars(),this.updateFormInputs(),this.renderTimePicker("left"),this.renderTimePicker("right")},elementChanged:function(){if(this.element.is("input")&&this.element.val().length){var t=this.element.val().split(this.locale.separator),e=null,a=null;2===t.length&&(e=H(t[0],this.locale.format),a=H(t[1],this.locale.format)),(this.singleDatePicker||null===e||null===a)&&(a=e=H(this.element.val(),this.locale.format)),e.isValid()&&a.isValid()&&(this.setStartDate(e),this.setEndDate(a),this.updateView())}},keydown:function(t){9!==t.keyCode&&13!==t.keyCode||this.hide(),27===t.keyCode&&(t.preventDefault(),t.stopPropagation(),this.hide())},updateElement:function(){if(this.element.is("input")&&this.autoUpdateInput){var t=this.startDate.format(this.locale.format);this.singleDatePicker||(t+=this.locale.separator+this.endDate.format(this.locale.format)),t!==this.element.val()&&this.element.val(t).trigger("change")}},remove:function(){this.container.remove(),this.element.off(".daterangepicker"),this.element.removeData()}},R.fn.daterangepicker=function(t,e){var a=R.extend(!0,{},R.fn.daterangepicker.defaultOptions,t);return this.each(function(){var t=R(this);t.data("daterangepicker")&&t.data("daterangepicker").remove(),t.data("daterangepicker",new i(t,a,e))}),this},i}); -//# sourceMappingURL=/sm/8cfffddf058dc09b67d92f8d849675e6b459dfb8ede5136cf5c98d10acf78cc3.map \ No newline at end of file diff --git a/js/i18n/af.js b/js/i18n/af.js deleted file mode 100644 index 87628ae..0000000 --- a/js/i18n/af.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/af",[],function(){return{errorLoading:function(){return"Die resultate kon nie gelaai word nie."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Verwyders asseblief "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Voer asseblief "+t+" of meer karakters";return n},loadingMore:function(){return"Meer resultate word gelaai…"},maximumSelected:function(e){var t="Kies asseblief net "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"Geen resultate gevind"},searching:function(){return"Besig…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/ar.js b/js/i18n/ar.js deleted file mode 100644 index 18b5edb..0000000 --- a/js/i18n/ar.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum;return"الرجاء حذف "+t+" عناصر"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"الرجاء إضافة "+t+" عناصر"},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){return"تستطيع إختيار "+e.maximum+" بنود فقط"},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/az.js b/js/i18n/az.js deleted file mode 100644 index 884c39e..0000000 --- a/js/i18n/az.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/bg.js b/js/i18n/bg.js deleted file mode 100644 index 2f4325a..0000000 --- a/js/i18n/bg.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/bs.js b/js/i18n/bs.js deleted file mode 100644 index e40cc50..0000000 --- a/js/i18n/bs.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bs",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspijelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/ca.js b/js/i18n/ca.js deleted file mode 100644 index d6a6abd..0000000 --- a/js/i18n/ca.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/cs.js b/js/i18n/cs.js deleted file mode 100644 index 8c0d466..0000000 --- a/js/i18n/cs.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadejte o jeden znak méně.":n<=4?"Prosím, zadejte o "+e(n,!0)+" znaky méně.":"Prosím, zadejte o "+n+" znaků méně."},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadejte ještě jeden znak.":n<=4?"Prosím, zadejte ještě další "+e(n,!0)+" znaky.":"Prosím, zadejte ještě dalších "+n+" znaků."},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku.":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky.":"Můžete zvolit maximálně "+n+" položek."},noResults:function(){return"Nenalezeny žádné položky."},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/da.js b/js/i18n/da.js deleted file mode 100644 index 081d1c7..0000000 --- a/js/i18n/da.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Angiv venligst "+t+" tegn mindre"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Angiv venligst "+t+" tegn mere"},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/de.js b/js/i18n/de.js deleted file mode 100644 index e1a0172..0000000 --- a/js/i18n/de.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/dsb.js b/js/i18n/dsb.js deleted file mode 100644 index c045040..0000000 --- a/js/i18n/dsb.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/dsb",[],function(){var e=["znamuško","znamušce","znamuška","znamuškow"],t=["zapisk","zapiska","zapiski","zapiskow"],n=function(t,n){if(t===1)return n[0];if(t===2)return n[1];if(t>2&&t<=4)return n[2];if(t>=5)return n[3]};return{errorLoading:function(){return"Wuslědki njejsu se dali zacytaś."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Pšosym lašuj "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Pšosym zapódaj nanejmjenjej "+r+" "+n(r,e)},loadingMore:function(){return"Dalšne wuslědki se zacytaju…"},maximumSelected:function(e){return"Móžoš jano "+e.maximum+" "+n(e.maximum,t)+"wubraś."},noResults:function(){return"Žedne wuslědki namakane"},searching:function(){return"Pyta se…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/el.js b/js/i18n/el.js deleted file mode 100644 index ab24e29..0000000 --- a/js/i18n/el.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/en.js b/js/i18n/en.js deleted file mode 100644 index 646d78a..0000000 --- a/js/i18n/en.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/es.js b/js/i18n/es.js deleted file mode 100644 index 8430954..0000000 --- a/js/i18n/es.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/et.js b/js/i18n/et.js deleted file mode 100644 index d19b6c6..0000000 --- a/js/i18n/et.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/eu.js b/js/i18n/eu.js deleted file mode 100644 index f403093..0000000 --- a/js/i18n/eu.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/fa.js b/js/i18n/fa.js deleted file mode 100644 index b2a7d0e..0000000 --- a/js/i18n/fa.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها می‌توانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/fi.js b/js/i18n/fi.js deleted file mode 100644 index 126e4dc..0000000 --- a/js/i18n/fi.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{errorLoading:function(){return"Tuloksia ei saatu ladattua."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){return"Haetaan…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/fr.js b/js/i18n/fr.js deleted file mode 100644 index 7b3183c..0000000 --- a/js/i18n/fr.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Supprimez "+t+" caractère"+(t>1?"s":"")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Saisissez au moins "+t+" caractère"+(t>1?"s":"")},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1?"s":"")},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/gl.js b/js/i18n/gl.js deleted file mode 100644 index b501a62..0000000 --- a/js/i18n/gl.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{errorLoading:function(){return"Non foi posíbel cargar os resultados."},inputTooLong:function(e){var t=e.input.length-e.maximum;return t===1?"Elimine un carácter":"Elimine "+t+" caracteres"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t===1?"Engada un carácter":"Engada "+t+" caracteres"},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){return e.maximum===1?"Só pode seleccionar un elemento":"Só pode seleccionar "+e.maximum+" elementos"},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/he.js b/js/i18n/he.js deleted file mode 100644 index afd7e8a..0000000 --- a/js/i18n/he.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/hi.js b/js/i18n/hi.js deleted file mode 100644 index 2dc94c9..0000000 --- a/js/i18n/hi.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/hr.js b/js/i18n/hr.js deleted file mode 100644 index 8637a94..0000000 --- a/js/i18n/hr.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/hsb.js b/js/i18n/hsb.js deleted file mode 100644 index 970e18c..0000000 --- a/js/i18n/hsb.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hsb",[],function(){var e=["znamješko","znamješce","znamješka","znamješkow"],t=["zapisk","zapiskaj","zapiski","zapiskow"],n=function(t,n){if(t===1)return n[0];if(t===2)return n[1];if(t>2&&t<=4)return n[2];if(t>=5)return n[3]};return{errorLoading:function(){return"Wuslědki njedachu so začitać."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Prošu zhašej "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Prošu zapodaj znajmjeńša "+r+" "+n(r,e)},loadingMore:function(){return"Dalše wuslědki so začitaja…"},maximumSelected:function(e){return"Móžeš jenož "+e.maximum+" "+n(e.maximum,t)+"wubrać"},noResults:function(){return"Žane wuslědki namakane"},searching:function(){return"Pyta so…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/hu.js b/js/i18n/hu.js deleted file mode 100644 index 0296c29..0000000 --- a/js/i18n/hu.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{errorLoading:function(){return"Az eredmények betöltése nem sikerült."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/hy.js b/js/i18n/hy.js deleted file mode 100644 index f7db83e..0000000 --- a/js/i18n/hy.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hy",[],function(){return{errorLoading:function(){return"Արդյունքները հնարավոր չէ բեռնել։"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Խնդրում ենք հեռացնել "+t+" նշան";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Խնդրում ենք մուտքագրել "+t+" կամ ավել նշաններ";return n},loadingMore:function(){return"Բեռնվում են նոր արդյունքներ․․․"},maximumSelected:function(e){var t="Դուք կարող եք ընտրել առավելագույնը "+e.maximum+" կետ";return t},noResults:function(){return"Արդյունքներ չեն գտնվել"},searching:function(){return"Որոնում․․․"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/id.js b/js/i18n/id.js deleted file mode 100644 index 247ba2b..0000000 --- a/js/i18n/id.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/is.js b/js/i18n/is.js deleted file mode 100644 index aae1f38..0000000 --- a/js/i18n/is.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/it.js b/js/i18n/it.js deleted file mode 100644 index f56bfa6..0000000 --- a/js/i18n/it.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/ja.js b/js/i18n/ja.js deleted file mode 100644 index bda8e7d..0000000 --- a/js/i18n/ja.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/km.js b/js/i18n/km.js deleted file mode 100644 index be2c4ae..0000000 --- a/js/i18n/km.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/ko.js b/js/i18n/ko.js deleted file mode 100644 index caee03f..0000000 --- a/js/i18n/ko.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/lt.js b/js/i18n/lt.js deleted file mode 100644 index a3f9af2..0000000 --- a/js/i18n/lt.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/lv.js b/js/i18n/lv.js deleted file mode 100644 index 242b1b4..0000000 --- a/js/i18n/lv.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/mk.js b/js/i18n/mk.js deleted file mode 100644 index 7b4c338..0000000 --- a/js/i18n/mk.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/ms.js b/js/i18n/ms.js deleted file mode 100644 index 7990997..0000000 --- a/js/i18n/ms.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Sila hapuskan "+t+" aksara"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Sila masukkan "+t+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(e){return"Anda hanya boleh memilih "+e.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/nb.js b/js/i18n/nb.js deleted file mode 100644 index d6553ca..0000000 --- a/js/i18n/nb.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Vennligst skriv inn "+t+" tegn til"},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/nl.js b/js/i18n/nl.js deleted file mode 100644 index 043c36a..0000000 --- a/js/i18n/nl.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",n="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(n+="s"),n+=" worden geselecteerd",n},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/pl.js b/js/i18n/pl.js deleted file mode 100644 index f04f0e9..0000000 --- a/js/i18n/pl.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/ps.js b/js/i18n/ps.js deleted file mode 100644 index be5e8ee..0000000 --- a/js/i18n/ps.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ps",[],function(){return{errorLoading:function(){return"پايلي نه سي ترلاسه کېدای"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="د مهربانۍ لمخي "+t+" توری ړنګ کړئ";return t!=1&&(n=n.replace("توری","توري")),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لږ تر لږه "+t+" يا ډېر توري وليکئ";return n},loadingMore:function(){return"نوري پايلي ترلاسه کيږي..."},maximumSelected:function(e){var t="تاسو يوازي "+e.maximum+" قلم په نښه کولای سی";return e.maximum!=1&&(t=t.replace("قلم","قلمونه")),t},noResults:function(){return"پايلي و نه موندل سوې"},searching:function(){return"لټول کيږي..."}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/pt-BR.js b/js/i18n/pt-BR.js deleted file mode 100644 index feb82f2..0000000 --- a/js/i18n/pt-BR.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/pt.js b/js/i18n/pt.js deleted file mode 100644 index 8c1f25c..0000000 --- a/js/i18n/pt.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"caractere",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/ro.js b/js/i18n/ro.js deleted file mode 100644 index 043c225..0000000 --- a/js/i18n/ro.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return t!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți "+t+" sau mai multe caractere";return n},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",e.maximum!==1&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/ru.js b/js/i18n/ru.js deleted file mode 100644 index 9c7d25d..0000000 --- a/js/i18n/ru.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/sk.js b/js/i18n/sk.js deleted file mode 100644 index 0dd081f..0000000 --- a/js/i18n/sk.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/sl.js b/js/i18n/sl.js deleted file mode 100644 index 6402de6..0000000 --- a/js/i18n/sl.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sl",[],function(){return{errorLoading:function(){return"Zadetkov iskanja ni bilo mogoče naložiti."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Prosim zbrišite "+t+" znak";return t==2?n+="a":t!=1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Prosim vpišite še "+t+" znak";return t==2?n+="a":t!=1&&(n+="e"),n},loadingMore:function(){return"Nalagam več zadetkov…"},maximumSelected:function(e){var t="Označite lahko največ "+e.maximum+" predmet";return e.maximum==2?t+="a":e.maximum!=1&&(t+="e"),t},noResults:function(){return"Ni zadetkov."},searching:function(){return"Iščem…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/sr-Cyrl.js b/js/i18n/sr-Cyrl.js deleted file mode 100644 index 65f759f..0000000 --- a/js/i18n/sr-Cyrl.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr-Cyrl",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Обришите "+n+" симбол";return r+=e(n,"","а","а"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Укуцајте бар још "+n+" симбол";return r+=e(n,"","а","а"),r},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(t){var n="Можете изабрати само "+t.maximum+" ставк";return n+=e(t.maximum,"у","е","и"),n},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/sr.js b/js/i18n/sr.js deleted file mode 100644 index 19209dd..0000000 --- a/js/i18n/sr.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/sv.js b/js/i18n/sv.js deleted file mode 100644 index 21f97a1..0000000 --- a/js/i18n/sv.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/th.js b/js/i18n/th.js deleted file mode 100644 index 2ea1654..0000000 --- a/js/i18n/th.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/th",[],function(){return{errorLoading:function(){return"ไม่สามารถค้นข้อมูลได้"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/tk.js b/js/i18n/tk.js deleted file mode 100644 index 8f5f550..0000000 --- a/js/i18n/tk.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tk",[],function(){return{errorLoading:function(){return"Netije ýüklenmedi."},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" harp bozuň.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ýene-de iň az "+t+" harp ýazyň.";return n},loadingMore:function(){return"Köpräk netije görkezilýär…"},maximumSelected:function(e){var t="Diňe "+e.maximum+" sanysyny saýlaň.";return t},noResults:function(){return"Netije tapylmady."},searching:function(){return"Gözlenýär…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/tr.js b/js/i18n/tr.js deleted file mode 100644 index 797a899..0000000 --- a/js/i18n/tr.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tr",[],function(){return{errorLoading:function(){return"Sonuç yüklenemedi"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/uk.js b/js/i18n/uk.js deleted file mode 100644 index dc3989c..0000000 --- a/js/i18n/uk.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/vi.js b/js/i18n/vi.js deleted file mode 100644 index 6a32cb7..0000000 --- a/js/i18n/vi.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+" ký tự";return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/zh-CN.js b/js/i18n/zh-CN.js deleted file mode 100644 index f349dba..0000000 --- a/js/i18n/zh-CN.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(e){var t="最多只能选择"+e.maximum+"个项目";return t},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/i18n/zh-TW.js b/js/i18n/zh-TW.js deleted file mode 100644 index 9e9f7b4..0000000 --- a/js/i18n/zh-TW.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */ - -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="請刪掉"+t+"個字元";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="請再輸入"+t+"個字元";return n},loadingMore:function(){return"載入中…"},maximumSelected:function(e){var t="你只能選擇最多"+e.maximum+"項";return t},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/js/moment.min.js b/js/moment.min.js deleted file mode 100644 index 770f8bc..0000000 --- a/js/moment.min.js +++ /dev/null @@ -1,7 +0,0 @@ -//! moment.js -//! version : 2.18.1 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com -!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return sd.apply(null,arguments)}function b(a){sd=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return null!=a&&"[object Object]"===Object.prototype.toString.call(a)}function e(a){var b;for(b in a)return!1;return!0}function f(a){return void 0===a}function g(a){return"number"==typeof a||"[object Number]"===Object.prototype.toString.call(a)}function h(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function i(a,b){var c,d=[];for(c=0;c0)for(c=0;c0?"future":"past"];return z(c)?c(b):c.replace(/%s/i,b)}function J(a,b){var c=a.toLowerCase();Hd[c]=Hd[c+"s"]=Hd[b]=a}function K(a){return"string"==typeof a?Hd[a]||Hd[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)j(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(a,b){Id[a]=b}function N(a){var b=[];for(var c in a)b.push({unit:c,priority:Id[c]});return b.sort(function(a,b){return a.priority-b.priority}),b}function O(b,c){return function(d){return null!=d?(Q(this,b,d),a.updateOffset(this,c),this):P(this,b)}}function P(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function Q(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function R(a){return a=K(a),z(this[a])?this[a]():this}function S(a,b){if("object"==typeof a){a=L(a);for(var c=N(a),d=0;d=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function U(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Md[a]=e),b&&(Md[b[0]]=function(){return T(e.apply(this,arguments),b[1],b[2])}),c&&(Md[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function V(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function W(a){var b,c,d=a.match(Jd);for(b=0,c=d.length;b=0&&Kd.test(a);)a=a.replace(Kd,c),Kd.lastIndex=0,d-=1;return a}function Z(a,b,c){ce[a]=z(b)?b:function(a,d){return a&&c?c:b}}function $(a,b){return j(ce,a)?ce[a](b._strict,b._locale):new RegExp(_(a))}function _(a){return aa(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function aa(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ba(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),g(b)&&(d=function(a,c){c[b]=u(a)}),c=0;c=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function ta(a){var b=new Date(Date.UTC.apply(null,arguments));return a<100&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ua(a,b,c){var d=7+b-c,e=(7+ta(a,0,d).getUTCDay()-b)%7;return-e+d-1}function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return j<=0?(f=a-1,g=pa(f)+j):j>pa(a)?(f=a+1,g=j-pa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return g<1?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(pa(a)-d+e)/7}function ya(a){return wa(a,this._week.dow,this._week.doy).week}function za(){return this._week.dow}function Aa(){return this._week.doy}function Ba(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function Ca(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function Da(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function Ea(a,b){return"string"==typeof a?b.weekdaysParse(a)%7||7:isNaN(a)?null:a}function Fa(a,b){return a?c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]:c(this._weekdays)?this._weekdays:this._weekdays.standalone}function Ga(a){return a?this._weekdaysShort[a.day()]:this._weekdaysShort}function Ha(a){return a?this._weekdaysMin[a.day()]:this._weekdaysMin}function Ia(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;d<7;++d)f=l([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=ne.call(this._weekdaysParse,g),e!==-1?e:null):"ddd"===b?(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:null):(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:null):"dddd"===b?(e=ne.call(this._weekdaysParse,g),e!==-1?e:(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:null))):"ddd"===b?(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:(e=ne.call(this._weekdaysParse,g),e!==-1?e:(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:null))):(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:(e=ne.call(this._weekdaysParse,g),e!==-1?e:(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:null)))}function Ja(a,b,c){var d,e,f;if(this._weekdaysParseExact)return Ia.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;d<7;d++){if(e=l([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function Ka(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Da(a,this.localeData()),this.add(a-b,"d")):b}function La(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ma(a){if(!this.isValid())return null!=a?this:NaN;if(null!=a){var b=Ea(a,this.localeData());return this.day(this.day()%7?b:b-7)}return this.day()||7}function Na(a){return this._weekdaysParseExact?(j(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):(j(this,"_weekdaysRegex")||(this._weekdaysRegex=ye),this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex)}function Oa(a){return this._weekdaysParseExact?(j(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(j(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ze),this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Pa(a){return this._weekdaysParseExact?(j(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(j(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ae),this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Qa(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],h=[],i=[],j=[];for(b=0;b<7;b++)c=l([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),h.push(e),i.push(f),j.push(d),j.push(e),j.push(f);for(g.sort(a),h.sort(a),i.sort(a),j.sort(a),b=0;b<7;b++)h[b]=aa(h[b]),i[b]=aa(i[b]),j[b]=aa(j[b]);this._weekdaysRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function Ra(){return this.hours()%12||12}function Sa(){return this.hours()||24}function Ta(a,b){U(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Ua(a,b){return b._meridiemParse}function Va(a){return"p"===(a+"").toLowerCase().charAt(0)}function Wa(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Xa(a){return a?a.toLowerCase().replace("_","-"):a}function Ya(a){for(var b,c,d,e,f=0;f0;){if(d=Za(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&v(e,c,!0)>=b-1)break;b--}f++}return null}function Za(a){var b=null;if(!Fe[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Be._abbr,require("./locale/"+a),$a(b)}catch(a){}return Fe[a]}function $a(a,b){var c;return a&&(c=f(b)?bb(a):_a(a,b),c&&(Be=c)),Be._abbr}function _a(a,b){if(null!==b){var c=Ee;if(b.abbr=a,null!=Fe[a])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."),c=Fe[a]._config;else if(null!=b.parentLocale){if(null==Fe[b.parentLocale])return Ge[b.parentLocale]||(Ge[b.parentLocale]=[]),Ge[b.parentLocale].push({name:a,config:b}),null;c=Fe[b.parentLocale]._config}return Fe[a]=new C(B(c,b)),Ge[a]&&Ge[a].forEach(function(a){_a(a.name,a.config)}),$a(a),Fe[a]}return delete Fe[a],null}function ab(a,b){if(null!=b){var c,d=Ee;null!=Fe[a]&&(d=Fe[a]._config),b=B(d,b),c=new C(b),c.parentLocale=Fe[a],Fe[a]=c,$a(a)}else null!=Fe[a]&&(null!=Fe[a].parentLocale?Fe[a]=Fe[a].parentLocale:null!=Fe[a]&&delete Fe[a]);return Fe[a]}function bb(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Be;if(!c(a)){if(b=Za(a))return b;a=[a]}return Ya(a)}function cb(){return Ad(Fe)}function db(a){var b,c=a._a;return c&&n(a).overflow===-2&&(b=c[fe]<0||c[fe]>11?fe:c[ge]<1||c[ge]>ea(c[ee],c[fe])?ge:c[he]<0||c[he]>24||24===c[he]&&(0!==c[ie]||0!==c[je]||0!==c[ke])?he:c[ie]<0||c[ie]>59?ie:c[je]<0||c[je]>59?je:c[ke]<0||c[ke]>999?ke:-1,n(a)._overflowDayOfYear&&(bge)&&(b=ge),n(a)._overflowWeeks&&b===-1&&(b=le),n(a)._overflowWeekday&&b===-1&&(b=me),n(a).overflow=b),a}function eb(a){var b,c,d,e,f,g,h=a._i,i=He.exec(h)||Ie.exec(h);if(i){for(n(a).iso=!0,b=0,c=Ke.length;b10?"YYYY ":"YY "),f="HH:mm"+(c[4]?":ss":""),c[1]){var l=new Date(c[2]),m=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][l.getDay()];if(c[1].substr(0,3)!==m)return n(a).weekdayMismatch=!0,void(a._isValid=!1)}switch(c[5].length){case 2:0===i?h=" +0000":(i=k.indexOf(c[5][1].toUpperCase())-12,h=(i<0?" -":" +")+(""+i).replace(/^-?/,"0").match(/..$/)[0]+"00");break;case 4:h=j[c[5]];break;default:h=j[" GMT"]}c[5]=h,a._i=c.splice(1).join(""),g=" ZZ",a._f=d+e+f+g,lb(a),n(a).rfc2822=!0}else a._isValid=!1}function gb(b){var c=Me.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(eb(b),void(b._isValid===!1&&(delete b._isValid,fb(b),b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b)))))}function hb(a,b,c){return null!=a?a:null!=b?b:c}function ib(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function jb(a){var b,c,d,e,f=[];if(!a._d){for(d=ib(a),a._w&&null==a._a[ge]&&null==a._a[fe]&&kb(a),null!=a._dayOfYear&&(e=hb(a._a[ee],d[ee]),(a._dayOfYear>pa(e)||0===a._dayOfYear)&&(n(a)._overflowDayOfYear=!0),c=ta(e,0,a._dayOfYear),a._a[fe]=c.getUTCMonth(),a._a[ge]=c.getUTCDate()),b=0;b<3&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;b<7;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[he]&&0===a._a[ie]&&0===a._a[je]&&0===a._a[ke]&&(a._nextDay=!0,a._a[he]=0),a._d=(a._useUTC?ta:sa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[he]=24)}}function kb(a){var b,c,d,e,f,g,h,i;if(b=a._w,null!=b.GG||null!=b.W||null!=b.E)f=1,g=4,c=hb(b.GG,a._a[ee],wa(tb(),1,4).year),d=hb(b.W,1),e=hb(b.E,1),(e<1||e>7)&&(i=!0);else{f=a._locale._week.dow,g=a._locale._week.doy;var j=wa(tb(),f,g);c=hb(b.gg,a._a[ee],j.year),d=hb(b.w,j.week),null!=b.d?(e=b.d,(e<0||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f}d<1||d>xa(c,f,g)?n(a)._overflowWeeks=!0:null!=i?n(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[ee]=h.year,a._dayOfYear=h.dayOfYear)}function lb(b){if(b._f===a.ISO_8601)return void eb(b);if(b._f===a.RFC_2822)return void fb(b);b._a=[],n(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Y(b._f,b._locale).match(Jd)||[],c=0;c0&&n(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),Md[f]?(d?n(b).empty=!1:n(b).unusedTokens.push(f),da(f,d,b)):b._strict&&!d&&n(b).unusedTokens.push(f);n(b).charsLeftOver=i-j,h.length>0&&n(b).unusedInput.push(h),b._a[he]<=12&&n(b).bigHour===!0&&b._a[he]>0&&(n(b).bigHour=void 0),n(b).parsedDateParts=b._a.slice(0),n(b).meridiem=b._meridiem,b._a[he]=mb(b._locale,b._a[he],b._meridiem),jb(b),db(b)}function mb(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&b<12&&(b+=12),d||12!==b||(b=0),b):b}function nb(a){var b,c,d,e,f;if(0===a._f.length)return n(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ethis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ob(){if(!f(this._isDSTShifted))return this._isDSTShifted;var a={};if(q(a,this),a=qb(a),a._a){var b=a._isUTC?l(a._a):tb(a._a);this._isDSTShifted=this.isValid()&&v(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Pb(){return!!this.isValid()&&!this._isUTC}function Qb(){return!!this.isValid()&&this._isUTC}function Rb(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Sb(a,b){var c,d,e,f=a,h=null;return Bb(a)?f={ms:a._milliseconds,d:a._days,M:a._months}:g(a)?(f={},b?f[b]=a:f.milliseconds=a):(h=Te.exec(a))?(c="-"===h[1]?-1:1,f={y:0,d:u(h[ge])*c,h:u(h[he])*c,m:u(h[ie])*c,s:u(h[je])*c,ms:u(Cb(1e3*h[ke]))*c}):(h=Ue.exec(a))?(c="-"===h[1]?-1:1,f={y:Tb(h[2],c),M:Tb(h[3],c),w:Tb(h[4],c),d:Tb(h[5],c),h:Tb(h[6],c),m:Tb(h[7],c),s:Tb(h[8],c)}):null==f?f={}:"object"==typeof f&&("from"in f||"to"in f)&&(e=Vb(tb(f.from),tb(f.to)),f={},f.ms=e.milliseconds,f.M=e.months),d=new Ab(f),Bb(a)&&j(a,"_locale")&&(d._locale=a._locale),d}function Tb(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Ub(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Vb(a,b){var c;return a.isValid()&&b.isValid()?(b=Fb(b,a),a.isBefore(b)?c=Ub(a,b):(c=Ub(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function Wb(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(y(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Sb(c,d),Xb(this,e,a),this}}function Xb(b,c,d,e){var f=c._milliseconds,g=Cb(c._days),h=Cb(c._months);b.isValid()&&(e=null==e||e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&Q(b,"Date",P(b,"Date")+g*d),h&&ja(b,P(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function Yb(a,b){var c=a.diff(b,"days",!0);return c<-6?"sameElse":c<-1?"lastWeek":c<0?"lastDay":c<1?"sameDay":c<2?"nextDay":c<7?"nextWeek":"sameElse"}function Zb(b,c){var d=b||tb(),e=Fb(d,this).startOf("day"),f=a.calendarFormat(this,e)||"sameElse",g=c&&(z(c[f])?c[f].call(this,d):c[f]);return this.format(g||this.localeData().calendar(f,this,tb(d)))}function $b(){return new r(this)}function _b(a,b){var c=s(a)?a:tb(a);return!(!this.isValid()||!c.isValid())&&(b=K(f(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()9999?X(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):z(Date.prototype.toISOString)?this.toDate().toISOString():X(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function jc(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var a="moment",b="";this.isLocal()||(a=0===this.utcOffset()?"moment.utc":"moment.parseZone",b="Z");var c="["+a+'("]',d=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",e="-MM-DD[T]HH:mm:ss.SSS",f=b+'[")]';return this.format(c+d+e+f)}function kc(b){b||(b=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var c=X(this,b);return this.localeData().postformat(c)}function lc(a,b){return this.isValid()&&(s(a)&&a.isValid()||tb(a).isValid())?Sb({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function mc(a){return this.from(tb(),a)}function nc(a,b){return this.isValid()&&(s(a)&&a.isValid()||tb(a).isValid())?Sb({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function oc(a){return this.to(tb(),a)}function pc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}function qc(){return this._locale}function rc(a){switch(a=K(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function sc(a){return a=K(a),void 0===a||"millisecond"===a?this:("date"===a&&(a="day"),this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms"))}function tc(){return this._d.valueOf()-6e4*(this._offset||0)}function uc(){return Math.floor(this.valueOf()/1e3)}function vc(){return new Date(this.valueOf())}function wc(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function xc(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function yc(){return this.isValid()?this.toISOString():null}function zc(){return o(this)}function Ac(){ -return k({},n(this))}function Bc(){return n(this).overflow}function Cc(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Dc(a,b){U(0,[a,a.length],0,b)}function Ec(a){return Ic.call(this,a,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Fc(a){return Ic.call(this,a,this.isoWeek(),this.isoWeekday(),1,4)}function Gc(){return xa(this.year(),1,4)}function Hc(){var a=this.localeData()._week;return xa(this.year(),a.dow,a.doy)}function Ic(a,b,c,d,e){var f;return null==a?wa(this,d,e).year:(f=xa(a,d,e),b>f&&(b=f),Jc.call(this,a,b,c,d,e))}function Jc(a,b,c,d,e){var f=va(a,b,c,d,e),g=ta(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Kc(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Lc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function Mc(a,b){b[ke]=u(1e3*("0."+a))}function Nc(){return this._isUTC?"UTC":""}function Oc(){return this._isUTC?"Coordinated Universal Time":""}function Pc(a){return tb(1e3*a)}function Qc(){return tb.apply(null,arguments).parseZone()}function Rc(a){return a}function Sc(a,b,c,d){var e=bb(),f=l().set(d,b);return e[c](f,a)}function Tc(a,b,c){if(g(a)&&(b=a,a=void 0),a=a||"",null!=b)return Sc(a,b,c,"month");var d,e=[];for(d=0;d<12;d++)e[d]=Sc(a,d,c,"month");return e}function Uc(a,b,c,d){"boolean"==typeof a?(g(b)&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,g(b)&&(c=b,b=void 0),b=b||"");var e=bb(),f=a?e._week.dow:0;if(null!=c)return Sc(b,(c+f)%7,d,"day");var h,i=[];for(h=0;h<7;h++)i[h]=Sc(b,(h+f)%7,d,"day");return i}function Vc(a,b){return Tc(a,b,"months")}function Wc(a,b){return Tc(a,b,"monthsShort")}function Xc(a,b,c){return Uc(a,b,c,"weekdays")}function Yc(a,b,c){return Uc(a,b,c,"weekdaysShort")}function Zc(a,b,c){return Uc(a,b,c,"weekdaysMin")}function $c(){var a=this._data;return this._milliseconds=df(this._milliseconds),this._days=df(this._days),this._months=df(this._months),a.milliseconds=df(a.milliseconds),a.seconds=df(a.seconds),a.minutes=df(a.minutes),a.hours=df(a.hours),a.months=df(a.months),a.years=df(a.years),this}function _c(a,b,c,d){var e=Sb(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function ad(a,b){return _c(this,a,b,1)}function bd(a,b){return _c(this,a,b,-1)}function cd(a){return a<0?Math.floor(a):Math.ceil(a)}function dd(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||f<=0&&g<=0&&h<=0||(f+=864e5*cd(fd(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=t(f/1e3),i.seconds=a%60,b=t(a/60),i.minutes=b%60,c=t(b/60),i.hours=c%24,g+=t(c/24),e=t(ed(g)),h+=e,g-=cd(fd(e)),d=t(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function ed(a){return 4800*a/146097}function fd(a){return 146097*a/4800}function gd(a){if(!this.isValid())return NaN;var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+ed(b),"month"===a?c:c/12;switch(b=this._days+Math.round(fd(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function hd(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*u(this._months/12):NaN}function id(a){return function(){return this.as(a)}}function jd(a){return a=K(a),this.isValid()?this[a+"s"]():NaN}function kd(a){return function(){return this.isValid()?this._data[a]:NaN}}function ld(){return t(this.days()/7)}function md(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function nd(a,b,c){var d=Sb(a).abs(),e=uf(d.as("s")),f=uf(d.as("m")),g=uf(d.as("h")),h=uf(d.as("d")),i=uf(d.as("M")),j=uf(d.as("y")),k=e<=vf.ss&&["s",e]||e0,k[4]=c,md.apply(null,k)}function od(a){return void 0===a?uf:"function"==typeof a&&(uf=a,!0)}function pd(a,b){return void 0!==vf[a]&&(void 0===b?vf[a]:(vf[a]=b,"s"===a&&(vf.ss=b-1),!0))}function qd(a){if(!this.isValid())return this.localeData().invalidDate();var b=this.localeData(),c=nd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function rd(){if(!this.isValid())return this.localeData().invalidDate();var a,b,c,d=wf(this._milliseconds)/1e3,e=wf(this._days),f=wf(this._months);a=t(d/60),b=t(a/60),d%=60,a%=60,c=t(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(m<0?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var sd,td;td=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;d68?1900:2e3)};var te=O("FullYear",!0);U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),M("week",5),M("isoWeek",5),Z("w",Sd),Z("ww",Sd,Od),Z("W",Sd),Z("WW",Sd,Od),ca(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=u(a)});var ue={dow:0,doy:6};U("d",0,"do","day"),U("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),U("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),U("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),M("day",11),M("weekday",11),M("isoWeekday",11),Z("d",Sd),Z("e",Sd),Z("E",Sd),Z("dd",function(a,b){return b.weekdaysMinRegex(a)}),Z("ddd",function(a,b){return b.weekdaysShortRegex(a)}),Z("dddd",function(a,b){return b.weekdaysRegex(a)}),ca(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:n(c).invalidWeekday=a}),ca(["d","e","E"],function(a,b,c,d){b[d]=u(a)});var ve="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),we="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),xe="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ye=be,ze=be,Ae=be;U("H",["HH",2],0,"hour"),U("h",["hh",2],0,Ra),U("k",["kk",2],0,Sa),U("hmm",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)}),U("hmmss",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ta("a",!0),Ta("A",!1),J("hour","h"),M("hour",13),Z("a",Ua),Z("A",Ua),Z("H",Sd),Z("h",Sd),Z("k",Sd),Z("HH",Sd,Od),Z("hh",Sd,Od),Z("kk",Sd,Od),Z("hmm",Td),Z("hmmss",Ud),Z("Hmm",Td),Z("Hmmss",Ud),ba(["H","HH"],he),ba(["k","kk"],function(a,b,c){var d=u(a);b[he]=24===d?0:d}),ba(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),ba(["h","hh"],function(a,b,c){b[he]=u(a),n(c).bigHour=!0}),ba("hmm",function(a,b,c){var d=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d)),n(c).bigHour=!0}),ba("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d,2)),b[je]=u(a.substr(e)),n(c).bigHour=!0}),ba("Hmm",function(a,b,c){var d=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d))}),ba("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d,2)),b[je]=u(a.substr(e))});var Be,Ce=/[ap]\.?m?\.?/i,De=O("Hours",!0),Ee={calendar:Bd,longDateFormat:Cd,invalidDate:Dd,ordinal:Ed,dayOfMonthOrdinalParse:Fd,relativeTime:Gd,months:pe,monthsShort:qe,week:ue,weekdays:ve,weekdaysMin:xe,weekdaysShort:we,meridiemParse:Ce},Fe={},Ge={},He=/^\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)?)?$/,Ie=/^\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)?)?$/,Je=/Z|[+-]\d\d(?::?\d\d)?/,Ke=[["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}/]],Le=[["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/]],Me=/^\/?Date\((\-?\d+)/i,Ne=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;a.createFromInputFallback=x("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(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),a.ISO_8601=function(){},a.RFC_2822=function(){};var Oe=x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=tb.apply(null,arguments);return this.isValid()&&a.isValid()?athis?this:a:p()}),Qe=function(){return Date.now?Date.now():+new Date},Re=["year","quarter","month","week","day","hour","minute","second","millisecond"];Db("Z",":"),Db("ZZ",""),Z("Z",_d),Z("ZZ",_d),ba(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Eb(_d,a)});var Se=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var Te=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Ue=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Sb.fn=Ab.prototype,Sb.invalid=zb;var Ve=Wb(1,"add"),We=Wb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Xe=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Dc("gggg","weekYear"),Dc("ggggg","weekYear"),Dc("GGGG","isoWeekYear"),Dc("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),M("weekYear",1),M("isoWeekYear",1),Z("G",Zd),Z("g",Zd),Z("GG",Sd,Od),Z("gg",Sd,Od),Z("GGGG",Wd,Qd),Z("gggg",Wd,Qd),Z("GGGGG",Xd,Rd),Z("ggggg",Xd,Rd),ca(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=u(a)}),ca(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),U("Q",0,"Qo","quarter"),J("quarter","Q"),M("quarter",7),Z("Q",Nd),ba("Q",function(a,b){b[fe]=3*(u(a)-1)}),U("D",["DD",2],"Do","date"),J("date","D"),M("date",9),Z("D",Sd),Z("DD",Sd,Od),Z("Do",function(a,b){return a?b._dayOfMonthOrdinalParse||b._ordinalParse:b._dayOfMonthOrdinalParseLenient}),ba(["D","DD"],ge),ba("Do",function(a,b){b[ge]=u(a.match(Sd)[0],10)});var Ye=O("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),M("dayOfYear",4),Z("DDD",Vd),Z("DDDD",Pd),ba(["DDD","DDDD"],function(a,b,c){c._dayOfYear=u(a)}),U("m",["mm",2],0,"minute"),J("minute","m"),M("minute",14),Z("m",Sd),Z("mm",Sd,Od),ba(["m","mm"],ie);var Ze=O("Minutes",!1);U("s",["ss",2],0,"second"),J("second","s"),M("second",15),Z("s",Sd),Z("ss",Sd,Od),ba(["s","ss"],je);var $e=O("Seconds",!1);U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return 10*this.millisecond()}),U(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),U(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),U(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),U(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),U(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),M("millisecond",16),Z("S",Vd,Nd),Z("SS",Vd,Od),Z("SSS",Vd,Pd);var _e;for(_e="SSSS";_e.length<=9;_e+="S")Z(_e,Yd);for(_e="S";_e.length<=9;_e+="S")ba(_e,Mc);var af=O("Milliseconds",!1);U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var bf=r.prototype;bf.add=Ve,bf.calendar=Zb,bf.clone=$b,bf.diff=fc,bf.endOf=sc,bf.format=kc,bf.from=lc,bf.fromNow=mc,bf.to=nc,bf.toNow=oc,bf.get=R,bf.invalidAt=Bc,bf.isAfter=_b,bf.isBefore=ac,bf.isBetween=bc,bf.isSame=cc,bf.isSameOrAfter=dc,bf.isSameOrBefore=ec,bf.isValid=zc,bf.lang=Xe,bf.locale=pc,bf.localeData=qc,bf.max=Pe,bf.min=Oe,bf.parsingFlags=Ac,bf.set=S,bf.startOf=rc,bf.subtract=We,bf.toArray=wc,bf.toObject=xc,bf.toDate=vc,bf.toISOString=ic,bf.inspect=jc,bf.toJSON=yc,bf.toString=hc,bf.unix=uc,bf.valueOf=tc,bf.creationData=Cc,bf.year=te,bf.isLeapYear=ra,bf.weekYear=Ec,bf.isoWeekYear=Fc,bf.quarter=bf.quarters=Kc,bf.month=ka,bf.daysInMonth=la,bf.week=bf.weeks=Ba,bf.isoWeek=bf.isoWeeks=Ca,bf.weeksInYear=Hc,bf.isoWeeksInYear=Gc,bf.date=Ye,bf.day=bf.days=Ka,bf.weekday=La,bf.isoWeekday=Ma,bf.dayOfYear=Lc,bf.hour=bf.hours=De,bf.minute=bf.minutes=Ze,bf.second=bf.seconds=$e,bf.millisecond=bf.milliseconds=af,bf.utcOffset=Hb,bf.utc=Jb,bf.local=Kb,bf.parseZone=Lb,bf.hasAlignedHourOffset=Mb,bf.isDST=Nb,bf.isLocal=Pb,bf.isUtcOffset=Qb,bf.isUtc=Rb,bf.isUTC=Rb,bf.zoneAbbr=Nc,bf.zoneName=Oc,bf.dates=x("dates accessor is deprecated. Use date instead.",Ye),bf.months=x("months accessor is deprecated. Use month instead",ka),bf.years=x("years accessor is deprecated. Use year instead",te),bf.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Ib),bf.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ob);var cf=C.prototype;cf.calendar=D,cf.longDateFormat=E,cf.invalidDate=F,cf.ordinal=G,cf.preparse=Rc,cf.postformat=Rc,cf.relativeTime=H,cf.pastFuture=I,cf.set=A,cf.months=fa,cf.monthsShort=ga,cf.monthsParse=ia,cf.monthsRegex=na,cf.monthsShortRegex=ma,cf.week=ya,cf.firstDayOfYear=Aa,cf.firstDayOfWeek=za,cf.weekdays=Fa,cf.weekdaysMin=Ha,cf.weekdaysShort=Ga,cf.weekdaysParse=Ja,cf.weekdaysRegex=Na,cf.weekdaysShortRegex=Oa,cf.weekdaysMinRegex=Pa,cf.isPM=Va,cf.meridiem=Wa,$a("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===u(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=x("moment.lang is deprecated. Use moment.locale instead.",$a),a.langData=x("moment.langData is deprecated. Use moment.localeData instead.",bb);var df=Math.abs,ef=id("ms"),ff=id("s"),gf=id("m"),hf=id("h"),jf=id("d"),kf=id("w"),lf=id("M"),mf=id("y"),nf=kd("milliseconds"),of=kd("seconds"),pf=kd("minutes"),qf=kd("hours"),rf=kd("days"),sf=kd("months"),tf=kd("years"),uf=Math.round,vf={ss:44,s:45,m:45,h:22,d:26,M:11},wf=Math.abs,xf=Ab.prototype;return xf.isValid=yb,xf.abs=$c,xf.add=ad,xf.subtract=bd,xf.as=gd,xf.asMilliseconds=ef,xf.asSeconds=ff,xf.asMinutes=gf,xf.asHours=hf,xf.asDays=jf,xf.asWeeks=kf,xf.asMonths=lf,xf.asYears=mf,xf.valueOf=hd,xf._bubble=dd,xf.get=jd,xf.milliseconds=nf,xf.seconds=of,xf.minutes=pf,xf.hours=qf,xf.days=rf,xf.weeks=ld,xf.months=sf,xf.years=tf,xf.humanize=qd,xf.toISOString=rd,xf.toString=rd,xf.toJSON=rd,xf.locale=pc,xf.localeData=qc,xf.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",rd),xf.lang=Xe,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Z("x",Zd),Z("X",ae),ba("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),ba("x",function(a,b,c){c._d=new Date(u(a))}),a.version="2.18.1",b(tb),a.fn=bf,a.min=vb,a.max=wb,a.now=Qe,a.utc=l,a.unix=Pc,a.months=Vc,a.isDate=h,a.locale=$a,a.invalid=p,a.duration=Sb,a.isMoment=s,a.weekdays=Xc,a.parseZone=Qc,a.localeData=bb,a.isDuration=Bb,a.monthsShort=Wc,a.weekdaysMin=Zc,a.defineLocale=_a,a.updateLocale=ab,a.locales=cb,a.weekdaysShort=Yc,a.normalizeUnits=K,a.relativeTimeRounding=od,a.relativeTimeThreshold=pd,a.calendarFormat=Yb,a.prototype=bf,a}); \ No newline at end of file diff --git a/js/package-lock.json b/js/package-lock.json new file mode 100644 index 0000000..715350f --- /dev/null +++ b/js/package-lock.json @@ -0,0 +1,3410 @@ +{ + "name": "timetrackerjs", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "timetrackerjs", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "chart.js": "^2.9.4", + "daterangepicker": "^3.1.0", + "jquery": "^3.5.1", + "jquery-migrate": "^3.3.2", + "jqueryui": "^1.11.1", + "moment": "^2.29.4", + "select2": "^4.0.13", + "tabulator-tables": "^4.9.3" + }, + "devDependencies": { + "@nextcloud/browserslist-config": "^3.0.1", + "css-loader": "^5.0.1", + "file-loader": "^6.2.0", + "style-loader": "^2.0.0", + "webpack": "^5.94.0", + "webpack-cli": "^4.2.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nextcloud/browserslist-config": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@nextcloud/browserslist-config/-/browserslist-config-3.0.1.tgz", + "integrity": "sha512-GZTxL5fsDgmFoot/qnRurjHCuHjSfOg+A6t4+P2TySXua2Q1Ex0lecZYlSnRuOR/W5BGOZ06ITTA/hbkSh1Ypg==", + "dev": true, + "engines": { + "node": "^20.0.0", + "npm": "^10.0.0" + } + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "22.5.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.1.tgz", + "integrity": "sha512-KkHsxej0j9IW1KKOOAA/XBA0z08UFSrRQHErzEfA3Vgq57eXIMYboIlHJuYIfd+lwCQjtKqUu3UnmKbtUc9yRw==", + "dev": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", + "integrity": "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==", + "dev": true, + "dependencies": { + "@webassemblyjs/helper-numbers": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", + "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", + "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz", + "integrity": "sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", + "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", + "dev": true, + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.11.6", + "@webassemblyjs/helper-api-error": "1.11.6", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", + "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz", + "integrity": "sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/wasm-gen": "1.12.1" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", + "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", + "dev": true, + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", + "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", + "dev": true, + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", + "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", + "dev": true + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz", + "integrity": "sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/helper-wasm-section": "1.12.1", + "@webassemblyjs/wasm-gen": "1.12.1", + "@webassemblyjs/wasm-opt": "1.12.1", + "@webassemblyjs/wasm-parser": "1.12.1", + "@webassemblyjs/wast-printer": "1.12.1" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz", + "integrity": "sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/ieee754": "1.11.6", + "@webassemblyjs/leb128": "1.11.6", + "@webassemblyjs/utf8": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz", + "integrity": "sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/wasm-gen": "1.12.1", + "@webassemblyjs/wasm-parser": "1.12.1" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz", + "integrity": "sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-api-error": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/ieee754": "1.11.6", + "@webassemblyjs/leb128": "1.11.6", + "@webassemblyjs/utf8": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz", + "integrity": "sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/info": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.1.0.tgz", + "integrity": "sha512-uNWSdaYHc+f3LdIZNwhdhkjjLDDl3jP2+XBqAq9H8DjrJUvlOKdP8TNruy1yEaDfgpAIgbSAN7pye4FEHg9tYQ==", + "dev": true, + "dependencies": { + "envinfo": "^7.7.3" + }, + "peerDependencies": { + "webpack-cli": "4.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.1.0.tgz", + "integrity": "sha512-7RfnMXCpJ/NThrhq4gYQYILB18xWyoQcBey81oIyVbmgbc6m5ZHHyFK+DyH7pLHJf0p14MxL4mTsoPAgBSTpIg==", + "dev": true, + "peerDependencies": { + "webpack-cli": "4.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-import-attributes": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", + "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", + "dev": true, + "peerDependencies": { + "acorn": "^8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/array-back": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.1.tgz", + "integrity": "sha512-Z/JnaVEXv+A9xabHzN43FiiiWEE7gPCRXMrVmRm00tWbjZRul1iHm7ECzlyNq1p4a4ATXz+G9FJ3GqGOkOV3fg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/browserslist": { + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", + "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001646", + "electron-to-chromium": "^1.5.4", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001655", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001655.tgz", + "integrity": "sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chart.js": { + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.9.4.tgz", + "integrity": "sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==", + "dependencies": { + "chartjs-color": "^2.1.0", + "moment": "^2.10.2" + } + }, + "node_modules/chartjs-color": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chartjs-color/-/chartjs-color-2.4.1.tgz", + "integrity": "sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==", + "dependencies": { + "chartjs-color-string": "^0.6.0", + "color-convert": "^1.9.3" + } + }, + "node_modules/chartjs-color-string": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz", + "integrity": "sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==", + "dependencies": { + "color-name": "^1.0.0" + } + }, + "node_modules/chrome-trace-event": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz", + "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==", + "dev": true, + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "node_modules/colorette": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz", + "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==", + "dev": true + }, + "node_modules/command-line-usage": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.1.tgz", + "integrity": "sha512-F59pEuAR9o1SF/bD0dQBDluhpT4jJQNWUHEuVBqpDmCUo6gPjCi+m9fCWnWZVR/oG6cMTUms4h+3NPl74wGXvA==", + "dev": true, + "dependencies": { + "array-back": "^4.0.1", + "chalk": "^2.4.2", + "table-layout": "^1.0.1", + "typical": "^5.2.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-loader": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-5.0.1.tgz", + "integrity": "sha512-cXc2ti9V234cq7rJzFKhirb2L2iPy8ZjALeVJAozXYz9te3r4eqLSixNAbMDJSgJEQywqXzs8gonxaboeKqwiw==", + "dev": true, + "dependencies": { + "camelcase": "^6.2.0", + "cssesc": "^3.0.0", + "icss-utils": "^5.0.0", + "loader-utils": "^2.0.0", + "postcss": "^8.1.4", + "postcss-modules-extract-imports": "^3.0.0", + "postcss-modules-local-by-default": "^4.0.0", + "postcss-modules-scope": "^3.0.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.1.0", + "schema-utils": "^3.0.0", + "semver": "^7.3.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.27.0 || ^5.0.0" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/daterangepicker": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/daterangepicker/-/daterangepicker-3.1.0.tgz", + "integrity": "sha512-DxWXvvPq4srWLCqFugqSV+6CBt/CvQ0dnpXhQ3gl0autcIDAruG1PuGG3gC7yPRNytAD1oU1AcUOzaYhOawhTw==", + "dependencies": { + "jquery": ">=1.10", + "moment": "^2.9.0" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.13", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz", + "integrity": "sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q==", + "dev": true + }, + "node_modules/emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "dependencies": { + "ansi-colors": "^4.1.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/envinfo": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.7.3.tgz", + "integrity": "sha512-46+j5QxbPWza0PB1i15nZx0xQ4I/EfQxg9J8Had3b408SV63nEtor2e+oiY63amTo9KTuh2a3XLObNwduxYwwA==", + "dev": true, + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/es-module-lexer": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", + "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "dev": true + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/events": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", + "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==", + "dev": true, + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/execa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", + "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/file-loader": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-6.2.0.tgz", + "integrity": "sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw==", + "dev": true, + "dependencies": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "dev": true, + "engines": { + "node": ">=8.12.0" + } + }, + "node_modules/icss-utils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", + "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "dev": true, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/import-local": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", + "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-local/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local/node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/indexes-of": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", + "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", + "dev": true + }, + "node_modules/interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/jquery": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", + "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==" + }, + "node_modules/jquery-migrate": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-3.3.2.tgz", + "integrity": "sha512-L3gYhr7yEtLUSAeqXSicVa0vRD4aGwjw/bWY8YzrO2o/qDY1BaMyP3oB3bZf5Auy3Hu9ynliio0CTyDWCBPVDw==", + "peerDependencies": { + "jquery": ">=3 <4" + } + }, + "node_modules/jqueryui": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/jqueryui/-/jqueryui-1.11.1.tgz", + "integrity": "sha1-hxhVBwX1Vo0RmRlhaQlNtzsikbw=" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true, + "engines": { + "node": ">=6.11.5" + } + }, + "node_modules/loader-utils": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", + "dev": true, + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + }, + "engines": { + "node": ">=8.9.0" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dev": true, + "dependencies": { + "mime-db": "1.44.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "engines": { + "node": "*" + } + }, + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", + "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", + "dev": true + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/picocolors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", + "dev": true + }, + "node_modules/postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-modules-extract-imports": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", + "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", + "dev": true, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-local-by-default": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz", + "integrity": "sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==", + "dev": true, + "dependencies": { + "icss-utils": "^5.0.0", + "postcss-selector-parser": "^6.0.2", + "postcss-value-parser": "^4.1.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-scope": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", + "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.4" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", + "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", + "dev": true, + "dependencies": { + "icss-utils": "^5.0.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.4.tgz", + "integrity": "sha512-gjMeXBempyInaBqpp8gODmwZ52WaYsVOsfr4L4lDQ7n3ncD6mEyySiDtgzCT+NYC0mmeOLvtsF8iaEf0YT6dBw==", + "dev": true, + "dependencies": { + "cssesc": "^3.0.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz", + "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==", + "dev": true + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/rechoir": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.0.tgz", + "integrity": "sha512-ADsDEH2bvbjltXEP+hTIAmeFekTFK0V2BTxMkok6qILyAJEXV0AFfoWcAq4yfll5VdIMd/RVXq0lR+wQi5ZU3Q==", + "dev": true, + "dependencies": { + "resolve": "^1.9.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/reduce-flatten": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", + "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "dependencies": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/select2": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/select2/-/select2-4.0.13.tgz", + "integrity": "sha512-1JeB87s6oN/TDxQQYCvS5EFoQyvV6eYMZZ0AeA4tdFDYWN3BAGZ8npr17UBFddU0lgAt3H0yjX3X6/ekOj1yjw==" + }, + "node_modules/semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/style-loader": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-2.0.0.tgz", + "integrity": "sha512-Z0gYUJmzZ6ZdRUqpg1r8GsaFKypE+3xAzuFeMuoHgjc9KZv3wMyCRjQIWEbhoFSq7+7yoHXySDJyyWQaPajeiQ==", + "dev": true, + "dependencies": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/table-layout": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.1.tgz", + "integrity": "sha512-dEquqYNJiGwY7iPfZ3wbXDI944iqanTSchrACLL2nOB+1r+h1Nzu2eH+DuPPvWvm5Ry7iAPeFlgEtP5bIp5U7Q==", + "dev": true, + "dependencies": { + "array-back": "^4.0.1", + "deep-extend": "~0.6.0", + "typical": "^5.2.0", + "wordwrapjs": "^4.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/tabulator-tables": { + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/tabulator-tables/-/tabulator-tables-4.9.3.tgz", + "integrity": "sha512-iwwQqAEGGxlgrBpcmJJvMJrfjGLcCXOB3AOb/DGkXqBy1YKoYA36hIl7qXGp6Jo8dSkzFAlDT6pKLZgyhs9OnQ==" + }, + "node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/terser": { + "version": "5.31.6", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.6.tgz", + "integrity": "sha512-PQ4DAriWzKj+qgehQ7LK5bQqCFNMmlhjR2PFFLuqGCpuCAauxemVBWwWOxo3UIwWQx8+Pr61Df++r76wDmkQBg==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", + "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.20", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.1", + "terser": "^5.26.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true + }, + "node_modules/uniq": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", + "dev": true + }, + "node_modules/update-browserslist-db": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", + "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.2", + "picocolors": "^1.0.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", + "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "node_modules/v8-compile-cache": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", + "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", + "dev": true + }, + "node_modules/watchpack": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", + "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", + "dev": true, + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack": { + "version": "5.94.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", + "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.5", + "@webassemblyjs/ast": "^1.12.1", + "@webassemblyjs/wasm-edit": "^1.12.1", + "@webassemblyjs/wasm-parser": "^1.12.1", + "acorn": "^8.7.1", + "acorn-import-attributes": "^1.9.5", + "browserslist": "^4.21.10", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.17.1", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.11", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.2.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.3.10", + "watchpack": "^2.4.1", + "webpack-sources": "^3.2.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.2.0.tgz", + "integrity": "sha512-EIl3k88vaF4fSxWSgtAQR+VwicfLMTZ9amQtqS4o+TDPW9HGaEpbFBbAZ4A3ZOT5SOnMxNOzROsSTPiE8tBJPA==", + "dev": true, + "dependencies": { + "@webpack-cli/info": "^1.1.0", + "@webpack-cli/serve": "^1.1.0", + "colorette": "^1.2.1", + "command-line-usage": "^6.1.0", + "commander": "^6.2.0", + "enquirer": "^2.3.6", + "execa": "^4.1.0", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "leven": "^3.1.0", + "rechoir": "^0.7.0", + "v8-compile-cache": "^2.2.0", + "webpack-merge": "^4.2.2" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "peerDependencies": { + "webpack": "4.x.x || 5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generate-loader": { + "optional": true + }, + "@webpack-cli/generate-plugin": { + "optional": true + }, + "@webpack-cli/init": { + "optional": true + }, + "@webpack-cli/migrate": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.0.tgz", + "integrity": "sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/webpack-merge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz", + "integrity": "sha512-TUE1UGoTX2Cd42j3krGYqObZbOD+xF7u28WB7tfUordytSjbWTIjK/8V0amkBfTYN4/pB/GIDlJZZ657BGG19g==", + "dev": true, + "dependencies": { + "lodash": "^4.17.15" + } + }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wordwrapjs": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.0.tgz", + "integrity": "sha512-Svqw723a3R34KvsMgpjFBYCgNOSdcW3mQFK4wIfhGQhtaFVOJmdYoXgi63ne3dTlWgatVcUc7t4HtQ/+bUVIzQ==", + "dev": true, + "dependencies": { + "reduce-flatten": "^2.0.0", + "typical": "^5.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + }, + "dependencies": { + "@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true + }, + "@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "@nextcloud/browserslist-config": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@nextcloud/browserslist-config/-/browserslist-config-3.0.1.tgz", + "integrity": "sha512-GZTxL5fsDgmFoot/qnRurjHCuHjSfOg+A6t4+P2TySXua2Q1Ex0lecZYlSnRuOR/W5BGOZ06ITTA/hbkSh1Ypg==", + "dev": true + }, + "@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true + }, + "@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "@types/node": { + "version": "22.5.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.1.tgz", + "integrity": "sha512-KkHsxej0j9IW1KKOOAA/XBA0z08UFSrRQHErzEfA3Vgq57eXIMYboIlHJuYIfd+lwCQjtKqUu3UnmKbtUc9yRw==", + "dev": true, + "requires": { + "undici-types": "~6.19.2" + } + }, + "@webassemblyjs/ast": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", + "integrity": "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==", + "dev": true, + "requires": { + "@webassemblyjs/helper-numbers": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", + "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", + "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz", + "integrity": "sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==", + "dev": true + }, + "@webassemblyjs/helper-numbers": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", + "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", + "dev": true, + "requires": { + "@webassemblyjs/floating-point-hex-parser": "1.11.6", + "@webassemblyjs/helper-api-error": "1.11.6", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", + "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz", + "integrity": "sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/wasm-gen": "1.12.1" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", + "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", + "dev": true, + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", + "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", + "dev": true, + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", + "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz", + "integrity": "sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/helper-wasm-section": "1.12.1", + "@webassemblyjs/wasm-gen": "1.12.1", + "@webassemblyjs/wasm-opt": "1.12.1", + "@webassemblyjs/wasm-parser": "1.12.1", + "@webassemblyjs/wast-printer": "1.12.1" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz", + "integrity": "sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/ieee754": "1.11.6", + "@webassemblyjs/leb128": "1.11.6", + "@webassemblyjs/utf8": "1.11.6" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz", + "integrity": "sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/wasm-gen": "1.12.1", + "@webassemblyjs/wasm-parser": "1.12.1" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz", + "integrity": "sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-api-error": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/ieee754": "1.11.6", + "@webassemblyjs/leb128": "1.11.6", + "@webassemblyjs/utf8": "1.11.6" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz", + "integrity": "sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.12.1", + "@xtuc/long": "4.2.2" + } + }, + "@webpack-cli/info": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.1.0.tgz", + "integrity": "sha512-uNWSdaYHc+f3LdIZNwhdhkjjLDDl3jP2+XBqAq9H8DjrJUvlOKdP8TNruy1yEaDfgpAIgbSAN7pye4FEHg9tYQ==", + "dev": true, + "requires": { + "envinfo": "^7.7.3" + } + }, + "@webpack-cli/serve": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.1.0.tgz", + "integrity": "sha512-7RfnMXCpJ/NThrhq4gYQYILB18xWyoQcBey81oIyVbmgbc6m5ZHHyFK+DyH7pLHJf0p14MxL4mTsoPAgBSTpIg==", + "dev": true, + "requires": {} + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true + }, + "acorn-import-attributes": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", + "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", + "dev": true, + "requires": {} + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, + "requires": {} + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "array-back": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.1.tgz", + "integrity": "sha512-Z/JnaVEXv+A9xabHzN43FiiiWEE7gPCRXMrVmRm00tWbjZRul1iHm7ECzlyNq1p4a4ATXz+G9FJ3GqGOkOV3fg==", + "dev": true + }, + "big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "dev": true + }, + "browserslist": { + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", + "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001646", + "electron-to-chromium": "^1.5.4", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.0" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001655", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001655.tgz", + "integrity": "sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "chart.js": { + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.9.4.tgz", + "integrity": "sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==", + "requires": { + "chartjs-color": "^2.1.0", + "moment": "^2.10.2" + } + }, + "chartjs-color": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chartjs-color/-/chartjs-color-2.4.1.tgz", + "integrity": "sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==", + "requires": { + "chartjs-color-string": "^0.6.0", + "color-convert": "^1.9.3" + } + }, + "chartjs-color-string": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz", + "integrity": "sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==", + "requires": { + "color-name": "^1.0.0" + } + }, + "chrome-trace-event": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz", + "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "colorette": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz", + "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==", + "dev": true + }, + "command-line-usage": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.1.tgz", + "integrity": "sha512-F59pEuAR9o1SF/bD0dQBDluhpT4jJQNWUHEuVBqpDmCUo6gPjCi+m9fCWnWZVR/oG6cMTUms4h+3NPl74wGXvA==", + "dev": true, + "requires": { + "array-back": "^4.0.1", + "chalk": "^2.4.2", + "table-layout": "^1.0.1", + "typical": "^5.2.0" + } + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "css-loader": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-5.0.1.tgz", + "integrity": "sha512-cXc2ti9V234cq7rJzFKhirb2L2iPy8ZjALeVJAozXYz9te3r4eqLSixNAbMDJSgJEQywqXzs8gonxaboeKqwiw==", + "dev": true, + "requires": { + "camelcase": "^6.2.0", + "cssesc": "^3.0.0", + "icss-utils": "^5.0.0", + "loader-utils": "^2.0.0", + "postcss": "^8.1.4", + "postcss-modules-extract-imports": "^3.0.0", + "postcss-modules-local-by-default": "^4.0.0", + "postcss-modules-scope": "^3.0.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.1.0", + "schema-utils": "^3.0.0", + "semver": "^7.3.2" + } + }, + "cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true + }, + "daterangepicker": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/daterangepicker/-/daterangepicker-3.1.0.tgz", + "integrity": "sha512-DxWXvvPq4srWLCqFugqSV+6CBt/CvQ0dnpXhQ3gl0autcIDAruG1PuGG3gC7yPRNytAD1oU1AcUOzaYhOawhTw==", + "requires": { + "jquery": ">=1.10", + "moment": "^2.9.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "electron-to-chromium": { + "version": "1.5.13", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz", + "integrity": "sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q==", + "dev": true + }, + "emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "enhanced-resolve": { + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + } + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "envinfo": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.7.3.tgz", + "integrity": "sha512-46+j5QxbPWza0PB1i15nZx0xQ4I/EfQxg9J8Had3b408SV63nEtor2e+oiY63amTo9KTuh2a3XLObNwduxYwwA==", + "dev": true + }, + "es-module-lexer": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", + "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "dev": true + }, + "escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "events": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", + "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==", + "dev": true + }, + "execa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", + "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "file-loader": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-6.2.0.tgz", + "integrity": "sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw==", + "dev": true, + "requires": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "dev": true + }, + "icss-utils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", + "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "dev": true, + "requires": {} + }, + "import-local": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", + "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + } + } + }, + "indexes-of": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", + "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", + "dev": true + }, + "interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "dev": true + }, + "is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + } + }, + "jquery": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", + "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==" + }, + "jquery-migrate": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-3.3.2.tgz", + "integrity": "sha512-L3gYhr7yEtLUSAeqXSicVa0vRD4aGwjw/bWY8YzrO2o/qDY1BaMyP3oB3bZf5Auy3Hu9ynliio0CTyDWCBPVDw==", + "requires": {} + }, + "jqueryui": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/jqueryui/-/jqueryui-1.11.1.tgz", + "integrity": "sha1-hxhVBwX1Vo0RmRlhaQlNtzsikbw=" + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, + "loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true + }, + "loader-utils": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "dev": true + }, + "mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dev": true, + "requires": { + "mime-db": "1.44.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" + }, + "nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true + }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "node-releases": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", + "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "picocolors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", + "dev": true + }, + "postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "dev": true, + "requires": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "postcss-modules-extract-imports": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", + "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", + "dev": true, + "requires": {} + }, + "postcss-modules-local-by-default": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz", + "integrity": "sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==", + "dev": true, + "requires": { + "icss-utils": "^5.0.0", + "postcss-selector-parser": "^6.0.2", + "postcss-value-parser": "^4.1.0" + } + }, + "postcss-modules-scope": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", + "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", + "dev": true, + "requires": { + "postcss-selector-parser": "^6.0.4" + } + }, + "postcss-modules-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", + "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", + "dev": true, + "requires": { + "icss-utils": "^5.0.0" + } + }, + "postcss-selector-parser": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.4.tgz", + "integrity": "sha512-gjMeXBempyInaBqpp8gODmwZ52WaYsVOsfr4L4lDQ7n3ncD6mEyySiDtgzCT+NYC0mmeOLvtsF8iaEf0YT6dBw==", + "dev": true, + "requires": { + "cssesc": "^3.0.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1", + "util-deprecate": "^1.0.2" + } + }, + "postcss-value-parser": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz", + "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "rechoir": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.0.tgz", + "integrity": "sha512-ADsDEH2bvbjltXEP+hTIAmeFekTFK0V2BTxMkok6qILyAJEXV0AFfoWcAq4yfll5VdIMd/RVXq0lR+wQi5ZU3Q==", + "dev": true, + "requires": { + "resolve": "^1.9.0" + } + }, + "reduce-flatten": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", + "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==", + "dev": true + }, + "resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "requires": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } + }, + "resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + }, + "select2": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/select2/-/select2-4.0.13.tgz", + "integrity": "sha512-1JeB87s6oN/TDxQQYCvS5EFoQyvV6eYMZZ0AeA4tdFDYWN3BAGZ8npr17UBFddU0lgAt3H0yjX3X6/ekOj1yjw==" + }, + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true + }, + "source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, + "style-loader": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-2.0.0.tgz", + "integrity": "sha512-Z0gYUJmzZ6ZdRUqpg1r8GsaFKypE+3xAzuFeMuoHgjc9KZv3wMyCRjQIWEbhoFSq7+7yoHXySDJyyWQaPajeiQ==", + "dev": true, + "requires": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + } + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "table-layout": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.1.tgz", + "integrity": "sha512-dEquqYNJiGwY7iPfZ3wbXDI944iqanTSchrACLL2nOB+1r+h1Nzu2eH+DuPPvWvm5Ry7iAPeFlgEtP5bIp5U7Q==", + "dev": true, + "requires": { + "array-back": "^4.0.1", + "deep-extend": "~0.6.0", + "typical": "^5.2.0", + "wordwrapjs": "^4.0.0" + } + }, + "tabulator-tables": { + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/tabulator-tables/-/tabulator-tables-4.9.3.tgz", + "integrity": "sha512-iwwQqAEGGxlgrBpcmJJvMJrfjGLcCXOB3AOb/DGkXqBy1YKoYA36hIl7qXGp6Jo8dSkzFAlDT6pKLZgyhs9OnQ==" + }, + "tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true + }, + "terser": { + "version": "5.31.6", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.6.tgz", + "integrity": "sha512-PQ4DAriWzKj+qgehQ7LK5bQqCFNMmlhjR2PFFLuqGCpuCAauxemVBWwWOxo3UIwWQx8+Pr61Df++r76wDmkQBg==", + "dev": true, + "requires": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + } + }, + "terser-webpack-plugin": { + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", + "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.20", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.1", + "terser": "^5.26.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true + }, + "undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true + }, + "uniq": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", + "dev": true + }, + "update-browserslist-db": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", + "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", + "dev": true, + "requires": { + "escalade": "^3.1.2", + "picocolors": "^1.0.1" + } + }, + "uri-js": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", + "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "v8-compile-cache": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", + "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", + "dev": true + }, + "watchpack": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", + "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", + "dev": true, + "requires": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + } + }, + "webpack": { + "version": "5.94.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", + "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", + "dev": true, + "requires": { + "@types/estree": "^1.0.5", + "@webassemblyjs/ast": "^1.12.1", + "@webassemblyjs/wasm-edit": "^1.12.1", + "@webassemblyjs/wasm-parser": "^1.12.1", + "acorn": "^8.7.1", + "acorn-import-attributes": "^1.9.5", + "browserslist": "^4.21.10", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.17.1", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.11", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.2.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.3.10", + "watchpack": "^2.4.1", + "webpack-sources": "^3.2.3" + } + }, + "webpack-cli": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.2.0.tgz", + "integrity": "sha512-EIl3k88vaF4fSxWSgtAQR+VwicfLMTZ9amQtqS4o+TDPW9HGaEpbFBbAZ4A3ZOT5SOnMxNOzROsSTPiE8tBJPA==", + "dev": true, + "requires": { + "@webpack-cli/info": "^1.1.0", + "@webpack-cli/serve": "^1.1.0", + "colorette": "^1.2.1", + "command-line-usage": "^6.1.0", + "commander": "^6.2.0", + "enquirer": "^2.3.6", + "execa": "^4.1.0", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "leven": "^3.1.0", + "rechoir": "^0.7.0", + "v8-compile-cache": "^2.2.0", + "webpack-merge": "^4.2.2" + }, + "dependencies": { + "commander": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.0.tgz", + "integrity": "sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==", + "dev": true + } + } + }, + "webpack-merge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz", + "integrity": "sha512-TUE1UGoTX2Cd42j3krGYqObZbOD+xF7u28WB7tfUordytSjbWTIjK/8V0amkBfTYN4/pB/GIDlJZZ657BGG19g==", + "dev": true, + "requires": { + "lodash": "^4.17.15" + } + }, + "webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wordwrapjs": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.0.tgz", + "integrity": "sha512-Svqw723a3R34KvsMgpjFBYCgNOSdcW3mQFK4wIfhGQhtaFVOJmdYoXgi63ne3dTlWgatVcUc7t4HtQ/+bUVIzQ==", + "dev": true, + "requires": { + "reduce-flatten": "^2.0.0", + "typical": "^5.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } +} diff --git a/js/package.json b/js/package.json new file mode 100644 index 0000000..6aff81b --- /dev/null +++ b/js/package.json @@ -0,0 +1,31 @@ +{ + "name": "timetrackerjs", + "version": "1.0.0", + "description": "", + "private": true, + "scripts": { + "build": "webpack --config webpack.config.js" + }, + "build": "webpack", + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@nextcloud/browserslist-config": "^3.0.1", + "css-loader": "^5.0.1", + "file-loader": "^6.2.0", + "style-loader": "^2.0.0", + "webpack": "^5.94.0", + "webpack-cli": "^4.2.0" + }, + "dependencies": { + "chart.js": "^2.9.4", + "daterangepicker": "^3.1.0", + "jquery": "^3.5.1", + "jquery-migrate": "^3.3.2", + "jqueryui": "^1.11.1", + "moment": "^2.29.4", + "select2": "^4.0.13", + "tabulator-tables": "^4.9.3" + } +} diff --git a/js/reports.js b/js/reports.js deleted file mode 100644 index a1e4f91..0000000 --- a/js/reports.js +++ /dev/null @@ -1,217 +0,0 @@ -(function() { - - $( function() { - - var group1 = "project"; - var group2 = "user"; - var group3 = "day"; - var filterProjectId = ""; - var filterClientId = ""; - - $(document).ready(function() { - $("#dialog-confirm").dialog({ - autoOpen: false, - modal: true - }); - - var start = moment().subtract(29, 'days'); - var end = moment(); - function cb(start, end) { - $('#report-range span').html(start.format('DD/MM/YY') + ' - ' + end.format('DD/MM/YY')); - } - $("#report-range").daterangepicker({ - timePicker: false, - startDate: start, - endDate: end, - ranges: { - 'Today': [moment(), moment()], - 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], - 'Last 7 Days': [moment().subtract(6, 'days'), moment()], - 'Last 30 Days': [moment().subtract(29, 'days'), moment()], - 'Last 90 Days': [moment().subtract(89, 'days'), moment()], - 'Last 365 Days': [moment().subtract(364, 'days'), moment()], - 'This Month': [moment().startOf('month'), moment().endOf('month')], - 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')], - 'The Month Before Last': [moment().subtract(2, 'month').startOf('month'), moment().subtract(2, 'month').endOf('month')], - 'This Year': [moment().startOf('year'), moment().endOf('year')], - 'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')], - - }, - locale: { - format: 'DD/MM/YY' - } - },cb); - $("#report-range").on('apply.daterangepicker', function(ev, picker) { - start = picker.startDate; - end = picker.endDate; - getReport(); - }); - cb(start, end); - $("#group1").select2(); - $("#group2").select2(); - $("#group3").select2(); - $('#group1').on("change", function(e) { - group1 = e.val; - getReport(); - }); - $('#group2').on("change", function(e) { - group2 = e.val; - getReport(); - }); - $('#group3').on("change", function(e) { - group3 = e.val; - getReport(); - }); - getReport(); - $("#filter-project").select2({ - tags: true, - width: '200px', - escapeMarkup : function(markup) { return markup; }, - placeholder: "Select project", - allowClear: true, - ajax: { - tags: true, - url: OC.generateUrl('/apps/timetracker/ajax/projects'), - - dataType: 'json', - delay: 250, - results: function (data, page) { //json parse - return { - results: $.map(data.Projects,function(val, i){ - return { id: val.id, text:val.name}; - }), - pagination: { - more: false, - } - }; - }, - cache: false, - - }, - initSelection: function(element, callback) { - - var results; - results = []; - results.push({ - id: projectId, - text: projectName, - }); - - callback(results[0]); - } - }); - - $("#filter-project").on("change", function (e) { - - filterProjectId = $(e.target).val(); - getReport(); - }); - - - - $("#filter-client").select2({ - tags: true, - width: '200px', - escapeMarkup : function(markup) { return markup; }, - placeholder: "Select client", - allowClear: true, - ajax: { - tags: true, - url: OC.generateUrl('/apps/timetracker/ajax/clients'), - - dataType: 'json', - delay: 250, - results: function (data, page) { //json parse - return { - results: $.map(data.Clients,function(val, i){ - return { id: val.id, text:val.name}; - }), - pagination: { - more: false, - } - }; - }, - cache: false, - - }, - initSelection: function(element, callback) { - - var results; - results = []; - results.push({ - id: clientId, - text: clientName, - }); - - callback(results[0]); - } - }); - - $("#filter-client").on("change", function (e) { - - filterClientId = $(e.target).val(); - getReport(); - }); - $('input.select2-input').attr('autocomplete', "xxxxxxxxxxx"); - - - - function getReport(){ - var baseUrl = OC.generateUrl('/apps/timetracker/ajax/report?name=&from='+start.unix()+'&to='+end.unix()+'&group1='+group1+'&group2='+group2+'&timegroup='+group3+'&filterProjectId='+filterProjectId+'&filterClientId='+filterClientId); - var table = new Tabulator("#report", { - ajaxURL:baseUrl, - layout:"fitColumns", - columns:[ - //{title:"Id", field:"id", width:100}, //column has a fixed width of 100px; - {title:"#", field:"", formatter:"rownum"}, - {title:"Name", field:"name", widthGrow:1}, //column will be allocated 1/5 of the remaining space - {title:"Details", field:"details", widthGrow:1}, //column will be allocated 1/5 of the remaining space - {title:"User", field:"userUid", widthGrow:1}, //column will be allocated 1/5 of the remaining space - {title:"Project", field:"project", widthGrow:1}, //column will be allocated 1/5 of the remaining space - {title:"Client", field:"client", widthGrow:1}, //column will be allocated 1/5 of the remaining space - {title:"When", field:"time", widthGrow:1}, //column will be allocated 1/5 of the remaining space - {title:"Total Duration", field:"totalDuration",formatter:function(cell, formatterParams, onRendered){ - //cell - the cell component - //formatterParams - parameters set for the column - //onRendered - function to call when the formatter has been rendered - var duration = cell.getValue(); - var s = Math.floor( (duration) % 60 ); - var m = Math.floor( (duration/60) % 60 ); - var h = Math.floor( (duration/(60*60))); - - return h + ':' + m + ':' + s; - - },bottomCalc:"sum", bottomCalcParams:{ - precision:1, - },bottomCalcFormatter:function(cell, formatterParams, onRendered){ - //cell - the cell component - //formatterParams - parameters set for the column - //onRendered - function to call when the formatter has been rendered - var duration = cell.getValue(); - var s = Math.floor( (duration) % 60 ); - var m = Math.floor( (duration/60) % 60 ); - var h = Math.floor( (duration/(60*60))); - - return h + ':' + m + ':' + s; - - }}, //column will be allocated 1/5 of the remaining space - ], - ajaxResponse:function(url, params, response){ - - return response.items; //return the tableData property of a response json object - }, - }); - $("#download-csv").off().click(function(){ - table.download("csv", "data.csv"); - return false; - }); - $("#download-json").off().click(function(){ - table.download("json", "data.json"); - return false; - }); - } - }); - - - } ); -}()); diff --git a/js/select2.full.js b/js/select2.full.js deleted file mode 100644 index 0e89784..0000000 --- a/js/select2.full.js +++ /dev/null @@ -1,6559 +0,0 @@ -/*! - * Select2 4.0.6-rc.1 - * https://select2.github.io - * - * Released under the MIT license - * https://github.com/select2/select2/blob/master/LICENSE.md - */ -;(function (factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['jquery'], factory); - } else if (typeof module === 'object' && module.exports) { - // Node/CommonJS - module.exports = function (root, jQuery) { - if (jQuery === undefined) { - // require('jQuery') returns a factory that requires window to - // build a jQuery instance, we normalize how we use modules - // that require this pattern but the window provided is a noop - // if it's defined (how jquery works) - if (typeof window !== 'undefined') { - jQuery = require('jquery'); - } - else { - jQuery = require('jquery')(root); - } - } - factory(jQuery); - return jQuery; - }; - } else { - // Browser globals - factory(jQuery); - } -} (function (jQuery) { - // This is needed so we can catch the AMD loader configuration and use it - // The inner file should be wrapped (by `banner.start.js`) in a function that - // returns the AMD loader references. - var S2 =(function () { - // Restore the Select2 AMD loader so it can be used - // Needed mostly in the language files, where the loader is not inserted - if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { - var S2 = jQuery.fn.select2.amd; - } -var S2;(function () { if (!S2 || !S2.requirejs) { -if (!S2) { S2 = {}; } else { require = S2; } -/** - * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. - * Released under MIT license, http://github.com/requirejs/almond/LICENSE - */ -//Going sloppy to avoid 'use strict' string cost, but strict practices should -//be followed. -/*global setTimeout: false */ - -var requirejs, require, define; -(function (undef) { - var main, req, makeMap, handlers, - defined = {}, - waiting = {}, - config = {}, - defining = {}, - hasOwn = Object.prototype.hasOwnProperty, - aps = [].slice, - jsSuffixRegExp = /\.js$/; - - function hasProp(obj, prop) { - return hasOwn.call(obj, prop); - } - - /** - * Given a relative module name, like ./something, normalize it to - * a real name that can be mapped to a path. - * @param {String} name the relative name - * @param {String} baseName a real name that the name arg is relative - * to. - * @returns {String} normalized name - */ - function normalize(name, baseName) { - var nameParts, nameSegment, mapValue, foundMap, lastIndex, - foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, - baseParts = baseName && baseName.split("/"), - map = config.map, - starMap = (map && map['*']) || {}; - - //Adjust any relative paths. - if (name) { - name = name.split('/'); - lastIndex = name.length - 1; - - // If wanting node ID compatibility, strip .js from end - // of IDs. Have to do this here, and not in nameToUrl - // because node allows either .js or non .js to map - // to same file. - if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { - name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); - } - - // Starts with a '.' so need the baseName - if (name[0].charAt(0) === '.' && baseParts) { - //Convert baseName to array, and lop off the last part, - //so that . matches that 'directory' and not name of the baseName's - //module. For instance, baseName of 'one/two/three', maps to - //'one/two/three.js', but we want the directory, 'one/two' for - //this normalization. - normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); - name = normalizedBaseParts.concat(name); - } - - //start trimDots - for (i = 0; i < name.length; i++) { - part = name[i]; - if (part === '.') { - name.splice(i, 1); - i -= 1; - } else if (part === '..') { - // If at the start, or previous value is still .., - // keep them so that when converted to a path it may - // still work when converted to a path, even though - // as an ID it is less than ideal. In larger point - // releases, may be better to just kick out an error. - if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { - continue; - } else if (i > 0) { - name.splice(i - 1, 2); - i -= 2; - } - } - } - //end trimDots - - name = name.join('/'); - } - - //Apply map config if available. - if ((baseParts || starMap) && map) { - nameParts = name.split('/'); - - for (i = nameParts.length; i > 0; i -= 1) { - nameSegment = nameParts.slice(0, i).join("/"); - - if (baseParts) { - //Find the longest baseName segment match in the config. - //So, do joins on the biggest to smallest lengths of baseParts. - for (j = baseParts.length; j > 0; j -= 1) { - mapValue = map[baseParts.slice(0, j).join('/')]; - - //baseName segment has config, find if it has one for - //this name. - if (mapValue) { - mapValue = mapValue[nameSegment]; - if (mapValue) { - //Match, update name to the new value. - foundMap = mapValue; - foundI = i; - break; - } - } - } - } - - if (foundMap) { - break; - } - - //Check for a star map match, but just hold on to it, - //if there is a shorter segment match later in a matching - //config, then favor over this star map. - if (!foundStarMap && starMap && starMap[nameSegment]) { - foundStarMap = starMap[nameSegment]; - starI = i; - } - } - - if (!foundMap && foundStarMap) { - foundMap = foundStarMap; - foundI = starI; - } - - if (foundMap) { - nameParts.splice(0, foundI, foundMap); - name = nameParts.join('/'); - } - } - - return name; - } - - function makeRequire(relName, forceSync) { - return function () { - //A version of a require function that passes a moduleName - //value for items that may need to - //look up paths relative to the moduleName - var args = aps.call(arguments, 0); - - //If first arg is not require('string'), and there is only - //one arg, it is the array form without a callback. Insert - //a null so that the following concat is correct. - if (typeof args[0] !== 'string' && args.length === 1) { - args.push(null); - } - return req.apply(undef, args.concat([relName, forceSync])); - }; - } - - function makeNormalize(relName) { - return function (name) { - return normalize(name, relName); - }; - } - - function makeLoad(depName) { - return function (value) { - defined[depName] = value; - }; - } - - function callDep(name) { - if (hasProp(waiting, name)) { - var args = waiting[name]; - delete waiting[name]; - defining[name] = true; - main.apply(undef, args); - } - - if (!hasProp(defined, name) && !hasProp(defining, name)) { - throw new Error('No ' + name); - } - return defined[name]; - } - - //Turns a plugin!resource to [plugin, resource] - //with the plugin being undefined if the name - //did not have a plugin prefix. - function splitPrefix(name) { - var prefix, - index = name ? name.indexOf('!') : -1; - if (index > -1) { - prefix = name.substring(0, index); - name = name.substring(index + 1, name.length); - } - return [prefix, name]; - } - - //Creates a parts array for a relName where first part is plugin ID, - //second part is resource ID. Assumes relName has already been normalized. - function makeRelParts(relName) { - return relName ? splitPrefix(relName) : []; - } - - /** - * Makes a name map, normalizing the name, and using a plugin - * for normalization if necessary. Grabs a ref to plugin - * too, as an optimization. - */ - makeMap = function (name, relParts) { - var plugin, - parts = splitPrefix(name), - prefix = parts[0], - relResourceName = relParts[1]; - - name = parts[1]; - - if (prefix) { - prefix = normalize(prefix, relResourceName); - plugin = callDep(prefix); - } - - //Normalize according - if (prefix) { - if (plugin && plugin.normalize) { - name = plugin.normalize(name, makeNormalize(relResourceName)); - } else { - name = normalize(name, relResourceName); - } - } else { - name = normalize(name, relResourceName); - parts = splitPrefix(name); - prefix = parts[0]; - name = parts[1]; - if (prefix) { - plugin = callDep(prefix); - } - } - - //Using ridiculous property names for space reasons - return { - f: prefix ? prefix + '!' + name : name, //fullName - n: name, - pr: prefix, - p: plugin - }; - }; - - function makeConfig(name) { - return function () { - return (config && config.config && config.config[name]) || {}; - }; - } - - handlers = { - require: function (name) { - return makeRequire(name); - }, - exports: function (name) { - var e = defined[name]; - if (typeof e !== 'undefined') { - return e; - } else { - return (defined[name] = {}); - } - }, - module: function (name) { - return { - id: name, - uri: '', - exports: defined[name], - config: makeConfig(name) - }; - } - }; - - main = function (name, deps, callback, relName) { - var cjsModule, depName, ret, map, i, relParts, - args = [], - callbackType = typeof callback, - usingExports; - - //Use name if no relName - relName = relName || name; - relParts = makeRelParts(relName); - - //Call the callback to define the module, if necessary. - if (callbackType === 'undefined' || callbackType === 'function') { - //Pull out the defined dependencies and pass the ordered - //values to the callback. - //Default to [require, exports, module] if no deps - deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; - for (i = 0; i < deps.length; i += 1) { - map = makeMap(deps[i], relParts); - depName = map.f; - - //Fast path CommonJS standard dependencies. - if (depName === "require") { - args[i] = handlers.require(name); - } else if (depName === "exports") { - //CommonJS module spec 1.1 - args[i] = handlers.exports(name); - usingExports = true; - } else if (depName === "module") { - //CommonJS module spec 1.1 - cjsModule = args[i] = handlers.module(name); - } else if (hasProp(defined, depName) || - hasProp(waiting, depName) || - hasProp(defining, depName)) { - args[i] = callDep(depName); - } else if (map.p) { - map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); - args[i] = defined[depName]; - } else { - throw new Error(name + ' missing ' + depName); - } - } - - ret = callback ? callback.apply(defined[name], args) : undefined; - - if (name) { - //If setting exports via "module" is in play, - //favor that over return value and exports. After that, - //favor a non-undefined return value over exports use. - if (cjsModule && cjsModule.exports !== undef && - cjsModule.exports !== defined[name]) { - defined[name] = cjsModule.exports; - } else if (ret !== undef || !usingExports) { - //Use the return value from the function. - defined[name] = ret; - } - } - } else if (name) { - //May just be an object definition for the module. Only - //worry about defining if have a module name. - defined[name] = callback; - } - }; - - requirejs = require = req = function (deps, callback, relName, forceSync, alt) { - if (typeof deps === "string") { - if (handlers[deps]) { - //callback in this case is really relName - return handlers[deps](callback); - } - //Just return the module wanted. In this scenario, the - //deps arg is the module name, and second arg (if passed) - //is just the relName. - //Normalize module name, if it contains . or .. - return callDep(makeMap(deps, makeRelParts(callback)).f); - } else if (!deps.splice) { - //deps is a config object, not an array. - config = deps; - if (config.deps) { - req(config.deps, config.callback); - } - if (!callback) { - return; - } - - if (callback.splice) { - //callback is an array, which means it is a dependency list. - //Adjust args if there are dependencies - deps = callback; - callback = relName; - relName = null; - } else { - deps = undef; - } - } - - //Support require(['a']) - callback = callback || function () {}; - - //If relName is a function, it is an errback handler, - //so remove it. - if (typeof relName === 'function') { - relName = forceSync; - forceSync = alt; - } - - //Simulate async callback; - if (forceSync) { - main(undef, deps, callback, relName); - } else { - //Using a non-zero value because of concern for what old browsers - //do, and latest browsers "upgrade" to 4 if lower value is used: - //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: - //If want a value immediately, use require('id') instead -- something - //that works in almond on the global level, but not guaranteed and - //unlikely to work in other AMD implementations. - setTimeout(function () { - main(undef, deps, callback, relName); - }, 4); - } - - return req; - }; - - /** - * Just drops the config on the floor, but returns req in case - * the config return value is used. - */ - req.config = function (cfg) { - return req(cfg); - }; - - /** - * Expose module registry for debugging and tooling - */ - requirejs._defined = defined; - - define = function (name, deps, callback) { - if (typeof name !== 'string') { - throw new Error('See almond README: incorrect module build, no module name'); - } - - //This module may not have dependencies - if (!deps.splice) { - //deps is not an array, so probably means - //an object literal or factory function for - //the value. Adjust args. - callback = deps; - deps = []; - } - - if (!hasProp(defined, name) && !hasProp(waiting, name)) { - waiting[name] = [name, deps, callback]; - } - }; - - define.amd = { - jQuery: true - }; -}()); - -S2.requirejs = requirejs;S2.require = require;S2.define = define; -} -}()); -S2.define("almond", function(){}); - -/* global jQuery:false, $:false */ -S2.define('jquery',[],function () { - var _$ = jQuery || $; - - if (_$ == null && console && console.error) { - console.error( - 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + - 'found. Make sure that you are including jQuery before Select2 on your ' + - 'web page.' - ); - } - - return _$; -}); - -S2.define('select2/utils',[ - 'jquery' -], function ($) { - var Utils = {}; - - Utils.Extend = function (ChildClass, SuperClass) { - var __hasProp = {}.hasOwnProperty; - - function BaseConstructor () { - this.constructor = ChildClass; - } - - for (var key in SuperClass) { - if (__hasProp.call(SuperClass, key)) { - ChildClass[key] = SuperClass[key]; - } - } - - BaseConstructor.prototype = SuperClass.prototype; - ChildClass.prototype = new BaseConstructor(); - ChildClass.__super__ = SuperClass.prototype; - - return ChildClass; - }; - - function getMethods (theClass) { - var proto = theClass.prototype; - - var methods = []; - - for (var methodName in proto) { - var m = proto[methodName]; - - if (typeof m !== 'function') { - continue; - } - - if (methodName === 'constructor') { - continue; - } - - methods.push(methodName); - } - - return methods; - } - - Utils.Decorate = function (SuperClass, DecoratorClass) { - var decoratedMethods = getMethods(DecoratorClass); - var superMethods = getMethods(SuperClass); - - function DecoratedClass () { - var unshift = Array.prototype.unshift; - - var argCount = DecoratorClass.prototype.constructor.length; - - var calledConstructor = SuperClass.prototype.constructor; - - if (argCount > 0) { - unshift.call(arguments, SuperClass.prototype.constructor); - - calledConstructor = DecoratorClass.prototype.constructor; - } - - calledConstructor.apply(this, arguments); - } - - DecoratorClass.displayName = SuperClass.displayName; - - function ctr () { - this.constructor = DecoratedClass; - } - - DecoratedClass.prototype = new ctr(); - - for (var m = 0; m < superMethods.length; m++) { - var superMethod = superMethods[m]; - - DecoratedClass.prototype[superMethod] = - SuperClass.prototype[superMethod]; - } - - var calledMethod = function (methodName) { - // Stub out the original method if it's not decorating an actual method - var originalMethod = function () {}; - - if (methodName in DecoratedClass.prototype) { - originalMethod = DecoratedClass.prototype[methodName]; - } - - var decoratedMethod = DecoratorClass.prototype[methodName]; - - return function () { - var unshift = Array.prototype.unshift; - - unshift.call(arguments, originalMethod); - - return decoratedMethod.apply(this, arguments); - }; - }; - - for (var d = 0; d < decoratedMethods.length; d++) { - var decoratedMethod = decoratedMethods[d]; - - DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); - } - - return DecoratedClass; - }; - - var Observable = function () { - this.listeners = {}; - }; - - Observable.prototype.on = function (event, callback) { - this.listeners = this.listeners || {}; - - if (event in this.listeners) { - this.listeners[event].push(callback); - } else { - this.listeners[event] = [callback]; - } - }; - - Observable.prototype.trigger = function (event) { - var slice = Array.prototype.slice; - var params = slice.call(arguments, 1); - - this.listeners = this.listeners || {}; - - // Params should always come in as an array - if (params == null) { - params = []; - } - - // If there are no arguments to the event, use a temporary object - if (params.length === 0) { - params.push({}); - } - - // Set the `_type` of the first object to the event - params[0]._type = event; - - if (event in this.listeners) { - this.invoke(this.listeners[event], slice.call(arguments, 1)); - } - - if ('*' in this.listeners) { - this.invoke(this.listeners['*'], arguments); - } - }; - - Observable.prototype.invoke = function (listeners, params) { - for (var i = 0, len = listeners.length; i < len; i++) { - listeners[i].apply(this, params); - } - }; - - Utils.Observable = Observable; - - Utils.generateChars = function (length) { - var chars = ''; - - for (var i = 0; i < length; i++) { - var randomChar = Math.floor(Math.random() * 36); - chars += randomChar.toString(36); - } - - return chars; - }; - - Utils.bind = function (func, context) { - return function () { - func.apply(context, arguments); - }; - }; - - Utils._convertData = function (data) { - for (var originalKey in data) { - var keys = originalKey.split('-'); - - var dataLevel = data; - - if (keys.length === 1) { - continue; - } - - for (var k = 0; k < keys.length; k++) { - var key = keys[k]; - - // Lowercase the first letter - // By default, dash-separated becomes camelCase - key = key.substring(0, 1).toLowerCase() + key.substring(1); - - if (!(key in dataLevel)) { - dataLevel[key] = {}; - } - - if (k == keys.length - 1) { - dataLevel[key] = data[originalKey]; - } - - dataLevel = dataLevel[key]; - } - - delete data[originalKey]; - } - - return data; - }; - - Utils.hasScroll = function (index, el) { - // Adapted from the function created by @ShadowScripter - // and adapted by @BillBarry on the Stack Exchange Code Review website. - // The original code can be found at - // http://codereview.stackexchange.com/q/13338 - // and was designed to be used with the Sizzle selector engine. - - var $el = $(el); - var overflowX = el.style.overflowX; - var overflowY = el.style.overflowY; - - //Check both x and y declarations - if (overflowX === overflowY && - (overflowY === 'hidden' || overflowY === 'visible')) { - return false; - } - - if (overflowX === 'scroll' || overflowY === 'scroll') { - return true; - } - - return ($el.innerHeight() < el.scrollHeight || - $el.innerWidth() < el.scrollWidth); - }; - - Utils.escapeMarkup = function (markup) { - var replaceMap = { - '\\': '\', - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', - '/': '/' - }; - - // Do not try to escape the markup if it's not a string - if (typeof markup !== 'string') { - return markup; - } - - return String(markup).replace(/[&<>"'\/\\]/g, function (match) { - return replaceMap[match]; - }); - }; - - // Append an array of jQuery nodes to a given element. - Utils.appendMany = function ($element, $nodes) { - // jQuery 1.7.x does not support $.fn.append() with an array - // Fall back to a jQuery object collection using $.fn.add() - if ($.fn.jquery.substr(0, 3) === '1.7') { - var $jqNodes = $(); - - $.map($nodes, function (node) { - $jqNodes = $jqNodes.add(node); - }); - - $nodes = $jqNodes; - } - - $element.append($nodes); - }; - - // Cache objects in Utils.__cache instead of $.data (see #4346) - Utils.__cache = {}; - - var id = 0; - Utils.GetUniqueElementId = function (element) { - // Get a unique element Id. If element has no id, - // creates a new unique number, stores it in the id - // attribute and returns the new id. - // If an id already exists, it simply returns it. - - var select2Id = element.getAttribute('data-select2-id'); - if (select2Id == null) { - // If element has id, use it. - if (element.id) { - select2Id = element.id; - element.setAttribute('data-select2-id', select2Id); - } else { - element.setAttribute('data-select2-id', ++id); - select2Id = id.toString(); - } - } - return select2Id; - }; - - Utils.StoreData = function (element, name, value) { - // Stores an item in the cache for a specified element. - // name is the cache key. - var id = Utils.GetUniqueElementId(element); - if (!Utils.__cache[id]) { - Utils.__cache[id] = {}; - } - - Utils.__cache[id][name] = value; - }; - - Utils.GetData = function (element, name) { - // Retrieves a value from the cache by its key (name) - // name is optional. If no name specified, return - // all cache items for the specified element. - // and for a specified element. - var id = Utils.GetUniqueElementId(element); - if (name) { - if (Utils.__cache[id]) { - return Utils.__cache[id][name] != null ? - Utils.__cache[id][name]: - $(element).data(name); // Fallback to HTML5 data attribs. - } - return $(element).data(name); // Fallback to HTML5 data attribs. - } else { - return Utils.__cache[id]; - } - }; - - Utils.RemoveData = function (element) { - // Removes all cached items for a specified element. - var id = Utils.GetUniqueElementId(element); - if (Utils.__cache[id] != null) { - delete Utils.__cache[id]; - } - }; - - return Utils; -}); - -S2.define('select2/results',[ - 'jquery', - './utils' -], function ($, Utils) { - function Results ($element, options, dataAdapter) { - this.$element = $element; - this.data = dataAdapter; - this.options = options; - - Results.__super__.constructor.call(this); - } - - Utils.Extend(Results, Utils.Observable); - - Results.prototype.render = function () { - var $results = $( - '
      ' - ); - - if (this.options.get('multiple')) { - $results.attr('aria-multiselectable', 'true'); - } - - this.$results = $results; - - return $results; - }; - - Results.prototype.clear = function () { - this.$results.empty(); - }; - - Results.prototype.displayMessage = function (params) { - var escapeMarkup = this.options.get('escapeMarkup'); - - this.clear(); - this.hideLoading(); - - var $message = $( - '
    • ' - ); - - var message = this.options.get('translations').get(params.message); - - $message.append( - escapeMarkup( - message(params.args) - ) - ); - - $message[0].className += ' select2-results__message'; - - this.$results.append($message); - }; - - Results.prototype.hideMessages = function () { - this.$results.find('.select2-results__message').remove(); - }; - - Results.prototype.append = function (data) { - this.hideLoading(); - - var $options = []; - - if (data.results == null || data.results.length === 0) { - if (this.$results.children().length === 0) { - this.trigger('results:message', { - message: 'noResults' - }); - } - - return; - } - - data.results = this.sort(data.results); - - for (var d = 0; d < data.results.length; d++) { - var item = data.results[d]; - - var $option = this.option(item); - - $options.push($option); - } - - this.$results.append($options); - }; - - Results.prototype.position = function ($results, $dropdown) { - var $resultsContainer = $dropdown.find('.select2-results'); - $resultsContainer.append($results); - }; - - Results.prototype.sort = function (data) { - var sorter = this.options.get('sorter'); - - return sorter(data); - }; - - Results.prototype.highlightFirstItem = function () { - var $options = this.$results - .find('.select2-results__option[aria-selected]'); - - var $selected = $options.filter('[aria-selected=true]'); - - // Check if there are any selected options - if ($selected.length > 0) { - // If there are selected options, highlight the first - $selected.first().trigger('mouseenter'); - } else { - // If there are no selected options, highlight the first option - // in the dropdown - $options.first().trigger('mouseenter'); - } - - this.ensureHighlightVisible(); - }; - - Results.prototype.setClasses = function () { - var self = this; - - this.data.current(function (selected) { - var selectedIds = $.map(selected, function (s) { - return s.id.toString(); - }); - - var $options = self.$results - .find('.select2-results__option[aria-selected]'); - - $options.each(function () { - var $option = $(this); - - var item = Utils.GetData(this, 'data'); - - // id needs to be converted to a string when comparing - var id = '' + item.id; - - if ((item.element != null && item.element.selected) || - (item.element == null && $.inArray(id, selectedIds) > -1)) { - $option.attr('aria-selected', 'true'); - } else { - $option.attr('aria-selected', 'false'); - } - }); - - }); - }; - - Results.prototype.showLoading = function (params) { - this.hideLoading(); - - var loadingMore = this.options.get('translations').get('searching'); - - var loading = { - disabled: true, - loading: true, - text: loadingMore(params) - }; - var $loading = this.option(loading); - $loading.className += ' loading-results'; - - this.$results.prepend($loading); - }; - - Results.prototype.hideLoading = function () { - this.$results.find('.loading-results').remove(); - }; - - Results.prototype.option = function (data) { - var option = document.createElement('li'); - option.className = 'select2-results__option'; - - var attrs = { - 'role': 'treeitem', - 'aria-selected': 'false' - }; - - if (data.disabled) { - delete attrs['aria-selected']; - attrs['aria-disabled'] = 'true'; - } - - if (data.id == null) { - delete attrs['aria-selected']; - } - - if (data._resultId != null) { - option.id = data._resultId; - } - - if (data.title) { - option.title = data.title; - } - - if (data.children) { - attrs.role = 'group'; - attrs['aria-label'] = data.text; - delete attrs['aria-selected']; - } - - for (var attr in attrs) { - var val = attrs[attr]; - - option.setAttribute(attr, val); - } - - if (data.children) { - var $option = $(option); - - var label = document.createElement('strong'); - label.className = 'select2-results__group'; - - var $label = $(label); - this.template(data, label); - - var $children = []; - - for (var c = 0; c < data.children.length; c++) { - var child = data.children[c]; - - var $child = this.option(child); - - $children.push($child); - } - - var $childrenContainer = $('
        ', { - 'class': 'select2-results__options select2-results__options--nested' - }); - - $childrenContainer.append($children); - - $option.append(label); - $option.append($childrenContainer); - } else { - this.template(data, option); - } - - Utils.StoreData(option, 'data', data); - - return option; - }; - - Results.prototype.bind = function (container, $container) { - var self = this; - - var id = container.id + '-results'; - - this.$results.attr('id', id); - - container.on('results:all', function (params) { - self.clear(); - self.append(params.data); - - if (container.isOpen()) { - self.setClasses(); - self.highlightFirstItem(); - } - }); - - container.on('results:append', function (params) { - self.append(params.data); - - if (container.isOpen()) { - self.setClasses(); - } - }); - - container.on('query', function (params) { - self.hideMessages(); - self.showLoading(params); - }); - - container.on('select', function () { - if (!container.isOpen()) { - return; - } - - self.setClasses(); - self.highlightFirstItem(); - }); - - container.on('unselect', function () { - if (!container.isOpen()) { - return; - } - - self.setClasses(); - self.highlightFirstItem(); - }); - - container.on('open', function () { - // When the dropdown is open, aria-expended="true" - self.$results.attr('aria-expanded', 'true'); - self.$results.attr('aria-hidden', 'false'); - - self.setClasses(); - self.ensureHighlightVisible(); - }); - - container.on('close', function () { - // When the dropdown is closed, aria-expended="false" - self.$results.attr('aria-expanded', 'false'); - self.$results.attr('aria-hidden', 'true'); - self.$results.removeAttr('aria-activedescendant'); - }); - - container.on('results:toggle', function () { - var $highlighted = self.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - $highlighted.trigger('mouseup'); - }); - - container.on('results:select', function () { - var $highlighted = self.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - var data = Utils.GetData($highlighted[0], 'data'); - - if ($highlighted.attr('aria-selected') == 'true') { - self.trigger('close', {}); - } else { - self.trigger('select', { - data: data - }); - } - }); - - container.on('results:previous', function () { - var $highlighted = self.getHighlightedResults(); - - var $options = self.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - // If we are already at te top, don't move further - // If no options, currentIndex will be -1 - if (currentIndex <= 0) { - return; - } - - var nextIndex = currentIndex - 1; - - // If none are highlighted, highlight the first - if ($highlighted.length === 0) { - nextIndex = 0; - } - - var $next = $options.eq(nextIndex); - - $next.trigger('mouseenter'); - - var currentOffset = self.$results.offset().top; - var nextTop = $next.offset().top; - var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); - - if (nextIndex === 0) { - self.$results.scrollTop(0); - } else if (nextTop - currentOffset < 0) { - self.$results.scrollTop(nextOffset); - } - }); - - container.on('results:next', function () { - var $highlighted = self.getHighlightedResults(); - - var $options = self.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - var nextIndex = currentIndex + 1; - - // If we are at the last option, stay there - if (nextIndex >= $options.length) { - return; - } - - var $next = $options.eq(nextIndex); - - $next.trigger('mouseenter'); - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var nextBottom = $next.offset().top + $next.outerHeight(false); - var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; - - if (nextIndex === 0) { - self.$results.scrollTop(0); - } else if (nextBottom > currentOffset) { - self.$results.scrollTop(nextOffset); - } - }); - - container.on('results:focus', function (params) { - params.element.addClass('select2-results__option--highlighted'); - }); - - container.on('results:message', function (params) { - self.displayMessage(params); - }); - - if ($.fn.mousewheel) { - this.$results.on('mousewheel', function (e) { - var top = self.$results.scrollTop(); - - var bottom = self.$results.get(0).scrollHeight - top + e.deltaY; - - var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; - var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); - - if (isAtTop) { - self.$results.scrollTop(0); - - e.preventDefault(); - e.stopPropagation(); - } else if (isAtBottom) { - self.$results.scrollTop( - self.$results.get(0).scrollHeight - self.$results.height() - ); - - e.preventDefault(); - e.stopPropagation(); - } - }); - } - - this.$results.on('mouseup', '.select2-results__option[aria-selected]', - function (evt) { - var $this = $(this); - - var data = Utils.GetData(this, 'data'); - - if ($this.attr('aria-selected') === 'true') { - if (self.options.get('multiple')) { - self.trigger('unselect', { - originalEvent: evt, - data: data - }); - } else { - self.trigger('close', {}); - } - - return; - } - - self.trigger('select', { - originalEvent: evt, - data: data - }); - }); - - this.$results.on('mouseenter', '.select2-results__option[aria-selected]', - function (evt) { - var data = Utils.GetData(this, 'data'); - - self.getHighlightedResults() - .removeClass('select2-results__option--highlighted'); - - self.trigger('results:focus', { - data: data, - element: $(this) - }); - }); - }; - - Results.prototype.getHighlightedResults = function () { - var $highlighted = this.$results - .find('.select2-results__option--highlighted'); - - return $highlighted; - }; - - Results.prototype.destroy = function () { - this.$results.remove(); - }; - - Results.prototype.ensureHighlightVisible = function () { - var $highlighted = this.getHighlightedResults(); - - if ($highlighted.length === 0) { - return; - } - - var $options = this.$results.find('[aria-selected]'); - - var currentIndex = $options.index($highlighted); - - var currentOffset = this.$results.offset().top; - var nextTop = $highlighted.offset().top; - var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); - - var offsetDelta = nextTop - currentOffset; - nextOffset -= $highlighted.outerHeight(false) * 2; - - if (currentIndex <= 2) { - this.$results.scrollTop(0); - } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { - this.$results.scrollTop(nextOffset); - } - }; - - Results.prototype.template = function (result, container) { - var template = this.options.get('templateResult'); - var escapeMarkup = this.options.get('escapeMarkup'); - - var content = template(result, container); - - if (content == null) { - container.style.display = 'none'; - } else if (typeof content === 'string') { - container.innerHTML = escapeMarkup(content); - } else { - $(container).append(content); - } - }; - - return Results; -}); - -S2.define('select2/keys',[ - -], function () { - var KEYS = { - BACKSPACE: 8, - TAB: 9, - ENTER: 13, - SHIFT: 16, - CTRL: 17, - ALT: 18, - ESC: 27, - SPACE: 32, - PAGE_UP: 33, - PAGE_DOWN: 34, - END: 35, - HOME: 36, - LEFT: 37, - UP: 38, - RIGHT: 39, - DOWN: 40, - DELETE: 46 - }; - - return KEYS; -}); - -S2.define('select2/selection/base',[ - 'jquery', - '../utils', - '../keys' -], function ($, Utils, KEYS) { - function BaseSelection ($element, options) { - this.$element = $element; - this.options = options; - - BaseSelection.__super__.constructor.call(this); - } - - Utils.Extend(BaseSelection, Utils.Observable); - - BaseSelection.prototype.render = function () { - var $selection = $( - '' - ); - - this._tabindex = 0; - - if (Utils.GetData(this.$element[0], 'old-tabindex') != null) { - this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex'); - } else if (this.$element.attr('tabindex') != null) { - this._tabindex = this.$element.attr('tabindex'); - } - - $selection.attr('title', this.$element.attr('title')); - $selection.attr('tabindex', this._tabindex); - - this.$selection = $selection; - - return $selection; - }; - - BaseSelection.prototype.bind = function (container, $container) { - var self = this; - - var id = container.id + '-container'; - var resultsId = container.id + '-results'; - - this.container = container; - - this.$selection.on('focus', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('blur', function (evt) { - self._handleBlur(evt); - }); - - this.$selection.on('keydown', function (evt) { - self.trigger('keypress', evt); - - if (evt.which === KEYS.SPACE) { - evt.preventDefault(); - } - }); - - container.on('results:focus', function (params) { - self.$selection.attr('aria-activedescendant', params.data._resultId); - }); - - container.on('selection:update', function (params) { - self.update(params.data); - }); - - container.on('open', function () { - // When the dropdown is open, aria-expanded="true" - self.$selection.attr('aria-expanded', 'true'); - self.$selection.attr('aria-owns', resultsId); - - self._attachCloseHandler(container); - }); - - container.on('close', function () { - // When the dropdown is closed, aria-expanded="false" - self.$selection.attr('aria-expanded', 'false'); - self.$selection.removeAttr('aria-activedescendant'); - self.$selection.removeAttr('aria-owns'); - - self.$selection.focus(); - window.setTimeout(function () { - self.$selection.focus(); - }, 0); - - self._detachCloseHandler(container); - }); - - container.on('enable', function () { - self.$selection.attr('tabindex', self._tabindex); - }); - - container.on('disable', function () { - self.$selection.attr('tabindex', '-1'); - }); - }; - - BaseSelection.prototype._handleBlur = function (evt) { - var self = this; - - // This needs to be delayed as the active element is the body when the tab - // key is pressed, possibly along with others. - window.setTimeout(function () { - // Don't trigger `blur` if the focus is still in the selection - if ( - (document.activeElement == self.$selection[0]) || - ($.contains(self.$selection[0], document.activeElement)) - ) { - return; - } - - self.trigger('blur', evt); - }, 1); - }; - - BaseSelection.prototype._attachCloseHandler = function (container) { - var self = this; - - $(document.body).on('mousedown.select2.' + container.id, function (e) { - var $target = $(e.target); - - var $select = $target.closest('.select2'); - - var $all = $('.select2.select2-container--open'); - - $all.each(function () { - var $this = $(this); - - if (this == $select[0]) { - return; - } - - var $element = Utils.GetData(this, 'element'); - - $element.select2('close'); - }); - }); - }; - - BaseSelection.prototype._detachCloseHandler = function (container) { - $(document.body).off('mousedown.select2.' + container.id); - }; - - BaseSelection.prototype.position = function ($selection, $container) { - var $selectionContainer = $container.find('.selection'); - $selectionContainer.append($selection); - }; - - BaseSelection.prototype.destroy = function () { - this._detachCloseHandler(this.container); - }; - - BaseSelection.prototype.update = function (data) { - throw new Error('The `update` method must be defined in child classes.'); - }; - - return BaseSelection; -}); - -S2.define('select2/selection/single',[ - 'jquery', - './base', - '../utils', - '../keys' -], function ($, BaseSelection, Utils, KEYS) { - function SingleSelection () { - SingleSelection.__super__.constructor.apply(this, arguments); - } - - Utils.Extend(SingleSelection, BaseSelection); - - SingleSelection.prototype.render = function () { - var $selection = SingleSelection.__super__.render.call(this); - - $selection.addClass('select2-selection--single'); - - $selection.html( - '' + - '' + - '' + - '' - ); - - return $selection; - }; - - SingleSelection.prototype.bind = function (container, $container) { - var self = this; - - SingleSelection.__super__.bind.apply(this, arguments); - - var id = container.id + '-container'; - - this.$selection.find('.select2-selection__rendered') - .attr('id', id) - .attr('role', 'textbox') - .attr('aria-readonly', 'true'); - this.$selection.attr('aria-labelledby', id); - - this.$selection.on('mousedown', function (evt) { - // Only respond to left clicks - if (evt.which !== 1) { - return; - } - - self.trigger('toggle', { - originalEvent: evt - }); - }); - - this.$selection.on('focus', function (evt) { - // User focuses on the container - }); - - this.$selection.on('blur', function (evt) { - // User exits the container - }); - - container.on('focus', function (evt) { - if (!container.isOpen()) { - self.$selection.focus(); - } - }); - }; - - SingleSelection.prototype.clear = function () { - var $rendered = this.$selection.find('.select2-selection__rendered'); - $rendered.empty(); - $rendered.removeAttr('title'); // clear tooltip on empty - }; - - SingleSelection.prototype.display = function (data, container) { - var template = this.options.get('templateSelection'); - var escapeMarkup = this.options.get('escapeMarkup'); - - return escapeMarkup(template(data, container)); - }; - - SingleSelection.prototype.selectionContainer = function () { - return $(''); - }; - - SingleSelection.prototype.update = function (data) { - if (data.length === 0) { - this.clear(); - return; - } - - var selection = data[0]; - - var $rendered = this.$selection.find('.select2-selection__rendered'); - var formatted = this.display(selection, $rendered); - - $rendered.empty().append(formatted); - $rendered.attr('title', selection.title || selection.text); - }; - - return SingleSelection; -}); - -S2.define('select2/selection/multiple',[ - 'jquery', - './base', - '../utils' -], function ($, BaseSelection, Utils) { - function MultipleSelection ($element, options) { - MultipleSelection.__super__.constructor.apply(this, arguments); - } - - Utils.Extend(MultipleSelection, BaseSelection); - - MultipleSelection.prototype.render = function () { - var $selection = MultipleSelection.__super__.render.call(this); - - $selection.addClass('select2-selection--multiple'); - - $selection.html( - '
          ' - ); - - return $selection; - }; - - MultipleSelection.prototype.bind = function (container, $container) { - var self = this; - - MultipleSelection.__super__.bind.apply(this, arguments); - - this.$selection.on('click', function (evt) { - self.trigger('toggle', { - originalEvent: evt - }); - }); - - this.$selection.on( - 'click', - '.select2-selection__choice__remove', - function (evt) { - // Ignore the event if it is disabled - if (self.options.get('disabled')) { - return; - } - - var $remove = $(this); - var $selection = $remove.parent(); - - var data = Utils.GetData($selection[0], 'data'); - - self.trigger('unselect', { - originalEvent: evt, - data: data - }); - } - ); - }; - - MultipleSelection.prototype.clear = function () { - var $rendered = this.$selection.find('.select2-selection__rendered'); - $rendered.empty(); - $rendered.removeAttr('title'); - }; - - MultipleSelection.prototype.display = function (data, container) { - var template = this.options.get('templateSelection'); - var escapeMarkup = this.options.get('escapeMarkup'); - - return escapeMarkup(template(data, container)); - }; - - MultipleSelection.prototype.selectionContainer = function () { - var $container = $( - '
        • ' + - '' + - '×' + - '' + - '
        • ' - ); - - return $container; - }; - - MultipleSelection.prototype.update = function (data) { - this.clear(); - - if (data.length === 0) { - return; - } - - var $selections = []; - - for (var d = 0; d < data.length; d++) { - var selection = data[d]; - - var $selection = this.selectionContainer(); - var formatted = this.display(selection, $selection); - - $selection.append(formatted); - $selection.attr('title', selection.title || selection.text); - - Utils.StoreData($selection[0], 'data', selection); - - $selections.push($selection); - } - - var $rendered = this.$selection.find('.select2-selection__rendered'); - - Utils.appendMany($rendered, $selections); - }; - - return MultipleSelection; -}); - -S2.define('select2/selection/placeholder',[ - '../utils' -], function (Utils) { - function Placeholder (decorated, $element, options) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options); - } - - Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { - var $placeholder = this.selectionContainer(); - - $placeholder.html(this.display(placeholder)); - $placeholder.addClass('select2-selection__placeholder') - .removeClass('select2-selection__choice'); - - return $placeholder; - }; - - Placeholder.prototype.update = function (decorated, data) { - var singlePlaceholder = ( - data.length == 1 && data[0].id != this.placeholder.id - ); - var multipleSelections = data.length > 1; - - if (multipleSelections || singlePlaceholder) { - return decorated.call(this, data); - } - - this.clear(); - - var $placeholder = this.createPlaceholder(this.placeholder); - - this.$selection.find('.select2-selection__rendered').append($placeholder); - }; - - return Placeholder; -}); - -S2.define('select2/selection/allowClear',[ - 'jquery', - '../keys', - '../utils' -], function ($, KEYS, Utils) { - function AllowClear () { } - - AllowClear.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - if (this.placeholder == null) { - if (this.options.get('debug') && window.console && console.error) { - console.error( - 'Select2: The `allowClear` option should be used in combination ' + - 'with the `placeholder` option.' - ); - } - } - - this.$selection.on('mousedown', '.select2-selection__clear', - function (evt) { - self._handleClear(evt); - }); - - container.on('keypress', function (evt) { - self._handleKeyboardClear(evt, container); - }); - }; - - AllowClear.prototype._handleClear = function (_, evt) { - // Ignore the event if it is disabled - if (this.options.get('disabled')) { - return; - } - - var $clear = this.$selection.find('.select2-selection__clear'); - - // Ignore the event if nothing has been selected - if ($clear.length === 0) { - return; - } - - evt.stopPropagation(); - - var data = Utils.GetData($clear[0], 'data'); - - var previousVal = this.$element.val(); - this.$element.val(this.placeholder.id); - - var unselectData = { - data: data - }; - this.trigger('clear', unselectData); - if (unselectData.prevented) { - this.$element.val(previousVal); - return; - } - - for (var d = 0; d < data.length; d++) { - unselectData = { - data: data[d] - }; - - // Trigger the `unselect` event, so people can prevent it from being - // cleared. - this.trigger('unselect', unselectData); - - // If the event was prevented, don't clear it out. - if (unselectData.prevented) { - this.$element.val(previousVal); - return; - } - } - - this.$element.trigger('change'); - - this.trigger('toggle', {}); - }; - - AllowClear.prototype._handleKeyboardClear = function (_, evt, container) { - if (container.isOpen()) { - return; - } - - if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) { - this._handleClear(evt); - } - }; - - AllowClear.prototype.update = function (decorated, data) { - decorated.call(this, data); - - if (this.$selection.find('.select2-selection__placeholder').length > 0 || - data.length === 0) { - return; - } - - var $remove = $( - '' + - '×' + - '' - ); - Utils.StoreData($remove[0], 'data', data); - - this.$selection.find('.select2-selection__rendered').prepend($remove); - }; - - return AllowClear; -}); - -S2.define('select2/selection/search',[ - 'jquery', - '../utils', - '../keys' -], function ($, Utils, KEYS) { - function Search (decorated, $element, options) { - decorated.call(this, $element, options); - } - - Search.prototype.render = function (decorated) { - var $search = $( - '' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - var $rendered = decorated.call(this); - - this._transferTabIndex(); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('open', function () { - self.$search.trigger('focus'); - }); - - container.on('close', function () { - self.$search.val(''); - self.$search.removeAttr('aria-activedescendant'); - self.$search.trigger('focus'); - }); - - container.on('enable', function () { - self.$search.prop('disabled', false); - - self._transferTabIndex(); - }); - - container.on('disable', function () { - self.$search.prop('disabled', true); - }); - - container.on('focus', function (evt) { - self.$search.trigger('focus'); - }); - - container.on('results:focus', function (params) { - self.$search.attr('aria-activedescendant', params.id); - }); - - this.$selection.on('focusin', '.select2-search--inline', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('focusout', '.select2-search--inline', function (evt) { - self._handleBlur(evt); - }); - - this.$selection.on('keydown', '.select2-search--inline', function (evt) { - evt.stopPropagation(); - - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - - var key = evt.which; - - if (key === KEYS.BACKSPACE && self.$search.val() === '') { - var $previousChoice = self.$searchContainer - .prev('.select2-selection__choice'); - - if ($previousChoice.length > 0) { - var item = Utils.GetData($previousChoice[0], 'data'); - - self.searchRemoveChoice(item); - - evt.preventDefault(); - } - } - }); - - // Try to detect the IE version should the `documentMode` property that - // is stored on the document. This is only implemented in IE and is - // slightly cleaner than doing a user agent check. - // This property is not available in Edge, but Edge also doesn't have - // this bug. - var msie = document.documentMode; - var disableInputEvents = msie && msie <= 11; - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$selection.on( - 'input.searchcheck', - '.select2-search--inline', - function (evt) { - // IE will trigger the `input` event when a placeholder is used on a - // search box. To get around this issue, we are forced to ignore all - // `input` events in IE and keep using `keyup`. - if (disableInputEvents) { - self.$selection.off('input.search input.searchcheck'); - return; - } - - // Unbind the duplicated `keyup` event - self.$selection.off('keyup.search'); - } - ); - - this.$selection.on( - 'keyup.search input.search', - '.select2-search--inline', - function (evt) { - // IE will trigger the `input` event when a placeholder is used on a - // search box. To get around this issue, we are forced to ignore all - // `input` events in IE and keep using `keyup`. - if (disableInputEvents && evt.type === 'input') { - self.$selection.off('input.search input.searchcheck'); - return; - } - - var key = evt.which; - - // We can freely ignore events from modifier keys - if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { - return; - } - - // Tabbing will be handled during the `keydown` phase - if (key == KEYS.TAB) { - return; - } - - self.handleSearch(evt); - } - ); - }; - - /** - * This method will transfer the tabindex attribute from the rendered - * selection to the search box. This allows for the search box to be used as - * the primary focus instead of the selection container. - * - * @private - */ - Search.prototype._transferTabIndex = function (decorated) { - this.$search.attr('tabindex', this.$selection.attr('tabindex')); - this.$selection.attr('tabindex', '-1'); - }; - - Search.prototype.createPlaceholder = function (decorated, placeholder) { - this.$search.attr('placeholder', placeholder.text); - }; - - Search.prototype.update = function (decorated, data) { - var searchHadFocus = this.$search[0] == document.activeElement; - - this.$search.attr('placeholder', ''); - - decorated.call(this, data); - - this.$selection.find('.select2-selection__rendered') - .append(this.$searchContainer); - - this.resizeSearch(); - if (searchHadFocus) { - var isTagInput = this.$element.find('[data-select2-tag]').length; - if (isTagInput) { - // fix IE11 bug where tag input lost focus - this.$element.focus(); - } else { - this.$search.focus(); - } - } - }; - - Search.prototype.handleSearch = function () { - this.resizeSearch(); - - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.searchRemoveChoice = function (decorated, item) { - this.trigger('unselect', { - data: item - }); - - this.$search.val(item.text); - this.handleSearch(); - }; - - Search.prototype.resizeSearch = function () { - this.$search.css('width', '25px'); - - var width = ''; - - if (this.$search.attr('placeholder') !== '') { - width = this.$selection.find('.select2-selection__rendered').innerWidth(); - } else { - var minimumWidth = this.$search.val().length + 1; - - width = (minimumWidth * 0.75) + 'em'; - } - - this.$search.css('width', width); - }; - - return Search; -}); - -S2.define('select2/selection/eventRelay',[ - 'jquery' -], function ($) { - function EventRelay () { } - - EventRelay.prototype.bind = function (decorated, container, $container) { - var self = this; - var relayEvents = [ - 'open', 'opening', - 'close', 'closing', - 'select', 'selecting', - 'unselect', 'unselecting', - 'clear', 'clearing' - ]; - - var preventableEvents = [ - 'opening', 'closing', 'selecting', 'unselecting', 'clearing' - ]; - - decorated.call(this, container, $container); - - container.on('*', function (name, params) { - // Ignore events that should not be relayed - if ($.inArray(name, relayEvents) === -1) { - return; - } - - // The parameters should always be an object - params = params || {}; - - // Generate the jQuery event for the Select2 event - var evt = $.Event('select2:' + name, { - params: params - }); - - self.$element.trigger(evt); - - // Only handle preventable events if it was one - if ($.inArray(name, preventableEvents) === -1) { - return; - } - - params.prevented = evt.isDefaultPrevented(); - }); - }; - - return EventRelay; -}); - -S2.define('select2/translation',[ - 'jquery', - 'require' -], function ($, require) { - function Translation (dict) { - this.dict = dict || {}; - } - - Translation.prototype.all = function () { - return this.dict; - }; - - Translation.prototype.get = function (key) { - return this.dict[key]; - }; - - Translation.prototype.extend = function (translation) { - this.dict = $.extend({}, translation.all(), this.dict); - }; - - // Static functions - - Translation._cache = {}; - - Translation.loadPath = function (path) { - if (!(path in Translation._cache)) { - var translations = require(path); - - Translation._cache[path] = translations; - } - - return new Translation(Translation._cache[path]); - }; - - return Translation; -}); - -S2.define('select2/diacritics',[ - -], function () { - var diacritics = { - '\u24B6': 'A', - '\uFF21': 'A', - '\u00C0': 'A', - '\u00C1': 'A', - '\u00C2': 'A', - '\u1EA6': 'A', - '\u1EA4': 'A', - '\u1EAA': 'A', - '\u1EA8': 'A', - '\u00C3': 'A', - '\u0100': 'A', - '\u0102': 'A', - '\u1EB0': 'A', - '\u1EAE': 'A', - '\u1EB4': 'A', - '\u1EB2': 'A', - '\u0226': 'A', - '\u01E0': 'A', - '\u00C4': 'A', - '\u01DE': 'A', - '\u1EA2': 'A', - '\u00C5': 'A', - '\u01FA': 'A', - '\u01CD': 'A', - '\u0200': 'A', - '\u0202': 'A', - '\u1EA0': 'A', - '\u1EAC': 'A', - '\u1EB6': 'A', - '\u1E00': 'A', - '\u0104': 'A', - '\u023A': 'A', - '\u2C6F': 'A', - '\uA732': 'AA', - '\u00C6': 'AE', - '\u01FC': 'AE', - '\u01E2': 'AE', - '\uA734': 'AO', - '\uA736': 'AU', - '\uA738': 'AV', - '\uA73A': 'AV', - '\uA73C': 'AY', - '\u24B7': 'B', - '\uFF22': 'B', - '\u1E02': 'B', - '\u1E04': 'B', - '\u1E06': 'B', - '\u0243': 'B', - '\u0182': 'B', - '\u0181': 'B', - '\u24B8': 'C', - '\uFF23': 'C', - '\u0106': 'C', - '\u0108': 'C', - '\u010A': 'C', - '\u010C': 'C', - '\u00C7': 'C', - '\u1E08': 'C', - '\u0187': 'C', - '\u023B': 'C', - '\uA73E': 'C', - '\u24B9': 'D', - '\uFF24': 'D', - '\u1E0A': 'D', - '\u010E': 'D', - '\u1E0C': 'D', - '\u1E10': 'D', - '\u1E12': 'D', - '\u1E0E': 'D', - '\u0110': 'D', - '\u018B': 'D', - '\u018A': 'D', - '\u0189': 'D', - '\uA779': 'D', - '\u01F1': 'DZ', - '\u01C4': 'DZ', - '\u01F2': 'Dz', - '\u01C5': 'Dz', - '\u24BA': 'E', - '\uFF25': 'E', - '\u00C8': 'E', - '\u00C9': 'E', - '\u00CA': 'E', - '\u1EC0': 'E', - '\u1EBE': 'E', - '\u1EC4': 'E', - '\u1EC2': 'E', - '\u1EBC': 'E', - '\u0112': 'E', - '\u1E14': 'E', - '\u1E16': 'E', - '\u0114': 'E', - '\u0116': 'E', - '\u00CB': 'E', - '\u1EBA': 'E', - '\u011A': 'E', - '\u0204': 'E', - '\u0206': 'E', - '\u1EB8': 'E', - '\u1EC6': 'E', - '\u0228': 'E', - '\u1E1C': 'E', - '\u0118': 'E', - '\u1E18': 'E', - '\u1E1A': 'E', - '\u0190': 'E', - '\u018E': 'E', - '\u24BB': 'F', - '\uFF26': 'F', - '\u1E1E': 'F', - '\u0191': 'F', - '\uA77B': 'F', - '\u24BC': 'G', - '\uFF27': 'G', - '\u01F4': 'G', - '\u011C': 'G', - '\u1E20': 'G', - '\u011E': 'G', - '\u0120': 'G', - '\u01E6': 'G', - '\u0122': 'G', - '\u01E4': 'G', - '\u0193': 'G', - '\uA7A0': 'G', - '\uA77D': 'G', - '\uA77E': 'G', - '\u24BD': 'H', - '\uFF28': 'H', - '\u0124': 'H', - '\u1E22': 'H', - '\u1E26': 'H', - '\u021E': 'H', - '\u1E24': 'H', - '\u1E28': 'H', - '\u1E2A': 'H', - '\u0126': 'H', - '\u2C67': 'H', - '\u2C75': 'H', - '\uA78D': 'H', - '\u24BE': 'I', - '\uFF29': 'I', - '\u00CC': 'I', - '\u00CD': 'I', - '\u00CE': 'I', - '\u0128': 'I', - '\u012A': 'I', - '\u012C': 'I', - '\u0130': 'I', - '\u00CF': 'I', - '\u1E2E': 'I', - '\u1EC8': 'I', - '\u01CF': 'I', - '\u0208': 'I', - '\u020A': 'I', - '\u1ECA': 'I', - '\u012E': 'I', - '\u1E2C': 'I', - '\u0197': 'I', - '\u24BF': 'J', - '\uFF2A': 'J', - '\u0134': 'J', - '\u0248': 'J', - '\u24C0': 'K', - '\uFF2B': 'K', - '\u1E30': 'K', - '\u01E8': 'K', - '\u1E32': 'K', - '\u0136': 'K', - '\u1E34': 'K', - '\u0198': 'K', - '\u2C69': 'K', - '\uA740': 'K', - '\uA742': 'K', - '\uA744': 'K', - '\uA7A2': 'K', - '\u24C1': 'L', - '\uFF2C': 'L', - '\u013F': 'L', - '\u0139': 'L', - '\u013D': 'L', - '\u1E36': 'L', - '\u1E38': 'L', - '\u013B': 'L', - '\u1E3C': 'L', - '\u1E3A': 'L', - '\u0141': 'L', - '\u023D': 'L', - '\u2C62': 'L', - '\u2C60': 'L', - '\uA748': 'L', - '\uA746': 'L', - '\uA780': 'L', - '\u01C7': 'LJ', - '\u01C8': 'Lj', - '\u24C2': 'M', - '\uFF2D': 'M', - '\u1E3E': 'M', - '\u1E40': 'M', - '\u1E42': 'M', - '\u2C6E': 'M', - '\u019C': 'M', - '\u24C3': 'N', - '\uFF2E': 'N', - '\u01F8': 'N', - '\u0143': 'N', - '\u00D1': 'N', - '\u1E44': 'N', - '\u0147': 'N', - '\u1E46': 'N', - '\u0145': 'N', - '\u1E4A': 'N', - '\u1E48': 'N', - '\u0220': 'N', - '\u019D': 'N', - '\uA790': 'N', - '\uA7A4': 'N', - '\u01CA': 'NJ', - '\u01CB': 'Nj', - '\u24C4': 'O', - '\uFF2F': 'O', - '\u00D2': 'O', - '\u00D3': 'O', - '\u00D4': 'O', - '\u1ED2': 'O', - '\u1ED0': 'O', - '\u1ED6': 'O', - '\u1ED4': 'O', - '\u00D5': 'O', - '\u1E4C': 'O', - '\u022C': 'O', - '\u1E4E': 'O', - '\u014C': 'O', - '\u1E50': 'O', - '\u1E52': 'O', - '\u014E': 'O', - '\u022E': 'O', - '\u0230': 'O', - '\u00D6': 'O', - '\u022A': 'O', - '\u1ECE': 'O', - '\u0150': 'O', - '\u01D1': 'O', - '\u020C': 'O', - '\u020E': 'O', - '\u01A0': 'O', - '\u1EDC': 'O', - '\u1EDA': 'O', - '\u1EE0': 'O', - '\u1EDE': 'O', - '\u1EE2': 'O', - '\u1ECC': 'O', - '\u1ED8': 'O', - '\u01EA': 'O', - '\u01EC': 'O', - '\u00D8': 'O', - '\u01FE': 'O', - '\u0186': 'O', - '\u019F': 'O', - '\uA74A': 'O', - '\uA74C': 'O', - '\u01A2': 'OI', - '\uA74E': 'OO', - '\u0222': 'OU', - '\u24C5': 'P', - '\uFF30': 'P', - '\u1E54': 'P', - '\u1E56': 'P', - '\u01A4': 'P', - '\u2C63': 'P', - '\uA750': 'P', - '\uA752': 'P', - '\uA754': 'P', - '\u24C6': 'Q', - '\uFF31': 'Q', - '\uA756': 'Q', - '\uA758': 'Q', - '\u024A': 'Q', - '\u24C7': 'R', - '\uFF32': 'R', - '\u0154': 'R', - '\u1E58': 'R', - '\u0158': 'R', - '\u0210': 'R', - '\u0212': 'R', - '\u1E5A': 'R', - '\u1E5C': 'R', - '\u0156': 'R', - '\u1E5E': 'R', - '\u024C': 'R', - '\u2C64': 'R', - '\uA75A': 'R', - '\uA7A6': 'R', - '\uA782': 'R', - '\u24C8': 'S', - '\uFF33': 'S', - '\u1E9E': 'S', - '\u015A': 'S', - '\u1E64': 'S', - '\u015C': 'S', - '\u1E60': 'S', - '\u0160': 'S', - '\u1E66': 'S', - '\u1E62': 'S', - '\u1E68': 'S', - '\u0218': 'S', - '\u015E': 'S', - '\u2C7E': 'S', - '\uA7A8': 'S', - '\uA784': 'S', - '\u24C9': 'T', - '\uFF34': 'T', - '\u1E6A': 'T', - '\u0164': 'T', - '\u1E6C': 'T', - '\u021A': 'T', - '\u0162': 'T', - '\u1E70': 'T', - '\u1E6E': 'T', - '\u0166': 'T', - '\u01AC': 'T', - '\u01AE': 'T', - '\u023E': 'T', - '\uA786': 'T', - '\uA728': 'TZ', - '\u24CA': 'U', - '\uFF35': 'U', - '\u00D9': 'U', - '\u00DA': 'U', - '\u00DB': 'U', - '\u0168': 'U', - '\u1E78': 'U', - '\u016A': 'U', - '\u1E7A': 'U', - '\u016C': 'U', - '\u00DC': 'U', - '\u01DB': 'U', - '\u01D7': 'U', - '\u01D5': 'U', - '\u01D9': 'U', - '\u1EE6': 'U', - '\u016E': 'U', - '\u0170': 'U', - '\u01D3': 'U', - '\u0214': 'U', - '\u0216': 'U', - '\u01AF': 'U', - '\u1EEA': 'U', - '\u1EE8': 'U', - '\u1EEE': 'U', - '\u1EEC': 'U', - '\u1EF0': 'U', - '\u1EE4': 'U', - '\u1E72': 'U', - '\u0172': 'U', - '\u1E76': 'U', - '\u1E74': 'U', - '\u0244': 'U', - '\u24CB': 'V', - '\uFF36': 'V', - '\u1E7C': 'V', - '\u1E7E': 'V', - '\u01B2': 'V', - '\uA75E': 'V', - '\u0245': 'V', - '\uA760': 'VY', - '\u24CC': 'W', - '\uFF37': 'W', - '\u1E80': 'W', - '\u1E82': 'W', - '\u0174': 'W', - '\u1E86': 'W', - '\u1E84': 'W', - '\u1E88': 'W', - '\u2C72': 'W', - '\u24CD': 'X', - '\uFF38': 'X', - '\u1E8A': 'X', - '\u1E8C': 'X', - '\u24CE': 'Y', - '\uFF39': 'Y', - '\u1EF2': 'Y', - '\u00DD': 'Y', - '\u0176': 'Y', - '\u1EF8': 'Y', - '\u0232': 'Y', - '\u1E8E': 'Y', - '\u0178': 'Y', - '\u1EF6': 'Y', - '\u1EF4': 'Y', - '\u01B3': 'Y', - '\u024E': 'Y', - '\u1EFE': 'Y', - '\u24CF': 'Z', - '\uFF3A': 'Z', - '\u0179': 'Z', - '\u1E90': 'Z', - '\u017B': 'Z', - '\u017D': 'Z', - '\u1E92': 'Z', - '\u1E94': 'Z', - '\u01B5': 'Z', - '\u0224': 'Z', - '\u2C7F': 'Z', - '\u2C6B': 'Z', - '\uA762': 'Z', - '\u24D0': 'a', - '\uFF41': 'a', - '\u1E9A': 'a', - '\u00E0': 'a', - '\u00E1': 'a', - '\u00E2': 'a', - '\u1EA7': 'a', - '\u1EA5': 'a', - '\u1EAB': 'a', - '\u1EA9': 'a', - '\u00E3': 'a', - '\u0101': 'a', - '\u0103': 'a', - '\u1EB1': 'a', - '\u1EAF': 'a', - '\u1EB5': 'a', - '\u1EB3': 'a', - '\u0227': 'a', - '\u01E1': 'a', - '\u00E4': 'a', - '\u01DF': 'a', - '\u1EA3': 'a', - '\u00E5': 'a', - '\u01FB': 'a', - '\u01CE': 'a', - '\u0201': 'a', - '\u0203': 'a', - '\u1EA1': 'a', - '\u1EAD': 'a', - '\u1EB7': 'a', - '\u1E01': 'a', - '\u0105': 'a', - '\u2C65': 'a', - '\u0250': 'a', - '\uA733': 'aa', - '\u00E6': 'ae', - '\u01FD': 'ae', - '\u01E3': 'ae', - '\uA735': 'ao', - '\uA737': 'au', - '\uA739': 'av', - '\uA73B': 'av', - '\uA73D': 'ay', - '\u24D1': 'b', - '\uFF42': 'b', - '\u1E03': 'b', - '\u1E05': 'b', - '\u1E07': 'b', - '\u0180': 'b', - '\u0183': 'b', - '\u0253': 'b', - '\u24D2': 'c', - '\uFF43': 'c', - '\u0107': 'c', - '\u0109': 'c', - '\u010B': 'c', - '\u010D': 'c', - '\u00E7': 'c', - '\u1E09': 'c', - '\u0188': 'c', - '\u023C': 'c', - '\uA73F': 'c', - '\u2184': 'c', - '\u24D3': 'd', - '\uFF44': 'd', - '\u1E0B': 'd', - '\u010F': 'd', - '\u1E0D': 'd', - '\u1E11': 'd', - '\u1E13': 'd', - '\u1E0F': 'd', - '\u0111': 'd', - '\u018C': 'd', - '\u0256': 'd', - '\u0257': 'd', - '\uA77A': 'd', - '\u01F3': 'dz', - '\u01C6': 'dz', - '\u24D4': 'e', - '\uFF45': 'e', - '\u00E8': 'e', - '\u00E9': 'e', - '\u00EA': 'e', - '\u1EC1': 'e', - '\u1EBF': 'e', - '\u1EC5': 'e', - '\u1EC3': 'e', - '\u1EBD': 'e', - '\u0113': 'e', - '\u1E15': 'e', - '\u1E17': 'e', - '\u0115': 'e', - '\u0117': 'e', - '\u00EB': 'e', - '\u1EBB': 'e', - '\u011B': 'e', - '\u0205': 'e', - '\u0207': 'e', - '\u1EB9': 'e', - '\u1EC7': 'e', - '\u0229': 'e', - '\u1E1D': 'e', - '\u0119': 'e', - '\u1E19': 'e', - '\u1E1B': 'e', - '\u0247': 'e', - '\u025B': 'e', - '\u01DD': 'e', - '\u24D5': 'f', - '\uFF46': 'f', - '\u1E1F': 'f', - '\u0192': 'f', - '\uA77C': 'f', - '\u24D6': 'g', - '\uFF47': 'g', - '\u01F5': 'g', - '\u011D': 'g', - '\u1E21': 'g', - '\u011F': 'g', - '\u0121': 'g', - '\u01E7': 'g', - '\u0123': 'g', - '\u01E5': 'g', - '\u0260': 'g', - '\uA7A1': 'g', - '\u1D79': 'g', - '\uA77F': 'g', - '\u24D7': 'h', - '\uFF48': 'h', - '\u0125': 'h', - '\u1E23': 'h', - '\u1E27': 'h', - '\u021F': 'h', - '\u1E25': 'h', - '\u1E29': 'h', - '\u1E2B': 'h', - '\u1E96': 'h', - '\u0127': 'h', - '\u2C68': 'h', - '\u2C76': 'h', - '\u0265': 'h', - '\u0195': 'hv', - '\u24D8': 'i', - '\uFF49': 'i', - '\u00EC': 'i', - '\u00ED': 'i', - '\u00EE': 'i', - '\u0129': 'i', - '\u012B': 'i', - '\u012D': 'i', - '\u00EF': 'i', - '\u1E2F': 'i', - '\u1EC9': 'i', - '\u01D0': 'i', - '\u0209': 'i', - '\u020B': 'i', - '\u1ECB': 'i', - '\u012F': 'i', - '\u1E2D': 'i', - '\u0268': 'i', - '\u0131': 'i', - '\u24D9': 'j', - '\uFF4A': 'j', - '\u0135': 'j', - '\u01F0': 'j', - '\u0249': 'j', - '\u24DA': 'k', - '\uFF4B': 'k', - '\u1E31': 'k', - '\u01E9': 'k', - '\u1E33': 'k', - '\u0137': 'k', - '\u1E35': 'k', - '\u0199': 'k', - '\u2C6A': 'k', - '\uA741': 'k', - '\uA743': 'k', - '\uA745': 'k', - '\uA7A3': 'k', - '\u24DB': 'l', - '\uFF4C': 'l', - '\u0140': 'l', - '\u013A': 'l', - '\u013E': 'l', - '\u1E37': 'l', - '\u1E39': 'l', - '\u013C': 'l', - '\u1E3D': 'l', - '\u1E3B': 'l', - '\u017F': 'l', - '\u0142': 'l', - '\u019A': 'l', - '\u026B': 'l', - '\u2C61': 'l', - '\uA749': 'l', - '\uA781': 'l', - '\uA747': 'l', - '\u01C9': 'lj', - '\u24DC': 'm', - '\uFF4D': 'm', - '\u1E3F': 'm', - '\u1E41': 'm', - '\u1E43': 'm', - '\u0271': 'm', - '\u026F': 'm', - '\u24DD': 'n', - '\uFF4E': 'n', - '\u01F9': 'n', - '\u0144': 'n', - '\u00F1': 'n', - '\u1E45': 'n', - '\u0148': 'n', - '\u1E47': 'n', - '\u0146': 'n', - '\u1E4B': 'n', - '\u1E49': 'n', - '\u019E': 'n', - '\u0272': 'n', - '\u0149': 'n', - '\uA791': 'n', - '\uA7A5': 'n', - '\u01CC': 'nj', - '\u24DE': 'o', - '\uFF4F': 'o', - '\u00F2': 'o', - '\u00F3': 'o', - '\u00F4': 'o', - '\u1ED3': 'o', - '\u1ED1': 'o', - '\u1ED7': 'o', - '\u1ED5': 'o', - '\u00F5': 'o', - '\u1E4D': 'o', - '\u022D': 'o', - '\u1E4F': 'o', - '\u014D': 'o', - '\u1E51': 'o', - '\u1E53': 'o', - '\u014F': 'o', - '\u022F': 'o', - '\u0231': 'o', - '\u00F6': 'o', - '\u022B': 'o', - '\u1ECF': 'o', - '\u0151': 'o', - '\u01D2': 'o', - '\u020D': 'o', - '\u020F': 'o', - '\u01A1': 'o', - '\u1EDD': 'o', - '\u1EDB': 'o', - '\u1EE1': 'o', - '\u1EDF': 'o', - '\u1EE3': 'o', - '\u1ECD': 'o', - '\u1ED9': 'o', - '\u01EB': 'o', - '\u01ED': 'o', - '\u00F8': 'o', - '\u01FF': 'o', - '\u0254': 'o', - '\uA74B': 'o', - '\uA74D': 'o', - '\u0275': 'o', - '\u01A3': 'oi', - '\u0223': 'ou', - '\uA74F': 'oo', - '\u24DF': 'p', - '\uFF50': 'p', - '\u1E55': 'p', - '\u1E57': 'p', - '\u01A5': 'p', - '\u1D7D': 'p', - '\uA751': 'p', - '\uA753': 'p', - '\uA755': 'p', - '\u24E0': 'q', - '\uFF51': 'q', - '\u024B': 'q', - '\uA757': 'q', - '\uA759': 'q', - '\u24E1': 'r', - '\uFF52': 'r', - '\u0155': 'r', - '\u1E59': 'r', - '\u0159': 'r', - '\u0211': 'r', - '\u0213': 'r', - '\u1E5B': 'r', - '\u1E5D': 'r', - '\u0157': 'r', - '\u1E5F': 'r', - '\u024D': 'r', - '\u027D': 'r', - '\uA75B': 'r', - '\uA7A7': 'r', - '\uA783': 'r', - '\u24E2': 's', - '\uFF53': 's', - '\u00DF': 's', - '\u015B': 's', - '\u1E65': 's', - '\u015D': 's', - '\u1E61': 's', - '\u0161': 's', - '\u1E67': 's', - '\u1E63': 's', - '\u1E69': 's', - '\u0219': 's', - '\u015F': 's', - '\u023F': 's', - '\uA7A9': 's', - '\uA785': 's', - '\u1E9B': 's', - '\u24E3': 't', - '\uFF54': 't', - '\u1E6B': 't', - '\u1E97': 't', - '\u0165': 't', - '\u1E6D': 't', - '\u021B': 't', - '\u0163': 't', - '\u1E71': 't', - '\u1E6F': 't', - '\u0167': 't', - '\u01AD': 't', - '\u0288': 't', - '\u2C66': 't', - '\uA787': 't', - '\uA729': 'tz', - '\u24E4': 'u', - '\uFF55': 'u', - '\u00F9': 'u', - '\u00FA': 'u', - '\u00FB': 'u', - '\u0169': 'u', - '\u1E79': 'u', - '\u016B': 'u', - '\u1E7B': 'u', - '\u016D': 'u', - '\u00FC': 'u', - '\u01DC': 'u', - '\u01D8': 'u', - '\u01D6': 'u', - '\u01DA': 'u', - '\u1EE7': 'u', - '\u016F': 'u', - '\u0171': 'u', - '\u01D4': 'u', - '\u0215': 'u', - '\u0217': 'u', - '\u01B0': 'u', - '\u1EEB': 'u', - '\u1EE9': 'u', - '\u1EEF': 'u', - '\u1EED': 'u', - '\u1EF1': 'u', - '\u1EE5': 'u', - '\u1E73': 'u', - '\u0173': 'u', - '\u1E77': 'u', - '\u1E75': 'u', - '\u0289': 'u', - '\u24E5': 'v', - '\uFF56': 'v', - '\u1E7D': 'v', - '\u1E7F': 'v', - '\u028B': 'v', - '\uA75F': 'v', - '\u028C': 'v', - '\uA761': 'vy', - '\u24E6': 'w', - '\uFF57': 'w', - '\u1E81': 'w', - '\u1E83': 'w', - '\u0175': 'w', - '\u1E87': 'w', - '\u1E85': 'w', - '\u1E98': 'w', - '\u1E89': 'w', - '\u2C73': 'w', - '\u24E7': 'x', - '\uFF58': 'x', - '\u1E8B': 'x', - '\u1E8D': 'x', - '\u24E8': 'y', - '\uFF59': 'y', - '\u1EF3': 'y', - '\u00FD': 'y', - '\u0177': 'y', - '\u1EF9': 'y', - '\u0233': 'y', - '\u1E8F': 'y', - '\u00FF': 'y', - '\u1EF7': 'y', - '\u1E99': 'y', - '\u1EF5': 'y', - '\u01B4': 'y', - '\u024F': 'y', - '\u1EFF': 'y', - '\u24E9': 'z', - '\uFF5A': 'z', - '\u017A': 'z', - '\u1E91': 'z', - '\u017C': 'z', - '\u017E': 'z', - '\u1E93': 'z', - '\u1E95': 'z', - '\u01B6': 'z', - '\u0225': 'z', - '\u0240': 'z', - '\u2C6C': 'z', - '\uA763': 'z', - '\u0386': '\u0391', - '\u0388': '\u0395', - '\u0389': '\u0397', - '\u038A': '\u0399', - '\u03AA': '\u0399', - '\u038C': '\u039F', - '\u038E': '\u03A5', - '\u03AB': '\u03A5', - '\u038F': '\u03A9', - '\u03AC': '\u03B1', - '\u03AD': '\u03B5', - '\u03AE': '\u03B7', - '\u03AF': '\u03B9', - '\u03CA': '\u03B9', - '\u0390': '\u03B9', - '\u03CC': '\u03BF', - '\u03CD': '\u03C5', - '\u03CB': '\u03C5', - '\u03B0': '\u03C5', - '\u03C9': '\u03C9', - '\u03C2': '\u03C3' - }; - - return diacritics; -}); - -S2.define('select2/data/base',[ - '../utils' -], function (Utils) { - function BaseAdapter ($element, options) { - BaseAdapter.__super__.constructor.call(this); - } - - Utils.Extend(BaseAdapter, Utils.Observable); - - BaseAdapter.prototype.current = function (callback) { - throw new Error('The `current` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.query = function (params, callback) { - throw new Error('The `query` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.bind = function (container, $container) { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.destroy = function () { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.generateResultId = function (container, data) { - var id = container.id + '-result-'; - - id += Utils.generateChars(4); - - if (data.id != null) { - id += '-' + data.id.toString(); - } else { - id += '-' + Utils.generateChars(4); - } - return id; - }; - - return BaseAdapter; -}); - -S2.define('select2/data/select',[ - './base', - '../utils', - 'jquery' -], function (BaseAdapter, Utils, $) { - function SelectAdapter ($element, options) { - this.$element = $element; - this.options = options; - - SelectAdapter.__super__.constructor.call(this); - } - - Utils.Extend(SelectAdapter, BaseAdapter); - - SelectAdapter.prototype.current = function (callback) { - var data = []; - var self = this; - - this.$element.find(':selected').each(function () { - var $option = $(this); - - var option = self.item($option); - - data.push(option); - }); - - callback(data); - }; - - SelectAdapter.prototype.select = function (data) { - var self = this; - - data.selected = true; - - // If data.element is a DOM node, use it instead - if ($(data.element).is('option')) { - data.element.selected = true; - - this.$element.trigger('change'); - - return; - } - - if (this.$element.prop('multiple')) { - this.current(function (currentData) { - var val = []; - - data = [data]; - data.push.apply(data, currentData); - - for (var d = 0; d < data.length; d++) { - var id = data[d].id; - - if ($.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - self.$element.trigger('change'); - }); - } else { - var val = data.id; - - this.$element.val(val); - this.$element.trigger('change'); - } - }; - - SelectAdapter.prototype.unselect = function (data) { - var self = this; - - if (!this.$element.prop('multiple')) { - return; - } - - data.selected = false; - - if ($(data.element).is('option')) { - data.element.selected = false; - - this.$element.trigger('change'); - - return; - } - - this.current(function (currentData) { - var val = []; - - for (var d = 0; d < currentData.length; d++) { - var id = currentData[d].id; - - if (id !== data.id && $.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - - self.$element.trigger('change'); - }); - }; - - SelectAdapter.prototype.bind = function (container, $container) { - var self = this; - - this.container = container; - - container.on('select', function (params) { - self.select(params.data); - }); - - container.on('unselect', function (params) { - self.unselect(params.data); - }); - }; - - SelectAdapter.prototype.destroy = function () { - // Remove anything added to child elements - this.$element.find('*').each(function () { - // Remove any custom data set by Select2 - Utils.RemoveData(this); - }); - }; - - SelectAdapter.prototype.query = function (params, callback) { - var data = []; - var self = this; - - var $options = this.$element.children(); - - $options.each(function () { - var $option = $(this); - - if (!$option.is('option') && !$option.is('optgroup')) { - return; - } - - var option = self.item($option); - - var matches = self.matches(params, option); - - if (matches !== null) { - data.push(matches); - } - }); - - callback({ - results: data - }); - }; - - SelectAdapter.prototype.addOptions = function ($options) { - Utils.appendMany(this.$element, $options); - }; - - SelectAdapter.prototype.option = function (data) { - var option; - - if (data.children) { - option = document.createElement('optgroup'); - option.label = data.text; - } else { - option = document.createElement('option'); - - if (option.textContent !== undefined) { - option.textContent = data.text; - } else { - option.innerText = data.text; - } - } - - if (data.id !== undefined) { - option.value = data.id; - } - - if (data.disabled) { - option.disabled = true; - } - - if (data.selected) { - option.selected = true; - } - - if (data.title) { - option.title = data.title; - } - - var $option = $(option); - - var normalizedData = this._normalizeItem(data); - normalizedData.element = option; - - // Override the option's data with the combined data - Utils.StoreData(option, 'data', normalizedData); - - return $option; - }; - - SelectAdapter.prototype.item = function ($option) { - var data = {}; - - data = Utils.GetData($option[0], 'data'); - - if (data != null) { - return data; - } - - if ($option.is('option')) { - data = { - id: $option.val(), - text: $option.text(), - disabled: $option.prop('disabled'), - selected: $option.prop('selected'), - title: $option.prop('title') - }; - } else if ($option.is('optgroup')) { - data = { - text: $option.prop('label'), - children: [], - title: $option.prop('title') - }; - - var $children = $option.children('option'); - var children = []; - - for (var c = 0; c < $children.length; c++) { - var $child = $($children[c]); - - var child = this.item($child); - - children.push(child); - } - - data.children = children; - } - - data = this._normalizeItem(data); - data.element = $option[0]; - - Utils.StoreData($option[0], 'data', data); - - return data; - }; - - SelectAdapter.prototype._normalizeItem = function (item) { - if (item !== Object(item)) { - item = { - id: item, - text: item - }; - } - - item = $.extend({}, { - text: '' - }, item); - - var defaults = { - selected: false, - disabled: false - }; - - if (item.id != null) { - item.id = item.id.toString(); - } - - if (item.text != null) { - item.text = item.text.toString(); - } - - if (item._resultId == null && item.id && this.container != null) { - item._resultId = this.generateResultId(this.container, item); - } - - return $.extend({}, defaults, item); - }; - - SelectAdapter.prototype.matches = function (params, data) { - var matcher = this.options.get('matcher'); - - return matcher(params, data); - }; - - return SelectAdapter; -}); - -S2.define('select2/data/array',[ - './select', - '../utils', - 'jquery' -], function (SelectAdapter, Utils, $) { - function ArrayAdapter ($element, options) { - var data = options.get('data') || []; - - ArrayAdapter.__super__.constructor.call(this, $element, options); - - this.addOptions(this.convertToOptions(data)); - } - - Utils.Extend(ArrayAdapter, SelectAdapter); - - ArrayAdapter.prototype.select = function (data) { - var $option = this.$element.find('option').filter(function (i, elm) { - return elm.value == data.id.toString(); - }); - - if ($option.length === 0) { - $option = this.option(data); - - this.addOptions($option); - } - - ArrayAdapter.__super__.select.call(this, data); - }; - - ArrayAdapter.prototype.convertToOptions = function (data) { - var self = this; - - var $existing = this.$element.find('option'); - var existingIds = $existing.map(function () { - return self.item($(this)).id; - }).get(); - - var $options = []; - - // Filter out all items except for the one passed in the argument - function onlyItem (item) { - return function () { - return $(this).val() == item.id; - }; - } - - for (var d = 0; d < data.length; d++) { - var item = this._normalizeItem(data[d]); - - // Skip items which were pre-loaded, only merge the data - if ($.inArray(item.id, existingIds) >= 0) { - var $existingOption = $existing.filter(onlyItem(item)); - - var existingData = this.item($existingOption); - var newData = $.extend(true, {}, item, existingData); - - var $newOption = this.option(newData); - - $existingOption.replaceWith($newOption); - - continue; - } - - var $option = this.option(item); - - if (item.children) { - var $children = this.convertToOptions(item.children); - - Utils.appendMany($option, $children); - } - - $options.push($option); - } - - return $options; - }; - - return ArrayAdapter; -}); - -S2.define('select2/data/ajax',[ - './array', - '../utils', - 'jquery' -], function (ArrayAdapter, Utils, $) { - function AjaxAdapter ($element, options) { - this.ajaxOptions = this._applyDefaults(options.get('ajax')); - - if (this.ajaxOptions.processResults != null) { - this.processResults = this.ajaxOptions.processResults; - } - - AjaxAdapter.__super__.constructor.call(this, $element, options); - } - - Utils.Extend(AjaxAdapter, ArrayAdapter); - - AjaxAdapter.prototype._applyDefaults = function (options) { - var defaults = { - data: function (params) { - return $.extend({}, params, { - q: params.term - }); - }, - transport: function (params, success, failure) { - var $request = $.ajax(params); - - $request.then(success); - $request.fail(failure); - - return $request; - } - }; - - return $.extend({}, defaults, options, true); - }; - - AjaxAdapter.prototype.processResults = function (results) { - return results; - }; - - AjaxAdapter.prototype.query = function (params, callback) { - var matches = []; - var self = this; - - if (this._request != null) { - // JSONP requests cannot always be aborted - if ($.isFunction(this._request.abort)) { - this._request.abort(); - } - - this._request = null; - } - - var options = $.extend({ - type: 'GET' - }, this.ajaxOptions); - - if (typeof options.url === 'function') { - options.url = options.url.call(this.$element, params); - } - - if (typeof options.data === 'function') { - options.data = options.data.call(this.$element, params); - } - - function request () { - var $request = options.transport(options, function (data) { - var results = self.processResults(data, params); - - if (self.options.get('debug') && window.console && console.error) { - // Check to make sure that the response included a `results` key. - if (!results || !results.results || !$.isArray(results.results)) { - console.error( - 'Select2: The AJAX results did not return an array in the ' + - '`results` key of the response.' - ); - } - } - - callback(results); - }, function () { - // Attempt to detect if a request was aborted - // Only works if the transport exposes a status property - if ('status' in $request && - ($request.status === 0 || $request.status === '0')) { - return; - } - - self.trigger('results:message', { - message: 'errorLoading' - }); - }); - - self._request = $request; - } - - if (this.ajaxOptions.delay && params.term != null) { - if (this._queryTimeout) { - window.clearTimeout(this._queryTimeout); - } - - this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); - } else { - request(); - } - }; - - return AjaxAdapter; -}); - -S2.define('select2/data/tags',[ - 'jquery' -], function ($) { - function Tags (decorated, $element, options) { - var tags = options.get('tags'); - - var createTag = options.get('createTag'); - - if (createTag !== undefined) { - this.createTag = createTag; - } - - var insertTag = options.get('insertTag'); - - if (insertTag !== undefined) { - this.insertTag = insertTag; - } - - decorated.call(this, $element, options); - - if ($.isArray(tags)) { - for (var t = 0; t < tags.length; t++) { - var tag = tags[t]; - var item = this._normalizeItem(tag); - - var $option = this.option(item); - - this.$element.append($option); - } - } - } - - Tags.prototype.query = function (decorated, params, callback) { - var self = this; - - this._removeOldTags(); - - if (params.term == null || params.page != null) { - decorated.call(this, params, callback); - return; - } - - function wrapper (obj, child) { - var data = obj.results; - - for (var i = 0; i < data.length; i++) { - var option = data[i]; - - var checkChildren = ( - option.children != null && - !wrapper({ - results: option.children - }, true) - ); - - var optionText = (option.text || '').toUpperCase(); - var paramsTerm = (params.term || '').toUpperCase(); - - var checkText = optionText === paramsTerm; - - if (checkText || checkChildren) { - if (child) { - return false; - } - - obj.data = data; - callback(obj); - - return; - } - } - - if (child) { - return true; - } - - var tag = self.createTag(params); - - if (tag != null) { - var $option = self.option(tag); - $option.attr('data-select2-tag', true); - - self.addOptions([$option]); - - self.insertTag(data, tag); - } - - obj.results = data; - - callback(obj); - } - - decorated.call(this, params, wrapper); - }; - - Tags.prototype.createTag = function (decorated, params) { - var term = $.trim(params.term); - - if (term === '') { - return null; - } - - return { - id: term, - text: term - }; - }; - - Tags.prototype.insertTag = function (_, data, tag) { - data.unshift(tag); - }; - - Tags.prototype._removeOldTags = function (_) { - var tag = this._lastTag; - - var $options = this.$element.find('option[data-select2-tag]'); - - $options.each(function () { - if (this.selected) { - return; - } - - $(this).remove(); - }); - }; - - return Tags; -}); - -S2.define('select2/data/tokenizer',[ - 'jquery' -], function ($) { - function Tokenizer (decorated, $element, options) { - var tokenizer = options.get('tokenizer'); - - if (tokenizer !== undefined) { - this.tokenizer = tokenizer; - } - - decorated.call(this, $element, options); - } - - Tokenizer.prototype.bind = function (decorated, container, $container) { - decorated.call(this, container, $container); - - this.$search = container.dropdown.$search || container.selection.$search || - $container.find('.select2-search__field'); - }; - - Tokenizer.prototype.query = function (decorated, params, callback) { - var self = this; - - function createAndSelect (data) { - // Normalize the data object so we can use it for checks - var item = self._normalizeItem(data); - - // Check if the data object already exists as a tag - // Select it if it doesn't - var $existingOptions = self.$element.find('option').filter(function () { - return $(this).val() === item.id; - }); - - // If an existing option wasn't found for it, create the option - if (!$existingOptions.length) { - var $option = self.option(item); - $option.attr('data-select2-tag', true); - - self._removeOldTags(); - self.addOptions([$option]); - } - - // Select the item, now that we know there is an option for it - select(item); - } - - function select (data) { - self.trigger('select', { - data: data - }); - } - - params.term = params.term || ''; - - var tokenData = this.tokenizer(params, this.options, createAndSelect); - - if (tokenData.term !== params.term) { - // Replace the search term if we have the search box - if (this.$search.length) { - this.$search.val(tokenData.term); - this.$search.focus(); - } - - params.term = tokenData.term; - } - - decorated.call(this, params, callback); - }; - - Tokenizer.prototype.tokenizer = function (_, params, options, callback) { - var separators = options.get('tokenSeparators') || []; - var term = params.term; - var i = 0; - - var createTag = this.createTag || function (params) { - return { - id: params.term, - text: params.term - }; - }; - - while (i < term.length) { - var termChar = term[i]; - - if ($.inArray(termChar, separators) === -1) { - i++; - - continue; - } - - var part = term.substr(0, i); - var partParams = $.extend({}, params, { - term: part - }); - - var data = createTag(partParams); - - if (data == null) { - i++; - continue; - } - - callback(data); - - // Reset the term to not include the tokenized portion - term = term.substr(i + 1) || ''; - i = 0; - } - - return { - term: term - }; - }; - - return Tokenizer; -}); - -S2.define('select2/data/minimumInputLength',[ - -], function () { - function MinimumInputLength (decorated, $e, options) { - this.minimumInputLength = options.get('minimumInputLength'); - - decorated.call(this, $e, options); - } - - MinimumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (params.term.length < this.minimumInputLength) { - this.trigger('results:message', { - message: 'inputTooShort', - args: { - minimum: this.minimumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MinimumInputLength; -}); - -S2.define('select2/data/maximumInputLength',[ - -], function () { - function MaximumInputLength (decorated, $e, options) { - this.maximumInputLength = options.get('maximumInputLength'); - - decorated.call(this, $e, options); - } - - MaximumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (this.maximumInputLength > 0 && - params.term.length > this.maximumInputLength) { - this.trigger('results:message', { - message: 'inputTooLong', - args: { - maximum: this.maximumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MaximumInputLength; -}); - -S2.define('select2/data/maximumSelectionLength',[ - -], function (){ - function MaximumSelectionLength (decorated, $e, options) { - this.maximumSelectionLength = options.get('maximumSelectionLength'); - - decorated.call(this, $e, options); - } - - MaximumSelectionLength.prototype.query = - function (decorated, params, callback) { - var self = this; - - this.current(function (currentData) { - var count = currentData != null ? currentData.length : 0; - if (self.maximumSelectionLength > 0 && - count >= self.maximumSelectionLength) { - self.trigger('results:message', { - message: 'maximumSelected', - args: { - maximum: self.maximumSelectionLength - } - }); - return; - } - decorated.call(self, params, callback); - }); - }; - - return MaximumSelectionLength; -}); - -S2.define('select2/dropdown',[ - 'jquery', - './utils' -], function ($, Utils) { - function Dropdown ($element, options) { - this.$element = $element; - this.options = options; - - Dropdown.__super__.constructor.call(this); - } - - Utils.Extend(Dropdown, Utils.Observable); - - Dropdown.prototype.render = function () { - var $dropdown = $( - '' + - '' + - '' - ); - - $dropdown.attr('dir', this.options.get('dir')); - - this.$dropdown = $dropdown; - - return $dropdown; - }; - - Dropdown.prototype.bind = function () { - // Should be implemented in subclasses - }; - - Dropdown.prototype.position = function ($dropdown, $container) { - // Should be implmented in subclasses - }; - - Dropdown.prototype.destroy = function () { - // Remove the dropdown from the DOM - this.$dropdown.remove(); - }; - - return Dropdown; -}); - -S2.define('select2/dropdown/search',[ - 'jquery', - '../utils' -], function ($, Utils) { - function Search () { } - - Search.prototype.render = function (decorated) { - var $rendered = decorated.call(this); - - var $search = $( - '' + - '' + - '' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - $rendered.prepend($search); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - this.$search.on('keydown', function (evt) { - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - }); - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$search.on('input', function (evt) { - // Unbind the duplicated `keyup` event - $(this).off('keyup'); - }); - - this.$search.on('keyup input', function (evt) { - self.handleSearch(evt); - }); - - container.on('open', function () { - self.$search.attr('tabindex', 0); - - self.$search.focus(); - - window.setTimeout(function () { - self.$search.focus(); - }, 0); - }); - - container.on('close', function () { - self.$search.attr('tabindex', -1); - - self.$search.val(''); - self.$search.blur(); - }); - - container.on('focus', function () { - if (!container.isOpen()) { - self.$search.focus(); - } - }); - - container.on('results:all', function (params) { - if (params.query.term == null || params.query.term === '') { - var showSearch = self.showSearch(params); - - if (showSearch) { - self.$searchContainer.removeClass('select2-search--hide'); - } else { - self.$searchContainer.addClass('select2-search--hide'); - } - } - }); - }; - - Search.prototype.handleSearch = function (evt) { - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.showSearch = function (_, params) { - return true; - }; - - return Search; -}); - -S2.define('select2/dropdown/hidePlaceholder',[ - -], function () { - function HidePlaceholder (decorated, $element, options, dataAdapter) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options, dataAdapter); - } - - HidePlaceholder.prototype.append = function (decorated, data) { - data.results = this.removePlaceholder(data.results); - - decorated.call(this, data); - }; - - HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - HidePlaceholder.prototype.removePlaceholder = function (_, data) { - var modifiedData = data.slice(0); - - for (var d = data.length - 1; d >= 0; d--) { - var item = data[d]; - - if (this.placeholder.id === item.id) { - modifiedData.splice(d, 1); - } - } - - return modifiedData; - }; - - return HidePlaceholder; -}); - -S2.define('select2/dropdown/infiniteScroll',[ - 'jquery' -], function ($) { - function InfiniteScroll (decorated, $element, options, dataAdapter) { - this.lastParams = {}; - - decorated.call(this, $element, options, dataAdapter); - - this.$loadingMore = this.createLoadingMore(); - this.loading = false; - } - - InfiniteScroll.prototype.append = function (decorated, data) { - this.$loadingMore.remove(); - this.loading = false; - - decorated.call(this, data); - - if (this.showLoadingMore(data)) { - this.$results.append(this.$loadingMore); - } - }; - - InfiniteScroll.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('query', function (params) { - self.lastParams = params; - self.loading = true; - }); - - container.on('query:append', function (params) { - self.lastParams = params; - self.loading = true; - }); - - this.$results.on('scroll', function () { - var isLoadMoreVisible = $.contains( - document.documentElement, - self.$loadingMore[0] - ); - - if (self.loading || !isLoadMoreVisible) { - return; - } - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var loadingMoreOffset = self.$loadingMore.offset().top + - self.$loadingMore.outerHeight(false); - - if (currentOffset + 50 >= loadingMoreOffset) { - self.loadMore(); - } - }); - }; - - InfiniteScroll.prototype.loadMore = function () { - this.loading = true; - - var params = $.extend({}, {page: 1}, this.lastParams); - - params.page++; - - this.trigger('query:append', params); - }; - - InfiniteScroll.prototype.showLoadingMore = function (_, data) { - return data.pagination && data.pagination.more; - }; - - InfiniteScroll.prototype.createLoadingMore = function () { - var $option = $( - '
        • ' - ); - - var message = this.options.get('translations').get('loadingMore'); - - $option.html(message(this.lastParams)); - - return $option; - }; - - return InfiniteScroll; -}); - -S2.define('select2/dropdown/attachBody',[ - 'jquery', - '../utils' -], function ($, Utils) { - function AttachBody (decorated, $element, options) { - this.$dropdownParent = options.get('dropdownParent') || $(document.body); - - decorated.call(this, $element, options); - } - - AttachBody.prototype.bind = function (decorated, container, $container) { - var self = this; - - var setupResultsEvents = false; - - decorated.call(this, container, $container); - - container.on('open', function () { - self._showDropdown(); - self._attachPositioningHandler(container); - - if (!setupResultsEvents) { - setupResultsEvents = true; - - container.on('results:all', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - - container.on('results:append', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - } - }); - - container.on('close', function () { - self._hideDropdown(); - self._detachPositioningHandler(container); - }); - - this.$dropdownContainer.on('mousedown', function (evt) { - evt.stopPropagation(); - }); - }; - - AttachBody.prototype.destroy = function (decorated) { - decorated.call(this); - - this.$dropdownContainer.remove(); - }; - - AttachBody.prototype.position = function (decorated, $dropdown, $container) { - // Clone all of the container classes - $dropdown.attr('class', $container.attr('class')); - - $dropdown.removeClass('select2'); - $dropdown.addClass('select2-container--open'); - - $dropdown.css({ - position: 'absolute', - top: -999999 - }); - - this.$container = $container; - }; - - AttachBody.prototype.render = function (decorated) { - var $container = $(''); - - var $dropdown = decorated.call(this); - $container.append($dropdown); - - this.$dropdownContainer = $container; - - return $container; - }; - - AttachBody.prototype._hideDropdown = function (decorated) { - this.$dropdownContainer.detach(); - }; - - AttachBody.prototype._attachPositioningHandler = - function (decorated, container) { - var self = this; - - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.each(function () { - Utils.StoreData(this, 'select2-scroll-position', { - x: $(this).scrollLeft(), - y: $(this).scrollTop() - }); - }); - - $watchers.on(scrollEvent, function (ev) { - var position = Utils.GetData(this, 'select2-scroll-position'); - $(this).scrollTop(position.y); - }); - - $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, - function (e) { - self._positionDropdown(); - self._resizeDropdown(); - }); - }; - - AttachBody.prototype._detachPositioningHandler = - function (decorated, container) { - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.off(scrollEvent); - - $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); - }; - - AttachBody.prototype._positionDropdown = function () { - var $window = $(window); - - var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); - var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); - - var newDirection = null; - - var offset = this.$container.offset(); - - offset.bottom = offset.top + this.$container.outerHeight(false); - - var container = { - height: this.$container.outerHeight(false) - }; - - container.top = offset.top; - container.bottom = offset.top + container.height; - - var dropdown = { - height: this.$dropdown.outerHeight(false) - }; - - var viewport = { - top: $window.scrollTop(), - bottom: $window.scrollTop() + $window.height() - }; - - var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); - var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); - - var css = { - left: offset.left, - top: container.bottom - }; - - // Determine what the parent element is to use for calciulating the offset - var $offsetParent = this.$dropdownParent; - - // For statically positoned elements, we need to get the element - // that is determining the offset - if ($offsetParent.css('position') === 'static') { - $offsetParent = $offsetParent.offsetParent(); - } - - var parentOffset = $offsetParent.offset(); - - css.top -= parentOffset.top; - css.left -= parentOffset.left; - - if (!isCurrentlyAbove && !isCurrentlyBelow) { - newDirection = 'below'; - } - - if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { - newDirection = 'above'; - } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { - newDirection = 'below'; - } - - if (newDirection == 'above' || - (isCurrentlyAbove && newDirection !== 'below')) { - css.top = container.top - parentOffset.top - dropdown.height; - } - - if (newDirection != null) { - this.$dropdown - .removeClass('select2-dropdown--below select2-dropdown--above') - .addClass('select2-dropdown--' + newDirection); - this.$container - .removeClass('select2-container--below select2-container--above') - .addClass('select2-container--' + newDirection); - } - - this.$dropdownContainer.css(css); - }; - - AttachBody.prototype._resizeDropdown = function () { - var css = { - width: this.$container.outerWidth(false) + 'px' - }; - - if (this.options.get('dropdownAutoWidth')) { - css.minWidth = css.width; - css.position = 'relative'; - css.width = 'auto'; - } - - this.$dropdown.css(css); - }; - - AttachBody.prototype._showDropdown = function (decorated) { - this.$dropdownContainer.appendTo(this.$dropdownParent); - - this._positionDropdown(); - this._resizeDropdown(); - }; - - return AttachBody; -}); - -S2.define('select2/dropdown/minimumResultsForSearch',[ - -], function () { - function countResults (data) { - var count = 0; - - for (var d = 0; d < data.length; d++) { - var item = data[d]; - - if (item.children) { - count += countResults(item.children); - } else { - count++; - } - } - - return count; - } - - function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { - this.minimumResultsForSearch = options.get('minimumResultsForSearch'); - - if (this.minimumResultsForSearch < 0) { - this.minimumResultsForSearch = Infinity; - } - - decorated.call(this, $element, options, dataAdapter); - } - - MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { - if (countResults(params.data.results) < this.minimumResultsForSearch) { - return false; - } - - return decorated.call(this, params); - }; - - return MinimumResultsForSearch; -}); - -S2.define('select2/dropdown/selectOnClose',[ - '../utils' -], function (Utils) { - function SelectOnClose () { } - - SelectOnClose.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('close', function (params) { - self._handleSelectOnClose(params); - }); - }; - - SelectOnClose.prototype._handleSelectOnClose = function (_, params) { - if (params && params.originalSelect2Event != null) { - var event = params.originalSelect2Event; - - // Don't select an item if the close event was triggered from a select or - // unselect event - if (event._type === 'select' || event._type === 'unselect') { - return; - } - } - - var $highlightedResults = this.getHighlightedResults(); - - // Only select highlighted results - if ($highlightedResults.length < 1) { - return; - } - - var data = Utils.GetData($highlightedResults[0], 'data'); - - // Don't re-select already selected resulte - if ( - (data.element != null && data.element.selected) || - (data.element == null && data.selected) - ) { - return; - } - - this.trigger('select', { - data: data - }); - }; - - return SelectOnClose; -}); - -S2.define('select2/dropdown/closeOnSelect',[ - -], function () { - function CloseOnSelect () { } - - CloseOnSelect.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('select', function (evt) { - self._selectTriggered(evt); - }); - - container.on('unselect', function (evt) { - self._selectTriggered(evt); - }); - }; - - CloseOnSelect.prototype._selectTriggered = function (_, evt) { - var originalEvent = evt.originalEvent; - - // Don't close if the control key is being held - if (originalEvent && originalEvent.ctrlKey) { - return; - } - - this.trigger('close', { - originalEvent: originalEvent, - originalSelect2Event: evt - }); - }; - - return CloseOnSelect; -}); - -S2.define('select2/i18n/en',[],function () { - // English - return { - errorLoading: function () { - return 'The results could not be loaded.'; - }, - inputTooLong: function (args) { - var overChars = args.input.length - args.maximum; - - var message = 'Please delete ' + overChars + ' character'; - - if (overChars != 1) { - message += 's'; - } - - return message; - }, - inputTooShort: function (args) { - var remainingChars = args.minimum - args.input.length; - - var message = 'Please enter ' + remainingChars + ' or more characters'; - - return message; - }, - loadingMore: function () { - return 'Loading more results…'; - }, - maximumSelected: function (args) { - var message = 'You can only select ' + args.maximum + ' item'; - - if (args.maximum != 1) { - message += 's'; - } - - return message; - }, - noResults: function () { - return 'No results found'; - }, - searching: function () { - return 'Searching…'; - } - }; -}); - -S2.define('select2/defaults',[ - 'jquery', - 'require', - - './results', - - './selection/single', - './selection/multiple', - './selection/placeholder', - './selection/allowClear', - './selection/search', - './selection/eventRelay', - - './utils', - './translation', - './diacritics', - - './data/select', - './data/array', - './data/ajax', - './data/tags', - './data/tokenizer', - './data/minimumInputLength', - './data/maximumInputLength', - './data/maximumSelectionLength', - - './dropdown', - './dropdown/search', - './dropdown/hidePlaceholder', - './dropdown/infiniteScroll', - './dropdown/attachBody', - './dropdown/minimumResultsForSearch', - './dropdown/selectOnClose', - './dropdown/closeOnSelect', - - './i18n/en' -], function ($, require, - - ResultsList, - - SingleSelection, MultipleSelection, Placeholder, AllowClear, - SelectionSearch, EventRelay, - - Utils, Translation, DIACRITICS, - - SelectData, ArrayData, AjaxData, Tags, Tokenizer, - MinimumInputLength, MaximumInputLength, MaximumSelectionLength, - - Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, - AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, - - EnglishTranslation) { - function Defaults () { - this.reset(); - } - - Defaults.prototype.apply = function (options) { - options = $.extend(true, {}, this.defaults, options); - - if (options.dataAdapter == null) { - if (options.ajax != null) { - options.dataAdapter = AjaxData; - } else if (options.data != null) { - options.dataAdapter = ArrayData; - } else { - options.dataAdapter = SelectData; - } - - if (options.minimumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MinimumInputLength - ); - } - - if (options.maximumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumInputLength - ); - } - - if (options.maximumSelectionLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumSelectionLength - ); - } - - if (options.tags) { - options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); - } - - if (options.tokenSeparators != null || options.tokenizer != null) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Tokenizer - ); - } - - if (options.query != null) { - var Query = require(options.amdBase + 'compat/query'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Query - ); - } - - if (options.initSelection != null) { - var InitSelection = require(options.amdBase + 'compat/initSelection'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - InitSelection - ); - } - } - - if (options.resultsAdapter == null) { - options.resultsAdapter = ResultsList; - - if (options.ajax != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - InfiniteScroll - ); - } - - if (options.placeholder != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - HidePlaceholder - ); - } - - if (options.selectOnClose) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - SelectOnClose - ); - } - } - - if (options.dropdownAdapter == null) { - if (options.multiple) { - options.dropdownAdapter = Dropdown; - } else { - var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); - - options.dropdownAdapter = SearchableDropdown; - } - - if (options.minimumResultsForSearch !== 0) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - MinimumResultsForSearch - ); - } - - if (options.closeOnSelect) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - CloseOnSelect - ); - } - - if ( - options.dropdownCssClass != null || - options.dropdownCss != null || - options.adaptDropdownCssClass != null - ) { - var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); - - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - DropdownCSS - ); - } - - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - AttachBody - ); - } - - if (options.selectionAdapter == null) { - if (options.multiple) { - options.selectionAdapter = MultipleSelection; - } else { - options.selectionAdapter = SingleSelection; - } - - // Add the placeholder mixin if a placeholder was specified - if (options.placeholder != null) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - Placeholder - ); - } - - if (options.allowClear) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - AllowClear - ); - } - - if (options.multiple) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - SelectionSearch - ); - } - - if ( - options.containerCssClass != null || - options.containerCss != null || - options.adaptContainerCssClass != null - ) { - var ContainerCSS = require(options.amdBase + 'compat/containerCss'); - - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - ContainerCSS - ); - } - - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - EventRelay - ); - } - - if (typeof options.language === 'string') { - // Check if the language is specified with a region - if (options.language.indexOf('-') > 0) { - // Extract the region information if it is included - var languageParts = options.language.split('-'); - var baseLanguage = languageParts[0]; - - options.language = [options.language, baseLanguage]; - } else { - options.language = [options.language]; - } - } - - if ($.isArray(options.language)) { - var languages = new Translation(); - options.language.push('en'); - - var languageNames = options.language; - - for (var l = 0; l < languageNames.length; l++) { - var name = languageNames[l]; - var language = {}; - - try { - // Try to load it with the original name - language = Translation.loadPath(name); - } catch (e) { - try { - // If we couldn't load it, check if it wasn't the full path - name = this.defaults.amdLanguageBase + name; - language = Translation.loadPath(name); - } catch (ex) { - // The translation could not be loaded at all. Sometimes this is - // because of a configuration problem, other times this can be - // because of how Select2 helps load all possible translation files. - if (options.debug && window.console && console.warn) { - console.warn( - 'Select2: The language file for "' + name + '" could not be ' + - 'automatically loaded. A fallback will be used instead.' - ); - } - - continue; - } - } - - languages.extend(language); - } - - options.translations = languages; - } else { - var baseTranslation = Translation.loadPath( - this.defaults.amdLanguageBase + 'en' - ); - var customTranslation = new Translation(options.language); - - customTranslation.extend(baseTranslation); - - options.translations = customTranslation; - } - - return options; - }; - - Defaults.prototype.reset = function () { - function stripDiacritics (text) { - // Used 'uni range + named function' from http://jsperf.com/diacritics/18 - function match(a) { - return DIACRITICS[a] || a; - } - - return text.replace(/[^\u0000-\u007E]/g, match); - } - - function matcher (params, data) { - // Always return the object if there is nothing to compare - if ($.trim(params.term) === '') { - return data; - } - - // Do a recursive check for options with children - if (data.children && data.children.length > 0) { - // Clone the data object if there are children - // This is required as we modify the object to remove any non-matches - var match = $.extend(true, {}, data); - - // Check each child of the option - for (var c = data.children.length - 1; c >= 0; c--) { - var child = data.children[c]; - - var matches = matcher(params, child); - - // If there wasn't a match, remove the object in the array - if (matches == null) { - match.children.splice(c, 1); - } - } - - // If any children matched, return the new object - if (match.children.length > 0) { - return match; - } - - // If there were no matching children, check just the plain object - return matcher(params, match); - } - - var original = stripDiacritics(data.text).toUpperCase(); - var term = stripDiacritics(params.term).toUpperCase(); - - // Check if the text contains the term - if (original.indexOf(term) > -1) { - return data; - } - - // If it doesn't contain the term, don't return anything - return null; - } - - this.defaults = { - amdBase: './', - amdLanguageBase: './i18n/', - closeOnSelect: true, - debug: false, - dropdownAutoWidth: false, - escapeMarkup: Utils.escapeMarkup, - language: EnglishTranslation, - matcher: matcher, - minimumInputLength: 0, - maximumInputLength: 0, - maximumSelectionLength: 0, - minimumResultsForSearch: 0, - selectOnClose: false, - sorter: function (data) { - return data; - }, - templateResult: function (result) { - return result.text; - }, - templateSelection: function (selection) { - return selection.text; - }, - theme: 'default', - width: 'resolve' - }; - }; - - Defaults.prototype.set = function (key, value) { - var camelKey = $.camelCase(key); - - var data = {}; - data[camelKey] = value; - - var convertedData = Utils._convertData(data); - - $.extend(true, this.defaults, convertedData); - }; - - var defaults = new Defaults(); - - return defaults; -}); - -S2.define('select2/options',[ - 'require', - 'jquery', - './defaults', - './utils' -], function (require, $, Defaults, Utils) { - function Options (options, $element) { - this.options = options; - - if ($element != null) { - this.fromElement($element); - } - - this.options = Defaults.apply(this.options); - - if ($element && $element.is('input')) { - var InputCompat = require(this.get('amdBase') + 'compat/inputData'); - - this.options.dataAdapter = Utils.Decorate( - this.options.dataAdapter, - InputCompat - ); - } - } - - Options.prototype.fromElement = function ($e) { - var excludedData = ['select2']; - - if (this.options.multiple == null) { - this.options.multiple = $e.prop('multiple'); - } - - if (this.options.disabled == null) { - this.options.disabled = $e.prop('disabled'); - } - - if (this.options.language == null) { - if ($e.prop('lang')) { - this.options.language = $e.prop('lang').toLowerCase(); - } else if ($e.closest('[lang]').prop('lang')) { - this.options.language = $e.closest('[lang]').prop('lang'); - } - } - - if (this.options.dir == null) { - if ($e.prop('dir')) { - this.options.dir = $e.prop('dir'); - } else if ($e.closest('[dir]').prop('dir')) { - this.options.dir = $e.closest('[dir]').prop('dir'); - } else { - this.options.dir = 'ltr'; - } - } - - $e.prop('disabled', this.options.disabled); - $e.prop('multiple', this.options.multiple); - - if (Utils.GetData($e[0], 'select2Tags')) { - if (this.options.debug && window.console && console.warn) { - console.warn( - 'Select2: The `data-select2-tags` attribute has been changed to ' + - 'use the `data-data` and `data-tags="true"` attributes and will be ' + - 'removed in future versions of Select2.' - ); - } - - Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags')); - Utils.StoreData($e[0], 'tags', true); - } - - if (Utils.GetData($e[0], 'ajaxUrl')) { - if (this.options.debug && window.console && console.warn) { - console.warn( - 'Select2: The `data-ajax-url` attribute has been changed to ' + - '`data-ajax--url` and support for the old attribute will be removed' + - ' in future versions of Select2.' - ); - } - - $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); - Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); - - } - - var dataset = {}; - - // Prefer the element's `dataset` attribute if it exists - // jQuery 1.x does not correctly handle data attributes with multiple dashes - if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { - dataset = $.extend(true, {}, $e[0].dataset, Utils.GetData($e[0])); - } else { - dataset = Utils.GetData($e[0]); - } - - var data = $.extend(true, {}, dataset); - - data = Utils._convertData(data); - - for (var key in data) { - if ($.inArray(key, excludedData) > -1) { - continue; - } - - if ($.isPlainObject(this.options[key])) { - $.extend(this.options[key], data[key]); - } else { - this.options[key] = data[key]; - } - } - - return this; - }; - - Options.prototype.get = function (key) { - return this.options[key]; - }; - - Options.prototype.set = function (key, val) { - this.options[key] = val; - }; - - return Options; -}); - -S2.define('select2/core',[ - 'jquery', - './options', - './utils', - './keys' -], function ($, Options, Utils, KEYS) { - var Select2 = function ($element, options) { - if (Utils.GetData($element[0], 'select2') != null) { - Utils.GetData($element[0], 'select2').destroy(); - } - - this.$element = $element; - - this.id = this._generateId($element); - - options = options || {}; - - this.options = new Options(options, $element); - - Select2.__super__.constructor.call(this); - - // Set up the tabindex - - var tabindex = $element.attr('tabindex') || 0; - Utils.StoreData($element[0], 'old-tabindex', tabindex); - $element.attr('tabindex', '-1'); - - // Set up containers and adapters - - var DataAdapter = this.options.get('dataAdapter'); - this.dataAdapter = new DataAdapter($element, this.options); - - var $container = this.render(); - - this._placeContainer($container); - - var SelectionAdapter = this.options.get('selectionAdapter'); - this.selection = new SelectionAdapter($element, this.options); - this.$selection = this.selection.render(); - - this.selection.position(this.$selection, $container); - - var DropdownAdapter = this.options.get('dropdownAdapter'); - this.dropdown = new DropdownAdapter($element, this.options); - this.$dropdown = this.dropdown.render(); - - this.dropdown.position(this.$dropdown, $container); - - var ResultsAdapter = this.options.get('resultsAdapter'); - this.results = new ResultsAdapter($element, this.options, this.dataAdapter); - this.$results = this.results.render(); - - this.results.position(this.$results, this.$dropdown); - - // Bind events - - var self = this; - - // Bind the container to all of the adapters - this._bindAdapters(); - - // Register any DOM event handlers - this._registerDomEvents(); - - // Register any internal event handlers - this._registerDataEvents(); - this._registerSelectionEvents(); - this._registerDropdownEvents(); - this._registerResultsEvents(); - this._registerEvents(); - - // Set the initial state - this.dataAdapter.current(function (initialData) { - self.trigger('selection:update', { - data: initialData - }); - }); - - // Hide the original select - $element.addClass('select2-hidden-accessible'); - $element.attr('aria-hidden', 'true'); - - // Synchronize any monitored attributes - this._syncAttributes(); - - Utils.StoreData($element[0], 'select2', this); - - // Ensure backwards compatibility with $element.data('select2'). - $element.data('select2', this); - }; - - Utils.Extend(Select2, Utils.Observable); - - Select2.prototype._generateId = function ($element) { - var id = ''; - - if ($element.attr('id') != null) { - id = $element.attr('id'); - } else if ($element.attr('name') != null) { - id = $element.attr('name') + '-' + Utils.generateChars(2); - } else { - id = Utils.generateChars(4); - } - - id = id.replace(/(:|\.|\[|\]|,)/g, ''); - id = 'select2-' + id; - - return id; - }; - - Select2.prototype._placeContainer = function ($container) { - $container.insertAfter(this.$element); - - var width = this._resolveWidth(this.$element, this.options.get('width')); - - if (width != null) { - $container.css('width', width); - } - }; - - Select2.prototype._resolveWidth = function ($element, method) { - var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; - - if (method == 'resolve') { - var styleWidth = this._resolveWidth($element, 'style'); - - if (styleWidth != null) { - return styleWidth; - } - - return this._resolveWidth($element, 'element'); - } - - if (method == 'element') { - var elementWidth = $element.outerWidth(false); - - if (elementWidth <= 0) { - return 'auto'; - } - - return elementWidth + 'px'; - } - - if (method == 'style') { - var style = $element.attr('style'); - - if (typeof(style) !== 'string') { - return null; - } - - var attrs = style.split(';'); - - for (var i = 0, l = attrs.length; i < l; i = i + 1) { - var attr = attrs[i].replace(/\s/g, ''); - var matches = attr.match(WIDTH); - - if (matches !== null && matches.length >= 1) { - return matches[1]; - } - } - - return null; - } - - return method; - }; - - Select2.prototype._bindAdapters = function () { - this.dataAdapter.bind(this, this.$container); - this.selection.bind(this, this.$container); - - this.dropdown.bind(this, this.$container); - this.results.bind(this, this.$container); - }; - - Select2.prototype._registerDomEvents = function () { - var self = this; - - this.$element.on('change.select2', function () { - self.dataAdapter.current(function (data) { - self.trigger('selection:update', { - data: data - }); - }); - }); - - this.$element.on('focus.select2', function (evt) { - self.trigger('focus', evt); - }); - - this._syncA = Utils.bind(this._syncAttributes, this); - this._syncS = Utils.bind(this._syncSubtree, this); - - if (this.$element[0].attachEvent) { - this.$element[0].attachEvent('onpropertychange', this._syncA); - } - - var observer = window.MutationObserver || - window.WebKitMutationObserver || - window.MozMutationObserver - ; - - if (observer != null) { - this._observer = new observer(function (mutations) { - $.each(mutations, self._syncA); - $.each(mutations, self._syncS); - }); - this._observer.observe(this.$element[0], { - attributes: true, - childList: true, - subtree: false - }); - } else if (this.$element[0].addEventListener) { - this.$element[0].addEventListener( - 'DOMAttrModified', - self._syncA, - false - ); - this.$element[0].addEventListener( - 'DOMNodeInserted', - self._syncS, - false - ); - this.$element[0].addEventListener( - 'DOMNodeRemoved', - self._syncS, - false - ); - } - }; - - Select2.prototype._registerDataEvents = function () { - var self = this; - - this.dataAdapter.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerSelectionEvents = function () { - var self = this; - var nonRelayEvents = ['toggle', 'focus']; - - this.selection.on('toggle', function () { - self.toggleDropdown(); - }); - - this.selection.on('focus', function (params) { - self.focus(params); - }); - - this.selection.on('*', function (name, params) { - if ($.inArray(name, nonRelayEvents) !== -1) { - return; - } - - self.trigger(name, params); - }); - }; - - Select2.prototype._registerDropdownEvents = function () { - var self = this; - - this.dropdown.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerResultsEvents = function () { - var self = this; - - this.results.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerEvents = function () { - var self = this; - - this.on('open', function () { - self.$container.addClass('select2-container--open'); - }); - - this.on('close', function () { - self.$container.removeClass('select2-container--open'); - }); - - this.on('enable', function () { - self.$container.removeClass('select2-container--disabled'); - }); - - this.on('disable', function () { - self.$container.addClass('select2-container--disabled'); - }); - - this.on('blur', function () { - self.$container.removeClass('select2-container--focus'); - }); - - this.on('query', function (params) { - if (!self.isOpen()) { - self.trigger('open', {}); - } - - this.dataAdapter.query(params, function (data) { - self.trigger('results:all', { - data: data, - query: params - }); - }); - }); - - this.on('query:append', function (params) { - this.dataAdapter.query(params, function (data) { - self.trigger('results:append', { - data: data, - query: params - }); - }); - }); - - this.on('keypress', function (evt) { - var key = evt.which; - - if (self.isOpen()) { - if (key === KEYS.ESC || key === KEYS.TAB || - (key === KEYS.UP && evt.altKey)) { - self.close(); - - evt.preventDefault(); - } else if (key === KEYS.ENTER) { - self.trigger('results:select', {}); - - evt.preventDefault(); - } else if ((key === KEYS.SPACE && evt.ctrlKey)) { - self.trigger('results:toggle', {}); - - evt.preventDefault(); - } else if (key === KEYS.UP) { - self.trigger('results:previous', {}); - - evt.preventDefault(); - } else if (key === KEYS.DOWN) { - self.trigger('results:next', {}); - - evt.preventDefault(); - } - } else { - if (key === KEYS.ENTER || key === KEYS.SPACE || - (key === KEYS.DOWN && evt.altKey)) { - self.open(); - - evt.preventDefault(); - } - } - }); - }; - - Select2.prototype._syncAttributes = function () { - this.options.set('disabled', this.$element.prop('disabled')); - - if (this.options.get('disabled')) { - if (this.isOpen()) { - this.close(); - } - - this.trigger('disable', {}); - } else { - this.trigger('enable', {}); - } - }; - - Select2.prototype._syncSubtree = function (evt, mutations) { - var changed = false; - var self = this; - - // Ignore any mutation events raised for elements that aren't options or - // optgroups. This handles the case when the select element is destroyed - if ( - evt && evt.target && ( - evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' - ) - ) { - return; - } - - if (!mutations) { - // If mutation events aren't supported, then we can only assume that the - // change affected the selections - changed = true; - } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { - for (var n = 0; n < mutations.addedNodes.length; n++) { - var node = mutations.addedNodes[n]; - - if (node.selected) { - changed = true; - } - } - } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { - changed = true; - } - - // Only re-pull the data if we think there is a change - if (changed) { - this.dataAdapter.current(function (currentData) { - self.trigger('selection:update', { - data: currentData - }); - }); - } - }; - - /** - * Override the trigger method to automatically trigger pre-events when - * there are events that can be prevented. - */ - Select2.prototype.trigger = function (name, args) { - var actualTrigger = Select2.__super__.trigger; - var preTriggerMap = { - 'open': 'opening', - 'close': 'closing', - 'select': 'selecting', - 'unselect': 'unselecting', - 'clear': 'clearing' - }; - - if (args === undefined) { - args = {}; - } - - if (name in preTriggerMap) { - var preTriggerName = preTriggerMap[name]; - var preTriggerArgs = { - prevented: false, - name: name, - args: args - }; - - actualTrigger.call(this, preTriggerName, preTriggerArgs); - - if (preTriggerArgs.prevented) { - args.prevented = true; - - return; - } - } - - actualTrigger.call(this, name, args); - }; - - Select2.prototype.toggleDropdown = function () { - if (this.options.get('disabled')) { - return; - } - - if (this.isOpen()) { - this.close(); - } else { - this.open(); - } - }; - - Select2.prototype.open = function () { - if (this.isOpen()) { - return; - } - - this.trigger('query', {}); - }; - - Select2.prototype.close = function () { - if (!this.isOpen()) { - return; - } - - this.trigger('close', {}); - }; - - Select2.prototype.isOpen = function () { - return this.$container.hasClass('select2-container--open'); - }; - - Select2.prototype.hasFocus = function () { - return this.$container.hasClass('select2-container--focus'); - }; - - Select2.prototype.focus = function (data) { - // No need to re-trigger focus events if we are already focused - if (this.hasFocus()) { - return; - } - - this.$container.addClass('select2-container--focus'); - this.trigger('focus', {}); - }; - - Select2.prototype.enable = function (args) { - if (this.options.get('debug') && window.console && console.warn) { - console.warn( - 'Select2: The `select2("enable")` method has been deprecated and will' + - ' be removed in later Select2 versions. Use $element.prop("disabled")' + - ' instead.' - ); - } - - if (args == null || args.length === 0) { - args = [true]; - } - - var disabled = !args[0]; - - this.$element.prop('disabled', disabled); - }; - - Select2.prototype.data = function () { - if (this.options.get('debug') && - arguments.length > 0 && window.console && console.warn) { - console.warn( - 'Select2: Data can no longer be set using `select2("data")`. You ' + - 'should consider setting the value instead using `$element.val()`.' - ); - } - - var data = []; - - this.dataAdapter.current(function (currentData) { - data = currentData; - }); - - return data; - }; - - Select2.prototype.val = function (args) { - if (this.options.get('debug') && window.console && console.warn) { - console.warn( - 'Select2: The `select2("val")` method has been deprecated and will be' + - ' removed in later Select2 versions. Use $element.val() instead.' - ); - } - - if (args == null || args.length === 0) { - return this.$element.val(); - } - - var newVal = args[0]; - - if ($.isArray(newVal)) { - newVal = $.map(newVal, function (obj) { - return obj.toString(); - }); - } - - this.$element.val(newVal).trigger('change'); - }; - - Select2.prototype.destroy = function () { - this.$container.remove(); - - if (this.$element[0].detachEvent) { - this.$element[0].detachEvent('onpropertychange', this._syncA); - } - - if (this._observer != null) { - this._observer.disconnect(); - this._observer = null; - } else if (this.$element[0].removeEventListener) { - this.$element[0] - .removeEventListener('DOMAttrModified', this._syncA, false); - this.$element[0] - .removeEventListener('DOMNodeInserted', this._syncS, false); - this.$element[0] - .removeEventListener('DOMNodeRemoved', this._syncS, false); - } - - this._syncA = null; - this._syncS = null; - - this.$element.off('.select2'); - this.$element.attr('tabindex', - Utils.GetData(this.$element[0], 'old-tabindex')); - - this.$element.removeClass('select2-hidden-accessible'); - this.$element.attr('aria-hidden', 'false'); - Utils.RemoveData(this.$element[0]); - this.$element.removeData('select2'); - - this.dataAdapter.destroy(); - this.selection.destroy(); - this.dropdown.destroy(); - this.results.destroy(); - - this.dataAdapter = null; - this.selection = null; - this.dropdown = null; - this.results = null; - }; - - Select2.prototype.render = function () { - var $container = $( - '' + - '' + - '' + - '' - ); - - $container.attr('dir', this.options.get('dir')); - - this.$container = $container; - - this.$container.addClass('select2-container--' + this.options.get('theme')); - - Utils.StoreData($container[0], 'element', this.$element); - - return $container; - }; - - return Select2; -}); - -S2.define('select2/compat/utils',[ - 'jquery' -], function ($) { - function syncCssClasses ($dest, $src, adapter) { - var classes, replacements = [], adapted; - - classes = $.trim($dest.attr('class')); - - if (classes) { - classes = '' + classes; // for IE which returns object - - $(classes.split(/\s+/)).each(function () { - // Save all Select2 classes - if (this.indexOf('select2-') === 0) { - replacements.push(this); - } - }); - } - - classes = $.trim($src.attr('class')); - - if (classes) { - classes = '' + classes; // for IE which returns object - - $(classes.split(/\s+/)).each(function () { - // Only adapt non-Select2 classes - if (this.indexOf('select2-') !== 0) { - adapted = adapter(this); - - if (adapted != null) { - replacements.push(adapted); - } - } - }); - } - - $dest.attr('class', replacements.join(' ')); - } - - return { - syncCssClasses: syncCssClasses - }; -}); - -S2.define('select2/compat/containerCss',[ - 'jquery', - './utils' -], function ($, CompatUtils) { - // No-op CSS adapter that discards all classes by default - function _containerAdapter (clazz) { - return null; - } - - function ContainerCSS () { } - - ContainerCSS.prototype.render = function (decorated) { - var $container = decorated.call(this); - - var containerCssClass = this.options.get('containerCssClass') || ''; - - if ($.isFunction(containerCssClass)) { - containerCssClass = containerCssClass(this.$element); - } - - var containerCssAdapter = this.options.get('adaptContainerCssClass'); - containerCssAdapter = containerCssAdapter || _containerAdapter; - - if (containerCssClass.indexOf(':all:') !== -1) { - containerCssClass = containerCssClass.replace(':all:', ''); - - var _cssAdapter = containerCssAdapter; - - containerCssAdapter = function (clazz) { - var adapted = _cssAdapter(clazz); - - if (adapted != null) { - // Append the old one along with the adapted one - return adapted + ' ' + clazz; - } - - return clazz; - }; - } - - var containerCss = this.options.get('containerCss') || {}; - - if ($.isFunction(containerCss)) { - containerCss = containerCss(this.$element); - } - - CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter); - - $container.css(containerCss); - $container.addClass(containerCssClass); - - return $container; - }; - - return ContainerCSS; -}); - -S2.define('select2/compat/dropdownCss',[ - 'jquery', - './utils' -], function ($, CompatUtils) { - // No-op CSS adapter that discards all classes by default - function _dropdownAdapter (clazz) { - return null; - } - - function DropdownCSS () { } - - DropdownCSS.prototype.render = function (decorated) { - var $dropdown = decorated.call(this); - - var dropdownCssClass = this.options.get('dropdownCssClass') || ''; - - if ($.isFunction(dropdownCssClass)) { - dropdownCssClass = dropdownCssClass(this.$element); - } - - var dropdownCssAdapter = this.options.get('adaptDropdownCssClass'); - dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter; - - if (dropdownCssClass.indexOf(':all:') !== -1) { - dropdownCssClass = dropdownCssClass.replace(':all:', ''); - - var _cssAdapter = dropdownCssAdapter; - - dropdownCssAdapter = function (clazz) { - var adapted = _cssAdapter(clazz); - - if (adapted != null) { - // Append the old one along with the adapted one - return adapted + ' ' + clazz; - } - - return clazz; - }; - } - - var dropdownCss = this.options.get('dropdownCss') || {}; - - if ($.isFunction(dropdownCss)) { - dropdownCss = dropdownCss(this.$element); - } - - CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter); - - $dropdown.css(dropdownCss); - $dropdown.addClass(dropdownCssClass); - - return $dropdown; - }; - - return DropdownCSS; -}); - -S2.define('select2/compat/initSelection',[ - 'jquery' -], function ($) { - function InitSelection (decorated, $element, options) { - if (options.get('debug') && window.console && console.warn) { - console.warn( - 'Select2: The `initSelection` option has been deprecated in favor' + - ' of a custom data adapter that overrides the `current` method. ' + - 'This method is now called multiple times instead of a single ' + - 'time when the instance is initialized. Support will be removed ' + - 'for the `initSelection` option in future versions of Select2' - ); - } - - this.initSelection = options.get('initSelection'); - this._isInitialized = false; - - decorated.call(this, $element, options); - } - - InitSelection.prototype.current = function (decorated, callback) { - var self = this; - - if (this._isInitialized) { - decorated.call(this, callback); - - return; - } - - this.initSelection.call(null, this.$element, function (data) { - self._isInitialized = true; - - if (!$.isArray(data)) { - data = [data]; - } - - callback(data); - }); - }; - - return InitSelection; -}); - -S2.define('select2/compat/inputData',[ - 'jquery', - '../utils' -], function ($, Utils) { - function InputData (decorated, $element, options) { - this._currentData = []; - this._valueSeparator = options.get('valueSeparator') || ','; - - if ($element.prop('type') === 'hidden') { - if (options.get('debug') && console && console.warn) { - console.warn( - 'Select2: Using a hidden input with Select2 is no longer ' + - 'supported and may stop working in the future. It is recommended ' + - 'to use a `');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,d,e){var f=this;a.call(this,d,e),d.on("open",function(){f.$search.trigger("focus")}),d.on("close",function(){f.$search.val(""),f.$search.removeAttr("aria-activedescendant"),f.$search.trigger("focus")}),d.on("enable",function(){f.$search.prop("disabled",!1),f._transferTabIndex()}),d.on("disable",function(){f.$search.prop("disabled",!0)}),d.on("focus",function(a){f.$search.trigger("focus")}),d.on("results:focus",function(a){f.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){f.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){f._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){if(a.stopPropagation(),f.trigger("keypress",a),f._keyUpPrevented=a.isDefaultPrevented(),a.which===c.BACKSPACE&&""===f.$search.val()){var d=f.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var e=b.GetData(d[0],"data");f.searchRemoveChoice(e),a.preventDefault()}}});var g=document.documentMode,h=g&&g<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(h)return void f.$selection.off("input.search input.searchcheck");f.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(h&&"input"===a.type)return void f.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&f.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;if(this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c){this.$element.find("[data-select2-tag]").length?this.$element.focus():this.$search.focus()}},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{a=.75*(this.$search.val().length+1)+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],g=["opening","closing","selecting","unselecting","clearing"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),null!=c.id?d+="-"+c.id.toString():d+="-"+a.generateChars(4),d},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){"status"in d&&(0===d.status||"0"===d.status)||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength)return void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;if(d.maximumSelectionLength>0&&f>=d.maximumSelectionLength)return void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}});a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val(""),e.$search.blur()}),c.on("focus",function(){c.isOpen()||e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){e.showSearch(a)?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){e.$results.offset().top+e.$results.outerHeight(!1)+50>=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1)&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
        • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){b.StoreData(this,"select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(c){var d=b.GetData(this,"select2-scroll-position");a(this).scrollTop(d.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id;this.$container.parents().filter(b.hasScroll).off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){null==c(d,e.children[g])&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var h=b(e.text).toUpperCase(),i=b(d.term).toUpperCase();return h.indexOf(i)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(!0,this.defaults,f)},new D}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),d.GetData(a[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),d.StoreData(a[0],"data",d.GetData(a[0],"select2Tags")),d.StoreData(a[0],"tags",!0)),d.GetData(a[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",d.GetData(a[0],"ajaxUrl")),d.StoreData(a[0],"ajax-Url",d.GetData(a[0],"ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,d.GetData(a[0])):d.GetData(a[0]);var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,d){null!=c.GetData(a[0],"select2")&&c.GetData(a[0],"select2").destroy(),this.$element=a,this.id=this._generateId(a),d=d||{},this.options=new b(d,a),e.__super__.constructor.call(this);var f=a.attr("tabindex")||0;c.StoreData(a[0],"old-tabindex",f),a.attr("tabindex","-1");var g=this.options.get("dataAdapter");this.dataAdapter=new g(a,this.options);var h=this.render();this._placeContainer(h);var i=this.options.get("selectionAdapter");this.selection=new i(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,h);var j=this.options.get("dropdownAdapter");this.dropdown=new j(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,h);var k=this.options.get("resultsAdapter");this.results=new k(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){l.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),c.StoreData(a[0],"select2",this),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",c.GetData(this.$element[0],"old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),c.RemoveData(this.$element[0]),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),c.StoreData(b[0],"element",this.$element),b},e}),b.define("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&null!=(f=d(this))&&g.push(f)})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;if(this._isInitialized)return void b.call(this,c);this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery","../utils"],function(a,b){function c(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `' + - '' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - var $rendered = decorated.call(this); - - this._transferTabIndex(); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('open', function () { - self.$search.trigger('focus'); - }); - - container.on('close', function () { - self.$search.val(''); - self.$search.removeAttr('aria-activedescendant'); - self.$search.trigger('focus'); - }); - - container.on('enable', function () { - self.$search.prop('disabled', false); - - self._transferTabIndex(); - }); - - container.on('disable', function () { - self.$search.prop('disabled', true); - }); - - container.on('focus', function (evt) { - self.$search.trigger('focus'); - }); - - container.on('results:focus', function (params) { - self.$search.attr('aria-activedescendant', params.id); - }); - - this.$selection.on('focusin', '.select2-search--inline', function (evt) { - self.trigger('focus', evt); - }); - - this.$selection.on('focusout', '.select2-search--inline', function (evt) { - self._handleBlur(evt); - }); - - this.$selection.on('keydown', '.select2-search--inline', function (evt) { - evt.stopPropagation(); - - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - - var key = evt.which; - - if (key === KEYS.BACKSPACE && self.$search.val() === '') { - var $previousChoice = self.$searchContainer - .prev('.select2-selection__choice'); - - if ($previousChoice.length > 0) { - var item = Utils.GetData($previousChoice[0], 'data'); - - self.searchRemoveChoice(item); - - evt.preventDefault(); - } - } - }); - - // Try to detect the IE version should the `documentMode` property that - // is stored on the document. This is only implemented in IE and is - // slightly cleaner than doing a user agent check. - // This property is not available in Edge, but Edge also doesn't have - // this bug. - var msie = document.documentMode; - var disableInputEvents = msie && msie <= 11; - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$selection.on( - 'input.searchcheck', - '.select2-search--inline', - function (evt) { - // IE will trigger the `input` event when a placeholder is used on a - // search box. To get around this issue, we are forced to ignore all - // `input` events in IE and keep using `keyup`. - if (disableInputEvents) { - self.$selection.off('input.search input.searchcheck'); - return; - } - - // Unbind the duplicated `keyup` event - self.$selection.off('keyup.search'); - } - ); - - this.$selection.on( - 'keyup.search input.search', - '.select2-search--inline', - function (evt) { - // IE will trigger the `input` event when a placeholder is used on a - // search box. To get around this issue, we are forced to ignore all - // `input` events in IE and keep using `keyup`. - if (disableInputEvents && evt.type === 'input') { - self.$selection.off('input.search input.searchcheck'); - return; - } - - var key = evt.which; - - // We can freely ignore events from modifier keys - if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { - return; - } - - // Tabbing will be handled during the `keydown` phase - if (key == KEYS.TAB) { - return; - } - - self.handleSearch(evt); - } - ); - }; - - /** - * This method will transfer the tabindex attribute from the rendered - * selection to the search box. This allows for the search box to be used as - * the primary focus instead of the selection container. - * - * @private - */ - Search.prototype._transferTabIndex = function (decorated) { - this.$search.attr('tabindex', this.$selection.attr('tabindex')); - this.$selection.attr('tabindex', '-1'); - }; - - Search.prototype.createPlaceholder = function (decorated, placeholder) { - this.$search.attr('placeholder', placeholder.text); - }; - - Search.prototype.update = function (decorated, data) { - var searchHadFocus = this.$search[0] == document.activeElement; - - this.$search.attr('placeholder', ''); - - decorated.call(this, data); - - this.$selection.find('.select2-selection__rendered') - .append(this.$searchContainer); - - this.resizeSearch(); - if (searchHadFocus) { - var isTagInput = this.$element.find('[data-select2-tag]').length; - if (isTagInput) { - // fix IE11 bug where tag input lost focus - this.$element.focus(); - } else { - this.$search.focus(); - } - } - }; - - Search.prototype.handleSearch = function () { - this.resizeSearch(); - - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.searchRemoveChoice = function (decorated, item) { - this.trigger('unselect', { - data: item - }); - - this.$search.val(item.text); - this.handleSearch(); - }; - - Search.prototype.resizeSearch = function () { - this.$search.css('width', '25px'); - - var width = ''; - - if (this.$search.attr('placeholder') !== '') { - width = this.$selection.find('.select2-selection__rendered').innerWidth(); - } else { - var minimumWidth = this.$search.val().length + 1; - - width = (minimumWidth * 0.75) + 'em'; - } - - this.$search.css('width', width); - }; - - return Search; -}); - -S2.define('select2/selection/eventRelay',[ - 'jquery' -], function ($) { - function EventRelay () { } - - EventRelay.prototype.bind = function (decorated, container, $container) { - var self = this; - var relayEvents = [ - 'open', 'opening', - 'close', 'closing', - 'select', 'selecting', - 'unselect', 'unselecting', - 'clear', 'clearing' - ]; - - var preventableEvents = [ - 'opening', 'closing', 'selecting', 'unselecting', 'clearing' - ]; - - decorated.call(this, container, $container); - - container.on('*', function (name, params) { - // Ignore events that should not be relayed - if ($.inArray(name, relayEvents) === -1) { - return; - } - - // The parameters should always be an object - params = params || {}; - - // Generate the jQuery event for the Select2 event - var evt = $.Event('select2:' + name, { - params: params - }); - - self.$element.trigger(evt); - - // Only handle preventable events if it was one - if ($.inArray(name, preventableEvents) === -1) { - return; - } - - params.prevented = evt.isDefaultPrevented(); - }); - }; - - return EventRelay; -}); - -S2.define('select2/translation',[ - 'jquery', - 'require' -], function ($, require) { - function Translation (dict) { - this.dict = dict || {}; - } - - Translation.prototype.all = function () { - return this.dict; - }; - - Translation.prototype.get = function (key) { - return this.dict[key]; - }; - - Translation.prototype.extend = function (translation) { - this.dict = $.extend({}, translation.all(), this.dict); - }; - - // Static functions - - Translation._cache = {}; - - Translation.loadPath = function (path) { - if (!(path in Translation._cache)) { - var translations = require(path); - - Translation._cache[path] = translations; - } - - return new Translation(Translation._cache[path]); - }; - - return Translation; -}); - -S2.define('select2/diacritics',[ - -], function () { - var diacritics = { - '\u24B6': 'A', - '\uFF21': 'A', - '\u00C0': 'A', - '\u00C1': 'A', - '\u00C2': 'A', - '\u1EA6': 'A', - '\u1EA4': 'A', - '\u1EAA': 'A', - '\u1EA8': 'A', - '\u00C3': 'A', - '\u0100': 'A', - '\u0102': 'A', - '\u1EB0': 'A', - '\u1EAE': 'A', - '\u1EB4': 'A', - '\u1EB2': 'A', - '\u0226': 'A', - '\u01E0': 'A', - '\u00C4': 'A', - '\u01DE': 'A', - '\u1EA2': 'A', - '\u00C5': 'A', - '\u01FA': 'A', - '\u01CD': 'A', - '\u0200': 'A', - '\u0202': 'A', - '\u1EA0': 'A', - '\u1EAC': 'A', - '\u1EB6': 'A', - '\u1E00': 'A', - '\u0104': 'A', - '\u023A': 'A', - '\u2C6F': 'A', - '\uA732': 'AA', - '\u00C6': 'AE', - '\u01FC': 'AE', - '\u01E2': 'AE', - '\uA734': 'AO', - '\uA736': 'AU', - '\uA738': 'AV', - '\uA73A': 'AV', - '\uA73C': 'AY', - '\u24B7': 'B', - '\uFF22': 'B', - '\u1E02': 'B', - '\u1E04': 'B', - '\u1E06': 'B', - '\u0243': 'B', - '\u0182': 'B', - '\u0181': 'B', - '\u24B8': 'C', - '\uFF23': 'C', - '\u0106': 'C', - '\u0108': 'C', - '\u010A': 'C', - '\u010C': 'C', - '\u00C7': 'C', - '\u1E08': 'C', - '\u0187': 'C', - '\u023B': 'C', - '\uA73E': 'C', - '\u24B9': 'D', - '\uFF24': 'D', - '\u1E0A': 'D', - '\u010E': 'D', - '\u1E0C': 'D', - '\u1E10': 'D', - '\u1E12': 'D', - '\u1E0E': 'D', - '\u0110': 'D', - '\u018B': 'D', - '\u018A': 'D', - '\u0189': 'D', - '\uA779': 'D', - '\u01F1': 'DZ', - '\u01C4': 'DZ', - '\u01F2': 'Dz', - '\u01C5': 'Dz', - '\u24BA': 'E', - '\uFF25': 'E', - '\u00C8': 'E', - '\u00C9': 'E', - '\u00CA': 'E', - '\u1EC0': 'E', - '\u1EBE': 'E', - '\u1EC4': 'E', - '\u1EC2': 'E', - '\u1EBC': 'E', - '\u0112': 'E', - '\u1E14': 'E', - '\u1E16': 'E', - '\u0114': 'E', - '\u0116': 'E', - '\u00CB': 'E', - '\u1EBA': 'E', - '\u011A': 'E', - '\u0204': 'E', - '\u0206': 'E', - '\u1EB8': 'E', - '\u1EC6': 'E', - '\u0228': 'E', - '\u1E1C': 'E', - '\u0118': 'E', - '\u1E18': 'E', - '\u1E1A': 'E', - '\u0190': 'E', - '\u018E': 'E', - '\u24BB': 'F', - '\uFF26': 'F', - '\u1E1E': 'F', - '\u0191': 'F', - '\uA77B': 'F', - '\u24BC': 'G', - '\uFF27': 'G', - '\u01F4': 'G', - '\u011C': 'G', - '\u1E20': 'G', - '\u011E': 'G', - '\u0120': 'G', - '\u01E6': 'G', - '\u0122': 'G', - '\u01E4': 'G', - '\u0193': 'G', - '\uA7A0': 'G', - '\uA77D': 'G', - '\uA77E': 'G', - '\u24BD': 'H', - '\uFF28': 'H', - '\u0124': 'H', - '\u1E22': 'H', - '\u1E26': 'H', - '\u021E': 'H', - '\u1E24': 'H', - '\u1E28': 'H', - '\u1E2A': 'H', - '\u0126': 'H', - '\u2C67': 'H', - '\u2C75': 'H', - '\uA78D': 'H', - '\u24BE': 'I', - '\uFF29': 'I', - '\u00CC': 'I', - '\u00CD': 'I', - '\u00CE': 'I', - '\u0128': 'I', - '\u012A': 'I', - '\u012C': 'I', - '\u0130': 'I', - '\u00CF': 'I', - '\u1E2E': 'I', - '\u1EC8': 'I', - '\u01CF': 'I', - '\u0208': 'I', - '\u020A': 'I', - '\u1ECA': 'I', - '\u012E': 'I', - '\u1E2C': 'I', - '\u0197': 'I', - '\u24BF': 'J', - '\uFF2A': 'J', - '\u0134': 'J', - '\u0248': 'J', - '\u24C0': 'K', - '\uFF2B': 'K', - '\u1E30': 'K', - '\u01E8': 'K', - '\u1E32': 'K', - '\u0136': 'K', - '\u1E34': 'K', - '\u0198': 'K', - '\u2C69': 'K', - '\uA740': 'K', - '\uA742': 'K', - '\uA744': 'K', - '\uA7A2': 'K', - '\u24C1': 'L', - '\uFF2C': 'L', - '\u013F': 'L', - '\u0139': 'L', - '\u013D': 'L', - '\u1E36': 'L', - '\u1E38': 'L', - '\u013B': 'L', - '\u1E3C': 'L', - '\u1E3A': 'L', - '\u0141': 'L', - '\u023D': 'L', - '\u2C62': 'L', - '\u2C60': 'L', - '\uA748': 'L', - '\uA746': 'L', - '\uA780': 'L', - '\u01C7': 'LJ', - '\u01C8': 'Lj', - '\u24C2': 'M', - '\uFF2D': 'M', - '\u1E3E': 'M', - '\u1E40': 'M', - '\u1E42': 'M', - '\u2C6E': 'M', - '\u019C': 'M', - '\u24C3': 'N', - '\uFF2E': 'N', - '\u01F8': 'N', - '\u0143': 'N', - '\u00D1': 'N', - '\u1E44': 'N', - '\u0147': 'N', - '\u1E46': 'N', - '\u0145': 'N', - '\u1E4A': 'N', - '\u1E48': 'N', - '\u0220': 'N', - '\u019D': 'N', - '\uA790': 'N', - '\uA7A4': 'N', - '\u01CA': 'NJ', - '\u01CB': 'Nj', - '\u24C4': 'O', - '\uFF2F': 'O', - '\u00D2': 'O', - '\u00D3': 'O', - '\u00D4': 'O', - '\u1ED2': 'O', - '\u1ED0': 'O', - '\u1ED6': 'O', - '\u1ED4': 'O', - '\u00D5': 'O', - '\u1E4C': 'O', - '\u022C': 'O', - '\u1E4E': 'O', - '\u014C': 'O', - '\u1E50': 'O', - '\u1E52': 'O', - '\u014E': 'O', - '\u022E': 'O', - '\u0230': 'O', - '\u00D6': 'O', - '\u022A': 'O', - '\u1ECE': 'O', - '\u0150': 'O', - '\u01D1': 'O', - '\u020C': 'O', - '\u020E': 'O', - '\u01A0': 'O', - '\u1EDC': 'O', - '\u1EDA': 'O', - '\u1EE0': 'O', - '\u1EDE': 'O', - '\u1EE2': 'O', - '\u1ECC': 'O', - '\u1ED8': 'O', - '\u01EA': 'O', - '\u01EC': 'O', - '\u00D8': 'O', - '\u01FE': 'O', - '\u0186': 'O', - '\u019F': 'O', - '\uA74A': 'O', - '\uA74C': 'O', - '\u01A2': 'OI', - '\uA74E': 'OO', - '\u0222': 'OU', - '\u24C5': 'P', - '\uFF30': 'P', - '\u1E54': 'P', - '\u1E56': 'P', - '\u01A4': 'P', - '\u2C63': 'P', - '\uA750': 'P', - '\uA752': 'P', - '\uA754': 'P', - '\u24C6': 'Q', - '\uFF31': 'Q', - '\uA756': 'Q', - '\uA758': 'Q', - '\u024A': 'Q', - '\u24C7': 'R', - '\uFF32': 'R', - '\u0154': 'R', - '\u1E58': 'R', - '\u0158': 'R', - '\u0210': 'R', - '\u0212': 'R', - '\u1E5A': 'R', - '\u1E5C': 'R', - '\u0156': 'R', - '\u1E5E': 'R', - '\u024C': 'R', - '\u2C64': 'R', - '\uA75A': 'R', - '\uA7A6': 'R', - '\uA782': 'R', - '\u24C8': 'S', - '\uFF33': 'S', - '\u1E9E': 'S', - '\u015A': 'S', - '\u1E64': 'S', - '\u015C': 'S', - '\u1E60': 'S', - '\u0160': 'S', - '\u1E66': 'S', - '\u1E62': 'S', - '\u1E68': 'S', - '\u0218': 'S', - '\u015E': 'S', - '\u2C7E': 'S', - '\uA7A8': 'S', - '\uA784': 'S', - '\u24C9': 'T', - '\uFF34': 'T', - '\u1E6A': 'T', - '\u0164': 'T', - '\u1E6C': 'T', - '\u021A': 'T', - '\u0162': 'T', - '\u1E70': 'T', - '\u1E6E': 'T', - '\u0166': 'T', - '\u01AC': 'T', - '\u01AE': 'T', - '\u023E': 'T', - '\uA786': 'T', - '\uA728': 'TZ', - '\u24CA': 'U', - '\uFF35': 'U', - '\u00D9': 'U', - '\u00DA': 'U', - '\u00DB': 'U', - '\u0168': 'U', - '\u1E78': 'U', - '\u016A': 'U', - '\u1E7A': 'U', - '\u016C': 'U', - '\u00DC': 'U', - '\u01DB': 'U', - '\u01D7': 'U', - '\u01D5': 'U', - '\u01D9': 'U', - '\u1EE6': 'U', - '\u016E': 'U', - '\u0170': 'U', - '\u01D3': 'U', - '\u0214': 'U', - '\u0216': 'U', - '\u01AF': 'U', - '\u1EEA': 'U', - '\u1EE8': 'U', - '\u1EEE': 'U', - '\u1EEC': 'U', - '\u1EF0': 'U', - '\u1EE4': 'U', - '\u1E72': 'U', - '\u0172': 'U', - '\u1E76': 'U', - '\u1E74': 'U', - '\u0244': 'U', - '\u24CB': 'V', - '\uFF36': 'V', - '\u1E7C': 'V', - '\u1E7E': 'V', - '\u01B2': 'V', - '\uA75E': 'V', - '\u0245': 'V', - '\uA760': 'VY', - '\u24CC': 'W', - '\uFF37': 'W', - '\u1E80': 'W', - '\u1E82': 'W', - '\u0174': 'W', - '\u1E86': 'W', - '\u1E84': 'W', - '\u1E88': 'W', - '\u2C72': 'W', - '\u24CD': 'X', - '\uFF38': 'X', - '\u1E8A': 'X', - '\u1E8C': 'X', - '\u24CE': 'Y', - '\uFF39': 'Y', - '\u1EF2': 'Y', - '\u00DD': 'Y', - '\u0176': 'Y', - '\u1EF8': 'Y', - '\u0232': 'Y', - '\u1E8E': 'Y', - '\u0178': 'Y', - '\u1EF6': 'Y', - '\u1EF4': 'Y', - '\u01B3': 'Y', - '\u024E': 'Y', - '\u1EFE': 'Y', - '\u24CF': 'Z', - '\uFF3A': 'Z', - '\u0179': 'Z', - '\u1E90': 'Z', - '\u017B': 'Z', - '\u017D': 'Z', - '\u1E92': 'Z', - '\u1E94': 'Z', - '\u01B5': 'Z', - '\u0224': 'Z', - '\u2C7F': 'Z', - '\u2C6B': 'Z', - '\uA762': 'Z', - '\u24D0': 'a', - '\uFF41': 'a', - '\u1E9A': 'a', - '\u00E0': 'a', - '\u00E1': 'a', - '\u00E2': 'a', - '\u1EA7': 'a', - '\u1EA5': 'a', - '\u1EAB': 'a', - '\u1EA9': 'a', - '\u00E3': 'a', - '\u0101': 'a', - '\u0103': 'a', - '\u1EB1': 'a', - '\u1EAF': 'a', - '\u1EB5': 'a', - '\u1EB3': 'a', - '\u0227': 'a', - '\u01E1': 'a', - '\u00E4': 'a', - '\u01DF': 'a', - '\u1EA3': 'a', - '\u00E5': 'a', - '\u01FB': 'a', - '\u01CE': 'a', - '\u0201': 'a', - '\u0203': 'a', - '\u1EA1': 'a', - '\u1EAD': 'a', - '\u1EB7': 'a', - '\u1E01': 'a', - '\u0105': 'a', - '\u2C65': 'a', - '\u0250': 'a', - '\uA733': 'aa', - '\u00E6': 'ae', - '\u01FD': 'ae', - '\u01E3': 'ae', - '\uA735': 'ao', - '\uA737': 'au', - '\uA739': 'av', - '\uA73B': 'av', - '\uA73D': 'ay', - '\u24D1': 'b', - '\uFF42': 'b', - '\u1E03': 'b', - '\u1E05': 'b', - '\u1E07': 'b', - '\u0180': 'b', - '\u0183': 'b', - '\u0253': 'b', - '\u24D2': 'c', - '\uFF43': 'c', - '\u0107': 'c', - '\u0109': 'c', - '\u010B': 'c', - '\u010D': 'c', - '\u00E7': 'c', - '\u1E09': 'c', - '\u0188': 'c', - '\u023C': 'c', - '\uA73F': 'c', - '\u2184': 'c', - '\u24D3': 'd', - '\uFF44': 'd', - '\u1E0B': 'd', - '\u010F': 'd', - '\u1E0D': 'd', - '\u1E11': 'd', - '\u1E13': 'd', - '\u1E0F': 'd', - '\u0111': 'd', - '\u018C': 'd', - '\u0256': 'd', - '\u0257': 'd', - '\uA77A': 'd', - '\u01F3': 'dz', - '\u01C6': 'dz', - '\u24D4': 'e', - '\uFF45': 'e', - '\u00E8': 'e', - '\u00E9': 'e', - '\u00EA': 'e', - '\u1EC1': 'e', - '\u1EBF': 'e', - '\u1EC5': 'e', - '\u1EC3': 'e', - '\u1EBD': 'e', - '\u0113': 'e', - '\u1E15': 'e', - '\u1E17': 'e', - '\u0115': 'e', - '\u0117': 'e', - '\u00EB': 'e', - '\u1EBB': 'e', - '\u011B': 'e', - '\u0205': 'e', - '\u0207': 'e', - '\u1EB9': 'e', - '\u1EC7': 'e', - '\u0229': 'e', - '\u1E1D': 'e', - '\u0119': 'e', - '\u1E19': 'e', - '\u1E1B': 'e', - '\u0247': 'e', - '\u025B': 'e', - '\u01DD': 'e', - '\u24D5': 'f', - '\uFF46': 'f', - '\u1E1F': 'f', - '\u0192': 'f', - '\uA77C': 'f', - '\u24D6': 'g', - '\uFF47': 'g', - '\u01F5': 'g', - '\u011D': 'g', - '\u1E21': 'g', - '\u011F': 'g', - '\u0121': 'g', - '\u01E7': 'g', - '\u0123': 'g', - '\u01E5': 'g', - '\u0260': 'g', - '\uA7A1': 'g', - '\u1D79': 'g', - '\uA77F': 'g', - '\u24D7': 'h', - '\uFF48': 'h', - '\u0125': 'h', - '\u1E23': 'h', - '\u1E27': 'h', - '\u021F': 'h', - '\u1E25': 'h', - '\u1E29': 'h', - '\u1E2B': 'h', - '\u1E96': 'h', - '\u0127': 'h', - '\u2C68': 'h', - '\u2C76': 'h', - '\u0265': 'h', - '\u0195': 'hv', - '\u24D8': 'i', - '\uFF49': 'i', - '\u00EC': 'i', - '\u00ED': 'i', - '\u00EE': 'i', - '\u0129': 'i', - '\u012B': 'i', - '\u012D': 'i', - '\u00EF': 'i', - '\u1E2F': 'i', - '\u1EC9': 'i', - '\u01D0': 'i', - '\u0209': 'i', - '\u020B': 'i', - '\u1ECB': 'i', - '\u012F': 'i', - '\u1E2D': 'i', - '\u0268': 'i', - '\u0131': 'i', - '\u24D9': 'j', - '\uFF4A': 'j', - '\u0135': 'j', - '\u01F0': 'j', - '\u0249': 'j', - '\u24DA': 'k', - '\uFF4B': 'k', - '\u1E31': 'k', - '\u01E9': 'k', - '\u1E33': 'k', - '\u0137': 'k', - '\u1E35': 'k', - '\u0199': 'k', - '\u2C6A': 'k', - '\uA741': 'k', - '\uA743': 'k', - '\uA745': 'k', - '\uA7A3': 'k', - '\u24DB': 'l', - '\uFF4C': 'l', - '\u0140': 'l', - '\u013A': 'l', - '\u013E': 'l', - '\u1E37': 'l', - '\u1E39': 'l', - '\u013C': 'l', - '\u1E3D': 'l', - '\u1E3B': 'l', - '\u017F': 'l', - '\u0142': 'l', - '\u019A': 'l', - '\u026B': 'l', - '\u2C61': 'l', - '\uA749': 'l', - '\uA781': 'l', - '\uA747': 'l', - '\u01C9': 'lj', - '\u24DC': 'm', - '\uFF4D': 'm', - '\u1E3F': 'm', - '\u1E41': 'm', - '\u1E43': 'm', - '\u0271': 'm', - '\u026F': 'm', - '\u24DD': 'n', - '\uFF4E': 'n', - '\u01F9': 'n', - '\u0144': 'n', - '\u00F1': 'n', - '\u1E45': 'n', - '\u0148': 'n', - '\u1E47': 'n', - '\u0146': 'n', - '\u1E4B': 'n', - '\u1E49': 'n', - '\u019E': 'n', - '\u0272': 'n', - '\u0149': 'n', - '\uA791': 'n', - '\uA7A5': 'n', - '\u01CC': 'nj', - '\u24DE': 'o', - '\uFF4F': 'o', - '\u00F2': 'o', - '\u00F3': 'o', - '\u00F4': 'o', - '\u1ED3': 'o', - '\u1ED1': 'o', - '\u1ED7': 'o', - '\u1ED5': 'o', - '\u00F5': 'o', - '\u1E4D': 'o', - '\u022D': 'o', - '\u1E4F': 'o', - '\u014D': 'o', - '\u1E51': 'o', - '\u1E53': 'o', - '\u014F': 'o', - '\u022F': 'o', - '\u0231': 'o', - '\u00F6': 'o', - '\u022B': 'o', - '\u1ECF': 'o', - '\u0151': 'o', - '\u01D2': 'o', - '\u020D': 'o', - '\u020F': 'o', - '\u01A1': 'o', - '\u1EDD': 'o', - '\u1EDB': 'o', - '\u1EE1': 'o', - '\u1EDF': 'o', - '\u1EE3': 'o', - '\u1ECD': 'o', - '\u1ED9': 'o', - '\u01EB': 'o', - '\u01ED': 'o', - '\u00F8': 'o', - '\u01FF': 'o', - '\u0254': 'o', - '\uA74B': 'o', - '\uA74D': 'o', - '\u0275': 'o', - '\u01A3': 'oi', - '\u0223': 'ou', - '\uA74F': 'oo', - '\u24DF': 'p', - '\uFF50': 'p', - '\u1E55': 'p', - '\u1E57': 'p', - '\u01A5': 'p', - '\u1D7D': 'p', - '\uA751': 'p', - '\uA753': 'p', - '\uA755': 'p', - '\u24E0': 'q', - '\uFF51': 'q', - '\u024B': 'q', - '\uA757': 'q', - '\uA759': 'q', - '\u24E1': 'r', - '\uFF52': 'r', - '\u0155': 'r', - '\u1E59': 'r', - '\u0159': 'r', - '\u0211': 'r', - '\u0213': 'r', - '\u1E5B': 'r', - '\u1E5D': 'r', - '\u0157': 'r', - '\u1E5F': 'r', - '\u024D': 'r', - '\u027D': 'r', - '\uA75B': 'r', - '\uA7A7': 'r', - '\uA783': 'r', - '\u24E2': 's', - '\uFF53': 's', - '\u00DF': 's', - '\u015B': 's', - '\u1E65': 's', - '\u015D': 's', - '\u1E61': 's', - '\u0161': 's', - '\u1E67': 's', - '\u1E63': 's', - '\u1E69': 's', - '\u0219': 's', - '\u015F': 's', - '\u023F': 's', - '\uA7A9': 's', - '\uA785': 's', - '\u1E9B': 's', - '\u24E3': 't', - '\uFF54': 't', - '\u1E6B': 't', - '\u1E97': 't', - '\u0165': 't', - '\u1E6D': 't', - '\u021B': 't', - '\u0163': 't', - '\u1E71': 't', - '\u1E6F': 't', - '\u0167': 't', - '\u01AD': 't', - '\u0288': 't', - '\u2C66': 't', - '\uA787': 't', - '\uA729': 'tz', - '\u24E4': 'u', - '\uFF55': 'u', - '\u00F9': 'u', - '\u00FA': 'u', - '\u00FB': 'u', - '\u0169': 'u', - '\u1E79': 'u', - '\u016B': 'u', - '\u1E7B': 'u', - '\u016D': 'u', - '\u00FC': 'u', - '\u01DC': 'u', - '\u01D8': 'u', - '\u01D6': 'u', - '\u01DA': 'u', - '\u1EE7': 'u', - '\u016F': 'u', - '\u0171': 'u', - '\u01D4': 'u', - '\u0215': 'u', - '\u0217': 'u', - '\u01B0': 'u', - '\u1EEB': 'u', - '\u1EE9': 'u', - '\u1EEF': 'u', - '\u1EED': 'u', - '\u1EF1': 'u', - '\u1EE5': 'u', - '\u1E73': 'u', - '\u0173': 'u', - '\u1E77': 'u', - '\u1E75': 'u', - '\u0289': 'u', - '\u24E5': 'v', - '\uFF56': 'v', - '\u1E7D': 'v', - '\u1E7F': 'v', - '\u028B': 'v', - '\uA75F': 'v', - '\u028C': 'v', - '\uA761': 'vy', - '\u24E6': 'w', - '\uFF57': 'w', - '\u1E81': 'w', - '\u1E83': 'w', - '\u0175': 'w', - '\u1E87': 'w', - '\u1E85': 'w', - '\u1E98': 'w', - '\u1E89': 'w', - '\u2C73': 'w', - '\u24E7': 'x', - '\uFF58': 'x', - '\u1E8B': 'x', - '\u1E8D': 'x', - '\u24E8': 'y', - '\uFF59': 'y', - '\u1EF3': 'y', - '\u00FD': 'y', - '\u0177': 'y', - '\u1EF9': 'y', - '\u0233': 'y', - '\u1E8F': 'y', - '\u00FF': 'y', - '\u1EF7': 'y', - '\u1E99': 'y', - '\u1EF5': 'y', - '\u01B4': 'y', - '\u024F': 'y', - '\u1EFF': 'y', - '\u24E9': 'z', - '\uFF5A': 'z', - '\u017A': 'z', - '\u1E91': 'z', - '\u017C': 'z', - '\u017E': 'z', - '\u1E93': 'z', - '\u1E95': 'z', - '\u01B6': 'z', - '\u0225': 'z', - '\u0240': 'z', - '\u2C6C': 'z', - '\uA763': 'z', - '\u0386': '\u0391', - '\u0388': '\u0395', - '\u0389': '\u0397', - '\u038A': '\u0399', - '\u03AA': '\u0399', - '\u038C': '\u039F', - '\u038E': '\u03A5', - '\u03AB': '\u03A5', - '\u038F': '\u03A9', - '\u03AC': '\u03B1', - '\u03AD': '\u03B5', - '\u03AE': '\u03B7', - '\u03AF': '\u03B9', - '\u03CA': '\u03B9', - '\u0390': '\u03B9', - '\u03CC': '\u03BF', - '\u03CD': '\u03C5', - '\u03CB': '\u03C5', - '\u03B0': '\u03C5', - '\u03C9': '\u03C9', - '\u03C2': '\u03C3' - }; - - return diacritics; -}); - -S2.define('select2/data/base',[ - '../utils' -], function (Utils) { - function BaseAdapter ($element, options) { - BaseAdapter.__super__.constructor.call(this); - } - - Utils.Extend(BaseAdapter, Utils.Observable); - - BaseAdapter.prototype.current = function (callback) { - throw new Error('The `current` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.query = function (params, callback) { - throw new Error('The `query` method must be defined in child classes.'); - }; - - BaseAdapter.prototype.bind = function (container, $container) { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.destroy = function () { - // Can be implemented in subclasses - }; - - BaseAdapter.prototype.generateResultId = function (container, data) { - var id = container.id + '-result-'; - - id += Utils.generateChars(4); - - if (data.id != null) { - id += '-' + data.id.toString(); - } else { - id += '-' + Utils.generateChars(4); - } - return id; - }; - - return BaseAdapter; -}); - -S2.define('select2/data/select',[ - './base', - '../utils', - 'jquery' -], function (BaseAdapter, Utils, $) { - function SelectAdapter ($element, options) { - this.$element = $element; - this.options = options; - - SelectAdapter.__super__.constructor.call(this); - } - - Utils.Extend(SelectAdapter, BaseAdapter); - - SelectAdapter.prototype.current = function (callback) { - var data = []; - var self = this; - - this.$element.find(':selected').each(function () { - var $option = $(this); - - var option = self.item($option); - - data.push(option); - }); - - callback(data); - }; - - SelectAdapter.prototype.select = function (data) { - var self = this; - - data.selected = true; - - // If data.element is a DOM node, use it instead - if ($(data.element).is('option')) { - data.element.selected = true; - - this.$element.trigger('change'); - - return; - } - - if (this.$element.prop('multiple')) { - this.current(function (currentData) { - var val = []; - - data = [data]; - data.push.apply(data, currentData); - - for (var d = 0; d < data.length; d++) { - var id = data[d].id; - - if ($.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - self.$element.trigger('change'); - }); - } else { - var val = data.id; - - this.$element.val(val); - this.$element.trigger('change'); - } - }; - - SelectAdapter.prototype.unselect = function (data) { - var self = this; - - if (!this.$element.prop('multiple')) { - return; - } - - data.selected = false; - - if ($(data.element).is('option')) { - data.element.selected = false; - - this.$element.trigger('change'); - - return; - } - - this.current(function (currentData) { - var val = []; - - for (var d = 0; d < currentData.length; d++) { - var id = currentData[d].id; - - if (id !== data.id && $.inArray(id, val) === -1) { - val.push(id); - } - } - - self.$element.val(val); - - self.$element.trigger('change'); - }); - }; - - SelectAdapter.prototype.bind = function (container, $container) { - var self = this; - - this.container = container; - - container.on('select', function (params) { - self.select(params.data); - }); - - container.on('unselect', function (params) { - self.unselect(params.data); - }); - }; - - SelectAdapter.prototype.destroy = function () { - // Remove anything added to child elements - this.$element.find('*').each(function () { - // Remove any custom data set by Select2 - Utils.RemoveData(this); - }); - }; - - SelectAdapter.prototype.query = function (params, callback) { - var data = []; - var self = this; - - var $options = this.$element.children(); - - $options.each(function () { - var $option = $(this); - - if (!$option.is('option') && !$option.is('optgroup')) { - return; - } - - var option = self.item($option); - - var matches = self.matches(params, option); - - if (matches !== null) { - data.push(matches); - } - }); - - callback({ - results: data - }); - }; - - SelectAdapter.prototype.addOptions = function ($options) { - Utils.appendMany(this.$element, $options); - }; - - SelectAdapter.prototype.option = function (data) { - var option; - - if (data.children) { - option = document.createElement('optgroup'); - option.label = data.text; - } else { - option = document.createElement('option'); - - if (option.textContent !== undefined) { - option.textContent = data.text; - } else { - option.innerText = data.text; - } - } - - if (data.id !== undefined) { - option.value = data.id; - } - - if (data.disabled) { - option.disabled = true; - } - - if (data.selected) { - option.selected = true; - } - - if (data.title) { - option.title = data.title; - } - - var $option = $(option); - - var normalizedData = this._normalizeItem(data); - normalizedData.element = option; - - // Override the option's data with the combined data - Utils.StoreData(option, 'data', normalizedData); - - return $option; - }; - - SelectAdapter.prototype.item = function ($option) { - var data = {}; - - data = Utils.GetData($option[0], 'data'); - - if (data != null) { - return data; - } - - if ($option.is('option')) { - data = { - id: $option.val(), - text: $option.text(), - disabled: $option.prop('disabled'), - selected: $option.prop('selected'), - title: $option.prop('title') - }; - } else if ($option.is('optgroup')) { - data = { - text: $option.prop('label'), - children: [], - title: $option.prop('title') - }; - - var $children = $option.children('option'); - var children = []; - - for (var c = 0; c < $children.length; c++) { - var $child = $($children[c]); - - var child = this.item($child); - - children.push(child); - } - - data.children = children; - } - - data = this._normalizeItem(data); - data.element = $option[0]; - - Utils.StoreData($option[0], 'data', data); - - return data; - }; - - SelectAdapter.prototype._normalizeItem = function (item) { - if (item !== Object(item)) { - item = { - id: item, - text: item - }; - } - - item = $.extend({}, { - text: '' - }, item); - - var defaults = { - selected: false, - disabled: false - }; - - if (item.id != null) { - item.id = item.id.toString(); - } - - if (item.text != null) { - item.text = item.text.toString(); - } - - if (item._resultId == null && item.id && this.container != null) { - item._resultId = this.generateResultId(this.container, item); - } - - return $.extend({}, defaults, item); - }; - - SelectAdapter.prototype.matches = function (params, data) { - var matcher = this.options.get('matcher'); - - return matcher(params, data); - }; - - return SelectAdapter; -}); - -S2.define('select2/data/array',[ - './select', - '../utils', - 'jquery' -], function (SelectAdapter, Utils, $) { - function ArrayAdapter ($element, options) { - var data = options.get('data') || []; - - ArrayAdapter.__super__.constructor.call(this, $element, options); - - this.addOptions(this.convertToOptions(data)); - } - - Utils.Extend(ArrayAdapter, SelectAdapter); - - ArrayAdapter.prototype.select = function (data) { - var $option = this.$element.find('option').filter(function (i, elm) { - return elm.value == data.id.toString(); - }); - - if ($option.length === 0) { - $option = this.option(data); - - this.addOptions($option); - } - - ArrayAdapter.__super__.select.call(this, data); - }; - - ArrayAdapter.prototype.convertToOptions = function (data) { - var self = this; - - var $existing = this.$element.find('option'); - var existingIds = $existing.map(function () { - return self.item($(this)).id; - }).get(); - - var $options = []; - - // Filter out all items except for the one passed in the argument - function onlyItem (item) { - return function () { - return $(this).val() == item.id; - }; - } - - for (var d = 0; d < data.length; d++) { - var item = this._normalizeItem(data[d]); - - // Skip items which were pre-loaded, only merge the data - if ($.inArray(item.id, existingIds) >= 0) { - var $existingOption = $existing.filter(onlyItem(item)); - - var existingData = this.item($existingOption); - var newData = $.extend(true, {}, item, existingData); - - var $newOption = this.option(newData); - - $existingOption.replaceWith($newOption); - - continue; - } - - var $option = this.option(item); - - if (item.children) { - var $children = this.convertToOptions(item.children); - - Utils.appendMany($option, $children); - } - - $options.push($option); - } - - return $options; - }; - - return ArrayAdapter; -}); - -S2.define('select2/data/ajax',[ - './array', - '../utils', - 'jquery' -], function (ArrayAdapter, Utils, $) { - function AjaxAdapter ($element, options) { - this.ajaxOptions = this._applyDefaults(options.get('ajax')); - - if (this.ajaxOptions.processResults != null) { - this.processResults = this.ajaxOptions.processResults; - } - - AjaxAdapter.__super__.constructor.call(this, $element, options); - } - - Utils.Extend(AjaxAdapter, ArrayAdapter); - - AjaxAdapter.prototype._applyDefaults = function (options) { - var defaults = { - data: function (params) { - return $.extend({}, params, { - q: params.term - }); - }, - transport: function (params, success, failure) { - var $request = $.ajax(params); - - $request.then(success); - $request.fail(failure); - - return $request; - } - }; - - return $.extend({}, defaults, options, true); - }; - - AjaxAdapter.prototype.processResults = function (results) { - return results; - }; - - AjaxAdapter.prototype.query = function (params, callback) { - var matches = []; - var self = this; - - if (this._request != null) { - // JSONP requests cannot always be aborted - if ($.isFunction(this._request.abort)) { - this._request.abort(); - } - - this._request = null; - } - - var options = $.extend({ - type: 'GET' - }, this.ajaxOptions); - - if (typeof options.url === 'function') { - options.url = options.url.call(this.$element, params); - } - - if (typeof options.data === 'function') { - options.data = options.data.call(this.$element, params); - } - - function request () { - var $request = options.transport(options, function (data) { - var results = self.processResults(data, params); - - if (self.options.get('debug') && window.console && console.error) { - // Check to make sure that the response included a `results` key. - if (!results || !results.results || !$.isArray(results.results)) { - console.error( - 'Select2: The AJAX results did not return an array in the ' + - '`results` key of the response.' - ); - } - } - - callback(results); - }, function () { - // Attempt to detect if a request was aborted - // Only works if the transport exposes a status property - if ('status' in $request && - ($request.status === 0 || $request.status === '0')) { - return; - } - - self.trigger('results:message', { - message: 'errorLoading' - }); - }); - - self._request = $request; - } - - if (this.ajaxOptions.delay && params.term != null) { - if (this._queryTimeout) { - window.clearTimeout(this._queryTimeout); - } - - this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); - } else { - request(); - } - }; - - return AjaxAdapter; -}); - -S2.define('select2/data/tags',[ - 'jquery' -], function ($) { - function Tags (decorated, $element, options) { - var tags = options.get('tags'); - - var createTag = options.get('createTag'); - - if (createTag !== undefined) { - this.createTag = createTag; - } - - var insertTag = options.get('insertTag'); - - if (insertTag !== undefined) { - this.insertTag = insertTag; - } - - decorated.call(this, $element, options); - - if ($.isArray(tags)) { - for (var t = 0; t < tags.length; t++) { - var tag = tags[t]; - var item = this._normalizeItem(tag); - - var $option = this.option(item); - - this.$element.append($option); - } - } - } - - Tags.prototype.query = function (decorated, params, callback) { - var self = this; - - this._removeOldTags(); - - if (params.term == null || params.page != null) { - decorated.call(this, params, callback); - return; - } - - function wrapper (obj, child) { - var data = obj.results; - - for (var i = 0; i < data.length; i++) { - var option = data[i]; - - var checkChildren = ( - option.children != null && - !wrapper({ - results: option.children - }, true) - ); - - var optionText = (option.text || '').toUpperCase(); - var paramsTerm = (params.term || '').toUpperCase(); - - var checkText = optionText === paramsTerm; - - if (checkText || checkChildren) { - if (child) { - return false; - } - - obj.data = data; - callback(obj); - - return; - } - } - - if (child) { - return true; - } - - var tag = self.createTag(params); - - if (tag != null) { - var $option = self.option(tag); - $option.attr('data-select2-tag', true); - - self.addOptions([$option]); - - self.insertTag(data, tag); - } - - obj.results = data; - - callback(obj); - } - - decorated.call(this, params, wrapper); - }; - - Tags.prototype.createTag = function (decorated, params) { - var term = $.trim(params.term); - - if (term === '') { - return null; - } - - return { - id: term, - text: term - }; - }; - - Tags.prototype.insertTag = function (_, data, tag) { - data.unshift(tag); - }; - - Tags.prototype._removeOldTags = function (_) { - var tag = this._lastTag; - - var $options = this.$element.find('option[data-select2-tag]'); - - $options.each(function () { - if (this.selected) { - return; - } - - $(this).remove(); - }); - }; - - return Tags; -}); - -S2.define('select2/data/tokenizer',[ - 'jquery' -], function ($) { - function Tokenizer (decorated, $element, options) { - var tokenizer = options.get('tokenizer'); - - if (tokenizer !== undefined) { - this.tokenizer = tokenizer; - } - - decorated.call(this, $element, options); - } - - Tokenizer.prototype.bind = function (decorated, container, $container) { - decorated.call(this, container, $container); - - this.$search = container.dropdown.$search || container.selection.$search || - $container.find('.select2-search__field'); - }; - - Tokenizer.prototype.query = function (decorated, params, callback) { - var self = this; - - function createAndSelect (data) { - // Normalize the data object so we can use it for checks - var item = self._normalizeItem(data); - - // Check if the data object already exists as a tag - // Select it if it doesn't - var $existingOptions = self.$element.find('option').filter(function () { - return $(this).val() === item.id; - }); - - // If an existing option wasn't found for it, create the option - if (!$existingOptions.length) { - var $option = self.option(item); - $option.attr('data-select2-tag', true); - - self._removeOldTags(); - self.addOptions([$option]); - } - - // Select the item, now that we know there is an option for it - select(item); - } - - function select (data) { - self.trigger('select', { - data: data - }); - } - - params.term = params.term || ''; - - var tokenData = this.tokenizer(params, this.options, createAndSelect); - - if (tokenData.term !== params.term) { - // Replace the search term if we have the search box - if (this.$search.length) { - this.$search.val(tokenData.term); - this.$search.focus(); - } - - params.term = tokenData.term; - } - - decorated.call(this, params, callback); - }; - - Tokenizer.prototype.tokenizer = function (_, params, options, callback) { - var separators = options.get('tokenSeparators') || []; - var term = params.term; - var i = 0; - - var createTag = this.createTag || function (params) { - return { - id: params.term, - text: params.term - }; - }; - - while (i < term.length) { - var termChar = term[i]; - - if ($.inArray(termChar, separators) === -1) { - i++; - - continue; - } - - var part = term.substr(0, i); - var partParams = $.extend({}, params, { - term: part - }); - - var data = createTag(partParams); - - if (data == null) { - i++; - continue; - } - - callback(data); - - // Reset the term to not include the tokenized portion - term = term.substr(i + 1) || ''; - i = 0; - } - - return { - term: term - }; - }; - - return Tokenizer; -}); - -S2.define('select2/data/minimumInputLength',[ - -], function () { - function MinimumInputLength (decorated, $e, options) { - this.minimumInputLength = options.get('minimumInputLength'); - - decorated.call(this, $e, options); - } - - MinimumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (params.term.length < this.minimumInputLength) { - this.trigger('results:message', { - message: 'inputTooShort', - args: { - minimum: this.minimumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MinimumInputLength; -}); - -S2.define('select2/data/maximumInputLength',[ - -], function () { - function MaximumInputLength (decorated, $e, options) { - this.maximumInputLength = options.get('maximumInputLength'); - - decorated.call(this, $e, options); - } - - MaximumInputLength.prototype.query = function (decorated, params, callback) { - params.term = params.term || ''; - - if (this.maximumInputLength > 0 && - params.term.length > this.maximumInputLength) { - this.trigger('results:message', { - message: 'inputTooLong', - args: { - maximum: this.maximumInputLength, - input: params.term, - params: params - } - }); - - return; - } - - decorated.call(this, params, callback); - }; - - return MaximumInputLength; -}); - -S2.define('select2/data/maximumSelectionLength',[ - -], function (){ - function MaximumSelectionLength (decorated, $e, options) { - this.maximumSelectionLength = options.get('maximumSelectionLength'); - - decorated.call(this, $e, options); - } - - MaximumSelectionLength.prototype.query = - function (decorated, params, callback) { - var self = this; - - this.current(function (currentData) { - var count = currentData != null ? currentData.length : 0; - if (self.maximumSelectionLength > 0 && - count >= self.maximumSelectionLength) { - self.trigger('results:message', { - message: 'maximumSelected', - args: { - maximum: self.maximumSelectionLength - } - }); - return; - } - decorated.call(self, params, callback); - }); - }; - - return MaximumSelectionLength; -}); - -S2.define('select2/dropdown',[ - 'jquery', - './utils' -], function ($, Utils) { - function Dropdown ($element, options) { - this.$element = $element; - this.options = options; - - Dropdown.__super__.constructor.call(this); - } - - Utils.Extend(Dropdown, Utils.Observable); - - Dropdown.prototype.render = function () { - var $dropdown = $( - '' + - '' + - '' - ); - - $dropdown.attr('dir', this.options.get('dir')); - - this.$dropdown = $dropdown; - - return $dropdown; - }; - - Dropdown.prototype.bind = function () { - // Should be implemented in subclasses - }; - - Dropdown.prototype.position = function ($dropdown, $container) { - // Should be implmented in subclasses - }; - - Dropdown.prototype.destroy = function () { - // Remove the dropdown from the DOM - this.$dropdown.remove(); - }; - - return Dropdown; -}); - -S2.define('select2/dropdown/search',[ - 'jquery', - '../utils' -], function ($, Utils) { - function Search () { } - - Search.prototype.render = function (decorated) { - var $rendered = decorated.call(this); - - var $search = $( - '' + - '' + - '' - ); - - this.$searchContainer = $search; - this.$search = $search.find('input'); - - $rendered.prepend($search); - - return $rendered; - }; - - Search.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - this.$search.on('keydown', function (evt) { - self.trigger('keypress', evt); - - self._keyUpPrevented = evt.isDefaultPrevented(); - }); - - // Workaround for browsers which do not support the `input` event - // This will prevent double-triggering of events for browsers which support - // both the `keyup` and `input` events. - this.$search.on('input', function (evt) { - // Unbind the duplicated `keyup` event - $(this).off('keyup'); - }); - - this.$search.on('keyup input', function (evt) { - self.handleSearch(evt); - }); - - container.on('open', function () { - self.$search.attr('tabindex', 0); - - self.$search.focus(); - - window.setTimeout(function () { - self.$search.focus(); - }, 0); - }); - - container.on('close', function () { - self.$search.attr('tabindex', -1); - - self.$search.val(''); - self.$search.blur(); - }); - - container.on('focus', function () { - if (!container.isOpen()) { - self.$search.focus(); - } - }); - - container.on('results:all', function (params) { - if (params.query.term == null || params.query.term === '') { - var showSearch = self.showSearch(params); - - if (showSearch) { - self.$searchContainer.removeClass('select2-search--hide'); - } else { - self.$searchContainer.addClass('select2-search--hide'); - } - } - }); - }; - - Search.prototype.handleSearch = function (evt) { - if (!this._keyUpPrevented) { - var input = this.$search.val(); - - this.trigger('query', { - term: input - }); - } - - this._keyUpPrevented = false; - }; - - Search.prototype.showSearch = function (_, params) { - return true; - }; - - return Search; -}); - -S2.define('select2/dropdown/hidePlaceholder',[ - -], function () { - function HidePlaceholder (decorated, $element, options, dataAdapter) { - this.placeholder = this.normalizePlaceholder(options.get('placeholder')); - - decorated.call(this, $element, options, dataAdapter); - } - - HidePlaceholder.prototype.append = function (decorated, data) { - data.results = this.removePlaceholder(data.results); - - decorated.call(this, data); - }; - - HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { - if (typeof placeholder === 'string') { - placeholder = { - id: '', - text: placeholder - }; - } - - return placeholder; - }; - - HidePlaceholder.prototype.removePlaceholder = function (_, data) { - var modifiedData = data.slice(0); - - for (var d = data.length - 1; d >= 0; d--) { - var item = data[d]; - - if (this.placeholder.id === item.id) { - modifiedData.splice(d, 1); - } - } - - return modifiedData; - }; - - return HidePlaceholder; -}); - -S2.define('select2/dropdown/infiniteScroll',[ - 'jquery' -], function ($) { - function InfiniteScroll (decorated, $element, options, dataAdapter) { - this.lastParams = {}; - - decorated.call(this, $element, options, dataAdapter); - - this.$loadingMore = this.createLoadingMore(); - this.loading = false; - } - - InfiniteScroll.prototype.append = function (decorated, data) { - this.$loadingMore.remove(); - this.loading = false; - - decorated.call(this, data); - - if (this.showLoadingMore(data)) { - this.$results.append(this.$loadingMore); - } - }; - - InfiniteScroll.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('query', function (params) { - self.lastParams = params; - self.loading = true; - }); - - container.on('query:append', function (params) { - self.lastParams = params; - self.loading = true; - }); - - this.$results.on('scroll', function () { - var isLoadMoreVisible = $.contains( - document.documentElement, - self.$loadingMore[0] - ); - - if (self.loading || !isLoadMoreVisible) { - return; - } - - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var loadingMoreOffset = self.$loadingMore.offset().top + - self.$loadingMore.outerHeight(false); - - if (currentOffset + 50 >= loadingMoreOffset) { - self.loadMore(); - } - }); - }; - - InfiniteScroll.prototype.loadMore = function () { - this.loading = true; - - var params = $.extend({}, {page: 1}, this.lastParams); - - params.page++; - - this.trigger('query:append', params); - }; - - InfiniteScroll.prototype.showLoadingMore = function (_, data) { - return data.pagination && data.pagination.more; - }; - - InfiniteScroll.prototype.createLoadingMore = function () { - var $option = $( - '
        • ' - ); - - var message = this.options.get('translations').get('loadingMore'); - - $option.html(message(this.lastParams)); - - return $option; - }; - - return InfiniteScroll; -}); - -S2.define('select2/dropdown/attachBody',[ - 'jquery', - '../utils' -], function ($, Utils) { - function AttachBody (decorated, $element, options) { - this.$dropdownParent = options.get('dropdownParent') || $(document.body); - - decorated.call(this, $element, options); - } - - AttachBody.prototype.bind = function (decorated, container, $container) { - var self = this; - - var setupResultsEvents = false; - - decorated.call(this, container, $container); - - container.on('open', function () { - self._showDropdown(); - self._attachPositioningHandler(container); - - if (!setupResultsEvents) { - setupResultsEvents = true; - - container.on('results:all', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - - container.on('results:append', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - } - }); - - container.on('close', function () { - self._hideDropdown(); - self._detachPositioningHandler(container); - }); - - this.$dropdownContainer.on('mousedown', function (evt) { - evt.stopPropagation(); - }); - }; - - AttachBody.prototype.destroy = function (decorated) { - decorated.call(this); - - this.$dropdownContainer.remove(); - }; - - AttachBody.prototype.position = function (decorated, $dropdown, $container) { - // Clone all of the container classes - $dropdown.attr('class', $container.attr('class')); - - $dropdown.removeClass('select2'); - $dropdown.addClass('select2-container--open'); - - $dropdown.css({ - position: 'absolute', - top: -999999 - }); - - this.$container = $container; - }; - - AttachBody.prototype.render = function (decorated) { - var $container = $(''); - - var $dropdown = decorated.call(this); - $container.append($dropdown); - - this.$dropdownContainer = $container; - - return $container; - }; - - AttachBody.prototype._hideDropdown = function (decorated) { - this.$dropdownContainer.detach(); - }; - - AttachBody.prototype._attachPositioningHandler = - function (decorated, container) { - var self = this; - - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.each(function () { - Utils.StoreData(this, 'select2-scroll-position', { - x: $(this).scrollLeft(), - y: $(this).scrollTop() - }); - }); - - $watchers.on(scrollEvent, function (ev) { - var position = Utils.GetData(this, 'select2-scroll-position'); - $(this).scrollTop(position.y); - }); - - $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, - function (e) { - self._positionDropdown(); - self._resizeDropdown(); - }); - }; - - AttachBody.prototype._detachPositioningHandler = - function (decorated, container) { - var scrollEvent = 'scroll.select2.' + container.id; - var resizeEvent = 'resize.select2.' + container.id; - var orientationEvent = 'orientationchange.select2.' + container.id; - - var $watchers = this.$container.parents().filter(Utils.hasScroll); - $watchers.off(scrollEvent); - - $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); - }; - - AttachBody.prototype._positionDropdown = function () { - var $window = $(window); - - var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); - var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); - - var newDirection = null; - - var offset = this.$container.offset(); - - offset.bottom = offset.top + this.$container.outerHeight(false); - - var container = { - height: this.$container.outerHeight(false) - }; - - container.top = offset.top; - container.bottom = offset.top + container.height; - - var dropdown = { - height: this.$dropdown.outerHeight(false) - }; - - var viewport = { - top: $window.scrollTop(), - bottom: $window.scrollTop() + $window.height() - }; - - var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); - var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); - - var css = { - left: offset.left, - top: container.bottom - }; - - // Determine what the parent element is to use for calciulating the offset - var $offsetParent = this.$dropdownParent; - - // For statically positoned elements, we need to get the element - // that is determining the offset - if ($offsetParent.css('position') === 'static') { - $offsetParent = $offsetParent.offsetParent(); - } - - var parentOffset = $offsetParent.offset(); - - css.top -= parentOffset.top; - css.left -= parentOffset.left; - - if (!isCurrentlyAbove && !isCurrentlyBelow) { - newDirection = 'below'; - } - - if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { - newDirection = 'above'; - } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { - newDirection = 'below'; - } - - if (newDirection == 'above' || - (isCurrentlyAbove && newDirection !== 'below')) { - css.top = container.top - parentOffset.top - dropdown.height; - } - - if (newDirection != null) { - this.$dropdown - .removeClass('select2-dropdown--below select2-dropdown--above') - .addClass('select2-dropdown--' + newDirection); - this.$container - .removeClass('select2-container--below select2-container--above') - .addClass('select2-container--' + newDirection); - } - - this.$dropdownContainer.css(css); - }; - - AttachBody.prototype._resizeDropdown = function () { - var css = { - width: this.$container.outerWidth(false) + 'px' - }; - - if (this.options.get('dropdownAutoWidth')) { - css.minWidth = css.width; - css.position = 'relative'; - css.width = 'auto'; - } - - this.$dropdown.css(css); - }; - - AttachBody.prototype._showDropdown = function (decorated) { - this.$dropdownContainer.appendTo(this.$dropdownParent); - - this._positionDropdown(); - this._resizeDropdown(); - }; - - return AttachBody; -}); - -S2.define('select2/dropdown/minimumResultsForSearch',[ - -], function () { - function countResults (data) { - var count = 0; - - for (var d = 0; d < data.length; d++) { - var item = data[d]; - - if (item.children) { - count += countResults(item.children); - } else { - count++; - } - } - - return count; - } - - function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { - this.minimumResultsForSearch = options.get('minimumResultsForSearch'); - - if (this.minimumResultsForSearch < 0) { - this.minimumResultsForSearch = Infinity; - } - - decorated.call(this, $element, options, dataAdapter); - } - - MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { - if (countResults(params.data.results) < this.minimumResultsForSearch) { - return false; - } - - return decorated.call(this, params); - }; - - return MinimumResultsForSearch; -}); - -S2.define('select2/dropdown/selectOnClose',[ - '../utils' -], function (Utils) { - function SelectOnClose () { } - - SelectOnClose.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('close', function (params) { - self._handleSelectOnClose(params); - }); - }; - - SelectOnClose.prototype._handleSelectOnClose = function (_, params) { - if (params && params.originalSelect2Event != null) { - var event = params.originalSelect2Event; - - // Don't select an item if the close event was triggered from a select or - // unselect event - if (event._type === 'select' || event._type === 'unselect') { - return; - } - } - - var $highlightedResults = this.getHighlightedResults(); - - // Only select highlighted results - if ($highlightedResults.length < 1) { - return; - } - - var data = Utils.GetData($highlightedResults[0], 'data'); - - // Don't re-select already selected resulte - if ( - (data.element != null && data.element.selected) || - (data.element == null && data.selected) - ) { - return; - } - - this.trigger('select', { - data: data - }); - }; - - return SelectOnClose; -}); - -S2.define('select2/dropdown/closeOnSelect',[ - -], function () { - function CloseOnSelect () { } - - CloseOnSelect.prototype.bind = function (decorated, container, $container) { - var self = this; - - decorated.call(this, container, $container); - - container.on('select', function (evt) { - self._selectTriggered(evt); - }); - - container.on('unselect', function (evt) { - self._selectTriggered(evt); - }); - }; - - CloseOnSelect.prototype._selectTriggered = function (_, evt) { - var originalEvent = evt.originalEvent; - - // Don't close if the control key is being held - if (originalEvent && originalEvent.ctrlKey) { - return; - } - - this.trigger('close', { - originalEvent: originalEvent, - originalSelect2Event: evt - }); - }; - - return CloseOnSelect; -}); - -S2.define('select2/i18n/en',[],function () { - // English - return { - errorLoading: function () { - return 'The results could not be loaded.'; - }, - inputTooLong: function (args) { - var overChars = args.input.length - args.maximum; - - var message = 'Please delete ' + overChars + ' character'; - - if (overChars != 1) { - message += 's'; - } - - return message; - }, - inputTooShort: function (args) { - var remainingChars = args.minimum - args.input.length; - - var message = 'Please enter ' + remainingChars + ' or more characters'; - - return message; - }, - loadingMore: function () { - return 'Loading more results…'; - }, - maximumSelected: function (args) { - var message = 'You can only select ' + args.maximum + ' item'; - - if (args.maximum != 1) { - message += 's'; - } - - return message; - }, - noResults: function () { - return 'No results found'; - }, - searching: function () { - return 'Searching…'; - } - }; -}); - -S2.define('select2/defaults',[ - 'jquery', - 'require', - - './results', - - './selection/single', - './selection/multiple', - './selection/placeholder', - './selection/allowClear', - './selection/search', - './selection/eventRelay', - - './utils', - './translation', - './diacritics', - - './data/select', - './data/array', - './data/ajax', - './data/tags', - './data/tokenizer', - './data/minimumInputLength', - './data/maximumInputLength', - './data/maximumSelectionLength', - - './dropdown', - './dropdown/search', - './dropdown/hidePlaceholder', - './dropdown/infiniteScroll', - './dropdown/attachBody', - './dropdown/minimumResultsForSearch', - './dropdown/selectOnClose', - './dropdown/closeOnSelect', - - './i18n/en' -], function ($, require, - - ResultsList, - - SingleSelection, MultipleSelection, Placeholder, AllowClear, - SelectionSearch, EventRelay, - - Utils, Translation, DIACRITICS, - - SelectData, ArrayData, AjaxData, Tags, Tokenizer, - MinimumInputLength, MaximumInputLength, MaximumSelectionLength, - - Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, - AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, - - EnglishTranslation) { - function Defaults () { - this.reset(); - } - - Defaults.prototype.apply = function (options) { - options = $.extend(true, {}, this.defaults, options); - - if (options.dataAdapter == null) { - if (options.ajax != null) { - options.dataAdapter = AjaxData; - } else if (options.data != null) { - options.dataAdapter = ArrayData; - } else { - options.dataAdapter = SelectData; - } - - if (options.minimumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MinimumInputLength - ); - } - - if (options.maximumInputLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumInputLength - ); - } - - if (options.maximumSelectionLength > 0) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - MaximumSelectionLength - ); - } - - if (options.tags) { - options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); - } - - if (options.tokenSeparators != null || options.tokenizer != null) { - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Tokenizer - ); - } - - if (options.query != null) { - var Query = require(options.amdBase + 'compat/query'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - Query - ); - } - - if (options.initSelection != null) { - var InitSelection = require(options.amdBase + 'compat/initSelection'); - - options.dataAdapter = Utils.Decorate( - options.dataAdapter, - InitSelection - ); - } - } - - if (options.resultsAdapter == null) { - options.resultsAdapter = ResultsList; - - if (options.ajax != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - InfiniteScroll - ); - } - - if (options.placeholder != null) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - HidePlaceholder - ); - } - - if (options.selectOnClose) { - options.resultsAdapter = Utils.Decorate( - options.resultsAdapter, - SelectOnClose - ); - } - } - - if (options.dropdownAdapter == null) { - if (options.multiple) { - options.dropdownAdapter = Dropdown; - } else { - var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); - - options.dropdownAdapter = SearchableDropdown; - } - - if (options.minimumResultsForSearch !== 0) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - MinimumResultsForSearch - ); - } - - if (options.closeOnSelect) { - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - CloseOnSelect - ); - } - - if ( - options.dropdownCssClass != null || - options.dropdownCss != null || - options.adaptDropdownCssClass != null - ) { - var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); - - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - DropdownCSS - ); - } - - options.dropdownAdapter = Utils.Decorate( - options.dropdownAdapter, - AttachBody - ); - } - - if (options.selectionAdapter == null) { - if (options.multiple) { - options.selectionAdapter = MultipleSelection; - } else { - options.selectionAdapter = SingleSelection; - } - - // Add the placeholder mixin if a placeholder was specified - if (options.placeholder != null) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - Placeholder - ); - } - - if (options.allowClear) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - AllowClear - ); - } - - if (options.multiple) { - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - SelectionSearch - ); - } - - if ( - options.containerCssClass != null || - options.containerCss != null || - options.adaptContainerCssClass != null - ) { - var ContainerCSS = require(options.amdBase + 'compat/containerCss'); - - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - ContainerCSS - ); - } - - options.selectionAdapter = Utils.Decorate( - options.selectionAdapter, - EventRelay - ); - } - - if (typeof options.language === 'string') { - // Check if the language is specified with a region - if (options.language.indexOf('-') > 0) { - // Extract the region information if it is included - var languageParts = options.language.split('-'); - var baseLanguage = languageParts[0]; - - options.language = [options.language, baseLanguage]; - } else { - options.language = [options.language]; - } - } - - if ($.isArray(options.language)) { - var languages = new Translation(); - options.language.push('en'); - - var languageNames = options.language; - - for (var l = 0; l < languageNames.length; l++) { - var name = languageNames[l]; - var language = {}; - - try { - // Try to load it with the original name - language = Translation.loadPath(name); - } catch (e) { - try { - // If we couldn't load it, check if it wasn't the full path - name = this.defaults.amdLanguageBase + name; - language = Translation.loadPath(name); - } catch (ex) { - // The translation could not be loaded at all. Sometimes this is - // because of a configuration problem, other times this can be - // because of how Select2 helps load all possible translation files. - if (options.debug && window.console && console.warn) { - console.warn( - 'Select2: The language file for "' + name + '" could not be ' + - 'automatically loaded. A fallback will be used instead.' - ); - } - - continue; - } - } - - languages.extend(language); - } - - options.translations = languages; - } else { - var baseTranslation = Translation.loadPath( - this.defaults.amdLanguageBase + 'en' - ); - var customTranslation = new Translation(options.language); - - customTranslation.extend(baseTranslation); - - options.translations = customTranslation; - } - - return options; - }; - - Defaults.prototype.reset = function () { - function stripDiacritics (text) { - // Used 'uni range + named function' from http://jsperf.com/diacritics/18 - function match(a) { - return DIACRITICS[a] || a; - } - - return text.replace(/[^\u0000-\u007E]/g, match); - } - - function matcher (params, data) { - // Always return the object if there is nothing to compare - if ($.trim(params.term) === '') { - return data; - } - - // Do a recursive check for options with children - if (data.children && data.children.length > 0) { - // Clone the data object if there are children - // This is required as we modify the object to remove any non-matches - var match = $.extend(true, {}, data); - - // Check each child of the option - for (var c = data.children.length - 1; c >= 0; c--) { - var child = data.children[c]; - - var matches = matcher(params, child); - - // If there wasn't a match, remove the object in the array - if (matches == null) { - match.children.splice(c, 1); - } - } - - // If any children matched, return the new object - if (match.children.length > 0) { - return match; - } - - // If there were no matching children, check just the plain object - return matcher(params, match); - } - - var original = stripDiacritics(data.text).toUpperCase(); - var term = stripDiacritics(params.term).toUpperCase(); - - // Check if the text contains the term - if (original.indexOf(term) > -1) { - return data; - } - - // If it doesn't contain the term, don't return anything - return null; - } - - this.defaults = { - amdBase: './', - amdLanguageBase: './i18n/', - closeOnSelect: true, - debug: false, - dropdownAutoWidth: false, - escapeMarkup: Utils.escapeMarkup, - language: EnglishTranslation, - matcher: matcher, - minimumInputLength: 0, - maximumInputLength: 0, - maximumSelectionLength: 0, - minimumResultsForSearch: 0, - selectOnClose: false, - sorter: function (data) { - return data; - }, - templateResult: function (result) { - return result.text; - }, - templateSelection: function (selection) { - return selection.text; - }, - theme: 'default', - width: 'resolve' - }; - }; - - Defaults.prototype.set = function (key, value) { - var camelKey = $.camelCase(key); - - var data = {}; - data[camelKey] = value; - - var convertedData = Utils._convertData(data); - - $.extend(true, this.defaults, convertedData); - }; - - var defaults = new Defaults(); - - return defaults; -}); - -S2.define('select2/options',[ - 'require', - 'jquery', - './defaults', - './utils' -], function (require, $, Defaults, Utils) { - function Options (options, $element) { - this.options = options; - - if ($element != null) { - this.fromElement($element); - } - - this.options = Defaults.apply(this.options); - - if ($element && $element.is('input')) { - var InputCompat = require(this.get('amdBase') + 'compat/inputData'); - - this.options.dataAdapter = Utils.Decorate( - this.options.dataAdapter, - InputCompat - ); - } - } - - Options.prototype.fromElement = function ($e) { - var excludedData = ['select2']; - - if (this.options.multiple == null) { - this.options.multiple = $e.prop('multiple'); - } - - if (this.options.disabled == null) { - this.options.disabled = $e.prop('disabled'); - } - - if (this.options.language == null) { - if ($e.prop('lang')) { - this.options.language = $e.prop('lang').toLowerCase(); - } else if ($e.closest('[lang]').prop('lang')) { - this.options.language = $e.closest('[lang]').prop('lang'); - } - } - - if (this.options.dir == null) { - if ($e.prop('dir')) { - this.options.dir = $e.prop('dir'); - } else if ($e.closest('[dir]').prop('dir')) { - this.options.dir = $e.closest('[dir]').prop('dir'); - } else { - this.options.dir = 'ltr'; - } - } - - $e.prop('disabled', this.options.disabled); - $e.prop('multiple', this.options.multiple); - - if (Utils.GetData($e[0], 'select2Tags')) { - if (this.options.debug && window.console && console.warn) { - console.warn( - 'Select2: The `data-select2-tags` attribute has been changed to ' + - 'use the `data-data` and `data-tags="true"` attributes and will be ' + - 'removed in future versions of Select2.' - ); - } - - Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags')); - Utils.StoreData($e[0], 'tags', true); - } - - if (Utils.GetData($e[0], 'ajaxUrl')) { - if (this.options.debug && window.console && console.warn) { - console.warn( - 'Select2: The `data-ajax-url` attribute has been changed to ' + - '`data-ajax--url` and support for the old attribute will be removed' + - ' in future versions of Select2.' - ); - } - - $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); - Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); - - } - - var dataset = {}; - - // Prefer the element's `dataset` attribute if it exists - // jQuery 1.x does not correctly handle data attributes with multiple dashes - if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { - dataset = $.extend(true, {}, $e[0].dataset, Utils.GetData($e[0])); - } else { - dataset = Utils.GetData($e[0]); - } - - var data = $.extend(true, {}, dataset); - - data = Utils._convertData(data); - - for (var key in data) { - if ($.inArray(key, excludedData) > -1) { - continue; - } - - if ($.isPlainObject(this.options[key])) { - $.extend(this.options[key], data[key]); - } else { - this.options[key] = data[key]; - } - } - - return this; - }; - - Options.prototype.get = function (key) { - return this.options[key]; - }; - - Options.prototype.set = function (key, val) { - this.options[key] = val; - }; - - return Options; -}); - -S2.define('select2/core',[ - 'jquery', - './options', - './utils', - './keys' -], function ($, Options, Utils, KEYS) { - var Select2 = function ($element, options) { - if (Utils.GetData($element[0], 'select2') != null) { - Utils.GetData($element[0], 'select2').destroy(); - } - - this.$element = $element; - - this.id = this._generateId($element); - - options = options || {}; - - this.options = new Options(options, $element); - - Select2.__super__.constructor.call(this); - - // Set up the tabindex - - var tabindex = $element.attr('tabindex') || 0; - Utils.StoreData($element[0], 'old-tabindex', tabindex); - $element.attr('tabindex', '-1'); - - // Set up containers and adapters - - var DataAdapter = this.options.get('dataAdapter'); - this.dataAdapter = new DataAdapter($element, this.options); - - var $container = this.render(); - - this._placeContainer($container); - - var SelectionAdapter = this.options.get('selectionAdapter'); - this.selection = new SelectionAdapter($element, this.options); - this.$selection = this.selection.render(); - - this.selection.position(this.$selection, $container); - - var DropdownAdapter = this.options.get('dropdownAdapter'); - this.dropdown = new DropdownAdapter($element, this.options); - this.$dropdown = this.dropdown.render(); - - this.dropdown.position(this.$dropdown, $container); - - var ResultsAdapter = this.options.get('resultsAdapter'); - this.results = new ResultsAdapter($element, this.options, this.dataAdapter); - this.$results = this.results.render(); - - this.results.position(this.$results, this.$dropdown); - - // Bind events - - var self = this; - - // Bind the container to all of the adapters - this._bindAdapters(); - - // Register any DOM event handlers - this._registerDomEvents(); - - // Register any internal event handlers - this._registerDataEvents(); - this._registerSelectionEvents(); - this._registerDropdownEvents(); - this._registerResultsEvents(); - this._registerEvents(); - - // Set the initial state - this.dataAdapter.current(function (initialData) { - self.trigger('selection:update', { - data: initialData - }); - }); - - // Hide the original select - $element.addClass('select2-hidden-accessible'); - $element.attr('aria-hidden', 'true'); - - // Synchronize any monitored attributes - this._syncAttributes(); - - Utils.StoreData($element[0], 'select2', this); - - // Ensure backwards compatibility with $element.data('select2'). - $element.data('select2', this); - }; - - Utils.Extend(Select2, Utils.Observable); - - Select2.prototype._generateId = function ($element) { - var id = ''; - - if ($element.attr('id') != null) { - id = $element.attr('id'); - } else if ($element.attr('name') != null) { - id = $element.attr('name') + '-' + Utils.generateChars(2); - } else { - id = Utils.generateChars(4); - } - - id = id.replace(/(:|\.|\[|\]|,)/g, ''); - id = 'select2-' + id; - - return id; - }; - - Select2.prototype._placeContainer = function ($container) { - $container.insertAfter(this.$element); - - var width = this._resolveWidth(this.$element, this.options.get('width')); - - if (width != null) { - $container.css('width', width); - } - }; - - Select2.prototype._resolveWidth = function ($element, method) { - var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; - - if (method == 'resolve') { - var styleWidth = this._resolveWidth($element, 'style'); - - if (styleWidth != null) { - return styleWidth; - } - - return this._resolveWidth($element, 'element'); - } - - if (method == 'element') { - var elementWidth = $element.outerWidth(false); - - if (elementWidth <= 0) { - return 'auto'; - } - - return elementWidth + 'px'; - } - - if (method == 'style') { - var style = $element.attr('style'); - - if (typeof(style) !== 'string') { - return null; - } - - var attrs = style.split(';'); - - for (var i = 0, l = attrs.length; i < l; i = i + 1) { - var attr = attrs[i].replace(/\s/g, ''); - var matches = attr.match(WIDTH); - - if (matches !== null && matches.length >= 1) { - return matches[1]; - } - } - - return null; - } - - return method; - }; - - Select2.prototype._bindAdapters = function () { - this.dataAdapter.bind(this, this.$container); - this.selection.bind(this, this.$container); - - this.dropdown.bind(this, this.$container); - this.results.bind(this, this.$container); - }; - - Select2.prototype._registerDomEvents = function () { - var self = this; - - this.$element.on('change.select2', function () { - self.dataAdapter.current(function (data) { - self.trigger('selection:update', { - data: data - }); - }); - }); - - this.$element.on('focus.select2', function (evt) { - self.trigger('focus', evt); - }); - - this._syncA = Utils.bind(this._syncAttributes, this); - this._syncS = Utils.bind(this._syncSubtree, this); - - if (this.$element[0].attachEvent) { - this.$element[0].attachEvent('onpropertychange', this._syncA); - } - - var observer = window.MutationObserver || - window.WebKitMutationObserver || - window.MozMutationObserver - ; - - if (observer != null) { - this._observer = new observer(function (mutations) { - $.each(mutations, self._syncA); - $.each(mutations, self._syncS); - }); - this._observer.observe(this.$element[0], { - attributes: true, - childList: true, - subtree: false - }); - } else if (this.$element[0].addEventListener) { - this.$element[0].addEventListener( - 'DOMAttrModified', - self._syncA, - false - ); - this.$element[0].addEventListener( - 'DOMNodeInserted', - self._syncS, - false - ); - this.$element[0].addEventListener( - 'DOMNodeRemoved', - self._syncS, - false - ); - } - }; - - Select2.prototype._registerDataEvents = function () { - var self = this; - - this.dataAdapter.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerSelectionEvents = function () { - var self = this; - var nonRelayEvents = ['toggle', 'focus']; - - this.selection.on('toggle', function () { - self.toggleDropdown(); - }); - - this.selection.on('focus', function (params) { - self.focus(params); - }); - - this.selection.on('*', function (name, params) { - if ($.inArray(name, nonRelayEvents) !== -1) { - return; - } - - self.trigger(name, params); - }); - }; - - Select2.prototype._registerDropdownEvents = function () { - var self = this; - - this.dropdown.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerResultsEvents = function () { - var self = this; - - this.results.on('*', function (name, params) { - self.trigger(name, params); - }); - }; - - Select2.prototype._registerEvents = function () { - var self = this; - - this.on('open', function () { - self.$container.addClass('select2-container--open'); - }); - - this.on('close', function () { - self.$container.removeClass('select2-container--open'); - }); - - this.on('enable', function () { - self.$container.removeClass('select2-container--disabled'); - }); - - this.on('disable', function () { - self.$container.addClass('select2-container--disabled'); - }); - - this.on('blur', function () { - self.$container.removeClass('select2-container--focus'); - }); - - this.on('query', function (params) { - if (!self.isOpen()) { - self.trigger('open', {}); - } - - this.dataAdapter.query(params, function (data) { - self.trigger('results:all', { - data: data, - query: params - }); - }); - }); - - this.on('query:append', function (params) { - this.dataAdapter.query(params, function (data) { - self.trigger('results:append', { - data: data, - query: params - }); - }); - }); - - this.on('keypress', function (evt) { - var key = evt.which; - - if (self.isOpen()) { - if (key === KEYS.ESC || key === KEYS.TAB || - (key === KEYS.UP && evt.altKey)) { - self.close(); - - evt.preventDefault(); - } else if (key === KEYS.ENTER) { - self.trigger('results:select', {}); - - evt.preventDefault(); - } else if ((key === KEYS.SPACE && evt.ctrlKey)) { - self.trigger('results:toggle', {}); - - evt.preventDefault(); - } else if (key === KEYS.UP) { - self.trigger('results:previous', {}); - - evt.preventDefault(); - } else if (key === KEYS.DOWN) { - self.trigger('results:next', {}); - - evt.preventDefault(); - } - } else { - if (key === KEYS.ENTER || key === KEYS.SPACE || - (key === KEYS.DOWN && evt.altKey)) { - self.open(); - - evt.preventDefault(); - } - } - }); - }; - - Select2.prototype._syncAttributes = function () { - this.options.set('disabled', this.$element.prop('disabled')); - - if (this.options.get('disabled')) { - if (this.isOpen()) { - this.close(); - } - - this.trigger('disable', {}); - } else { - this.trigger('enable', {}); - } - }; - - Select2.prototype._syncSubtree = function (evt, mutations) { - var changed = false; - var self = this; - - // Ignore any mutation events raised for elements that aren't options or - // optgroups. This handles the case when the select element is destroyed - if ( - evt && evt.target && ( - evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' - ) - ) { - return; - } - - if (!mutations) { - // If mutation events aren't supported, then we can only assume that the - // change affected the selections - changed = true; - } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { - for (var n = 0; n < mutations.addedNodes.length; n++) { - var node = mutations.addedNodes[n]; - - if (node.selected) { - changed = true; - } - } - } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { - changed = true; - } - - // Only re-pull the data if we think there is a change - if (changed) { - this.dataAdapter.current(function (currentData) { - self.trigger('selection:update', { - data: currentData - }); - }); - } - }; - - /** - * Override the trigger method to automatically trigger pre-events when - * there are events that can be prevented. - */ - Select2.prototype.trigger = function (name, args) { - var actualTrigger = Select2.__super__.trigger; - var preTriggerMap = { - 'open': 'opening', - 'close': 'closing', - 'select': 'selecting', - 'unselect': 'unselecting', - 'clear': 'clearing' - }; - - if (args === undefined) { - args = {}; - } - - if (name in preTriggerMap) { - var preTriggerName = preTriggerMap[name]; - var preTriggerArgs = { - prevented: false, - name: name, - args: args - }; - - actualTrigger.call(this, preTriggerName, preTriggerArgs); - - if (preTriggerArgs.prevented) { - args.prevented = true; - - return; - } - } - - actualTrigger.call(this, name, args); - }; - - Select2.prototype.toggleDropdown = function () { - if (this.options.get('disabled')) { - return; - } - - if (this.isOpen()) { - this.close(); - } else { - this.open(); - } - }; - - Select2.prototype.open = function () { - if (this.isOpen()) { - return; - } - - this.trigger('query', {}); - }; - - Select2.prototype.close = function () { - if (!this.isOpen()) { - return; - } - - this.trigger('close', {}); - }; - - Select2.prototype.isOpen = function () { - return this.$container.hasClass('select2-container--open'); - }; - - Select2.prototype.hasFocus = function () { - return this.$container.hasClass('select2-container--focus'); - }; - - Select2.prototype.focus = function (data) { - // No need to re-trigger focus events if we are already focused - if (this.hasFocus()) { - return; - } - - this.$container.addClass('select2-container--focus'); - this.trigger('focus', {}); - }; - - Select2.prototype.enable = function (args) { - if (this.options.get('debug') && window.console && console.warn) { - console.warn( - 'Select2: The `select2("enable")` method has been deprecated and will' + - ' be removed in later Select2 versions. Use $element.prop("disabled")' + - ' instead.' - ); - } - - if (args == null || args.length === 0) { - args = [true]; - } - - var disabled = !args[0]; - - this.$element.prop('disabled', disabled); - }; - - Select2.prototype.data = function () { - if (this.options.get('debug') && - arguments.length > 0 && window.console && console.warn) { - console.warn( - 'Select2: Data can no longer be set using `select2("data")`. You ' + - 'should consider setting the value instead using `$element.val()`.' - ); - } - - var data = []; - - this.dataAdapter.current(function (currentData) { - data = currentData; - }); - - return data; - }; - - Select2.prototype.val = function (args) { - if (this.options.get('debug') && window.console && console.warn) { - console.warn( - 'Select2: The `select2("val")` method has been deprecated and will be' + - ' removed in later Select2 versions. Use $element.val() instead.' - ); - } - - if (args == null || args.length === 0) { - return this.$element.val(); - } - - var newVal = args[0]; - - if ($.isArray(newVal)) { - newVal = $.map(newVal, function (obj) { - return obj.toString(); - }); - } - - this.$element.val(newVal).trigger('change'); - }; - - Select2.prototype.destroy = function () { - this.$container.remove(); - - if (this.$element[0].detachEvent) { - this.$element[0].detachEvent('onpropertychange', this._syncA); - } - - if (this._observer != null) { - this._observer.disconnect(); - this._observer = null; - } else if (this.$element[0].removeEventListener) { - this.$element[0] - .removeEventListener('DOMAttrModified', this._syncA, false); - this.$element[0] - .removeEventListener('DOMNodeInserted', this._syncS, false); - this.$element[0] - .removeEventListener('DOMNodeRemoved', this._syncS, false); - } - - this._syncA = null; - this._syncS = null; - - this.$element.off('.select2'); - this.$element.attr('tabindex', - Utils.GetData(this.$element[0], 'old-tabindex')); - - this.$element.removeClass('select2-hidden-accessible'); - this.$element.attr('aria-hidden', 'false'); - Utils.RemoveData(this.$element[0]); - this.$element.removeData('select2'); - - this.dataAdapter.destroy(); - this.selection.destroy(); - this.dropdown.destroy(); - this.results.destroy(); - - this.dataAdapter = null; - this.selection = null; - this.dropdown = null; - this.results = null; - }; - - Select2.prototype.render = function () { - var $container = $( - '' + - '' + - '' + - '' - ); - - $container.attr('dir', this.options.get('dir')); - - this.$container = $container; - - this.$container.addClass('select2-container--' + this.options.get('theme')); - - Utils.StoreData($container[0], 'element', this.$element); - - return $container; - }; - - return Select2; -}); - -S2.define('jquery-mousewheel',[ - 'jquery' -], function ($) { - // Used to shim jQuery.mousewheel for non-full builds. - return $; -}); - -S2.define('jquery.select2',[ - 'jquery', - 'jquery-mousewheel', - - './select2/core', - './select2/defaults', - './select2/utils' -], function ($, _, Select2, Defaults, Utils) { - if ($.fn.select2 == null) { - // All methods that should return the element - var thisMethods = ['open', 'close', 'destroy']; - - $.fn.select2 = function (options) { - options = options || {}; - - if (typeof options === 'object') { - this.each(function () { - var instanceOptions = $.extend(true, {}, options); - - var instance = new Select2($(this), instanceOptions); - }); - - return this; - } else if (typeof options === 'string') { - var ret; - var args = Array.prototype.slice.call(arguments, 1); - - this.each(function () { - var instance = Utils.GetData(this, 'select2'); - - if (instance == null && window.console && console.error) { - console.error( - 'The select2(\'' + options + '\') method was called on an ' + - 'element that is not using Select2.' - ); - } - - ret = instance[options].apply(instance, args); - }); - - // Check if we should be returning `this` - if ($.inArray(options, thisMethods) > -1) { - return this; - } - - return ret; - } else { - throw new Error('Invalid arguments for Select2: ' + options); - } - }; - } - - if ($.fn.select2.defaults == null) { - $.fn.select2.defaults = Defaults; - } - - return Select2; -}); - - // Return the AMD loader configuration so it can be used outside of this file - return { - define: S2.define, - require: S2.require - }; -}()); - - // Autoload the jQuery bindings - // We know that all of the modules exist above this, so we're safe - var select2 = S2.require('jquery.select2'); - - // Hold the AMD module references on the jQuery function that was just loaded - // This allows Select2 to use the internal loader outside of this file, such - // as in the language files. - jQuery.fn.select2.amd = S2; - - // Return the Select2 instance for anyone who is importing it. - return select2; -})); diff --git a/js/select2.min.js b/js/select2.min.js deleted file mode 100644 index e505290..0000000 --- a/js/select2.min.js +++ /dev/null @@ -1 +0,0 @@ -/*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if((e=p[o.slice(0,l).join("/")])&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=w.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),o.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var c=s[a];delete s[a],u[a]=!0,n.apply(b,c)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return void 0!==b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,c,d,f){var h,k,m,n,o,t,v,w=[],x=typeof d;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c.__cache={};var e=0;return c.GetUniqueElementId=function(a){var b=a.getAttribute("data-select2-id");return null==b&&(a.id?(b=a.id,a.setAttribute("data-select2-id",b)):(a.setAttribute("data-select2-id",++e),b=e.toString())),b},c.StoreData=function(a,b,d){var e=c.GetUniqueElementId(a);c.__cache[e]||(c.__cache[e]={}),c.__cache[e][b]=d},c.GetData=function(b,d){var e=c.GetUniqueElementId(b);return d?c.__cache[e]&&null!=c.__cache[e][d]?c.__cache[e][d]:a(b).data(d):c.__cache[e]},c.RemoveData=function(a){var b=c.GetUniqueElementId(a);null!=c.__cache[b]&&delete c.__cache[b]},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('
            ');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('
          • '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var c=this;this.data.current(function(d){var e=a.map(d,function(a){return a.id.toString()});c.$results.find(".select2-results__option[aria-selected]").each(function(){var c=a(this),d=b.GetData(this,"data"),f=""+d.id;null!=d.element&&d.element.selected||null==d.element&&a.inArray(f,e)>-1?c.attr("aria-selected","true"):c.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(c){var d=document.createElement("li");d.className="select2-results__option";var e={role:"treeitem","aria-selected":"false"};c.disabled&&(delete e["aria-selected"],e["aria-disabled"]="true"),null==c.id&&delete e["aria-selected"],null!=c._resultId&&(d.id=c._resultId),c.title&&(d.title=c.title),c.children&&(e.role="group",e["aria-label"]=c.text,delete e["aria-selected"]);for(var f in e){var g=e[f];d.setAttribute(f,g)}if(c.children){var h=a(d),i=document.createElement("strong");i.className="select2-results__group";a(i);this.template(c,i);for(var j=[],k=0;k",{class:"select2-results__options select2-results__options--nested"});n.append(j),h.append(i),h.append(n)}else this.template(c,d);return b.StoreData(d,"data",c),d},c.prototype.bind=function(c,d){var e=this,f=c.id+"-results";this.$results.attr("id",f),c.on("results:all",function(a){e.clear(),e.append(a.data),c.isOpen()&&(e.setClasses(),e.highlightFirstItem())}),c.on("results:append",function(a){e.append(a.data),c.isOpen()&&e.setClasses()}),c.on("query",function(a){e.hideMessages(),e.showLoading(a)}),c.on("select",function(){c.isOpen()&&(e.setClasses(),e.highlightFirstItem())}),c.on("unselect",function(){c.isOpen()&&(e.setClasses(),e.highlightFirstItem())}),c.on("open",function(){e.$results.attr("aria-expanded","true"),e.$results.attr("aria-hidden","false"),e.setClasses(),e.ensureHighlightVisible()}),c.on("close",function(){e.$results.attr("aria-expanded","false"),e.$results.attr("aria-hidden","true"),e.$results.removeAttr("aria-activedescendant")}),c.on("results:toggle",function(){var a=e.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),c.on("results:select",function(){var a=e.getHighlightedResults();if(0!==a.length){var c=b.GetData(a[0],"data");"true"==a.attr("aria-selected")?e.trigger("close",{}):e.trigger("select",{data:c})}}),c.on("results:previous",function(){var a=e.getHighlightedResults(),b=e.$results.find("[aria-selected]"),c=b.index(a);if(!(c<=0)){var d=c-1;0===a.length&&(d=0);var f=b.eq(d);f.trigger("mouseenter");var g=e.$results.offset().top,h=f.offset().top,i=e.$results.scrollTop()+(h-g);0===d?e.$results.scrollTop(0):h-g<0&&e.$results.scrollTop(i)}}),c.on("results:next",function(){var a=e.getHighlightedResults(),b=e.$results.find("[aria-selected]"),c=b.index(a),d=c+1;if(!(d>=b.length)){var f=b.eq(d);f.trigger("mouseenter");var g=e.$results.offset().top+e.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=e.$results.scrollTop()+h-g;0===d?e.$results.scrollTop(0):h>g&&e.$results.scrollTop(i)}}),c.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),c.on("results:message",function(a){e.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=e.$results.scrollTop(),c=e.$results.get(0).scrollHeight-b+a.deltaY,d=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=e.$results.height();d?(e.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(e.$results.scrollTop(e.$results.get(0).scrollHeight-e.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(c){var d=a(this),f=b.GetData(this,"data");if("true"===d.attr("aria-selected"))return void(e.options.get("multiple")?e.trigger("unselect",{originalEvent:c,data:f}):e.trigger("close",{}));e.trigger("select",{originalEvent:c,data:f})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(c){var d=b.GetData(this,"data");e.getHighlightedResults().removeClass("select2-results__option--highlighted"),e.trigger("results:focus",{data:d,element:a(this)})})},c.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var c=a('');return this._tabindex=0,null!=b.GetData(this.$element[0],"old-tabindex")?this._tabindex=b.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),c.attr("title",this.$element.attr("title")),c.attr("tabindex",this._tabindex),this.$selection=c,c},d.prototype.bind=function(a,b){var d=this,e=(a.id,a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),window.setTimeout(function(){d.$selection.focus()},0),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(c){a(document.body).on("mousedown.select2."+c.id,function(c){var d=a(c.target),e=d.closest(".select2");a(".select2.select2-container--open").each(function(){a(this),this!=e[0]&&b.GetData(this,"element").select2("close")})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){b.find(".selection").append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(''),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()})},e.prototype.clear=function(){var a=this.$selection.find(".select2-selection__rendered");a.empty(),a.removeAttr("title")},e.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},e.prototype.selectionContainer=function(){return a("")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.attr("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('
              '),a},d.prototype.bind=function(b,e){var f=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){f.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!f.options.get("disabled")){var d=a(this),e=d.parent(),g=c.GetData(e[0],"data");f.trigger("unselect",{originalEvent:b,data:g})}})},d.prototype.clear=function(){var a=this.$selection.find(".select2-selection__rendered");a.empty(),a.removeAttr("title")},d.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},d.prototype.selectionContainer=function(){return a('
            • ×
            • ')},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1||c)return a.call(this,b);this.clear();var d=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(d)},b}),b.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(a,b,c){function d(){}return d.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},d.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var d=this.$selection.find(".select2-selection__clear");if(0!==d.length){b.stopPropagation();var e=c.GetData(d[0],"data"),f=this.$element.val();this.$element.val(this.placeholder.id);var g={data:e};if(this.trigger("clear",g),g.prevented)return void this.$element.val(f);for(var h=0;h0||0===d.length)){var e=a('×');c.StoreData(e[0],"data",d),this.$selection.find(".select2-selection__rendered").prepend(e)}},d}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,d,e){var f=this;a.call(this,d,e),d.on("open",function(){f.$search.trigger("focus")}),d.on("close",function(){f.$search.val(""),f.$search.removeAttr("aria-activedescendant"),f.$search.trigger("focus")}),d.on("enable",function(){f.$search.prop("disabled",!1),f._transferTabIndex()}),d.on("disable",function(){f.$search.prop("disabled",!0)}),d.on("focus",function(a){f.$search.trigger("focus")}),d.on("results:focus",function(a){f.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){f.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){f._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){if(a.stopPropagation(),f.trigger("keypress",a),f._keyUpPrevented=a.isDefaultPrevented(),a.which===c.BACKSPACE&&""===f.$search.val()){var d=f.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var e=b.GetData(d[0],"data");f.searchRemoveChoice(e),a.preventDefault()}}});var g=document.documentMode,h=g&&g<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(h)return void f.$selection.off("input.search input.searchcheck");f.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(h&&"input"===a.type)return void f.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&f.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;if(this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c){this.$element.find("[data-select2-tag]").length?this.$element.focus():this.$search.focus()}},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{a=.75*(this.$search.val().length+1)+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],g=["opening","closing","selecting","unselecting","clearing"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),null!=c.id?d+="-"+c.id.toString():d+="-"+a.generateChars(4),d},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){"status"in d&&(0===d.status||"0"===d.status)||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength)return void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;if(d.maximumSelectionLength>0&&f>=d.maximumSelectionLength)return void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}});a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val(""),e.$search.blur()}),c.on("focus",function(){c.isOpen()||e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){e.showSearch(a)?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){e.$results.offset().top+e.$results.outerHeight(!1)+50>=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1)&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
            • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){b.StoreData(this,"select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(c){var d=b.GetData(this,"select2-scroll-position");a(this).scrollTop(d.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id;this.$container.parents().filter(b.hasScroll).off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){null==c(d,e.children[g])&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var h=b(e.text).toUpperCase(),i=b(d.term).toUpperCase();return h.indexOf(i)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(!0,this.defaults,f)},new D}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),d.GetData(a[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),d.StoreData(a[0],"data",d.GetData(a[0],"select2Tags")),d.StoreData(a[0],"tags",!0)),d.GetData(a[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",d.GetData(a[0],"ajaxUrl")),d.StoreData(a[0],"ajax-Url",d.GetData(a[0],"ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,d.GetData(a[0])):d.GetData(a[0]);var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,d){null!=c.GetData(a[0],"select2")&&c.GetData(a[0],"select2").destroy(),this.$element=a,this.id=this._generateId(a),d=d||{},this.options=new b(d,a),e.__super__.constructor.call(this);var f=a.attr("tabindex")||0;c.StoreData(a[0],"old-tabindex",f),a.attr("tabindex","-1");var g=this.options.get("dataAdapter");this.dataAdapter=new g(a,this.options);var h=this.render();this._placeContainer(h);var i=this.options.get("selectionAdapter");this.selection=new i(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,h);var j=this.options.get("dropdownAdapter");this.dropdown=new j(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,h);var k=this.options.get("resultsAdapter");this.results=new k(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){l.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),c.StoreData(a[0],"select2",this),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",c.GetData(this.$element[0],"old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),c.RemoveData(this.$element[0]),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),c.StoreData(b[0],"element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(a,b,c,d,e){if(null==a.fn.select2){var f=["open","close","destroy"];a.fn.select2=function(b){if("object"==typeof(b=b||{}))return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,g=Array.prototype.slice.call(arguments,1);return this.each(function(){var a=e.GetData(this,"select2");null==a&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=a[b].apply(a,g)}),a.inArray(b,f)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c}); \ No newline at end of file diff --git a/js/clients.js b/js/src/clients.js similarity index 84% rename from js/clients.js rename to js/src/clients.js index 68e5819..cfc9ddf 100644 --- a/js/clients.js +++ b/js/src/clients.js @@ -1,7 +1,22 @@ +var $ = require("jquery"); +require("jquery-migrate"); +// var moment = require("moment"); +require("jqueryui"); +//require("jqueryui/jquery-ui.css"); +import Tabulator from 'tabulator-tables'; +require('tabulator-tables/dist/css/tabulator.css'); +require('../../css/style.css'); +//require('tabulator-tables/dist/js/jquery_wrapper.js'); +// import 'select2/dist/js/select2.full.js' +// require('select2/dist/css/select2.css'); +// require('daterangepicker/daterangepicker.css'); (function() { + $.ajaxSetup({ + headers: { 'RequestToken': OC.requestToken } + }); $( function() { @@ -30,10 +45,10 @@ }) return false; }); - dialogClientEditForm = $( "#dialog-client-edit-form" ).dialog({ + var dialogClientEditForm = $( "#dialog-client-edit-form" ).dialog({ autoOpen: false, - height: 400, - width: 350, + height: 'auto', + width: 'auto', modal: true, buttons: { "Edit client": {click:function(){ @@ -53,15 +68,15 @@ } }); - form = dialogClientEditForm.find( "form" ).on( "submit", function( event ) { + var form = dialogClientEditForm.find( "form" ).on( "submit", function( event ) { event.preventDefault(); editClient(dialogClientEditForm); }); getClients(); function editClient(dialogClientEditForm){ - target = dialogClientEditForm.target; - form = dialogClientEditForm.find( "form" ); + var target = dialogClientEditForm.target; + var form = dialogClientEditForm.find( "form" ); var baseUrl = OC.generateUrl('/apps/timetracker/ajax/edit-client/'+target); var jqxhr = $.post( baseUrl, {name:form.find("#name").val()},function() { getClients(); @@ -150,4 +165,4 @@ }); } } ); -}()); \ No newline at end of file +}()); diff --git a/js/src/dashboard.js b/js/src/dashboard.js new file mode 100644 index 0000000..aa0a93e --- /dev/null +++ b/js/src/dashboard.js @@ -0,0 +1,319 @@ +var $ = require("jquery"); +require("jquery-migrate"); +// var moment = require("moment"); +require("jqueryui"); +//require("jqueryui/jquery-ui.css"); +require("daterangepicker"); +var moment = require("moment"); + +require('daterangepicker/daterangepicker.css'); +require('../../css/style.css'); + +var Chart = require("chart.js"); +Chart.plugins.register({ + afterDraw: function (chart) { + if (chart.data.datasets.length === 0 || chart.data.datasets[0].data.length === 0) { + // No data is present + var ctx = chart.chart.ctx; + var width = chart.chart.width; + var height = chart.chart.height + chart.clear(); + + ctx.save(); + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + ctx.font = "16px normal 'Helvetica Nueue'"; + ctx.fillText('No data to display', width / 2, height / 2); + ctx.restore(); + } + } +}); + +var dtf = require("./dateformat.js"); + +(function () { + $.ajaxSetup({ + headers: {'RequestToken': OC.requestToken} + }); + + $(function () { + $(document).ready(function () { + + var start = moment().subtract(29, 'days'); + var end = moment(); + var group1 = 'client'; + var group2 = 'project'; + var group3 = ''; + var filterProjectId = ''; + var filterClientId = ''; + var myDoughnutChart = null; + var costChart = null; + + function cb(start, end) { + $('#report-range span').html(start.format(dtf.dformat()) + ' - ' + end.format(dtf.dformat())); + } + + $("#report-range").daterangepicker({ + timePicker: false, + startDate: start, + endDate: end, + showCustomRangeLabel: false, + ranges: { + 'Today': [moment().startOf('day'), moment().endOf('day')], + 'This week': [moment().startOf('week'), moment().endOf('week')], + 'Last 7 Days': [moment().startOf('day').subtract(6, 'days'), moment().endOf('day')], + 'Last 30 Days': [moment().startOf('day').subtract(29, 'days'), moment().endOf('day')], + 'Last 90 Days': [moment().startOf('day').subtract(89, 'days'), moment().endOf('day')], + 'Last 365 Days': [moment().startOf('day').subtract(364, 'days'), moment().endOf('day')], + 'This Month': [moment().startOf('month'), moment().endOf('day')], + 'This Year': [moment().startOf('year'), moment().endOf('day')], + 'Starting last year': [moment().startOf('year').subtract(1, 'year'), moment().endOf('day')], + 'Last 3 years': [moment().startOf('day').subtract(3, 'year'), moment().endOf('day')], + 'Last 5 years': [moment().startOf('day').subtract(5, 'year'), moment().endOf('day')], + }, + locale: { + format: dtf.dformat(), + firstDay: firstDay + } + }, cb); + $("#report-range").on('apply.daterangepicker', function (ev, picker) { + //days = Math.round((picker.endDate.unix()-picker.startDate.unix()) / 86400); + start = picker.startDate; + getData(); + }); + cb(start, end); + + + var chartData = {}; + var costChartData = {}; + + getData(); + + function getData() { + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/report?name=&from=' + start.unix() + '&to=' + end.unix() + '&group1=' + group1 + '&group2=' + group2 + '&timegroup=' + group3 + '&filterProjectId=' + filterProjectId + '&filterClientId=' + filterClientId); + var default_colors = [ + '#3366CC', + '#DC3912', + '#FF9900', + '#109618', + '#990099', + '#3B3EAC', + '#0099C6', + '#DD4477', + '#66AA00', + '#B82E2E', + '#316395', + '#994499', + '#22AA99', + '#AAAA11', + '#6633CC', + '#E67300', + '#8B0707', + '#329262', + '#5574A6', + '#3B3EAC', + '#C71585', + '#006400', + '#4B0082', + '#8B0000', + '#FF4500', + '#BDB76B', + '#008080', + '#FFE4E1', + '#800000', + '#000080', + '#2F4F4F', + '#FF1493', + '#008000', + '#800080', + '#FF0000', + '#FF8C00', + '#20B2AA', + '#FAF0E6', + '#FFD700', + '#A52A2A', + '#708090', + '#DB7093', + '#808000', + '#9400D3', + '#FFDAB9', + '#7FFFD4' + ] + $.ajax({ + /*headers: {requesttoken: oc_requesttoken},*/ + url: baseUrl, + method: 'GET', + dataType: 'json', + success: function (d) { + chartData = { + labels: [], + datasets: [{data: [], backgroundColor: []}, {data: [], backgroundColor: []},], + }; + costChartData = { + labels: [], + datasets: [{data: [], backgroundColor: []}, {data: [], backgroundColor: []},], + }; + var clientMap = {}; + var nclients = 0; + var totalCost = 0; + // extract clients in clientMap + var totalMinutes = 0; + for (var x = 0; x < d.items.length; x++) { + cid = d.items[x].client; + if (cid == null) { + cid = -1; + } + if (clientMap[cid] === undefined) { + clientMap[cid] = { + duration: d.items[x].totalDuration, + order: nclients, + client: (d.items[x].client == null) ? 'Not Set' : d.items[x].client, + cost: d.items[x].cost + } + totalMinutes += d.items[x].totalDuration / 60.0; + totalCost += d.items[x].cost; + nclients++; + } else { + clientMap[cid].duration = clientMap[cid].duration + d.items[x].totalDuration; + clientMap[cid].cost = clientMap[cid].cost + d.items[x].cost; + totalMinutes += d.items[x].totalDuration / 60.0; + totalCost += d.items[x].cost; + } + } + var mx = 0; + var nindex = nclients; + + var sortable = []; + for (var client in clientMap) { + sortable.push([client, clientMap[client].order]); + } + + sortable.sort(function (a, b) { + return a[1] - b[1]; + }); + for (var i = 0; i < sortable.length; i++) { + t = sortable[i]; + key = t[0]; + + // first add clients + chartData.datasets[0].data[clientMap[key].order] = clientMap[key].duration / 60.0; + chartData.datasets[1].data[clientMap[key].order] = 0; + + costChartData.datasets[0].data[clientMap[key].order] = (clientMap[key].cost / 100); + costChartData.datasets[1].data[clientMap[key].order] = 0; + + if (clientMap[key].client == -1) { + chartData.labels[clientMap[key].order] = "Client Not Set"; + costChartData.labels[clientMap[key].order] = "Client Not Set"; + + } else { + chartData.labels[clientMap[key].order] = clientMap[key].client; + costChartData.labels[clientMap[key].order] = clientMap[key].client; + } + chartData.datasets[0].backgroundColor[clientMap[key].order] = default_colors[clientMap[key].order]; + chartData.datasets[1].backgroundColor[clientMap[key].order] = default_colors[clientMap[key].order]; + + costChartData.datasets[0].backgroundColor[clientMap[key].order] = default_colors[clientMap[key].order]; + costChartData.datasets[1].backgroundColor[clientMap[key].order] = default_colors[clientMap[key].order]; + // add projects for each client + + for (var x = 0; x < d.items.length; x++) { + + if (d.items[x].client === key || (d.items[x].client == null && key == -1)) { + chartData.datasets[0].data[nindex] = 0; + chartData.datasets[1].data[nindex] = d.items[x].totalDuration / 60.0; + + costChartData.datasets[0].data[nindex] = 0; + costChartData.datasets[1].data[nindex] = d.items[x].cost; + + chartData.datasets[1].backgroundColor[nindex] = default_colors[nindex]; + chartData.datasets[0].backgroundColor[nindex] = default_colors[nindex]; + + costChartData.datasets[1].backgroundColor[nindex] = default_colors[nindex]; + costChartData.datasets[0].backgroundColor[nindex] = default_colors[nindex]; + + + if (d.items[x].project == null) { + chartData.labels[nindex] = "Project Not Set"; + costChartData.labels[nindex] = "Project Not Set" + } else { + chartData.labels[nindex] = d.items[x].project; + costChartData.labels[nindex] = d.items[x].project; + } + nindex++; + } + } + } + ; + + console.log(chartData); + console.log(costChartData); + if (myDoughnutChart != null) { + myDoughnutChart.destroy(); + } + + if (costChart != null) { + costChart.destroy(); + } + + var ctx = document.getElementById("myChart").getContext("2d"); + + myDoughnutChart = new Chart(ctx, { + type: 'doughnut', + data: chartData, + options: { + tooltips: { + callbacks: { + title: function (tooltipItem, data) { + return data['labels'][tooltipItem[0]['index']]; + }, + label: function (tooltipItem, data) { + + mm = data['datasets'][tooltipItem.datasetIndex]['data'][tooltipItem['index']]; + h = Math.trunc(mm / 60); + m = Math.trunc(mm % 60); + return (h + " hours " + m + " minutes") + }, + afterLabel: function (tooltipItem, data) { + var dataset = data['datasets'][tooltipItem.datasetIndex]; + if (!(0 in dataset["_meta"])) + return ''; + var percent = Math.round((dataset['data'][tooltipItem['index']] / dataset["_meta"][0]['total']) * 100) + return '(' + percent + '%)'; + }, + }, + + } + } + }); + + var costChartCtx = document.getElementById("costChart").getContext("2d"); + + costChart = new Chart(costChartCtx, { + type: 'doughnut', + data: costChartData, + options: { + tooltips: { + callbacks: { + title: function (tooltipItem, data) { + return data['labels'][tooltipItem[0]['index']]; + }, + label: function (tooltipItem, data) { + var c = data['datasets'][tooltipItem.datasetIndex]['data'][tooltipItem['index']]; + return "Cost: " + (c / 100).toFixed(2); + } + }, + + } + } + }); + + h = Math.trunc(totalMinutes / 60); + m = Math.trunc(totalMinutes % 60); + $('#summary').html('Total time: ' + h + " hours " + m + " minutes" + "
              " + "Total costs: " + (totalCost / 100).toFixed(2)); + } + }); + } + }); + }); +}()); diff --git a/js/src/dateformat.js b/js/src/dateformat.js new file mode 100644 index 0000000..1925632 --- /dev/null +++ b/js/src/dateformat.js @@ -0,0 +1,53 @@ +var moment = require("moment"); +moment.locale(document.documentElement.getAttribute("data-locale") || undefined); +const dformat = moment.localeData().longDateFormat('L'); +const tformat = moment.localeData().longDateFormat('LTS'); + +exports.dformat = function () { + return dformat; +}; + +exports.tformat = function () { + return tformat; +}; + +exports.dtformat = function () { + return dformat + ' ' + tformat; +}; + +exports.mformat = function () { + var sample; + + try { + sample = window.Intl ? new Intl.DateTimeFormat((document.documentElement.getAttribute("data-locale") || undefined), { + numberingSystem: 'latn', + calendar: 'gregory', + }).format(new Date(1970, 11, 31)) : ''; + } catch { + sample = window.Intl ? new Intl.DateTimeFormat(undefined, { + numberingSystem: 'latn', + calendar: 'gregory', + }).format(new Date(1970, 11, 31)) : ''; + } + + let mm = 0, + mi = sample.indexOf(12); + let dd = 1, + di = sample.indexOf(31); + let yy = 2, + yi = sample.indexOf(1970); + + // IE 10 or earlier, iOS 9 or earlier, non-Latin numbering system + // or non-Gregorian calendar; fall back to mm/dd/yyyy + if (yi >= 0 && mi >= 0 && di >= 0) { + mm = (mi > yi) + (mi > di); + dd = (di > yi) + (di > mi); + yy = (yi > mi) + (yi > di); + } + + let r = []; + r[yy] = 'YYYY'; + r[mm] = 'MM'; + + return r.join(sample.match(/[-.]/) || '/').replace('//','/'); +}; diff --git a/js/src/goals.js b/js/src/goals.js new file mode 100644 index 0000000..8c6d210 --- /dev/null +++ b/js/src/goals.js @@ -0,0 +1,163 @@ +var $ = require("jquery"); +require("jquery-migrate"); +// var moment = require("moment"); +require("jqueryui"); +//require("jqueryui/jquery-ui.css"); +import Tabulator from 'tabulator-tables'; +require('tabulator-tables/dist/css/tabulator.css'); + +import 'select2/dist/js/select2.full.js' +require('select2/dist/css/select2.css'); + +require('../../css/style.css'); +(function() { + $.ajaxSetup({ + headers: { 'RequestToken': OC.requestToken } + }); + + $( function() { + var newGoalProjectId; + $(document).ready(function() { + $("#dialog-confirm").dialog({ + autoOpen: false, + modal: true + }); + }); + + + $("#project-select").select2({ + width: '200px', + escapeMarkup : function(markup) { return markup; }, + placeholder: "Select project", + allowClear: true, + templateResult: function formatState (project) { + var color = '#ffffff'; + if (project.color) { + color = project.color; + } + var $state = $( + '' + project.text + '' + ); + return $state; + }, + ajax: { + tags: true, + url: OC.generateUrl('/apps/timetracker/ajax/projects'), + + dataType: 'json', + delay: 250, + + processResults: function (data, page) { //json parse + return { + results: $.map(data.Projects,function(val, i){ + return { id: val.id, text:val.name, color: val.color}; + }), + pagination: { + more: false, + } + }; + }, + cache: false, + + }, + }); + $('#project-select').on("select2:select select2:unselect", function(e) { + newGoalProjectId = ($(e.target).val() != null)? $(e.target).val() : ""; + }); + + + $("#new-goal-submit").click(function () { + if ($("#new-goal-hours").val().trim() == '') + return false; + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/add-goal'); + var jqxhr = $.post( baseUrl, { + projectId : newGoalProjectId, + hours: $("#new-goal-hours").val(), + interval: $("#new-goal-interval").val(), + }, function() { + + getGoals(); + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + }) + .fail(function() { + alert( "error" ); + }) + return false; + }); + + getGoals(); + function getGoals(){ + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/goals'); + + var editIcon = function(cell, formatterParams){ //plain text value + return ""; + }; + + + var columns = [ + {title:"#", field:"", formatter:"rownum", width: 40, align: "center"}, + {title:"Project", field:"projectName", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"Target Hours", field:"hours", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"Interval", field:"interval", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"Started At", field:"createdAt", widthGrow:1, mutator: function(value, data, type, params, component){ + return new Date(data.createdAt*1000).toDateString();} + }, //column will be allocated 1/5 of the remaining space + {title:"Hours spent current interval", field:"workedHoursCurrentPeriod", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"Past Debt in Hours", field:"debtHours", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"Remaining Hours", field:"remainingHours", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"Total Remaining Hours", field:"totalRemainingHours", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {formatter:"buttonCross", width:40, align:"center", cellClick:function(e, cell) { + $("#dialog-confirm").dialog({ + buttons : { + "Confirm" : {click: function() { + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/delete-goal/'+cell.getRow().getData().id); + var jqxhr = $.post( baseUrl, function() { + getGoals(); + $("#dialog-confirm").dialog("close"); + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + }) + .fail(function() { + alert( "error" ); + }) + return false; + }, + text: 'Confirm', + class:'primary' + }, + "Cancel" : function() { + $(this).dialog("close"); + } + } + }); + $("#dialog-confirm").dialog('open'); + + //cell.getRow().delete(); + }}, + + ]; + + var table = new Tabulator("#goals", { + ajaxURL:baseUrl, + layout:"fitColumns", + columns:columns, + rowClick:function(e, row){ + return false; + }, + ajaxResponse:function(url, params, response){ + + return response.Goals; //return the tableData property of a response json object + }, + }); + } + } ); +}()); diff --git a/js/kingtable.js b/js/src/kingtable.js similarity index 100% rename from js/kingtable.js rename to js/src/kingtable.js diff --git a/js/src/piklor.js b/js/src/piklor.js new file mode 100644 index 0000000..3598c73 --- /dev/null +++ b/js/src/piklor.js @@ -0,0 +1,161 @@ +(function (root) { + + /** + * Piklor + * Creates a new `Piklor` instance. + * + * @name Piklor + * @function + * @param {String|Element} sel The element where the color picker will live. + * @param {Array} colors An array of strings representing colors. + * @param {Object} options An object containing the following fields: + * + * - `open` (String|Element): The HTML element or query selector which will open the picker. + * - `openEvent` (String): The open event (default: `"click"`). + * - `style` (Object): Some style options: + * - `display` (String): The display value when the picker is opened (default: `"block"`). + * - `template` (String): The color item template. The `{color}` snippet will be replaced + * with the color value (default: `"
              "`). + * - `autoclose` (Boolean): If `false`, the color picker will not be hided by default (default: `true`). + * - `closeOnBlur` (Boolean): If `true`, the color picker will be closed when clicked outside of it (default: `false`). + * + * @return {Piklor} The `Piklor` instance. + */ + function Piklor(sel, colors, options) { + var self = this; + options = options || {}; + options.open = self.getElm(options.open); + options.openEvent = options.openEvent || "click"; + options.style = Object(options.style); + options.style.display = options.style.display || "inline-block"; + options.closeOnBlur = options.closeOnBlur || false; + options.template = options.template || "
              "; + self.elm = self.getElm(sel); + self.cbs = []; + self.isOpen = true; + self.colors = colors; + self.options = options; + self.render(); + + // Handle the open element and event. + if (options.open) { + options.open.addEventListener(options.openEvent, function (ev) { + self.isOpen ? self.close() : self.open(); + ev.preventDefault(); + return false; + }); + } + + // Click on colors + self.elm.addEventListener("click", function (ev) { + var col = ev.target.getAttribute("data-col"); + if (!col) { return; } + self.close(); + self.set(col); + }); + + if (options.closeOnBlur) { + window.addEventListener("click", function (ev) { + // check if we didn't click 'open' and 'color pallete' elements + if (ev.target != options.open && ev.target != self.elm && self.isOpen) { + self.close(); + } + }); + } + + if (options.autoclose !== false) { + self.close(); + } + } + + /** + * getElm + * Finds the HTML element. + * + * @name getElm + * @function + * @param {String|Element} el The HTML element or query selector. + * @return {HTMLElement} The selected HTML element. + */ + Piklor.prototype.getElm = function (el) { + if (typeof el === "string") { + return document.querySelector(el); + } + return el; + }; + + /** + * render + * Renders the colors. + * + * @name render + * @function + */ + Piklor.prototype.render = function () { + var self = this + , html = "" + ; + + self.colors.forEach(function (c) { + html += self.options.template.replace(/\{color\}/g, c); + }); + + self.elm.innerHTML = html; + }; + + /** + * close + * Closes the color picker. + * + * @name close + * @function + */ + Piklor.prototype.close = function () { + this.elm.style.display = "none"; + this.isOpen = false; + }; + + /** + * open + * Opens the color picker. + * + * @name open + * @function + */ + Piklor.prototype.open = function () { + this.elm.style.display = this.options.style.display; + this.isOpen = true; + }; + + /** + * colorChosen + * Adds a new callback in the colorChosen callback buffer. + * + * @name colorChosen + * @function + * @param {Function} cb The callback function called with the selected color. + */ + Piklor.prototype.colorChosen = function (cb) { + this.cbs.push(cb); + }; + + /** + * set + * Sets the color picker color. + * + * @name set + * @function + * @param {String} c The color to set. + * @param {Boolean} p If `false`, the `colorChosen` callbacks will not be called. + */ + Piklor.prototype.set = function (c, p) { + var self = this; + self.color = c; + if (p === false) { return; } + self.cbs.forEach(function (cb) { + cb.call(self, c); + }); + }; + + root.Piklor = Piklor; +})(this); diff --git a/js/projects.js b/js/src/projects.js similarity index 55% rename from js/projects.js rename to js/src/projects.js index f9736b4..63c2f92 100644 --- a/js/projects.js +++ b/js/src/projects.js @@ -1,20 +1,84 @@ - +var $ = require("jquery"); +require("jquery-migrate"); +// var moment = require("moment"); +require("jqueryui"); +//require("jqueryui/jquery-ui.css"); +import Tabulator from 'tabulator-tables'; +require('tabulator-tables/dist/css/tabulator.css'); +import 'select2/dist/js/select2.full.js' +require('select2/dist/css/select2.css'); +require('../../css/style.css'); +//require("piklor.js"); +var Piklor = require('./piklor.js'); +require('../../css/piklor.css'); (function() { + var colorArray = [ + "#1abc9c" + , "#2ecc71" + , "#3498db" + , "#9b59b6" + , "#34495e" + , "#16a085" + , "#27ae60" + , "#2980b9" + , "#8e44ad" + , "#2c3e50" + , "#f1c40f" + , "#e67e22" + , "#e74c3c" + , "#ecf0f1" + , "#95a5a6" + , "#f39c12" + , "#d35400" + , "#c0392b" + , "#bdc3c7" + , "#7f8c8d" + , "#bf678b" + , "#bf678b" + , "#c98879" + , "#ddcb55" + , "#a5b872" + , "#6ea68f" + , "#3794ac" + , "#0082c9" + , "#2d73be" + , "#5b64b3" + , "#8855a8" +]; - + $.ajaxSetup({ + headers: { 'RequestToken': OC.requestToken } + }); $( function() { - + var pkedit = null; function isAdmin(){ return oc_isadmin; } $(document).ready(function() { + $("#dialog-confirm").dialog({ autoOpen: false, modal: true }); + var pk = new Piklor.Piklor("#color-picker-project-new", colorArray, { + open: ".picker-wrapper .btn" + }) + , wrapperEl = pk.getElm(".picker-wrapper") + , header = pk.getElm("header") + , footer = pk.getElm("footer") + ; + pk.colorChosen(function (col) { + wrapperEl.style.backgroundColor = col; + header.style.backgroundColor = col; + $('#new-project-color').val(col); + //footer.style.backgroundColor = col; + }); + + // OC.currentUser + $("#client-select").select2({ width: '200px', placeholder: 'Select client...', @@ -24,7 +88,7 @@ dataType: 'json', delay: 250, - results: function (data, page) { //json parse + processResults: function (data, page) { //json parse return { results: $.map(data.Clients,function(val, i){ return { id: val.id, text:val.name}; @@ -46,14 +110,15 @@ $("#new-project-submit").click(function (e) { e.preventDefault(); var selectedClient = $('#client-select').select2('data'); + var selectedColor = $('#new-project-color').val(); var clientId = null; - if (selectedClient !== null){ - clientId = selectedClient.id; + if (selectedClient.length > 0){ + clientId = selectedClient[0].id; } if ($("#new-project-input").val().trim() == '') return false; var baseUrl = OC.generateUrl('/apps/timetracker/ajax/add-project/'+$("#new-project-input").val()); - var jqxhr = $.post( baseUrl, {clientId:clientId} ,function() { + var jqxhr = $.post( baseUrl, {clientId:clientId, color:selectedColor} ,function() { getProjects(); $(dialogProjectEditForm).dialog("close"); }) @@ -68,13 +133,30 @@ }); return false; }); - dialogProjectEditForm = $( "#dialog-project-edit-form" ).dialog({ + var dialogProjectEditForm = $( "#dialog-project-edit-form" ).dialog({ autoOpen: false, - height: 400, - width: 350, + height: 'auto', + width: 'auto', modal: true, create: function( event, ui ) { - //debugger; + + var wrapperEl; + var header; + var footer; + pkedit = new Piklor.Piklor("#color-picker-project-edit", colorArray, { + open: ".picker-wrapper-project-edit .btn" + }) + , wrapperEl = pkedit.getElm(".picker-wrapper-project-edit") + , header = pkedit.getElm("header") + , footer = pkedit.getElm("footer") + ; + pkedit.colorChosen(function (col) { + wrapperEl.style.backgroundColor = col; + //header.style.backgroundColor = col; + $('#project-edit-color').val(col); + //footer.style.backgroundColor = col; + }); + if (isAdmin()){ $(".admin-only").removeClass('hidden'); $('#locked').click(function(){ @@ -85,6 +167,8 @@ } }); + } else { + $(".admin-only").hide(); } @@ -101,7 +185,7 @@ }, dataType: 'json', delay: 250, - results: function (data, page) { //json parse + processResults: function (data) { //json parse return { results: $.map(data.Tags,function(val, i){ return { id: val.id, text:val.name}; @@ -113,30 +197,9 @@ }, cache: false, }, - initSelection: function(element, callback) { - var results; - results = []; + }); - var arr = $(element).val().split(',').map(function (x){ - return parseInt(x); - }); - $.ajax(OC.generateUrl('/apps/timetracker/ajax/tags'), { - dataType: "json" - }).done(function(data) { - $.each(data.Tags, function( index, value ){ - if (arr.includes(value.id) ){ - results.push({ - id: value.id, - text: value.name, - }); - - } - }); - callback(results); - }); - } - }); $("#locked-select-users").select2({ @@ -144,18 +207,22 @@ width: '200px', placeholder: "Select users...", allowClear: true, + results: function(data) { + lastResults = data.results; + return {results: data}; + }, ajax: { headers: { "requesttoken" : oc_requesttoken, }, - url: '/ocs/v2.php/cloud/users/details?offset=0&search=', + url: OC.generateUrl('/ocs/v2.php/cloud/users/details'), formatNoMatches: function() { return ''; }, dataType: 'json', delay: 250, - results: function (data, page) { //json parse + processResults: function (data, page) { //json parse return { results: $.map(data.ocs.data.users,function(val, i){ return { id: i, text:val.displayname}; @@ -167,32 +234,8 @@ }, cache: false, }, - initSelection: function(element, callback) { - - var results; - results = []; - - var arr = $(element).val().split(','); - $.ajax('/ocs/v2.php/cloud/users/details?offset=0&search=', { - dataType: "json" - }).done(function(data) { - - $.map(data.ocs.data.users,function(val, i){ - if ( arr.includes(i) ){ - results.push({ - id: i, - text: val.displayname, - }); - } - return; - }); - - - - callback(results); - }); - } - }); + } + ); @@ -206,7 +249,7 @@ dataType: 'json', delay: 250, - results: function (data, page) { //json parse + processResults: function (data, page) { //json parse return { results: $.map(data.Clients,function(val, i){ return { id: val.id, text:val.name}; @@ -218,25 +261,32 @@ }, cache: false, }, - initSelection: function(element, callback) { - var results; - var jsn = JSON.parse($(element).val()); - - results = []; - if (jsn.clientId != "undefined"){ - results.push({ - id: jsn.clientId, - text: jsn.clientName, - }); - } - - callback(results[0]); - - } }); $('input.select2-input').attr('autocomplete', "xxxxxxxxxxx") }, buttons: { + "Delete project": { text:'Delete project', + click:function(){ + + $("#dialog-confirm").dialog({ + buttons : { + "Confirm" : {click: function() { + deleteProject(dialogProjectEditForm); + $("#dialog-confirm").dialog("close"); + }, + + text: 'Confirm', + class:'primary' + }, + "Cancel" : function() { + $(this).dialog("close"); + } + } + }); + $("#dialog-confirm").dialog('open'); + + + }, class:'redButton admin-only'}, "Edit project": { text:'Edit project', click:function(){ editProject(dialogProjectEditForm); @@ -250,17 +300,25 @@ } }); - form = dialogProjectEditForm.find( "form" ).on( "submit", function( event ) { + var form = dialogProjectEditForm.find( "form" ).on( "submit", function( event ) { event.preventDefault(); editProject(dialogProjectEditForm); }); function editProject(dialogProjectEditForm){ - target = dialogProjectEditForm.target; - form = dialogProjectEditForm.find( "form" ); + var target = dialogProjectEditForm.target; + var form = dialogProjectEditForm.find( "form" ); var baseUrl = OC.generateUrl('/apps/timetracker/ajax/edit-project/'+target.getData().id); - var jqxhr = $.post( baseUrl, {name:form.find("#name").val(), clientId:form.find("#client-select-popup").val(), locked:form.find("#locked").is(':checked')?'1':'0',archived:form.find("#archived").is(':checked')?'1':'0', allowedTags:form.find("#locked-select-tags").val(), allowedUsers:form.find("#locked-select-users").val() },function() { + var jqxhr = $.post( baseUrl, { + name:form.find("#name").val(), + clientId:form.find("#client-select-popup").val(), + color:form.find("#project-edit-color").val(), + locked:form.find("#locked").is(':checked')?'1':'0', + archived:form.find("#archived").is(':checked')?'1':'0', + allowedTags:$("#locked-select-tags").val().join(","), + allowedUsers:$("#locked-select-users").val().join(",") + },function() { getProjects(); $(dialogProjectEditForm).dialog("close"); }) @@ -275,49 +333,32 @@ }); } + function deleteProject(dialogProjectEditForm){ + var target = dialogProjectEditForm.target; + var form = dialogProjectEditForm.find( "form" ); + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/delete-project-with-data/'+target.getData().id); + var jqxhr = $.post( baseUrl, {name:form.find("#name").val(), clientId:form.find("#client-select-popup").val(), locked:form.find("#locked").is(':checked')?'1':'0',archived:form.find("#archived").is(':checked')?'1':'0', allowedTags:form.find("#locked-select-tags").val(), allowedUsers:form.find("#locked-select-users").val() },function() { + getProjects(); + $(dialogProjectEditForm).dialog("close"); + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + }) + .fail(function() { + alert( "error" ); + }); + + } function getProjects(){ var baseUrl = OC.generateUrl('/apps/timetracker/ajax/projects-table'); - // var table = window.kingtable = new KingTable({ - // url: baseUrl, - // lruCacheSize: 0, - // element: document.getElementById("projects"), - // //caption: "KingTable - colors demo with server side pagination (paginated set in memory)", - // id: "projects-table", - // itemCount:false, - // columns: { - // name: { - // displayName:"Name", - // html: function (item){ - // //debugger; - // return "
              "+item.name+"
              "; - // }, - // }, - // client: { - // displayName:"Client", - // }, - // }, - // fields: [ - - // ] - // }); - // table.render().then(function () { - // $('.edit-name').click(function(e) { - // e.preventDefault(); - // dialogProjectEditForm.target = e.target; - - // form = dialogProjectEditForm.find( "form" ) - // form.find("#name").val($(e.target).data("name")); - // debugger; - // //form.find("#client-select-popup").val($(e.target).data("client-id")).trigger('change');; - // form.find("#client-select-popup").select2("val",'{"clientId": "'+$(e.target).data("client-id")+'", "clientName":"'+$(e.target).data("client-name")+'"}'); - - // dialogProjectEditForm.dialog("open"); - // }) - - // }); + var columns = [ //{title:"Id", field:"id", width:100}, //column has a fixed width of 100px; {title:"#", field:"", formatter:"rownum", width: 40, align: "center"}, + {title:"Color", field:"color", formatter:"color", width: 40}, //column will be allocated 1/5 of the remaining space {title:"Name", field:"name", widthGrow:1}, //column will be allocated 1/5 of the remaining space {title:"Client", field:"client", widthGrow:1}, //column will be allocated 1/5 of the remaining space {title:"Locked", field:"locked", widthGrow:1, formatter:"tickCross"}, //column will be allocated 1/5 of the remaining space @@ -352,25 +393,77 @@ form = dialogProjectEditForm.find( "form" ) form.find("#name").val(row.getData().name); - + form.find("#project-edit-color").val(row.getData().color); + pkedit.set(row.getData().color); //form.find("#client-select-popup").val($(e.target).data("client-id")).trigger('change'); var clientSelectData = { clientId: row.getData().clientId, clientName: row.getData().client, }; - // var tagSelectData = [{ - // allowedTags: row.getData().allowedTags, - - // }]; + if (clientSelectData.clientId != null){ + $('#client-select-popup').append( + '' + ); + $("#client-select-popup").trigger('change'); + } - form.find("#client-select-popup").select2("val",JSON.stringify(clientSelectData)); form.find("#archived").prop('checked', row.getData().archived); if (isAdmin()){ var tags = row.getData().origAllowedTags.map(function(e){ return e.id;}); var users = row.getData().allowedUsers; - form.find("#locked-select-tags").select2("val",tags); - form.find("#locked-select-users").select2("val",users); + + $.ajax(OC.generateUrl('/apps/timetracker/ajax/tags'), { + dataType: "json" + }).done(function(data) { + $('#locked-select-tags').html(''); + $.each(data.Tags, function( index, value ){ + if (tags.includes(value.id) ){ + var option = new Option(value.name, value.id, true, true); + $('#locked-select-tags').append(option).trigger('change'); + + } + } + ); + $('#locked-select-tags').trigger({ + type: 'select2:select', + params: { + data: data + } + }); + + }); + + $.ajax(OC.generateUrl('/ocs/v2.php/cloud/users/details'), { + dataType: "json", + headers: { + "requesttoken" : oc_requesttoken, + + }, + }).done(function(data) { + + var userMap = $.map(data.ocs.data.users,function(val, i){ + return { id: i, text:val.displayname}; + }); + + $('#locked-select-users').val(null).trigger('change'); + $('#locked-select-users').html(''); + $.each(userMap, function( index, value ){ + if (users.includes(value.text) ){ + var option = new Option(value.text, value.id, true, true); + $('#locked-select-users').append(option).trigger('change'); + + } + } + ); + $('#locked-select-users').trigger({ + type: 'select2:select', + params: { + data: data + } + }); + }); + form.find("#locked").prop('checked', row.getData().locked); if($('#locked').is(':checked')){ $("#locked-options").removeClass('hidden'); @@ -391,4 +484,4 @@ } ); -}()); \ No newline at end of file +}()); diff --git a/js/src/reports.js b/js/src/reports.js new file mode 100644 index 0000000..a154de1 --- /dev/null +++ b/js/src/reports.js @@ -0,0 +1,296 @@ +var $ = require("jquery"); +require("jquery-migrate"); +// var moment = require("moment"); +require("jqueryui"); +//require("jqueryui/jquery-ui.css"); +require("daterangepicker"); +import Tabulator from 'tabulator-tables'; +require('tabulator-tables/dist/css/tabulator.css'); +require('daterangepicker/daterangepicker.css'); +import 'select2/dist/js/select2.full.js' +require('select2/dist/css/select2.css'); +require('../../css/style.css'); + +var dtf = require("./dateformat.js"); + +(function() { + $.ajaxSetup({ + headers: { 'RequestToken': OC.requestToken } + }); + $( function() { + + var group1 = "project"; + var group2 = "user"; + var group3 = "day"; + var filterProjectId = ""; + var filterClientId = ""; + + $(document).ready(function() { + $("#dialog-confirm").dialog({ + autoOpen: false, + modal: true + }); + + var start = moment().subtract(29, 'days'); + var end = moment(); + function cb(start, end) { + $('#report-range span').html(start.format(dtf.dformat()) + ' - ' + end.format(dtf.dformat())); + } + $("#report-range").daterangepicker({ + timePicker: false, + startDate: start, + endDate: end, + ranges: { + 'Today': [moment(), moment()], + 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], + 'Last 7 Days': [moment().subtract(6, 'days'), moment()], + 'Last 30 Days': [moment().subtract(29, 'days'), moment()], + 'Last 90 Days': [moment().subtract(89, 'days'), moment()], + 'Last 365 Days': [moment().subtract(364, 'days'), moment()], + 'This Month': [moment().startOf('month'), moment().endOf('month')], + 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')], + 'The Month Before Last': [moment().subtract(2, 'month').startOf('month'), moment().subtract(2, 'month').endOf('month')], + 'This Year': [moment().startOf('year'), moment().endOf('year')], + 'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')], + + }, + locale: { + format: dtf.dformat(), + firstDay: firstDay + } + },cb); + $("#report-range").on('apply.daterangepicker', function(ev, picker) { + start = picker.startDate; + end = picker.endDate; + getReport(); + }); + cb(start, end); + $("#group1").select2(); + $("#group2").select2(); + $("#group3").select2(); + $('#group1').on("select2:select select2:unselect", function(e) { + group1 = e.params.data.id; + getReport(); + }); + $('#group2').on("select2:select select2:unselect", function(e) { + group2 = e.params.data.id; + getReport(); + }); + $('#group3').on("select2:select select2:unselect", function(e) { + group3 = e.params.data.id; + getReport(); + }); + getReport(); + $("#filter-project").select2({ + width: '200px', + escapeMarkup : function(markup) { return markup; }, + placeholder: "Select project", + allowClear: true, + templateResult: function formatState (project) { + var color = '#ffffff'; + if (project.color) { + color = project.color; + } + var $state = $( + '' + project.text + '' + ); + return $state; + }, + ajax: { + tags: true, + url: OC.generateUrl('/apps/timetracker/ajax/projects'), + + dataType: 'json', + delay: 250, + + processResults: function (data, page) { //json parse + return { + results: $.map(data.Projects,function(val, i){ + return { id: val.id, text:val.name, color: val.color}; + }), + pagination: { + more: false, + } + }; + }, + cache: false, + + }, + }); + + $('#filter-project').on("select2:select select2:unselect", function(e) { + + + filterProjectId = ($(e.target).val() != null)? $(e.target).val() : ""; + getReport(); + }); + + + + $("#filter-client").select2({ + tags: true, + width: '200px', + escapeMarkup : function(markup) { return markup; }, + placeholder: "Select client", + allowClear: true, + ajax: { + tags: true, + url: OC.generateUrl('/apps/timetracker/ajax/clients'), + + dataType: 'json', + delay: 250, + processResults: function (data, page) { //json parse + return { + results: $.map(data.Clients,function(val, i){ + return { id: val.id, text:val.name}; + }), + pagination: { + more: false, + } + }; + }, + cache: false, + + }, + }); + + + $('#filter-client').on("select2:select select2:unselect", function(e) { + + + filterClientId = ($(e.target).val() != null)? $(e.target).val() : ""; + getReport(); + }); + + + $('input.select2-input').attr('autocomplete', "xxxxxxxxxxx"); + + + + function getReport(){ + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/report?name=&from='+start.unix()+'&to='+end.unix()+'&group1='+group1+'&group2='+group2+'&timegroup='+group3+'&filterProjectId='+filterProjectId+'&filterClientId='+filterClientId); + function pad(n, width, z) { + z = z || '0'; + n = n + ''; + return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; + } + var endedAccessor = function(value, data, type, params, column){ + if (group1 != '' || group2 != '' || group3 != ''){ + return '*'; + } + return moment(data.time, dtf.dtformat()).add(moment.duration(data.totalDuration)).format(dtf.dtformat()); + } + var totalDurationAccessor = function(value, data, type, params, column){ + var s = Math.floor( (data.totalDuration) % 60 ); + var m = Math.floor( (data.totalDuration/60) % 60 ); + var h = Math.floor( (data.totalDuration/(60*60))); + return pad(h,2) + ':' + pad(m,2) + ':' + pad(s,2); + } + var whenAccessor = function(value, data, type, params, column){ + switch(group3) { + case 'day': + return moment.unix(value).format(dtf.dformat()); + case 'month': + return moment.unix(value).format(dtf.mformat()); + case 'week': + return moment.unix(value).format('YYYY[W]W'); + case 'year': + return moment.unix(value).format('YYYY'); + default: + return moment.unix(value).format(dtf.dtformat()); + } + } + var nullCheckAccessor = function(value, data, type, params, column){ + return value ? value : ''; + } + + var money = function(value, data, type, params, component) { + return value / 100; + } + var table = new Tabulator("#report", { + ajaxURL:baseUrl, + layout:"fitColumns", + columns:[ + //{title:"Id", field:"id", width:100}, //column has a fixed width of 100px; + {title:"#", field:"id", formatter:"rownum"}, + {title:"Name", field:"name", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"Details", field:"details", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"User", field:"userUid", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"Project", field:"project",accessorDownload:nullCheckAccessor, widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"Client", field:"client",accessorDownload:nullCheckAccessor, widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"When", field:"time", widthGrow:1,accessorDownload:whenAccessor,formatter:function(cell, formatterParams, onRendered){ + var t = cell.getValue(); + switch(group3) { + case 'day': + return moment.unix(t).format(dtf.dformat()); + case 'month': + return moment.unix(t).format(dtf.mformat()); + case 'week': + return moment.unix(t).format('YYYY[W]W'); + case 'year': + return moment.unix(t).format('YYYY'); + default: + return moment.unix(t).format(dtf.dtformat()); + } + }}, + {title:"Cost", field:"cost", mutator:money, accessorDownload: nullCheckAccessor, widthGrow:1, bottomCalc: "sum", formatter: "money", bottomCalcFormatter: "money"}, //column will be allocated 1/5 of the remaining space + {title:"Total Duration", field:"totalDuration",accessorDownload:totalDurationAccessor,formatter:function(cell, formatterParams, onRendered){ + //cell - the cell component + //formatterParams - parameters set for the column + //onRendered - function to call when the formatter has been rendered + var duration = cell.getValue(); + var s = Math.floor( (duration) % 60 ); + var m = Math.floor( (duration/60) % 60 ); + var h = Math.floor( (duration/(60*60))); + return pad(h,2) + ':' + pad(m,2) + ':' + pad(s,2); + + },bottomCalc:"sum", bottomCalcParams:{ + precision:1, + },bottomCalcFormatter:function(cell, formatterParams, onRendered){ + //cell - the cell component + //formatterParams - parameters set for the column + //onRendered - function to call when the formatter has been rendered + var duration = cell.getValue(); + var s = Math.floor( (duration) % 60 ); + var m = Math.floor( (duration/60) % 60 ); + var h = Math.floor( (duration/(60*60))); + + return pad(h,2) + ':' + pad(m,2) + ':' + pad(s,2); + + }}, //column will be allocated 1/5 of the remaining space + {title:"Ended", field:"ended",visible:false,accessorDownload:endedAccessor,formatter:function(cell, formatterParams, onRendered){ + //cell - the cell component + //formatterParams - parameters set for the column + //onRendered - function to call when the formatter has been rendered + if (group1 != '' || group2 != '' || group3 != ''){ + return '*'; + } + var time = cell.getRow().getData().time; + var duration = cell.getRow().getData().totalDuration; + return moment.unix(parseInt(time) + parseInt(duration)).format(dtf.dtformat()); + + }}, + ], + ajaxResponse:function(url, params, response){ + + return response.items; //return the tableData property of a response json object + }, + }); + $("#download-csv").off().click(function(){ + table.showColumn("ended"); + table.download("csv", "data.csv"); + table.hideColumn("ended"); + return false; + }); + $("#download-json").off().click(function(){ + table.showColumn("ended"); + table.download("json", "data.json"); + table.hideColumn("ended"); + return false; + }); + } + }); + + + } ); +}()); diff --git a/js/tags.js b/js/src/tags.js similarity index 87% rename from js/tags.js rename to js/src/tags.js index 8e594f2..5cf547b 100644 --- a/js/tags.js +++ b/js/src/tags.js @@ -1,6 +1,15 @@ - - +var $ = require("jquery"); +require("jquery-migrate"); +// var moment = require("moment"); +require("jqueryui"); +//require("jqueryui/jquery-ui.css"); +import Tabulator from 'tabulator-tables'; +require('tabulator-tables/dist/css/tabulator.css'); +require('../../css/style.css'); (function() { + $.ajaxSetup({ + headers: { 'RequestToken': OC.requestToken } + }); $( function() { @@ -31,10 +40,10 @@ }) return false; }); - dialogTagEditForm = $( "#dialog-tag-edit-form" ).dialog({ + var dialogTagEditForm = $( "#dialog-tag-edit-form" ).dialog({ autoOpen: false, - height: 400, - width: 350, + height: 'auto', + width: 'auto', modal: true, buttons: { "Edit tag": {click: function(){ @@ -53,15 +62,15 @@ } }); - form = dialogTagEditForm.find( "form" ).on( "submit", function( event ) { + var form = dialogTagEditForm.find( "form" ).on( "submit", function( event ) { event.preventDefault(); editTag(dialogTagEditForm); }); getTags(); function editTag(dialogTagEditForm){ - target = dialogTagEditForm.target; - form = dialogTagEditForm.find( "form" ); + var target = dialogTagEditForm.target; + var form = dialogTagEditForm.find( "form" ); var baseUrl = OC.generateUrl('/apps/timetracker/ajax/edit-tag/'+target); var jqxhr = $.post( baseUrl, {name:form.find("#name").val()},function() { getTags(); diff --git a/js/timelines-admin.js b/js/src/timelines-admin.js similarity index 90% rename from js/timelines-admin.js rename to js/src/timelines-admin.js index a8cfe2e..aba2afe 100644 --- a/js/timelines-admin.js +++ b/js/src/timelines-admin.js @@ -1,6 +1,19 @@ -(function() { +var $ = require("jquery"); +require("jquery-migrate"); +// var moment = require("moment"); +require("jqueryui"); +//require("jqueryui/jquery-ui.css"); +import Tabulator from 'tabulator-tables'; +require('tabulator-tables/dist/css/tabulator.css'); +import 'select2/dist/js/select2.full.js' +require('select2/dist/css/select2.css'); +require('../../css/style.css'); +(function() { + $.ajaxSetup({ + headers: { 'RequestToken': OC.requestToken } + }); function timeConverter(UNIX_timestamp){ var a = new Date(UNIX_timestamp * 1000); var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; @@ -32,8 +45,8 @@ function editTimeline(dialogTimelineEditForm){ - target = dialogTimelineEditForm.target; - form = dialogTimelineEditForm.find( "form" ); + var target = dialogTimelineEditForm.target; + var form = dialogTimelineEditForm.find( "form" ); var baseUrl = OC.generateUrl('/apps/timetracker/ajax/edit-timeline/'+target.getData().id); var jqxhr = $.post( baseUrl, {status:form.find("#status").val()},function() { getTimelines(); @@ -51,10 +64,10 @@ } - dialogTimelineEditForm = $( "#dialog-timeline-edit-form" ).dialog({ + var dialogTimelineEditForm = $( "#dialog-timeline-edit-form" ).dialog({ autoOpen: false, - height: 400, - width: 350, + height: 'auto', + width: 'auto', modal: true, create: function( event, ui ) { @@ -137,7 +150,6 @@ //cell - the cell component //formatterParams - parameters set for the column //onRendered - function to call when the formatter has been rendered - //debugger; var baseUrl = OC.generateUrl('/apps/timetracker/ajax/download-timeline/'+cell.getRow().getData()["id"]); return ''+"Download"+''; @@ -147,7 +159,6 @@ {formatter:editIcon, width:40, align:"center", cellClick:function(e, cell){ dialogTimelineEditForm.target = cell.getRow(); - //debugger; dialogTimelineEditForm.find('#status').val(cell.getRow().getData().status); dialogTimelineEditForm.dialog("open"); return false; @@ -166,4 +177,4 @@ } ); -}()); \ No newline at end of file +}()); diff --git a/js/timelines.js b/js/src/timelines.js similarity index 59% rename from js/timelines.js rename to js/src/timelines.js index 02a81fc..2fe0166 100644 --- a/js/timelines.js +++ b/js/src/timelines.js @@ -1,4 +1,22 @@ +var $ = require("jquery"); +require("jquery-migrate"); +// var moment = require("moment"); +require("jqueryui"); +//require("jqueryui/jquery-ui.css"); +import Tabulator from 'tabulator-tables'; +require('tabulator-tables/dist/css/tabulator.css'); +require("daterangepicker"); +require('daterangepicker/daterangepicker.css'); +import 'select2/dist/js/select2.full.js' +require('select2/dist/css/select2.css'); +require('../../css/style.css'); + +var dtf = require("./dateformat.js"); + (function() { + $.ajaxSetup({ + headers: { 'RequestToken': OC.requestToken } + }); $( function() { @@ -8,7 +26,6 @@ var filterProjectId = ""; var filterClientId = ""; - function timeConverter(UNIX_timestamp){ var a = new Date(UNIX_timestamp * 1000); var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; @@ -31,7 +48,7 @@ var start = moment().subtract(29, 'days'); var end = moment(); function cb(start, end) { - $('#report-range span').html(start.format('DD/MM/YY') + ' - ' + end.format('DD/MM/YY')); + $('#report-range span').html(start.format(dtf.dformat()) + ' - ' + end.format(dtf.dformat())); } $("#report-range").daterangepicker({ timePicker: false, @@ -52,7 +69,8 @@ }, locale: { - format: 'DD/MM/YY' + format: dtf.dformat(), + firstDay: firstDay } },cb); $("#report-range").on('apply.daterangepicker', function(ev, picker) { @@ -64,16 +82,17 @@ $("#group1").select2(); $("#group2").select2(); $("#group3").select2(); - $('#group1').on("change", function(e) { - group1 = e.val; + $('#group1').on("select2:select select2:unselect", function(e) { + + group1 = (e.params.data.id != null)? e.params.data.id : ""; getReport(); }); - $('#group2').on("change", function(e) { - group2 = e.val; + $('#group2').on("select2:select select2:unselect", function(e) { + group2 = (e.params.data.id != null)? e.params.data.id : ""; getReport(); }); - $('#group3').on("change", function(e) { - group3 = e.val; + $('#group3').on("select2:select select2:unselect", function(e) { + group3 = (e.params.data.id != null)? e.params.data.id : ""; getReport(); }); getReport(); @@ -84,16 +103,26 @@ escapeMarkup : function(markup) { return markup; }, placeholder: "Select project", allowClear: true, + templateResult: function formatState (project) { + var color = '#ffffff'; + if (project.color) { + color = project.color; + } + var $state = $( + '' + project.text + '' + ); + return $state; + }, ajax: { tags: true, url: OC.generateUrl('/apps/timetracker/ajax/projects'), dataType: 'json', delay: 250, - results: function (data, page) { //json parse + processResults: function (data, page) { //json parse return { results: $.map(data.Projects,function(val, i){ - return { id: val.id, text:val.name}; + return { id: val.id, text:val.name, color: val.color}; }), pagination: { more: false, @@ -103,22 +132,12 @@ cache: false, }, - initSelection: function(element, callback) { - - var results; - results = []; - results.push({ - id: projectId, - text: projectName, - }); - - callback(results[0]); - } }); $("#filter-project").on("change", function (e) { - filterProjectId = $(e.target).val(); + filterProjectId = ($(e.target).val() != null)? $(e.target).val() : ""; + getReport(); }); @@ -136,7 +155,7 @@ dataType: 'json', delay: 250, - results: function (data, page) { //json parse + processResults: function (data, page) { //json parse return { results: $.map(data.Clients,function(val, i){ return { id: val.id, text:val.name}; @@ -149,22 +168,12 @@ cache: false, }, - initSelection: function(element, callback) { - - var results; - results = []; - results.push({ - id: clientId, - text: clientName, - }); - - callback(results[0]); - } }); $("#filter-client").on("change", function (e) { - filterClientId = $(e.target).val(); + + filterClientId = ($(e.target).val() != null)? $(e.target).val() : ""; getReport(); }); $('input.select2-input').attr('autocomplete', "xxxxxxxxxxx"); @@ -173,6 +182,11 @@ function getReport(){ var baseUrl = OC.generateUrl('/apps/timetracker/ajax/report?name=&from='+start.unix()+'&to='+end.unix()+'&group1='+group1+'&group2='+group2+'&timegroup='+group3+'&filterProjectId='+filterProjectId+'&filterClientId='+filterClientId); + function pad(n, width, z) { + z = z || '0'; + n = n + ''; + return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; + } var table = new Tabulator("#report", { ajaxURL:baseUrl, layout:"fitColumns", @@ -183,7 +197,21 @@ {title:"User", field:"userUid", widthGrow:1}, //column will be allocated 1/5 of the remaining space {title:"Project", field:"project", widthGrow:1}, //column will be allocated 1/5 of the remaining space {title:"Client", field:"client", widthGrow:1}, //column will be allocated 1/5 of the remaining space - {title:"When", field:"time", widthGrow:1}, //column will be allocated 1/5 of the remaining space + {title:"When", field:"time", widthGrow:1, formatter:function(cell, formatterParams, onRendered){ + var t = cell.getValue(); + switch(group3) { + case 'day': + return moment.unix(t).format(dtf.dformat()); + case 'month': + return moment.unix(t).format(dtf.mformat()); + case 'week': + return moment.unix(t).format('YYYY[W]W'); + case 'year': + return moment.unix(t).format('YYYY'); + default: + return moment.unix(t).format(dtf.dtformat()); + } + }}, {title:"Total Duration", field:"totalDuration",formatter:function(cell, formatterParams, onRendered){ //cell - the cell component //formatterParams - parameters set for the column @@ -193,7 +221,7 @@ var m = Math.floor( (duration/60) % 60 ); var h = Math.floor( (duration/(60*60))); - return h + ':' + m + ':' + s; + return pad(h,2) + ':' + pad(m,2) + ':' + pad(s,2); },}, //column will be allocated 1/5 of the remaining space ], @@ -219,6 +247,23 @@ }); return false; }); + $("#timeline-csv-email").off().click(function(){ + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/email-timeline'); + $.post(baseUrl, // url + { + from: start.unix(), + to: end.unix(), + group1: group1, + group2: group2, + timegroup: group3, + filterProjectId: filterProjectId, + filterClientId: filterClientId + }, // data to be submit + function(data, status, jqXHR) {// success callback + getTimelines(); + }); + return false; + }); } @@ -271,12 +316,91 @@ //cell - the cell component //formatterParams - parameters set for the column //onRendered - function to call when the formatter has been rendered - //debugger; var baseUrl = OC.generateUrl('/apps/timetracker/ajax/download-timeline/'+cell.getRow().getData()["id"]); return ''+"Download"+''; }}, + {title:"Email", field:"", formatter:"rownum",formatter:function(cell, formatterParams, onRendered){ + //cell - the cell component + //formatterParams - parameters set for the column + //onRendered - function to call when the formatter has been rendered + + + return 'Email'; + + },cellClick:function(e, cell){ + $("#dialog-send-email-form").dialog({ + buttons : { + "Confirm" : { + click: function() { + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/email-timeline/'+cell.getRow().getData().id); + + var jqxhr = $.post( baseUrl, { + email:$('#email-address').val(), + subject:$('#email-subject').val(), + content:$('#email-content').val(), + }, function() { + $("#dialog-send-email-form").dialog("close"); + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + }) + .fail(function() { + alert( "error" ); + }) + return false; + }, + text: 'Confirm', + class:'primary' + }, + "Cancel" : function() { + $(this).dialog("close"); + } + } + }); + $("#dialog-send-email-form").dialog('open'); + + //cell.getRow().delete(); + } + }, + {formatter:"buttonCross", width:40, align:"center", cellClick:function(e, cell){ + $("#dialog-confirm").dialog({ + buttons : { + "Confirm" : { + click: function() { + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/delete-timeline/'+cell.getRow().getData().id); + var jqxhr = $.post( baseUrl, function() { + getTimelines(); + $("#dialog-confirm").dialog("close"); + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + }) + .fail(function() { + alert( "error" ); + }) + return false; + }, + text: 'Confirm', + class:'primary' + }, + "Cancel" : function() { + $(this).dialog("close"); + } + } + }); + $("#dialog-confirm").dialog('open'); + + //cell.getRow().delete(); + } + }, ], ajaxResponse:function(url, params, response){ @@ -290,4 +414,4 @@ } ); -}()); \ No newline at end of file +}()); diff --git a/js/src/timer.js b/js/src/timer.js new file mode 100644 index 0000000..ef991fe --- /dev/null +++ b/js/src/timer.js @@ -0,0 +1,678 @@ +var $ = require("jquery"); +require("jquery-migrate"); +require("daterangepicker"); +var moment = require("moment"); +require("jqueryui"); +//require("jqueryui/jquery-ui.css"); +//import 'select2/dist/js/select2.full.js' +import 'select2/dist/js/select2.full.js' +require('select2/dist/css/select2.css'); +require('daterangepicker/daterangepicker.css'); +require('../../css/style.css'); + +var dtf = require("./dateformat.js"); + +( + + +function() { + + $.ajaxSetup({ + headers: { 'RequestToken': OC.requestToken } + }); + /*select2($);*/ + + + + $( function() { + $('#work-input-form').on('submit', function(e) { + e.preventDefault(); + createWorkItem($(this)); + }); + var days='30'; + var start = moment().startOf('day').subtract(29, 'days'); + var end = moment().endOf('day'); + + function cb(start, end) { + $('#report-range span').html(start.format(dtf.dformat()) + ' - ' + end.format(dtf.dformat())); + } + $("#report-range").daterangepicker({ + timePicker: false, + startDate: start, + endDate: end, + ranges: { + 'Today': [moment().startOf('day'), moment().endOf('day')], + 'Last 7 Days': [moment().startOf('day').subtract(6, 'days'), moment().endOf('day')], + 'Last 30 Days': [moment().startOf('day').subtract(29, 'days'), moment().endOf('day')], + 'Last 90 Days': [moment().startOf('day').subtract(89, 'days'), moment().endOf('day')], + 'Last 365 Days': [moment().startOf('day').subtract(364, 'days'), moment().endOf('day')], + 'This Month': [moment().startOf('month'), moment().endOf('day')], + 'This Year': [moment().startOf('year'), moment().endOf('day')], + 'Starting last year': [moment().startOf('year').subtract(1, 'year'), moment().endOf('day')], + 'Last 3 years': [moment().startOf('day').subtract(3, 'year'), moment().endOf('day')], + 'Last 5 years': [moment().startOf('day').subtract(5, 'year'), moment().endOf('day')], + }, + locale: { + format: dtf.dformat(), + firstDay: firstDay + } + },cb); + $("#report-range").on('apply.daterangepicker', function(ev, picker) { + start = picker.startDate; + end = picker.endDate; + getWorkItems(); + }); + cb(start, end); + + var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' + }; + + function escapeHtml (string) { + return String(string).replace(/[&<>"'`=\/]/g, function (s) { + return entityMap[s]; + }); + } + + getWorkItems(); + var timerInterval; + var dialogWorkItemEditForm = $( "#dialog-work-item-edit-form" ).dialog({ + autoOpen: false, + height: 'auto', + width: 'auto', + modal: true, + buttons: { + "Edit work item": function(){ + editWorkIntem(dialogWorkItemEditForm); + }, + Cancel: function() { + dialogWorkItemEditForm.dialog( "close" ); + } + }, + close: function() { + var form = dialogWorkItemEditForm.find( "form" ); + form[ 0 ].reset(); + } + }); + var picker = $("#hours-manual-entry").daterangepicker({ + timePicker: true, + timePicker24Hour: true, + locale: { + format: dtf.dtformat(), + firstDay: firstDay + } + }); + function validateManualEntryFields(){ + if($('#name-manual-entry').val() == ''){ + $("#confirm-button").button("option", "disabled", true); + } else { + $("#confirm-button").button("option", "disabled", false); + } + } + $('#name-manual-entry').on('input',function() { + + validateManualEntryFields(); + }); + + $("#dialog-manual-entry").dialog({ + autoOpen: false, + buttons : + [ { + id: 'confirm-button', + text: "Confirm", + click: function() { + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/add-work-interval/'+encodeURIComponent(encodeURIComponent($('#name-manual-entry').val()))); // encode twice so we can have slashes + var jqxhr = $.post( baseUrl, + { + start:picker.data('daterangepicker').startDate.format('DD/MM/YY HH:mm'), + end:picker.data('daterangepicker').endDate.format('DD/MM/YY HH:mm'), + tzoffset: new Date().getTimezoneOffset(), + async: true, + details:$('#details-manual-entry').val()} ,function() { + getWorkItems(); + $("#dialog-manual-entry").dialog("close"); + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + }) + .fail(function() { + alert( "error" ); + }) + }, + }, + { + id: 'cancel-button', + text: "Cancel", + click: function() { + $(this).dialog("close"); + }, + }, + ] + + }); + + $('#manual-entry-button').click(function(e) { + $("#hours-manual-entry").val(''); + $("#dialog-manual-entry").dialog("open"); + return false; + }); + validateManualEntryFields(); + + function editWorkIntem(dialogWorkItemEditForm){ + var target = dialogWorkItemEditForm.target; + var form = dialogWorkItemEditForm.find( "form" ); + var id = $(target).data('myid'); + var baseUrl = OC.generateUrl("/apps/timetracker/ajax/update-work-interval/"+id); + var jqxhr = $.post( baseUrl, {name:form.find("#name").val(),details:form.find("#details").val()},function() { + getWorkItems(); + $(dialogWorkItemEditForm).dialog("close"); + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + }) + .fail(function() { + alert( "error" ); + }) + .always(function() { + + }); + + } + function cutString(s, n){ + if (s.length < n) { + return s; + } + return s.substring(0, n - 4) + ' ...'; + } + function secondsToTimer(s){ + function pad(num, size) { + var s = num+""; + while (s.length < size) s = "0" + s; + return s; + } + var secondsInDay = 60*60*24; + var secondsInHour = 60*60; + var secondsInMinute = 60; + + var days = Math.floor(s/secondsInDay); + var hours = Math.floor((s-days*secondsInDay)/secondsInHour); + var minutes = Math.floor((s-days*secondsInDay-hours*secondsInHour)/secondsInMinute); + var seconds = s % 60; + if (days > 0){ + return days + " days "+pad(hours,2)+':'+pad(minutes,2)+':'+pad(seconds,2); + } else { + return pad(hours,2)+':'+pad(minutes,2)+':'+pad(seconds,2); + } + } + function tsToHour(ts) { + return moment.unix(ts).format(dtf.tformat()); + } + function getWorkItems() { + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/work-intervals?from='+start.unix()+'&to='+end.unix()+'&tzoffset='+new Date().getTimezoneOffset()); + $.ajaxSetup({ + scriptCharset: "utf-8", + //contentType: "application/json; charset=utf-8" + }); + $.getJSON( baseUrl, function( data ) { + + if (data.running.length > 0){ + localStorage.setItem('isTimerStarted', true); + localStorage.setItem('timerStartTime', data.running[0].start); + var now = Math.floor(Date.now() / 1000); + localStorage.setItem('timerStartTimeLocal', data.running[0].start + now - data.now ); + $('#start-tracking > span').addClass("stop-button").removeClass("play-button"); + timerInterval = setInterval(function() { + if (localStorage.getItem('isTimerStarted') === 'false'){ + clearInterval(timerInterval); + return; + } + var timerStartTimeLocal = localStorage.getItem('timerStartTimeLocal'); + var now = Math.floor(Date.now() / 1000); + + $('#timer').html(secondsToTimer(now - timerStartTimeLocal)); + }, 1000); + } else { + clearInterval(timerInterval); + localStorage.setItem('isTimerStarted', false); + $('#timer').html(secondsToTimer(0)); + $('#start-tracking > span').addClass("play-button").removeClass("stop-button"); + } + + + var days = []; + $.each( data.days, function( dayName, dayMap ) { + + var dayItems = []; + $.each(dayMap, function (dayItemName, workItem){ + var children = []; + + $.each(workItem.children, function (ckey, child){ + var cost = '' + if (child.cost !== 0) { var cost = (child.cost / 100).toFixed(2) } + children.push( + "
            • "+ + "
              "+ + "
              "+ + "
              "+escapeHtml(cutString(child.name,64))+ + "
              "+escapeHtml(cutString(child.details,64))+"
              "+ + "
              "+ + ""+ + ""+ + ""+ + "
              "+ + "
              "+ + tsToHour(child.start)+" - "+((child.running == 1)?'':tsToHour(child.start+child.duration))+ + "
              "+ + "
              "+((child.running == 1)?'running...':secondsToTimer(child.duration))+"
              "+ + "
              "+ + ""+ + "
              "+ + "
              "+ + "
              "+ + "
            • "); + }); + + + dayItems.push("
              "+ + "
                "+ + "
              • "+ + "
                "+ + ((children.length == 1)?"
                 
                ":"
                "+children.length+"
                ")+ + "
                "+ + cutString(dayItemName,128)+ + "
                "+ + "
                "+secondsToTimer(workItem.totalTime)+ + "
                "+ + "
                "+ + "
              • "+ + children.join("")+ + "
              "+ + "
              "); + }); + days.push( "
              "+ + "
                "+ + "
              • " + + "
                " + dayName +"
                "+ + dayItems.join("") + + "
              • "+ + "
              "+ + "
              " ); + }); + + $("#work-intervals").html($( "
              ", { + "class": "my-new-list", + html: days.join( "" ) + })); + + $(".cost").focusout(function(e) { + e.preventDefault(); + var input = $(this); + var cost = $(this).val(); + var id = $(e.target).data('myid'); + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/add-cost/' + id); + if (cost !== undefined) { + $.post(baseUrl, {cost: cost}, 'json').done(function (e) { + input.css('border', 'solid 1px green'); + setTimeout(function () { + input.css('border', ''); + }, 3000); + }).fail(function (xhr, status, error) { + var errorMessage = JSON.parse(xhr.responseText); + if (errorMessage.error !== undefined) { + alert(errorMessage.error); + } + input.css('border', 'solid 1px red'); + }); + } + }); + + $(".wi-child-hours").each(function(){ + $(this).daterangepicker({ + timePicker: true, + startDate:moment.unix($(this).data('start-date')).format(dtf.dtformat()), + endDate:moment.unix($(this).data('end-date')).format(dtf.dtformat()), + timePicker24Hour: true, + locale: { + format: dtf.dtformat(), + firstDay: firstDay + } + }); + + $(this).on('apply.daterangepicker', function(ev, picker) { + var id = $(this).data('myid'); + var jqxhr = $.post( "ajax/update-work-interval/"+id,{start:picker.startDate.format('DD/MM/YY HH:mm'), end:picker.endDate.format('DD/MM/YY HH:mm'), tzoffset: new Date().getTimezoneOffset()}, function() { + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + getWorkItems(); + }) + .fail(function() { + alert( "error" ); + }) + .always(function() { + }); + }); + }); + $('.wi-child-name').click(function(e) { + e.preventDefault(); + dialogWorkItemEditForm.target = e.target; + + var form = dialogWorkItemEditForm.find( "form" ) + form.find("#name").val($(e.target).data("name")); + form.find("#details").val($(e.target).data("details")); + dialogWorkItemEditForm.dialog("open"); + return false; + + }) + $('.wi-play').click(function(e) { + e.preventDefault(); + createWorkItem($(this)); + }); + + $('.wi-resume').click(function(e) { + e.preventDefault(); + resumeWorkItem($(this)); + }); + $('.wi-trash').click(function(e) { + $("#dialog-confirm").dialog({ + buttons : { + "Confirm" : function() { + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/delete-work-interval/'+e.target.id); + var jqxhr = $.post( baseUrl, function() { + getWorkItems(); + $("#dialog-confirm").dialog("close"); + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + }) + .fail(function() { + alert( "error" ); + }) + }, + "Cancel" : function() { + $(this).dialog("close"); + } + } + }); + $("#dialog-confirm").dialog("open"); + return false; + }); + + var projectsAjaxUrl = OC.generateUrl('/apps/timetracker/ajax/projects'); + $(".set-project").each(function(){ + //var interval = setInterval( function() { + + var id = $(this).data('myid'); + var projectId = $(this).data('projectid'); + var projectColor = $(this).data('projectcolor'); + + $(this).select2({ + containerCssClass:'project-select', + escapeMarkup : function(markup) { return markup; }, + placeholder: "", + allowClear: true, + templateResult: function formatState (project) { + var color = '#ffffff'; + if (project.color) { + color = project.color; + } + var $state = $( + '' + project.text + '' + ); + return $state; + }, + templateSelection: function formatState (project) { + var color = '#ffffff'; + if (projectColor) { + color = projectColor; + } + var $state = $( + '' + project.text + '' + ); + return $state; + }, + ajax: { + url: projectsAjaxUrl, + + dataType: 'json', + delay: 250, + processResults: function (data) { //json parse + return { + results: $.map(data.Projects,function(val, i){ + return { id: val.id, text:val.name, color: val.color}; + }), + pagination: { + more: false, + } + }; + }, + cache: false, + + }, + }); + $(this).data('myid',id); + + $(this).val(projectId).trigger('change'); + //clearInterval(interval); + //}.bind(this),0); + }); + + var tagsAjaxUrl = OC.generateUrl('/apps/timetracker/ajax/tags'); + $(".set-tag").each(function(){ + //var interval = setInterval( function() { + + + $(this).select2({ + tags: true, + containerCssClass:'tags-select', + placeholder: "Select tags...", + allowClear: true, + + ajax: { + url: function () { return tagsAjaxUrl+'?workItem='+$(this).data('myid');}, + data: function (params){ + var query = { + q: params.term, + type: 'public' + } + + // Query parameters will be ?search=[term]&type=public + return query; + }, + headers: { 'RequestToken': OC.requestToken }, + formatNoMatches: function() { + return ''; + }, + dataType: 'json', + delay: 250, + processResults: function (data) { //json parse + return { + results: $.map(data.Tags,function(val, i){ + return { id: val.id, text:val.name}; + }), + pagination: { + more: false, + } + }; + }, + cache: false, + }, + }); + $(this).select2('val', []); + //clearInterval(interval); + //}.bind(this),0); + }); + $('input.select2-input').attr('autocomplete', "xxxxxxxxxxx") + + //$(".set-project").on("change", function (e) { + $(".set-project").on("select2:select select2:unselect", function (e) { + var myid = $(e.target).data('myid'); + var selectedId = $(e.target).val(); + var jqxhr = $.post( "ajax/update-work-interval/"+myid,{projectId:selectedId}, function() { + + + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + getWorkItems(); + }) + .fail(function() { + alert( "error" ); + }) + .always(function() { + }); + }); + $(".set-project").on("select2:unselecting", function(e) { + var self = $(this); + setTimeout(function() { + self.select2('close'); + }, 0); + }); + + $(".set-tag").on("change", function (e) { + var myid = $(e.target).data('myid'); + var selectedTag = $(e.target).val(); + var jqxhr = $.post( "ajax/update-work-interval/"+myid,{tagId:selectedTag.join(",")}, function() { + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } + getWorkItems(); + }) + .fail(function() { + alert( "error" ); + }) + .always(function() { + }); + }); + $(".set-tag").on("select2:unselecting", function(e) { + var self = $(this); + setTimeout(function() { + self.select2('close'); + }, 0); + }); + }).fail(function() { + alert( "error getting work items" ); + }); + } + + function createWorkItem(wiPlay) { + var workName = $('#work-input').val(); + $('#work-input').val(wiPlay.data('work-name')); + startTimer(wiPlay.data('projectid'), wiPlay.data('tagids'), workName); + return false; + } + + function resumeWorkItem(wiResume) { + startTimer(wiResume.data('projectid'), wiResume.data('tagids'), wiResume.data('work-name')); + return false; + } + + function startTimer(projectId = null, tags = "", inputWorkName = null){ + if(localStorage.getItem('isTimerStarted') === 'true'){ + stopTimer(startTimer, [projectId, tags, inputWorkName]); + return; + } + var workName = inputWorkName ?? $('#work-input').val(); + if (workName == ''){ + workName = 'no description'; + } + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/start-timer/'+encodeURIComponent(encodeURIComponent(workName))); + var jqxhr = $.post(baseUrl, { projectId: projectId, tags: tags}, function() { + }) + .done(function(data, status, jqxhr) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } else { + localStorage.setItem('isTimerStarted', true); + $('#start-tracking > span').addClass("stop-button").removeClass("play-button"); + } + }) + .fail(function() { + alert( "error" ); + }).always(function() { + getWorkItems(); + }); + + } + function stopTimer(onStopped = null, args = []){ + + var workName = $('#work-input').val(); + if (workName == ''){ + workName = 'no description'; + } + var baseUrl = OC.generateUrl('/apps/timetracker/ajax/stop-timer/'+encodeURIComponent(encodeURIComponent(workName))); + var jqxhr = $.post(baseUrl, function() { // encode twice so we can pass / character + }) + .done(function(data, status, jqXHR) { + var response = data; + if ('Error' in response){ + alert(response.Error); + } else { + localStorage.setItem('isTimerStarted', false); + $('#start-tracking > span').addClass("play-button").removeClass("stop-button"); + if (onStopped != null){ + onStopped(...args); + } else { + getWorkItems(); + } + } + }) + .fail(function() { + alert( "error" ); + }) + .always(function() { + + }); + } + + + + $( "#datepicker-from" ).datepicker(); + $( "#datepicker-to" ).datepicker(); + + if(localStorage.getItem('isTimerStarted') === 'true'){ + $('#start-tracking > span').addClass("stop-button").removeClass("play-button"); + } else { + $('#start-tracking > span').addClass("play-button").removeClass("stop-button"); + } + $( "#start-tracking" ).click(function() { + if(localStorage.getItem('isTimerStarted') === 'true'){ + stopTimer(); + } else { + startTimer(); + } + return false; + }); + } ); + +}()); diff --git a/js/tabulator.js b/js/tabulator.js deleted file mode 100644 index cde33a1..0000000 --- a/js/tabulator.js +++ /dev/null @@ -1,19815 +0,0 @@ -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.1.5 (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; - } - - }); - } - - var ColumnManager = function ColumnManager(table) { - - this.table = table; //hold parent table - - - 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"); - - return el; - }; - - //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; - }; - - //scroll horizontally to match table body - - - ColumnManager.prototype.scrollHorizontal = function (left) { - - var hozAdjust = 0, - scrollWidth = this.element.scrollWidth - this.table.element.clientWidth; - - 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.layout(); - } - }; - - ///////////// Column Setup Functions ///////////// - - - 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()); - } - } - - 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.columnVertAlign, 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 (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.getColumnByIndex = function (index) { - - return this.columnsByIndex[index]; - }; - - 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._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.persistentLayout && this.table.modExists("persistence", true)) { - - 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 _this = this; - - var left = 0, - offset = 0, - adjust = 0, - colEl = column.getElement(); - - return new Promise(function (resolve, reject) { - - if (typeof position === "undefined") { - - position = _this.table.options.scrollToColumnPosition; - } - - if (typeof ifVisible === "undefined") { - - ifVisible = _this.table.options.scrollToColumnIfVisible; - } - - if (column.visible) { - - //align to correct position - - - switch (position) { - - case "middle": - - case "center": - - adjust = -_this.element.clientWidth / 2; - - break; - - case "right": - - adjust = colEl.clientWidth - _this.headersElement.clientWidth; - - break; - - } - - //check column visibility - - - if (!ifVisible) { - - offset = colEl.offsetLeft; - - if (offset > 0 && offset + colEl.offsetWidth < _this.element.clientWidth) { - - return false; - } - } - - //calculate scroll position - - - left = colEl.offsetLeft + _this.element.scrollLeft + adjust; - - left = Math.max(Math.min(left, _this.table.rowManager.element.scrollWidth - _this.table.rowManager.element.clientWidth), 0); - - _this.table.rowManager.scrollHorizontal(left); - - _this.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 column = this._addColumn(definition, before, nextToColumn); - - this._reIndexColumns(); - - 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); - } - - this.redraw(); - - if (this.table.modules.layout.getMode() != "fitColumns") { - - column.reinitializeWidth(); - } - - this._verticalAlignHeaders(); - - this.table.rowManager.reinitialize(); - }; - - //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 (this.table.modules.layout.getMode() == "fitColumns") { - - 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.persistentLayout && this.table.modExists("persistence", true)) { - - 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 () { - - 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 () { - - 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.setHeaderFilterValue = function (value) { - - if (this._column.table.modExists("filter", true)) { - - this._column.table.modules.filter.setHeaderFilterValue(this._column, value); - } - }; - - 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.groupElement = this.createGroupElement(); //column group holder element - - this.isGroup = false; - - this.tooltip = false; //hold column tooltip - - this.hozAlign = ""; //horizontal text alignment - - - //multi dimentional filed handling - - this.field = ""; - - this.fieldStructure = ""; - - this.getFieldValue = ""; - - this.setFieldValue = ""; - - this.setField(this.definition.field); - - this.modules = {}; //hold module variables; - - - this.cellEvents = { - - cellClick: false, - - cellDblClick: false, - - cellContext: false, - - cellTap: false, - - cellDblTap: false, - - cellTapHold: false - - }; - - this.width = null; //column width - - this.minWidth = null; //column minimum width - - this.widthFixed = false; //user has specified a width for this column - - - this.visible = true; //default visible state - - - //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(); - }; - - 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.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._setNesteData : 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.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); - } - - //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; - }); - - 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); - }); - - 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; - } - - //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 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 : 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.align == "undefined" ? "" : self.definition.align; - }; - - Column.prototype._buildColumnHeaderContent = function () { - - var self = this, - def = self.definition, - table = self.table; - - var contentElement = document.createElement("div"); - - contentElement.classList.add("tabulator-col-content"); - - contentElement.appendChild(self._buildColumnHeaderTitle()); - - 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 formatter, contents, params, mockCell; - - if (this.definition.titleFormatter && this.table.modExists("format")) { - - formatter = this.table.modules.format.getFormatter(this.definition.titleFormatter); - - 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); - - switch (typeof contents === 'undefined' ? 'undefined' : _typeof(contents)) { - - case "object": - - if (contents instanceof Node) { - - this.element.appendChild(contents); - } else { - - this.element.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": - - this.element.innerHTML = ""; - - break; - - default: - - this.element.innerHTML = contents; - - } - } else { - - el.innerHTML = title; - } - }; - - //build header element for column group - - Column.prototype._buildGroupHeader = function () { - - this.element.classList.add("tabulator-col-group"); - - this.element.setAttribute("role", "columngroup"); - - this.element.setAttribute("aria-title", this.definition.title); - - 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._setNesteData = 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]]) { - - dataObj[structure[i]] = {}; - } - - 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(); - }); - }; - - //// 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.persistentLayout && this.table.modExists("responsiveLayout", true)) { - - 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); - } - } - }; - - //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.persistentLayout && this.table.modExists("persistence", true)) { - - 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); - } - } - }; - - Column.prototype.matchChildWidths = function () { - - var childWidth = 0; - - if (this.contentElement && this.columns.length) { - - this.columns.forEach(function (column) { - - childWidth += column.getWidth(); - }); - - this.contentElement.style.maxWidth = childWidth - 1 + "px"; - } - }; - - 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.element.style.width = width ? width + "px" : ""; - - if (!this.isGroup) { - - this.cells.forEach(function (cell) { - - cell.setWidth(width); - }); - } - - 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 () { - - // return this.element.offsetWidth; - - return this.width; - }; - - Column.prototype.getHeight = function () { - - return this.element.offsetHeight; - }; - - Column.prototype.setMinWidth = function (minWidth) { - - this.minWidth = minWidth; - - this.element.style.minWidth = minWidth ? minWidth + "px" : ""; - - this.cells.forEach(function (cell) { - - cell.setMinWidth(minWidth); - }); - }; - - Column.prototype.delete = function () { - - if (this.isGroup) { - - this.columns.forEach(function (column) { - - column.delete(); - }); - } - - var cellCount = this.cells.length; - - for (var i = 0; i < cellCount; i++) { - - this.cells[0].delete(); - } - - this.element.parentNode.removeChild(this.element); - - this.table.columnManager.deregisterColumn(this); - }; - - //////////////// 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.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.setWidth(""); - }); - } - - 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.deleteCell = function (cell) { - - var index = this.cells.indexOf(cell); - - if (index > -1) { - - this.cells.splice(index, 1); - } - }; - - //////////////// Event Bindings ///////////////// - - - //////////////// Object Generation ///////////////// - - Column.prototype.getComponent = function () { - - return new ColumnComponent(this); - }; - - var RowManager = function RowManager(table) { - - this.table = table; - - this.element = this.createHolderElement(); //containing element - - this.tableElement = 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 = "classic"; //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 - }; - - //////////////// 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.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); - } - } 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 (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.getRowFromPosition = function (position, active) { - - if (active) { - - return this.activeRows[position]; - } else { - - return this.rows[position]; - } - }; - - RowManager.prototype.scrollToRow = function (row, position, ifVisible) { - var _this2 = 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 = _this2.table.options.scrollToRowPosition; - } - - if (typeof ifVisible === "undefined") { - - ifVisible = _this2.table.options.scrollToRowIfVisible; - } - - if (position === "nearest") { - - switch (_this2.renderMode) { - - case "classic": - - rowTop = Tabulator.prototype.helpers.elOffset(rowEl).top; - - position = Math.abs(_this2.element.scrollTop - rowTop) > Math.abs(_this2.element.scrollTop + _this2.element.clientHeight - rowTop) ? "bottom" : "top"; - - break; - - case "virtual": - - position = Math.abs(_this2.vDomTop - rowIndex) > Math.abs(_this2.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(_this2.element).top; - - if (offset > 0 && offset < _this2.element.clientHeight - rowEl.offsetHeight) { - - return false; - } - } - } - - //scroll to row - - switch (_this2.renderMode) { - - case "classic": - - _this2.element.scrollTop = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this2.element).top + _this2.element.scrollTop; - - break; - - case "virtual": - - _this2._virtualRenderFill(rowIndex, true); - - break; - - } - - //align to correct position - - switch (position) { - - case "middle": - - case "center": - - _this2.element.scrollTop = _this2.element.scrollTop - _this2.element.clientHeight / 2; - - break; - - case "bottom": - - _this2.element.scrollTop = _this2.element.scrollTop - _this2.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) { - var _this3 = this; - - var self = this; - - return new Promise(function (resolve, reject) { - - if (renderInPosition && _this3.getDisplayRows().length) { - - if (self.table.options.pagination) { - - self._setDataActual(data, true); - } else { - - _this3.reRenderInPosition(function () { - - self._setDataActual(data); - }); - } - } else { - - _this3.resetScroll(); - - _this3._setDataActual(data); - } - - resolve(); - }); - }; - - RowManager.prototype._setDataActual = function (data, renderInPosition) { - - var self = this; - - self.table.options.dataLoading.call(this.table, data); - - self.rows.forEach(function (row) { - - row.wipe(); - }); - - self.rows = []; - - 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(); - } - - 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.deleteRow = function (row) { - - 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); - } - }); - - this.reRenderInPosition(); - - 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 _this4 = this; - - var self = this, - length = 0, - rows = []; - - return new Promise(function (resolve, reject) { - - pos = _this4.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 (_this4.table.options.groupBy && _this4.table.modExists("groupRows")) { - - _this4.table.modules.groupRows.updateGroupRows(true); - } else if (_this4.table.options.pagination && _this4.table.modExists("page")) { - - _this4.refreshActiveData(false, false, true); - } else { - - _this4.reRenderInPosition(); - } - - //recalc column calculations if present - - if (_this4.table.modExists("columnCalcs")) { - - _this4.table.modules.columnCalcs.recalc(_this4.table.rowManager.activeRows); - } - - 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), - 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 (index) { - - 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) { - - var allIndex = this.rows.indexOf(index), - 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); - } - - if (allIndex > -1) { - - 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, { pos: this.getRowPosition(from), to: to, after: after }); - } - - this.moveRowActual(from, to, after); - - this.table.options.rowMoved.call(this.table, from.getComponent()); - }; - - RowManager.prototype.moveRowActual = function (from, to, after) { - - var self = this; - - this._moveRowInArray(this.rows, from, to, after); - - this._moveRowInArray(this.activeRows, from, to, after); - - this.displayRowIterator(function (rows) { - - self._moveRowInArray(rows, from, to, after); - }); - - if (this.table.options.groupBy && this.table.modExists("groupRows")) { - - 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 (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 self = this, - output = []; - - var rows = active ? self.activeRows : self.rows; - - rows.forEach(function (row) { - - output.push(row.getData(transform || "data")); - }); - - return output; - }; - - RowManager.prototype.getHtml = function (active) { - - var data = this.getData(active), - columns = [], - header = "", - body = "", - table = ""; - - //build header row - - this.table.columnManager.getColumns().forEach(function (column) { - - var def = column.getDefinition(); - - if (column.visible && !def.hideInHtml) { - - header += '' + (def.title || "") + ''; - - columns.push(column); - } - }); - - //build body rows - - data.forEach(function (rowData) { - - var row = ""; - - columns.forEach(function (column) { - - var value = column.getFieldValue(rowData); - - if (typeof value === "undefined" || value === null) { - - value = ":"; - } - - row += '' + value + ''; - }); - - body += '' + row + ''; - }); - - //build table - - table = '\n\n\t\t\t\n\n\t\t\t' + header + '\n\n\t\t\t\n\n\t\t\t' + body + '\n\n\t\t\t
              '; - - return table; - }; - - RowManager.prototype.getComponents = function (active) { - - var self = this, - output = []; - - var rows = active ? self.activeRows : self.rows; - - rows.forEach(function (row) { - - output.push(row.getComponent()); - }); - - return output; - }; - - RowManager.prototype.getDataCount = function (active) { - - return active ? this.rows.length : this.activeRows.length; - }; - - RowManager.prototype._genRemoteRequest = function () { - - var self = this, - table = self.table, - options = table.options, - params = {}; - - if (table.modExists("page")) { - - //set sort data if defined - - if (options.ajaxSorting) { - - var sorters = self.table.modules.sort.getSort(); - - sorters.forEach(function (item) { - - delete item.column; - }); - - params[self.table.modules.page.paginationDataSentNames.sorters] = sorters; - } - - //set filter data if defined - - if (options.ajaxFiltering) { - - var filters = self.table.modules.filter.getFilters(true, true); - - params[self.table.modules.page.paginationDataSentNames.filters] = filters; - } - - self.table.modules.ajax.setParams(params, true); - } - - table.modules.ajax.sendRequest().then(function (data) { - - self.setData(data); - }).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 () { - - 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("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, - displayIndex; - - 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(); - } - } else { - - skipStage = false; - } - - //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); - } - }; - - 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] || []; - } - }; - - //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 () { - - return this.rows; - }; - - ///////////////// Table Rendering ///////////////// - - - //trigger rerender of table in current position - - RowManager.prototype.reRenderInPosition = function (callback) { - - if (this.getRenderMode() == "virtual") { - - 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(); - } - }; - - RowManager.prototype.setRenderMode = function () { - - if ((this.table.element.clientHeight || this.table.options.height) && this.table.options.virtualDom) { - - this.renderMode = "virtual"; - } else { - - this.renderMode = "classic"; - } - }; - - RowManager.prototype.getRenderMode = function () { - - return this.renderMode; - }; - - RowManager.prototype.renderTable = function () { - - var self = this; - - self.table.options.renderStarted.call(this.table); - - self.element.scrollTop = 0; - - switch (self.renderMode) { - - case "classic": - - self._simpleRender(); - - break; - - case "virtual": - - self._virtualRenderFill(); - - break; - - } - - if (self.firstRender) { - - if (self.displayRowsCount) { - - self.firstRender = false; - - self.table.modules.layout.layout(); - } else { - - self.renderEmptyScroll(); - } - } - - if (self.table.modExists("frozenColumns")) { - - self.table.modules.frozenColumns.layout(); - } - - if (!self.displayRowsCount) { - - if (self.table.options.placeholder) { - - if (this.renderMode) { - - self.table.options.placeholder.setAttribute("tabulator-render-mode", this.renderMode); - } - - self.getElement().appendChild(self.table.options.placeholder); - } - } - - self.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 () { - - 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.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 { - - // element.children().detach(); - - while (element.firstChild) { - element.removeChild(element.firstChild); - } //check if position is too close to bottom of table - - var heightOccpied = (self.displayRowsCount - position + 1) * self.vDomRowHeight; - - if (heightOccpied < self.height) { - - position -= Math.ceil((self.height - heightOccpied) / 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]; - - self.styleRow(row, index); - - element.appendChild(row.getElement()); - - if (!row.initialized) { - - row.initialize(true); - } else { - - if (!row.heightInitialized) { - - row.normalizeHeight(true); - } - } - - if (i < topPad) { - - topPadHeight += row.getHeight(); - } else { - - rowsHeight += row.getHeight(); - } - - 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(); - } - }; - - //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 (topDiff < 0) { - - //hide bottom row if needed - - if (this.vDomScrollHeight - this.scrollTop > this.vDomWindowBuffer) { - - this._removeBottomRow(-bottomDiff); - } - } - } else { - - //scrolling down - - if (topDiff >= 0) { - - //hide top row if needed - - if (this.scrollTop > this.vDomWindowBuffer) { - - this._removeTopRow(topDiff); - } - } - - 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 (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 (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 () { - - if (this.renderMode === "virtual") { - - this.height = this.element.clientHeight; - - this.vDomWindowBuffer = this.table.options.virtualDomBuffer || this.height; - - var otherHeight = this.columnManager.getElement().offsetHeight + (this.table.footerManager && !this.table.footerManager.external ? this.table.footerManager.getElement().offsetHeight : 0); - - this.element.style.minHeight = "calc(100% - " + otherHeight + "px)"; - - this.element.style.height = "calc(100% - " + otherHeight + "px)"; - - this.element.style.maxHeight = "calc(100% - " + otherHeight + "px)"; - } - }; - - //renitialize all rows - - RowManager.prototype.reinitialize = function () { - - this.rows.forEach(function (row) { - - row.reinitialize(); - }); - }; - - //redraw table - - RowManager.prototype.redraw = function (force) { - - var pos = 0, - left = this.scrollLeft; - - this.adjustTableSize(); - - if (!force) { - - if (self.renderMode == "classic") { - - if (self.table.options.groupBy) { - - self.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.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.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.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.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 () { - - return this._row.nextRow(); - }; - - RowComponent.prototype.getPrevRow = function () { - - return this._row.prevRow(); - }; - - var Row = function Row(data, parent) { - - this.table = parent.table; - - this.parent = parent; - - this.data = {}; - - this.type = "row"; //type of element - - this.element = this.createElement(); - - this.modules = {}; //hold module variables; - - this.cells = []; - - this.height = 0; //hold element 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.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); - } - - //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()); - }); - } - - if (self.table.options.rowTap) { - - tap = false; - - self.element.addEventListener("touchstart", function (e) { - - tap = 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); - }); - - 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 movable rows - - 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; - - this.height = 0; - - if (this.element.offsetParent !== null) { - - this.initialize(true); - } - }; - - //get heights when doing bulk row style calcs in virtual DOM - - Row.prototype.calcHeight = function () { - - 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; - } - }); - - this.height = Math.max(maxHeight, minHeight); - - this.outerHeight = this.element.offsetHeight; - }; - - //set of cells - - Row.prototype.setCellHeight = function () { - - var height = this.height; - - this.cells.forEach(function (cell) { - - cell.setHeight(height); - }); - - 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(); - - 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.height = height; - - 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) { - - var self = this; - - if (self.table.modExists("mutator")) { - - self.data = self.table.modules.mutator.transformRow(data, "data"); - } else { - - self.data = data; - } - }; - - //update the rows data - - Row.prototype.updateData = function (data) { - var _this5 = this; - - var self = this, - visible = Tabulator.prototype.helpers.elVisible(this.element); - - return new Promise(function (resolve, reject) { - - if (typeof data === "string") { - - data = JSON.parse(data); - } - - //mutate incomming data if needed - - if (self.table.modExists("mutator")) { - - data = self.table.modules.mutator.transformRow(data, "data", true); - } - - //set data - - for (var attrname in data) { - - self.data[attrname] = data[attrname]; - } - - //update affected cells only - - for (var attrname in data) { - - var cell = _this5.getCell(attrname); - - if (cell) { - - if (cell.getValue() != data[attrname]) { - - cell.setValueProcessData(data[attrname]); - - if (visible) { - - cell.cellRendered(); - } - } - } - } - - //Partial reinitialization if visible - - if (visible) { - - self.normalizeHeight(); - - if (self.table.options.rowFormatter) { - - self.table.options.rowFormatter(self.getComponent()); - } - } else { - - _this5.initialized = false; - - _this5.height = 0; - } - - //self.reinitialize(); - - - self.table.options.rowUpdated.call(_this5.table, self.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 ? row.getComponent() : false; - }; - - Row.prototype.prevRow = function () { - - var row = this.table.rowManager.prevDisplayRow(this, true); - - return row ? row.getComponent() : false; - }; - - ///////////////////// Actions ///////////////////// - - - Row.prototype.delete = function () { - var _this6 = this; - - return new Promise(function (resolve, reject) { - - var index = _this6.table.rowManager.getRowIndex(_this6); - - _this6.deleteActual(); - - if (_this6.table.options.history && _this6.table.modExists("history")) { - - if (index) { - - index = _this6.table.rowManager.rows[index - 1]; - } - - _this6.table.modules.history.action("rowDelete", _this6, { data: _this6.getData(), pos: !index, index: index }); - } - - resolve(); - }); - }; - - Row.prototype.deleteActual = function () { - - 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); - } - - // if(this.table.options.dataTree && this.table.modExists("dataTree")){ - - // this.table.modules.dataTree.collapseRow(this, true); - - // } - - - this.table.rowManager.deleteRow(this); - - this.deleteCells(); - - this.initialized = false; - - this.heightInitialized = false; - - //remove from group - - if (this.modules.group) { - - this.modules.group.removeRow(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(); - - // this.element.children().each(function(){ - - // $(this).remove(); - - // }) - - // this.element.empty(); - - - while (this.element.firstChild) { - this.element.removeChild(this.element.firstChild); - } // this.element.remove(); - - 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 () { - - return new RowComponent(this); - }; - - //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.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.height = null; - - this.width = null; - - this.minWidth = null; - - this.build(); - }; - - //////////////// Setup Functions ///////////////// - - - //generate element - - Cell.prototype.build = function () { - - this.generateElement(); - - this.setWidth(this.column.width); - - 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(), - dblTap, - tapHold, - tap; - - //set text alignment - - element.style.textAlign = self.column.hozAlign; - - if (field) { - - element.setAttribute("tabulator-field", field); - } - - if (self.column.definition.cssClass) { - - var classNames = self.column.definition.cssClass.split(" "); - - classNames.forEach(function (className) { - - element.classList.add(className); - }); - } - - //set event bindings - - if (cellEvents.cellClick || self.table.options.cellClick) { - - self.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); - } - }); - } - - 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); - } - }); - } - - if (this.table.options.tooltipGenerationMode === "hover") { - - //update tooltip on mouse enter - - element.addEventListener("mouseenter", function (e) { - - self._generateTooltip(); - }); - } - - if (cellEvents.cellTap || this.table.options.cellTap) { - - tap = false; - - element.addEventListener("touchstart", function (e) { - - tap = 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); - }); - - element.addEventListener("touchend", function (e) { - - clearTimeout(tapHold); - - tapHold = null; - }); - } - - 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(); - } - }; - - //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.table.options.cellEdited.call(this.table, component); - - this.table.options.dataEdited.call(this.table, this.table.rowManager.getData()); - } - - if (this.table.modExists("columnCalcs")) { - - if (this.column.definition.topCalc || this.column.definition.bottomCalc) { - - if (this.table.options.groupBy && this.table.modExists("groupRows")) { - - this.table.modules.columnCalcs.recalcRowGroup(this.row); - } else { - - this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); - } - } - } - }; - - 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); - - return changed; - }; - - Cell.prototype.setValueActual = function (value) { - - this.oldValue = this.value; - - this.value = value; - - this.column.setFieldValue(this.row.data, value); - - 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); - } - - //handle frozen cells - - if (this.table.modExists("frozenColumns")) { - - this.table.modules.frozenColumns.layoutElement(this.element, this.column); - } - }; - - Cell.prototype.setWidth = function (width) { - - this.width = width; - - // this.element.css("width", width || ""); - - this.element.style.width = width ? width + "px" : ""; - }; - - Cell.prototype.getWidth = function () { - - return this.width || this.element.offsetWidth; - }; - - Cell.prototype.setMinWidth = function (minWidth) { - - this.minWidth = minWidth; - - this.element.style.minWidth = minWidth ? minWidth + "px" : ""; - }; - - 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 (height) { - - this.height = height; - - this.element.style.height = height ? height + "px" : ""; - }; - - 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.delete = function () { - - this.element.parentNode.removeChild(this.element); - - this.column.deleteCell(this); - - this.row.deleteCell(this); - }; - - //////////////// 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 () { - - return new CellComponent(this); - }; - - 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.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 - - - layout: "fitData", ///layout type "fitColumns" | "fitData" - - layoutColumnsOnNewData: false, //update column widths on setData - - - columnMinWidth: 40, //minimum global width for a column - - columnVertAlign: "top", //vertical alignment of column headers - - - resizableColumns: true, //resizable columns - - resizableRows: false, //resizable rows - - autoResize: true, //auto resize table - - - columns: [], //store for colum header info - - - data: [], //default starting data - - - 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 - - - columnHeaderSortMulti: true, //multiple or single column sorting - - - sortOrderReverse: false, //reverse internal sort ordering - - - footerElement: false, //hold footer element - - - index: "id", //filed for row index - - - keybindings: [], //array for keybindings - - - clipboard: false, //enable clipboard - - clipboardCopyStyled: true, //formatted table data - - clipboardCopySelector: "active", //method of chosing which data is coppied to the clipboard - - clipboardCopyFormatter: "table", //convert data to a clipboard string - - clipboardPasteParser: "table", //convert pasted clipboard data to rows - - clipboardPasteAction: "insert", //how to insert pasted data into the table - - clipboardCopyConfig: false, //clipboard config - - - 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: false, //download config - - - dataTree: false, //enable data tree - - 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 - - - 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 - - - headerFilterPlaceholder: false, //placeholder text to display in header filters - - - history: false, //enable edit history - - - locale: false, //current system language - - langs: {}, - - virtualDom: true, //enable DOM virtualization - - - persistentLayout: false, //store column layout in memory - - persistentSort: false, //store sorting in memory - - persistentFilter: false, //store filters in memory - - persistenceID: "", //key for persistent storage - - persistenceMode: true, //mode for storing persistence information - - - 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 - - paginationButtonCount: 5, // set count of page button - - 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 - - - movableColumns: false, //enable movable columns - - - movableRows: false, //enable movable rows - - movableRowsConnectedTables: false, //tables 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() {}, - - scrollToRowPosition: "top", - - scrollToRowIfVisible: true, - - scrollToColumnPosition: "left", - - scrollToColumnIfVisible: true, - - rowFormatter: false, - - 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, - - 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, - - 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, - - groupTap: false, - - groupDblTap: false, - - groupTapHold: false, - - columnCalcs: true, - - //pagination callbacks - - pageLoaded: function pageLoaded() {}, - - //localization callbacks - - localized: function localized() {}, - - //validation has failed - - validationFailed: function validationFailed() {}, - - //history callbacks - - historyUndo: function historyUndo() {}, - - historyRedo: function historyRedo() {} - - }; - - Tabulator.prototype.initializeOptions = function (options) { - - 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.options[key] = {}; - } else { - - this.options[key] = this.defaultOptions[key]; - } - } - } - }; - - Tabulator.prototype.initializeElement = function (element) { - - if (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 () {}; - - //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); - - this.options.data = this.options.data.slice(0); - }; - - //build tabulator element - - Tabulator.prototype._buildElement = function () { - - 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; - } - - 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.dataTree && this.modExists("dataTree", true)) { - - mod.dataTree.initialize(); - } - - if ((options.persistentLayout || options.persistentSort || options.persistentFilter) && this.modExists("persistence", true)) { - - mod.persistence.initialize(options.persistenceMode, options.persistenceID); - } - - if (options.persistentLayout && this.modExists("persistence", true)) { - - options.columns = mod.persistence.load("columns", options.columns); - } - - if (options.movableRows && this.modExists("moveRow")) { - - mod.moveRow.initialize(); - } - - if (this.modExists("columnCalcs")) { - - mod.columnCalcs.initialize(); - } - - this.columnManager.setColumns(options.columns); - - if (this.modExists("frozenRows")) { - - this.modules.frozenRows.initialize(); - } - - if ((options.persistentSort || options.initialSort) && this.modExists("sort", true)) { - - var sorters = []; - - if (options.persistentSort && this.modExists("persistence", true)) { - - 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.persistentFilter || options.initialFilter) && this.modExists("filter", true)) { - - var filters = []; - - if (options.persistentFilter && this.modExists("persistence", true)) { - - filters = mod.persistence.load("filter"); - - if (filters === false && options.initialFilter) { - - filters = options.initialFilter; - } - } else if (options.initialFilter) { - - filters = options.initialFilter; - } - - mod.filter.setFilter(filters); - - // this.setFilter(filters); - } - - 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(); - } - - options.tableBuilt.call(this); - }; - - Tabulator.prototype._loadInitialData = function () { - - var self = this; - - if (self.options.pagination && self.modExists("page")) { - - self.modules.page.reset(true); - - if (self.options.pagination == "local") { - - 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().then(function () {}).catch(function () {}); - } else { - - self.rowManager.setData(self.options.data); - } - } - } else { - - if (self.options.ajaxURL) { - - self.modules.page.setPage(1).then(function () {}).catch(function () {}); - } else { - - self.rowManager.setData([]); - } - } - } 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().then(function () {}).catch(function () {}); - } else { - - self.rowManager.setData(self.options.data); - } - } - } - }; - - //deconstructor - - Tabulator.prototype.destroy = function () { - - var element = this.element; - - Tabulator.prototype.comms.deregister(this); //deregister table from inderdevice communication - - - //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; - - 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; - } - }; - - ////////////////// Data Handling ////////////////// - - - //load data - - Tabulator.prototype.setData = function (data, params, config) { - - if (this.modExists("ajax")) { - - this.modules.ajax.blockActiveRequest(); - } - - return this._setData(data, params, config); - }; - - Tabulator.prototype._setData = function (data, params, config, inPosition) { - - 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); - } 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); - - 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); - } - } - } - } else { - - if (data) { - - //asume data is already an object - - return self.rowManager.setData(data, inPosition); - } 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); - - return self.modules.page.setPage(1); - } else { - - return self.modules.ajax.loadData(inPosition); - } - } else { - - //empty data - - return self.rowManager.setData([], inPosition); - } - } - } - }; - - //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) { - - return this.rowManager.getData(active); - }; - - //get table data array count - - Tabulator.prototype.getDataCount = function (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 (active) { - - return this.rowManager.getHtml(active); - }; - - //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 _this7 = this; - - var self = this; - - var responses = 0; - - return new Promise(function (resolve, reject) { - - if (_this7.modExists("ajax")) { - - _this7.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 _this8 = this; - - return new Promise(function (resolve, reject) { - - if (_this8.modExists("ajax")) { - - _this8.modules.ajax.blockActiveRequest(); - } - - if (typeof data === "string") { - - data = JSON.parse(data); - } - - if (data) { - - _this8.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 _this9 = this; - - var self = this, - rows = [], - responses = 0; - - return new Promise(function (resolve, reject) { - - if (_this9.modExists("ajax")) { - - _this9.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 _this10 = this; - - return new Promise(function (resolve, reject) { - - var row = _this10.rowManager.findRow(index); - - if (row) { - - row.delete().then(function () { - - resolve(); - }).catch(function (err) { - - reject(err); - }); - } else { - - console.warn("Delete Error - No matching row found:", index); - - reject("Delete Error - No matching row found"); - } - }); - }; - - //add row to table - - Tabulator.prototype.addRow = function (data, pos, index) { - var _this11 = this; - - return new Promise(function (resolve, reject) { - - if (typeof data === "string") { - - data = JSON.parse(data); - } - - _this11.rowManager.addRows(data, pos, index).then(function (rows) { - - //recalc column calculations if present - - if (_this11.modExists("columnCalcs")) { - - _this11.modules.columnCalcs.recalc(_this11.rowManager.activeRows); - } - - resolve(rows[0].getComponent()); - }); - }); - }; - - //update a row if it exitsts otherwise create it - - Tabulator.prototype.updateOrAddRow = function (index, data) { - var _this12 = this; - - return new Promise(function (resolve, reject) { - - var row = _this12.rowManager.findRow(index); - - if (typeof data === "string") { - - data = JSON.parse(data); - } - - if (row) { - - row.updateData(data).then(function () { - - //recalc column calculations if present - - if (_this12.modExists("columnCalcs")) { - - _this12.modules.columnCalcs.recalc(_this12.rowManager.activeRows); - } - - resolve(row.getComponent()); - }).catch(function (err) { - - reject(err); - }); - } else { - - row = _this12.rowManager.addRows(data).then(function (rows) { - - //recalc column calculations if present - - if (_this12.modExists("columnCalcs")) { - - _this12.modules.columnCalcs.recalc(_this12.rowManager.activeRows); - } - - resolve(rows[0].getComponent()); - }).catch(function (err) { - - reject(err); - }); - } - }); - }; - - //update row data - - Tabulator.prototype.updateRow = function (index, data) { - var _this13 = this; - - return new Promise(function (resolve, reject) { - - var row = _this13.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 _this14 = this; - - return new Promise(function (resolve, reject) { - - var row = _this14.rowManager.findRow(index); - - if (row) { - - _this14.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.getRows = function (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, selectorParams, formatter, formatterParams) { - - if (this.modExists("clipboard", true)) { - - this.modules.clipboard.copy(selector, selectorParams, formatter, formatterParams); - } - }; - - /////////////// 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 column = this.columnManager.findColumn(field); - - this.columnManager.addColumn(definition, before, column); - }; - - Tabulator.prototype.deleteColumn = function (field) { - - var column = this.columnManager.findColumn(field); - - if (column) { - - column.delete(); - } else { - - console.warn("Column Delete Error - No matching column found:", field); - - return false; - } - }; - - //scroll to column in DOM - - Tabulator.prototype.scrollToColumn = function (field, position, ifVisible) { - var _this15 = this; - - return new Promise(function (resolve, reject) { - - var column = _this15.columnManager.findColumn(field); - - if (column) { - - _this15.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) { - - this.options.height = isNaN(height) ? height : height + "px"; - - this.element.style.height = this.options.height; - - this.rowManager.redraw(); - }; - - ///////////////////// 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) { - - if (this.modExists("filter", true)) { - - this.modules.filter.setFilter(field, type, value); - - this.rowManager.filterRefresh(); - } - }; - - //add filter to array - - Tabulator.prototype.addFilter = function (field, type, value) { - - if (this.modExists("filter", true)) { - - this.modules.filter.addFilter(field, type, value); - - 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.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(); - } - }; - - ///////////////////// Filtering //////////////////// - - Tabulator.prototype.selectRow = function (rows) { - - if (this.modExists("selectRow", true)) { - - 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(); - } - }; - - //////////// 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.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"); - } 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"); - } 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"); - } 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(); - } - }; - - ///////////////// Column Calculation Functions /////////////// - - Tabulator.prototype.getCalcResults = function () { - - if (this.modExists("columnCalcs", true)) { - - return this.modules.columnCalcs.getResults(); - } else { - - return false; - } - }; - - /////////////// Navigation Management ////////////// - - - Tabulator.prototype.navigatePrev = function () { - - var cell = false; - - if (this.modExists("edit", true)) { - - cell = this.modules.edit.currentCell; - - if (cell) { - - e.preventDefault(); - - 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) { - - e.preventDefault(); - - 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().dpwn(); - } - } - - 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) { - - if (this.modExists("download", true)) { - - this.modules.download.download(type, filename, options); - } - }; - - /////////// 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) { - - 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 (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 { - - 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; - }); - } - - }; - - 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 the 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 the contain - - - "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 - - - "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": { - - "first": "First", - - "first_title": "First Page", - - "last": "Last", - - "last_title": "Last Page", - - "prev": "Prev", - - "prev_title": "Prev Page", - - "next": "Next", - - "next_title": "Next Page" - - }, - - "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"]; //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) { - 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) { - var self = this; - - if (this.progressiveLoad) { - return this._loadDataProgressive(); - } else { - return this._loadDataStandard(inPosition); - } - }; - - 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) { - var _this16 = this; - - return new Promise(function (resolve, reject) { - _this16.sendRequest(inPosition).then(function (data) { - _this16.table.rowManager.setData(data, inPosition).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 _this17 = 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(_this17.table, self.url, self.params) !== false) { - - self.loading = true; - - if (!silent) { - self.showLoader(); - } - - _this17.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); - } 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"); - } - - self.hideLoader(); - - self.loading = false; - }).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 += "?" + 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 != "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.credentials === "undefined") { - config.credentials = 'include'; - } - - 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"; - } - - //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) { - 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) { - 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.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 data = []; - - rows.forEach(function (row) { - data.push(row.getData()); - }); - - 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); - - if (self.table.modExists("mutator")) { - self.table.modules.mutator.enable(); - } - - row.getElement().classList.add("tabulator-calcs", "tabulator-calcs-" + pos); - row.type = "calc"; - - row.generateCells = function () { - - var cells = []; - - self.table.columnManager.columnsByIndex.forEach(function (column) { - - if (column.visible) { - //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.width); - - column.cells.push(cell); - cells.push(cell); - } - }); - - 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](value, 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.copySelector = false; - this.copySelectorParams = {}; - this.copyFormatter = false; - this.copyFormatterParams = {}; - this.pasteParser = function () {}; - this.pasteAction = function () {}; - this.htmlElement = false; - this.config = {}; - - this.blocked = true; //block copy actions not originating from this command - }; - - Clipboard.prototype.initialize = function () { - var self = this; - - this.mode = this.table.options.clipboard; - - if (this.mode === true || this.mode === "copy") { - this.table.element.addEventListener("copy", function (e) { - var data; - - self.processConfig(); - - if (!self.blocked) { - e.preventDefault(); - - data = self.generateContent(); - - if (window.clipboardData && window.clipboardData.setData) { - window.clipboardData.setData('Text', data); - } else if (e.clipboardData && e.clipboardData.setData) { - e.clipboardData.setData('text/plain', data); - if (self.htmlElement) { - e.clipboardData.setData('text/html', self.htmlElement.outerHTML); - } - } else if (e.originalEvent && e.originalEvent.clipboardData.setData) { - e.originalEvent.clipboardData.setData('text/plain', data); - if (self.htmlElement) { - e.originalEvent.clipboardData.setData('text/html', self.htmlElement.outerHTML); - } - } - - self.table.options.clipboardCopied.call(this.table, data); - - self.reset(); - } - }); - } - - if (this.mode === true || this.mode === "paste") { - this.table.element.addEventListener("paste", function (e) { - self.paste(e); - }); - } - - this.setPasteParser(this.table.options.clipboardPasteParser); - this.setPasteAction(this.table.options.clipboardPasteAction); - }; - - Clipboard.prototype.processConfig = function () { - var config = { - columnHeaders: "groups", - rowGroups: true - }; - - if (typeof this.table.options.clipboardCopyHeader !== "undefined") { - config.columnHeaders = this.table.options.clipboardCopyHeader; - console.warn("DEPRECATION WANRING - clipboardCopyHeader option has been depricated, please use the columnHeaders property on the clipboardCopyConfig option"); - } - - if (this.table.options.clipboardCopyConfig) { - for (var key in this.table.options.clipboardCopyConfig) { - config[key] = this.table.options.clipboardCopyConfig[key]; - } - } - - if (config.rowGroups && this.table.options.groupBy && this.table.modExists("groupRows")) { - this.config.rowGroups = true; - } - - if (config.columnHeaders) { - if ((config.columnHeaders === "groups" || config === true) && this.table.columnManager.columns.length != this.table.columnManager.columnsByIndex.length) { - this.config.columnHeaders = "groups"; - } else { - this.config.columnHeaders = "columns"; - } - } else { - this.config.columnHeaders = false; - } - }; - - Clipboard.prototype.reset = function () { - this.blocked = false; - this.originalSelectionText = ""; - }; - - 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.copy = function (selector, selectorParams, formatter, formatterParams, internal) { - var range, sel; - this.blocked = false; - - if (this.mode === true || this.mode === "copy") { - - if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") { - range = document.createRange(); - range.selectNodeContents(this.table.element); - sel = window.getSelection(); - - if (sel.toString() && internal) { - selector = "userSelection"; - formatter = "raw"; - selectorParams = 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(); - } - - this.setSelector(selector); - this.copySelectorParams = typeof selectorParams != "undefined" && selectorParams != null ? selectorParams : this.config.columnHeaders; - this.setFormatter(formatter); - this.copyFormatterParams = typeof formatterParams != "undefined" && formatterParams != null ? formatterParams : {}; - - document.execCommand('copy'); - - if (sel) { - sel.removeAllRanges(); - } - } - }; - - Clipboard.prototype.setSelector = function (selector) { - selector = selector || this.table.options.clipboardCopySelector; - - switch (typeof selector === 'undefined' ? 'undefined' : _typeof(selector)) { - case "string": - if (this.copySelectors[selector]) { - this.copySelector = this.copySelectors[selector]; - } else { - console.warn("Clipboard Error - No such selector found:", selector); - } - break; - - case "function": - this.copySelector = selector; - break; - } - }; - - Clipboard.prototype.setFormatter = function (formatter) { - - formatter = formatter || this.table.options.clipboardCopyFormatter; - - switch (typeof formatter === 'undefined' ? 'undefined' : _typeof(formatter)) { - case "string": - if (this.copyFormatters[formatter]) { - this.copyFormatter = this.copyFormatters[formatter]; - } else { - console.warn("Clipboard Error - No such formatter found:", formatter); - } - break; - - case "function": - this.copyFormatter = formatter; - break; - } - }; - - Clipboard.prototype.generateContent = function () { - var data; - - this.htmlElement = false; - data = this.copySelector.call(this, this.config, this.copySelectorParams); - - return this.copyFormatter.call(this, data, this.config, this.copyFormatterParams); - }; - - Clipboard.prototype.generateSimpleHeaders = function (columns) { - var headers = []; - - columns.forEach(function (column) { - headers.push(column.definition.title); - }); - - return headers; - }; - - Clipboard.prototype.generateColumnGroupHeaders = function (columns) { - var _this18 = this; - - var output = []; - - this.table.columnManager.columns.forEach(function (column) { - var colData = _this18.processColumnGroup(column); - - if (colData) { - output.push(colData); - } - }); - - return output; - }; - - Clipboard.prototype.processColumnGroup = function (column) { - var _this19 = this; - - var subGroups = column.columns; - - var groupData = { - type: "group", - title: column.definition.title, - column: column - }; - - if (subGroups.length) { - groupData.subGroups = []; - groupData.width = 0; - - subGroups.forEach(function (subGroup) { - var subGroupData = _this19.processColumnGroup(subGroup); - - if (subGroupData) { - groupData.width += subGroupData.width; - groupData.subGroups.push(subGroupData); - } - }); - - if (!groupData.width) { - return false; - } - } else { - if (column.field && column.visible) { - groupData.width = 1; - } else { - return false; - } - } - - return groupData; - }; - - Clipboard.prototype.groupHeadersToRows = function (columns) { - - var headers = []; - - function parseColumnGroup(column, level) { - - if (typeof headers[level] === "undefined") { - headers[level] = []; - } - - headers[level].push(column.title); - - if (column.subGroups) { - column.subGroups.forEach(function (subGroup) { - parseColumnGroup(subGroup, level + 1); - }); - } else { - padColumnheaders(); - } - } - - function padColumnheaders() { - var max = 0; - - headers.forEach(function (title) { - var len = title.length; - if (len > max) { - max = len; - } - }); - - headers.forEach(function (title) { - var len = title.length; - if (len < max) { - for (var i = len; i < max; i++) { - title.push(""); - } - } - }); - } - - columns.forEach(function (column) { - parseColumnGroup(column, 0); - }); - - return headers; - }; - - Clipboard.prototype.rowsToData = function (rows, config, params) { - var columns = this.table.columnManager.columnsByIndex, - data = []; - - rows.forEach(function (row) { - var rowArray = [], - rowData = row.getData("clipboard"); - - columns.forEach(function (column) { - var value = column.getFieldValue(rowData); - - switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { - case "object": - value = JSON.stringify(value); - break; - - case "undefined": - case "null": - value = ""; - break; - - default: - value = value; - } - - rowArray.push(value); - }); - - data.push(rowArray); - }); - - return data; - }; - - Clipboard.prototype.buildComplexRows = function (config) { - var _this20 = this; - - var output = [], - groups = this.table.modules.groupRows.getGroups(); - - groups.forEach(function (group) { - output.push(_this20.processGroupData(group)); - }); - - return output; - }; - - Clipboard.prototype.processGroupData = function (group) { - var _this21 = this; - - var subGroups = group.getSubGroups(); - - var groupData = { - type: "group", - key: group.key - }; - - if (subGroups.length) { - groupData.subGroups = []; - - subGroups.forEach(function (subGroup) { - groupData.subGroups.push(_this21.processGroupData(subGroup)); - }); - } else { - groupData.rows = group.getRows(true); - } - - return groupData; - }; - - Clipboard.prototype.buildOutput = function (rows, config, params) { - var _this22 = this; - - var output = [], - columns = this.table.columnManager.columnsByIndex; - - if (config.columnHeaders) { - - if (config.columnHeaders == "groups") { - columns = this.generateColumnGroupHeaders(this.table.columnManager.columns); - - output = output.concat(this.groupHeadersToRows(columns)); - } else { - output.push(this.generateSimpleHeaders(columns)); - } - } - - //generate styled content - if (this.table.options.clipboardCopyStyled) { - this.generateHTML(rows, columns, config, params); - } - - //generate unstyled content - if (config.rowGroups) { - rows.forEach(function (row) { - output = output.concat(_this22.parseRowGroupData(row, config, params)); - }); - } else { - output = output.concat(this.rowsToData(rows, config, params)); - } - - return output; - }; - - Clipboard.prototype.parseRowGroupData = function (group, config, params) { - var _this23 = this; - - var groupData = []; - - groupData.push([group.key]); - - if (group.subGroups) { - group.subGroups.forEach(function (subGroup) { - groupData = groupData.concat(_this23.parseRowGroupData(subGroup, config, params)); - }); - } else { - - groupData = groupData.concat(this.rowsToData(group.rows, config, params)); - } - - return groupData; - }; - - Clipboard.prototype.generateHTML = function (rows, columns, config, params) { - var self = this, - data = [], - headers = [], - body, - oddRow, - evenRow, - firstRow, - firstCell, - firstGroup, - lastCell, - styleCells; - - //create table element - this.htmlElement = document.createElement("table"); - self.mapElementStyles(this.table.element, this.htmlElement, ["border-top", "border-left", "border-right", "border-bottom"]); - - function generateSimpleHeaders() { - var headerEl = document.createElement("tr"); - - columns.forEach(function (column) { - var columnEl = document.createElement("th"); - columnEl.innerHTML = column.definition.title; - - self.mapElementStyles(column.getElement(), columnEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); - - headerEl.appendChild(columnEl); - }); - - self.mapElementStyles(self.table.columnManager.getHeadersElement(), headerEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); - - self.htmlElement.appendChild(document.createElement("thead").appendChild(headerEl)); - } - - function generateHeaders(headers) { - - var headerHolderEl = document.createElement("thead"); - - headers.forEach(function (columns) { - var headerEl = document.createElement("tr"); - - columns.forEach(function (column) { - var columnEl = document.createElement("th"); - - if (column.width > 1) { - columnEl.colSpan = column.width; - } - - if (column.height > 1) { - columnEl.rowSpan = column.height; - } - - columnEl.innerHTML = column.title; - - self.mapElementStyles(column.element, columnEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); - - headerEl.appendChild(columnEl); - }); - - self.mapElementStyles(self.table.columnManager.getHeadersElement(), headerEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); - - headerHolderEl.appendChild(headerEl); - }); - - self.htmlElement.appendChild(headerHolderEl); - } - - function parseColumnGroup(column, level) { - - if (typeof headers[level] === "undefined") { - headers[level] = []; - } - - headers[level].push({ - title: column.title, - width: column.width, - height: 1, - children: !!column.subGroups, - element: column.column.getElement() - }); - - if (column.subGroups) { - column.subGroups.forEach(function (subGroup) { - parseColumnGroup(subGroup, level + 1); - }); - } - } - - function padVerticalColumnheaders() { - headers.forEach(function (row, index) { - row.forEach(function (header) { - if (!header.children) { - header.height = headers.length - index; - } - }); - }); - } - - //create headers if needed - if (config.columnHeaders) { - if (config.columnHeaders == "groups") { - columns.forEach(function (column) { - parseColumnGroup(column, 0); - }); - - padVerticalColumnheaders(); - generateHeaders(headers); - } else { - generateSimpleHeaders(); - } - } - - columns = this.table.columnManager.columnsByIndex; - - //create table body - body = document.createElement("tbody"); - - //lookup row styles - if (window.getComputedStyle) { - oddRow = this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"); - evenRow = this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"); - firstRow = this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"); - firstGroup = this.table.element.getElementsByClassName("tabulator-group")[0]; - - if (firstRow) { - styleCells = firstRow.getElementsByClassName("tabulator-cell"); - firstCell = styleCells[0]; - lastCell = styleCells[styleCells.length - 1]; - } - } - - function processRows(rowArray) { - //add rows to table - rowArray.forEach(function (row, i) { - var rowEl = document.createElement("tr"), - rowData = row.getData("clipboard"), - styleRow = firstRow; - - columns.forEach(function (column, j) { - var cellEl = document.createElement("td"), - value = column.getFieldValue(rowData); - - switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { - case "object": - value = JSON.stringify(value); - break; - - case "undefined": - case "null": - value = ""; - break; - - default: - value = value; - } - - cellEl.innerHTML = value; - - if (column.definition.align) { - cellEl.style.textAlign = column.definition.align; - } - - if (j < columns.length - 1) { - if (firstCell) { - self.mapElementStyles(firstCell, cellEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size"]); - } - } else { - if (firstCell) { - self.mapElementStyles(firstCell, cellEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size"]); - } - } - - rowEl.appendChild(cellEl); - }); - - if (!(i % 2) && oddRow) { - styleRow = oddRow; - } - - if (i % 2 && evenRow) { - styleRow = evenRow; - } - - if (styleRow) { - self.mapElementStyles(styleRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); - } - - body.appendChild(rowEl); - }); - } - - function processGroup(group) { - var groupEl = document.createElement("tr"), - groupCellEl = document.createElement("td"); - - groupCellEl.colSpan = columns.length; - - groupCellEl.innerHTML = group.key; - - groupEl.appendChild(groupCellEl); - body.appendChild(groupEl); - - self.mapElementStyles(firstGroup, groupEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); - - if (group.subGroups) { - group.subGroups.forEach(function (subGroup) { - processGroup(subGroup); - }); - } else { - processRows(group.rows); - } - } - - if (config.rowGroups) { - rows.forEach(function (group) { - processGroup(group); - }); - } else { - processRows(rows); - } - - this.htmlElement.appendChild(body); - }; - - Clipboard.prototype.mapElementStyles = function (from, to, props) { - - var lookup = { - "background-color": "backgroundColor", - "color": "fontColor", - "font-weight": "fontWeight", - "font-family": "fontFamily", - "font-size": "fontSize", - "border-top": "borderTop", - "border-left": "borderLeft", - "border-right": "borderRight", - "border-bottom": "borderBottom" - }; - - if (window.getComputedStyle) { - var fromStyle = window.getComputedStyle(from); - - props.forEach(function (prop) { - to.style[lookup[prop]] = fromStyle.getPropertyValue(prop); - }); - } - - // return window.getComputedStyle ? window.getComputedStyle(element, null).getPropertyValue(property) : element.style[property.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); })]; - }; - - Clipboard.prototype.copySelectors = { - userSelection: function userSelection(config, params) { - return params; - }, - selected: function selected(config, params) { - var rows = []; - - if (this.table.modExists("selectRow", true)) { - rows = this.table.modules.selectRow.getSelectedRows(); - } - - if (config.rowGroups) { - console.warn("Clipboard Warning - select coptSelector does not support row groups"); - } - - return this.buildOutput(rows, config, params); - }, - table: function table(config, params) { - if (config.rowGroups) { - console.warn("Clipboard Warning - table coptSelector does not support row groups"); - } - - return this.buildOutput(this.table.rowManager.getComponents(), config, params); - }, - active: function active(config, params) { - var rows; - - if (config.rowGroups) { - rows = this.buildComplexRows(config); - } else { - rows = this.table.rowManager.getComponents(true); - } - - return this.buildOutput(rows, config, params); - } - }; - - Clipboard.prototype.copyFormatters = { - raw: function raw(data, params) { - return data; - }, - table: function table(data, params) { - var output = []; - - data.forEach(function (row) { - row.forEach(function (value) { - if (typeof value == "undefined") { - value = ""; - } - - value = typeof value == "undefined" || value === null ? "" : value.toString(); - - if (value.match(/\r|\n/)) { - value = value.split('"').join('""'); - value = '"' + value + '"'; - } - }); - - output.push(row.join("\t")); - }); - - return output.join("\n"); - } - }; - - 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.startOpen = function () {}; - - this.displayIndex = 0; - }; - - DataTree.prototype.initialize = function () { - var dummyEl = null, - options = this.table.options; - - this.field = options.dataTreeChildField; - this.indent = options.dataTreeChildIndent; - - 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.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.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 children = typeof row.getData()[this.field] !== "undefined"; - - row.modules.dataTree = { - index: 0, - open: children ? this.startOpen(row.getComponent(), 0) : false, - controlEl: false, - branchEl: false, - parent: false, - children: children - }; - }; - - DataTree.prototype.layoutRow = function (row) { - var cell = row.getCells()[0], - el = cell.getElement(), - config = row.modules.dataTree; - - el.style.paddingLeft = parseInt(window.getComputedStyle(el, null).getPropertyValue('padding-left')) + config.index * this.indent + "px"; - - if (config.branchEl) { - config.branchEl.parentNode.removeChild(config.branchEl); - } - - this.generateControlElement(row, el); - - if (config.index && this.branchEl) { - config.branchEl = this.branchEl.cloneNode(true); - el.insertBefore(config.branchEl, el.firstChild); - el.style.paddingLeft = parseInt(el.style.paddingLeft) + (config.branchEl.offsetWidth + config.branchEl.style.marginRight) * (config.index - 1) + "px"; - } - }; - - DataTree.prototype.generateControlElement = function (row, el) { - var _this24 = 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(); - _this24.collapseRow(row); - }); - } else { - config.controlEl = this.expandEl.cloneNode(true); - config.controlEl.addEventListener("click", function (e) { - e.stopPropagation(); - _this24.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 _this25 = 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 = _this25.getChildren(row); - - children.forEach(function (child) { - output.push(child); - }); - } - } - }); - - return output; - }; - - DataTree.prototype.getChildren = function (row) { - var _this26 = this; - - var config = row.modules.dataTree, - output = []; - - if (config.children !== false && config.open) { - if (!Array.isArray(config.children)) { - config.children = this.generateChildren(row); - } - - config.children.forEach(function (child) { - output.push(child); - - var subChildren = _this26.getChildren(child); - - subChildren.forEach(function (sub) { - output.push(sub); - }); - }); - } - - return output; - }; - - DataTree.prototype.generateChildren = function (row) { - var _this27 = this; - - var children = []; - - row.getData()[this.field].forEach(function (childData) { - var childRow = new Row(childData || {}, _this27.table.rowManager); - childRow.modules.dataTree.index = row.modules.dataTree.index + 1; - childRow.modules.dataTree.parent = row; - childRow.modules.dataTree.open = _this27.startOpen(row, 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.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)) { - if (cell.row.modules.dataTree.children !== false) { - cell.row.reinitialize(); - } - } - }; - - Tabulator.prototype.registerModule("dataTree", DataTree); - var Download = function Download(table) { - this.table = table; //hold Tabulator object - this.fields = {}; //hold filed multi dimension arrays - this.columnsByIndex = []; //hold columns in their order in the table - this.columnsByField = {}; //hold columns with lookup by field name - this.config = {}; - }; - - //trigger file download - Download.prototype.download = function (type, filename, options, interceptCallback) { - var self = this, - downloadFunc = false; - this.processConfig(); - - function buildLink(data, mime) { - if (interceptCallback) { - 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); - } - } - - this.processColumns(); - - if (downloadFunc) { - downloadFunc.call(this, self.processDefinitions(), self.processData(), options || {}, buildLink, this.config); - } - }; - - Download.prototype.processConfig = function () { - var config = { //download config - columnGroups: true, - rowGroups: true - }; - - if (this.table.options.downloadConfig) { - for (var key in this.table.options.downloadConfig) { - config[key] = this.table.options.downloadConfig[key]; - } - } - - if (config.rowGroups && this.table.options.groupBy && this.table.modExists("groupRows")) { - this.config.rowGroups = true; - } - - if (config.columnGroups && this.table.columnManager.columns.length != this.table.columnManager.columnsByIndex.length) { - this.config.columnGroups = true; - } - }; - - Download.prototype.processColumns = function () { - var self = this; - - self.columnsByIndex = []; - self.columnsByField = {}; - - self.table.columnManager.columnsByIndex.forEach(function (column) { - - if (column.field && column.visible && column.definition.download !== false) { - self.columnsByIndex.push(column); - self.columnsByField[column.field] = column; - } - }); - }; - - Download.prototype.processDefinitions = function () { - var self = this, - processedDefinitions = []; - - if (this.config.columnGroups) { - self.table.columnManager.columns.forEach(function (column) { - var colData = self.processColumnGroup(column); - - if (colData) { - processedDefinitions.push(colData); - } - }); - } else { - self.columnsByIndex.forEach(function (column) { - if (column.download !== false) { - //isolate definiton from defintion object - processedDefinitions.push(self.processDefinition(column)); - } - }); - } - - return processedDefinitions; - }; - - Download.prototype.processColumnGroup = function (column) { - var _this28 = this; - - var subGroups = column.columns; - - var groupData = { - type: "group", - title: column.definition.title - }; - - if (subGroups.length) { - groupData.subGroups = []; - groupData.width = 0; - - subGroups.forEach(function (subGroup) { - var subGroupData = _this28.processColumnGroup(subGroup); - - if (subGroupData) { - groupData.width += subGroupData.width; - groupData.subGroups.push(subGroupData); - } - }); - - if (!groupData.width) { - return false; - } - } else { - if (column.field && column.visible && column.definition.download !== false) { - groupData.width = 1; - groupData.definition = this.processDefinition(column); - } else { - return false; - } - } - - return groupData; - }; - - Download.prototype.processDefinition = function (column) { - var def = {}; - - for (var key in column.definition) { - def[key] = column.definition[key]; - } - - if (typeof column.definition.downloadTitle != "undefined") { - def.title = column.definition.downloadTitle; - } - - return def; - }; - - Download.prototype.processData = function () { - var _this29 = this; - - var self = this, - data = [], - groups = []; - - if (this.config.rowGroups) { - groups = this.table.modules.groupRows.getGroups(); - - groups.forEach(function (group) { - data.push(_this29.processGroupData(group)); - }); - } else { - data = self.table.rowManager.getData(true, "download"); - } - - //bulk data processing - if (typeof self.table.options.downloadDataFormatter == "function") { - data = self.table.options.downloadDataFormatter(data); - } - - return data; - }; - - Download.prototype.processGroupData = function (group) { - var _this30 = this; - - var subGroups = group.getSubGroups(); - - var groupData = { - type: "group", - key: group.key - }; - - if (subGroups.length) { - groupData.subGroups = []; - - subGroups.forEach(function (subGroup) { - groupData.subGroups.push(_this30.processGroupData(subGroup)); - }); - } else { - groupData.rows = group.getData(true, "download"); - } - - return groupData; - }; - - Download.prototype.triggerDownload = function (data, mime, type, filename) { - 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 (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(); - } - } - }; - - //nested field lookup - Download.prototype.getFieldValue = function (field, data) { - var column = this.columnsByField[field]; - - if (column) { - return column.getFieldValue(data); - } - - return false; - }; - - Download.prototype.commsReceived = function (table, action, data) { - switch (action) { - case "intercept": - this.download(data.type, "", data.options, data.intercept); - break; - } - }; - - //downloaders - Download.prototype.downloaders = { - csv: function csv(columns, data, options, setFileContents, config) { - var self = this, - titles = [], - fields = [], - delimiter = options && options.delimiter ? options.delimiter : ",", - fileContents; - - //build column headers - function parseSimpleTitles() { - columns.forEach(function (column) { - titles.push('"' + String(column.title).split('"').join('""') + '"'); - fields.push(column.field); - }); - } - - function parseColumnGroup(column, level) { - if (column.subGroups) { - column.subGroups.forEach(function (subGroup) { - parseColumnGroup(subGroup, level + 1); - }); - } else { - titles.push('"' + String(column.title).split('"').join('""') + '"'); - fields.push(column.definition.field); - } - } - - if (config.columnGroups) { - console.warn("Download Warning - CSV downloader cannot process column groups"); - - columns.forEach(function (column) { - parseColumnGroup(column, 0); - }); - } else { - parseSimpleTitles(); - } - - //generate header row - fileContents = [titles.join(delimiter)]; - - function parseRows(data) { - //generate each row of the table - data.forEach(function (row) { - var rowData = []; - - fields.forEach(function (field) { - var value = self.getFieldValue(field, row); - - switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { - case "object": - value = JSON.stringify(value); - break; - - case "undefined": - case "null": - value = ""; - break; - - default: - value = value; - } - - //escape quotation marks - rowData.push('"' + String(value).split('"').join('""') + '"'); - }); - - fileContents.push(rowData.join(delimiter)); - }); - } - - function parseGroup(group) { - if (group.subGroups) { - group.subGroups.forEach(function (subGroup) { - parseGroup(subGroup); - }); - } else { - parseRows(group.rows); - } - } - - if (config.rowGroups) { - console.warn("Download Warning - CSV downloader cannot process row groups"); - - data.forEach(function (group) { - parseGroup(group); - }); - } else { - parseRows(data); - } - - setFileContents(fileContents.join("\n"), "text/csv"); - }, - - json: function json(columns, data, options, setFileContents, config) { - var fileContents = JSON.stringify(data, null, '\t'); - - setFileContents(fileContents, "application/json"); - }, - - pdf: function pdf(columns, data, options, setFileContents, config) { - var self = this, - fields = [], - header = [], - body = [], - table = "", - groupRowIndexs = [], - autoTableParams = {}, - rowGroupStyles = {}, - jsPDFParams = options.jsPDF || {}, - title = options && options.title ? options.title : ""; - - if (!jsPDFParams.orientation) { - jsPDFParams.orientation = options.orientation || "landscape"; - } - - if (!jsPDFParams.unit) { - jsPDFParams.unit = "pt"; - } - - //build column headers - function parseSimpleTitles() { - columns.forEach(function (column) { - if (column.field) { - header.push(column.title || ""); - fields.push(column.field); - } - }); - } - - function parseColumnGroup(column, level) { - if (column.subGroups) { - column.subGroups.forEach(function (subGroup) { - parseColumnGroup(subGroup, level + 1); - }); - } else { - header.push(column.title || ""); - fields.push(column.definition.field); - } - } - - if (config.columnGroups) { - console.warn("Download Warning - PDF downloader cannot process column groups"); - - columns.forEach(function (column) { - parseColumnGroup(column, 0); - }); - } else { - parseSimpleTitles(); - } - - function parseValue(value) { - switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { - case "object": - value = JSON.stringify(value); - break; - - case "undefined": - case "null": - value = ""; - break; - - default: - value = value; - } - - return value; - } - - function parseRows(data) { - //build table rows - data.forEach(function (row) { - var rowData = []; - - fields.forEach(function (field) { - var value = self.getFieldValue(field, row); - rowData.push(parseValue(value)); - }); - - body.push(rowData); - }); - } - - function parseGroup(group) { - var groupData = []; - - groupData.push(parseValue(group.key)); - - groupRowIndexs.push(body.length); - - body.push(groupData); - - if (group.subGroups) { - group.subGroups.forEach(function (subGroup) { - parseGroup(subGroup); - }); - } else { - parseRows(group.rows); - } - } - - if (config.rowGroups) { - data.forEach(function (group) { - parseGroup(group); - }); - } else { - parseRows(data); - } - - 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 (config.rowGroups) { - var createdCell = function createdCell(cell, data) { - if (groupRowIndexs.indexOf(data.row.index) > -1) { - for (var key in rowGroupStyles) { - cell.styles[key] = rowGroupStyles[key]; - } - } - }; - - rowGroupStyles = options.rowGroupStyles || { - fontStyle: "bold", - fontSize: 12, - cellPadding: 6, - fillColor: 220 - }; - - if (!autoTableParams.createdCell) { - autoTableParams.createdCell = createdCell; - } else { - var createdCellHolder = autoTableParams.createdCell; - - autoTableParams.createdCell = function (cell, data) { - createdCell(cell, data); - createdCellHolder(cell, data); - }; - } - } - - if (title) { - autoTableParams.addPageContent = function (data) { - doc.text(title, 40, 30); - }; - } - - doc.autoTable(header, body, autoTableParams); - - setFileContents(doc.output("arraybuffer"), "application/pdf"); - }, - - xlsx: function xlsx(columns, data, options, setFileContents, config) { - var self = this, - sheetName = options.sheetName || "Sheet1", - workbook = { SheetNames: [], Sheets: {} }, - groupRowIndexs = [], - groupColumnIndexs = [], - output; - - function generateSheet() { - var titles = [], - fields = [], - rows = [], - worksheet; - - //convert rows to worksheet - function rowsToSheet() { - var sheet = {}; - var range = { s: { c: 0, r: 0 }, e: { c: fields.length, r: rows.length } }; - - XLSX.utils.sheet_add_aoa(sheet, rows); - - sheet['!ref'] = XLSX.utils.encode_range(range); - - var merges = generateMerges(); - - if (merges.length) { - sheet["!merges"] = merges; - } - - return sheet; - } - - function parseSimpleTitles() { - //get field lists - columns.forEach(function (column) { - titles.push(column.title); - fields.push(column.field); - }); - - rows.push(titles); - } - - function parseColumnGroup(column, level) { - - if (typeof titles[level] === "undefined") { - titles[level] = []; - } - - if (typeof groupColumnIndexs[level] === "undefined") { - groupColumnIndexs[level] = []; - } - - if (column.width > 1) { - - groupColumnIndexs[level].push({ - type: "hoz", - start: titles[level].length, - end: titles[level].length + column.width - 1 - }); - } - - titles[level].push(column.title); - - if (column.subGroups) { - column.subGroups.forEach(function (subGroup) { - parseColumnGroup(subGroup, level + 1); - }); - } else { - fields.push(column.definition.field); - padColumnTitles(fields.length - 1, level); - - groupColumnIndexs[level].push({ - type: "vert", - start: fields.length - 1 - }); - } - } - - function padColumnTitles() { - var max = 0; - - titles.forEach(function (title) { - var len = title.length; - if (len > max) { - max = len; - } - }); - - titles.forEach(function (title) { - var len = title.length; - if (len < max) { - for (var i = len; i < max; i++) { - title.push(""); - } - } - }); - } - - if (config.columnGroups) { - columns.forEach(function (column) { - parseColumnGroup(column, 0); - }); - - titles.forEach(function (title) { - rows.push(title); - }); - } else { - parseSimpleTitles(); - } - - function generateMerges() { - var output = []; - - groupRowIndexs.forEach(function (index) { - output.push({ s: { r: index, c: 0 }, e: { r: index, c: fields.length - 1 } }); - }); - - groupColumnIndexs.forEach(function (merges, level) { - merges.forEach(function (merge) { - if (merge.type === "hoz") { - output.push({ s: { r: level, c: merge.start }, e: { r: level, c: merge.end } }); - } else { - if (level != titles.length - 1) { - output.push({ s: { r: level, c: merge.start }, e: { r: titles.length - 1, c: merge.start } }); - } - } - }); - }); - - return output; - } - - //generate each row of the table - function parseRows(data) { - data.forEach(function (row) { - var rowData = []; - - fields.forEach(function (field) { - var value = self.getFieldValue(field, row); - - rowData.push((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === "object" ? JSON.stringify(value) : value); - }); - - rows.push(rowData); - }); - } - - function parseGroup(group) { - var groupData = []; - - groupData.push(group.key); - - groupRowIndexs.push(rows.length); - - rows.push(groupData); - - if (group.subGroups) { - group.subGroups.forEach(function (subGroup) { - parseGroup(subGroup); - }); - } else { - parseRows(group.rows); - } - } - - if (config.rowGroups) { - data.forEach(function (group) { - parseGroup(group); - }); - } else { - parseRows(data); - } - - worksheet = rowsToSheet(); - - 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 }, - intercept: function intercept(data) { - workbook.Sheets[sheet] = data; - } - }); - } - } - } else { - workbook.SheetNames.push(sheetName); - workbook.Sheets[sheetName] = generateSheet(); - } - - //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"); - } - - }; - - 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; - }; - - //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 WANRING - the tick editor has been depricated, 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 WANRING - the tick editor has been depricated, 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 () { - var cell = this.currentCell, - cellEl; - - this.invalidEdit = false; - - if (cell) { - this.currentCell = false; - - cellEl = cell.getElement(); - 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(); - cell.setValueActual(cell.getValue()); - - 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(); - } - }); - - 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) { - this.recursionBlock = true; - cell.getElement().focus(); - this.recursionBlock = false; - }; - - Edit.prototype.editCell = function (cell, forceEdit) { - this.focusCellNoEvent(cell); - this.edit(cell, false, forceEdit); - }; - - 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")) { - valid = self.table.modules.validate.validate(cell.column.modules.validate, cell.getComponent(), value); - } - - if (valid === true) { - self.clearEditor(); - cell.setValue(value, true); - - if (self.table.options.dataTree && self.table.modExists("dataTree")) { - self.table.modules.dataTree.checkForRestyle(cell); - } - } else { - self.invalidEdit = true; - element.classList.add("tabulator-validation-fail"); - self.focusCellNoEvent(cell); - rendered(); - self.table.options.validationFailed.call(self.table, cell.getComponent(), value, valid); - } - } 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; - - 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; - } - }; - - //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", "text"); - - input.style.padding = "4px"; - input.style.width = "100%"; - input.style.boxSizing = "border-box"; - - input.value = typeof cellValue !== "undefined" ? cellValue : ""; - - onRendered(function () { - input.focus(); - input.style.height = "100%"; - }); - - function onChange(e) { - if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value != cellValue) { - success(input.value); - } 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 13: - success(input.value); - break; - - case 27: - cancel(); - break; - } - }); - - return input; - }, - - //resizable text area element - textarea: function textarea(cell, onRendered, success, cancel, editorParams) { - var self = this, - cellValue = cell.getValue(), - value = String(cellValue !== null && 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"; - - input.value = value; - - onRendered(function () { - input.focus(); - input.style.height = "100%"; - }); - - function onChange(e) { - - if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value != cellValue) { - success(input.value); - 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) { - if (e.keyCode == 27) { - cancel(); - } - }); - - return input; - }, - - //input element with type of number - number: function number(cell, onRendered, success, cancel, editorParams) { - - var cellValue = cell.getValue(), - 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"; - - input.value = cellValue; - - onRendered(function () { - input.focus(); - input.style.height = "100%"; - - //submit new value on blur - input.addEventListener("blur", function (e) { - onChange(); - }); - }); - - function onChange() { - var value = input.value; - - if (!isNaN(value) && value !== "") { - value = Number(value); - } - - if (value != cellValue) { - success(value); - } 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; - } - }); - - 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"; - - input.value = cellValue; - - onRendered(function () { - input.focus(); - input.style.height = "100%"; - }); - - function onChange() { - var value = input.value; - - if (!isNaN(value) && value !== "") { - value = Number(value); - } - - if (value != cellValue) { - success(value); - } 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(), - input = document.createElement("input"), - listEl = document.createElement("div"), - dataItems = [], - displayItems = [], - currentItem = {}, - blurable = true; - - if (Array.isArray(editorParams) || !Array.isArray(editorParams) && (typeof editorParams === 'undefined' ? 'undefined' : _typeof(editorParams)) === "object" && !editorParams.values) { - console.warn("DEPRECATION WANRING - 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() { - var output = {}, - column = cell.getColumn()._getSelf(), - data = self.table.getData(); - - data.forEach(function (row) { - var val = column.getFieldValue(row); - - if (val !== null && typeof val !== "undefined" && val !== "") { - output[val] = true; - } - }); - - return Object.keys(output); - } - - function parseItems(inputValues, curentValue) { - var dataList = []; - var displayList = []; - - function processComplexListItem(item) { - var item = { - label: editorParams.listItemFormatter ? editorParams.listItemFormatter(item.value, item.label) : item.label, - value: item.value, - element: false - }; - - if (item.value === curentValue) { - setCurrentItem(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, - element: false - }; - - displayList.push(item); - - value.options.forEach(function (item) { - processComplexListItem(item); - }); - } else { - processComplexListItem(value); - } - } else { - item = { - label: editorParams.listItemFormatter ? editorParams.listItemFormatter(value, value) : value, - value: value, - element: false - }; - - if (item.value === curentValue) { - setCurrentItem(item); - } - - dataList.push(item); - displayList.push(item); - } - }); - } else { - for (var key in inputValues) { - var item = { - label: editorParams.listItemFormatter ? editorParams.listItemFormatter(key, inputValues[key]) : inputValues[key], - value: key, - element: false - }; - - if (item.value === curentValue) { - setCurrentItem(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) { - - if (item.group) { - el = document.createElement("div"); - el.classList.add("tabulator-edit-select-list-group"); - el.tabIndex = 0; - el.innerHTML = item.label === "" ? " " : item.label; - } else { - el = document.createElement("div"); - 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 (item === currentItem) { - el.classList.add("active"); - } - } - - el.addEventListener("mousedown", function () { - blurable = false; - - setTimeout(function () { - blurable = true; - }, 10); - }); - - item.element = el; - } - - listEl.appendChild(el); - }); - } - - function setCurrentItem(item) { - - if (currentItem && currentItem.element) { - currentItem.element.classList.remove("active"); - } - - currentItem = item; - input.value = item.label === " " ? "" : item.label; - - if (item.element) { - item.element.classList.add("active"); - } - } - - function chooseItem() { - hideList(); - - if (initialValue !== currentItem.value) { - initialValue = currentItem.value; - success(currentItem.value); - } else { - cancel(); - } - } - - function cancelItem() { - hideList(); - cancel(); - } - - function showList() { - if (!listEl.parentNode) { - - if (editorParams.values === true) { - parseItems(getUniqueColumnValues(), initialValue); - } else { - parseItems(editorParams.values || [], initialValue); - } - - 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 hideList() { - if (listEl.parentNode) { - listEl.parentNode.removeChild(listEl); - } - } - - //style input - input.setAttribute("type", "text"); - - input.style.padding = "4px"; - input.style.width = "100%"; - input.style.boxSizing = "border-box"; - input.readOnly = true; - - //allow key based navigation - input.addEventListener("keydown", function (e) { - var index; - - switch (e.keyCode) { - case 38: - //up arrow - e.stopImmediatePropagation(); - e.stopPropagation(); - - index = dataItems.indexOf(currentItem); - - if (index > 0) { - setCurrentItem(dataItems[index - 1]); - } - break; - - case 40: - //down arrow - e.stopImmediatePropagation(); - e.stopPropagation(); - - index = dataItems.indexOf(currentItem); - - if (index < dataItems.length - 1) { - if (index == -1) { - setCurrentItem(dataItems[0]); - } else { - setCurrentItem(dataItems[index + 1]); - } - } - break; - - case 13: - //enter - chooseItem(); - break; - - case 27: - //escape - cancelItem(); - break; - } - }); - - input.addEventListener("blur", function (e) { - if (blurable) { - 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(); - }); - - return input; - }, - - //autocomplete - autocomplete: function autocomplete(cell, onRendered, success, cancel, editorParams) { - var self = this, - cellEl = cell.getElement(), - initialValue = cell.getValue(), - input = document.createElement("input"), - listEl = document.createElement("div"), - allItems = [], - displayItems = [], - values = [], - currentItem = {}, - blurable = true; - - function getUniqueColumnValues() { - var output = {}, - column = cell.getColumn()._getSelf(), - data = self.table.getData(); - - data.forEach(function (row) { - var val = column.getFieldValue(row); - - if (val !== null && typeof val !== "undefined" && val !== "") { - output[val] = true; - } - }); - - return Object.keys(output); - } - - function parseItems(inputValues, curentValue) { - var itemList = []; - - if (Array.isArray(inputValues)) { - inputValues.forEach(function (value) { - var item = { - title: editorParams.listItemFormatter ? editorParams.listItemFormatter(value, value) : value, - value: value, - element: false - }; - - if (item.value === curentValue) { - setCurrentItem(item); - } - - itemList.push(item); - }); - } else { - for (var key in inputValues) { - var item = { - title: editorParams.listItemFormatter ? editorParams.listItemFormatter(key, inputValues[key]) : inputValues[key], - value: key, - element: false - }; - - if (item.value === curentValue) { - setCurrentItem(item); - } - - itemList.push(item); - } - } - - allItems = itemList; - } - - function filterList(term, intialLoad) { - var matches = []; - - if (editorParams.searchFunc) { - matches = editorParams.searchFunc(term, values); - } else { - if (term === "") { - - if (editorParams.showListOnEmpty) { - allItems.forEach(function (item) { - matches.push(item); - }); - } - } else { - allItems.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); - } - } - }); - } - } - - displayItems = matches; - - fillList(intialLoad); - } - - function fillList(intialLoad) { - var current = false; - - while (listEl.firstChild) { - listEl.removeChild(listEl.firstChild); - }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 () { - setCurrentItem(item); - chooseItem(); - }); - - el.addEventListener("mousedown", function () { - 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 setCurrentItem(item, showInputValue) { - if (currentItem && currentItem.element) { - currentItem.element.classList.remove("active"); - } - - currentItem = item; - - if (item && item.element) { - item.element.classList.add("active"); - } - } - - function chooseItem() { - hideList(); - - if (currentItem) { - if (initialValue !== currentItem.value) { - initialValue = currentItem.value; - input.value = currentItem.value; - success(input.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 cancelItem() { - hideList(); - cancel(); - } - - function showList() { - if (!listEl.parentNode) { - while (listEl.firstChild) { - listEl.removeChild(listEl.firstChild); - }if (editorParams.values === true) { - values = getUniqueColumnValues(); - } else { - values = editorParams.values || []; - } - - parseItems(values, initialValue); - - 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 hideList() { - if (listEl.parentNode) { - listEl.parentNode.removeChild(listEl); - } - } - - //style input - input.setAttribute("type", "text"); - - input.style.padding = "4px"; - input.style.width = "100%"; - input.style.boxSizing = "border-box"; - - //allow key based navigation - input.addEventListener("keydown", function (e) { - var index; - - switch (e.keyCode) { - case 38: - //up arrow - e.stopImmediatePropagation(); - e.stopPropagation(); - - index = displayItems.indexOf(currentItem); - - if (index > 0) { - setCurrentItem(displayItems[index - 1]); - } else { - setCurrentItem(false); - } - break; - - case 40: - //down arrow - e.stopImmediatePropagation(); - e.stopPropagation(); - - index = displayItems.indexOf(currentItem); - - if (index < displayItems.length - 1) { - if (index == -1) { - setCurrentItem(displayItems[0]); - } else { - setCurrentItem(displayItems[index + 1]); - } - } - break; - - case 13: - //enter - chooseItem(); - break; - - case 27: - //escape - cancelItem(); - 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("blur", function (e) { - if (blurable) { - chooseItem(); - } - }); - - input.addEventListener("focus", function (e) { - showList(); - input.value = initialValue; - filterList(initialValue, true); - }); - - //style list element - listEl = document.createElement("div"); - listEl.classList.add("tabulator-edit-select-list"); - - onRendered(function () { - input.style.height = "100%"; - input.focus(); - }); - - return input; - }, - - //start 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 nextStar = star.cloneNode(true); - - stars.push(nextStar); - - nextStar.addEventListener("mouseover", function (e) { - e.stopPropagation(); - starChange(i); - }); - - nextStar.addEventListener("click", function (e) { - e.stopPropagation(); - success(i); - }); - - starsHolder.appendChild(nextStar); - } - - //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"; - - //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("mouseover", 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 = "absolute"; - bar.style.top = "8px"; - bar.style.bottom = "8px"; - bar.style.left = "4px"; - bar.style.marginRight = "4px"; - bar.style.backgroundColor = "#488CE9"; - bar.style.maxWidth = "100%"; - bar.style.minWidth = "0%"; - - //style cell - element.style.padding = "0 4px"; - - //make sure value is in range - value = Math.min(parseFloat(value), max); - value = Math.max(parseFloat(value), min); - - //workout percentage - value = 100 - Math.round((value - min) / percent); - bar.style.right = 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 - bar.style.width = bar.clientWidth + element.clientWidth / 100 + "px"; - break; - - case 37: - //left arrow - bar.style.width = bar.clientWidth - element.clientWidth / 100 + "px"; - break; - - 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"; - - 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(); - }); - } - - 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 Filter = function Filter(table) { - - this.table = table; //hold Tabulator object - - this.filterList = []; //hold filter list - this.headerFilters = {}; //hold column filters - this.headerFilterElements = []; //hold header filter elements for manipulation - this.headerFilterColumns = []; //hold columns that use header filters - - 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(), - prevSuccess, - 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 = "", - filterFunc; - - if (typeof prevSuccess === "undefined" || prevSuccess !== value) { - - 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) { - return self.filters[column.definition.headerFilterFunc](value, column.getFieldValue(data)); - }; - } 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) { - return String(column.getFieldValue(data)).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 }; - } else { - delete self.headerFilters[field]; - } - - self.changed = true; - - self.table.rowManager.filterRefresh(); - } - } - - column.modules.filter = { - success: success, - attrType: false, - tagType: false, - emptyFunc: false - }; - - this.generateHeaderFilterElement(column); - }; - - Filter.prototype.generateHeaderFilterElement = function (column, initialValue) { - 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) { - var oldFilterElement = column.modules.filter.headerElement.parentNode; - var oldFilterElementIndex = self.headerFilterElements.indexOf(oldFilterElement); - if (oldFilterElementIndex >= 0) { - self.headerFilterElements.splice(oldFilterElementIndex, 1); - } - - var oldColumnIndex = self.headerFilterColumns.indexOf(oldColumnIndex); - if (oldColumnIndex >= 0) { - self.headerFilterColumns.splice(oldColumnIndex, 1); - } - - column.contentElement.removeChild(oldFilterElement); - } - - 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(); - }); - - //live update filters as user types - typingTimer = false; - - searchTrigger = function searchTrigger(e) { - if (typingTimer) { - clearTimeout(typingTimer); - } - - typingTimer = setTimeout(function () { - success(editorElement.value); - }, 300); - }; - - 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.editor === "autocomplete" && 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); - - self.headerFilterElements.push(editorElement); - 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.headerFilterElements.forEach(function (element) { - element.style.display = 'none'; - }); - }; - - //show all header filter elements (used to ensure correct column widths in "fitData" layout mode) - Filter.prototype.showHeaderFilterElements = function () { - this.headerFilterElements.forEach(function (element) { - element.style.display = ''; - }); - }; - - //programatically set value 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()); - } - }; - - //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); - 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); - } 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) { - var self = this; - - self.filterList = []; - - if (!Array.isArray(field)) { - field = [{ field: field, type: type, value: value }]; - } - - self.addFilter(field); - }; - - //add filter to array - Filter.prototype.addFilter = function (field, type, value) { - var self = this; - - if (!Array.isArray(field)) { - field = [{ field: field, type: type, value: value }]; - } - - field.forEach(function (filter) { - - filter = self.findFilter(filter); - - if (filter) { - self.filterList.push(filter); - - self.changed = true; - } - }); - - if (this.table.options.persistentFilter && this.table.modExists("persistence", true)) { - 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)); - }; - } else { - filterFunc = function filterFunc(data) { - return self.filters[filter.type](filter.value, data[filter.field]); - }; - } - } 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 self = this, - output = []; - - if (all) { - output = self.getHeaderFilters(); - } - - self.filterList.forEach(function (filter) { - output.push({ field: filter.field, type: filter.type, value: filter.value }); - }); - - if (ajax) { - output.forEach(function (item) { - if (typeof item.type == "function") { - item.type = "function"; - } - }); - } - - 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.persistentFilter && this.table.modExists("persistence", true)) { - 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.persistentFilter && this.table.modExists("persistence", true)) { - this.table.modules.persistence.save("filter"); - } - }; - - //clear header filters - Filter.prototype.clearHeaderFilter = function () { - var self = this; - - this.headerFilters = {}; - - this.headerFilterColumns.forEach(function (column) { - column.modules.filter.value = null; - 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) { - return rowVal == filterVal ? true : false; - }, - - //less than - "<": function _(filterVal, rowVal) { - return rowVal < filterVal ? true : false; - }, - - //less than or equal to - "<=": function _(filterVal, rowVal) { - return rowVal <= filterVal ? true : false; - }, - - //greater than - ">": function _(filterVal, rowVal) { - return rowVal > filterVal ? true : false; - }, - - //greater than or equal to - ">=": function _(filterVal, rowVal) { - return rowVal >= filterVal ? true : false; - }, - - //not equal to - "!=": function _(filterVal, rowVal) { - return rowVal != filterVal ? true : false; - }, - - "regex": function regex(filterVal, rowVal) { - - if (typeof filterVal == "string") { - filterVal = new RegExp(filterVal); - } - - return filterVal.test(rowVal); - }, - - //contains the string - "like": function like(filterVal, rowVal) { - 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 ? true : false; - } else { - return false; - } - } - }, - - //in array - "in": function _in(filterVal, rowVal) { - 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) { - var self = this, - config = { params: column.definition.formatterParams || {} }; - - //set column formatter - switch (_typeof(column.definition.formatter)) { - case "string": - - if (column.definition.formatter === "tick") { - column.definition.formatter = "tickCross"; - - if (typeof config.params.crossElement == "undefined") { - config.params.crossElement = false; - } - - console.warn("DEPRECATION WANRING - the tick formatter has been depricated, please use the tickCross formatter with the crossElement param set to false"); - } - - if (self.formatters[column.definition.formatter]) { - config.formatter = self.formatters[column.definition.formatter]; - } else { - console.warn("Formatter Error - No such formatter found: ", column.definition.formatter); - config.formatter = self.formatters.plaintext; - } - break; - - case "function": - config.formatter = column.definition.formatter; - break; - - default: - config.formatter = self.formatters.plaintext; - break; - } - - column.modules.format = config; - }; - - Format.prototype.cellRendered = function (cell) { - if (cell.column.modules.format.renderedCallback) { - cell.column.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) { - cell.column.modules.format.renderedCallback = callback; - } - - return cell.column.modules.format.formatter.call(this, component, params, onRendered); - }; - - 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; - }; - - //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 = this.sanitizeHTML(cell.getValue()), - urlPrefix = formatterParams.urlPrefix || "", - label = this.emptyToSpace(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 (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); - } - - el.innerHTML = this.emptyToSpace(label); - - return el; - }, - - //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 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 = parseInt(value) < maxStars ? parseInt(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; - }, - - //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); - - return "
              " + (legend ? "
              " + legend + "
              " : ""); - }, - - //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"); - - function toggleList(isOpen) { - var collapse = cell.getRow().getElement().getElementsByClassName("tabulator-responsive-collapse")[0]; - - open = isOpen; - - if (open) { - el.classList.add("open"); - if (collapse) { - collapse.style.display = ''; - } - } else { - el.classList.remove("open"); - if (collapse) { - collapse.style.display = 'none'; - } - } - } - - el.classList.add("tabulator-responsive-collapse-toggle"); - el.innerHTML = "+-"; - - cell.getElement().classList.add("tabulator-row-handle"); - - if (self.table.options.responsiveLayoutCollapseStartOpen) { - open = true; - } - - el.addEventListener("click", function () { - toggleList(!open); - }); - - toggleList(open); - - return el; - } - }; - - 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.initializationMode = "left"; - this.active = false; - }; - - //reset initial state - FrozenColumns.prototype.reset = function () { - this.initializationMode = "left"; - this.leftColumns = []; - this.rightColumns = []; - this.active = false; - }; - - //initialize specific column - FrozenColumns.prototype.initializeColumn = function (column) { - var config = { margin: 0, edge: false }; - - if (column.definition.frozen) { - - if (!column.parent.isGroup) { - - if (!column.isGroup) { - 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 { - console.warn("Frozen Column Error - Column Groups cannot be frozen"); - } - } else { - console.warn("Frozen Column Error - Grouped columns cannot be frozen"); - } - } else { - this.initializationMode = "right"; - } - }; - - //layout columns appropropriatly - FrozenColumns.prototype.layout = function () { - var self = this, - tableHolder = this.table.rowManager.element, - rightMargin = 0; - - if (self.active) { - - //calculate row padding - - self.leftMargin = self._calcSpace(self.leftColumns, self.leftColumns.length); - self.table.columnManager.headersElement.style.marginLeft = self.leftMargin + "px"; - - self.rightMargin = self._calcSpace(self.rightColumns, self.rightColumns.length); - self.table.columnManager.element.style.paddingRight = self.rightMargin + "px"; - - self.table.rowManager.activeRows.forEach(function (row) { - self.layoutRow(row); - }); - - if (self.table.modExists("columnCalcs")) { - if (self.table.modules.columnCalcs.topInitialized && self.table.modules.columnCalcs.topRow) { - self.layoutRow(self.table.modules.columnCalcs.topRow); - } - if (self.table.modules.columnCalcs.botInitialized && self.table.modules.columnCalcs.botRow) { - self.layoutRow(self.table.modules.columnCalcs.botRow); - } - } - - //calculate left columns - self.leftColumns.forEach(function (column, i) { - column.modules.frozen.margin = self._calcSpace(self.leftColumns, i) + self.table.columnManager.scrollLeft; - - if (i == self.leftColumns.length - 1) { - column.modules.frozen.edge = true; - } else { - column.modules.frozen.edge = false; - } - - self.layoutColumn(column); - }); - - //calculate right frozen columns - rightMargin = self.table.rowManager.element.clientWidth + self.table.columnManager.scrollLeft; - - // if(tableHolder.scrollHeight > tableHolder.clientHeight){ - // rightMargin -= tableHolder.offsetWidth - tableHolder.clientWidth; - // } - - self.rightColumns.forEach(function (column, i) { - column.modules.frozen.margin = rightMargin - self._calcSpace(self.rightColumns, i + 1); - - if (i == self.rightColumns.length - 1) { - column.modules.frozen.edge = true; - } else { - column.modules.frozen.edge = false; - } - - self.layoutColumn(column); - }); - - this.table.rowManager.tableElement.style.marginRight = this.rightMargin + "px"; - } - }; - - FrozenColumns.prototype.layoutColumn = function (column) { - var self = this; - - self.layoutElement(column.getElement(), column); - - column.cells.forEach(function (cell) { - self.layoutElement(cell.getElement(), column); - }); - }; - - FrozenColumns.prototype.layoutRow = function (row) { - var rowEl = row.getElement(); - - rowEl.style.paddingLeft = this.leftMargin + "px"; - // rowEl.style.paddingRight = this.rightMargin + "px"; - }; - - FrozenColumns.prototype.layoutElement = function (element, column) { - - if (column.modules.frozen) { - element.style.position = "absolute"; - element.style.left = column.modules.frozen.margin + "px"; - - 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); - 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.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 () { - 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.visible = oldGroup ? oldGroup.visible : typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0]; - - this.createElements(); - this.addBindings(); - - this.createValueGroups(); - }; - - Group.prototype.createElements = function () { - 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-arrow"); - }; - - Group.prototype.createValueGroups = function () { - var _this31 = this; - - var level = this.level + 1; - if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { - this.groupManager.allowedValues[level].forEach(function (value) { - _this31._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(e, self.getComponent()); - }); - } - - if (self.groupManager.table.options.groupDblClick) { - self.element.addEventListener("dblclick", function (e) { - self.groupManager.table.options.groupDblClick(e, self.getComponent()); - }); - } - - if (self.groupManager.table.options.groupContext) { - self.element.addEventListener("contextmenu", function (e) { - self.groupManager.table.options.groupContext(e, self.getComponent()); - }); - } - - if (self.groupManager.table.options.groupTap) { - - tap = false; - - self.element.addEventListener("touchstart", function (e) { - tap = 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); - }); - - 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); - } - }; - - 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); - - if (index > -1) { - this.rows.splice(index, 1); - } - - if (!this.rows.length) { - if (this.parent) { - this.parent.removeGroup(this); - } else { - this.groupManager.removeGroup(this); - } - - this.groupManager.updateGroupRows(true); - } else { - 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 = 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 = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); - output.push(this.calcs.bottom); - } - } - } else { - if (!this.groupList.length && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.options.groupClosedShowCalcs) { - 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 = 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 = 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 () { - return new GroupComponent(this); - }; - - ////////////////////////////////////////////////// - ////////////// 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; - - 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.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) { - this.groupList.forEach(function (group) { - group.arrowElement.style.marginLeft = left + "px"; - }); - }; - - 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); - - this._rebindRow(action.component, newRow); - }, - - rowMove: function rowMove(action) { - this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.pos], false); - 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._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.pos], false); - 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) { - var attributes = element.attributes; - - 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-", ""); - - for (var key in options) { - if (key.toLowerCase() == name) { - options[key] = 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); - - for (var i in attributes) { - var attrib = attributes[i], - name; - - if (attrib && (typeof attrib === 'undefined' ? 'undefined' : _typeof(attrib)) == "object" && attrib.name && attrib.name.indexOf("tabulator-") === 0) { - - name = attrib.name.replace("tabulator-", ""); - - col[name] = this._attribValue(attrib.value); - } - } - - 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 _this32 = this; - - var self = this; - - var _loop2 = function _loop2(key) { - - if (_this32.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 - }; - - 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; - - 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) { - 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; - - if (this.table.modExists("edit")) { - cell = this.table.modules.edit.currentCell; - - if (cell) { - e.preventDefault(); - cell.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(!this.table.options.selectable || this.table.options.selectable == "highlight" ? "active" : "selected", null, null, null, true); - } - } - } - }; - - Tabulator.prototype.registerModule("keybindings", Keybindings); - 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.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 (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) { - 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); - } - } - }); - } - - column.modules.moveColumn = config; - }; - - MoveColumns.prototype.startMove = function (e, column) { - var element = column.getElement(); - - this.moving = column; - this.startX = 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"; - - 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._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.moveColumn(this.moving, this.toCol, this.toColAfter); - } - - this.moving = false; - this.toCol = false; - this.toColAfter = false; - - 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 = 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.connection = false; - 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.connection = this.table.options.movableRowsConnectedTables; - }; - - MoveRows.prototype.setHandle = function (handle) { - this.hasHandle = handle; - }; - - 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); - } - } - }); - } - - 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); - } - } - }); - }; - - MoveRows.prototype._bindMouseMove = function () { - var self = this; - - self.table.rowManager.getDisplayRows().forEach(function (row) { - if (row.type === "row" && 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.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 element, position; - - element = row.getElement(); - if (this.connection) { - position = element.getBoundingClientRect(); - - this.startX = position.left - e.pageX + window.scrollX; - this.startY = position.top - e.pageY + window.scrollY; - } else { - this.startY = e.pageY - element.getBoundingClientRect().top; - } - }; - - MoveRows.prototype.endMove = function (e) { - if (!e || e.which === 1) { - 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 = 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 + e.pageX + "px"; - this.hoverElement.style.top = this.startY + e.pageY + "px"; - }; - - //establish connection with other tables - MoveRows.prototype.connectToTables = function (row) { - var self = this, - connections = this.table.modules.comms.getConnections(this.connection); - - this.table.options.movableRowsSendingStart.call(this.table, connections); - - this.table.modules.comms.send(this.connection, "moveRow", "connect", { - row: row - }); - }; - - //disconnect from other tables - MoveRows.prototype.disconnectFromTables = function () { - var self = this, - connections = this.table.modules.comms.getConnections(this.connection); - - this.table.options.movableRowsSendingStop.call(this.table, connections); - - this.table.modules.comms.send(this.connection, "moveRow", "disconnect"); - }; - - //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; - - 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, update) { - 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(data); - - if (!update || update && 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; - - if (mutator) { - return mutator.mutator(value, cell.row.getData(), "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.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"); - }; - - //setup pageination - Page.prototype.initialize = function (hidden) { - var self = this; - - //update param names - for (var key in self.table.options.paginationDataSent) { - self.paginationDataSentNames[key] = self.table.options.paginationDataSent[key]; - } - - for (var _key2 in self.table.options.paginationDataReceived) { - self.paginationDataReceivedNames[_key2] = self.table.options.paginationDataReceived[_key2]; - } - - //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; - } - - //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; - self.size = self.table.options.paginationSize || Math.floor(self.table.rowManager.getElement().clientHeight / 24); - self.count = self.table.options.paginationButtonCount; - }; - - 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 = 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) { - if (this.mode == "local" || force) { - this.page = 1; - } - return true; - }; - - //set the maxmum page - Page.prototype.setMaxPage = function (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 _this33 = this; - - return new Promise(function (resolve, reject) { - if (page > 0 && page <= _this33.max) { - _this33.page = page; - _this33.trigger().then(function () { - resolve(); - }).catch(function () { - reject(); - }); - } else { - console.warn("Pagination Error - Requested page is out of range of 1 - " + _this33.max + ":", page); - reject(); - } - }); - }; - - Page.prototype.setPageSize = function (size) { - if (size > 0) { - this.size = size; - } - }; - - //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"); - button.setAttribute("aria-label", "Show Page " + page); - button.setAttribute("title", "Show Page " + 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 _this34 = this; - - return new Promise(function (resolve, reject) { - if (_this34.page > 1) { - _this34.page--; - _this34.trigger().then(function () { - resolve(); - }).catch(function () { - reject(); - }); - } else { - console.warn("Pagination Error - Previous page would be less than page 1:", 0); - reject(); - } - }); - }; - - //next page - Page.prototype.nextPage = function () { - var _this35 = this; - - return new Promise(function (resolve, reject) { - if (_this35.page < _this35.max) { - _this35.page++; - _this35.trigger().then(function () { - resolve(); - }).catch(function () { - reject(); - }); - } else { - if (!_this35.progressiveLoad) { - console.warn("Pagination Error - Next page would be greater than maximum page of " + _this35.max + ":", _this35.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 = []; - 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 _this36 = this; - - var left; - - return new Promise(function (resolve, reject) { - - switch (_this36.mode) { - case "local": - left = _this36.table.rowManager.scrollLeft; - - _this36.table.rowManager.refreshActiveData("page"); - _this36.table.rowManager.scrollHorizontal(left); - - _this36.table.options.pageLoaded.call(_this36.table, _this36.getPage()); - resolve(); - break; - - case "remote": - case "progressive_load": - case "progressive_scroll": - _this36.table.modules.ajax.blockActiveRequest(); - _this36._getRemotePage().then(function () { - resolve(); - }).catch(function () { - reject(); - }); - break; - - default: - console.warn("Pagination Error - no such pagination mode:", _this36.mode); - reject(); - } - }); - }; - - Page.prototype._getRemotePage = function () { - var _this37 = 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[_this37.paginationDataSentNames.page] = self.page; - - //set page size if defined - if (_this37.size) { - pageParams[_this37.paginationDataSentNames.size] = _this37.size; - } - - //set sort data if defined - if (_this37.table.options.ajaxSorting && _this37.table.modExists("sort")) { - var sorters = self.table.modules.sort.getSort(); - - sorters.forEach(function (item) { - delete item.column; - }); - - pageParams[_this37.paginationDataSentNames.sorters] = sorters; - } - - //set filter data if defined - if (_this37.table.options.ajaxFiltering && _this37.table.modExists("filter")) { - var filters = self.table.modules.filter.getFilters(true, true); - pageParams[_this37.paginationDataSentNames.filters] = filters; - } - - self.table.modules.ajax.setParams(pageParams); - - self.table.modules.ajax.sendRequest(_this37.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.paginationDataReceivedNames.last_page] === "undefined") { - console.warn("Remote Pagination Error - Server response missing '" + this.paginationDataReceivedNames.last_page + "' property"); - } - - if (data[this.paginationDataReceivedNames.data]) { - this.max = parseInt(data[this.paginationDataReceivedNames.last_page]) || 1; - - if (this.progressiveLoad) { - switch (this.mode) { - case "progressive_load": - this.table.rowManager.addRows(data[this.paginationDataReceivedNames.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.paginationDataReceivedNames.data]); - - this.table.rowManager.setData(data, true); - - 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.paginationDataReceivedNames.data]); - - this.table.rowManager.scrollHorizontal(left); - - this.table.columnManager.scrollHorizontal(left); - - this.table.options.pageLoaded.call(this.table, this.getPage()); - } - } else { - console.warn("Remote Pagination Error - Server response missing '" + this.paginationDataReceivedNames.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" - }; - - //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"]; - }; - - //setup parameters - Persistence.prototype.initialize = function (mode, id) { - //determine persistent layout storage type - this.mode = mode !== true ? mode : typeof window.localStorage !== 'undefined' ? "local" : "cookie"; - - //set storage tag - this.id = "tabulator-" + (id || this.table.element.getAttribute("id") || ""); - }; - - //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) { - var data = "", - id = this.id + (type === "columns" ? "" : "-" + type); - - switch (this.mode) { - case "local": - data = localStorage.getItem(id); - break; - - case "cookie": - - //find cookie - var cookie = document.cookie, - cookiePos = cookie.indexOf(id + "="), - end = void 0; - - //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(id + "=", ""); - } - break; - - default: - console.warn("Persistance Load Error - invalid mode selected", this.mode); - } - - return data ? JSON.parse(data) : false; - }; - - //merge old and new column defintions - 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); - - if (from) { - - from.width = column.width; - from.visible = column.visible; - - 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; - } - - var id = this.id + (type === "columns" ? "" : "-" + type); - - this.saveData(id, 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; - }; - - //save data to chosed medium - Persistence.prototype.saveData = function (id, data) { - - data = JSON.stringify(data); - - switch (this.mode) { - case "local": - localStorage.setItem(id, data); - break; - - case "cookie": - var expireDate = new Date(); - expireDate.setDate(expireDate.getDate() + 10000); - - //save cookie - document.cookie = id + "=" + data + "; expires=" + expireDate.toUTCString(); - break; - - default: - console.warn("Persistance Save Error - invalid mode selected", this.mode); - } - }; - - //build premission list - Persistence.prototype.parseColumns = function (columns) { - var self = this, - definitions = []; - - columns.forEach(function (column) { - var def = {}; - - if (column.isGroup) { - def.title = column.getDefinition().title; - def.columns = self.parseColumns(column.getColumns()); - } else { - def.title = column.getDefinition().title; - def.field = column.getField(); - def.width = column.getWidth(); - def.visible = column.visible; - } - - definitions.push(def); - }); - - return definitions; - }; - - Tabulator.prototype.registerModule("persistence", Persistence); - - 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(); - }); - - handle.addEventListener("mousedown", function (e) { - var nearestColumn = column.getLastColumn(); - - if (nearestColumn && self._checkResizability(nearestColumn)) { - self.startColumn = column; - self._mouseDown(e, nearestColumn); - } - }); - - //reszie column on double click - handle.addEventListener("dblclick", function (e) { - if (self._checkResizability(column)) { - column.reinitializeWidth(true); - } - }); - - prevHandle.addEventListener("click", function (e) { - e.stopPropagation(); - }); - - prevHandle.addEventListener("mousedown", 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)) { - self.startColumn = column; - self._mouseDown(e, prevColumn); - } - } - }); - - //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)) { - 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) { - var self = this; - - self.table.element.classList.add("tabulator-block-select"); - - function mouseMove(e) { - column.setWidth(self.startWidth + (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); - - self.table.element.classList.remove("tabulator-block-select"); - - if (self.table.options.persistentLayout && self.table.modExists("persistence", true)) { - 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 = e.screenX; - self.startWidth = column.getWidth(); - - document.body.addEventListener("mousemove", mouseMove); - document.body.addEventListener("mouseup", 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(); - }); - - handle.addEventListener("mousedown", function (e) { - self.startRow = row; - self._mouseDown(e, row); - }); - - prevHandle.addEventListener("click", function (e) { - e.stopPropagation(); - }); - - prevHandle.addEventListener("mousedown", function (e) { - var prevRow = self.table.rowManager.prevDisplayRow(row); - - if (prevRow) { - self.startRow = prevRow; - self._mouseDown(e, prevRow); - } - }); - - rowEl.appendChild(handle); - rowEl.appendChild(prevHandle); - }; - - ResizeRows.prototype._mouseDown = function (e, row) { - var self = this; - - self.table.element.classList.add("tabulator-block-select"); - - function mouseMove(e) { - row.setHeight(self.startHeight + (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); - - 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 = e.screenY; - self.startHeight = row.getHeight(); - - document.body.addEventListener("mousemove", mouseMove); - - document.body.addEventListener("mouseup", mouseUp); - }; - - Tabulator.prototype.registerModule("resizeRows", ResizeRows); - var ResizeTable = function ResizeTable(table) { - this.table = table; //hold Tabulator object - this.binding = false; - this.observer = false; - }; - - ResizeTable.prototype.initialize = function (row) { - var table = this.table, - observer; - - if (typeof ResizeObserver !== "undefined" && table.rowManager.getRenderMode() === "virtual") { - this.observer = new ResizeObserver(function (entry) { - table.redraw(); - }); - - this.observer.observe(table.element); - } else { - this.binding = function () { - 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); - } - }; - - 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; - }; - - //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(); - } - }; - - //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.layoutRow = function (row) { - var rowEl = row.getElement(), - el = document.createElement("div"); - - el.classList.add("tabulator-responsive-collapse"); - - if (!rowEl.classList.contains("tabulator-calcs")) { - row.modules.responsiveLayout = { - element: el - }; - - if (!this.collapseStartOpen) { - el.style.display = 'none'; - } - - rowEl.appendChild(el); - - 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) { - column.hide(false, true); - - if (this.mode === "collapse") { - this.hiddenColumns.unshift(column); - this.generateCollapsedContent(); - } - }; - - 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(); - } - }; - - //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.columnManager.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[column.definition.title] = column.modules.format.formatter.call(self.table.modules.format, mockCellComponent, column.modules.format.params); - } else { - output[column.definition.title] = value; - } - } - }); - - return output; - }; - - ResponsiveLayout.prototype.formatCollapsedData = function (data) { - var list = document.createElement("table"), - listContents = ""; - - for (var key in data) { - listContents += "" + key + "" + data[key] + ""; - } - - 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 - }; - - 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 && self.table.options.selectableRangeMode === "click") { - element.addEventListener("click", function (e) { - if (e.shiftKey) { - 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) { - toggledRows.forEach(function (toggledRow) { - if (toggledRow !== self.lastClickedRow) { - self.toggleRow(toggledRow); - } - }); - self.lastClickedRow = row; - } else { - self.deselectRows(); - self.selectRows(toggledRows); - } - } else if (e.ctrlKey) { - self.toggleRow(row); - self.lastClickedRow = row; - } else { - self.deselectRows(); - self.selectRows(row); - self.lastClickedRow = row; - } - }); - } else { - element.addEventListener("click", function (e) { - if (!self.selecting) { - self.toggleRow(row); - } - }); - - element.addEventListener("mousedown", function (e) { - if (e.shiftKey) { - 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.toggleRow(row); - - if (self.selectPrev[1] == row) { - self.toggleRow(self.selectPrev[0]); - } - } - }); - - element.addEventListener("mouseout", function (e) { - if (self.selecting) { - 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.selected) { - this._deselectRow(row); - } else { - this._selectRow(row); - } - } - }; - - //select a number of rows - SelectRow.prototype.selectRows = function (rows) { - var self = this; - - switch (typeof rows === 'undefined' ? 'undefined' : _typeof(rows)) { - case "undefined": - self.table.rowManager.rows.forEach(function (row) { - self._selectRow(row, true, true); - }); - - self._rowSelectionChanged(); - break; - - case "boolean": - if (rows === true) { - self.table.rowManager.activeRows.forEach(function (row) { - self._selectRow(row, true, true); - }); - - self._rowSelectionChanged(); - } - break; - - default: - if (Array.isArray(rows)) { - rows.forEach(function (row) { - self._selectRow(row, true, true); - }); - - self._rowSelectionChanged(); - } else { - self._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) { - row.modules.select.selected = true; - row.getElement().classList.add("tabulator-selected"); - - this.selectedRows.push(row); - - if (!silent) { - this.table.options.rowSelected.call(this.table, row.getComponent()); - this._rowSelectionChanged(); - } - } - } 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) { - 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(); - } else { - if (Array.isArray(rows)) { - rows.forEach(function (row) { - self._deselectRow(row, true); - }); - - self._rowSelectionChanged(); - } else { - self._deselectRow(rows); - } - } - }; - - //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) { - - row.modules.select.selected = false; - row.getElement().classList.remove("tabulator-selected"); - self.selectedRows.splice(index, 1); - - if (!silent) { - self.table.options.rowDeselected.call(this.table, row.getComponent()); - self._rowSelectionChanged(); - } - } - } 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 () { - this.table.options.rowSelectionChanged.call(this.table, this.getSelectedData(), this.getSelectedRows()); - }; - - 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" - }; - - if (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) { - dir = column.modules.sort.dir == "asc" ? "desc" : column.modules.sort.dir == "desc" ? "asc" : 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 = sorters[match].dir == "asc" ? "desc" : "asc"; - - if (match != sorters.length - 1) { - sorters.push(sorters.splice(match, 1)[0]); - } - } else { - sorters.push({ column: column, dir: dir }); - } - - //add to existing sort - self.setSort(sorters); - } else { - //sort by column only - self.setSort(column, dir); - } - - self.table.rowManager.sorterRefresh(); - } - }); - } - }; - - //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.persistentSort && this.table.modExists("persistence", true)) { - 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 () { - var self = this, - lastSort, - sortList; - - sortList = this.table.options.sortOrderReverse ? self.sortList.slice().reverse() : self.sortList; - - if (self.table.options.dataSorting) { - self.table.options.dataSorting.call(self.table, self.getSort()); - } - - self.clearColumnHeaders(); - - if (!self.table.options.ajaxSorting) { - - sortList.forEach(function (item, i) { - - if (item.column && item.column.modules.sort) { - - //if no sorter has been defined, take a guess - if (!item.column.modules.sort.sorter) { - item.column.modules.sort.sorter = self.findSorter(item.column); - } - - self._sortItem(item.column, item.dir, sortList, i); - } - - self.setColumnHeader(item.column, item.dir); - }); - } else { - sortList.forEach(function (item, i) { - self.setColumnHeader(item.column, item.dir); - }); - } - - if (self.table.options.dataSorted) { - self.table.options.dataSorted.call(self.table, self.getSort(), self.table.rowManager.getComponents(true)); - } - }; - - //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._sortItem = function (column, dir, sortList, i) { - var self = this; - - var activeRows = self.table.rowManager.activeRows; - - var params = typeof column.modules.sort.params === "function" ? column.modules.sort.params(column.getComponent(), dir) : column.modules.sort.params; - - activeRows.sort(function (a, b) { - - var result = self._sortRow(a, b, column, dir, params); - - //if results match recurse through previous searchs to be sure - if (result === 0 && i) { - for (var j = i - 1; j >= 0; j--) { - result = self._sortRow(a, b, sortList[j].column, sortList[j].dir, 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 emptyAlign = 0; - - a = parseFloat(String(a).replace(",", "")); - b = parseFloat(String(b).replace(",", "")); - - //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; - }; - - //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 parts, type, params; - - switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { - case "string": - parts = value.split(":", 2); - type = parts.shift(); - params = parts[0]; - - 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 = []; - - if (validators) { - validators.forEach(function (item) { - if (!item.func.call(self, cell, value, item.params)) { - valid.push({ - type: item.type, - parameters: item.params - }); - } - }); - } - - return valid.length ? valid : true; - }; - - 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; - }, - - //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/js/timer.js b/js/timer.js deleted file mode 100644 index 1e91a29..0000000 --- a/js/timer.js +++ /dev/null @@ -1,530 +0,0 @@ - - -(function() { - - - $( function() { - - var entityMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '/': '/', - '`': '`', - '=': '=' - }; - - function escapeHtml (string) { - return String(string).replace(/[&<>"'`=\/]/g, function (s) { - return entityMap[s]; - }); - } - - getWorkItems(); - var timerInterval; - dialogWorkItemEditForm = $( "#dialog-work-item-edit-form" ).dialog({ - autoOpen: false, - height: 400, - width: 350, - modal: true, - buttons: { - "Edit work item": function(){ - editWorkIntem(dialogWorkItemEditForm); - }, - Cancel: function() { - dialogWorkItemEditForm.dialog( "close" ); - } - }, - close: function() { - form[ 0 ].reset(); - } - }); - var picker = $("#hours-manual-entry").daterangepicker({ - timePicker: true, - //startDate:tsToDate($(this).data('start-date')), - //endDate:tsToDate($(this).data('end-date')), - timePicker24Hour: true, - locale: { - format: 'DD/MM/YY hh:mm:ss' - } - }); - function validateManualEntryFields(){ - if($('#name-manual-entry').val() == ''){ - $("#confirm-button").button("option", "disabled", true); - } else { - $("#confirm-button").button("option", "disabled", false); - } - } - $('#name-manual-entry').on('input',function() { - - validateManualEntryFields(); - }); - - $("#dialog-manual-entry").dialog({ - autoOpen: false, - buttons : - [ { - id: 'confirm-button', - text: "Confirm", - click: function() { - var baseUrl = OC.generateUrl('/apps/timetracker/ajax/add-work-interval/'+$('#name-manual-entry').val()); - - var jqxhr = $.post( baseUrl,{start:picker.data('daterangepicker').startDate.format('DD/MM/YY HH:mm'), end:picker.data('daterangepicker').endDate.format('DD/MM/YY HH:mm'), tzoffset: new Date().getTimezoneOffset(), details:$('#details-manual-entry').val()} ,function() { - getWorkItems(); - $("#dialog-manual-entry").dialog("close"); - }) - .done(function(data, status, jqXHR) { - var response = data; - if ('Error' in response){ - alert(response.Error); - } - }) - .fail(function() { - alert( "error" ); - }) - }, - }, - { - id: 'cancel-button', - text: "Cancel", - click: function() { - $(this).dialog("close"); - }, - },] - }); - - $('#manual-entry-button').click(function(e) { - $("#dialog-manual-entry").dialog("open"); - return false; - }); - validateManualEntryFields(); - - function editWorkIntem(dialogWorkItemEditForm){ - target = dialogWorkItemEditForm.target; - form = dialogWorkItemEditForm.find( "form" ); - var id = $(target).data('myid'); - var baseUrl = OC.generateUrl("/apps/timetracker/ajax/update-work-interval/"+id); - var jqxhr = $.post( baseUrl, {name:form.find("#name").val(),details:form.find("#details").val()},function() { - getWorkItems(); - $(dialogWorkItemEditForm).dialog("close"); - }) - .done(function(data, status, jqXHR) { - var response = data; - if ('Error' in response){ - alert(response.Error); - } - }) - .fail(function() { - alert( "error" ); - }) - .always(function() { - - }); - - } - function cutString(s, n){ - if (s.length < n) { - return s; - } - return s.substring(0, n - 4) + ' ...'; - } - function secondsToTimer(s){ - function pad(num, size) { - var s = num+""; - while (s.length < size) s = "0" + s; - return s; - } - var secondsInDay = 60*60*24; - var secondsInHour = 60*60; - var secondsInMinute = 60; - - var days = Math.floor(s/secondsInDay); - var hours = Math.floor((s-days*secondsInDay)/secondsInHour); - var minutes = Math.floor((s-days*secondsInDay-hours*secondsInHour)/secondsInMinute); - var seconds = s % 60; - if (days > 0){ - return days + " days "+pad(hours,2)+':'+pad(minutes,2)+':'+pad(seconds,2); - } else { - return pad(hours,2)+':'+pad(minutes,2)+':'+pad(seconds,2); - } - } - function tsToDate(ts){ - var date = new Date(ts*1000); - // Hours part from the timestamp - var hours = date.getHours(); - // Minutes part from the timestamp - var minutes = "0" + date.getMinutes(); - // Seconds part from the timestamp - var seconds = "0" + date.getSeconds(); - var year = date.getFullYear() % 100; - //var year = date.getYear(); - var month = date.getMonth()+1; - var day = date.getDate(); - // Will display time in 10:30:23 format - var formattedTime = day+"/"+month+"/"+year+" "+hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); - return formattedTime; - } - function tsToHour(ts){ - var date = new Date(ts*1000); - // Hours part from the timestamp - var hours = date.getHours(); - // Minutes part from the timestamp - var minutes = "0" + date.getMinutes(); - // Seconds part from the timestamp - var seconds = "0" + date.getSeconds(); - - // Will display time in 10:30:23 format - var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); - return formattedTime; - } - function getWorkItems(){ - var baseUrl = OC.generateUrl('/apps/timetracker/ajax/work-intervals'); - $.ajaxSetup({ - scriptCharset: "utf-8", - contentType: "application/json; charset=utf-8" - }); - $.getJSON( baseUrl, function( data ) { - - if (data.running.length > 0){ - localStorage.setItem('isTimerStarted', true); - localStorage.setItem('timerStartTime', data.running[0].start); - var now = Math.floor(Date.now() / 1000); - localStorage.setItem('timerStartTimeLocal', data.running[0].start + now - data.now ); - $('#start-tracking > span').addClass("stop-button").removeClass("play-button"); - timerInterval = setInterval(function() { - var timerStartTimeLocal = localStorage.getItem('timerStartTimeLocal'); - var now = Math.floor(Date.now() / 1000); - - $('#timer').html(secondsToTimer(now - timerStartTimeLocal)); - }, 1000); - } else { - clearInterval(timerInterval); - localStorage.setItem('isTimerStarted', false); - $('#timer').html(secondsToTimer(0)); - $('#start-tracking > span').addClass("play-button").removeClass("stop-button"); - } - - - var days = []; - $.each( data.days, function( dayName, dayMap ) { - - var dayItems = []; - $.each(dayMap, function (dayItemName, workItem){ - var children = []; - - $.each(workItem.children, function (ckey, child){ - //debugger; - children.push("
            • "+escapeHtml(cutString(child.name,64))+ - "
              "+escapeHtml(cutString(child.details,64))+"
              "+"
              "+ - ""+ - ""+ - "
              "+tsToHour(child.start)+" - "+ - ((child.running == 1)?'':tsToHour(child.start+child.duration))+ - "
              "+ - "
              "+((child.running == 1)?'running...':secondsToTimer(child.duration))+"
              "+ - "
              "+"
            • "); - }); - - - dayItems.push("
              "+"
              • "+ - ((children.length == 1)?"
                 
                ":"
                "+children.length+"
                ")+ - "
                "+ - cutString(dayItemName,128)+"
                "+secondsToTimer(workItem.totalTime)+ - "
                "+ - "
              • "+children.join("")+"
              "+"
              "); - }); - days.push( "
              • " + - "
                " + dayName +"
                "+ dayItems.join("") + "
              " ); - }); - - $("#work-intervals").html($( "
              ", { - "class": "my-new-list", - html: days.join( "" ) - })); - - - $(".wi-child-hours").each(function(){ - $(this).daterangepicker({ - timePicker: true, - startDate:tsToDate($(this).data('start-date')), - endDate:tsToDate($(this).data('end-date')), - timePicker24Hour: true, - locale: { - format: 'DD/MM/YY hh:mm:ss' - } - }); - - $(this).on('apply.daterangepicker', function(ev, picker) { - var id = $(this).data('myid'); - var jqxhr = $.post( "ajax/update-work-interval/"+id,{start:picker.startDate.format('DD/MM/YY HH:mm'), end:picker.endDate.format('DD/MM/YY HH:mm'), tzoffset: new Date().getTimezoneOffset()}, function() { - }) - .done(function(data, status, jqXHR) { - var response = data; - if ('Error' in response){ - alert(response.Error); - } - getWorkItems(); - }) - .fail(function() { - alert( "error" ); - }) - .always(function() { - }); - }); - }); - $('.wi-child-name').click(function(e) { - e.preventDefault(); - dialogWorkItemEditForm.target = e.target; - - form = dialogWorkItemEditForm.find( "form" ) - form.find("#name").val($(e.target).data("name")); - form.find("#details").val($(e.target).data("details")); - dialogWorkItemEditForm.dialog("open"); - return false; - - }) - $('.wi-play').click(function(e) { - e.preventDefault(); - $('#work-input').val($(this).data('work-name')); - startTimer(); - return false; - }) - $('.wi-trash').click(function(e) { - $("#dialog-confirm").dialog({ - buttons : { - "Confirm" : function() { - var baseUrl = OC.generateUrl('/apps/timetracker/ajax/delete-work-interval/'+e.target.id); - var jqxhr = $.post( baseUrl, function() { - getWorkItems(); - $("#dialog-confirm").dialog("close"); - }) - .done(function(data, status, jqXHR) { - var response = data; - if ('Error' in response){ - alert(response.Error); - } - }) - .fail(function() { - alert( "error" ); - }) - }, - "Cancel" : function() { - $(this).dialog("close"); - } - } - }); - $("#dialog-confirm").dialog("open"); - return false; - }); - - $(".set-project").each(function(){ - var id = $(this).data('myid'); - var projectId = $(this).data('projectid'); - - var projectName = $(this).data('projectname'); - - - $(this).select2({ - width: '200px', - escapeMarkup : function(markup) { return markup; }, - placeholder: "", - allowClear: true, - ajax: { - url: OC.generateUrl('/apps/timetracker/ajax/projects'), - - dataType: 'json', - delay: 250, - results: function (data, page) { //json parse - return { - results: $.map(data.Projects,function(val, i){ - return { id: val.id, text:val.name}; - }), - pagination: { - more: false, - } - }; - }, - cache: false, - - }, - initSelection: function(element, callback) { - var results; - results = []; - results.push({ - id: projectId, - text: projectName, - }); - - callback(results[0]); - } - }); - $(this).data('myid',id); - - $(this).val(projectId).trigger('change'); - - }); - $(".set-tag").each(function(){ - var id = $(this).data('myid'); - var tagIds = []; - var tagNames = []; - if(typeof($(this).data('tagids')) !== 'undefined'){ - tagIds = $(this).data('tagids').toString().split(','); - tagNames = $(this).data('tagnames').toString().split(','); - } - $(this).select2({ - tags: true, - width: '200px', - placeholder: "Select tags...", - allowClear: true, - ajax: { - url: OC.generateUrl('/apps/timetracker/ajax/tags')+'?workItem='+$(this).data('myid'), - formatNoMatches: function() { - return ''; - }, - dataType: 'json', - delay: 250, - results: function (data, page) { //json parse - return { - results: $.map(data.Tags,function(val, i){ - return { id: val.id, text:val.name}; - }), - pagination: { - more: false, - } - }; - }, - cache: false, - }, - initSelection: function(element, callback) { - var results; - results = []; - for(var x=0;x span').addClass("stop-button").removeClass("play-button"); - getWorkItems(); - }) - .done(function(data, status, jqXHR) { - var response = data; - if ('Error' in response){ - alert(response.Error); - } - }) - .fail(function() { - alert( "error" ); - }); - - } - function stopTimer(){ - - var workName = $('#work-input').val(); - if (workName == ''){ - workName = 'no description'; - } - var jqxhr = $.post( "ajax/stop-timer/"+workName, function() { - localStorage.setItem('isTimerStarted', false); - $('#start-tracking > span').addClass("play-button").removeClass("stop-button"); - getWorkItems(); - }) - .done(function(data, status, jqXHR) { - var response = data; - if ('Error' in response){ - alert(response.Error); - } - }) - .fail(function() { - alert( "error" ); - }) - .always(function() { - }); - } - $( "#datepicker-from" ).datepicker(); - $( "#datepicker-to" ).datepicker(); - - if(localStorage.getItem('isTimerStarted') === 'true'){ - $('#start-tracking > span').addClass("stop-button").removeClass("play-button"); - } else { - $('#start-tracking > span').addClass("play-button").removeClass("stop-button"); - } - $( "#start-tracking" ).click(function() { - if(localStorage.getItem('isTimerStarted') === 'true'){ - stopTimer(); - } else { - startTimer(); - } - return false; - }); - } ); - -}()); \ No newline at end of file diff --git a/js/webpack.config.js b/js/webpack.config.js new file mode 100644 index 0000000..384f39b --- /dev/null +++ b/js/webpack.config.js @@ -0,0 +1,37 @@ +module.exports = { + //mode: 'development', + devtool: 'cheap-module-source-map', + entry: { + timer: './src/timer.js', + clients: './src/clients.js', + dashboard: './src/dashboard.js', + projects: './src/projects.js', + reports: './src/reports.js', + tags: './src/tags.js', + goals: './src/goals.js', + timelines: './src/timelines.js', + timelinesadmin: './src/timelines-admin.js', + }, + output: { + filename: '[name].js', + path: __dirname + '/dist' + }, + resolve: { + alias: { + 'jquery-ui': 'jqueryui' + } + }, + module: { + rules: [ + { + test: /\.css$/, + use: ['style-loader', 'css-loader'], + }, + { + test: /\.(jpg|png|jpeg|svg)$/, + loader: 'file-loader' + }, + ] + }, +}; + diff --git a/lib/AppFramework/Db/OldNextcloudMapper.php b/lib/AppFramework/Db/OldNextcloudMapper.php new file mode 100644 index 0000000..ee45fb5 --- /dev/null +++ b/lib/AppFramework/Db/OldNextcloudMapper.php @@ -0,0 +1,373 @@ + + * @author Christoph Wurst + * @author Joas Schilling + * @author Lukas Reschke + * @author Morris Jobke + * @author Roeland Jago Douma + * @author Thomas Müller + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see + * + */ +namespace OCA\TimeTracker\AppFramework\Db; + +use OCP\AppFramework\Db\DoesNotExistException; +use OCP\AppFramework\Db\Entity; +use OCP\AppFramework\Db\MultipleObjectsReturnedException; +use OCP\IDBConnection; + +/** + * Simple parent class for inheriting your data access layer from. This class + * may be subject to change in the future + * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper + */ +abstract class OldNextcloudMapper { + protected $tableName; + protected $entityClass; + protected $db; + + /** + * @param IDBConnection $db Instance of the Db abstraction layer + * @param string $tableName the name of the table. set this to allow entity + * @param string $entityClass the name of the entity that the sql should be + * mapped to queries without using sql + * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + public function __construct(IDBConnection $db, $tableName, $entityClass = null) { + $this->db = $db; + $this->tableName = '*PREFIX*' . $tableName; + + // if not given set the entity name to the class without the mapper part + // cache it here for later use since reflection is slow + if ($entityClass === null) { + $this->entityClass = str_replace('Mapper', '', get_class($this)); + } else { + $this->entityClass = $entityClass; + } + } + + + /** + * @return string the table name + * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + public function getTableName() { + return $this->tableName; + } + + + /** + * Deletes an entity from the table + * @param Entity $entity the entity that should be deleted + * @return Entity the deleted entity + * @since 7.0.0 - return value added in 8.1.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + public function delete(Entity $entity) { + $sql = 'DELETE FROM `' . $this->tableName . '` WHERE `id` = ?'; + $stmt = $this->execute($sql, [$entity->getId()]); + $stmt->closeCursor(); + return $entity; + } + + + /** + * Creates a new entry in the db from an entity + * @param Entity $entity the entity that should be created + * @return Entity the saved entity with the set id + * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + public function insert(Entity $entity) { + // get updated fields to save, fields have to be set using a setter to + // be saved + $properties = $entity->getUpdatedFields(); + $values = ''; + $columns = ''; + $params = []; + + // build the fields + $i = 0; + foreach ($properties as $property => $updated) { + $column = $entity->propertyToColumn($property); + $getter = 'get' . ucfirst($property); + + $columns .= '`' . $column . '`'; + $values .= '?'; + + // only append colon if there are more entries + if ($i < count($properties) - 1) { + $columns .= ','; + $values .= ','; + } + + $params[] = $entity->$getter(); + $i++; + } + + $sql = 'INSERT INTO `' . $this->tableName . '`(' . + $columns . ') VALUES(' . $values . ')'; + + $stmt = $this->execute($sql, $params); + + $entity->setId((int) $this->db->lastInsertId($this->tableName)); + + $stmt->closeCursor(); + + return $entity; + } + + + + /** + * Updates an entry in the db from an entity + * @throws \InvalidArgumentException if entity has no id + * @param Entity $entity the entity that should be created + * @return Entity the saved entity with the set id + * @since 7.0.0 - return value was added in 8.0.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + public function update(Entity $entity) { + // if entity wasn't changed it makes no sense to run a db query + $properties = $entity->getUpdatedFields(); + if (count($properties) === 0) { + return $entity; + } + + // entity needs an id + $id = $entity->getId(); + if ($id === null) { + throw new \InvalidArgumentException( + 'Entity which should be updated has no id'); + } + + // get updated fields to save, fields have to be set using a setter to + // be saved + // do not update the id field + unset($properties['id']); + + $columns = ''; + $params = []; + + // build the fields + $i = 0; + foreach ($properties as $property => $updated) { + $column = $entity->propertyToColumn($property); + $getter = 'get' . ucfirst($property); + + $columns .= '`' . $column . '` = ?'; + + // only append colon if there are more entries + if ($i < count($properties) - 1) { + $columns .= ','; + } + + $params[] = $entity->$getter(); + $i++; + } + + $sql = 'UPDATE `' . $this->tableName . '` SET ' . + $columns . ' WHERE `id` = ?'; + $params[] = $id; + + $stmt = $this->execute($sql, $params); + $stmt->closeCursor(); + + return $entity; + } + + /** + * Checks if an array is associative + * @param array $array + * @return bool true if associative + * @since 8.1.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + private function isAssocArray(array $array) { + return array_values($array) !== $array; + } + + /** + * Returns the correct PDO constant based on the value type + * @param $value + * @return int PDO constant + * @since 8.1.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + private function getPDOType($value) { + switch (gettype($value)) { + case 'integer': + return \PDO::PARAM_INT; + case 'boolean': + return \PDO::PARAM_BOOL; + default: + return \PDO::PARAM_STR; + } + } + + + /** + * Runs an sql query + * @param string $sql the prepare string + * @param array $params the params which should replace the ? in the sql query + * @param int $limit the maximum number of rows + * @param int $offset from which row we want to start + * @return \PDOStatement the database query result + * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + protected function execute($sql, array $params = [], $limit = null, $offset = null) { + $query = $this->db->prepare($sql, $limit, $offset); + + if ($this->isAssocArray($params)) { + foreach ($params as $key => $param) { + $pdoConstant = $this->getPDOType($param); + $query->bindValue($key, $param, $pdoConstant); + } + } else { + $index = 1; // bindParam is 1 indexed + foreach ($params as $param) { + $pdoConstant = $this->getPDOType($param); + $query->bindValue($index, $param, $pdoConstant); + $index++; + } + } + + $query->execute(); + + return $query; + } + + /** + * Returns an db result and throws exceptions when there are more or less + * results + * @see findEntity + * @param string $sql the sql query + * @param array $params the parameters of the sql query + * @param int $limit the maximum number of rows + * @param int $offset from which row we want to start + * @throws DoesNotExistException if the item does not exist + * @throws MultipleObjectsReturnedException if more than one item exist + * @return array the result as row + * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + protected function findOneQuery($sql, array $params = [], $limit = null, $offset = null) { + $stmt = $this->execute($sql, $params, $limit, $offset); + $row = $stmt->fetch(); + + if ($row === false || $row === null) { + $stmt->closeCursor(); + $msg = $this->buildDebugMessage( + 'Did expect one result but found none when executing', $sql, $params, $limit, $offset + ); + throw new DoesNotExistException($msg); + } + $row2 = $stmt->fetch(); + $stmt->closeCursor(); + //MDB2 returns null, PDO and doctrine false when no row is available + if (! ($row2 === false || $row2 === null)) { + $msg = $this->buildDebugMessage( + 'Did not expect more than one result when executing', $sql, $params, $limit, $offset + ); + throw new MultipleObjectsReturnedException($msg); + } else { + return $row; + } + } + + /** + * Builds an error message by prepending the $msg to an error message which + * has the parameters + * @see findEntity + * @param string $sql the sql query + * @param array $params the parameters of the sql query + * @param int $limit the maximum number of rows + * @param int $offset from which row we want to start + * @return string formatted error message string + * @since 9.1.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + private function buildDebugMessage($msg, $sql, array $params = [], $limit = null, $offset = null) { + return $msg . + ': query "' . $sql . '"; ' . + 'parameters ' . print_r($params, true) . '; ' . + 'limit "' . $limit . '"; '. + 'offset "' . $offset . '"'; + } + + + /** + * Creates an entity from a row. Automatically determines the entity class + * from the current mapper name (MyEntityMapper -> MyEntity) + * @param array $row the row which should be converted to an entity + * @return Entity the entity + * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + protected function mapRowToEntity($row) { + return call_user_func($this->entityClass .'::fromRow', $row); + } + + + /** + * Runs a sql query and returns an array of entities + * @param string $sql the prepare string + * @param array $params the params which should replace the ? in the sql query + * @param int $limit the maximum number of rows + * @param int $offset from which row we want to start + * @return array all fetched entities + * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + protected function findEntities($sql, array $params = [], $limit = null, $offset = null) { + $stmt = $this->execute($sql, $params, $limit, $offset); + + $entities = []; + + while ($row = $stmt->fetch()) { + $entities[] = $this->mapRowToEntity($row); + } + + $stmt->closeCursor(); + + return $entities; + } + + + /** + * Returns an db result and throws exceptions when there are more or less + * results + * @param string $sql the sql query + * @param array $params the parameters of the sql query + * @param int $limit the maximum number of rows + * @param int $offset from which row we want to start + * @throws DoesNotExistException if the item does not exist + * @throws MultipleObjectsReturnedException if more than one item exist + * @return Entity the entity + * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper + */ + protected function findEntity($sql, array $params = [], $limit = null, $offset = null) { + return $this->mapRowToEntity($this->findOneQuery($sql, $params, $limit, $offset)); + } +} diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index b91ee9e..de801d7 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -25,6 +25,15 @@ class Application extends App { */ public function __construct(array $urlParams=array()){ parent::__construct('timetracker', $urlParams); + + if (!\class_exists('\OCA\TimeTracker\AppFramework\Db\CompatibleMapper')) { + if (\class_exists(\OCP\AppFramework\Db\Mapper::class)) { + \class_alias(\OCP\AppFramework\Db\Mapper::class, 'OCA\TimeTracker\AppFramework\Db\CompatibleMapper'); + } else { + \class_alias(\OCA\TimeTracker\AppFramework\Db\OldNextcloudMapper::class, 'OCA\TimeTracker\AppFramework\Db\CompatibleMapper'); + } + } + $container = $this->getContainer(); /** * Controllers @@ -44,4 +53,4 @@ public function __construct(array $urlParams=array()){ }); } -} \ No newline at end of file +} diff --git a/lib/Controller/AjaxController.php b/lib/Controller/AjaxController.php index 2017de9..96e12d2 100644 --- a/lib/Controller/AjaxController.php +++ b/lib/Controller/AjaxController.php @@ -1,9 +1,11 @@ userId = $UserId; $this->userSession = $userSession; @@ -59,6 +65,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi $this->userToProjectMapper = $userToProjectMapper; $this->tagMapper = $tagMapper; + $this->goalMapper = $goalMapper; $this->workIntervalToTagMapper = $workIntervalToTagMapper; $this->reportItemMapper = $reportItemMapper; @@ -67,6 +74,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi $this->timelineEntryMapper = $timelineEntryMapper; $this->request = $request; + $this->l10n = $l10n; } /** @@ -74,16 +82,17 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi * @NoAdminRequired */ public function workIntervals() { - $i = 0; - $tryIntervals=[90,180,365,365*5]; - do { - $l = $this->workIntervalMapper->findLatestDays($this->userId,$tryIntervals[$i],0); - $i++; - } while ((count($l) == 0) && ($i < count($tryIntervals))); + $from = $this->request->from; + $to = $this->request->to; + $l = $this->workIntervalMapper->findLatestInterval($this->userId, $from, $to); $days = []; + $tzoffset = 0; + if (isset($this->request->tzoffset)) { + $tzoffset = -($this->request->tzoffset * 60); + } + date_default_timezone_set('UTC'); foreach ($l as $wi){ - //$dt = date("d/m/Y", $wi->start); - $dt = date("D, j M", $wi->start); + $dt = $this->l10n->l('date', $wi->start+$tzoffset, ['width' => 'medium']); if (!isset($days[$dt])){ $days[$dt] = []; } @@ -94,13 +103,15 @@ public function workIntervals() { if ($wi->projectId != null){ $project = $this->projectMapper->find($wi->projectId); } - + $tags = []; $wiToTags = $this->workIntervalToTagMapper->findAllForWorkInterval($wi->id); foreach($wiToTags as $wiToTag){ - $tags[] = $this->tagMapper->find($wiToTag->tagId); + $t = $this->tagMapper->find($wiToTag->tagId); + if ($t != null) + $tags[] = $t; } - + $wa = ['duration' => $wi->duration, 'id' => $wi->id, 'name' => $wi->name, @@ -110,18 +121,20 @@ public function workIntervals() { 'start' => $wi->start, 'tags' => $tags, 'userUid' => $wi->userUid, + 'cost' => $wi->cost, 'projectName' => ($project === null)?null:$project->name, + 'projectColor' => ($project === null)?null:$project->color, ]; $days[$dt][$wi->name]['children'][] = $wa; $days[$dt][$wi->name]['totalTime'] += $wa['duration']; } - + $running = $this->workIntervalMapper->findAllRunning($this->userId); return new JSONResponse(["WorkIntervals" => $l, "running" => $running, 'days' => $days, 'now' => time()]); } - + public function isThisAdminUser(){ return \OC_User::isAdminUser(\OC_User::getUser()); } @@ -136,9 +149,35 @@ public function isUserAdmin($user){ * @NoCSRFRequired */ public function index() { - + } + /** + * @NoAdminRequired + */ + public function addCost($id) + { + $wi = $this->workIntervalMapper->find($id); + $cost = $this->request->cost; + $cost = str_replace(',', '.', $cost); + + if (!is_numeric($cost)) { + return new JSONResponse(['error' => 'Non numeric value'], Http::STATUS_BAD_REQUEST); + } + + $costInCents = $cost * 100; + + $wi->setCost($costInCents); + + try { + $this->workIntervalMapper->update($wi); + } catch (\Exception $e) { + return new JSONResponse(['error' => true, 'message' => $e->getMessage()]); + } + + return new JSONResponse(['success' => true, 'test' => $cost ?? 't']); + } + /** * * @NoAdminRequired @@ -146,6 +185,17 @@ public function index() { public function startTimer($name) { //$this->endTimer(); + $projectId = null; + $name = urldecode($name); + if (isset($this->request->projectId) && (!empty($this->request->projectId))){ + $projectId = $this->request->projectId; + } + + $tags = null; + if (isset($this->request->tags) && (!empty($this->request->tags))){ + $tags = $this->request->tags; + } + if (strlen($name) > 255){ return new JSONResponse(["Error" => "Name too long"]); } @@ -154,15 +204,22 @@ public function startTimer($name) { $winterval->setRunning(1); $winterval->setName($name); $winterval->setUserUid($this->userId); + + // first get tags and project ids from the last work item with the same name $lwinterval = $this->workIntervalMapper->findLatestByName($this->userId, $name); - if ($lwinterval != null){ - + if ($projectId == null && $lwinterval != null){ + $winterval->setProjectId($lwinterval->projectId); } + + if($projectId != null){ + $winterval->setProjectId($projectId); + } + $this->workIntervalMapper->insert($winterval); - if ($lwinterval != null){ - $tags = $this->workIntervalToTagMapper->findAllForWorkInterval($lwinterval->id); - foreach($tags as $t){ + if ($tags == null && $lwinterval != null){ + $lastTags = $this->workIntervalToTagMapper->findAllForWorkInterval($lwinterval->id); + foreach($lastTags as $t){ $wtot = new WorkIntervalToTag(); $wtot->setWorkIntervalId($winterval->id); $wtot->setTagId($t->tagId); @@ -171,11 +228,25 @@ public function startTimer($name) { } } - - + + if ($tags != null){ + $tagsArray = explode(",", $tags); + foreach($tagsArray as $t){ + $wtot = new WorkIntervalToTag(); + $wtot->setWorkIntervalId($winterval->id); + $wtot->setTagId($t); + $wtot->setCreatedAt(time()); + $this->workIntervalToTagMapper->insert($wtot); + } + + } + + + + //echo json_encode((array)$winterval); return new JSONResponse(["WorkIntervals" => $winterval, "running" => 1]); - + } @@ -188,17 +259,19 @@ public function startTimer($name) { */ public function stopTimer($name) { + $name = urldecode($name); if (strlen($name) > 255){ return new JSONResponse(["Error" => "Name too long"]); } $running = $this->workIntervalMapper->findAllRunning($this->userId); - + $now = time(); foreach($running as $r){ $r->setRunning(0); $r->setDuration($now - $r->start); - $r->setName($name); + if ($name != 'no description') + $r->setName($name); $this->workIntervalMapper->update($r); } return new JSONResponse(["WorkIntervals" => json_decode(json_encode($running), true)]); @@ -213,7 +286,9 @@ public function stopTimer($name) { public function deleteWorkInterval($id) { $wi = $this->workIntervalMapper->find($id); $this->workIntervalMapper->delete($wi); - + + $running = $this->workIntervalMapper->findAllRunning($this->userId); + return new JSONResponse(["WorkIntervals" => json_decode(json_encode($running), true)]); } @@ -223,9 +298,9 @@ public function deleteWorkInterval($id) { */ public function updateWorkInterval($id) { - + $wi = $this->workIntervalMapper->find($id); - + if (isset($this->request->name)) { if (strlen($this->request->name) > 255){ return new JSONResponse(["Error" => "Name too long"]); @@ -259,23 +334,42 @@ public function updateWorkInterval($id) { $newWiToTag->setTagId($tag); $newWiToTag->setCreatedAt(time()); $this->workIntervalToTagMapper->insert($newWiToTag); - + } - + } } } + if (isset($this->request->tagId)) { - $tags = \explode(",", $this->request->tagId); + if (is_array($this->request->tagId)){ + $tags = $this->request->tagId; + } else { + + $tags = \explode(",", $this->request->tagId); + } $this->workIntervalToTagMapper->deleteAllForWorkInterval($id); $project = null; $locked = 0; - + foreach($tags as $tag){ if (empty($tag)) continue; + if(!is_numeric($tag)){ + if ($wi->projectId != null){ + $project = $this->projectMapper->find($wi->projectId); + if($project && $project->locked) + continue; // don't add new tags to locked projects + } + $c = new Tag(); + $c->setName($tag); + $c->setUserUid($this->userId); + $c->setCreatedAt(time()); + $this->tagMapper->insert($c); + $tag = $c->id; + } $newWiToTag = new WorkIntervalToTag(); $newWiToTag->setWorkIntervalId($id); $newWiToTag->setTagId($tag); @@ -301,7 +395,8 @@ public function updateWorkInterval($id) { } $this->workIntervalMapper->update($wi); - + $running = $this->workIntervalMapper->findAllRunning($this->userId); + return new JSONResponse(["WorkIntervals" => json_decode(json_encode($running), true)]); } @@ -312,13 +407,13 @@ public function updateWorkInterval($id) { */ public function addWorkInterval() { - + $wi = new WorkInterval(); $wi->setUserUid($this->userId); $wi->setRunning(0); - + if (isset($this->request->name)) { - $wi->setName($this->request->name); + $wi->setName(urldecode($this->request->name)); } if (isset($this->request->details)) { if (strlen($this->request->details) > 1024){ @@ -347,9 +442,9 @@ public function addWorkInterval() { $newWiToTag->setTagId($tag); $newWiToTag->setCreatedAt(time()); $this->workIntervalToTagMapper->insert($newWiToTag); - + } - + } } @@ -359,7 +454,7 @@ public function addWorkInterval() { $this->workIntervalToTagMapper->deleteAllForWorkInterval($id); $project = null; $locked = 0; - + foreach($tags as $tag){ if (empty($tag)) @@ -389,7 +484,9 @@ public function addWorkInterval() { } $this->workIntervalMapper->insert($wi); - + + $running = $this->workIntervalMapper->findAllRunning($this->userId); + return new JSONResponse(["WorkIntervals" => json_decode(json_encode($running), true)]); } @@ -457,7 +554,7 @@ public function deleteClient($id) { $utoc = $this->userToClientMapper->findForUserAndClient($this->userId, $c); if ($utoc != null){ - + $this->userToClientMapper->delete($utoc); } return $this->getClients(); @@ -470,12 +567,16 @@ public function deleteClient($id) { * @NoCSRFRequired */ public function getClients(){ - $clients = $this->clientMapper->findAll($this->userId); - return new JSONResponse(["Clients" => json_decode(json_encode($clients), true)]); - } + $clientName = $this->request->term ?? null; - + if ($clientName) { + $clients = $this->clientMapper->searchByName($this->userId, $clientName); + } else { + $clients = $this->clientMapper->findAll($this->userId); + } + return new JSONResponse(["Clients" => json_decode(json_encode($clients), true)]); + } /** * @@ -486,6 +587,10 @@ public function addProject($name) { if (isset($this->request->clientId)) { $clientId = $this->request->clientId; } + $color = '#ffffff'; + if (isset($this->request->color) && !empty($this->request->color)) { + $color = $this->request->color; + } if (trim($name) == ''){ return; } @@ -493,6 +598,7 @@ public function addProject($name) { if ($p == null){ $p = new Project(); $p->setName($name); + $p->setColor($color); $p->setCreatedAt(time()); $p->setCreatedByUserUid($this->userId); $p->setClientId($clientId); @@ -534,6 +640,10 @@ public function editProject($id) { $p->setName($name); } } + if (isset($this->request->color)){ + $color = $this->request->color; + $p->setColor($color); + } if (isset($this->request->clientId)){ $clientId = $this->request->clientId; $p->setClientId($clientId); @@ -563,9 +673,10 @@ public function editProject($id) { $this->userToProjectMapper->insert($up); } } + if (isset($this->request->archived) && $p->getArchived() != $this->request->archived){ if (($this->isThisAdminUser() || $p->createdByUserUid == $this->userId) ){ - + $archived = $this->request->archived; $p->setArchived($archived); } else { @@ -574,7 +685,7 @@ public function editProject($id) { } $this->projectMapper->update($p); - + return $this->getProjects(); } /** @@ -588,23 +699,50 @@ public function deleteProject($id) { $utop = $this->userToProjectMapper->findForUserAndProject($this->userId, $p); if ($utop != null){ - + $this->userToProjectMapper->delete($utop); } return $this->getProjects(); } - + public function deleteProjectWithData($id) { + if (!$this->isThisAdminUser()){ + return; + } + $this->userToProjectMapper->deleteAllForProject($id); + $wi = $this->workIntervalMapper->findAllForProject($id); + if ($wi != null){ + foreach ($wi as $w){ + $this->workIntervalToTagMapper->deleteAllForWorkInterval($w->id); + } + } + $this->workIntervalMapper->deleteAllForProject($id); + $this->tagMapper->allowedTags($id,[]); + $this->projectMapper->delete($id); + + + return $this->getProjects(); + } + + /** * * @NoAdminRequired */ public function getProjects(){ - $projects = $this->projectMapper->findAll($this->userId); + $projectName = $this->request->term ?? null; + + if ($projectName) { + $projects = $this->projectMapper->searchByName($this->userId, $projectName); + } else { + $projects = $this->projectMapper->findAll($this->userId); + } $parray = json_decode(json_encode($projects), true); foreach($parray as $pi => $pv){ - $tags = $this->tagMapper->findAllAlowedForProject($pv->id); - $parray[$pi]['allowedtags'] = $tags; + if (isset($pv->id)) { + $tags = $this->tagMapper->findAllAlowedForProject($pv->id); + $parray[$pi]['allowedtags'] = $tags; + } } return new JSONResponse(["Projects" => $parray]); @@ -633,6 +771,7 @@ public function getProjectsTable(){ $out['name'] = $p->name; $out['locked'] = $p->locked; $out['archived'] = $p->archived; + $out['color'] = $p->color; $out['client'] = null; $tags = $this->tagMapper->findAllAlowedForProject($p->id); $users = array_map(function ($utop) { return $utop->userUid;},$this->userToProjectMapper->findAllForProject($p->id)); @@ -645,7 +784,7 @@ public function getProjectsTable(){ $out['clientId'] = $client->id; } } - + $outProjects[] = $out; } @@ -671,7 +810,7 @@ public function addTag($name) { return new JSONResponse(["Error" => "This tag name already exists"]); } - + return $this->getTags(); } /** @@ -694,7 +833,7 @@ public function editTag($id) { } $c->setName($name); $this->tagMapper->update($c); - + return $this->getTags(); } /** @@ -719,11 +858,12 @@ public function deleteTag($id) { public function getTags(){ $workItem = $this->request->workItem; $project = null; + $q = $this->request->q; if ($workItem != null){ $wi = $this->workIntervalMapper->find($workItem); if ($wi->projectId != null){ $project = $this->projectMapper->find($wi->projectId); - + } } if($project != null && $project->locked){ @@ -731,6 +871,15 @@ public function getTags(){ } else { $tags = $this->tagMapper->findAll($this->userId); } + if ($q != null){ + $filteredTags = []; + foreach($tags as $t){ + if (stripos($t->name, $q) !== FALSE){ + $filteredTags[] = $t; + } + } + $tags = $filteredTags; + } return new JSONResponse(["Tags" => json_decode(json_encode($tags), true)]); } @@ -760,7 +909,7 @@ public function getReport(){ $name = $this->userId; } - + if(!$this->isThisAdminUser()){ $allowedClients = $this->clientMapper->findAll($this->userId); $allowedClientsId = array_map(function($client){ return $client->id;}, $allowedClients ); @@ -780,7 +929,7 @@ public function getReport(){ } } - + $filterTagId = []; $groupOn1 = $this->request->group1; $groupOn2 = $this->request->group2; @@ -814,7 +963,7 @@ public function postTimeline(){ $name = $this->userId; } - + if(!$this->isThisAdminUser()){ $allowedClients = $this->clientMapper->findAll($this->userId); $allowedClientsId = array_map(function($client){ return $client->id;}, $allowedClients ); @@ -834,12 +983,12 @@ public function postTimeline(){ } } - + $filterTagId = []; $groupOn1 = $this->request->group1; $groupOn2 = $this->request->group2; $items = $this->reportItemMapper->report($name, $from, $to, $filterProjectId, $filterClientId, $filterTagId, $timegroup, $groupOn1, $groupOn2, $this->isThisAdminUser(), 0, 1000); - + $timeline = new Timeline(); $timeline->setUserUid($this->userId); $timeline->setGroup1($this->request->group1); @@ -847,7 +996,7 @@ public function postTimeline(){ $timeline->setTimeGroup($this->request->timegroup); $timeline->setFilterProjects(implode(', ',$filterProjectId)); $timeline->setFilterClients(implode(', ',$filterClientId)); - $timeline->setTimeInterval(gmdate("d/m/Y", $from). ' - '. gmdate("d/m/Y", $to)); + $timeline->setTimeInterval($this->l10n->l('date', $from) . ' - '. $this->l10n->l('date', $to)); $totalDuration = 0; foreach($items as $i){ $totalDuration += $i->totalDuration; @@ -862,11 +1011,12 @@ public function postTimeline(){ $te->setTimelineId($timeline->id); $te->setUserUid($timeline->userUid); $te->setName($i->name); - $te->setProjectName($i->project); - //$te->setClientName(); + $te->setProjectName($i->project ? $i->project : ""); + $te->setClientName($i->client ? $i->client : ""); $te->setTimeInterval($i->time); $te->setTotalDuration($i->totalDuration); $te->setCreatedAt(time()); + $te->setCost($i->cost); $this->timelineEntryMapper->insert($te); } @@ -906,6 +1056,7 @@ public function secondsToTime($seconds){ $timeFormat = sprintf('%02d:%02d:%02d', $hours, $mins, $secs); return $timeFormat; } + /** * * @NoAdminRequired @@ -913,7 +1064,7 @@ public function secondsToTime($seconds){ */ public function downloadTimeline($id){ $te = $this->timelineEntryMapper->findTimelineEntries($id); - if (count($te) == 0){ + if (count($te) == 0){ // nothing to send exit(0); } @@ -930,7 +1081,7 @@ public function downloadTimeline($id){ fputcsv($output, array('id', 'User Uid', 'Name', 'Project Name', 'Client Name', 'Time Interval', 'Total Duration')); $totalDuration = 0; foreach($te as $t){ - + fputcsv($output, [$t->id, $t->userUid, $t->name, $t->projectName, $t->clientName, $t->timeInterval, $this->secondsToTime($t->totalDuration)]); $totalDuration += $t->totalDuration; } @@ -952,5 +1103,230 @@ public function editTimeline($id){ return new JSONResponse(["Timeline" => $timeline]); } + /** + * + * @NoAdminRequired + */ + + public function deleteTimeline($id) { + $tl = $this->timelineMapper->find($id); + if ($tl->userUid == $this->userId){ + $this->timelineMapper->delete($tl); + } + return $this->getTimelines(); + } + + /** + * + * @NoAdminRequired + */ + + public function emailTimeline($id) { + + $te = $this->timelineEntryMapper->findTimelineEntries($id); + if (count($te) == 0){ // nothing to send + exit(0); + } + $user = $te[0]->userUid; + + $email = $this->request->email; + $emails = explode(';',$email); + $subject = $this->request->subject; + $content = $this->request->content; + + // output headers so that the file is downloaded rather than displayed + header('Content-Type: text/csv; charset=utf-8'); + header('Content-Disposition: attachment; filename=timeline-'.$user.'-'.$id.'.csv'); + + // create a file pointer connected to the output stream + $id = (int)$id; + $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR. 'timeline-'.$user.'-'.$id.'.csv'; + $output = fopen($path, "w"); + //$path = stream_get_meta_data($output)['uri']; + // output the column headings + fputcsv($output, array('id', 'User Uid', 'Name', 'Project Name', 'Client Name', 'Time Interval', 'Total Duration')); + $totalDuration = 0; + foreach($te as $t){ + + fputcsv($output, [$t->id, $t->userUid, $t->name, $t->projectName, $t->clientName, $t->timeInterval, $this->secondsToTime($t->totalDuration)]); + $totalDuration += $t->totalDuration; + } + fputcsv($output, ['TOTAL', '', '', '', '', '', $this->secondsToTime($totalDuration)]); + + + + $mailer = \OC::$server->getMailer(); + $message = $mailer->createMessage(); + $attach = $mailer->createAttachmentFromPath($path); + $message->setSubject($subject); + //$message->setTo([$email => 'Recipient']); + $message->setTo($emails); + $message->setPlainBody($content); + //$message->setHtmlBody($content); + $message->attach($attach); + $mailer->send($message); + + fclose($output); + unlink($path); + return new JSONResponse([]); + } + + + + + + /** + * + * @NoAdminRequired + */ + public function addGoal() { + + $projectId = $this->request->projectId; + $hours = $this->request->hours; + $interval = $this->request->interval; + + $g = $this->goalMapper->findByUserProject($this->userId, $projectId); + if ($g == null){ + $g = new Goal(); + $g->setProjectId($projectId); + $g->setUserUid($this->userId); + $g->setCreatedAt(time()); + $g->setHours($hours); + $g->setInterval($interval); + $this->goalMapper->insert($g); + } else if ($g != null){ + return new JSONResponse(["Error" => "There can be only one goal per project"]); + } + + + return $this->getGoals(); + } + + /** + * + * @NoAdminRequired + */ + public function deleteGoal($id) { + $c = $this->goalMapper->find($id); + if ($c == null){ + return; + } + if ($c->userUid != $this->userId){ + return; + } + $this->goalMapper->delete($c); + return $this->getGoals(); + } + + public function getStartOfWeek($timestamp){ + $date = new \DateTime('@'.$timestamp); + $weeknumber = $date->format("W"); + $year = $date->format("Y"); + $weekstartdt = new \DateTime(); + $weekstartdt->setTime(0, 0, 0, 0); + $weekstartdt->setISODate($year, $weeknumber); + + return $weekstartdt; + } + public function getStartOfMonth($timestamp){ + $date = new \DateTime('@'.$timestamp); + $date->modify('first day of this month'); + $date->setTime(0, 0, 0, 0); + + return $date; + } + + public function getWeeksSince($timestamp){ + $start = $this->getStartOfWeek($timestamp); + $end = $this->getStartOfWeek(time()); + $oneWeek = \DateInterval::createFromDateString('1 week'); + $currentWeek = $start; + $weeks = []; + while ($currentWeek < $end){ + $weeks[] = $currentWeek->format("Y-m-d"); + $currentWeek->add($oneWeek); + } + return $weeks; + } + public function getMonthsSince($timestamp){ + $start = $this->getStartOfMonth($timestamp); + $end = $this->getStartOfMonth(time()); + $oneMonth = \DateInterval::createFromDateString('1 month'); + $currentMonth = $start; + $months = []; + while ($currentMonth < $end){ + $months[] = $currentMonth->format("Y-m"); + $currentMonth->add($oneMonth); + } + return $months; + } + /** + * + * @NoAdminRequired + * @NoCSRFRequired + */ + + public function getGoals(){ + $goals = $this->goalMapper->findAll($this->userId); + $weekStart = $this->getStartOfWeek(time())->format('Y-m-d'); + $monthStart = $this->getStartOfMonth(time())->format('Y-m'); + + $ret = []; + foreach($goals as $goal){ + $rgoal = []; + if ($goal->interval == 'Weekly'){ + $goalWeekStart = $this->getStartOfWeek($goal->createdAt); + $repItems = $this->reportItemMapper->report($this->userId, $goalWeekStart->getTimestamp(),time(),[$goal->projectId],"","","week","project","",false,0,10000); + $intervals = $this->getWeeksSince($goalWeekStart->getTimestamp()); + } elseif ($goal->interval == 'Monthly'){ + $goalMonthStart = $this->getStartOfMonth($goal->createdAt); + $repItems = $this->reportItemMapper->report($this->userId, $goalMonthStart->getTimestamp(),time(),[$goal->projectId],"","","month","project","",false,0,10000); + $intervals = $this->getMonthsSince($goalMonthStart->getTimestamp()); + } + $workedSecondsCurrentPeriod = 0; + $debtSeconds = 0; + foreach($intervals as $interval){ + $workedInInterval = 0; + foreach($repItems as $repItem) { + + if ($goal->interval == 'Weekly'){ + if ($interval == $this->getStartOfWeek($repItem->time)->format('Y-m-d')) { + $workedInInterval += $repItem->totalDuration; + } + } elseif ($goal->interval == 'Monthly'){ + if ($interval == $this->getStartOfMonth($repItem->time)->format('Y-m')) { + $workedInInterval += $repItem->totalDuration; + } + } + } + $debtSeconds += ($goal->hours*3600 - $workedInInterval); + } + + foreach($repItems as $period){ + if ($goal->interval == 'Weekly' && $this->getStartOfWeek($period->time)->format('Y-m-d') == $weekStart){ + $workedSecondsCurrentPeriod += $period->totalDuration; + } elseif ($goal->interval == 'Monthly' && $this->getStartOfMonth($period->time)->format('Y-m') == $monthStart){ + $workedSecondsCurrentPeriod += $period->totalDuration; + } + } + + $rgoal = [ + 'id' => $goal->id, + 'userUid' => $goal->userUid, + 'projectId' => $goal->projectId, + 'projectName' => $goal->projectName, + 'hours' => $goal->hours, + 'interval' => $goal->interval, + 'createdAt' => $goal->createdAt, + 'workedHoursCurrentPeriod' => round($workedSecondsCurrentPeriod / 3600, 2), + 'debtHours' => round($debtSeconds / 3600, 2), + 'remainingHours' => round($goal->hours - $workedSecondsCurrentPeriod / 3600, 2), + 'totalRemainingHours' => round(($debtSeconds + $goal->hours *3600 - $workedSecondsCurrentPeriod) / 3600, 2), + ]; + $ret[] = $rgoal; + } + return new JSONResponse(["Goals" => json_decode(json_encode($ret), true)]); + } } + diff --git a/lib/Controller/ClientsController.php b/lib/Controller/ClientsController.php index 8df7143..fee8296 100644 --- a/lib/Controller/ClientsController.php +++ b/lib/Controller/ClientsController.php @@ -26,7 +26,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi * @NoCSRFRequired */ public function index() { - return new TemplateResponse('timetracker', 'index',['appPage' => 'content/clients', 'script' => 'clients']); // templates/index.php + return new TemplateResponse('timetracker', 'index',['appPage' => 'content/clients', 'script' => 'dist/clients']); // templates/index.php } diff --git a/lib/Controller/DashboardController.php b/lib/Controller/DashboardController.php index 919ff4e..6b1f841 100644 --- a/lib/Controller/DashboardController.php +++ b/lib/Controller/DashboardController.php @@ -25,7 +25,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi * @NoCSRFRequired */ public function index() { - return new TemplateResponse('timetracker', 'index',['appPage' => 'content/dashboard', 'script' => 'dashboard']); // templates/index.php + return new TemplateResponse('timetracker', 'index',['appPage' => 'content/dashboard', 'script' => 'dist/dashboard']); // templates/index.php } diff --git a/lib/Controller/GoalsController.php b/lib/Controller/GoalsController.php new file mode 100644 index 0000000..514df91 --- /dev/null +++ b/lib/Controller/GoalsController.php @@ -0,0 +1,32 @@ +userSession = $userSession; + $user = $this->userSession->getUser(); + + } + + /** + * + * @NoAdminRequired + * @NoCSRFRequired + */ + public function index() { + return new TemplateResponse('timetracker', 'index',['appPage' => 'content/goals', 'script' => 'dist/goals']); // templates/index.php + } + + +} diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index cbf74ca..5599515 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -26,7 +26,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi * @NoCSRFRequired */ public function index() { - return new TemplateResponse('timetracker', 'index',['appPage' => 'content/index', 'script' => 'timer']); // templates/index.php + return new TemplateResponse('timetracker', 'index',['appPage' => 'content/index', 'script' => 'dist/timer']); // templates/index.php } diff --git a/lib/Controller/ProjectsController.php b/lib/Controller/ProjectsController.php index cd7dfc3..25eae3b 100644 --- a/lib/Controller/ProjectsController.php +++ b/lib/Controller/ProjectsController.php @@ -30,7 +30,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi * @NoCSRFRequired */ public function index() { - return new TemplateResponse('timetracker', 'index',['appPage' => 'content/projects', 'script' => 'projects']); // templates/index.php + return new TemplateResponse('timetracker', 'index',['appPage' => 'content/projects', 'script' => 'dist/projects']); // templates/index.php } diff --git a/lib/Controller/ReportsController.php b/lib/Controller/ReportsController.php index 25a34bd..e2e8fc5 100644 --- a/lib/Controller/ReportsController.php +++ b/lib/Controller/ReportsController.php @@ -25,7 +25,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi * @NoCSRFRequired */ public function index() { - return new TemplateResponse('timetracker', 'index',['appPage' => 'content/reports', 'script' => 'reports']); // templates/index.php + return new TemplateResponse('timetracker', 'index',['appPage' => 'content/reports', 'script' => 'dist/reports']); // templates/index.php } diff --git a/lib/Controller/TagsController.php b/lib/Controller/TagsController.php index ea88894..95cdc1b 100644 --- a/lib/Controller/TagsController.php +++ b/lib/Controller/TagsController.php @@ -25,7 +25,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi * @NoCSRFRequired */ public function index() { - return new TemplateResponse('timetracker', 'index',['appPage' => 'content/tags', 'script' => 'tags']); // templates/index.php + return new TemplateResponse('timetracker', 'index',['appPage' => 'content/tags', 'script' => 'dist/tags']); // templates/index.php } diff --git a/lib/Controller/TimelinesAdminController.php b/lib/Controller/TimelinesAdminController.php index 709a00b..3f414b7 100644 --- a/lib/Controller/TimelinesAdminController.php +++ b/lib/Controller/TimelinesAdminController.php @@ -25,7 +25,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi * @NoCSRFRequired */ public function index() { - return new TemplateResponse('timetracker', 'index',['appPage' => 'content/timelines-admin', 'script' => 'timelines-admin']); // templates/index.php + return new TemplateResponse('timetracker', 'index',['appPage' => 'content/timelines-admin', 'script' => 'dist/timelinesadmin']); // templates/index.php } diff --git a/lib/Controller/TimelinesController.php b/lib/Controller/TimelinesController.php index e79c2be..62bbfeb 100644 --- a/lib/Controller/TimelinesController.php +++ b/lib/Controller/TimelinesController.php @@ -25,7 +25,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi * @NoCSRFRequired */ public function index() { - return new TemplateResponse('timetracker', 'index',['appPage' => 'content/timelines', 'script' => 'timelines']); // templates/index.php + return new TemplateResponse('timetracker', 'index',['appPage' => 'content/timelines', 'script' => 'dist/timelines']); // templates/index.php } diff --git a/lib/Db/ClientMapper.php b/lib/Db/ClientMapper.php index 77e6f11..1cee7ba 100644 --- a/lib/Db/ClientMapper.php +++ b/lib/Db/ClientMapper.php @@ -4,9 +4,10 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class ClientMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class ClientMapper extends CompatibleMapper { public function __construct(IDBConnection $db) { parent::__construct($db, 'timetracker_client'); @@ -16,14 +17,14 @@ public function __construct(IDBConnection $db) { public function findByName($name) { $sql = 'SELECT * FROM `*PREFIX*timetracker_client` ' . 'WHERE upper(`name`) = ?'; - + try { $e = $this->findEntity($sql, [strtoupper($name)]); return $e; } catch (\OCP\AppFramework\Db\DoesNotExistException $e){ return null; } - + } /** @@ -36,11 +37,14 @@ public function find($id) { return $this->findEntity($sql, [$id]); } - public function findAll($user){ $sql = 'SELECT tc.* FROM `*PREFIX*timetracker_client` tc left join `*PREFIX*timetracker_user_to_client` uc on uc.client_id = tc.id where uc.user_uid = ? order by tc.name asc'; return $this->findEntities($sql, [$user]); } - -} \ No newline at end of file + public function searchByName($user, $name){ + $name = strtoupper($name); + $sql = 'SELECT tc.* FROM `*PREFIX*timetracker_client` tc left join `*PREFIX*timetracker_user_to_client` uc on uc.client_id = tc.id where uc.user_uid = ? and upper(tc.name) LIKE ? order by tc.name asc'; + return $this->findEntities($sql, [$user, "%" . $name . "%"]); + } +} diff --git a/lib/Db/Goal.php b/lib/Db/Goal.php new file mode 100644 index 0000000..eb7bee3 --- /dev/null +++ b/lib/Db/Goal.php @@ -0,0 +1,29 @@ +addType('id', 'integer'); + $this->addType('userUid', 'string'); + $this->addType('projectId', 'integer'); + $this->addType('projectName', 'string'); + $this->addType('hours', 'integer'); + $this->addType('interval', 'string'); + $this->addType('createdAt', 'integer'); + } +} \ No newline at end of file diff --git a/lib/Db/GoalMapper.php b/lib/Db/GoalMapper.php new file mode 100644 index 0000000..a3ccf76 --- /dev/null +++ b/lib/Db/GoalMapper.php @@ -0,0 +1,47 @@ +findEntity($sql, [$userUid, $projectId]); + return $e; + } catch (\OCP\AppFramework\Db\DoesNotExistException $e){ + return null; + } + + } + + /** + * @throws \OCP\AppFramework\Db\DoesNotExistException if not found + * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result + */ + public function find($id) { + $sql = 'SELECT * FROM `*PREFIX*timetracker_goal` ' . + 'WHERE `id` = ?'; + return $this->findEntity($sql, [$id]); + } + + + public function findAll($user){ + $sql = 'SELECT tg.*,p.name as project_name FROM `*PREFIX*timetracker_goal` tg join `*PREFIX*timetracker_project` p on p.id = tg.project_id where tg.user_uid = ? order by tg.created_at desc'; + return $this->findEntities($sql, [$user]); + } + + +} diff --git a/lib/Db/Project.php b/lib/Db/Project.php index 89011fe..2161b29 100644 --- a/lib/Db/Project.php +++ b/lib/Db/Project.php @@ -8,6 +8,7 @@ class Project extends Entity { public $id; public $name; + public $color; public $clientId; public $createdByUserUid; public $createdAt; @@ -20,6 +21,7 @@ public function __construct() { $this->addType('id', 'integer'); $this->addType('name', 'string'); + $this->addType('color', 'string'); $this->addType('clientId', 'integer'); $this->addType('createdByUserUid', 'string'); $this->addType('createdAt', 'integer'); diff --git a/lib/Db/ProjectMapper.php b/lib/Db/ProjectMapper.php index 4ea2708..8c23921 100644 --- a/lib/Db/ProjectMapper.php +++ b/lib/Db/ProjectMapper.php @@ -4,9 +4,10 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class ProjectMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class ProjectMapper extends CompatibleMapper { public function __construct(IDBConnection $db) { parent::__construct($db, 'timetracker_project'); @@ -16,14 +17,22 @@ public function __construct(IDBConnection $db) { public function findByName($name) { $sql = 'SELECT * FROM `*PREFIX*timetracker_project` ' . 'WHERE upper(`name`) = ?'; - + try { $e = $this->findEntity($sql, [strtoupper($name)]); return $e; } catch (\OCP\AppFramework\Db\DoesNotExistException $e){ return null; } - + + } + + public function searchByName($user, string $name) { + $name = strtoupper($name); + $sql = 'SELECT tp.* FROM `*PREFIX*timetracker_project` tp LEFT JOIN `*PREFIX*timetracker_user_to_project` up ON up.project_id = tp.id WHERE up.`user_uid` = ? AND upper(tp.`name`) LIKE ? ORDER BY tp.`name`'; + + return $this->findEntities($sql, [$user,"%" . $name ."%"]); + } /** @@ -56,7 +65,16 @@ public function findAllAdmin($getArchived = 0){ return $this->findEntities($sql, []); } + public function delete($project_id) { + $sql = 'delete FROM `*PREFIX*timetracker_project` ' . + ' where id = ?'; + try { + $this->execute($sql, [$project_id]); + return; + } catch (\OCP\AppFramework\Db\DoesNotExistException $e){ + return; + } - -} \ No newline at end of file + } +} diff --git a/lib/Db/ReportItem.php b/lib/Db/ReportItem.php index d847205..1388980 100644 --- a/lib/Db/ReportItem.php +++ b/lib/Db/ReportItem.php @@ -12,23 +12,27 @@ class ReportItem extends Entity { public $projectId; public $userUid; public $time; + public $ftime; public $totalDuration; public $project; public $clientId; public $client; + public $cost; public function __construct() { // add types in constructor - + $this->addType('id', 'integer'); $this->addType('name', 'string'); - $this->addType('name', 'details'); + $this->addType('details', 'string'); $this->addType('projectId', 'integer'); $this->addType('userUid', 'string'); $this->addType('time', 'string'); + $this->addType('ftime', 'string'); $this->addType('totalDuration', 'integer'); $this->addType('project', 'string'); + $this->addType('cost', 'integer'); } -} \ No newline at end of file +} diff --git a/lib/Db/ReportItemMapper.php b/lib/Db/ReportItemMapper.php index 9672668..6728175 100644 --- a/lib/Db/ReportItemMapper.php +++ b/lib/Db/ReportItemMapper.php @@ -4,9 +4,10 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class ReportItemMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class ReportItemMapper extends CompatibleMapper { private $dbengine; @@ -14,6 +15,8 @@ public function __construct(IDBConnection $db) { $this->dbengine = 'MYSQL'; if (strpos(get_class($db->getDatabasePlatform()),'PostgreSQL') !== FALSE){ $this->dbengine = 'POSTGRES'; + } else if (strpos(get_class($db->getDatabasePlatform()),'Sqlite') !== FALSE){ + $this->dbengine = 'SQLITE'; } parent::__construct($db, 'timetracker_work_interval'); } @@ -30,12 +33,17 @@ public function __construct(IDBConnection $db) { public $client; */ - + public function report($user, $from, $to, $filterProjectId, $filterClientId, $filterTagId, $timegroup, $groupOn1, $groupOn2, $admin, $start, $limit ){ - + $selectFields = ['min(wi.id) as id', 'sum(duration) as "totalDuration"']; - - $pg = 0; + + if ($timegroup !== null) { + $selectFields[]= "SUM(wi.cost) as cost"; + } else { + $selectFields[] = 'wi.cost as cost'; + } + $aggregation = true; if(empty($groupOn1) && empty($groupOn2) && empty($timegroup)) { $selectFields[] = 'min(wi.details) as "details"'; @@ -51,42 +59,44 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi $selectFields[] = '\'*\' as "details"'; } + if (!$aggregation) { + $selectFields[]= "start as time"; + } else { + $selectFields[]= "min(start) as time"; + } - if ($this->dbengine != 'MYSQL') { - $pg = 1; - if(empty($timegroup)){ - if (!$aggregation) { - $selectFields[]= "to_char(to_timestamp(min(start))::date,'YYYY-MM-DD HH24:MI') as time"; - } else { - $selectFields[]= "to_timestamp(min(start))::date as time"; - } - } elseif ($timegroup == 'week') { - $selectFields[]= "to_char(to_timestamp(start)::date, 'YYYY-WW') as time"; + if ($this->dbengine == 'POSTGRES') { + if ($timegroup == 'week') { + $selectFields[]= "concat(date_part('year', to_timestamp(start)), 'W', to_char(to_timestamp(start), 'IW')) as ftime"; + }elseif ($timegroup == 'year') { + $selectFields[]= "date_part('year', to_timestamp(start)) as ftime"; + }elseif ($timegroup == 'month') { + $selectFields[]= "to_char(to_timestamp(start), 'YYYY-MM') as ftime"; }elseif ($timegroup == 'day') { - $selectFields[]= "to_timestamp(start)::date as time"; + $selectFields[]= "to_char(to_timestamp(start), 'YYYY-MM-DD') as ftime"; + } + } else if ($this->dbengine == 'SQLITE') { + if ($timegroup == 'week') { + $selectFields[]= "strftime('%YW%W', datetime(start, 'unixepoch')) as ftime"; }elseif ($timegroup == 'year') { - $selectFields[]= 'date_part(\'year\', to_timestamp(start)::date) as time'; + $selectFields[]= "strftime('%Y', datetime(start, 'unixepoch')) as ftime"; }elseif ($timegroup == 'month') { - $selectFields[]= "to_char(to_timestamp(start)::date, 'YYYY-MM') as time"; + $selectFields[]= "strftime('%Y-%m', datetime(start, 'unixepoch')) as ftime"; + }elseif ($timegroup == 'day') { + $selectFields[]= "strftime('%Y-%m-%d', datetime(start, 'unixepoch')) as ftime"; } } else { - if(empty($timegroup)){ - if (!$aggregation) { - $selectFields[]= "DATE_FORMAT(FROM_UNIXTIME(start),'%Y-%m-%d %H:%i') as time"; - } else { - $selectFields[]= "DATE_FORMAT(FROM_UNIXTIME(min(start)),'%Y-%m-%d') as time"; - } - } elseif ($timegroup == 'week') { - $selectFields[]= "STR_TO_DATE(CONCAT(YEARWEEK(FROM_UNIXTIME(start)),' Monday'), '%x%v %W') as time"; - }elseif ($timegroup == 'day') { - $selectFields[]= "DATE_FORMAT(FROM_UNIXTIME(start),'%Y-%m-%d') as time"; + if ($timegroup == 'week') { + $selectFields[]= "CONCAT(YEAR(FROM_UNIXTIME(start)), 'W', WEEK(FROM_UNIXTIME(start))) as ftime"; }elseif ($timegroup == 'year') { - $selectFields[]= 'YEAR(FROM_UNIXTIME(start)) as time'; + $selectFields[]= "YEAR(FROM_UNIXTIME(start)) as ftime"; }elseif ($timegroup == 'month') { - $selectFields[]= "DATE_FORMAT(FROM_UNIXTIME(start),'%Y-%m') as time"; + $selectFields[]= "DATE_FORMAT(FROM_UNIXTIME(start),'%Y-%m') as ftime"; + }elseif ($timegroup == 'day') { + $selectFields[]= "DATE(FROM_UNIXTIME(start)) as ftime"; } - } + if ($aggregation){ if($groupOn1 != 'name'){ if ($this->dbengine != 'MYSQL') { @@ -100,46 +110,46 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi } } - + if ($aggregation){ if(($groupOn1 != 'project') && ($groupOn2 != 'project')){ $selectFields[] = '\'*\' as "projectId"'; - if ($this->dbengine != 'MYSQL') { + if ($this->dbengine == 'POSTGRES') { $selectFields[] = 'string_agg(distinct p.name, \',\') as project'; } else { $selectFields[] = 'group_concat(distinct p.name) as project'; } } else { - + $selectFields[] = '\'*\' as "projectId"'; $selectFields[] = 'p.name as project'; } - - + + if(($groupOn1 != 'client') && ($groupOn2 != 'client')){ $selectFields[] = '\'*\' as "clientId"'; - if ($this->dbengine != 'MYSQL') { + if ($this->dbengine == 'POSTGRES') { $selectFields[] = 'string_agg(distinct c.name, \',\') as client'; } else { $selectFields[] = 'group_concat(distinct c.name) as client'; } - + } else { $selectFields[] = '\'*\' as "clientId"'; $selectFields[] = 'c.name as client'; } - + if(($groupOn1 != 'userUid') && ($groupOn2 != 'userUid') && $aggregation){ - if ($this->dbengine != 'MYSQL') { + if ($this->dbengine == 'POSTGRES') { $selectFields[] = 'string_agg(distinct user_uid, \',\') as "userUid"'; } else { $selectFields[] = 'group_concat(distinct user_uid) as "userUid"'; } - + } else { $selectFields[] = 'user_uid as "userUid"'; } - + } $selectItems = implode(", ",$selectFields). @@ -164,7 +174,7 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi foreach($filterProjectId as $f){ $qm[] = '?'; $params[] = $f; - + if($f == null) { $append = ' or wi.project_id is null '; } @@ -200,16 +210,16 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi // } elseif ($timegroup == 'year') { // $groups[] = "YEAR(start)"; // } - $groups[] = 'time'; + $groups[] = 'ftime'; } - + if (!empty($groupOn1)){ if ($groupOn1 == "project" || $groupOn1 == "client" || $groupOn1 == "name" || $groupOn1 == "userUid") // $groups[] = $groupOn1; if ($groupOn1 == 'name'){ $groups[] = 'wi.name'; } else { - if($pg) { // postgres needs quotes on names + if ($this->dbengine == 'POSTGRES') { // postgres needs quotes on names $groups[] = '"'.$groupOn1.'"'; } else { $groups[] = $groupOn1; @@ -221,8 +231,8 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi if ($groupOn2 == 'name'){ $groups[] = 'wi.name'; } else { - if($pg) { - $groups[] = '"'.$groupOn2.'"';// postgres needs quotes on names + if ($this->dbengine == 'POSTGRES') { // postgres needs quotes on names + $groups[] = '"'.$groupOn2.'"'; } else { $groups[] = $groupOn2; } @@ -241,12 +251,12 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi if (empty($limit)){ $limit = 10000; } - $sql = 'SELECT '.$selectItems.' where '.implode(" and ",$filters).' '.$group. ' order by time desc'; + $sql = 'SELECT '.$selectItems.' where '.implode(" and ",$filters).' '.$group; //var_dump($sql); // var_dump($params); return $this->findEntities($sql, $params, $limit, $start); } - -} \ No newline at end of file + +} diff --git a/lib/Db/TagMapper.php b/lib/Db/TagMapper.php index 9bee004..187252f 100644 --- a/lib/Db/TagMapper.php +++ b/lib/Db/TagMapper.php @@ -4,11 +4,18 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class TagMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class TagMapper extends CompatibleMapper { public function __construct(IDBConnection $db) { + $this->dbengine = 'MYSQL'; + if (strpos(get_class($db->getDatabasePlatform()),'PostgreSQL') !== FALSE){ + $this->dbengine = 'POSTGRES'; + } else if (strpos(get_class($db->getDatabasePlatform()),'Sqlite') !== FALSE){ + $this->dbengine = 'SQLITE'; + } parent::__construct($db, 'timetracker_tag'); } @@ -33,7 +40,12 @@ public function findByNameUser($name, $userUid) { public function find($id) { $sql = 'SELECT * FROM `*PREFIX*timetracker_tag` ' . 'WHERE `id` = ?'; - return $this->findEntity($sql, [$id]); + try { + $e = $this->findEntity($sql, [$id]); + return $e; + } catch (\OCP\AppFramework\Db\DoesNotExistException $e){ + return null; + } } @@ -43,23 +55,29 @@ public function findAll($user){ } public function findAllAlowedForProject($pid){ - $sql = 'SELECT tt.* FROM `*PREFIX*timetracker_tag` tt join `*PREFIX*timetracker_locked_project_allowed_tag` atg on tt.id = atg.tag_id where atg.project_id = ? order by tt.name asc'; + $sql = 'SELECT tt.* FROM `*PREFIX*timetracker_tag` tt join `*PREFIX*timetracker_lpa_tags` atg on tt.id = atg.tag_id where atg.project_id = ? order by tt.name asc'; return $this->findEntities($sql, [$pid]); } public function allowedTags($id, $tag_ids){ - $sql = 'delete from `*PREFIX*timetracker_locked_project_allowed_tag` where project_id = ?'; + $sql = 'delete from `*PREFIX*timetracker_lpa_tags` where project_id = ?'; $this->execute($sql, [$id]); foreach ($tag_ids as $t){ if (empty($t)) continue; - $sql = 'insert into `*PREFIX*timetracker_locked_project_allowed_tag` (project_id, tag_id, created_at) values(?,?,UNIX_TIMESTAMP(now())) '; + if ($this->dbengine == 'MYSQL'){ + $sql = "insert into `*PREFIX*timetracker_lpa_tags` (project_id, tag_id, created_at) values(?,?,UNIX_TIMESTAMP(now()))"; + } else if ($this->dbengine == 'POSTGRES'){ + $sql = "insert into `*PREFIX*timetracker_lpa_tags` (project_id, tag_id, created_at) values(?,?,extract(epoch from now()))"; + } else if ($this->dbengine == 'SQLITE'){ + $sql = "insert into `*PREFIX*timetracker_lpa_tags` (project_id, tag_id, created_at) values(?,?,strftime('%s', 'now'))"; + } $this->execute($sql, [$id, $t]); } return; } -} \ No newline at end of file +} diff --git a/lib/Db/TimelineEntryMapper.php b/lib/Db/TimelineEntryMapper.php index 0c66a31..c0216c4 100644 --- a/lib/Db/TimelineEntryMapper.php +++ b/lib/Db/TimelineEntryMapper.php @@ -4,9 +4,10 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class TimelineEntryMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class TimelineEntryMapper extends CompatibleMapper { public function __construct(IDBConnection $db) { parent::__construct($db, 'timetracker_timeline_entry'); @@ -31,4 +32,4 @@ public function findTimelineEntries($tid) { return $this->findEntities($sql, [$tid]); } -} \ No newline at end of file +} diff --git a/lib/Db/TimelineMapper.php b/lib/Db/TimelineMapper.php index 3cbea06..4f434fb 100644 --- a/lib/Db/TimelineMapper.php +++ b/lib/Db/TimelineMapper.php @@ -4,9 +4,10 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class TimelineMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class TimelineMapper extends CompatibleMapper { public function __construct(IDBConnection $db) { parent::__construct($db, 'timetracker_timeline'); @@ -63,4 +64,4 @@ public function findByStatus($status) { } } -} \ No newline at end of file +} diff --git a/lib/Db/UserToClient.php b/lib/Db/UserToClient.php index 03f2660..048c986 100644 --- a/lib/Db/UserToClient.php +++ b/lib/Db/UserToClient.php @@ -22,7 +22,7 @@ public function __construct() { $this->addType('clientId', 'integer'); $this->addType('admin', 'integer'); $this->addType('access', 'integer'); - $this->addType('createdAt', 'timestamp'); + $this->addType('createdAt', 'integer'); } } \ No newline at end of file diff --git a/lib/Db/UserToClientMapper.php b/lib/Db/UserToClientMapper.php index 7884697..816598f 100644 --- a/lib/Db/UserToClientMapper.php +++ b/lib/Db/UserToClientMapper.php @@ -4,9 +4,10 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class UserToClientMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class UserToClientMapper extends CompatibleMapper { public function __construct(IDBConnection $db) { parent::__construct($db, 'timetracker_user_to_client'); @@ -54,4 +55,4 @@ public function findForUserAndClient($uid, $client) { -} \ No newline at end of file +} diff --git a/lib/Db/UserToProject.php b/lib/Db/UserToProject.php index 52a441b..51dc4c9 100644 --- a/lib/Db/UserToProject.php +++ b/lib/Db/UserToProject.php @@ -22,7 +22,7 @@ public function __construct() { $this->addType('projectId', 'integer'); $this->addType('admin', 'integer'); $this->addType('access', 'integer'); - $this->addType('createdAt', 'timestamp'); + $this->addType('createdAt', 'integer'); } } \ No newline at end of file diff --git a/lib/Db/UserToProjectMapper.php b/lib/Db/UserToProjectMapper.php index f88eb2e..6337603 100644 --- a/lib/Db/UserToProjectMapper.php +++ b/lib/Db/UserToProjectMapper.php @@ -4,9 +4,10 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class UserToProjectMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class UserToProjectMapper extends CompatibleMapper { public function __construct(IDBConnection $db) { parent::__construct($db, 'timetracker_user_to_project'); @@ -77,4 +78,4 @@ public function deleteAllForProject($project_id) { -} \ No newline at end of file +} diff --git a/lib/Db/WorkInterval.php b/lib/Db/WorkInterval.php index 998036d..d546f16 100644 --- a/lib/Db/WorkInterval.php +++ b/lib/Db/WorkInterval.php @@ -14,11 +14,12 @@ class WorkInterval extends Entity { public $start; public $duration; public $running; + public $cost; public function __construct() { // add types in constructor - + $this->addType('id', 'integer'); $this->addType('name', 'string'); $this->addType('details', 'string'); @@ -27,5 +28,6 @@ public function __construct() { $this->addType('start', 'integer'); $this->addType('duration', 'integer'); $this->addType('running', 'integer'); + $this->addType('cost', 'integer'); } } diff --git a/lib/Db/WorkIntervalMapper.php b/lib/Db/WorkIntervalMapper.php index f788c8f..4a94ec4 100644 --- a/lib/Db/WorkIntervalMapper.php +++ b/lib/Db/WorkIntervalMapper.php @@ -4,16 +4,13 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class WorkIntervalMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class WorkIntervalMapper extends CompatibleMapper { private $dbengine; public function __construct(IDBConnection $db) { - $this->dbengine = 'MYSQL'; - if (strpos(get_class($db->getDatabasePlatform()),'PostgreSQL') !== FALSE){ - $this->dbengine = 'POSTGRES'; - } parent::__construct($db, 'timetracker_work_interval'); } @@ -47,12 +44,12 @@ public function findAllForWorkItem($workItemId, $limit=null, $offset=null) { } public function findLatest($user, $limit = 10, $offset = 0){ - $sql = 'SELECT * FROM `*PREFIX*timetracker_work_interval` where user_uid = ? order by id desc'; + $sql = 'SELECT * FROM `*PREFIX*timetracker_work_interval` where user_uid = ? order by start desc'; return $this->findEntities($sql, [$user],$limit, $offset); } public function findLatestByName($user, $name){ - $sql = 'SELECT * FROM `*PREFIX*timetracker_work_interval` where user_uid = ? and name = ? order by id desc'; + $sql = 'SELECT * FROM `*PREFIX*timetracker_work_interval` where user_uid = ? and name = ? order by start desc'; try { return $this->findEntity($sql, [$user, $name], 1, 0); } catch (\OCP\AppFramework\Db\DoesNotExistException $e){ @@ -60,25 +57,27 @@ public function findLatestByName($user, $name){ } } - public function findLatestDays($user, $limitDays = 10, $startDay = 0, $limit = 100, $offset = 0){ - if ($this->dbengine == 'MYSQL'){ - $sql = 'SELECT * FROM `*PREFIX*timetracker_work_interval` where user_uid = ? and - start > unix_timestamp(curdate() + interval 1 day - interval ? day) and - start < unix_timestamp(curdate() + interval 1 day - interval ? day) - order by id desc'; - return $this->findEntities($sql, [$user,$limitDays,$startDay],$limit, $offset); - } else { - $sql = 'SELECT * FROM `*PREFIX*timetracker_work_interval` where user_uid = ? and - start > extract(epoch from current_date + interval \'1\' day - interval \''.(int)$limitDays.'\' day) and - start < extract(epoch from current_date + interval \'1\' day - interval \''.(int)$startDay.'\' day) - order by id desc'; - return $this->findEntities($sql, [$user],$limit, $offset); + public function findLatestInterval($user, $from, $to, $limit = 5000, $offset = 0){ + $filters[] = "(user_uid = ?)"; + $params[] = $user; + + if (!empty($from)){ + $filters[] = "(start > ?)"; + $params[] = $from; + } - + if (!empty($to)){ + $filters[] = "(start < ?)"; + $params[] = $to; + + } + + $sql = 'SELECT * FROM `*PREFIX*timetracker_work_interval` where '.implode(" and ",$filters).' order by start desc'; + return $this->findEntities($sql, $params, $limit, $offset); } public function findAllRunning($user, $limit = 100, $offset = 0){ - $sql = 'SELECT * FROM `*PREFIX*timetracker_work_interval` where user_uid = ? and running = 1 order by id desc'; + $sql = 'SELECT * FROM `*PREFIX*timetracker_work_interval` where user_uid = ? and running = 1 order by start desc'; return $this->findEntities($sql, [$user],$limit, $offset); } @@ -87,4 +86,22 @@ public function stopAllRunning($user, $limit = 100, $offset = 0){ return $this->findEntities($sql, [$user],$limit, $offset); } -} \ No newline at end of file + public function findAllForProject($project_id){ + $sql = 'SELECT * FROM `*PREFIX*timetracker_work_interval` where project_id = ?'; + return $this->findEntities($sql, [$project_id]); + } + + public function deleteAllForProject($project_id) { + $sql = 'delete FROM `*PREFIX*timetracker_work_interval` ' . + ' where project_id = ?'; + + try { + $this->execute($sql, [$project_id]); + return; + } catch (\OCP\AppFramework\Db\DoesNotExistException $e){ + return; + } + + } + +} diff --git a/lib/Db/WorkIntervalToTag.php b/lib/Db/WorkIntervalToTag.php index 628ec9b..28df902 100644 --- a/lib/Db/WorkIntervalToTag.php +++ b/lib/Db/WorkIntervalToTag.php @@ -18,7 +18,7 @@ public function __construct() { $this->addType('id', 'integer'); $this->addType('workIntervalId', 'integer'); $this->addType('tagId', 'integer'); - $this->addType('createdAt', 'timestamp'); + $this->addType('createdAt', 'integer'); } } \ No newline at end of file diff --git a/lib/Db/WorkIntervalToTagMapper.php b/lib/Db/WorkIntervalToTagMapper.php index 228228c..d7bd2a5 100644 --- a/lib/Db/WorkIntervalToTagMapper.php +++ b/lib/Db/WorkIntervalToTagMapper.php @@ -4,17 +4,18 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class WorkIntervalToTagMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class WorkIntervalToTagMapper extends CompatibleMapper { public function __construct(IDBConnection $db) { - parent::__construct($db, 'timetracker_workinterval_to_tag'); + parent::__construct($db, 'timetracker_workint_to_tag'); } public function find($id) { - $sql = 'SELECT * FROM `*PREFIX*timetracker_workinterval_to_tag` ' . + $sql = 'SELECT * FROM `*PREFIX*timetracker_workint_to_tag` ' . 'WHERE `id` = ?'; try { @@ -27,7 +28,7 @@ public function find($id) { } public function findAllForWorkInterval($workIntervalId) { - $sql = 'SELECT * FROM `*PREFIX*timetracker_workinterval_to_tag` ' . + $sql = 'SELECT * FROM `*PREFIX*timetracker_workint_to_tag` ' . 'WHERE `work_interval_id` = ?'; try { @@ -40,7 +41,7 @@ public function findAllForWorkInterval($workIntervalId) { } public function deleteAllForWorkInterval($workIntervalId) { - $sql = 'DELETE FROM `*PREFIX*timetracker_workinterval_to_tag` ' . + $sql = 'DELETE FROM `*PREFIX*timetracker_workint_to_tag` ' . 'WHERE `work_interval_id` = ?'; try { @@ -53,7 +54,7 @@ public function deleteAllForWorkInterval($workIntervalId) { } public function deleteAllForTag($tagId) { - $sql = 'DELETE FROM `*PREFIX*timetracker_workinterval_to_tag` ' . + $sql = 'DELETE FROM `*PREFIX*timetracker_workint_to_tag` ' . 'WHERE `tag_id` = ?'; try { @@ -69,4 +70,4 @@ public function deleteAllForTag($tagId) { -} \ No newline at end of file +} diff --git a/lib/Db/WorkItem.php b/lib/Db/WorkItem.php index 1208d0d..ccf5f2a 100644 --- a/lib/Db/WorkItem.php +++ b/lib/Db/WorkItem.php @@ -22,7 +22,7 @@ public function __construct() { $this->addType('projectId', 'integer'); $this->addType('tagId', 'integer'); $this->addType('totalDuration', 'integer'); - $this->addType('createdAt', 'timestamp'); + $this->addType('createdAt', 'integer'); $this->addType('userUid', 'string'); } } \ No newline at end of file diff --git a/lib/Db/WorkItemMapper.php b/lib/Db/WorkItemMapper.php index 0a8da3e..8517fc6 100644 --- a/lib/Db/WorkItemMapper.php +++ b/lib/Db/WorkItemMapper.php @@ -4,9 +4,10 @@ namespace OCA\TimeTracker\Db; use OCP\IDBConnection; -use OCP\AppFramework\Db\Mapper; -class WorkItemMapper extends Mapper { +use OCA\TimeTracker\AppFramework\Db\CompatibleMapper; + +class WorkItemMapper extends CompatibleMapper { public function __construct(IDBConnection $db) { parent::__construct($db, 'timetracker_work_item'); @@ -50,4 +51,4 @@ public function findAll($limit=null, $offset=null) { return $this->findEntities($sql, $limit, $offset); } -} \ No newline at end of file +} diff --git a/lib/Migration/Version000000Date20210719124731.php b/lib/Migration/Version000000Date20210719124731.php new file mode 100644 index 0000000..4963fa1 --- /dev/null +++ b/lib/Migration/Version000000Date20210719124731.php @@ -0,0 +1,479 @@ +connection = $connection; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @return null|ISchemaWrapper + */ + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + if (!$schema->hasTable('timetracker_client')) { + $table = $schema->createTable('timetracker_client'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('name', 'string', [ + 'notnull' => true, + 'length' => 64 + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id']); + } + + if (!$schema->hasTable('timetracker_project')) { + $table = $schema->createTable('timetracker_project'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('name', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('client_id', 'integer', [ + 'notnull' => false, + 'length' => 4, + ]); + $table->addColumn('created_by_user_uid', 'string', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('locked', 'integer', [ + 'notnull' => false, + 'default' => 0, + 'length' => 4, + ]); + $table->addColumn('archived', 'integer', [ + 'notnull' => false, + 'default' => 0, + 'length' => 4, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('color', 'string', [ + 'notnull' => true, + 'default' => '#ffffff', + 'length' => 7, + ]); + + $table->setPrimaryKey(['id']); + } + + if (!$schema->hasTable('timetracker_user_to_project')) { + $table = $schema->createTable('timetracker_user_to_project'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('user_uid', 'string', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('project_id', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('admin', 'integer', [ + 'notnull' => true, + 'default' => 0, + 'length' => 4, + ]); + $table->addColumn('access', 'integer', [ + 'notnull' => true, + 'default' => 1, + 'length' => 4, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id'], 'tt_u_to_p_id_idx'); + } + + if (!$schema->hasTable('timetracker_user_to_client')) { + $table = $schema->createTable('timetracker_user_to_client'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('user_uid', 'string', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('client_id', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('admin', 'integer', [ + 'notnull' => true, + 'default' => 0, + 'length' => 4, + ]); + $table->addColumn('access', 'integer', [ + 'notnull' => true, + 'default' => 1, + 'length' => 4, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id'], 'tt_u_t_c_id_idx'); + } + + if (!$schema->hasTable('timetracker_work_interval')) { + $table = $schema->createTable('timetracker_work_interval'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('name', 'string', [ + 'notnull' => true, + 'length' => 256, + ]); + $table->addColumn('details', 'string', [ + 'notnull' => true, + 'default' => '', + 'length' => 1024, + ]); + $table->addColumn('project_id', 'integer', [ + 'notnull' => false, + 'length' => 4, + ]); + $table->addColumn('user_uid', 'text', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('start', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('duration', 'integer', [ + 'notnull' => false, + 'length' => 4, + ]); + $table->addColumn('running', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id'], 'tt_w_i_id_idx'); + } + + if (!$schema->hasTable('timetracker_tag')) { + $table = $schema->createTable('timetracker_tag'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('name', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('user_uid', 'string', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id']); + } + + + if (!$schema->hasTable('timetracker_lpa_tags')) { + $table = $schema->createTable('timetracker_lpa_tags'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('project_id', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('tag_id', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id']); + } + + if (!$schema->hasTable('timetracker_workint_to_tag')) { + $table = $schema->createTable('timetracker_workint_to_tag'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('work_interval_id', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('tag_id', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id'], 'tt_wi_to_tag_id_idx'); + } + + if (!$schema->hasTable('timetracker_timeline_entry')) { + $table = $schema->createTable('timetracker_timeline_entry'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('timeline_id', 'integer', [ + 'notnull' => false, + 'length' => 4, + ]); + $table->addColumn('user_uid', 'text', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('name', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('project_name', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('client_name', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('time_interval', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('total_duration', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id'], 'tt_t_e_id_idx'); + } + + if (!$schema->hasTable('timetracker_timeline')) { + $table = $schema->createTable('timetracker_timeline'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('status', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('user_uid', 'text', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('group1', 'text', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('group2', 'text', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('time_group', 'text', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('filter_projects', 'text', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('filter_clients', 'text', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('time_interval', 'text', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('total_duration', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id']); + } + + if (!$schema->hasTable('timetracker_goal')) { + $table = $schema->createTable('timetracker_goal'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('user_uid', 'text', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('project_id', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('hours', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('interval', 'text', [ + 'notnull' => true, + 'length' => 12, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id']); + } + + return $schema; + } + + /** + * @param IOutput $output + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @since 13.0.0 + */ + public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { + $this->moveTimeTrackerWorkIntervalToTag(); + $this->moveTimeTrackerLockedProjectAllowedTag(); + } + + protected function moveTimeTrackerWorkIntervalToTag(): void { + if (!$this->connection->tableExists('timetracker_workint_to_tag') || + !$this->connection->tableExists('timetracker_workinterval_to_tag')) { + return; + } + + $insert = $this->connection->getQueryBuilder(); + $insert->insert('timetracker_workint_to_tag') + ->values([ + 'id' => $insert->createParameter('id'), + 'work_interval_id' => $insert->createParameter('work_interval_id'), + 'tag_id' => $insert->createParameter('tag_id'), + 'created_at' => $insert->createParameter('created_at'), + ]); + + $query = $this->connection->getQueryBuilder(); + $query->select('*') + ->from('timetracker_workint_to_tag'); + $result = $query->execute(); + if ($result->fetch()) { + $result->closeCursor(); + return; + } + + $query = $this->connection->getQueryBuilder(); + $query->select('*') + ->from('timetracker_workinterval_to_tag'); + $result = $query->execute(); + + while ($row = $result->fetch()) { + $insert + ->setParameter('id', (int) $row['id'], IQueryBuilder::PARAM_INT) + ->setParameter('work_interval_id', (int) $row['work_interval_id'], IQueryBuilder::PARAM_INT) + ->setParameter('tag_id', (int) $row['tag_id'], IQueryBuilder::PARAM_INT) + ->setParameter('created_at', (int) $row['created_at'], IQueryBuilder::PARAM_INT) + ; + $insert->execute(); + } + $result->closeCursor(); + } + + protected function moveTimeTrackerLockedProjectAllowedTag(): void { + if (!$this->connection->tableExists('timetracker_lpa_tags') || + !$this->connection->tableExists('timetracker_locked_project_allowed_tag')) { + return; + } + + $insert = $this->connection->getQueryBuilder(); + $insert->insert('timetracker_lpa_tags') + ->values([ + 'id' => $insert->createParameter('id'), + 'project_id' => $insert->createParameter('project_id'), + 'tag_id' => $insert->createParameter('tag_id'), + 'created_at' => $insert->createParameter('created_at'), + ]); + + $query = $this->connection->getQueryBuilder(); + $query->select('*') + ->from('timetracker_lpa_tags'); + $result = $query->execute(); + if ($result->fetch()) { + $result->closeCursor(); + return; + } + + $query = $this->connection->getQueryBuilder(); + $query->select('*') + ->from('timetracker_locked_project_allowed_tag'); + $result = $query->execute(); + + while ($row = $result->fetch()) { + $insert + ->setParameter('id', (int) $row['id'], IQueryBuilder::PARAM_INT) + ->setParameter('project_id', (int) $row['project_id'], IQueryBuilder::PARAM_INT) + ->setParameter('tag_id', (int) $row['tag_id'], IQueryBuilder::PARAM_INT) + ->setParameter('created_at', (int) $row['created_at'], IQueryBuilder::PARAM_INT) + ; + $insert->execute(); + } + $result->closeCursor(); + } +} diff --git a/lib/Migration/Version000001Date20210719192031.php b/lib/Migration/Version000001Date20210719192031.php new file mode 100644 index 0000000..01c4b4a --- /dev/null +++ b/lib/Migration/Version000001Date20210719192031.php @@ -0,0 +1,118 @@ +hasTable('timetracker_project')) { + $table = $schema->getTable('timetracker_project'); + if ($table->hasColumn('created_by_user_id')) { + $schema->dropTable('timetracker_project'); + $table = $schema->createTable('timetracker_project'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('name', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('client_id', 'integer', [ + 'notnull' => false, + 'length' => 4, + ]); + $table->addColumn('created_by_user_uid', 'string', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('locked', 'integer', [ + 'notnull' => false, + 'default' => 0, + 'length' => 4, + ]); + $table->addColumn('archived', 'integer', [ + 'notnull' => false, + 'default' => 0, + 'length' => 4, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('color', 'string', [ + 'notnull' => true, + 'default' => '#ffffff', + 'length' => 7, + ]); + + $table->setPrimaryKey(['id']); + } + } + + if ($schema->hasTable('timetracker_timeline_entry')) { + $table = $schema->getTable('timetracker_timeline_entry'); + if ($table->hasColumn('user_id')) { + $schema->dropTable('timetracker_timeline_entry'); + $table = $schema->createTable('timetracker_timeline_entry'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('timeline_id', 'integer', [ + 'notnull' => false, + 'length' => 4, + ]); + $table->addColumn('user_uid', 'text', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('name', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('project_name', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('client_name', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('time_interval', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('total_duration', 'text', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('created_at', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + + $table->setPrimaryKey(['id'], 'tt_t_e_id_idx'); + } + } + + return $schema; + } +} diff --git a/lib/Migration/Version000020Date20220528101009.php b/lib/Migration/Version000020Date20220528101009.php new file mode 100644 index 0000000..6e2c6bf --- /dev/null +++ b/lib/Migration/Version000020Date20220528101009.php @@ -0,0 +1,75 @@ + + * + * @author Harm Akkerman + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\TimeTracker\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +/** + * Auto-generated migration step: Please modify to your needs! + */ +class Version000020Date20220528101009 extends SimpleMigrationStep { + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @return null|ISchemaWrapper + */ + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + $schema = $schemaClosure(); + if ($schema->hasTable('timetracker_work_interval')) { + $table = $schema->getTable('timetracker_work_interval'); + if (!$table->hasColumn('cost')) { + $table->addColumn('cost', 'integer', [ + 'notnull' => false, + 'length' => 10, + ]); + } + } + + return $schema; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { + } +} diff --git a/templates/content/clients.php b/templates/content/clients.php index d4687f7..e0f12ac 100644 --- a/templates/content/clients.php +++ b/templates/content/clients.php @@ -1,28 +1,28 @@
              -

              Clients

              -
              +

              Clients

              +
              -
              - - -
              -
              -
              +
              + + +
              +
              +
              \ No newline at end of file diff --git a/templates/content/dashboard.php b/templates/content/dashboard.php index 08c637e..66ac410 100644 --- a/templates/content/dashboard.php +++ b/templates/content/dashboard.php @@ -1,14 +1,22 @@ -
              -

              Dashboard

              +

              Dashboard

              -
              -
              -
              -

              Time (in minutes) allocated to each client in the last 30 days

              - -
              -
              +
              +
              +
              +

              Time (in minutes) allocated to each client in the last days

              +
              +
              +
              +
              +   + +
              +
              + + +
              +
              +
              -
              \ No newline at end of file diff --git a/templates/content/goals.php b/templates/content/goals.php new file mode 100644 index 0000000..b0f4159 --- /dev/null +++ b/templates/content/goals.php @@ -0,0 +1,26 @@ +
              +

              Goals

              +
              +
              + + + + +
              +
              + +
              +
              +
              +
              \ No newline at end of file diff --git a/templates/content/index.php b/templates/content/index.php index 148aff8..d3ba8e6 100644 --- a/templates/content/index.php +++ b/templates/content/index.php @@ -1,62 +1,69 @@
              -
              -
              +
              +
              +
              + +
              +
              +
              +
              + +
              + +
              +
              Manual entry
              + + -
              - -
              - -
              -
              -
              Manual entry
              - - + -
              -
              -
              +
              +
              +
              +
              +   + +
              +
              +
              + +
              +
              +
              -
              \ No newline at end of file diff --git a/templates/content/projects.php b/templates/content/projects.php index 3a95452..4569291 100644 --- a/templates/content/projects.php +++ b/templates/content/projects.php @@ -1,61 +1,81 @@ -
              -

              Projects

              -
              +

              Projects

              +
              -
              + + +
              + +
              +
              +
              +
              -
              -
              - +
              +
              +
              - +
              - -
              - - -
              +
              + + +
              -
              -
              +
              +
              \ No newline at end of file diff --git a/templates/content/reports.php b/templates/content/reports.php index 2ac76c8..f4005a9 100644 --- a/templates/content/reports.php +++ b/templates/content/reports.php @@ -1,80 +1,79 @@ -
              -

              Reports

              +

              Reports

              + + + -
              -
              +
              +
              \ No newline at end of file diff --git a/templates/content/tags.php b/templates/content/tags.php index 5fcf6df..10e6823 100644 --- a/templates/content/tags.php +++ b/templates/content/tags.php @@ -1,28 +1,28 @@
              -

              Tags

              -
              +

              Tags

              +
              - +
              -
              - - -
              -
              -
              +
              + + +
              +
              +
              \ No newline at end of file diff --git a/templates/content/timelines-admin.php b/templates/content/timelines-admin.php index 8cc294a..e16f4ca 100644 --- a/templates/content/timelines-admin.php +++ b/templates/content/timelines-admin.php @@ -1,44 +1,43 @@ -
              -

              Timelines Admin

              +

              Timelines Admin

              + + + +
              +
              + -
              -
              +
              +
              \ No newline at end of file diff --git a/templates/content/timelines.php b/templates/content/timelines.php index e6010fb..70c5a8f 100644 --- a/templates/content/timelines.php +++ b/templates/content/timelines.php @@ -1,80 +1,102 @@ -
              -

              Timelines

              +

              Timelines

              + + + + +
              +
              +
              +
              +   + +
              +
              +
              +
              + + + -
              -
              - - -
              -
              - - - - -
              +
              +
              + + +
              +
              + + + + +
              -
              -
              -
              -

              Exported Timelines Statuses

              -
              -
              -
              +
              +
              +
              +

              Exported Timelines Statuses

              +
              +
              +
              \ No newline at end of file diff --git a/templates/index.php b/templates/index.php index c9f1513..d9144c1 100644 --- a/templates/index.php +++ b/templates/index.php @@ -1,35 +1,24 @@ = 28) { + style('timetracker', 'style-compat'); +} + script('timetracker', $script); ?> -
              -
              - inc('navigation/index')); ?> - inc('settings/index')); ?> -
              +
              + inc('navigation/index')); ?> +
              -
              -
              - inc($appPage)); ?> -
              +
              +
              + inc($appPage)); ?>
              - diff --git a/templates/navigation/index.php b/templates/navigation/index.php index 8f19325..6217972 100644 --- a/templates/navigation/index.php +++ b/templates/navigation/index.php @@ -1,13 +1,13 @@ -
                -
              • Timer
              • -
              • Dashboard
              • -
              • Reports
              • -
              • Timelines
              • + diff --git a/webfonts/fa-brands-400.svg b/webfonts/fa-brands-400.svg index 7f23efa..1f1c4d9 100644 --- a/webfonts/fa-brands-400.svg +++ b/webfonts/fa-brands-400.svg @@ -1,1260 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/webfonts/fa-regular-400.svg b/webfonts/fa-regular-400.svg index e789514..e3b9a24 100644 --- a/webfonts/fa-regular-400.svg +++ b/webfonts/fa-regular-400.svg @@ -1,471 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/webfonts/fa-solid-900.svg b/webfonts/fa-solid-900.svg index f83fa4a..bd49cf0 100644 --- a/webfonts/fa-solid-900.svg +++ b/webfonts/fa-solid-900.svg @@ -1,2760 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file