定制 avalynx/avalynx-autocomplete 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

avalynx/avalynx-autocomplete

Composer 安装命令:

composer require avalynx/avalynx-autocomplete

包简介

AvalynxAutocomplete is a lightweight, customizable autocomplete component for web applications. It is designed to be used with Bootstrap version 5.3 or higher and does not require any framework dependencies.

README 文档

README

npm version npm downloads jsDelivr License Tests codecov GitHub stars

AvalynxAutocomplete is a lightweight, customizable autocomplete component for web applications. It is designed to be used with Bootstrap version 5.3 or higher and does not require any framework dependencies.

Features

  • Customizable Autocomplete Inputs: Supports various customization options like single- and multi-select, case-sensitivity, minimum length for search, and debouncing.
  • Flexible Data Sources: Support for static data or dynamic loading via a custom fetchData function.
  • Multi-Select Support: Management of multiple selections with tags, which can be displayed either above or inline in the input field.
  • Bootstrap Integration: Designed for seamless integration with Bootstrap >= 5.3.
  • Easy to Use: Simple API for creating and managing autocomplete fields in your web applications.

Examples

Here is an overview of various use cases for AvalynxAutocomplete:

Installation

To use AvalynxAutocomplete in your project, you can directly include it in your HTML file. Ensure you have Bootstrap 5.3 or higher included in your project.

First, include Bootstrap:

<!-- Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3/dist/js/bootstrap.bundle.min.js"></script>

Then, include AvalynxAutocomplete (CSS and JS):

<link rel="stylesheet" href="path/to/avalynx-autocomplete.css">
<script src="path/to/avalynx-autocomplete.js"></script>

Replace path/to/ with the actual path to the file in your project.

Installation via jsDelivr (Link)

AvalynxAutocomplete is also available via jsDelivr. You can include it in your project like this:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/avalynx-autocomplete@1.0.4/dist/css/avalynx-autocomplete.css">
<script src="https://cdn.jsdelivr.net/npm/avalynx-autocomplete@1.0.4/dist/js/avalynx-autocomplete.js"></script>

Make sure to also include Bootstrap's JS/CSS in your project.

Installation via NPM (Link)

AvalynxAutocomplete is also available as an npm package. You can add it to your project with the following command:

npm install avalynx-autocomplete

After installation, you can import AvalynxAutocomplete into your JavaScript file like this:

import { AvalynxAutocomplete } from 'avalynx-autocomplete';

Installation via Symfony AssetMapper

php bin/console importmap:require avalynx-autocomplete

After installation, you can import AvalynxAutocomplete into your JavaScript file like this:

import { AvalynxAutocomplete } from 'avalynx-autocomplete';

Installation via Symfony AssetComposer

More information about the Symfony AssetComposer Bundle can be found here.

{% do addAssetComposer('avalynx/avalynx-autocomplete/dist/css/avalynx-autocomplete.css') %}
{% do addAssetComposer('avalynx/avalynx-autocomplete/dist/js/avalynx-autocomplete.js') %}

Installation via Composer (Link)

AvalynxAutocomplete is also available as a Composer package. You can add it to your project with the following command:

composer require avalynx/avalynx-autocomplete

After installation, you can include AvalynxAutocomplete in your HTML file like this:

<link rel="stylesheet" href="vendor/avalynx/avalynx-autocomplete/dist/css/avalynx-autocomplete.css">
<script src="vendor/avalynx/avalynx-autocomplete/dist/js/avalynx-autocomplete.js"></script>

Usage

To create an autocomplete field, simply instantiate a new AvalynxAutocomplete object with the desired options:

new AvalynxAutocomplete("#myAutocomplete", {
  data: [
    { key: '1', value: 'Option 1' },
    { key: '2', value: 'Option 2' },
    { key: '3', value: 'Option 3' }
  ],
  maxItems: 10,
  minLength: 2
}, {
  placeholder: 'Search...',
  noResults: 'No results found'
});

For use with an API (fetchData):

new AvalynxAutocomplete("#myAjaxAutocomplete", {
  fetchData: async (query) => {
    const response = await fetch(`https://api.example.com/search?q=${query}`);
    const data = await response.json();
    return data.map(item => ({ key: item.id, value: item.name }));
  },
  minLength: 3
});

Options

AvalynxAutocomplete allows the following options for customization:

  • selector: (string) The selector for the input elements (default: '.avalynx-autocomplete').
  • options: An object containing the following keys:
    • className: (string) Additional CSS classes for the dropdown (default: '').
    • maxItems: (number) Maximum number of results displayed in the dropdown (default: 5).
    • maxSelections: (number) Maximum number of selectable items. If > 1, multi-select mode is activated (default: 1).
    • minLength: (number) Minimum number of characters to start the search (default: 1).
    • debounce: (number) Delay in milliseconds after the last keystroke (default: 300).
    • caseSensitive: (boolean) Case-sensitive search (default: false).
    • disabled: (boolean) Initialize in a disabled state (default: false).
    • defaultValue: (string|null) Default value (label) upon initialization (default: null).
    • defaultKey: (string|null) Default key upon initialization (default: null).
    • defaultSelections: (array|null) Array of objects {key, value} for multi-select default values (default: null).
    • tagsPosition: (string) Position of tags in multi-select ('above' or 'inline') (default: 'above').
    • clearStyle: (string) Style of the clear button ('button' or 'icon') (default: 'button').
    • data: (array|null) Static array of data objects {key, value} (default: null).
    • fetchData: (function|null) Asynchronous function for fetching data (default: null).
    • onChange: (function) Callback on selection change (default: null).
    • onClear: (function) Callback when the field is cleared (default: null).
    • onLoaded: (function) Callback after component initialization (default: null).
  • language: An object containing the following keys:
    • placeholder: (string) Placeholder text for the input field (default: 'Search...').
    • noResults: (string) Text when no results are found (default: 'No results found').
    • clearTitle: (string) Title attribute for the clear button (default: 'Clear selection').
    • removeTitle: (string) Title attribute for removing a tag (default: 'Remove').

Contributing

Contributions are welcome! If you'd like to contribute, please fork the repository and submit a pull request with your changes or improvements. We're looking for contributions in the following areas:

  • Bug fixes
  • Feature enhancements
  • Documentation improvements

Before submitting your pull request, please ensure your changes are well-documented and follow the existing coding style of the project.

License

AvalynxAutocomplete is open-source software licensed under the MIT license.

Contact

If you have any questions, feature requests, or issues, please open an issue in our GitHub repository or submit a pull request.

Thank you for considering AvalynxAutocomplete for your project!

avalynx/avalynx-autocomplete 适用场景与选型建议

avalynx/avalynx-autocomplete 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「bootstrap」 「autocomplete」 「component」 「dropdown」 「bootstrap5」 「avalynx」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 avalynx/avalynx-autocomplete 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 avalynx/avalynx-autocomplete 我们能提供哪些服务?
定制开发 / 二次开发

基于 avalynx/avalynx-autocomplete 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 35
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-27