@lancom/shared 0.0.454 → 0.0.457

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.
@@ -714,6 +714,18 @@ export default {
714
714
  removeProductColor(id) {
715
715
  return _delete(`admin/colors/${id}`);
716
716
  },
717
+ async fetchColorGroups() {
718
+ return sortByName(await _get('admin/color-groups'));
719
+ },
720
+ fetchColorGroupById(id) {
721
+ return _get(`admin/color-groups/${id}`);
722
+ },
723
+ saveColorGroup(colorGroup) {
724
+ return colorGroup._id ? _put(`admin/color-groups/${colorGroup._id}`, colorGroup) : _post('admin/color-groups', colorGroup);
725
+ },
726
+ removeColorGroup(id) {
727
+ return _delete(`admin/color-groups/${id}`);
728
+ },
717
729
  async fetchProductSizes() {
718
730
  return sortSizes(await _get('admin/sizes'));
719
731
  },
@@ -3,7 +3,8 @@ import debounce from 'lodash.debounce';
3
3
 
4
4
  class Breakpoints {
5
5
  screens = {
6
- mini: 448,
6
+ mini: 449,
7
+ xs: 450,
7
8
  sm: 768,
8
9
  md: 1024,
9
10
  lg: 1280,
@@ -48,7 +49,7 @@ class Breakpoints {
48
49
 
49
50
 
50
51
  isMini(val) {
51
- return val < this.screens.mini;
52
+ return val <= this.screens.mini;
52
53
  }
53
54
 
54
55
  isXs(val) {
@@ -451,7 +451,7 @@ export default {
451
451
  this.removeTemplateLayer(this.selectedLayer);
452
452
  },
453
453
  onOutsideClick() {
454
- if (this.addedFromCanvas && this.selectedLayer?.type === 'text' && !this.selectedLayer.copy) {
454
+ if (this.addedFromCanvas && this.selectedLayer?.type === 'text' && !this.selectedLayer.copy) {
455
455
  this.removeTemplateLayer(this.selectedLayer);
456
456
  }
457
457
  this.addedFromCanvas = false;
@@ -8,6 +8,13 @@
8
8
  background: white;
9
9
  left: 0;
10
10
  right: 0;
11
+ // min-height: 64px;
12
+ box-shadow: none !important;
13
+ border-radius: 0;
14
+ border: none;
15
+ .EditorPricing__clearance-messages {
16
+ display: none;
17
+ }
11
18
  }
12
19
  &__menu {
13
20
  position: fixed;
@@ -117,4 +124,4 @@
117
124
  overflow-y: auto;
118
125
  overflow-x: hidden;
119
126
  }
120
- }
127
+ }
@@ -79,7 +79,7 @@
79
79
  style="margin-top: 40px;" />
80
80
  <editor-layers
81
81
  v-show="currentTab === 'layers'"
82
- :hasPricing="false" />
82
+ :has-pricing="false" />
83
83
  </div>
84
84
  </div>
85
85
  </div>
@@ -101,6 +101,12 @@ const { mapMutations, mapGetters } = createNamespacedHelpers('product');
101
101
  export default {
102
102
  name: 'MobileEditorProductDetails',
103
103
  mixins: [addToCartMixin],
104
+ props: {
105
+ isEditMode: {
106
+ type: Boolean,
107
+ default: true
108
+ }
109
+ },
104
110
  components: {
105
111
  EditorWorkspace,
106
112
  EditorLayers,
@@ -156,14 +162,14 @@ export default {
156
162
 
157
163
  const prevTab = this.currentTab;
158
164
 
159
- if (this.isOpen) {
165
+ if (this.isOpen && this.isEditMode) {
160
166
  this.hide(true);
161
167
  }
162
168
 
163
169
  this.$nextTick(() => {
164
170
  this.isOpen = true;
165
171
 
166
- if(tab === 'layers') {
172
+ if (!this.isEditMode && tab === 'layers') {
167
173
  this.setEditModeSelectedLayer(false);
168
174
  }
169
175
 
@@ -1,3 +1,5 @@
1
+ @import "@/assets/scss/variables";
2
+
1
3
  .ProductPricingTiers {
2
4
  &__title {
3
5
  color: #0A0A0A;
@@ -21,6 +23,9 @@
21
23
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.10), 0 2px 4px -2px rgba(0, 0, 0, 0.10);
22
24
  cursor: pointer;
23
25
  transition: all 0.3s ease;
26
+ @media (max-width: $bp-extra-small-max) {
27
+ width: 132px;
28
+ }
24
29
  &:hover {
25
30
  transform: translateY(-3px);
26
31
  box-shadow: 0 4px 8px -1px rgba(0, 0, 0, 0.30), 0 2px 4px -2px rgba(0, 0, 0, 0.30);
@@ -35,11 +40,20 @@
35
40
  font-weight: 600;
36
41
  line-height: 28px;
37
42
  text-align: center;
43
+ @media (max-width: $bp-extra-small-max) {
44
+ padding: 8px 0;
45
+ font-size: 12px;
46
+ line-height: 20px;
47
+ }
38
48
  span {
39
49
  color: #194BB3;
40
50
  font-size: 18px;
41
51
  font-weight: 700;
42
52
  line-height: 28px;
53
+ @media (max-width: $bp-extra-small-max) {
54
+ font-size: 14px;
55
+ line-height: 20px;
56
+ }
43
57
  }
44
58
  }
45
59
  &-price {
@@ -50,11 +64,21 @@
50
64
  margin-top: 6px;
51
65
  padding: 4px;
52
66
  text-align: center;
67
+ @media (max-width: $bp-extra-small-max) {
68
+ font-size: 10px;
69
+ line-height: 16px;
70
+ margin-top: 4px;
71
+ padding: 2px;
72
+ }
53
73
  span {
54
74
  color: #194BB3;
55
75
  font-size: 12px;
56
76
  font-weight: 700;
57
77
  line-height: 20px;
78
+ @media (max-width: $bp-extra-small-max) {
79
+ font-size: 10px;
80
+ line-height: 16px;
81
+ }
58
82
  }
59
83
  }
60
84
  }
@@ -37,8 +37,11 @@
37
37
  :has-selected-icon="hasSelectedIcon"
38
38
  :selected-icon-circle="selectedIconCircle" />
39
39
  </div>
40
- <div class="ProductsAside__item">
40
+ <!-- <div class="ProductsAside__item">
41
41
  <products-colors />
42
+ </div> -->
43
+ <div class="ProductsAside__item">
44
+ <products-color-groups />
42
45
  </div>
43
46
  <div class="ProductsAside__item">
44
47
  <products-attributes
@@ -57,7 +60,8 @@ import { mapGetters } from 'vuex';
57
60
  import ProductsBrands from '@lancom/shared/components/products/products_brands/products-brands';
58
61
  import ProductsTags from '@lancom/shared/components/products/products_tags/products-tags';
59
62
  import ProductsAttributes from '@lancom/shared/components/products/products_attributes/products-attributes';
60
- import ProductsColors from '@lancom/shared/components/products/products_colors/products-colors';
63
+ // import ProductsColors from '@lancom/shared/components/products/products_colors/products-colors';
64
+ import ProductsColorGroups from '@lancom/shared/components/products/products_color_groups/products-color-groups';
61
65
  import ProductsProductionTime from '@lancom/shared/components/products/products_production_time/products-production-time';
62
66
  import ProductsMinimumQty from '@lancom/shared/components/products/products_minimum_qty/products-minimum-qty';
63
67
  import { generateProductsLink } from '@lancom/shared/assets/js/utils/product';
@@ -69,7 +73,8 @@ export default {
69
73
  ProductsBrands,
70
74
  ProductsTags,
71
75
  ProductsAttributes,
72
- ProductsColors,
76
+ // ProductsColors,
77
+ ProductsColorGroups,
73
78
  ProductsProductionTime,
74
79
  ProductsMinimumQty
75
80
  },
@@ -0,0 +1,69 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .ProductsColorGroups {
4
+ &__header {
5
+ font-size: 22px;
6
+ line-height: 20px;
7
+ font-weight: 600;
8
+ margin-top: 3px;
9
+ margin-bottom: 24px;
10
+ color: $black;
11
+ }
12
+ &__selected-item {
13
+ display: flex;
14
+ align-items: center;
15
+ font-size: 12px;
16
+ font-weight: bold;
17
+ margin: 12px 0;
18
+ padding-top: 4px;
19
+ color: $grey_1;
20
+ i {
21
+ font-size: 22px;
22
+ }
23
+ a {
24
+ color: $grey_1;
25
+ }
26
+ }
27
+ &__selected-name {
28
+ flex-grow: 1;
29
+ margin-left: 14px;
30
+ text-transform: uppercase;
31
+ }
32
+ &__selected-cancel {
33
+ cursor: pointer;
34
+ }
35
+ &__color-group {
36
+ padding: 2px;
37
+ border: 2px solid $white;
38
+ width: 36px;
39
+ height: 36px;
40
+ border-radius: 13px;
41
+ overflow: hidden;
42
+ flex-shrink: 0;
43
+ &-image {
44
+ width: 100%;
45
+ height: 100%;
46
+ border-radius: 11px;
47
+ overflow: hidden;
48
+ }
49
+ &--selected {
50
+ border: 2px solid $grey_1;
51
+ }
52
+ }
53
+ &__items {
54
+ display: flex;
55
+ flex-wrap: wrap;
56
+ margin-top: 20px;
57
+ margin-left: -5px;
58
+ &-color-group {
59
+ margin: 1px 4px;
60
+ }
61
+ }
62
+ &__toggle-list {
63
+ margin-top: 5px;
64
+ margin-right: 10px;
65
+ font-size: 11px;
66
+ cursor: pointer;
67
+ text-align: right;
68
+ }
69
+ }
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <div class="ProductsColorGroups__wrapper">
3
+ <toggle-content label="Colour Groups">
4
+ <div class="ProductsColorGroups__selected">
5
+ <div
6
+ v-for="colorGroup in selectedColorGroups"
7
+ :key="colorGroup._id"
8
+ class="ProductsColorGroups__selected-item">
9
+ <div class="ProductsColorGroups__color-group ProductsColorGroups__color-group--selected">
10
+ <product-color-image
11
+ :color="colorGroup"
12
+ class="ProductsColorGroups__color-group-image" />
13
+ </div>
14
+ <div class="ProductsColorGroups__selected-name">
15
+ {{ colorGroup.name }}
16
+ </div>
17
+ <products-link :color-group="colorGroup.alias">
18
+ <i class="icon-cancel ProductsColorGroups__selected-cancel"></i>
19
+ </products-link>
20
+ </div>
21
+ </div>
22
+ <div class="ProductsColorGroups__items">
23
+ <products-link
24
+ v-for="colorGroup in visibleColorGroups"
25
+ :key="colorGroup._id"
26
+ v-tooltip="colorGroup.name"
27
+ :color-group="colorGroup.alias">
28
+ <div
29
+ class="ProductsColorGroups__items-color-group ProductsColorGroups__color-group"
30
+ :class="{
31
+ 'ProductsColorGroups__color-group--selected': isSelectedColorGroup(colorGroup)
32
+ }">
33
+ <product-color-image
34
+ v-if="canLoadImages"
35
+ :color="colorGroup"
36
+ class="ProductsColorGroups__color-group-image" />
37
+ </div>
38
+ </products-link>
39
+ </div>
40
+ <div
41
+ v-if="shortListColorGroupsLimit < colorGroupsCount"
42
+ @click="toggleDisplayAllColorGroups()"
43
+ class="ProductsColorGroups__toggle-list">
44
+ {{ displayAllColorGroups ? 'Hide all colour groups' : 'Show all colour groups' }}
45
+ </div>
46
+ </toggle-content>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import { mapGetters } from 'vuex';
52
+ import ToggleContent from '@lancom/shared/components/common/toggle-content';
53
+ import ProductsLink from '@lancom/shared/components/products/products_link/products-link';
54
+ import ProductColorImage from '@lancom/shared/components/product/product_color_image/product-color-image';
55
+
56
+ export default {
57
+ name: 'ProductsColorGroups',
58
+ components: {
59
+ ProductColorImage,
60
+ ProductsLink,
61
+ ToggleContent
62
+ },
63
+ data() {
64
+ return {
65
+ canLoadImages: false,
66
+ displayAllColorGroups: false,
67
+ shortListColorGroupsLimit: 15
68
+ };
69
+ },
70
+ computed: {
71
+ ...mapGetters('products', ['colorGroups']),
72
+ colorGroupsCount() {
73
+ return this.colorGroups.length;
74
+ },
75
+ selectedColorGroups() {
76
+ const colorGroups = (this.$route.query.colorGroups || '').split(',');
77
+ return this.colorGroups.filter(colorGroup => colorGroups.includes(colorGroup.alias));
78
+ },
79
+ visibleColorGroups() {
80
+ return this.displayAllColorGroups ? this.colorGroups : this.colorGroups.slice(0, this.shortListColorGroupsLimit);
81
+ }
82
+ },
83
+ mounted() {
84
+ setTimeout(() => {
85
+ this.canLoadImages = true;
86
+ }, 1000);
87
+ },
88
+ methods: {
89
+ isSelectedColorGroup(colorGroup) {
90
+ return this.selectedColorGroups.some(cg => cg._id === colorGroup._id);
91
+ },
92
+ toggleDisplayAllColorGroups() {
93
+ this.displayAllColorGroups = !this.displayAllColorGroups;
94
+ }
95
+ }
96
+ };
97
+ </script>
98
+
99
+ <style lang="scss" scoped>
100
+ @import 'products-color-groups';
101
+ </style>
@@ -27,6 +27,9 @@ export default {
27
27
  color: {
28
28
  type: String
29
29
  },
30
+ colorGroup: {
31
+ type: String
32
+ },
30
33
  productionTime: {
31
34
  type: String
32
35
  },
@@ -51,6 +54,7 @@ export default {
51
54
  brand: this.brand,
52
55
  tags: this.tags,
53
56
  colors: this.color,
57
+ colorGroups: this.colorGroup,
54
58
  productionTime: this.productionTime,
55
59
  minimumQty: this.minimumQty,
56
60
  option: this.option,
@@ -34,6 +34,13 @@
34
34
  z-index: 200;
35
35
  transition: opacity .16s cubic-bezier(0.23, 1, 0.32, 1);
36
36
  }
37
+ &__close {
38
+ position: absolute;
39
+ right: 10px;
40
+ top: 40px;
41
+ font-weight: bold;
42
+ font-size: 20px;
43
+ }
37
44
  }
38
45
 
39
46
  .TheAside__container,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.454",
3
+ "version": "0.0.457",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/products.js CHANGED
@@ -9,6 +9,7 @@ export const state = () => ({
9
9
  maxPrice: 0,
10
10
  types: [],
11
11
  colors: [],
12
+ colorGroups: [],
12
13
  brands: [],
13
14
  category: null,
14
15
  categories: [],
@@ -23,6 +24,7 @@ export const getters = {
23
24
  products: ({ products }) => products,
24
25
  types: ({ types }) => types || [],
25
26
  colors: ({ colors }) => colors || [],
27
+ colorGroups: ({ colorGroups }) => colorGroups || [],
26
28
  brands: ({ brands }) => brands || [],
27
29
  categories: ({ categories }) => categories || [],
28
30
  category: ({ category }) => category,
@@ -51,7 +53,7 @@ export const actions = {
51
53
  try {
52
54
  commit('setLoadError', null);
53
55
  const {
54
- products, count, page, perPage, productTypes, colors, brands, tags, attributes,
56
+ products, count, page, perPage, productTypes, colors, colorGroups, brands, tags, attributes,
55
57
  categories, minPrice, maxPrice, category
56
58
  } = await api.fetchProducts(shop, params);
57
59
  commit('setProducts', products);
@@ -60,6 +62,7 @@ export const actions = {
60
62
  commit('setPerPage', perPage);
61
63
  commit('setTypes', productTypes);
62
64
  commit('setColors', colors);
65
+ commit('setColorGroups', colorGroups);
63
66
  commit('setBrands', brands);
64
67
  commit('setCategories', categories);
65
68
  commit('setCategory', category);
@@ -118,6 +121,9 @@ export const mutations = {
118
121
  setColors(state, colors) {
119
122
  state.colors = colors;
120
123
  },
124
+ setColorGroups(state, colorGroups) {
125
+ state.colorGroups = colorGroups;
126
+ },
121
127
  setMinPrice(state, minPrice) {
122
128
  state.minPrice = minPrice;
123
129
  },