From 0bdca85e14a150fc3bfbd050c453a6221de3524e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20T=C3=A1mara=20Pati=C3=B1o?= Date: Wed, 10 Apr 2024 10:12:46 -0500 Subject: [PATCH] Usa tom-select en filtro geo de listado de poblacion. Closes #270 --- app/assets/stylesheets/application.css | 2 ++ app/javascript/application.js | 10 ++++++- package.json | 3 +- yarn.lock | 38 ++++++++++++++++++++------ 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 2ce89f5..24f3545 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -11,6 +11,7 @@ * file per style scope. * *= require sivel2_gen/application.css + *= require tom-select/dist/css/tom-select.bootstrap5.min.css *= require_tree . *= require_self */ @@ -19,3 +20,4 @@ border: 1px solid lightgray; padding: 10px; } + diff --git a/app/javascript/application.js b/app/javascript/application.js index 2f62201..4960850 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -17,6 +17,8 @@ import '../../vendor/assets/javascripts/jquery-ui.js' import 'popper.js' // Dialogos emergentes usados por bootstrap import * as bootstrap from 'bootstrap' // Maquetacion y elementos de diseƱo import 'chosen-js/chosen.jquery'; // Cuadros de seleccion potenciados +import TomSelect from 'tom-select'; +window.TomSelect = TomSelect import 'bootstrap-datepicker' import 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.es.min.js' @@ -84,7 +86,13 @@ promesaRecursosSprocketsYDocumento.then((mensaje) => { if (p2ult == 'graficar/actos_individuales') { plotly_serietiempo_actos() } - + new TomSelect('.tom-select', { + create: true, + sortField: { + field: "text", + direction: "asc" + } + }) window.AutocompletaAjaxEntidad.iniciar() diff --git a/package.json b/package.json index 830eee1..7dd402c 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ "postcss": "^8.2.10", "puppeteer-core": "^19.7.5", "sortable": "^2.0.0", - "sortablejs": "^1.14.0" + "sortablejs": "^1.14.0", + "tom-select": "^2.3.1" }, "devDependencies": { "css-what": "^5.0.1", diff --git a/yarn.lock b/yarn.lock index e407a95..2abafea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -717,6 +717,18 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@orchidjs/sifter@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@orchidjs/sifter/-/sifter-1.0.3.tgz#43f42519472282eb632d0a1589184f044d64129b" + integrity sha512-zCZbwKegHytfsPm8Amcfh7v/4vHqTAaOu6xFswBYcn8nznBOuseu6COB2ON7ez0tFV0mKL0nRNnCiZZA+lU9/g== + dependencies: + "@orchidjs/unicode-variants" "^1.0.4" + +"@orchidjs/unicode-variants@^1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@orchidjs/unicode-variants/-/unicode-variants-1.0.4.tgz#6d2f812e3b19545bba2d81caffff1204de9a6a58" + integrity sha512-NvVBRnZNE+dugiXERFsET1JlKZfM5lJDEpSMilKW4bToYJ7pxf0Zne78xyXB2ny2c2aHfJ6WLnz1AaTNHAmQeQ== + "@pasosdejesus/autocompleta_ajax@https://gitlab.com/pasosdeJesus/autocompleta_ajax.git": version "0.9.9-a32" resolved "https://gitlab.com/pasosdeJesus/autocompleta_ajax.git#c460a93c41ef66b862965b673615d95e5f059458" @@ -862,9 +874,9 @@ integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== "@types/node@*": - version "20.12.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.4.tgz#af5921bd75ccdf3a3d8b3fa75bf3d3359268cd11" - integrity sha512-E+Fa9z3wSQpzgYQdYmme5X3OTuejnnTx88A6p6vkkJosR3KBz+HpE3kqNm98VE6cfLFcISx7zW7MsJkH6KwbTw== + version "20.12.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.7.tgz#04080362fa3dd6c5822061aa3124f5c152cff384" + integrity sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg== dependencies: undici-types "~5.26.4" @@ -1227,9 +1239,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001587: - version "1.0.30001605" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001605.tgz#ca12d7330dd8bcb784557eb9aa64f0037870d9d6" - integrity sha512-nXwGlFWo34uliI9z3n6Qc0wZaf7zaZWA1CPZ169La5mV3I/gem7bst0vr5XQH5TJXZIMfDeZyOrZnSlVzKxxHQ== + version "1.0.30001607" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001607.tgz#b91e8e033f6bca4e13d3d45388d87fa88931d9a5" + integrity sha512-WcvhVRjXLKFB/kmOFVwELtMxyhq3iM/MvmXcyCe2PNf166c39mptscOc/45TTS96n2gpNV2z7+NakArTWZCQ3w== chalk@^2.4.2: version "2.4.2" @@ -1504,9 +1516,9 @@ domexception@^2.0.1: webidl-conversions "^5.0.0" electron-to-chromium@^1.4.668: - version "1.4.726" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.726.tgz#9ca95f19e9a0d63675e838b24681182203e40a30" - integrity sha512-xtjfBXn53RORwkbyKvDfTajtnTp0OJoPOIBzXvkNbb7+YYvCHJflba3L7Txyx/6Fov3ov2bGPr/n5MTixmPhdQ== + version "1.4.731" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.731.tgz#d3dc19f359045b750a1fb0bc42315a502d950187" + integrity sha512-+TqVfZjpRz2V/5SPpmJxq9qK620SC5SqCnxQIOi7i/U08ZDcTpKbT7Xjj9FU5CbXTMUb4fywbIr8C7cGv4hcjw== emittery@^0.8.1: version "0.8.1" @@ -3335,6 +3347,14 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +tom-select@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/tom-select/-/tom-select-2.3.1.tgz#df338d9082874cd0bceb3bee87ed0184447c47f1" + integrity sha512-QS4vnOcB6StNGqX4sGboGXL2fkhBF2gIBB+8Hwv30FZXYPn0CyYO8kkdATRvwfCTThxiR4WcXwKJZ3cOmtI9eg== + dependencies: + "@orchidjs/sifter" "^1.0.3" + "@orchidjs/unicode-variants" "^1.0.4" + tough-cookie@^4.0.0: version "4.1.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf"