@castandcrew/document-signer-react

中文文档
3.0.14发布于 2026/10/26MITCommonJS近 30 天下载 4909

Document-Signer React Component

原始使用文档
文档目录4 节
  1. DocumentViewer
  2. DocumentSigner
  3. onDocumentComplete
  4. MobileDocumentPane

DocumentSigner React components

@castandcrew/document-signer-react NPM packge provides following React components:

DocumentViewer

Import:

import DocumentViewer from '@castandcrew/document-signer-react/DocumentViewer';
or;
import { DocumentViewer } from '@castandcrew/document-signer-react';

Props:

NameTypeDefaultDescription
actionBarPropsActionBar.propsActionBar component properties
actionButtonsArray<React.Component>ActionBar buttons
activeRoleIdnull
activeRuleGroupIdnull
classesObject
classNameString
currentDocumentObject
documentMappingModeBooleanfalse
getDocumentImageUrlsfunc(documentId: String, page: Integer)
goToFieldfunc(String)
nextDocIdString
prevDocIdString
renderFieldfunc(Object)
setCurrentDocumentfunc(String)
sideBarReact.Component
throwFatalErrorfuncFatal error handler
withSidebarBooleanfalseRender sidebar?
selectedDocIds`Array'[]
isPreviewDocumentBoolean`false

DocumentSigner

Import:

import DocumentSigner from '@castandcrew/document-signer-react/DocumentSigner';
or;
import { DocumentSigner } from '@castandcrew/document-signer-react';

Props:

NameTypeDefaultDescription
actions{ submit?: Action, cancel?: Action, save?: Action }Action object is defined as { text: String, action: func(docs: [Object])}
actor{ name: String, initials: String }Document Actor data
canApproveOffersBooleanCan Actor approve offers? (We want to remove this)
classes{ root?: CSSObject, busyOverlay?: CSSObject, busyContainer?: CSSObject, documentSelector?: CSSObject, documentViewer?: CSSObject }CSSObject is a Object defining CSS rules
classNameStringAdditional CSS class name for the root HTML element
documentsArray<Object>Array of document objects received from Document-Signer API application
featureFlagsArray<String>Array of enabled Feature-Flag names
getDocumentImageUrlsfunc(documentId: UUID, page: Int)Function to retreive image for the specific document page
isDocOneBoolfalseIs there only 1 document to sign? (We want to remove this)
isSaveSignatureEnabledBoolShould we offer to save signature for the session lifetime?
meObjectAuthneticated user information
offerObjectOffer information
onDocumentCompletefunc({ documentId, hasNextIncompleteDocument, continue })Reskin only. See onDocumentComplete
showI9NoteBoolShould we show notification message for I-9 documents?
styledEngineInjectFirstBooleanfalseShould StyledEngineProvider inject CSS first?
templatesAcknowledgeNotesStringAcknowledgement Notes
templatesAcknowledgeTitleStringAcknowledgement Title
throwFatalErrorfunc(message: String)Fatal error handler

Reskin-only props (DocumentSigner.reskin):

NameTypeDefaultDescription
pendingReviewDocumentIdsArray<String | Number>[]Documents waiting on a review outside the signer. They show "Form is incomplete" with a warning icon and keep the submit button disabled.
renderDocumentBannerfunc(currentDocument: Object) => NodeContent rendered above the current document's page image, eg. an alert. Return null for no banner.

onDocumentComplete

Optional, desktop reskin (DocumentSigner.reskin) only. Called once each time a document becomes complete and valid (all required fields filled, no document or field errors, and not pending review). Reopening or re-editing an already complete document does not call it again; it is called again only if the document becomes incomplete or invalid and then complete again. The payload is:

  • documentId: the completed document id.
  • hasNextIncompleteDocument: whether an incomplete document follows it.
  • continue(): navigates to the next incomplete document after it, resolved when called; does nothing if there is none.

When this prop is provided, the built-in success notification is not shown, so the consumer is responsible for its own notice. Error and save notifications are unchanged. Without it, the signer behaves as before.

MobileDocumentPane

Import:

import MobileDocumentPane from '@castandcrew/document-signer-react/MobileDocumentPane';
or;
import { MobileDocumentPane } from '@castandcrew/document-signer-react';

Props:

NameTypeDefaultDescription
actorObject
classNameString
isAutosignActiveBoolean
onChangeInputfunc(inputId, value)
onDoubleClickfunc(Event)
onFocusInputfunc(inputId)
onNeedPagefunc(pageIndex)
onPageLoadErrorfunc(index, error, tryCount)
pageHeightInteger
pagesInteger
pageWidthInteger
scrollContainerHTMLElement
selectedInputIdString
zoomInteger

版本与发布记录

@castandcrew/document-signer-react 共发布 84 个版本,首次发布于 2020/12/08;过去 12 个月发布了 42 个版本。

版本发布日期距今
3.0.14latest2026/10/2613 天前
3.0.132026/10/2119 天前
3.0.122026/10/2119 天前
3.0.112026/10/1327 天前
3.0.10-alpha.222026/09/261 个月前
3.0.10-alpha.212026/09/241 个月前

其他发布通道:alpha → 3.0.10-alpha.18。

关于 @castandcrew/document-signer-react 的常见问题

@castandcrew/document-signer-react 是什么?

Document-Signer React Component

如何安装 @castandcrew/document-signer-react?

在项目目录运行 npm install @castandcrew/document-signer-react,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^17.0.0 || ^18.0.0 || ^19.0.0)、react-dom(^17.0.0 || ^18.0.0 || ^19.0.0)、@mui/styles(^5.16.14)、@mui/system(^5.16.14)、@mui/material(^5.16.14)、react-router-dom(^6.25.1)、@mui/icons-material(^5.16.14)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@castandcrew/document-signer-react 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/castandcrew__document-signer-react 是否存在。

@castandcrew/document-signer-react 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@castandcrew/document-signer-react 可以商用吗?

@castandcrew/document-signer-react 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@castandcrew/document-signer-react 的下载量有多少?

根据 npm 官方下载统计,@castandcrew/document-signer-react 在 2026/10/09 – 2026/11/07 这 30 天内被下载 4,909 次,日均约 164 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@castandcrew/document-signer-react 还在维护吗?

最新版本 3.0.14 发布于 2026/10/26(13 天前);至今共发布 84 个版本,其中过去 12 个月发布了 42 个;首次发布于 2020/12/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。