diff --git a/quasar.conf.js b/quasar.conf.js index 8183b7e..3e42cce 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -13,9 +13,9 @@ const extendTypescriptToWebpack = (config) => { config.resolve .alias .set('@components', path.resolve(__dirname, 'src/components/index.ts')) - .set('@components', path.resolve(__dirname, 'src/components')) + // .set('@components', path.resolve(__dirname, 'src/components')) .set('@views', path.resolve(__dirname, 'src/components/views/index.ts')) - .set('@views', path.resolve(__dirname, 'src/components/views')) + // .set('@views', path.resolve(__dirname, 'src/components/views')) .set('@src', path.resolve(__dirname, 'src')) .set('@icons', path.resolve(__dirname, 'src/assets/icons')) .set('@images', path.resolve(__dirname, 'src/assets/images')) @@ -149,13 +149,17 @@ module.exports = function (ctx) { 'QDatetime', 'QSlideTransition', 'QTable', + 'QContextMenu', + 'QProgress', + 'QSlider', ], directives: [ 'Ripple', - 'CloseOverlay' + 'CloseOverlay', ], // Quasar plugins plugins: [ + 'Dialog', 'Notify', 'Meta', 'Cookies', diff --git a/src/classes/debounce.ts b/src/classes/debounce.ts new file mode 100644 index 0000000..54680aa --- /dev/null +++ b/src/classes/debounce.ts @@ -0,0 +1,42 @@ + +/** + * A function that emits a side effect and does not return anything. + */ +export type Procedure = (...args: any[]) => void + +export type Options = { + isImmediate: boolean +} + +export function debounce( + func: F, + waitMilliseconds: number = 50, + options: Options = { + isImmediate: false + } +): F { + let timeoutId: NodeJS.Timeout | undefined + + return function(this: any, ...args: any[]) { + const context = this + + const doLater = function() { + timeoutId = undefined + if (!options.isImmediate) { + func.apply(context, args) + } + } + + const shouldCallNow = options.isImmediate && timeoutId === undefined + + if (timeoutId !== undefined) { + clearTimeout(timeoutId) + } + + timeoutId = setTimeout(doLater, waitMilliseconds) + + if (shouldCallNow) { + func.apply(context, args) + } + } as any +} diff --git a/src/classes/routinestd.ts b/src/classes/routinestd.ts new file mode 100644 index 0000000..bfa4b91 --- /dev/null +++ b/src/classes/routinestd.ts @@ -0,0 +1,18 @@ +export async function askConfirm($q: any, mytitle, mytext, ok, cancel) { + try { + return await $q.dialog({ + title: mytitle, + message: mytext, + ok: ok, + cancel: cancel + }).then((ris) => { + return true + // this.$q.notify('Agreed!') + }).catch(() => { + return false + // this.$q.notify('Disagreed...') + }) + } catch (e) { + return false + } +} diff --git a/src/components/Header.vue b/src/components/Header.vue index 1447da4..db65f37 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -1,6 +1,13 @@