@lancom/shared 0.0.345 → 0.0.347

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.
@@ -552,6 +552,9 @@ export default {
552
552
  moveToWarehouseLocations(move) {
553
553
  return _post(`admin/warehouse-locations/move/bulk`, move);
554
554
  },
555
+ fetchPromodataProducts(params) {
556
+ return _get('admin/promodata-products', params);
557
+ },
555
558
  fetchWarehouseCanonicalProductsLocations(warehouse) {
556
559
  return _get(`admin/warehouses/${warehouse}/locations`);
557
560
  },
@@ -63,7 +63,7 @@
63
63
  name="sm"
64
64
  mode="down">
65
65
  <client-only>
66
- <editor-product-details />
66
+ <editor-product-details @add-design="addDesign()" />
67
67
  </client-only>
68
68
  </breakpoint>
69
69
  <breakpoint
@@ -79,7 +79,7 @@
79
79
  name="sm"
80
80
  mode="down">
81
81
  <client-only>
82
- <mobile-editor-product-details />
82
+ <mobile-editor-product-details ref="mobileDetails" />
83
83
  </client-only>
84
84
  </breakpoint>
85
85
  </div>
@@ -189,6 +189,9 @@ export default {
189
189
  'setSelectedTab'
190
190
  ]),
191
191
  ...mapMutations('layers', ['resetLayers']),
