UNPKG

@etsoo/appscript

Version:

Applications shared TypeScript framework

62 lines (61 loc) 2.23 kB
import { DataTypes, IdType, ListType } from "@etsoo/shared"; import { CustomCultureData } from "../def/CustomCulture"; import { QueryRQ } from "../api/rq/QueryRQ"; /** * Business utils */ export declare namespace BusinessUtils { /** * Format avatar title * @param title Title * @param maxChars Max characters * @param defaultTitle Default title * @returns Result */ function formatAvatarTitle(title?: string, maxChars?: number, defaultTitle?: string): string; /** * Format query, dealing with paging data * @param rq Query * @returns Result */ function formatQuery<T extends IdType>(rq: QueryRQ<T>): { id?: T | undefined; ids?: T[] | undefined; excludedIds?: T[] | undefined; keyword?: string; queryPaging: import("..").QueryPagingData | undefined; }; /** * Get 12-month items * @param monthLabels Month labels * @param startMonth Start month, 0 as Jan. * @returns 12 months */ function getMonths(monthLabels: string[], startMonth?: number): ListType[]; /** * Check if the item is a custom culture data * @param item Item to check * @param hasOrgId Has orgId or not * @returns Result */ function isCustomCultureData(item: unknown, hasOrgId?: boolean): item is CustomCultureData; /** * Merge custom resources to target collection * @param target Target collection merges to * @param resources New resources to merge */ function mergeCustomResources(target: DataTypes.StringRecord, resources: CustomCultureData[]): void; /** * Restore resources to target collection * @param target Target collection to restore resources to, null to clear cache */ function restoreResources(target?: DataTypes.StringRecord): void; /** * Setup paging keysets * @param data Paging data * @param lastItem Last item of the query * @param idField Id field in data * @param fields Fields map */ function setupPagingKeysets<T, K extends IdType = number>(data: QueryRQ<K>, lastItem: T | undefined, idField: keyof T & string, fields?: Record<string, string | null | undefined>): QueryRQ<K>; }