buefy 0.7.9 → 0.8.2
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/CHANGELOG.md +82 -0
- package/dist/buefy.css +13759 -8263
- package/dist/buefy.js +9073 -14866
- package/dist/buefy.min.css +1 -5
- package/dist/buefy.min.js +2 -2
- package/dist/cjs/autocomplete.js +22 -0
- package/dist/cjs/button.js +106 -0
- package/dist/cjs/checkbox.js +135 -0
- package/dist/cjs/chunk-07fe6fc0.js +247 -0
- package/dist/cjs/chunk-0af453a7.js +105 -0
- package/dist/cjs/chunk-0e89e51b.js +394 -0
- package/dist/cjs/chunk-13e039f5.js +104 -0
- package/dist/cjs/chunk-143d9e6d.js +404 -0
- package/dist/cjs/chunk-19ebd649.js +114 -0
- package/dist/cjs/chunk-1b1231ce.js +94 -0
- package/dist/cjs/chunk-1e6abfcf.js +94 -0
- package/dist/cjs/chunk-28d164b1.js +172 -0
- package/dist/cjs/chunk-3396605d.js +394 -0
- package/dist/cjs/chunk-364a37a0.js +404 -0
- package/dist/cjs/chunk-3b066933.js +103 -0
- package/dist/cjs/chunk-3dffe6e7.js +54 -0
- package/dist/cjs/chunk-4a03b064.js +199 -0
- package/dist/cjs/chunk-50b06939.js +153 -0
- package/dist/cjs/chunk-52623128.js +105 -0
- package/dist/cjs/chunk-53d4f332.js +94 -0
- package/dist/cjs/chunk-544a95da.js +404 -0
- package/dist/cjs/chunk-545f01b1.js +49 -0
- package/dist/cjs/chunk-59b91990.js +64 -0
- package/dist/cjs/chunk-5b2a3329.js +394 -0
- package/dist/cjs/chunk-60061aa8.js +172 -0
- package/dist/cjs/chunk-67658e54.js +404 -0
- package/dist/cjs/chunk-6963026a.js +86 -0
- package/dist/cjs/chunk-6cece6b7.js +140 -0
- package/dist/cjs/chunk-6d6465c1.js +140 -0
- package/dist/cjs/chunk-6e9c0aca.js +94 -0
- package/dist/cjs/chunk-77f69fca.js +106 -0
- package/dist/cjs/chunk-7a25d736.js +114 -0
- package/dist/cjs/chunk-876befa8.js +247 -0
- package/dist/cjs/chunk-8985ffff.js +105 -0
- package/dist/cjs/chunk-8a05c8c9.js +207 -0
- package/dist/cjs/chunk-90407463.js +258 -0
- package/dist/cjs/chunk-956525c9.js +106 -0
- package/dist/cjs/chunk-96ce35a2.js +114 -0
- package/dist/cjs/chunk-9da1d120.js +86 -0
- package/dist/cjs/chunk-9f6a8079.js +54 -0
- package/dist/cjs/chunk-a60dc21d.js +281 -0
- package/dist/cjs/chunk-b628277d.js +199 -0
- package/dist/cjs/chunk-c146745e.js +153 -0
- package/dist/cjs/chunk-c2aec7a9.js +547 -0
- package/dist/cjs/chunk-c9641331.js +86 -0
- package/dist/cjs/chunk-d492406b.js +172 -0
- package/dist/cjs/chunk-e0aa62a0.js +404 -0
- package/dist/cjs/chunk-e45e0329.js +48 -0
- package/dist/cjs/chunk-e5de6583.js +207 -0
- package/dist/cjs/chunk-e85cceb6.js +258 -0
- package/dist/cjs/chunk-ed5addd6.js +547 -0
- package/dist/cjs/chunk-ef4753d5.js +283 -0
- package/dist/cjs/chunk-f0c597f9.js +199 -0
- package/dist/cjs/chunk-f1df1c63.js +9 -0
- package/dist/cjs/chunk-f1ee2f5c.js +207 -0
- package/dist/cjs/chunk-fbd4d545.js +247 -0
- package/dist/cjs/clockpicker.js +447 -0
- package/dist/cjs/collapse.js +102 -0
- package/dist/cjs/datepicker.js +1281 -0
- package/dist/cjs/dialog.js +237 -0
- package/dist/cjs/dropdown.js +19 -0
- package/dist/cjs/field.js +18 -0
- package/dist/cjs/icon.js +17 -0
- package/dist/cjs/index.js +164 -0
- package/dist/cjs/input.js +20 -0
- package/dist/cjs/loading.js +166 -0
- package/dist/cjs/menu.js +231 -0
- package/dist/cjs/message.js +65 -0
- package/dist/cjs/modal.js +48 -0
- package/dist/cjs/navbar.js +258 -0
- package/dist/cjs/notification.js +142 -0
- package/dist/cjs/numberinput.js +191 -0
- package/dist/cjs/pagination.js +19 -0
- package/dist/cjs/progress.js +151 -0
- package/dist/cjs/radio.js +224 -0
- package/dist/cjs/select.js +20 -0
- package/dist/cjs/slider.js +511 -0
- package/dist/cjs/snackbar.js +114 -0
- package/dist/cjs/steps.js +352 -0
- package/dist/cjs/switch.js +144 -0
- package/dist/cjs/table.js +877 -0
- package/dist/cjs/tabs.js +258 -0
- package/dist/cjs/tag.js +63 -0
- package/dist/cjs/taginput.js +297 -0
- package/dist/cjs/timepicker.js +75 -0
- package/dist/cjs/toast.js +89 -0
- package/dist/cjs/tooltip.js +17 -0
- package/dist/cjs/upload.js +210 -0
- package/dist/components/autocomplete/index.js +1084 -2
- package/dist/components/autocomplete/index.min.js +2 -0
- package/dist/components/button/index.js +425 -2
- package/dist/components/button/index.min.js +2 -0
- package/dist/components/checkbox/index.js +342 -2
- package/dist/components/checkbox/index.min.js +2 -0
- package/dist/components/clockpicker/index.js +2340 -2
- package/dist/components/clockpicker/index.min.js +2 -0
- package/dist/components/collapse/index.js +201 -2
- package/dist/components/collapse/index.min.js +2 -0
- package/dist/components/datepicker/index.js +2720 -2
- package/dist/components/datepicker/index.min.js +2 -0
- package/dist/components/dialog/index.js +768 -2
- package/dist/components/dialog/index.min.js +2 -0
- package/dist/components/dropdown/index.js +555 -2
- package/dist/components/dropdown/index.min.js +2 -0
- package/dist/components/field/index.js +447 -2
- package/dist/components/field/index.min.js +2 -0
- package/dist/components/icon/index.js +322 -2
- package/dist/components/icon/index.min.js +2 -0
- package/dist/components/input/index.js +675 -2
- package/dist/components/input/index.min.js +2 -0
- package/dist/components/loading/index.js +282 -2
- package/dist/components/loading/index.min.js +2 -0
- package/dist/components/menu/index.js +550 -2
- package/dist/components/menu/index.min.js +2 -0
- package/dist/components/message/index.js +482 -2
- package/dist/components/message/index.min.js +2 -0
- package/dist/components/modal/index.js +400 -2
- package/dist/components/modal/index.min.js +2 -0
- package/dist/components/navbar/index.js +371 -0
- package/dist/components/navbar/index.min.js +2 -0
- package/dist/components/notification/index.js +705 -2
- package/dist/components/notification/index.min.js +2 -0
- package/dist/components/numberinput/index.js +846 -2
- package/dist/components/numberinput/index.min.js +2 -0
- package/dist/components/pagination/index.js +577 -2
- package/dist/components/pagination/index.min.js +2 -0
- package/dist/components/progress/index.js +250 -0
- package/dist/components/progress/index.min.js +2 -0
- package/dist/components/radio/index.js +323 -2
- package/dist/components/radio/index.min.js +2 -0
- package/dist/components/select/index.js +571 -2
- package/dist/components/select/index.min.js +2 -0
- package/dist/components/slider/index.js +764 -0
- package/dist/components/slider/index.min.js +2 -0
- package/dist/components/snackbar/index.js +397 -2
- package/dist/components/snackbar/index.min.js +2 -0
- package/dist/components/steps/index.js +721 -2
- package/dist/components/steps/index.min.js +2 -0
- package/dist/components/switch/index.js +243 -2
- package/dist/components/switch/index.min.js +2 -0
- package/dist/components/table/index.js +1870 -2
- package/dist/components/table/index.min.js +2 -0
- package/dist/components/tabs/index.js +627 -2
- package/dist/components/tabs/index.min.js +2 -0
- package/dist/components/tag/index.js +262 -2
- package/dist/components/tag/index.min.js +2 -0
- package/dist/components/taginput/index.js +1459 -2
- package/dist/components/taginput/index.min.js +2 -0
- package/dist/components/timepicker/index.js +2053 -2
- package/dist/components/timepicker/index.min.js +2 -0
- package/dist/components/toast/index.js +372 -2
- package/dist/components/toast/index.min.js +2 -0
- package/dist/components/tooltip/index.js +236 -2
- package/dist/components/tooltip/index.min.js +2 -0
- package/dist/components/upload/index.js +501 -2
- package/dist/components/upload/index.min.js +2 -0
- package/dist/esm/autocomplete.js +18 -0
- package/dist/esm/button.js +102 -0
- package/dist/esm/checkbox.js +131 -0
- package/dist/esm/chunk-00e3e67f.js +401 -0
- package/dist/esm/chunk-051f8b06.js +105 -0
- package/dist/esm/chunk-0566c90d.js +152 -0
- package/dist/esm/chunk-07e19446.js +545 -0
- package/dist/esm/chunk-085a700d.js +7 -0
- package/dist/esm/chunk-0ad6938a.js +53 -0
- package/dist/esm/chunk-0e3f4fb5.js +52 -0
- package/dist/esm/chunk-10c85529.js +151 -0
- package/dist/esm/chunk-121b1efa.js +197 -0
- package/dist/esm/chunk-19dad95e.js +256 -0
- package/dist/esm/chunk-231b6066.js +113 -0
- package/dist/esm/chunk-24d1a01f.js +279 -0
- package/dist/esm/chunk-297bff6b.js +393 -0
- package/dist/esm/chunk-2b2ae5c6.js +245 -0
- package/dist/esm/chunk-2cb6f867.js +46 -0
- package/dist/esm/chunk-33717194.js +392 -0
- package/dist/esm/chunk-3b811b77.js +139 -0
- package/dist/esm/chunk-3e47308f.js +104 -0
- package/dist/esm/chunk-411d6eea.js +84 -0
- package/dist/esm/chunk-4535dec5.js +92 -0
- package/dist/esm/chunk-47a5f3a1.js +103 -0
- package/dist/esm/chunk-4a5384da.js +205 -0
- package/dist/esm/chunk-4b663574.js +112 -0
- package/dist/esm/chunk-4d393f09.js +170 -0
- package/dist/esm/chunk-4d695899.js +257 -0
- package/dist/esm/chunk-4f508891.js +171 -0
- package/dist/esm/chunk-531b8274.js +281 -0
- package/dist/esm/chunk-591ee4a2.js +151 -0
- package/dist/esm/chunk-5d3bf82e.js +170 -0
- package/dist/esm/chunk-5e0b0665.js +104 -0
- package/dist/esm/chunk-648b9aa4.js +45 -0
- package/dist/esm/chunk-666940cf.js +546 -0
- package/dist/esm/chunk-67c97e13.js +246 -0
- package/dist/esm/chunk-6844653e.js +401 -0
- package/dist/esm/chunk-699b7cb4.js +245 -0
- package/dist/esm/chunk-6f881e7d.js +51 -0
- package/dist/esm/chunk-7123d158.js +256 -0
- package/dist/esm/chunk-7cf87590.js +60 -0
- package/dist/esm/chunk-823177ac.js +545 -0
- package/dist/esm/chunk-8838757a.js +401 -0
- package/dist/esm/chunk-8ca878c0.js +198 -0
- package/dist/esm/chunk-8fc2e874.js +85 -0
- package/dist/esm/chunk-912ed715.js +92 -0
- package/dist/esm/chunk-92acc21f.js +392 -0
- package/dist/esm/chunk-98e86f40.js +197 -0
- package/dist/esm/chunk-99a1f9df.js +92 -0
- package/dist/esm/chunk-9a776697.js +112 -0
- package/dist/esm/chunk-9e3207cc.js +46 -0
- package/dist/esm/chunk-9ec14e09.js +112 -0
- package/dist/esm/chunk-a5ea70d0.js +205 -0
- package/dist/esm/chunk-ac3f4847.js +138 -0
- package/dist/esm/chunk-b5376f3e.js +92 -0
- package/dist/esm/chunk-b56eb2c8.js +197 -0
- package/dist/esm/chunk-b796d1b2.js +392 -0
- package/dist/esm/chunk-b822a5db.js +205 -0
- package/dist/esm/chunk-b9bdb0e4.js +6 -0
- package/dist/esm/chunk-bfe15983.js +401 -0
- package/dist/esm/chunk-c9039f68.js +104 -0
- package/dist/esm/chunk-cc718c15.js +245 -0
- package/dist/esm/chunk-cca88db8.js +99 -0
- package/dist/esm/chunk-d6200087.js +50 -0
- package/dist/esm/chunk-daeac852.js +138 -0
- package/dist/esm/chunk-db31c548.js +103 -0
- package/dist/esm/chunk-e5568f45.js +84 -0
- package/dist/esm/chunk-e5fce48f.js +59 -0
- package/dist/esm/chunk-e84b4047.js +170 -0
- package/dist/esm/chunk-e8d90b72.js +98 -0
- package/dist/esm/chunk-e932bb68.js +206 -0
- package/dist/esm/chunk-edd8ff91.js +103 -0
- package/dist/esm/chunk-f0465d8d.js +84 -0
- package/dist/esm/chunk-f743d154.js +93 -0
- package/dist/esm/chunk-f8036b32.js +402 -0
- package/dist/esm/chunk-f984748f.js +401 -0
- package/dist/esm/chunk-fd5b0e1e.js +99 -0
- package/dist/esm/clockpicker.js +443 -0
- package/dist/esm/collapse.js +98 -0
- package/dist/esm/datepicker.js +1277 -0
- package/dist/esm/dialog.js +231 -0
- package/dist/esm/dropdown.js +14 -0
- package/dist/esm/field.js +14 -0
- package/dist/esm/icon.js +13 -0
- package/dist/esm/index.js +154 -0
- package/dist/esm/input.js +16 -0
- package/dist/esm/loading.js +159 -0
- package/dist/esm/menu.js +225 -0
- package/dist/esm/message.js +61 -0
- package/dist/esm/modal.js +42 -0
- package/dist/esm/navbar.js +253 -0
- package/dist/esm/notification.js +135 -0
- package/dist/esm/numberinput.js +187 -0
- package/dist/esm/pagination.js +15 -0
- package/dist/esm/progress.js +147 -0
- package/dist/esm/radio.js +219 -0
- package/dist/esm/select.js +16 -0
- package/dist/esm/slider.js +506 -0
- package/dist/esm/snackbar.js +108 -0
- package/dist/esm/steps.js +347 -0
- package/dist/esm/switch.js +140 -0
- package/dist/esm/table.js +872 -0
- package/dist/esm/tabs.js +253 -0
- package/dist/esm/tag.js +59 -0
- package/dist/esm/taginput.js +293 -0
- package/dist/esm/timepicker.js +71 -0
- package/dist/esm/toast.js +83 -0
- package/dist/esm/tooltip.js +13 -0
- package/dist/esm/upload.js +206 -0
- package/package.json +26 -4
- package/src/components/checkbox/Checkbox.vue +12 -4
- package/src/components/checkbox/CheckboxButton.vue +10 -2
- package/src/components/clockpicker/Clockpicker.vue +0 -5
- package/src/components/datepicker/Datepicker.spec.js +60 -0
- package/src/components/datepicker/Datepicker.vue +46 -19
- package/src/components/datepicker/DatepickerTable.spec.js +107 -2
- package/src/components/datepicker/DatepickerTable.vue +73 -4
- package/src/components/datepicker/DatepickerTableRow.spec.js +127 -17
- package/src/components/datepicker/DatepickerTableRow.vue +103 -4
- package/src/components/dialog/Dialog.vue +5 -3
- package/src/components/dialog/index.js +2 -2
- package/src/components/dropdown/Dropdown.vue +1 -4
- package/src/components/dropdown/DropdownItem.vue +7 -3
- package/src/components/field/Field.spec.js +18 -0
- package/src/components/field/Field.vue +21 -2
- package/src/components/index.js +6 -0
- package/src/components/input/Input.vue +2 -2
- package/src/components/loading/index.js +1 -1
- package/src/components/modal/index.js +1 -1
- package/src/components/navbar/NavBar.spec.js +76 -0
- package/src/components/navbar/Navbar.vue +127 -0
- package/src/components/navbar/NavbarBurger.vue +25 -0
- package/src/components/navbar/NavbarItem.vue +21 -0
- package/src/components/navbar/index.js +20 -0
- package/src/components/notification/index.js +1 -1
- package/src/components/pagination/Pagination.vue +28 -6
- package/src/components/progress/Progress.spec.js +77 -0
- package/src/components/progress/Progress.vue +108 -0
- package/src/components/progress/__snapshots__/Progress.spec.js.snap +7 -0
- package/src/components/progress/index.js +17 -0
- package/src/components/radio/Radio.spec.js +18 -1
- package/src/components/radio/Radio.vue +11 -5
- package/src/components/radio/RadioButton.spec.js +18 -1
- package/src/components/radio/RadioButton.vue +20 -8
- package/src/components/select/Select.spec.js +22 -1
- package/src/components/select/Select.vue +2 -1
- package/src/components/select/__snapshots__/Select.spec.js.snap +7 -0
- package/src/components/slider/Slider.spec.js +10 -0
- package/src/components/slider/Slider.vue +240 -0
- package/src/components/slider/SliderThumb.vue +188 -0
- package/src/components/slider/SliderTick.vue +43 -0
- package/src/components/slider/index.js +20 -0
- package/src/components/snackbar/index.js +2 -2
- package/src/components/steps/StepItem.vue +2 -3
- package/src/components/steps/Steps.vue +7 -5
- package/src/components/switch/Switch.spec.js +29 -0
- package/src/components/switch/Switch.vue +29 -5
- package/src/components/switch/__snapshots__/Switch.spec.js.snap +3 -0
- package/src/components/table/Table.vue +30 -8
- package/src/components/table/TableColumn.vue +2 -2
- package/src/components/tag/Tag.vue +4 -1
- package/src/components/taginput/Taginput.spec.js +10 -0
- package/src/components/taginput/Taginput.vue +8 -3
- package/src/components/toast/index.js +2 -2
- package/src/components/tooltip/Tooltip.vue +5 -5
- package/src/components/upload/Upload.vue +15 -8
- package/src/index.js +11 -4
- package/src/scss/buefy-build.scss +3 -3
- package/src/scss/buefy.scss +4 -0
- package/src/scss/components/_datepicker.scss +40 -1
- package/src/scss/components/_form.scss +52 -1
- package/src/scss/components/_progress.scss +45 -0
- package/src/scss/components/_radio.scss +14 -14
- package/src/scss/components/_slider.scss +138 -0
- package/src/scss/components/_steps.scss +4 -4
- package/src/scss/components/_switch.scss +54 -2
- package/src/scss/components/_taginput.scss +3 -0
- package/src/scss/components/_upload.scss +1 -3
- package/src/utils/SlotComponent.js +9 -2
- package/src/utils/TimepickerMixin.js +17 -6
- package/src/utils/config.js +4 -1
- package/src/utils/helpers.spec.js +67 -0
- package/src/utils/plugins.js +2 -1
- package/types/components.d.ts +3 -3
- package/types/index.d.ts +24 -11
- package/dist/components/index.js +0 -2
|
@@ -0,0 +1,877 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var __chunk_1 = require('./chunk-9f6a8079.js');
|
|
6
|
+
var __chunk_2 = require('./chunk-59b91990.js');
|
|
7
|
+
require('./chunk-545f01b1.js');
|
|
8
|
+
require('./chunk-c146745e.js');
|
|
9
|
+
var __chunk_5 = require('./chunk-60061aa8.js');
|
|
10
|
+
var __chunk_6 = require('./chunk-13e039f5.js');
|
|
11
|
+
var __chunk_9 = require('./chunk-96ce35a2.js');
|
|
12
|
+
var __chunk_13 = require('./chunk-1b1231ce.js');
|
|
13
|
+
var __chunk_18 = require('./chunk-876befa8.js');
|
|
14
|
+
var __chunk_20 = require('./chunk-3dffe6e7.js');
|
|
15
|
+
|
|
16
|
+
var _components;
|
|
17
|
+
var script = {
|
|
18
|
+
name: 'BTableMobileSort',
|
|
19
|
+
components: (_components = {}, __chunk_1._defineProperty(_components, __chunk_13.Select.name, __chunk_13.Select), __chunk_1._defineProperty(_components, __chunk_5.Icon.name, __chunk_5.Icon), _components),
|
|
20
|
+
props: {
|
|
21
|
+
currentSortColumn: Object,
|
|
22
|
+
isAsc: Boolean,
|
|
23
|
+
columns: Array,
|
|
24
|
+
placeholder: String
|
|
25
|
+
},
|
|
26
|
+
data: function data() {
|
|
27
|
+
return {
|
|
28
|
+
mobileSort: this.currentSortColumn
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
computed: {
|
|
32
|
+
showPlaceholder: function showPlaceholder() {
|
|
33
|
+
var _this = this;
|
|
34
|
+
|
|
35
|
+
return !this.columns || !this.columns.some(function (column) {
|
|
36
|
+
return column === _this.mobileSort;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
watch: {
|
|
41
|
+
mobileSort: function mobileSort(column) {
|
|
42
|
+
if (this.currentSortColumn === column) return;
|
|
43
|
+
this.$emit('sort', column);
|
|
44
|
+
},
|
|
45
|
+
currentSortColumn: function currentSortColumn(column) {
|
|
46
|
+
this.mobileSort = column;
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
sort: function sort() {
|
|
51
|
+
this.$emit('sort', this.mobileSort);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/* script */
|
|
57
|
+
const __vue_script__ = script;
|
|
58
|
+
|
|
59
|
+
/* template */
|
|
60
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"field table-mobile-sort"},[_c('div',{staticClass:"field has-addons"},[_c('b-select',{attrs:{"expanded":""},model:{value:(_vm.mobileSort),callback:function ($$v) {_vm.mobileSort=$$v;},expression:"mobileSort"}},[(_vm.placeholder)?[_c('option',{directives:[{name:"show",rawName:"v-show",value:(_vm.showPlaceholder),expression:"showPlaceholder"}],attrs:{"selected":"","disabled":"","hidden":""},domProps:{"value":{}}},[_vm._v("\n "+_vm._s(_vm.placeholder)+"\n ")])]:_vm._e(),_vm._v(" "),_vm._l((_vm.columns),function(column,index){return (column.sortable)?_c('option',{key:index,domProps:{"value":column}},[_vm._v("\n "+_vm._s(column.label)+"\n ")]):_vm._e()})],2),_vm._v(" "),_c('div',{staticClass:"control"},[_c('button',{staticClass:"button is-primary",on:{"click":_vm.sort}},[_c('b-icon',{directives:[{name:"show",rawName:"v-show",value:(_vm.currentSortColumn === _vm.mobileSort),expression:"currentSortColumn === mobileSort"}],class:{ 'is-desc': !_vm.isAsc },attrs:{"icon":"arrow-up","size":"is-small","both":""}})],1)])],1)])};
|
|
61
|
+
var __vue_staticRenderFns__ = [];
|
|
62
|
+
|
|
63
|
+
/* style */
|
|
64
|
+
const __vue_inject_styles__ = undefined;
|
|
65
|
+
/* scoped */
|
|
66
|
+
const __vue_scope_id__ = undefined;
|
|
67
|
+
/* module identifier */
|
|
68
|
+
const __vue_module_identifier__ = undefined;
|
|
69
|
+
/* functional template */
|
|
70
|
+
const __vue_is_functional_template__ = false;
|
|
71
|
+
/* style inject */
|
|
72
|
+
|
|
73
|
+
/* style inject SSR */
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
var TableMobileSort = __chunk_6.__vue_normalize__(
|
|
78
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
79
|
+
__vue_inject_styles__,
|
|
80
|
+
__vue_script__,
|
|
81
|
+
__vue_scope_id__,
|
|
82
|
+
__vue_is_functional_template__,
|
|
83
|
+
__vue_module_identifier__,
|
|
84
|
+
undefined,
|
|
85
|
+
undefined
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
//
|
|
89
|
+
//
|
|
90
|
+
//
|
|
91
|
+
//
|
|
92
|
+
//
|
|
93
|
+
//
|
|
94
|
+
//
|
|
95
|
+
//
|
|
96
|
+
//
|
|
97
|
+
var script$1 = {
|
|
98
|
+
name: 'BTableColumn',
|
|
99
|
+
props: {
|
|
100
|
+
label: String,
|
|
101
|
+
customKey: [String, Number],
|
|
102
|
+
field: String,
|
|
103
|
+
meta: [String, Number, Boolean, Function, Object, Array],
|
|
104
|
+
width: [Number, String],
|
|
105
|
+
numeric: Boolean,
|
|
106
|
+
centered: Boolean,
|
|
107
|
+
sortable: Boolean,
|
|
108
|
+
visible: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: true
|
|
111
|
+
},
|
|
112
|
+
customSort: Function,
|
|
113
|
+
internal: Boolean // Used internally by Table
|
|
114
|
+
|
|
115
|
+
},
|
|
116
|
+
data: function data() {
|
|
117
|
+
return {
|
|
118
|
+
newKey: this.customKey || this.label
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
computed: {
|
|
122
|
+
rootClasses: function rootClasses() {
|
|
123
|
+
return {
|
|
124
|
+
'has-text-right': this.numeric && !this.centered,
|
|
125
|
+
'has-text-centered': this.centered
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
methods: {
|
|
130
|
+
addRefToTable: function addRefToTable() {
|
|
131
|
+
var _this = this;
|
|
132
|
+
|
|
133
|
+
if (!this.$parent.$data._isTable) {
|
|
134
|
+
this.$destroy();
|
|
135
|
+
throw new Error('You should wrap bTableColumn on a bTable');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (this.internal) return; // Since we're using scoped prop the columns gonna be multiplied,
|
|
139
|
+
// this finds when to stop based on the newKey property.
|
|
140
|
+
|
|
141
|
+
var repeated = this.$parent.newColumns.some(function (column) {
|
|
142
|
+
return column.newKey === _this.newKey;
|
|
143
|
+
});
|
|
144
|
+
!repeated && this.$parent.newColumns.push(this);
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
beforeMount: function beforeMount() {
|
|
148
|
+
this.addRefToTable();
|
|
149
|
+
},
|
|
150
|
+
beforeUpdate: function beforeUpdate() {
|
|
151
|
+
this.addRefToTable();
|
|
152
|
+
},
|
|
153
|
+
beforeDestroy: function beforeDestroy() {
|
|
154
|
+
var index = this.$parent.newColumns.map(function (column) {
|
|
155
|
+
return column.newKey;
|
|
156
|
+
}).indexOf(this.newKey);
|
|
157
|
+
|
|
158
|
+
if (index >= 0) {
|
|
159
|
+
this.$parent.newColumns.splice(index, 1);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/* script */
|
|
165
|
+
const __vue_script__$1 = script$1;
|
|
166
|
+
|
|
167
|
+
/* template */
|
|
168
|
+
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.visible)?_c('td',{class:_vm.rootClasses,attrs:{"data-label":_vm.label}},[_vm._t("default")],2):_vm._e()};
|
|
169
|
+
var __vue_staticRenderFns__$1 = [];
|
|
170
|
+
|
|
171
|
+
/* style */
|
|
172
|
+
const __vue_inject_styles__$1 = undefined;
|
|
173
|
+
/* scoped */
|
|
174
|
+
const __vue_scope_id__$1 = undefined;
|
|
175
|
+
/* module identifier */
|
|
176
|
+
const __vue_module_identifier__$1 = undefined;
|
|
177
|
+
/* functional template */
|
|
178
|
+
const __vue_is_functional_template__$1 = false;
|
|
179
|
+
/* style inject */
|
|
180
|
+
|
|
181
|
+
/* style inject SSR */
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
var TableColumn = __chunk_6.__vue_normalize__(
|
|
186
|
+
{ render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
|
|
187
|
+
__vue_inject_styles__$1,
|
|
188
|
+
__vue_script__$1,
|
|
189
|
+
__vue_scope_id__$1,
|
|
190
|
+
__vue_is_functional_template__$1,
|
|
191
|
+
__vue_module_identifier__$1,
|
|
192
|
+
undefined,
|
|
193
|
+
undefined
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
var _components$1;
|
|
197
|
+
var script$2 = {
|
|
198
|
+
name: 'BTable',
|
|
199
|
+
components: (_components$1 = {}, __chunk_1._defineProperty(_components$1, __chunk_9.Checkbox.name, __chunk_9.Checkbox), __chunk_1._defineProperty(_components$1, __chunk_5.Icon.name, __chunk_5.Icon), __chunk_1._defineProperty(_components$1, __chunk_18.Pagination.name, __chunk_18.Pagination), __chunk_1._defineProperty(_components$1, __chunk_20.SlotComponent.name, __chunk_20.SlotComponent), __chunk_1._defineProperty(_components$1, TableMobileSort.name, TableMobileSort), __chunk_1._defineProperty(_components$1, TableColumn.name, TableColumn), _components$1),
|
|
200
|
+
props: {
|
|
201
|
+
data: {
|
|
202
|
+
type: Array,
|
|
203
|
+
default: function _default() {
|
|
204
|
+
return [];
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
columns: {
|
|
208
|
+
type: Array,
|
|
209
|
+
default: function _default() {
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
bordered: Boolean,
|
|
214
|
+
striped: Boolean,
|
|
215
|
+
narrowed: Boolean,
|
|
216
|
+
hoverable: Boolean,
|
|
217
|
+
loading: Boolean,
|
|
218
|
+
detailed: Boolean,
|
|
219
|
+
checkable: Boolean,
|
|
220
|
+
headerCheckable: {
|
|
221
|
+
type: Boolean,
|
|
222
|
+
default: true
|
|
223
|
+
},
|
|
224
|
+
checkboxPosition: {
|
|
225
|
+
type: String,
|
|
226
|
+
default: 'left',
|
|
227
|
+
validator: function validator(value) {
|
|
228
|
+
return ['left', 'right'].indexOf(value) >= 0;
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
selected: Object,
|
|
232
|
+
focusable: Boolean,
|
|
233
|
+
customIsChecked: Function,
|
|
234
|
+
isRowCheckable: {
|
|
235
|
+
type: Function,
|
|
236
|
+
default: function _default() {
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
checkedRows: {
|
|
241
|
+
type: Array,
|
|
242
|
+
default: function _default() {
|
|
243
|
+
return [];
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
mobileCards: {
|
|
247
|
+
type: Boolean,
|
|
248
|
+
default: true
|
|
249
|
+
},
|
|
250
|
+
defaultSort: [String, Array],
|
|
251
|
+
defaultSortDirection: {
|
|
252
|
+
type: String,
|
|
253
|
+
default: 'asc'
|
|
254
|
+
},
|
|
255
|
+
sortIcon: {
|
|
256
|
+
type: String,
|
|
257
|
+
default: 'arrow-up'
|
|
258
|
+
},
|
|
259
|
+
sortIconSize: {
|
|
260
|
+
type: String,
|
|
261
|
+
default: 'is-small'
|
|
262
|
+
},
|
|
263
|
+
paginated: Boolean,
|
|
264
|
+
currentPage: {
|
|
265
|
+
type: Number,
|
|
266
|
+
default: 1
|
|
267
|
+
},
|
|
268
|
+
perPage: {
|
|
269
|
+
type: [Number, String],
|
|
270
|
+
default: 20
|
|
271
|
+
},
|
|
272
|
+
showDetailIcon: {
|
|
273
|
+
type: Boolean,
|
|
274
|
+
default: true
|
|
275
|
+
},
|
|
276
|
+
paginationSimple: Boolean,
|
|
277
|
+
paginationSize: String,
|
|
278
|
+
paginationPosition: {
|
|
279
|
+
type: String,
|
|
280
|
+
default: 'bottom',
|
|
281
|
+
validator: function validator(value) {
|
|
282
|
+
return ['bottom', 'top', 'both'].indexOf(value) >= 0;
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
backendSorting: Boolean,
|
|
286
|
+
rowClass: {
|
|
287
|
+
type: Function,
|
|
288
|
+
default: function _default() {
|
|
289
|
+
return '';
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
openedDetailed: {
|
|
293
|
+
type: Array,
|
|
294
|
+
default: function _default() {
|
|
295
|
+
return [];
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
hasDetailedVisible: {
|
|
299
|
+
type: Function,
|
|
300
|
+
default: function _default() {
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
detailKey: {
|
|
305
|
+
type: String,
|
|
306
|
+
default: ''
|
|
307
|
+
},
|
|
308
|
+
customDetailRow: {
|
|
309
|
+
type: Boolean,
|
|
310
|
+
default: false
|
|
311
|
+
},
|
|
312
|
+
backendPagination: Boolean,
|
|
313
|
+
total: {
|
|
314
|
+
type: [Number, String],
|
|
315
|
+
default: 0
|
|
316
|
+
},
|
|
317
|
+
iconPack: String,
|
|
318
|
+
mobileSortPlaceholder: String,
|
|
319
|
+
customRowKey: String,
|
|
320
|
+
draggable: {
|
|
321
|
+
type: Boolean,
|
|
322
|
+
defualt: false
|
|
323
|
+
},
|
|
324
|
+
ariaNextLabel: String,
|
|
325
|
+
ariaPreviousLabel: String,
|
|
326
|
+
ariaPageLabel: String,
|
|
327
|
+
ariaCurrentLabel: String
|
|
328
|
+
},
|
|
329
|
+
data: function data() {
|
|
330
|
+
return {
|
|
331
|
+
getValueByPath: __chunk_2.getValueByPath,
|
|
332
|
+
newColumns: __chunk_1._toConsumableArray(this.columns),
|
|
333
|
+
visibleDetailRows: this.openedDetailed,
|
|
334
|
+
newData: this.data,
|
|
335
|
+
newDataTotal: this.backendPagination ? this.total : this.data.length,
|
|
336
|
+
newCheckedRows: __chunk_1._toConsumableArray(this.checkedRows),
|
|
337
|
+
newCurrentPage: this.currentPage,
|
|
338
|
+
currentSortColumn: {},
|
|
339
|
+
isAsc: true,
|
|
340
|
+
firstTimeSort: true,
|
|
341
|
+
// Used by first time initSort
|
|
342
|
+
_isTable: true // Used by TableColumn
|
|
343
|
+
|
|
344
|
+
};
|
|
345
|
+
},
|
|
346
|
+
computed: {
|
|
347
|
+
/**
|
|
348
|
+
* return if detailed row tabled
|
|
349
|
+
* will be with chevron column & icon or not
|
|
350
|
+
*/
|
|
351
|
+
showDetailRowIcon: function showDetailRowIcon() {
|
|
352
|
+
return this.detailed && this.showDetailIcon;
|
|
353
|
+
},
|
|
354
|
+
tableClasses: function tableClasses() {
|
|
355
|
+
return {
|
|
356
|
+
'is-bordered': this.bordered,
|
|
357
|
+
'is-striped': this.striped,
|
|
358
|
+
'is-narrow': this.narrowed,
|
|
359
|
+
'has-mobile-cards': this.mobileCards,
|
|
360
|
+
'is-hoverable': (this.hoverable || this.focusable) && this.visibleData.length
|
|
361
|
+
};
|
|
362
|
+
},
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Splitted data based on the pagination.
|
|
366
|
+
*/
|
|
367
|
+
visibleData: function visibleData() {
|
|
368
|
+
if (!this.paginated) return this.newData;
|
|
369
|
+
var currentPage = this.newCurrentPage;
|
|
370
|
+
var perPage = this.perPage;
|
|
371
|
+
|
|
372
|
+
if (this.newData.length <= perPage) {
|
|
373
|
+
return this.newData;
|
|
374
|
+
} else {
|
|
375
|
+
var start = (currentPage - 1) * perPage;
|
|
376
|
+
var end = parseInt(start, 10) + parseInt(perPage, 10);
|
|
377
|
+
return this.newData.slice(start, end);
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
visibleColumns: function visibleColumns() {
|
|
381
|
+
if (!this.newColumns) return this.newColumns;
|
|
382
|
+
return this.newColumns.filter(function (column) {
|
|
383
|
+
return column.visible || column.visible === undefined;
|
|
384
|
+
});
|
|
385
|
+
},
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Check if all rows in the page are checked.
|
|
389
|
+
*/
|
|
390
|
+
isAllChecked: function isAllChecked() {
|
|
391
|
+
var _this = this;
|
|
392
|
+
|
|
393
|
+
var validVisibleData = this.visibleData.filter(function (row) {
|
|
394
|
+
return _this.isRowCheckable(row);
|
|
395
|
+
});
|
|
396
|
+
if (validVisibleData.length === 0) return false;
|
|
397
|
+
var isAllChecked = validVisibleData.some(function (currentVisibleRow) {
|
|
398
|
+
return __chunk_2.indexOf(_this.newCheckedRows, currentVisibleRow, _this.customIsChecked) < 0;
|
|
399
|
+
});
|
|
400
|
+
return !isAllChecked;
|
|
401
|
+
},
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Check if all rows in the page are checkable.
|
|
405
|
+
*/
|
|
406
|
+
isAllUncheckable: function isAllUncheckable() {
|
|
407
|
+
var _this2 = this;
|
|
408
|
+
|
|
409
|
+
var validVisibleData = this.visibleData.filter(function (row) {
|
|
410
|
+
return _this2.isRowCheckable(row);
|
|
411
|
+
});
|
|
412
|
+
return validVisibleData.length === 0;
|
|
413
|
+
},
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Check if has any sortable column.
|
|
417
|
+
*/
|
|
418
|
+
hasSortablenewColumns: function hasSortablenewColumns() {
|
|
419
|
+
return this.newColumns.some(function (column) {
|
|
420
|
+
return column.sortable;
|
|
421
|
+
});
|
|
422
|
+
},
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Return total column count based if it's checkable or expanded
|
|
426
|
+
*/
|
|
427
|
+
columnCount: function columnCount() {
|
|
428
|
+
var count = this.newColumns.length;
|
|
429
|
+
count += this.checkable ? 1 : 0;
|
|
430
|
+
count += this.detailed ? 1 : 0;
|
|
431
|
+
return count;
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
watch: {
|
|
435
|
+
/**
|
|
436
|
+
* When data prop change:
|
|
437
|
+
* 1. Update internal value.
|
|
438
|
+
* 2. Reset newColumns (thead), in case it's on a v-for loop.
|
|
439
|
+
* 3. Sort again if it's not backend-sort.
|
|
440
|
+
* 4. Set new total if it's not backend-paginated.
|
|
441
|
+
*/
|
|
442
|
+
data: function data(value) {
|
|
443
|
+
var _this3 = this;
|
|
444
|
+
|
|
445
|
+
// Save newColumns before resetting
|
|
446
|
+
var newColumns = this.newColumns;
|
|
447
|
+
this.newColumns = [];
|
|
448
|
+
this.newData = value; // Prevent table from being headless, data could change and created hook
|
|
449
|
+
// on column might not trigger
|
|
450
|
+
|
|
451
|
+
this.$nextTick(function () {
|
|
452
|
+
if (!_this3.newColumns.length) _this3.newColumns = newColumns;
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
if (!this.backendSorting) {
|
|
456
|
+
this.sort(this.currentSortColumn, true);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (!this.backendPagination) {
|
|
460
|
+
this.newDataTotal = value.length;
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* When Pagination total change, update internal total
|
|
466
|
+
* only if it's backend-paginated.
|
|
467
|
+
*/
|
|
468
|
+
total: function total(newTotal) {
|
|
469
|
+
if (!this.backendPagination) return;
|
|
470
|
+
this.newDataTotal = newTotal;
|
|
471
|
+
},
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* When checkedRows prop change, update internal value without
|
|
475
|
+
* mutating original data.
|
|
476
|
+
*/
|
|
477
|
+
checkedRows: function checkedRows(rows) {
|
|
478
|
+
this.newCheckedRows = __chunk_1._toConsumableArray(rows);
|
|
479
|
+
},
|
|
480
|
+
columns: function columns(value) {
|
|
481
|
+
this.newColumns = __chunk_1._toConsumableArray(value);
|
|
482
|
+
},
|
|
483
|
+
newColumns: function newColumns(value) {
|
|
484
|
+
this.checkSort();
|
|
485
|
+
},
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* When the user wants to control the detailed rows via props.
|
|
489
|
+
* Or wants to open the details of certain row with the router for example.
|
|
490
|
+
*/
|
|
491
|
+
openedDetailed: function openedDetailed(expandedRows) {
|
|
492
|
+
this.visibleDetailRows = expandedRows;
|
|
493
|
+
},
|
|
494
|
+
currentPage: function currentPage(newVal) {
|
|
495
|
+
this.newCurrentPage = newVal;
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
methods: {
|
|
499
|
+
/**
|
|
500
|
+
* Sort an array by key without mutating original data.
|
|
501
|
+
* Call the user sort function if it was passed.
|
|
502
|
+
*/
|
|
503
|
+
sortBy: function sortBy(array, key, fn, isAsc) {
|
|
504
|
+
var sorted = []; // Sorting without mutating original data
|
|
505
|
+
|
|
506
|
+
if (fn && typeof fn === 'function') {
|
|
507
|
+
sorted = __chunk_1._toConsumableArray(array).sort(function (a, b) {
|
|
508
|
+
return fn(a, b, isAsc);
|
|
509
|
+
});
|
|
510
|
+
} else {
|
|
511
|
+
sorted = __chunk_1._toConsumableArray(array).sort(function (a, b) {
|
|
512
|
+
// Get nested values from objects
|
|
513
|
+
var newA = __chunk_2.getValueByPath(a, key);
|
|
514
|
+
var newB = __chunk_2.getValueByPath(b, key); // sort boolean type
|
|
515
|
+
|
|
516
|
+
if (typeof newA === 'boolean' && typeof newB === 'boolean') {
|
|
517
|
+
return isAsc ? newA - newB : newB - newA;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (!newA && newA !== 0) return 1;
|
|
521
|
+
if (!newB && newB !== 0) return -1;
|
|
522
|
+
if (newA === newB) return 0;
|
|
523
|
+
newA = typeof newA === 'string' ? newA.toUpperCase() : newA;
|
|
524
|
+
newB = typeof newB === 'string' ? newB.toUpperCase() : newB;
|
|
525
|
+
return isAsc ? newA > newB ? 1 : -1 : newA > newB ? -1 : 1;
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
return sorted;
|
|
530
|
+
},
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Sort the column.
|
|
534
|
+
* Toggle current direction on column if it's sortable
|
|
535
|
+
* and not just updating the prop.
|
|
536
|
+
*/
|
|
537
|
+
sort: function sort(column) {
|
|
538
|
+
var updatingData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
539
|
+
if (!column || !column.sortable) return;
|
|
540
|
+
|
|
541
|
+
if (!updatingData) {
|
|
542
|
+
this.isAsc = column === this.currentSortColumn ? !this.isAsc : this.defaultSortDirection.toLowerCase() !== 'desc';
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (!this.firstTimeSort) {
|
|
546
|
+
this.$emit('sort', column.field, this.isAsc ? 'asc' : 'desc');
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (!this.backendSorting) {
|
|
550
|
+
this.newData = this.sortBy(this.newData, column.field, column.customSort, this.isAsc);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
this.currentSortColumn = column;
|
|
554
|
+
},
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Check if the row is checked (is added to the array).
|
|
558
|
+
*/
|
|
559
|
+
isRowChecked: function isRowChecked(row) {
|
|
560
|
+
return __chunk_2.indexOf(this.newCheckedRows, row, this.customIsChecked) >= 0;
|
|
561
|
+
},
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Remove a checked row from the array.
|
|
565
|
+
*/
|
|
566
|
+
removeCheckedRow: function removeCheckedRow(row) {
|
|
567
|
+
var index = __chunk_2.indexOf(this.newCheckedRows, row, this.customIsChecked);
|
|
568
|
+
|
|
569
|
+
if (index >= 0) {
|
|
570
|
+
this.newCheckedRows.splice(index, 1);
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Header checkbox click listener.
|
|
576
|
+
* Add or remove all rows in current page.
|
|
577
|
+
*/
|
|
578
|
+
checkAll: function checkAll() {
|
|
579
|
+
var _this4 = this;
|
|
580
|
+
|
|
581
|
+
var isAllChecked = this.isAllChecked;
|
|
582
|
+
this.visibleData.forEach(function (currentRow) {
|
|
583
|
+
_this4.removeCheckedRow(currentRow);
|
|
584
|
+
|
|
585
|
+
if (!isAllChecked) {
|
|
586
|
+
if (_this4.isRowCheckable(currentRow)) {
|
|
587
|
+
_this4.newCheckedRows.push(currentRow);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
this.$emit('check', this.newCheckedRows);
|
|
592
|
+
this.$emit('check-all', this.newCheckedRows); // Emit checked rows to update user variable
|
|
593
|
+
|
|
594
|
+
this.$emit('update:checkedRows', this.newCheckedRows);
|
|
595
|
+
},
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Row checkbox click listener.
|
|
599
|
+
* Add or remove a single row.
|
|
600
|
+
*/
|
|
601
|
+
checkRow: function checkRow(row) {
|
|
602
|
+
if (!this.isRowChecked(row)) {
|
|
603
|
+
this.newCheckedRows.push(row);
|
|
604
|
+
} else {
|
|
605
|
+
this.removeCheckedRow(row);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
this.$emit('check', this.newCheckedRows, row); // Emit checked rows to update user variable
|
|
609
|
+
|
|
610
|
+
this.$emit('update:checkedRows', this.newCheckedRows);
|
|
611
|
+
},
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Row click listener.
|
|
615
|
+
* Emit all necessary events.
|
|
616
|
+
*/
|
|
617
|
+
selectRow: function selectRow(row, index) {
|
|
618
|
+
this.$emit('click', row);
|
|
619
|
+
if (this.selected === row) return; // Emit new and old row
|
|
620
|
+
|
|
621
|
+
this.$emit('select', row, this.selected); // Emit new row to update user variable
|
|
622
|
+
|
|
623
|
+
this.$emit('update:selected', row);
|
|
624
|
+
},
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Paginator change listener.
|
|
628
|
+
*/
|
|
629
|
+
pageChanged: function pageChanged(page) {
|
|
630
|
+
this.newCurrentPage = page > 0 ? page : 1;
|
|
631
|
+
this.$emit('page-change', this.newCurrentPage);
|
|
632
|
+
this.$emit('update:currentPage', this.newCurrentPage);
|
|
633
|
+
},
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Toggle to show/hide details slot
|
|
637
|
+
*/
|
|
638
|
+
toggleDetails: function toggleDetails(obj) {
|
|
639
|
+
var found = this.isVisibleDetailRow(obj);
|
|
640
|
+
|
|
641
|
+
if (found) {
|
|
642
|
+
this.closeDetailRow(obj);
|
|
643
|
+
this.$emit('details-close', obj);
|
|
644
|
+
} else {
|
|
645
|
+
this.openDetailRow(obj);
|
|
646
|
+
this.$emit('details-open', obj);
|
|
647
|
+
} // Syncs the detailed rows with the parent component
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
this.$emit('update:openedDetailed', this.visibleDetailRows);
|
|
651
|
+
},
|
|
652
|
+
openDetailRow: function openDetailRow(obj) {
|
|
653
|
+
var index = this.handleDetailKey(obj);
|
|
654
|
+
this.visibleDetailRows.push(index);
|
|
655
|
+
},
|
|
656
|
+
closeDetailRow: function closeDetailRow(obj) {
|
|
657
|
+
var index = this.handleDetailKey(obj);
|
|
658
|
+
var i = this.visibleDetailRows.indexOf(index);
|
|
659
|
+
this.visibleDetailRows.splice(i, 1);
|
|
660
|
+
},
|
|
661
|
+
isVisibleDetailRow: function isVisibleDetailRow(obj) {
|
|
662
|
+
var index = this.handleDetailKey(obj);
|
|
663
|
+
var result = this.visibleDetailRows.indexOf(index) >= 0;
|
|
664
|
+
return result;
|
|
665
|
+
},
|
|
666
|
+
isActiveDetailRow: function isActiveDetailRow(row) {
|
|
667
|
+
return this.detailed && !this.customDetailRow && this.isVisibleDetailRow(row);
|
|
668
|
+
},
|
|
669
|
+
isActiveCustomDetailRow: function isActiveCustomDetailRow(row) {
|
|
670
|
+
return this.detailed && this.customDetailRow && this.isVisibleDetailRow(row);
|
|
671
|
+
},
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* When the detailKey is defined we use the object[detailKey] as index.
|
|
675
|
+
* If not, use the object reference by default.
|
|
676
|
+
*/
|
|
677
|
+
handleDetailKey: function handleDetailKey(index) {
|
|
678
|
+
var key = this.detailKey;
|
|
679
|
+
return !key.length ? index : index[key];
|
|
680
|
+
},
|
|
681
|
+
checkPredefinedDetailedRows: function checkPredefinedDetailedRows() {
|
|
682
|
+
var defaultExpandedRowsDefined = this.openedDetailed.length > 0;
|
|
683
|
+
|
|
684
|
+
if (defaultExpandedRowsDefined && !this.detailKey.length) {
|
|
685
|
+
throw new Error('If you set a predefined opened-detailed, you must provide a unique key using the prop "detail-key"');
|
|
686
|
+
}
|
|
687
|
+
},
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Call initSort only first time (For example async data).
|
|
691
|
+
*/
|
|
692
|
+
checkSort: function checkSort() {
|
|
693
|
+
if (this.newColumns.length && this.firstTimeSort) {
|
|
694
|
+
this.initSort();
|
|
695
|
+
this.firstTimeSort = false;
|
|
696
|
+
} else if (this.newColumns.length) {
|
|
697
|
+
if (this.currentSortColumn.field) {
|
|
698
|
+
for (var i = 0; i < this.newColumns.length; i++) {
|
|
699
|
+
if (this.newColumns[i].field === this.currentSortColumn.field) {
|
|
700
|
+
this.currentSortColumn = this.newColumns[i];
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Check if footer slot has custom content.
|
|
710
|
+
*/
|
|
711
|
+
hasCustomFooterSlot: function hasCustomFooterSlot() {
|
|
712
|
+
if (this.$slots.footer.length > 1) return true;
|
|
713
|
+
var tag = this.$slots.footer[0].tag;
|
|
714
|
+
if (tag !== 'th' && tag !== 'td') return false;
|
|
715
|
+
return true;
|
|
716
|
+
},
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Check if bottom-left slot exists.
|
|
720
|
+
*/
|
|
721
|
+
hasBottomLeftSlot: function hasBottomLeftSlot() {
|
|
722
|
+
return typeof this.$slots['bottom-left'] !== 'undefined';
|
|
723
|
+
},
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Table arrow keys listener, change selection.
|
|
727
|
+
*/
|
|
728
|
+
pressedArrow: function pressedArrow(pos) {
|
|
729
|
+
if (!this.visibleData.length) return;
|
|
730
|
+
var index = this.visibleData.indexOf(this.selected) + pos; // Prevent from going up from first and down from last
|
|
731
|
+
|
|
732
|
+
index = index < 0 ? 0 : index > this.visibleData.length - 1 ? this.visibleData.length - 1 : index;
|
|
733
|
+
this.selectRow(this.visibleData[index]);
|
|
734
|
+
},
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Focus table element if has selected prop.
|
|
738
|
+
*/
|
|
739
|
+
focus: function focus() {
|
|
740
|
+
if (!this.focusable) return;
|
|
741
|
+
this.$el.querySelector('table').focus();
|
|
742
|
+
},
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Initial sorted column based on the default-sort prop.
|
|
746
|
+
*/
|
|
747
|
+
initSort: function initSort() {
|
|
748
|
+
var _this5 = this;
|
|
749
|
+
|
|
750
|
+
if (!this.defaultSort) return;
|
|
751
|
+
var sortField = '';
|
|
752
|
+
var sortDirection = this.defaultSortDirection;
|
|
753
|
+
|
|
754
|
+
if (Array.isArray(this.defaultSort)) {
|
|
755
|
+
sortField = this.defaultSort[0];
|
|
756
|
+
|
|
757
|
+
if (this.defaultSort[1]) {
|
|
758
|
+
sortDirection = this.defaultSort[1];
|
|
759
|
+
}
|
|
760
|
+
} else {
|
|
761
|
+
sortField = this.defaultSort;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
this.newColumns.forEach(function (column) {
|
|
765
|
+
if (column.field === sortField) {
|
|
766
|
+
_this5.isAsc = sortDirection.toLowerCase() !== 'desc';
|
|
767
|
+
|
|
768
|
+
_this5.sort(column, true);
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
},
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Emits drag start event
|
|
775
|
+
*/
|
|
776
|
+
handleDragStart: function handleDragStart(event, row, index) {
|
|
777
|
+
this.$emit('dragstart', {
|
|
778
|
+
event: event,
|
|
779
|
+
row: row,
|
|
780
|
+
index: index
|
|
781
|
+
});
|
|
782
|
+
},
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Emits drop event
|
|
786
|
+
*/
|
|
787
|
+
handleDrop: function handleDrop(event, row, index) {
|
|
788
|
+
this.$emit('drop', {
|
|
789
|
+
event: event,
|
|
790
|
+
row: row,
|
|
791
|
+
index: index
|
|
792
|
+
});
|
|
793
|
+
},
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Emits drag over event
|
|
797
|
+
*/
|
|
798
|
+
handleDragOver: function handleDragOver(event, row, index) {
|
|
799
|
+
this.$emit('dragover', {
|
|
800
|
+
event: event,
|
|
801
|
+
row: row,
|
|
802
|
+
index: index
|
|
803
|
+
});
|
|
804
|
+
},
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Emits drag leave event
|
|
808
|
+
*/
|
|
809
|
+
handleDragLeave: function handleDragLeave(event, row, index) {
|
|
810
|
+
this.$emit('dragleave', {
|
|
811
|
+
event: event,
|
|
812
|
+
row: row,
|
|
813
|
+
index: index
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
},
|
|
817
|
+
mounted: function mounted() {
|
|
818
|
+
this.checkPredefinedDetailedRows();
|
|
819
|
+
this.checkSort();
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
/* script */
|
|
824
|
+
const __vue_script__$2 = script$2;
|
|
825
|
+
|
|
826
|
+
/* template */
|
|
827
|
+
var __vue_render__$2 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"b-table",class:{ 'is-loading': _vm.loading }},[(_vm.mobileCards && _vm.hasSortablenewColumns)?_c('b-table-mobile-sort',{attrs:{"current-sort-column":_vm.currentSortColumn,"is-asc":_vm.isAsc,"columns":_vm.newColumns,"placeholder":_vm.mobileSortPlaceholder},on:{"sort":function (column) { return _vm.sort(column); }}}):_vm._e(),_vm._v(" "),(_vm.paginated && (_vm.paginationPosition === 'top' || _vm.paginationPosition === 'both'))?_c('div',{staticClass:"top level"},[_c('div',{staticClass:"level-left"},[_vm._t("top-left")],2),_vm._v(" "),_c('div',{staticClass:"level-right"},[(_vm.paginated)?_c('div',{staticClass:"level-item"},[_c('b-pagination',{attrs:{"icon-pack":_vm.iconPack,"total":_vm.newDataTotal,"per-page":_vm.perPage,"simple":_vm.paginationSimple,"size":_vm.paginationSize,"current":_vm.newCurrentPage,"aria-next-label":_vm.ariaNextLabel,"aria-previous-label":_vm.ariaPreviousLabel,"aria-page-label":_vm.ariaPageLabel,"aria-current-label":_vm.ariaCurrentLabel},on:{"change":_vm.pageChanged}})],1):_vm._e()])]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"table-wrapper"},[_c('table',{staticClass:"table",class:_vm.tableClasses,attrs:{"tabindex":!_vm.focusable ? false : 0},on:{"keydown":[function($event){if(!('button' in $event)&&_vm._k($event.keyCode,"up",38,$event.key)){ return null; }if($event.target !== $event.currentTarget){ return null; }$event.preventDefault();_vm.pressedArrow(-1);},function($event){if(!('button' in $event)&&_vm._k($event.keyCode,"down",40,$event.key)){ return null; }if($event.target !== $event.currentTarget){ return null; }$event.preventDefault();_vm.pressedArrow(1);}]}},[(_vm.newColumns.length)?_c('thead',[_c('tr',[(_vm.showDetailRowIcon)?_c('th',{attrs:{"width":"40px"}}):_vm._e(),_vm._v(" "),(_vm.checkable && _vm.checkboxPosition === 'left')?_c('th',{staticClass:"checkbox-cell"},[(_vm.headerCheckable)?[_c('b-checkbox',{attrs:{"value":_vm.isAllChecked,"disabled":_vm.isAllUncheckable},nativeOn:{"change":function($event){_vm.checkAll($event);}}})]:_vm._e()],2):_vm._e(),_vm._v(" "),_vm._l((_vm.visibleColumns),function(column,index){return _c('th',{key:index,class:{
|
|
828
|
+
'is-current-sort': _vm.currentSortColumn === column,
|
|
829
|
+
'is-sortable': column.sortable
|
|
830
|
+
},style:({
|
|
831
|
+
width: column.width === undefined ? null : column.width + 'px'
|
|
832
|
+
}),on:{"click":function($event){$event.stopPropagation();_vm.sort(column);}}},[_c('div',{staticClass:"th-wrap",class:{
|
|
833
|
+
'is-numeric': column.numeric,
|
|
834
|
+
'is-centered': column.centered
|
|
835
|
+
}},[(column.$scopedSlots && column.$scopedSlots.header)?[_c('b-slot-component',{attrs:{"component":column,"scoped":true,"name":"header","tag":"span","props":{ column: column, index: index }}})]:(_vm.$scopedSlots.header)?[_vm._t("header",null,{column:column,index:index})]:[_vm._v(_vm._s(column.label))],_vm._v(" "),_c('b-icon',{directives:[{name:"show",rawName:"v-show",value:(_vm.currentSortColumn === column),expression:"currentSortColumn === column"}],class:{ 'is-desc': !_vm.isAsc },attrs:{"icon":_vm.sortIcon,"pack":_vm.iconPack,"both":"","size":_vm.sortIconSize}})],2)])}),_vm._v(" "),(_vm.checkable && _vm.checkboxPosition === 'right')?_c('th',{staticClass:"checkbox-cell"},[(_vm.headerCheckable)?[_c('b-checkbox',{attrs:{"value":_vm.isAllChecked,"disabled":_vm.isAllUncheckable},nativeOn:{"change":function($event){_vm.checkAll($event);}}})]:_vm._e()],2):_vm._e()],2)]):_vm._e(),_vm._v(" "),(_vm.visibleData.length)?_c('tbody',[_vm._l((_vm.visibleData),function(row,index){return [_c('tr',{key:_vm.customRowKey ? row[_vm.customRowKey] : index,class:[_vm.rowClass(row, index), {
|
|
836
|
+
'is-selected': row === _vm.selected,
|
|
837
|
+
'is-checked': _vm.isRowChecked(row),
|
|
838
|
+
}],attrs:{"draggable":_vm.draggable},on:{"click":function($event){_vm.selectRow(row);},"dblclick":function($event){_vm.$emit('dblclick', row);},"mouseenter":function($event){_vm.$emit('mouseenter', row);},"mouseleave":function($event){_vm.$emit('mouseleave', row);},"contextmenu":function($event){_vm.$emit('contextmenu', row, $event);},"dragstart":function($event){_vm.handleDragStart($event, row, index);},"drop":function($event){_vm.handleDrop($event, row, index);},"dragover":function($event){_vm.handleDragOver($event, row, index);},"dragleave":function($event){_vm.handleDragLeave($event, row, index);}}},[(_vm.showDetailRowIcon)?_c('td',{staticClass:"chevron-cell"},[(_vm.hasDetailedVisible(row))?_c('a',{attrs:{"role":"button"},on:{"click":function($event){$event.stopPropagation();_vm.toggleDetails(row);}}},[_c('b-icon',{class:{'is-expanded': _vm.isVisibleDetailRow(row)},attrs:{"icon":"chevron-right","pack":_vm.iconPack,"both":""}})],1):_vm._e()]):_vm._e(),_vm._v(" "),(_vm.checkable && _vm.checkboxPosition === 'left')?_c('td',{staticClass:"checkbox-cell"},[_c('b-checkbox',{attrs:{"disabled":!_vm.isRowCheckable(row),"value":_vm.isRowChecked(row)},nativeOn:{"change":function($event){_vm.checkRow(row);},"click":function($event){$event.stopPropagation();}}})],1):_vm._e(),_vm._v(" "),(_vm.$scopedSlots.default)?_vm._t("default",null,{row:row,index:index}):_vm._l((_vm.newColumns),function(column){return _c('BTableColumn',_vm._b({key:column.field,attrs:{"internal":""}},'BTableColumn',column,false),[(column.renderHtml)?_c('span',{domProps:{"innerHTML":_vm._s(_vm.getValueByPath(row, column.field))}}):[_vm._v("\n "+_vm._s(_vm.getValueByPath(row, column.field))+"\n ")]],2)}),_vm._v(" "),(_vm.checkable && _vm.checkboxPosition === 'right')?_c('td',{staticClass:"checkbox-cell"},[_c('b-checkbox',{attrs:{"disabled":!_vm.isRowCheckable(row),"value":_vm.isRowChecked(row)},nativeOn:{"change":function($event){_vm.checkRow(row);},"click":function($event){$event.stopPropagation();}}})],1):_vm._e()],2),_vm._v(" "),(_vm.isActiveDetailRow(row))?_c('tr',{staticClass:"detail"},[_c('td',{attrs:{"colspan":_vm.columnCount}},[_c('div',{staticClass:"detail-container"},[_vm._t("detail",null,{row:row,index:index})],2)])]):_vm._e(),_vm._v(" "),(_vm.isActiveCustomDetailRow(row))?_vm._t("detail",null,{row:row,index:index}):_vm._e()]})],2):_c('tbody',[_c('tr',{staticClass:"is-empty"},[_c('td',{attrs:{"colspan":_vm.columnCount}},[_vm._t("empty")],2)])]),_vm._v(" "),(_vm.$slots.footer !== undefined)?_c('tfoot',[_c('tr',{staticClass:"table-footer"},[(_vm.hasCustomFooterSlot())?_vm._t("footer"):_c('th',{attrs:{"colspan":_vm.columnCount}},[_vm._t("footer")],2)],2)]):_vm._e()])]),_vm._v(" "),((_vm.checkable && _vm.hasBottomLeftSlot()) ||
|
|
839
|
+
(_vm.paginated && (_vm.paginationPosition === 'bottom' || _vm.paginationPosition === 'both')))?_c('div',{staticClass:"level"},[_c('div',{staticClass:"level-left"},[_vm._t("bottom-left")],2),_vm._v(" "),_c('div',{staticClass:"level-right"},[(_vm.paginated)?_c('div',{staticClass:"level-item"},[_c('b-pagination',{attrs:{"icon-pack":_vm.iconPack,"total":_vm.newDataTotal,"per-page":_vm.perPage,"simple":_vm.paginationSimple,"size":_vm.paginationSize,"current":_vm.newCurrentPage,"aria-next-label":_vm.ariaNextLabel,"aria-previous-label":_vm.ariaPreviousLabel,"aria-page-label":_vm.ariaPageLabel,"aria-current-label":_vm.ariaCurrentLabel},on:{"change":_vm.pageChanged}})],1):_vm._e()])]):_vm._e()],1)};
|
|
840
|
+
var __vue_staticRenderFns__$2 = [];
|
|
841
|
+
|
|
842
|
+
/* style */
|
|
843
|
+
const __vue_inject_styles__$2 = undefined;
|
|
844
|
+
/* scoped */
|
|
845
|
+
const __vue_scope_id__$2 = undefined;
|
|
846
|
+
/* module identifier */
|
|
847
|
+
const __vue_module_identifier__$2 = undefined;
|
|
848
|
+
/* functional template */
|
|
849
|
+
const __vue_is_functional_template__$2 = false;
|
|
850
|
+
/* style inject */
|
|
851
|
+
|
|
852
|
+
/* style inject SSR */
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
var Table = __chunk_6.__vue_normalize__(
|
|
857
|
+
{ render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
|
|
858
|
+
__vue_inject_styles__$2,
|
|
859
|
+
__vue_script__$2,
|
|
860
|
+
__vue_scope_id__$2,
|
|
861
|
+
__vue_is_functional_template__$2,
|
|
862
|
+
__vue_module_identifier__$2,
|
|
863
|
+
undefined,
|
|
864
|
+
undefined
|
|
865
|
+
);
|
|
866
|
+
|
|
867
|
+
var Plugin = {
|
|
868
|
+
install: function install(Vue) {
|
|
869
|
+
__chunk_6.registerComponent(Vue, Table);
|
|
870
|
+
__chunk_6.registerComponent(Vue, TableColumn);
|
|
871
|
+
}
|
|
872
|
+
};
|
|
873
|
+
__chunk_6.use(Plugin);
|
|
874
|
+
|
|
875
|
+
exports.Table = Table;
|
|
876
|
+
exports.TableColumn = TableColumn;
|
|
877
|
+
exports.default = Plugin;
|