mediacube-ui 0.1.146 → 0.1.148

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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.148](https://github.com/MediaCubeCo/mcui/compare/v0.1.147...v0.1.148) (2023-10-02)
6
+
7
+ ### [0.1.147](https://github.com/MediaCubeCo/mcui/compare/v0.1.146...v0.1.147) (2023-09-28)
8
+
5
9
  ### [0.1.146](https://github.com/MediaCubeCo/mcui/compare/v0.1.145...v0.1.146) (2023-09-21)
6
10
 
7
11
  ### [0.1.145](https://github.com/MediaCubeCo/mcui/compare/v0.1.144...v0.1.145) (2023-09-19)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediacube-ui",
3
- "version": "0.1.146",
3
+ "version": "0.1.148",
4
4
  "description": "Design system for Mediacube services",
5
5
  "author": "Mediacube",
6
6
  "private": false,
@@ -51,6 +51,7 @@
51
51
  import McTitle from '../../McTitle/McTitle'
52
52
  import McSvgIcon from '../../McSvgIcon/McSvgIcon'
53
53
  import fieldErrors from '../../../mixins/fieldErrors'
54
+ import { LANGUAGES } from '../../../helpers/consts'
54
55
  export default {
55
56
  name: 'McFieldCheckbox',
56
57
  components: { McTitle, McSvgIcon },
@@ -161,7 +162,7 @@ export default {
161
162
  'mc-field-checkbox--disabled': this.disabled,
162
163
  'mc-field-checkbox--empty': !this.mainText && !this.$slots.default,
163
164
  [`mc-field-checkbox--size-${this.checkboxSize}`]: !!this.checkboxSize,
164
- 'mc-field-checkbox--rtl': ['ar'].includes(this.locale),
165
+ 'mc-field-checkbox--rtl': LANGUAGES.rtl.includes(this.locale),
165
166
  }
166
167
  },
167
168
  inputProps() {
@@ -4,8 +4,8 @@
4
4
  <!-- @slot Слот заголовка -->
5
5
  <slot name="header">
6
6
  <mc-title v-if="hasTitle" :ellipsis="false" max-width="100%" weight="medium">{{
7
- computedTitle
8
- }}</mc-title>
7
+ computedTitle
8
+ }}</mc-title>
9
9
  </slot>
10
10
  </div>
11
11
  <div class="mc-field-select__main">
@@ -98,6 +98,7 @@ import McSvgIcon from '../../McSvgIcon/McSvgIcon'
98
98
  import McPreview from '../../../patterns/McPreview/McPreview'
99
99
  import fieldErrors from '../../../mixins/fieldErrors'
100
100
  import equalFieldHeight from '../../../mixins/equalFieldHeight'
101
+ import { LANGUAGES } from '../../../helpers/consts'
101
102
  export default {
102
103
  name: 'McFieldSelect',
103
104
  components: { McSvgIcon, McAvatar, McTitle, McTooltip, MultiSelect, McPreview },
@@ -301,6 +302,13 @@ export default {
301
302
  type: Boolean,
302
303
  default: false,
303
304
  },
305
+ /**
306
+ * Для какого языка селект
307
+ */
308
+ locale: {
309
+ type: String,
310
+ default: null,
311
+ },
304
312
  },
