Enhance form column settings and table display

- Add "Show all" and "Hide all" buttons in column settings modal
- Improve column width handling and default width management
- Update OpenSelect and OpenText components to support more flexible prop types
- Add z-index to table header for better visual hierarchy
- Refactor column width property from `cell_width` to `width`
This commit is contained in:
Julien Nahum
2025-02-17 11:27:58 +01:00
parent 0d6bd1bfde
commit 55b0f57741
8 changed files with 203 additions and 38 deletions

View File

@@ -7,7 +7,7 @@
<thead
:id="'table-header-' + tableHash"
ref="header"
class="n-table-head top-0"
class="n-table-head top-0 z-10"
:class="{ absolute: data.length !== 0 }"
style="will-change: transform; transform: translate3d(0px, 0px, 0px)"
>
@@ -18,7 +18,7 @@
:key="col.id"
scope="col"
:allow-resize="allowResize"
:width="col.cell_width ? col.cell_width + 'px' : 'auto'"
:width="col.width ? col.width + 'px' : '150px'"
class="n-table-cell p-0 relative"
@resize-width="resizeCol(col, $event)"
>
@@ -68,7 +68,7 @@
<td
v-for="(col, colIndex) in columns"
:key="col.id"
:style="{ width: col.cell_width + 'px' }"
:style="{ width: col.width ? col.width + 'px' : '150px' }"
class="n-table-cell border-gray-100 dark:border-gray-900 text-sm p-2 overflow-hidden"
:class="[
{
@@ -179,7 +179,8 @@ export default {
type: Boolean,
},
scrollParent: {
type: [Boolean]
type: [Boolean, Object],
default: null
},
},
emits: ["updated", "deleted", "resize", "update-columns"],
@@ -294,7 +295,7 @@ export default {
if (this.internalColumns) {
this.$nextTick(() => {
this.internalColumns.forEach((col) => {
if (!_has(col, "cell_width")) {
if (!_has(col, "width")) {
if (
this.allowResize &&
this.internalColumns.length &&
@@ -315,7 +316,7 @@ export default {
resizeCol(col, width) {
if (!this.form) return
const index = this.internalColumns.findIndex((c) => c.id === col.id)
this.internalColumns[index].cell_width = width
this.internalColumns[index].width = width
this.setColumns(this.internalColumns)
this.$nextTick(() => {
this.$emit("resize")

View File

@@ -24,8 +24,14 @@ export default {
components: { OpenTag },
props: {
value: {
type: Object,
type: [String, Object, Array],
required: false,
default: null
},
property: {
type: Object,
required: true
}
},
data() {
@@ -34,10 +40,7 @@ export default {
computed: {
valueIsObject() {
if (typeof this.value === "object" && this.value !== null) {
return true
}
return false
return Array.isArray(this.value) || (typeof this.value === "object" && this.value !== null)
},
},
}

View File

@@ -7,8 +7,9 @@ export default {
components: {},
props: {
value: {
type: String,
required: true,
type: [String, Number],
required: false,
default: null
},
},
}