@topthink/components 1.0.57 → 1.0.59
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/es/editor-widget-CQ3zv-Xu.js +355 -0
- package/es/{image-zoom-912e2b3b.js → image-zoom-OrIPGqh0.js} +0 -1
- package/es/index-PGfJO0Bp.js +39 -0
- package/es/index-PvFKqXZL.js +1 -0
- package/es/{index-6ae8237d.js → index-XkUorbN_.js} +13 -14
- package/es/index.js +1 -2
- package/es/{steps-afba29a7.js → steps-b_BcYIwk.js} +1 -2
- package/package.json +20 -18
- package/types/components/button.d.ts +9 -9
- package/types/components/card.d.ts +7 -7
- package/types/components/dimmer.d.ts +7 -7
- package/types/components/error.d.ts +5 -5
- package/types/components/form.d.ts +4 -4
- package/types/components/image-zoom.d.ts +4 -4
- package/types/components/lazy/{form.d.ts → form/index.d.ts} +19 -19
- package/types/components/lazy/form/widgets/editor-widget.d.ts +6 -0
- package/types/components/lazy/image-zoom.d.ts +3 -3
- package/types/components/lazy/steps.d.ts +9 -9
- package/types/components/lazy/table/context.d.ts +2 -2
- package/types/components/lazy/table/index.d.ts +45 -45
- package/types/components/lazy/table/search.d.ts +23 -23
- package/types/components/lazy/table/use-selection.d.ts +3 -3
- package/types/components/loader.d.ts +9 -9
- package/types/components/loading-button.d.ts +7 -7
- package/types/components/modal/confirm.d.ts +8 -8
- package/types/components/modal/index.d.ts +32 -32
- package/types/components/modal/message.d.ts +26 -26
- package/types/components/modal/show.d.ts +3 -3
- package/types/components/modal-button.d.ts +17 -17
- package/types/components/modal-form.d.ts +10 -10
- package/types/components/number-format.d.ts +10 -10
- package/types/components/pagination.d.ts +11 -11
- package/types/components/request-button.d.ts +13 -13
- package/types/components/result.d.ts +15 -15
- package/types/components/space.d.ts +9 -9
- package/types/components/statistic.d.ts +7 -7
- package/types/components/steps.d.ts +10 -10
- package/types/components/table.d.ts +4 -4
- package/types/components/tooltip.d.ts +9 -9
- package/types/hooks/use-callback-ref.d.ts +2 -2
- package/types/hooks/use-controllable-state.d.ts +8 -8
- package/types/hooks/use-debounce.d.ts +2 -2
- package/types/hooks/use-overlay-state.d.ts +16 -16
- package/types/hooks/use-request.d.ts +21 -21
- package/types/hooks/use-safe-state.d.ts +4 -4
- package/types/hooks/use-state-with-callback.d.ts +2 -2
- package/types/hooks/use-unmounted-ref.d.ts +3 -3
- package/types/index.d.ts +33 -33
- package/types/request.d.ts +32 -32
- package/types/utils/is-record.d.ts +1 -1
- package/types/utils/message.d.ts +11 -11
- package/types/utils/toast.d.ts +11 -11
- package/types/utils/types.d.ts +7 -7
- package/types/utils/wait-pay-complete.d.ts +11 -11
- package/es/form-01bf45e9.js +0 -233
- package/es/form-01bf45e9.js.map +0 -1
- package/es/form-0a372a24.js +0 -2
- package/es/form-0a372a24.js.map +0 -1
- package/es/form-1791ea39.js +0 -236
- package/es/form-1791ea39.js.map +0 -1
- package/es/form-74ef0417.js +0 -2
- package/es/form-74ef0417.js.map +0 -1
- package/es/form-8925a750.js +0 -231
- package/es/form-8925a750.js.map +0 -1
- package/es/form-95db7eac.js +0 -2
- package/es/form-95db7eac.js.map +0 -1
- package/es/form-9c0e638a.js +0 -231
- package/es/form-9c0e638a.js.map +0 -1
- package/es/image-zoom-912e2b3b.js.map +0 -1
- package/es/index-1930b692.js +0 -67
- package/es/index-1930b692.js.map +0 -1
- package/es/index-1d379f3a.js +0 -562
- package/es/index-1d379f3a.js.map +0 -1
- package/es/index-303e1845.js +0 -560
- package/es/index-303e1845.js.map +0 -1
- package/es/index-4f51cece.js +0 -1352
- package/es/index-4f51cece.js.map +0 -1
- package/es/index-5142110c.js +0 -67
- package/es/index-5142110c.js.map +0 -1
- package/es/index-6ae8237d.js.map +0 -1
- package/es/index-7a7c06a9.js +0 -40
- package/es/index-7a7c06a9.js.map +0 -1
- package/es/index-9869b1c6.js +0 -1350
- package/es/index-9869b1c6.js.map +0 -1
- package/es/index-a48179db.js +0 -1382
- package/es/index-a48179db.js.map +0 -1
- package/es/index-b34ecf90.js +0 -40
- package/es/index-b34ecf90.js.map +0 -1
- package/es/index-d964165a.js +0 -560
- package/es/index-d964165a.js.map +0 -1
- package/es/index-e17dc6f0.js +0 -40
- package/es/index-e17dc6f0.js.map +0 -1
- package/es/index.js.map +0 -1
- package/es/steps-afba29a7.js.map +0 -1
- package/es/steps-c27a3885.js +0 -34
- package/es/steps-c27a3885.js.map +0 -1
package/es/index-1930b692.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-1930b692.js","sources":["../src/utils/message.ts","../src/components/modal/message.tsx","../src/hooks/use-state-with-callback.ts","../src/components/modal/show.tsx","../src/components/tooltip.tsx","../src/components/lazy/table/context.ts","../src/components/button.tsx","../src/components/modal/confirm.tsx","../src/components/modal/index.tsx","../src/errors/unauthorized.ts","../src/utils/toast.tsx","../src/request.ts","../src/hooks/use-safe-state.ts","../src/hooks/use-unmounted-ref.ts","../src/utils/wait-pay-complete.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/components/steps.tsx","../src/components/statistic.tsx","../src/components/pagination.tsx","../src/components/number-format.tsx","../src/components/loading-button.tsx","../src/components/image-zoom.tsx","../src/components/request-button.tsx","../src/components/form.tsx","../src/components/table.tsx","../src/hooks/use-overlay-state.ts","../src/components/modal-button.tsx","../src/components/modal-form.tsx","../src/hooks/use-request.ts","../src/hooks/use-callback-ref.ts","../src/hooks/use-controllable-state.ts","../src/hooks/use-debounce.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: MessageOptions = {\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 defaults: defaultOptions\r\n};\r\n\r\nexport default Message;\r\n","import {\r\n ComponentType,\r\n createContext,\r\n Fragment,\r\n ReactNode,\r\n useCallback,\r\n useContext,\r\n useEffect,\r\n useMemo,\r\n useState\r\n} from 'react';\r\nimport useStateWithCallback from '../../hooks/use-state-with-callback';\r\nimport { ModalProps } from 'react-bootstrap';\r\n\r\ninterface MessageContextType {\r\n container?: ModalProps['container'];\r\n}\r\n\r\nconst MessageContext = createContext<MessageContextType>({});\r\n\r\ntype MessageWrapProps<T, P = void> = {\r\n resolve: (value: P | void) => void\r\n destroy: () => void\r\n message: T\r\n}\r\n\r\nexport type MessageProps<T, P = void> = {\r\n resolve: (value: P | void) => void\r\n message: T\r\n state: {\r\n show: boolean\r\n onHide: () => void\r\n onExited: () => void\r\n container?: ModalProps['container']\r\n }\r\n}\r\n\r\nexport function wrapMessage<T = {}, P = any>(Component: ComponentType<MessageProps<T, P>>): ComponentType<MessageWrapProps<T, P>> {\r\n\r\n return ({ resolve, destroy, message }) => {\r\n\r\n const [show, setShow] = useStateWithCallback(true);\r\n const context = useContext(MessageContext);\r\n\r\n const handleResolve = useCallback((value: P | void) => {\r\n setShow(false, () => {\r\n resolve(value);\r\n });\r\n }, [setShow, resolve]);\r\n\r\n const state = useMemo(() => {\r\n return {\r\n show,\r\n onHide: () => handleResolve(),\r\n onExited: () => destroy(),\r\n container: context.container\r\n };\r\n }, [show, handleResolve, destroy]);\r\n\r\n return <Component\r\n resolve={handleResolve}\r\n state={state}\r\n message={message}\r\n />;\r\n };\r\n}\r\n\r\nexport function createMessage<T = {}, P = any>(Component: ComponentType<MessageWrapProps<T, P>>): (message: T) => Promise<P | void> {\r\n return (message) => {\r\n return new Promise<P | void>((resolve) => {\r\n const component = <Component\r\n resolve={resolve}\r\n destroy={() => {\r\n hide(component);\r\n }}\r\n message={message}\r\n />;\r\n\r\n show(component);\r\n });\r\n };\r\n}\r\n\r\ntype State = Set<ReactNode>\r\n\r\nlet listener: (state: State) => void = () => void 0;\r\n\r\nlet memoryState: State = new Set();\r\n\r\nexport const show = (modal: ReactNode) => {\r\n memoryState = new Set(memoryState);\r\n memoryState.add(modal);\r\n\r\n listener(memoryState);\r\n};\r\n\r\nexport const hide = (modal: ReactNode) => {\r\n memoryState = new Set(memoryState);\r\n memoryState.delete(modal);\r\n\r\n listener(memoryState);\r\n};\r\n\r\nexport default function Message(props: MessageContextType) {\r\n const [state, setState] = useState<State>(memoryState);\r\n useEffect(() => {\r\n listener = setState;\r\n }, []);\r\n\r\n return <MessageContext.Provider value={props}>\r\n {Array.from(state).map((message, index) => <Fragment key={`message-${index}`}>{message}</Fragment>)}\r\n </MessageContext.Provider>;\r\n}\r\n","import { SetStateAction, useEffect, useRef, useState } from 'react';\n\nexport default function useStateWithCallback<S>(initState: S): [S, (value: SetStateAction<S>, callback: () => void) => void] {\n const callbackRef = useRef<Function | null>(null);\n\n const [state, setState] = useState(initState);\n\n useEffect(() => {\n if (callbackRef.current) {\n callbackRef.current();\n callbackRef.current = null;\n }\n }, [state]);\n\n const setCallbackState = (value: SetStateAction<S>, callback: () => void) => {\n callbackRef.current = typeof callback === 'function' ? callback : null;\n setState(value);\n };\n\n return [state, setCallbackState];\n}\n","import { createMessage, MessageProps, wrapMessage } from './message';\r\nimport { ComponentType } from 'react';\r\n\r\nexport default function show<T, P = any>(Component: ComponentType<MessageProps<any, T>>, options?: P) {\r\n return createMessage(wrapMessage(Component))(options);\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 './lazy/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","import { FC } from 'react';\r\nimport { Modal } from 'react-bootstrap';\r\nimport { createMessage, MessageProps, wrapMessage } from './message';\r\nimport Button from '../button';\r\n\r\ninterface ConfirmOptions {\r\n title?: string;\r\n message: string;\r\n okText?: string;\r\n cancelText?: string;\r\n}\r\n\r\nconst Confirm: FC<MessageProps<ConfirmOptions, true>> = function({\r\n state,\r\n message: {\r\n title,\r\n message,\r\n okText,\r\n cancelText\r\n },\r\n resolve,\r\n}) {\r\n return <Modal centered {...state} >\r\n <Modal.Header>\r\n <Modal.Title as='h5'>{title || '确认'}</Modal.Title>\r\n </Modal.Header>\r\n <Modal.Body>{message}</Modal.Body>\r\n <Modal.Footer>\r\n <Button variant='secondary' onClick={() => resolve()}>{cancelText || '取消'}</Button>\r\n <Button onClick={() => resolve(true)}>{okText || '确定'}</Button>\r\n </Modal.Footer>\r\n </Modal>;\r\n};\r\n\r\nexport default function confirm(options: ConfirmOptions) {\r\n return createMessage(wrapMessage(Confirm))(options);\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\nimport show from './show';\r\nimport confirm from './confirm';\r\nimport Message, { MessageProps } from './message';\r\n\r\nexport interface ModalProps extends Pick<\r\n ReactModalProps,\r\n 'style' | 'container' | '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\nconst 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\r\nModal.Message = Message;\r\nModal.confirm = confirm;\r\nModal.show = show;\r\nexport default Modal;\r\nexport { MessageProps };\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 { Alert } from 'react-bootstrap';\r\nimport { NoticeContent, NotificationInstance } from 'rc-notification/lib/Notification';\r\nimport Notification from 'rc-notification';\r\nimport { NotificationProps } from 'rc-notification/es/Notification';\r\n\r\nlet noticeInstance: NotificationInstance | null;\r\n\r\nconst defaultOptions: NotificationProps & {\r\n getContainer?: () => HTMLElement;\r\n} = {};\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 ...defaultOptions,\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\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\nconst types = ['error', 'success', 'info'] as const;\r\n\r\ntype ToastType = Record<typeof types[number], (content: string, options?: NoticeContent) => void> & {\r\n defaults: typeof defaultOptions;\r\n};\r\n\r\nconst Toast = types.reduce((toast, type) => {\r\n toast[type] = (content: string, options?: NoticeContent) => {\r\n notice({\r\n ...options,\r\n type,\r\n content\r\n });\r\n };\r\n return toast;\r\n}, {} as any);\r\n\r\nToast.defaults = defaultOptions;\r\n\r\nexport default Toast as ToastType;\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\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 authTokenName?: string;\r\n }\r\n}\r\n\r\nrax.attach();\r\n\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.defaults.authTokenName = 'authorization';\r\naxios.interceptors.request.use(\r\n config => {\r\n const key = config.authTokenName;\r\n if (key) {\r\n const token = localStorage.getItem(key);\r\n\r\n if (token) {\r\n config.headers = {\r\n Authorization: `Bearer ${token}`,\r\n ...config.headers,\r\n };\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 Toast.error(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 arrayFormat: 'bracket',\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 { useCallback, useState } from 'react';\r\nimport type { Dispatch, SetStateAction } from 'react';\r\nimport useUnmountedRef from './use-unmounted-ref';\r\n\r\nfunction useSafeState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];\r\n\r\nfunction useSafeState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>];\r\n\r\nfunction useSafeState<S>(initialState?: S | (() => S)) {\r\n const unmountedRef = useUnmountedRef();\r\n const [state, setState] = useState(initialState);\r\n const setCurrentState = useCallback((currentState) => {\r\n /** if component is unmounted, stop update */\r\n if (unmountedRef.current) return;\r\n setState(currentState);\r\n }, []);\r\n\r\n return [state, setCurrentState] as const;\r\n}\r\n\r\nexport default useSafeState;\r\n","import { useEffect, useRef } from 'react';\r\n\r\nconst useUnmountedRef = () => {\r\n const unmountedRef = useRef(false);\r\n useEffect(() => {\r\n unmountedRef.current = false;\r\n return () => {\r\n unmountedRef.current = true;\r\n };\r\n }, []);\r\n return unmountedRef;\r\n};\r\n\r\nexport default useUnmountedRef;\r\n","import show from '../components/modal/show';\r\nimport Modal, { MessageProps } from '../components/modal';\r\nimport { useEffect, useRef } from 'react';\r\nimport request from '../request';\r\nimport useSafeState from '../hooks/use-safe-state';\r\n\r\ninterface PayResult {\r\n pay_url: string;\r\n order_no: string;\r\n}\r\n\r\ninterface Options {\r\n result: PayResult;\r\n checkUrl: string;\r\n onComplete?: () => void;\r\n}\r\n\r\nconst WaitModal = function({ state, message, resolve }: MessageProps<Options>) {\r\n\r\n const open = useRef(true);\r\n const { result, checkUrl, onComplete } = message;\r\n const [checking, setChecking] = useSafeState(false);\r\n\r\n useEffect(() => {\r\n request({\r\n url: checkUrl,\r\n method: 'post',\r\n data: { order_no: result.order_no },\r\n raxConfig: {\r\n shouldRetry(err) {\r\n return open.current && err.response?.status === 449;\r\n }\r\n }\r\n }).then(() => {\r\n onComplete?.();\r\n resolve();\r\n }).catch(() => null);\r\n }, []);\r\n\r\n return <Modal\r\n {...state}\r\n centered\r\n onHide={() => {\r\n open.current = false;\r\n state.onHide();\r\n }}\r\n backdrop='static'\r\n header='支付结果'\r\n okText='已完成支付'\r\n okButtonProps={{ loading: checking }}\r\n onOk={async (e) => {\r\n e.preventDefault();\r\n try {\r\n setChecking(true);\r\n await request({\r\n url: checkUrl,\r\n method: 'post',\r\n data: { order_no: result.order_no },\r\n raxConfig: {\r\n shouldRetry() {\r\n return false;\r\n }\r\n }\r\n });\r\n onComplete?.();\r\n resolve();\r\n } catch {\r\n // ignore\r\n } finally {\r\n setChecking(false);\r\n }\r\n }}\r\n cancelText='取消'\r\n >\r\n 请在新打开的页面上进行支付,支付完成后再关闭此窗口\r\n </Modal>;\r\n};\r\n\r\nexport default function waitPayComplete(options: Options) {\r\n const { result } = options;\r\n window.open(result.pay_url);\r\n show(WaitModal, options);\r\n}\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","import { ComponentProps, lazy, Suspense } from 'react';\r\n\r\nconst LazySteps = lazy(() => import('./lazy/steps'));\r\n\r\nexport default function Steps(props: ComponentProps<typeof LazySteps>) {\r\n return <Suspense fallback={null}>\r\n <LazySteps {...props} />\r\n </Suspense>;\r\n}\r\n","import { ReactNode } from 'react';\r\nimport Card from './card';\r\nimport styled from 'styled-components';\r\n\r\nexport interface StatisticProps {\r\n title: ReactNode;\r\n content: ReactNode;\r\n footer?: ReactNode;\r\n}\r\n\r\nexport default function Statistic({ title, content, footer }: StatisticProps) {\r\n\r\n return <Card>\r\n <Title>{title}</Title>\r\n <Content>{content}</Content>\r\n {footer && <Footer>{footer}</Footer>}\r\n </Card>;\r\n}\r\n\r\nconst Footer = styled.div`\r\n margin-top: 9px;\r\n padding-top: 10px;\r\n border-top: 1px solid #f0f0f0;\r\n color: rgba(0, 0, 0, .65);\r\n`;\r\n\r\nconst Content = styled.div`\r\n color: rgba(0, 0, 0, .85);\r\n font-size: 24px;\r\n`;\r\n\r\nconst Title = styled.div`\r\n margin-bottom: 4px;\r\n color: rgba(0, 0, 0, .45);\r\n font-size: 1.1rem;\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 { ComponentProps, lazy, Suspense } from 'react';\r\n\r\nconst LazyImageZoom = lazy(() => import('./lazy/image-zoom'));\r\n\r\nexport default function ImageZoom(props: ComponentProps<typeof LazyImageZoom>) {\r\n return <Suspense fallback={null}>\r\n <LazyImageZoom {...props} />\r\n </Suspense>;\r\n}\r\n","import request, { RequestConfig, showRequestError } from '../request';\r\nimport { createElement, ElementType, MouseEvent, useCallback } from 'react';\r\nimport { AxiosRequestConfig } from 'axios';\r\nimport Button, { ButtonProps } from './button';\r\nimport useSafeState from '../hooks/use-safe-state';\r\nimport Modal from './modal';\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] = useSafeState(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 Modal.confirm({ message: 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 { ComponentProps, lazy, Suspense } from 'react';\r\n\r\nconst LazyForm = lazy(() => import('./lazy/form'));\r\n\r\nexport default function Form(props: ComponentProps<typeof LazyForm>) {\r\n return <Suspense fallback={null}>\r\n <LazyForm {...props} />\r\n </Suspense>;\r\n}\r\n\r\nexport type { FormProps, FormType } from './lazy/form';\r\n","import { ComponentProps, lazy, Suspense } from 'react';\r\n\r\nconst LazyTable = lazy(() => import('./lazy/table'));\r\n\r\nexport default function Table(props: ComponentProps<typeof LazyTable>) {\r\n return <Suspense fallback={null}>\r\n <LazyTable {...props} />\r\n </Suspense>;\r\n}\r\n\r\nexport type { TableProps, Columns, TableType } from './lazy/table';\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 {\r\n createElement,\r\n ElementType,\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 Omit<ButtonProps, 'as'> {\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 as?: ElementType | ButtonProps['as'];\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 as = Button,\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 = createElement(as, {\r\n ...props,\r\n onClick: show\r\n }, text);\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 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 try {\r\n execute();\r\n } catch {\r\n\r\n }\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(async () => {\r\n try {\r\n if (currentParams) {\r\n await execute(...currentParams);\r\n } else {\r\n await execute();\r\n }\r\n } catch {\r\n\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","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"],"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","defaults","MessageContext","createContext","wrapMessage","Component","_ref","resolve","destroy","show","setShow","initState","callbackRef","useRef","state","setState","useState","useEffect","current","value","callback","useStateWithCallback","context","useContext","handleResolve","useCallback","useMemo","onHide","onExited","container","_jsx","createMessage","Promise","component","hide","listener","memoryState","Set","modal","add","delete","Tooltip","tooltip","children","placement","OverlayTrigger","overlay","BsTooltip","id","uniqueId","TableContext","Button","forwardRef","ref","loading","percent","disabled","variant","props","_jsxs","Spinner","as","size","role","animation","className","button","BsButton","Confirm","title","okText","cancelText","Modal","centered","Header","Title","Body","Footer","onClick","header","footer","closable","onOk","onCancel","okButtonProps","bodyAs","headerAs","confirmLoading","rest","setLoading","okButton","defaultPrevented","cancelButton","_Fragment","ReactModal","closeButton","Provider","Array","from","map","index","Fragment","Unauthorized","constructor","url","super","_defineProperty","this","noticeInstance","notice","type","Notification","newInstance","prefixCls","maxCount","style","top","right","instance","getNoticeInstance","duration","content","Alert","Toast","reduce","rax","attach","axios","raxConfig","retryDelay","backoffType","shouldRetry","config","response","retryDecider","method","toUpperCase","status","maxContentLength","Infinity","maxBodyLength","baseURL","authTokenName","interceptors","request","use","key","token","localStorage","getItem","headers","Authorization","reject","isRecord","location","window","href","undefined","isAxiosError","errors","isRequestError","showRequestError","Object","values","join","paramsSerializer","params","queryString","stringify","sort","skipNull","skipEmptyString","arrayFormat","useSafeState","initialState","unmountedRef","useUnmountedRef","currentState","WaitModal","open","checkUrl","onComplete","checking","setChecking","order_no","err","then","catch","backdrop","preventDefault","waitPayComplete","pay_url","Container","styled","div","Icon","Extra","IconMap","info","warning","Result","extra","Dimmer","active","inverted","Loader","wrap","Wrap","$height","Card","BsCard","classNames","entries","_ref2","name","Space","direction","small","middle","large","items","Children","child","Item","$direction","$size","css","LazySteps","lazy","import","Steps","Suspense","fallback","Statistic","Content","noop","isInteger","isFinite","Math","floor","Pagination","total","onChange","defaultCurrent","defaultPageSize","setCurrent","pageSize","setPageSize","allPages","handleChange","p","prevPage","nextPage","pagerList","jumpPrev","jumpNext","firstPager","lastPager","i","push","BsPagination","Last","First","Prev","Next","left","max","min","pageBufferSize","unshift","NumberFormat","locale","currency","formatter","opt","minimumFractionDigits","Intl","format","LoadingButton","LazyImageZoom","ImageZoom","RequestButton","onSuccess","fetching","setFetching","handleClick","createElement","LazyForm","Form","LazyTable","Table","useOverlayState","onShow","arguments","length","visible","setVisible","setKey","exit","ModalButton","text","modalProps","useImperativeHandle","ModalForm","buttonProps","form","handleOk","submit","handleSuccess","onSubmitting","hidden","useRequest","manual","refreshDeps","execute","currentParams","others","useAsyncCallback","refresh","useCallbackRef","deps","_len","args","_key","useControllableState","valueProp","defaultValue","shouldUpdate","prev","next","onChangeProp","shouldUpdateProp","uncontrolledState","setUncontrolledState","controlled","setValue","nextValue","useDebounce","wait","debouncedCallbackRef","debounce"],"mappings":"o2BAIA,MAAMA,EAAaC,EAAiBC,GAM9BC,EAAiC,CACnCC,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,EAE5BC,SAAUzB,GC9Cd,MAAM0B,EAAiBC,EAAkC,CAAA,GAmBnD,SAAUC,EAA6BC,GAEzC,OAAOC,IAAkC,IAAjCC,QAAEA,EAAOC,QAAEA,EAAOhB,QAAEA,GAASc,EAEjC,MAAOG,EAAMC,GCvCG,SA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