avalynx/avalynx-select
Composer 安装命令:
composer require avalynx/avalynx-select
包简介
AvalynxSelect is a lightweight, customizable select dropdown 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
AvalynxSelect is a lightweight, customizable select dropdown 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 Dropdowns: Supports various customization options like live search, case sensitivity, scrollable list, and more.
- AJAX Support: Dynamically load list items via AJAX with support for custom mapping, debouncing, and prefetching.
- Bootstrap Integration: Designed for seamless integration with Bootstrap >= 5.3.
- Easy to Use: Simple API for creating and managing select dropdowns within your web applications.
Example
Here's a simple example of how to use AvalynxSelect in your project:
- Overview
- Simple select
- Simple select with livesearch and different options
- Simple select with AJAX
- Simple select with responsive design
- Simple select with event listeners
- Disabled select
- Default value select
Installation
To use AvalynxSelect in your project, you can directly include it in your HTML file. Ensure you have Bootstrap 5.3 or higher included in your project for AvalynxSelect to work correctly.
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 AvalynxSelect:
<script src="path/to/avalynx-select.js"></script>
Replace path/to/avalynx-select.js with the actual path to the file in your project.
Installation via jsDelivr (Link)
AvalynxSelect is also available via jsDelivr. You can include it in your project like this:
<script src="https://cdn.jsdelivr.net/npm/avalynx-select@1.2.1/dist/js/avalynx-select.js"></script>
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxSelect displays correctly.
Installation via NPM (Link)
AvalynxSelect is also available as a npm package. You can add it to your project with the following command:
npm install avalynx-select
After installing, you can import AvalynxSelect into your JavaScript file like this:
import { AvalynxSelect } from 'avalynx-select';
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxSelect displays correctly.
Installation via Symfony AssetMapper
php bin/console importmap:require avalynx-select
After installing, you can import AvalynxSelect into your JavaScript file like this:
import { AvalynxSelect } from 'avalynx-select';
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxSelect displays correctly.
Installation via Symfony AssetComposer
More information about the Symfony AssetComposer Bundle can be found here.
{% do addAssetComposer('avalynx/avalynx-select/dist/js/avalynx-select.js') %}
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxSelect displays correctly.
Installation via Composer (Link)
AvalynxSelect is also available as a Composer package. You can add it to your project with the following command:
composer require avalynx/avalynx-select
After installing, you can import AvalynxSelect into your HTML file like this:
<script src="vendor/avalynx/avalynx-select/dist/js/avalynx-select.js"></script>
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxSelect displays correctly.
Usage
To create a select dropdown, simply instantiate a new AvalynxSelect object with the desired options:
new AvalynxSelect("#mySelect", { liveSearch: true, caseSensitive: false, showAll: true, scrollList: true, scrollItems: 8 }, { searchPlaceholder: 'Search...', selectPlaceholder: 'Please select...' });
For AJAX support:
new AvalynxSelect("#myAjaxSelect", { ajax: { url: 'https://api.example.com/data', method: 'GET', minimumInputLength: 3 } });
Options
AvalynxSelect allows the following options for customization:
selector: (string) The selector to use for targeting select elements within the DOM (default:'.avalynx-select').options: An object containing the following keys:className: (string) A custom class name for the loader element (default:'').liveSearch: (boolean) Enable live search functionality (default:false).caseSensitive: (boolean) Enable case-sensitive search (default:false).showAll: (boolean) Show all options when search term is empty (default:true).showActive: (boolean) Show the active option in the dropdown (default:true).scrollList: (boolean) Enable scrollable list (default:true).scrollItems: (number) Number of items to display before scrolling (default:8).maxItemsToShow: (number|null) Cap the number of rendered items (default:null).noDefaultSelection: (boolean) Do not select any option by default (default:false).disabled: (boolean) Initialize the select as disabled (default:false).defaultValue: (string|null) The default value to select on initialization (default:null).ajax: (object|null) Configuration for AJAX data source (default:null).url: (string) URL for the AJAX request (default:'').method: (string) HTTP method for the AJAX request (default:'GET').headers: (object) Custom headers for the AJAX request (default:{}).debounce: (number) Debounce time in milliseconds (default:250).minimumInputLength: (number) Minimum number of characters before AJAX request (default:0).length: (number) Number of items to fetch (default:25).start: (number) Starting index for fetching items (default:0).initialLoad: (boolean) Load initial data via AJAX (default:false).mapRequest: (function|null) Function to map request parameters (default:null).mapResponse: (function|null) Function to map response data (default:null).resolveByValue: (function|null) Function to resolve a value to a label (default:null).
onChange: (function) Callback function to be executed when an option is selected (default:null).onLoaded: (function) Callback function to be executed when the component is loaded (default:null).
language: An object containing the following keys:searchPlaceholder: (string) Placeholder text for the search input (default:'Search...').selectPlaceholder: (string) Placeholder text for the select dropdown (default:'Please select...').loading: (string) Text to display when loading data (default:'Loading...').noResults: (string) Text to display when no results are found (default:'No results').error: (string) Text to display when an error occurs (default:'Error loading data').typeMore: (string) Text to display for minimum input requirement (default:'Type {remaining} more characters...').idleHint: (string) Hint text when the search input is empty (default:'Start typing to search').
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
AvalynxSelect is open-sourced software licensed under the MIT license.
Contact
If you have any questions, feature requests, or issues, please open an issue on our GitHub repository or submit a pull request.
Thank you for considering AvalynxSelect for your project!
avalynx/avalynx-select 适用场景与选型建议
avalynx/avalynx-select 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 134 次下载、GitHub Stars 达 4, 最近一次更新时间为 2024 年 05 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「bootstrap」 「component」 「select」 「dropdown」 「bootstrap5」 「avalynx」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 avalynx/avalynx-select 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 avalynx/avalynx-select 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 avalynx/avalynx-select 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
FSi DataSource Component
CakePHP behavior plugin for easily generating some complicated queries like (bulk) insert/upsert etc.
PHP PDO Mysql select statement iterator implemented as multiple queries using LIMIT clauses
PHP library that allows linking queries from diferent physical databases using mysql pdo database connections
Country select field type.
Views for the package MedicOneSystems Livewire Datatables with Bootstrap 4
统计信息
- 总下载量: 134
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 26
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-30