192
+ addDesign() {
193
+ this.$refs.mobileDetails.show('details');
194
+ },
192
195
  editorCurrentTabComponent(currentTab) {
193
196
  switch(currentTab) {
194
197
  case 'product':
@@ -100,6 +100,16 @@
100
100
  @media (max-width: $bp-extra-small-max) {
101
101
  display: block;
102
102
  }
103
+ &-placeholder {
104
+ top: -100px;
105
+ position: relative;
106
+ background: $green;
107
+ display: inline-block;
108
+ padding: 10px;
109
+ font-size: 13px;
110
+ font-weight: bold;
111
+ cursor: pointer;
112
+ }
103
113
  img {
104
114
  width: 100%;
105
115
  max-width: 330px;
@@ -114,6 +114,11 @@
114
114
  :fill-background="true"
115
115
  :origin-background="true"
116
116
  size="large" />
117
+ <div
118
+ class="EditorProductDetails__product-image-placeholder"
119
+ @click="$emit('add-design')">
120
+ ADD DESIGN
121
+ </div>
117
122
  <div
118
123
  class="EditorProductDetails__product-sides-toggle"
119
124
  @click="toggleSide">
@@ -74,6 +74,7 @@
74
74
  </transition>
75
75
  </div>
76
76
  <div
77
+ v-if="!isZoomIn"
77
78
  class="EditorWorkspace__sides-toggle"
78
79
  :class="{
79
80
  'EditorWorkspace__sides-toggle--fixed': isZoomIn
@@ -111,7 +111,7 @@ import { fabric } from 'fabric';
111
111
  import { mapGetters, mapMutations, mapActions } from 'vuex';
112
112
  import throttle from 'lodash.throttle';
113
113
  import debounce from 'lodash.debounce';
114
- import { getLargeColorImage } from '@lancom/shared/assets/js/utils/colors';
114
+ import { getLargeColorImage, getMediumColorImage } from '@lancom/shared/assets/js/utils/colors';
115
115
  import { COLORS_IMAGES_TYPES } from '@lancom/shared/assets/js/constants/colors';
116
116
  import FabricHelper from '@lancom/shared/assets/js/utils/fabric-helper';
117
117
  import { findParentByPredicate } from '@lancom/shared/assets/js/utils/dom';
@@ -145,7 +145,7 @@ export default {
145
145
  visibleWireframe: false,
146
146
  fabricHelper: null,
147
147
  redrawWithThrottle: throttle(this.redraw, 100, { trailing: false }),
148
- saveLayersAsImageWithDebounce: debounce(this.saveLayersAsImage, 100),
148
+ saveLayersAsImageWithDebounce: debounce(this.saveLayersAsImage, 400),
149
149
  onResize: debounce(this.handleWorkspaceSize, 1000),
150
150
  backgroundImage: null,
151
151
  backgroundImageUrl: null,
@@ -381,9 +381,12 @@ export default {
381
381
  return this.selectedLayer && this.selectedLayer.createdAt === layer.createdAt;
382
382
  },
383
383
  updateBackgroundImage() {
384
+ // console.log(this.calcWorkspaceSize(true));
385
+ const isMedium = this.calcWorkspaceSize(true) <= 400;
384
386
  const type = this.side === 'front' ? COLORS_IMAGES_TYPES.FRONT : COLORS_IMAGES_TYPES.BACK;
385
- const wireframeImageUrl = this.visibleWireframe && this.wireframeImage?.large;
386
- const imageUrl = wireframeImageUrl || getLargeColorImage(this.product, type, this.editableColor, false, ['wireframe']);
387
+ const wireframeImageUrl = this.visibleWireframe && (isMedium ? this.wireframeImage?.medium : this.wireframeImage?.large);
388
+ const getter = isMedium ? getMediumColorImage : getLargeColorImage;
389
+ const imageUrl = wireframeImageUrl || getter(this.product, type, this.editableColor, false, ['wireframe']);
387
390
  if (this.backgroundImage && this.backgroundImageUrl === imageUrl) {
388
391
  return this.fabricHelper.setBackgroundImage(this.backgroundImage);
389
392
  }
@@ -443,6 +446,6 @@ export default {
443
446
  };
444
447
  </script>
445
448
 
446
- <style lang="scss">
449
+ <style lang="scss" scoped>
447
450
  @import 'editor-workspace-side.scss';
448
451
  </style>
@@ -18,7 +18,7 @@
18
18
  height: 78px;
19
19
  z-index: 999999;
20
20
  display: grid;
21
- grid-template-columns: repeat(3, 1fr);
21
+ grid-template-columns: repeat(4, 1fr);
22
22
  background-color: $white_high_emphasis;
23
23
  box-shadow: 5px 0px 30px rgba(124, 124, 124, 0.1);
24
24
 
@@ -34,6 +34,9 @@
34
34
  flex-direction: column;
35
35
  font-size: 14px;
36
36
  }
37
+ &-label {
38
+ margin-top: 6px;
39
+ }
37
40
 
38
41
  &.active {
39
42
  color: $black;
@@ -10,7 +10,7 @@
10
10
  :has-pricing="false"
11
11
  @choose-products="chooseProducts()" />
12
12
  <div
13
- v-if="!!currentTab"
13
+ :class="{ active: !currentTab }"
14
14
  class="MobileEditorProductDetails__menu-action"
15
15
  @click="hide()">
16
16
  <i class="icon-blank MobileEditorProductDetails__menu-action-icon"></i>
@@ -19,7 +19,7 @@
19
19
  </span>
20
20
  </div>
21
21
  <div
22
- v-if="currentTab !== 'details'"
22
+ :class="{ active: currentTab === 'details' }"
23
23
  class="MobileEditorProductDetails__menu-action"
24
24
  @click="show('details')">
25
25
  <i class="icon-product MobileEditorProductDetails__menu-action-icon"></i>
@@ -28,7 +28,7 @@
28
28
  </span>
29
29
  </div>
30
30
  <div
31
- v-if="currentTab !== 'layers'"
31
+ :class="{ active: currentTab === 'layers' }"
32
32
  class="MobileEditorProductDetails__menu-action"
33
33
  @click="showLayers">
34
34
  <i class="icon-edit MobileEditorProductDetails__menu-action-icon"></i>
@@ -51,10 +51,7 @@
51
51
  </span>
52
52
  </div>
53
53
  </div>
54
- <transition-group
55
- appear
56
- name="appear-from-bottom"
57
- tag="div">
54
+ <div>
58
55
  <div
59
56
  v-if="isOpen"
60
57
  key="backdrop"
@@ -85,7 +82,7 @@
85
82
  :hasPricing="false" />
86
83
  </div>
87
84
  </div>
88
- </transition-group>
85
+ </div>
89
86
  </div>
90
87
  </template>
91
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.345",
3
+ "version": "0.0.347",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/product.js CHANGED
@@ -68,7 +68,10 @@ export const getters = {
68
68
  usedSimpleProductsQuantity: ({ template }) => (template.simpleProducts || []).filter(p => p.amount > 0).reduce((sum, { amount }) => sum + amount, 0),
69
69
  usedBigSizeSimpleProductsQuantity: (state, { usedSimpleProducts }) => filterBigSize(usedSimpleProducts).reduce((sum, { amount }) => sum + amount, 0),
70
70
  defaultSimpleProduct: ({ productDetails, editableColor }) => {
71
- return editableColor && productDetails.simpleProducts.find(({ color, size }) => color._id === editableColor._id && size.alias === 'small');
71
+ return editableColor && (
72
+ productDetails.simpleProducts.find(({ color, size }) => color._id === editableColor._id && size.alias === 'small')
73
+ || productDetails.simpleProducts.find(({ color }) => color._id === editableColor._id)
74
+ );
72
75
  },
73
76
  availableColors: ({ availableColors }) => availableColors,
74
77
  availableSizes: ({ availableSizes }) => availableSizes,
@@ -92,7 +95,7 @@ export const getters = {
92
95
  layersUpdatesCount: ({ layersUpdatesCount }) => layersUpdatesCount,
93
96
  printArea: ({ editablePrintArea, editorSize: { width, height }, product }) => {
94
97
  return getPrintAreaByName({
95
- printArea: editablePrintArea?._id,
98
+ printArea: editablePrintArea?.parentPrintArea || editablePrintArea?._id,
96
99
  printSize: editablePrintArea?.printSize,
97
100
  printAreaOffsets: editablePrintArea?.printAreaOffsets,
98
101
  editorWidth: width,