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.

body.js 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import ExpandTransitionGenerator from '../../transitions/expand-transition';
  2. import { getObjectValueByPath } from '../../../util/helpers';
  3. /* @vue/component */
  4. export default {
  5. methods: {
  6. genTBody: function genTBody() {
  7. var children = this.genItems();
  8. return this.$createElement('tbody', children);
  9. },
  10. genExpandedRow: function genExpandedRow(props) {
  11. var children = [];
  12. if (this.isExpanded(props.item)) {
  13. var expand = this.$createElement('div', {
  14. class: 'v-datatable__expand-content',
  15. key: getObjectValueByPath(props.item, this.itemKey)
  16. }, [this.$scopedSlots.expand(props)]);
  17. children.push(expand);
  18. }
  19. var transition = this.$createElement('transition-group', {
  20. class: 'v-datatable__expand-col',
  21. attrs: { colspan: this.headerColumns },
  22. props: {
  23. tag: 'td'
  24. },
  25. on: ExpandTransitionGenerator('v-datatable__expand-col--expanded')
  26. }, children);
  27. return this.genTR([transition], { class: 'v-datatable__expand-row' });
  28. },
  29. genFilteredItems: function genFilteredItems() {
  30. if (!this.$scopedSlots.items) {
  31. return null;
  32. }
  33. var rows = [];
  34. for (var index = 0, len = this.filteredItems.length; index < len; ++index) {
  35. var item = this.filteredItems[index];
  36. var props = this.createProps(item, index);
  37. var row = this.$scopedSlots.items(props);
  38. rows.push(this.hasTag(row, 'td') ? this.genTR(row, {
  39. key: this.itemKey ? getObjectValueByPath(props.item, this.itemKey) : index,
  40. attrs: { active: this.isSelected(item) }
  41. }) : row);
  42. if (this.$scopedSlots.expand) {
  43. var expandRow = this.genExpandedRow(props);
  44. rows.push(expandRow);
  45. }
  46. }
  47. return rows;
  48. },
  49. genEmptyItems: function genEmptyItems(content) {
  50. if (this.hasTag(content, 'tr')) {
  51. return content;
  52. } else if (this.hasTag(content, 'td')) {
  53. return this.genTR(content);
  54. } else {
  55. return this.genTR([this.$createElement('td', {
  56. class: {
  57. 'text-xs-center': typeof content === 'string'
  58. },
  59. attrs: { colspan: this.headerColumns }
  60. }, content)]);
  61. }
  62. }
  63. }
  64. };
  65. //# sourceMappingURL=body.js.map