bitboss-ui 2.1.128 → 2.1.130
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/ai/BbTable.md +389 -96
- package/dist/components/BaseButton/BaseButton.vue.d.ts +10 -5
- package/dist/components/BaseButton/RouterComponent.vue.d.ts +15 -12
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +24 -10
- package/dist/components/BaseCheckboxGroup/BaseCheckboxGroup.vue.d.ts +17 -22
- package/dist/components/BaseColorInput/BaseColorInput.vue.d.ts +205 -6
- package/dist/components/BaseColorInput/ColorPalette.vue.d.ts +10 -3
- package/dist/components/BaseDatePicker/BaseDatePicker.vue.d.ts +11 -6
- package/dist/components/BaseDatePicker/BaseDatePickerHeader.vue.d.ts +2 -3
- package/dist/components/BaseDatePicker/BaseDatePickerInputDaySelector.vue.d.ts +35 -27
- package/dist/components/BaseDatePicker/BaseDatePickerMonthSelector.vue.d.ts +2 -3
- package/dist/components/BaseDatePicker/BaseDatePickerYearSelector.vue.d.ts +4 -3
- package/dist/components/BaseDatePickerInput/BaseDatePickerInput.vue.d.ts +345 -6
- package/dist/components/BaseDialog/BaseDialog.vue.d.ts +22 -8
- package/dist/components/BaseInputContainer/BaseInputContainer.vue.d.ts +15 -6
- package/dist/components/BaseNumberInput/BaseNumberInput.vue.d.ts +15 -6
- package/dist/components/BaseRadio/BaseRadio.vue.d.ts +11 -6
- package/dist/components/BaseRadioGroup/BaseRadioGroup.vue.d.ts +17 -22
- package/dist/components/BaseRating/BaseRating.vue.d.ts +15 -6
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +15 -20
- package/dist/components/BaseSlider/BaseSlider.vue.d.ts +21 -6
- package/dist/components/BaseSwitch/BaseSwitch.vue.d.ts +15 -6
- package/dist/components/BaseSwitchGroup/BaseSwitchGroup.vue.d.ts +17 -22
- package/dist/components/BaseTag/BaseTag.vue.d.ts +353 -6
- package/dist/components/BaseTextInput/BaseTextInput.vue.d.ts +15 -6
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +15 -6
- package/dist/components/BbAccordion/BbAccordion.vue.d.ts +11 -6
- package/dist/components/BbAlert/BbAlert.vue.d.ts +10 -5
- package/dist/components/BbAvatar/BbAvatar.vue.d.ts +15 -6
- package/dist/components/BbBadge/BbBadge.vue.d.ts +10 -5
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue.d.ts +34 -7
- package/dist/components/BbButton/BbButton.vue.d.ts +11 -7
- package/dist/components/BbCheckbox/BbCheckbox.vue.d.ts +11 -6
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +17 -22
- package/dist/components/BbChip/BbChip.vue.d.ts +11 -6
- package/dist/components/BbCollapsible/BbCollapsible.vue.d.ts +10 -5
- package/dist/components/BbColorInput/BbColorInput.vue.d.ts +16 -7
- package/dist/components/BbColorPalette/BbColorPalette.vue.d.ts +77 -6
- package/dist/components/BbConfirm/BbConfirm.vue.d.ts +1 -2
- package/dist/components/BbConfirm/BbConfirmPortal.vue.d.ts +29 -14
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +11 -6
- package/dist/components/BbDialog/BbDialog.vue.d.ts +12 -8
- package/dist/components/BbDropdown/BbDropdown.vue.d.ts +232 -7
- package/dist/components/BbDropdownButton/BbDropdownButton.vue.d.ts +30 -7
- package/dist/components/BbDropzone/BbDropzone.vue.d.ts +15 -6
- package/dist/components/BbIcon/BbIcon.vue.d.ts +2 -3
- package/dist/components/BbIntersection/BbIntersection.vue.d.ts +15 -6
- package/dist/components/BbNumberInput/BbNumberInput.vue.d.ts +284 -7
- package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +22 -8
- package/dist/components/BbPagination/BbPagination.vue.d.ts +18 -8
- package/dist/components/BbPopover/BbPopover.vue.d.ts +217 -8
- package/dist/components/BbProgress/BbProgress.vue.d.ts +2 -3
- package/dist/components/BbRadio/BbRadio.vue.d.ts +11 -6
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +17 -22
- package/dist/components/BbRating/BbRating.vue.d.ts +16 -7
- package/dist/components/BbRatio/BbRatio.vue.d.ts +10 -5
- package/dist/components/BbRows/BbRows.vue.d.ts +49 -14
- package/dist/components/BbSelect/BbSelect.vue.d.ts +15 -20
- package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +15 -20
- package/dist/components/BbSlider/BbSlider.vue.d.ts +16 -7
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.d.ts +17 -6
- package/dist/components/BbSpinner/BbSpinner.vue.d.ts +2 -3
- package/dist/components/BbSwitch/BbSwitch.vue.d.ts +11 -6
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +17 -22
- package/dist/components/BbTab/BbTab.vue.d.ts +18 -15
- package/dist/components/BbTable/BbTable.vue.d.ts +83 -25
- package/dist/components/BbTable/types.d.ts +10 -4
- package/dist/components/BbTag/BbTag.vue.d.ts +11 -6
- package/dist/components/BbTextInput/BbTextInput.vue.d.ts +16 -7
- package/dist/components/BbTextarea/BbTextarea.vue.d.ts +16 -7
- package/dist/components/BbToast/BbToast.vue.d.ts +2 -3
- package/dist/components/BbToast/BbToastMessage.vue.d.ts +2 -3
- package/dist/components/BbTooltip/BbTooltip.vue.d.ts +216 -8
- package/dist/components/BbTree/BbTree.vue.d.ts +10 -5
- package/dist/components/ChipsBox/ChipsBox.vue.d.ts +1 -2
- package/dist/components/ClearableButton/ClearableButton.vue.d.ts +1 -2
- package/dist/components/CommaBox/CommaBox.vue.d.ts +1 -2
- package/dist/components/CommonInputInnerContainer/CommonInputInnerContainer.vue.d.ts +15 -6
- package/dist/components/CommonInputOuterContainer/CommonInputOuterContainer.vue.d.ts +10 -5
- package/dist/components/CommonPopover/CommonPopover.vue.d.ts +18 -8
- package/dist/components/ErrorIcon/ErrorIcon.vue.d.ts +1 -2
- package/dist/components/FlatListBox/FlatListBox.vue.d.ts +11 -16
- package/dist/components/GroupedListBox/GroupedListBox.vue.d.ts +11 -16
- package/dist/components/ListBox/ListBox.vue.d.ts +11 -16
- package/dist/components/OptionsContainer/OptionsContainer.vue.d.ts +6 -11
- package/dist/components/Transitions/ScaleFade.vue.d.ts +15 -7
- package/dist/components/Transitions/Slide.vue.d.ts +15 -7
- package/dist/composables/useTableWidthContext.d.ts +7 -0
- package/dist/index.css +1 -2
- package/dist/index.js +226 -80
- package/dist/index10.js +81 -4
- package/dist/index101.js +94 -300
- package/dist/index103.js +136 -16
- package/dist/index105.js +102 -4
- package/dist/index107.js +24 -9
- package/dist/index109.js +142 -19
- package/dist/index11.js +39 -41
- package/dist/index110.js +532 -12
- package/dist/index112.js +190 -24
- package/dist/index114.js +116 -7
- package/dist/index116.js +58 -5
- package/dist/index118.js +40 -5
- package/dist/index12.js +41 -10
- package/dist/index120.js +100 -5
- package/dist/index122.js +137 -5
- package/dist/index124.js +368 -51
- package/dist/index126.js +819 -222
- package/dist/index128.js +124 -6
- package/dist/index13.js +185 -92
- package/dist/index130.js +118 -25
- package/dist/index132.js +126 -5
- package/dist/index134.js +28 -0
- package/dist/index136.js +155 -13
- package/dist/index138.js +122 -0
- package/dist/index14.js +128 -306
- package/dist/index140.js +32 -224
- package/dist/index141.js +29 -5
- package/dist/index142.js +71 -4
- package/dist/index144.js +14 -0
- package/dist/index146.js +12 -7
- package/dist/index147.js +4 -182
- package/dist/index148.js +421 -0
- package/dist/index149.js +11 -6
- package/dist/index150.js +10 -5
- package/dist/index151.js +27 -4
- package/dist/index152.js +4 -95
- package/dist/index153.js +7 -0
- package/dist/index154.js +8 -6
- package/dist/index155.js +7 -168
- package/dist/index156.js +5 -0
- package/dist/index157.js +5 -6
- package/dist/index158.js +5 -145
- package/dist/index159.js +5 -0
- package/dist/index16.js +152 -58
- package/dist/index160.js +5 -6
- package/dist/index161.js +5 -53
- package/dist/index162.js +5 -0
- package/dist/index163.js +5 -6
- package/dist/index164.js +4 -15
- package/dist/index165.js +4 -18
- package/dist/index166.js +5 -35
- package/dist/index167.js +5 -0
- package/dist/index168.js +5 -6
- package/dist/index169.js +5 -89
- package/dist/index170.js +5 -0
- package/dist/index171.js +5 -6
- package/dist/index172.js +5 -82
- package/dist/index173.js +5 -0
- package/dist/index174.js +5 -6
- package/dist/index175.js +4 -37
- package/dist/index176.js +4 -460
- package/dist/index177.js +5 -28
- package/dist/index178.js +5 -66
- package/dist/index179.js +5 -17
- package/dist/index18.js +138 -34
- package/dist/index180.js +5 -162
- package/dist/index181.js +5 -5
- package/dist/index182.js +5 -217
- package/dist/index183.js +5 -5
- package/dist/index184.js +5 -112
- package/dist/index185.js +5 -5
- package/dist/index186.js +4 -459
- package/dist/index187.js +5 -0
- package/dist/index188.js +4 -6
- package/dist/index189.js +5 -4
- package/dist/index190.js +4 -7
- package/dist/index191.js +5 -7
- package/dist/index192.js +5 -268
- package/dist/index193.js +5 -0
- package/dist/index194.js +5 -6
- package/dist/index195.js +4 -124
- package/dist/index196.js +5 -0
- package/dist/index197.js +5 -6
- package/dist/index198.js +5 -174
- package/dist/index199.js +5 -0
- package/dist/index20.js +195 -8
- package/dist/index200.js +4 -5
- package/dist/index201.js +5 -224
- package/dist/index202.js +5 -0
- package/dist/index203.js +4 -5
- package/dist/index204.js +5 -135
- package/dist/index205.js +4 -0
- package/dist/index206.js +4 -5
- package/dist/index207.js +5 -5
- package/dist/index208.js +5 -170
- package/dist/index209.js +5 -0
- package/dist/index210.js +4 -5
- package/dist/index211.js +5 -37
- package/dist/index212.js +5 -0
- package/dist/index213.js +4 -5
- package/dist/index214.js +5 -63
- package/dist/index215.js +5 -0
- package/dist/index216.js +4 -5
- package/dist/index217.js +5 -74
- package/dist/index218.js +5 -0
- package/dist/index219.js +4 -5
- package/dist/index22.js +245 -6
- package/dist/index220.js +5 -65
- package/dist/index221.js +46 -0
- package/dist/index222.js +4 -5
- package/dist/index223.js +5 -67
- package/dist/index224.js +140 -0
- package/dist/index225.js +4 -6
- package/dist/index226.js +4 -41
- package/dist/index227.js +7 -0
- package/dist/index228.js +10 -6
- package/dist/index229.js +34 -9
- package/dist/index230.js +30 -22
- package/dist/index232.js +4 -286
- package/dist/index233.js +4 -0
- package/dist/index234.js +4 -6
- package/dist/index235.js +15 -47
- package/dist/index236.js +87 -164
- package/dist/index238.js +32 -6
- package/dist/index239.js +19 -10
- package/dist/index24.js +616 -9
- package/dist/index240.js +19 -159
- package/dist/index241.js +53 -0
- package/dist/index242.js +20 -6
- package/dist/index243.js +5 -134
- package/dist/index244.js +14 -0
- package/dist/index245.js +7 -6
- package/dist/index246.js +7 -167
- package/dist/index247.js +7 -0
- package/dist/index248.js +7 -6
- package/dist/index249.js +7 -147
- package/dist/index250.js +7 -0
- package/dist/index251.js +5 -6
- package/dist/index252.js +9 -34
- package/dist/index253.js +162 -0
- package/dist/index255.js +7 -65
- package/dist/index256.js +4 -0
- package/dist/index257.js +8 -6
- package/dist/index258.js +269 -18
- package/dist/index259.js +54 -5
- package/dist/index26.js +184 -4
- package/dist/index260.js +53 -159
- package/dist/index261.js +34 -0
- package/dist/index262.js +62 -6
- package/dist/index263.js +6 -60
- package/dist/index264.js +375 -0
- package/dist/index266.js +6 -134
- package/dist/index267.js +9 -0
- package/dist/index268.js +4 -6
- package/dist/index269.js +15 -12
- package/dist/index270.js +15 -206
- package/dist/index271.js +11 -0
- package/dist/index272.js +25 -6
- package/dist/index273.js +25 -85
- package/dist/index274.js +5 -5
- package/dist/index275.js +13 -55
- package/dist/index276.js +36 -5
- package/dist/index277.js +5 -164
- package/dist/index278.js +27 -0
- package/dist/index279.js +6 -6
- package/dist/index28.js +148 -8
- package/dist/index280.js +22 -145
- package/dist/index281.js +11 -0
- package/dist/index282.js +46 -6
- package/dist/index283.js +55 -11
- package/dist/index284.js +20 -200
- package/dist/index285.js +14 -0
- package/dist/index286.js +108 -6
- package/dist/index288.js +102 -0
- package/dist/index290.js +108 -20
- package/dist/index291.js +11 -0
- package/dist/index292.js +8 -6
- package/dist/index293.js +18 -125
- package/dist/index294.js +7 -0
- package/dist/index295.js +190 -6
- package/dist/index296.js +5 -161
- package/dist/index297.js +23 -0
- package/dist/index298.js +8 -6
- package/dist/index299.js +68 -126
- package/dist/index30.js +177 -117
- package/dist/index300.js +5 -0
- package/dist/index301.js +12 -6
- package/dist/index302.js +5 -20
- package/dist/index303.js +4 -0
- package/dist/index304.js +9 -6
- package/dist/index305.js +9 -116
- package/dist/index306.js +5 -5
- package/dist/index307.js +18 -506
- package/dist/index308.js +30 -0
- package/dist/index309.js +7 -6
- package/dist/index310.js +9 -196
- package/dist/index311.js +4 -0
- package/dist/index312.js +6 -6
- package/dist/index314.js +9 -0
- package/dist/index315.js +4 -5
- package/dist/index316.js +5 -134
- package/dist/index317.js +5 -0
- package/dist/index318.js +282 -6
- package/dist/index319.js +4 -162
- package/dist/index32.js +99 -27
- package/dist/index320.js +18 -0
- package/dist/index321.js +4 -6
- package/dist/index322.js +18 -319
- package/dist/index323.js +4 -0
- package/dist/index324.js +29 -6
- package/dist/index325.js +4 -36
- package/dist/index326.js +3 -42
- package/dist/index327.js +4 -632
- package/dist/index328.js +4 -0
- package/dist/index329.js +4 -6
- package/dist/index330.js +4 -155
- package/dist/index331.js +127 -0
- package/dist/index332.js +4 -6
- package/dist/index333.js +17 -142
- package/dist/index334.js +4 -0
- package/dist/index335.js +21 -6
- package/dist/index336.js +4 -155
- package/dist/index337.js +5 -0
- package/dist/index338.js +4 -5
- package/dist/index339.js +4 -58
- package/dist/index34.js +176 -111
- package/dist/index340.js +6 -5
- package/dist/index341.js +721 -20
- package/dist/index342.js +368 -0
- package/dist/index343.js +59 -6
- package/dist/index344.js +8 -142
- package/dist/index345.js +4 -0
- package/dist/index346.js +69 -6
- package/dist/index347.js +69 -4
- package/dist/index348.js +95 -109
- package/dist/index349.js +7 -0
- package/dist/index350.js +9 -6
- package/dist/index351.js +20 -54
- package/dist/index352.js +11 -24
- package/dist/index353.js +17 -23
- package/dist/index354.js +6 -838
- package/dist/index355.js +8 -473
- package/dist/index356.js +36 -51
- package/dist/index357.js +132 -7
- package/dist/index358.js +401 -0
- package/dist/index359.js +202 -0
- package/dist/index36.js +133 -6
- package/dist/index360.js +261 -0
- package/dist/index361.js +24 -0
- package/dist/index363.js +136 -0
- package/dist/index364.js +4 -0
- package/dist/index365.js +4 -0
- package/dist/index366.js +230 -0
- package/dist/index367.js +484 -0
- package/dist/index368.js +130 -0
- package/dist/index369.js +49 -0
- package/dist/index370.js +72 -0
- package/dist/index371.js +522 -0
- package/dist/index372.js +52 -0
- package/dist/index38.js +491 -62
- package/dist/index4.js +35 -0
- package/dist/index40.js +334 -8
- package/dist/index42.js +127 -8
- package/dist/index44.js +184 -20
- package/dist/index46.js +239 -384
- package/dist/index48.js +140 -6
- package/dist/index5.js +41 -34
- package/dist/index50.js +156 -11
- package/dist/index52.js +64 -105
- package/dist/index54.js +91 -97
- package/dist/index56.js +68 -27
- package/dist/index58.js +53 -156
- package/dist/index6.js +61 -37
- package/dist/index60.js +225 -5
- package/dist/index62.js +168 -5
- package/dist/index64.js +99 -7
- package/dist/index66.js +137 -25
- package/dist/index68.js +43 -6
- package/dist/index7.js +64 -58
- package/dist/index70.js +46 -0
- package/dist/index72.js +120 -13
- package/dist/index74.js +125 -6
- package/dist/index75.js +84 -158
- package/dist/index77.js +21 -6
- package/dist/index78.js +129 -4
- package/dist/index8.js +14 -4
- package/dist/index80.js +62 -54
- package/dist/index82.js +324 -5
- package/dist/index84.js +154 -0
- package/dist/index86.js +220 -64
- package/dist/index88.js +84 -6
- package/dist/index9.js +9 -10
- package/dist/index90.js +45 -18
- package/dist/index91.js +134 -17
- package/dist/index93.js +176 -33
- package/dist/index95.js +234 -15
- package/dist/index97.js +249 -17
- package/dist/index99.js +33 -0
- package/package.json +2 -2
- package/dist/index100.js +0 -6
- package/dist/index102.js +0 -16
- package/dist/index104.js +0 -27
- package/dist/index106.js +0 -7
- package/dist/index108.js +0 -4
- package/dist/index111.js +0 -19
- package/dist/index115.js +0 -241
- package/dist/index117.js +0 -42
- package/dist/index119.js +0 -53
- package/dist/index121.js +0 -32
- package/dist/index123.js +0 -8
- package/dist/index125.js +0 -5
- package/dist/index129.js +0 -162
- package/dist/index131.js +0 -51
- package/dist/index133.js +0 -607
- package/dist/index135.js +0 -6
- package/dist/index137.js +0 -153
- package/dist/index139.js +0 -6
- package/dist/index143.js +0 -128
- package/dist/index145.js +0 -6
- package/dist/index15.js +0 -10
- package/dist/index17.js +0 -11
- package/dist/index19.js +0 -4
- package/dist/index2.js +0 -20
- package/dist/index21.js +0 -35
- package/dist/index23.js +0 -7
- package/dist/index231.js +0 -24
- package/dist/index25.js +0 -24
- package/dist/index254.js +0 -6
- package/dist/index265.js +0 -6
- package/dist/index27.js +0 -4
- package/dist/index287.js +0 -241
- package/dist/index289.js +0 -6
- package/dist/index29.js +0 -7
- package/dist/index31.js +0 -10
- package/dist/index313.js +0 -142
- package/dist/index33.js +0 -5
- package/dist/index37.js +0 -6
- package/dist/index39.js +0 -63
- package/dist/index41.js +0 -9
- package/dist/index43.js +0 -179
- package/dist/index45.js +0 -6
- package/dist/index49.js +0 -33
- package/dist/index51.js +0 -8
- package/dist/index53.js +0 -330
- package/dist/index55.js +0 -328
- package/dist/index57.js +0 -102
- package/dist/index61.js +0 -131
- package/dist/index65.js +0 -35
- package/dist/index69.js +0 -54
- package/dist/index71.js +0 -6
- package/dist/index79.js +0 -4
- package/dist/index81.js +0 -5
- package/dist/index83.js +0 -141
- package/dist/index85.js +0 -6
- package/dist/index89.js +0 -30
- package/dist/index92.js +0 -9
- package/dist/index94.js +0 -4
- package/dist/index96.js +0 -10
- package/dist/index98.js +0 -189
package/dist/ai/BbTable.md
CHANGED
|
@@ -31,7 +31,11 @@
|
|
|
31
31
|
<col
|
|
32
32
|
v-for="track in columnTracks"
|
|
33
33
|
:key="track.key"
|
|
34
|
-
:style="{
|
|
34
|
+
:style="{
|
|
35
|
+
width: track.width,
|
|
36
|
+
minWidth: track.locked ? track.width : undefined,
|
|
37
|
+
maxWidth: track.locked ? track.width : undefined,
|
|
38
|
+
}"
|
|
35
39
|
/>
|
|
36
40
|
</colgroup>
|
|
37
41
|
<thead>
|
|
@@ -84,11 +88,18 @@
|
|
|
84
88
|
</slot>
|
|
85
89
|
</th>
|
|
86
90
|
<th
|
|
87
|
-
v-for="header in mappedHeaders"
|
|
91
|
+
v-for="(header, index) in mappedHeaders"
|
|
88
92
|
:key="header.key"
|
|
89
93
|
:aria-sort="header.sortDirection"
|
|
90
94
|
class="bb-table-header"
|
|
91
|
-
:class="
|
|
95
|
+
:class="[
|
|
96
|
+
header.classes,
|
|
97
|
+
{
|
|
98
|
+
'bb-table-header--edge-start': index === 0,
|
|
99
|
+
'bb-table-header--edge-end':
|
|
100
|
+
index === mappedHeaders.length - 1,
|
|
101
|
+
},
|
|
102
|
+
]"
|
|
92
103
|
scope="col"
|
|
93
104
|
>
|
|
94
105
|
<!-- @vue-ignore -->
|
|
@@ -307,10 +318,17 @@
|
|
|
307
318
|
</slot>
|
|
308
319
|
</td>
|
|
309
320
|
<td
|
|
310
|
-
v-for="col in item.cols"
|
|
321
|
+
v-for="(col, colIndex) in item.cols"
|
|
311
322
|
:key="col.key"
|
|
312
323
|
class="bb-table-data__cell"
|
|
313
|
-
:class="
|
|
324
|
+
:class="[
|
|
325
|
+
col.classes,
|
|
326
|
+
{
|
|
327
|
+
'bb-table-data__cell--edge-start': colIndex === 0,
|
|
328
|
+
'bb-table-data__cell--edge-end':
|
|
329
|
+
colIndex === item.cols.length - 1,
|
|
330
|
+
},
|
|
331
|
+
]"
|
|
314
332
|
>
|
|
315
333
|
<!-- @vue-ignore -->
|
|
316
334
|
<slot
|
|
@@ -509,6 +527,10 @@ const {
|
|
|
509
527
|
} = useTableWidthContext({
|
|
510
528
|
id: () => props.id,
|
|
511
529
|
container: () => containerRef.value,
|
|
530
|
+
inheritFrom: () =>
|
|
531
|
+
typeof props.inheritColumnWidths === 'string'
|
|
532
|
+
? props.inheritColumnWidths
|
|
533
|
+
: undefined,
|
|
512
534
|
});
|
|
513
535
|
|
|
514
536
|
const inheritColumnWidths = computed(() => props.inheritColumnWidths !== false);
|
|
@@ -533,10 +555,13 @@ const fixedLayout = computed(
|
|
|
533
555
|
* parent. Tables with the same column count already sum to the full width, so
|
|
534
556
|
* this is a no-op for them and only narrows tables with fewer columns.
|
|
535
557
|
*/
|
|
536
|
-
|
|
558
|
+
/** True for a nested table that inherits its column widths from a parent. */
|
|
559
|
+
const isInheriting = computed(
|
|
537
560
|
() => inheritColumnWidths.value && !!parentId.value
|
|
538
561
|
);
|
|
539
562
|
|
|
563
|
+
const sizeToColumns = isInheriting;
|
|
564
|
+
|
|
540
565
|
/** Numbers and bare numeric strings (e.g. `400`, `'400'`) default to px; values
|
|
541
566
|
* that already carry a unit/keyword (`'50%'`, `'10rem'`, `'auto'`) pass through. */
|
|
542
567
|
const toLength = (width: number | string) => {
|
|
@@ -545,6 +570,29 @@ const toLength = (width: number | string) => {
|
|
|
545
570
|
return /^-?\d*\.?\d+$/.test(trimmed) ? `${trimmed}px` : trimmed;
|
|
546
571
|
};
|
|
547
572
|
|
|
573
|
+
/**
|
|
574
|
+
* Resolves a CSS length to px in the context of `host`.
|
|
575
|
+
* Returns `null` when the value cannot be resolved reliably.
|
|
576
|
+
*/
|
|
577
|
+
const resolveLengthToPx = (
|
|
578
|
+
width: number | string,
|
|
579
|
+
host: HTMLElement
|
|
580
|
+
): number | null => {
|
|
581
|
+
const length = toLength(width);
|
|
582
|
+
if (/^-?\d*\.?\d+px$/.test(length)) return parseFloat(length);
|
|
583
|
+
|
|
584
|
+
const probe = document.createElement('div');
|
|
585
|
+
probe.style.position = 'absolute';
|
|
586
|
+
probe.style.visibility = 'hidden';
|
|
587
|
+
probe.style.pointerEvents = 'none';
|
|
588
|
+
probe.style.width = length;
|
|
589
|
+
host.appendChild(probe);
|
|
590
|
+
const px = probe.getBoundingClientRect().width;
|
|
591
|
+
host.removeChild(probe);
|
|
592
|
+
|
|
593
|
+
return Number.isFinite(px) && px > 0 ? px : null;
|
|
594
|
+
};
|
|
595
|
+
|
|
548
596
|
/** Number of data columns the parent renders (numeric track keys). */
|
|
549
597
|
const parentDataColumns = computed(() => {
|
|
550
598
|
const tracks = parentNode.value?.tracks;
|
|
@@ -637,25 +685,95 @@ const columnIntervals = computed(() => {
|
|
|
637
685
|
});
|
|
638
686
|
});
|
|
639
687
|
|
|
688
|
+
/**
|
|
689
|
+
* A column whose interval begins at or beyond the parent's last data cell has no
|
|
690
|
+
* matching parent column to inherit from — the table has more columns than its
|
|
691
|
+
* parent. Such columns are sized to their own measured content and scroll within
|
|
692
|
+
* the expand row instead of inheriting a track.
|
|
693
|
+
*/
|
|
694
|
+
const isOverflowColumn = (interval: { start: number }) =>
|
|
695
|
+
isInheriting.value && interval.start >= dataEndCell.value;
|
|
696
|
+
|
|
697
|
+
/** True when any column overflows the parent (more columns than the parent). */
|
|
698
|
+
const overflowsParent = computed(() =>
|
|
699
|
+
columnIntervals.value.some(isOverflowColumn)
|
|
700
|
+
);
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* A "flex" column shares a root table's leftover space (min-content floor)
|
|
704
|
+
* proportionally via the probe. Only root tables flex this way; an inheriting
|
|
705
|
+
* table instead snaps its in-range columns to the parent, content-sizes its
|
|
706
|
+
* overflow columns, and lets a single fill column take up any slack.
|
|
707
|
+
*/
|
|
708
|
+
const isFlexColumn = (index: number) =>
|
|
709
|
+
props.columns[index]?.width == null && !isInheriting.value;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* The last column of an inheriting table whose width is left undefined — neither
|
|
713
|
+
* a `width` nor a `snap` (a `snap` *is* a width definition: the track range it
|
|
714
|
+
* spans). That column absorbs the leftover space so the table fills its parent
|
|
715
|
+
* when a frozen/snapped column narrower than the parent's would otherwise leave a
|
|
716
|
+
* gap. `-1` for a root table, or when every column defines its own width.
|
|
717
|
+
*/
|
|
718
|
+
const fillColumnIndex = computed(() => {
|
|
719
|
+
if (!isInheriting.value) return -1;
|
|
720
|
+
for (let i = props.columns.length - 1; i >= 0; i--) {
|
|
721
|
+
const column = props.columns[i];
|
|
722
|
+
if (column.width == null && column.snap == null) return i;
|
|
723
|
+
}
|
|
724
|
+
return -1;
|
|
725
|
+
});
|
|
726
|
+
|
|
640
727
|
// Parent columns left of the first column (e.g. a select this table doesn't
|
|
641
728
|
// render, or columns skipped by the first snap) and those right of the last are
|
|
642
729
|
// folded into the edge columns as the structural offset, keeping the table
|
|
643
730
|
// aligned to the parent. `offsetStartValue` becomes the first column's padding.
|
|
644
731
|
const offsetStartValue = computed(() => {
|
|
645
732
|
const first = columnIntervals.value[0];
|
|
646
|
-
|
|
647
|
-
//
|
|
648
|
-
|
|
649
|
-
|
|
733
|
+
// No parent to align to (a root table) means no offset at all — without this
|
|
734
|
+
// the structural reclaim below would still fold a negative `-ownSelect` in.
|
|
735
|
+
if (!inheritColumnWidths.value || !parentId.value || !first) return null;
|
|
736
|
+
// The fill runs from the parent's left edge to this table's first data
|
|
737
|
+
// column — the parent's select cell, if any, plus any skipped data columns.
|
|
738
|
+
const head = gridRangeWidth(0, first.start);
|
|
739
|
+
// This table's own select column sits flush at the left edge and takes its
|
|
740
|
+
// measured width, so reclaim it from the fill (mirror of the actions side):
|
|
741
|
+
// the first data column then lines the *next* column up flush with the
|
|
742
|
+
// parent. When the parent has a select cell it is part of `head`, so only the
|
|
743
|
+
// surplus over it is reclaimed; when the parent has none the whole select
|
|
744
|
+
// width comes out of the first column, which shrinks to make room for it.
|
|
745
|
+
const ownSelect = props.selectable ? structuralFit.select : null;
|
|
746
|
+
if (!ownSelect) return head;
|
|
747
|
+
return `calc(${head ?? '0px'} - ${ownSelect})`;
|
|
650
748
|
});
|
|
651
749
|
const offsetEndValue = computed(() => {
|
|
652
750
|
const intervals = columnIntervals.value;
|
|
653
751
|
const last = intervals[intervals.length - 1];
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
752
|
+
// No parent to align to (a root table) means no offset at all — without this
|
|
753
|
+
// the structural reclaim below would still fold a negative `-ownActions` in.
|
|
754
|
+
if (!inheritColumnWidths.value || !parentId.value || !last) return null;
|
|
755
|
+
// With more columns than the parent, the table runs past the parent's right
|
|
756
|
+
// edge: there is no trailing parent region to fold, and the last column is a
|
|
757
|
+
// content-sized overflow column, so there is no end fill.
|
|
758
|
+
if (overflowsParent.value) return null;
|
|
759
|
+
// When the last column is the (auto) fill column it already absorbs the whole
|
|
760
|
+
// trailing region via fixed layout, so folding the offset in too would double
|
|
761
|
+
// it — and skew its right-aligned content inward.
|
|
762
|
+
if (fillColumnIndex.value === props.columns.length - 1) return null;
|
|
763
|
+
// The fill runs from the last data column's end all the way to the parent's
|
|
764
|
+
// right edge — any unmapped data columns plus the parent's actions cell, if
|
|
765
|
+
// it has one.
|
|
766
|
+
const tail = gridRangeWidth(last.end, tableEndCell.value);
|
|
767
|
+
// This table's own actions column sits flush against that right edge and
|
|
768
|
+
// takes its measured content width, so reclaim it from the fill: the table
|
|
769
|
+
// then ends exactly at the parent's edge instead of overflowing by the
|
|
770
|
+
// actions width. When the parent has an actions cell it is part of `tail`, so
|
|
771
|
+
// only the surplus over it is effectively reclaimed; when the parent has none
|
|
772
|
+
// the whole actions width comes out of the data fill. The result may be
|
|
773
|
+
// negative — the last data column then shrinks to make room for the actions.
|
|
774
|
+
const ownActions = props.actions ? structuralFit.actions : null;
|
|
775
|
+
if (!ownActions) return tail;
|
|
776
|
+
return `calc(${tail ?? '0px'} - ${ownActions})`;
|
|
659
777
|
});
|
|
660
778
|
const offsetStartActive = computed(() => offsetStartValue.value !== null);
|
|
661
779
|
const offsetEndActive = computed(() => offsetEndValue.value !== null);
|
|
@@ -685,28 +803,43 @@ const columnTracks = computed(() => {
|
|
|
685
803
|
fixedLayout.value && structuralFit[key]
|
|
686
804
|
? (structuralFit[key] as string)
|
|
687
805
|
: sync(key);
|
|
688
|
-
const tracks: { key: string; width: string }[] = [];
|
|
806
|
+
const tracks: { key: string; width: string; locked?: boolean }[] = [];
|
|
689
807
|
|
|
690
808
|
if (props.selectable) {
|
|
691
|
-
tracks.push({ key: 'select', width: structural('select') });
|
|
809
|
+
tracks.push({ key: 'select', width: structural('select'), locked: false });
|
|
692
810
|
}
|
|
693
811
|
|
|
694
812
|
const lastIndex = props.columns.length - 1;
|
|
695
813
|
props.columns.forEach((column, index) => {
|
|
696
814
|
const key = String(index);
|
|
697
815
|
const frozen = column.width != null ? toLength(column.width) : null;
|
|
698
|
-
// For auto columns in fixed layout, use the proportional width derived
|
|
699
|
-
// from the offscreen probe so each column is pinned to a precise value
|
|
700
|
-
// rather than relying on equal-share distribution (which ignores natural
|
|
701
|
-
// content widths and can under-allocate to wider auto columns).
|
|
702
|
-
const probeWidth =
|
|
703
|
-
frozen == null && fixedLayout.value
|
|
704
|
-
? (probeColWidths.value[index] ?? null)
|
|
705
|
-
: null;
|
|
706
|
-
// The column's own width is the gridline range it spans of the parent.
|
|
707
816
|
const interval = columnIntervals.value[index];
|
|
708
|
-
|
|
709
|
-
|
|
817
|
+
|
|
818
|
+
// The fill column is left `auto` so fixed layout (the inheriting table has
|
|
819
|
+
// a definite `width: 100%`) hands it the leftover space — its own inherited
|
|
820
|
+
// track plus the folded edge region plus any deficit. Skipped when the
|
|
821
|
+
// table overflows: there is no leftover then, and it must content-size.
|
|
822
|
+
if (index === fillColumnIndex.value && !overflowsParent.value) {
|
|
823
|
+
tracks.push({ key, width: 'auto', locked: false });
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
let span: string | null;
|
|
828
|
+
if (frozen != null) {
|
|
829
|
+
span = frozen;
|
|
830
|
+
} else if (isFlexColumn(index)) {
|
|
831
|
+
// Root table auto column: a precise share of the leftover space from the
|
|
832
|
+
// proportional probe rather than fixed layout's equal split. `auto` is
|
|
833
|
+
// the fallback before the probe runs.
|
|
834
|
+
span = (fixedLayout.value && probeColWidths.value[index]) || null;
|
|
835
|
+
} else if (isOverflowColumn(interval)) {
|
|
836
|
+
// Inheriting table, past the parent's last column: no track to snap to,
|
|
837
|
+
// so size to its own content and let the table overflow (and scroll).
|
|
838
|
+
span = columnMinWidths.value[index] ?? null;
|
|
839
|
+
} else {
|
|
840
|
+
// In range: snap to the parent's matching column.
|
|
841
|
+
span = gridRangeWidth(interval.start, interval.end);
|
|
842
|
+
}
|
|
710
843
|
|
|
711
844
|
const offsets: string[] = [];
|
|
712
845
|
if (index === 0 && offsetStartActive.value) {
|
|
@@ -722,11 +855,11 @@ const columnTracks = computed(() => {
|
|
|
722
855
|
? `calc(${[...offsets, span ?? '0px'].join(' + ')})`
|
|
723
856
|
: (span ?? 'auto');
|
|
724
857
|
|
|
725
|
-
tracks.push({ key, width });
|
|
858
|
+
tracks.push({ key, width, locked: frozen != null });
|
|
726
859
|
});
|
|
727
860
|
|
|
728
861
|
if (props.actions) {
|
|
729
|
-
tracks.push({ key: 'actions', width: structural('actions') });
|
|
862
|
+
tracks.push({ key: 'actions', width: structural('actions'), locked: false });
|
|
730
863
|
}
|
|
731
864
|
|
|
732
865
|
return tracks;
|
|
@@ -758,6 +891,10 @@ const containerStyle = computed(() => {
|
|
|
758
891
|
vars['--bb-table-natural-width'] = naturalTotalWidth.value;
|
|
759
892
|
}
|
|
760
893
|
|
|
894
|
+
if (fillValue.value > 0) {
|
|
895
|
+
vars['--bb-table-fill'] = `${fillValue.value}px`;
|
|
896
|
+
}
|
|
897
|
+
|
|
761
898
|
return vars;
|
|
762
899
|
});
|
|
763
900
|
|
|
@@ -794,10 +931,19 @@ const measureStructuralFit = () => {
|
|
|
794
931
|
const fit = (selector: string) => {
|
|
795
932
|
let max = 0;
|
|
796
933
|
table.querySelectorAll<HTMLElement>(selector).forEach((cell) => {
|
|
797
|
-
|
|
934
|
+
// Combined horizontal extent of the children, not the widest one: an
|
|
935
|
+
// actions cell holds several side-by-side controls whose total width is
|
|
936
|
+
// what the column must fit. Measured from edges so it stays correct even
|
|
937
|
+
// when the cell is narrower than its content (controls overflow on
|
|
938
|
+
// `nowrap`), which keeps the pin-to-content convergence stable.
|
|
939
|
+
let left = Infinity;
|
|
940
|
+
let right = -Infinity;
|
|
798
941
|
cell.querySelectorAll<HTMLElement>(':scope > *').forEach((child) => {
|
|
799
|
-
|
|
942
|
+
const rect = child.getBoundingClientRect();
|
|
943
|
+
left = Math.min(left, rect.left);
|
|
944
|
+
right = Math.max(right, rect.right);
|
|
800
945
|
});
|
|
946
|
+
const content = right > left ? right - left : 0;
|
|
801
947
|
const style = getComputedStyle(cell);
|
|
802
948
|
const padding =
|
|
803
949
|
parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
@@ -806,11 +952,18 @@ const measureStructuralFit = () => {
|
|
|
806
952
|
return max > 0 ? `${Math.ceil(max)}px` : null;
|
|
807
953
|
};
|
|
808
954
|
|
|
955
|
+
// Scoped to this table's own header/body rows: an unscoped descendant query
|
|
956
|
+
// would also match the structural cells of a nested table living in an expand
|
|
957
|
+
// row, letting a child's actions/select width hijack this table's column.
|
|
809
958
|
structuralFit.select = props.selectable
|
|
810
|
-
? fit(
|
|
959
|
+
? fit(
|
|
960
|
+
':scope > thead > tr > th.bb-table-header--select, :scope > tbody > tr > td.bb-table-data__cell--select'
|
|
961
|
+
)
|
|
811
962
|
: null;
|
|
812
963
|
structuralFit.actions = props.actions
|
|
813
|
-
? fit(
|
|
964
|
+
? fit(
|
|
965
|
+
':scope > thead > tr > th.bb-table-header--actions, :scope > tbody > tr > td.bb-table__cell--actions'
|
|
966
|
+
)
|
|
814
967
|
: null;
|
|
815
968
|
};
|
|
816
969
|
|
|
@@ -824,14 +977,17 @@ const measure = () => {
|
|
|
824
977
|
* data column (`null` for frozen columns — they keep their declared width).
|
|
825
978
|
*
|
|
826
979
|
* For each auto column the formula is:
|
|
827
|
-
* width = max(
|
|
980
|
+
* width = max(minimum, available × (minimum / minimumTotal))
|
|
828
981
|
*
|
|
829
|
-
* where `
|
|
830
|
-
*
|
|
982
|
+
* where `minimum` is the column's `min-content` width (what it shrinks to in a
|
|
983
|
+
* very narrow container, i.e. the floor below which content would be clipped),
|
|
984
|
+
* `available` = containerWidth − frozenColumnWidths − structuralColumnWidths
|
|
985
|
+
* and `minimumTotal` = sum of the auto columns' minimums.
|
|
831
986
|
*
|
|
832
|
-
*
|
|
833
|
-
*
|
|
834
|
-
* table-level `min-width`
|
|
987
|
+
* So when the container has room (`available ≥ minimumTotal`) the slack is shared
|
|
988
|
+
* out proportionally to each column's minimum, scaling them up together; when it
|
|
989
|
+
* does not, every column drops to its minimum and the table-level `min-width`
|
|
990
|
+
* lets it overflow (the container scrolls) rather than squashing content further.
|
|
835
991
|
*
|
|
836
992
|
* Re-measured after any DOM mutation (debounced 200 ms) and after any container
|
|
837
993
|
* resize (via a dedicated ResizeObserver on the container element).
|
|
@@ -839,19 +995,54 @@ const measure = () => {
|
|
|
839
995
|
const probeColWidths = ref<(string | null)[]>([]);
|
|
840
996
|
|
|
841
997
|
/**
|
|
842
|
-
*
|
|
843
|
-
*
|
|
844
|
-
*
|
|
845
|
-
|
|
998
|
+
* Each unfrozen column's measured `min-content` width (`null` for frozen). Used
|
|
999
|
+
* to content-size the overflow columns of an inheriting table — those past the
|
|
1000
|
+
* parent's last column, with no track to snap to.
|
|
1001
|
+
*/
|
|
1002
|
+
const columnMinWidths = ref<(string | null)[]>([]);
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Leftover px the inheriting fill column adds so the table reaches its parent's
|
|
1006
|
+
* width. Published as `--bb-table-fill`; `0` when the table already fills or
|
|
1007
|
+
* overflows. Derived self-correctingly from the live total (see the probe).
|
|
1008
|
+
*/
|
|
1009
|
+
const fillValue = ref(0);
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Total minimum width of the table (all columns at their `min-content`, plus the
|
|
1013
|
+
* structural columns). Published as `--bb-table-natural-width` and used as
|
|
1014
|
+
* `min-width` on the `<table>` so the table scrolls horizontally only once the
|
|
1015
|
+
* container is narrower than this true minimum.
|
|
846
1016
|
*/
|
|
847
1017
|
const naturalTotalWidth = ref<string | null>(null);
|
|
848
1018
|
|
|
1019
|
+
/**
|
|
1020
|
+
* Width budget for probe distribution. Prefer the immediate parent's visible
|
|
1021
|
+
* width (the scroll viewport) over this table's own offset width so a
|
|
1022
|
+
* max-content growth loop in ancestors cannot recursively inflate probe output.
|
|
1023
|
+
*/
|
|
1024
|
+
const probeViewportWidth = (container: HTMLElement): number => {
|
|
1025
|
+
const parentWidth = container.parentElement?.clientWidth ?? 0;
|
|
1026
|
+
const selfWidth = container.clientWidth || container.getBoundingClientRect().width;
|
|
1027
|
+
const fallback = container.offsetWidth;
|
|
1028
|
+
const width = parentWidth || selfWidth || fallback;
|
|
1029
|
+
return Number.isFinite(width) && width > 0 ? width : 0;
|
|
1030
|
+
};
|
|
1031
|
+
|
|
849
1032
|
const runNaturalWidthProbe = () => {
|
|
850
1033
|
const container = containerRef.value;
|
|
851
1034
|
if (!container || !fixedLayout.value) return;
|
|
852
|
-
|
|
1035
|
+
// Runs for a frozen-column table (to share space), or any inheriting table
|
|
1036
|
+
// (to content-size overflow columns and drive the fill column's slack).
|
|
1037
|
+
if (
|
|
1038
|
+
!props.columns.some((col) => col.width != null) &&
|
|
1039
|
+
!overflowsParent.value &&
|
|
1040
|
+
fillColumnIndex.value < 0
|
|
1041
|
+
)
|
|
1042
|
+
return;
|
|
853
1043
|
|
|
854
|
-
const containerWidth = container
|
|
1044
|
+
const containerWidth = probeViewportWidth(container);
|
|
1045
|
+
if (containerWidth <= 0) return;
|
|
855
1046
|
const dataOffset = props.selectable ? 1 : 0;
|
|
856
1047
|
|
|
857
1048
|
// ── Real-table measurements ────────────────────────────────────────────
|
|
@@ -863,22 +1054,30 @@ const runNaturalWidthProbe = () => {
|
|
|
863
1054
|
? parseFloat(structuralFit.actions)
|
|
864
1055
|
: 0;
|
|
865
1056
|
|
|
866
|
-
//
|
|
867
|
-
//
|
|
868
|
-
//
|
|
1057
|
+
// Live rendered widths from the fixed-layout table. Frozen columns use their
|
|
1058
|
+
// declared width (resolved to px) so an explicit width like `200` remains a
|
|
1059
|
+
// true floor in the probe math even when the live render is under pressure.
|
|
1060
|
+
// `frozenTotal` (declared widths) feeds the stable min-width floor;
|
|
1061
|
+
// `nonFlexTotal` (frozen + inherited) is what the flex columns share.
|
|
869
1062
|
const realThs = headerCells();
|
|
870
1063
|
let frozenTotal = 0;
|
|
1064
|
+
let nonFlexTotal = 0;
|
|
871
1065
|
props.columns.forEach((col, i) => {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1066
|
+
const renderedWidth =
|
|
1067
|
+
realThs[dataOffset + i]?.getBoundingClientRect().width ?? 0;
|
|
1068
|
+
const declaredFrozenWidth =
|
|
1069
|
+
col.width != null ? resolveLengthToPx(col.width, container) : null;
|
|
1070
|
+
const width = declaredFrozenWidth ?? renderedWidth;
|
|
1071
|
+
|
|
1072
|
+
if (col.width != null) frozenTotal += width;
|
|
1073
|
+
if (!isFlexColumn(i)) nonFlexTotal += width;
|
|
876
1074
|
});
|
|
877
1075
|
|
|
878
|
-
// ── Offscreen probe for
|
|
879
|
-
// The clone's inner table is forced to `width:
|
|
880
|
-
// hints are stripped so each <th> reports
|
|
881
|
-
// independent of the container size or
|
|
1076
|
+
// ── Offscreen probe for the auto columns' minimum (min-content) widths ──
|
|
1077
|
+
// The clone's inner table is forced to `width: min-content` and the auto <col>
|
|
1078
|
+
// hints are stripped so each <th> reports the narrowest width it can take
|
|
1079
|
+
// before content would be clipped, independent of the container size or
|
|
1080
|
+
// previous probe cycles.
|
|
882
1081
|
const probe = document.createElement('div');
|
|
883
1082
|
probe.style.cssText = [
|
|
884
1083
|
'position:absolute',
|
|
@@ -894,11 +1093,16 @@ const runNaturalWidthProbe = () => {
|
|
|
894
1093
|
const clone = container.cloneNode(true) as HTMLElement;
|
|
895
1094
|
clone.classList.remove('bb-table--fixed');
|
|
896
1095
|
|
|
897
|
-
//
|
|
898
|
-
//
|
|
899
|
-
//
|
|
900
|
-
|
|
901
|
-
|
|
1096
|
+
// Expand rows are full-width (colspan) and hold nested tables; under the
|
|
1097
|
+
// auto-layout probe their content would back-pressure this table's own
|
|
1098
|
+
// columns, so drop them and measure this table's columns in isolation.
|
|
1099
|
+
clone
|
|
1100
|
+
.querySelectorAll('.bb-table-expand__row')
|
|
1101
|
+
.forEach((row) => row.remove());
|
|
1102
|
+
|
|
1103
|
+
// Auto <col> hints are cleared so a previous cycle's computed width cannot
|
|
1104
|
+
// act as a minimum and inflate the measurement; frozen hints are left intact
|
|
1105
|
+
// since their declared width is a genuine floor for that column.
|
|
902
1106
|
const probeColEls = Array.from(clone.querySelectorAll<HTMLElement>('col'));
|
|
903
1107
|
props.columns.forEach((col, i) => {
|
|
904
1108
|
if (col.width == null) {
|
|
@@ -909,7 +1113,7 @@ const runNaturalWidthProbe = () => {
|
|
|
909
1113
|
|
|
910
1114
|
const innerTable = clone.querySelector<HTMLElement>('table');
|
|
911
1115
|
if (innerTable) {
|
|
912
|
-
innerTable.style.width = '
|
|
1116
|
+
innerTable.style.width = 'min-content';
|
|
913
1117
|
innerTable.style.minWidth = '0';
|
|
914
1118
|
}
|
|
915
1119
|
|
|
@@ -923,8 +1127,10 @@ const runNaturalWidthProbe = () => {
|
|
|
923
1127
|
? Array.from(headerRow.querySelectorAll<HTMLElement>(':scope > th'))
|
|
924
1128
|
: [];
|
|
925
1129
|
|
|
926
|
-
//
|
|
927
|
-
|
|
1130
|
+
// Min-content of every unfrozen column (0 for frozen). Independent of the live
|
|
1131
|
+
// table's width, so it is a stable basis for both the flex share and the
|
|
1132
|
+
// min-width floor — unlike the rendered inherited widths.
|
|
1133
|
+
const minContents = props.columns.map((col, i) => {
|
|
928
1134
|
if (col.width != null) return 0;
|
|
929
1135
|
const th = ths[dataOffset + i];
|
|
930
1136
|
return th ? th.getBoundingClientRect().width : 0;
|
|
@@ -933,24 +1139,62 @@ const runNaturalWidthProbe = () => {
|
|
|
933
1139
|
document.body.removeChild(probe);
|
|
934
1140
|
|
|
935
1141
|
// ── Proportional <col> widths ──────────────────────────────────────────
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1142
|
+
// Only the flex columns share `available`; the inherited columns are already
|
|
1143
|
+
// laid out and excluded via `nonFlexTotal`.
|
|
1144
|
+
const flexMinTotal = props.columns.reduce(
|
|
1145
|
+
(s, _, i) => s + (isFlexColumn(i) ? minContents[i] : 0),
|
|
1146
|
+
0
|
|
1147
|
+
);
|
|
1148
|
+
const available = containerWidth - nonFlexTotal - selectWidth - actionsWidth;
|
|
1149
|
+
|
|
1150
|
+
// Share the available space proportionally to each flex column's minimum, but
|
|
1151
|
+
// never drop below that minimum — when space runs out the table overflows
|
|
1152
|
+
// (and the container scrolls) instead of clipping content.
|
|
1153
|
+
//
|
|
1154
|
+
// Widths are kept sub-pixel (not rounded up): the raw shares sum to exactly
|
|
1155
|
+
// `available`, whereas ceiling each column would over-allocate by up to a
|
|
1156
|
+
// pixel apiece and, under `table-layout: fixed`, push the table a few px past
|
|
1157
|
+
// the container and trip the horizontal scrollbar. `toFixed` only trims the
|
|
1158
|
+
// float tail, well below the 1px a scrollbar needs.
|
|
1159
|
+
const px = (n: number) => `${Number(n.toFixed(3))}px`;
|
|
1160
|
+
probeColWidths.value = props.columns.map((_, i) => {
|
|
1161
|
+
if (!isFlexColumn(i)) return null;
|
|
1162
|
+
const minimum = minContents[i];
|
|
1163
|
+
if (flexMinTotal <= 0) return px(minimum);
|
|
1164
|
+
const share = available > 0 ? available * (minimum / flexMinTotal) : 0;
|
|
1165
|
+
return px(Math.max(minimum, share));
|
|
947
1166
|
});
|
|
948
1167
|
|
|
949
|
-
//
|
|
950
|
-
//
|
|
951
|
-
|
|
1168
|
+
// Min-content per unfrozen column, for content-sizing an inheriting table's
|
|
1169
|
+
// overflow columns (no parent track to snap to).
|
|
1170
|
+
columnMinWidths.value = minContents.map((w) => (w > 0 ? px(w) : null));
|
|
1171
|
+
|
|
1172
|
+
// Leftover the inheriting fill column must absorb to reach the parent's width.
|
|
1173
|
+
// `parentTotal` is the parent table's full width (the expand cell this table
|
|
1174
|
+
// sits in); the container itself shrink-wraps to the table, so it can't be the
|
|
1175
|
+
// reference. Self-correcting: the live total already includes last cycle's
|
|
1176
|
+
// fill, so adding it back recovers the intrinsic total and the result is the
|
|
1177
|
+
// same once the table fills (0 when it already fills or overflows).
|
|
1178
|
+
if (fillColumnIndex.value >= 0) {
|
|
1179
|
+
const parentTotal = Object.values(parentNode.value?.tracks ?? {}).reduce(
|
|
1180
|
+
(s, w) => s + (parseFloat(w) || 0),
|
|
1181
|
+
0
|
|
1182
|
+
);
|
|
1183
|
+
const liveTotal = realThs.reduce(
|
|
1184
|
+
(s, th) => s + th.getBoundingClientRect().width,
|
|
1185
|
+
0
|
|
1186
|
+
);
|
|
1187
|
+
fillValue.value = Math.max(0, parentTotal - liveTotal + fillValue.value);
|
|
1188
|
+
} else {
|
|
1189
|
+
fillValue.value = 0;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
// Table min-width = frozen (declared) widths + every unfrozen column's
|
|
1193
|
+
// min-content + structural. Built only from values that do not depend on the
|
|
1194
|
+
// table's own width, so it can never exceed max-content and force a stretch.
|
|
1195
|
+
const minContentTotal = minContents.reduce((s, w) => s + w, 0);
|
|
952
1196
|
const naturalTotal =
|
|
953
|
-
frozenTotal +
|
|
1197
|
+
frozenTotal + minContentTotal + selectWidth + actionsWidth;
|
|
954
1198
|
naturalTotalWidth.value =
|
|
955
1199
|
naturalTotal > 0 ? `${Math.ceil(naturalTotal)}px` : null;
|
|
956
1200
|
};
|
|
@@ -1038,6 +1282,7 @@ const containerClass = computed(() => ({
|
|
|
1038
1282
|
'bb-table--loading': loading.value,
|
|
1039
1283
|
'bb-table--empty': !options.value.length,
|
|
1040
1284
|
'bb-table--selectable': !!props.selectable,
|
|
1285
|
+
'scrollbar-border': true,
|
|
1041
1286
|
}));
|
|
1042
1287
|
|
|
1043
1288
|
const replacementContentSpan = computed(
|
|
@@ -1515,10 +1760,16 @@ export type BbTableProps<Item = any> = {
|
|
|
1515
1760
|
id?: string;
|
|
1516
1761
|
|
|
1517
1762
|
/**
|
|
1518
|
-
*
|
|
1519
|
-
*
|
|
1763
|
+
* Controls whether unfrozen columns inherit their width from an ancestor
|
|
1764
|
+
* table's matching track, accounting for `select`/`actions` columns.
|
|
1765
|
+
* - `true` (the default): inherit from the nearest ancestor table.
|
|
1766
|
+
* - `false`: do not inherit.
|
|
1767
|
+
* - a table id (string): inherit from the specific ancestor in the chain with
|
|
1768
|
+
* that id rather than the immediate parent. Use this when an intermediate
|
|
1769
|
+
* table has a different column count, so the extra columns would otherwise
|
|
1770
|
+
* misalign against it.
|
|
1520
1771
|
*/
|
|
1521
|
-
inheritColumnWidths?: boolean;
|
|
1772
|
+
inheritColumnWidths?: boolean | string;
|
|
1522
1773
|
|
|
1523
1774
|
/**
|
|
1524
1775
|
* Boolean that defines whether to display a "Select all" checkbox.
|
|
@@ -1880,9 +2131,17 @@ export type BbTableSlots<Item = any> = {
|
|
|
1880
2131
|
--bb-table-offset-internal-end: var(--bb-table-offset-end);
|
|
1881
2132
|
--bb-table-offset-external-start: 0px;
|
|
1882
2133
|
--bb-table-offset-external-end: 0px;
|
|
2134
|
+
/* Slack the fill column adds to reach the parent's width. Reset per table so a
|
|
2135
|
+
nested table never inherits an ancestor's value through the cascade. */
|
|
2136
|
+
--bb-table-fill: 0px;
|
|
1883
2137
|
border-collapse: separate;
|
|
1884
2138
|
border-spacing: 0;
|
|
1885
2139
|
display: grid;
|
|
2140
|
+
/* Override the UA `min-inline-size: min-content` that a <fieldset> container
|
|
2141
|
+
(rendered for selectable tables) carries — without this the container can't
|
|
2142
|
+
shrink below the table's content width, so it overflows its parent and
|
|
2143
|
+
pushes the page instead of scrolling inside its own `overflow-x: auto`. */
|
|
2144
|
+
min-width: 0;
|
|
1886
2145
|
overflow-x: auto;
|
|
1887
2146
|
padding-inline-end: var(--bb-table-offset-external-end);
|
|
1888
2147
|
padding-inline-start: var(--bb-table-offset-external-start);
|
|
@@ -1912,10 +2171,22 @@ export type BbTableSlots<Item = any> = {
|
|
|
1912
2171
|
width: 100%;
|
|
1913
2172
|
|
|
1914
2173
|
thead {
|
|
2174
|
+
th {
|
|
2175
|
+
box-sizing: border-box;
|
|
2176
|
+
min-width: 0;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
1915
2179
|
.bb-table-header--actions {
|
|
1916
2180
|
width: auto;
|
|
1917
2181
|
}
|
|
1918
2182
|
}
|
|
2183
|
+
|
|
2184
|
+
tbody {
|
|
2185
|
+
td {
|
|
2186
|
+
box-sizing: border-box;
|
|
2187
|
+
min-width: 0;
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
1919
2190
|
}
|
|
1920
2191
|
}
|
|
1921
2192
|
|
|
@@ -1963,9 +2234,21 @@ export type BbTableSlots<Item = any> = {
|
|
|
1963
2234
|
them out of alignment. Declared after `--fixed` and the base table rule so
|
|
1964
2235
|
it overrides their width/min-width at equal specificity. */
|
|
1965
2236
|
&--inherit-widths {
|
|
2237
|
+
/* Never grow past the parent's expand cell: a child with more columns
|
|
2238
|
+
than the parent overflows the cell, so cap the container here and let its
|
|
2239
|
+
own `overflow-x: auto` scroll the surplus columns inside the expand row
|
|
2240
|
+
rather than stretching the ancestor. */
|
|
2241
|
+
max-width: 100%;
|
|
2242
|
+
min-width: 0;
|
|
2243
|
+
|
|
1966
2244
|
table {
|
|
1967
2245
|
min-width: 0;
|
|
1968
|
-
width
|
|
2246
|
+
/* A *definite* width (not `max-content`) so `table-layout: fixed` stays
|
|
2247
|
+
content-independent: inherited columns keep their colgroup widths and
|
|
2248
|
+
align with the parent instead of growing to fit content. The fill
|
|
2249
|
+
column is `auto`, so fixed layout hands it the leftover; when columns
|
|
2250
|
+
overflow, the table grows past 100% and scrolls. */
|
|
2251
|
+
width: 100%;
|
|
1969
2252
|
}
|
|
1970
2253
|
}
|
|
1971
2254
|
|
|
@@ -2029,28 +2312,38 @@ export type BbTableSlots<Item = any> = {
|
|
|
2029
2312
|
}
|
|
2030
2313
|
|
|
2031
2314
|
td.bb-table-expand__cell {
|
|
2315
|
+
/* Collapse to the content's height instead of inheriting the data-row
|
|
2316
|
+
cell height, so an expand row with no slot content takes no space. */
|
|
2317
|
+
height: auto;
|
|
2032
2318
|
padding: 0;
|
|
2319
|
+
|
|
2320
|
+
&:empty {
|
|
2321
|
+
display: none;
|
|
2322
|
+
}
|
|
2033
2323
|
}
|
|
2034
2324
|
}
|
|
2035
2325
|
}
|
|
2036
2326
|
|
|
2037
|
-
/* Apply the structural edge offsets to the first/last
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2327
|
+
/* Apply the structural edge offsets to the first/last *data* column. They
|
|
2328
|
+
must land on the data cells, not the absolute first/last child: a select
|
|
2329
|
+
or actions column would otherwise absorb the fill and leave the data
|
|
2330
|
+
columns misaligned with the parent (and bloat the actions cell).
|
|
2331
|
+
|
|
2332
|
+
The offset is clamped at 0 here: a positive fill widens the cell and is
|
|
2333
|
+
reserved as extra edge padding, but a *negative* offset (a select/actions
|
|
2334
|
+
column reclaimed from this column's width) must not eat into the normal
|
|
2335
|
+
`--padding-x` — that only shrinks the column width, not its inner padding. */
|
|
2336
|
+
thead tr > th.bb-table-header--edge-start,
|
|
2337
|
+
tbody tr > td.bb-table-data__cell--edge-start {
|
|
2043
2338
|
padding-inline-start: calc(
|
|
2044
|
-
var(--padding-x) + var(--bb-table-offset-internal-start)
|
|
2339
|
+
var(--padding-x) + max(0px, var(--bb-table-offset-internal-start))
|
|
2045
2340
|
);
|
|
2046
2341
|
}
|
|
2047
2342
|
|
|
2048
|
-
thead tr > th
|
|
2049
|
-
tbody
|
|
2050
|
-
tr
|
|
2051
|
-
> td:last-child:not(.bb-table-expand__cell):not(.bb-table-loading__cell) {
|
|
2343
|
+
thead tr > th.bb-table-header--edge-end,
|
|
2344
|
+
tbody tr > td.bb-table-data__cell--edge-end {
|
|
2052
2345
|
padding-inline-end: calc(
|
|
2053
|
-
var(--padding-x) + var(--bb-table-offset-internal-end)
|
|
2346
|
+
var(--padding-x) + max(0px, var(--bb-table-offset-internal-end))
|
|
2054
2347
|
);
|
|
2055
2348
|
}
|
|
2056
2349
|
|