@uxf/data-grid 10.0.0-beta.6 → 10.0.0-beta.60
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/data-grid.js +1 -1
- package/data-grid.stories.js +8 -1
- package/package.json +2 -1
- package/tailwindui/components/action-cell-base.js +3 -1
- package/tailwindui/components/toolbar-control.js +22 -5
- package/tailwindui/filter-handler/index.js +1 -0
- package/tailwindui/styles.css +51 -56
- package/types/components.d.ts +5 -4
- package/types/core.d.ts +1 -0
- package/types/data-grid-props.d.ts +3 -2
package/data-grid.js
CHANGED
|
@@ -121,7 +121,7 @@ const DataGrid = (props) => {
|
|
|
121
121
|
react_1.default.createElement(Container, { noBorder: props.noBorder, className: props.className },
|
|
122
122
|
react_1.default.createElement(Toolbar, { noBorder: props.noBorder },
|
|
123
123
|
react_1.default.createElement(ToolbarTabs, { activeTab: state.request.tab, onChange: (tab) => dispatch(actions_1.dataGridActions.changeTab(tab)), schema: props.schema }),
|
|
124
|
-
react_1.default.createElement(ToolbarControl, { gridName: props.gridName, dispatch: dispatch, filterHandlers: props.ui.FilterHandlers, noBorder: props.noBorder, schema: props.schema,
|
|
124
|
+
react_1.default.createElement(ToolbarControl, { gridName: props.gridName, dispatch: dispatch, filterHandlers: props.ui.FilterHandlers, noBorder: props.noBorder, schema: props.schema, onFulltextChange: (value) => dispatch(actions_1.dataGridActions.search(value)), showFulltext: props.schema.fullText, hiddenColumns: props.hiddenColumns, onChangeHiddenColumns: props.onChangeHiddenColumns, onCsvDownload: props.onCsvDownload, state: state }),
|
|
125
125
|
react_1.default.createElement(ToolbarCustoms, { buttons: props.customActions })),
|
|
126
126
|
react_1.default.createElement(LinearProgress, { loading: !!state.loading }),
|
|
127
127
|
react_1.default.createElement(FilterList, { gridName: props.gridName, onFilter: onFilter, filters: props.schema.filters, filtersData: state.request.f, filterHandlers: props.ui.FilterHandlers, noBorder: props.noBorder }),
|
package/data-grid.stories.js
CHANGED
|
@@ -223,12 +223,19 @@ const loader = async (_, request) => {
|
|
|
223
223
|
result: filteredData.slice(page * perPage, page * perPage + perPage),
|
|
224
224
|
};
|
|
225
225
|
};
|
|
226
|
+
const onCsvDownload = (request) => {
|
|
227
|
+
// eslint-disable-next-line no-console
|
|
228
|
+
console.log(request);
|
|
229
|
+
};
|
|
226
230
|
function Default() {
|
|
227
231
|
const [hiddenColumns, setHiddenColumns] = (0, react_1.useState)([]);
|
|
228
232
|
const [selectedRows, setSelectedRows] = (0, react_1.useState)(new Set());
|
|
229
233
|
const callbackRef = (0, _1.useCallbackRef)();
|
|
230
234
|
return (react_1.default.createElement("div", { className: "min-h-screen bg-gray-50 p-4 dark:bg-gray-950" },
|
|
231
|
-
react_1.default.createElement(tailwindui_1.DataGrid, { callbackRef: callbackRef, schema: schema, title: "Test", noBorder: false, loader: loader, onChangeHiddenColumns: setHiddenColumns, hiddenColumns: hiddenColumns, onChangeSelectedRows: setSelectedRows, selectedRows: selectedRows, getOpenUrl: (row) => `https://www.uxf.cz/item-${row.id}`, onEdit: console.log, onRemove:
|
|
235
|
+
react_1.default.createElement(tailwindui_1.DataGrid, { callbackRef: callbackRef, schema: schema, title: "Test", noBorder: false, loader: loader, onChangeHiddenColumns: setHiddenColumns, hiddenColumns: hiddenColumns, onChangeSelectedRows: setSelectedRows, selectedRows: selectedRows, getOpenUrl: (row) => `https://www.uxf.cz/item-${row.id}`, onEdit: console.log, onRemove: (row, reload) => {
|
|
236
|
+
console.log(row, reload);
|
|
237
|
+
reload();
|
|
238
|
+
}, initialState: "eyJzb3J0IjoiaWQiLCJkaXIiOiJhc2MiLCJwZXJQYWdlIjoxMCwicGFnZSI6MCwiZiI6W3sibmFtZSI6ImNvZGUiLCJ2YWx1ZSI6IkNaIn1dfQ==", onCsvDownload: onCsvDownload, defaultConfig: {
|
|
232
239
|
columns: {
|
|
233
240
|
id: { width: 50, hidden: true },
|
|
234
241
|
text: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/data-grid",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.60",
|
|
4
4
|
"description": "UXF DataGrid",
|
|
5
5
|
"homepage": "https://gitlab.com/uxf-npm/data-grid#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"node": ">=8.9"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
+
"@uxf/ui": "10.0.0-beta.60",
|
|
33
34
|
"react": "^18.0.0",
|
|
34
35
|
"react-dom": "^18.0.0",
|
|
35
36
|
"dayjs": "^1.11.7"
|
|
@@ -74,8 +74,10 @@ const Button = (props) => {
|
|
|
74
74
|
return null;
|
|
75
75
|
};
|
|
76
76
|
const ActionCellBase = (props) => {
|
|
77
|
+
const onRemove = props.onRemove;
|
|
78
|
+
const handleRemove = onRemove ? () => onRemove(props.row, props.reload) : undefined;
|
|
77
79
|
return (react_1.default.createElement(exports.ActionCellWrapper, null,
|
|
78
|
-
react_1.default.createElement(Button, { row: props.row, onClick:
|
|
80
|
+
react_1.default.createElement(Button, { row: props.row, onClick: handleRemove, getUrl: undefined, icon: "trash", title: "Smazat" }),
|
|
79
81
|
react_1.default.createElement(Button, { row: props.row, onClick: props.onEdit, getUrl: props.getEditUrl, icon: "pen", title: "Upravit" }),
|
|
80
82
|
react_1.default.createElement(Button, { row: props.row, onClick: props.onOpen, getUrl: props.getOpenUrl, icon: "circle-info", title: "Detail" })));
|
|
81
83
|
};
|
|
@@ -32,6 +32,7 @@ const drawer_1 = require("./drawer");
|
|
|
32
32
|
const toggle_1 = require("@uxf/ui/toggle");
|
|
33
33
|
const actions_1 = require("../../store/actions");
|
|
34
34
|
const show_1 = require("../show");
|
|
35
|
+
const utils_1 = require("../../utils");
|
|
35
36
|
function Filters(props) {
|
|
36
37
|
return (react_1.default.createElement("div", { className: "uxf-data-grid__filters" }, props.schema.filters.map((filter) => {
|
|
37
38
|
var _a, _b;
|
|
@@ -47,21 +48,37 @@ function Filters(props) {
|
|
|
47
48
|
})));
|
|
48
49
|
}
|
|
49
50
|
function Columns(props) {
|
|
50
|
-
|
|
51
|
+
const onHideColumn = (columnName) => {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
(_a = props.onChangeHiddenColumns) === null || _a === void 0 ? void 0 : _a.call(props, [...((_b = props.hiddenColumns) !== null && _b !== void 0 ? _b : []), columnName]);
|
|
54
|
+
};
|
|
55
|
+
const onShowColumn = (columnName) => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
(_a = props.onChangeHiddenColumns) === null || _a === void 0 ? void 0 : _a.call(props, [...((_b = props.hiddenColumns) !== null && _b !== void 0 ? _b : [])].filter((v) => v !== columnName));
|
|
58
|
+
};
|
|
59
|
+
return (react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-control-columns" }, props.schema.columns.map((column) => {
|
|
60
|
+
var _a;
|
|
61
|
+
return (react_1.default.createElement(toggle_1.Toggle, { key: column.name, label: typeof column.label === "string" ? column.label : "", value: !((_a = props.hiddenColumns) === null || _a === void 0 ? void 0 : _a.includes(column.name)), onChange: (value) => (value ? onShowColumn(column.name) : onHideColumn(column.name)) }));
|
|
62
|
+
})));
|
|
51
63
|
}
|
|
52
64
|
const ToolbarControl = (props) => {
|
|
53
65
|
const [isFiltersOpen, setFiltersOpen] = (0, react_1.useState)(false);
|
|
54
66
|
const [isColumnsOpen, setColumnsOpen] = (0, react_1.useState)(false);
|
|
67
|
+
const fulltextValue = props.state.request.search;
|
|
68
|
+
const filtersData = props.state.request.f;
|
|
55
69
|
return (react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-control" },
|
|
56
70
|
react_1.default.createElement(show_1.Show, { when: props.showFulltext },
|
|
57
|
-
react_1.default.createElement(text_input_1.TextInput, { value:
|
|
58
|
-
react_1.default.createElement(button_1.Button, { isIconButton: true, variant: "white", size: "sm", onClick: () => setFiltersOpen(true), title: "Filtrovat", className: "uxf-data-grid__plugin-
|
|
71
|
+
react_1.default.createElement(text_input_1.TextInput, { value: fulltextValue, onChange: props.onFulltextChange, placeholder: "Pi\u0161te pro hled\u00E1n\u00ED", className: "uxf-data-grid__plugin-fulltext", size: "small", leftElement: react_1.default.createElement(icon_1.Icon, { name: "search", size: 16 }), label: "Vyhled\u00E1v\u00E1n\u00ED", hiddenLabel: true })),
|
|
72
|
+
react_1.default.createElement(button_1.Button, { isIconButton: true, variant: "white", size: "sm", onClick: () => setFiltersOpen(true), title: "Filtrovat", className: "uxf-data-grid__plugin-button" },
|
|
59
73
|
react_1.default.createElement(icon_1.Icon, { name: "filter" })),
|
|
60
74
|
react_1.default.createElement(show_1.Show, { when: props.onChangeHiddenColumns && props.hiddenColumns },
|
|
61
|
-
react_1.default.createElement(button_1.Button, { isIconButton: true, variant: "white", size: "sm", onClick: () => setColumnsOpen(true), title: "Nastaven\u00ED sloupc\u016F" },
|
|
75
|
+
react_1.default.createElement(button_1.Button, { isIconButton: true, variant: "white", size: "sm", onClick: () => setColumnsOpen(true), title: "Nastaven\u00ED sloupc\u016F", className: "uxf-data-grid__plugin-button" },
|
|
62
76
|
react_1.default.createElement(icon_1.Icon, { name: "table-columns" }))),
|
|
77
|
+
react_1.default.createElement(show_1.Show, { when: props.onCsvDownload },
|
|
78
|
+
react_1.default.createElement(button_1.Button, { isIconButton: true, variant: "white", size: "sm", onClick: () => { var _a; return (_a = props.onCsvDownload) === null || _a === void 0 ? void 0 : _a.call(props, (0, utils_1.createRequest)(props.state, props.schema.sort, props.schema.dir)); }, title: "St\u00E1hnout CSV", className: "uxf-data-grid__plugin-button" },
|
|
79
|
+
react_1.default.createElement(icon_1.Icon, { name: "file-arrow-down" }))),
|
|
63
80
|
react_1.default.createElement(drawer_1.Drawer, { open: isFiltersOpen, onClose: () => setFiltersOpen(false), title: "Filtry" },
|
|
64
|
-
react_1.default.createElement(Filters, { gridName: props.gridName, schema: props.schema, dispatch: props.dispatch, filtersData:
|
|
81
|
+
react_1.default.createElement(Filters, { gridName: props.gridName, schema: props.schema, dispatch: props.dispatch, filtersData: filtersData, filterHandlers: props.filterHandlers, noBorder: props.noBorder })),
|
|
65
82
|
react_1.default.createElement(drawer_1.Drawer, { open: isColumnsOpen, onClose: () => setColumnsOpen(false), title: "Nastaven\u00ED sloupc\u016F" },
|
|
66
83
|
react_1.default.createElement(Columns, { schema: props.schema, onChangeHiddenColumns: props.onChangeHiddenColumns, hiddenColumns: props.hiddenColumns }))));
|
|
67
84
|
};
|
package/tailwindui/styles.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.uxf-data-grid {
|
|
2
|
-
@apply border border-gray-300 dark:border-gray-700
|
|
2
|
+
@apply rounded border border-gray-300 dark:border-gray-700;
|
|
3
3
|
|
|
4
4
|
&.no-border {
|
|
5
5
|
@apply border-0;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
&__action-cell-wrapper {
|
|
19
|
-
@apply flex
|
|
19
|
+
@apply flex h-full w-full items-center justify-center space-x-2 text-center;
|
|
20
20
|
|
|
21
21
|
.uxf-icon {
|
|
22
22
|
@apply text-gray-400 dark:text-gray-500;
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
|
|
26
26
|
&__body-cell {
|
|
27
27
|
&--boolean {
|
|
28
|
-
@apply
|
|
28
|
+
@apply flex h-full w-full items-center;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
&__drawer {
|
|
33
|
-
@apply fixed
|
|
33
|
+
@apply fixed inset-0 z-10 transform overflow-hidden bg-gray-900 bg-opacity-25 ease-in-out dark:bg-opacity-75;
|
|
34
34
|
|
|
35
35
|
&--open {
|
|
36
|
-
@apply
|
|
36
|
+
@apply translate-x-0 opacity-100 transition-opacity duration-500;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
&--closed {
|
|
40
|
-
@apply
|
|
40
|
+
@apply translate-x-full opacity-0 transition-all delay-500;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
&-body-wrapper {
|
|
44
|
-
@apply w-11/12 max-w-sm
|
|
44
|
+
@apply absolute right-0 h-full w-11/12 max-w-sm translate-x-full transform bg-white shadow-xl transition-all duration-500 ease-in-out;
|
|
45
45
|
|
|
46
46
|
&--open {
|
|
47
47
|
@apply translate-x-0;
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
&-body {
|
|
52
|
-
@apply relative w-full max-w-sm
|
|
52
|
+
@apply relative flex h-full w-full max-w-sm flex-col overflow-y-scroll pb-10 dark:bg-gray-950 dark:text-gray-100;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
&-close-button {
|
|
56
|
-
@apply
|
|
56
|
+
@apply !mt-4 ml-auto mr-4;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
&-header {
|
|
60
|
-
@apply p-4 pt-8 font-bold
|
|
60
|
+
@apply p-4 pt-8 text-lg font-bold;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
&-content {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
&-backdrop {
|
|
68
|
-
@apply w-screen
|
|
68
|
+
@apply h-full w-screen cursor-pointer;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
|
|
78
78
|
&__filter {
|
|
79
79
|
&--interval {
|
|
80
|
-
@apply
|
|
80
|
+
@apply grid grid-cols-[1fr_min-content_1fr] gap-4;
|
|
81
81
|
|
|
82
82
|
.uxf-data-grid__filter-gap {
|
|
83
83
|
@apply flex items-center pt-5;
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
&__filter-list {
|
|
93
|
-
@apply
|
|
93
|
+
@apply space-x-2 p-2;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
&__footer {
|
|
97
|
-
@apply flex flex-wrap items-center justify-end p-2
|
|
97
|
+
@apply flex flex-wrap items-center justify-end gap-4 p-2;
|
|
98
98
|
|
|
99
99
|
&.no-border {
|
|
100
100
|
@apply px-0;
|
|
@@ -102,29 +102,23 @@
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
&__linear-progress {
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
border-radius: 20px;
|
|
106
|
+
height: 3px;
|
|
107
107
|
left: 0;
|
|
108
|
-
right: 0;
|
|
109
108
|
overflow: hidden;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
border-radius: 20px;
|
|
109
|
+
position: absolute;
|
|
110
|
+
right: 0;
|
|
111
|
+
z-index: 1;
|
|
114
112
|
|
|
115
113
|
&.is-loading::before {
|
|
116
|
-
content: '';
|
|
117
|
-
position: absolute;
|
|
118
|
-
left: -50%;
|
|
119
|
-
height: 3px;
|
|
120
|
-
width: 40%;
|
|
121
|
-
background-color: theme("colors.dataGridSecondary");
|
|
122
|
-
-webkit-animation: datagridlineanim 1s linear infinite;
|
|
123
|
-
-moz-animation: datagridlineanim 1s linear infinite;
|
|
124
114
|
animation: datagridlineanim 1s linear infinite;
|
|
125
|
-
-
|
|
126
|
-
-moz-border-radius: 20px;
|
|
115
|
+
background-color: theme("colors.dataGridSecondary");
|
|
127
116
|
border-radius: 20px;
|
|
117
|
+
content: "";
|
|
118
|
+
height: 3px;
|
|
119
|
+
left: -50%;
|
|
120
|
+
position: absolute;
|
|
121
|
+
width: 40%;
|
|
128
122
|
}
|
|
129
123
|
}
|
|
130
124
|
|
|
@@ -133,18 +127,18 @@
|
|
|
133
127
|
}
|
|
134
128
|
|
|
135
129
|
&__pagination-counts {
|
|
136
|
-
@apply text-sm text-
|
|
130
|
+
@apply text-sm text-lightLow;
|
|
137
131
|
}
|
|
138
132
|
|
|
139
133
|
&__plugin-fulltext {
|
|
140
|
-
@apply my-2 text-gray-400
|
|
134
|
+
@apply my-2 w-full text-gray-400 sm:w-auto;
|
|
141
135
|
|
|
142
136
|
.uxf-icon {
|
|
143
137
|
@apply text-gray-400;
|
|
144
138
|
}
|
|
145
139
|
}
|
|
146
140
|
|
|
147
|
-
&__plugin-
|
|
141
|
+
&__plugin-button {
|
|
148
142
|
@apply my-2 shrink-0;
|
|
149
143
|
|
|
150
144
|
.uxf-icon {
|
|
@@ -153,7 +147,7 @@
|
|
|
153
147
|
}
|
|
154
148
|
|
|
155
149
|
&__rows-per-page {
|
|
156
|
-
@apply flex flex-wrap gap-2 text-sm text-
|
|
150
|
+
@apply flex flex-wrap items-center gap-2 text-sm text-lightLow;
|
|
157
151
|
|
|
158
152
|
.uxf-select {
|
|
159
153
|
@apply w-28;
|
|
@@ -161,19 +155,19 @@
|
|
|
161
155
|
}
|
|
162
156
|
|
|
163
157
|
&__select-row-checkbox-wrapper {
|
|
164
|
-
@apply flex items-center justify-center text-white
|
|
158
|
+
@apply flex h-full w-full items-center justify-center text-white;
|
|
165
159
|
}
|
|
166
160
|
|
|
167
161
|
&__selected-rows-toolbar-wrapper {
|
|
168
|
-
@apply fixed bottom-8 left-0 right-0 flex flex-row
|
|
162
|
+
@apply fixed bottom-8 left-0 right-0 flex flex-row items-center justify-center;
|
|
169
163
|
}
|
|
170
164
|
|
|
171
165
|
&__selected-rows-toolbar {
|
|
172
|
-
@apply
|
|
166
|
+
@apply flex items-center justify-center rounded-full border border-gray-100 bg-dataGridPrimary px-6 py-2 text-sm text-white drop-shadow-xl dark:border-gray-800;
|
|
173
167
|
}
|
|
174
168
|
|
|
175
169
|
&__selected-rows-toolbar-actions {
|
|
176
|
-
@apply
|
|
170
|
+
@apply space-x-2 pl-4;
|
|
177
171
|
}
|
|
178
172
|
|
|
179
173
|
&__table {
|
|
@@ -181,11 +175,11 @@
|
|
|
181
175
|
}
|
|
182
176
|
|
|
183
177
|
&__toolbar {
|
|
184
|
-
@apply flex flex-wrap
|
|
178
|
+
@apply flex flex-wrap items-center justify-end gap-2 border-b border-b-gray-300 px-2 py-2 dark:border-b-gray-700 md:py-0 md:pl-0;
|
|
185
179
|
}
|
|
186
180
|
|
|
187
181
|
&__toolbar-tab {
|
|
188
|
-
@apply inline-flex items-center
|
|
182
|
+
@apply inline-flex items-center whitespace-nowrap border-b-2 border-transparent p-4 text-sm font-medium text-gray-500 hover:text-gray-700;
|
|
189
183
|
|
|
190
184
|
&.is-active {
|
|
191
185
|
@apply border-dataGridPrimary text-dataGridPrimary;
|
|
@@ -197,17 +191,17 @@
|
|
|
197
191
|
|
|
198
192
|
&-nav {
|
|
199
193
|
&--desktop {
|
|
200
|
-
@apply -mb-px space-x-4
|
|
194
|
+
@apply -mb-px hidden space-x-4;
|
|
201
195
|
|
|
202
|
-
@
|
|
196
|
+
@screen md {
|
|
203
197
|
@apply flex;
|
|
204
198
|
}
|
|
205
199
|
}
|
|
206
200
|
|
|
207
201
|
&--mobile {
|
|
208
|
-
@apply
|
|
202
|
+
@apply z-10 flex w-max items-center;
|
|
209
203
|
|
|
210
|
-
@
|
|
204
|
+
@screen md {
|
|
211
205
|
@apply hidden;
|
|
212
206
|
}
|
|
213
207
|
|
|
@@ -226,11 +220,11 @@
|
|
|
226
220
|
}
|
|
227
221
|
|
|
228
222
|
&-modal-content {
|
|
229
|
-
@apply flex flex-col items-start divide-y divide-lightBorder
|
|
223
|
+
@apply flex flex-col items-start divide-y divide-lightBorder pb-4 pt-1 text-left dark:divide-darkBorder;
|
|
230
224
|
}
|
|
231
225
|
|
|
232
226
|
&-modal-button {
|
|
233
|
-
@apply justify-start
|
|
227
|
+
@apply w-full justify-start;
|
|
234
228
|
}
|
|
235
229
|
|
|
236
230
|
&-modal-button-text {
|
|
@@ -238,16 +232,16 @@
|
|
|
238
232
|
}
|
|
239
233
|
|
|
240
234
|
&-modal-active-tab-icon {
|
|
241
|
-
@apply text-lightMedium dark:text-darkMedium
|
|
235
|
+
@apply mr-3 text-lightMedium dark:text-darkMedium;
|
|
242
236
|
}
|
|
243
237
|
}
|
|
244
238
|
|
|
245
239
|
&__toolbar-control {
|
|
246
|
-
@apply flex flex-row items-center justify-between gap-2
|
|
240
|
+
@apply order-3 flex w-full flex-row items-center justify-between gap-2 xs:order-2 xs:w-auto;
|
|
247
241
|
}
|
|
248
242
|
|
|
249
243
|
&__toolbar-customs {
|
|
250
|
-
@apply flex flex-row items-center gap-2
|
|
244
|
+
@apply order-2 flex flex-row items-center gap-2 xs:order-3 md:my-2;
|
|
251
245
|
|
|
252
246
|
&-mobile {
|
|
253
247
|
@apply md:hidden;
|
|
@@ -260,18 +254,18 @@
|
|
|
260
254
|
}
|
|
261
255
|
|
|
262
256
|
.rdg-cell.action {
|
|
263
|
-
text-align: right;
|
|
264
|
-
border-right: 0;
|
|
265
257
|
align-items: center;
|
|
258
|
+
border-right: 0;
|
|
259
|
+
box-shadow: -3px 0 15px rgba(221 221 221 / 50%);
|
|
266
260
|
display: flex;
|
|
267
261
|
justify-content: center;
|
|
268
262
|
position: sticky;
|
|
269
|
-
box-shadow: -3px 0 15px rgba(221 221 221 / 50%);
|
|
270
263
|
right: 0;
|
|
264
|
+
text-align: right;
|
|
271
265
|
}
|
|
272
266
|
|
|
273
267
|
.rdg-header-row {
|
|
274
|
-
@apply bg-gray-200
|
|
268
|
+
@apply bg-gray-200 font-medium text-gray-400 dark:bg-gray-800 dark:text-gray-600;
|
|
275
269
|
|
|
276
270
|
.rdg-cell {
|
|
277
271
|
@apply rounded-none bg-gray-50 dark:bg-gray-900 dark:text-darkMedium;
|
|
@@ -287,12 +281,13 @@
|
|
|
287
281
|
}
|
|
288
282
|
|
|
289
283
|
.rdg-header-sort-name + span {
|
|
290
|
-
display: flex;
|
|
291
284
|
align-items: center;
|
|
285
|
+
display: flex;
|
|
292
286
|
}
|
|
293
287
|
|
|
294
288
|
.rdg-cell {
|
|
295
289
|
border-inline-end: none;
|
|
290
|
+
overflow: visible;
|
|
296
291
|
|
|
297
292
|
&.rdg-cell-frozen {
|
|
298
293
|
box-shadow: none;
|
|
@@ -349,4 +344,4 @@
|
|
|
349
344
|
left: 100%;
|
|
350
345
|
width: 100%;
|
|
351
346
|
}
|
|
352
|
-
}
|
|
347
|
+
}
|
package/types/components.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { BaseGridType, Columns, Filter, Filters, Schema } from "./schema";
|
|
|
3
3
|
import { RequestFilter, Response } from "./api";
|
|
4
4
|
import { PaginationProps } from "@uxf/ui/pagination/pagination";
|
|
5
5
|
import { CheckboxFormatterProps } from "react-data-grid";
|
|
6
|
-
import { ChangeHiddenColumnsHandler } from "./core";
|
|
6
|
+
import { ChangeHiddenColumnsHandler, CsvDownloadHandler } from "./core";
|
|
7
|
+
import { DataGridState } from "./state";
|
|
7
8
|
/**
|
|
8
9
|
* Action cell
|
|
9
10
|
*/
|
|
@@ -13,7 +14,7 @@ export interface ActionCellProps<R> {
|
|
|
13
14
|
getOpenUrl?: (row: R) => string | null | undefined;
|
|
14
15
|
onEdit?: (row: R) => void;
|
|
15
16
|
getEditUrl?: (row: R) => string | null | undefined;
|
|
16
|
-
onRemove?: (row: R) => void;
|
|
17
|
+
onRemove?: (row: R, reload: () => void) => void;
|
|
17
18
|
reload: () => Promise<void>;
|
|
18
19
|
}
|
|
19
20
|
export type ActionCellComponent<R> = FC<ActionCellProps<R>>;
|
|
@@ -152,14 +153,14 @@ export interface ToolbarControlProps {
|
|
|
152
153
|
gridName: string | undefined;
|
|
153
154
|
schema: Schema<any>;
|
|
154
155
|
dispatch: (action: any) => void;
|
|
155
|
-
filtersData: RequestFilter[];
|
|
156
156
|
filterHandlers: FilterHandlers;
|
|
157
|
-
fulltextValue: string;
|
|
158
157
|
onFulltextChange: (value: string) => void;
|
|
159
158
|
noBorder: boolean | null | undefined;
|
|
160
159
|
onChangeHiddenColumns?: ChangeHiddenColumnsHandler;
|
|
160
|
+
onCsvDownload?: CsvDownloadHandler;
|
|
161
161
|
hiddenColumns?: string[];
|
|
162
162
|
showFulltext?: boolean;
|
|
163
|
+
state: DataGridState;
|
|
163
164
|
}
|
|
164
165
|
export type ToolbarControlComponent = React.FC<ToolbarControlProps>;
|
|
165
166
|
/**
|
package/types/core.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Request, Response, ResultItem } from "./api";
|
|
|
2
2
|
import { BaseGridType } from "./schema";
|
|
3
3
|
export type KeyExtractor = (row: ResultItem) => number;
|
|
4
4
|
export type ChangeHiddenColumnsHandler = (hiddenColumns: string[]) => void;
|
|
5
|
+
export type CsvDownloadHandler = (request: Request) => void;
|
|
5
6
|
export type Loader = (gridName: string | undefined, request: Request, encodedRequest: string) => Promise<Response>;
|
|
6
7
|
export type CallbackRef = {
|
|
7
8
|
reload: () => Promise<void>;
|
|
@@ -4,7 +4,7 @@ import { Request } from "./api";
|
|
|
4
4
|
import { DataGridProps as RDGProps } from "react-data-grid";
|
|
5
5
|
import { ToolbarCustomsProps } from "./components";
|
|
6
6
|
import { UIComponents } from "./ui-components";
|
|
7
|
-
import { CallbackRef, ChangeHiddenColumnsHandler, Config, KeyExtractor, Loader } from "./core";
|
|
7
|
+
import { CallbackRef, ChangeHiddenColumnsHandler, Config, CsvDownloadHandler, KeyExtractor, Loader } from "./core";
|
|
8
8
|
export type DataGridBaseProps<GridType extends BaseGridType, R> = {
|
|
9
9
|
callbackRef?: MutableRefObject<CallbackRef | undefined>;
|
|
10
10
|
schema: Schema<GridType>;
|
|
@@ -14,6 +14,7 @@ export type DataGridBaseProps<GridType extends BaseGridType, R> = {
|
|
|
14
14
|
keyExtractor?: KeyExtractor;
|
|
15
15
|
initialState?: Request | string;
|
|
16
16
|
onChangeHiddenColumns?: ChangeHiddenColumnsHandler;
|
|
17
|
+
onCsvDownload?: CsvDownloadHandler;
|
|
17
18
|
hiddenColumns?: string[];
|
|
18
19
|
onChangeSelectedRows?: (selectedRows: Set<number>) => void;
|
|
19
20
|
selectedRows?: Set<number>;
|
|
@@ -21,7 +22,7 @@ export type DataGridBaseProps<GridType extends BaseGridType, R> = {
|
|
|
21
22
|
getOpenUrl?: (row: R) => string | null | undefined;
|
|
22
23
|
onEdit?: (row: R) => void;
|
|
23
24
|
getEditUrl?: (row: R) => string | null | undefined;
|
|
24
|
-
onRemove?: (row: R) => void;
|
|
25
|
+
onRemove?: (row: R, reload: () => void) => void;
|
|
25
26
|
noBorder?: boolean;
|
|
26
27
|
rowHeight?: RDGProps<any>["rowHeight"];
|
|
27
28
|
headerRowHeight?: RDGProps<any>["headerRowHeight"];
|