Skip to content

Commit 85bc931

Browse files
committed
Wip
1 parent f0779d7 commit 85bc931

File tree

98 files changed

+3110
-2643
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+3110
-2643
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@ name: CI
22

33
on:
44
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
5+
branches:
6+
- 'master'
7+
pull_request:
8+
workflow_dispatch:
89

910
jobs:
1011
build:
11-
12-
runs-on: ubuntu-latest
13-
12+
runs-on: ubuntu-22.04
1413
steps:
15-
- uses: actions/checkout@v2
16-
- uses: actions/setup-node@v1
17-
with:
18-
node-version: '10.x'
19-
- run: npm install
20-
- run: npm run test
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Setup node
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 16
20+
cache: 'npm'
21+
- name: Install
22+
run: npm install
23+
- name: Run Tests
24+
run: npm run test

.github/workflows/cypress.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Cypress Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
cypress-run:
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Cypress run
17+
uses: cypress-io/github-action@v5
18+
with:
19+
component: true
20+
browser: chrome

.storybook/addons.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

.storybook/config.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

.storybook/main.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import path from 'path'
2+
3+
module.exports = {
4+
stories: ['../stories/**/*.stories.@(js|jsx|ts|tsx)'],
5+
addons: [{
6+
name: '@storybook/addon-essentials',
7+
options: {
8+
backgrounds: false
9+
}
10+
}, '@storybook/addon-links', '@storybook/addon-controls'],
11+
resolve: {
12+
alias: [
13+
{
14+
find: "@",
15+
replacement: path.resolve(__dirname, "./src"),
16+
},
17+
]
18+
},
19+
framework: {
20+
name: '@storybook/vue3-vite',
21+
options: {}
22+
},
23+
core: {
24+
disableTelemetry: true
25+
},
26+
features: {
27+
storyStoreV7: true
28+
},
29+
docs: {
30+
autodocs: false
31+
}
32+
};

.storybook/preview-head.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script>
2+
window.global = window;
3+
</script>
4+
<link rel="stylesheet" href="./stories/styles.css" />
5+
<link rel="stylesheet" href="./src/components/vue-draggable-resizable.css" />

.storybook/preview.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
export default {
2+
argTypes: {
3+
axis: {
4+
options: ['x', 'y', 'both'],
5+
control: { type: 'radio' },
6+
description: 'Define the axis on which the element is draggable'
7+
},
8+
w: {
9+
control: {
10+
type: 'number',
11+
min: 0,
12+
description: 'Define the width of the element'
13+
}
14+
},
15+
h: {
16+
control: {
17+
type: 'number',
18+
min: 0,
19+
description: 'Define the height of the element'
20+
}
21+
},
22+
z: {
23+
control: {
24+
type: 'number',
25+
description: 'Define the z-index of the element'
26+
}
27+
},
28+
active: {
29+
control: 'boolean',
30+
description: 'Determines if the component should be active or not'
31+
},
32+
draggable: {
33+
control: 'boolean',
34+
description: 'Defines it the component should be draggable or not'
35+
},
36+
resizable: {
37+
control: 'boolean',
38+
description: 'Defines it the component should be resizable or not'
39+
},
40+
preventDeactivation: {
41+
control: 'boolean',
42+
description: 'Determines if the component should be deactivated when the user clicks/taps outside it'
43+
},
44+
handles: {
45+
control: 'inline-check',
46+
options: ['tl', 'tm', 'tr', 'mr', 'br', 'bm', 'bl', 'ml'],
47+
description: 'Define the array of handles to restrict the element resizing'
48+
},
49+
lockAspectRatio: {
50+
control: 'boolean',
51+
description: 'Locks the aspect ratio of the component'
52+
},
53+
parent: {
54+
control: 'boolean',
55+
description: 'Force the component to stay in the parent element'
56+
},
57+
minWidth: {
58+
control: 'number',
59+
description: 'The minimum width of the component'
60+
},
61+
minHeight: {
62+
control: 'number',
63+
description: 'The minimum height of the component'
64+
},
65+
maxWidth: {
66+
control: 'number',
67+
description: 'The maximum width of the component'
68+
},
69+
maxHeight: {
70+
control: 'number',
71+
description: 'The maximum height of the component'
72+
},
73+
grid: {
74+
description: 'The definition of the grid'
75+
}
76+
},
77+
controls: {
78+
matchers: {
79+
color: /(background|color)$/i,
80+
date: /Date$/,
81+
}
82+
},
83+
parameters: {
84+
actions: { argTypesRegex: "^on[A-Z].*" },
85+
controls: { expanded: true },
86+
options: {
87+
storySort: {
88+
order: ['Basic', '*'],
89+
},
90+
}
91+
}
92+
};

