@visns-studio/visns-components 4.10.47 → 5.0.0
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/package.json +28 -30
- package/src/components/cms/Field.jsx +39 -63
- package/src/components/crm/Breadcrumb.jsx +2 -18
- package/src/components/crm/DataGrid.jsx +23 -379
- package/src/components/crm/Field.jsx +16 -215
- package/src/components/crm/Form.jsx +81 -79
- package/src/components/crm/MultiSelect.jsx +25 -71
- package/src/components/crm/Navigation.jsx +7 -11
- package/src/components/crm/QrCode.jsx +8 -12
- package/src/components/crm/QuickAction.jsx +1 -0
- package/src/components/crm/generic/GenericAuth.jsx +2 -6
- package/src/components/crm/generic/GenericDashboard.jsx +30 -340
- package/src/components/crm/generic/GenericDetail.jsx +37 -80
- package/src/components/crm/generic/GenericDynamic.jsx +76 -94
- package/src/components/crm/generic/GenericFormBuilder.jsx +19 -79
- package/src/components/crm/generic/GenericIndex.jsx +1 -2
- package/src/components/crm/generic/styles/GenericDetail.module.scss +0 -51
- package/src/components/crm/generic/styles/GenericFormBuilder.module.scss +0 -5
- package/src/components/crm/styles/DataGrid.module.scss +25 -0
- package/src/components/crm/styles/Field.module.scss +0 -210
- package/src/components/crm/styles/Form.module.scss +0 -78
- package/src/components/crm/styles/Navigation.module.scss +4 -10
- package/src/components/crm/styles/QrCode.module.scss +0 -18
- package/src/index.js +0 -8
- package/src/components/crm/generic/styles/GenericDashboard.module.scss +0 -325
- package/src/components/crm/sketch/SketchField.jsx +0 -395
- package/src/components/crm/sketch/arrow.jsx +0 -108
- package/src/components/crm/sketch/circle.jsx +0 -75
- package/src/components/crm/sketch/default-tool.jsx +0 -16
- package/src/components/crm/sketch/fabrictool.jsx +0 -22
- package/src/components/crm/sketch/history.jsx +0 -144
- package/src/components/crm/sketch/json/config.json +0 -14
- package/src/components/crm/sketch/line.jsx +0 -64
- package/src/components/crm/sketch/pan.jsx +0 -48
- package/src/components/crm/sketch/pencil.jsx +0 -36
- package/src/components/crm/sketch/rectangle-label-object.jsx +0 -69
- package/src/components/crm/sketch/rectangle-label.jsx +0 -93
- package/src/components/crm/sketch/rectangle.jsx +0 -76
- package/src/components/crm/sketch/select.jsx +0 -16
- package/src/components/crm/sketch/tools.jsx +0 -11
- package/src/components/crm/sketch/utils.jsx +0 -67
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import FabricCanvasTool from './fabrictool';
|
|
2
|
-
import { Rect as FabricRect } from 'fabric'; // Import Rect specifically for Fabric v6
|
|
3
|
-
|
|
4
|
-
class Rectangle extends FabricCanvasTool {
|
|
5
|
-
configureCanvas(props) {
|
|
6
|
-
const canvas = this._canvas;
|
|
7
|
-
|
|
8
|
-
// Disable drawing mode and selection for other objects
|
|
9
|
-
canvas.isDrawingMode = false;
|
|
10
|
-
canvas.selection = false;
|
|
11
|
-
canvas.forEachObject((o) => {
|
|
12
|
-
o.selectable = false;
|
|
13
|
-
o.evented = false;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// Set rectangle drawing properties
|
|
17
|
-
this._width = props.lineWidth || 1;
|
|
18
|
-
this._color = props.lineColor || 'black';
|
|
19
|
-
this._fill = props.fillColor || 'transparent';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
doMouseDown(o) {
|
|
23
|
-
const canvas = this._canvas;
|
|
24
|
-
this.isDown = true;
|
|
25
|
-
|
|
26
|
-
// Get initial pointer position for rectangle start
|
|
27
|
-
const pointer = canvas.getPointer(o.e);
|
|
28
|
-
this.startX = pointer.x;
|
|
29
|
-
this.startY = pointer.y;
|
|
30
|
-
|
|
31
|
-
// Create a new rectangle at the start position
|
|
32
|
-
this.rect = new FabricRect({
|
|
33
|
-
left: this.startX,
|
|
34
|
-
top: this.startY,
|
|
35
|
-
originX: 'left',
|
|
36
|
-
originY: 'top',
|
|
37
|
-
width: 0, // Initial width, will expand in doMouseMove
|
|
38
|
-
height: 0, // Initial height, will expand in doMouseMove
|
|
39
|
-
stroke: this._color,
|
|
40
|
-
strokeWidth: this._width,
|
|
41
|
-
fill: this._fill,
|
|
42
|
-
transparentCorners: false,
|
|
43
|
-
selectable: false,
|
|
44
|
-
evented: false,
|
|
45
|
-
strokeUniform: true,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Add rectangle to the canvas
|
|
49
|
-
canvas.add(this.rect);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
doMouseMove(o) {
|
|
53
|
-
if (!this.isDown) return;
|
|
54
|
-
const canvas = this._canvas;
|
|
55
|
-
const pointer = canvas.getPointer(o.e);
|
|
56
|
-
|
|
57
|
-
// Set rectangle dimensions based on pointer movement
|
|
58
|
-
this.rect.set({
|
|
59
|
-
left: Math.min(this.startX, pointer.x),
|
|
60
|
-
top: Math.min(this.startY, pointer.y),
|
|
61
|
-
width: Math.abs(this.startX - pointer.x),
|
|
62
|
-
height: Math.abs(this.startY - pointer.y),
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
this.rect.setCoords();
|
|
66
|
-
|
|
67
|
-
// Render the canvas to show the updated rectangle
|
|
68
|
-
canvas.requestRenderAll();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
doMouseUp() {
|
|
72
|
-
this.isDown = false;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export default Rectangle;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*eslint no-unused-vars: 0*/
|
|
2
|
-
|
|
3
|
-
import FabricCanvasTool from './fabrictool';
|
|
4
|
-
|
|
5
|
-
class Select extends FabricCanvasTool {
|
|
6
|
-
configureCanvas(props) {
|
|
7
|
-
let canvas = this._canvas;
|
|
8
|
-
canvas.isDrawingMode = false;
|
|
9
|
-
canvas.selection = true;
|
|
10
|
-
canvas.forEachObject((o) => {
|
|
11
|
-
o.selectable = o.evented = true;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default Select;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determine the mouse position
|
|
3
|
-
*
|
|
4
|
-
* @param event the canvas event
|
|
5
|
-
* @returns *[] tuple of position x,y
|
|
6
|
-
* @private
|
|
7
|
-
*/
|
|
8
|
-
export const pointerPosition = (event) => {
|
|
9
|
-
event = event || window.event;
|
|
10
|
-
var target = event.target || event.srcElement,
|
|
11
|
-
style = target.currentStyle || window.getComputedStyle(target, null),
|
|
12
|
-
borderLeftWidth = parseInt(style['borderLeftWidth'], 10),
|
|
13
|
-
borderTopWidth = parseInt(style['borderTopWidth'], 10),
|
|
14
|
-
rect = target.getBoundingClientRect(),
|
|
15
|
-
_x = event.clientX - borderLeftWidth - rect.left,
|
|
16
|
-
_y = event.clientY - borderTopWidth - rect.top,
|
|
17
|
-
_touchX = event.changedTouches
|
|
18
|
-
? event.changedTouches[0].clientX - borderLeftWidth - rect.left
|
|
19
|
-
: null,
|
|
20
|
-
_touchY = event.changedTouches
|
|
21
|
-
? event.changedTouches[0].clientY - borderTopWidth - rect.top
|
|
22
|
-
: null;
|
|
23
|
-
return [_x || _touchX, _y || _touchY];
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Calculate the distance of two x,y points
|
|
28
|
-
*
|
|
29
|
-
* @param point1 an object with x,y attributes representing the start point
|
|
30
|
-
* @param point2 an object with x,y attributes representing the end point
|
|
31
|
-
*
|
|
32
|
-
* @returns {number}
|
|
33
|
-
*/
|
|
34
|
-
export const linearDistance = (point1, point2) => {
|
|
35
|
-
let xs = point2.x - point1.x;
|
|
36
|
-
let ys = point2.y - point1.y;
|
|
37
|
-
return Math.sqrt(xs * xs + ys * ys);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Return a random uuid of the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
|
|
42
|
-
* @returns {string}
|
|
43
|
-
*/
|
|
44
|
-
export const uuid4 = () => {
|
|
45
|
-
let uuid = '',
|
|
46
|
-
ii;
|
|
47
|
-
for (ii = 0; ii < 32; ii += 1) {
|
|
48
|
-
switch (ii) {
|
|
49
|
-
case 8:
|
|
50
|
-
case 20:
|
|
51
|
-
uuid += '-';
|
|
52
|
-
uuid += ((Math.random() * 16) | 0).toString(16);
|
|
53
|
-
break;
|
|
54
|
-
case 12:
|
|
55
|
-
uuid += '-';
|
|
56
|
-
uuid += '4';
|
|
57
|
-
break;
|
|
58
|
-
case 16:
|
|
59
|
-
uuid += '-';
|
|
60
|
-
uuid += ((Math.random() * 4) | 8).toString(16);
|
|
61
|
-
break;
|
|
62
|
-
default:
|
|
63
|
-
uuid += ((Math.random() * 16) | 0).toString(16);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return uuid;
|
|
67
|
-
};
|