Fix CSS layout issues for Bootstrap 5 inline editing

- Add flexbox layout for inline editing forms
- Constrain select dropdown maximum width to prevent overflow
- Improve button styling and spacing
- Fix alignment issues in inline mode
- Bump version to 25.0.2
This commit is contained in:
Micha
2025-07-27 15:11:10 +02:00
parent 4e840a540e
commit 53bc5ef34e
10 changed files with 4372 additions and 15 deletions

BIN
._screen16.png Executable file

Binary file not shown.

25
.npmignore Normal file
View File

@@ -0,0 +1,25 @@
# Development files
demo/
test/
src/
webpack.config.js
Gruntfile.js
# IDE files
.idea/
.claude/
# Temporary files
node_modules/
*.log
# Webpack dev files
dist/app.js
dist/app.js.*
dist/jquery.js
dist/jquery.js.*
# Legacy files
Package.nuspec
bower.json
composer.json

View File

@@ -33,6 +33,11 @@ The demo showcases:
## Installation
### Via npm
```bash
npm install x-editable-bootstrap5
```
### Dependencies
This library requires:

122
dist/README.md vendored
View File

@@ -1,17 +1,123 @@
# X-Editable (Bootstrap 5 Fork)
This project is a fork of [vitalets/x-editable](https://github.com/vitalets/x-editable), adapted to work with **Bootstrap 5** while maintaining compatibility with jQuery.
A drop-in replacement for legacy Bootstrap 3 x-editable projects, modernized for **Bootstrap 5** with jQuery support.
## Why This Fork?
The original **x-editable** library was designed for Bootstrap 3 and has not been actively maintained. This fork modernizes the codebase and updates it to support:
- **Bootstrap 5**
- **Bootstrap Icons** (replacing Glyphicons)
This project was created when we needed a **drop-in replacement** for x-editable in a legacy Bootstrap 3 project. The original [vitalets/x-editable](https://github.com/vitalets/x-editable) library has not been actively maintained and doesn't support Bootstrap 5.
NOTE: This repo has not yet been completely tested and is not available via NPM right now!
**Key Features:**
- **Bootstrap 5** compatibility
- **jQuery** support maintained
- **Select dropdowns** - fully functional
- **Date pickers** - using bootstrap-datepicker
- **Drop-in replacement** - minimal code changes needed
- **Streamlined codebase** - Bootstrap 5 only, legacy code removed
Later:
### Using npm:
```sh
## Demo
The `/demo` folder contains working examples of the library in action.
**To run the demo:**
```bash
# In the project root directory
php -S 0.0.0.0:8000
# Then visit: http://localhost:8000/demo/
```
The demo showcases:
- Select inputs with AJAX and static data sources
- Date picker functionality
- Basic in-place editing
## Installation
### Via npm
```bash
npm install x-editable-bootstrap5
```
### Dependencies
This library requires:
- **Bootstrap 5** (CSS and JS)
- **jQuery 3.x**
- **bootstrap-datepicker** (for date inputs)
### Quick Start
1. **Include the CSS and JS files:**
```html
<!-- Bootstrap 5 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<!-- Bootstrap Datepicker -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.10.0/css/bootstrap-datepicker.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.10.0/js/bootstrap-datepicker.min.js"></script>
<!-- X-Editable Bootstrap 5 -->
<link href="dist/bootstrap5-editable/css/bootstrap-editable.css" rel="stylesheet">
<script src="dist/bootstrap5-editable/js/bootstrap-editable.js"></script>
```
2. **Initialize editable elements:**
```javascript
$('#my-editable').editable({
type: 'select',
source: [
{value: 1, text: 'Option 1'},
{value: 2, text: 'Option 2'}
],
url: '/update-endpoint'
});
```
## Migration from Bootstrap 3
If you're migrating from the original x-editable:
1. **Update Bootstrap** to version 5
2. **Add bootstrap-datepicker** dependency (no longer bundled)
3. **Replace x-editable files** with this Bootstrap 5 version
4. **Update CSS classes** if using custom styling (Bootstrap 3 → 5 changes)
The JavaScript API remains largely the same, making it a true drop-in replacement.
## Build
To build the library from source:
```bash
# Install dependencies
npm install
# Build with Grunt
grunt build
# Or build with webpack for demo
npx webpack --mode=development
```
## Repository
**Main Repository:** [git.24unix.net/tracer/x-editable-bs5](https://git.24unix.net/tracer/x-editable-bs5)
**Mirrors:**
- GitHub: [github.com/24unix/x-editable-bs5](https://github.com/24unix/x-editable-bs5)
- GitLab: [gitlab.com/24unix/x-editable-bs5](https://gitlab.com/24unix/x-editable-bs5)
Development happens on the main repository at git.24unix.net, with mirrors automatically synced to GitHub and GitLab.
## License
This project maintains the same MIT license as the original x-editable project.
## Credits
- Original [x-editable](https://github.com/vitalets/x-editable) by [Vitaliy Potapov](https://github.com/vitalets)
- Bootstrap 5 modernization and maintenance by this fork

View File

@@ -1,4 +1,4 @@
/*! X-editable - v1.5.2
/*! X-editable Bootstrap 5 - v25.0.1
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -170,6 +170,45 @@
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}
/* Bootstrap 5 inline editing fixes */
.editable-inline .editableform {
display: inline-flex;
align-items: center;
gap: 0.5rem;
flex-wrap: nowrap;
}
.editable-inline .editable-input {
flex-shrink: 1;
min-width: 0;
max-width: 200px; /* Prevent overly wide selects */
}
.editable-inline .editable-input select {
max-width: 100%;
min-width: 120px;
}
.editable-inline .editable-buttons {
flex-shrink: 0;
margin-left: 0;
display: flex;
align-items: center;
gap: 0.25rem;
}
/* Improve button styling for Bootstrap 5 */
.editable-buttons .btn {
padding: 0.25rem 0.5rem;
line-height: 1.2;
border-radius: 0.25rem;
}
.editable-buttons .btn-sm {
padding: 0.125rem 0.25rem;
font-size: 0.875rem;
}
.editable-container.editable-popup {
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
}

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
/*! X-editable - v1.5.2
/*! X-editable Bootstrap 5 - v25.0.1
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,8 +1,8 @@
{
"name": "@24unix/x-editable",
"title": "X-editable",
"name": "x-editable-bootstrap5",
"title": "X-editable Bootstrap 5",
"description": "A maintained fork of x-editable for Bootstrap 5 support.",
"version": "1.5.2",
"version": "25.0.2",
"homepage": "https://git.24unix.net/tracer/x-editable",
"author": {
"name": "Micha Espey",

BIN
screen16.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -165,3 +165,42 @@
border-radius: 0.375rem;
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}
/* Bootstrap 5 inline editing fixes */
.editable-inline .editableform {
display: inline-flex;
align-items: center;
gap: 0.5rem;
flex-wrap: nowrap;
}
.editable-inline .editable-input {
flex-shrink: 1;
min-width: 0;
max-width: 200px; /* Prevent overly wide selects */
}
.editable-inline .editable-input select {
max-width: 100%;
min-width: 120px;
}
.editable-inline .editable-buttons {
flex-shrink: 0;
margin-left: 0;
display: flex;
align-items: center;
gap: 0.25rem;
}
/* Improve button styling for Bootstrap 5 */
.editable-buttons .btn {
padding: 0.25rem 0.5rem;
line-height: 1.2;
border-radius: 0.25rem;
}
.editable-buttons .btn-sm {
padding: 0.125rem 0.25rem;
font-size: 0.875rem;
}