@sio-group/ui-datatable 0.1.2 → 0.1.4
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/CHANGELOG.md +14 -0
- package/dist/index.cjs +4 -5
- package/dist/index.js +4 -5
- package/dist/styles/index.css +33 -0
- package/dist/styles/index.css.map +1 -1
- package/package.json +2 -2
- package/src/assets/scss/index.scss +35 -5
- package/src/assets/scss/tokens/_color.scss +4 -0
- package/src/components/ActionCell.tsx +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @sio-group/ui-datatable
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Bug: Fix action cel behavior
|
|
8
|
+
|
|
9
|
+
## 0.1.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- style datatable dropdown
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @sio-group/ui-modal@0.4.3
|
|
16
|
+
|
|
3
17
|
## 0.1.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -205,13 +205,15 @@ var ActionCell = ({
|
|
|
205
205
|
if (dropdownRef.current && triggerRef.current) {
|
|
206
206
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
207
207
|
dropdownRef.current.style.left = `${rect.left}px`;
|
|
208
|
-
dropdownRef.current.style.top = `${rect.
|
|
208
|
+
dropdownRef.current.style.top = `${rect.bottom}px`;
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
211
|
(0, import_react2.useEffect)(() => {
|
|
212
212
|
if (!isOpen) return;
|
|
213
|
+
positionDropdown();
|
|
213
214
|
const handleOutside = (e) => {
|
|
214
215
|
if (dropdownRef.current?.contains(e.target)) return;
|
|
216
|
+
if (triggerRef.current?.contains(e.target)) return;
|
|
215
217
|
setIsOpen(false);
|
|
216
218
|
};
|
|
217
219
|
document.addEventListener("mousedown", handleOutside, false);
|
|
@@ -248,10 +250,7 @@ var ActionCell = ({
|
|
|
248
250
|
"aria-label": "Acties",
|
|
249
251
|
"aria-expanded": isOpen,
|
|
250
252
|
"aria-haspopup": "menu",
|
|
251
|
-
onClick: () =>
|
|
252
|
-
setIsOpen(!isOpen);
|
|
253
|
-
positionDropdown();
|
|
254
|
-
},
|
|
253
|
+
onClick: () => setIsOpen(!isOpen),
|
|
255
254
|
children: renderMenuIcon ? renderMenuIcon() : "\u22EE"
|
|
256
255
|
}
|
|
257
256
|
),
|
package/dist/index.js
CHANGED
|
@@ -179,13 +179,15 @@ var ActionCell = ({
|
|
|
179
179
|
if (dropdownRef.current && triggerRef.current) {
|
|
180
180
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
181
181
|
dropdownRef.current.style.left = `${rect.left}px`;
|
|
182
|
-
dropdownRef.current.style.top = `${rect.
|
|
182
|
+
dropdownRef.current.style.top = `${rect.bottom}px`;
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
185
|
useEffect(() => {
|
|
186
186
|
if (!isOpen) return;
|
|
187
|
+
positionDropdown();
|
|
187
188
|
const handleOutside = (e) => {
|
|
188
189
|
if (dropdownRef.current?.contains(e.target)) return;
|
|
190
|
+
if (triggerRef.current?.contains(e.target)) return;
|
|
189
191
|
setIsOpen(false);
|
|
190
192
|
};
|
|
191
193
|
document.addEventListener("mousedown", handleOutside, false);
|
|
@@ -222,10 +224,7 @@ var ActionCell = ({
|
|
|
222
224
|
"aria-label": "Acties",
|
|
223
225
|
"aria-expanded": isOpen,
|
|
224
226
|
"aria-haspopup": "menu",
|
|
225
|
-
onClick: () =>
|
|
226
|
-
setIsOpen(!isOpen);
|
|
227
|
-
positionDropdown();
|
|
228
|
-
},
|
|
227
|
+
onClick: () => setIsOpen(!isOpen),
|
|
229
228
|
children: renderMenuIcon ? renderMenuIcon() : "\u22EE"
|
|
230
229
|
}
|
|
231
230
|
),
|
package/dist/styles/index.css
CHANGED
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
--sio-color-error: #EF4444;
|
|
9
9
|
--sio-color-warning: #F59E0B;
|
|
10
10
|
--sio-color-info: #06B6D4;
|
|
11
|
+
--sio-datatable-bg: var(--sio-color-white);
|
|
11
12
|
--sio-datatable-border: var(--sio-color-light-gray);
|
|
12
13
|
--sio-datatable-striped: #f9fafb;
|
|
13
14
|
--sio-datatable-hover: #f1f5f9;
|
|
15
|
+
--sio-datatable-shadow: 0 4px 8px 0;
|
|
16
|
+
--sio-datatable-shadow-color: rgba(0,0,0, .2);
|
|
17
|
+
--sio-datatable-border-radius: 3px;
|
|
14
18
|
--sio-form-border: var(--sio-color-light-gray);
|
|
15
19
|
--sio-form-bg: var(--sio-color-white);
|
|
16
20
|
}
|
|
@@ -150,5 +154,34 @@
|
|
|
150
154
|
.datatable .empty-state {
|
|
151
155
|
margin: 25px;
|
|
152
156
|
}
|
|
157
|
+
.datatable .action-group {
|
|
158
|
+
display: flex;
|
|
159
|
+
gap: 3px;
|
|
160
|
+
}
|
|
161
|
+
.datatable .action-dropdown {
|
|
162
|
+
position: relative;
|
|
163
|
+
display: inline-block;
|
|
164
|
+
}
|
|
165
|
+
.datatable .action-dropdown__menu {
|
|
166
|
+
position: fixed;
|
|
167
|
+
display: flex;
|
|
168
|
+
flex-direction: column;
|
|
169
|
+
background: var(--sio-datatable-bg);
|
|
170
|
+
box-shadow: var(--sio-datatable-shadow) var(--sio-datatable-shadow-color);
|
|
171
|
+
border: 1px solid var(--sio-datatable-border);
|
|
172
|
+
border-radius: var(--sio-datatable-border-radius);
|
|
173
|
+
z-index: 1000;
|
|
174
|
+
}
|
|
175
|
+
.datatable .action-dropdown__menu .btn {
|
|
176
|
+
display: flex;
|
|
177
|
+
width: 100%;
|
|
178
|
+
min-width: 150px;
|
|
179
|
+
padding: 8px 16px;
|
|
180
|
+
border: none;
|
|
181
|
+
gap: 5px;
|
|
182
|
+
}
|
|
183
|
+
.datatable .action-dropdown__menu .btn:hover {
|
|
184
|
+
background-color: var(--sio-datatable-hover);
|
|
185
|
+
}
|
|
153
186
|
|
|
154
187
|
/*# sourceMappingURL=index.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../src/assets/scss/tokens/_color.scss","../../src/assets/scss/tokens/_datatable.scss","../../src/assets/scss/index.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EAEA;EACA;;;
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../src/assets/scss/tokens/_color.scss","../../src/assets/scss/tokens/_datatable.scss","../../src/assets/scss/index.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;;;ACrBF;EACE;EAEA;EACA;EAEA;EACA;EACA;;;ACJA;EACE;EACA;;AAGF;EACE;EACA;;AAIA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAKN;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAIJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAEA;EACE;;AAKF;EACE;EACA;;AAIJ;AAAA;EAEE;EACA;EACA;;AAIA;AAAA;EAEE;EACA;;AAIJ;EACE;;AAGF;EACE;;AAIJ;EACE;;AAEA;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAKN;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;;AAEA;EACE;;AAIJ;EACE;;AAMA;EACE;EACA;;AAGF;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE","file":"index.css"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sio-group/ui-datatable",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@sio-group/ui-core": "0.4.0",
|
|
35
35
|
"@sio-group/ui-pagination": "0.1.1",
|
|
36
|
-
"@sio-group/ui-modal": "0.4.
|
|
36
|
+
"@sio-group/ui-modal": "0.4.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@vitejs/plugin-react": "^4",
|
|
@@ -160,11 +160,41 @@
|
|
|
160
160
|
margin: 25px;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
.action
|
|
164
|
-
|
|
163
|
+
.action {
|
|
164
|
+
&-cel {}
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
&-group {
|
|
167
|
+
display: flex;
|
|
168
|
+
gap: 3px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&-dropdown {
|
|
172
|
+
position: relative;
|
|
173
|
+
display: inline-block;
|
|
174
|
+
|
|
175
|
+
&__menu {
|
|
176
|
+
position: fixed;
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
background: var(--sio-datatable-bg);
|
|
180
|
+
box-shadow: var(--sio-datatable-shadow) var(--sio-datatable-shadow-color);
|
|
181
|
+
border: 1px solid var(--sio-datatable-border);
|
|
182
|
+
border-radius: var(--sio-datatable-border-radius);
|
|
183
|
+
z-index: 1000;
|
|
184
|
+
|
|
185
|
+
.btn {
|
|
186
|
+
display: flex;
|
|
187
|
+
width: 100%;
|
|
188
|
+
min-width: 150px;
|
|
189
|
+
padding: 8px 16px;
|
|
190
|
+
border: none;
|
|
191
|
+
gap: 5px;
|
|
192
|
+
|
|
193
|
+
&:hover {
|
|
194
|
+
background-color: var(--sio-datatable-hover);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
168
198
|
}
|
|
169
199
|
}
|
|
170
|
-
}
|
|
200
|
+
}
|
|
@@ -10,9 +10,13 @@
|
|
|
10
10
|
--sio-color-warning: #F59E0B;
|
|
11
11
|
--sio-color-info: #06B6D4;
|
|
12
12
|
|
|
13
|
+
--sio-datatable-bg: var(--sio-color-white);
|
|
13
14
|
--sio-datatable-border: var(--sio-color-light-gray);
|
|
14
15
|
--sio-datatable-striped: #f9fafb;
|
|
15
16
|
--sio-datatable-hover: #f1f5f9;
|
|
17
|
+
--sio-datatable-shadow: 0 4px 8px 0;
|
|
18
|
+
--sio-datatable-shadow-color: rgba(0,0,0, .2);
|
|
19
|
+
--sio-datatable-border-radius: 3px;
|
|
16
20
|
|
|
17
21
|
--sio-form-border: var(--sio-color-light-gray);
|
|
18
22
|
--sio-form-bg: var(--sio-color-white);
|
|
@@ -15,15 +15,18 @@ export const ActionCell = <T extends { id: string | number }> ({
|
|
|
15
15
|
if (dropdownRef.current && triggerRef.current) {
|
|
16
16
|
const rect: DOMRect = triggerRef.current.getBoundingClientRect();
|
|
17
17
|
dropdownRef.current.style.left = `${rect.left}px`;
|
|
18
|
-
dropdownRef.current.style.top = `${rect.
|
|
18
|
+
dropdownRef.current.style.top = `${rect.bottom}px`;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
if (!isOpen) return;
|
|
24
24
|
|
|
25
|
+
positionDropdown();
|
|
26
|
+
|
|
25
27
|
const handleOutside = (e: MouseEvent | Event) => {
|
|
26
28
|
if (dropdownRef.current?.contains(e.target as Node)) return;
|
|
29
|
+
if (triggerRef.current?.contains(e.target as Node)) return;
|
|
27
30
|
setIsOpen(false);
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -65,10 +68,7 @@ export const ActionCell = <T extends { id: string | number }> ({
|
|
|
65
68
|
aria-label="Acties"
|
|
66
69
|
aria-expanded={isOpen}
|
|
67
70
|
aria-haspopup="menu"
|
|
68
|
-
onClick={() =>
|
|
69
|
-
setIsOpen(!isOpen);
|
|
70
|
-
positionDropdown();
|
|
71
|
-
}}
|
|
71
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
72
72
|
>
|
|
73
73
|
{renderMenuIcon ? renderMenuIcon() : '⋮'}
|
|
74
74
|
</button>
|