@anypoint-web-components/anypoint-form-mixins

中文文档
1.3.1发布于 2021/10/15Apache-2.0ESM + CJS近 30 天下载 3223

A set of mixins to be implemented in various form controls

原始使用文档
文档目录7 节
  1. checked-element-mixin
  2. Usage
  3. Installation
  4. In a LitElement
  5. Development
  6. Running the demo locally
  7. Running the tests

Deprecated

This component has been moved to anypoint-web-components/awc.


checked-element-mixin

Use CheckedElementMixin to implement an element that can be checked like native checkbox.

Usage

Installation

npm install --save @anypoint-web-components/anypoint-form-mixins

In a LitElement

import { LitElement, html } from 'lit-element';
import { CheckedElementMixin } from '@anypoint-web-components/anypoint-form-mixins/anypoint-form-mixins.js';

class SimpleCheckbox extends CheckedElementMixin(LitElement) {
  static get styles() {
    return css`
    :host {
      display: block;
    }

    :host([invalid]) span {
      color: red;
    }

    #labelText {
      display: inline-block;
      width: 100px;
    }`;
  }

  render() {
    return html`
    <input type="checkbox" id="checkbox" @click="${this._onCheckClick}">
    <span id="labelText">${this.label}</span>
    <paper-button raised @click="${this._onClick}">validate</paper-button>`;
  }

  static get properties() {
    return {
      label: { type: String }
    };
  }

  constructor() {
    super();
    this.label = 'Not validated';
  }

  _onCheckClick(e) {
    this.checked = e.target.checked;
  }

  _onClick() {
    this.validate();
    this.label = this.invalid ? 'is invalid' : 'is valid';
  }
}
window.customElements.define('simple-checkbox', SimpleCheckbox);

Development

git clone https://github.com/anypoint-web-components/anypoint-form-mixins
cd anypoint-form-mixins
npm install

Running the demo locally

npm start

Running the tests

npm test

版本与发布记录

@anypoint-web-components/anypoint-form-mixins 共发布 8 个版本,首次发布于 2019/06/24;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.3.1latest2021/10/155 年前
1.3.02021/05/115 年前
1.2.22020/10/056 年前
1.2.12020/09/286 年前
1.2.02020/05/296 年前
1.1.02020/01/086 年前

关于 @anypoint-web-components/anypoint-form-mixins 的常见问题

@anypoint-web-components/anypoint-form-mixins 是什么?

A set of mixins to be implemented in various form controls

如何安装 @anypoint-web-components/anypoint-form-mixins?

在项目目录运行 npm install @anypoint-web-components/anypoint-form-mixins,或使用 pnpm add / yarn add / bun add。

@anypoint-web-components/anypoint-form-mixins 支持 TypeScript 吗?

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

@anypoint-web-components/anypoint-form-mixins 支持 ESM 还是 CommonJS?

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

@anypoint-web-components/anypoint-form-mixins 可以商用吗?

@anypoint-web-components/anypoint-form-mixins 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@anypoint-web-components/anypoint-form-mixins 的下载量有多少?

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

@anypoint-web-components/anypoint-form-mixins 还在维护吗?

最新版本 1.3.1 发布于 2021/10/15(5 年前);至今共发布 8 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/06/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。