@lancom/shared 0.0.346 → 0.0.348
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/assets/js/api/admin.js +3 -0
- package/components/editor/editor.vue +5 -2
- package/components/editor/editor_product_details/editor-product-details.scss +10 -0
- package/components/editor/editor_product_details/editor-product-details.vue +5 -0
- package/components/editor/editor_workspace/editor-workspace.vue +1 -0
- package/components/editor/editor_workspace/editor_workspace_side/editor-workspace-side.vue +7 -4
- package/components/editor/mobile_editor_product_details/mobile-editor-product-details.vue +2 -5
- package/components/product/layouts/product_colors_selector/product_colors_selector_options/product-colors-selector-options.scss +3 -2
- package/components/product/product_color_image/product-color-image.vue +31 -0
- package/components/products/products_colors/products-colors.scss +2 -0
- package/package.json +1 -1
- package/store/product.js +5 -2
package/assets/js/api/admin.js
CHANGED
|
@@ -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">
|
|
@@ -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,
|
|
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
|
|
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
|
}
|
|
@@ -51,10 +51,7 @@
|
|
|
51
51
|
</span>
|
|
52
52
|
</div>
|
|
53
53
|
</div>
|
|
54
|
-
<
|
|
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
|
-
</
|
|
85
|
+
</div>
|
|
89
86
|
</div>
|
|
90
87
|
</template>
|
|
91
88
|
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
bottom: -4px;
|
|
24
24
|
left: -4px;
|
|
25
25
|
border-radius: 13px;
|
|
26
|
-
border: 2px solid $
|
|
27
|
-
transform: scale(
|
|
26
|
+
border: 2px solid $grey_4;
|
|
27
|
+
transform: scale(1);
|
|
28
28
|
transition: transform .22s ease-in-out;
|
|
29
29
|
}
|
|
30
30
|
&-inner {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
&.selected {
|
|
40
40
|
&:before {
|
|
41
41
|
transform: scale(1);
|
|
42
|
+
border: 2px solid $grey_1;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
&-selected-icon {
|
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
class="ProductColorImage"
|
|
4
4
|
:class="{ zoomedIn }"
|
|
5
5
|
:style="style">
|
|
6
|
+
<div
|
|
7
|
+
v-if="hasAdditionalColors"
|
|
8
|
+
:style="{
|
|
9
|
+
'top': additionalColorHeight,
|
|
10
|
+
width: '100%',
|
|
11
|
+
height: '100%',
|
|
12
|
+
position: 'relative'
|
|
13
|
+
}">
|
|
14
|
+
<div
|
|
15
|
+
v-for="(additionalColorsThumb, index) of additionalColorsThumbs"
|
|
16
|
+
:key="index"
|
|
17
|
+
:style="additionalColorsThumb">
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
6
20
|
</div>
|
|
7
21
|
</template>
|
|
8
22
|
|
|
@@ -32,6 +46,23 @@ export default {
|
|
|
32
46
|
},
|
|
33
47
|
style() {
|
|
34
48
|
return getColorBackgroundStyle(this.color);
|
|
49
|
+
},
|
|
50
|
+
hasAdditionalColors() {
|
|
51
|
+
return this.additionalColors.length > 0;
|
|
52
|
+
},
|
|
53
|
+
additionalColors() {
|
|
54
|
+
return (this.color.additionalColors || []);
|
|
55
|
+
},
|
|
56
|
+
additionalColorHeight() {
|
|
57
|
+
return `${100 / (this.additionalColors.length + 1)}%`;
|
|
58
|
+
},
|
|
59
|
+
additionalColorsThumbs() {
|
|
60
|
+
return (this.color.additionalColors || [])
|
|
61
|
+
.map(c => ({
|
|
62
|
+
...getColorBackgroundStyle(c.color || c),
|
|
63
|
+
height: this.additionalColorHeight,
|
|
64
|
+
width: '100%'
|
|
65
|
+
}))
|
|
35
66
|
}
|
|
36
67
|
}
|
|
37
68
|
};
|
package/package.json
CHANGED
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 &&
|
|
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,
|