mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-08 01:08:43 +08:00
7506a147e6
* batch node (#6732) * batch node * docs: add local code quality standards and style guides for automated review * refactor: remove enforced minimum for parallel concurrency, simplify edge handling in task runtime context, and fix loop output mapping * feat: auto-infer and sync valueType for parallel loop input and output based on referenced array source * fix: refactor parallelRun output type synchronization and improve sub-workflow error handling in dispatch service * feat: enforce parallel concurrency limits and validate against workflow loop constraints * feat: implement retry mechanism for parallel workflow tasks with usage tracking per attempt * fix review * perf: use function * refactor: abstract nested node logic into useNestedNode hook and update parallelRun icon/service logic * fix: type import * refactor: update ParallelRunStatusEnum and i18n labels for improved status clarity * feat: parallel run details and input/output display to chat response modal and service dispatch * fix: config limit error * refactor: optimize parallel run task execution, fix point accumulation, and improve error handling for sub-workflows * fix: include totalPoints in parallel task results * refactor: centralize nested input injection and point safety utilities for workflow dispatchers * test: add unit tests for safePoints utility function * refactor: update parallel workflow runtime types and clean up docstring placement in dispatch utils * fix: include all runtime nodes in parallel execution to ensure variable reference accessibility * refactor: update pushSubWorkflowUsage signature to use object parameter for improved consistency --------- Co-authored-by: DigHuang <114602213+DigHuang@users.noreply.github.com> * feat(s3): add proxy transfer mode with tokenized upload/download (#6729) * feat(s3): add proxy transfer mode with tokenized upload/download * wip: switch to proxy mode for upload progress * fix: office mime types * fix(s3): upload MIME validation, multer whitelist, API error status - Treat AVI/MPEG mime aliases (incl. video/mp1s vs video/mpeg) as matching - Optional allowedExtensions on multer for dataset images and localFile - Map S3/business errors to 4xx in jsonRes where appropriate - Align presign max size with team plan; fix dataset import size UX - Add upload validation tests Made-with: Cursor * fix: show clear message when upload frequency limit is exceeded - Reject ERROR_ENUM.uploadFileIntervalLimit from authFrequencyLimit instead of Mongo doc - Add i18n for upload_file_interval_limit (zh-CN/en/zh-Hant) Made-with: Cursor * fix file token validation and upload mime checks * fix: test * fix(s3): treat m4a audio/mp4 and audio/x-m4a as equivalent - Add MIME equivalence group for AAC/M4A container mismatch (mime-types vs file-type) - Add upload validation test for minimal ftyp/M4A buffer - Test env: keep FILE_TOKEN_KEY in vitest test.env and test/setup.ts (drop loadTestEnv file) Made-with: Cursor * fix(chat): 调试区文件类型与编辑态一致,并修复 accept 在 WebKit 下不更新 - ChatTest: 用 getAppChatConfig + getGuideModule 合并画布引导节点与 chatConfig - useChatTest: 依赖 fileSelectConfig 序列化与 chatConfig,避免深层变更未触发预览更新 - useSelectFile: 用 useCallback + input key 替代 useMemoizedFn,确保 accept 变更后重建 input Made-with: Cursor * fix: invalid request * feat: prompt inject (#6757) * feat: resume chat stream (#6722) * fix: openapi schema issue while creating openapi json * feat: resume chat stream * wip: chat status and read status * feat: sync chat side bar status * fix: allow reassignment of variables in chatTest handler Made-with: Cursor * feat(chat): stream resume hardening, resume modules in @fastgpt/service, stale generating cron - Move stream resume mirror + resumeStatus into packages/service; update API imports - chatTest: ensurePendingChatRoundItems, default responseChatItemId; zod default import for client - useChatTest + HomeChatWindow: enableAutoResume and sync init chatGenerateStatus - ChatContext: safe no-op defaults without provider - Cron: clean MongoChat stuck in generating >30min; timer lock cleanStaleGeneratingChat Made-with: Cursor * fix(chat): address stream-resume PR review (zod/mongoose enum, legacy status, upsert, UI race) - Zod: use z.nativeEnum(ChatGenerateStatusEnum); mongoose chatGenerateStatus enum as [0,1,2] only - Init APIs: default missing chatGenerateStatus to done before read/unread logic - ensurePendingChatRoundItems: unique index + upsert; rename ChatGenerateStatusEnum - ChatBox auto-resume: guard by chatId; sidebar sync via targetChatId - Tests: chat history/feedback APIs pass with schema fixes Made-with: Cursor * fix(chat): expose resume at /api/v2/chat/resume; openapi + review tidy - Move handler from v1/stream to v2/chat/resume (pairs with v2 completions + Redis mirror) - Update fetch, OpenAPI AIPath, comments; remove slim projects/app global chat api - getHistoryStatus default chatGenerateStatus; team init + chatTest notes; ChatItem tweak Made-with: Cursor * fix(chat): fix resume JSON parse catch shadowing; drop unused resumeChatStream Made-with: Cursor * docs(chat): comment closed+stream mirror write path in workflow dispatch Made-with: Cursor * refactor: unify resumable stream mirroring * fix: keep v1 chat completions out of resume flow * refactor: make prepared chat rounds transactional * fix: handle resume stream terminal errors * fix: rerank max token * feat(workflow): extend variable update node with Number/Boolean/Array operations (#6752) * feat(workflow): extend variable update node with Number/Boolean/Array ops * feat: math operator icons and refactor variable update renderers for improved layout and consistency * chore(workflow): clean up variable update types and restore icon cleanup * feat: add test * fix:md_ascii_bug (#6755) * md_ascii_bug * md_ascii_bug * md_ascii_bug * md_ascii_bug * md_ascii_bug * perf: test --------- Co-authored-by: archer <545436317@qq.com> * doc * del dataset * perf: date auto coerce * doc * add test * perf: channel setting * doc * fix: chat resume stream (#6759) * refactor(api): move stream resume to /api/core/chat/resume Relocate resume handler from pages/api/v2 to pages/api/core, update OpenAPI paths, frontend streamResumeFetch URL, tests, and comments. Made-with: Cursor * fix: remove stray conflict markers; use z.nativeEnum for chatGenerateStatus Made-with: Cursor * fix: use enum instead of nativeEnum * fix(chat): address resume review suggestions * fix(chat): require sse when resuming generating chats * revert(chat): keep chatitem dataId index non-unique * fix: ts * fix doc * fix(chat): gate stream resume mirror by header (#6760) * fix: remove stray conflict markers; use z.nativeEnum for chatGenerateStatus Made-with: Cursor * fix: use enum instead of nativeEnum * fix(chat): address resume review suggestions * fix(chat): require sse when resuming generating chats * feat(chat): gate stream resume mirror by header * refactor(chat): decouple resume mirror header parsing * perf: dataset queue * fix: multipleselect * perf: workflow bug * doc * doc * perf: deploy yml;fix: child nodes watch * adapt embedding model defaultconfig * install shell * add mcp zod check * feat: http tool zod schema * Feat/batch UI (#6763) * feat: aggregate parallel run results into task-specific virtual nodes and update UI to support i18n arguments for module names * style: update workflow node card padding and table styling for improved layout consistency * feat: implement parallel run workflow node with documentation and i18n support * style(modal): WholeResponseModal UI and layout styling * chore: improve chat resume UX (#6764) * fix: remove stray conflict markers; use z.nativeEnum for chatGenerateStatus Made-with: Cursor * fix: use enum instead of nativeEnum * fix(chat): address resume review suggestions * fix(chat): require sse when resuming generating chats * feat(chat): gate stream resume mirror by header * refactor(chat): decouple resume mirror header parsing * feat: improve stream resume fallback * feat: block duplicate chat generation * feat: polish resume unavailable recovery * test: stabilize resume stream timeout * fix: harden resume wait flow * fix: get mcp tool raw schema * style: update UI styling and layout for LLM request detail and response modals * perf: http tool * fix: test * fix: http raw schema * fix: test * deploy yml * deploy yml --------- Co-authored-by: DigHuang <114602213+DigHuang@users.noreply.github.com> Co-authored-by: Ryo <whoeverimf5@gmail.com> Co-authored-by: YeYuheng <57035043+YYH211@users.noreply.github.com>
945 lines
20 KiB
TypeScript
945 lines
20 KiB
TypeScript
import { extendTheme, defineStyleConfig, type ComponentStyleConfig } from '@chakra-ui/react';
|
|
import {
|
|
modalAnatomy,
|
|
switchAnatomy,
|
|
selectAnatomy,
|
|
numberInputAnatomy,
|
|
checkboxAnatomy,
|
|
tableAnatomy,
|
|
radioAnatomy
|
|
} from '@chakra-ui/anatomy';
|
|
import { createMultiStyleConfigHelpers, defineStyle } from '@chakra-ui/styled-system';
|
|
import { getWebReqUrl } from './../common/system/utils';
|
|
|
|
const { definePartsStyle: modalPart, defineMultiStyleConfig: modalMultiStyle } =
|
|
createMultiStyleConfigHelpers(modalAnatomy.keys);
|
|
const { definePartsStyle: switchPart, defineMultiStyleConfig: switchMultiStyle } =
|
|
createMultiStyleConfigHelpers(switchAnatomy.keys);
|
|
const { definePartsStyle: selectPart, defineMultiStyleConfig: selectMultiStyle } =
|
|
createMultiStyleConfigHelpers(selectAnatomy.keys);
|
|
const { definePartsStyle: numInputPart, defineMultiStyleConfig: numInputMultiStyle } =
|
|
createMultiStyleConfigHelpers(numberInputAnatomy.keys);
|
|
const { definePartsStyle: checkBoxPart, defineMultiStyleConfig: checkBoxMultiStyle } =
|
|
createMultiStyleConfigHelpers(checkboxAnatomy.keys);
|
|
const { definePartsStyle: tablePart, defineMultiStyleConfig: tableMultiStyle } =
|
|
createMultiStyleConfigHelpers(tableAnatomy.keys);
|
|
const { definePartsStyle: radioParts, defineMultiStyleConfig: radioStyle } =
|
|
createMultiStyleConfigHelpers(radioAnatomy.keys);
|
|
|
|
export const shadowLight = '0px 0px 0px 2.4px rgba(51, 112, 255, 0.15)';
|
|
|
|
// 按键
|
|
const Button = defineStyleConfig({
|
|
baseStyle: {
|
|
_active: {
|
|
transform: 'scale(0.98)'
|
|
},
|
|
_disabled: {
|
|
transform: 'none !important',
|
|
_hover: {
|
|
filter: 'none'
|
|
}
|
|
}
|
|
},
|
|
sizes: {
|
|
xs: {
|
|
fontSize: 'xs',
|
|
px: '2',
|
|
py: '0',
|
|
h: '24px',
|
|
minH: '24px',
|
|
fontWeight: 'medium',
|
|
borderRadius: 'sm'
|
|
},
|
|
xsSquare: {
|
|
fontSize: 'xs',
|
|
px: '0',
|
|
py: '0',
|
|
h: '24px',
|
|
minH: '24px',
|
|
w: '24px',
|
|
fontWeight: 'medium',
|
|
borderRadius: 'sm'
|
|
},
|
|
sm: {
|
|
fontSize: 'sm',
|
|
px: '3',
|
|
py: 0,
|
|
fontWeight: 'medium',
|
|
h: '30px',
|
|
minH: '30px',
|
|
borderRadius: 'sm'
|
|
},
|
|
smSquare: {
|
|
fontSize: 'sm',
|
|
px: '0',
|
|
py: 0,
|
|
fontWeight: 'medium',
|
|
h: '30px',
|
|
minH: '30px',
|
|
w: '30px',
|
|
borderRadius: 'sm'
|
|
},
|
|
base: {
|
|
fontSize: 'sm',
|
|
px: '4',
|
|
py: 0,
|
|
h: '34px',
|
|
minH: '34px',
|
|
fontWeight: 'medium',
|
|
borderRadius: 'sm'
|
|
},
|
|
baseSquare: {
|
|
fontSize: 'sm',
|
|
px: '0',
|
|
py: 0,
|
|
h: '34px',
|
|
w: '34px',
|
|
fontWeight: 'medium',
|
|
borderRadius: 'sm'
|
|
},
|
|
md: {
|
|
fontSize: 'sm',
|
|
px: '4',
|
|
py: 0,
|
|
h: '34px',
|
|
minH: '34px',
|
|
fontWeight: 'medium',
|
|
borderRadius: 'sm'
|
|
},
|
|
mdSquare: {
|
|
fontSize: 'sm',
|
|
px: '0',
|
|
py: 0,
|
|
h: '34px',
|
|
minH: '34px',
|
|
w: '34px',
|
|
fontWeight: 'medium',
|
|
borderRadius: 'sm'
|
|
},
|
|
lg: {
|
|
fontSize: 'md',
|
|
px: '4',
|
|
py: 0,
|
|
h: '40px',
|
|
minH: '40px',
|
|
fontWeight: 'medium',
|
|
borderRadius: 'md'
|
|
},
|
|
lgSquare: {
|
|
fontSize: 'md',
|
|
px: '0',
|
|
py: 0,
|
|
h: '40px',
|
|
minH: '40px',
|
|
w: '40px',
|
|
fontWeight: 'medium',
|
|
borderRadius: 'md'
|
|
}
|
|
},
|
|
variants: {
|
|
primary: {
|
|
bg: 'primary.600',
|
|
color: 'white',
|
|
border: 'none',
|
|
boxShadow: '0px 0px 1px 0px rgba(19, 51, 107, 0.08), 0px 1px 2px 0px rgba(19, 51, 107, 0.05)',
|
|
_hover: {
|
|
filter: 'brightness(120%)'
|
|
},
|
|
_disabled: {
|
|
bg: 'primary.7 !important'
|
|
}
|
|
},
|
|
primaryOutline: {
|
|
color: 'primary.600',
|
|
border: '1px solid',
|
|
borderColor: 'primary.300',
|
|
bg: 'white',
|
|
transition: 'background 0.1s',
|
|
boxShadow: '1',
|
|
_hover: {
|
|
bg: 'primary.1'
|
|
},
|
|
_active: {
|
|
color: 'primary.600'
|
|
},
|
|
_disabled: {
|
|
bg: 'white !important'
|
|
}
|
|
},
|
|
primaryGhost: {
|
|
color: 'primary.600',
|
|
border: '1px solid',
|
|
borderColor: 'primary.300',
|
|
bg: 'primary.50',
|
|
transition: 'background 0.1s',
|
|
boxShadow: '1',
|
|
_hover: {
|
|
bg: 'primary.600',
|
|
color: 'white',
|
|
borderColor: 'primary.600'
|
|
},
|
|
_disabled: {
|
|
color: 'primary.600 !important',
|
|
bg: 'primary.50 !important',
|
|
borderColor: 'primary.300 !important'
|
|
}
|
|
},
|
|
whiteBase: {
|
|
color: 'myGray.600',
|
|
border: '1px solid',
|
|
borderColor: 'myGray.250',
|
|
bg: 'white',
|
|
transition: 'background 0.1s',
|
|
boxShadow: '0px 0px 1px 0px rgba(19, 51, 107, 0.08), 0px 1px 2px 0px rgba(19, 51, 107, 0.05)',
|
|
_hover: {
|
|
color: 'primary.600'
|
|
},
|
|
_active: {
|
|
color: 'primary.600'
|
|
},
|
|
_disabled: {
|
|
color: 'myGray.600 !important'
|
|
}
|
|
},
|
|
whitePrimaryOutline: {
|
|
border: '1px solid',
|
|
borderColor: 'myGray.250',
|
|
bg: 'white',
|
|
transition: 'background 0.1s',
|
|
_hover: {
|
|
color: 'primary.600',
|
|
borderColor: 'primary.300'
|
|
}
|
|
},
|
|
whitePrimary: {
|
|
color: 'myGray.600',
|
|
border: '1px solid',
|
|
borderColor: 'myGray.250',
|
|
bg: 'white',
|
|
transition: 'background 0.1s',
|
|
boxShadow: '0px 0px 1px 0px rgba(19, 51, 107, 0.08), 0px 1px 2px 0px rgba(19, 51, 107, 0.05)',
|
|
_hover: {
|
|
color: 'primary.600',
|
|
background: 'primary.1',
|
|
borderColor: 'primary.300'
|
|
},
|
|
_active: {
|
|
color: 'primary.600'
|
|
},
|
|
_disabled: {
|
|
color: 'myGray.600 !important'
|
|
}
|
|
},
|
|
whiteDanger: {
|
|
color: 'myGray.600',
|
|
border: '1px solid',
|
|
borderColor: 'myGray.250',
|
|
bg: 'white',
|
|
transition: 'background 0.1s',
|
|
boxShadow: '0px 0px 1px 0px rgba(19, 51, 107, 0.08), 0px 1px 2px 0px rgba(19, 51, 107, 0.05)',
|
|
_hover: {
|
|
color: 'red.600',
|
|
borderColor: 'red.300',
|
|
bg: 'red.50'
|
|
},
|
|
_active: {
|
|
color: 'red.600'
|
|
}
|
|
},
|
|
grayBase: {
|
|
bg: 'myGray.150',
|
|
color: 'myGray.900',
|
|
_hover: {
|
|
color: 'primary.600',
|
|
bg: 'primary.50'
|
|
},
|
|
_disabled: {
|
|
bg: 'myGray.50 !important'
|
|
}
|
|
},
|
|
grayDanger: {
|
|
bg: 'myGray.150',
|
|
color: 'myGray.600',
|
|
_hover: {
|
|
color: 'red.600',
|
|
background: 'red.1',
|
|
borderColor: 'red.300'
|
|
},
|
|
_active: {
|
|
color: 'red.600'
|
|
}
|
|
},
|
|
grayGhost: {
|
|
color: 'myGray.500',
|
|
fontWeight: '500',
|
|
bg: 'transparent',
|
|
transition: 'background 0.1s',
|
|
_hover: {
|
|
bg: 'myGray.05'
|
|
}
|
|
},
|
|
transparentBase: {
|
|
color: 'myGray.800',
|
|
fontWeight: '500',
|
|
bg: 'transparent',
|
|
transition: 'background 0.1s',
|
|
_hover: {
|
|
bg: 'myGray.150'
|
|
},
|
|
_active: {
|
|
bg: 'myGray.150'
|
|
},
|
|
_disabled: {
|
|
color: 'myGray.800 !important'
|
|
}
|
|
},
|
|
transparentDanger: {
|
|
color: 'myGray.800',
|
|
fontWeight: '500',
|
|
bg: 'transparent',
|
|
transition: 'background 0.1s',
|
|
_hover: {
|
|
bg: 'red.50',
|
|
color: 'red.600'
|
|
},
|
|
_active: {
|
|
bg: 'red.50'
|
|
},
|
|
_disabled: {
|
|
color: 'myGray.800 !important'
|
|
}
|
|
},
|
|
dangerFill: {
|
|
bg: 'red.600',
|
|
color: 'white',
|
|
border: 'none',
|
|
boxShadow: '0px 0px 1px 0px rgba(19, 51, 107, 0.08), 0px 1px 2px 0px rgba(19, 51, 107, 0.05)',
|
|
_hover: {
|
|
filter: 'brightness(120%)'
|
|
},
|
|
_disabled: {
|
|
bg: 'red.200 !important'
|
|
}
|
|
}
|
|
},
|
|
defaultProps: {
|
|
size: 'base',
|
|
variant: 'primary'
|
|
}
|
|
});
|
|
|
|
const Input: ComponentStyleConfig = {
|
|
baseStyle: {
|
|
field: {
|
|
color: 'myGray.700'
|
|
}
|
|
},
|
|
sizes: {
|
|
sm: defineStyle({
|
|
field: {
|
|
h: '32px',
|
|
borderRadius: 'sm'
|
|
}
|
|
}),
|
|
md: defineStyle({
|
|
field: {
|
|
h: '36px',
|
|
borderRadius: 'sm'
|
|
}
|
|
}),
|
|
lg: defineStyle({
|
|
field: {
|
|
h: '40px',
|
|
borderRadius: 'md'
|
|
}
|
|
})
|
|
},
|
|
variants: {
|
|
outline: {
|
|
field: {
|
|
border: '1px solid',
|
|
borderColor: 'borderColor.low',
|
|
px: 3,
|
|
_focus: {
|
|
borderColor: 'primary.500',
|
|
boxShadow: shadowLight,
|
|
bg: 'white'
|
|
},
|
|
_hover: {
|
|
borderColor: 'primary.300'
|
|
},
|
|
_disabled: {
|
|
color: 'myGray.400',
|
|
bg: 'myWhite.300'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
defaultProps: {
|
|
size: 'md',
|
|
variant: 'outline'
|
|
}
|
|
};
|
|
|
|
const NumberInput = numInputMultiStyle({
|
|
sizes: {
|
|
sm: defineStyle({
|
|
field: {
|
|
h: '32px',
|
|
borderRadius: 'sm',
|
|
fontsize: 'sm'
|
|
}
|
|
}),
|
|
lg: defineStyle({
|
|
field: {
|
|
h: '40px',
|
|
borderRadius: 'sm',
|
|
fontsize: 'sm'
|
|
}
|
|
})
|
|
},
|
|
variants: {
|
|
outline: numInputPart({
|
|
field: {
|
|
bg: 'myGray.50',
|
|
border: '1px solid',
|
|
borderColor: 'myGray.200',
|
|
borderRadius: 'sm',
|
|
transition: 'border-color 0.1s ease-in-out, box-shadow 0.1s ease-in-out',
|
|
_hover: {
|
|
borderColor: 'primary.300'
|
|
},
|
|
_focus: {
|
|
borderColor: 'primary.600 !important',
|
|
boxShadow: `${shadowLight} !important`,
|
|
bg: 'white'
|
|
},
|
|
_disabled: {
|
|
color: 'myGray.400 !important',
|
|
bg: 'myWhite.300 !important'
|
|
},
|
|
_invalid: {
|
|
borderColor: 'red.500 !important',
|
|
borderWidth: '1px !important',
|
|
boxShadow: 'none !important',
|
|
_hover: {
|
|
borderColor: 'red.400 !important'
|
|
},
|
|
_focus: {
|
|
borderColor: 'red.600 !important',
|
|
boxShadow: '0px 0px 0px 2.4px rgba(244, 69, 46, 0.15) !important'
|
|
}
|
|
}
|
|
},
|
|
stepper: {
|
|
bg: 'transparent',
|
|
color: 'myGray.600',
|
|
_active: {
|
|
color: 'primary.500'
|
|
},
|
|
_hover: {
|
|
bg: 'myGray.100'
|
|
}
|
|
}
|
|
})
|
|
},
|
|
defaultProps: {
|
|
variant: 'outline'
|
|
}
|
|
});
|
|
|
|
const Textarea: ComponentStyleConfig = {
|
|
variants: {
|
|
outline: {
|
|
border: '1px solid',
|
|
px: 3,
|
|
borderRadius: 'md',
|
|
borderColor: 'myGray.200',
|
|
fontSize: 'sm',
|
|
_hover: {
|
|
borderColor: 'primary.300'
|
|
},
|
|
_focus: {
|
|
borderColor: 'primary.500',
|
|
boxShadow: shadowLight,
|
|
bg: 'white'
|
|
},
|
|
'&::-webkit-resizer': {
|
|
background: `url(${getWebReqUrl('/icon/resizer.svg')}) no-repeat`,
|
|
backgroundSize: '11px',
|
|
backgroundPosition: 'right bottom',
|
|
backgroundPositionX: 'right 12px',
|
|
backgroundPositionY: 'bottom 12px'
|
|
}
|
|
}
|
|
},
|
|
|
|
defaultProps: {
|
|
size: 'md',
|
|
variant: 'outline'
|
|
}
|
|
};
|
|
|
|
const Switch = switchMultiStyle({
|
|
baseStyle: switchPart({
|
|
track: {
|
|
bg: 'myGray.100',
|
|
borderWidth: '1px',
|
|
borderColor: 'borders.base',
|
|
_checked: {
|
|
bg: 'primary.600'
|
|
}
|
|
}
|
|
}),
|
|
defaultProps: {
|
|
size: 'md'
|
|
}
|
|
});
|
|
|
|
const Select = selectMultiStyle({
|
|
variants: {
|
|
outline: selectPart({
|
|
field: {
|
|
borderColor: 'myGray.200',
|
|
_focusWithin: {
|
|
boxShadow: shadowLight,
|
|
borderColor: 'primary.500'
|
|
}
|
|
}
|
|
})
|
|
}
|
|
});
|
|
|
|
const Radio = radioStyle({
|
|
baseStyle: radioParts({
|
|
control: {
|
|
_hover: {
|
|
borderColor: 'primary.300',
|
|
bg: 'primary.50'
|
|
},
|
|
_checked: {
|
|
borderColor: 'primary.600',
|
|
bg: 'primary.50',
|
|
boxShadow: shadowLight,
|
|
_before: {
|
|
bg: 'primary.600'
|
|
},
|
|
_hover: {
|
|
bg: 'primary.50'
|
|
}
|
|
}
|
|
}
|
|
})
|
|
});
|
|
const Checkbox = checkBoxMultiStyle({
|
|
baseStyle: checkBoxPart({
|
|
label: {
|
|
fontFamily: 'mono', // change the font family of the label
|
|
_disabled: {
|
|
outline: 'none'
|
|
}
|
|
},
|
|
control: {
|
|
borderRadius: 'xs',
|
|
bg: 'none',
|
|
_checked: {
|
|
bg: 'primary.50',
|
|
borderColor: 'primary.600',
|
|
borderWidth: '1px',
|
|
color: 'primary.600',
|
|
boxShadow: `${shadowLight} !important`,
|
|
_hover: {
|
|
bg: 'primary.50'
|
|
},
|
|
_disabled: {
|
|
bg: 'myGray.100',
|
|
borderColor: 'transparent',
|
|
color: 'myGray.400',
|
|
outline: 'none',
|
|
_hover: {
|
|
bg: 'myGray.100',
|
|
borderColor: 'transparent'
|
|
}
|
|
}
|
|
},
|
|
_hover: {
|
|
borderColor: 'primary.400'
|
|
},
|
|
_disabled: {
|
|
_hover: {
|
|
borderColor: 'inherit'
|
|
}
|
|
}
|
|
}
|
|
}),
|
|
sizes: {
|
|
sm: checkBoxPart({
|
|
control: {
|
|
width: '16px',
|
|
height: '16px',
|
|
borderWidth: '2px'
|
|
},
|
|
icon: {
|
|
fontSize: '10px'
|
|
}
|
|
}),
|
|
md: checkBoxPart({
|
|
control: {
|
|
width: '18px',
|
|
height: '18px',
|
|
borderWidth: '2px'
|
|
},
|
|
icon: {
|
|
fontSize: '12px'
|
|
}
|
|
}),
|
|
lg: checkBoxPart({
|
|
control: {
|
|
width: '20px',
|
|
height: '20px',
|
|
borderWidth: '2px'
|
|
},
|
|
icon: {
|
|
fontSize: '14px'
|
|
}
|
|
})
|
|
},
|
|
defaultProps: {
|
|
size: 'sm'
|
|
}
|
|
});
|
|
|
|
const Modal = modalMultiStyle({
|
|
sizes: {
|
|
md: modalPart({
|
|
body: {
|
|
py: 4,
|
|
px: 7
|
|
},
|
|
footer: {
|
|
pt: 2
|
|
}
|
|
}),
|
|
lg: modalPart({
|
|
body: {
|
|
pt: 8,
|
|
pb: 6,
|
|
px: '3.25rem'
|
|
},
|
|
footer: {
|
|
pb: 8,
|
|
px: '3.25rem',
|
|
pt: 0
|
|
}
|
|
})
|
|
}
|
|
});
|
|
|
|
const Table = tableMultiStyle({
|
|
sizes: {
|
|
md: defineStyle({
|
|
table: {
|
|
fontsize: 'sm'
|
|
},
|
|
thead: {
|
|
tr: {
|
|
bg: 'myGray.100',
|
|
fontSize: 'sm',
|
|
borderBottom: 'base',
|
|
th: {
|
|
borderBottom: 'none',
|
|
overflow: 'hidden',
|
|
'&:first-of-type': {
|
|
borderLeftRadius: 'md'
|
|
},
|
|
'&:last-of-type': {
|
|
borderRightRadius: 'md'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
tbody: {
|
|
tr: {
|
|
td: {
|
|
overflow: 'hidden',
|
|
'&:first-of-type': {
|
|
borderLeftRadius: 'md'
|
|
},
|
|
'&:last-of-type': {
|
|
borderRightRadius: 'md'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
},
|
|
variants: {
|
|
workflow: {
|
|
table: {
|
|
bg: 'white'
|
|
},
|
|
thead: {
|
|
tr: {
|
|
th: {
|
|
p: '0',
|
|
px: 8,
|
|
bg: 'myGray.50',
|
|
borderRadius: 'none !important',
|
|
borderBottom: 'none',
|
|
height: '32px',
|
|
fontSize: 'mini',
|
|
fontWeight: 'medium'
|
|
}
|
|
}
|
|
},
|
|
tbody: {
|
|
tr: {
|
|
td: {
|
|
p: '0',
|
|
px: 8,
|
|
fontSize: 'xs',
|
|
borderBottom: 'base',
|
|
height: '32px'
|
|
},
|
|
'&:last-child': {
|
|
td: {
|
|
borderBottom: 'none'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
defaultProps: {
|
|
size: 'md'
|
|
}
|
|
});
|
|
|
|
// 全局主题
|
|
export const theme = extendTheme({
|
|
styles: {
|
|
global: {
|
|
'html, body': {
|
|
color: 'myGray.600',
|
|
fontWeight: 'normal',
|
|
height: '100%',
|
|
overflow: 'hidden',
|
|
fontSize: '16px'
|
|
},
|
|
a: {
|
|
color: 'primary.600'
|
|
},
|
|
|
|
'*': {
|
|
_focusVisible: {
|
|
boxShadow: 'none'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
colors: {
|
|
myWhite: {
|
|
100: '#FEFEFE',
|
|
200: '#FDFDFE',
|
|
300: '#FBFBFC',
|
|
400: '#F8FAFB',
|
|
500: '#F6F8F9',
|
|
600: '#F4F6F8',
|
|
700: '#C3C5C6',
|
|
800: '#929495',
|
|
900: '#626263',
|
|
1000: '#313132'
|
|
},
|
|
myGray: {
|
|
'05': 'rgba(17, 24, 36, 0.05)',
|
|
1: 'rgba(17, 24, 36, 0.1)',
|
|
15: 'rgba(17, 24, 36, 0.15)',
|
|
|
|
25: '#FBFBFC',
|
|
50: '#F7F8FA',
|
|
100: '#F4F4F7',
|
|
150: '#F0F1F6',
|
|
200: '#E8EBF0',
|
|
250: '#DFE2EA',
|
|
300: '#C4CBD7',
|
|
400: '#8A95A7',
|
|
500: '#667085',
|
|
600: '#485264',
|
|
700: '#383F50',
|
|
800: '#1D2532',
|
|
900: '#111824'
|
|
},
|
|
primary: {
|
|
1: 'rgba(51, 112, 255, 0.1)',
|
|
'015': 'rgba(51, 112, 255, 0.15)',
|
|
3: 'rgba(51, 112, 255, 0.3)',
|
|
5: 'rgba(51, 112, 255, 0.5)',
|
|
7: 'rgba(51, 112, 255, 0.7)',
|
|
9: 'rgba(51, 112, 255, 0.9)',
|
|
|
|
50: '#F0F4FF',
|
|
100: '#E1EAFF',
|
|
200: '#C5D7FF',
|
|
300: '#94B5FF',
|
|
400: '#5E8FFF',
|
|
500: '#487FFF',
|
|
600: '#3370FF',
|
|
700: '#2B5FD9',
|
|
800: '#2450B5',
|
|
900: '#1D4091'
|
|
},
|
|
blue: {
|
|
1: 'rgba(51, 112, 255, 0.1)',
|
|
'015': 'rgba(51, 112, 255, 0.15)',
|
|
3: 'rgba(51, 112, 255, 0.3)',
|
|
5: 'rgba(51, 112, 255, 0.5)',
|
|
7: 'rgba(51, 112, 255, 0.7)',
|
|
9: 'rgba(51, 112, 255, 0.9)',
|
|
|
|
50: '#F0F4FF',
|
|
100: '#E1EAFF',
|
|
200: '#C5D7FF',
|
|
300: '#94B5FF',
|
|
400: '#5E8FFF',
|
|
500: '#487FFF',
|
|
600: '#3370FF',
|
|
700: '#2B5FD9',
|
|
800: '#2450B5',
|
|
900: '#1D4091'
|
|
},
|
|
red: {
|
|
1: 'rgba(217,45,32,0.1)',
|
|
3: 'rgba(217,45,32,0.3)',
|
|
5: 'rgba(217,45,32,0.5)',
|
|
|
|
25: '#FFFBFA',
|
|
50: '#FEF3F2',
|
|
100: '#FEE4E2',
|
|
200: '#FECDCA',
|
|
300: '#FDA29B',
|
|
400: '#F97066',
|
|
500: '#F04438',
|
|
600: '#D92D20',
|
|
700: '#B42318',
|
|
800: '#912018',
|
|
900: '#7A271A'
|
|
},
|
|
green: {
|
|
25: '#F9FEFB',
|
|
50: '#EDFBF3',
|
|
100: '#D1FADF',
|
|
200: '#B9F4D1',
|
|
300: '#76E4AA',
|
|
400: '#32D583',
|
|
500: '#12B76A',
|
|
600: '#039855',
|
|
700: '#027A48',
|
|
800: '#05603A',
|
|
900: '#054F31'
|
|
},
|
|
yellow: {
|
|
25: '#FFFDFA',
|
|
50: '#FFFAEB',
|
|
100: '#FEF0C7',
|
|
200: '#FEDF89',
|
|
300: '#F5C149',
|
|
400: '#FDB022',
|
|
500: '#F79009',
|
|
600: '#DC6803',
|
|
700: '#B54708',
|
|
800: '#93370D',
|
|
900: '#7A2E0E'
|
|
},
|
|
adora: {
|
|
25: '#FCFCFF',
|
|
50: '#F0EEFF',
|
|
100: '#E4E1FC',
|
|
200: '#D3CAFF',
|
|
300: '#B6A8FC',
|
|
400: '#9E8DFB',
|
|
500: '#8774EE',
|
|
600: '#6F5DD7',
|
|
700: '#5E4EBD',
|
|
800: '#4E4198',
|
|
900: '#42387D'
|
|
},
|
|
borderColor: {
|
|
low: '#E8EBF0',
|
|
base: '#DFE2EA',
|
|
high: '#C4CBD7',
|
|
highest: '#8A95A7'
|
|
}
|
|
},
|
|
fonts: {
|
|
body: 'PingFang,Noto Sans,-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"'
|
|
},
|
|
fontSizes: {
|
|
mini: '0.75rem',
|
|
xs: '0.8rem',
|
|
sm: '0.875rem',
|
|
md: '1rem',
|
|
lg: '1.25rem',
|
|
xl: '1.5rem',
|
|
'2xl': '1.75rem',
|
|
'3xl': '2rem',
|
|
'4xl': '2.25rem',
|
|
'5xl': '2.8rem',
|
|
'6xl': '3.6rem'
|
|
},
|
|
borders: {
|
|
sm: '1px solid #E8EBF0',
|
|
base: '1px solid #DFE2EA',
|
|
md: '1px solid #DAE0E2',
|
|
lg: '1px solid #D0E0E2'
|
|
},
|
|
radii: {
|
|
none: '0',
|
|
xs: '0.25rem',
|
|
sm: '0.375rem',
|
|
md: '0.5rem',
|
|
semilg: '0.625rem',
|
|
lg: '0.75rem',
|
|
xl: '1rem',
|
|
xxl: '1.25rem'
|
|
},
|
|
shadows: {
|
|
1: '0 1px 2px 0 rgba(19, 51, 107, 0.05), 0 0 1px 0 rgba(19, 51, 107, 0.08)',
|
|
1.5: '0px 1px 2px 0px rgba(19, 51, 107, 0.10), 0px 0px 1px 0px rgba(19, 51, 107, 0.15)',
|
|
2: '0px 4px 4px 0px rgba(19, 51, 107, 0.05), 0px 0px 1px 0px rgba(19, 51, 107, 0.08)',
|
|
3: '0px 4px 10px 0px rgba(19, 51, 107, 0.08), 0px 0px 1px 0px rgba(19, 51, 107, 0.08)',
|
|
3.5: '0px 4px 10px 0px rgba(19, 51, 107, 0.10), 0px 0px 1px 0px rgba(19, 51, 107, 0.10)',
|
|
4: '0px 12px 16px -4px rgba(19, 51, 107, 0.20), 0px 0px 1px 0px rgba(19, 51, 107, 0.20)',
|
|
5: '0px 20px 24px -8px rgba(19, 51, 107, 0.15), 0px 0px 1px 0px rgba(19, 51, 107, 0.15)',
|
|
6: '0px 24px 48px -12px rgba(19, 51, 107, 0.20), 0px 0px 1px 0px rgba(19, 51, 107, 0.20)',
|
|
7: '0px 32px 64px -12px rgba(19, 51, 107, 0.20), 0px 0px 1px 0px rgba(19, 51, 107, 0.20)',
|
|
focus: shadowLight,
|
|
outline: 'none'
|
|
},
|
|
breakpoints: {
|
|
sm: '900px',
|
|
md: '1200px',
|
|
lg: '1500px',
|
|
xl: '1800px',
|
|
'2xl': '2100px'
|
|
},
|
|
lgColor: {
|
|
activeBlueGradient: 'linear-gradient(to bottom right, #d6e8ff 0%, #f0f7ff 100%)',
|
|
hoverBlueGradient: 'linear-gradient(to top left, #d6e8ff 0%, #f0f7ff 100%)',
|
|
primary: 'linear-gradient(to bottom right, #2152d9 0%,#3370ff 40%, #4e83fd 100%)',
|
|
primary2: 'linear-gradient(to bottom right, #2152d9 0%,#3370ff 30%,#4e83fd 80%, #85b1ff 100%)'
|
|
},
|
|
components: {
|
|
Button,
|
|
Input,
|
|
Textarea,
|
|
Switch,
|
|
Select,
|
|
NumberInput,
|
|
Checkbox,
|
|
Modal,
|
|
Table,
|
|
Radio
|
|
}
|
|
});
|