This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { gql } from "@apollo/client/core"; | |
import { useQuery } from "@vue/apollo-composable"; | |
import { computed, ComputedRef, Ref } from "vue"; | |
export interface ApolloResult<Model> { | |
// This key is usually the name of the query | |
[key: string]: Model | undefined; | |
} | |
type ApolloResultRef<Model> = Ref<ApolloResult<Model> | undefined>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AxiosResponse } from 'axios'; | |
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |
const createResponseStub: <T = any>(data?: T) => AxiosResponse = (data) => ({ | |
config: {}, | |
data, | |
status: 200, | |
statusText: '', | |
headers: {}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface MyEntity { | |
id?: number; | |
title: string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
addEscapeKey, | |
removeEscapeKey, | |
} from 'quasar/src/utils/private/escape-key.js'; | |
import { onMounted, onUnmounted } from 'vue'; | |
// Quasar doesn't offer a way to hook into the esc handler from inside the dialog component itself, | |
// so we have to do it ourselves | |
// This requires the QDialog to have `no-esc-dismiss` and `no-shake` (purely aesthetic) prop enabled | |
export function useDialogEscapeKey( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { QDialog } from 'quasar'; | |
import { computed, Ref, watch } from 'vue'; | |
// Quasar doesn't offer a way to hook into the backdrop click event from inside the dialog component itself, | |
// so we have to do it ourselves and prevent the default handler from Quasar from firing | |
export function useDialogBackdropClick( | |
dialogRef: Ref<QDialog | undefined>, | |
handler: (event: FocusEvent) => void | Promise<void>, | |
) { | |
// Apparently retrieving `document.querySelector('.q-dialog__backdrop')` on onMounted doesn't work, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { spawn } from "node:child_process"; | |
export type SupportedPackageManager = "npm" | "yarn" | "pnpm"; | |
export const ACCEPT_DEFAULT = "ACCEPT_DEFAULT"; | |
export const ENTER_KEY = "\n"; | |
export const WHITESPACE_KEY = " "; | |
// Octals literals are banned into ESM | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_octal#octal_escape_sequences | |
export const DOWN_KEY = "\u001b[B"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 'src/css/_color-additions.scss' | |
// import at the end of `src/css/quasar.variables.scss` as `@import 'color.additions';` | |
$white: #fff; | |
$black: #000; | |
// There must be at least 2 colors here, or it won't be taken as a list and the following code won't work | |
$additional-colors: ( | |
'custom-color1' $custom-color1, | |
'custom-color2' $custom-color2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { isEmpty } from 'lodash-es'; | |
import { useI18n } from 'src/boot/i18n'; | |
const { t } = useI18n(); | |
/** | |
* Validation rule which returns true if the value is considered "not empty", | |
* or an error message otherwise. | |
*/ | |
export function required<T>(value: T) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios, { | |
AxiosError, | |
AxiosRequestConfig, | |
AxiosResponse, | |
Method, | |
} from 'axios'; | |
import { | |
QUploaderFactoryFn, | |
QUploaderFactoryObject, | |
ValueOrFunction, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { App, InjectionKey } from 'vue'; | |
/** | |
* Inject a service using Vue app reference and the injection key. | |
* Use this to inject a service when outside a component scope (eg. into a Quasar boot file), | |
* where Vue `inject` won't work. | |
* This is expecially useful when the data is provided from a third-party package | |
* which only expose the injection key. | |
* | |
* @example |
NewerOlder