@bigbinary/neeto-form-frontend

中文文档
4.6.4发布于 2026/11/05UNLICENSEDTypeScriptESM + CJS零依赖近 30 天下载 1.4万

Neeto Form Engine Frontend

原始使用文档
文档目录8 节
  1. Engine
  2. Installation
  3. Customizability
  4. Set up Google reCAPTCHA
  5. Frontend package
  6. Installation
  7. Instructions for development
  8. Usage

neeto-form-nano

The neeto-form-nano allows us to build forms within neeto applications. This nano exports @bigbinary/neeto-form-frontend NPM package and neeto-form-engine Rails engine.

See this page to find host applications using this nano. Changes made in the nano should be rolled out to all of them, especially migrations..

Contents

  1. Development with Host Application
  2. Instructions for Publishing

Development with Host Application

Engine

The engine adds setup for form on backend and allows us to attach forms to any model. It also stores submissions.

Installation

  1. Add this line to your application's Gemfile:

    source "NEETO_GEM_SERVER_URL" do
      # ...existing gems
    
      gem 'neeto-form-engine'
    
      # Use this for development:
      # gem 'neeto-form-engine', path: "../neeto-form-nano"
    end
    
  2. And then execute:

    bundle install
    
  3. Install the migrations

    bundle exec rails neeto_form_engine:install:migrations
    
  4. Run the migrations

    bundle exec rails db:migrate
    
  5. Add this line to your application's config/routes.rb file.

    mount NeetoFormEngine::Engine, at: "/neeto_form"
    
  6. Create file neeto_form_engine.rb under config/initializers to provide the owner_class information

    NeetoFormEngine.owner_class = "Organization"
    
  7. Configure models to add below association to the provided owner class

    has_many :forms, class_name: "::NeetoFormEngine::Form", as: :owner
    
  8. Configure models to add below association to scope submission records (optional)

    has_one :submission, class_name: "::NeetoFormEngine::Submission", as: :record
    
  9. Configure model to add below association to attach form (optional)

    has_one :form, class_name: "::NeetoFormEngine::Form", as: :attachable
    

Customizability

NeetoFormEngine::Customizable::Forms::Createable

The engine supports customizing the default behavior of Forms::CreateService by overriding the supported methods in this concern.

Available methods:

  1. create_default_questions!: If you want to use custom logic to create default questions, you can specify them using this method. owner, form and params will be available globally.
  2. additional_form_params: If you want to include additional attributes while creating forms, you can specify them using this method. It takes one argument params which will be the form parameters passed from the front-end.

NeetoFormEngine::Customizable::Questions::Createable

The engine supports customizing the default behavior of Questions::CreateService by overriding the supported methods in this concern.

Available methods:

  1. create_question!: This method receives one argument params that contains the question parameters passed from the front-end.
  2. additional_question_params: If you want to include additional attributes while creating questions, you can specify them using this method. It takes one argument params which will be the question parameters passed from the front-end.

NeetoFormEngine::Customizable::Questions::Updateable

The engine supports customizing the default behavior of Questions::UpdateService by overriding the supported constants in this concern.

Available constants:

  1. EXCLUDED_UPDATE_PARAMS: If you have included extra parameters other than kind for additional use cases that are not valid entity attributes, they need to be specified as EXCLUDED_UPDATE_PARAMS.

NeetoFormEngine::Customizable::QuestionResponses::Createable

The engine supports customizing the default behavior of QuestionResponses::CreateService by overriding the supported methods in this concern.

Available methods:

  1. additional_initialization_logic: If you want to initialize additional variables, you can specify them using this method.
  2. additional_process_actions: If you want to perform any additional actions outside the transaction block, you can override this method.
  3. additional_create_submission_actions: You can use this method to specify any additional logic that needs to be executed after creating submissions.
  4. additional_create_response_actions: If you want to perform some additional actions on each of the responses, you can specify them using this method. This method receives question and response_param passed from the front-end as arguments.

Set up Google reCAPTCHA

  1. Sign up for an API key pair from the official website.

  2. Configure the following environment variables and secrets with suitable values

    • Under .env file:

      FORM_NANO_RECAPTCHA_V2_SITE_KEY=# Value from Google cloud console
      FORM_NANO_RECAPTCHA_V2_SECRET_KEY=# Value from Google cloud console
      
    • Under secrets.yml file:

      form_nano:
        recaptcha_v2:
          site_key: <%= ENV["FORM_NANO_RECAPTCHA_V2_SITE_KEY"] %>
          secret_key: <%= ENV["FORM_NANO_RECAPTCHA_V2_SECRET_KEY"] %>
      
  3. Include the site key in global_props

    module ApplicationHelper
      def get_client_props
        # other variables
        custom_props = {
          # other props
          form_nano_recaptcha_v2_site_key: Rails.application.vault.form_nano.dig(:recaptcha_v2, :site_key)
        }
      end
    end
    

