+
{{ trans('visiosoft.module.advs::field.product_option.name') }}
-
- {{ form.fields.product_options_value.configSet('cat1',adv.cat1).input|raw }}
+
+ {{ form.fields.product_options_value.configSet('cat1', adv.cat1).input|raw }}
{% endif %}
@@ -275,6 +274,5 @@
{{ asset_add("scripts.js", "visiosoft.module.advs::js/new-create.js") }}
{{ asset_add("scripts.js", "streams::js/form/form.js") }}
{{ asset_add("scripts.js", "streams::js/form/translations.js") }}
- {{ asset_add("styles.css", "visiosoft.module.advs::css/new-create.css") }}
{% endblock %}
\ No newline at end of file
diff --git a/addons/default/visiosoft/advs-module/resources/views/new-ad/partials/contact-info.twig b/addons/default/visiosoft/advs-module/resources/views/new-ad/partials/contact-info.twig
index f0f40442e..39078b5b9 100644
--- a/addons/default/visiosoft/advs-module/resources/views/new-ad/partials/contact-info.twig
+++ b/addons/default/visiosoft/advs-module/resources/views/new-ad/partials/contact-info.twig
@@ -1,47 +1,40 @@
-
{{ trans('visiosoft.module.advs::field.contact_info') }}
-
-
diff --git a/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php b/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php
index 7bcb93053..f14c1aadb 100644
--- a/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php
+++ b/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php
@@ -9,24 +9,14 @@ class AdvFormBuilder extends FormBuilder
protected $category = null;
- protected $rules = [];
-
protected $skips = [
'slug'
];
- protected $actions = [];
-
protected $buttons = [
'cancel',
];
- protected $options = [];
-
- protected $sections = [];
-
- protected $assets = [];
-
public function __construct(Form $form)
{
parent::__construct($form);
diff --git a/addons/default/visiosoft/advs-module/src/ProductoptionsValue/Support/MultipleFieldType/LookupTableBuilder.php b/addons/default/visiosoft/advs-module/src/ProductoptionsValue/Support/MultipleFieldType/LookupTableBuilder.php
index 6d8baa6f3..f62e5eb27 100644
--- a/addons/default/visiosoft/advs-module/src/ProductoptionsValue/Support/MultipleFieldType/LookupTableBuilder.php
+++ b/addons/default/visiosoft/advs-module/src/ProductoptionsValue/Support/MultipleFieldType/LookupTableBuilder.php
@@ -4,7 +4,7 @@ use Anomaly\Streams\Platform\Ui\Table\Table;
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
-class LookupTableBuilder extends \Anomaly\MultipleFieldType\Table\LookupTableBuilder
+class LookupTableBuilder extends \Visiosoft\MultipleFieldType\Table\LookupTableBuilder
{
public function __construct(Table $table,ValueTableBuilder $valueTableBuilder)
{
diff --git a/addons/default/visiosoft/advs-module/src/ProductoptionsValue/Support/MultipleFieldType/SelectedTableBuilder.php b/addons/default/visiosoft/advs-module/src/ProductoptionsValue/Support/MultipleFieldType/SelectedTableBuilder.php
index 99b456683..2771e40f2 100644
--- a/addons/default/visiosoft/advs-module/src/ProductoptionsValue/Support/MultipleFieldType/SelectedTableBuilder.php
+++ b/addons/default/visiosoft/advs-module/src/ProductoptionsValue/Support/MultipleFieldType/SelectedTableBuilder.php
@@ -1,6 +1,6 @@
check()){
+ return null;
+ }
return $prefix . number_format($number, $decimals, $point, str_replace(' ', ' ', $separator)) . $suffix;
}
diff --git a/addons/default/visiosoft/base-theme/src/BaseThemeServiceProvider.php b/addons/default/visiosoft/base-theme/src/BaseThemeServiceProvider.php
index 6748b5a58..d8dbd9135 100644
--- a/addons/default/visiosoft/base-theme/src/BaseThemeServiceProvider.php
+++ b/addons/default/visiosoft/base-theme/src/BaseThemeServiceProvider.php
@@ -1,167 +1,15 @@
[
- // Visiosoft\TestbootTheme\Http\Middleware\ExampleMiddleware::class,
- //],
- ];
-
- /**
- * Addon route middleware.
- *
- * @type array|null
- */
- protected $routeMiddleware = [];
-
- /**
- * The addon event listeners.
- *
- * @type array|null
- */
- protected $listeners = [
- //Visiosoft\TestbootTheme\Event\ExampleEvent::class => [
- // Visiosoft\TestbootTheme\Listener\ExampleListener::class,
- //],
- ];
-
- /**
- * The addon alias bindings.
- *
- * @type array|null
- */
- protected $aliases = [
- //'Example' => Visiosoft\TestbootTheme\Example::class
- ];
-
- /**
- * The addon class bindings.
- *
- * @type array|null
- */
- protected $bindings = [];
-
- /**
- * The addon singleton bindings.
- *
- * @type array|null
- */
- protected $singletons = [];
-
- /**
- * Additional service providers.
- *
- * @type array|null
- */
- protected $providers = [
- //\ExamplePackage\Provider\ExampleProvider::class
- ];
-
- /**
- * The addon view overrides.
- *
- * @type array|null
- */
- protected $overrides = [
- //'streams::errors/404' => 'module::errors/404',
- //'streams::errors/500' => 'module::errors/500',
- ];
-
- /**
- * The addon mobile-only view overrides.
- *
- * @type array|null
- */
protected $mobile = [
'streams::errors/404' => 'visiosoft.theme.base::errors/404',
'streams::errors/403' => 'visiosoft.theme.base::errors/403',
'anomaly.module.users::login' => 'visiosoft.theme.base::addons/anomaly/users-module/login',
'anomaly.module.users::register' => 'visiosoft.theme.base::addons/anomaly/users-module/register',
'anomaly.module.users::password/forgot' => 'visiosoft.theme.base::addons/anomaly/users-module/password/forgot',
- 'anomaly.module.users::password/reset' => 'visiosoft.theme.base::addons/anomaly/users-module/password/reset'
+ 'anomaly.module.users::password/reset' => 'visiosoft.theme.base::addons/anomaly/users-module/password/reset',
];
-
- /**
- * Register the addon.
- */
- public function register()
- {
- // Run extra pre-boot registration logic here.
- // Use method injection or commands to bring in services.
- }
-
- /**
- * Boot the addon.
- */
- public function boot()
- {
- // Run extra post-boot registration logic here.
- // Use method injection or commands to bring in services.
- }
-
- /**
- * Map additional addon routes.
- *
- * @param Router $router
- */
- public function map(Router $router)
- {
- // Register dynamic routes here for example.
- // Use method injection or commands to bring in services.
- }
-
}
diff --git a/addons/default/visiosoft/multiple-field_type/.gitignore b/addons/default/visiosoft/multiple-field_type/.gitignore
new file mode 100644
index 000000000..372d36068
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/.gitignore
@@ -0,0 +1,10 @@
+.coverage
+composer.lock
+npm-debug.log
+mix-manifest.json
+package-lock.json
+/bin
+/build
+/vendor
+/coverage
+/node_modules
diff --git a/addons/default/visiosoft/multiple-field_type/LICENSE.md b/addons/default/visiosoft/multiple-field_type/LICENSE.md
new file mode 100644
index 000000000..996c17435
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/LICENSE.md
@@ -0,0 +1,21 @@
+#The MIT License (MIT)
+
+###Copyright (c) 2014 AnomalyLabs, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/addons/default/visiosoft/multiple-field_type/README.md b/addons/default/visiosoft/multiple-field_type/README.md
new file mode 100644
index 000000000..1b8f2fa4c
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/README.md
@@ -0,0 +1,7 @@
+# Multiple Field Type
+
+*visiosoft.field_type.multiple*
+
+### A multiple relationship field type.
+
+The multiple field type provides a multi-select input for a related model.
diff --git a/addons/default/visiosoft/multiple-field_type/composer.json b/addons/default/visiosoft/multiple-field_type/composer.json
new file mode 100644
index 000000000..c65fe4252
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/composer.json
@@ -0,0 +1,30 @@
+{
+ "name": "visiosoft/multiple-field_type",
+ "type": "streams-addon",
+ "description": "A multiple relationship field type.",
+ "keywords": [
+ "streams field type",
+ "streams addon",
+ "field type"
+ ],
+ "homepage": "http://pyrocms.com/anomaly/multiple-field_type",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Openclassify, Inc.",
+ "homepage": "https://openclassify.com/",
+ "role": "Owner"
+ }
+ ],
+ "support": {
+ "docs": "https://pyrocms.com/documentation/multiple-field-type",
+ "forum": "https://pyrocms.com/forum/channels/multiple-field-type",
+ "issues": "https://github.com/pyrocms/pyrocms/issues?q=is:issue is:open [multiple-field-type]",
+ "source": "https://github.com/anomalylabs/multiple-field-type"
+ },
+ "autoload": {
+ "psr-4": {
+ "Visiosoft\\MultipleFieldType\\": "src/"
+ }
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/package.json b/addons/default/visiosoft/multiple-field_type/package.json
new file mode 100644
index 000000000..a33e9caa6
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/package.json
@@ -0,0 +1,20 @@
+{
+ "private": true,
+ "scripts": {
+ "dev": "npm run development",
+ "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
+ "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
+ "watch-poll": "npm run watch -- --watch-poll",
+ "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
+ "prod": "npm run production",
+ "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
+ },
+ "devDependencies": {
+ "choices": "^0.1.0",
+ "cross-env": "^5.1",
+ "laravel-mix": "^4.0.12",
+ "resolve-url-loader": "^2.3.1",
+ "sass": "^1.16.0",
+ "sass-loader": "^7.1.0"
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/resources/config/config.php b/addons/default/visiosoft/multiple-field_type/resources/config/config.php
new file mode 100644
index 000000000..57653c752
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/config/config.php
@@ -0,0 +1,39 @@
+ [
+ 'required' => true,
+ 'type' => 'anomaly.field_type.select',
+ 'config' => [
+ 'handler' => RelatedHandler::class,
+ ],
+ ],
+ 'mode' => [
+ 'required' => true,
+ 'type' => 'anomaly.field_type.select',
+ 'config' => [
+ 'options' => [
+ 'tags' => 'visiosoft.field_type.multiple::config.mode.option.tags',
+ 'lookup' => 'visiosoft.field_type.multiple::config.mode.option.lookup',
+ 'checkboxes' => 'visiosoft.field_type.multiple::config.mode.option.checkboxes',
+ ],
+ ],
+ ],
+ 'title_name' => [
+ 'type' => 'anomaly.field_type.text',
+ ],
+ 'min' => [
+ 'type' => 'anomaly.field_type.integer',
+ 'config' => [
+ 'min' => 1,
+ ],
+ ],
+ 'max' => [
+ 'type' => 'anomaly.field_type.integer',
+ 'config' => [
+ 'min' => 1,
+ ],
+ ],
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/css/choices.css b/addons/default/visiosoft/multiple-field_type/resources/css/choices.css
new file mode 100644
index 000000000..d82dbeba0
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/css/choices.css
@@ -0,0 +1,322 @@
+/*===============================
+= Choices =
+===============================*/
+.choices {
+ position: relative;
+ margin-bottom: 0.5rem;
+ font-size: 16px;
+}
+.choices:focus {
+ outline: none;
+}
+.choices:last-child {
+ margin-bottom: 0;
+}
+.choices.is-disabled .choices__inner, .choices.is-disabled .choices__input {
+ background-color: #eceeef;
+ cursor: not-allowed;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+.choices.is-disabled .choices__item {
+ cursor: not-allowed;
+}
+
+.choices[data-type*=select-one] {
+ cursor: pointer;
+}
+.choices[data-type*=select-one] .choices__inner {
+ padding-bottom: 7.5px;
+}
+.choices[data-type*=select-one] .choices__input {
+ display: block;
+ width: 100%;
+ padding: 10px;
+ border-bottom: 1px solid #DDDDDD;
+ background-color: #FFFFFF;
+ margin: 0;
+}
+.choices[data-type*=select-one] .choices__button {
+ background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);
+ padding: 0;
+ background-size: 8px;
+ height: 100%;
+ position: absolute;
+ top: 50%;
+ right: 0;
+ margin-top: -10px;
+ margin-right: 25px;
+ height: 20px;
+ width: 20px;
+ border-radius: 10em;
+ opacity: 0.5;
+}
+.choices[data-type*=select-one] .choices__button:hover, .choices[data-type*=select-one] .choices__button:focus {
+ opacity: 1;
+}
+.choices[data-type*=select-one] .choices__button:focus {
+ box-shadow: 0px 0px 0px 2px #11bef6;
+}
+.choices[data-type*=select-one]:after {
+ content: "";
+ height: 0;
+ width: 0;
+ border-style: solid;
+ border-color: #55595c transparent transparent transparent;
+ border-width: 5px;
+ position: absolute;
+ right: 11.5px;
+ top: 50%;
+ margin-top: -2.5px;
+ pointer-events: none;
+}
+.choices[data-type*=select-one].is-open:after {
+ border-color: transparent transparent #55595c transparent;
+ margin-top: -7.5px;
+}
+.choices[data-type*=select-one][dir=rtl]:after {
+ left: 11.5px;
+ right: auto;
+}
+.choices[data-type*=select-one][dir=rtl] .choices__button {
+ right: auto;
+ left: 0;
+ margin-left: 25px;
+ margin-right: 0;
+}
+
+.choices[data-type*=select-multiple] .choices__inner, .choices[data-type*=text] .choices__inner {
+ cursor: text;
+}
+.choices[data-type*=select-multiple] .choices__button, .choices[data-type*=text] .choices__button {
+ position: relative;
+ display: inline-block;
+ margin-top: 0;
+ margin-right: -4px;
+ margin-bottom: 0;
+ margin-left: 8px;
+ padding-left: 16px;
+ border-left: 1px solid #089ccc;
+ background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);
+ background-size: 8px;
+ width: 8px;
+ line-height: 1;
+ opacity: 0.75;
+}
+.choices[data-type*=select-multiple] .choices__button:hover, .choices[data-type*=select-multiple] .choices__button:focus, .choices[data-type*=text] .choices__button:hover, .choices[data-type*=text] .choices__button:focus {
+ opacity: 1;
+}
+
+.choices__inner {
+ display: inline-block;
+ vertical-align: top;
+ width: 100%;
+ background-color: #ffffff;
+ padding: 7.5px 7.5px 3.75px;
+ border: 1px solid #DDDDDD;
+ border-radius: 0.1rem;
+ font-size: 14px;
+ min-height: 44px;
+ overflow: hidden;
+}
+.is-focused .choices__inner, .is-open .choices__inner {
+ border-color: #b7b7b7;
+}
+.is-open .choices__inner {
+ border-radius: 0.1rem 0.1rem 0 0;
+}
+.is-flipped.is-open .choices__inner {
+ border-radius: 0 0 0.1rem 0.1rem;
+}
+
+.choices__list {
+ margin: 0;
+ padding-left: 0;
+ list-style: none;
+}
+
+.choices__list--single {
+ display: inline-block;
+ padding: 4px 16px 4px 4px;
+ width: 100%;
+}
+[dir=rtl] .choices__list--single {
+ padding-right: 4px;
+ padding-left: 16px;
+}
+.choices__list--single .choices__item {
+ width: 100%;
+}
+
+.choices__list--multiple {
+ display: inline;
+}
+.choices__list--multiple .choices__item {
+ display: inline-block;
+ vertical-align: middle;
+ border-radius: 0.1rem;
+ padding: 4px 10px;
+ font-size: 12px;
+ font-weight: 500;
+ margin-right: 3.75px;
+ margin-bottom: 3.75px;
+ background-color: #11bef6;
+ border: 1px solid #09afe5;
+ color: #FFFFFF;
+ word-break: break-all;
+}
+.choices__list--multiple .choices__item[data-deletable] {
+ padding-right: 5px;
+}
+[dir=rtl] .choices__list--multiple .choices__item {
+ margin-right: 0;
+ margin-left: 3.75px;
+}
+.choices__list--multiple .choices__item.is-highlighted {
+ background-color: #09afe5;
+ border: 1px solid #089ccc;
+}
+.is-disabled .choices__list--multiple .choices__item {
+ background-color: #aaaaaa;
+ border: 1px solid #919191;
+}
+
+.choices__list--dropdown {
+ display: none;
+ z-index: 1;
+ position: absolute;
+ width: 100%;
+ background-color: #FFFFFF;
+ border: 1px solid #DDDDDD;
+ top: 100%;
+ margin-top: -1px;
+ border-bottom-left-radius: 0.1rem;
+ border-bottom-right-radius: 0.1rem;
+ overflow: hidden;
+ word-break: break-all;
+}
+.choices__list--dropdown.is-active {
+ display: block;
+}
+.is-open .choices__list--dropdown {
+ border-color: #b7b7b7;
+}
+.is-flipped .choices__list--dropdown {
+ top: auto;
+ bottom: 100%;
+ margin-top: 0;
+ margin-bottom: -1px;
+ border-radius: 0.25rem 0.25rem 0 0;
+}
+.choices__list--dropdown .choices__list {
+ position: relative;
+ max-height: 300px;
+ overflow: auto;
+ -webkit-overflow-scrolling: touch;
+ will-change: scroll-position;
+}
+.choices__list--dropdown .choices__item {
+ position: relative;
+ padding: 10px;
+ font-size: 14px;
+}
+[dir=rtl] .choices__list--dropdown .choices__item {
+ text-align: right;
+}
+@media (min-width: 640px) {
+ .choices__list--dropdown .choices__item--selectable {
+ padding-right: 100px;
+ }
+ .choices__list--dropdown .choices__item--selectable:after {
+ content: attr(data-select-text);
+ font-size: 12px;
+ opacity: 0;
+ position: absolute;
+ right: 10px;
+ top: 50%;
+ -webkit-transform: translateY(-50%);
+ transform: translateY(-50%);
+ }
+ [dir=rtl] .choices__list--dropdown .choices__item--selectable {
+ text-align: right;
+ padding-left: 100px;
+ padding-right: 10px;
+ }
+ [dir=rtl] .choices__list--dropdown .choices__item--selectable:after {
+ right: auto;
+ left: 10px;
+ }
+}
+.choices__list--dropdown .choices__item--selectable.is-highlighted {
+ background-color: #f2f2f2;
+}
+.choices__list--dropdown .choices__item--selectable.is-highlighted:after {
+ opacity: 0.5;
+}
+
+.choices__item {
+ cursor: default;
+}
+
+.choices__item--selectable {
+ cursor: pointer;
+}
+
+.choices__item--disabled {
+ cursor: not-allowed;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ opacity: 0.5;
+}
+
+.choices__heading {
+ font-weight: 600;
+ font-size: 12px;
+ padding: 10px;
+ border-bottom: 1px solid #f7f7f7;
+ color: gray;
+}
+
+.choices__button {
+ text-indent: -9999px;
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ border: 0;
+ background-color: transparent;
+ background-repeat: no-repeat;
+ background-position: center;
+ cursor: pointer;
+}
+.choices__button:focus {
+ outline: none;
+}
+
+.choices__input {
+ display: inline-block;
+ vertical-align: baseline;
+ background-color: #ffffff;
+ font-size: 14px;
+ margin-bottom: 5px;
+ border: 0;
+ border-radius: 0;
+ max-width: 100%;
+ padding: 4px 0 4px 2px;
+}
+.choices__input:focus {
+ outline: 0;
+}
+[dir=rtl] .choices__input {
+ padding-right: 2px;
+ padding-left: 0;
+}
+
+.choices__placeholder {
+ opacity: 0.5;
+}
+
+/*===== End of Choices ======*/
\ No newline at end of file
diff --git a/addons/default/visiosoft/multiple-field_type/resources/css/lookup.scss b/addons/default/visiosoft/multiple-field_type/resources/css/lookup.scss
new file mode 100644
index 000000000..ab65d6794
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/css/lookup.scss
@@ -0,0 +1,301 @@
+/* Main styles */
+.multiple-field_type .selected {
+ margin-top: calc(15rem / 16);
+}
+
+.multiple-field_type .selected table tr td {
+ padding: 0.5rem;
+ border-top: none;
+ border-bottom: none;
+}
+
+.multiple-field_type .selected table tr td:first-of-type {
+ width: 0;
+ padding-right: calc(15rem / 16);
+}
+
+.multiple-field_type .selected table tr td:last-of-type {
+ padding-left: calc(15rem / 16);
+}
+/* End main styles */
+
+/* Button */
+.multiple-select-btn {
+ background-color: #6E5DDB;
+ padding: 1rem 2rem;
+ font-family: 'Poppins', sans-serif;
+ font-size: calc(18rem / 16);
+ border-radius: .25rem;
+ border: 0;
+ color: #fff;
+ display: inline-flex;
+ align-items: center;
+ margin-bottom: 2rem;
+
+ &:hover {
+ color: #fff;
+ }
+
+ svg {
+ width: 1.5rem;
+ height: auto;
+ }
+}
+/* End Button */
+
+/* Modal */
+.multiple-select-btn ~ .modal {
+ .modal-dialog {
+ @media only screen and (min-width: 576px) {
+ max-width: calc(840rem / 16);
+ margin: 1.75rem auto;
+ }
+
+ .modal-content {
+ .modal-header {
+ padding: 0;
+ display: block;
+ border: 0;
+
+ .btn-wrapper {
+ text-align: right;
+
+ button {
+ margin: 1.5rem 1.5rem .25rem;
+ padding: 0;
+ background: none;
+ border: 0;
+
+ svg {
+ width: 2.25rem;
+ height: auto;
+ }
+ }
+ }
+
+ h4 {
+ color: #6E5DDB;
+ padding: 0 1rem;
+ @media only screen and (min-width: 576px) {
+ padding: 0 5rem;
+ }
+ }
+ }
+
+ .table-filters {
+ padding: 0 1rem;
+ margin: 2rem 0;
+ @media only screen and (min-width: 576px) {
+ padding: 0 5rem;
+ }
+
+ form {
+ justify-content: space-between;
+
+ select {
+ border: 0;
+ box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075);
+ font-size: calc(14rem / 16);
+ font-family: 'Poppins', sans-serif;
+ font-weight: 500;
+ padding: .5rem 1.5rem;
+ height: initial;
+ }
+
+ .filter-buttons {
+ button {
+ background-color: #6e5ddb;
+ color: #fff;
+ }
+
+ a {
+ border-color: #6e5ddb;
+ color: #6e5ddb;
+ }
+ }
+ }
+ }
+
+ .table-responsive {
+ padding: 0 1rem;
+ @media only screen and (min-width: 576px) {
+ padding: 0 5rem;
+ }
+
+ table {
+ thead {
+ tr {
+ th {
+ border-bottom: calc(1rem / 16) solid #E5E5E5;
+ border-top: 0;
+ font-family: 'Poppins', sans-serif;
+ font-size: calc(19rem / 16);
+ font-weight: 600;
+ color: #505050;
+
+ &.buttons {
+ display: none;
+ }
+
+ a {
+ color: #505050;
+ }
+ }
+ }
+ }
+
+ tbody {
+ td {
+ border-bottom: calc(1rem / 16) solid #E5E5E5;
+ font-size: calc(19rem / 16);
+ font-family: 'Poppins', sans-serif;
+ font-weight: 500;
+ color: #505050;
+
+ &.buttons {
+ display: none;
+ }
+ }
+ }
+
+ tfoot {
+ th {
+ border: 0;
+ padding: 1.35rem 0 !important;
+
+ button {
+ background-color: #6E5DDB;
+ padding: 1rem 2rem;
+ font-family: 'Poppins', sans-serif;
+ font-size: calc(18rem / 16);
+ border-radius: .25rem;
+ border: 0;
+ color: #fff;
+ display: inline-flex;
+ align-items: center;
+
+ &:focus {
+ box-shadow: unset;
+ }
+
+ i {
+ margin-right: .25rem;
+ }
+ }
+ }
+
+ td {
+ padding: .5rem 0;
+ border: 0;
+ color: #999;
+
+ small {
+ font-size: calc(15rem / 16);
+ color: #999 !important;
+ font-family: 'Poppins', sans-serif;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+/* End Modal */
+
+/* Value table */
+.multiple-field_type-value-table {
+ .table-responsive {
+ @media only screen and (min-width: 576px) {
+ padding: 0 4rem;
+ }
+
+ table {
+ thead {
+ tr {
+ th {
+ border-bottom: calc(1rem / 16) solid #E5E5E5;
+ border-top: 0;
+ font-family: 'Poppins', sans-serif;
+ font-size: calc(19rem / 16);
+ font-weight: 600;
+ color: #505050;
+
+ a {
+ color: #505050;
+ }
+ }
+ }
+ }
+
+ tbody {
+ td {
+ border-bottom: calc(1rem / 16) solid #E5E5E5;
+ font-size: calc(19rem / 16);
+ font-family: 'Poppins', sans-serif;
+ font-weight: 500;
+ color: #505050;
+
+ &.buttons {
+ a {
+ background-color: unset;
+ border: 0;
+ color: #DC3545;
+ font-family: 'Poppins', sans-serif;
+ font-weight: 500;
+ display: inline-flex;
+ align-items: center;
+ line-height: 1;
+ font-size: calc(17rem / 16);
+ cursor: pointer;
+ }
+
+ i {
+ margin-right: .5rem;
+ }
+ }
+ }
+ }
+
+ tfoot {
+ th {
+ border: 0;
+ padding: 1.35rem 0 !important;
+
+ button {
+ background-color: #6E5DDB;
+ padding: 1rem 2rem;
+ font-family: 'Poppins', sans-serif;
+ font-size: calc(18rem / 16);
+ border-radius: .25rem;
+ border: 0;
+ color: #fff;
+ display: inline-flex;
+ align-items: center;
+
+ &:focus {
+ box-shadow: unset;
+ }
+
+ i {
+ margin-right: .25rem;
+ }
+ }
+ }
+
+ td {
+ padding: .5rem 0;
+ border: 0;
+ color: #999;
+
+ small {
+ font-size: calc(15rem / 16);
+ color: #999 !important;
+ font-family: 'Poppins', sans-serif;
+ }
+ }
+ }
+ }
+ }
+}
+/* End Value table */
diff --git a/addons/default/visiosoft/multiple-field_type/resources/css/tags.css b/addons/default/visiosoft/multiple-field_type/resources/css/tags.css
new file mode 100644
index 000000000..3854526c4
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/css/tags.css
@@ -0,0 +1,3 @@
+.multiple-field_type .choices {
+ z-index: 100;
+}
\ No newline at end of file
diff --git a/addons/default/visiosoft/multiple-field_type/resources/images/close.svg b/addons/default/visiosoft/multiple-field_type/resources/images/close.svg
new file mode 100644
index 000000000..85882199b
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/images/close.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/addons/default/visiosoft/multiple-field_type/resources/images/plus.svg b/addons/default/visiosoft/multiple-field_type/resources/images/plus.svg
new file mode 100644
index 000000000..dc901980f
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/images/plus.svg
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/default/visiosoft/multiple-field_type/resources/js/choices.js b/addons/default/visiosoft/multiple-field_type/resources/js/choices.js
new file mode 100644
index 000000000..8792bbb7d
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/js/choices.js
@@ -0,0 +1,75 @@
+/**
+ * Prompts the user for multiple choice
+ *
+ * `choices` are displayed in an ordered list, user is prompted with message,
+ * callback is returned with the index of the choice.
+ *
+ * @param prompt String Message to show users
+ * @param choices Array[String] Names of the choices
+ * @param callback Function Callback the function when a valid choice is made
+ *
+ * @install
+ * npm install choices
+ *
+ * @example
+ *
+ * var choices = require('choices');
+ * var options = ['First Option', 'Second option', 'Third option'];
+ * choices('Pick an option', options, function(idx) {
+ * console.log('You picked ' + options[idx]);
+ * });
+ *
+ * [1]: First option
+ * [2]: Second option
+ * [3]: Third option
+ * Pick an option>> 2
+ * You picked Second option
+ *
+ * @todo Add support for more than 9 options (key number + enter)
+ *
+ */
+
+var Choices = module.exports = function Choices(prompt, options, callback) {
+ var stdin = process.stdin;
+ var colors = require('colors');
+
+ if (options.length > 9) {
+ throw new Error('choices only supports < 9 choices');
+ }
+
+ options.forEach(function(name, idx) {
+ console.log(' ['.bold + ('' + (idx + 1)).green.bold + ']'.bold + ': ' + name);
+ });
+
+ process.stdout.write(prompt + '>> '.red);
+
+ stdin.setRawMode(true);
+ stdin.resume();
+
+ stdin.once(
+ 'data',
+ function(key) {
+ var idx,
+ charCode = key.toString('utf8').charCodeAt(0);
+ stdin.pause();
+ stdin.setRawMode(false);
+
+ var re = /[\0-\x1F\x7F-\x9F\xAD\u0378\u0379\u037F-\u0383\u038B\u038D\u03A2\u0528-\u0530\u0557\u0558\u0560\u0588\u058B-\u058E\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08A1\u08AD-\u08E3\u08FF\u0978\u0980\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0C00\u0C04\u0C0D\u0C11\u0C29\u0C34\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5A-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C81\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D01\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5F\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F5-\u13FF\u169D-\u169F\u16F1-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191D-\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7-\u1CFF\u1DE7-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BB-\u20CF\u20F1-\u20FF\u218A-\u218F\u23F4-\u23FF\u2427-\u243F\u244B-\u245F\u2700\u2B4D-\u2B4F\u2B5A-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E3C-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FCD-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA698-\uA69E\uA6F8-\uA6FF\uA78F\uA794-\uA79F\uA7AB-\uA7F7\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C5-\uA8CD\uA8DA-\uA8DF\uA8FC-\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9E0-\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAA7C-\uAA7F\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F-\uABBF\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE27-\uFE2F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF]/g;
+ process.stdout.write(key.toString('utf8').replace(re, '') + "\n");
+
+
+ if (charCode == 3 || charCode == 27 || charCode == 113 || charCode == 81) {
+ return callback(null);
+ }
+
+ idx = +key;
+
+ if (idx > 0 && idx <= options.length)
+ return callback(idx - 1);
+
+ process.nextTick(function() {
+ Choices(prompt, options, callback);
+ });
+ }
+ );
+};
diff --git a/addons/default/visiosoft/multiple-field_type/resources/js/choices.min.js b/addons/default/visiosoft/multiple-field_type/resources/js/choices.min.js
new file mode 100644
index 000000000..9e2e63c19
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/js/choices.min.js
@@ -0,0 +1,4 @@
+/*! choices.js v3.0.4 | (c) 2018 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
+!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Choices=t():e.Choices=t()}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={exports:{},id:n,loaded:!1};return e[n].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var i={};return t.m=e,t.c=i,t.p="/assets/scripts/dist/",t(0)}([function(e,t,i){e.exports=i(1)},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function s(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function o(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t
0&&void 0!==arguments[0]?arguments[0]:"[data-choice]",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r(this,e),(0,v.isType)("String",t)){var n=document.querySelectorAll(t);if(n.length>1)for(var s=1;s"'+(0,v.stripHTML)(e)+'"'},maxItemText:function(e){return"Only "+e+" values can be added."},itemComparer:function(e,t){return e===t},uniqueItemText:"Only unique values can be added.",classNames:{containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",hiddenState:"is-hidden",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"},fuseOptions:{include:"score"},callbackOnInit:null,callbackOnCreateTemplates:null};if(this.idNames={itemChoice:"item-choice"},this.config=(0,v.extend)(a,i),"auto"!==this.config.renderSelectedChoices&&"always"!==this.config.renderSelectedChoices&&(this.config.silent||console.warn("renderSelectedChoices: Possible values are 'auto' and 'always'. Falling back to 'auto'."),this.config.renderSelectedChoices="auto"),this.store=new f.default(this.render),this.initialised=!1,this.currentState={},this.prevState={},this.currentValue="",this.element=t,this.passedElement=(0,v.isType)("String",t)?document.querySelector(t):t,!this.passedElement)return void(this.config.silent||console.error("Passed element not found"));this.isTextElement="text"===this.passedElement.type,this.isSelectOneElement="select-one"===this.passedElement.type,this.isSelectMultipleElement="select-multiple"===this.passedElement.type,this.isSelectElement=this.isSelectOneElement||this.isSelectMultipleElement,this.isValidElementType=this.isTextElement||this.isSelectElement,this.isIe11=!(!navigator.userAgent.match(/Trident/)||!navigator.userAgent.match(/rv[ :]11/)),this.isScrollingOnIe=!1,this.config.shouldSortItems===!0&&this.isSelectOneElement&&(this.config.silent||console.warn("shouldSortElements: Type of passed element is 'select-one', falling back to false.")),this.highlightPosition=0,this.canSearch=this.config.searchEnabled,this.placeholder=!1,this.isSelectOneElement||(this.placeholder=!!this.config.placeholder&&(this.config.placeholderValue||this.passedElement.getAttribute("placeholder"))),this.presetChoices=this.config.choices,this.presetItems=this.config.items,this.passedElement.value&&(this.presetItems=this.presetItems.concat(this.passedElement.value.split(this.config.delimiter))),this.baseId=(0,v.generateId)(this.passedElement,"choices-"),this.render=this.render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onPaste=this._onPaste.bind(this),this._onInput=this._onInput.bind(this),this.wasTap=!0;var c="classList"in document.documentElement;c||this.config.silent||console.error("Choices: Your browser doesn't support Choices");var l=(0,v.isElement)(this.passedElement)&&this.isValidElementType;if(l){if("active"===this.passedElement.getAttribute("data-choice"))return;this.init()}else this.config.silent||console.error("Incompatible input passed")}return a(e,[{key:"init",value:function(){if(this.initialised!==!0){var e=this.config.callbackOnInit;this.initialised=!0,this._createTemplates(),this._createInput(),this.store.subscribe(this.render),this.render(),this._addEventListeners(),e&&(0,v.isType)("Function",e)&&e.call(this)}}},{key:"destroy",value:function(){if(this.initialised!==!1){this._removeEventListeners(),this.passedElement.classList.remove(this.config.classNames.input,this.config.classNames.hiddenState),this.passedElement.removeAttribute("tabindex");var e=this.passedElement.getAttribute("data-choice-orig-style");Boolean(e)?(this.passedElement.removeAttribute("data-choice-orig-style"),this.passedElement.setAttribute("style",e)):this.passedElement.removeAttribute("style"),this.passedElement.removeAttribute("aria-hidden"),this.passedElement.removeAttribute("data-choice"),this.passedElement.value=this.passedElement.value,this.containerOuter.parentNode.insertBefore(this.passedElement,this.containerOuter),this.containerOuter.parentNode.removeChild(this.containerOuter),this.clearStore(),this.config.templates=null,this.initialised=!1}}},{key:"renderGroups",value:function(e,t,i){var n=this,s=i||document.createDocumentFragment(),o=this.config.sortFilter;return this.config.shouldSort&&e.sort(o),e.forEach(function(e){var i=t.filter(function(t){return n.isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&!t.selected});if(i.length>=1){var o=n._getTemplate("choiceGroup",e);s.appendChild(o),n.renderChoices(i,s,!0)}}),s}},{key:"renderChoices",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=t||document.createDocumentFragment(),r=this.config,a=r.renderSelectedChoices,c=r.searchResultLimit,l=r.renderChoiceLimit,h=this.isSearching?v.sortByScore:this.config.sortFilter,u=function(e){var t="auto"!==a||(i.isSelectOneElement||!e.selected);if(t){var n=i._getTemplate("choice",e);s.appendChild(n)}},d=e;"auto"!==a||this.isSelectOneElement||(d=e.filter(function(e){return!e.selected}));var f=d.reduce(function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e},{placeholderChoices:[],normalChoices:[]}),p=f.placeholderChoices,m=f.normalChoices;(this.config.shouldSort||this.isSearching)&&m.sort(h);var g=d.length,y=[].concat(o(p),o(m));this.isSearching?g=c:l>0&&!n&&(g=l);for(var b=0;b1&&void 0!==arguments[1]?arguments[1]:null,n=i||document.createDocumentFragment();if(this.config.shouldSortItems&&!this.isSelectOneElement&&e.sort(this.config.sortFilter),this.isTextElement){var s=this.store.getItemsReducedToValues(e),o=s.join(this.config.delimiter);this.passedElement.setAttribute("value",o),this.passedElement.value=o}else{var r=document.createDocumentFragment();e.forEach(function(e){var i=t._getTemplate("option",e);r.appendChild(i)}),this.passedElement.innerHTML="",this.passedElement.appendChild(r)}return e.forEach(function(e){var i=t._getTemplate("item",e);n.appendChild(i)}),n}},{key:"render",value:function(){if(!this.store.isLoading()&&(this.currentState=this.store.getState(),this.currentState!==this.prevState)){if((this.currentState.choices!==this.prevState.choices||this.currentState.groups!==this.prevState.groups||this.currentState.items!==this.prevState.items)&&this.isSelectElement){var e=this.store.getGroupsFilteredByActive(),t=this.store.getChoicesFilteredByActive(),i=document.createDocumentFragment();this.choiceList.innerHTML="",this.config.resetScrollPosition&&(this.choiceList.scrollTop=0),e.length>=1&&this.isSearching!==!0?i=this.renderGroups(e,t,i):t.length>=1&&(i=this.renderChoices(t,i));var n=this.store.getItemsFilteredByActive(),s=this._canAddItem(n,this.input.value);if(i.childNodes&&i.childNodes.length>0)s.response?(this.choiceList.appendChild(i),this._highlightChoice()):this.choiceList.appendChild(this._getTemplate("notice",s.notice));else{var o=void 0,r=void 0;this.isSearching?(r=(0,v.isType)("Function",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,o=this._getTemplate("notice",r,"no-results")):(r=(0,v.isType)("Function",this.config.noChoicesText)?this.config.noChoicesText():this.config.noChoicesText,o=this._getTemplate("notice",r,"no-choices")),this.choiceList.appendChild(o)}}if(this.currentState.items!==this.prevState.items){var a=this.store.getItemsFilteredByActive();if(this.itemList.innerHTML="",a&&a){var c=this.renderItems(a);c.childNodes&&this.itemList.appendChild(c)}}this.prevState=this.currentState}}},{key:"highlightItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return this;var i=e.id,n=e.groupId,s=n>=0?this.store.getGroupById(n):null;return this.store.dispatch((0,p.highlightItem)(i,!0)),t&&(s&&s.value?(0,v.triggerEvent)(this.passedElement,"highlightItem",{id:i,value:e.value,label:e.label,groupValue:s.value}):(0,v.triggerEvent)(this.passedElement,"highlightItem",{id:i,value:e.value,label:e.label})),this}},{key:"unhighlightItem",value:function(e){if(!e)return this;var t=e.id,i=e.groupId,n=i>=0?this.store.getGroupById(i):null;return this.store.dispatch((0,p.highlightItem)(t,!1)),n&&n.value?(0,v.triggerEvent)(this.passedElement,"unhighlightItem",{id:t,value:e.value,label:e.label,groupValue:n.value}):(0,v.triggerEvent)(this.passedElement,"unhighlightItem",{id:t,value:e.value,label:e.label}),this}},{key:"highlightAll",value:function(){var e=this,t=this.store.getItems();return t.forEach(function(t){e.highlightItem(t)}),this}},{key:"unhighlightAll",value:function(){var e=this,t=this.store.getItems();return t.forEach(function(t){e.unhighlightItem(t)}),this}},{key:"removeItemsByValue",value:function(e){var t=this;if(!e||!(0,v.isType)("String",e))return this;var i=this.store.getItemsFilteredByActive();return i.forEach(function(i){i.value===e&&t._removeItem(i)}),this}},{key:"removeActiveItems",value:function(e){var t=this,i=this.store.getItemsFilteredByActive();return i.forEach(function(i){i.active&&e!==i.id&&t._removeItem(i)}),this}},{key:"removeHighlightedItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.store.getItemsFilteredByActive();return i.forEach(function(i){i.highlighted&&i.active&&(e._removeItem(i),t&&e._triggerChange(i.value))}),this}},{key:"showDropdown",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=document.body,i=document.documentElement,n=Math.max(t.scrollHeight,t.offsetHeight,i.clientHeight,i.scrollHeight,i.offsetHeight);this.containerOuter.classList.add(this.config.classNames.openState),this.containerOuter.setAttribute("aria-expanded","true"),this.dropdown.classList.add(this.config.classNames.activeState),this.dropdown.setAttribute("aria-expanded","true");var s=this.dropdown.getBoundingClientRect(),o=Math.ceil(s.top+window.scrollY+this.dropdown.offsetHeight),r=!1;return"auto"===this.config.position?r=o>=n:"top"===this.config.position&&(r=!0),r&&this.containerOuter.classList.add(this.config.classNames.flippedState),e&&this.canSearch&&document.activeElement!==this.input&&this.input.focus(),(0,v.triggerEvent)(this.passedElement,"showDropdown",{}),this}},{key:"hideDropdown",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.containerOuter.classList.contains(this.config.classNames.flippedState);return this.containerOuter.classList.remove(this.config.classNames.openState),this.containerOuter.setAttribute("aria-expanded","false"),this.dropdown.classList.remove(this.config.classNames.activeState),this.dropdown.setAttribute("aria-expanded","false"),t&&this.containerOuter.classList.remove(this.config.classNames.flippedState),e&&this.canSearch&&document.activeElement===this.input&&this.input.blur(),(0,v.triggerEvent)(this.passedElement,"hideDropdown",{}),this}},{key:"toggleDropdown",value:function(){var e=this.dropdown.classList.contains(this.config.classNames.activeState);return e?this.hideDropdown():this.showDropdown(!0),this}},{key:"getValue",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.store.getItemsFilteredByActive(),n=[];return i.forEach(function(i){e.isTextElement?n.push(t?i.value:i):i.active&&n.push(t?i.value:i)}),this.isSelectOneElement?n[0]:n}},{key:"setValue",value:function(e){var t=this;if(this.initialised===!0){var i=[].concat(o(e)),n=function(e){var i=(0,v.getType)(e);if("Object"===i){if(!e.value)return;t.isTextElement?t._addItem(e.value,e.label,e.id,void 0,e.customProperties,e.placeholder):t._addChoice(e.value,e.label,!0,!1,-1,e.customProperties,e.placeholder)}else"String"===i&&(t.isTextElement?t._addItem(e):t._addChoice(e,e,!0,!1,-1,null))};i.length>1?i.forEach(function(e){n(e)}):n(i[0])}return this}},{key:"setValueByChoice",value:function(e){var t=this;if(!this.isTextElement){var i=this.store.getChoices(),n=(0,v.isType)("Array",e)?e:[e];n.forEach(function(e){var n=i.find(function(i){return t.config.itemComparer(i.value,e)});n?n.selected?t.config.silent||console.warn("Attempting to select choice already selected"):t._addItem(n.value,n.label,n.id,n.groupId,n.customProperties,n.placeholder,n.keyCode):t.config.silent||console.warn("Attempting to select choice that does not exist")})}return this}},{key:"setChoices",value:function(e,t,i){var n=this,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(this.initialised===!0&&this.isSelectElement){if(!(0,v.isType)("Array",e)||!t)return this;s&&this._clearChoices(),this._setLoading(!0),e&&e.length&&(this.containerOuter.classList.remove(this.config.classNames.loadingState),e.forEach(function(e){e.choices?n._addGroup(e,e.id||null,t,i):n._addChoice(e[t],e[i],e.selected,e.disabled,void 0,e.customProperties,e.placeholder)})),this._setLoading(!1)}return this}},{key:"clearStore",value:function(){return this.store.dispatch((0,p.clearAll)()),this}},{key:"clearInput",value:function(){return this.input.value&&(this.input.value=""),this.isSelectOneElement||this._setInputWidth(),!this.isTextElement&&this.config.searchEnabled&&(this.isSearching=!1,this.store.dispatch((0,p.activateChoices)(!0))),this}},{key:"enable",value:function(){if(this.initialised){this.passedElement.disabled=!1;var e=this.containerOuter.classList.contains(this.config.classNames.disabledState);e&&(this._addEventListeners(),this.passedElement.removeAttribute("disabled"),this.input.removeAttribute("disabled"),this.containerOuter.classList.remove(this.config.classNames.disabledState),this.containerOuter.removeAttribute("aria-disabled"),this.isSelectOneElement&&this.containerOuter.setAttribute("tabindex","0"))}return this}},{key:"disable",value:function(){if(this.initialised){this.passedElement.disabled=!0;var e=!this.containerOuter.classList.contains(this.config.classNames.disabledState);e&&(this._removeEventListeners(),this.passedElement.setAttribute("disabled",""),this.input.setAttribute("disabled",""),this.containerOuter.classList.add(this.config.classNames.disabledState),this.containerOuter.setAttribute("aria-disabled","true"),this.isSelectOneElement&&this.containerOuter.setAttribute("tabindex","-1"))}return this}},{key:"ajax",value:function(e){var t=this;return this.initialised===!0&&this.isSelectElement&&(requestAnimationFrame(function(){t._handleLoadingState(!0)}),e(this._ajaxCallback())),this}},{key:"_triggerChange",value:function(e){e&&(0,v.triggerEvent)(this.passedElement,"change",{value:e})}},{key:"_handleButtonAction",value:function(e,t){if(e&&t&&this.config.removeItems&&this.config.removeItemButton){var i=t.parentNode.getAttribute("data-id"),n=e.find(function(e){return e.id===parseInt(i,10)});this._removeItem(n),this._triggerChange(n.value),this.isSelectOneElement&&this._selectPlaceholderChoice()}}},{key:"_selectPlaceholderChoice",value:function(){var e=this.store.getPlaceholderChoice();e&&(this._addItem(e.value,e.label,e.id,e.groupId,null,e.placeholder),this._triggerChange(e.value))}},{key:"_handleItemAction",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e&&t&&this.config.removeItems&&!this.isSelectOneElement){var s=t.getAttribute("data-id");e.forEach(function(e){e.id!==parseInt(s,10)||e.highlighted?n||e.highlighted&&i.unhighlightItem(e):i.highlightItem(e)}),document.activeElement!==this.input&&this.input.focus()}}},{key:"_handleChoiceAction",value:function(e,t){if(e&&t){var i=t.getAttribute("data-id"),n=this.store.getChoiceById(i),s=e[0]&&e[0].keyCode?e[0].keyCode:null,o=this.dropdown.classList.contains(this.config.classNames.activeState);if(n.keyCode=s,(0,v.triggerEvent)(this.passedElement,"choice",{choice:n}),n&&!n.selected&&!n.disabled){var r=this._canAddItem(e,n.value);r.response&&(this._addItem(n.value,n.label,n.id,n.groupId,n.customProperties,n.placeholder,n.keyCode),this._triggerChange(n.value))}this.clearInput(),o&&this.isSelectOneElement&&(this.hideDropdown(),this.containerOuter.focus())}}},{key:"_handleBackspace",value:function(e){if(this.config.removeItems&&e){var t=e[e.length-1],i=e.some(function(e){return e.highlighted});this.config.editItems&&!i&&t?(this.input.value=t.value,this._setInputWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}}},{key:"_canAddItem",value:function(e,t){var i=!0,n=(0,v.isType)("Function",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;(this.isSelectMultipleElement||this.isTextElement)&&this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(i=!1,n=(0,v.isType)("Function",this.config.maxItemText)?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),this.isTextElement&&this.config.addItems&&i&&this.config.regexFilter&&(i=this._regexFilter(t));var s=!e.some(function(e){return(0,v.isType)("String",t)?e.value===t.trim():e.value===t});return s||this.config.duplicateItems||this.isSelectOneElement||!i||(i=!1,n=(0,v.isType)("Function",this.config.uniqueItemText)?this.config.uniqueItemText(t):this.config.uniqueItemText),{response:i,notice:n}}},{key:"_handleLoadingState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.itemList.querySelector("."+this.config.classNames.placeholder);e?(this.containerOuter.classList.add(this.config.classNames.loadingState),this.containerOuter.setAttribute("aria-busy","true"),this.isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),this.itemList.appendChild(t)):this.input.placeholder=this.config.loadingText):(this.containerOuter.classList.remove(this.config.classNames.loadingState),this.isSelectOneElement?t.innerHTML=this.placeholder||"":this.input.placeholder=this.placeholder||"")}},{key:"_ajaxCallback",value:function(){var e=this;return function(t,i,n){if(t&&i){var s=(0,v.isType)("Object",t)?[t]:t;s&&(0,v.isType)("Array",s)&&s.length?(e._handleLoadingState(!1),e._setLoading(!0),s.forEach(function(t){if(t.choices){var s=t.id||null;e._addGroup(t,s,i,n)}else e._addChoice(t[i],t[n],t.selected,t.disabled,void 0,t.customProperties,t.placeholder)}),e._setLoading(!1),e.isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1),e.containerOuter.removeAttribute("aria-busy")}}}},{key:"_searchChoices",value:function(e){var t=(0,v.isType)("String",e)?e.trim():e,i=(0,v.isType)("String",this.currentValue)?this.currentValue.trim():this.currentValue;if(t.length>=1&&t!==i+" "){var n=this.store.getSearchableChoices(),s=t,o=(0,v.isType)("Array",this.config.searchFields)?this.config.searchFields:[this.config.searchFields],r=Object.assign(this.config.fuseOptions,{keys:o}),a=new l.default(n,r),c=a.search(s);return this.currentValue=t,this.highlightPosition=0,this.isSearching=!0,this.store.dispatch((0,p.filterChoices)(c)),c.length}return 0}},{key:"_handleSearch",value:function(e){if(e){var t=this.store.getChoices(),i=t.some(function(e){return!e.active});if(this.input===document.activeElement)if(e&&e.length>=this.config.searchFloor){var n=0;this.config.searchChoices&&(n=this._searchChoices(e)),(0,v.triggerEvent)(this.passedElement,"search",{value:e,resultCount:n})}else i&&(this.isSearching=!1,this.store.dispatch((0,p.activateChoices)(!0)))}}},{key:"_addEventListeners",value:function(){document.addEventListener("keyup",this._onKeyUp),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("click",this._onClick),document.addEventListener("touchmove",this._onTouchMove),document.addEventListener("touchend",this._onTouchEnd),document.addEventListener("mousedown",this._onMouseDown),document.addEventListener("mouseover",this._onMouseOver),this.isSelectOneElement&&(this.containerOuter.addEventListener("focus",this._onFocus),this.containerOuter.addEventListener("blur",this._onBlur)),this.input.addEventListener("input",this._onInput),this.input.addEventListener("paste",this._onPaste),this.input.addEventListener("focus",this._onFocus),this.input.addEventListener("blur",this._onBlur)}},{key:"_removeEventListeners",value:function(){document.removeEventListener("keyup",this._onKeyUp),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("click",this._onClick),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd),document.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mouseover",this._onMouseOver),this.isSelectOneElement&&(this.containerOuter.removeEventListener("focus",this._onFocus),this.containerOuter.removeEventListener("blur",this._onBlur)),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("paste",this._onPaste),this.input.removeEventListener("focus",this._onFocus),this.input.removeEventListener("blur",this._onBlur)}},{key:"_setInputWidth",value:function(){this.placeholder?this.input.value&&this.input.value.length>=this.placeholder.length/1.25&&(this.input.style.width=(0,v.getWidthOfInput)(this.input)):this.input.style.width=(0,v.getWidthOfInput)(this.input)}},{key:"_onKeyDown",value:function(e){var t,i=this;if(e.target===this.input||this.containerOuter.contains(e.target)){var n=e.target,o=this.store.getItemsFilteredByActive(),r=this.input===document.activeElement,a=this.dropdown.classList.contains(this.config.classNames.activeState),c=this.itemList&&this.itemList.children,l=String.fromCharCode(e.keyCode),h=46,u=8,d=13,f=65,p=27,m=38,g=40,y=33,b=34,E=e.ctrlKey||e.metaKey;this.isTextElement||!/[a-zA-Z0-9-_ ]/.test(l)||a||this.showDropdown(!0),this.canSearch=this.config.searchEnabled;var _=function(){E&&c&&(i.canSearch=!1,i.config.removeItems&&!i.input.value&&i.input===document.activeElement&&i.highlightAll())},S=function(){if(i.isTextElement&&n.value){var t=i.input.value,s=i._canAddItem(o,t);s.response&&(a&&i.hideDropdown(),i._addItem(t),i._triggerChange(t),i.clearInput())}if(n.hasAttribute("data-button")&&(i._handleButtonAction(o,n),e.preventDefault()),a){e.preventDefault();var r=i.dropdown.querySelector("."+i.config.classNames.highlightedState);r&&(o[0]&&(o[0].keyCode=d),i._handleChoiceAction(o,r))}else i.isSelectOneElement&&(a||(i.showDropdown(!0),e.preventDefault()))},I=function(){a&&(i.toggleDropdown(),i.containerOuter.focus())},w=function(){if(a||i.isSelectOneElement){a||i.showDropdown(!0),i.canSearch=!1;var t=e.keyCode===g||e.keyCode===b?1:-1,n=e.metaKey||e.keyCode===b||e.keyCode===y,s=void 0;if(n)s=t>0?Array.from(i.dropdown.querySelectorAll("[data-choice-selectable]")).pop():i.dropdown.querySelector("[data-choice-selectable]");else{var o=i.dropdown.querySelector("."+i.config.classNames.highlightedState);s=o?(0,v.getAdjacentEl)(o,"[data-choice-selectable]",t):i.dropdown.querySelector("[data-choice-selectable]")}s&&((0,v.isScrolledIntoView)(s,i.choiceList,t)||i._scrollToChoice(s,t),i._highlightChoice(s)),e.preventDefault()}},T=function(){!r||e.target.value||i.isSelectOneElement||(i._handleBackspace(o),e.preventDefault())},C=(t={},s(t,f,_),s(t,d,S),s(t,p,I),s(t,m,w),s(t,y,w),s(t,g,w),s(t,b,w),s(t,u,T),s(t,h,T),t);C[e.keyCode]&&C[e.keyCode]()}}},{key:"_onKeyUp",value:function(e){if(e.target===this.input){var t=this.input.value,i=this.store.getItemsFilteredByActive(),n=this._canAddItem(i,t);if(this.isTextElement){var s=this.dropdown.classList.contains(this.config.classNames.activeState);if(t){if(n.notice){var o=this._getTemplate("notice",n.notice);this.dropdown.innerHTML=o.outerHTML}n.response===!0?s||this.showDropdown():!n.notice&&s&&this.hideDropdown()}else s&&this.hideDropdown()}else{var r=46,a=8;e.keyCode!==r&&e.keyCode!==a||e.target.value?this.canSearch&&n.response&&this._handleSearch(this.input.value):!this.isTextElement&&this.isSearching&&(this.isSearching=!1,this.store.dispatch((0,p.activateChoices)(!0)))}this.canSearch=this.config.searchEnabled}}},{key:"_onInput",value:function(){this.isSelectOneElement||this._setInputWidth()}},{key:"_onTouchMove",value:function(){this.wasTap===!0&&(this.wasTap=!1)}},{key:"_onTouchEnd",value:function(e){var t=e.target||e.touches[0].target,i=this.dropdown.classList.contains(this.config.classNames.activeState);this.wasTap===!0&&this.containerOuter.contains(t)&&(t!==this.containerOuter&&t!==this.containerInner||this.isSelectOneElement||(this.isTextElement?document.activeElement!==this.input&&this.input.focus():i||this.showDropdown(!0)),e.stopPropagation()),this.wasTap=!0}},{key:"_onMouseDown",value:function(e){var t=e.target;if(t===this.choiceList&&this.isIe11&&(this.isScrollingOnIe=!0),this.containerOuter.contains(t)&&t!==this.input){var i=void 0,n=this.store.getItemsFilteredByActive(),s=e.shiftKey;(i=(0,v.findAncestorByAttrName)(t,"data-button"))?this._handleButtonAction(n,i):(i=(0,v.findAncestorByAttrName)(t,"data-item"))?this._handleItemAction(n,i,s):(i=(0,v.findAncestorByAttrName)(t,"data-choice"))&&this._handleChoiceAction(n,i),e.preventDefault()}}},{key:"_onClick",value:function(e){var t=e.target,i=this.dropdown.classList.contains(this.config.classNames.activeState),n=this.store.getItemsFilteredByActive();if(this.containerOuter.contains(t))t.hasAttribute("data-button")&&this._handleButtonAction(n,t),i?this.isSelectOneElement&&t!==this.input&&!this.dropdown.contains(t)&&this.hideDropdown(!0):this.isTextElement?document.activeElement!==this.input&&this.input.focus():this.canSearch?this.showDropdown(!0):(this.showDropdown(),this.containerOuter.focus());else{var s=n.some(function(e){return e.highlighted});s&&this.unhighlightAll(),this.containerOuter.classList.remove(this.config.classNames.focusState),i&&this.hideDropdown()}}},{key:"_onMouseOver",value:function(e){(e.target===this.dropdown||this.dropdown.contains(e.target))&&e.target.hasAttribute("data-choice")&&this._highlightChoice(e.target)}},{key:"_onPaste",value:function(e){e.target!==this.input||this.config.paste||e.preventDefault()}},{key:"_onFocus",value:function(e){var t=this,i=e.target;if(this.containerOuter.contains(i)){var n=this.dropdown.classList.contains(this.config.classNames.activeState),s={text:function(){i===t.input&&t.containerOuter.classList.add(t.config.classNames.focusState)},"select-one":function(){t.containerOuter.classList.add(t.config.classNames.focusState),i===t.input&&(n||t.showDropdown())},"select-multiple":function(){i===t.input&&(t.containerOuter.classList.add(t.config.classNames.focusState),n||t.showDropdown(!0))}};s[this.passedElement.type]()}}},{key:"_onBlur",value:function(e){var t=this,i=e.target;if(this.containerOuter.contains(i)&&!this.isScrollingOnIe){var n=this.store.getItemsFilteredByActive(),s=this.dropdown.classList.contains(this.config.classNames.activeState),o=n.some(function(e){return e.highlighted}),r={text:function(){i===t.input&&(t.containerOuter.classList.remove(t.config.classNames.focusState),o&&t.unhighlightAll(),s&&t.hideDropdown())},"select-one":function(){t.containerOuter.classList.remove(t.config.classNames.focusState),i===t.containerOuter&&s&&!t.canSearch&&t.hideDropdown(),i===t.input&&s&&t.hideDropdown()},"select-multiple":function(){i===t.input&&(t.containerOuter.classList.remove(t.config.classNames.focusState),s&&t.hideDropdown(),o&&t.unhighlightAll())}};r[this.passedElement.type]()}else this.isScrollingOnIe=!1,this.input.focus()}},{key:"_regexFilter",value:function(e){if(!e)return!1;var t=this.config.regexFilter,i=new RegExp(t.source,"i");return i.test(e)}},{key:"_scrollToChoice",value:function(e,t){var i=this;if(e){var n=this.choiceList.offsetHeight,s=e.offsetHeight,o=e.offsetTop+s,r=this.choiceList.scrollTop+n,a=t>0?this.choiceList.scrollTop+o-r:e.offsetTop,c=function e(){var n=4,s=i.choiceList.scrollTop,o=!1,r=void 0,c=void 0;t>0?(r=(a-s)/n,c=r>1?r:1,i.choiceList.scrollTop=s+c,s1?r:1,i.choiceList.scrollTop=s-c,s>a&&(o=!0)),o&&requestAnimationFrame(function(i){e(i,a,t)})};requestAnimationFrame(function(e){c(e,a,t)})}}},{key:"_highlightChoice",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=Array.from(this.dropdown.querySelectorAll("[data-choice-selectable]")),n=t;if(i&&i.length){var s=Array.from(this.dropdown.querySelectorAll("."+this.config.classNames.highlightedState));s.forEach(function(t){t.classList.remove(e.config.classNames.highlightedState),t.setAttribute("aria-selected","false")}),n?this.highlightPosition=i.indexOf(n):(n=i.length>this.highlightPosition?i[this.highlightPosition]:i[i.length-1],n||(n=i[0])),n.classList.add(this.config.classNames.highlightedState),n.setAttribute("aria-selected","true"),this.containerOuter.setAttribute("aria-activedescendant",n.id)}}},{key:"_addItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,a=(0,v.isType)("String",e)?e.trim():e,c=r,l=this.store.getItems(),h=t||a,u=parseInt(i,10)||-1,d=n>=0?this.store.getGroupById(n):null,f=l?l.length+1:1;return this.config.prependValue&&(a=this.config.prependValue+a.toString()),this.config.appendValue&&(a+=this.config.appendValue.toString()),
+this.store.dispatch((0,p.addItem)(a,h,f,u,n,s,o,c)),this.isSelectOneElement&&this.removeActiveItems(f),d&&d.value?(0,v.triggerEvent)(this.passedElement,"addItem",{id:f,value:a,label:h,groupValue:d.value,keyCode:c}):(0,v.triggerEvent)(this.passedElement,"addItem",{id:f,value:a,label:h,keyCode:c}),this}},{key:"_removeItem",value:function(e){if(!e||!(0,v.isType)("Object",e))return this;var t=e.id,i=e.value,n=e.label,s=e.choiceId,o=e.groupId,r=o>=0?this.store.getGroupById(o):null;return this.store.dispatch((0,p.removeItem)(t,s)),r&&r.value?(0,v.triggerEvent)(this.passedElement,"removeItem",{id:t,value:i,label:n,groupValue:r.value}):(0,v.triggerEvent)(this.passedElement,"removeItem",{id:t,value:i,label:n}),this}},{key:"_addChoice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;if("undefined"!=typeof e&&null!==e){var c=this.store.getChoices(),l=t||e,h=c?c.length+1:1,u=this.baseId+"-"+this.idNames.itemChoice+"-"+h;this.store.dispatch((0,p.addChoice)(e,l,h,s,n,u,o,r,a)),i&&this._addItem(e,l,h,void 0,o,r,a)}}},{key:"_clearChoices",value:function(){this.store.dispatch((0,p.clearChoices)())}},{key:"_addGroup",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"label",o=(0,v.isType)("Object",e)?e.choices:Array.from(e.getElementsByTagName("OPTION")),r=t?t:Math.floor((new Date).valueOf()*Math.random()),a=!!e.disabled&&e.disabled;o?(this.store.dispatch((0,p.addGroup)(e.label,r,!0,a)),o.forEach(function(e){var t=e.disabled||e.parentNode&&e.parentNode.disabled;i._addChoice(e[n],(0,v.isType)("Object",e)?e[s]:e.innerHTML,e.selected,t,r,e.customProperties,e.placeholder)})):this.store.dispatch((0,p.addGroup)(e.label,e.id,!1,e.disabled))}},{key:"_getTemplate",value:function(e){if(!e)return null;for(var t=this.config.templates,i=arguments.length,n=Array(i>1?i-1:0),s=1;s\n \n ')},containerInner:function(){return(0,v.strToEl)('\n
\n ')},itemList:function(){var i,n=(0,u.default)(t.list,(i={},s(i,t.listSingle,e.isSelectOneElement),s(i,t.listItems,!e.isSelectOneElement),i));return(0,v.strToEl)('\n
\n ')},placeholder:function(e){return(0,v.strToEl)('\n
\n '+e+"\n
\n ")},item:function(i){var n,o=(0,u.default)(t.item,(n={},s(n,t.highlightedState,i.highlighted),s(n,t.itemSelectable,!i.highlighted),s(n,t.placeholder,i.placeholder),n));if(e.config.removeItemButton){var r;return o=(0,u.default)(t.item,(r={},s(r,t.highlightedState,i.highlighted),s(r,t.itemSelectable,!i.disabled),s(r,t.placeholder,i.placeholder),r)),(0,v.strToEl)('\n
\n "+i.label+'\n Remove item\n \n
\n ")}return(0,v.strToEl)('\n
\n "+i.label+"\n
\n ")},choiceList:function(){return(0,v.strToEl)('\n
\n
\n ")},choiceGroup:function(e){var i=(0,u.default)(t.group,s({},t.itemDisabled,e.disabled));return(0,v.strToEl)('\n
\n ")},choice:function(i){var n,o=(0,u.default)(t.item,t.itemChoice,(n={},s(n,t.itemDisabled,i.disabled),s(n,t.itemSelectable,!i.disabled),s(n,t.placeholder,i.placeholder),n));return(0,v.strToEl)('\n
0?'role="treeitem"':'role="option"')+"\n >\n "+i.label+"\n
\n ")},input:function(){var e=(0,u.default)(t.input,t.inputCloned);return(0,v.strToEl)('\n
\n ')},dropdown:function(){var e=(0,u.default)(t.list,t.listDropdown);return(0,v.strToEl)('\n
\n
\n ')},notice:function(e){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=(0,u.default)(t.item,t.itemChoice,(i={},s(i,t.noResults,"no-results"===n),s(i,t.noChoices,"no-choices"===n),i));return(0,v.strToEl)('\n
\n '+e+"\n
\n ")},option:function(e){return(0,v.strToEl)('\n
'+e.label+" \n ")}},n=this.config.callbackOnCreateTemplates,o={};n&&(0,v.isType)("Function",n)&&(o=n.call(this,v.strToEl)),this.config.templates=(0,v.extend)(i,o)}},{key:"_setLoading",value:function(e){this.store.dispatch((0,p.setIsLoading)(e))}},{key:"_createInput",value:function(){var e=this,t=this.passedElement.getAttribute("dir")||"ltr",i=this._getTemplate("containerOuter",t),n=this._getTemplate("containerInner"),s=this._getTemplate("itemList"),o=this._getTemplate("choiceList"),r=this._getTemplate("input"),a=this._getTemplate("dropdown");this.containerOuter=i,this.containerInner=n,this.input=r,this.choiceList=o,this.itemList=s,this.dropdown=a,this.passedElement.classList.add(this.config.classNames.input,this.config.classNames.hiddenState),this.passedElement.tabIndex="-1";var c=this.passedElement.getAttribute("style");if(Boolean(c)&&this.passedElement.setAttribute("data-choice-orig-style",c),this.passedElement.setAttribute("style","display:none;"),this.passedElement.setAttribute("aria-hidden","true"),this.passedElement.setAttribute("data-choice","active"),(0,v.wrap)(this.passedElement,n),(0,v.wrap)(n,i),this.isSelectOneElement?r.placeholder=this.config.searchPlaceholderValue||"":this.placeholder&&(r.placeholder=this.placeholder,r.style.width=(0,v.getWidthOfInput)(r)),this.config.addItems||this.disable(),i.appendChild(n),i.appendChild(a),n.appendChild(s),this.isTextElement||a.appendChild(o),this.isSelectMultipleElement||this.isTextElement?n.appendChild(r):this.canSearch&&a.insertBefore(r,a.firstChild),this.isSelectElement){var l=Array.from(this.passedElement.getElementsByTagName("OPTGROUP"));if(this.highlightPosition=0,this.isSearching=!1,this._setLoading(!0),l&&l.length)l.forEach(function(t){e._addGroup(t,t.id||null)});else{var h=Array.from(this.passedElement.options),u=this.config.sortFilter,d=this.presetChoices;h.forEach(function(e){d.push({value:e.value,label:e.innerHTML,selected:e.selected,disabled:e.disabled||e.parentNode.disabled,placeholder:e.hasAttribute("placeholder")})}),this.config.shouldSort&&d.sort(u);var f=d.some(function(e){return e.selected});d.forEach(function(t,i){if(e.isSelectOneElement){var n=f||!f&&i>0;e._addChoice(t.value,t.label,!n||t.selected,!!n&&t.disabled,void 0,t.customProperties,t.placeholder)}else e._addChoice(t.value,t.label,t.selected,t.disabled,void 0,t.customProperties,t.placeholder)})}this._setLoading(!1)}else this.isTextElement&&this.presetItems.forEach(function(t){var i=(0,v.getType)(t);if("Object"===i){if(!t.value)return;e._addItem(t.value,t.label,t.id,void 0,t.customProperties,t.placeholder)}else"String"===i&&e._addItem(t)})}}]),e}();e.exports=m},function(e,t,i){!function(t){"use strict";function i(){console.log.apply(console,arguments)}function n(e,t){var i;this.list=e,this.options=t=t||{};for(i in a)a.hasOwnProperty(i)&&("boolean"==typeof a[i]?this.options[i]=i in t?t[i]:a[i]:this.options[i]=t[i]||a[i])}function s(e,t,i){var n,r,a,c,l,h;if(t){if(a=t.indexOf("."),a!==-1?(n=t.slice(0,a),r=t.slice(a+1)):n=t,c=e[n],null!==c&&void 0!==c)if(r||"string"!=typeof c&&"number"!=typeof c)if(o(c))for(l=0,h=c.length;l
1)throw new Error("Key weight has to be > 0 and <= 1");e=e.name}else this._keyMap[e]={weight:1};this._analyze(e,o(h,e,[]),h,i)}},n.prototype._analyze=function(e,t,n,s){var r,a,c,l,h,u,d,f,p,v,m,g,y,b,E,_=this.options,S=!1;if(void 0!==t&&null!==t){a=[];var I=0;if("string"==typeof t){if(r=t.split(_.tokenSeparator),_.verbose&&i("---------\nKey:",e),this.options.tokenize){for(b=0;b=this.tokenSearchers.length,_.verbose&&i("Check Matches",y),(S||d.isMatch)&&y&&(c=this.resultMap[s],c?c.output.push({key:e,score:h,matchedIndices:d.matchedIndices}):(this.resultMap[s]={item:n,output:[{key:e,score:h,matchedIndices:d.matchedIndices}]},this.results.push(this.resultMap[s])))}else if(o(t))for(b=0;b0){if(t={item:r.item},l.indexOf("matches")!==-1)for(n=r.output,t.matches=[],i=0;iw.maxPatternLength){if(y=e.match(new RegExp(this.pattern.replace(w.tokenSeparator,"|"))),b=!!y)for(_=[],t=0,S=y.length;t=u;i--)if(v=this.patternAlphabet[e.charAt(i-1)],v&&(E[i-1]=1),f[i]=(f[i+1]<<1|1)&v,0!==t&&(f[i]|=(p[i+1]|p[i])<<1|1|p[i+1]),f[i]&this.matchmask&&(m=this._bitapScore(t,i-1),m<=r)){if(r=m,a=i-1,g.push(a),a<=o)break;u=Math.max(1,2*o-a)}if(this._bitapScore(t+1,o)>r)break;p=f}return _=this._getMatchedIndices(E),{isMatch:a>=0,score:0===m?.001:m,matchedIndices:_}},r.prototype._getMatchedIndices=function(e){for(var t,i=[],n=-1,s=-1,o=0,r=e.length;o=this.options.minMatchCharLength&&i.push([n,s]),n=-1);return e[o-1]&&o-1-n+1>=this.options.minMatchCharLength&&i.push([n,o-1]),i},e.exports=n}(this)},function(e,t,i){var n,s;!function(){"use strict";function i(){for(var e=[],t=0;t0&&void 0!==arguments[0]?arguments[0]:this.getItems(),t=e.reduce(function(e,t){return e.push(t.value),e},[]);return t}},{key:"getChoices",value:function(){var e=this.store.getState();return e.choices}},{key:"getChoicesFilteredByActive",value:function(){var e=this.getChoices(),t=e.filter(function(e){return e.active===!0});return t}},{key:"getChoicesFilteredBySelectable",value:function(){var e=this.getChoices(),t=e.filter(function(e){return e.disabled!==!0});return t}},{key:"getSearchableChoices",value:function(){var e=this.getChoicesFilteredBySelectable();return e.filter(function(e){return e.placeholder!==!0})}},{key:"getChoiceById",value:function(e){if(e){var t=this.getChoicesFilteredByActive(),i=t.find(function(t){return t.id===parseInt(e,10)});return i}return!1}},{key:"getGroups",value:function(){var e=this.store.getState();return e.groups}},{key:"getGroupsFilteredByActive",value:function(){var e=this.getGroups(),t=this.getChoices(),i=e.filter(function(e){var i=e.active===!0&&e.disabled===!1,n=t.some(function(e){return e.active===!0&&e.disabled===!1});return i&&n},[]);return i}},{key:"getGroupById",value:function(e){var t=this.getGroups(),i=t.find(function(t){return t.id===e});return i}},{key:"getPlaceholderChoice",value:function(){var e=this.getChoices(),t=[].concat(s(e)).reverse().find(function(e){return e.placeholder===!0});return t}}]),e}();t.default=h,e.exports=h},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.compose=t.applyMiddleware=t.bindActionCreators=t.combineReducers=t.createStore=void 0;var s=i(6),o=n(s),r=i(21),a=n(r),c=i(23),l=n(c),h=i(24),u=n(h),d=i(25),f=n(d),p=i(22);n(p);t.createStore=o.default,t.combineReducers=a.default,t.bindActionCreators=l.default,t.applyMiddleware=u.default,t.compose=f.default},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function s(e,t,i){function n(){g===m&&(g=m.slice())}function o(){return v}function a(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return n(),g.push(e),function(){if(t){t=!1,n();var i=g.indexOf(e);g.splice(i,1)}}}function h(e){if(!(0,r.default)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(y)throw new Error("Reducers may not dispatch actions.");try{y=!0,v=p(v,e)}finally{y=!1}for(var t=m=g,i=0;i0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(c)throw c;for(var n=!1,o={},r=0;r0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"ADD_ITEM":var n=[].concat(i(e),[{id:t.id,choiceId:t.choiceId,groupId:t.groupId,value:t.value,label:t.label,active:!0,highlighted:!1,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);return n.map(function(e){return e.highlighted&&(e.highlighted=!1),e});case"REMOVE_ITEM":return e.map(function(e){return e.id===t.id&&(e.active=!1),e});case"HIGHLIGHT_ITEM":return e.map(function(e){return e.id===t.id&&(e.highlighted=t.highlighted),e});default:return e}};t.default=n},function(e,t){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"ADD_GROUP":return[].concat(i(e),[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);case"CLEAR_CHOICES":return e.groups=[];default:return e}};t.default=n},function(e,t){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"ADD_CHOICE":return[].concat(i(e),[{id:t.id,elementId:t.elementId,groupId:t.groupId,value:t.value,label:t.label||t.value,disabled:t.disabled||!1,selected:!1,active:!0,score:9999,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);case"ADD_ITEM":var n=e;return t.activateOptions&&(n=e.map(function(e){return e.active=t.active,e})),t.choiceId>-1&&(n=e.map(function(e){return e.id===parseInt(t.choiceId,10)&&(e.selected=!0),e})),n;case"REMOVE_ITEM":return t.choiceId>-1?e.map(function(e){return e.id===parseInt(t.choiceId,10)&&(e.selected=!1),e}):e;case"FILTER_CHOICES":var s=t.results,o=e.map(function(e){return e.active=s.some(function(t){return t.item.id===e.id&&(e.score=t.score,!0)}),e});return o;case"ACTIVATE_CHOICES":return e.map(function(e){return e.active=t.active,e});case"CLEAR_CHOICES":return e.choices=[];default:return e}};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{loading:!1},t=arguments[1];switch(t.type){case"LOADING":return{loading:t.isLoading};default:return e}};t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.addItem=function(e,t,i,n,s,o,r,a){return{type:"ADD_ITEM",value:e,label:t,id:i,choiceId:n,groupId:s,customProperties:o,placeholder:r,keyCode:a}},t.removeItem=function(e,t){return{type:"REMOVE_ITEM",id:e,choiceId:t}},t.highlightItem=function(e,t){return{type:"HIGHLIGHT_ITEM",id:e,highlighted:t}},t.addChoice=function(e,t,i,n,s,o,r,a,c){return{type:"ADD_CHOICE",value:e,label:t,id:i,groupId:n,disabled:s,elementId:o,customProperties:r,placeholder:a,keyCode:c}},t.filterChoices=function(e){return{type:"FILTER_CHOICES",results:e}},t.activateChoices=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return{type:"ACTIVATE_CHOICES",active:e}},t.clearChoices=function(){return{type:"CLEAR_CHOICES"}},t.addGroup=function(e,t,i,n){return{type:"ADD_GROUP",value:e,id:t,active:i,disabled:n}},t.clearAll=function(){return{type:"CLEAR_ALL"}},t.setIsLoading=function(e){return{type:"LOADING",isLoading:e}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=(t.capitalise=function(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},t.generateChars=function(e){for(var t="",i=0;i=0?t:0},t.getElementOffset=function(e,t){var i=t;return i>1&&(i=1),i>0&&(i=0),Math.max(e.offsetHeight*i)},t.getAdjacentEl=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e&&t){var n=e.parentNode.parentNode,s=Array.from(n.querySelectorAll(t)),o=s.indexOf(e),r=i>0?1:-1;return s[o+r]}},t.getScrollPosition=function(e){return"bottom"===e?Math.max((window.scrollY||window.pageYOffset)+(window.innerHeight||document.documentElement.clientHeight)):window.scrollY||window.pageYOffset},t.isInView=function(e,t,i){return this.getScrollPosition(t)>this.getElemDistance(e)+this.getElementOffset(e,i)},t.isScrolledIntoView=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e){var n=void 0;return n=i>0?t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight:e.offsetTop>=t.scrollTop}},t.stripHTML=function(e){return e.replace(/&/g,"&").replace(/>/g,"&rt;").replace(/"+a(t)+"");if(n.style.position="absolute",n.style.padding="0",n.style.top="-9999px",n.style.left="-9999px",n.style.width="auto",n.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var s=window.getComputedStyle(e);s&&(n.style.fontSize=s.fontSize,n.style.fontFamily=s.fontFamily,n.style.fontWeight=s.fontWeight,n.style.fontStyle=s.fontStyle,n.style.letterSpacing=s.letterSpacing,n.style.textTransform=s.textTransform,n.style.padding=s.padding)}document.body.appendChild(n),t&&n.offsetWidth!==e.offsetWidth&&(i=n.offsetWidth+4),document.body.removeChild(n)}return i+"px"},t.sortByAlpha=function(e,t){var i=(e.label||e.value).toLowerCase(),n=(t.label||t.value).toLowerCase();return in?1:0},t.sortByScore=function(e,t){return e.score-t.score},t.triggerEvent=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});return e.dispatchEvent(n)}},function(e,t){"use strict";!function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i}Array.from||(Array.from=function(){var e=Object.prototype.toString,t=function(t){return"function"==typeof t||"[object Function]"===e.call(t)},i=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t},n=Math.pow(2,53)-1,s=function(e){var t=i(e);return Math.min(Math.max(t,0),n)};return function(e){var i=this,n=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var o,r=arguments.length>1?arguments[1]:void 0;if("undefined"!=typeof r){if(!t(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(o=arguments[2])}for(var a,c=s(n.length),l=t(i)?Object(new i(c)):new Array(c),h=0;h>>0,s=arguments[1],o=0;o tbody',
+ containerSelector: 'table',
+ placeholder: ' ',
+ afterMove: function ($placeholder) {
+
+ $placeholder.closest('table').find('button.reorder').removeClass('disabled');
+
+ $placeholder.closest('table').find('.dragged').detach().insertBefore($placeholder);
+
+ selected = [];
+
+ $(wrapper.find('table').find('[data-dismiss="multiple"]')).each(function () {
+ selected.push(String($(this).data('entry')));
+ });
+
+ $('[name="' + field + '"]').val(selected.join(','));
+ }
+ });
+ }
+
+ // Sort initially
+ wrapper.sort();
+ });
+});
diff --git a/addons/default/visiosoft/multiple-field_type/resources/js/tags.js b/addons/default/visiosoft/multiple-field_type/resources/js/tags.js
new file mode 100644
index 000000000..527498a4a
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/js/tags.js
@@ -0,0 +1,13 @@
+(function (window, document) {
+
+ let fields = Array.prototype.slice.call(
+ document.querySelectorAll('select[data-provides="visiosoft.field_type.multiple"]')
+ );
+
+ fields.forEach(function (field) {
+ new Choices(field, {
+ removeItemButton: true,
+ searchResultLimit: 10,
+ });
+ });
+})(window, document);
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/ar/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/addon.php
new file mode 100644
index 000000000..54ae3ab70
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/addon.php
@@ -0,0 +1,7 @@
+ 'متعدد',
+ 'name' => 'نوع الحقل المتعدد',
+ 'description' => 'نوع الحقل النتعدد العلاقات.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/ar/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/config.php
new file mode 100644
index 000000000..b691b27ab
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/config.php
@@ -0,0 +1,29 @@
+ [
+ 'label' => 'الدفق المرتبط',
+ 'instructions' => 'حدد إدخالات الدفق ذات الصلة لعرضها ضمن القائمة المنسدلة.',
+ ],
+ 'mode' => [
+ 'label' => 'وضخ الإدخال',
+ 'option' => [
+ 'tags' => 'الأوسمة',
+ 'lookup' => 'ابحث عن',
+ 'checkboxes' => 'مربعات الاختيار',
+ ],
+ ],
+ 'min' => [
+ 'label' => 'الحد الأدنى للاختيارات',
+ 'instructions' => 'حدد الحد الأدني للاختيارات المسموحة.',
+ ],
+ 'max' => [
+ 'label' => 'الحد الأعلى للاختيارات',
+ 'instructions' => 'حدد عدد الحد الأعلى اللاختيارات المسموحة.',
+ ],
+ 'title_name' => [
+ 'label' => 'حقل العنوان',
+ 'placeholder' => 'الاسم الأول',
+ 'instructions' => 'حدد slug لعرضه لخيارات القائمة المنسدلة / البحث. يمكنك تحديد عناوين قابلة للتحليل مثل {entry.first_name} {entry.last_name} سيتم استخدام عمود عنوان التدفق ذي الصلة افتراضيًا.',
+ ],
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/ar/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/input.php
new file mode 100644
index 000000000..d8e14ecb9
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/input.php
@@ -0,0 +1,6 @@
+ 'اختر خيار...',
+ 'help' => 'اختر القيم بحيث يكون بينها فاصلة , ثم اضغط "ادخال".',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/ar/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/message.php
new file mode 100644
index 000000000..321b9adbe
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/ar/message.php
@@ -0,0 +1,5 @@
+ 'حدد الإدخالات التي تريد اضافتها.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/de/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/de/addon.php
new file mode 100644
index 000000000..6918c0a47
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/de/addon.php
@@ -0,0 +1,7 @@
+ 'Mehrfachbeziehungen',
+ 'name' => 'Mehrfachbeziehungen Feldtyp',
+ 'description' => 'Ein Feldtyp für Mehrfachbeziehungen.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/de/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/de/config.php
new file mode 100644
index 000000000..f43d0f644
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/de/config.php
@@ -0,0 +1,29 @@
+ [
+ 'label' => 'Verbundener Stream',
+ 'instructions' => 'Geben Sie den verbunden Stream an, dessen Einträge im Dropdown zur Auswahl stehen sollen.',
+ ],
+ 'mode' => [
+ 'label' => 'Eingabemodus',
+ 'option' => [
+ 'tags' => 'Stichworte',
+ 'lookup' => 'Nachschlagen',
+ 'checkboxes' => 'Kontrollkästchen',
+ ],
+ ],
+ 'min' => [
+ 'label' => 'Minimalauswahl',
+ 'instructions' => 'Geben Sie die minimale Anzahl an auszuwählenden Einträgen ein.',
+ ],
+ 'max' => [
+ 'label' => 'Maximalauswahl',
+ 'instructions' => 'Geben Sie die maximal erlaubte Anzahl an ausgewählten Einträgen an.',
+ ],
+ 'title_name' => [
+ 'label' => 'Titelfeld',
+ 'placeholder' => 'Vorname',
+ 'instructions' => 'Geben Sie den Slug des Felds an, das für Dropdown- / Suchoptionen angezeigt werden soll. Sie können analysierbare Titel wie {entry.first_name} {entry.last_name} angeben. Die Titelspalte des zugehörigen Streams wird standardmäßig verwendet.',
+ ],
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/de/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/de/input.php
new file mode 100644
index 000000000..08227fc10
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/de/input.php
@@ -0,0 +1,6 @@
+ 'Wählen Sie eine Option...',
+ 'help' => 'Trennen Sie Ihre Eingaben mit einem Komma oder durch drücken der Taste Enter.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/de/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/de/message.php
new file mode 100644
index 000000000..e16d9bb4b
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/de/message.php
@@ -0,0 +1,5 @@
+ 'Wählen Sie die Einträge aus, die Sie hinzufügen möchten.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/en/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/en/addon.php
new file mode 100644
index 000000000..b58237ed9
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/en/addon.php
@@ -0,0 +1,7 @@
+ 'Multiple',
+ 'name' => 'Multiple Field Type',
+ 'description' => 'A multiple relationship field type.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/en/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/en/config.php
new file mode 100644
index 000000000..ab3401aa7
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/en/config.php
@@ -0,0 +1,29 @@
+ [
+ 'label' => 'Related Stream',
+ 'instructions' => 'Specify the related stream entries to display in the dropdown.',
+ ],
+ 'mode' => [
+ 'label' => 'Input Mode',
+ 'option' => [
+ 'tags' => 'Tags',
+ 'lookup' => 'Lookup',
+ 'checkboxes' => 'Checkboxes',
+ ],
+ ],
+ 'min' => [
+ 'label' => 'Minimum Selections',
+ 'instructions' => 'Specify the minimum number of allowed selections.',
+ ],
+ 'max' => [
+ 'label' => 'Maximum Selections',
+ 'instructions' => 'Specify the maximum number of allowed selections.',
+ ],
+ 'title_name' => [
+ 'label' => 'Title Field',
+ 'placeholder' => 'first_name',
+ 'instructions' => 'Specify the slug of field to display for dropdown/search options. You can specify parsable titles like {entry.first_name} {entry.last_name} The related stream\'s title column will be used by default.',
+ ],
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/en/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/en/input.php
new file mode 100644
index 000000000..eb1c1d223
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/en/input.php
@@ -0,0 +1,6 @@
+ 'Choose an option...',
+ 'help' => 'Separate values with a comma or by pressing "Enter".',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/en/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/en/message.php
new file mode 100644
index 000000000..212311d7a
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/en/message.php
@@ -0,0 +1,5 @@
+ 'Select the entries you would like to add.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/fr/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/addon.php
new file mode 100644
index 000000000..b957ab83c
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/addon.php
@@ -0,0 +1,7 @@
+ 'Plusieurs',
+ 'name' => 'Multiple',
+ 'description' => 'Type de champs pour les relations multiples.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/fr/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/config.php
new file mode 100644
index 000000000..19ebe2f16
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/config.php
@@ -0,0 +1,29 @@
+ [
+ 'label' => 'Stream en relation',
+ 'instructions' => 'Choisissez les entrées à afficher dans la sélection.',
+ ],
+ 'mode' => [
+ 'label' => 'Mode d\'entrée',
+ 'option' => [
+ 'tags' => 'Mots clés',
+ 'lookup' => 'Chercher',
+ 'checkboxes' => 'Cases à cocher',
+ ],
+ ],
+ 'min' => [
+ 'label' => 'Nombre de sélection minimum',
+ 'instructions' => 'Entrez un nombre minimum de sélection.',
+ ],
+ 'max' => [
+ 'label' => 'Nombre de sélection maximum',
+ 'instructions' => 'Entrez un nombre maximum de sélection.',
+ ],
+ 'title_name' => [
+ 'label' => 'Champ de titre',
+ 'placeholder' => 'Prénom',
+ 'instructions' => 'Spécifiez le slug du champ à afficher pour les options de liste déroulante / de recherche. Vous pouvez spécifier des titres analysables tels que {entry.first_name} {entry.last_name} La colonne de titre du flux associé sera utilisée par défaut.',
+ ],
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/fr/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/input.php
new file mode 100644
index 000000000..11673965e
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/input.php
@@ -0,0 +1,6 @@
+ 'Choisissez une option...',
+ 'help' => 'Séparez les valeurs par une virgule ou en tapant "Entrée".',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/fr/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/message.php
new file mode 100644
index 000000000..98d1f8141
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/fr/message.php
@@ -0,0 +1,5 @@
+ 'Sélectionnez les entrées que vous souhaitez ajouter.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/hu/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/addon.php
new file mode 100644
index 000000000..815f0dd73
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/addon.php
@@ -0,0 +1,7 @@
+ 'Többszörös',
+ 'name' => 'Többszörös Mező Típus',
+ 'description' => 'Többszörös kapcsolat mező típus.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/hu/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/config.php
new file mode 100644
index 000000000..1e58e3274
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/config.php
@@ -0,0 +1,29 @@
+ [
+ 'label' => 'Releváns Folyam',
+ 'instructions' => 'Határozd meg a releváns folyamat a legördülő megjelenítéséhez.',
+ ],
+ 'mode' => [
+ 'label' => 'Bevitel Módja',
+ 'option' => [
+ 'tags' => 'Cimkék',
+ 'lookup' => 'Átvizsgálás',
+ 'checkboxes' => 'Jelölőnégyzetek',
+ ],
+ ],
+ 'min' => [
+ 'label' => 'Minimális Kiválasztás',
+ 'instructions' => 'Határozd meg a minimálisan kiválasztható elemek számát.',
+ ],
+ 'max' => [
+ 'label' => 'Maximális Kiválasztás',
+ 'instructions' => 'Határozd meg a maximálisan kiválasztható elemek számát.',
+ ],
+ 'title_name' => [
+ 'label' => 'Cím mező',
+ 'placeholder' => 'keresztnév',
+ 'instructions' => 'Adja meg a mezõjét a megjelenítendõ legördülõ / keresési opciókhoz. Megadhat értelmezhető címeket, például {entry.first_name} {entry.last_name} Alapértelmezés szerint a kapcsolódó adatfolyam oszlopát fogja használni.',
+ ],
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/hu/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/input.php
new file mode 100644
index 000000000..a1a8b2e0d
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/input.php
@@ -0,0 +1,6 @@
+ 'Válassz elemet...',
+ 'help' => 'Az értékeket szóközzel, vagy enterrel válaszd el.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/hu/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/message.php
new file mode 100644
index 000000000..67f1f9d09
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/hu/message.php
@@ -0,0 +1,5 @@
+ 'Válaszd ki a bejegyzéseket amiket hozzá szeretnél adni.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/tr/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/addon.php
new file mode 100644
index 000000000..da60b0edb
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/addon.php
@@ -0,0 +1,7 @@
+ 'Çoklu',
+ 'name' => 'Çoklu Alan Tipi',
+ 'description' => 'Bir çoklu ilişki alan tipi',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/tr/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/config.php
new file mode 100644
index 000000000..ad555c66d
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/config.php
@@ -0,0 +1,29 @@
+ [
+ 'label' => 'İlişkili Stream',
+ 'instructions' => 'Açılırlistede gösterilecek ilişkili stream girişlerini belirtin.',
+ ],
+ 'mode' => [
+ 'label' => 'Giriş Modu',
+ 'option' => [
+ 'tags' => 'Etiketler',
+ 'lookup' => 'Bakış',
+ 'checkboxes' => 'Onay Kutuları',
+ ],
+ ],
+ 'min' => [
+ 'label' => 'Minimum seçim sayısı',
+ 'instructions' => 'İzin verilen minimum seçim sayısını belirtin.',
+ ],
+ 'max' => [
+ 'label' => 'Maksimum seçim sayısı',
+ 'instructions' => 'İzin verilen maksimum seçim sayısını belirtin.',
+ ],
+ 'title_name' => [
+ 'label' => 'Başlık Alanı',
+ 'placeholder' => 'İsim',
+ 'instructions' => 'Açılır menü / arama seçeneklerini görüntülemek için alanın slug değerini belirtin. {entry.first_name} {entry.last_name} gibi sütun isimleri belirtebilirsiniz.',
+ ],
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/tr/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/input.php
new file mode 100644
index 000000000..4b9639bdb
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/input.php
@@ -0,0 +1,6 @@
+ 'Bir seçim yapın...',
+ 'help' => 'Girişleri, arasına virgül koyarak veya "Enter" tuşuna basarak ayırabilirsiniz.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/tr/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/message.php
new file mode 100644
index 000000000..4893f6a93
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/tr/message.php
@@ -0,0 +1,5 @@
+ 'Eklemek istediğiniz girişleri seçin.',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/addon.php
new file mode 100644
index 000000000..1dbf45af0
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/addon.php
@@ -0,0 +1,7 @@
+ '多个',
+ 'name' => '多个字段类型',
+ 'description' => '一个多个关系字段类型。',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/config.php
new file mode 100644
index 000000000..f3dcb44d4
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/config.php
@@ -0,0 +1,23 @@
+ [
+ 'label' => '关系表',
+ 'instructions' => '指定在下拉框中数据所属的关系表。',
+ ],
+ 'mode' => [
+ 'label' => '输入类型',
+ 'option' => [
+ 'tags' => '标签',
+ 'lookup' => '查找',
+ ],
+ ],
+ 'min' => [
+ 'label' => '最少选项数',
+ 'instructions' => '指定允许最小的选项数量。',
+ ],
+ 'max' => [
+ 'label' => '最多选项数',
+ 'instructions' => '指定允许最多的选项数量。',
+ ],
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/input.php
new file mode 100644
index 000000000..fdfa5db68
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/input.php
@@ -0,0 +1,6 @@
+ '请选择一个选项',
+ 'help' => '请使用逗号或者回车键来分开不同选项。',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/message.php
new file mode 100644
index 000000000..431e79ab7
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-cn/message.php
@@ -0,0 +1,5 @@
+ '选择你想添加的具体实例。',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/addon.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/addon.php
new file mode 100644
index 000000000..689eefe6d
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/addon.php
@@ -0,0 +1,7 @@
+ '多重',
+ 'name' => '多重欄位型別',
+ 'description' => '一個具有多重關係的欄位型別。',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/config.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/config.php
new file mode 100644
index 000000000..eecff34cc
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/config.php
@@ -0,0 +1,23 @@
+ [
+ 'label' => '關連的資料流',
+ 'instructions' => '指定在下拉選單中資料所屬的資料流。',
+ ],
+ 'mode' => [
+ 'label' => '輸入模式',
+ 'option' => [
+ 'tags' => '標籤',
+ 'lookup' => '查找',
+ ],
+ ],
+ 'min' => [
+ 'label' => '最小選項數量',
+ 'instructions' => '指定允許的最小選項數量。',
+ ],
+ 'max' => [
+ 'label' => '最大選項數量',
+ 'instructions' => '指定允許的最大選項數量。',
+ ],
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/input.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/input.php
new file mode 100644
index 000000000..242ab513a
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/input.php
@@ -0,0 +1,6 @@
+ '請選擇一個項目...',
+ 'help' => '請使用英文逗號或換行來區別不同的項目。',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/message.php b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/message.php
new file mode 100644
index 000000000..747dd5ca1
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/lang/zh-tw/message.php
@@ -0,0 +1,5 @@
+ '選擇您想新增的項目。',
+];
diff --git a/addons/default/visiosoft/multiple-field_type/resources/scss/choices.scss b/addons/default/visiosoft/multiple-field_type/resources/scss/choices.scss
new file mode 100644
index 000000000..85861b571
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/scss/choices.scss
@@ -0,0 +1,340 @@
+/*===============================
+= Choices =
+===============================*/
+
+$choices-selector: 'choices' !default;
+$choices-font-size-lg: 16px !default;
+$choices-font-size-md: 14px !default;
+$choices-font-size-sm: 12px !default;
+$choices-guttering: 0.5rem !default;
+$choices-border-radius: .1rem !default;
+$choices-border-radius-item: .1rem !default;
+$choices-bg-color: #ffffff !default;
+$choices-bg-color-disabled: #eceeef !default;
+$choices-bg-color-dropdown: #FFFFFF !default;
+$choices-text-color: #55595c !default;
+$choices-keyline-color: #DDDDDD !default;
+$choices-primary-color: #11bef6 !default;
+$choices-disabled-color: #eaeaea !default;
+$choices-highlight-color: $choices-primary-color !default;
+$choices-button-icon-path: '../../icons' !default;
+$choices-button-dimension: 8px !default;
+$choices-button-offset: 8px !default;
+
+.#{$choices-selector} {
+ position: relative;
+ margin-bottom: $choices-guttering;
+ font-size: $choices-font-size-lg;
+ &:focus {
+ outline: none;
+ }
+ &:last-child {
+ margin-bottom: 0;
+ }
+ &.is-disabled {
+ .#{$choices-selector}__inner, .#{$choices-selector}__input {
+ background-color: $choices-bg-color-disabled;
+ cursor: not-allowed;
+ user-select: none;
+ }
+ .#{$choices-selector}__item {
+ cursor: not-allowed;
+ }
+ }
+}
+
+.#{$choices-selector}[data-type*="select-one"] {
+ cursor: pointer;
+ .#{$choices-selector}__inner {
+ padding-bottom: 7.5px;
+ }
+ .#{$choices-selector}__input {
+ display: block;
+ width: 100%;
+ padding: 10px;
+ border-bottom: 1px solid $choices-keyline-color;
+ background-color: #FFFFFF;
+ margin: 0;
+ }
+ .#{$choices-selector}__button {
+ background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);
+ padding: 0;
+ background-size: 8px;
+ height: 100%;
+ position: absolute;
+ top: 50%;
+ right: 0;
+ margin-top: -10px;
+ margin-right: 25px;
+ height: 20px;
+ width: 20px;
+ border-radius: 10em;
+ opacity: .5;
+ &:hover, &:focus {
+ opacity: 1;
+ }
+ &:focus {
+ box-shadow: 0px 0px 0px 2px $choices-highlight-color;
+ }
+ }
+ &:after {
+ content: "";
+ height: 0;
+ width: 0;
+ border-style: solid;
+ border-color: $choices-text-color transparent transparent transparent;
+ border-width: 5px;
+ position: absolute;
+ right: 11.5px;
+ top: 50%;
+ margin-top: -2.5px;
+ pointer-events: none;
+ }
+ &.is-open:after {
+ border-color: transparent transparent $choices-text-color transparent;
+ margin-top: -7.5px;
+ }
+ &[dir="rtl"] {
+ &:after {
+ left: 11.5px;
+ right: auto;
+ }
+ .#{$choices-selector}__button {
+ right: auto;
+ left: 0;
+ margin-left: 25px;
+ margin-right: 0;
+ }
+ }
+}
+
+.#{$choices-selector}[data-type*="select-multiple"], .#{$choices-selector}[data-type*="text"] {
+ .#{$choices-selector}__inner {
+ cursor: text;
+ }
+ .#{$choices-selector}__button {
+ position: relative;
+ display: inline-block;
+ margin-top: 0;
+ margin-right: -$choices-button-offset/2;
+ margin-bottom: 0;
+ margin-left: $choices-button-offset;
+ padding-left: $choices-button-offset*2;
+ border-left: 1px solid darken($choices-primary-color, 10%);
+ background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);
+ background-size: $choices-button-dimension;
+ width: $choices-button-dimension;
+ line-height: 1;
+ opacity: .75;
+ &:hover, &:focus {
+ opacity: 1;
+ }
+ }
+}
+
+.#{$choices-selector}__inner {
+ display: inline-block;
+ vertical-align: top;
+ width: 100%;
+ background-color: $choices-bg-color;
+ padding: 7.5px 7.5px 3.75px;
+ border: 1px solid $choices-keyline-color;
+ border-radius: $choices-border-radius;
+ font-size: $choices-font-size-md;
+ min-height: 44px;
+ overflow: hidden;
+ .is-focused &, .is-open & {
+ border-color: darken($choices-keyline-color, 15%);
+ }
+ .is-open & {
+ border-radius: $choices-border-radius $choices-border-radius 0 0;
+ }
+ .is-flipped.is-open & {
+ border-radius: 0 0 $choices-border-radius $choices-border-radius;
+ }
+}
+
+.#{$choices-selector}__list {
+ margin: 0;
+ padding-left: 0;
+ list-style: none;
+}
+
+.#{$choices-selector}__list--single {
+ display: inline-block;
+ padding: 4px 16px 4px 4px;
+ width: 100%;
+ [dir="rtl"] & {
+ padding-right: 4px;
+ padding-left: 16px;
+ }
+ .#{$choices-selector}__item {
+ width: 100%;
+ }
+}
+
+.#{$choices-selector}__list--multiple {
+ display: inline;
+ .#{$choices-selector}__item {
+ display: inline-block;
+ vertical-align: middle;
+ border-radius: $choices-border-radius-item;
+ padding: 4px 10px;
+ font-size: $choices-font-size-sm;
+ font-weight: 500;
+ margin-right: 3.75px;
+ margin-bottom: 3.75px;
+ background-color: $choices-primary-color;
+ border: 1px solid darken($choices-primary-color, 5%);
+ color: #FFFFFF;
+ word-break: break-all;
+ &[data-deletable] {
+ padding-right: 5px;
+ }
+ [dir="rtl"] & {
+ margin-right: 0;
+ margin-left: 3.75px;
+ }
+ &.is-highlighted {
+ background-color: darken($choices-primary-color, 5%);
+ border: 1px solid darken($choices-primary-color, 10%);
+ }
+ .is-disabled & {
+ background-color: darken($choices-disabled-color, 25%);
+ border: 1px solid darken($choices-disabled-color, 35%);
+ }
+ }
+}
+
+.#{$choices-selector}__list--dropdown {
+ display: none;
+ z-index: 1;
+ position: absolute;
+ width: 100%;
+ background-color: $choices-bg-color-dropdown;
+ border: 1px solid $choices-keyline-color;
+ top: 100%;
+ margin-top: -1px;
+ border-bottom-left-radius: $choices-border-radius;
+ border-bottom-right-radius: $choices-border-radius;
+ overflow: hidden;
+ word-break: break-all;
+ &.is-active {
+ display: block;
+ }
+ .is-open & {
+ border-color: darken($choices-keyline-color, 15%);
+ }
+ .is-flipped & {
+ top: auto;
+ bottom: 100%;
+ margin-top: 0;
+ margin-bottom: -1px;
+ border-radius: .25rem .25rem 0 0;
+ }
+ .#{$choices-selector}__list {
+ position: relative;
+ max-height: 300px;
+ overflow: auto;
+ -webkit-overflow-scrolling: touch;
+ will-change: scroll-position;
+ }
+ .#{$choices-selector}__item {
+ position: relative;
+ padding: 10px;
+ font-size: $choices-font-size-md;
+ [dir="rtl"] & {
+ text-align: right;
+ }
+ }
+ .#{$choices-selector}__item--selectable {
+ @media (min-width: 640px) {
+ padding-right: 100px;
+ &:after {
+ content: attr(data-select-text);
+ font-size: $choices-font-size-sm;
+ opacity: 0;
+ position: absolute;
+ right: 10px;
+ top: 50%;
+ transform: translateY(-50%);
+ }
+ [dir="rtl"] & {
+ text-align: right;
+ padding-left: 100px;
+ padding-right: 10px;
+ &:after {
+ right: auto;
+ left: 10px;
+ }
+ }
+ }
+ &.is-highlighted {
+ background-color: mix(#000000, #FFFFFF, 5%);
+ &:after {
+ opacity: .5;
+ }
+ }
+ }
+}
+
+.#{$choices-selector}__item {
+ cursor: default;
+}
+
+.#{$choices-selector}__item--selectable {
+ cursor: pointer;
+}
+
+.#{$choices-selector}__item--disabled {
+ cursor: not-allowed;
+ user-select: none;
+ opacity: .5;
+}
+
+.#{$choices-selector}__heading {
+ font-weight: 600;
+ font-size: $choices-font-size-sm;
+ padding: 10px;
+ border-bottom: 1px solid lighten($choices-keyline-color, 10%);
+ color: lighten(#333, 30%);
+}
+
+.#{$choices-selector}__button {
+ text-indent: -9999px;
+ -webkit-appearance: none;
+ appearance: none;
+ border: 0;
+ background-color: transparent;
+ background-repeat: no-repeat;
+ background-position: center;
+ cursor: pointer;
+ &:focus {
+ outline: none;
+ }
+}
+
+.#{$choices-selector}__input {
+ display: inline-block;
+ vertical-align: baseline;
+ background-color: $choices-bg-color;
+ font-size: $choices-font-size-md;
+ margin-bottom: 5px;
+ border: 0;
+ border-radius: 0;
+ max-width: 100%;
+ padding: 4px 0 4px 2px;
+ &:focus {
+ outline: 0;
+ }
+ [dir="rtl"] & {
+ padding-right: 2px;
+ padding-left: 0;
+ }
+}
+
+.#{$choices-selector}__placeholder {
+ opacity: .5;
+}
+
+/*===== End of Choices ======*/
diff --git a/addons/default/visiosoft/multiple-field_type/resources/scss/lookup.scss b/addons/default/visiosoft/multiple-field_type/resources/scss/lookup.scss
new file mode 100644
index 000000000..05704c2b5
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/scss/lookup.scss
@@ -0,0 +1,21 @@
+.multiple-field_type {
+
+ .selected {
+ margin-top: 15px;
+
+ table tr td {
+ padding: 0.5rem;
+ border-top: none;
+ border-bottom: none;
+
+ &:first-of-type {
+ width: 0;
+ padding-right: 15px;
+ }
+
+ &:last-of-type {
+ padding-left: 15px;
+ }
+ }
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/resources/scss/tags.scss b/addons/default/visiosoft/multiple-field_type/resources/scss/tags.scss
new file mode 100644
index 000000000..60eb886f9
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/scss/tags.scss
@@ -0,0 +1,5 @@
+.multiple-field_type {
+ .choices {
+ z-index: 100;
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/checkboxes.twig b/addons/default/visiosoft/multiple-field_type/resources/views/checkboxes.twig
new file mode 100644
index 000000000..c8e116c79
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/checkboxes.twig
@@ -0,0 +1,41 @@
+
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/filter.twig b/addons/default/visiosoft/multiple-field_type/resources/views/filter.twig
new file mode 100644
index 000000000..3f3e58749
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/filter.twig
@@ -0,0 +1,11 @@
+
+
+ {{ trans(field_type.placeholder) }}
+
+ {% for value, option in field_type.options %}
+ {{ trans(option) }}
+ {% endfor %}
+
+
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/lookup.twig b/addons/default/visiosoft/multiple-field_type/resources/views/lookup.twig
new file mode 100644
index 000000000..1aa990961
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/lookup.twig
@@ -0,0 +1,24 @@
+{{ asset_add('styles.css', 'visiosoft.field_type.multiple::css/lookup.scss') }}
+{{ asset_add('scripts.js', 'visiosoft.field_type.multiple::js/lookup.js') }}
+
+
+
+
+
+ {{ img('visiosoft.field_type.multiple::images/plus.svg').data|raw }}
+ {{ trans('streams::button.select') }}
+
+
+
+
+
+ {{ field_type.table|raw }}
+
+
+
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax.twig
new file mode 100644
index 000000000..ebdbf87f0
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax.twig
@@ -0,0 +1,53 @@
+{{ asset_add("scripts.js", "streams::js/table/table.js") }}
+
+{% if not actions.isEmpty() %}
+ {{ asset_add("scripts.js", "streams::js/table/actions.js") }}
+{% endif %}
+
+{% if table.options.sortable %}
+ {{ asset_add("scripts.js", "streams::js/table/sortable.js") }}
+{% endif %}
+
+{{ view("visiosoft.field_type.multiple::table/ajax/heading", {'table': table}) }}
+
+{{ view("visiosoft.field_type.multiple::table/ajax/views", {'table': table}) }}
+{{ view("visiosoft.field_type.multiple::table/ajax/filters", {'table': table}) }}
+
+{% if table.rows.isEmpty() %}
+ {% block no_results %}
+
+
+ {{ trans(table.options.get('no_results_message', 'streams::message.no_results')) }}
+
+
+ {% endblock %}
+{% endif %}
+
+{% if not table.rows.isEmpty() %}
+
+ {{ form_open({'url': url_full(), 'class': 'ajax'}) }}
+
+
+
+
+ {{ view("visiosoft.field_type.multiple::table/ajax/header", {'table': table}) }}
+
+ {% block body %}
+ {{ view("visiosoft.field_type.multiple::table/partials/body", {'table': table}) }}
+ {% endblock %}
+
+ {{ view("streams::table/partials/footer", {'table': table}) }}
+
+
+
+
+ {{ form_close() }}
+
+{% endif %}
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/filters.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/filters.twig
new file mode 100644
index 000000000..742d77703
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/filters.twig
@@ -0,0 +1,27 @@
+{% if not table.filters.isEmpty() %}
+
+
+ {{ form_open({'method': 'get', 'id': 'filters', 'url': url_full(), 'class': 'ajax form-inline'}) }}
+
+
+
+ {% for filter in table.filters %}
+
+ {{ filter.input|raw }}
+
+ {% endfor %}
+
+
+ {{ form_close() }}
+
+
+{% endif %}
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/header.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/header.twig
new file mode 100644
index 000000000..5e0af80c6
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/header.twig
@@ -0,0 +1,36 @@
+
+
+
+ {% if table.options.sortable %}
+
+ {% endif %}
+
+ {% if not table.actions.isEmpty() %}
+
+
+
+ {% endif %}
+
+ {% for header in table.headers %}
+
+ {% if header.sortable %}
+
+ {{ html_link(url_current() ~ '?' ~ header.getQueryString(), trans(header.heading), {'class': 'ajax'}) }}
+
+ {% if header.direction == 'asc' %}
+ {{ icon('sort-ascending', 'text-muted') }}
+ {% elseif header.direction == 'desc' %}
+ {{ icon('sort-descending', 'text-muted') }}
+ {% else %}
+ {{ icon('sortable', 'text-muted') }}
+ {% endif %}
+
+ {% else %}
+ {{ trans(header.heading)|raw }}
+ {% endif %}
+
+ {% endfor %}
+
+
+
+
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/heading.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/heading.twig
new file mode 100644
index 000000000..2cefe0a14
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/heading.twig
@@ -0,0 +1,19 @@
+{% if (table.options.title or table.options.description) and table.options.title %}
+
+{% endif %}
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/views.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/views.twig
new file mode 100644
index 000000000..43250ffc0
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/ajax/views.twig
@@ -0,0 +1,14 @@
+{% if not table.views.isEmpty() %}
+
+
+
+{% endif %}
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/partials/body.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/partials/body.twig
new file mode 100644
index 000000000..176f1dbd0
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/partials/body.twig
@@ -0,0 +1,31 @@
+
+{% for row in table.rows %}
+
+
+ {% if table.options.sortable %}
+
+ {{ icon('fa fa-arrows handle') }}
+
+
+ {% endif %}
+
+ {% if not table.actions.isEmpty() %}
+
+
+
+ {% endif %}
+
+ {% for column in row.columns %}
+
+ {{ column.value|raw }}
+
+ {% endfor %}
+
+
+ {{ buttons(row.buttons)|raw }}
+
+
+
+{% endfor %}
+
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/table/table.twig b/addons/default/visiosoft/multiple-field_type/resources/views/table/table.twig
new file mode 100644
index 000000000..e11a8d90a
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/table/table.twig
@@ -0,0 +1,34 @@
+{{ asset_add("scripts.js", "streams::js/table/jquery-sortable.js") }}
+
+{% if not table.rows.isEmpty() %}
+ {% block panel %}
+
+
+
+
+
+ {{ view("visiosoft.field_type.multiple::table/ajax/header", {'table': table}) }}
+
+ {% block body %}
+ {{ view("visiosoft.field_type.multiple::table/partials/body", {'table': table}) }}
+ {% endblock %}
+
+
+
+
+
+ {% endblock %}
+{% else %}
+
+ {% block no_results %}
+
+
+ {{ trans(table.options.get('no_results_message', 'streams::message.no_results')) }}
+
+
+ {% endblock %}
+
+{% endif %}
\ No newline at end of file
diff --git a/addons/default/visiosoft/multiple-field_type/resources/views/tags.twig b/addons/default/visiosoft/multiple-field_type/resources/views/tags.twig
new file mode 100644
index 000000000..07df2c621
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/resources/views/tags.twig
@@ -0,0 +1,22 @@
+{{ asset_add("styles.css", "visiosoft.field_type.multiple::css/choices.css", ["as:jshjohnson/Choices.css"]) }}
+{{ asset_add("scripts.js", "visiosoft.field_type.multiple::js/choices.min.js", ["as:jshjohnson/Choices.js"]) }}
+{{ asset_add("styles.css", "visiosoft.field_type.multiple::css/tags.css") }}
+{{ asset_add("scripts.js", "visiosoft.field_type.multiple::js/tags.js") }}
+
+
+
+ {% for key, title in field_type.options %}
+ {{ title }}
+ {% endfor %}
+
+
+
+
+ {{ trans('visiosoft.field_type.multiple::input.help') }}
+
diff --git a/addons/default/visiosoft/multiple-field_type/src/Command/BuildOptions.php b/addons/default/visiosoft/multiple-field_type/src/Command/BuildOptions.php
new file mode 100644
index 000000000..e80c25f53
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Command/BuildOptions.php
@@ -0,0 +1,53 @@
+fieldType = $fieldType;
+ }
+
+ /**
+ * Handle the command.
+ *
+ * @param Container $container
+ */
+ public function handle(Container $container)
+ {
+ if ($options = $this->fieldType->config('options')) {
+
+ $this->fieldType->setOptions($options);
+
+ return;
+ }
+
+ $model = $this->fieldType->getRelatedModel();
+ $handler = $this->fieldType->config('handler', $model->getMultipleFieldTypeOptionsHandler());
+
+ if (!class_exists($handler) && !str_contains($handler, '@')) {
+ $handler = array_get($this->fieldType->getHandlers(), $handler);
+ }
+
+ if (is_string($handler) && !str_contains($handler, '@')) {
+ $handler .= '@handle';
+ }
+
+ $container->call($handler, ['fieldType' => $this->fieldType]);
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Command/GetConfiguration.php b/addons/default/visiosoft/multiple-field_type/src/Command/GetConfiguration.php
new file mode 100644
index 000000000..d7d95a55b
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Command/GetConfiguration.php
@@ -0,0 +1,39 @@
+key = $key;
+ }
+
+ /**
+ * Handle the command.
+ *
+ * @param Repository $cache
+ * @return Collection
+ */
+ public function handle(Repository $cache)
+ {
+ return new Collection(
+ array_merge(Crypt::decrypt($this->key), ['key' => $this->key])
+ );
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Handler/Related.php b/addons/default/visiosoft/multiple-field_type/src/Handler/Related.php
new file mode 100644
index 000000000..69e670c3e
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Handler/Related.php
@@ -0,0 +1,65 @@
+getRelatedModel();
+
+ $query = $model->newQuery();
+ $results = $query->get();
+
+ try {
+
+ /**
+ * Try and use a non-parsing pattern.
+ */
+ if (strpos($fieldType->config('title_name', $model->getTitleName()), '{') === false) {
+ $fieldType->setOptions(
+ $results->pluck(
+ $fieldType->config('title_name', $model->getTitleName()),
+ $fieldType->config('key_name', $model->getKeyName())
+ )->all()
+ );
+ }
+
+ /**
+ * Try and use a parsing pattern.
+ */
+ if (strpos($fieldType->config('title_name', $model->getTitleName()), '{') !== false) {
+ $fieldType->setOptions(
+ array_combine(
+ $results->map(
+ function ($item) use ($fieldType, $model) {
+ return data_get($item, $fieldType->config('key_name', $model->getKeyName()));
+ }
+ )->all(),
+ $results->map(
+ function ($item) use ($fieldType, $model, $value) {
+ return $value->make($fieldType->config('title_name', $model->getTitleName()), $item);
+ }
+ )->all()
+ )
+ );
+ }
+ } catch (\Exception $e) {
+ $fieldType->setOptions(
+ $results->pluck(
+ $model->getTitleName(),
+ $model->getKeyName()
+ )->all()
+ );
+ }
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Http/Controller/LookupController.php b/addons/default/visiosoft/multiple-field_type/src/Http/Controller/LookupController.php
new file mode 100644
index 000000000..6bc0c6961
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Http/Controller/LookupController.php
@@ -0,0 +1,106 @@
+dispatch(new GetConfiguration($key));
+
+ $related = $container->make($config->get('related'));
+
+ if ($table = $config->get('lookup_table')) {
+ $table = $container->make($table);
+ } else {
+ $table = $related->newMultipleFieldTypeLookupTableBuilder();
+ }
+
+ /* @var LookupTableBuilder $table */
+ $table->setConfig($config)
+ ->setModel($related);
+
+ return $table->render();
+ }
+
+ /**
+ * @param Container $container
+ * @param MultipleFieldType $fieldType
+ * @param $key
+ */
+ public function json(Container $container, MultipleFieldType $fieldType, $key)
+ {
+ /* @var Collection $config */
+ $config = $this->dispatch(new GetConfiguration($key));
+
+ $fieldType->mergeConfig($config->all());
+
+ /* @var EloquentModel $model */
+ $model = $container->make($config->get('related'));
+
+ $data = [];
+
+ /* @var EntryInterface $item */
+ foreach ($model->all() as $item) {
+ $data[] = (object)[
+ 'id' => $item->getId(),
+ 'text' => $item->getTitle(),
+ ];
+ }
+
+ return $this->response->json($data);
+ }
+
+ /**
+ * Return the selected entries.
+ *
+ * @param SelectedTableBuilder $table
+ * @param MultipleFieldType $fieldType
+ * @param $key
+ * @return null|string
+ */
+ public function selected(Container $container, MultipleFieldType $fieldType, $key)
+ {
+ /* @var Collection $config */
+ $config = $this->dispatch(new GetConfiguration($key));
+
+ $fieldType->mergeConfig($config->all());
+ $fieldType->setField($config->get('field'));
+ $fieldType->setEntry($this->container->make($config->get('entry')));
+
+ $related = $container->make($config->get('related'));
+
+ if ($table = $config->get('selected_table')) {
+ $table = $container->make($table);
+ } else {
+ $table = $related->newMultipleFieldTypeSelectedTableBuilder();
+ }
+
+ /* @var SelectedTableBuilder $table */
+ $table->setSelected(array_filter(explode(',', $this->request->get('uploaded'))))
+ ->setModel($config->get('related'))
+ ->setFieldType($fieldType)
+ ->setConfig($config)
+ ->build()
+ ->load();
+
+ return $table->getTableContent();
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/MultipleFieldType.php b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldType.php
new file mode 100644
index 000000000..34d7c42cd
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldType.php
@@ -0,0 +1,357 @@
+ 'Visiosoft\MultipleFieldType\Handler\Related@handle',
+ //'fields' => 'Visiosoft\MultipleFieldType\Handler\Fields@handle',
+ //'assignments' => 'Visiosoft\MultipleFieldType\Handler\Assignments@handle'
+ ];
+
+ /**
+ * The field type rules.
+ *
+ * @var array
+ */
+ protected $rules = [
+ 'array',
+ ];
+
+ /**
+ * The field type config.
+ *
+ * @var array
+ */
+ protected $config = [
+ 'mode' => 'tags',
+ ];
+
+ /**
+ * The select input options.
+ *
+ * @var null|array
+ */
+ protected $options = null;
+
+ /**
+ * The cache repository.
+ *
+ * @var Repository
+ */
+ protected $cache;
+
+ /**
+ * The service container.
+ *
+ * @var Container
+ */
+ protected $container;
+
+ /**
+ * Create a new MultipleFieldType instance.
+ *
+ * @param Repository $cache
+ * @param Container $container
+ */
+ public function __construct(Repository $cache, Container $container)
+ {
+ $this->cache = $cache;
+ $this->container = $container;
+ }
+
+ /**
+ * Return the ids.
+ *
+ * @return array|mixed|static
+ */
+ public function ids()
+ {
+ $value = $this->getValue();
+
+ if (is_object($value)) {
+ $value = $value->pluck('id')->all();
+ }
+
+ return array_filter((array)$value);
+ }
+
+ /**
+ * Get the rules.
+ *
+ * @return array
+ */
+ public function getRules()
+ {
+ $rules = parent::getRules();
+
+ if ($min = array_get($this->getConfig(), 'min')) {
+ $rules[] = 'min:' . $min;
+ }
+
+ if ($max = array_get($this->getConfig(), 'max')) {
+ $rules[] = 'max:' . $max;
+ }
+
+ return $rules;
+ }
+
+ /**
+ * Return the config key.
+ *
+ * @return string
+ */
+ public function key()
+ {
+ return Crypt::encrypt(array_merge(
+ $this->getConfig(),
+ [
+ 'field' => $this->getField(),
+ 'entry' => get_class($this->getEntry()),
+ ]
+ ));
+ }
+
+ /**
+ * Value table.
+ *
+ * @return string
+ */
+ public function table()
+ {
+ $value = $this->getValue();
+ $related = $this->getRelatedModel();
+
+ if ($table = $this->config('value_table')) {
+ $table = $this->container->make($table);
+ } else {
+ $table = $related->newMultipleFieldTypeValueTableBuilder();
+ }
+
+ /* @var ValueTableBuilder $table */
+ $table->setConfig(new Collection($this->getConfig()))
+ ->setFieldType($this)
+ ->setModel($related);
+
+ if (!$value instanceof EntryCollection) {
+ $table->setSelected((array)$value);
+ }
+
+ if ($value instanceof EntryCollection) {
+ $table->setSelected($value->ids());
+ }
+
+ return $table
+ ->build()
+ ->load()
+ ->getTableContent();
+ }
+
+ /**
+ * Get the relation.
+ *
+ * @return BelongsToMany
+ */
+ public function getRelation()
+ {
+ $entry = $this->getEntry();
+ $model = $this->getRelatedModel();
+
+ return $entry->belongsToMany(
+ get_class($model),
+ $this->getPivotTableName(),
+ 'entry_id',
+ 'related_id'
+ )->orderBy($this->getPivotTableName() . '.sort_order', 'ASC');
+ }
+
+ /**
+ * Get the options.
+ *
+ * @return array
+ */
+ public function getOptions()
+ {
+ if ($this->options === null) {
+ $this->dispatch(new BuildOptions($this));
+ }
+
+ return $this->options;
+ }
+
+ /**
+ * Set the options.
+ *
+ * @param array $options
+ * @return $this
+ */
+ public function setOptions(array $options)
+ {
+ $this->options = $options;
+
+ return $this;
+ }
+
+ /**
+ * Get the pre-defined handlers.
+ *
+ * @return array
+ */
+ public function getHandlers()
+ {
+ return $this->handlers;
+ }
+
+ /**
+ * Return the input view.
+ *
+ * @return string
+ */
+ public function getInputView()
+ {
+ return $this->inputView ?: 'visiosoft.field_type.multiple::' . $this->config('mode');
+ }
+
+ /**
+ * Get the related model.
+ *
+ * @return EloquentModel
+ */
+ public function getRelatedModel()
+ {
+ $model = $this->config('related');
+
+ if (strpos($model, '.')) {
+
+ /* @var StreamInterface $stream */
+ $stream = $this->dispatch(new GetStream($model));
+
+ return $stream->getEntryModel();
+ }
+
+ return $this->container->make($model);
+ }
+
+ /**
+ * Get the pivot table.
+ *
+ * @return string
+ */
+ public function getPivotTableName()
+ {
+ return $this->entry->getTableName() . '_' . $this->getField();
+ }
+
+ /**
+ * Get the post value.
+ *
+ * @param null $default
+ * @return array
+ */
+ public function getPostValue($default = null)
+ {
+ if (is_array($value = parent::getPostValue($default))) {
+ return array_filter($value);
+ }
+
+ return array_filter(explode(',', $value));
+ }
+
+ /**
+ * Get the class.
+ *
+ * @return null|string
+ */
+ public function getClass()
+ {
+ if ($class = parent::getClass()) {
+ return $class;
+ }
+
+ return $this->config('mode') == 'dropdown' ? 'custom-select form-control' : null;
+ }
+
+ /**
+ * Handle saving the form data ourselves.
+ *
+ * @param FormBuilder $builder
+ */
+ public function handle(FormBuilder $builder)
+ {
+ $entry = $builder->getFormEntry();
+
+ // See the accessor for how IDs are handled.
+ $entry->{$this->getField()} = $this->getPostValue();
+ }
+
+ /**
+ * Fired just before version comparison.
+ *
+ * @param EloquentCollection $related
+ */
+ public function toArrayForComparison(EloquentCollection $related)
+ {
+ return $related->map(
+ function (EloquentModel $model) {
+ return array_diff_key(
+ $model->toArrayWithRelations(),
+ array_flip(
+ [
+ 'id',
+ 'sort_order',
+ 'created_at',
+ 'created_by_id',
+ 'updated_at',
+ 'updated_by_id',
+ 'deleted_at',
+ 'deleted_by_id',
+ ]
+ )
+ );
+ }
+ )->toArray();
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeAccessor.php b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeAccessor.php
new file mode 100644
index 000000000..63f22872a
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeAccessor.php
@@ -0,0 +1,97 @@
+organizeSyncValue(explode(',', $value));
+ } elseif (is_array($value)) {
+ $value = $this->organizeSyncValue($value);
+ } elseif ($value instanceof Collection) {
+ $value = $this->organizeSyncValue($value->filter()->all());
+ } elseif ($value instanceof EntryInterface) {
+ $value = $this->organizeSyncValue([$value->getId()]);
+ }
+
+ if (!$value) {
+ $this->fieldType->getRelation()->detach();
+
+ return;
+ }
+
+ $this->fieldType->getRelation()->sync($value);
+ }
+
+ /**
+ * Organize the value for sync.
+ *
+ * @param array $value
+ * @return array
+ */
+ protected function organizeSyncValue(array $value)
+ {
+
+ /**
+ * First clean our value.
+ */
+ $value = array_filter(array_unique($value));
+
+ /**
+ * Next take the natural array
+ * key and make it the sort order.
+ */
+ $value = array_combine(
+ array_values($value),
+ array_map(
+ function ($key) {
+ return [
+ 'sort_order' => $key,
+ ];
+ },
+ array_keys($value)
+ )
+ );
+
+ /**
+ * Lastly add the file_id
+ * relation column for sync.
+ */
+ array_walk(
+ $value,
+ function (&$value, $key) {
+ $value['related_id'] = $key;
+ }
+ );
+
+ return $value;
+ }
+
+ /**
+ * Get the value.
+ *
+ * @return mixed
+ */
+ public function get()
+ {
+ return $this->fieldType->getRelation();
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeQuery.php b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeQuery.php
new file mode 100644
index 000000000..e6f3d08ab
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeQuery.php
@@ -0,0 +1,27 @@
+getStream();
+
+ $query->leftJoin(
+ $stream->getEntryTableName() . '_' . $filter->getField() . ' AS filter_' . $filter->getField(),
+ $stream->getEntryTableName() . '.id',
+ '=',
+ 'filter_' . $filter->getField() . '.entry_id'
+ )->where('filter_' . $filter->getField() . '.related_id', $filter->getValue());
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeSchema.php b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeSchema.php
new file mode 100644
index 000000000..d11d54cdc
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeSchema.php
@@ -0,0 +1,66 @@
+getTable() . '_' . $this->fieldType->getField();
+
+ $this->schema->dropIfExists($table);
+
+ $this->schema->create(
+ $table,
+ function (Blueprint $table) {
+
+ $table->increments('id');
+ $table->integer('entry_id');
+ $table->integer('related_id');
+ $table->integer('sort_order')->nullable();
+
+ $table->unique(
+ ['entry_id', 'related_id'],
+ md5($table->getTable() . '_' . $this->fieldType->getField().'-unique-relations')
+ );
+ }
+ );
+ }
+
+ /**
+ * Rename the pivot table.
+ *
+ * @param Blueprint $table
+ * @param FieldType $from
+ */
+ public function renameColumn(Blueprint $table, FieldType $from)
+ {
+ $this->schema->rename(
+ $table->getTable() . '_' . $from->getField(),
+ $table->getTable() . '_' . $this->fieldType->getField()
+ );
+ }
+
+ /**
+ * Drop the pivot table.
+ *
+ * @param Blueprint $table
+ */
+ public function dropColumn(Blueprint $table)
+ {
+ $this->schema->dropIfExists(
+ $table->getTable() . '_' . $this->fieldType->getField()
+ );
+ }
+
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeServiceProvider.php b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeServiceProvider.php
new file mode 100644
index 000000000..efdb75d3d
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/MultipleFieldTypeServiceProvider.php
@@ -0,0 +1,102 @@
+ MultipleFieldTypeAccessor::class,
+ ];
+
+ /**
+ * The addon routes.
+ *
+ * @var array
+ */
+ protected $routes = [
+ 'streams/multiple-field_type/json/{key}' => 'Visiosoft\MultipleFieldType\Http\Controller\LookupController@json',
+ 'streams/multiple-field_type/index/{key}' => 'Visiosoft\MultipleFieldType\Http\Controller\LookupController@index',
+ 'streams/multiple-field_type/selected/{key}' => 'Visiosoft\MultipleFieldType\Http\Controller\LookupController@selected',
+ ];
+
+ /**
+ * Register the addon.
+ *
+ * @param EntryModel $model
+ */
+ public function register(EntryModel $model)
+ {
+ $model->bind(
+ 'new_multiple_field_type_lookup_table_builder',
+ function (Container $container) {
+
+ /* @var EntryInterface $this */
+ $builder = $this->getBoundModelNamespace() . '\\Support\\MultipleFieldType\\LookupTableBuilder';
+
+ if (class_exists($builder)) {
+ return $container->make($builder);
+ }
+
+ return $container->make(LookupTableBuilder::class);
+ }
+ );
+
+ $model->bind(
+ 'new_multiple_field_type_value_table_builder',
+ function (Container $container) {
+
+ /* @var EntryInterface $this */
+ $builder = $this->getBoundModelNamespace() . '\\Support\\MultipleFieldType\\ValueTableBuilder';
+
+ if (class_exists($builder)) {
+ return $container->make($builder);
+ }
+
+ return $container->make(ValueTableBuilder::class);
+ }
+ );
+
+ $model->bind(
+ 'new_multiple_field_type_selected_table_builder',
+ function (Container $container) {
+
+ /* @var EntryInterface $this */
+ $builder = $this->getBoundModelNamespace() . '\\Support\\MultipleFieldType\\SelectedTableBuilder';
+
+ if (class_exists($builder)) {
+ return $container->make($builder);
+ }
+
+ return $container->make(SelectedTableBuilder::class);
+ }
+ );
+
+ $model->bind(
+ 'get_multiple_field_type_options_handler',
+ function () {
+
+ /* @var EntryInterface $this */
+ $handler = $this->getBoundModelNamespace() . '\\Support\\MultipleFieldType\\OptionsHandler';
+
+ if (class_exists($handler)) {
+ return $handler;
+ }
+
+ return Related::class;
+ }
+ );
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Support/Config/RelatedHandler.php b/addons/default/visiosoft/multiple-field_type/src/Support/Config/RelatedHandler.php
new file mode 100644
index 000000000..64113992c
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Support/Config/RelatedHandler.php
@@ -0,0 +1,38 @@
+visible() as $stream) {
+
+ $addon = ucwords(str_replace('_', ' ', $stream->getNamespace()));
+
+ $model = $stream->getEntryModelName();
+
+ array_set($options, "{$addon}.{$model}", $stream->getName());
+ }
+
+ foreach ($options as $namespace) {
+ ksort($namespace);
+ }
+
+ ksort($options);
+
+ $fieldType->setOptions($options);
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableActions.php b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableActions.php
new file mode 100644
index 000000000..a51a8de73
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableActions.php
@@ -0,0 +1,22 @@
+setActions(
+ [
+ 'add_selected' => [
+ 'data-key' => $builder->config('key'),
+ ],
+ ]
+ );
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableBuilder.php b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableBuilder.php
new file mode 100644
index 000000000..ea33017b6
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableBuilder.php
@@ -0,0 +1,96 @@
+ false,
+ 'title' => 'visiosoft.field_type.multiple::message.select_entries',
+ 'table_view' => 'visiosoft.field_type.multiple::table/ajax',
+ ];
+
+ /**
+ * Return a config value.
+ *
+ * @param $key
+ * @param null $default
+ * @return mixed
+ */
+ public function config($key, $default = null)
+ {
+ return $this->config->get($key, $default);
+ }
+
+ /**
+ * Get the config.
+ *
+ * @return Collection|null
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * Set the config.
+ *
+ * @param Collection $config
+ * @return $this
+ */
+ public function setConfig(Collection $config)
+ {
+ $this->config = $config;
+
+ return $this;
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableButtons.php b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableButtons.php
new file mode 100644
index 000000000..81c20bf2c
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableButtons.php
@@ -0,0 +1,24 @@
+setButtons(
+ [
+ 'add' => [
+ 'data-entry' => 'entry.id',
+ 'data-key' => $builder->config('key'),
+ ],
+ ]
+ );
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableColumns.php b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableColumns.php
new file mode 100644
index 000000000..27b812ebd
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableColumns.php
@@ -0,0 +1,31 @@
+getTableStream();
+ $column = $stream->getTitleColumn();
+
+ if ($column == 'id') {
+
+ $builder->setColumns([]);
+
+ return;
+ }
+
+ $builder->setColumns(
+ [
+ $column,
+ ]
+ );
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableFilters.php b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableFilters.php
new file mode 100644
index 000000000..954e3eba6
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Table/LookupTableFilters.php
@@ -0,0 +1,35 @@
+getTableStream();
+ $filter = $stream->getTitleColumn();
+
+ if ($filter == 'id') {
+
+ $builder->setFilters([]);
+
+ return;
+ }
+
+ $builder->setFilters(
+ [
+ 'search' => [
+ 'fields' => [
+ $filter,
+ ],
+ ],
+ ]
+ );
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/SelectedTableBuilder.php b/addons/default/visiosoft/multiple-field_type/src/Table/SelectedTableBuilder.php
new file mode 100644
index 000000000..b6fb2b9b6
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Table/SelectedTableBuilder.php
@@ -0,0 +1,175 @@
+ [
+ 'data-dismiss' => 'multiple',
+ 'data-entry' => 'entry.id',
+ ],
+ ];
+
+ /**
+ * The table options.
+ *
+ * @var array
+ */
+ protected $options = [
+ 'limit' => 9999,
+ 'show_headers' => false,
+ 'sortable_headers' => false,
+ 'table_view' => 'visiosoft.field_type.multiple::table/table',
+ ];
+
+ /**
+ * Fired just before querying.
+ *
+ * @param Builder $query
+ */
+ public function onQuerying(Builder $query)
+ {
+ $uploaded = $this->getSelected();
+ $fieldType = $this->getFieldType();
+
+ /*
+ * If we have the entry available then
+ * we can determine saved sort order.
+ */
+ $related = $fieldType->getRelatedModel();
+
+ $query->whereIn($related->getTableName() . '.id', $uploaded ?: 0);
+ }
+
+ /**
+ * Return a config value.
+ *
+ * @param $key
+ * @param null $default
+ * @return mixed
+ */
+ public function config($key, $default = null)
+ {
+ return $this->config->get($key, $default);
+ }
+
+ /**
+ * Get the config.
+ *
+ * @return Collection|null
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * Set the config.
+ *
+ * @param Collection $config
+ * @return $this
+ */
+ public function setConfig(Collection $config)
+ {
+ $this->config = $config;
+
+ return $this;
+ }
+
+ /**
+ * Get the selected value.
+ *
+ * @return array
+ */
+ public function getSelected()
+ {
+ return $this->selected;
+ }
+
+ /**
+ * Get the selected value.
+ *
+ * @param array $selected
+ * @return $this
+ */
+ public function setSelected(array $selected)
+ {
+ $this->selected = $selected;
+
+ return $this;
+ }
+
+ /**
+ * Get the field type.
+ *
+ * @return MultipleFieldType|null
+ */
+ public function getFieldType()
+ {
+ return $this->fieldType;
+ }
+
+ /**
+ * Set the field type.
+ *
+ * @param MultipleFieldType $fieldType
+ * @return $this
+ */
+ public function setFieldType(MultipleFieldType $fieldType)
+ {
+ $this->fieldType = $fieldType;
+
+ return $this;
+ }
+
+ /**
+ * Set the table entries.
+ *
+ * @param \Illuminate\Support\Collection $entries
+ * @return $this
+ */
+ public function setTableEntries(\Illuminate\Support\Collection $entries)
+ {
+ if (!$this->getFieldType()) {
+ $entries = $entries->sort(
+ function ($a, $b) {
+ return array_search($a->id, $this->getSelected()) - array_search($b->id, $this->getSelected());
+ }
+ );
+ }
+
+ return parent::setTableEntries($entries);
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/src/Table/ValueTableBuilder.php b/addons/default/visiosoft/multiple-field_type/src/Table/ValueTableBuilder.php
new file mode 100644
index 000000000..213c20e46
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/src/Table/ValueTableBuilder.php
@@ -0,0 +1,182 @@
+ [
+ 'data-dismiss' => 'multiple',
+ 'data-entry' => 'entry.id',
+ ],
+ ];
+
+ /**
+ * The table options.
+ *
+ * @var array
+ */
+ protected $options = [
+ 'limit' => 9999,
+ 'show_headers' => false,
+ 'sortable_headers' => false,
+ 'table_view' => 'visiosoft.field_type.multiple::table/table',
+ ];
+
+ /**
+ * Fired just before querying.
+ *
+ * @param Builder $query
+ */
+ public function onQuerying(Builder $query)
+ {
+ $uploaded = $this->getSelected();
+ $fieldType = $this->getFieldType();
+
+ /*
+ * If we have the entry available then
+ * we can determine saved sort order.
+ */
+ $table = $fieldType->getPivotTableName();
+ $related = $fieldType->getRelatedModel();
+ $entry = $fieldType->getEntry();
+
+ if ($entry->getId() && $related && !$uploaded) {
+ $query->join($table, $table . '.related_id', '=', $related->getTableName() . '.id');
+ $query->where($table . '.entry_id', $entry->getId());
+ $query->orderBy($table . '.sort_order', 'ASC');
+ } elseif ($related) {
+ $query->whereIn($related->getTableName() . '.id', $uploaded ?: [0]);
+ }
+ }
+
+ /**
+ * Return a config value.
+ *
+ * @param $key
+ * @param null $default
+ * @return mixed
+ */
+ public function config($key, $default = null)
+ {
+ return $this->config->get($key, $default);
+ }
+
+ /**
+ * Get the config.
+ *
+ * @return Collection|null
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * Set the config.
+ *
+ * @param Collection $config
+ * @return $this
+ */
+ public function setConfig(Collection $config)
+ {
+ $this->config = $config;
+
+ return $this;
+ }
+
+ /**
+ * Get the selected value.
+ *
+ * @return array
+ */
+ public function getSelected()
+ {
+ return $this->selected;
+ }
+
+ /**
+ * Get the selected value.
+ *
+ * @param array $selected
+ * @return $this
+ */
+ public function setSelected(array $selected)
+ {
+ $this->selected = $selected;
+
+ return $this;
+ }
+
+ /**
+ * Get the field type.
+ *
+ * @return MultipleFieldType|null
+ */
+ public function getFieldType()
+ {
+ return $this->fieldType;
+ }
+
+ /**
+ * Set the field type.
+ *
+ * @param MultipleFieldType $fieldType
+ * @return $this
+ */
+ public function setFieldType(MultipleFieldType $fieldType)
+ {
+ $this->fieldType = $fieldType;
+
+ return $this;
+ }
+
+ /**
+ * Set the table entries.
+ *
+ * @param \Illuminate\Support\Collection $entries
+ * @return $this
+ */
+ public function setTableEntries(\Illuminate\Support\Collection $entries)
+ {
+ if (!$this->getFieldType()) {
+ $entries = $entries->sort(
+ function ($a, $b) {
+ return array_search($a->id, $this->getSelected()) - array_search($b->id, $this->getSelected());
+ }
+ );
+ }
+
+ return parent::setTableEntries($entries);
+ }
+}
diff --git a/addons/default/visiosoft/multiple-field_type/webpack.mix.js b/addons/default/visiosoft/multiple-field_type/webpack.mix.js
new file mode 100644
index 000000000..95baa13ef
--- /dev/null
+++ b/addons/default/visiosoft/multiple-field_type/webpack.mix.js
@@ -0,0 +1,57 @@
+let mix = require('laravel-mix');
+
+/*
+ |--------------------------------------------------------------------------
+ | Mix Asset Management
+ |--------------------------------------------------------------------------
+ |
+ | Mix provides a clean, fluent API for defining some Webpack build steps
+ | for your Laravel application. By default, we are compiling the Sass
+ | file for the application as well as bundling up all the JS files.
+ |
+ */
+
+mix
+ .copy('node_modules/choices/choices.js', 'resources/js')
+ .sass('resources/scss/choices.scss', 'resources/css')
+ .sass('resources/scss/lookup.scss', 'resources/css')
+ .sass('resources/scss/tags.scss', 'resources/css')
+ .options({
+ processCssUrls: false
+ });
+
+// Full API
+// mix.js(src, output);
+// mix.react(src, output); <-- Identical to mix.js(), but registers React Babel compilation.
+// mix.preact(src, output); <-- Identical to mix.js(), but registers Preact compilation.
+// mix.coffee(src, output); <-- Identical to mix.js(), but registers CoffeeScript compilation.
+// mix.ts(src, output); <-- TypeScript support. Requires tsconfig.json to exist in the same folder as webpack.mix.js
+// mix.extract(vendorLibs);
+// mix.sass(src, output);
+// mix.less(src, output);
+// mix.stylus(src, output);
+// mix.postCss(src, output, [require('postcss-some-plugin')()]);
+// mix.browserSync('my-site.test');
+// mix.combine(files, destination);
+// mix.babel(files, destination); <-- Identical to mix.combine(), but also includes Babel compilation.
+// mix.copy(from, to);
+// mix.copyDirectory(fromDir, toDir);
+// mix.minify(file);
+// mix.sourceMaps(); // Enable sourcemaps
+// mix.version(); // Enable versioning.
+// mix.disableNotifications();
+// mix.setPublicPath('path/to/public');
+// mix.setResourceRoot('prefix/for/resource/locators');
+// mix.autoload({}); <-- Will be passed to Webpack's ProvidePlugin.
+// mix.webpackConfig({}); <-- Override webpack.config.js, without editing the file directly.
+// mix.babelConfig({}); <-- Merge extra Babel configuration (plugins, etc.) with Mix's default.
+// mix.then(function () {}) <-- Will be triggered each time Webpack finishes building.
+// mix.extend(name, handler) <-- Extend Mix's API with your own components.
+// mix.options({
+// extractVueStyles: false, // Extract .vue component styling to file, rather than inline.
+// globalVueStyles: file, // Variables file to be imported in every component.
+// processCssUrls: true, // Process/optimize relative stylesheet url()'s. Set to false, if you don't want them touched.
+// purifyCss: false, // Remove unused CSS selectors.
+// terser: {}, // Terser-specific options. https://github.com/webpack-contrib/terser-webpack-plugin#options
+// postCss: [] // Post-CSS options: https://github.com/postcss/postcss/blob/master/docs/plugins.md
+// });