@topthink/components 1.0.22 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/utils/message.ts","../src/utils/toast.tsx","../src/components/result.tsx","../src/components/dimmer.tsx","../src/components/loader.tsx","../src/components/card.tsx","../src/components/error.tsx","../src/components/space.tsx","../src/images/step_check.svg","../src/components/steps.tsx","../src/components/pagination.tsx","../src/components/number-format.tsx","../src/components/loading-button.tsx","../src/components/tooltip.tsx","../src/components/table/context.ts","../src/components/button.tsx","../src/errors/unauthorized.ts","../src/request.ts","../src/components/request-button.tsx","../src/components/form.tsx","../src/components/table/use-selection.tsx","../src/images/plus_square.svg","../src/images/minus_square.svg","../src/hooks/use-callback-ref.ts","../src/hooks/use-controllable-state.ts","../src/hooks/use-debounce.ts","../src/components/table/search.tsx","../src/components/table/index.tsx","../src/hooks/use-overlay-state.ts","../src/components/modal.tsx","../src/components/modal-button.tsx","../src/components/modal-form.tsx","../src/hooks/use-request.ts"],"sourcesContent":["import Swal from 'sweetalert2/dist/sweetalert2.js';\r\nimport withReactContent from 'sweetalert2-react-content';\r\nimport { SweetAlertOptions, SweetAlertResult } from 'sweetalert2';\r\n\r\nconst CustomSwal = withReactContent(Swal);\r\n\r\ninterface MessageOptions<T = any> extends SweetAlertOptions<T> {\r\n\r\n}\r\n\r\nconst defaultOptions = {\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消'\r\n};\r\n\r\nconst Message = {\r\n confirm: async <T = any>(options: MessageOptions<T>) => {\r\n const { isConfirmed } = await CustomSwal.fire({\r\n ...defaultOptions,\r\n icon: 'warning',\r\n showCancelButton: true,\r\n ...options,\r\n async preConfirm(data) {\r\n if (options.preConfirm) {\r\n try {\r\n return await options.preConfirm(data);\r\n } catch (e) {\r\n if (e instanceof Error) {\r\n CustomSwal.showValidationMessage(e.message);\r\n }\r\n return false;\r\n }\r\n }\r\n return true;\r\n },\r\n });\r\n\r\n return isConfirmed;\r\n },\r\n success: (options: MessageOptions) => {\r\n CustomSwal.fire({\r\n ...defaultOptions,\r\n toast: true,\r\n position: 'top',\r\n icon: 'success',\r\n timer: 2000,\r\n showConfirmButton: false,\r\n ...options\r\n });\r\n },\r\n error: (options: MessageOptions) => {\r\n CustomSwal.fire({\r\n ...defaultOptions,\r\n toast: true,\r\n position: 'top',\r\n icon: 'error',\r\n timer: 5000,\r\n showConfirmButton: false,\r\n ...options\r\n });\r\n },\r\n close: (result?: SweetAlertResult) => {\r\n CustomSwal.close(result);\r\n }\r\n};\r\n\r\nexport default Message;\r\n","import { Alert } from 'react-bootstrap';\r\nimport { NoticeContent, NotificationInstance } from 'rc-notification/lib/Notification';\r\nimport Notification from 'rc-notification';\r\n\r\nlet noticeInstance: NotificationInstance | null;\r\n\r\nfunction getNoticeInstance(callback: (instance: NotificationInstance) => void) {\r\n if (noticeInstance) {\r\n return callback(noticeInstance);\r\n }\r\n\r\n Notification.newInstance({\r\n prefixCls: 'notification',\r\n maxCount: 5,\r\n style: {\r\n top: 20,\r\n right: 20\r\n }\r\n }, (instance) => {\r\n if (noticeInstance) {\r\n callback(noticeInstance);\r\n return;\r\n }\r\n noticeInstance = instance;\r\n callback(instance);\r\n });\r\n}\r\n\r\nconst types = ['error', 'success', 'info'];\r\n\r\nconst notice = ({ type, ...options }: { type: string } & NoticeContent) => {\r\n getNoticeInstance((instance) => {\r\n options.duration = 3;\r\n let variant = type;\r\n switch (type) {\r\n case 'error':\r\n variant = 'danger';\r\n options.duration = options.closable ? 0 : 5;\r\n break;\r\n }\r\n\r\n options.content = <Alert variant={variant}>{options.content}</Alert>;\r\n\r\n instance.notice(options);\r\n });\r\n};\r\n\r\n\r\nlet Toast: {\r\n [index in typeof types[number]]: (content: string, options?: NoticeContent) => void\r\n} = {};\r\n\r\ntypes.forEach((type) => {\r\n Toast[type] = (content, options) => {\r\n notice({\r\n ...options,\r\n type,\r\n content\r\n });\r\n };\r\n});\r\n\r\nexport default Toast;\r\n","import { ReactNode } from 'react';\r\nimport styled from 'styled-components';\r\n\r\nconst Container = styled.div`\r\n padding: 48px 32px;\r\n`;\r\n\r\nconst Icon = styled.div`\r\n margin-bottom: 24px;\r\n text-align: center;\r\n font-size: 72px;\r\n`;\r\n\r\nconst Title = styled.div`\r\n color: rgba(0, 0, 0, .85);\r\n font-size: 24px;\r\n line-height: 1.8;\r\n text-align: center;\r\n`;\r\n\r\nconst Extra = styled.div`\r\n margin-top: 32px;\r\n text-align: center;\r\n`;\r\n\r\nconst IconMap = {\r\n success: <i className='bi bi-check-circle-fill text-success' />,\r\n error: <i className='bi bi-exclamation-circle-fill text-danger' />,\r\n info: <i className='bi bi-info-circle-fill text-info' />,\r\n warning: <i className='bi bi-exclamation-triangle-fill text-warning' />,\r\n};\r\n\r\ninterface ResultProps {\r\n status?: keyof typeof IconMap\r\n icon?: ReactNode\r\n title?: string\r\n extra?: ReactNode;\r\n}\r\n\r\nexport default function Result({ status, title, icon, extra }: ResultProps) {\r\n\r\n if (!icon && status) {\r\n icon = IconMap[status];\r\n }\r\n\r\n return <Container>\r\n {icon && <Icon>{icon}</Icon>}\r\n {title && <Title>{title}</Title>}\r\n {extra && <Extra>{extra}</Extra>}\r\n </Container>;\r\n}\r\n","import styled from 'styled-components';\r\n\r\nexport const Dimmable = styled.div`\r\n position: relative;\r\n`;\r\n\r\ninterface DimmerProps {\r\n active?: boolean\r\n inverted?: boolean\r\n}\r\n\r\nconst Dimmer = styled.div<DimmerProps>`\r\n display: ${props => props.active ? 'flex' : 'none'};\r\n position: absolute;\r\n top: 0 !important;\r\n left: 0 !important;\r\n width: 100%;\r\n height: 100%;\r\n text-align: center;\r\n vertical-align: middle;\r\n padding: 1em;\r\n background-color: ${props => props.inverted ? 'rgba(255, 255, 255, .85)' : 'rgba(0, 0, 0, .85)'};\r\n opacity: ${props => props.active ? 1 : 0};\r\n line-height: 1;\r\n animation-fill-mode: both;\r\n animation-duration: .5s;\r\n transition: background-color .5s linear;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n user-select: none;\r\n will-change: opacity;\r\n z-index: 990;\r\n`;\r\n\r\nexport default Dimmer;\r\n","import { PropsWithChildren } from 'react';\r\nimport { Spinner, SpinnerProps } from 'react-bootstrap';\r\nimport Dimmer from './dimmer';\r\nimport styled from 'styled-components';\r\n\r\ninterface LoaderProps {\r\n loading?: boolean;\r\n animation?: SpinnerProps['animation'];\r\n wrap?: boolean | number;\r\n}\r\n\r\nexport default function Loader({\r\n loading = true,\r\n children,\r\n variant = 'primary',\r\n animation = 'border',\r\n wrap,\r\n ...props\r\n}: PropsWithChildren<LoaderProps & Omit<SpinnerProps, 'animation'>>): JSX.Element | null {\r\n if (!loading) {\r\n return null;\r\n }\r\n\r\n if (children) {\r\n children = <p className='mt-3 text-secondary'>{children}</p>;\r\n }\r\n\r\n children = <Dimmer inverted active>\r\n <Spinner animation={animation} variant={variant} {...props} />\r\n {children}\r\n </Dimmer>;\r\n\r\n if (wrap) {\r\n return <Wrap $height={typeof wrap === 'number' ? wrap : 150}>\r\n {children}\r\n </Wrap>;\r\n }\r\n\r\n return children as JSX.Element;\r\n}\r\n\r\nconst Wrap = styled.div<{ $height: number }>`\r\n position: relative;\r\n height: ${props => `${props.$height}px`};\r\n`;\r\n","import { PropsWithChildren } from 'react';\r\nimport { Card as BsCard, CardProps as BsCardProps } from 'react-bootstrap';\r\nimport classNames from 'classnames';\r\n\r\ninterface CardProps extends BsCardProps {\r\n title?: string;\r\n}\r\n\r\nexport default function Card({ children, title, className, ...props }: PropsWithChildren<CardProps>) {\r\n\r\n return <BsCard className={classNames('border-0 shadow-sm mb-3', className)} {...props}>\r\n <div className='card-body'>\r\n {title && <>\r\n <h5>{title}</h5>\r\n <hr />\r\n </>}\r\n {children}\r\n </div>\r\n </BsCard>;\r\n}\r\n","import { Alert } from 'react-bootstrap';\r\nimport { Errors } from '../request';\r\n\r\nexport default function Error({ errors }: { errors?: Errors }) {\r\n if (!errors) {\r\n return null;\r\n }\r\n return <Alert variant='danger'>\r\n <ul className='mb-0'>\r\n {typeof errors === 'string'\r\n ? <li>{errors}</li>\r\n : Object.entries(errors).map(([name, error]) => <li key={name}>{error}</li>)\r\n }\r\n </ul>\r\n </Alert>;\r\n}\r\n","import { Children, ReactNode } from 'react';\r\nimport styled, { css } from 'styled-components';\r\n\r\ninterface SpaceProps {\r\n children: ReactNode;\r\n size?: 'small' | 'middle' | 'large' | number;\r\n direction?: 'vertical' | 'horizontal';\r\n className?: string;\r\n}\r\n\r\n\r\nexport default function Space({ children, className, size = 'small', direction = 'horizontal' }: SpaceProps) {\r\n\r\n if (typeof size === 'string') {\r\n size = {\r\n small: 8,\r\n middle: 16,\r\n large: 24\r\n }[size];\r\n }\r\n\r\n const items = Children.map(children, (child) => {\r\n if (child) {\r\n return <Item>{child}</Item>;\r\n }\r\n });\r\n\r\n return <Container className={className} $direction={direction} $size={size}>\r\n {items}\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.div<{ $size: number, $direction: string }>`\r\n display: inline-flex;\r\n align-items: center;\r\n gap: ${props => props.$size}px;\r\n\r\n ${props => props.$direction === 'vertical' && css`\r\n display: flex;\r\n flex-direction: column;\r\n align-items: inherit;\r\n `}\r\n`;\r\n\r\nconst Item = styled.div`\r\n\r\n`;\r\n","var img = \"data:image/svg+xml,%3csvg t='1651217947509' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='2548' width='16' height='16' fill='currentColor'%3e %3cpath d='M887.904 298.208c-12.864-12.064-33.152-11.488-45.216 1.408L415.936 753.984l-233.12-229.696C170.208 511.872 149.952 512 137.536 524.608c-12.416 12.576-12.256 32.864 0.352 45.248l256.48 252.672c0.096 0.096 0.224 0.128 0.32 0.224 0.096 0.096 0.128 0.224 0.224 0.32 2.016 1.92 4.448 3.008 6.784 4.288 1.152 0.672 2.144 1.664 3.36 2.144 3.776 1.472 7.776 2.24 11.744 2.24 4.192 0 8.384-0.832 12.288-2.496 1.312-0.544 2.336-1.664 3.552-2.368 2.4-1.408 4.896-2.592 6.944-4.672 0.096-0.096 0.128-0.256 0.224-0.352 0.064-0.096 0.192-0.128 0.288-0.224l449.184-478.208C901.44 330.592 900.768 310.336 887.904 298.208z' p-id='2549'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","import RcSteps from 'rc-steps';\r\nimport 'rc-steps/assets/index.css';\r\nimport styled from 'styled-components';\r\nimport { ComponentProps } from 'react';\r\nimport { ReactComponent as CheckIcon } from '../images/step_check.svg';\r\n\r\nexport default function Steps(props: ComponentProps<typeof RcSteps>) {\r\n return <CustomRcSteps\r\n icons={{\r\n finish: <CheckIcon />,\r\n error: <></>\r\n }}\r\n {...props}\r\n />;\r\n}\r\n\r\nSteps.Step = RcSteps.Step;\r\n\r\nconst CustomRcSteps = styled(RcSteps)`\r\n .rc-steps-item-icon {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n\r\n & > .rc-steps-icon {\r\n top: 0;\r\n }\r\n }\r\n\r\n .rc-steps-item-process {\r\n .rc-steps-item-icon {\r\n background: var(--bs-primary);\r\n border-color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-steps-item-finish {\r\n .rc-steps-item-icon {\r\n border-color: var(--bs-primary);\r\n\r\n & > .rc-steps-icon {\r\n color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-steps-item-title:after {\r\n background-color: var(--bs-primary);\r\n }\r\n }\r\n\r\n`;\r\n","import { ReactNode, useCallback, useEffect, useMemo, useState } from 'react';\r\nimport { Pagination as BsPagination } from 'react-bootstrap';\r\n\r\nfunction noop() {\r\n}\r\n\r\n\r\nfunction isInteger(value: any): value is number {\r\n return (\r\n typeof value === 'number' && isFinite(value) && Math.floor(value) === value\r\n );\r\n}\r\n\r\nexport interface PaginationProps {\r\n className?: string\r\n total: number\r\n current?: number\r\n defaultCurrent?: number\r\n pageSize?: number\r\n defaultPageSize?: number,\r\n onChange?: (current: number, pageSize: number) => void\r\n}\r\n\r\nexport default function Pagination({\r\n total = 0,\r\n onChange = noop,\r\n defaultCurrent = 1,\r\n defaultPageSize = 10,\r\n className,\r\n ...props\r\n}: PaginationProps) {\r\n\r\n const [current, setCurrent] = useState(defaultCurrent);\r\n const [pageSize, setPageSize] = useState(defaultPageSize);\r\n\r\n useEffect(() => {\r\n if (isInteger(props.current)) {\r\n setCurrent(props.current);\r\n }\r\n }, [props.current]);\r\n\r\n useEffect(() => {\r\n if (isInteger(props.pageSize)) {\r\n setPageSize(props.pageSize);\r\n }\r\n }, [props.pageSize]);\r\n\r\n const allPages = useMemo(() => {\r\n return Math.floor((total - 1) / pageSize) + 1;\r\n }, [total, pageSize]);\r\n\r\n const handleChange = useCallback((p: number) => {\r\n return () => {\r\n if (p !== current) {\r\n setCurrent(p);\r\n onChange(p, pageSize);\r\n }\r\n };\r\n }, [onChange, current, pageSize]);\r\n\r\n const pageBufferSize = 2;\r\n const prevPage = current - 1 > 0 ? current - 1 : 0;\r\n const nextPage = current + 1 < allPages ? current + 1 : allPages;\r\n\r\n const pagerList: ReactNode[] = [];\r\n let jumpPrev: ReactNode = null;\r\n let jumpNext: ReactNode = null;\r\n let firstPager: ReactNode = null;\r\n let lastPager: ReactNode = null;\r\n\r\n if (allPages <= 3 + pageBufferSize * 2) {\r\n for (let i = 1; i <= allPages; i += 1) {\r\n const active = current === i;\r\n pagerList.push(\r\n <BsPagination.Item key={i} active={active} onClick={handleChange(i)}>{i}</BsPagination.Item>\r\n );\r\n }\r\n } else {\r\n lastPager = <BsPagination.Last key='last' onClick={handleChange(allPages)} />;\r\n firstPager = <BsPagination.First key='first' onClick={handleChange(1)} />;\r\n jumpPrev = <BsPagination.Prev key='prev' onClick={handleChange(prevPage)} />;\r\n jumpNext = <BsPagination.Next key='next' onClick={handleChange(nextPage)} />;\r\n\r\n let left = Math.max(1, current - pageBufferSize);\r\n let right = Math.min(current + pageBufferSize, allPages);\r\n\r\n if (current - 1 <= pageBufferSize) {\r\n right = 1 + pageBufferSize * 2;\r\n }\r\n\r\n if (allPages - current <= pageBufferSize) {\r\n left = allPages - pageBufferSize * 2;\r\n }\r\n\r\n for (let i = left; i <= right; i += 1) {\r\n const active = current === i;\r\n pagerList.push(\r\n <BsPagination.Item key={i} active={active} onClick={handleChange(i)}>{i}</BsPagination.Item>\r\n );\r\n }\r\n\r\n if (current - 1 >= pageBufferSize * 2 && current !== 1 + 2) {\r\n pagerList.unshift(jumpPrev);\r\n }\r\n if (\r\n allPages - current >= pageBufferSize * 2 &&\r\n current !== allPages - 2\r\n ) {\r\n pagerList.push(jumpNext);\r\n }\r\n\r\n if (left !== 1) {\r\n pagerList.unshift(firstPager);\r\n }\r\n if (right !== allPages) {\r\n pagerList.push(lastPager);\r\n }\r\n }\r\n\r\n return <BsPagination className={className}>\r\n {pagerList}\r\n </BsPagination>;\r\n\r\n}\r\n","import { useMemo } from 'react';\r\n\r\ninterface Props {\r\n value: number;\r\n currency?: boolean;\r\n locale?: string;\r\n className?: string;\r\n options?: Intl.NumberFormatOptions;\r\n}\r\n\r\nexport default function NumberFormat({ className, value, locale = 'zh-CN', currency = true, options = {} }: Props) {\r\n\r\n const formatter = useMemo(() => {\r\n\r\n let opt;\r\n\r\n if (currency) {\r\n opt = {\r\n style: 'currency',\r\n currency: 'CNY'\r\n };\r\n } else {\r\n opt = {\r\n minimumFractionDigits: 2,\r\n };\r\n }\r\n\r\n return new Intl.NumberFormat(locale, { ...opt, ...options });\r\n }, [currency, locale, options]);\r\n\r\n if (className) {\r\n return <span className={className}>{formatter.format(value)}</span>;\r\n }\r\n\r\n return <>{formatter.format(value)}</>;\r\n}\r\n","import { Button, ButtonProps } from 'react-bootstrap';\r\n\r\ninterface CustomButtonProps extends ButtonProps {\r\n loading: boolean;\r\n}\r\n\r\nexport default function LoadingButton({ loading, disabled, children, ...props }: CustomButtonProps) {\r\n\r\n return <Button {...props} disabled={loading || disabled}>\r\n {loading ? 'Loading…' : children}\r\n </Button>;\r\n}\r\n","import { OverlayTrigger, OverlayTriggerProps, Tooltip as BsTooltip } from 'react-bootstrap';\r\nimport { uniqueId } from 'lodash';\r\n\r\ninterface TooltipProps {\r\n tooltip: string;\r\n children: OverlayTriggerProps['children'];\r\n placement?: OverlayTriggerProps['placement'];\r\n}\r\n\r\nexport default function Tooltip({ tooltip, children, placement = 'bottom' }: TooltipProps) {\r\n\r\n return <OverlayTrigger\r\n placement={placement}\r\n overlay={\r\n <BsTooltip id={uniqueId()}>\r\n {tooltip}\r\n </BsTooltip>\r\n }\r\n >\r\n {children}\r\n </OverlayTrigger>;\r\n}\r\n","import { createContext } from 'react';\r\n\r\nexport const TableContext = createContext(false);\r\n","import { Button as BsButton, ButtonProps as BsButtonProps, Spinner } from 'react-bootstrap';\r\nimport { forwardRef, useContext } from 'react';\r\nimport Tooltip from './tooltip';\r\nimport { TableContext } from './table/context';\r\n\r\nexport interface ButtonProps extends BsButtonProps {\r\n loading?: boolean;\r\n percent?: number;\r\n tooltip?: string;\r\n}\r\n\r\nconst Button = forwardRef<any, ButtonProps>((\r\n {\r\n loading,\r\n percent,\r\n disabled,\r\n children,\r\n tooltip,\r\n variant,\r\n ...props\r\n },\r\n ref\r\n) => {\r\n\r\n const inTable = useContext(TableContext);\r\n\r\n if (inTable && !variant) {\r\n variant = 'link';\r\n }\r\n\r\n if (loading) {\r\n disabled = true;\r\n children = <>\r\n <Spinner ref={ref} as='span' size='sm' role='status' aria-hidden='true' animation='border' />\r\n {percent ? <span className='ms-2'>{percent}%</span> : null}\r\n </>;\r\n }\r\n\r\n const button = <BsButton ref={ref} {...props} variant={variant} disabled={disabled}>{children}</BsButton>;\r\n\r\n if (tooltip) {\r\n return <Tooltip tooltip={tooltip}>\r\n <span className={'d-inline-block'}>{button}</span>\r\n </Tooltip>;\r\n }\r\n\r\n return button;\r\n});\r\n\r\nexport default Button;\r\n","export default class Unauthorized extends Error {\r\n\r\n url: string;\r\n\r\n constructor(url: string) {\r\n super('Unauthorized');\r\n this.url = url;\r\n }\r\n}\r\n","import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';\r\nimport queryString from 'query-string';\r\nimport * as rax from 'retry-axios';\r\nimport { RetryConfig } from 'retry-axios';\r\nimport Unauthorized from './errors/unauthorized';\r\nimport Toast from './utils/toast';\r\nimport Message from './utils/message';\r\n\r\nexport type Errors = string | {\r\n [key: string]: string\r\n}\r\n\r\ndeclare module 'retry-axios' {\r\n interface RetryConfig {\r\n retryDecider?: () => boolean;\r\n }\r\n}\r\n\r\ndeclare module 'axios' {\r\n interface AxiosError {\r\n errors: Errors;\r\n }\r\n\r\n interface AxiosRequestConfig {\r\n raxConfig?: RetryConfig;\r\n }\r\n}\r\n\r\nrax.attach();\r\naxios.defaults.raxConfig = {\r\n retryDelay: 2000,\r\n backoffType: 'static',\r\n shouldRetry: ({ config, response }) => {\r\n if (config.raxConfig?.retryDecider && !config.raxConfig.retryDecider()) {\r\n return false;\r\n }\r\n return config.method?.toUpperCase() === 'GET' && response?.status === 449;\r\n }\r\n};\r\naxios.defaults.maxContentLength = Infinity;\r\naxios.defaults.maxBodyLength = Infinity;\r\naxios.defaults.baseURL = '/api';\r\naxios.interceptors.request.use(\r\n config => {\r\n const token = localStorage.getItem('authorization');\r\n\r\n if (token) {\r\n config.headers = {\r\n ...config.headers,\r\n Authorization: `Bearer ${token}`\r\n };\r\n }\r\n return config;\r\n },\r\n error => {\r\n return Promise.reject(error);\r\n }\r\n);\r\n\r\nconst isRecord = (data: any): data is Record<string, string> => {\r\n return data && (typeof data === 'object');\r\n};\r\n\r\naxios.interceptors.response.use(\r\n response => {\r\n if (response.status === 201 && response.data.location) {\r\n window.location.href = response.data.location;\r\n response.data = undefined; //防止多次跳转\r\n }\r\n\r\n return response;\r\n },\r\n e => {\r\n if (axios.isAxiosError(e)) {\r\n if (e.response) {\r\n const { data, status } = e.response;\r\n if (status === 401) {\r\n e.errors = 'Unauthorized';\r\n if (isRecord(data) && data.url) {\r\n e = new Unauthorized(data.url);\r\n }\r\n Toast.error('Unauthorized');\r\n } else {\r\n if (isRecord(data)) {\r\n if (status === 422) {\r\n e.errors = data;\r\n } else if ('message' in data) {\r\n e.errors = data['message'];\r\n }\r\n } else {\r\n e.errors = data as string;\r\n }\r\n }\r\n }\r\n }\r\n return Promise.reject(e);\r\n }\r\n);\r\n\r\nexport type RequestConfig = AxiosRequestConfig | string\r\nexport type RequestInstance = AxiosInstance\r\nexport const isRequestError = axios.isAxiosError;\r\n\r\nexport const showRequestError = (e: any) => {\r\n if (axios.isAxiosError(e)) {\r\n let errors = e.errors;\r\n if (typeof e.errors !== 'string') {\r\n errors = Object.values(e.errors).join('<br />');\r\n }\r\n Message.error({ title: errors as string });\r\n } else {\r\n throw e;\r\n }\r\n};\r\n\r\nconst request = async function <T = any>(config: RequestConfig) {\r\n config = typeof config === 'string' ? { url: config } : config;\r\n\r\n const { data } = await axios.request<T>({\r\n paramsSerializer: function(params) {\r\n return queryString.stringify(params, {\r\n sort: false,\r\n skipNull: true,\r\n skipEmptyString: true\r\n });\r\n },\r\n ...config\r\n });\r\n\r\n return data;\r\n};\r\n\r\nrequest.defaults = axios.defaults;\r\nrequest.interceptors = axios.interceptors;\r\n\r\nexport default request;\r\n","import request, { RequestConfig, showRequestError } from '../request';\r\nimport { createElement, ElementType, MouseEvent, useCallback, useState } from 'react';\r\nimport Message from '../utils/message';\r\nimport { AxiosRequestConfig } from 'axios';\r\nimport Button, { ButtonProps } from './button';\r\n\r\ninterface Props extends Omit<ButtonProps, 'as'> {\r\n url: RequestConfig;\r\n method?: AxiosRequestConfig['method'];\r\n confirm?: string;\r\n onSuccess?: (result: any) => void;\r\n as?: ElementType | ButtonProps['as'];\r\n}\r\n\r\nexport default function RequestButton({\r\n url,\r\n method,\r\n confirm,\r\n onSuccess,\r\n children,\r\n disabled,\r\n as = Button,\r\n ...props\r\n}: Props) {\r\n\r\n const [fetching, setFetching] = useState(false);\r\n\r\n const handleClick = useCallback(async (e: MouseEvent) => {\r\n e.preventDefault();\r\n try {\r\n setFetching(true);\r\n if (confirm) {\r\n if (!await Message.confirm({ text: confirm })) {\r\n return;\r\n }\r\n }\r\n\r\n const config = typeof url === 'string' ? { url, method } : { method, ...url };\r\n\r\n const result = await request(config);\r\n\r\n if (onSuccess) {\r\n onSuccess(result);\r\n }\r\n } catch (e) {\r\n showRequestError(e);\r\n } finally {\r\n setFetching(false);\r\n }\r\n }, [url, method, setFetching]);\r\n\r\n return createElement(as, {\r\n ...props,\r\n disabled: disabled || fetching,\r\n onClick: handleClick\r\n }, children);\r\n}\r\n","import JsonForm, { getRegistry, JsonFormProps, JsonFormType } from '@topthink/json-form';\r\nimport * as React from 'react';\r\nimport {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useCallback,\r\n useState\r\n} from 'react';\r\nimport axios, { AxiosError, Method } from 'axios';\r\nimport request from '../request';\r\nimport { mapValues } from 'lodash';\r\nimport { AjvError, ISubmitEvent, WidgetProps } from '@rjsf/core';\r\nimport Button from './button';\r\n\r\nconst localize = require('ajv-i18n/localize/zh');\r\n\r\nexport interface FormProps<T = any> extends JsonFormProps<T> {\r\n onSuccess?: (data: any) => void;\r\n method?: Method;\r\n children?: ReactNode | ((props: { submit: ReactNode, loading: boolean }) => ReactNode);\r\n submitText?: string;\r\n onSubmitting?: (submitting: boolean) => void;\r\n}\r\n\r\ntype Error = {\r\n __errors: string[]\r\n}\r\n\r\ntype Errors = Error | {\r\n [key: string]: Error\r\n}\r\n\r\nconst toExtraErrors = (error: AxiosError): Errors => {\r\n const errors = error.errors;\r\n if (typeof errors === 'string') {\r\n return {\r\n __errors: [errors]\r\n };\r\n }\r\n return mapValues(errors, (e) => {\r\n return {\r\n __errors: [e]\r\n };\r\n });\r\n};\r\n\r\nconst widgets = {\r\n upload: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\r\n const data = new FormData();\r\n\r\n data.set('file', file);\r\n\r\n const { url } = await request({\r\n url: options.endpoint as string,\r\n method: 'post',\r\n data\r\n });\r\n\r\n return url;\r\n };\r\n }\r\n\r\n return <widgets.upload {...props} options={options} />;\r\n },\r\n editor: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\r\n const data = new FormData();\r\n\r\n data.set('file', file);\r\n\r\n const { url } = await request({\r\n url: props.options.endpoint as string,\r\n method: 'post',\r\n data\r\n });\r\n\r\n return url;\r\n };\r\n }\r\n\r\n return <widgets.editor {...props} options={options} />;\r\n }\r\n};\r\n\r\nexport interface FormType extends JsonFormType {\r\n\r\n}\r\n\r\ntype Form<T = any> = ForwardRefExoticComponent<PropsWithoutRef<FormProps<T>> & RefAttributes<FormType>>\r\n\r\nconst Form: Form = forwardRef(({\r\n action,\r\n method = 'post',\r\n onSuccess,\r\n formData,\r\n onSubmitting,\r\n onSubmit,\r\n onChange,\r\n submitText = '提交',\r\n children,\r\n ...props\r\n}, ref) => {\r\n\r\n const [extraErrors, setExtraErrors] = useState<Errors>();\r\n const [loading, setLoading] = useState(false);\r\n const [data, setData] = useState(formData);\r\n\r\n const handleSubmit = useCallback(async (e: ISubmitEvent<any>, nativeEvent: React.FormEvent<HTMLFormElement>) => {\r\n if (!loading) {\r\n try {\r\n setLoading(true);\r\n if (onSubmitting) {\r\n onSubmitting(true);\r\n }\r\n if (action) {\r\n const { formData } = e;\r\n //todo 包含File对象需转FormData\r\n try {\r\n const result = await request({\r\n url: action,\r\n method,\r\n data: formData\r\n });\r\n setExtraErrors(undefined);\r\n if (onSuccess) {\r\n await onSuccess(result);\r\n }\r\n return result;\r\n } catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n setExtraErrors(toExtraErrors(e));\r\n } else {\r\n throw e;\r\n }\r\n }\r\n } else if (onSubmit) {\r\n return await onSubmit(e, nativeEvent);\r\n }\r\n } finally {\r\n setLoading(false);\r\n if (onSubmitting) {\r\n onSubmitting(false);\r\n }\r\n }\r\n }\r\n }, [action, method, onSubmit]);\r\n\r\n const handleChange = useCallback((e: ISubmitEvent<any>) => {\r\n const { formData } = e;\r\n setData(formData);\r\n if (onChange) {\r\n onChange(e);\r\n }\r\n }, [setData, onChange]);\r\n\r\n const transformErrors = useCallback((errors: AjvError[]) => {\r\n errors = errors.map(error => ({\r\n keyword: error.name,\r\n dataPath: error.property,\r\n ...error\r\n }));\r\n\r\n localize(errors);\r\n\r\n return errors;\r\n }, []);\r\n\r\n const submit = <Button className={'px-4'} loading={loading} type='submit' variant='primary'>{submitText}</Button>;\r\n\r\n if (typeof children === 'function') {\r\n children = children({ submit, loading });\r\n }\r\n\r\n return <JsonForm\r\n ref={ref}\r\n extraErrors={extraErrors}\r\n onSubmit={handleSubmit}\r\n transformErrors={transformErrors}\r\n noHtml5Validate\r\n noValidate\r\n {...props}\r\n formData={data}\r\n onChange={handleChange}\r\n widgets={widgets}\r\n >\r\n {children || <div className='col-12'>\r\n {submit}\r\n </div>}\r\n </JsonForm>;\r\n});\r\n\r\nexport default Form;\r\n","import { Columns, TableProps, TableRowSelection } from './index';\r\nimport { InputHTMLAttributes, Key, useCallback, useEffect, useRef, useState } from 'react';\r\n\r\nconst Checkbox = function({\r\n indeterminate = false,\r\n ...props\r\n}: InputHTMLAttributes<HTMLInputElement> & { indeterminate?: boolean }) {\r\n\r\n const ref = useRef<HTMLInputElement>(null);\r\n\r\n useEffect(() => {\r\n if (ref.current) {\r\n ref.current.indeterminate = indeterminate;\r\n }\r\n }, [indeterminate]);\r\n\r\n return <input\r\n ref={ref}\r\n {...props}\r\n className='form-check-input'\r\n type='checkbox'\r\n />;\r\n};\r\n\r\nexport default function useSelection<T = any>(\r\n rowSelection: TableRowSelection<T> | undefined,\r\n rowKey: Required<TableProps<T>>['rowKey'],\r\n data: T[]\r\n) {\r\n const [keys, setKeys] = useState(() => new Set(rowSelection?.selectedRowKeys || []));\r\n\r\n const getRowKey = (record: T) => {\r\n if (typeof rowKey === 'string') {\r\n // @ts-ignore\r\n return record[rowKey];\r\n } else {\r\n return rowKey(record);\r\n }\r\n };\r\n\r\n const getRecordByKey = (key: Key) => {\r\n return data.find((record) => {\r\n return getRowKey(record) === key;\r\n })!;\r\n };\r\n\r\n const setSelectedKeys = useCallback((keys: Set<Key>) => {\r\n setKeys(keys);\r\n const changedKeys = Array.from(keys);\r\n\r\n const records = changedKeys.map(function(key) {\r\n return getRecordByKey(key);\r\n });\r\n\r\n if (rowSelection?.onChange) {\r\n rowSelection?.onChange(changedKeys, records);\r\n }\r\n }, [getRecordByKey]);\r\n\r\n const transformColumns = useCallback((columns: Columns): Columns => {\r\n if (!rowSelection) {\r\n return columns;\r\n }\r\n\r\n const recordKeys = data.map(getRowKey);\r\n\r\n const checkedCurrentAll = recordKeys.every(function(key) {\r\n return keys.has(key);\r\n });\r\n const checkedCurrentSome = recordKeys.some(function(key) {\r\n return keys.has(key);\r\n });\r\n\r\n return [{\r\n key: 'selection',\r\n title: <Checkbox\r\n checked={checkedCurrentAll}\r\n indeterminate={!checkedCurrentAll && checkedCurrentSome}\r\n onChange={() => {\r\n if (checkedCurrentAll) {\r\n recordKeys.forEach(function(key) {\r\n keys.delete(key);\r\n });\r\n } else {\r\n recordKeys.forEach(function(key) {\r\n keys.add(key);\r\n });\r\n }\r\n setSelectedKeys(new Set(keys));\r\n }}\r\n />,\r\n width: 30,\r\n align: 'center',\r\n render({ record }) {\r\n const key = getRowKey(record);\r\n const checked = keys.has(key);\r\n return <Checkbox\r\n checked={checked}\r\n onChange={() => {\r\n if (checked) {\r\n keys.delete(key);\r\n } else {\r\n keys.add(key);\r\n }\r\n setSelectedKeys(new Set(keys));\r\n }}\r\n />;\r\n }\r\n }, ...columns];\r\n }, [data, rowSelection, keys]);\r\n\r\n return [transformColumns];\r\n}\r\n","var img = \"data:image/svg+xml,%3csvg t='1681378941268' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='11434' width='16' height='16' fill='currentColor'%3e %3cpath d='M252.068571 906.496h520.283429c89.581714 0 134.144-44.562286 134.144-132.845714V250.331429c0-88.283429-44.562286-132.845714-134.144-132.845715H252.068571c-89.142857 0-134.582857 44.141714-134.582857 132.845715V773.668571c0 88.704 45.44 132.845714 134.582857 132.845715z m1.28-68.992c-42.843429 0-66.852571-22.710857-66.852571-67.291429V253.805714c0-44.580571 24.009143-67.291429 66.852571-67.291428h517.723429c42.422857 0 66.432 22.710857 66.432 67.291428V770.194286c0 44.580571-24.009143 67.291429-66.432 67.291428z m258.432-123.008c22.710857 0 36.425143-15.853714 36.425143-40.704v-126.427429h134.144c24.009143 0 40.722286-12.873143 40.722286-35.584 0-23.131429-15.853714-36.425143-40.722286-36.425142H548.205714v-134.582858c0-24.850286-13.714286-40.704-36.425143-40.704s-35.565714 16.713143-35.565714 40.722286v134.582857H342.491429c-24.850286 0-41.142857 13.275429-41.142858 36.406857 0 22.710857 17.152 35.584 41.142858 35.584h133.723428v126.427429c0 23.990857 12.854857 40.704 35.565714 40.704z' p-id='11435'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","var img = \"data:image/svg+xml,%3csvg t='1681378996359' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='12821' width='16' height='16' fill='currentColor'%3e %3cpath d='M252.068571 906.496h520.283429c89.581714 0 134.144-44.562286 134.144-132.845714V250.331429c0-88.283429-44.562286-132.845714-134.144-132.845715H252.068571c-89.142857 0-134.582857 44.141714-134.582857 132.845715V773.668571c0 88.704 45.44 132.845714 134.582857 132.845715z m1.28-68.992c-42.843429 0-66.852571-22.710857-66.852571-67.291429V253.805714c0-44.580571 24.009143-67.291429 66.852571-67.291428h517.723429c42.422857 0 66.432 22.710857 66.432 67.291428V770.194286c0 44.580571-24.009143 67.291429-66.432 67.291428z m86.582858-289.718857h344.576c23.990857 0 40.704-12.854857 40.704-35.565714 0-23.149714-15.433143-36.425143-40.704-36.425143H339.931429c-24.868571 0-40.722286 13.275429-40.722286 36.425143 0 22.710857 16.713143 35.565714 40.722286 35.565714z' p-id='12822'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","import { DependencyList, useCallback, useEffect, useRef } from 'react';\r\n\r\nexport default function useCallbackRef<T extends (...args: any[]) => any>(\r\n callback: T | undefined,\r\n deps: DependencyList = [],\r\n) {\r\n const callbackRef = useRef(callback);\r\n\r\n useEffect(() => {\r\n callbackRef.current = callback;\r\n });\r\n\r\n return useCallback(((...args) => callbackRef.current?.(...args)) as T, deps);\r\n}\r\n","import { Dispatch, SetStateAction, useState } from 'react';\r\nimport useCallbackRef from './use-callback-ref';\r\n\r\nexport interface UseControllableStateProps<T> {\r\n value?: T;\r\n defaultValue?: T | (() => T);\r\n onChange?: (value: T) => void;\r\n shouldUpdate?: (prev: T, next: T) => boolean;\r\n}\r\n\r\nexport default function useControllableState<T>(props: UseControllableStateProps<T>) {\r\n const {\r\n value: valueProp,\r\n defaultValue,\r\n onChange,\r\n shouldUpdate = (prev, next) => prev !== next,\r\n } = props;\r\n\r\n const onChangeProp = useCallbackRef(onChange);\r\n const shouldUpdateProp = useCallbackRef(shouldUpdate);\r\n\r\n const [uncontrolledState, setUncontrolledState] = useState(defaultValue as T);\r\n const controlled = valueProp !== undefined;\r\n const value = controlled ? valueProp : uncontrolledState;\r\n\r\n const setValue = useCallbackRef(\r\n (next: SetStateAction<T>) => {\r\n const setter = next as (prevState?: T) => T;\r\n const nextValue = typeof next === 'function' ? setter(value) : next;\r\n\r\n if (!shouldUpdateProp(value, nextValue)) {\r\n return;\r\n }\r\n\r\n if (!controlled) {\r\n setUncontrolledState(nextValue);\r\n }\r\n\r\n onChangeProp(nextValue);\r\n },\r\n [controlled, onChangeProp, value, shouldUpdateProp],\r\n );\r\n\r\n return [value, setValue] as [T, Dispatch<SetStateAction<T>>];\r\n}\r\n","import { debounce, DebouncedFunc } from 'lodash';\r\nimport { useEffect, useRef } from 'react';\r\n\r\nexport default function useDebounce<T extends (...args: any) => any>(callback: T, wait: number, options?: {}): DebouncedFunc<T> {\r\n const callbackRef = useRef<T>(callback);\r\n const debouncedCallbackRef = useRef<DebouncedFunc<T>>(\r\n debounce(callback, wait, options)\r\n );\r\n\r\n useEffect(() => {\r\n callbackRef.current = callback;\r\n });\r\n\r\n useEffect(() => {\r\n debouncedCallbackRef.current = debounce((...args: any) => {\r\n callbackRef.current(...args);\r\n }, wait, options);\r\n }, [wait, options]);\r\n\r\n return debouncedCallbackRef.current;\r\n}\r\n","import { Form } from 'react-bootstrap';\r\nimport { ChangeEvent, useCallback, useEffect, useState } from 'react';\r\nimport useDebounce from '../../hooks/use-debounce';\r\n\r\ninterface Props {\r\n keyword: string;\r\n onKeywordChange: (value: string) => void;\r\n}\r\n\r\nexport default function Search({ keyword, onKeywordChange }: Props) {\r\n\r\n const [value, setValue] = useState(keyword);\r\n\r\n const debouncedOnKeywordChange = useDebounce(onKeywordChange, 500);\r\n\r\n useEffect(() => {\r\n setValue(keyword);\r\n }, [keyword]);\r\n\r\n const onChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\r\n setValue(e.target.value);\r\n debouncedOnKeywordChange(e.target.value);\r\n }, [debouncedOnKeywordChange, setValue]);\r\n\r\n return <Form.Control value={value} onChange={onChange} type={'search'} placeholder={'Search...'} />;\r\n}\r\n","import RcTable, { TableProps as RcTableProps } from 'rc-table';\r\nimport { unstable_batchedUpdates } from 'react-dom';\r\nimport { ColumnType as BsColumnType, RenderedCell, RenderExpandIconProps } from 'rc-table/es/interface';\r\nimport { Table as BsTable } from 'react-bootstrap';\r\nimport { useUrlSearchParams } from 'use-url-search-params';\r\nimport {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n Key,\r\n PropsWithChildren,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useCallback,\r\n useEffect,\r\n useImperativeHandle,\r\n useMemo,\r\n useRef,\r\n useState\r\n} from 'react';\r\nimport Pagination from '../pagination';\r\nimport styled from 'styled-components';\r\nimport request from '../../request';\r\nimport Card from '../card';\r\nimport Loader from '../loader';\r\nimport Space from '../space';\r\nimport useSelection from './use-selection';\r\nimport { PaginationType } from '../../utils/types';\r\nimport { ReactComponent as PlusIcon } from '../../images/plus_square.svg';\r\nimport { ReactComponent as MinusIcon } from '../../images/minus_square.svg';\r\nimport useControllableState from '../../hooks/use-controllable-state';\r\nimport Search from './search';\r\nimport NumberFormat from '../number-format';\r\nimport { TableContext } from './context';\r\n\r\nexport interface TableType {\r\n reload: () => void;\r\n}\r\n\r\ninterface ColumnType<RecordType> extends BsColumnType<RecordType> {\r\n render?: (data: {\r\n value: any,\r\n record: RecordType,\r\n index: number,\r\n action: TableType\r\n }) => ReactNode | RenderedCell<RecordType>;\r\n valueType?: 'currency';\r\n}\r\n\r\nexport type Columns<RecordType = any> = ColumnType<RecordType>[]\r\n\r\nconst CustomTHead = styled.thead`\r\n th {\r\n padding: 0.5rem 0.5rem;\r\n border-bottom-width: 1px;\r\n border-color: var(--bs-border-color);\r\n }\r\n`;\r\n\r\nconst components: RcTableProps['components'] = {\r\n table: (props) => {\r\n return <BsTable {...props} className='mb-0 align-middle table-hover' />;\r\n },\r\n header: {\r\n wrapper(props) {\r\n return <CustomTHead {...props} />;\r\n }\r\n }\r\n};\r\n\r\nconst ExpandIconContainer = styled.a`\r\n cursor: pointer;\r\n width: 28px;\r\n height: 28px;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n vertical-align: middle;\r\n`;\r\n\r\nconst ExpandIcon = function <RecordType>({\r\n record,\r\n expanded,\r\n expandable,\r\n onExpand\r\n}: RenderExpandIconProps<RecordType>) {\r\n if (!expandable) return <ExpandIconContainer />;\r\n return <ExpandIconContainer onClick={e => onExpand(record, e)}>\r\n {expanded ? <MinusIcon /> : <PlusIcon />}\r\n </ExpandIconContainer>;\r\n};\r\n\r\nconst CustomPagination = styled(Pagination)`\r\n margin-bottom: 0;\r\n justify-content: flex-end;\r\n margin-top: 1rem;\r\n`;\r\n\r\nfunction isPagination<T>(data: any): data is PaginationType<T> {\r\n return 'current_page' in data;\r\n}\r\n\r\nexport interface TableRowSelection<RecordType = any> {\r\n selectedRowKeys?: Key[];\r\n onChange?: (selectedRowKeys: Key[], selectedRows: RecordType[]) => void;\r\n}\r\n\r\nexport interface TableProps<RecordType = any> extends Omit<RcTableProps<RecordType>, 'children' | 'columns'> {\r\n source: string | ((params: Params) => Promise<RecordType>);\r\n paginate?: boolean;\r\n columns: Columns<RecordType>;\r\n toolBarRender?: ((action: TableType) => ReactNode) | false;\r\n search?: boolean;\r\n rowSelection?: TableRowSelection<RecordType>;\r\n card?: boolean;\r\n sync?: boolean;\r\n}\r\n\r\ntype Params = {\r\n page?: number;\r\n sortField?: string;\r\n sortOrder?: number;\r\n q?: string;\r\n [key: string]: any;\r\n};\r\n\r\ntype CustomTableType<T = any> = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<TableProps<T>>>\r\n & RefAttributes<TableType>>\r\n\r\nconst Table: CustomTableType = forwardRef((\r\n {\r\n source,\r\n rowKey = 'id',\r\n paginate = true,\r\n toolBarRender,\r\n columns = [],\r\n search,\r\n rowSelection,\r\n card = true,\r\n expandable = {},\r\n sync = false,\r\n ...props\r\n },\r\n ref\r\n) => {\r\n const [data, setData] = useState<any[]>([]);\r\n const [pagination, setPagination] = useState(paginate ? { total: 0, current: 1, pageSize: 10 } : null);\r\n const [loading, setLoading] = useState(true);\r\n\r\n const [params, setParams] = useUrlSearchParams({});\r\n\r\n const [keyword, setKeyword] = useControllableState<string>({\r\n value: sync ? (params.q as string || '') : undefined,\r\n defaultValue: '',\r\n onChange: (value) => {\r\n if (sync) {\r\n setParams({ q: value || undefined });\r\n }\r\n }\r\n });\r\n\r\n const [page, setPage] = useControllableState<number>({\r\n value: sync ? (params.page as number || 1) : undefined,\r\n defaultValue: 1,\r\n onChange: (value) => {\r\n if (sync) {\r\n setParams({ page: value || undefined });\r\n }\r\n }\r\n });\r\n\r\n const fetchData = useCallback(async () => {\r\n setLoading(true);\r\n try {\r\n let result;\r\n const params: Params = {\r\n q: keyword,\r\n page: page > 1 ? page : undefined,\r\n };\r\n\r\n if (typeof source === 'string') {\r\n result = await request({\r\n url: source,\r\n params,\r\n });\r\n } else {\r\n result = await source(params);\r\n }\r\n\r\n if (paginate && isPagination<any>(result)) {\r\n setPagination({\r\n total: result.total,\r\n current: result.current_page,\r\n pageSize: result.per_page\r\n });\r\n result = result.data;\r\n }\r\n setData(result);\r\n } catch (e) {\r\n\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [source, setData, keyword, page]);\r\n\r\n useEffect(() => {\r\n fetchData();\r\n }, [keyword, page]);\r\n\r\n const action = useRef<TableType>({\r\n reload: fetchData\r\n });\r\n\r\n useEffect(() => {\r\n action.current = {\r\n reload: fetchData\r\n };\r\n }, [fetchData]);\r\n\r\n useImperativeHandle(ref, () => action.current);\r\n\r\n //多选\r\n const [transformColumns] = useSelection(rowSelection, rowKey, data);\r\n\r\n const customColumns = useMemo(() => {\r\n return transformColumns(columns).map(({ render, valueType, ...column }) => {\r\n const customColumn: BsColumnType<any> = { ...column };\r\n\r\n if (render) {\r\n customColumn.render = (value, record, index) => {\r\n return render({ value, record, index, action: action.current });\r\n };\r\n } else if (valueType === 'currency') {\r\n customColumn.render = (value) => {\r\n return <NumberFormat value={value} />;\r\n };\r\n }\r\n return customColumn;\r\n });\r\n }, [columns, transformColumns, action]);\r\n\r\n const children = <>\r\n <Loader loading={loading} />\r\n {toolBarRender !== false && <Header>\r\n <LeftTools size={12}>\r\n {toolBarRender && toolBarRender(action.current)}\r\n </LeftTools>\r\n <RightTools size={12}>\r\n {search && <Search keyword={keyword} onKeywordChange={(value) => {\r\n unstable_batchedUpdates(() => {\r\n setPage(1);\r\n setKeyword(value);\r\n });\r\n }} />}\r\n <Action onClick={action.current.reload}><i className='bi bi-arrow-repeat' /></Action>\r\n </RightTools>\r\n </Header>}\r\n <TableContext.Provider value={true}>\r\n <RcTable {...props} expandable={{ expandIcon: ExpandIcon, ...expandable }} rowKey={rowKey} columns={customColumns} components={components} data={data} />\r\n </TableContext.Provider>\r\n {pagination && <CustomPagination {...pagination} onChange={setPage} />}\r\n </>;\r\n\r\n if (card) {\r\n return <Card>\r\n {children}\r\n </Card>;\r\n }\r\n return children;\r\n});\r\n\r\nexport default Table;\r\n\r\nconst Header = styled.div`\r\n display: flex;\r\n justify-content: space-between;\r\n padding-bottom: 1rem;\r\n height: 48px;\r\n border-bottom: 2px solid #212529;\r\n`;\r\n\r\nconst RightTools = styled(Space)`\r\n\r\n`;\r\nconst LeftTools = styled(Space)`\r\n\r\n`;\r\n\r\nconst Action = styled.span`\r\n cursor: pointer;\r\n font-size: 20px;\r\n line-height: 1;\r\n\r\n &:hover {\r\n color: var(--bs-primary);\r\n }\r\n`;\r\n","import { useCallback, useState } from 'react';\r\n\r\ninterface Options {\r\n onHide?: () => void;\r\n onShow?: () => void;\r\n}\r\n\r\nlet id = 0;\r\n\r\nexport default function useOverlayState({ onHide, onShow }: Options = {}) {\r\n const [visible, setVisible] = useState(false);\r\n\r\n const [key, setKey] = useState(`visible-${id}`);\r\n\r\n const hide = useCallback(() => {\r\n setVisible(false);\r\n if (onHide) {\r\n onHide();\r\n }\r\n }, [setVisible, onHide]);\r\n\r\n const exit = useCallback(() => {\r\n setKey(`visible-${++id}`);\r\n }, [setKey, id]);\r\n\r\n const show = useCallback(() => {\r\n setVisible(true);\r\n if (onShow) {\r\n onShow();\r\n }\r\n }, [setVisible, onShow]);\r\n\r\n const state = {\r\n show: visible,\r\n onHide: hide,\r\n onExited: exit,\r\n key\r\n };\r\n\r\n return {\r\n visible,\r\n show,\r\n hide,\r\n state\r\n };\r\n}\r\n","import { ButtonProps, Modal as ReactModal, ModalProps as ReactModalProps } from 'react-bootstrap';\r\nimport { ElementType, MouseEvent, ReactNode, useMemo, useState } from 'react';\r\nimport Button from './button';\r\n\r\nexport interface ModalProps extends Pick<\r\n ReactModalProps,\r\n 'backdrop' | 'centered' | 'size' | 'scrollable' | 'fullscreen' | 'onHide' | 'onShow' | 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited'\r\n> {\r\n children: ReactNode;\r\n header?: ReactNode;\r\n footer?: ReactNode | ((args: { okButton: ReactNode, cancelButton: ReactNode }) => ReactNode);\r\n okText?: string;\r\n cancelText?: string;\r\n closable?: boolean;\r\n show?: boolean;\r\n onOk?: (e: MouseEvent) => void;\r\n onCancel?: (e: MouseEvent) => void;\r\n okButtonProps?: ButtonProps;\r\n bodyAs?: ElementType;\r\n headerAs?: ElementType;\r\n confirmLoading?: boolean;\r\n}\r\n\r\nexport default function Modal({\r\n header,\r\n children,\r\n footer,\r\n closable = true,\r\n show,\r\n cancelText = '取消',\r\n okText = '确定',\r\n onOk,\r\n onCancel,\r\n onHide,\r\n okButtonProps,\r\n bodyAs,\r\n headerAs = 'h5',\r\n confirmLoading = false,\r\n ...rest\r\n}: ModalProps) {\r\n\r\n const [loading, setLoading] = useState(false);\r\n\r\n const okButton = useMemo(() => {\r\n return <Button loading={loading || confirmLoading} variant={'primary'} onClick={async (e) => {\r\n setLoading(true);\r\n try {\r\n await onOk?.(e);\r\n if (!e.defaultPrevented) {\r\n onHide?.();\r\n }\r\n } finally {\r\n setLoading(false);\r\n }\r\n }} {...okButtonProps}>{okText}</Button>;\r\n }, [okButtonProps, okText, onOk, onHide, loading, confirmLoading]);\r\n\r\n const cancelButton = useMemo(() => {\r\n return <Button variant='secondary' onClick={(e) => {\r\n onCancel?.(e);\r\n if (!e.defaultPrevented) {\r\n onHide?.();\r\n }\r\n }}>{cancelText}</Button>;\r\n }, [onCancel, onHide, cancelText]);\r\n\r\n switch (typeof footer) {\r\n case 'undefined':\r\n footer = <>\r\n {cancelButton}\r\n {okButton}\r\n </>;\r\n break;\r\n case 'function':\r\n footer = footer({ okButton, cancelButton });\r\n break;\r\n }\r\n\r\n return <ReactModal {...rest} onHide={onHide} show={show}>\r\n {header && <ReactModal.Header closeButton={closable}>\r\n <ReactModal.Title as={headerAs}>{header}</ReactModal.Title>\r\n </ReactModal.Header>}\r\n <ReactModal.Body as={bodyAs}>{children}</ReactModal.Body>\r\n {footer && <ReactModal.Footer>{footer}</ReactModal.Footer>}\r\n </ReactModal>;\r\n}\r\n","import {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n MouseEvent,\r\n PropsWithChildren,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useImperativeHandle\r\n} from 'react';\r\nimport useOverlayState from '../hooks/use-overlay-state';\r\nimport Modal, { ModalProps } from './modal';\r\nimport { ButtonProps } from 'react-bootstrap';\r\nimport Button from './button';\r\n\r\nexport interface ModalButtonProps extends ButtonProps {\r\n text: ReactNode;\r\n modalProps?: ModalProps;\r\n onOk?: () => any;\r\n onShow?: () => void;\r\n confirmLoading?: boolean;\r\n}\r\n\r\nexport interface ModalType {\r\n close: () => void;\r\n}\r\n\r\ntype ModalButtonType = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<ModalButtonProps>>\r\n & RefAttributes<ModalType>>\r\n\r\nconst ModalButton: ModalButtonType = forwardRef(({\r\n text,\r\n onOk,\r\n modalProps,\r\n children,\r\n onShow,\r\n confirmLoading,\r\n ...props\r\n}, ref) => {\r\n\r\n const { state, show, hide } = useOverlayState({ onShow });\r\n\r\n useImperativeHandle(ref, () => ({\r\n close: hide\r\n }));\r\n\r\n const handleOk = async (e: MouseEvent) => {\r\n if (onOk) {\r\n const result = await onOk();\r\n if (result === false) {\r\n e.preventDefault();\r\n }\r\n }\r\n };\r\n\r\n const button = <Button onClick={show} {...props}>{text}</Button>;\r\n\r\n return <>\r\n {button}\r\n <Modal\r\n header={text}\r\n {...modalProps}\r\n {...state}\r\n confirmLoading={confirmLoading}\r\n onOk={handleOk}\r\n >\r\n {children}\r\n </Modal>\r\n </>;\r\n});\r\n\r\nexport default ModalButton;\r\n","import ModalButton, { ModalButtonProps, ModalType } from './modal-button';\r\nimport { ReactNode, useCallback, useRef, useState } from 'react';\r\nimport Form, { FormProps, FormType } from './form';\r\nimport { ModalProps } from './modal';\r\n\r\nexport interface ModalFormProps<T = any> extends FormProps<T> {\r\n text: ReactNode;\r\n buttonProps?: ModalButtonProps;\r\n modalProps?: ModalProps;\r\n children?: ReactNode;\r\n}\r\n\r\nexport default function ModalForm<T = any>({\r\n text,\r\n onSuccess,\r\n buttonProps,\r\n modalProps,\r\n children,\r\n ...props\r\n}: ModalFormProps<T>) {\r\n\r\n const [loading, setLoading] = useState(false);\r\n\r\n const ref = useRef<ModalType>(null);\r\n const form = useRef<FormType>(null);\r\n\r\n const handleOk = useCallback(() => {\r\n form.current?.submit();\r\n return false;\r\n }, []);\r\n\r\n const handleSuccess = useCallback((data) => {\r\n if (onSuccess) {\r\n onSuccess(data);\r\n }\r\n ref.current?.close();\r\n }, [onSuccess]);\r\n\r\n\r\n return <ModalButton\r\n ref={ref}\r\n text={text}\r\n {...buttonProps}\r\n modalProps={modalProps}\r\n onOk={handleOk}\r\n confirmLoading={loading}\r\n >\r\n <Form\r\n {...props}\r\n onSubmitting={setLoading}\r\n ref={form}\r\n onSuccess={handleSuccess}\r\n >\r\n {children}\r\n <input type='submit' hidden />\r\n </Form>\r\n </ModalButton>;\r\n}\r\n","import { useAsyncCallback, UseAsyncCallbackOptions } from 'react-async-hook';\r\nimport request, { isRequestError, RequestConfig } from '../request';\r\nimport { DependencyList, useCallback, useEffect } from 'react';\r\nimport { AxiosRequestConfig } from 'axios';\r\nimport { values } from 'lodash';\r\n\r\ntype UseRequestOptions<T> = {\r\n manual?: boolean\r\n refreshDeps?: DependencyList;\r\n} & UseAsyncCallbackOptions<T>;\r\n\r\nexport default function useRequest<T = any>(config: RequestConfig, {\r\n manual,\r\n refreshDeps,\r\n ...options\r\n}: UseRequestOptions<T> = {}) {\r\n let { execute, currentParams, error, ...others } = useAsyncCallback(async (params?: AxiosRequestConfig) => {\r\n\r\n config = typeof config === 'string' ? { url: config } : config;\r\n\r\n return await request<T>({\r\n ...config,\r\n ...params\r\n });\r\n }, options);\r\n\r\n useEffect(() => {\r\n if (!manual && !refreshDeps) {\r\n execute();\r\n }\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (refreshDeps) {\r\n refresh();\r\n }\r\n }, refreshDeps);\r\n\r\n const refresh = useCallback(() => {\r\n if (currentParams) {\r\n execute(...currentParams);\r\n } else {\r\n execute();\r\n }\r\n }, [execute, currentParams]);\r\n\r\n if (error && isRequestError(error)) {\r\n const errors = error.errors;\r\n error = new Error(typeof errors === 'string' ? errors : values(errors).join(''));\r\n }\r\n\r\n return {\r\n refresh,\r\n execute,\r\n error,\r\n ...others\r\n };\r\n}\r\n"],"names":["CustomSwal","withReactContent","Swal","defaultOptions","confirmButtonText","cancelButtonText","Message","confirm","async","isConfirmed","fire","icon","showCancelButton","options","data","preConfirm","e","Error","showValidationMessage","message","success","toast","position","timer","showConfirmButton","error","close","result","noticeInstance","notice","_ref","type","callback","Notification","newInstance","prefixCls","maxCount","style","top","right","instance","getNoticeInstance","duration","variant","closable","content","_jsx","Alert","children","Toast","forEach","Container","styled","div","Icon","Title","Extra","IconMap","className","info","warning","Result","status","title","extra","_jsxs","Dimmer","props","active","inverted","Loader","loading","animation","wrap","Spinner","Wrap","$height","Card","BsCard","classNames","_Fragment","errors","Object","entries","map","_ref2","name","Space","size","direction","small","middle","large","items","Children","child","Item","$direction","$size","css","_path","_extends","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","SvgStepCheck","React","createElement","viewBox","xmlns","width","height","fill","d","Steps","CustomRcSteps","icons","finish","CheckIcon","Step","RcSteps","noop","isInteger","value","isFinite","Math","floor","Pagination","total","onChange","defaultCurrent","defaultPageSize","current","setCurrent","useState","pageSize","setPageSize","useEffect","allPages","useMemo","handleChange","useCallback","p","prevPage","nextPage","pagerList","jumpPrev","jumpNext","firstPager","lastPager","push","BsPagination","onClick","Last","First","Prev","Next","left","max","min","pageBufferSize","unshift","NumberFormat","locale","currency","formatter","opt","minimumFractionDigits","Intl","format","LoadingButton","disabled","Button","Tooltip","tooltip","placement","OverlayTrigger","overlay","BsTooltip","id","uniqueId","TableContext","createContext","forwardRef","ref","percent","useContext","as","role","button","BsButton","Unauthorized","constructor","url","super","_defineProperty","rax","attach","axios","defaults","raxConfig","retryDelay","backoffType","shouldRetry","_config$raxConfig","_config$method","config","response","retryDecider","method","toUpperCase","maxContentLength","Infinity","maxBodyLength","baseURL","interceptors","request","use","token","localStorage","getItem","headers","Authorization","Promise","reject","isRecord","location","window","href","undefined","isAxiosError","isRequestError","showRequestError","values","join","paramsSerializer","params","queryString","stringify","sort","skipNull","skipEmptyString","RequestButton","onSuccess","fetching","setFetching","handleClick","preventDefault","text","localize","require","widgets","upload","getRegistry","endpoint","onUpload","FormData","set","file","editor","Form","_ref3","action","formData","onSubmitting","onSubmit","submitText","extraErrors","setExtraErrors","setLoading","setData","handleSubmit","nativeEvent","__errors","mapValues","toExtraErrors","transformErrors","keyword","dataPath","property","submit","JsonForm","noHtml5Validate","noValidate","Checkbox","indeterminate","useRef","SvgPlusSquare","SvgMinusSquare","useCallbackRef","deps","callbackRef","_callbackRef$current","_len","args","Array","_key","useControllableState","valueProp","defaultValue","shouldUpdate","prev","next","onChangeProp","shouldUpdateProp","uncontrolledState","setUncontrolledState","controlled","setValue","nextValue","useDebounce","wait","debouncedCallbackRef","debounce","Search","onKeywordChange","debouncedOnKeywordChange","Control","placeholder","CustomTHead","thead","components","table","BsTable","header","wrapper","ExpandIconContainer","a","ExpandIcon","record","expanded","expandable","onExpand","MinusIcon","PlusIcon","CustomPagination","Table","rowKey","paginate","toolBarRender","columns","search","rowSelection","card","sync","pagination","setPagination","setParams","useUrlSearchParams","setKeyword","q","page","setPage","fetchData","isPagination","current_page","per_page","reload","useImperativeHandle","transformColumns","keys","setKeys","Set","selectedRowKeys","getRowKey","getRecordByKey","find","setSelectedKeys","changedKeys","from","records","recordKeys","checkedCurrentAll","every","has","checkedCurrentSome","some","checked","delete","add","align","render","useSelection","customColumns","valueType","column","customColumn","index","Header","LeftTools","RightTools","unstable_batchedUpdates","Action","Provider","RcTable","expandIcon","span","useOverlayState","onHide","onShow","visible","setVisible","setKey","hide","exit","show","state","onExited","Modal","footer","cancelText","okText","onOk","onCancel","okButtonProps","bodyAs","headerAs","confirmLoading","rest","okButton","defaultPrevented","cancelButton","ReactModal","closeButton","Body","Footer","ModalButton","modalProps","ModalForm","buttonProps","form","handleOk","_form$current","handleSuccess","_ref$current","hidden","useRequest","manual","refreshDeps","execute","currentParams","others","useAsyncCallback","refresh"],"mappings":"yvCAIA,MAAMA,EAAaC,EAAiBC,GAM9BC,EAAiB,CACnBC,kBAAmB,KACnBC,iBAAkB,MAGhBC,EAAU,CACZC,QAASC,UACL,MAAMC,YAAEA,SAAsBT,EAAWU,KAAK,IACvCP,EACHQ,KAAM,UACNC,kBAAkB,KACfC,EACHL,iBAAiBM,GACb,GAAID,EAAQE,WACR,IACI,aAAaF,EAAQE,WAAWD,EAMnC,CALC,MAAOE,GAIL,OAHIA,aAAaC,OACbjB,EAAWkB,sBAAsBF,EAAEG,UAEhC,CACV,CAEL,OAAO,CACX,IAGJ,OAAOV,CAAW,EAEtBW,QAAUP,IACNb,EAAWU,KAAK,IACTP,EACHkB,OAAO,EACPC,SAAU,MACVX,KAAM,UACNY,MAAO,IACPC,mBAAmB,KAChBX,GACL,EAENY,MAAQZ,IACJb,EAAWU,KAAK,IACTP,EACHkB,OAAO,EACPC,SAAU,MACVX,KAAM,QACNY,MAAO,IACPC,mBAAmB,KAChBX,GACL,EAENa,MAAQC,IACJ3B,EAAW0B,MAAMC,EAAO,GC1DhC,IAAIC,EAwBJ,MAEMC,EAASC,IAA2D,IAA1DC,KAAEA,KAASlB,GAA2CiB,GAxBtE,SAA2BE,GACvB,GAAIJ,EACA,OAAOI,EAASJ,GAGpBK,EAAaC,YAAY,CACrBC,UAAW,eACXC,SAAU,EACVC,MAAO,CACHC,IAAK,GACLC,M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exN,GAAQ,CAChC,MAAMwD,EAASxD,EAAMwD,OACrBxD,EAAQ,IAAIR,MAAwB,iBAAXgE,EAAsBA,EAASkK,EAAOlK,GAAQmK,KAAK,IAC/E,CAED,MAAO,CACHiN,UACAJ,UACAxa,WACG0a,EAEX"}
1
+ {"version":3,"file":"index.js","sources":["../src/utils/message.ts","../src/utils/toast.tsx","../src/components/result.tsx","../src/components/dimmer.tsx","../src/components/loader.tsx","../src/components/card.tsx","../src/components/error.tsx","../src/components/space.tsx","../src/images/step_check.svg","../src/components/steps.tsx","../src/components/pagination.tsx","../src/components/number-format.tsx","../src/components/loading-button.tsx","../src/components/tooltip.tsx","../src/components/table/context.ts","../src/components/button.tsx","../src/errors/unauthorized.ts","../src/request.ts","../src/components/request-button.tsx","../src/components/form.tsx","../src/components/table/use-selection.tsx","../src/images/plus_square.svg","../src/images/minus_square.svg","../src/hooks/use-callback-ref.ts","../src/hooks/use-controllable-state.ts","../src/hooks/use-debounce.ts","../src/components/table/search.tsx","../src/components/table/index.tsx","../src/hooks/use-overlay-state.ts","../src/components/modal.tsx","../src/components/modal-button.tsx","../src/components/modal-form.tsx","../src/hooks/use-request.ts"],"sourcesContent":["import Swal from 'sweetalert2/dist/sweetalert2.js';\r\nimport withReactContent from 'sweetalert2-react-content';\r\nimport { SweetAlertOptions, SweetAlertResult } from 'sweetalert2';\r\n\r\nconst CustomSwal = withReactContent(Swal);\r\n\r\ninterface MessageOptions<T = any> extends SweetAlertOptions<T> {\r\n\r\n}\r\n\r\nconst defaultOptions = {\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消'\r\n};\r\n\r\nconst Message = {\r\n confirm: async <T = any>(options: MessageOptions<T>) => {\r\n const { isConfirmed } = await CustomSwal.fire({\r\n ...defaultOptions,\r\n icon: 'warning',\r\n showCancelButton: true,\r\n ...options,\r\n async preConfirm(data) {\r\n if (options.preConfirm) {\r\n try {\r\n return await options.preConfirm(data);\r\n } catch (e) {\r\n if (e instanceof Error) {\r\n CustomSwal.showValidationMessage(e.message);\r\n }\r\n return false;\r\n }\r\n }\r\n return true;\r\n },\r\n });\r\n\r\n return isConfirmed;\r\n },\r\n success: (options: MessageOptions) => {\r\n CustomSwal.fire({\r\n ...defaultOptions,\r\n toast: true,\r\n position: 'top',\r\n icon: 'success',\r\n timer: 2000,\r\n showConfirmButton: false,\r\n ...options\r\n });\r\n },\r\n error: (options: MessageOptions) => {\r\n CustomSwal.fire({\r\n ...defaultOptions,\r\n toast: true,\r\n position: 'top',\r\n icon: 'error',\r\n timer: 5000,\r\n showConfirmButton: false,\r\n ...options\r\n });\r\n },\r\n close: (result?: SweetAlertResult) => {\r\n CustomSwal.close(result);\r\n }\r\n};\r\n\r\nexport default Message;\r\n","import { Alert } from 'react-bootstrap';\r\nimport { NoticeContent, NotificationInstance } from 'rc-notification/lib/Notification';\r\nimport Notification from 'rc-notification';\r\n\r\nlet noticeInstance: NotificationInstance | null;\r\n\r\nfunction getNoticeInstance(callback: (instance: NotificationInstance) => void) {\r\n if (noticeInstance) {\r\n return callback(noticeInstance);\r\n }\r\n\r\n Notification.newInstance({\r\n prefixCls: 'notification',\r\n maxCount: 5,\r\n style: {\r\n top: 20,\r\n right: 20\r\n }\r\n }, (instance) => {\r\n if (noticeInstance) {\r\n callback(noticeInstance);\r\n return;\r\n }\r\n noticeInstance = instance;\r\n callback(instance);\r\n });\r\n}\r\n\r\nconst types = ['error', 'success', 'info'];\r\n\r\nconst notice = ({ type, ...options }: { type: string } & NoticeContent) => {\r\n getNoticeInstance((instance) => {\r\n options.duration = 3;\r\n let variant = type;\r\n switch (type) {\r\n case 'error':\r\n variant = 'danger';\r\n options.duration = options.closable ? 0 : 5;\r\n break;\r\n }\r\n\r\n options.content = <Alert variant={variant}>{options.content}</Alert>;\r\n\r\n instance.notice(options);\r\n });\r\n};\r\n\r\n\r\nlet Toast: {\r\n [index in typeof types[number]]: (content: string, options?: NoticeContent) => void\r\n} = {};\r\n\r\ntypes.forEach((type) => {\r\n Toast[type] = (content, options) => {\r\n notice({\r\n ...options,\r\n type,\r\n content\r\n });\r\n };\r\n});\r\n\r\nexport default Toast;\r\n","import { ReactNode } from 'react';\r\nimport styled from 'styled-components';\r\n\r\nconst Container = styled.div`\r\n padding: 48px 32px;\r\n`;\r\n\r\nconst Icon = styled.div`\r\n margin-bottom: 24px;\r\n text-align: center;\r\n font-size: 72px;\r\n`;\r\n\r\nconst Title = styled.div`\r\n color: rgba(0, 0, 0, .85);\r\n font-size: 24px;\r\n line-height: 1.8;\r\n text-align: center;\r\n`;\r\n\r\nconst Extra = styled.div`\r\n margin-top: 32px;\r\n text-align: center;\r\n`;\r\n\r\nconst IconMap = {\r\n success: <i className='bi bi-check-circle-fill text-success' />,\r\n error: <i className='bi bi-exclamation-circle-fill text-danger' />,\r\n info: <i className='bi bi-info-circle-fill text-info' />,\r\n warning: <i className='bi bi-exclamation-triangle-fill text-warning' />,\r\n};\r\n\r\ninterface ResultProps {\r\n status?: keyof typeof IconMap\r\n icon?: ReactNode\r\n title?: string\r\n extra?: ReactNode;\r\n}\r\n\r\nexport default function Result({ status, title, icon, extra }: ResultProps) {\r\n\r\n if (!icon && status) {\r\n icon = IconMap[status];\r\n }\r\n\r\n return <Container>\r\n {icon && <Icon>{icon}</Icon>}\r\n {title && <Title>{title}</Title>}\r\n {extra && <Extra>{extra}</Extra>}\r\n </Container>;\r\n}\r\n","import styled from 'styled-components';\r\n\r\nexport const Dimmable = styled.div`\r\n position: relative;\r\n`;\r\n\r\ninterface DimmerProps {\r\n active?: boolean\r\n inverted?: boolean\r\n}\r\n\r\nconst Dimmer = styled.div<DimmerProps>`\r\n display: ${props => props.active ? 'flex' : 'none'};\r\n position: absolute;\r\n top: 0 !important;\r\n left: 0 !important;\r\n width: 100%;\r\n height: 100%;\r\n text-align: center;\r\n vertical-align: middle;\r\n padding: 1em;\r\n background-color: ${props => props.inverted ? 'rgba(255, 255, 255, .85)' : 'rgba(0, 0, 0, .85)'};\r\n opacity: ${props => props.active ? 1 : 0};\r\n line-height: 1;\r\n animation-fill-mode: both;\r\n animation-duration: .5s;\r\n transition: background-color .5s linear;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n user-select: none;\r\n will-change: opacity;\r\n z-index: 990;\r\n`;\r\n\r\nexport default Dimmer;\r\n","import { PropsWithChildren } from 'react';\r\nimport { Spinner, SpinnerProps } from 'react-bootstrap';\r\nimport Dimmer from './dimmer';\r\nimport styled from 'styled-components';\r\n\r\ninterface LoaderProps {\r\n loading?: boolean;\r\n animation?: SpinnerProps['animation'];\r\n wrap?: boolean | number;\r\n}\r\n\r\nexport default function Loader({\r\n loading = true,\r\n children,\r\n variant = 'primary',\r\n animation = 'border',\r\n wrap,\r\n ...props\r\n}: PropsWithChildren<LoaderProps & Omit<SpinnerProps, 'animation'>>): JSX.Element | null {\r\n if (!loading) {\r\n return null;\r\n }\r\n\r\n if (children) {\r\n children = <p className='mt-3 text-secondary'>{children}</p>;\r\n }\r\n\r\n children = <Dimmer inverted active>\r\n <Spinner animation={animation} variant={variant} {...props} />\r\n {children}\r\n </Dimmer>;\r\n\r\n if (wrap) {\r\n return <Wrap $height={typeof wrap === 'number' ? wrap : 150}>\r\n {children}\r\n </Wrap>;\r\n }\r\n\r\n return children as JSX.Element;\r\n}\r\n\r\nconst Wrap = styled.div<{ $height: number }>`\r\n position: relative;\r\n height: ${props => `${props.$height}px`};\r\n`;\r\n","import { PropsWithChildren } from 'react';\r\nimport { Card as BsCard, CardProps as BsCardProps } from 'react-bootstrap';\r\nimport classNames from 'classnames';\r\n\r\ninterface CardProps extends BsCardProps {\r\n title?: string;\r\n}\r\n\r\nexport default function Card({ children, title, className, ...props }: PropsWithChildren<CardProps>) {\r\n\r\n return <BsCard className={classNames('border-0 shadow-sm mb-3', className)} {...props}>\r\n <div className='card-body'>\r\n {title && <>\r\n <h5>{title}</h5>\r\n <hr />\r\n </>}\r\n {children}\r\n </div>\r\n </BsCard>;\r\n}\r\n","import { Alert } from 'react-bootstrap';\r\nimport { Errors } from '../request';\r\n\r\nexport default function Error({ errors }: { errors?: Errors }) {\r\n if (!errors) {\r\n return null;\r\n }\r\n return <Alert variant='danger'>\r\n <ul className='mb-0'>\r\n {typeof errors === 'string'\r\n ? <li>{errors}</li>\r\n : Object.entries(errors).map(([name, error]) => <li key={name}>{error}</li>)\r\n }\r\n </ul>\r\n </Alert>;\r\n}\r\n","import { Children, ReactNode } from 'react';\r\nimport styled, { css } from 'styled-components';\r\n\r\ninterface SpaceProps {\r\n children: ReactNode;\r\n size?: 'small' | 'middle' | 'large' | number;\r\n direction?: 'vertical' | 'horizontal';\r\n className?: string;\r\n}\r\n\r\n\r\nexport default function Space({ children, className, size = 'small', direction = 'horizontal' }: SpaceProps) {\r\n\r\n if (typeof size === 'string') {\r\n size = {\r\n small: 8,\r\n middle: 16,\r\n large: 24\r\n }[size];\r\n }\r\n\r\n const items = Children.map(children, (child) => {\r\n if (child) {\r\n return <Item>{child}</Item>;\r\n }\r\n });\r\n\r\n return <Container className={className} $direction={direction} $size={size}>\r\n {items}\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.div<{ $size: number, $direction: string }>`\r\n display: inline-flex;\r\n align-items: center;\r\n gap: ${props => props.$size}px;\r\n\r\n ${props => props.$direction === 'vertical' && css`\r\n display: flex;\r\n flex-direction: column;\r\n align-items: inherit;\r\n `}\r\n`;\r\n\r\nconst Item = styled.div`\r\n\r\n`;\r\n","var img = \"data:image/svg+xml,%3csvg t='1651217947509' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='2548' width='16' height='16' fill='currentColor'%3e %3cpath d='M887.904 298.208c-12.864-12.064-33.152-11.488-45.216 1.408L415.936 753.984l-233.12-229.696C170.208 511.872 149.952 512 137.536 524.608c-12.416 12.576-12.256 32.864 0.352 45.248l256.48 252.672c0.096 0.096 0.224 0.128 0.32 0.224 0.096 0.096 0.128 0.224 0.224 0.32 2.016 1.92 4.448 3.008 6.784 4.288 1.152 0.672 2.144 1.664 3.36 2.144 3.776 1.472 7.776 2.24 11.744 2.24 4.192 0 8.384-0.832 12.288-2.496 1.312-0.544 2.336-1.664 3.552-2.368 2.4-1.408 4.896-2.592 6.944-4.672 0.096-0.096 0.128-0.256 0.224-0.352 0.064-0.096 0.192-0.128 0.288-0.224l449.184-478.208C901.44 330.592 900.768 310.336 887.904 298.208z' p-id='2549'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","import RcSteps from 'rc-steps';\r\nimport 'rc-steps/assets/index.css';\r\nimport styled from 'styled-components';\r\nimport { ComponentProps } from 'react';\r\nimport { ReactComponent as CheckIcon } from '../images/step_check.svg';\r\n\r\nexport default function Steps(props: ComponentProps<typeof RcSteps>) {\r\n return <CustomRcSteps\r\n icons={{\r\n finish: <CheckIcon />,\r\n error: <></>\r\n }}\r\n {...props}\r\n />;\r\n}\r\n\r\nSteps.Step = RcSteps.Step;\r\n\r\nconst CustomRcSteps = styled(RcSteps)`\r\n .rc-steps-item-icon {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n\r\n & > .rc-steps-icon {\r\n top: 0;\r\n }\r\n }\r\n\r\n .rc-steps-item-process {\r\n .rc-steps-item-icon {\r\n background: var(--bs-primary);\r\n border-color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-steps-item-finish {\r\n .rc-steps-item-icon {\r\n border-color: var(--bs-primary);\r\n\r\n & > .rc-steps-icon {\r\n color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-steps-item-title:after {\r\n background-color: var(--bs-primary);\r\n }\r\n }\r\n\r\n`;\r\n","import { ReactNode, useCallback, useEffect, useMemo, useState } from 'react';\r\nimport { Pagination as BsPagination } from 'react-bootstrap';\r\n\r\nfunction noop() {\r\n}\r\n\r\n\r\nfunction isInteger(value: any): value is number {\r\n return (\r\n typeof value === 'number' && isFinite(value) && Math.floor(value) === value\r\n );\r\n}\r\n\r\nexport interface PaginationProps {\r\n className?: string\r\n total: number\r\n current?: number\r\n defaultCurrent?: number\r\n pageSize?: number\r\n defaultPageSize?: number,\r\n onChange?: (current: number, pageSize: number) => void\r\n}\r\n\r\nexport default function Pagination({\r\n total = 0,\r\n onChange = noop,\r\n defaultCurrent = 1,\r\n defaultPageSize = 10,\r\n className,\r\n ...props\r\n}: PaginationProps) {\r\n\r\n const [current, setCurrent] = useState(defaultCurrent);\r\n const [pageSize, setPageSize] = useState(defaultPageSize);\r\n\r\n useEffect(() => {\r\n if (isInteger(props.current)) {\r\n setCurrent(props.current);\r\n }\r\n }, [props.current]);\r\n\r\n useEffect(() => {\r\n if (isInteger(props.pageSize)) {\r\n setPageSize(props.pageSize);\r\n }\r\n }, [props.pageSize]);\r\n\r\n const allPages = useMemo(() => {\r\n return Math.floor((total - 1) / pageSize) + 1;\r\n }, [total, pageSize]);\r\n\r\n const handleChange = useCallback((p: number) => {\r\n return () => {\r\n if (p !== current) {\r\n setCurrent(p);\r\n onChange(p, pageSize);\r\n }\r\n };\r\n }, [onChange, current, pageSize]);\r\n\r\n const pageBufferSize = 2;\r\n const prevPage = current - 1 > 0 ? current - 1 : 0;\r\n const nextPage = current + 1 < allPages ? current + 1 : allPages;\r\n\r\n const pagerList: ReactNode[] = [];\r\n let jumpPrev: ReactNode = null;\r\n let jumpNext: ReactNode = null;\r\n let firstPager: ReactNode = null;\r\n let lastPager: ReactNode = null;\r\n\r\n if (allPages <= 3 + pageBufferSize * 2) {\r\n for (let i = 1; i <= allPages; i += 1) {\r\n const active = current === i;\r\n pagerList.push(\r\n <BsPagination.Item key={i} active={active} onClick={handleChange(i)}>{i}</BsPagination.Item>\r\n );\r\n }\r\n } else {\r\n lastPager = <BsPagination.Last key='last' onClick={handleChange(allPages)} />;\r\n firstPager = <BsPagination.First key='first' onClick={handleChange(1)} />;\r\n jumpPrev = <BsPagination.Prev key='prev' onClick={handleChange(prevPage)} />;\r\n jumpNext = <BsPagination.Next key='next' onClick={handleChange(nextPage)} />;\r\n\r\n let left = Math.max(1, current - pageBufferSize);\r\n let right = Math.min(current + pageBufferSize, allPages);\r\n\r\n if (current - 1 <= pageBufferSize) {\r\n right = 1 + pageBufferSize * 2;\r\n }\r\n\r\n if (allPages - current <= pageBufferSize) {\r\n left = allPages - pageBufferSize * 2;\r\n }\r\n\r\n for (let i = left; i <= right; i += 1) {\r\n const active = current === i;\r\n pagerList.push(\r\n <BsPagination.Item key={i} active={active} onClick={handleChange(i)}>{i}</BsPagination.Item>\r\n );\r\n }\r\n\r\n if (current - 1 >= pageBufferSize * 2 && current !== 1 + 2) {\r\n pagerList.unshift(jumpPrev);\r\n }\r\n if (\r\n allPages - current >= pageBufferSize * 2 &&\r\n current !== allPages - 2\r\n ) {\r\n pagerList.push(jumpNext);\r\n }\r\n\r\n if (left !== 1) {\r\n pagerList.unshift(firstPager);\r\n }\r\n if (right !== allPages) {\r\n pagerList.push(lastPager);\r\n }\r\n }\r\n\r\n return <BsPagination className={className}>\r\n {pagerList}\r\n </BsPagination>;\r\n\r\n}\r\n","import { useMemo } from 'react';\r\n\r\ninterface Props {\r\n value: number;\r\n currency?: boolean;\r\n locale?: string;\r\n className?: string;\r\n options?: Intl.NumberFormatOptions;\r\n}\r\n\r\nexport default function NumberFormat({ className, value, locale = 'zh-CN', currency = true, options = {} }: Props) {\r\n\r\n const formatter = useMemo(() => {\r\n\r\n let opt;\r\n\r\n if (currency) {\r\n opt = {\r\n style: 'currency',\r\n currency: 'CNY'\r\n };\r\n } else {\r\n opt = {\r\n minimumFractionDigits: 2,\r\n };\r\n }\r\n\r\n return new Intl.NumberFormat(locale, { ...opt, ...options });\r\n }, [currency, locale, options]);\r\n\r\n if (className) {\r\n return <span className={className}>{formatter.format(value)}</span>;\r\n }\r\n\r\n return <>{formatter.format(value)}</>;\r\n}\r\n","import { Button, ButtonProps } from 'react-bootstrap';\r\n\r\ninterface CustomButtonProps extends ButtonProps {\r\n loading: boolean;\r\n}\r\n\r\nexport default function LoadingButton({ loading, disabled, children, ...props }: CustomButtonProps) {\r\n\r\n return <Button {...props} disabled={loading || disabled}>\r\n {loading ? 'Loading…' : children}\r\n </Button>;\r\n}\r\n","import { OverlayTrigger, OverlayTriggerProps, Tooltip as BsTooltip } from 'react-bootstrap';\r\nimport { uniqueId } from 'lodash';\r\n\r\ninterface TooltipProps {\r\n tooltip: string;\r\n children: OverlayTriggerProps['children'];\r\n placement?: OverlayTriggerProps['placement'];\r\n}\r\n\r\nexport default function Tooltip({ tooltip, children, placement = 'bottom' }: TooltipProps) {\r\n\r\n return <OverlayTrigger\r\n placement={placement}\r\n overlay={\r\n <BsTooltip id={uniqueId()}>\r\n {tooltip}\r\n </BsTooltip>\r\n }\r\n >\r\n {children}\r\n </OverlayTrigger>;\r\n}\r\n","import { createContext } from 'react';\r\n\r\nexport const TableContext = createContext(false);\r\n","import { Button as BsButton, ButtonProps as BsButtonProps, Spinner } from 'react-bootstrap';\r\nimport { forwardRef, useContext } from 'react';\r\nimport Tooltip from './tooltip';\r\nimport { TableContext } from './table/context';\r\n\r\nexport interface ButtonProps extends BsButtonProps {\r\n loading?: boolean;\r\n percent?: number;\r\n tooltip?: string;\r\n}\r\n\r\nconst Button = forwardRef<any, ButtonProps>((\r\n {\r\n loading,\r\n percent,\r\n disabled,\r\n children,\r\n tooltip,\r\n variant,\r\n ...props\r\n },\r\n ref\r\n) => {\r\n\r\n const inTable = useContext(TableContext);\r\n\r\n if (inTable && !variant) {\r\n variant = 'link';\r\n }\r\n\r\n if (loading) {\r\n disabled = true;\r\n children = <>\r\n <Spinner ref={ref} as='span' size='sm' role='status' aria-hidden='true' animation='border' />\r\n {percent ? <span className='ms-2'>{percent}%</span> : null}\r\n </>;\r\n }\r\n\r\n const button = <BsButton ref={ref} {...props} variant={variant} disabled={disabled}>{children}</BsButton>;\r\n\r\n if (tooltip) {\r\n return <Tooltip tooltip={tooltip}>\r\n <span className={'d-inline-block'}>{button}</span>\r\n </Tooltip>;\r\n }\r\n\r\n return button;\r\n});\r\n\r\nexport default Button;\r\n","export default class Unauthorized extends Error {\r\n\r\n url: string;\r\n\r\n constructor(url: string) {\r\n super('Unauthorized');\r\n this.url = url;\r\n }\r\n}\r\n","import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';\r\nimport queryString from 'query-string';\r\nimport * as rax from 'retry-axios';\r\nimport { RetryConfig } from 'retry-axios';\r\nimport Unauthorized from './errors/unauthorized';\r\nimport Toast from './utils/toast';\r\nimport Message from './utils/message';\r\n\r\nexport type Errors = string | {\r\n [key: string]: string\r\n}\r\n\r\ndeclare module 'retry-axios' {\r\n interface RetryConfig {\r\n retryDecider?: () => boolean;\r\n }\r\n}\r\n\r\ndeclare module 'axios' {\r\n interface AxiosError {\r\n errors: Errors;\r\n }\r\n\r\n interface AxiosRequestConfig {\r\n raxConfig?: RetryConfig;\r\n }\r\n}\r\n\r\nrax.attach();\r\naxios.defaults.raxConfig = {\r\n retryDelay: 2000,\r\n backoffType: 'static',\r\n shouldRetry: ({ config, response }) => {\r\n if (config.raxConfig?.retryDecider && !config.raxConfig.retryDecider()) {\r\n return false;\r\n }\r\n return config.method?.toUpperCase() === 'GET' && response?.status === 449;\r\n }\r\n};\r\naxios.defaults.maxContentLength = Infinity;\r\naxios.defaults.maxBodyLength = Infinity;\r\naxios.defaults.baseURL = '/api';\r\naxios.interceptors.request.use(\r\n config => {\r\n const token = localStorage.getItem('authorization');\r\n\r\n if (token) {\r\n config.headers = {\r\n ...config.headers,\r\n Authorization: `Bearer ${token}`\r\n };\r\n }\r\n return config;\r\n },\r\n error => {\r\n return Promise.reject(error);\r\n }\r\n);\r\n\r\nconst isRecord = (data: any): data is Record<string, string> => {\r\n return data && (typeof data === 'object');\r\n};\r\n\r\naxios.interceptors.response.use(\r\n response => {\r\n if (response.status === 201 && response.data.location) {\r\n window.location.href = response.data.location;\r\n response.data = undefined; //防止多次跳转\r\n }\r\n\r\n return response;\r\n },\r\n e => {\r\n if (axios.isAxiosError(e)) {\r\n if (e.response) {\r\n const { data, status } = e.response;\r\n if (status === 401) {\r\n e.errors = 'Unauthorized';\r\n if (isRecord(data) && data.url) {\r\n e = new Unauthorized(data.url);\r\n }\r\n Toast.error('Unauthorized');\r\n } else {\r\n if (isRecord(data)) {\r\n if (status === 422) {\r\n e.errors = data;\r\n } else if ('message' in data) {\r\n e.errors = data['message'];\r\n }\r\n } else {\r\n e.errors = data as string;\r\n }\r\n }\r\n }\r\n }\r\n return Promise.reject(e);\r\n }\r\n);\r\n\r\nexport type RequestConfig = AxiosRequestConfig | string\r\nexport type RequestInstance = AxiosInstance\r\nexport const isRequestError = axios.isAxiosError;\r\n\r\nexport const showRequestError = (e: any) => {\r\n if (axios.isAxiosError(e)) {\r\n let errors = e.errors;\r\n if (typeof e.errors !== 'string') {\r\n errors = Object.values(e.errors).join('<br />');\r\n }\r\n Message.error({ title: errors as string });\r\n } else {\r\n throw e;\r\n }\r\n};\r\n\r\nconst request = async function <T = any>(config: RequestConfig) {\r\n config = typeof config === 'string' ? { url: config } : config;\r\n\r\n const { data } = await axios.request<T>({\r\n paramsSerializer: function(params) {\r\n return queryString.stringify(params, {\r\n sort: false,\r\n skipNull: true,\r\n skipEmptyString: true\r\n });\r\n },\r\n ...config\r\n });\r\n\r\n return data;\r\n};\r\n\r\nrequest.defaults = axios.defaults;\r\nrequest.interceptors = axios.interceptors;\r\n\r\nexport default request;\r\n","import request, { RequestConfig, showRequestError } from '../request';\r\nimport { createElement, ElementType, MouseEvent, useCallback, useState } from 'react';\r\nimport Message from '../utils/message';\r\nimport { AxiosRequestConfig } from 'axios';\r\nimport Button, { ButtonProps } from './button';\r\n\r\ninterface Props extends Omit<ButtonProps, 'as'> {\r\n url: RequestConfig;\r\n method?: AxiosRequestConfig['method'];\r\n confirm?: string;\r\n onSuccess?: (result: any) => void;\r\n as?: ElementType | ButtonProps['as'];\r\n}\r\n\r\nexport default function RequestButton({\r\n url,\r\n method,\r\n confirm,\r\n onSuccess,\r\n children,\r\n disabled,\r\n as = Button,\r\n ...props\r\n}: Props) {\r\n\r\n const [fetching, setFetching] = useState(false);\r\n\r\n const handleClick = useCallback(async (e: MouseEvent) => {\r\n e.preventDefault();\r\n try {\r\n setFetching(true);\r\n if (confirm) {\r\n if (!await Message.confirm({ text: confirm })) {\r\n return;\r\n }\r\n }\r\n\r\n const config = typeof url === 'string' ? { url, method } : { method, ...url };\r\n\r\n const result = await request(config);\r\n\r\n if (onSuccess) {\r\n onSuccess(result);\r\n }\r\n } catch (e) {\r\n showRequestError(e);\r\n } finally {\r\n setFetching(false);\r\n }\r\n }, [url, method, setFetching]);\r\n\r\n return createElement(as, {\r\n ...props,\r\n disabled: disabled || fetching,\r\n onClick: handleClick\r\n }, children);\r\n}\r\n","import JsonForm, { getRegistry, JsonFormProps, JsonFormType } from '@topthink/json-form';\r\nimport * as React from 'react';\r\nimport {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useCallback,\r\n useState\r\n} from 'react';\r\nimport axios, { AxiosError, Method } from 'axios';\r\nimport request from '../request';\r\nimport { mapValues } from 'lodash';\r\nimport { AjvError, ISubmitEvent, WidgetProps } from '@rjsf/core';\r\nimport Button from './button';\r\n\r\nconst localize = require('ajv-i18n/localize/zh');\r\n\r\nexport interface FormProps<T = any> extends JsonFormProps<T> {\r\n onSuccess?: (data: any) => void;\r\n method?: Method;\r\n children?: ReactNode | ((props: { submit: ReactNode, loading: boolean }) => ReactNode);\r\n submitText?: string;\r\n onSubmitting?: (submitting: boolean) => void;\r\n}\r\n\r\ntype Error = {\r\n __errors: string[]\r\n}\r\n\r\ntype Errors = Error | {\r\n [key: string]: Error\r\n}\r\n\r\nconst toExtraErrors = (error: AxiosError): Errors => {\r\n const errors = error.errors;\r\n if (typeof errors === 'string') {\r\n return {\r\n __errors: [errors]\r\n };\r\n }\r\n return mapValues(errors, (e) => {\r\n return {\r\n __errors: [e]\r\n };\r\n });\r\n};\r\n\r\nconst widgets = {\r\n upload: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\r\n const data = new FormData();\r\n\r\n data.set('file', file);\r\n\r\n const { url } = await request({\r\n url: options.endpoint as string,\r\n method: 'post',\r\n data\r\n });\r\n\r\n return url;\r\n };\r\n }\r\n\r\n return <widgets.upload {...props} options={options} />;\r\n },\r\n editor: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\r\n const data = new FormData();\r\n\r\n data.set('file', file);\r\n\r\n const { url } = await request({\r\n url: props.options.endpoint as string,\r\n method: 'post',\r\n data\r\n });\r\n\r\n return url;\r\n };\r\n }\r\n\r\n return <widgets.editor {...props} options={options} />;\r\n }\r\n};\r\n\r\nexport interface FormType extends JsonFormType {\r\n\r\n}\r\n\r\ntype Form<T = any> = ForwardRefExoticComponent<PropsWithoutRef<FormProps<T>> & RefAttributes<FormType>>\r\n\r\nconst Form: Form = forwardRef(({\r\n action,\r\n method = 'post',\r\n onSuccess,\r\n formData,\r\n onSubmitting,\r\n onSubmit,\r\n onChange,\r\n submitText = '提交',\r\n children,\r\n ...props\r\n}, ref) => {\r\n\r\n const [extraErrors, setExtraErrors] = useState<Errors>();\r\n const [loading, setLoading] = useState(false);\r\n const [data, setData] = useState(formData);\r\n\r\n const handleSubmit = useCallback(async (e: ISubmitEvent<any>, nativeEvent: React.FormEvent<HTMLFormElement>) => {\r\n if (!loading) {\r\n try {\r\n setLoading(true);\r\n if (onSubmitting) {\r\n onSubmitting(true);\r\n }\r\n if (action) {\r\n const { formData } = e;\r\n //todo 包含File对象需转FormData\r\n try {\r\n const result = await request({\r\n url: action,\r\n method,\r\n data: formData\r\n });\r\n setExtraErrors(undefined);\r\n if (onSuccess) {\r\n await onSuccess(result);\r\n }\r\n return result;\r\n } catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n setExtraErrors(toExtraErrors(e));\r\n } else {\r\n throw e;\r\n }\r\n }\r\n } else if (onSubmit) {\r\n return await onSubmit(e, nativeEvent);\r\n }\r\n } finally {\r\n setLoading(false);\r\n if (onSubmitting) {\r\n onSubmitting(false);\r\n }\r\n }\r\n }\r\n }, [action, method, onSubmit]);\r\n\r\n const handleChange = useCallback((e: ISubmitEvent<any>) => {\r\n const { formData } = e;\r\n setData(formData);\r\n if (onChange) {\r\n onChange(e);\r\n }\r\n }, [setData, onChange]);\r\n\r\n const transformErrors = useCallback((errors: AjvError[]) => {\r\n errors = errors.map(error => ({\r\n keyword: error.name,\r\n dataPath: error.property,\r\n ...error\r\n }));\r\n\r\n localize(errors);\r\n\r\n return errors;\r\n }, []);\r\n\r\n const submit = <Button className={'px-4'} loading={loading} type='submit' variant='primary'>{submitText}</Button>;\r\n\r\n if (typeof children === 'function') {\r\n children = children({ submit, loading });\r\n }\r\n\r\n return <JsonForm\r\n ref={ref}\r\n extraErrors={extraErrors}\r\n onSubmit={handleSubmit}\r\n transformErrors={transformErrors}\r\n noHtml5Validate\r\n noValidate\r\n {...props}\r\n formData={data}\r\n onChange={handleChange}\r\n widgets={widgets}\r\n >\r\n {children || <div className='col-12'>\r\n {submit}\r\n </div>}\r\n </JsonForm>;\r\n});\r\n\r\nexport default Form;\r\n","import { Columns, TableProps, TableRowSelection } from './index';\r\nimport { InputHTMLAttributes, Key, useCallback, useEffect, useRef, useState } from 'react';\r\n\r\nconst Checkbox = function({\r\n indeterminate = false,\r\n ...props\r\n}: InputHTMLAttributes<HTMLInputElement> & { indeterminate?: boolean }) {\r\n\r\n const ref = useRef<HTMLInputElement>(null);\r\n\r\n useEffect(() => {\r\n if (ref.current) {\r\n ref.current.indeterminate = indeterminate;\r\n }\r\n }, [indeterminate]);\r\n\r\n return <input\r\n ref={ref}\r\n {...props}\r\n className='form-check-input'\r\n type='checkbox'\r\n />;\r\n};\r\n\r\nexport default function useSelection<T = any>(\r\n rowSelection: TableRowSelection<T> | undefined,\r\n rowKey: Required<TableProps<T>>['rowKey'],\r\n data: T[]\r\n) {\r\n const [keys, setKeys] = useState(() => new Set(rowSelection?.selectedRowKeys || []));\r\n\r\n const getRowKey = (record: T) => {\r\n if (typeof rowKey === 'string') {\r\n // @ts-ignore\r\n return record[rowKey];\r\n } else {\r\n return rowKey(record);\r\n }\r\n };\r\n\r\n const getRecordByKey = (key: Key) => {\r\n return data.find((record) => {\r\n return getRowKey(record) === key;\r\n })!;\r\n };\r\n\r\n const setSelectedKeys = useCallback((keys: Set<Key>) => {\r\n setKeys(keys);\r\n const changedKeys = Array.from(keys);\r\n\r\n const records = changedKeys.map(function(key) {\r\n return getRecordByKey(key);\r\n });\r\n\r\n if (rowSelection?.onChange) {\r\n rowSelection?.onChange(changedKeys, records);\r\n }\r\n }, [getRecordByKey]);\r\n\r\n const transformColumns = useCallback((columns: Columns): Columns => {\r\n if (!rowSelection) {\r\n return columns;\r\n }\r\n\r\n const recordKeys = data.map(getRowKey);\r\n\r\n const checkedCurrentAll = recordKeys.every(function(key) {\r\n return keys.has(key);\r\n });\r\n const checkedCurrentSome = recordKeys.some(function(key) {\r\n return keys.has(key);\r\n });\r\n\r\n return [{\r\n key: 'selection',\r\n title: <Checkbox\r\n checked={checkedCurrentAll}\r\n indeterminate={!checkedCurrentAll && checkedCurrentSome}\r\n onChange={() => {\r\n if (checkedCurrentAll) {\r\n recordKeys.forEach(function(key) {\r\n keys.delete(key);\r\n });\r\n } else {\r\n recordKeys.forEach(function(key) {\r\n keys.add(key);\r\n });\r\n }\r\n setSelectedKeys(new Set(keys));\r\n }}\r\n />,\r\n width: 30,\r\n align: 'center',\r\n render({ record }) {\r\n const key = getRowKey(record);\r\n const checked = keys.has(key);\r\n return <Checkbox\r\n checked={checked}\r\n onChange={() => {\r\n if (checked) {\r\n keys.delete(key);\r\n } else {\r\n keys.add(key);\r\n }\r\n setSelectedKeys(new Set(keys));\r\n }}\r\n />;\r\n }\r\n }, ...columns];\r\n }, [data, rowSelection, keys]);\r\n\r\n return [transformColumns];\r\n}\r\n","var img = \"data:image/svg+xml,%3csvg t='1681378941268' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='11434' width='16' height='16' fill='currentColor'%3e %3cpath d='M252.068571 906.496h520.283429c89.581714 0 134.144-44.562286 134.144-132.845714V250.331429c0-88.283429-44.562286-132.845714-134.144-132.845715H252.068571c-89.142857 0-134.582857 44.141714-134.582857 132.845715V773.668571c0 88.704 45.44 132.845714 134.582857 132.845715z m1.28-68.992c-42.843429 0-66.852571-22.710857-66.852571-67.291429V253.805714c0-44.580571 24.009143-67.291429 66.852571-67.291428h517.723429c42.422857 0 66.432 22.710857 66.432 67.291428V770.194286c0 44.580571-24.009143 67.291429-66.432 67.291428z m258.432-123.008c22.710857 0 36.425143-15.853714 36.425143-40.704v-126.427429h134.144c24.009143 0 40.722286-12.873143 40.722286-35.584 0-23.131429-15.853714-36.425143-40.722286-36.425142H548.205714v-134.582858c0-24.850286-13.714286-40.704-36.425143-40.704s-35.565714 16.713143-35.565714 40.722286v134.582857H342.491429c-24.850286 0-41.142857 13.275429-41.142858 36.406857 0 22.710857 17.152 35.584 41.142858 35.584h133.723428v126.427429c0 23.990857 12.854857 40.704 35.565714 40.704z' p-id='11435'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","var img = \"data:image/svg+xml,%3csvg t='1681378996359' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='12821' width='16' height='16' fill='currentColor'%3e %3cpath d='M252.068571 906.496h520.283429c89.581714 0 134.144-44.562286 134.144-132.845714V250.331429c0-88.283429-44.562286-132.845714-134.144-132.845715H252.068571c-89.142857 0-134.582857 44.141714-134.582857 132.845715V773.668571c0 88.704 45.44 132.845714 134.582857 132.845715z m1.28-68.992c-42.843429 0-66.852571-22.710857-66.852571-67.291429V253.805714c0-44.580571 24.009143-67.291429 66.852571-67.291428h517.723429c42.422857 0 66.432 22.710857 66.432 67.291428V770.194286c0 44.580571-24.009143 67.291429-66.432 67.291428z m86.582858-289.718857h344.576c23.990857 0 40.704-12.854857 40.704-35.565714 0-23.149714-15.433143-36.425143-40.704-36.425143H339.931429c-24.868571 0-40.722286 13.275429-40.722286 36.425143 0 22.710857 16.713143 35.565714 40.722286 35.565714z' p-id='12822'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","import { DependencyList, useCallback, useEffect, useRef } from 'react';\r\n\r\nexport default function useCallbackRef<T extends (...args: any[]) => any>(\r\n callback: T | undefined,\r\n deps: DependencyList = [],\r\n) {\r\n const callbackRef = useRef(callback);\r\n\r\n useEffect(() => {\r\n callbackRef.current = callback;\r\n });\r\n\r\n return useCallback(((...args) => callbackRef.current?.(...args)) as T, deps);\r\n}\r\n","import { Dispatch, SetStateAction, useState } from 'react';\r\nimport useCallbackRef from './use-callback-ref';\r\n\r\nexport interface UseControllableStateProps<T> {\r\n value?: T;\r\n defaultValue?: T | (() => T);\r\n onChange?: (value: T) => void;\r\n shouldUpdate?: (prev: T, next: T) => boolean;\r\n}\r\n\r\nexport default function useControllableState<T>(props: UseControllableStateProps<T>) {\r\n const {\r\n value: valueProp,\r\n defaultValue,\r\n onChange,\r\n shouldUpdate = (prev, next) => prev !== next,\r\n } = props;\r\n\r\n const onChangeProp = useCallbackRef(onChange);\r\n const shouldUpdateProp = useCallbackRef(shouldUpdate);\r\n\r\n const [uncontrolledState, setUncontrolledState] = useState(defaultValue as T);\r\n const controlled = valueProp !== undefined;\r\n const value = controlled ? valueProp : uncontrolledState;\r\n\r\n const setValue = useCallbackRef(\r\n (next: SetStateAction<T>) => {\r\n const setter = next as (prevState?: T) => T;\r\n const nextValue = typeof next === 'function' ? setter(value) : next;\r\n\r\n if (!shouldUpdateProp(value, nextValue)) {\r\n return;\r\n }\r\n\r\n if (!controlled) {\r\n setUncontrolledState(nextValue);\r\n }\r\n\r\n onChangeProp(nextValue);\r\n },\r\n [controlled, onChangeProp, value, shouldUpdateProp],\r\n );\r\n\r\n return [value, setValue] as [T, Dispatch<SetStateAction<T>>];\r\n}\r\n","import { debounce, DebouncedFunc } from 'lodash';\r\nimport { useEffect, useRef } from 'react';\r\n\r\nexport default function useDebounce<T extends (...args: any) => any>(callback: T, wait: number, options?: {}): DebouncedFunc<T> {\r\n const callbackRef = useRef<T>(callback);\r\n const debouncedCallbackRef = useRef<DebouncedFunc<T>>(\r\n debounce(callback, wait, options)\r\n );\r\n\r\n useEffect(() => {\r\n callbackRef.current = callback;\r\n });\r\n\r\n useEffect(() => {\r\n debouncedCallbackRef.current = debounce((...args: any) => {\r\n callbackRef.current(...args);\r\n }, wait, options);\r\n }, [wait, options]);\r\n\r\n return debouncedCallbackRef.current;\r\n}\r\n","import { Form } from 'react-bootstrap';\r\nimport { ChangeEvent, useCallback, useEffect, useState } from 'react';\r\nimport useDebounce from '../../hooks/use-debounce';\r\n\r\ninterface Props {\r\n keyword: string;\r\n onKeywordChange: (value: string) => void;\r\n}\r\n\r\nexport default function Search({ keyword, onKeywordChange }: Props) {\r\n\r\n const [value, setValue] = useState(keyword);\r\n\r\n const debouncedOnKeywordChange = useDebounce(onKeywordChange, 500);\r\n\r\n useEffect(() => {\r\n setValue(keyword);\r\n }, [keyword]);\r\n\r\n const onChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\r\n setValue(e.target.value);\r\n debouncedOnKeywordChange(e.target.value);\r\n }, [debouncedOnKeywordChange, setValue]);\r\n\r\n return <Form.Control value={value} onChange={onChange} type={'search'} placeholder={'Search...'} />;\r\n}\r\n","import RcTable, { TableProps as RcTableProps } from 'rc-table';\r\nimport { unstable_batchedUpdates } from 'react-dom';\r\nimport { ColumnType as BsColumnType, RenderedCell, RenderExpandIconProps } from 'rc-table/es/interface';\r\nimport { Table as BsTable } from 'react-bootstrap';\r\nimport { useUrlSearchParams } from 'use-url-search-params';\r\nimport {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n Key,\r\n PropsWithChildren,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useCallback,\r\n useEffect,\r\n useImperativeHandle,\r\n useMemo,\r\n useRef,\r\n useState\r\n} from 'react';\r\nimport Pagination from '../pagination';\r\nimport styled from 'styled-components';\r\nimport request from '../../request';\r\nimport Card from '../card';\r\nimport Loader from '../loader';\r\nimport Space from '../space';\r\nimport useSelection from './use-selection';\r\nimport { PaginationType } from '../../utils/types';\r\nimport { ReactComponent as PlusIcon } from '../../images/plus_square.svg';\r\nimport { ReactComponent as MinusIcon } from '../../images/minus_square.svg';\r\nimport useControllableState from '../../hooks/use-controllable-state';\r\nimport Search from './search';\r\nimport NumberFormat from '../number-format';\r\nimport { TableContext } from './context';\r\n\r\nexport interface TableType {\r\n reload: () => void;\r\n}\r\n\r\ninterface ColumnType<RecordType> extends BsColumnType<RecordType> {\r\n render?: (data: {\r\n value: any,\r\n record: RecordType,\r\n index: number,\r\n action: TableType\r\n }) => ReactNode | RenderedCell<RecordType>;\r\n valueType?: 'currency';\r\n}\r\n\r\nexport type Columns<RecordType = any> = ColumnType<RecordType>[]\r\n\r\nconst CustomTHead = styled.thead`\r\n th {\r\n padding: 0.5rem 0.5rem;\r\n border-bottom-width: 1px;\r\n border-color: var(--bs-border-color);\r\n }\r\n`;\r\n\r\nconst components: RcTableProps['components'] = {\r\n table: (props) => {\r\n return <BsTable {...props} className='mb-0 align-middle table-hover' />;\r\n },\r\n header: {\r\n wrapper(props) {\r\n return <CustomTHead {...props} />;\r\n }\r\n }\r\n};\r\n\r\nconst ExpandIconContainer = styled.a`\r\n cursor: pointer;\r\n width: 28px;\r\n height: 28px;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n vertical-align: middle;\r\n`;\r\n\r\nconst ExpandIcon = function <RecordType>({\r\n record,\r\n expanded,\r\n expandable,\r\n onExpand\r\n}: RenderExpandIconProps<RecordType>) {\r\n if (!expandable) return <ExpandIconContainer />;\r\n return <ExpandIconContainer onClick={e => onExpand(record, e)}>\r\n {expanded ? <MinusIcon /> : <PlusIcon />}\r\n </ExpandIconContainer>;\r\n};\r\n\r\nconst CustomPagination = styled(Pagination)`\r\n margin-bottom: 0;\r\n justify-content: flex-end;\r\n margin-top: 1rem;\r\n`;\r\n\r\nfunction isPagination<T>(data: any): data is PaginationType<T> {\r\n return 'current_page' in data;\r\n}\r\n\r\nexport interface TableRowSelection<RecordType = any> {\r\n selectedRowKeys?: Key[];\r\n onChange?: (selectedRowKeys: Key[], selectedRows: RecordType[]) => void;\r\n}\r\n\r\nexport interface TableProps<RecordType = any> extends Omit<RcTableProps<RecordType>, 'children' | 'columns'> {\r\n source: string | ((params: Params) => Promise<RecordType>);\r\n paginate?: boolean;\r\n columns: Columns<RecordType>;\r\n toolBarRender?: ((action: TableType) => ReactNode) | false;\r\n search?: boolean;\r\n rowSelection?: TableRowSelection<RecordType>;\r\n card?: boolean;\r\n sync?: boolean;\r\n}\r\n\r\ntype Params = {\r\n page?: number;\r\n sortField?: string;\r\n sortOrder?: number;\r\n q?: string;\r\n [key: string]: any;\r\n};\r\n\r\ntype CustomTableType<T = any> = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<TableProps<T>>>\r\n & RefAttributes<TableType>>\r\n\r\nconst Table: CustomTableType = forwardRef((\r\n {\r\n source,\r\n rowKey = 'id',\r\n paginate = true,\r\n toolBarRender,\r\n columns = [],\r\n search,\r\n rowSelection,\r\n card = true,\r\n expandable = {},\r\n sync = false,\r\n ...props\r\n },\r\n ref\r\n) => {\r\n const [data, setData] = useState<any[]>([]);\r\n const [pagination, setPagination] = useState(paginate ? { total: 0, current: 1, pageSize: 10 } : null);\r\n const [loading, setLoading] = useState(true);\r\n\r\n const [params, setParams] = useUrlSearchParams({});\r\n\r\n const [keyword, setKeyword] = useControllableState<string>({\r\n value: sync ? (params.q as string || '') : undefined,\r\n defaultValue: '',\r\n onChange: (value) => {\r\n if (sync) {\r\n setParams({ q: value || undefined });\r\n }\r\n }\r\n });\r\n\r\n const [page, setPage] = useControllableState<number>({\r\n value: sync ? (params.page as number || 1) : undefined,\r\n defaultValue: 1,\r\n onChange: (value) => {\r\n if (sync) {\r\n setParams({ page: value || undefined });\r\n }\r\n }\r\n });\r\n\r\n const fetchData = useCallback(async () => {\r\n setLoading(true);\r\n try {\r\n let result;\r\n const params: Params = {\r\n q: keyword,\r\n page: page > 1 ? page : undefined,\r\n };\r\n\r\n if (typeof source === 'string') {\r\n result = await request({\r\n url: source,\r\n params,\r\n });\r\n } else {\r\n result = await source(params);\r\n }\r\n\r\n if (paginate && isPagination<any>(result)) {\r\n setPagination({\r\n total: result.total,\r\n current: result.current_page,\r\n pageSize: result.per_page\r\n });\r\n result = result.data;\r\n }\r\n setData(result);\r\n } catch (e) {\r\n\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [source, setData, keyword, page]);\r\n\r\n useEffect(() => {\r\n fetchData();\r\n }, [keyword, page]);\r\n\r\n const action = useRef<TableType>({\r\n reload: fetchData\r\n });\r\n\r\n useEffect(() => {\r\n action.current = {\r\n reload: fetchData\r\n };\r\n }, [fetchData]);\r\n\r\n useImperativeHandle(ref, () => action.current);\r\n\r\n //多选\r\n const [transformColumns] = useSelection(rowSelection, rowKey, data);\r\n\r\n const customColumns = useMemo(() => {\r\n return transformColumns(columns).map(({ render, valueType, ...column }) => {\r\n const customColumn: BsColumnType<any> = { ...column };\r\n\r\n if (render) {\r\n customColumn.render = (value, record, index) => {\r\n return render({ value, record, index, action: action.current });\r\n };\r\n } else if (valueType === 'currency') {\r\n customColumn.render = (value) => {\r\n return <NumberFormat value={value} />;\r\n };\r\n }\r\n return customColumn;\r\n });\r\n }, [columns, transformColumns, action]);\r\n\r\n const children = <>\r\n <Loader loading={loading} />\r\n {toolBarRender !== false && <Header>\r\n <LeftTools size={12}>\r\n {toolBarRender && toolBarRender(action.current)}\r\n </LeftTools>\r\n <RightTools size={12}>\r\n {search && <Search keyword={keyword} onKeywordChange={(value) => {\r\n unstable_batchedUpdates(() => {\r\n setPage(1);\r\n setKeyword(value);\r\n });\r\n }} />}\r\n <Action onClick={action.current.reload}><i className='bi bi-arrow-repeat' /></Action>\r\n </RightTools>\r\n </Header>}\r\n <TableContext.Provider value={true}>\r\n <RcTable {...props} expandable={{ expandIcon: ExpandIcon, ...expandable }} rowKey={rowKey} columns={customColumns} components={components} data={data} />\r\n </TableContext.Provider>\r\n {pagination && <CustomPagination {...pagination} onChange={setPage} />}\r\n </>;\r\n\r\n if (card) {\r\n return <Card>\r\n {children}\r\n </Card>;\r\n }\r\n return children;\r\n});\r\n\r\nexport default Table;\r\n\r\nconst Header = styled.div`\r\n display: flex;\r\n justify-content: space-between;\r\n padding-bottom: 1rem;\r\n height: 48px;\r\n border-bottom: 2px solid #212529;\r\n`;\r\n\r\nconst RightTools = styled(Space)`\r\n\r\n`;\r\nconst LeftTools = styled(Space)`\r\n\r\n`;\r\n\r\nconst Action = styled.span`\r\n cursor: pointer;\r\n font-size: 20px;\r\n line-height: 1;\r\n\r\n &:hover {\r\n color: var(--bs-primary);\r\n }\r\n`;\r\n","import { useCallback, useState } from 'react';\r\n\r\ninterface Options {\r\n onHide?: () => void;\r\n onShow?: () => void;\r\n}\r\n\r\nlet id = 0;\r\n\r\nexport default function useOverlayState({ onHide, onShow }: Options = {}) {\r\n const [visible, setVisible] = useState(false);\r\n\r\n const [key, setKey] = useState(`visible-${id}`);\r\n\r\n const hide = useCallback(() => {\r\n setVisible(false);\r\n if (onHide) {\r\n onHide();\r\n }\r\n }, [setVisible, onHide]);\r\n\r\n const exit = useCallback(() => {\r\n setKey(`visible-${++id}`);\r\n }, [setKey, id]);\r\n\r\n const show = useCallback(() => {\r\n setVisible(true);\r\n if (onShow) {\r\n onShow();\r\n }\r\n }, [setVisible, onShow]);\r\n\r\n const state = {\r\n show: visible,\r\n onHide: hide,\r\n onExited: exit,\r\n key\r\n };\r\n\r\n return {\r\n visible,\r\n show,\r\n hide,\r\n state\r\n };\r\n}\r\n","import { Modal as ReactModal, ModalProps as ReactModalProps } from 'react-bootstrap';\r\nimport { ElementType, MouseEvent, ReactNode, useMemo, useState } from 'react';\r\nimport Button, { ButtonProps } from './button';\r\n\r\nexport interface ModalProps extends Pick<\r\n ReactModalProps,\r\n 'backdrop' | 'centered' | 'size' | 'scrollable' | 'fullscreen' | 'onHide' | 'onShow' | 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited'\r\n> {\r\n children: ReactNode;\r\n header?: ReactNode;\r\n footer?: ReactNode | ((args: { okButton: ReactNode, cancelButton: ReactNode }) => ReactNode);\r\n okText?: string;\r\n cancelText?: string;\r\n closable?: boolean;\r\n show?: boolean;\r\n onOk?: (e: MouseEvent) => void;\r\n onCancel?: (e: MouseEvent) => void;\r\n okButtonProps?: ButtonProps;\r\n bodyAs?: ElementType;\r\n headerAs?: ElementType;\r\n confirmLoading?: boolean;\r\n}\r\n\r\nexport default function Modal({\r\n header,\r\n children,\r\n footer,\r\n closable = true,\r\n show,\r\n cancelText = '取消',\r\n okText = '确定',\r\n onOk,\r\n onCancel,\r\n onHide,\r\n okButtonProps,\r\n bodyAs,\r\n headerAs = 'h5',\r\n confirmLoading = false,\r\n ...rest\r\n}: ModalProps) {\r\n\r\n const [loading, setLoading] = useState(false);\r\n\r\n const okButton = useMemo(() => {\r\n return <Button loading={loading || confirmLoading} variant={'primary'} onClick={async (e) => {\r\n setLoading(true);\r\n try {\r\n await onOk?.(e);\r\n if (!e.defaultPrevented) {\r\n onHide?.();\r\n }\r\n } finally {\r\n setLoading(false);\r\n }\r\n }} {...okButtonProps}>{okText}</Button>;\r\n }, [okButtonProps, okText, onOk, onHide, loading, confirmLoading]);\r\n\r\n const cancelButton = useMemo(() => {\r\n return <Button variant='secondary' onClick={(e) => {\r\n onCancel?.(e);\r\n if (!e.defaultPrevented) {\r\n onHide?.();\r\n }\r\n }}>{cancelText}</Button>;\r\n }, [onCancel, onHide, cancelText]);\r\n\r\n switch (typeof footer) {\r\n case 'undefined':\r\n footer = <>\r\n {cancelButton}\r\n {okButton}\r\n </>;\r\n break;\r\n case 'function':\r\n footer = footer({ okButton, cancelButton });\r\n break;\r\n }\r\n\r\n return <ReactModal {...rest} onHide={onHide} show={show}>\r\n {header && <ReactModal.Header closeButton={closable}>\r\n <ReactModal.Title as={headerAs}>{header}</ReactModal.Title>\r\n </ReactModal.Header>}\r\n <ReactModal.Body as={bodyAs}>{children}</ReactModal.Body>\r\n {footer && <ReactModal.Footer>{footer}</ReactModal.Footer>}\r\n </ReactModal>;\r\n}\r\n","import {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n MouseEvent,\r\n PropsWithChildren,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useImperativeHandle\r\n} from 'react';\r\nimport useOverlayState from '../hooks/use-overlay-state';\r\nimport Modal, { ModalProps } from './modal';\r\nimport { ButtonProps } from 'react-bootstrap';\r\nimport Button from './button';\r\n\r\nexport interface ModalButtonProps extends ButtonProps {\r\n text: ReactNode;\r\n modalProps?: Omit<ModalProps, 'children' | 'confirmLoading' | 'onOk'>;\r\n onOk?: () => any;\r\n onShow?: () => void;\r\n confirmLoading?: boolean;\r\n}\r\n\r\nexport interface ModalType {\r\n close: () => void;\r\n}\r\n\r\ntype ModalButtonType = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<ModalButtonProps>>\r\n & RefAttributes<ModalType>>\r\n\r\nconst ModalButton: ModalButtonType = forwardRef(({\r\n text,\r\n onOk,\r\n modalProps,\r\n children,\r\n onShow,\r\n confirmLoading,\r\n ...props\r\n}, ref) => {\r\n\r\n const { state, show, hide } = useOverlayState({ onShow });\r\n\r\n useImperativeHandle(ref, () => ({\r\n close: hide\r\n }));\r\n\r\n const handleOk = async (e: MouseEvent) => {\r\n if (onOk) {\r\n const result = await onOk();\r\n if (result === false) {\r\n e.preventDefault();\r\n }\r\n }\r\n };\r\n\r\n const button = <Button onClick={show} {...props}>{text}</Button>;\r\n\r\n return <>\r\n {button}\r\n <Modal\r\n header={text}\r\n {...modalProps}\r\n {...state}\r\n confirmLoading={confirmLoading}\r\n onOk={handleOk}\r\n >\r\n {children}\r\n </Modal>\r\n </>;\r\n});\r\n\r\nexport default ModalButton;\r\n","import ModalButton, { ModalButtonProps, ModalType } from './modal-button';\r\nimport { ReactNode, useCallback, useRef, useState } from 'react';\r\nimport Form, { FormProps, FormType } from './form';\r\n\r\nexport interface ModalFormProps<T = any> extends FormProps<T> {\r\n text: ReactNode;\r\n buttonProps?: Omit<ModalButtonProps, 'text' | 'modalProps' | 'confirmLoading' | 'onOk'>;\r\n modalProps?: ModalButtonProps['modalProps'];\r\n children?: ReactNode;\r\n}\r\n\r\nexport default function ModalForm<T = any>({\r\n text,\r\n onSuccess,\r\n buttonProps,\r\n modalProps,\r\n children,\r\n ...props\r\n}: ModalFormProps<T>) {\r\n\r\n const [loading, setLoading] = useState(false);\r\n\r\n const ref = useRef<ModalType>(null);\r\n const form = useRef<FormType>(null);\r\n\r\n const handleOk = useCallback(() => {\r\n form.current?.submit();\r\n return false;\r\n }, []);\r\n\r\n const handleSuccess = useCallback((data) => {\r\n if (onSuccess) {\r\n onSuccess(data);\r\n }\r\n ref.current?.close();\r\n }, [onSuccess]);\r\n\r\n\r\n return <ModalButton\r\n ref={ref}\r\n text={text}\r\n {...buttonProps}\r\n modalProps={modalProps}\r\n onOk={handleOk}\r\n confirmLoading={loading}\r\n >\r\n <Form\r\n {...props}\r\n onSubmitting={setLoading}\r\n ref={form}\r\n onSuccess={handleSuccess}\r\n >\r\n {children}\r\n <input type='submit' hidden />\r\n </Form>\r\n </ModalButton>;\r\n}\r\n","import { useAsyncCallback, UseAsyncCallbackOptions } from 'react-async-hook';\r\nimport request, { isRequestError, RequestConfig } from '../request';\r\nimport { DependencyList, useCallback, useEffect } from 'react';\r\nimport { AxiosRequestConfig } from 'axios';\r\nimport { values } from 'lodash';\r\n\r\ntype UseRequestOptions<T> = {\r\n manual?: boolean\r\n refreshDeps?: DependencyList;\r\n} & UseAsyncCallbackOptions<T>;\r\n\r\nexport default function useRequest<T = any>(config: RequestConfig, {\r\n manual,\r\n refreshDeps,\r\n ...options\r\n}: UseRequestOptions<T> = {}) {\r\n let { execute, currentParams, error, ...others } = useAsyncCallback(async (params?: AxiosRequestConfig) => {\r\n\r\n config = typeof config === 'string' ? { url: config } : config;\r\n\r\n return await request<T>({\r\n ...config,\r\n ...params\r\n });\r\n }, options);\r\n\r\n useEffect(() => {\r\n if (!manual && !refreshDeps) {\r\n execute();\r\n }\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (refreshDeps) {\r\n refresh();\r\n }\r\n }, refreshDeps);\r\n\r\n const refresh = useCallback(() => {\r\n if (currentParams) {\r\n execute(...currentParams);\r\n } else {\r\n execute();\r\n }\r\n }, [execute, currentParams]);\r\n\r\n if (error && isRequestError(error)) {\r\n const errors = error.errors;\r\n error = new Error(typeof errors === 'string' ? errors : values(errors).join(''));\r\n }\r\n\r\n return {\r\n refresh,\r\n execute,\r\n error,\r\n ...others\r\n };\r\n}\r\n"],"names":["CustomSwal","withReactContent","Swal","defaultOptions","confirmButtonText","cancelButtonText","Message","confirm","async","isConfirmed","fire","icon","showCancelButton","options","data","preConfirm","e","Error","showValidationMessage","message","success","toast","position","timer","showConfirmButton","error","close","result","noticeInstance","notice","_ref","type","callback","Notification","newInstance","prefixCls","maxCount","style","top","right","instance","getNoticeInstance","duration","variant","closable","content","_jsx","Alert","children","Toast","forEach","Container","styled","div","Icon","Title","Extra","IconMap","className","info","warning","Result","status","title","extra","_jsxs","Dimmer","props","active","inverted","Loader","loading","animation","wrap","Spinner","Wrap","$height","Card","BsCard","classNames","_Fragment","errors","Object","entries","map","_ref2","name","Space","size","direction","small","middle","large","items","Children","child","Item","$direction","$size","css","_path","_extends","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","SvgStepCheck","React","createElement","viewBox","xmlns","width","height","fill","d","Steps","CustomRcSteps","icons","finish","CheckIcon","Step","RcSteps","noop","isInteger","value","isFinite","Math","floor","Pagination","total","onChange","defaultCurrent","defaultPageSize","current","setCurrent","useState","pageSize","setPageSize","useEffect","allPages","useMemo","handleChange","useCallback","p","prevPage","nextPage","pagerList","jumpPrev","jumpNext","firstPager","lastPager","push","BsPagination","onClick","Last","First","Prev","Next","left","max","min","pageBufferSize","unshift","NumberFormat","locale","currency","formatter","opt","minimumFractionDigits","Intl","format","LoadingButton","disabled","Button","Tooltip","tooltip","placement","OverlayTrigger","overlay","BsTooltip","id","uniqueId","TableContext","createContext","forwardRef","ref","percent","useContext","as","role","button","BsButton","Unauthorized","constructor","url","super","_defineProperty","rax","attach","axios","defaults","raxConfig","retryDelay","backoffType","shouldRetry","_config$raxConfig","_config$method","config","response","retryDecider","method","toUpperCase","maxContentLength","Infinity","maxBodyLength","baseURL","interceptors","request","use","token","localStorage","getItem","headers","Authorization","Promise","reject","isRecord","location","window","href","undefined","isAxiosError","isRequestError","showRequestError","values","join","paramsSerializer","params","queryString","stringify","sort","skipNull","skipEmptyString","RequestButton","onSuccess","fetching","setFetching","handleClick","preventDefault","text","localize","require","widgets","upload","getRegistry","endpoint","onUpload","FormData","set","file","editor","Form","_ref3","action","formData","onSubmitting","onSubmit","submitText","extraErrors","setExtraErrors","setLoading","setData","handleSubmit","nativeEvent","__errors","mapValues","toExtraErrors","transformErrors","keyword","dataPath","property","submit","JsonForm","noHtml5Validate","noValidate","Checkbox","indeterminate","useRef","SvgPlusSquare","SvgMinusSquare","useCallbackRef","deps","callbackRef","_callbackRef$current","_len","args","Array","_key","useControllableState","valueProp","defaultValue","shouldUpdate","prev","next","onChangeProp","shouldUpdateProp","uncontrolledState","setUncontrolledState","controlled","setValue","nextValue","useDebounce","wait","debouncedCallbackRef","debounce","Search","onKeywordChange","debouncedOnKeywordChange","Control","placeholder","CustomTHead","thead","components","table","BsTable","header","wrapper","ExpandIconContainer","a","ExpandIcon","record","expanded","expandable","onExpand","MinusIcon","PlusIcon","CustomPagination","Table","rowKey","paginate","toolBarRender","columns","search","rowSelection","card","sync","pagination","setPagination","setParams","useUrlSearchParams","setKeyword","q","page","setPage","fetchData","isPagination","current_page","per_page","reload","useImperativeHandle","transformColumns","keys","setKeys","Set","selectedRowKeys","getRowKey","getRecordByKey","find","setSelectedKeys","changedKeys","from","records","recordKeys","checkedCurrentAll","every","has","checkedCurrentSome","some","checked","delete","add","align","render","useSelection","customColumns","valueType","column","customColumn","index","Header","LeftTools","RightTools","unstable_batchedUpdates","Action","Provider","RcTable","expandIcon","span","useOverlayState","onHide","onShow","visible","setVisible","setKey","hide","exit","show","state","onExited","Modal","footer","cancelText","okText","onOk","onCancel","okButtonProps","bodyAs","headerAs","confirmLoading","rest","okButton","defaultPrevented","cancelButton","ReactModal","closeButton","Body","Footer","ModalButton","modalProps","ModalForm","buttonProps","form","handleOk","_form$current","handleSuccess","_ref$current","hidden","useRequest","manual","refreshDeps","execute","currentParams","others","useAsyncCallback","refresh"],"mappings":"yvCAIA,MAAMA,EAAaC,EAAiBC,GAM9BC,EAAiB,CACnBC,kBAAmB,KACnBC,iBAAkB,MAGhBC,EAAU,CACZC,QAASC,UACL,MAAMC,YAAEA,SAAsBT,EAAWU,KAAK,IACvCP,EACHQ,KAAM,UACNC,kBAAkB,KACfC,EACHL,iBAAiBM,GACb,GAAID,EAAQE,WACR,IACI,aAAaF,EAAQE,WAAWD,EAMnC,CALC,MAAOE,GAIL,OAHIA,aAAaC,OACbjB,EAAWkB,sBAAsBF,EAAEG,UAEhC,CACV,CAEL,OAAO,CACX,IAGJ,OAAOV,CAAW,EAEtBW,QAAUP,IACNb,EAAWU,KAAK,IACTP,EACHkB,OAAO,EACPC,SAAU,MACVX,KAAM,UACNY,MAAO,IACPC,mBAAmB,KAChBX,GACL,EAENY,MAAQZ,IACJb,EAAWU,KAAK,IACTP,EACHkB,OAAO,EACPC,SAAU,MACVX,KAAM,QACNY,MAAO,IACPC,mBAAmB,KAChBX,GACL,EAENa,MAAQC,IACJ3B,EAAW0B,MAAMC,EAAO,GC1DhC,IAAIC,EAwBJ,MAEMC,EAASC,IAA2D,IAA1DC,KAAEA,KAASlB,GAA2CiB,GAxBtE,SAA2BE,GACvB,GAAIJ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EH,MAAMK,EAAU9S,GAAY,KACpB2S,EACAD,KAAWC,GAEXD,GACH,GACF,CAACA,EAASC,IAEb,GAAIza,GAASwN,GAAexN,GAAQ,CAChC,MAAMwD,EAASxD,EAAMwD,OACrBxD,EAAQ,IAAIR,MAAwB,iBAAXgE,EAAsBA,EAASkK,EAAOlK,GAAQmK,KAAK,IAC/E,CAED,MAAO,CACHiN,UACAJ,UACAxa,WACG0a,EAEX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topthink/components",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "scripts": {
5
5
  "prebuild": "rimraf lib types",
6
6
  "build": "rollup -c --environment NODE_ENV:production",
@@ -61,5 +61,5 @@
61
61
  },
62
62
  "author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
63
63
  "license": "MIT",
64
- "gitHead": "f213b8ef8d7f997da8a3bbaa9854695472c1187d"
64
+ "gitHead": "84ba774b4ab1def1313497efb58e07b3e48c8515"
65
65
  }
@@ -3,7 +3,7 @@ import { ModalProps } from './modal';
3
3
  import { ButtonProps } from 'react-bootstrap';
4
4
  export interface ModalButtonProps extends ButtonProps {
5
5
  text: ReactNode;
6
- modalProps?: ModalProps;
6
+ modalProps?: Omit<ModalProps, 'children' | 'confirmLoading' | 'onOk'>;
7
7
  onOk?: () => any;
8
8
  onShow?: () => void;
9
9
  confirmLoading?: boolean;
@@ -1,11 +1,10 @@
1
1
  import { ModalButtonProps } from './modal-button';
2
2
  import { ReactNode } from 'react';
3
3
  import { FormProps } from './form';
4
- import { ModalProps } from './modal';
5
4
  export interface ModalFormProps<T = any> extends FormProps<T> {
6
5
  text: ReactNode;
7
- buttonProps?: ModalButtonProps;
8
- modalProps?: ModalProps;
6
+ buttonProps?: Omit<ModalButtonProps, 'text' | 'modalProps' | 'confirmLoading' | 'onOk'>;
7
+ modalProps?: ModalButtonProps['modalProps'];
9
8
  children?: ReactNode;
10
9
  }
11
10
  export default function ModalForm<T = any>({ text, onSuccess, buttonProps, modalProps, children, ...props }: ModalFormProps<T>): JSX.Element;
@@ -1,5 +1,6 @@
1
- import { ButtonProps, ModalProps as ReactModalProps } from 'react-bootstrap';
1
+ import { ModalProps as ReactModalProps } from 'react-bootstrap';
2
2
  import { ElementType, MouseEvent, ReactNode } from 'react';
3
+ import { ButtonProps } from './button';
3
4
  export interface ModalProps extends Pick<ReactModalProps, 'backdrop' | 'centered' | 'size' | 'scrollable' | 'fullscreen' | 'onHide' | 'onShow' | 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited'> {
4
5
  children: ReactNode;
5
6
  header?: ReactNode;