@omnitend/dashboard-for-laravel 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/extended/DXField.vue.d.ts +8 -4
- package/dist/dashboard-for-laravel.js +236 -219
- package/dist/dashboard-for-laravel.js.map +1 -1
- package/dist/dashboard-for-laravel.umd.cjs +1 -1
- package/dist/dashboard-for-laravel.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +10 -0
- package/package.json +1 -1
- package/resources/js/components/extended/DXField.vue +32 -11
- package/resources/js/components/extended/DXForm.vue +2 -0
- package/resources/js/types/index.ts +11 -0
package/dist/types/index.d.ts
CHANGED
|
@@ -157,6 +157,16 @@ export interface FieldDefinition {
|
|
|
157
157
|
* layout. Falls back to the form-level `labelCols` when omitted.
|
|
158
158
|
*/
|
|
159
159
|
labelCols?: LabelCols;
|
|
160
|
+
/**
|
|
161
|
+
* Skip rendering the field's own label. In horizontal layout no label
|
|
162
|
+
* column is reserved either, so the control spans the full width. Useful
|
|
163
|
+
* for `switch` (and `checkbox`) fields, which render their own label
|
|
164
|
+
* inside the control — the outer row label would otherwise duplicate it,
|
|
165
|
+
* and the self-label then lines up with sibling row labels. Also used
|
|
166
|
+
* internally by `DXRepeater`'s `table` layout, where a column header
|
|
167
|
+
* already names the field.
|
|
168
|
+
*/
|
|
169
|
+
hideLabel?: boolean;
|
|
160
170
|
/**
|
|
161
171
|
* Component rendered for `type: "component"` fields. Receives
|
|
162
172
|
* `modelValue`, `field`, `model` props and emits `update:modelValue`.
|
package/package.json
CHANGED
|
@@ -35,7 +35,10 @@
|
|
|
35
35
|
:class="field.class || 'mb-3'"
|
|
36
36
|
v-bind="horizontalAttrs"
|
|
37
37
|
>
|
|
38
|
-
|
|
38
|
+
<!-- The inner label (beside the checkbox) always names the control, so
|
|
39
|
+
hideLabel drops only the redundant outer row label; horizontalAttrs
|
|
40
|
+
then reserves no label column, letting the control span full width. -->
|
|
41
|
+
<template v-if="!hideLabel" #label>
|
|
39
42
|
<DXFieldLabel :label="resolvedLabel" :info="resolvedInfo" />
|
|
40
43
|
</template>
|
|
41
44
|
<slot
|
|
@@ -119,7 +122,10 @@
|
|
|
119
122
|
:class="[field.class || 'mb-3', 'dx-switch', { 'dx-switch--on': switchIsOn }]"
|
|
120
123
|
v-bind="horizontalAttrs"
|
|
121
124
|
>
|
|
122
|
-
|
|
125
|
+
<!-- The switch renders its own label inside the control, so hideLabel
|
|
126
|
+
drops only the redundant outer row label; horizontalAttrs then
|
|
127
|
+
reserves no label column, letting the toggle span full width. -->
|
|
128
|
+
<template v-if="!hideLabel" #label>
|
|
123
129
|
<DXFieldLabel :label="resolvedLabel" :info="resolvedInfo" />
|
|
124
130
|
</template>
|
|
125
131
|
<slot
|
|
@@ -203,7 +209,7 @@
|
|
|
203
209
|
<!-- Repeater: nested, repeatable sub-form -->
|
|
204
210
|
<div v-else-if="field.type === 'repeater'" :class="field.class || 'mb-3'">
|
|
205
211
|
<DFormGroup v-bind="repeaterHorizontalAttrs">
|
|
206
|
-
<template #label>
|
|
212
|
+
<template v-if="!hideLabel" #label>
|
|
207
213
|
<DXFieldLabel :label="resolvedLabel" :info="resolvedInfo" />
|
|
208
214
|
</template>
|
|
209
215
|
<DXRepeater
|
|
@@ -503,10 +509,14 @@ interface Props {
|
|
|
503
509
|
labelCols?: LabelCols;
|
|
504
510
|
|
|
505
511
|
/**
|
|
506
|
-
* Skip rendering the field's own label
|
|
507
|
-
*
|
|
508
|
-
*
|
|
509
|
-
*
|
|
512
|
+
* Skip rendering the field's own (outer) label. Applies to the standard
|
|
513
|
+
* labelled-field branch and to the checkbox/switch/repeater branches. In
|
|
514
|
+
* horizontal layout no label column is reserved either, so the control
|
|
515
|
+
* spans the full width (a switch/checkbox self-label then lines up with
|
|
516
|
+
* sibling row labels). Used by DXRepeater's `table` layout (a column
|
|
517
|
+
* header already names the field) and by consumers hiding the redundant
|
|
518
|
+
* row label on a switch/checkbox, which render their own label inside the
|
|
519
|
+
* control (#78).
|
|
510
520
|
*/
|
|
511
521
|
hideLabel?: boolean;
|
|
512
522
|
}
|
|
@@ -545,9 +555,17 @@ function labelColsAttrs(cols: LabelCols | undefined): Record<string, any> {
|
|
|
545
555
|
}
|
|
546
556
|
|
|
547
557
|
// Default to a 3-column label when horizontal but no width was configured,
|
|
548
|
-
// so `layout: "horizontal"` alone is enough to see the effect.
|
|
558
|
+
// so `layout: "horizontal"` alone is enough to see the effect. When the
|
|
559
|
+
// field's label is hidden, reserve no label column at all — BFormGroup would
|
|
560
|
+
// otherwise still emit an empty label column (it goes horizontal whenever any
|
|
561
|
+
// labelCols are set, regardless of whether a label exists), leaving the
|
|
562
|
+
// control indented in the input column beside dead space. Dropping the column
|
|
563
|
+
// lets the control span full width, so a switch/checkbox self-label lines up
|
|
564
|
+
// with sibling row labels (#78).
|
|
549
565
|
const horizontalAttrs = computed<Record<string, any>>(() =>
|
|
550
|
-
isHorizontal.value
|
|
566
|
+
isHorizontal.value && !props.hideLabel
|
|
567
|
+
? labelColsAttrs(props.labelCols ?? 3)
|
|
568
|
+
: {},
|
|
551
569
|
);
|
|
552
570
|
|
|
553
571
|
// A table-layout repeater is inherently wide — squeezing its own label into a
|
|
@@ -846,9 +864,12 @@ onBeforeUnmount(() => {
|
|
|
846
864
|
`justify-content: space-between` on a full-width box used to leave a wide
|
|
847
865
|
unclickable gap between the label and the toggle (only the tiny toggle
|
|
848
866
|
itself was a real click target); shrinking the box to fit its content
|
|
849
|
-
removes that dead zone entirely.
|
|
867
|
+
removes that dead zone entirely. Uses block-level `flex` (not `inline-flex`)
|
|
868
|
+
so the box stays shrink-to-fit yet still takes its own line: an inline-level
|
|
869
|
+
box let a following `<small class="form-text">` hint flow inline beside it
|
|
870
|
+
instead of dropping below the control like every other field type (#79). */
|
|
850
871
|
.dx-switch :deep(.form-check) {
|
|
851
|
-
display:
|
|
872
|
+
display: flex;
|
|
852
873
|
align-items: center;
|
|
853
874
|
gap: 0.75rem;
|
|
854
875
|
width: fit-content;
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
:model="model"
|
|
89
89
|
:layout="field.layout ?? layout"
|
|
90
90
|
:label-cols="field.labelCols ?? labelCols"
|
|
91
|
+
:hide-label="field.hideLabel"
|
|
91
92
|
>
|
|
92
93
|
<template
|
|
93
94
|
v-for="(slotName, target) in fieldSlotMap(field.key)"
|
|
@@ -151,6 +152,7 @@
|
|
|
151
152
|
:model="model"
|
|
152
153
|
:layout="field.layout ?? layout"
|
|
153
154
|
:label-cols="field.labelCols ?? labelCols"
|
|
155
|
+
:hide-label="field.hideLabel"
|
|
154
156
|
>
|
|
155
157
|
<template
|
|
156
158
|
v-for="(slotName, target) in fieldSlotMap(field.key)"
|
|
@@ -207,6 +207,17 @@ export interface FieldDefinition {
|
|
|
207
207
|
*/
|
|
208
208
|
labelCols?: LabelCols;
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Skip rendering the field's own label. In horizontal layout no label
|
|
212
|
+
* column is reserved either, so the control spans the full width. Useful
|
|
213
|
+
* for `switch` (and `checkbox`) fields, which render their own label
|
|
214
|
+
* inside the control — the outer row label would otherwise duplicate it,
|
|
215
|
+
* and the self-label then lines up with sibling row labels. Also used
|
|
216
|
+
* internally by `DXRepeater`'s `table` layout, where a column header
|
|
217
|
+
* already names the field.
|
|
218
|
+
*/
|
|
219
|
+
hideLabel?: boolean;
|
|
220
|
+
|
|
210
221
|
/**
|
|
211
222
|
* Component rendered for `type: "component"` fields. Receives
|
|
212
223
|
* `modelValue`, `field`, `model` props and emits `update:modelValue`.
|