@addsign/moje-agenda-shared-lib 2.0.41 → 2.0.43
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/dist/Combination-D2GKeTwa.js +1162 -0
- package/dist/Combination-D2GKeTwa.js.map +1 -0
- package/dist/Dialog-CCrUyF91.js +424 -0
- package/dist/Dialog-CCrUyF91.js.map +1 -0
- package/dist/assets/style.css +61 -8
- package/dist/chevron-down-CfJmko7t.js +14 -0
- package/dist/chevron-down-CfJmko7t.js.map +1 -0
- package/dist/components/Attachments.js +2 -1
- package/dist/components/Attachments.js.map +1 -1
- package/dist/components/ConfirmationModalDialog.js +1 -1
- package/dist/components/ConfirmationModalDialog.js.map +1 -1
- package/dist/components/Modal.js +1 -1
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/datatable/DataTable.js +3 -2
- package/dist/components/datatable/DataTable.js.map +1 -1
- package/dist/components/datatable/DataTableServer.js +42 -13
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +5 -4
- package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBarServer.js +2 -1
- package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
- package/dist/components/form/DateRangeField.js +2 -2
- package/dist/components/form/DateRangeField.js.map +1 -1
- package/dist/components/form/FileInput.js +3 -2
- package/dist/components/form/FileInput.js.map +1 -1
- package/dist/components/form/FileInputMultiple.js +3 -2
- package/dist/components/form/FileInputMultiple.js.map +1 -1
- package/dist/components/form/FormField.js +8 -7
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/form/InputField.js +3 -2
- package/dist/components/form/InputField.js.map +1 -1
- package/dist/components/form/PositionsSelectorSingle.js +2 -1
- package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
- package/dist/components/form/RadioGroup.js +1 -1
- package/dist/components/form/RadioGroup.js.map +1 -1
- package/dist/components/form/SelectField.js +5 -4
- package/dist/components/form/SelectField.js.map +1 -1
- package/dist/components/layout/Neoptimizovano.js +2 -1
- package/dist/components/layout/Neoptimizovano.js.map +1 -1
- package/dist/components/layout/PageTitle.js +1 -1
- package/dist/components/layout/PageTitle.js.map +1 -1
- package/dist/components/layout/SectionTitle.js +1 -1
- package/dist/components/layout/SectionTitle.js.map +1 -1
- package/dist/components/profiles/ProfileOverview.js +2 -1
- package/dist/components/profiles/ProfileOverview.js.map +1 -1
- package/dist/components/ui/Combobox.js +1 -1
- package/dist/components/ui/DatePicker.js +1 -1
- package/dist/components/ui/DateTimePicker.js +1 -1
- package/dist/components/ui/Dialog.js +1 -1
- package/dist/components/ui/ScrollArea.js +2 -2
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +27 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/checkbox.js +4 -4
- package/dist/components/ui/command.js +2 -2
- package/dist/components/ui/multi-select.d.ts +67 -0
- package/dist/components/ui/multi-select.js +295 -0
- package/dist/components/ui/multi-select.js.map +1 -0
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/radioGroup.js +5 -5
- package/dist/components/ui/select.js +8 -16
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/toast.js +5 -5
- package/dist/components/ui/tooltip.js +6 -6
- package/dist/index-B0wyIFEr.js +47 -0
- package/dist/index-B0wyIFEr.js.map +1 -0
- package/dist/index-BcR8DnnV.js +234 -0
- package/dist/index-BcR8DnnV.js.map +1 -0
- package/dist/index-CK9QfV6i.js +40 -0
- package/dist/index-CK9QfV6i.js.map +1 -0
- package/dist/index-CcNKXchf.js +2203 -0
- package/dist/index-CcNKXchf.js.map +1 -0
- package/dist/index-D75exu1X.js +18 -0
- package/dist/index-D75exu1X.js.map +1 -0
- package/dist/index-DzfDO78K.js +15 -0
- package/dist/index-DzfDO78K.js.map +1 -0
- package/dist/index-NZPkObcw.js +110 -0
- package/dist/index-NZPkObcw.js.map +1 -0
- package/dist/index-qqHvAsVd.js +2266 -0
- package/dist/index-qqHvAsVd.js.map +1 -0
- package/dist/index-wO-IHm1z.js +131 -0
- package/dist/index-wO-IHm1z.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +3 -1
- package/dist/main.js.map +1 -1
- package/dist/popover-CcrzvSk7.js +319 -0
- package/dist/popover-CcrzvSk7.js.map +1 -0
- package/lib/components/ConfirmationModalDialog.tsx +1 -1
- package/lib/components/Modal.tsx +1 -1
- package/lib/components/datatable/DataTable.tsx +1 -1
- package/lib/components/datatable/DataTableServer.tsx +51 -17
- package/lib/components/form/AutocompleteSearchBar.tsx +3 -3
- package/lib/components/form/DateRangeField.tsx +2 -2
- package/lib/components/form/FormField.tsx +6 -6
- package/lib/components/form/InputField.tsx +3 -2
- package/lib/components/form/RadioGroup.tsx +1 -1
- package/lib/components/form/SelectField.tsx +3 -3
- package/lib/components/layout/PageTitle.tsx +19 -19
- package/lib/components/layout/SectionTitle.tsx +1 -1
- package/lib/components/ui/badge.tsx +36 -0
- package/lib/components/ui/multi-select.tsx +365 -0
- package/lib/main.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { c as createContextScope, b as composeEventHandlers } from "./index-NZPkObcw.js";
|
|
4
|
+
import { u as useComposedRefs, S as Slot } from "./index-D9mvqz1C.js";
|
|
5
|
+
import { D as DismissableLayer } from "./index-BcR8DnnV.js";
|
|
6
|
+
import { h as hideOthers, R as ReactRemoveScroll, u as useFocusGuards, F as FocusScope } from "./Combination-D2GKeTwa.js";
|
|
7
|
+
import { u as useId } from "./index-DzfDO78K.js";
|
|
8
|
+
import { c as createPopperScope, A as Anchor, C as Content, a as Arrow, R as Root2$1 } from "./index-CcNKXchf.js";
|
|
9
|
+
import { P as Portal$1 } from "./index-D75exu1X.js";
|
|
10
|
+
import { P as Presence } from "./index-wO-IHm1z.js";
|
|
11
|
+
import { P as Primitive } from "./index-B761_inZ.js";
|
|
12
|
+
import { u as useControllableState } from "./index-B0wyIFEr.js";
|
|
13
|
+
import { cn } from "./utils/utils.js";
|
|
14
|
+
var POPOVER_NAME = "Popover";
|
|
15
|
+
var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
|
|
16
|
+
createPopperScope
|
|
17
|
+
]);
|
|
18
|
+
var usePopperScope = createPopperScope();
|
|
19
|
+
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
20
|
+
var Popover$1 = (props) => {
|
|
21
|
+
const {
|
|
22
|
+
__scopePopover,
|
|
23
|
+
children,
|
|
24
|
+
open: openProp,
|
|
25
|
+
defaultOpen,
|
|
26
|
+
onOpenChange,
|
|
27
|
+
modal = false
|
|
28
|
+
} = props;
|
|
29
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
30
|
+
const triggerRef = React.useRef(null);
|
|
31
|
+
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
32
|
+
const [open = false, setOpen] = useControllableState({
|
|
33
|
+
prop: openProp,
|
|
34
|
+
defaultProp: defaultOpen,
|
|
35
|
+
onChange: onOpenChange
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ jsx(Root2$1, { ...popperScope, children: /* @__PURE__ */ jsx(
|
|
38
|
+
PopoverProvider,
|
|
39
|
+
{
|
|
40
|
+
scope: __scopePopover,
|
|
41
|
+
contentId: useId(),
|
|
42
|
+
triggerRef,
|
|
43
|
+
open,
|
|
44
|
+
onOpenChange: setOpen,
|
|
45
|
+
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
46
|
+
hasCustomAnchor,
|
|
47
|
+
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
|
|
48
|
+
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),
|
|
49
|
+
modal,
|
|
50
|
+
children
|
|
51
|
+
}
|
|
52
|
+
) });
|
|
53
|
+
};
|
|
54
|
+
Popover$1.displayName = POPOVER_NAME;
|
|
55
|
+
var ANCHOR_NAME = "PopoverAnchor";
|
|
56
|
+
var PopoverAnchor = React.forwardRef(
|
|
57
|
+
(props, forwardedRef) => {
|
|
58
|
+
const { __scopePopover, ...anchorProps } = props;
|
|
59
|
+
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
60
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
61
|
+
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
62
|
+
React.useEffect(() => {
|
|
63
|
+
onCustomAnchorAdd();
|
|
64
|
+
return () => onCustomAnchorRemove();
|
|
65
|
+
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
|
|
66
|
+
return /* @__PURE__ */ jsx(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
70
|
+
var TRIGGER_NAME = "PopoverTrigger";
|
|
71
|
+
var PopoverTrigger$1 = React.forwardRef(
|
|
72
|
+
(props, forwardedRef) => {
|
|
73
|
+
const { __scopePopover, ...triggerProps } = props;
|
|
74
|
+
const context = usePopoverContext(TRIGGER_NAME, __scopePopover);
|
|
75
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
76
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
77
|
+
const trigger = /* @__PURE__ */ jsx(
|
|
78
|
+
Primitive.button,
|
|
79
|
+
{
|
|
80
|
+
type: "button",
|
|
81
|
+
"aria-haspopup": "dialog",
|
|
82
|
+
"aria-expanded": context.open,
|
|
83
|
+
"aria-controls": context.contentId,
|
|
84
|
+
"data-state": getState(context.open),
|
|
85
|
+
...triggerProps,
|
|
86
|
+
ref: composedTriggerRef,
|
|
87
|
+
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: trigger });
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
PopoverTrigger$1.displayName = TRIGGER_NAME;
|
|
94
|
+
var PORTAL_NAME = "PopoverPortal";
|
|
95
|
+
var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {
|
|
96
|
+
forceMount: void 0
|
|
97
|
+
});
|
|
98
|
+
var PopoverPortal = (props) => {
|
|
99
|
+
const { __scopePopover, forceMount, children, container } = props;
|
|
100
|
+
const context = usePopoverContext(PORTAL_NAME, __scopePopover);
|
|
101
|
+
return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$1, { asChild: true, container, children }) }) });
|
|
102
|
+
};
|
|
103
|
+
PopoverPortal.displayName = PORTAL_NAME;
|
|
104
|
+
var CONTENT_NAME = "PopoverContent";
|
|
105
|
+
var PopoverContent$1 = React.forwardRef(
|
|
106
|
+
(props, forwardedRef) => {
|
|
107
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);
|
|
108
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
109
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
110
|
+
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
PopoverContent$1.displayName = CONTENT_NAME;
|
|
114
|
+
var PopoverContentModal = React.forwardRef(
|
|
115
|
+
(props, forwardedRef) => {
|
|
116
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
117
|
+
const contentRef = React.useRef(null);
|
|
118
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
119
|
+
const isRightClickOutsideRef = React.useRef(false);
|
|
120
|
+
React.useEffect(() => {
|
|
121
|
+
const content = contentRef.current;
|
|
122
|
+
if (content)
|
|
123
|
+
return hideOthers(content);
|
|
124
|
+
}, []);
|
|
125
|
+
return /* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsx(
|
|
126
|
+
PopoverContentImpl,
|
|
127
|
+
{
|
|
128
|
+
...props,
|
|
129
|
+
ref: composedRefs,
|
|
130
|
+
trapFocus: context.open,
|
|
131
|
+
disableOutsidePointerEvents: true,
|
|
132
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
133
|
+
var _a;
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
if (!isRightClickOutsideRef.current)
|
|
136
|
+
(_a = context.triggerRef.current) == null ? void 0 : _a.focus();
|
|
137
|
+
}),
|
|
138
|
+
onPointerDownOutside: composeEventHandlers(
|
|
139
|
+
props.onPointerDownOutside,
|
|
140
|
+
(event) => {
|
|
141
|
+
const originalEvent = event.detail.originalEvent;
|
|
142
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
143
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
144
|
+
isRightClickOutsideRef.current = isRightClick;
|
|
145
|
+
},
|
|
146
|
+
{ checkForDefaultPrevented: false }
|
|
147
|
+
),
|
|
148
|
+
onFocusOutside: composeEventHandlers(
|
|
149
|
+
props.onFocusOutside,
|
|
150
|
+
(event) => event.preventDefault(),
|
|
151
|
+
{ checkForDefaultPrevented: false }
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
) });
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
var PopoverContentNonModal = React.forwardRef(
|
|
158
|
+
(props, forwardedRef) => {
|
|
159
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
160
|
+
const hasInteractedOutsideRef = React.useRef(false);
|
|
161
|
+
const hasPointerDownOutsideRef = React.useRef(false);
|
|
162
|
+
return /* @__PURE__ */ jsx(
|
|
163
|
+
PopoverContentImpl,
|
|
164
|
+
{
|
|
165
|
+
...props,
|
|
166
|
+
ref: forwardedRef,
|
|
167
|
+
trapFocus: false,
|
|
168
|
+
disableOutsidePointerEvents: false,
|
|
169
|
+
onCloseAutoFocus: (event) => {
|
|
170
|
+
var _a, _b;
|
|
171
|
+
(_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
|
|
172
|
+
if (!event.defaultPrevented) {
|
|
173
|
+
if (!hasInteractedOutsideRef.current)
|
|
174
|
+
(_b = context.triggerRef.current) == null ? void 0 : _b.focus();
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
}
|
|
177
|
+
hasInteractedOutsideRef.current = false;
|
|
178
|
+
hasPointerDownOutsideRef.current = false;
|
|
179
|
+
},
|
|
180
|
+
onInteractOutside: (event) => {
|
|
181
|
+
var _a, _b;
|
|
182
|
+
(_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
|
|
183
|
+
if (!event.defaultPrevented) {
|
|
184
|
+
hasInteractedOutsideRef.current = true;
|
|
185
|
+
if (event.detail.originalEvent.type === "pointerdown") {
|
|
186
|
+
hasPointerDownOutsideRef.current = true;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const target = event.target;
|
|
190
|
+
const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
|
|
191
|
+
if (targetIsTrigger)
|
|
192
|
+
event.preventDefault();
|
|
193
|
+
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
194
|
+
event.preventDefault();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
var PopoverContentImpl = React.forwardRef(
|
|
202
|
+
(props, forwardedRef) => {
|
|
203
|
+
const {
|
|
204
|
+
__scopePopover,
|
|
205
|
+
trapFocus,
|
|
206
|
+
onOpenAutoFocus,
|
|
207
|
+
onCloseAutoFocus,
|
|
208
|
+
disableOutsidePointerEvents,
|
|
209
|
+
onEscapeKeyDown,
|
|
210
|
+
onPointerDownOutside,
|
|
211
|
+
onFocusOutside,
|
|
212
|
+
onInteractOutside,
|
|
213
|
+
...contentProps
|
|
214
|
+
} = props;
|
|
215
|
+
const context = usePopoverContext(CONTENT_NAME, __scopePopover);
|
|
216
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
217
|
+
useFocusGuards();
|
|
218
|
+
return /* @__PURE__ */ jsx(
|
|
219
|
+
FocusScope,
|
|
220
|
+
{
|
|
221
|
+
asChild: true,
|
|
222
|
+
loop: true,
|
|
223
|
+
trapped: trapFocus,
|
|
224
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
225
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
226
|
+
children: /* @__PURE__ */ jsx(
|
|
227
|
+
DismissableLayer,
|
|
228
|
+
{
|
|
229
|
+
asChild: true,
|
|
230
|
+
disableOutsidePointerEvents,
|
|
231
|
+
onInteractOutside,
|
|
232
|
+
onEscapeKeyDown,
|
|
233
|
+
onPointerDownOutside,
|
|
234
|
+
onFocusOutside,
|
|
235
|
+
onDismiss: () => context.onOpenChange(false),
|
|
236
|
+
children: /* @__PURE__ */ jsx(
|
|
237
|
+
Content,
|
|
238
|
+
{
|
|
239
|
+
"data-state": getState(context.open),
|
|
240
|
+
role: "dialog",
|
|
241
|
+
id: context.contentId,
|
|
242
|
+
...popperScope,
|
|
243
|
+
...contentProps,
|
|
244
|
+
ref: forwardedRef,
|
|
245
|
+
style: {
|
|
246
|
+
...contentProps.style,
|
|
247
|
+
// re-namespace exposed content custom properties
|
|
248
|
+
...{
|
|
249
|
+
"--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
250
|
+
"--radix-popover-content-available-width": "var(--radix-popper-available-width)",
|
|
251
|
+
"--radix-popover-content-available-height": "var(--radix-popper-available-height)",
|
|
252
|
+
"--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
|
|
253
|
+
"--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
var CLOSE_NAME = "PopoverClose";
|
|
265
|
+
var PopoverClose = React.forwardRef(
|
|
266
|
+
(props, forwardedRef) => {
|
|
267
|
+
const { __scopePopover, ...closeProps } = props;
|
|
268
|
+
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
269
|
+
return /* @__PURE__ */ jsx(
|
|
270
|
+
Primitive.button,
|
|
271
|
+
{
|
|
272
|
+
type: "button",
|
|
273
|
+
...closeProps,
|
|
274
|
+
ref: forwardedRef,
|
|
275
|
+
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
PopoverClose.displayName = CLOSE_NAME;
|
|
281
|
+
var ARROW_NAME = "PopoverArrow";
|
|
282
|
+
var PopoverArrow = React.forwardRef(
|
|
283
|
+
(props, forwardedRef) => {
|
|
284
|
+
const { __scopePopover, ...arrowProps } = props;
|
|
285
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
286
|
+
return /* @__PURE__ */ jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
PopoverArrow.displayName = ARROW_NAME;
|
|
290
|
+
function getState(open) {
|
|
291
|
+
return open ? "open" : "closed";
|
|
292
|
+
}
|
|
293
|
+
var Root2 = Popover$1;
|
|
294
|
+
var Trigger = PopoverTrigger$1;
|
|
295
|
+
var Portal = PopoverPortal;
|
|
296
|
+
var Content2 = PopoverContent$1;
|
|
297
|
+
const Popover = Root2;
|
|
298
|
+
const PopoverTrigger = Trigger;
|
|
299
|
+
const PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
|
|
300
|
+
Content2,
|
|
301
|
+
{
|
|
302
|
+
ref,
|
|
303
|
+
align,
|
|
304
|
+
sideOffset,
|
|
305
|
+
className: cn(
|
|
306
|
+
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
307
|
+
className
|
|
308
|
+
),
|
|
309
|
+
...props
|
|
310
|
+
}
|
|
311
|
+
) }));
|
|
312
|
+
PopoverContent.displayName = Content2.displayName;
|
|
313
|
+
export {
|
|
314
|
+
Popover as P,
|
|
315
|
+
PopoverTrigger as a,
|
|
316
|
+
PopoverContent as b,
|
|
317
|
+
PopoverClose as c
|
|
318
|
+
};
|
|
319
|
+
//# sourceMappingURL=popover-CcrzvSk7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover-CcrzvSk7.js","sources":["../node_modules/@radix-ui/react-popover/dist/index.mjs","../lib/components/ui/popover.tsx"],"sourcesContent":["\"use client\";\n\n// packages/react/popover/src/Popover.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { DismissableLayer } from \"@radix-ui/react-dismissable-layer\";\nimport { useFocusGuards } from \"@radix-ui/react-focus-guards\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { useId } from \"@radix-ui/react-id\";\nimport * as PopperPrimitive from \"@radix-ui/react-popper\";\nimport { createPopperScope } from \"@radix-ui/react-popper\";\nimport { Portal as PortalPrimitive } from \"@radix-ui/react-portal\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { hideOthers } from \"aria-hidden\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { jsx } from \"react/jsx-runtime\";\nvar POPOVER_NAME = \"Popover\";\nvar [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [\n createPopperScope\n]);\nvar usePopperScope = createPopperScope();\nvar [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);\nvar Popover = (props) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = false\n } = props;\n const popperScope = usePopperScope(__scopePopover);\n const triggerRef = React.useRef(null);\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange\n });\n return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsx(\n PopoverProvider,\n {\n scope: __scopePopover,\n contentId: useId(),\n triggerRef,\n open,\n onOpenChange: setOpen,\n onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),\n hasCustomAnchor,\n onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),\n onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),\n modal,\n children\n }\n ) });\n};\nPopover.displayName = POPOVER_NAME;\nvar ANCHOR_NAME = \"PopoverAnchor\";\nvar PopoverAnchor = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopePopover, ...anchorProps } = props;\n const context = usePopoverContext(ANCHOR_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context;\n React.useEffect(() => {\n onCustomAnchorAdd();\n return () => onCustomAnchorRemove();\n }, [onCustomAnchorAdd, onCustomAnchorRemove]);\n return /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });\n }\n);\nPopoverAnchor.displayName = ANCHOR_NAME;\nvar TRIGGER_NAME = \"PopoverTrigger\";\nvar PopoverTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopePopover, ...triggerProps } = props;\n const context = usePopoverContext(TRIGGER_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n const trigger = /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": context.open,\n \"aria-controls\": context.contentId,\n \"data-state\": getState(context.open),\n ...triggerProps,\n ref: composedTriggerRef,\n onClick: composeEventHandlers(props.onClick, context.onOpenToggle)\n }\n );\n return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { asChild: true, ...popperScope, children: trigger });\n }\n);\nPopoverTrigger.displayName = TRIGGER_NAME;\nvar PORTAL_NAME = \"PopoverPortal\";\nvar [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {\n forceMount: void 0\n});\nvar PopoverPortal = (props) => {\n const { __scopePopover, forceMount, children, container } = props;\n const context = usePopoverContext(PORTAL_NAME, __scopePopover);\n return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, container, children }) }) });\n};\nPopoverPortal.displayName = PORTAL_NAME;\nvar CONTENT_NAME = \"PopoverContent\";\nvar PopoverContent = React.forwardRef(\n (props, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) });\n }\n);\nPopoverContent.displayName = CONTENT_NAME;\nvar PopoverContentModal = React.forwardRef(\n (props, forwardedRef) => {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const isRightClickOutsideRef = React.useRef(false);\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n return /* @__PURE__ */ jsx(RemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsx(\n PopoverContentImpl,\n {\n ...props,\n ref: composedRefs,\n trapFocus: context.open,\n disableOutsidePointerEvents: true,\n onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n }),\n onPointerDownOutside: composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n isRightClickOutsideRef.current = isRightClick;\n },\n { checkForDefaultPrevented: false }\n ),\n onFocusOutside: composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false }\n )\n }\n ) });\n }\n);\nvar PopoverContentNonModal = React.forwardRef(\n (props, forwardedRef) => {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n return /* @__PURE__ */ jsx(\n PopoverContentImpl,\n {\n ...props,\n ref: forwardedRef,\n trapFocus: false,\n disableOutsidePointerEvents: false,\n onCloseAutoFocus: (event) => {\n props.onCloseAutoFocus?.(event);\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n event.preventDefault();\n }\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n },\n onInteractOutside: (event) => {\n props.onInteractOutside?.(event);\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === \"pointerdown\") {\n hasPointerDownOutsideRef.current = true;\n }\n }\n const target = event.target;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n if (event.detail.originalEvent.type === \"focusin\" && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }\n }\n );\n }\n);\nvar PopoverContentImpl = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n ...contentProps\n } = props;\n const context = usePopoverContext(CONTENT_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n useFocusGuards();\n return /* @__PURE__ */ jsx(\n FocusScope,\n {\n asChild: true,\n loop: true,\n trapped: trapFocus,\n onMountAutoFocus: onOpenAutoFocus,\n onUnmountAutoFocus: onCloseAutoFocus,\n children: /* @__PURE__ */ jsx(\n DismissableLayer,\n {\n asChild: true,\n disableOutsidePointerEvents,\n onInteractOutside,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onDismiss: () => context.onOpenChange(false),\n children: /* @__PURE__ */ jsx(\n PopperPrimitive.Content,\n {\n \"data-state\": getState(context.open),\n role: \"dialog\",\n id: context.contentId,\n ...popperScope,\n ...contentProps,\n ref: forwardedRef,\n style: {\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n \"--radix-popover-content-transform-origin\": \"var(--radix-popper-transform-origin)\",\n \"--radix-popover-content-available-width\": \"var(--radix-popper-available-width)\",\n \"--radix-popover-content-available-height\": \"var(--radix-popper-available-height)\",\n \"--radix-popover-trigger-width\": \"var(--radix-popper-anchor-width)\",\n \"--radix-popover-trigger-height\": \"var(--radix-popper-anchor-height)\"\n }\n }\n }\n )\n }\n )\n }\n );\n }\n);\nvar CLOSE_NAME = \"PopoverClose\";\nvar PopoverClose = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopePopover, ...closeProps } = props;\n const context = usePopoverContext(CLOSE_NAME, __scopePopover);\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n ...closeProps,\n ref: forwardedRef,\n onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))\n }\n );\n }\n);\nPopoverClose.displayName = CLOSE_NAME;\nvar ARROW_NAME = \"PopoverArrow\";\nvar PopoverArrow = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopePopover, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopePopover);\n return /* @__PURE__ */ jsx(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });\n }\n);\nPopoverArrow.displayName = ARROW_NAME;\nfunction getState(open) {\n return open ? \"open\" : \"closed\";\n}\nvar Root2 = Popover;\nvar Anchor2 = PopoverAnchor;\nvar Trigger = PopoverTrigger;\nvar Portal = PopoverPortal;\nvar Content2 = PopoverContent;\nvar Close = PopoverClose;\nvar Arrow2 = PopoverArrow;\nexport {\n Anchor2 as Anchor,\n Arrow2 as Arrow,\n Close,\n Content2 as Content,\n Popover,\n PopoverAnchor,\n PopoverArrow,\n PopoverClose,\n PopoverContent,\n PopoverPortal,\n PopoverTrigger,\n Portal,\n Root2 as Root,\n Trigger,\n createPopoverScope\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\r\n\r\nimport { cn } from \"../../utils/utils\";\r\n\r\nconst Popover = PopoverPrimitive.Root;\r\n\r\nconst PopoverTrigger = PopoverPrimitive.Trigger;\r\n\r\nconst PopoverContent = React.forwardRef<\r\n React.ElementRef<typeof PopoverPrimitive.Content>,\r\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\r\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\r\n <PopoverPrimitive.Portal>\r\n <PopoverPrimitive.Content\r\n ref={ref}\r\n align={align}\r\n sideOffset={sideOffset}\r\n className={cn(\r\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n </PopoverPrimitive.Portal>\r\n));\r\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\r\n\r\nexport { Popover, PopoverTrigger, PopoverContent };\r\n"],"names":["Popover","PopperPrimitive.Root","PopperPrimitive.Anchor","PopoverTrigger","PortalPrimitive","PopoverContent","RemoveScroll","PopperPrimitive.Content","PopperPrimitive.Arrow","PopoverPrimitive.Root","PopoverPrimitive.Trigger","PopoverPrimitive.Portal","PopoverPrimitive.Content"],"mappings":";;;;;;;;;;;;;AAqBA,IAAI,eAAe;AACnB,IAAI,CAAC,sBAAsB,kBAAkB,IAAI,mBAAmB,cAAc;AAAA,EAChF;AACF,CAAC;AACD,IAAI,iBAAiB,kBAAiB;AACtC,IAAI,CAAC,iBAAiB,iBAAiB,IAAI,qBAAqB,YAAY;AAC5E,IAAIA,YAAU,CAAC,UAAU;AACvB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN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SAAS,MAAM,QAAQ,aAAa,KAAK,CAAC;AAAA,MAC/E;AAAA,IACP;AAAA,EACG;AACH;AACA,aAAa,cAAc;AAC3B,IAAI,aAAa;AACjB,IAAI,eAAe,MAAM;AAAA,EACvB,CAAC,OAAO,iBAAiB;AACvB,UAAM,EAAE,gBAAgB,GAAG,WAAU,IAAK;AAC1C,UAAM,cAAc,eAAe,cAAc;AACjD,WAAuB,oBAAIC,OAAuB,EAAE,GAAG,aAAa,GAAG,YAAY,KAAK,aAAY,CAAE;AAAA,EACvG;AACH;AACA,aAAa,cAAc;AAC3B,SAAS,SAAS,MAAM;AACtB,SAAO,OAAO,SAAS;AACzB;AACA,IAAI,QAAQR;AAEZ,IAAI,UAAUG;AACd,IAAI,SAAS;AACb,IAAI,WAAWE;AClSf,MAAM,UAAUI;AAEhB,MAAM,iBAAiBC;AAEvB,MAAM,iBAAiB,MAAM,WAG3B,CAAC,EAAE,WAAW,QAAQ,UAAU,aAAa,GAAG,GAAG,MAAM,GAAG,QAC3D,oBAAAC,QAAA,EACC,UAAA;AAAA,EAACC;AAAAA,EAAA;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA,EAAA;AACN,EAAA,CACF,CACD;AACD,eAAe,cAAcA,SAAyB;","x_google_ignoreList":[0]}
|
|
@@ -61,7 +61,7 @@ export function ConfirmationModalDialog({
|
|
|
61
61
|
<FaRegTrashAlt className="w-6 h-6 left-[12px] top-[12px] absolute" />
|
|
62
62
|
</div>
|
|
63
63
|
<div className="self-stretch h-16 flex-col justify-start items-start gap-1 flex">
|
|
64
|
-
<div className="self-stretch text-
|
|
64
|
+
<div className="self-stretch text-muted-foreground text-lg font-semibold font-['Inter'] leading-7">
|
|
65
65
|
{title}
|
|
66
66
|
</div>
|
|
67
67
|
<div className="self-stretch text-slate-600 text-sm font-normal font-['Open Sans'] leading-tight">
|
package/lib/components/Modal.tsx
CHANGED
|
@@ -41,7 +41,7 @@ export function Modal({
|
|
|
41
41
|
<FaRegTrashAlt className="w-6 h-6 left-[12px] top-[12px] absolute" />
|
|
42
42
|
</div>
|
|
43
43
|
<div className="self-stretch h-16 flex-col justify-start items-start gap-1 flex">
|
|
44
|
-
<div className="self-stretch text-
|
|
44
|
+
<div className="self-stretch text-muted-foreground text-lg font-semibold font-['Inter'] leading-7">
|
|
45
45
|
{title}
|
|
46
46
|
</div>
|
|
47
47
|
<div className="self-stretch text-slate-600 text-sm font-normal font-['Open Sans'] leading-tight">
|
|
@@ -31,6 +31,7 @@ import SelectField from "../form/SelectField";
|
|
|
31
31
|
import InputField from "../form/InputField";
|
|
32
32
|
import { Resizable } from "./Resizable";
|
|
33
33
|
import { DatatableSettings } from "./DatatableSettings";
|
|
34
|
+
import { MultiSelect } from "../ui/multi-select";
|
|
34
35
|
|
|
35
36
|
import * as XLSX from "xlsx";
|
|
36
37
|
|
|
@@ -186,12 +187,24 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
186
187
|
if (currentPage === undefined) return;
|
|
187
188
|
setIsLoading(true);
|
|
188
189
|
|
|
189
|
-
//odebrani prazdny filteru
|
|
190
|
+
//odebrani prazdny filteru a transformace multi-select hodnot
|
|
190
191
|
const filteredMergedFilters = Object.entries(mergedFilters).reduce(
|
|
191
192
|
(acc: Record<string, any>, [key, value]) => {
|
|
192
|
-
|
|
193
|
-
|
|
193
|
+
// Skip null and empty string values
|
|
194
|
+
if (value === null || value === "") {
|
|
195
|
+
return acc;
|
|
194
196
|
}
|
|
197
|
+
|
|
198
|
+
// Handle multi-select values (arrays)
|
|
199
|
+
if (Array.isArray(value)) {
|
|
200
|
+
if (value.length > 0) {
|
|
201
|
+
acc[key] = value.join(",");
|
|
202
|
+
}
|
|
203
|
+
return acc;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Handle other values
|
|
207
|
+
acc[key] = value;
|
|
195
208
|
return acc;
|
|
196
209
|
},
|
|
197
210
|
{}
|
|
@@ -199,7 +212,7 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
199
212
|
|
|
200
213
|
federationContext.apiClient
|
|
201
214
|
.get(url, {
|
|
202
|
-
signal: currentAbortController.signal,
|
|
215
|
+
signal: currentAbortController.signal,
|
|
203
216
|
params: {
|
|
204
217
|
...filteredMergedFilters,
|
|
205
218
|
pageSize: itemsPerPageLocal,
|
|
@@ -282,7 +295,6 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
282
295
|
useEffect(() => {
|
|
283
296
|
const fetchFilterOptions = async (column: DataTableColumn<T>) => {
|
|
284
297
|
if (column.filterOptions) {
|
|
285
|
-
// if filterOptions is provided, use it directly
|
|
286
298
|
return column.filterOptions;
|
|
287
299
|
} else if (column.filterSource) {
|
|
288
300
|
try {
|
|
@@ -291,8 +303,8 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
291
303
|
);
|
|
292
304
|
|
|
293
305
|
const options = response.data.map((item: any) => ({
|
|
294
|
-
value: item[column.filterValueKey as keyof typeof item],
|
|
295
|
-
label: item[column.filterLabelKey as keyof typeof item],
|
|
306
|
+
value: item[column.filterValueKey as keyof typeof item]?.toString(),
|
|
307
|
+
label: item[column.filterLabelKey as keyof typeof item]?.toString(),
|
|
296
308
|
}));
|
|
297
309
|
return options;
|
|
298
310
|
} catch (error) {
|
|
@@ -303,12 +315,14 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
303
315
|
return [];
|
|
304
316
|
}
|
|
305
317
|
};
|
|
318
|
+
|
|
306
319
|
const updateFilterOptions = async () => {
|
|
307
320
|
const newFilterOptions: Record<string, any[]> = {};
|
|
308
321
|
|
|
309
322
|
for (const column of columns) {
|
|
310
323
|
if (
|
|
311
|
-
column.filterType === "select"
|
|
324
|
+
(column.filterType === "select" ||
|
|
325
|
+
column.filterType === "multi-select") &&
|
|
312
326
|
(column.filterSource || column.filterOptions) &&
|
|
313
327
|
column.filterValueKey &&
|
|
314
328
|
column.filterLabelKey &&
|
|
@@ -316,11 +330,13 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
316
330
|
) {
|
|
317
331
|
const options = await fetchFilterOptions(column);
|
|
318
332
|
|
|
319
|
-
if (options) {
|
|
333
|
+
if (options && column.filterType === "select") {
|
|
320
334
|
newFilterOptions[column.filterParam as string] = [
|
|
321
335
|
{ value: "", label: "" },
|
|
322
336
|
...options,
|
|
323
337
|
];
|
|
338
|
+
} else if (options && column.filterType === "multi-select") {
|
|
339
|
+
newFilterOptions[column.filterParam as string] = options;
|
|
324
340
|
}
|
|
325
341
|
}
|
|
326
342
|
}
|
|
@@ -428,7 +444,7 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
428
444
|
// Pagination display logic
|
|
429
445
|
const paginationDisplay = `Strana ${(currentPage || 0) + 1} z ${data?.totalPages || 1}`;
|
|
430
446
|
|
|
431
|
-
const filterHandler = (filterParam: keyof T, value: string) => {
|
|
447
|
+
const filterHandler = (filterParam: keyof T, value: string | string[]) => {
|
|
432
448
|
setColumnFilters((prev) => ({ ...prev, [filterParam]: value }));
|
|
433
449
|
setCurrentPage(0);
|
|
434
450
|
};
|
|
@@ -738,7 +754,6 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
738
754
|
>
|
|
739
755
|
{filterType === "select" ? (
|
|
740
756
|
<SelectField
|
|
741
|
-
// label={header}
|
|
742
757
|
key={JSON.stringify(mergedFilters)}
|
|
743
758
|
name={String(key) + "_filter"}
|
|
744
759
|
onInputChange={(e) =>
|
|
@@ -755,16 +770,37 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
755
770
|
mergedFilters?.[String(filterParam)] ?? ""
|
|
756
771
|
}
|
|
757
772
|
clearable
|
|
758
|
-
className="
|
|
773
|
+
className="px-0"
|
|
759
774
|
placeholder={"Zadejte filtr"}
|
|
760
775
|
rounded={true}
|
|
761
776
|
disabled={Object.keys(
|
|
762
777
|
(filters as object) || {}
|
|
763
778
|
).includes(String(filterParam))}
|
|
764
779
|
/>
|
|
780
|
+
) : filterType === "multi-select" ? (
|
|
781
|
+
<MultiSelect
|
|
782
|
+
key={JSON.stringify(mergedFilters)}
|
|
783
|
+
options={
|
|
784
|
+
filterOptions[String(filterParam)] || []
|
|
785
|
+
}
|
|
786
|
+
onChange={(values) =>
|
|
787
|
+
filterHandler(
|
|
788
|
+
filterParam as keyof T,
|
|
789
|
+
values
|
|
790
|
+
)
|
|
791
|
+
}
|
|
792
|
+
value={
|
|
793
|
+
mergedFilters?.[String(filterParam)] || []
|
|
794
|
+
}
|
|
795
|
+
placeholder={"Zadejte filtr"}
|
|
796
|
+
className="px-0"
|
|
797
|
+
disabled={Object.keys(
|
|
798
|
+
(filters as object) || {}
|
|
799
|
+
).includes(String(filterParam))}
|
|
800
|
+
variant="secondary"
|
|
801
|
+
/>
|
|
765
802
|
) : filterType === "dateRange" ? (
|
|
766
803
|
<DateRangeField
|
|
767
|
-
// label={header}
|
|
768
804
|
key={JSON.stringify(mergedFilters)}
|
|
769
805
|
name={String(filterParam)}
|
|
770
806
|
nameEnd={String(filterParam2)}
|
|
@@ -793,7 +829,6 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
793
829
|
/>
|
|
794
830
|
) : filterType === "date" ? (
|
|
795
831
|
<DateField
|
|
796
|
-
// label={header}
|
|
797
832
|
key={JSON.stringify(mergedFilters)}
|
|
798
833
|
name={String(filterParam)}
|
|
799
834
|
onInputChange={(e) =>
|
|
@@ -816,7 +851,6 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
816
851
|
/>
|
|
817
852
|
) : filterType === "text" ? (
|
|
818
853
|
<InputField
|
|
819
|
-
// label={header}
|
|
820
854
|
key={filterParam}
|
|
821
855
|
name={String(key) + "_filter"}
|
|
822
856
|
onInputChange={(e) =>
|
|
@@ -882,7 +916,7 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
882
916
|
}
|
|
883
917
|
className={`px-3 py-2 ${rowAction ? "cursor-pointer" : ""} ${
|
|
884
918
|
colIndex === 0
|
|
885
|
-
? "font-medium text-
|
|
919
|
+
? "font-medium text-muted-foreground"
|
|
886
920
|
: "text-gray-700"
|
|
887
921
|
} ${classes || ""}`}
|
|
888
922
|
>
|
|
@@ -898,7 +932,7 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
898
932
|
.map((action, actionIndex) => (
|
|
899
933
|
<div
|
|
900
934
|
key={`${rowIndex}-${colIndex}-${actionIndex}`}
|
|
901
|
-
className="
|
|
935
|
+
className="inline-flex align-middle"
|
|
902
936
|
>
|
|
903
937
|
{action.icon && (
|
|
904
938
|
<Button
|
|
@@ -401,19 +401,19 @@ const SearchInput: React.FC<SearchInputProps> = ({
|
|
|
401
401
|
)}
|
|
402
402
|
{isFocused && !isLoading && (
|
|
403
403
|
<MdExpandLess
|
|
404
|
-
className="material-icons absolute right-0 cursor-pointer text-
|
|
404
|
+
className="material-icons absolute right-0 cursor-pointer text-muted-foreground lext-lg"
|
|
405
405
|
onClick={onBlur}
|
|
406
406
|
/>
|
|
407
407
|
)}
|
|
408
408
|
{!isFocused && !isLoading && (
|
|
409
409
|
<MdExpandMore
|
|
410
|
-
className="material-icons absolute right-0 cursor-pointer text-
|
|
410
|
+
className="material-icons absolute right-0 cursor-pointer text-muted-foreground lext-lg"
|
|
411
411
|
onClick={handleExpandMoreClick}
|
|
412
412
|
/>
|
|
413
413
|
)}
|
|
414
414
|
{value && clearable && !isLoading && (
|
|
415
415
|
<MdClose
|
|
416
|
-
className="material-icons absolute right-6 cursor-pointer text-
|
|
416
|
+
className="material-icons absolute right-6 cursor-pointer text-muted-foreground lext-lg"
|
|
417
417
|
onClick={handleClearQuery}
|
|
418
418
|
/>
|
|
419
419
|
)}
|
|
@@ -83,14 +83,14 @@ export default function DateRangeField({
|
|
|
83
83
|
inputClassName={(className) => {
|
|
84
84
|
return (
|
|
85
85
|
className +
|
|
86
|
-
` focus:!ring-indigo-200 focus:!border-indigo-300 focus:ring-4 border !border-gray-200 !pr-8 !pl-[8px] font-normal ${rounded ? " rounded-lg " : " !rounded-none "} outline-none shadow-none
|
|
86
|
+
` focus:!ring-indigo-200 focus:!border-indigo-300 focus:ring-4 border !border-gray-200 !pr-8 !pl-[8px] font-normal ${rounded ? " rounded-lg " : " !rounded-none "} outline-none shadow-none placeholder-muted-foreground`
|
|
87
87
|
);
|
|
88
88
|
}}
|
|
89
89
|
containerClassName={(className) => {
|
|
90
90
|
return className + " ";
|
|
91
91
|
}}
|
|
92
92
|
separator={"-"}
|
|
93
|
-
toggleClassName="absolute rounded-r-lg right-0 h-full px-3 text-gray-400 focus:outline-none disabled:opacity-80 disabled:cursor-not-allowed text-
|
|
93
|
+
toggleClassName="absolute rounded-r-lg right-0 h-full px-3 text-gray-400 focus:outline-none disabled:opacity-80 disabled:cursor-not-allowed text-muted-foreground"
|
|
94
94
|
{...rest}
|
|
95
95
|
/>
|
|
96
96
|
</div>
|