305
313
  data() {
306
314
  return {
@@ -353,6 +361,7 @@ export default {
353
361
  'mc-field-select--is-empty-options-list': this.isEmptyOptionsList,
354
362
  'mc-field-select--with-preview': this.optionWithPreview,
355
363
  'mc-field-select--max-height': this.maxHeight,
364
+ 'mc-field-select--rtl': LANGUAGES.rtl.includes(this.locale),
356
365
  }
357
366
  },
358
367
  computedTitle() {
@@ -587,6 +596,7 @@ $text-white: scale-color($color-white, $alpha: -10%);
587
596
  border-radius: $radius-100 !important;
588
597
  padding: 0 $space-500 0 $space-100;
589
598
  overflow: hidden;
599
+ text-align: start;
590
600
  &:hover {
591
601
  border-color: $color-purple;
592
602
  }
@@ -611,6 +621,7 @@ $text-white: scale-color($color-white, $alpha: -10%);
611
621
  font-family: $font-family-main;
612
622
  margin-top: $space-50;
613
623
  margin-bottom: $space-50;
624
+ margin-right: unset;
614
625
  background-color: $color-lighter-purple;
615
626
  color: $color-black;
616
627
  padding: $size-50 $size-50 $size-50 $size-100;
@@ -903,55 +914,67 @@ $text-white: scale-color($color-white, $alpha: -10%);
903
914
  text-overflow: ellipsis;
904
915
  white-space: nowrap;
905
916
  }
906
- }
907
- html[dir='rtl'] {
908
- .mc-field-select {
909
- &__single-label {
910
- @include child-indent-right(0);
911
- @include child-indent-left-rtl($space-50);
912
- }
913
- &__label-text {
914
- padding-left: 0;
915
- padding-right: $space-50;
916
- &--indent-left {
917
- margin-left: 0;
918
- margin-right: $space-300;
919
- }
920
- }
921
917
 
922
- .multiselect {
923
- &__placeholder {
924
- padding-left: 0;
925
- padding-right: $space-50;
926
- }
918
+ &--rtl {
919
+ direction: rtl;
920
+ }
927
921
 
928
- &__single {
929
- padding-right: 0;
922
+ @at-root {
923
+ #{$block-name}--rtl,
924
+ html[dir='rtl'] #{$block-name} {
925
+ &__single-label {
926
+ @include child-indent-right(0);
927
+ @include child-indent-left-rtl($space-50);
930
928
  }
931
-
932
- &__input {
929
+ &__label-text {
933
930
  padding-left: 0;
934
931
  padding-right: $space-50;
932
+ &--indent-left {
933
+ margin-left: 0;
934
+ margin-right: $space-300;
935
+ }
935
936
  }
936
- &__tags-wrap {
937
- @include child-indent-right(0);
938
- @include child-indent-left-rtl($space-100);
939
- }
940
- &__tags {
941
- padding: 0 $space-100 0 $space-500;
942
- }
943
- &__select {
944
- right: unset;
945
- left: 1px;
946
- }
947
- }
948
- &--with-preview {
949
- .mc-preview {
950
- align-items: center;
951
- }
937
+
952
938
  .multiselect {
939
+ &__placeholder {
940
+ padding-left: 0;
941
+ padding-right: $space-50;
942
+ width: 100%;
943
+ }
944
+
945
+ &__single {
946
+ padding-right: 0;
947
+ }
948
+
949
+ &__input {
950
+ padding-left: 0;
951
+ padding-right: $space-50;
952
+ }
953
+ &__tags-wrap {
954
+ @include child-indent-right(0);
955
+ @include child-indent-left-rtl($space-100);
956
+ }
957
+ &__tag-icon {
958
+ margin-left: unset;
959
+ margin-right: 7px;
960
+ }
953
961
  &__tags {
954
- padding: $space-200 $space-150;
962
+ padding: 0 $space-100 0 $space-500;
963
+ text-align: right;
964
+ }
965
+ &__select {
966
+ right: unset;
967
+ left: 1px;
968
+ }
969
+ }
970
+ &--with-preview {
971
+ .mc-preview {
972
+ align-items: center;
973
+ }
974
+ .multiselect {
975
+ &__tags {
976
+ padding: $space-200 $space-150;
977
+ }
955
978
  }
956
979
  }
957
980
  }
@@ -123,6 +123,7 @@ import McSvgIcon from '../../McSvgIcon/McSvgIcon'
123
123
  import fieldErrors from '../../../mixins/fieldErrors'
124
124
  import McTooltip from '../../McTooltip/McTooltip'
125
125
  import equalFieldHeight from '../../../mixins/equalFieldHeight'
126
+ import { LANGUAGES } from '../../../helpers/consts'
126
127
 
127
128
  export default {
128
129
  name: 'McFieldText',
@@ -376,7 +377,7 @@ export default {
376
377
  'mc-field-text--textarea-autosize': this.isTextareaAutosize,
377
378
  'mc-field-text--disabled': this.disabled,
378
379
  'mc-field-text--copy': this.copy,
379
- 'mc-field-text--rtl': ['ar'].includes(this.locale),
380
+ 'mc-field-text--rtl': LANGUAGES.rtl.includes(this.locale),
380
381
  }
381
382
  },
382
383
  computedTitle() {
@@ -0,0 +1,3 @@
1
+ export const LANGUAGES = {
2
+ rtl: ['ar'],
3
+ }
@@ -285,7 +285,7 @@ export default {
285
285
  ref: 'xTable',
286
286
  'context-menu': this.tableMenu,
287
287
  class: this.classes,
288
- 'sync-resize': this.cardIsOpen,
288
+ // 'sync-resize': this.cardIsOpen,
289
289
  'scroll-y': this.scrollY,
290
290
  'show-footer': this.canShowFooter,
291
291
  'footer-method': this.footerMethod,
@@ -376,7 +376,7 @@ export default {
376
376
  return this.$listeners['cell-click'] && this.contextMenu ? menu : false
377
377
  },
378
378
  columnsForFirstLoad() {
379
- return new Array(20).fill('').map(() => new Array(20).fill(''))
379
+ return new Array(20).fill('').map(() => new Array(30).fill(''))
380
380
  },
381
381
  },
382
382
  watch: {
@@ -384,21 +384,17 @@ export default {
384
384
  newValue && this.updateData()
385
385
  },
386
386
  totalFooter: {
387
- handler: async function(newVal) {
388
- newVal && (await this.loadData(true))
387
+ handler(newVal) {
388
+ newVal && this.loadData(true)
389
389
  },
390
390
  deep: true,
391
391
  },
392
392
  items: {
393
- handler: async function(newVal) {
394
- newVal && (await this.loadData(true))
395
- newVal && (await this.setFirstColsWidth())
393
+ handler(newVal) {
394
+ newVal && this.loadData(true)
396
395
  },
397
396
  deep: true,
398
397
  },
399
- cardIsOpen(newVal) {
400
- this.toggleColumns(newVal)
401
- },
402
398
  '$attrs.loading'() {
403
399
  this.checkHorizontalScroll()
404
400
  },
@@ -493,38 +489,15 @@ export default {
493
489
  this.observer && loader.length && this.observer.observe(loader[0])
494
490
  },
495
491
  setFirstColsWidth() {
496
- const columns = this.$refs.xTable.getColumns()
497
- const leftFixedColumnsWidth = columns.reduce((sum, curr) => {
498
- if (curr.fixed === 'left') {
499
- return sum + Number(curr.width || curr.minWidth)
500
- }
501
- return sum
502
- }, 0)
503
- if (leftFixedColumnsWidth) {
504
- this.firstColsWidth = leftFixedColumnsWidth + 5 // 5 - ширина скролла
505
- }
492
+ if (!this.api) return 0
493
+ const firstCol = this.api.getColumns().find(c => c.fixed === 'left')
494
+ this.firstColsWidth = +firstCol?.width || +firstCol?.minWidth || 0
506
495
  },
507
496
  toggleColumns(val) {
508
497
  if (val) {
509
- const columns = this.$refs.xTable.getColumns()
510
- let fixedColNeigbhorIndex
511
- const hideColumns = columns.filter((col, i) => {
512
- const isFixedCol = col.fixed === 'left'
513
- /**
514
- * Скрываем все столбцы кроме фиксированного и его соседа, чтобы не было рассинхрона при выходе из карточки
515
- * т.к. когда остается 1 столбец, то фикс - размаунтится, а потом при выходе из карточки перерендеривается
516
- * и скроллит в самый верх
517
- * */
518
- if (isFixedCol) fixedColNeigbhorIndex = i + 1
519
- switch (true) {
520
- case i === fixedColNeigbhorIndex:
521
- return
522
- default:
523
- return !isFixedCol
524
- }
525
- return !isFixedCol
498
+ this.api.getColumns().forEach(col => {
499
+ col.fixed !== 'left' && (col.visible = false)
526
500
  })
527
- hideColumns.forEach(col => (col.visible = false))
528
501
  this.$refs.xTable.refreshColumn()
529
502
  } else {
530
503
  this.$refs.xTable.resetColumn()
@@ -843,5 +816,13 @@ export default {
843
816
  background-position: 468px 0;
844
817
  }
845
818
  }
819
+ @keyframes placeHolderShimmer {
820
+ 0% {
821
+ background-position: -468px 0;
822
+ }
823
+ 100% {
824
+ background-position: 468px 0;
825
+ }
826
+ }
846
827
  }
847
828
  </style>