chore/ts dep compat (#535)
* chore: ensures typescript dependency compatibility * chore: updates dependencies * chore: updates window-info breakpoints
This commit is contained in:
@@ -16,4 +16,5 @@ export type RenderedTypeProps = {
|
||||
className?: string
|
||||
onClick?: onClick
|
||||
to: string
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ export type Props = {
|
||||
}
|
||||
|
||||
export type RenderedTypeProps = {
|
||||
children: React.ReactNode
|
||||
className?: string,
|
||||
to: string,
|
||||
onClick?: () => void,
|
||||
|
||||
@@ -155,7 +155,6 @@ const Popup: React.FC<Props> = (props) => {
|
||||
className={`${baseClass}__wrap`}
|
||||
// TODO: color ::after with bg color
|
||||
>
|
||||
|
||||
<div
|
||||
className={`${baseClass}__scroll`}
|
||||
style={{
|
||||
|
||||
@@ -2,7 +2,7 @@ import { CSSProperties } from 'react';
|
||||
|
||||
export type Props = {
|
||||
className?: string
|
||||
render?: (any) => void,
|
||||
render?: (any) => React.ReactNode,
|
||||
children?: React.ReactNode,
|
||||
verticalAlign?: 'top' | 'bottom'
|
||||
horizontalAlign?: 'left' | 'center' | 'right',
|
||||
|
||||
@@ -32,7 +32,7 @@ const UploadCard: React.FC<Props> = (props) => {
|
||||
collection={collection}
|
||||
/>
|
||||
<div className={`${baseClass}__filename`}>
|
||||
{doc?.filename}
|
||||
{typeof doc?.filename === 'string' ? doc?.filename : '[Untitled]'}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useReducer, useState, useCallback, useEffect } from 'react';
|
||||
import { useConfig } from '@payloadcms/config-provider';
|
||||
import { Props, Option, ValueWithRelation } from './types';
|
||||
import { Props, Option, ValueWithRelation, GetResults } from './types';
|
||||
import optionsReducer from './optionsReducer';
|
||||
import useDebounce from '../../../../../hooks/useDebounce';
|
||||
import ReactSelect from '../../../ReactSelect';
|
||||
@@ -38,7 +38,7 @@ const RelationshipField: React.FC<Props> = (props) => {
|
||||
dispatchOptions({ type: 'ADD', data, relation, hasMultipleRelations, collection });
|
||||
}, [collections, hasMultipleRelations]);
|
||||
|
||||
const getResults = useCallback(async ({
|
||||
const getResults = useCallback<GetResults>(async ({
|
||||
lastFullyLoadedRelation: lastFullyLoadedRelationArg,
|
||||
lastLoadedPage: lastLoadedPageArg,
|
||||
search: searchArg,
|
||||
|
||||
@@ -33,3 +33,5 @@ export type ValueWithRelation = {
|
||||
relationTo: string
|
||||
value: string
|
||||
}
|
||||
|
||||
export type GetResults = (args: { lastFullyLoadedRelation?: number, lastLoadedPage?: number, search?: string }) => Promise<void>
|
||||
|
||||
@@ -20,7 +20,7 @@ import wait from '../../../../utilities/wait';
|
||||
import { Field } from '../../../../fields/config/types';
|
||||
import buildInitialState from './buildInitialState';
|
||||
import errorMessages from './errorMessages';
|
||||
import { Context as FormContextType, Props, SubmitOptions } from './types';
|
||||
import { Context as FormContextType, GetDataByPath, Props, SubmitOptions } from './types';
|
||||
import { SubmittedContext, ProcessingContext, ModifiedContext, FormContext, FormWatchContext } from './context';
|
||||
import buildStateFromSchema from './buildStateFromSchema';
|
||||
import { useOperation } from '../../utilities/OperationProvider';
|
||||
@@ -298,7 +298,7 @@ const Form: React.FC<Props> = (props) => {
|
||||
const getField = useCallback((path: string) => contextRef.current.fields[path], [contextRef]);
|
||||
const getData = useCallback(() => reduceFieldsToValues(contextRef.current.fields, true), [contextRef]);
|
||||
const getSiblingData = useCallback((path: string) => getSiblingDataFunc(contextRef.current.fields, path), [contextRef]);
|
||||
const getDataByPath = useCallback((path: string) => getDataByPathFunc(contextRef.current.fields, path), [contextRef]);
|
||||
const getDataByPath = useCallback<GetDataByPath>((path: string) => getDataByPathFunc(contextRef.current.fields, path), [contextRef]);
|
||||
const getUnflattenedValues = useCallback(() => reduceFieldsToValues(contextRef.current.fields), [contextRef]);
|
||||
|
||||
const createFormData = useCallback((overrides: any = {}) => {
|
||||
|
||||
@@ -8,6 +8,7 @@ import RenderFields from '../../../RenderFields';
|
||||
import FormSubmit from '../../../Submit';
|
||||
import Upload from '../../../../views/collections/Edit/Upload';
|
||||
import { NegativeFieldGutterProvider } from '../../../FieldTypeGutter/context';
|
||||
import ViewDescription from '../../../../elements/ViewDescription';
|
||||
import { Props } from './types';
|
||||
|
||||
import './index.scss';
|
||||
@@ -72,7 +73,9 @@ const AddUploadModal: React.FC<Props> = (props) => {
|
||||
/>
|
||||
</div>
|
||||
{description && (
|
||||
<div className={`${baseClass}__sub-header`}>{description}</div>
|
||||
<div className={`${baseClass}__sub-header`}>
|
||||
<ViewDescription description={description} />
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
<Upload
|
||||
|
||||
@@ -12,11 +12,12 @@ import UploadGallery from '../../../../elements/UploadGallery';
|
||||
import { Props } from './types';
|
||||
import PerPage from '../../../../elements/PerPage';
|
||||
import formatFields from '../../../../views/collections/List/formatFields';
|
||||
|
||||
import './index.scss';
|
||||
import { getFilterOptionsQuery } from '../../getFilterOptionsQuery';
|
||||
import { useDocumentInfo } from '../../../../utilities/DocumentInfo';
|
||||
import { useWatchForm } from '../../../Form/context';
|
||||
import ViewDescription from '../../../../elements/ViewDescription';
|
||||
|
||||
import './index.scss';
|
||||
|
||||
const baseClass = 'select-existing-upload-modal';
|
||||
|
||||
@@ -117,7 +118,9 @@ const SelectExistingUploadModal: React.FC<Props> = (props) => {
|
||||
/>
|
||||
</div>
|
||||
{description && (
|
||||
<div className={`${baseClass}__sub-header`}>{description}</div>
|
||||
<div className={`${baseClass}__sub-header`}>
|
||||
<ViewDescription description={description} />
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
<ListControls
|
||||
|
||||
@@ -33,7 +33,7 @@ const CompareVersion: React.FC<Props> = (props) => {
|
||||
|
||||
const getResults = useCallback(async ({
|
||||
lastLoadedPage: lastLoadedPageArg,
|
||||
} = {}) => {
|
||||
}) => {
|
||||
const query: {
|
||||
[key: string]: unknown
|
||||
where: Where
|
||||
|
||||
@@ -20,7 +20,7 @@ const DefaultCell: React.FC<Props> = (props) => {
|
||||
|
||||
const { routes: { admin } } = useConfig();
|
||||
|
||||
let WrapElement: React.ComponentType | string = 'span';
|
||||
let WrapElement: React.ComponentType<any> | string = 'span';
|
||||
|
||||
const wrapElementProps: {
|
||||
to?: string
|
||||
|
||||
@@ -22,10 +22,10 @@ const Index = () => (
|
||||
<React.Fragment>
|
||||
<ConfigProvider config={config}>
|
||||
<WindowInfoProvider breakpoints={{
|
||||
xs: 400,
|
||||
s: 768,
|
||||
m: 1024,
|
||||
l: 1440,
|
||||
xs: '(max-width: 400px)',
|
||||
s: '(max-width: 768px)',
|
||||
m: '(max-width: 1024px)',
|
||||
l: '(max-width: 1440px)',
|
||||
}}
|
||||
>
|
||||
<ScrollInfoProvider>
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { DeepRequired } from 'ts-essentials';
|
||||
import { PaginateModel, PassportLocalModel } from 'mongoose';
|
||||
import { PaginateModel } from 'mongoose';
|
||||
import { GraphQLType } from 'graphql';
|
||||
import { Access, GeneratePreviewURL } from '../../config/types';
|
||||
import { Access, GeneratePreviewURL, EntityDescription } from '../../config/types';
|
||||
import { Field } from '../../fields/config/types';
|
||||
import { PayloadRequest } from '../../express/types';
|
||||
import { IncomingAuthType, Auth } from '../../auth/types';
|
||||
import { IncomingUploadType, Upload } from '../../uploads/types';
|
||||
import { IncomingCollectionVersions, SanitizedCollectionVersions } from '../../versions/types';
|
||||
|
||||
export interface CollectionModel extends PaginateModel<any>, PassportLocalModel<any> {
|
||||
type Register<T = any> = (doc: T, password: string) => T;
|
||||
|
||||
interface PassportLocalModel {
|
||||
register: Register
|
||||
authenticate: any
|
||||
}
|
||||
|
||||
export interface CollectionModel extends PaginateModel<any>, PassportLocalModel {
|
||||
buildQuery: (query: unknown, locale?: string) => Record<string, unknown>
|
||||
}
|
||||
|
||||
@@ -128,7 +135,7 @@ export type CollectionAdminOptions = {
|
||||
/**
|
||||
* Custom description for collection
|
||||
*/
|
||||
description?: string | (() => string) | React.FC;
|
||||
description?: EntityDescription;
|
||||
disableDuplicate?: boolean;
|
||||
/**
|
||||
* Hide the API URL within the Edit view
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Options } from 'express-fileupload';
|
||||
import { Configuration } from 'webpack';
|
||||
import SMTPConnection from 'nodemailer/lib/smtp-connection';
|
||||
import GraphQL from 'graphql';
|
||||
import { ConnectionOptions } from 'mongoose';
|
||||
import { ConnectOptions } from 'mongoose';
|
||||
import React from 'react';
|
||||
import { LoggerOptions } from 'pino';
|
||||
import { Payload } from '..';
|
||||
@@ -63,7 +63,7 @@ export function hasTransportOptions(emailConfig: EmailOptions): emailConfig is E
|
||||
export type InitOptions = {
|
||||
express?: Express;
|
||||
mongoURL: string;
|
||||
mongoOptions?: ConnectionOptions;
|
||||
mongoOptions?: ConnectOptions;
|
||||
secret: string;
|
||||
license?: string;
|
||||
email?: EmailOptions;
|
||||
@@ -187,3 +187,5 @@ export type SanitizedConfig = Omit<DeepRequired<Config>, 'collections' | 'global
|
||||
globals: SanitizedGlobalConfig[]
|
||||
paths: { [key: string]: string };
|
||||
}
|
||||
|
||||
export type EntityDescription = string | (() => string) | React.ComponentType
|
||||
|
||||
@@ -181,9 +181,9 @@ export type UIField = {
|
||||
width?: string
|
||||
condition?: Condition
|
||||
components?: {
|
||||
Filter?: React.ComponentType;
|
||||
Cell?: React.ComponentType;
|
||||
Field: React.ComponentType;
|
||||
Filter?: React.ComponentType<any>;
|
||||
Cell?: React.ComponentType<any>;
|
||||
Field: React.ComponentType<any>;
|
||||
}
|
||||
}
|
||||
type: 'ui';
|
||||
|
||||
Reference in New Issue
Block a user