From 82e31d4dcf2e84f07268b3ef9cb28833a18e639b Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 4 Mar 2024 10:18:28 +0100 Subject: [PATCH 1/6] refs #6911 feat: setDefaults --- quasar.config.js | 3 ++- src/boot/setDefaults.js | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/boot/setDefaults.js diff --git a/quasar.config.js b/quasar.config.js index 755e96bd3..3e98e3618 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -29,7 +29,8 @@ module.exports = configure(function (/* ctx */) { // app boot file (/src/boot) // --> boot files are part of "main.js" // https://v2.quasar.dev/quasar-cli/boot-files - boot: ['i18n', 'axios', 'vnDate', 'validations'], + // + boot: ['i18n', 'axios', 'vnDate','quasar','setDefaults', 'validations'], // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css css: ['app.scss'], diff --git a/src/boot/setDefaults.js b/src/boot/setDefaults.js new file mode 100644 index 000000000..d54baa63e --- /dev/null +++ b/src/boot/setDefaults.js @@ -0,0 +1,41 @@ +import { QInput, QSelect } from "quasar"; +import { QTable} from "quasar"; +const setDefault = (component, key, value) => { + const prop = component.props[key]; + switch (typeof prop) { + case "object": + prop.default = value; + break; + case "function": + component.props[key] = { + type: prop, + default: value + }; + break; + case "undefined": + throw new Error("unknown prop: " + key); + default: + throw new Error("unhandled type: " + typeof prop); + } + }; + +QInput.props.outlined = { + type: QInput.props.outlined, + default: true +}; +QInput.props.dense = { + type: QInput.props.dense, + default: true +}; +QInput.props.stackLabel = { + type: QInput.props.stackLabel, + default: true +}; + +setDefault(QInput, "outlined", false); +setDefault(QTable, "gridHeader", true); +setDefault(QTable, "color", 'red-8'); +setDefault(QTable, "pagination", { rowsPerPage: 25 }); +setDefault(QTable, "rowKey", 'id'); +setDefault(QSelect,'optionValue','id'); +setDefault(QSelect,'optionLabel','name'); From 901c8c8f71ea4f5f0e04cdc261a987a684948fa7 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 4 Mar 2024 10:23:45 +0100 Subject: [PATCH 2/6] refs #6911 feat: qFormMixin keyup.enter --- src/boot/qformMixin.js | 20 ++++++++++++++++++++ src/boot/quasar.js | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 src/boot/qformMixin.js create mode 100644 src/boot/quasar.js diff --git a/src/boot/qformMixin.js b/src/boot/qformMixin.js new file mode 100644 index 000000000..daca84eef --- /dev/null +++ b/src/boot/qformMixin.js @@ -0,0 +1,20 @@ +import { QTable, QForm } from 'quasar'; + +export default { + inject: { QForm }, + component: { QForm }, + components: { QForm }, + extends: { QForm }, + mounted: function () { + if (this.$el?.classList?.contains('q-form')) + if (this.$el?.id !== 'searchbarForm') { + let that = this; + + document.addEventListener('keyup', function (evt) { + if (evt.keyCode === 13) { + that.onSubmit(); + } + }); + } + }, +}; diff --git a/src/boot/quasar.js b/src/boot/quasar.js new file mode 100644 index 000000000..a8d9b7ad9 --- /dev/null +++ b/src/boot/quasar.js @@ -0,0 +1,6 @@ +import { boot } from 'quasar/wrappers'; +import qFormMixin from './qformMixin'; + +export default boot(({ app }) => { + app.mixin(qFormMixin); +}); From 628d5453a8903005e5f0e2585c9ae41e313784c7 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 4 Mar 2024 11:14:36 +0100 Subject: [PATCH 3/6] refs #6911 feat: remove keyup.eneter=submit for each form --- src/components/FormModel.vue | 1 - src/pages/Claim/ClaimRmaList.vue | 2 +- .../Customer/Defaulter/CustomerDefaulterAddObservation.vue | 2 +- src/pages/Login/LoginMain.vue | 6 +----- src/pages/Login/TwoFactor.vue | 6 +----- src/pages/Travel/Card/TravelThermographsForm.vue | 1 - src/pages/Wagon/Type/WagonTypeCreate.vue | 7 +------ src/pages/Wagon/WagonCreate.vue | 7 +------ 8 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index e3f87020c..9f5ae319c 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -211,7 +211,6 @@ watch(formUrl, async () => { - + { - +
{{ t('Add observation to all selected clients', { diff --git a/src/pages/Login/LoginMain.vue b/src/pages/Login/LoginMain.vue index bf5968781..e2ccdac16 100644 --- a/src/pages/Login/LoginMain.vue +++ b/src/pages/Login/LoginMain.vue @@ -67,11 +67,7 @@ async function onSubmit() {