/* * MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved. * Email: mythpe@gmail.com * Mobile: +966590470092 * Website: https://www.4myth.com * Github: https://github.com/mythpe */ import { AxiosInstance } from 'axios' import { openURL, QBtnDropdownProps, QBtnProps, QCardProps, QDialogOptions, QDialogProps, QFieldProps, QIconProps, QInfiniteScroll, QItemLabelProps, QItemProps, QItemSectionProps, QListProps, QMenuProps, QNotifyCreateOptions, QPageStickyProps, QPopupProxyProps, QTooltipProps } from 'quasar' import { MAvatarViewerProps, MBlockProps, MBtnProps, MCardProps, MCheckboxProps, MCkeditorProps, MColProps, MColumnProps, MContainerProps, MDatatableProps, MDateProps, MDraggableProps, MDtBtnProps, MEditorProps, MFileProps, MHelpRowProps, MInputProps, MModalMenuProps, MNoResultImgProps, MOptionsProps, MOtpProps, MPickerProps, MRadioProps, MRowProps, MSelectProps, MSignaturePadProps, MTimeProps, MToggleProps, MTypingStringProps, MUploaderProps } from '../components' import { I18n } from 'vue-i18n' import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue' import { RouteLocationNormalizedLoaded } from 'vue-router' import { ApiErrorResponse, ApiInterface, MDtColumn, MDtHeadersParameter, ParseHeaderOptions, Vue3MAlertMessage, Vue3MAlertMessageOptions, Vue3MConfirmMessage } from './m-helpers' import { Dates, Helpers, Str } from '../utils' import { ConfigType, MythApiServicesSchema } from './api-helpers' export interface MythOptionsConfig { /** * Rules keys that can be added to Input Rules as Vue Attr */ inputRules?: string[]; /** * Google Maps API key. */ google?: { apiKey: string; // eslint-disable-next-line no-undef mapsOptions?: google.maps.MapOptions; }; notify?: Partial; dialog?: Partial; confirmDialog?: Partial; confirmDialogOptions?: { buttons?: Partial; okProps?: Partial; cancelProps?: Partial; }; datatable?: Partial; /** * Styles for DataTable. */ dt?: { /** * Style of the DataTable. */ dense?: boolean; /** * Quasar loading with datatable loading props. */ useQuasarLoading?: boolean; /** * MModalMenu props. * Inside table top slot. * defaults: no-close-btn & persistent & position="top" */ filterDialogProps?: Partial & Partial & Partial; showDialogProps?: Partial; formDialogProps?: Partial; fabBtn?: { pageStickyProps?: Partial; offset?: QPageStickyProps['offset']; position?: QPageStickyProps['position']; buttonProps?: Partial; }, contextmenu?: { menu?: Partial; list?: Partial; btnStyle?: { showLabel?: boolean; updateColor?: string; showColor?: string; destroyColor?: string; } }, buttons?: { filter?: Partial; refresh?: Partial; more?: Partial; fullscreen?: Partial; moreMenu?: Partial; moreList?: Partial; moreItem?: Partial; }, topSelection?: { btn?: Partial; }, searchInput?: { props?: Partial; optionsIcon?: string; menuProps?: Partial; menuBtn?: Partial; }; dialogButtonsProps?: Partial; listItem?: { item?: Partial; avatarSection?: Partial; icon?: Partial; labelSection?: Partial; labelItem?: Partial; }; btn?: Partial; /** * Dropdown of control column in table. * q-btn-dropdown */ controlDropdown?: Partial; MDtBtn?: { /** * List mode Props. */ item?: { /** * Item Props. */ props?: Partial; /** * q-item-section. * Props of avatar section. */ avatarProps?: Partial; /** * q-icon. * Props of icon inside avatar section. */ iconProps?: Partial; /** * q-item-section. * Props of label section. */ labelSectionProps?: Partial; /** * q-item-label. * Props of label inside label section. */ itemLabelProps?: Partial; }; /** * MDtBtn btn mode Props. */ btn?: { props?: Partial; }; } }; button?: Partial; loadingButtons?: { elm?: undefined | 'audio' | 'ball' | 'bars' | 'box' | 'clock' | 'comment' | 'cube' | 'dots' | 'facebook' | 'gears' | 'grid' | 'hearts' | 'hourglass' | 'infinity' | 'ios' | 'orbit' | 'oval' | 'pie' | 'puff' | 'radio' | 'rings' | 'tail' color?: string | undefined; size?: string | undefined; }; input?: Partial; avatarViewer?: Partial; options?: Partial; mobile?: Partial; field?: Partial; file?: Partial; picker?: Partial; pickerBtn?: Partial; date?: Partial; time?: Partial; select?: Partial; signaturePad?: Partial; checkbox?: Partial; editor?: Partial; ckeditor?: Partial; radio?: Partial; toggle?: Partial; uploader?: Partial; uploaderOptions?: { downloadBtnProps?: Partial; removeBtnProps?: Partial; iconsSize?: MUploaderProps['iconsSize']; }; container?: Partial; row?: Partial; col?: Partial; column?: Partial; draggable?: Partial; noResultImg?: Partial; modalMenu?: Partial; modalMenuOptions?: { card?: Partial; closeBtn?: Partial; }; tooltip?: Partial; otp?: Partial; card?: Partial; block?: Partial; typingString?: Partial>; helpRow?: Partial>; helpRowIcon?: Partial; helpRowItem?: Partial; } export type MythApiAxiosType = Partial export type MythApiConfig = { baseUrl: string; axios: MythApiAxiosType; services: MythApiServicesSchema } export type MythI18nType = I18n; export type UseMythVue = { i18n: MythI18nType; baseUrl: string; axios: MythApiAxiosType; services: MythApiServicesSchema; options: MythOptionsConfig; str: typeof Str, dates: typeof Dates, helpers: typeof Helpers, tools: { isSmall: ComputedRef; popupBreakpoint: ComputedRef; transitions: { slideLeftFade: { hide: ComputedRef; show: ComputedRef; }, slideRightFade: { hide: ComputedRef; show: ComputedRef; }, slideDownFade: { hide: ComputedRef; show: ComputedRef; }, slideUpFade: { hide: ComputedRef; show: ComputedRef; }, } }, getPageTitle (route: RouteLocationNormalizedLoaded, number?: number | string): string; parseHeaders (headers: MDtHeadersParameter, options?: ParseHeaderOptions): MDtColumn[]; __ (string: string | { text: string } | any, ...args: any[]): string; copyText (text: string | any): Promise; quasarNotifyOptions (opts: QNotifyCreateOptions | string): QNotifyCreateOptions; alertMessage (opts: Vue3MAlertMessageOptions): Vue3MAlertMessage; alertSuccess (message: string): Vue3MAlertMessage; alertError (message: string): Vue3MAlertMessage; confirmMessage (message?: string, title?: string, opts?: QDialogOptions): Vue3MConfirmMessage; [key: string]: any; } export type InstallPluginOptions = { i18n: MythI18nType; api: MythApiConfig; options: MythOptionsConfig; } export type UseModelMethod = string | ((id: any, config?: ConfigType | undefined) => Promise); export type UseModelsMethod = string | ((config?: ConfigType | undefined) => Promise); export type UseModelsOptionsArg = { lazy?: boolean; search?: ComputedRef | Ref; filter?: ComputedRef> | Ref>; isPanel?: boolean | MaybeRefOrGetter; method?: UseModelMethod | UseModelsMethod; timeout?: number; qInfiniteScroll?: Ref | null>; onSuccess?: (data: ApiInterface) => void; onError?: (e: ApiErrorResponse) => void; } declare module '@vue/runtime-core' { interface ComponentCustomProperties { $myth: UseMythVue; openWindow: InstanceType; __: UseMythVue['__'] getPageTitle (number?: number | string, route?: RouteLocationNormalizedLoaded): string; } }