@mozaic-ds/vue 0.30.0 → 0.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mozaic-ds/vue",
3
- "version": "0.30.0",
3
+ "version": "0.31.1",
4
4
  "description": "Vue.js implementation of Mozaic Design System",
5
5
  "author": "Adeo - Mozaic Design System",
6
6
  "scripts": {
@@ -1,111 +1,119 @@
1
1
  <template>
2
- <div class="mc-data-table" :class="getClasses">
2
+ <div ref="datatable" class="mc-data-table" :class="getClasses">
3
3
  <slot />
4
- <div class="mc-data-table__body">
5
- <table aria-describedby="data" :class="getTableClasses">
6
- <thead>
7
- <tr v-if="!hideHeader">
8
- <th
9
- v-for="(header, index) in getHeaders"
10
- :key="`header-${index}`"
11
- :class="header.cssClass"
12
- scope="col"
13
- >
14
- <div class="header">
15
- <slot :name="`header.${header.dataFieldExpr}`" :header="header">
16
- {{ header.caption }}
17
- </slot>
18
- <div
19
- v-if="sorting.mode !== 'none' && header.allowSorting"
20
- class="header__sort"
21
- @click="!loading && onSortClick({ e: $event, header })"
22
- >
23
- <m-icon
24
- :name="'ArrowArrowTop16'"
25
- :class="{ active: header.sortOrder === 'asc' }"
26
- />
27
- <m-icon
28
- :name="'ArrowArrowBottom16'"
29
- :class="{ active: header.sortOrder === 'desc' }"
30
- />
4
+
5
+ <div class="mc-datatable__container">
6
+ <div class="mc-data-table__body" :style="bodyStyleAttr">
7
+ <table aria-describedby="data" :class="getTableClasses">
8
+ <thead>
9
+ <tr v-if="!hideHeader">
10
+ <th
11
+ v-for="(header, index) in getHeaders"
12
+ :key="`header-${index}`"
13
+ :class="header.cssClass"
14
+ scope="col"
15
+ >
16
+ <div class="header">
17
+ <slot
18
+ :name="`header.${header.dataFieldExpr}`"
19
+ :header="header"
20
+ >
21
+ {{ header.caption }}
22
+ </slot>
23
+ <div
24
+ v-if="sorting.mode !== 'none' && header.allowSorting"
25
+ class="header__sort"
26
+ :class="header.sortOrder"
27
+ @click="!loading && onSortClick({ e: $event, header })"
28
+ >
29
+ <m-icon
30
+ :name="'ArrowArrowTop16'"
31
+ :class="{ active: header.sortOrder === 'asc' }"
32
+ />
33
+ <m-icon
34
+ :name="'ArrowArrowBottom16'"
35
+ :class="{ active: header.sortOrder === 'desc' }"
36
+ />
37
+ </div>
31
38
  </div>
32
- </div>
33
- </th>
34
- </tr>
35
- </thead>
36
- <tbody>
37
- <tr
38
- v-for="(item, rowIndex) in getSource"
39
- :key="item[dataKeyExpr]"
40
- :class="rowClasses(item)"
41
- >
42
- <td
43
- v-for="(header, index) in getHeaders"
44
- :key="`${index}-${getItemValue(item, dataKeyExpr)}-${
45
- header.dataFieldExpr
46
- }`"
47
- :class="header.cssClass"
48
- @click="
49
- allowRowClick && onRowClick({ event: $event, item: item })
50
- "
39
+ </th>
40
+ </tr>
41
+ </thead>
42
+ <tbody>
43
+ <tr
44
+ v-for="(item, rowIndex) in getSource"
45
+ :key="item[dataKeyExpr]"
46
+ :class="rowClasses(item)"
51
47
  >
52
- <slot
53
- :name="`item.${header.dataFieldExpr}`"
54
- :item="item"
55
- :index="rowIndex"
48
+ <td
49
+ v-for="(header, index) in getHeaders"
50
+ :key="`${index}-${getItemValue(item, dataKeyExpr)}-${
51
+ header.dataFieldExpr
52
+ }`"
53
+ :class="header.cssClass"
54
+ @click="
55
+ allowRowClick && onRowClick({ event: $event, item: item })
56
+ "
56
57
  >
57
- {{ getItemValue(item, header.dataFieldExpr) }}
58
- </slot>
59
- </td>
60
- </tr>
61
- <tr v-if="getSource.length == 0">
62
- <td :colspan="getHeaders.length">
63
- <slot name="no-data" />
64
- </td>
65
- </tr>
66
- </tbody>
67
- </table>
68
- </div>
69
- <div
70
- v-if="pagingOptions.enabled && total != null"
71
- class="mc-data-table__footer"
72
- >
73
- <div class="mc-data-table__footer__item-per-page">
74
- <m-select
75
- :id="'itemPerPage'"
76
- :disabled="loading"
77
- :options="getPageSizes"
78
- :value="getPageValue"
79
- @change="onPageSizeChanged"
80
- >
81
- <template #text="{ option }">
82
- <slot name="pager.text" :pager="option">
83
- {{ option.text }}
84
- </slot>
85
- </template>
86
- </m-select>
58
+ <slot
59
+ :name="`item.${header.dataFieldExpr}`"
60
+ :item="item"
61
+ :index="rowIndex"
62
+ >
63
+ {{ getItemValue(item, header.dataFieldExpr) }}
64
+ </slot>
65
+ </td>
66
+ </tr>
67
+ <tr v-if="getSource.length == 0">
68
+ <td :colspan="getHeaders.length">
69
+ <slot name="no-data" />
70
+ </td>
71
+ </tr>
72
+ </tbody>
73
+ </table>
87
74
  </div>
88
75
  <div
89
- v-if="pagingOptions.displayTotal"
90
- class="mc-data-table__footer__display-total-item"
76
+ v-if="pagingOptions.enabled && total != null"
77
+ class="mc-data-table__footer"
91
78
  >
92
- <span class="strong">{{ getTotalStringCurrentCount }}</span> /
93
- <span class="strong">{{ total }}</span>
94
- </div>
95
- <div class="mc-data-table__footer__pagination">
96
- <m-pagination
97
- :disabled="loading"
98
- :length="getPagingSize"
99
- :page-label="pagingOptions.pageLabel"
100
- :value="pagingOptions.index"
101
- @on-update-page="onUpdatePage"
79
+ <div class="mc-data-table__footer__item-per-page">
80
+ <m-select
81
+ id="itemPerPage"
82
+ :disabled="loading"
83
+ :options="getPageSizes"
84
+ :value="getPageValue"
85
+ size="s"
86
+ @change="onPageSizeChanged"
87
+ >
88
+ <template #text="{ option }">
89
+ <slot name="pager.text" :pager="option">
90
+ {{ option.text }}
91
+ </slot>
92
+ </template>
93
+ </m-select>
94
+ </div>
95
+ <div
96
+ v-if="pagingOptions.displayTotal"
97
+ class="mc-data-table__footer__display-total-item"
102
98
  >
103
- <template #text="{ option }">
104
- <slot name="paging.text" :paging="option">
105
- {{ option.text }}
106
- </slot>
107
- </template>
108
- </m-pagination>
99
+ <span class="strong">{{ getTotalStringCurrentCount }}</span> /
100
+ <span class="strong">{{ total }}</span>
101
+ </div>
102
+ <div class="mc-data-table__footer__pagination">
103
+ <m-pagination
104
+ :disabled="loading"
105
+ :length="getPagingSize"
106
+ :page-label="pagingOptions.pageLabel"
107
+ :value="pagingOptions.index"
108
+ @on-update-page="onUpdatePage"
109
+ >
110
+ <template #text="{ option }">
111
+ <slot name="paging.text" :paging="option">
112
+ {{ option.text }}
113
+ </slot>
114
+ </template>
115
+ </m-pagination>
116
+ </div>
109
117
  </div>
110
118
  </div>
111
119
  </div>
@@ -305,6 +313,7 @@ export default {
305
313
  data: null,
306
314
  loading: false,
307
315
  created: false,
316
+ bodyStyleAttr: '',
308
317
  };
309
318
  },
310
319
 
@@ -458,6 +467,7 @@ export default {
458
467
  mounted() {
459
468
  this.load();
460
469
  this.created = true;
470
+ this.bodyStyleAttr = this.$refs.datatable.attributes.style.value;
461
471
  },
462
472
 
463
473
  methods: {
@@ -587,137 +597,190 @@ export default {
587
597
 
588
598
  <style lang="scss">
589
599
  /* stylelint-disable */
590
- $local-config: (
591
- font-path: '~@mozaic-ds/web-fonts',
592
- );
593
-
594
600
  @import 'settings-tools/_all-settings';
595
601
 
596
602
  .mc-data-table {
597
- @include set-font-face();
603
+ @include set-font-family;
598
604
 
599
- position: relative;
600
- background-color: $color-grey-000;
601
- padding: 2px 0;
602
- background-clip: padding-box;
603
- display: flex;
604
- flex-direction: column;
605
+ $parent: get-parent-selector(&);
605
606
 
606
- @include set-border-radius('m');
607
+ background-color: $color-background-datatable-container;
608
+ box-sizing: border-box;
609
+
610
+ *,
611
+ ::after,
612
+ ::before {
613
+ box-sizing: inherit;
614
+ }
607
615
 
608
616
  &__body {
609
- overflow-x: scroll;
610
- height: 100%;
611
-
612
- & table {
613
- border-collapse: collapse;
614
- width: 100%;
615
-
616
- &.no-data {
617
- height: 100%;
618
- & tr {
619
- & td {
620
- text-align: center;
621
- }
622
- }
617
+ @include set-datatable-scrollbar();
618
+
619
+ overflow-x: auto;
620
+ overflow-y: hidden;
621
+
622
+ table {
623
+ @include set-datatable-base();
624
+
625
+ & > thead,
626
+ & > tbody {
627
+ background-color: $color-grey-000;
623
628
  }
624
629
 
625
- & thead {
626
- & tr {
627
- & th {
628
- height: 46px;
629
- background-color: $color-grey-000;
630
- padding: 0 1rem;
631
- font-style: normal;
632
- font-weight: 600;
633
- font-size: 14px;
634
- line-height: 18px;
635
- text-align: left;
636
- box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1);
637
- white-space: nowrap;
638
- text-overflow: ellipsis;
639
-
640
- & .header {
641
- display: flex;
630
+ thead {
631
+ th,
632
+ td {
633
+ @include set-datatable-head-label();
634
+
635
+ height: map-get($datatabke-default-celle-size, 'height');
636
+
637
+ .header {
638
+ align-items: center;
639
+ display: flex;
640
+ height: 100%;
641
+ font-family: inherit;
642
+ justify-content: space-between;
643
+ width: 100%;
644
+
645
+ &__sort {
642
646
  align-items: center;
647
+ display: flex;
648
+ flex-direction: column;
649
+ height: $mu150;
650
+ justify-content: space-around;
651
+ margin-left: $mu050;
652
+ width: $mu150;
653
+ cursor: pointer;
654
+
655
+ &::after,
656
+ &::before {
657
+ background-color: $color-background-arrow-default;
658
+ content: '';
659
+ flex-shrink: 0;
660
+ height: $mu050;
661
+ width: $mu075;
662
+ }
643
663
 
644
- &__sort {
645
- margin-left: 5px;
646
- position: relative;
647
- width: 24px;
664
+ &::before {
665
+ clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
666
+ }
648
667
 
649
- & svg {
650
- margin-top: -50%;
651
- opacity: 0.1;
652
- position: absolute;
653
- cursor: pointer;
668
+ &::after {
669
+ clip-path: polygon(0 0, 100% 0, 50% 100%);
670
+ }
654
671
 
655
- &.active {
656
- opacity: 1;
657
- }
672
+ &.asc {
673
+ &::before {
674
+ background-color: $color-background-arrow-active;
675
+ }
676
+ }
658
677
 
659
- &:last-child {
660
- top: 9px;
661
- }
678
+ &.desc {
679
+ &::after {
680
+ background-color: $color-background-arrow-active;
662
681
  }
663
682
  }
683
+
684
+ & svg {
685
+ display: none;
686
+ opacity: 0;
687
+ }
664
688
  }
665
689
  }
666
690
  }
667
691
  }
668
692
 
669
- & tbody {
670
- & tr {
671
- &:not(:last-child) {
672
- border-bottom: 1px solid $color-grey-300;
693
+ tbody {
694
+ tr {
695
+ &:hover {
696
+ background-color: $color-background-datatable-cell-hover;
673
697
  }
674
698
 
675
699
  &.mc-data-table__body__row--clickable {
676
700
  cursor: pointer;
677
701
 
678
- &:hover {
679
- background-color: $color-grey-100;
680
- opacity: 0.8;
681
- }
682
-
683
702
  &:active {
684
- background-color: $color-grey-200;
685
- opacity: 0.8;
703
+ background-color: $color-background-datatable-cell-selected;
686
704
  }
687
705
  }
688
706
 
689
- & td {
690
- font-style: normal;
691
- font-weight: normal;
692
- font-size: 13px;
693
- line-height: 18px;
694
- height: 40px;
695
- padding: 0 1rem;
696
- white-space: nowrap;
697
- text-overflow: ellipsis;
707
+ &.row-selected {
708
+ background-color: $color-background-datatable-cell-selected;
698
709
  }
699
710
  }
711
+
712
+ th,
713
+ td {
714
+ @include set-font-scale('04', 'm'); // 14px / 18px
715
+
716
+ color: $color-font-tbody-cell;
717
+ }
718
+ }
719
+
720
+ tr {
721
+ height: map-get($datatabke-default-celle-size, 'height');
722
+ }
723
+
724
+ th,
725
+ td {
726
+ border-bottom: get-border(s) solid $color-grey-300;
727
+ text-align: left;
728
+ vertical-align: middle;
729
+ padding: 0 $mu100;
700
730
  }
701
731
  }
702
732
  }
703
733
 
734
+ // sticky
735
+ &--fixed-header {
736
+ #{$parent} {
737
+ &__body {
738
+ table {
739
+ > thead {
740
+ @include set-box-shadow('l');
741
+
742
+ top: 0;
743
+ z-index: 2;
744
+ position: sticky;
745
+ }
746
+
747
+ > tbody {
748
+ tr:last-child {
749
+ th,
750
+ td {
751
+ border-bottom: transparent;
752
+ }
753
+ }
754
+ }
755
+ }
756
+ }
757
+ }
758
+ }
759
+
760
+ // manage scroll
761
+ &[style*='height'] {
762
+ .mc-data-table__body {
763
+ overflow-y: auto;
764
+ }
765
+ }
766
+
767
+ // footer
768
+
704
769
  &__footer {
705
- border-top: 1px solid $color-grey-300;
706
- height: 70px;
707
- display: flex;
770
+ @include set-box-shadow('s');
771
+
708
772
  align-items: center;
709
- padding: 0 1rem;
773
+ background-color: $color-grey-000;
774
+ display: flex;
775
+ padding: $mu075 $mu100;
776
+ gap: $mu100;
710
777
 
711
- @include set-border-radius('m', 'bottom');
778
+ @media screen and (max-width: ($screen-m - 1)) {
779
+ flex-direction: column;
780
+ }
712
781
 
713
782
  &__item-per-page {
714
- & select {
715
- width: auto;
716
- font-size: 0.875rem;
717
- line-height: 1.1428571;
718
- padding: calc(0.5rem - 1px) 2.25rem calc(0.5rem - 1px)
719
- calc(0.5rem - 1px);
720
- }
783
+ flex-shrink: 0;
721
784
  }
722
785
 
723
786
  &__display-total-item {
@@ -725,54 +788,25 @@ $local-config: (
725
788
  min-width: 150px;
726
789
  padding: 0.5rem 2.25rem;
727
790
  font-size: 0.875rem;
791
+
728
792
  .strong {
729
793
  font-weight: bold;
730
794
  }
731
795
  }
732
796
 
733
797
  &__pagination {
734
- text-align: right;
735
- width: 100%;
736
- display: flex;
737
- justify-content: flex-end;
738
-
739
- & .mc-pagination {
740
- .mc-pagination__button {
741
- min-width: 2rem;
742
- min-height: 2rem;
743
-
744
- .mc-pagination__button-icon {
745
- height: 1rem;
746
- width: 1rem;
747
- }
748
- }
749
-
750
- .mc-select {
751
- font-size: 0.875rem;
752
- line-height: 1.1428571;
753
- padding: calc(0.5rem - 1px) 2.25rem calc(0.5rem - 1px)
754
- calc(0.5rem - 1px);
755
- }
756
- }
798
+ margin-left: auto;
757
799
  }
758
800
  }
801
+ }
759
802
 
760
- &.mc-data-table--fixed-header & {
761
- &__body {
762
- & table {
763
- overflow-y: auto;
764
-
765
- & thead {
766
- & tr {
767
- & th {
768
- position: sticky;
769
- top: 0;
770
- z-index: 1;
771
- }
772
- }
773
- }
774
- }
775
- }
803
+ .mc-datatable {
804
+ &__container {
805
+ @include set-border-radius();
806
+ @include set-box-shadow('s');
807
+
808
+ background-color: $color-background-datatable-container;
809
+ overflow: hidden;
776
810
  }
777
811
  }
778
812
  /* stylelint-enable */
@@ -29,7 +29,7 @@
29
29
  :size="small ? 's' : null"
30
30
  :disabled="disabled"
31
31
  role="spinbutton"
32
- @change="handle"
32
+ @change="handle($event.target.value)"
33
33
  @focus="onFocus"
34
34
  @keypress="integerOnly && formatValue($event)"
35
35
  v-on="$listeners"
@@ -26,6 +26,9 @@ const supportedTypes = [
26
26
  'text',
27
27
  'time',
28
28
  'search',
29
+ 'month',
30
+ 'week',
31
+ 'datetime-local',
29
32
  ];
30
33
 
31
34
  export default {