Frontend package

The frontend package allows us to create forms across neeto products.

Installation

  1. Install the NPM package

    yarn add @bigbinary/neeto-form-frontend
    
  2. The frontend package has a few peer dependencies that are required for the proper functioning of the package. Install all the peer dependencies using the below command:

    yarn add @bigbinary/neetoui @bigbinary/neeto-icons ramda@^0.28.0 classnames@^2.3.1 [email protected] @bigbinary/neeto-commons-frontend react-google-recaptcha
    
  3. Import stylesheet from the following location:

    @import "@bigbinary/neeto-form-frontend/dist/main.css";
    

Instructions for development

Check the Frontend package development guide for step-by-step instructions to develop the frontend package.

Usage

You can learn more about the usage here:

  1. Components
  2. Hooks
  3. Email Verification

Instructions for Publishing

Consult the building and releasing packages guide for details on how to publish.

版本与发布记录

@bigbinary/neeto-form-frontend 共发布 363 个版本,首次发布于 2023/01/05;过去 12 个月发布了 125 个版本。

版本发布日期距今
4.6.4latest2026/11/053 天前
4.6.4-beta1beta2026/11/053 天前
4.6.32026/11/017 天前
4.6.3-beta12026/11/017 天前
4.6.22026/10/309 天前
4.6.2-beta12026/10/309 天前

关于 @bigbinary/neeto-form-frontend 的常见问题

@bigbinary/neeto-form-frontend 是什么?

Neeto Form Engine Frontend

如何安装 @bigbinary/neeto-form-frontend?

在项目目录运行 npm install @bigbinary/neeto-form-frontend,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:qs(6.16.2)、url(0.11.4)、yup(0.32.11)、antd(5.22.1)、util(^0.12.5)、uuid(14.0.0)、axios(1.20.0)、dayjs(1.11.10)、ramda(0.29.0)、react(18.3.1)、buffer(^6.0.3)、formik(2.4.6)、i18next(22.5.1)、zustand(4.4.2)、dompurify(3.4.17)、js-logger(1.6.1)、react-dom(18.3.1)、classnames(2.5.1)、stream-http(3.2.0)、tailwindcss(3.4.14)、lucide-react(0.577.0)、react-helmet(^6.1.0)、react-select(5.6.0)、framer-motion(11.2.14)、os-browserify(0.3.0)、react-i18next(12.3.1)、vm-browserify(1.1.2)、@babel/runtime(7.29.7)、react-dropzone(14.3.8)、react-toastify(8.0.2)、tty-browserify(0.0.1)、path-browserify(^1.0.1)、https-browserify(1.0.0)、mixpanel-browser(^2.45.0)、react-router-dom(5.3.3)、@hello-pangea/dnd(16.3.0)、crypto-browserify(3.12.1)、libphonenumber-js(1.11.14)、source-map-loader(4.0.1)、stream-browserify(^3.0.0)、@bigbinary/neetoui(8.8.3)、@honeybadger-io/js(6.10.1)、@rails/activestorage(7.0.8-3)、@bigbinary/neeto-cist(1.0.17)、@honeybadger-io/react(6.1.25)、@tanstack/react-query(5.59.20)、@bigbinary/neeto-atoms(1.1.6)、@bigbinary/neeto-icons(1.20.89)、react-google-recaptcha(^3.1.0)、@bigbinary/neeto-hotkeys(1.0.9)、@bigbinary/neeto-molecules(5.12.1)、@tailwindcss/container-queries(^0.1.1)、@tanstack/react-query-devtools(5.59.20)、@bigbinary/neeto-editor-frontend(2.5.0)、@bigbinary/neeto-commons-frontend(4.15.0)、@bigbinary/neeto-filters-frontend(4.7.1)、@bigbinary/neeto-image-uploader-frontend(4.1.16)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bigbinary/neeto-form-frontend 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bigbinary/neeto-form-frontend 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@bigbinary/neeto-form-frontend 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.13。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@bigbinary/neeto-form-frontend 可以商用吗?

@bigbinary/neeto-form-frontend 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@bigbinary/neeto-form-frontend 的下载量有多少?

根据 npm 官方下载统计,@bigbinary/neeto-form-frontend 在 2026/10/08 – 2026/11/06 这 30 天内被下载 13,754 次,日均约 458 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bigbinary/neeto-form-frontend 还在维护吗?

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