Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VDataTable.js 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  6. require('../../../src/stylus/components/_tables.styl');
  7. require('../../../src/stylus/components/_data-table.styl');
  8. var _dataIterable = require('../../mixins/data-iterable');
  9. var _dataIterable2 = _interopRequireDefault(_dataIterable);
  10. var _head = require('./mixins/head');
  11. var _head2 = _interopRequireDefault(_head);
  12. var _body = require('./mixins/body');
  13. var _body2 = _interopRequireDefault(_body);
  14. var _foot = require('./mixins/foot');
  15. var _foot2 = _interopRequireDefault(_foot);
  16. var _progress = require('./mixins/progress');
  17. var _progress2 = _interopRequireDefault(_progress);
  18. var _helpers = require('../../util/helpers');
  19. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20. // Importing does not work properly
  21. var VTableOverflow = (0, _helpers.createSimpleFunctional)('v-table__overflow');
  22. /* @vue/component */
  23. exports.default = {
  24. name: 'v-data-table',
  25. mixins: [_dataIterable2.default, _head2.default, _body2.default, _foot2.default, _progress2.default],
  26. props: {
  27. headers: {
  28. type: Array,
  29. default: function _default() {
  30. return [];
  31. }
  32. },
  33. headersLength: {
  34. type: Number
  35. },
  36. headerText: {
  37. type: String,
  38. default: 'text'
  39. },
  40. headerKey: {
  41. type: String,
  42. default: null
  43. },
  44. hideHeaders: Boolean,
  45. rowsPerPageText: {
  46. type: String,
  47. default: '$vuetify.dataTable.rowsPerPageText'
  48. },
  49. customFilter: {
  50. type: Function,
  51. default: function _default(items, search, filter, headers) {
  52. search = search.toString().toLowerCase();
  53. if (search.trim() === '') return items;
  54. var props = headers.map(function (h) {
  55. return h.value;
  56. });
  57. return items.filter(function (item) {
  58. return props.some(function (prop) {
  59. return filter((0, _helpers.getObjectValueByPath)(item, prop, item[prop]), search);
  60. });
  61. });
  62. }
  63. }
  64. },
  65. data: function data() {
  66. return {
  67. actionsClasses: 'v-datatable__actions',
  68. actionsRangeControlsClasses: 'v-datatable__actions__range-controls',
  69. actionsSelectClasses: 'v-datatable__actions__select',
  70. actionsPaginationClasses: 'v-datatable__actions__pagination'
  71. };
  72. },
  73. computed: {
  74. classes: function classes() {
  75. return _extends({
  76. 'v-datatable v-table': true,
  77. 'v-datatable--select-all': this.selectAll !== false
  78. }, this.themeClasses);
  79. },
  80. filteredItems: function filteredItems() {
  81. return this.filteredItemsImpl(this.headers);
  82. },
  83. headerColumns: function headerColumns() {
  84. return this.headersLength || this.headers.length + (this.selectAll !== false);
  85. }
  86. },
  87. created: function created() {
  88. var firstSortable = this.headers.find(function (h) {
  89. return !('sortable' in h) || h.sortable;
  90. });
  91. this.defaultPagination.sortBy = !this.disableInitialSort && firstSortable ? firstSortable.value : null;
  92. this.initPagination();
  93. },
  94. methods: {
  95. hasTag: function hasTag(elements, tag) {
  96. return Array.isArray(elements) && elements.find(function (e) {
  97. return e.tag === tag;
  98. });
  99. },
  100. genTR: function genTR(children) {
  101. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  102. return this.$createElement('tr', data, children);
  103. }
  104. },
  105. render: function render(h) {
  106. var tableOverflow = h(VTableOverflow, {}, [h('table', {
  107. 'class': this.classes
  108. }, [this.genTHead(), this.genTBody(), this.genTFoot()])]);
  109. return h('div', [tableOverflow, this.genActionsFooter()]);
  110. }
  111. };
  112. //# sourceMappingURL=VDataTable.js.map