@lancom/shared 0.0.451 → 0.0.453
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/helpers.js +1 -1
- package/assets/js/api/index.js +3 -0
- package/assets/js/utils/fabric/selection-style.js +6 -5
- package/assets/js/utils/fabric-helper.js +5 -12
- package/components/editor/editor_workspace/editor_workspace_side/editor-workspace-side.vue +7 -6
- package/components/product/other_products/other-products.vue +7 -5
- package/mixins/product-view.js +3 -2
- package/package.json +2 -1
package/assets/js/api/helpers.js
CHANGED
|
@@ -18,7 +18,7 @@ if (process.client) {
|
|
|
18
18
|
axiosApiInstance.interceptors.response.use(
|
|
19
19
|
response => response,
|
|
20
20
|
error => {
|
|
21
|
-
if (error.response
|
|
21
|
+
if (error.response?.status === 401) {
|
|
22
22
|
removeAuthToken();
|
|
23
23
|
const currentPath = window.location.pathname;
|
|
24
24
|
if (currentPath && currentPath !== '/') {
|
package/assets/js/api/index.js
CHANGED
|
@@ -96,6 +96,9 @@ const api = {
|
|
|
96
96
|
fetchRelatedProducts(shop, alias, params) {
|
|
97
97
|
return _get(`shop/${shop}/products/${alias}/related-products`, params);
|
|
98
98
|
},
|
|
99
|
+
fetchOtherProducts(shop, alias, params) {
|
|
100
|
+
return _get(`shop/${shop}/products/${alias}/other-products`, params);
|
|
101
|
+
},
|
|
99
102
|
fetchHelpMessages(shop, group) {
|
|
100
103
|
return _get(`shop/${shop}/help-messages/${group}`);
|
|
101
104
|
},
|
|
@@ -49,20 +49,21 @@ export function setupCustomControls(fabricHelper) {
|
|
|
49
49
|
['tl', 'bl', 'br'].forEach(key => {
|
|
50
50
|
fabric.Object.prototype.controls[key].sizeX = 7;
|
|
51
51
|
fabric.Object.prototype.controls[key].sizeY = 7;
|
|
52
|
+
fabric.Object.prototype.controls[key].actionName = 'scaling';
|
|
52
53
|
});
|
|
53
54
|
|
|
54
55
|
fabric.Object.prototype.controls.tr = new fabric.Control({
|
|
55
56
|
x: 0.5,
|
|
56
57
|
y: -0.5,
|
|
57
58
|
cursorStyle: 'pointer',
|
|
58
|
-
mouseUpHandler
|
|
59
|
+
mouseUpHandler(eventData, transform) {
|
|
59
60
|
const target = transform.target;
|
|
60
61
|
fabricHelper.dispatch('removeLayer', target.layer);
|
|
61
62
|
fabricHelper.editor.remove(target);
|
|
62
63
|
fabricHelper.editor.renderAll();
|
|
63
64
|
return true;
|
|
64
65
|
},
|
|
65
|
-
render
|
|
66
|
+
render(ctx, left, top, styleOverride, fabricObject) {
|
|
66
67
|
const size = 10;
|
|
67
68
|
ctx.save();
|
|
68
69
|
ctx.translate(left, top);
|
|
@@ -91,7 +92,7 @@ export function setupCustomControls(fabricHelper) {
|
|
|
91
92
|
cursorStyle: 'pointer',
|
|
92
93
|
actionHandler: fabric.controlsUtils.rotationWithSnapping,
|
|
93
94
|
actionName: 'rotate',
|
|
94
|
-
render
|
|
95
|
+
render(ctx, left, top, styleOverride, fabricObject) {
|
|
95
96
|
if (rotateImg) {
|
|
96
97
|
renderIcon(ctx, left, top, styleOverride, fabricObject, rotateImg);
|
|
97
98
|
}
|
|
@@ -106,7 +107,7 @@ export function setupCustomControls(fabricHelper) {
|
|
|
106
107
|
offsetY: -30,
|
|
107
108
|
offsetX: 30,
|
|
108
109
|
cursorStyle: 'pointer',
|
|
109
|
-
mouseUpHandler
|
|
110
|
+
mouseUpHandler(eventData, transform) {
|
|
110
111
|
const target = transform.target;
|
|
111
112
|
const helper = fabricHelper;
|
|
112
113
|
|
|
@@ -134,7 +135,7 @@ export function setupCustomControls(fabricHelper) {
|
|
|
134
135
|
|
|
135
136
|
return true;
|
|
136
137
|
},
|
|
137
|
-
render
|
|
138
|
+
render(ctx, left, top, styleOverride, fabricObject) {
|
|
138
139
|
if (centerImg) {
|
|
139
140
|
renderIcon(ctx, left, top, styleOverride, fabricObject, centerImg);
|
|
140
141
|
} else {
|
|
@@ -275,13 +275,7 @@ export default class FabricHelper {
|
|
|
275
275
|
object.on('rotating', () => {
|
|
276
276
|
this.dispatch('setField', { field: 'angle', value: parseInt(object.angle) });
|
|
277
277
|
});
|
|
278
|
-
object.on('moved', () => {
|
|
279
|
-
this.dispatch('setField', { field: 'top', value: Math.round(object.top) });
|
|
280
|
-
this.dispatch('setField', { field: 'left', value: Math.round(object.left) });
|
|
281
|
-
});
|
|
282
|
-
object.on('moving', () => this.checkBoundingIntersection(object));
|
|
283
278
|
object.on('scaling', () => {
|
|
284
|
-
this.checkBoundingIntersection(object);
|
|
285
279
|
if (object.type === 'art') {
|
|
286
280
|
const measure = this.getEditorDPI();
|
|
287
281
|
const originalRatio = object.originalSize.width / object.width;
|
|
@@ -290,17 +284,16 @@ export default class FabricHelper {
|
|
|
290
284
|
}
|
|
291
285
|
});
|
|
292
286
|
|
|
293
|
-
object.on('
|
|
294
|
-
this.dispatch('setField', { field: '
|
|
295
|
-
|
|
296
|
-
object.on('moved', () => {
|
|
287
|
+
object.on('modified', () => {
|
|
288
|
+
this.dispatch('setField', { field: 'top', value: Math.round(object.top) });
|
|
289
|
+
this.dispatch('setField', { field: 'left', value: Math.round(object.left) });
|
|
297
290
|
this.dispatch('setField', { field: 'boundingRect', value: object.getBoundingRect() });
|
|
298
291
|
});
|
|
299
292
|
/*
|
|
300
293
|
** TEXT OBJECT EVENTS
|
|
301
294
|
*/
|
|
302
295
|
if (type === 'text') {
|
|
303
|
-
object.on('
|
|
296
|
+
object.on('modified', target => {
|
|
304
297
|
const fontSize = Math.round(object.fontSize * object.scaleX);
|
|
305
298
|
// const strokeWidth = Math.round(object.strokeWidth * object.scaleX);
|
|
306
299
|
this.dispatch('setField', { field: 'fontSize', value: fontSize });
|
|
@@ -331,7 +324,7 @@ export default class FabricHelper {
|
|
|
331
324
|
** ART OBJECT EVENTS
|
|
332
325
|
*/
|
|
333
326
|
if (type === 'art') {
|
|
334
|
-
object.on('
|
|
327
|
+
object.on('modified', () => {
|
|
335
328
|
this.dispatch('setField', { field: 'scaleX', value: object.scaleX });
|
|
336
329
|
this.dispatch('setField', { field: 'scaleY', value: object.scaleY });
|
|
337
330
|
});
|
|
@@ -386,11 +386,12 @@ export default {
|
|
|
386
386
|
});
|
|
387
387
|
this.fabricHelper.on('removeLayer', (layer) => {
|
|
388
388
|
setTimeout(() => {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
389
|
+
this.removeTemplateLayer(layer);
|
|
390
|
+
// if (!this.editModeSelectedLayer) {
|
|
391
|
+
// this.removeTemplateLayer(layer);
|
|
392
|
+
// } else if (!layer.copy) {
|
|
393
|
+
// this.fabricHelper.dispatch('setField', { field: 'isEditMode', value: false });;
|
|
394
|
+
// }
|
|
394
395
|
}, 100);
|
|
395
396
|
});
|
|
396
397
|
this.fabricHelper.on('outOfPrintArea', this.setOffsetWarningVisibility);
|
|
@@ -462,7 +463,7 @@ export default {
|
|
|
462
463
|
async createTextLayer() {
|
|
463
464
|
this.addedFromCanvas = true;
|
|
464
465
|
window.scrollTo(0, 0);
|
|
465
|
-
const layer = await this.createLayer({ type: 'text', isEditMode: this.isEditMode });
|
|
466
|
+
const layer = this.printAreaLayers?.length > 0 ? this.printAreaLayers[0] : (await this.createLayer({ type: 'text', isEditMode: this.isEditMode }));
|
|
466
467
|
this.visibleWireframe = true;
|
|
467
468
|
if (!this.isEditMode) {
|
|
468
469
|
setTimeout(() => {
|
|
@@ -29,9 +29,13 @@ export default {
|
|
|
29
29
|
OtherProduct
|
|
30
30
|
},
|
|
31
31
|
props: {
|
|
32
|
-
|
|
32
|
+
product: {
|
|
33
33
|
type: Object,
|
|
34
|
-
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
toEditor: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
35
39
|
},
|
|
36
40
|
limit: {
|
|
37
41
|
type: Number,
|
|
@@ -55,13 +59,11 @@ export default {
|
|
|
55
59
|
try {
|
|
56
60
|
this.loading = true;
|
|
57
61
|
const condition = {
|
|
58
|
-
...this.additionalCondition,
|
|
59
62
|
country: this.country?._id,
|
|
60
63
|
currency: this.currency?._id,
|
|
61
64
|
limit: this.limit
|
|
62
65
|
};
|
|
63
|
-
this.products = (await api.
|
|
64
|
-
console.log('this.products: ', this.products);
|
|
66
|
+
this.products = (await api.fetchOtherProducts(this.shop._id, this.product.alias, condition)).products;
|
|
65
67
|
} catch (e) {
|
|
66
68
|
} finally {
|
|
67
69
|
this.loading = false;
|
package/mixins/product-view.js
CHANGED
|
@@ -125,7 +125,8 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
|
|
|
125
125
|
return (thumbProductImages.length > 0 ? thumbProductImages : this.images).slice(0, 6);
|
|
126
126
|
},
|
|
127
127
|
mainProductImageSrc() {
|
|
128
|
-
|
|
128
|
+
const image = (this.isEditor && this.mainProductImage.extralarge) || this.mainProductImage.large;
|
|
129
|
+
return this.mainProductImage && staticLink(image);
|
|
129
130
|
},
|
|
130
131
|
mainProductImageStyles() {
|
|
131
132
|
return this.mainProductImageSrc ? { 'background-image': `url(${this.mainProductImageSrc});` } : {};
|
|
@@ -342,7 +343,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
|
|
|
342
343
|
if (brand) {
|
|
343
344
|
productSchema.brand = {
|
|
344
345
|
'@type': 'Brand',
|
|
345
|
-
logo: staticLink(brand.logo),
|
|
346
|
+
logo: staticLink(brand.smallLogo || brand.logo),
|
|
346
347
|
name: brand.name
|
|
347
348
|
};
|
|
348
349
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lancom/shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.453",
|
|
4
4
|
"description": "lancom common scripts",
|
|
5
5
|
"author": "e.tokovenko <e.tokovenko@gmail.com>",
|
|
6
6
|
"repository": {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"homepage": "https://bitbucket.org/simpletee/lancom-shared#readme",
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"axios": "0.21.4",
|
|
13
14
|
"basic-auth": "^2.0.1",
|
|
14
15
|
"lodash.get": "^4.4.2",
|
|
15
16
|
"nuxt-client-init-module": "^0.3.0",
|