.storybook/styles.css

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
html, body, #root, #root > div {
2+
height: 100%;
3+
margin: 0;
4+
box-sizing: border-box;
5+
font-family: Arial;
6+
}
7+
8+
#root > div {
9+
position: relative;
10+
padding: 0px;
11+
}
12+
13+
#toolbar {
14+
position: fixed;
15+
bottom: 0;
16+
height: 24px;
17+
padding: 12px 0;
18+
width: 100%;
19+
border-top: 1px solid #999;
20+
background-color: #CCC;
21+
z-index: 999;
22+
}
23+
24+
.drag-handle,
25+
.drag-cancel {
26+
padding: 6px;
27+
margin: 6px;
28+
background-color: #CCC;
29+
border: 2px solid;
30+
}
31+
32+
.drag-handle:hover {
33+
cursor: move;
34+
}
35+
36+
.drag-cancel:hover {
37+
cursor: not-allowed;
38+
}
39+
40+
.my-class {
41+
background-color: green;
42+
border: 1px solid red;
43+
-webkit-transition: background-color 200ms linear;
44+
-ms-transition: background-color 200ms linear;
45+
transition: background-color 200ms linear;
46+
}
47+
48+
.my-dragging-class {
49+
background-color: red;
50+
border: 1px solid black;
51+
}
52+
53+
.my-resizing-class {
54+
background-color: blue;
55+
border: 1px solid black;
56+
color: white;
57+
}
58+
59+
.my-active-class {
60+
border: 1px solid black;
61+
-webkit-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
62+
-moz-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
63+
box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
64+
}
65+
66+
.my-handle-class {
67+
position: absolute;
68+
border: 1px solid black;
69+
border-radius: 50%;
70+
height: 14px;
71+
width: 14px;
72+
font-size: 1em;
73+
line-height: 1em;
74+
box-sizing: border-box;
75+
-webkit-transition: all 300ms linear;
76+
-ms-transition: all 300ms linear;
77+
transition: all 300ms linear;
78+
}
79+
80+
.my-handle-class-tl {
81+
top: -14px;
82+
left: -14px;
83+
cursor: nw-resize;
84+
}
85+
.my-handle-class-tm {
86+
top: -14px;
87+
left: 50%;
88+
margin-left: -7px;
89+
cursor: n-resize;
90+
}
91+
.my-handle-class-tr {
92+
top: -14px;
93+
right: -14px;
94+
cursor: ne-resize;
95+
}
96+
.my-handle-class-ml {
97+
top: 50%;
98+
margin-top: -7px;
99+
left: -14px;
100+
cursor: w-resize;
101+
}
102+
.my-handle-class-mr {
103+
top: 50%;
104+
margin-top: -7px;
105+
right: -14px;
106+
cursor: e-resize;
107+
}
108+
.my-handle-class-bl {
109+
bottom: -14px;
110+
left: -14px;
111+
cursor: sw-resize;
112+
}
113+
.my-handle-class-bm {
114+
bottom: -14px;
115+
left: 50%;
116+
margin-left: -7px;
117+
cursor: s-resize;
118+
}
119+
.my-handle-class-br {
120+
bottom: -14px;
121+
right: -14px;
122+
cursor: se-resize;
123+
}
124+
.my-handle-class-tl:hover,
125+
.my-handle-class-tm:hover,
126+
.my-handle-class-tr:hover,
127+
.my-handle-class-ml:hover,
128+
.my-handle-class-mr:hover,
129+
.my-handle-class-bl:hover,
130+
.my-handle-class-bm:hover,
131+
.my-handle-class-br:hover {
132+
transform: scale(1.4);
133+
}
134+
.select-box-dashed{
135+
position: absolute;
136+
width: 0px;
137+
height: 0px;
138+
padding: 0px;
139+
margin: 0px;
140+
border: 1px dashed #0099ff;
141+
z-index:9999;
142+
background-color: #c3d5ed;
143+
opacity: 0.5;
144+
filter: alpha(opacity=50);
145+
font-size: 0px;
146+
}
147+

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ All notable changes to `vue-draggable-resizable` will be documented in this file
77
- Updates all packages
88
- Adds vitest instead of mocha and karma for testing
99
- Adds vite instead of raw webpack
10+
- Adds Cypress to component-test the package in real browsers
11+
- Fix `drag-stop` and `resize-stop` events
1012
- And minor changes
1113

1214
## 2.3.0 - 2020-12-17

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Maurizio Bonani
3+
Copyright (c) 2023 Maurizio Bonani
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)