@duskmoon-dev/components 0.3.1 → 0.4.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/README.md +61 -2
- package/dist/{chunk-r9wkv7xd.js → chunk-fwjzvsrx.js} +3 -3
- package/dist/classes/chat.d.ts +43 -0
- package/dist/classes/console-page.d.ts +16 -0
- package/dist/classes/dropdown.d.ts +5 -5
- package/dist/classes/fab.d.ts +11 -0
- package/dist/classes/index.d.ts +6 -0
- package/dist/classes/index.js +1443 -1210
- package/dist/classes/megamenu.d.ts +10 -0
- package/dist/classes/otp-input.d.ts +12 -0
- package/dist/classes/popover.d.ts +1 -3
- package/dist/classes/swap.d.ts +12 -0
- package/dist/classes/tree-select.d.ts +6 -6
- package/dist/components/anchor/index.js +2 -2
- package/dist/components/app/index.js +211 -151
- package/dist/components/avatar/Avatar.types.d.ts +1 -1
- package/dist/components/avatar/index.js +2 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/button/Button.d.ts +1 -1
- package/dist/components/button/Button.types.d.ts +8 -0
- package/dist/components/button/index.js +253 -24
- package/dist/components/calendar/index.js +44 -19
- package/dist/components/cascader/index.js +2 -2
- package/dist/components/chat/Chat.d.ts +22 -0
- package/dist/components/chat/Chat.types.d.ts +73 -0
- package/dist/components/chat/index.d.ts +2 -0
- package/dist/components/chat/index.js +309 -0
- package/dist/components/color-picker/ColorPicker.types.d.ts +2 -1
- package/dist/components/color-picker/index.js +210 -13
- package/dist/components/config-provider/index.js +2 -2
- package/dist/components/console-page/ConsolePage.d.ts +2 -0
- package/dist/components/console-page/ConsolePage.types.d.ts +29 -0
- package/dist/components/console-page/index.d.ts +2 -0
- package/dist/components/console-page/index.js +205 -0
- package/dist/components/date-picker/DatePicker.types.d.ts +1 -0
- package/dist/components/date-picker/index.js +537 -35
- package/dist/components/date-picker/usePickerDropdown.d.ts +17 -0
- package/dist/components/dm-breadcrumb/index.js +18 -18
- package/dist/components/dm-date-picker/index.js +635 -133
- package/dist/components/dm-drawer/index.js +269 -40
- package/dist/components/dm-layout/index.js +575 -208
- package/dist/components/dm-menu/index.js +399 -32
- package/dist/components/dm-message/index.js +18 -18
- package/dist/components/dm-page-header/index.js +537 -247
- package/dist/components/dm-pagination/index.js +39 -39
- package/dist/components/dm-pro-table/index.js +2374 -1559
- package/dist/components/dm-provider/index.js +94 -94
- package/dist/components/dm-query/DmQuery.types.d.ts +1 -1
- package/dist/components/dm-query/index.js +955 -210
- package/dist/components/dm-search/DmSearch.types.d.ts +4 -0
- package/dist/components/dm-search/index.js +937 -183
- package/dist/components/dm-splitter/index.js +32 -32
- package/dist/components/dm-status/index.js +25 -25
- package/dist/components/dm-table/index.js +1430 -676
- package/dist/components/dm-tabs/index.js +34 -34
- package/dist/components/dm-toolbar/index.js +423 -133
- package/dist/components/dm-tree/index.js +92 -92
- package/dist/components/dm-truncate/index.js +145 -65
- package/dist/components/dropdown/Dropdown.types.d.ts +1 -1
- package/dist/components/dropdown/index.js +467 -177
- package/dist/components/fab/Fab.d.ts +4 -0
- package/dist/components/fab/Fab.types.d.ts +25 -0
- package/dist/components/fab/index.d.ts +2 -0
- package/dist/components/fab/index.js +480 -0
- package/dist/components/form/Form.types.d.ts +1 -0
- package/dist/components/form/index.js +16 -5
- package/dist/components/grid/index.js +2 -2
- package/dist/components/input/index.js +4 -4
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/megamenu/Megamenu.d.ts +2 -0
- package/dist/components/megamenu/Megamenu.types.d.ts +32 -0
- package/dist/components/megamenu/index.d.ts +2 -0
- package/dist/components/megamenu/index.js +214 -0
- package/dist/components/message/index.js +5 -5
- package/dist/components/modal/index.js +128 -68
- package/dist/components/notification/index.js +2 -2
- package/dist/components/otp-input/OtpInput.d.ts +2 -0
- package/dist/components/otp-input/OtpInput.types.d.ts +16 -0
- package/dist/components/otp-input/index.d.ts +2 -0
- package/dist/components/otp-input/index.js +112 -0
- package/dist/components/popconfirm/index.js +297 -68
- package/dist/components/popover/index.js +24 -4
- package/dist/components/skeleton/index.js +5 -5
- package/dist/components/spin/index.js +2 -2
- package/dist/components/steps/index.js +2 -2
- package/dist/components/swap/Swap.d.ts +3 -0
- package/dist/components/swap/Swap.types.d.ts +22 -0
- package/dist/components/swap/index.d.ts +2 -0
- package/dist/components/swap/index.js +109 -0
- package/dist/components/table/index.js +2 -2
- package/dist/components/tabs/index.js +2 -2
- package/dist/components/tag/index.js +2 -2
- package/dist/components/time-picker/TimePicker.types.d.ts +1 -0
- package/dist/components/time-picker/index.js +167 -29
- package/dist/components/tooltip/Tooltip.types.d.ts +4 -0
- package/dist/components/tooltip/index.js +107 -27
- package/dist/components/tour/index.js +315 -86
- package/dist/components/tree-select/index.js +8 -8
- package/dist/components/typography/index.js +4 -4
- package/dist/components/upload/Upload.types.d.ts +1 -0
- package/dist/components/upload/index.js +7 -5
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4023 -2134
- package/dist/infrastructure.js +11 -11
- package/dist/styles.css +13677 -9811
- package/dist/theme/index.js +3 -3
- package/dist/utils/index.js +5 -5
- package/package.json +30 -6
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
// src/components/dm-table/DmTable.tsx
|
|
4
|
+
import { useMemo as useMemo8, useState as useState10 } from "react";
|
|
5
|
+
|
|
3
6
|
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
4
7
|
function r(e) {
|
|
5
8
|
var t, f, n = "";
|
|
@@ -25,6 +28,25 @@ function clsx() {
|
|
|
25
28
|
function cn(...inputs) {
|
|
26
29
|
return clsx(inputs);
|
|
27
30
|
}
|
|
31
|
+
// src/classes/dm-table.ts
|
|
32
|
+
var dmTableBaseClass = "dm-table";
|
|
33
|
+
var dmTableSearchClass = "dm-table-search";
|
|
34
|
+
var dmTableCardClass = "dm-table-card";
|
|
35
|
+
var dmTableHeaderClass = "dm-table-header";
|
|
36
|
+
var dmTableTitleClass = "dm-table-title";
|
|
37
|
+
var dmTableExtraClass = "dm-table-extra";
|
|
38
|
+
var dmTableIndicatorsClass = "dm-table-indicators";
|
|
39
|
+
var dmTableTableExtraClass = "dm-table-table-extra";
|
|
40
|
+
var dmTableColumnSettingClass = "dm-table-column-setting";
|
|
41
|
+
var dmTablePaginationClass = "dm-table-pagination";
|
|
42
|
+
function getDmTableClasses({ className }) {
|
|
43
|
+
return cn(dmTableBaseClass, className);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// src/components/button/Button.tsx
|
|
47
|
+
import React from "react";
|
|
48
|
+
import { createPortal } from "react-dom";
|
|
49
|
+
|
|
28
50
|
// src/classes/button.ts
|
|
29
51
|
var buttonBaseClass = "btn";
|
|
30
52
|
var buttonColorClasses = {
|
|
@@ -48,7 +70,7 @@ var buttonAppearanceClasses = {
|
|
|
48
70
|
};
|
|
49
71
|
var buttonShapeClasses = {
|
|
50
72
|
rect: "",
|
|
51
|
-
circle: "btn-circle",
|
|
73
|
+
circle: "btn-circle btn-icon",
|
|
52
74
|
square: "btn-square"
|
|
53
75
|
};
|
|
54
76
|
var buttonSizeClasses = {
|
|
@@ -68,11 +90,14 @@ function getButtonClasses({
|
|
|
68
90
|
isLoading,
|
|
69
91
|
className
|
|
70
92
|
}) {
|
|
71
|
-
return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
|
|
93
|
+
return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], shape === "circle" && size === "xs" && "btn-icon-sm", shape === "circle" && size === "sm" && "btn-icon-sm", shape === "circle" && size === "lg" && "btn-icon-lg", block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
|
|
72
94
|
}
|
|
73
95
|
|
|
74
96
|
// src/components/button/Button.tsx
|
|
75
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
97
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
98
|
+
function isPromiseLike(value) {
|
|
99
|
+
return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
100
|
+
}
|
|
76
101
|
function Button({
|
|
77
102
|
color = "primary",
|
|
78
103
|
appearance = "filled",
|
|
@@ -86,8 +111,155 @@ function Button({
|
|
|
86
111
|
children,
|
|
87
112
|
disabled,
|
|
88
113
|
ref,
|
|
114
|
+
confirm,
|
|
115
|
+
onClick,
|
|
89
116
|
...props
|
|
90
117
|
}) {
|
|
118
|
+
const buttonRef = React.useRef(null);
|
|
119
|
+
const popoverRef = React.useRef(null);
|
|
120
|
+
const cancelRef = React.useRef(null);
|
|
121
|
+
const approvalRef = React.useRef("idle");
|
|
122
|
+
const pendingRef = React.useRef(false);
|
|
123
|
+
const actionRef = React.useRef(0);
|
|
124
|
+
const operationRef = React.useRef(0);
|
|
125
|
+
const mountedRef = React.useRef(false);
|
|
126
|
+
const [portalTarget, setPortalTarget] = React.useState(null);
|
|
127
|
+
const [confirmLoading, setConfirmLoading] = React.useState(false);
|
|
128
|
+
const [confirmError, setConfirmError] = React.useState(false);
|
|
129
|
+
const generatedId = React.useId().replace(/:/g, "");
|
|
130
|
+
const popoverId = `button-confirm-${generatedId}`;
|
|
131
|
+
const titleId = `${popoverId}-title`;
|
|
132
|
+
const descriptionId = `${popoverId}-description`;
|
|
133
|
+
const anchor = `--${popoverId}-anchor`;
|
|
134
|
+
const hasConfirm = Boolean(confirm);
|
|
135
|
+
const confirmation = confirm && typeof confirm === "object" ? confirm : undefined;
|
|
136
|
+
const title = confirmation ? confirmation.title : "Confirm action";
|
|
137
|
+
const hasTitle = title !== undefined && title !== null && title !== false && title !== "";
|
|
138
|
+
const content = confirmation?.component ?? confirmation?.message ?? confirmation?.description;
|
|
139
|
+
const hasContent = content !== undefined && content !== null && content !== false && content !== "";
|
|
140
|
+
const mergedRef = React.useCallback((node) => {
|
|
141
|
+
buttonRef.current = node;
|
|
142
|
+
if (!node) {
|
|
143
|
+
if (typeof ref === "function")
|
|
144
|
+
ref(null);
|
|
145
|
+
else if (ref)
|
|
146
|
+
ref.current = null;
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const cleanup = typeof ref === "function" ? ref(node) : undefined;
|
|
150
|
+
if (ref && typeof ref !== "function")
|
|
151
|
+
ref.current = node;
|
|
152
|
+
return () => {
|
|
153
|
+
buttonRef.current = null;
|
|
154
|
+
if (typeof cleanup === "function")
|
|
155
|
+
cleanup();
|
|
156
|
+
else if (typeof ref === "function")
|
|
157
|
+
ref(null);
|
|
158
|
+
else if (ref)
|
|
159
|
+
ref.current = null;
|
|
160
|
+
};
|
|
161
|
+
}, [ref]);
|
|
162
|
+
React.useEffect(() => {
|
|
163
|
+
mountedRef.current = true;
|
|
164
|
+
return () => {
|
|
165
|
+
mountedRef.current = false;
|
|
166
|
+
operationRef.current += 1;
|
|
167
|
+
};
|
|
168
|
+
}, []);
|
|
169
|
+
React.useEffect(() => {
|
|
170
|
+
operationRef.current += 1;
|
|
171
|
+
approvalRef.current = "idle";
|
|
172
|
+
setConfirmError(false);
|
|
173
|
+
setPortalTarget(hasConfirm ? document.body : null);
|
|
174
|
+
}, [hasConfirm]);
|
|
175
|
+
function closePopover() {
|
|
176
|
+
if (popoverRef.current?.matches(":popover-open")) {
|
|
177
|
+
popoverRef.current.hidePopover();
|
|
178
|
+
}
|
|
179
|
+
buttonRef.current?.focus();
|
|
180
|
+
}
|
|
181
|
+
function handleClick(event) {
|
|
182
|
+
if (!confirm) {
|
|
183
|
+
onClick?.(event);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (approvalRef.current === "native") {
|
|
187
|
+
approvalRef.current = "idle";
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (approvalRef.current === "action") {
|
|
191
|
+
approvalRef.current = "idle";
|
|
192
|
+
let result;
|
|
193
|
+
try {
|
|
194
|
+
result = onClick?.(event);
|
|
195
|
+
} catch {
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
pendingRef.current = false;
|
|
198
|
+
setConfirmError(true);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (!isPromiseLike(result)) {
|
|
202
|
+
pendingRef.current = false;
|
|
203
|
+
closePopover();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const userPreventedDefault = event.defaultPrevented;
|
|
207
|
+
event.preventDefault();
|
|
208
|
+
setConfirmLoading(true);
|
|
209
|
+
const action = actionRef.current;
|
|
210
|
+
const operation = operationRef.current;
|
|
211
|
+
Promise.resolve(result).then(() => {
|
|
212
|
+
if (!mountedRef.current || action !== actionRef.current)
|
|
213
|
+
return;
|
|
214
|
+
pendingRef.current = false;
|
|
215
|
+
setConfirmLoading(false);
|
|
216
|
+
if (operation !== operationRef.current)
|
|
217
|
+
return;
|
|
218
|
+
closePopover();
|
|
219
|
+
if (!userPreventedDefault && !buttonRef.current?.disabled) {
|
|
220
|
+
approvalRef.current = "native";
|
|
221
|
+
buttonRef.current?.click();
|
|
222
|
+
approvalRef.current = "idle";
|
|
223
|
+
}
|
|
224
|
+
}, () => {
|
|
225
|
+
if (!mountedRef.current || action !== actionRef.current)
|
|
226
|
+
return;
|
|
227
|
+
pendingRef.current = false;
|
|
228
|
+
setConfirmLoading(false);
|
|
229
|
+
if (operation !== operationRef.current)
|
|
230
|
+
return;
|
|
231
|
+
setConfirmError(true);
|
|
232
|
+
cancelRef.current?.focus();
|
|
233
|
+
});
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
event.preventDefault();
|
|
237
|
+
if (disabled || isLoading || pendingRef.current)
|
|
238
|
+
return;
|
|
239
|
+
if (popoverRef.current?.matches(":popover-open")) {
|
|
240
|
+
closePopover();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
setConfirmError(false);
|
|
244
|
+
popoverRef.current?.showPopover();
|
|
245
|
+
cancelRef.current?.focus();
|
|
246
|
+
}
|
|
247
|
+
function handleConfirm(event) {
|
|
248
|
+
event.preventDefault();
|
|
249
|
+
event.stopPropagation();
|
|
250
|
+
const trigger = buttonRef.current;
|
|
251
|
+
if (disabled || isLoading || pendingRef.current || !trigger || trigger.disabled || !event.currentTarget.matches(":popover-open"))
|
|
252
|
+
return;
|
|
253
|
+
setConfirmError(false);
|
|
254
|
+
pendingRef.current = true;
|
|
255
|
+
actionRef.current += 1;
|
|
256
|
+
approvalRef.current = "action";
|
|
257
|
+
trigger.click();
|
|
258
|
+
if (approvalRef.current === "action") {
|
|
259
|
+
approvalRef.current = "idle";
|
|
260
|
+
pendingRef.current = false;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
91
263
|
const classes = getButtonClasses({
|
|
92
264
|
color,
|
|
93
265
|
appearance,
|
|
@@ -97,29 +269,104 @@ function Button({
|
|
|
97
269
|
isLoading,
|
|
98
270
|
className
|
|
99
271
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
...props,
|
|
272
|
+
const confirmClasses = getButtonClasses({
|
|
273
|
+
color,
|
|
274
|
+
size: "sm",
|
|
275
|
+
isLoading: confirmLoading
|
|
276
|
+
});
|
|
277
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
107
278
|
children: [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
279
|
+
/* @__PURE__ */ jsxs("button", {
|
|
280
|
+
ref: confirm ? mergedRef : ref,
|
|
281
|
+
className: classes,
|
|
282
|
+
disabled: disabled || isLoading,
|
|
283
|
+
"aria-busy": isLoading,
|
|
284
|
+
"aria-disabled": disabled || isLoading,
|
|
285
|
+
...props,
|
|
286
|
+
style: confirm ? { ...props.style, anchorName: anchor } : props.style,
|
|
287
|
+
"aria-haspopup": confirm ? "dialog" : props["aria-haspopup"],
|
|
288
|
+
"aria-controls": confirm ? popoverId : props["aria-controls"],
|
|
289
|
+
onClick: confirm ? handleClick : onClick,
|
|
290
|
+
children: [
|
|
291
|
+
isLoading && /* @__PURE__ */ jsx("span", {
|
|
292
|
+
className: "btn-spinner"
|
|
293
|
+
}),
|
|
294
|
+
!isLoading && leftIcon && /* @__PURE__ */ jsx("span", {
|
|
295
|
+
className: "btn-icon-left",
|
|
296
|
+
children: leftIcon
|
|
297
|
+
}),
|
|
298
|
+
/* @__PURE__ */ jsx("span", {
|
|
299
|
+
className: "btn-content",
|
|
300
|
+
children
|
|
301
|
+
}),
|
|
302
|
+
!isLoading && rightIcon && /* @__PURE__ */ jsx("span", {
|
|
303
|
+
className: "btn-icon-right",
|
|
304
|
+
children: rightIcon
|
|
305
|
+
})
|
|
306
|
+
]
|
|
118
307
|
}),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
308
|
+
confirm && portalTarget && createPortal(/* @__PURE__ */ jsxs("form", {
|
|
309
|
+
id: popoverId,
|
|
310
|
+
ref: popoverRef,
|
|
311
|
+
popover: "auto",
|
|
312
|
+
role: "dialog",
|
|
313
|
+
"aria-labelledby": hasTitle ? titleId : undefined,
|
|
314
|
+
"aria-label": hasTitle ? undefined : "Confirm action",
|
|
315
|
+
"aria-describedby": hasContent ? descriptionId : undefined,
|
|
316
|
+
className: "popover popover-confirm popover-bottom",
|
|
317
|
+
style: { positionAnchor: anchor },
|
|
318
|
+
onSubmit: handleConfirm,
|
|
319
|
+
onClick: (event) => event.stopPropagation(),
|
|
320
|
+
onToggle: (event) => {
|
|
321
|
+
if (!event.currentTarget.matches(":popover-open")) {
|
|
322
|
+
operationRef.current += 1;
|
|
323
|
+
if (event.currentTarget.contains(document.activeElement) || document.activeElement === document.body) {
|
|
324
|
+
buttonRef.current?.focus();
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
children: [
|
|
329
|
+
hasTitle && /* @__PURE__ */ jsx("div", {
|
|
330
|
+
className: "popover-header",
|
|
331
|
+
children: /* @__PURE__ */ jsx("h3", {
|
|
332
|
+
id: titleId,
|
|
333
|
+
className: "popover-title",
|
|
334
|
+
children: title
|
|
335
|
+
})
|
|
336
|
+
}),
|
|
337
|
+
hasContent && /* @__PURE__ */ jsx("div", {
|
|
338
|
+
id: descriptionId,
|
|
339
|
+
className: "popover-body",
|
|
340
|
+
children: content
|
|
341
|
+
}),
|
|
342
|
+
confirmError && /* @__PURE__ */ jsx("div", {
|
|
343
|
+
role: "alert",
|
|
344
|
+
className: "popover-body",
|
|
345
|
+
children: "The action failed. Please try again."
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ jsxs("div", {
|
|
348
|
+
className: "popover-footer",
|
|
349
|
+
children: [
|
|
350
|
+
/* @__PURE__ */ jsx("button", {
|
|
351
|
+
ref: cancelRef,
|
|
352
|
+
type: "button",
|
|
353
|
+
className: "btn btn-text btn-sm",
|
|
354
|
+
popoverTarget: popoverId,
|
|
355
|
+
popoverTargetAction: "hide",
|
|
356
|
+
disabled: confirmLoading,
|
|
357
|
+
children: confirmation?.cancelText ?? "Cancel"
|
|
358
|
+
}),
|
|
359
|
+
/* @__PURE__ */ jsx("button", {
|
|
360
|
+
type: "submit",
|
|
361
|
+
className: confirmClasses,
|
|
362
|
+
disabled: disabled || isLoading || confirmLoading,
|
|
363
|
+
"aria-busy": confirmLoading,
|
|
364
|
+
children: confirmation?.confirmText ?? "Confirm"
|
|
365
|
+
})
|
|
366
|
+
]
|
|
367
|
+
})
|
|
368
|
+
]
|
|
369
|
+
}), portalTarget)
|
|
123
370
|
]
|
|
124
371
|
});
|
|
125
372
|
}
|
|
@@ -166,359 +413,106 @@ function Card({
|
|
|
166
413
|
children
|
|
167
414
|
});
|
|
168
415
|
}
|
|
169
|
-
// src/components/
|
|
170
|
-
import {
|
|
416
|
+
// src/components/dm-pagination/DmPagination.tsx
|
|
417
|
+
import {
|
|
418
|
+
forwardRef as forwardRef2,
|
|
419
|
+
useEffect,
|
|
420
|
+
useMemo as useMemo2,
|
|
421
|
+
useRef,
|
|
422
|
+
useState as useState2
|
|
423
|
+
} from "react";
|
|
171
424
|
|
|
172
|
-
// src/classes/
|
|
173
|
-
var
|
|
174
|
-
var
|
|
175
|
-
var
|
|
176
|
-
var
|
|
177
|
-
var
|
|
178
|
-
var
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
var datePickerSizeClasses = {
|
|
184
|
-
sm: "datepicker-sm",
|
|
185
|
-
md: "",
|
|
186
|
-
lg: "datepicker-lg"
|
|
187
|
-
};
|
|
188
|
-
var datePickerStatusClasses = {
|
|
189
|
-
error: "datepicker-error",
|
|
190
|
-
success: "datepicker-success"
|
|
425
|
+
// src/classes/dm-pagination.ts
|
|
426
|
+
var dmPaginationBaseClass = "dm-pagination";
|
|
427
|
+
var dmPaginationHiddenClass = "dm-pagination-hidden";
|
|
428
|
+
var dmPaginationPagerClass = "dm-pagination-pager";
|
|
429
|
+
var dmPaginationRefreshClass = "dm-pagination-refresh";
|
|
430
|
+
var dmPaginationRefreshLoadingClass = "dm-pagination-refresh-loading";
|
|
431
|
+
var dmPaginationSelectedClass = "dm-pagination-selected";
|
|
432
|
+
var dmPaginationAlignClasses = {
|
|
433
|
+
left: "dm-pagination-left",
|
|
434
|
+
center: "dm-pagination-center",
|
|
435
|
+
right: "dm-pagination-right"
|
|
191
436
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
437
|
+
function getDmPaginationClasses({
|
|
438
|
+
align = "right",
|
|
439
|
+
hidden,
|
|
440
|
+
className
|
|
441
|
+
}) {
|
|
442
|
+
return cn(dmPaginationBaseClass, dmPaginationAlignClasses[align], hidden && dmPaginationHiddenClass, className);
|
|
443
|
+
}
|
|
444
|
+
function getDmPaginationRefreshClasses({
|
|
445
|
+
loading,
|
|
446
|
+
className
|
|
447
|
+
}) {
|
|
448
|
+
return cn(dmPaginationRefreshClass, loading && dmPaginationRefreshLoadingClass, className);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// src/components/pagination/Pagination.tsx
|
|
452
|
+
import {
|
|
453
|
+
forwardRef,
|
|
454
|
+
useMemo,
|
|
455
|
+
useState
|
|
456
|
+
} from "react";
|
|
457
|
+
|
|
458
|
+
// src/classes/pagination.ts
|
|
459
|
+
var paginationBaseClass = "pagination";
|
|
460
|
+
var paginationItemClass = "pagination-item";
|
|
461
|
+
var paginationItemActiveClass = "pagination-item-active";
|
|
462
|
+
var paginationItemDisabledClass = "pagination-item-disabled";
|
|
463
|
+
var paginationPrevClass = "pagination-prev";
|
|
464
|
+
var paginationNextClass = "pagination-next";
|
|
465
|
+
var paginationEllipsisClass = "pagination-ellipsis";
|
|
466
|
+
var paginationCompactClass = "pagination-compact";
|
|
467
|
+
var paginationInfoClass = "pagination-info";
|
|
468
|
+
var paginationInfoTextClass = "pagination-info-text";
|
|
469
|
+
var paginationInputClass = "pagination-input";
|
|
470
|
+
var paginationResponsiveClass = "pagination-responsive";
|
|
471
|
+
var paginationSizeClasses = {
|
|
472
|
+
sm: "pagination-sm",
|
|
473
|
+
md: "",
|
|
474
|
+
lg: "pagination-lg"
|
|
199
475
|
};
|
|
200
|
-
function
|
|
476
|
+
function getPaginationClasses({
|
|
201
477
|
size = "md",
|
|
202
|
-
|
|
203
|
-
picker = "date",
|
|
204
|
-
open,
|
|
205
|
-
disabled,
|
|
206
|
-
range,
|
|
478
|
+
compact,
|
|
207
479
|
className
|
|
208
480
|
}) {
|
|
209
|
-
return cn(
|
|
481
|
+
return cn(paginationBaseClass, paginationResponsiveClass, paginationSizeClasses[size], compact && paginationCompactClass, className);
|
|
210
482
|
}
|
|
211
|
-
function
|
|
212
|
-
|
|
213
|
-
|
|
483
|
+
function getPaginationItemClasses({
|
|
484
|
+
active,
|
|
485
|
+
disabled
|
|
214
486
|
}) {
|
|
215
|
-
return cn(
|
|
487
|
+
return cn(paginationItemClass, active && paginationItemActiveClass, disabled && paginationItemDisabledClass);
|
|
216
488
|
}
|
|
217
489
|
|
|
218
|
-
// src/components/
|
|
490
|
+
// src/components/pagination/Pagination.tsx
|
|
219
491
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return `${year}-${month}`;
|
|
227
|
-
if (picker === "year")
|
|
228
|
-
return String(year);
|
|
229
|
-
if (picker === "time")
|
|
230
|
-
return "00:00";
|
|
231
|
-
return `${year}-${month}-${day}`;
|
|
492
|
+
var defaultPageSizeOptions = [10, 20, 50, 100];
|
|
493
|
+
function toPositiveInteger(value, fallback) {
|
|
494
|
+
if (!Number.isFinite(value) || value === undefined) {
|
|
495
|
+
return fallback;
|
|
496
|
+
}
|
|
497
|
+
return Math.max(1, Math.floor(value));
|
|
232
498
|
}
|
|
233
|
-
function
|
|
234
|
-
|
|
235
|
-
return "month";
|
|
236
|
-
if (picker === "week")
|
|
237
|
-
return "week";
|
|
238
|
-
if (picker === "time")
|
|
239
|
-
return "time";
|
|
240
|
-
return picker === "year" || picker === "quarter" ? "text" : "date";
|
|
499
|
+
function clampPage(page, pageCount) {
|
|
500
|
+
return Math.min(pageCount, Math.max(1, Math.floor(page)));
|
|
241
501
|
}
|
|
242
|
-
function
|
|
243
|
-
|
|
244
|
-
return "Select month";
|
|
245
|
-
if (picker === "week")
|
|
246
|
-
return "Select week";
|
|
247
|
-
if (picker === "quarter")
|
|
248
|
-
return "Select quarter";
|
|
249
|
-
if (picker === "year")
|
|
250
|
-
return "Select year";
|
|
251
|
-
if (picker === "time")
|
|
252
|
-
return "Select time";
|
|
253
|
-
return "Select date";
|
|
502
|
+
function getPageCount(total, pageSize) {
|
|
503
|
+
return Math.max(1, Math.ceil(Math.max(0, total) / pageSize));
|
|
254
504
|
}
|
|
255
|
-
function
|
|
256
|
-
|
|
505
|
+
function getRange(current, pageSize, total) {
|
|
506
|
+
if (total <= 0) {
|
|
507
|
+
return [0, 0];
|
|
508
|
+
}
|
|
509
|
+
const start = (current - 1) * pageSize + 1;
|
|
510
|
+
const end = Math.min(total, current * pageSize);
|
|
511
|
+
return [start, end];
|
|
257
512
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
defaultOpen,
|
|
262
|
-
defaultValue,
|
|
263
|
-
disabled,
|
|
264
|
-
disabledDate,
|
|
265
|
-
onBlur,
|
|
266
|
-
onChange,
|
|
267
|
-
onFocus,
|
|
268
|
-
onOpenChange,
|
|
269
|
-
open,
|
|
270
|
-
picker = "date",
|
|
271
|
-
placeholder,
|
|
272
|
-
presets,
|
|
273
|
-
showNow,
|
|
274
|
-
size = "md",
|
|
275
|
-
status,
|
|
276
|
-
value,
|
|
277
|
-
...props
|
|
278
|
-
}, ref) => {
|
|
279
|
-
const isValueControlled = value !== undefined;
|
|
280
|
-
const isOpenControlled = open !== undefined;
|
|
281
|
-
const [innerValue, setInnerValue] = useState(() => normalizeDateValue(defaultValue));
|
|
282
|
-
const [innerOpen, setInnerOpen] = useState(Boolean(defaultOpen));
|
|
283
|
-
const currentValue = isValueControlled ? normalizeDateValue(value) : innerValue;
|
|
284
|
-
const visible = isOpenControlled ? Boolean(open) : innerOpen;
|
|
285
|
-
const inputType = inputTypeForPicker(picker);
|
|
286
|
-
function setVisible(nextOpen) {
|
|
287
|
-
if (!isOpenControlled) {
|
|
288
|
-
setInnerOpen(nextOpen);
|
|
289
|
-
}
|
|
290
|
-
onOpenChange?.(nextOpen);
|
|
291
|
-
}
|
|
292
|
-
function emitChange(nextValue) {
|
|
293
|
-
if (nextValue && disabledDate?.(nextValue)) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
if (!isValueControlled) {
|
|
297
|
-
setInnerValue(nextValue);
|
|
298
|
-
}
|
|
299
|
-
onChange?.(nextValue, nextValue ?? "");
|
|
300
|
-
}
|
|
301
|
-
const presetItems = useMemo(() => presets ?? [], [presets]);
|
|
302
|
-
return /* @__PURE__ */ jsxs2("div", {
|
|
303
|
-
...props,
|
|
304
|
-
ref,
|
|
305
|
-
className: getDatePickerClasses({
|
|
306
|
-
size,
|
|
307
|
-
status,
|
|
308
|
-
picker,
|
|
309
|
-
open: visible,
|
|
310
|
-
disabled,
|
|
311
|
-
className
|
|
312
|
-
}),
|
|
313
|
-
children: [
|
|
314
|
-
/* @__PURE__ */ jsx3("input", {
|
|
315
|
-
className: datePickerInputClass,
|
|
316
|
-
disabled,
|
|
317
|
-
type: inputType,
|
|
318
|
-
value: currentValue ?? "",
|
|
319
|
-
placeholder: placeholder ?? placeholderForPicker(picker),
|
|
320
|
-
onFocus: (event) => {
|
|
321
|
-
onFocus?.(event);
|
|
322
|
-
setVisible(true);
|
|
323
|
-
},
|
|
324
|
-
onBlur: (event) => {
|
|
325
|
-
onBlur?.(event);
|
|
326
|
-
setVisible(false);
|
|
327
|
-
},
|
|
328
|
-
onChange: (event) => emitChange(event.currentTarget.value || undefined)
|
|
329
|
-
}),
|
|
330
|
-
allowClear && currentValue && !disabled ? /* @__PURE__ */ jsx3("button", {
|
|
331
|
-
type: "button",
|
|
332
|
-
className: datePickerClearClass,
|
|
333
|
-
"aria-label": "Clear date",
|
|
334
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
335
|
-
onClick: () => emitChange(undefined),
|
|
336
|
-
children: "x"
|
|
337
|
-
}) : null,
|
|
338
|
-
/* @__PURE__ */ jsx3("span", {
|
|
339
|
-
className: datePickerIconClass,
|
|
340
|
-
"aria-hidden": "true"
|
|
341
|
-
}),
|
|
342
|
-
(presetItems.length > 0 || showNow) && visible ? /* @__PURE__ */ jsxs2("div", {
|
|
343
|
-
className: getDatePickerDropdownClasses({ open: visible }),
|
|
344
|
-
children: [
|
|
345
|
-
presetItems.map((preset, index) => /* @__PURE__ */ jsx3("button", {
|
|
346
|
-
type: "button",
|
|
347
|
-
className: datePickerPresetClass,
|
|
348
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
349
|
-
onClick: () => emitChange(preset.value),
|
|
350
|
-
children: preset.label
|
|
351
|
-
}, index)),
|
|
352
|
-
showNow ? /* @__PURE__ */ jsx3("div", {
|
|
353
|
-
className: datePickerFooterClass,
|
|
354
|
-
children: /* @__PURE__ */ jsx3("button", {
|
|
355
|
-
type: "button",
|
|
356
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
357
|
-
onClick: () => emitChange(todayValue(picker)),
|
|
358
|
-
children: "Now"
|
|
359
|
-
})
|
|
360
|
-
}) : null
|
|
361
|
-
]
|
|
362
|
-
}) : null
|
|
363
|
-
]
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
DatePickerRoot.displayName = "DatePicker";
|
|
367
|
-
var RangePicker = forwardRef(({
|
|
368
|
-
allowClear,
|
|
369
|
-
className,
|
|
370
|
-
defaultValue,
|
|
371
|
-
disabled,
|
|
372
|
-
disabledDate,
|
|
373
|
-
onChange,
|
|
374
|
-
picker = "date",
|
|
375
|
-
placeholder,
|
|
376
|
-
separator = "-",
|
|
377
|
-
size = "md",
|
|
378
|
-
status,
|
|
379
|
-
value,
|
|
380
|
-
...props
|
|
381
|
-
}, ref) => {
|
|
382
|
-
const isControlled = value !== undefined;
|
|
383
|
-
const [innerValue, setInnerValue] = useState(defaultValue ?? [undefined, undefined]);
|
|
384
|
-
const currentValue = isControlled ? value : innerValue;
|
|
385
|
-
const inputType = inputTypeForPicker(picker);
|
|
386
|
-
function emitChange(nextValue) {
|
|
387
|
-
if (nextValue.some((item) => item !== undefined && Boolean(disabledDate?.(item)))) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
if (!isControlled) {
|
|
391
|
-
setInnerValue(nextValue);
|
|
392
|
-
}
|
|
393
|
-
onChange?.(nextValue, [nextValue[0] ?? "", nextValue[1] ?? ""]);
|
|
394
|
-
}
|
|
395
|
-
function updateIndex(index, nextItem) {
|
|
396
|
-
emitChange(index === 0 ? [nextItem, currentValue?.[1]] : [currentValue?.[0], nextItem]);
|
|
397
|
-
}
|
|
398
|
-
return /* @__PURE__ */ jsxs2("div", {
|
|
399
|
-
...props,
|
|
400
|
-
ref,
|
|
401
|
-
className: getDatePickerClasses({
|
|
402
|
-
size,
|
|
403
|
-
status,
|
|
404
|
-
picker,
|
|
405
|
-
disabled,
|
|
406
|
-
range: true,
|
|
407
|
-
className
|
|
408
|
-
}),
|
|
409
|
-
children: [
|
|
410
|
-
/* @__PURE__ */ jsx3("input", {
|
|
411
|
-
className: datePickerInputClass,
|
|
412
|
-
disabled,
|
|
413
|
-
type: inputType,
|
|
414
|
-
value: currentValue?.[0] ?? "",
|
|
415
|
-
placeholder: Array.isArray(placeholder) ? placeholder[0] : "Start date",
|
|
416
|
-
onChange: (event) => updateIndex(0, event.currentTarget.value || undefined)
|
|
417
|
-
}),
|
|
418
|
-
/* @__PURE__ */ jsx3("span", {
|
|
419
|
-
className: datePickerSeparatorClass,
|
|
420
|
-
children: separator
|
|
421
|
-
}),
|
|
422
|
-
/* @__PURE__ */ jsx3("input", {
|
|
423
|
-
className: datePickerInputClass,
|
|
424
|
-
disabled,
|
|
425
|
-
type: inputType,
|
|
426
|
-
value: currentValue?.[1] ?? "",
|
|
427
|
-
placeholder: Array.isArray(placeholder) ? placeholder[1] : "End date",
|
|
428
|
-
onChange: (event) => updateIndex(1, event.currentTarget.value || undefined)
|
|
429
|
-
}),
|
|
430
|
-
allowClear && (currentValue?.[0] || currentValue?.[1]) && !disabled ? /* @__PURE__ */ jsx3("button", {
|
|
431
|
-
type: "button",
|
|
432
|
-
className: datePickerClearClass,
|
|
433
|
-
"aria-label": "Clear date range",
|
|
434
|
-
onClick: () => emitChange([undefined, undefined]),
|
|
435
|
-
children: "x"
|
|
436
|
-
}) : null
|
|
437
|
-
]
|
|
438
|
-
});
|
|
439
|
-
});
|
|
440
|
-
RangePicker.displayName = "DatePicker.RangePicker";
|
|
441
|
-
function withPicker(picker, displayName) {
|
|
442
|
-
const Picker = forwardRef((props, ref) => /* @__PURE__ */ jsx3(DatePickerRoot, {
|
|
443
|
-
...props,
|
|
444
|
-
ref,
|
|
445
|
-
picker
|
|
446
|
-
}));
|
|
447
|
-
Picker.displayName = displayName;
|
|
448
|
-
return Picker;
|
|
449
|
-
}
|
|
450
|
-
var DatePicker = Object.assign(DatePickerRoot, {
|
|
451
|
-
RangePicker,
|
|
452
|
-
WeekPicker: withPicker("week", "DatePicker.WeekPicker"),
|
|
453
|
-
MonthPicker: withPicker("month", "DatePicker.MonthPicker"),
|
|
454
|
-
QuarterPicker: withPicker("quarter", "DatePicker.QuarterPicker"),
|
|
455
|
-
YearPicker: withPicker("year", "DatePicker.YearPicker")
|
|
456
|
-
});
|
|
457
|
-
// src/components/pagination/Pagination.tsx
|
|
458
|
-
import {
|
|
459
|
-
forwardRef as forwardRef2,
|
|
460
|
-
useMemo as useMemo2,
|
|
461
|
-
useState as useState2
|
|
462
|
-
} from "react";
|
|
463
|
-
|
|
464
|
-
// src/classes/pagination.ts
|
|
465
|
-
var paginationBaseClass = "pagination";
|
|
466
|
-
var paginationItemClass = "pagination-item";
|
|
467
|
-
var paginationItemActiveClass = "pagination-item-active";
|
|
468
|
-
var paginationItemDisabledClass = "pagination-item-disabled";
|
|
469
|
-
var paginationPrevClass = "pagination-prev";
|
|
470
|
-
var paginationNextClass = "pagination-next";
|
|
471
|
-
var paginationEllipsisClass = "pagination-ellipsis";
|
|
472
|
-
var paginationCompactClass = "pagination-compact";
|
|
473
|
-
var paginationInfoClass = "pagination-info";
|
|
474
|
-
var paginationInfoTextClass = "pagination-info-text";
|
|
475
|
-
var paginationInputClass = "pagination-input";
|
|
476
|
-
var paginationResponsiveClass = "pagination-responsive";
|
|
477
|
-
var paginationSizeClasses = {
|
|
478
|
-
sm: "pagination-sm",
|
|
479
|
-
md: "",
|
|
480
|
-
lg: "pagination-lg"
|
|
481
|
-
};
|
|
482
|
-
function getPaginationClasses({
|
|
483
|
-
size = "md",
|
|
484
|
-
compact,
|
|
485
|
-
className
|
|
486
|
-
}) {
|
|
487
|
-
return cn(paginationBaseClass, paginationResponsiveClass, paginationSizeClasses[size], compact && paginationCompactClass, className);
|
|
488
|
-
}
|
|
489
|
-
function getPaginationItemClasses({
|
|
490
|
-
active,
|
|
491
|
-
disabled
|
|
492
|
-
}) {
|
|
493
|
-
return cn(paginationItemClass, active && paginationItemActiveClass, disabled && paginationItemDisabledClass);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
// src/components/pagination/Pagination.tsx
|
|
497
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
498
|
-
var defaultPageSizeOptions = [10, 20, 50, 100];
|
|
499
|
-
function toPositiveInteger(value, fallback) {
|
|
500
|
-
if (!Number.isFinite(value) || value === undefined) {
|
|
501
|
-
return fallback;
|
|
502
|
-
}
|
|
503
|
-
return Math.max(1, Math.floor(value));
|
|
504
|
-
}
|
|
505
|
-
function clampPage(page, pageCount) {
|
|
506
|
-
return Math.min(pageCount, Math.max(1, Math.floor(page)));
|
|
507
|
-
}
|
|
508
|
-
function getPageCount(total, pageSize) {
|
|
509
|
-
return Math.max(1, Math.ceil(Math.max(0, total) / pageSize));
|
|
510
|
-
}
|
|
511
|
-
function getRange(current, pageSize, total) {
|
|
512
|
-
if (total <= 0) {
|
|
513
|
-
return [0, 0];
|
|
514
|
-
}
|
|
515
|
-
const start = (current - 1) * pageSize + 1;
|
|
516
|
-
const end = Math.min(total, current * pageSize);
|
|
517
|
-
return [start, end];
|
|
518
|
-
}
|
|
519
|
-
function getPageTokens(current, pageCount) {
|
|
520
|
-
if (pageCount <= 7) {
|
|
521
|
-
return Array.from({ length: pageCount }, (_, index) => index + 1);
|
|
513
|
+
function getPageTokens(current, pageCount) {
|
|
514
|
+
if (pageCount <= 7) {
|
|
515
|
+
return Array.from({ length: pageCount }, (_, index) => index + 1);
|
|
522
516
|
}
|
|
523
517
|
const pages = new Set([1, pageCount, current - 1, current, current + 1]);
|
|
524
518
|
if (current <= 4) {
|
|
@@ -545,7 +539,7 @@ function getPageTokens(current, pageCount) {
|
|
|
545
539
|
function getSizeOptions(pageSize) {
|
|
546
540
|
return Array.from(new Set([...defaultPageSizeOptions, pageSize])).sort((first, second) => first - second);
|
|
547
541
|
}
|
|
548
|
-
var Pagination =
|
|
542
|
+
var Pagination = forwardRef(({
|
|
549
543
|
current,
|
|
550
544
|
defaultCurrent = 1,
|
|
551
545
|
pageSize,
|
|
@@ -563,13 +557,13 @@ var Pagination = forwardRef2(({
|
|
|
563
557
|
}, ref) => {
|
|
564
558
|
const isCurrentControlled = current !== undefined;
|
|
565
559
|
const isPageSizeControlled = pageSize !== undefined;
|
|
566
|
-
const [internalCurrent, setInternalCurrent] =
|
|
567
|
-
const [internalPageSize, setInternalPageSize] =
|
|
568
|
-
const [quickJumpValue, setQuickJumpValue] =
|
|
560
|
+
const [internalCurrent, setInternalCurrent] = useState(defaultCurrent);
|
|
561
|
+
const [internalPageSize, setInternalPageSize] = useState(defaultPageSize);
|
|
562
|
+
const [quickJumpValue, setQuickJumpValue] = useState("");
|
|
569
563
|
const mergedPageSize = toPositiveInteger(pageSize ?? internalPageSize, defaultPageSize);
|
|
570
564
|
const pageCount = getPageCount(total, mergedPageSize);
|
|
571
565
|
const mergedCurrent = clampPage(toPositiveInteger(current ?? internalCurrent, defaultCurrent), pageCount);
|
|
572
|
-
const pageTokens =
|
|
566
|
+
const pageTokens = useMemo(() => getPageTokens(mergedCurrent, pageCount), [mergedCurrent, pageCount]);
|
|
573
567
|
const range = getRange(mergedCurrent, mergedPageSize, total);
|
|
574
568
|
function changePage(nextPage, nextPageSize = mergedPageSize) {
|
|
575
569
|
const nextPageCount = getPageCount(total, nextPageSize);
|
|
@@ -603,19 +597,19 @@ var Pagination = forwardRef2(({
|
|
|
603
597
|
}
|
|
604
598
|
const previousDisabled = disabled || mergedCurrent <= 1;
|
|
605
599
|
const nextDisabled = disabled || mergedCurrent >= pageCount;
|
|
606
|
-
return /* @__PURE__ */
|
|
600
|
+
return /* @__PURE__ */ jsxs2("nav", {
|
|
607
601
|
...props,
|
|
608
602
|
ref,
|
|
609
603
|
className: getPaginationClasses({ size, compact: simple, className }),
|
|
610
604
|
children: [
|
|
611
|
-
showTotal ? /* @__PURE__ */
|
|
605
|
+
showTotal ? /* @__PURE__ */ jsx3("div", {
|
|
612
606
|
className: paginationInfoClass,
|
|
613
|
-
children: /* @__PURE__ */
|
|
607
|
+
children: /* @__PURE__ */ jsx3("span", {
|
|
614
608
|
className: paginationInfoTextClass,
|
|
615
609
|
children: showTotal(total, range)
|
|
616
610
|
})
|
|
617
611
|
}) : null,
|
|
618
|
-
/* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ jsx3("button", {
|
|
619
613
|
type: "button",
|
|
620
614
|
className: paginationPrevClass,
|
|
621
615
|
disabled: previousDisabled,
|
|
@@ -623,10 +617,10 @@ var Pagination = forwardRef2(({
|
|
|
623
617
|
onClick: () => changePage(mergedCurrent - 1),
|
|
624
618
|
children: "Prev"
|
|
625
619
|
}),
|
|
626
|
-
simple ? /* @__PURE__ */
|
|
620
|
+
simple ? /* @__PURE__ */ jsxs2("div", {
|
|
627
621
|
className: paginationInputClass,
|
|
628
622
|
children: [
|
|
629
|
-
/* @__PURE__ */
|
|
623
|
+
/* @__PURE__ */ jsx3("input", {
|
|
630
624
|
"aria-label": "Current page",
|
|
631
625
|
type: "number",
|
|
632
626
|
min: 1,
|
|
@@ -641,7 +635,7 @@ var Pagination = forwardRef2(({
|
|
|
641
635
|
}
|
|
642
636
|
}
|
|
643
637
|
}),
|
|
644
|
-
/* @__PURE__ */
|
|
638
|
+
/* @__PURE__ */ jsxs2("span", {
|
|
645
639
|
className: paginationInfoTextClass,
|
|
646
640
|
children: [
|
|
647
641
|
"/ ",
|
|
@@ -649,10 +643,10 @@ var Pagination = forwardRef2(({
|
|
|
649
643
|
]
|
|
650
644
|
})
|
|
651
645
|
]
|
|
652
|
-
}) : pageTokens.map((pageToken, index) => pageToken === "ellipsis" ? /* @__PURE__ */
|
|
646
|
+
}) : pageTokens.map((pageToken, index) => pageToken === "ellipsis" ? /* @__PURE__ */ jsx3("span", {
|
|
653
647
|
"aria-hidden": "true",
|
|
654
648
|
className: paginationEllipsisClass
|
|
655
|
-
}, `ellipsis-${index}`) : /* @__PURE__ */
|
|
649
|
+
}, `ellipsis-${index}`) : /* @__PURE__ */ jsx3("button", {
|
|
656
650
|
type: "button",
|
|
657
651
|
className: getPaginationItemClasses({
|
|
658
652
|
active: pageToken === mergedCurrent,
|
|
@@ -664,7 +658,7 @@ var Pagination = forwardRef2(({
|
|
|
664
658
|
onClick: () => changePage(pageToken),
|
|
665
659
|
children: pageToken
|
|
666
660
|
}, pageToken)),
|
|
667
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ jsx3("button", {
|
|
668
662
|
type: "button",
|
|
669
663
|
className: paginationNextClass,
|
|
670
664
|
disabled: nextDisabled,
|
|
@@ -672,14 +666,14 @@ var Pagination = forwardRef2(({
|
|
|
672
666
|
onClick: () => changePage(mergedCurrent + 1),
|
|
673
667
|
children: "Next"
|
|
674
668
|
}),
|
|
675
|
-
showSizeChanger ? /* @__PURE__ */
|
|
669
|
+
showSizeChanger ? /* @__PURE__ */ jsx3("div", {
|
|
676
670
|
className: paginationInputClass,
|
|
677
|
-
children: /* @__PURE__ */
|
|
671
|
+
children: /* @__PURE__ */ jsx3("select", {
|
|
678
672
|
"aria-label": "Page size",
|
|
679
673
|
value: mergedPageSize,
|
|
680
674
|
disabled,
|
|
681
675
|
onChange: handlePageSizeChange,
|
|
682
|
-
children: getSizeOptions(mergedPageSize).map((option) => /* @__PURE__ */
|
|
676
|
+
children: getSizeOptions(mergedPageSize).map((option) => /* @__PURE__ */ jsxs2("option", {
|
|
683
677
|
value: option,
|
|
684
678
|
children: [
|
|
685
679
|
option,
|
|
@@ -688,9 +682,9 @@ var Pagination = forwardRef2(({
|
|
|
688
682
|
}, option))
|
|
689
683
|
})
|
|
690
684
|
}) : null,
|
|
691
|
-
showQuickJumper && !simple ? /* @__PURE__ */
|
|
685
|
+
showQuickJumper && !simple ? /* @__PURE__ */ jsx3("div", {
|
|
692
686
|
className: paginationInputClass,
|
|
693
|
-
children: /* @__PURE__ */
|
|
687
|
+
children: /* @__PURE__ */ jsx3("input", {
|
|
694
688
|
"aria-label": "Jump to page",
|
|
695
689
|
type: "number",
|
|
696
690
|
min: 1,
|
|
@@ -706,42 +700,7 @@ var Pagination = forwardRef2(({
|
|
|
706
700
|
});
|
|
707
701
|
Pagination.displayName = "Pagination";
|
|
708
702
|
// src/components/dm-pagination/DmPagination.tsx
|
|
709
|
-
import {
|
|
710
|
-
forwardRef as forwardRef3,
|
|
711
|
-
useEffect,
|
|
712
|
-
useMemo as useMemo3,
|
|
713
|
-
useRef,
|
|
714
|
-
useState as useState3
|
|
715
|
-
} from "react";
|
|
716
|
-
|
|
717
|
-
// src/classes/dm-pagination.ts
|
|
718
|
-
var dmPaginationBaseClass = "dm-pagination";
|
|
719
|
-
var dmPaginationHiddenClass = "dm-pagination-hidden";
|
|
720
|
-
var dmPaginationPagerClass = "dm-pagination-pager";
|
|
721
|
-
var dmPaginationRefreshClass = "dm-pagination-refresh";
|
|
722
|
-
var dmPaginationRefreshLoadingClass = "dm-pagination-refresh-loading";
|
|
723
|
-
var dmPaginationSelectedClass = "dm-pagination-selected";
|
|
724
|
-
var dmPaginationAlignClasses = {
|
|
725
|
-
left: "dm-pagination-left",
|
|
726
|
-
center: "dm-pagination-center",
|
|
727
|
-
right: "dm-pagination-right"
|
|
728
|
-
};
|
|
729
|
-
function getDmPaginationClasses({
|
|
730
|
-
align = "right",
|
|
731
|
-
hidden,
|
|
732
|
-
className
|
|
733
|
-
}) {
|
|
734
|
-
return cn(dmPaginationBaseClass, dmPaginationAlignClasses[align], hidden && dmPaginationHiddenClass, className);
|
|
735
|
-
}
|
|
736
|
-
function getDmPaginationRefreshClasses({
|
|
737
|
-
loading,
|
|
738
|
-
className
|
|
739
|
-
}) {
|
|
740
|
-
return cn(dmPaginationRefreshClass, loading && dmPaginationRefreshLoadingClass, className);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
// src/components/dm-pagination/DmPagination.tsx
|
|
744
|
-
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
703
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
745
704
|
var defaultLocale = {
|
|
746
705
|
refresh: "Refresh",
|
|
747
706
|
showTotal: (total, range) => `${range[0]}-${range[1]} of ${total}`,
|
|
@@ -773,7 +732,7 @@ function getResponsiveSimple({
|
|
|
773
732
|
}
|
|
774
733
|
function useElementWidth() {
|
|
775
734
|
const ref = useRef(null);
|
|
776
|
-
const [width, setWidth] =
|
|
735
|
+
const [width, setWidth] = useState2(1000);
|
|
777
736
|
useEffect(() => {
|
|
778
737
|
const element = ref.current;
|
|
779
738
|
if (!element || typeof ResizeObserver === "undefined")
|
|
@@ -789,12 +748,12 @@ function useElementWidth() {
|
|
|
789
748
|
function renderSelected(selectedTotal, locale) {
|
|
790
749
|
if (!selectedTotal)
|
|
791
750
|
return null;
|
|
792
|
-
return /* @__PURE__ */
|
|
751
|
+
return /* @__PURE__ */ jsx4("span", {
|
|
793
752
|
className: dmPaginationSelectedClass,
|
|
794
753
|
children: locale.selected(selectedTotal)
|
|
795
754
|
});
|
|
796
755
|
}
|
|
797
|
-
var DmPagination =
|
|
756
|
+
var DmPagination = forwardRef2(({
|
|
798
757
|
selectedTotal = 0,
|
|
799
758
|
loading = false,
|
|
800
759
|
total = 0,
|
|
@@ -814,7 +773,7 @@ var DmPagination = forwardRef3(({
|
|
|
814
773
|
...props
|
|
815
774
|
}, ref) => {
|
|
816
775
|
const [measureRef, width] = useElementWidth();
|
|
817
|
-
const mergedLocale =
|
|
776
|
+
const mergedLocale = useMemo2(() => ({ ...defaultLocale, ...locale }), [locale]);
|
|
818
777
|
const isRefreshVisible = showRefresh && Boolean(refresh);
|
|
819
778
|
const shouldRender = showPagination || isRefreshVisible;
|
|
820
779
|
const responsiveSimpleMode = responsiveSimple ? getResponsiveSimple({
|
|
@@ -825,7 +784,7 @@ var DmPagination = forwardRef3(({
|
|
|
825
784
|
}) : false;
|
|
826
785
|
const mergedSimple = simple ?? responsiveSimpleMode;
|
|
827
786
|
const mergedShowQuickJumper = showQuickJumper ?? !mergedSimple;
|
|
828
|
-
const totalRenderer =
|
|
787
|
+
const totalRenderer = useMemo2(() => {
|
|
829
788
|
if (showTotal)
|
|
830
789
|
return showTotal;
|
|
831
790
|
return (nextTotal, range) => {
|
|
@@ -833,7 +792,7 @@ var DmPagination = forwardRef3(({
|
|
|
833
792
|
return "";
|
|
834
793
|
const selected = renderSelected(selectedTotal, mergedLocale);
|
|
835
794
|
const message = mergedSimple && !showTotalFullMessage ? mergedLocale.showTotalSimple(nextTotal, range, selectedTotal) : mergedLocale.showTotal(nextTotal, range, selectedTotal);
|
|
836
|
-
return /* @__PURE__ */
|
|
795
|
+
return /* @__PURE__ */ jsxs3("span", {
|
|
837
796
|
title: `${mergedLocale.showTotal(nextTotal, range, selectedTotal)}${selectedTotal ? mergedLocale.selected(selectedTotal) : ""}`,
|
|
838
797
|
children: [
|
|
839
798
|
message,
|
|
@@ -850,7 +809,7 @@ var DmPagination = forwardRef3(({
|
|
|
850
809
|
]);
|
|
851
810
|
if (!shouldRender)
|
|
852
811
|
return null;
|
|
853
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
854
813
|
ref: (element) => {
|
|
855
814
|
measureRef.current = element;
|
|
856
815
|
if (typeof ref === "function") {
|
|
@@ -862,43 +821,858 @@ var DmPagination = forwardRef3(({
|
|
|
862
821
|
className: getDmPaginationClasses({ align, className }),
|
|
863
822
|
style: wrapperStyle,
|
|
864
823
|
children: [
|
|
865
|
-
showPagination ? /* @__PURE__ */
|
|
866
|
-
className: dmPaginationPagerClass,
|
|
867
|
-
children: /* @__PURE__ */
|
|
868
|
-
...props,
|
|
869
|
-
total,
|
|
870
|
-
simple: mergedSimple,
|
|
871
|
-
showQuickJumper: mergedShowQuickJumper,
|
|
872
|
-
showSizeChanger,
|
|
873
|
-
showTotal: totalRenderer
|
|
874
|
-
})
|
|
824
|
+
showPagination ? /* @__PURE__ */ jsx4("div", {
|
|
825
|
+
className: dmPaginationPagerClass,
|
|
826
|
+
children: /* @__PURE__ */ jsx4(Pagination, {
|
|
827
|
+
...props,
|
|
828
|
+
total,
|
|
829
|
+
simple: mergedSimple,
|
|
830
|
+
showQuickJumper: mergedShowQuickJumper,
|
|
831
|
+
showSizeChanger,
|
|
832
|
+
showTotal: totalRenderer
|
|
833
|
+
})
|
|
834
|
+
}) : null,
|
|
835
|
+
isRefreshVisible ? /* @__PURE__ */ jsxs3("button", {
|
|
836
|
+
type: "button",
|
|
837
|
+
className: getDmPaginationRefreshClasses({ loading }),
|
|
838
|
+
disabled: loading || props.disabled,
|
|
839
|
+
"aria-busy": loading || undefined,
|
|
840
|
+
onClick: refresh,
|
|
841
|
+
children: [
|
|
842
|
+
/* @__PURE__ */ jsx4("span", {
|
|
843
|
+
"aria-hidden": "true",
|
|
844
|
+
children: "Reload"
|
|
845
|
+
}),
|
|
846
|
+
/* @__PURE__ */ jsx4("span", {
|
|
847
|
+
children: mergedLocale.refresh
|
|
848
|
+
})
|
|
849
|
+
]
|
|
850
|
+
}) : null
|
|
851
|
+
]
|
|
852
|
+
});
|
|
853
|
+
});
|
|
854
|
+
DmPagination.displayName = "DmPagination";
|
|
855
|
+
// src/components/dm-search/DmSearch.tsx
|
|
856
|
+
import {
|
|
857
|
+
forwardRef as forwardRef7,
|
|
858
|
+
useEffect as useEffect3,
|
|
859
|
+
useImperativeHandle as useImperativeHandle3,
|
|
860
|
+
useMemo as useMemo6,
|
|
861
|
+
useState as useState8
|
|
862
|
+
} from "react";
|
|
863
|
+
|
|
864
|
+
// src/classes/dm-search.ts
|
|
865
|
+
var dmSearchBaseClass = "dm-search";
|
|
866
|
+
var dmSearchCompactClass = "dm-search-compact";
|
|
867
|
+
var dmSearchCollapsedClass = "dm-search-collapsed";
|
|
868
|
+
var dmSearchFieldsClass = "dm-search-fields";
|
|
869
|
+
var dmSearchFieldClass = "dm-search-field";
|
|
870
|
+
var dmSearchActionsClass = "dm-search-actions";
|
|
871
|
+
var dmSearchFastFilterClass = "dm-search-fast-filter";
|
|
872
|
+
function getDmSearchClasses({
|
|
873
|
+
compact,
|
|
874
|
+
collapsed,
|
|
875
|
+
className
|
|
876
|
+
}) {
|
|
877
|
+
return cn(dmSearchBaseClass, compact && dmSearchCompactClass, collapsed && dmSearchCollapsedClass, className);
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// src/components/date-picker/DatePicker.tsx
|
|
881
|
+
import { forwardRef as forwardRef4, useMemo as useMemo4, useState as useState5 } from "react";
|
|
882
|
+
|
|
883
|
+
// src/components/calendar/Calendar.tsx
|
|
884
|
+
import { forwardRef as forwardRef3, useMemo as useMemo3, useState as useState3 } from "react";
|
|
885
|
+
|
|
886
|
+
// src/classes/calendar.ts
|
|
887
|
+
var calendarBaseClass = "datepicker calendar";
|
|
888
|
+
var calendarHeaderClass = "calendar-header";
|
|
889
|
+
var calendarTitleClass = "calendar-title";
|
|
890
|
+
var calendarControlsClass = "calendar-controls";
|
|
891
|
+
var calendarNavClass = "calendar-nav";
|
|
892
|
+
var calendarModeClass = "calendar-mode";
|
|
893
|
+
var calendarWeekdaysClass = "calendar-weekdays";
|
|
894
|
+
var calendarWeekdayClass = "calendar-weekday";
|
|
895
|
+
var calendarBodyClass = "calendar-body";
|
|
896
|
+
var calendarDateGridClass = "calendar-date-grid";
|
|
897
|
+
var calendarMonthGridClass = "calendar-month-grid";
|
|
898
|
+
var calendarCellContentClass = "calendar-cell-content";
|
|
899
|
+
function getCalendarClasses({
|
|
900
|
+
fullscreen = true,
|
|
901
|
+
mode = "month",
|
|
902
|
+
className
|
|
903
|
+
}) {
|
|
904
|
+
return cn(calendarBaseClass, fullscreen ? "calendar-fullscreen" : "calendar-card", mode === "year" && "calendar-year-mode", className);
|
|
905
|
+
}
|
|
906
|
+
function getCalendarCellClasses({
|
|
907
|
+
selected,
|
|
908
|
+
today,
|
|
909
|
+
outside,
|
|
910
|
+
disabled,
|
|
911
|
+
className
|
|
912
|
+
}) {
|
|
913
|
+
return cn("calendar-cell", selected && "calendar-cell-selected", today && "calendar-cell-today", outside && "calendar-cell-outside", disabled && "calendar-cell-disabled", className);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// src/components/calendar/Calendar.tsx
|
|
917
|
+
import { jsx as jsx5, jsxs as jsxs4, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
918
|
+
var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
919
|
+
var MONTHS = [
|
|
920
|
+
"Jan",
|
|
921
|
+
"Feb",
|
|
922
|
+
"Mar",
|
|
923
|
+
"Apr",
|
|
924
|
+
"May",
|
|
925
|
+
"Jun",
|
|
926
|
+
"Jul",
|
|
927
|
+
"Aug",
|
|
928
|
+
"Sep",
|
|
929
|
+
"Oct",
|
|
930
|
+
"Nov",
|
|
931
|
+
"Dec"
|
|
932
|
+
];
|
|
933
|
+
function pad(value) {
|
|
934
|
+
return String(value).padStart(2, "0");
|
|
935
|
+
}
|
|
936
|
+
function formatDate(date) {
|
|
937
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
938
|
+
}
|
|
939
|
+
function formatMonth(date) {
|
|
940
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-01`;
|
|
941
|
+
}
|
|
942
|
+
function parseDate(value) {
|
|
943
|
+
if (value instanceof Date && !Number.isNaN(value.getTime())) {
|
|
944
|
+
return new Date(value.getFullYear(), value.getMonth(), value.getDate());
|
|
945
|
+
}
|
|
946
|
+
if (typeof value === "string" && value.length > 0) {
|
|
947
|
+
const [year, month = "1", day = "1"] = value.split("-");
|
|
948
|
+
const parsed = new Date(Number(year), Number(month) - 1, Number(day));
|
|
949
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
950
|
+
return parsed;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
const today = new Date;
|
|
954
|
+
return new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
955
|
+
}
|
|
956
|
+
function addMonths(date, amount) {
|
|
957
|
+
return new Date(date.getFullYear(), date.getMonth() + amount, 1);
|
|
958
|
+
}
|
|
959
|
+
function addYears(date, amount) {
|
|
960
|
+
return new Date(date.getFullYear() + amount, date.getMonth(), 1);
|
|
961
|
+
}
|
|
962
|
+
function startOfCalendarGrid(panelDate) {
|
|
963
|
+
const firstOfMonth = new Date(panelDate.getFullYear(), panelDate.getMonth(), 1);
|
|
964
|
+
const start = new Date(firstOfMonth);
|
|
965
|
+
start.setDate(firstOfMonth.getDate() - firstOfMonth.getDay());
|
|
966
|
+
return start;
|
|
967
|
+
}
|
|
968
|
+
function buildDateGrid(panelDate) {
|
|
969
|
+
const start = startOfCalendarGrid(panelDate);
|
|
970
|
+
return Array.from({ length: 42 }, (_, index) => {
|
|
971
|
+
const date = new Date(start);
|
|
972
|
+
date.setDate(start.getDate() + index);
|
|
973
|
+
return date;
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
function isSameMonth(left, right) {
|
|
977
|
+
return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth();
|
|
978
|
+
}
|
|
979
|
+
function isOutsideRange(date, validRange) {
|
|
980
|
+
if (!validRange) {
|
|
981
|
+
return false;
|
|
982
|
+
}
|
|
983
|
+
const current = formatDate(date);
|
|
984
|
+
const start = formatDate(parseDate(validRange[0]));
|
|
985
|
+
const end = formatDate(parseDate(validRange[1]));
|
|
986
|
+
return current < start || current > end;
|
|
987
|
+
}
|
|
988
|
+
function Header({
|
|
989
|
+
panelDate,
|
|
990
|
+
mode,
|
|
991
|
+
setPanelDate,
|
|
992
|
+
setMode
|
|
993
|
+
}) {
|
|
994
|
+
const title = mode === "year" ? String(panelDate.getFullYear()) : `${MONTHS[panelDate.getMonth()]} ${panelDate.getFullYear()}`;
|
|
995
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
996
|
+
className: calendarHeaderClass,
|
|
997
|
+
children: [
|
|
998
|
+
/* @__PURE__ */ jsx5("button", {
|
|
999
|
+
type: "button",
|
|
1000
|
+
className: calendarNavClass,
|
|
1001
|
+
"aria-label": "Previous panel",
|
|
1002
|
+
onClick: () => setPanelDate(mode === "year" ? addYears(panelDate, -1) : addMonths(panelDate, -1), mode),
|
|
1003
|
+
children: /* @__PURE__ */ jsx5("svg", {
|
|
1004
|
+
"aria-hidden": "true",
|
|
1005
|
+
focusable: "false",
|
|
1006
|
+
width: "16",
|
|
1007
|
+
height: "16",
|
|
1008
|
+
viewBox: "0 0 24 24",
|
|
1009
|
+
fill: "none",
|
|
1010
|
+
stroke: "currentColor",
|
|
1011
|
+
strokeWidth: "2",
|
|
1012
|
+
strokeLinecap: "round",
|
|
1013
|
+
strokeLinejoin: "round",
|
|
1014
|
+
children: /* @__PURE__ */ jsx5("path", {
|
|
1015
|
+
d: "m15 18-6-6 6-6"
|
|
1016
|
+
})
|
|
1017
|
+
})
|
|
1018
|
+
}),
|
|
1019
|
+
/* @__PURE__ */ jsxs4("div", {
|
|
1020
|
+
className: calendarControlsClass,
|
|
1021
|
+
children: [
|
|
1022
|
+
/* @__PURE__ */ jsx5("div", {
|
|
1023
|
+
className: calendarTitleClass,
|
|
1024
|
+
children: title
|
|
1025
|
+
}),
|
|
1026
|
+
/* @__PURE__ */ jsxs4("div", {
|
|
1027
|
+
className: calendarModeClass,
|
|
1028
|
+
children: [
|
|
1029
|
+
/* @__PURE__ */ jsx5("button", {
|
|
1030
|
+
type: "button",
|
|
1031
|
+
"aria-pressed": mode === "month",
|
|
1032
|
+
onClick: () => setMode("month"),
|
|
1033
|
+
children: "Month"
|
|
1034
|
+
}),
|
|
1035
|
+
/* @__PURE__ */ jsx5("button", {
|
|
1036
|
+
type: "button",
|
|
1037
|
+
"aria-pressed": mode === "year",
|
|
1038
|
+
onClick: () => setMode("year"),
|
|
1039
|
+
children: "Year"
|
|
1040
|
+
})
|
|
1041
|
+
]
|
|
1042
|
+
})
|
|
1043
|
+
]
|
|
1044
|
+
}),
|
|
1045
|
+
/* @__PURE__ */ jsx5("button", {
|
|
1046
|
+
type: "button",
|
|
1047
|
+
className: calendarNavClass,
|
|
1048
|
+
"aria-label": "Next panel",
|
|
1049
|
+
onClick: () => setPanelDate(mode === "year" ? addYears(panelDate, 1) : addMonths(panelDate, 1), mode),
|
|
1050
|
+
children: /* @__PURE__ */ jsx5("svg", {
|
|
1051
|
+
"aria-hidden": "true",
|
|
1052
|
+
focusable: "false",
|
|
1053
|
+
width: "16",
|
|
1054
|
+
height: "16",
|
|
1055
|
+
viewBox: "0 0 24 24",
|
|
1056
|
+
fill: "none",
|
|
1057
|
+
stroke: "currentColor",
|
|
1058
|
+
strokeWidth: "2",
|
|
1059
|
+
strokeLinecap: "round",
|
|
1060
|
+
strokeLinejoin: "round",
|
|
1061
|
+
children: /* @__PURE__ */ jsx5("path", {
|
|
1062
|
+
d: "m9 18 6-6-6-6"
|
|
1063
|
+
})
|
|
1064
|
+
})
|
|
1065
|
+
})
|
|
1066
|
+
]
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
var Calendar = forwardRef3(({
|
|
1070
|
+
className,
|
|
1071
|
+
value,
|
|
1072
|
+
defaultValue,
|
|
1073
|
+
mode,
|
|
1074
|
+
defaultMode = "month",
|
|
1075
|
+
fullscreen = true,
|
|
1076
|
+
validRange,
|
|
1077
|
+
disabledDate,
|
|
1078
|
+
dateCellRender,
|
|
1079
|
+
dateFullCellRender,
|
|
1080
|
+
monthCellRender,
|
|
1081
|
+
monthFullCellRender,
|
|
1082
|
+
cellRender,
|
|
1083
|
+
fullCellRender,
|
|
1084
|
+
headerRender,
|
|
1085
|
+
onChange,
|
|
1086
|
+
onSelect,
|
|
1087
|
+
onPanelChange,
|
|
1088
|
+
...props
|
|
1089
|
+
}, ref) => {
|
|
1090
|
+
const selectedDate = parseDate(value ?? defaultValue);
|
|
1091
|
+
const [innerValue, setInnerValue] = useState3(() => formatDate(selectedDate));
|
|
1092
|
+
const [panelDate, setInnerPanelDate] = useState3(selectedDate);
|
|
1093
|
+
const [innerMode, setInnerMode] = useState3(mode ?? defaultMode);
|
|
1094
|
+
const currentMode = mode ?? innerMode;
|
|
1095
|
+
const currentValue = value === undefined ? innerValue : formatDate(parseDate(value));
|
|
1096
|
+
const today = useMemo3(() => formatDate(new Date), []);
|
|
1097
|
+
const dateGrid = useMemo3(() => buildDateGrid(panelDate), [panelDate]);
|
|
1098
|
+
function emitPanelChange(nextDate, nextMode = currentMode) {
|
|
1099
|
+
setInnerPanelDate(nextDate);
|
|
1100
|
+
onPanelChange?.(formatDate(nextDate), nextMode);
|
|
1101
|
+
}
|
|
1102
|
+
function setCalendarMode(nextMode) {
|
|
1103
|
+
if (mode === undefined) {
|
|
1104
|
+
setInnerMode(nextMode);
|
|
1105
|
+
}
|
|
1106
|
+
onPanelChange?.(formatDate(panelDate), nextMode);
|
|
1107
|
+
}
|
|
1108
|
+
function commitValue(nextDate, source) {
|
|
1109
|
+
const nextValue = source === "month" ? formatMonth(nextDate) : formatDate(nextDate);
|
|
1110
|
+
if (disabledDate?.(nextValue) || isOutsideRange(nextDate, validRange)) {
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
if (value === undefined) {
|
|
1114
|
+
setInnerValue(nextValue);
|
|
1115
|
+
}
|
|
1116
|
+
setInnerPanelDate(nextDate);
|
|
1117
|
+
onSelect?.(nextValue, { source });
|
|
1118
|
+
onChange?.(nextValue);
|
|
1119
|
+
}
|
|
1120
|
+
function renderDateCell(date) {
|
|
1121
|
+
const dateValue = formatDate(date);
|
|
1122
|
+
const originNode = /* @__PURE__ */ jsxs4("div", {
|
|
1123
|
+
className: calendarCellContentClass,
|
|
1124
|
+
children: [
|
|
1125
|
+
/* @__PURE__ */ jsx5("span", {
|
|
1126
|
+
children: date.getDate()
|
|
1127
|
+
}),
|
|
1128
|
+
dateCellRender?.(dateValue)
|
|
1129
|
+
]
|
|
1130
|
+
});
|
|
1131
|
+
const info = {
|
|
1132
|
+
originNode,
|
|
1133
|
+
today,
|
|
1134
|
+
type: "month"
|
|
1135
|
+
};
|
|
1136
|
+
const content = fullCellRender?.(dateValue, info) ?? dateFullCellRender?.(dateValue) ?? cellRender?.(dateValue, info) ?? originNode;
|
|
1137
|
+
const disabled = disabledDate?.(dateValue) || isOutsideRange(date, validRange);
|
|
1138
|
+
return /* @__PURE__ */ jsx5("button", {
|
|
1139
|
+
type: "button",
|
|
1140
|
+
"aria-label": dateValue,
|
|
1141
|
+
disabled,
|
|
1142
|
+
className: getCalendarCellClasses({
|
|
1143
|
+
selected: dateValue === currentValue,
|
|
1144
|
+
today: dateValue === today,
|
|
1145
|
+
outside: !isSameMonth(date, panelDate),
|
|
1146
|
+
disabled
|
|
1147
|
+
}),
|
|
1148
|
+
onClick: () => commitValue(date, "date"),
|
|
1149
|
+
children: content
|
|
1150
|
+
}, dateValue);
|
|
1151
|
+
}
|
|
1152
|
+
function renderMonthCell(month) {
|
|
1153
|
+
const date = new Date(panelDate.getFullYear(), month, 1);
|
|
1154
|
+
const dateValue = formatMonth(date);
|
|
1155
|
+
const originNode = /* @__PURE__ */ jsxs4("div", {
|
|
1156
|
+
className: calendarCellContentClass,
|
|
1157
|
+
children: [
|
|
1158
|
+
/* @__PURE__ */ jsx5("span", {
|
|
1159
|
+
children: MONTHS[month]
|
|
1160
|
+
}),
|
|
1161
|
+
monthCellRender?.(dateValue)
|
|
1162
|
+
]
|
|
1163
|
+
});
|
|
1164
|
+
const info = {
|
|
1165
|
+
originNode,
|
|
1166
|
+
today,
|
|
1167
|
+
type: "year"
|
|
1168
|
+
};
|
|
1169
|
+
const content = fullCellRender?.(dateValue, info) ?? monthFullCellRender?.(dateValue) ?? cellRender?.(dateValue, info) ?? originNode;
|
|
1170
|
+
const disabled = disabledDate?.(dateValue) || isOutsideRange(date, validRange);
|
|
1171
|
+
return /* @__PURE__ */ jsx5("button", {
|
|
1172
|
+
type: "button",
|
|
1173
|
+
"aria-label": dateValue,
|
|
1174
|
+
disabled,
|
|
1175
|
+
className: getCalendarCellClasses({
|
|
1176
|
+
selected: dateValue === formatMonth(parseDate(currentValue)),
|
|
1177
|
+
today: dateValue === formatMonth(new Date),
|
|
1178
|
+
disabled
|
|
1179
|
+
}),
|
|
1180
|
+
onClick: () => commitValue(date, "month"),
|
|
1181
|
+
children: content
|
|
1182
|
+
}, dateValue);
|
|
1183
|
+
}
|
|
1184
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
1185
|
+
...props,
|
|
1186
|
+
ref,
|
|
1187
|
+
className: getCalendarClasses({
|
|
1188
|
+
fullscreen,
|
|
1189
|
+
mode: currentMode,
|
|
1190
|
+
className
|
|
1191
|
+
}),
|
|
1192
|
+
children: [
|
|
1193
|
+
headerRender ? headerRender({
|
|
1194
|
+
value: formatDate(panelDate),
|
|
1195
|
+
type: currentMode,
|
|
1196
|
+
onChange: (nextValue) => emitPanelChange(parseDate(nextValue)),
|
|
1197
|
+
onTypeChange: setCalendarMode
|
|
1198
|
+
}) : /* @__PURE__ */ jsx5(Header, {
|
|
1199
|
+
panelDate,
|
|
1200
|
+
mode: currentMode,
|
|
1201
|
+
setPanelDate: emitPanelChange,
|
|
1202
|
+
setMode: setCalendarMode
|
|
1203
|
+
}),
|
|
1204
|
+
/* @__PURE__ */ jsx5("div", {
|
|
1205
|
+
className: calendarBodyClass,
|
|
1206
|
+
children: currentMode === "month" ? /* @__PURE__ */ jsxs4(Fragment2, {
|
|
1207
|
+
children: [
|
|
1208
|
+
/* @__PURE__ */ jsx5("div", {
|
|
1209
|
+
className: calendarWeekdaysClass,
|
|
1210
|
+
"aria-hidden": "true",
|
|
1211
|
+
children: WEEKDAYS.map((weekday) => /* @__PURE__ */ jsx5("span", {
|
|
1212
|
+
className: calendarWeekdayClass,
|
|
1213
|
+
children: weekday
|
|
1214
|
+
}, weekday))
|
|
1215
|
+
}),
|
|
1216
|
+
/* @__PURE__ */ jsx5("div", {
|
|
1217
|
+
className: calendarDateGridClass,
|
|
1218
|
+
children: dateGrid.map(renderDateCell)
|
|
1219
|
+
})
|
|
1220
|
+
]
|
|
1221
|
+
}) : /* @__PURE__ */ jsx5("div", {
|
|
1222
|
+
className: calendarMonthGridClass,
|
|
1223
|
+
children: MONTHS.map((_, month) => renderMonthCell(month))
|
|
1224
|
+
})
|
|
1225
|
+
})
|
|
1226
|
+
]
|
|
1227
|
+
});
|
|
1228
|
+
});
|
|
1229
|
+
Calendar.displayName = "Calendar";
|
|
1230
|
+
// src/components/date-picker/usePickerDropdown.ts
|
|
1231
|
+
import { useEffect as useEffect2, useId, useImperativeHandle, useRef as useRef2, useState as useState4 } from "react";
|
|
1232
|
+
function usePickerDropdown({
|
|
1233
|
+
open,
|
|
1234
|
+
defaultOpen,
|
|
1235
|
+
disabled,
|
|
1236
|
+
onOpenChange,
|
|
1237
|
+
ref
|
|
1238
|
+
}) {
|
|
1239
|
+
const rootRef = useRef2(null);
|
|
1240
|
+
const inputRef = useRef2(null);
|
|
1241
|
+
const skipFocus = useRef2(false);
|
|
1242
|
+
const panelId = useId();
|
|
1243
|
+
const [innerOpen, setInnerOpen] = useState4(Boolean(defaultOpen));
|
|
1244
|
+
const visible = !disabled && (open ?? innerOpen);
|
|
1245
|
+
useImperativeHandle(ref, () => rootRef.current, []);
|
|
1246
|
+
function setVisible(next) {
|
|
1247
|
+
if (disabled || next === visible)
|
|
1248
|
+
return;
|
|
1249
|
+
if (open === undefined)
|
|
1250
|
+
setInnerOpen(next);
|
|
1251
|
+
onOpenChange?.(next);
|
|
1252
|
+
}
|
|
1253
|
+
function closeAndFocus() {
|
|
1254
|
+
skipFocus.current = true;
|
|
1255
|
+
inputRef.current?.focus();
|
|
1256
|
+
skipFocus.current = false;
|
|
1257
|
+
setVisible(false);
|
|
1258
|
+
}
|
|
1259
|
+
useEffect2(() => {
|
|
1260
|
+
function handleOutside(event) {
|
|
1261
|
+
if (visible && !rootRef.current?.contains(event.target))
|
|
1262
|
+
setVisible(false);
|
|
1263
|
+
}
|
|
1264
|
+
function handleKeyDown(event) {
|
|
1265
|
+
if (event.defaultPrevented || !rootRef.current?.contains(event.target))
|
|
1266
|
+
return;
|
|
1267
|
+
if (event.key === "Escape" && visible) {
|
|
1268
|
+
event.preventDefault();
|
|
1269
|
+
closeAndFocus();
|
|
1270
|
+
} else if (event.key === "ArrowDown" && event.target === inputRef.current) {
|
|
1271
|
+
event.preventDefault();
|
|
1272
|
+
setVisible(true);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
document.addEventListener("pointerdown", handleOutside);
|
|
1276
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
1277
|
+
return () => {
|
|
1278
|
+
document.removeEventListener("pointerdown", handleOutside);
|
|
1279
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
1280
|
+
};
|
|
1281
|
+
});
|
|
1282
|
+
return {
|
|
1283
|
+
rootRef,
|
|
1284
|
+
inputRef,
|
|
1285
|
+
panelId,
|
|
1286
|
+
visible,
|
|
1287
|
+
setVisible,
|
|
1288
|
+
closeAndFocus,
|
|
1289
|
+
onInputFocus: () => {
|
|
1290
|
+
if (!skipFocus.current)
|
|
1291
|
+
setVisible(true);
|
|
1292
|
+
},
|
|
1293
|
+
onRootBlur: (event) => {
|
|
1294
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
1295
|
+
setVisible(false);
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
// src/classes/date-picker.ts
|
|
1301
|
+
var datePickerBaseClass = "datepicker";
|
|
1302
|
+
var datePickerInputClass = "datepicker-input";
|
|
1303
|
+
var datePickerIconClass = "datepicker-icon";
|
|
1304
|
+
var datePickerDropdownClass = "datepicker-dropdown";
|
|
1305
|
+
var datePickerDropdownOpenClass = "datepicker-dropdown-open";
|
|
1306
|
+
var datePickerFooterClass = "datepicker-footer";
|
|
1307
|
+
var datePickerPresetClass = "datepicker-preset";
|
|
1308
|
+
var datePickerRangeClass = "datepicker-range";
|
|
1309
|
+
var datePickerSeparatorClass = "datepicker-range-separator";
|
|
1310
|
+
var datePickerClearClass = "datepicker-clear";
|
|
1311
|
+
var datePickerSizeClasses = {
|
|
1312
|
+
sm: "datepicker-sm",
|
|
1313
|
+
md: "",
|
|
1314
|
+
lg: "datepicker-lg"
|
|
1315
|
+
};
|
|
1316
|
+
var datePickerStatusClasses = {
|
|
1317
|
+
error: "datepicker-error",
|
|
1318
|
+
success: "datepicker-success"
|
|
1319
|
+
};
|
|
1320
|
+
var datePickerPickerClasses = {
|
|
1321
|
+
date: "",
|
|
1322
|
+
week: "datepicker-week",
|
|
1323
|
+
month: "datepicker-month-picker",
|
|
1324
|
+
quarter: "datepicker-quarter-picker",
|
|
1325
|
+
year: "datepicker-year-picker",
|
|
1326
|
+
time: "datepicker-time-picker"
|
|
1327
|
+
};
|
|
1328
|
+
function getDatePickerClasses({
|
|
1329
|
+
size = "md",
|
|
1330
|
+
status,
|
|
1331
|
+
picker = "date",
|
|
1332
|
+
open,
|
|
1333
|
+
disabled,
|
|
1334
|
+
range,
|
|
1335
|
+
className
|
|
1336
|
+
}) {
|
|
1337
|
+
return cn(datePickerBaseClass, datePickerSizeClasses[size], status && datePickerStatusClasses[status], datePickerPickerClasses[picker], open && "datepicker-open", disabled && "datepicker-disabled", range && datePickerRangeClass, className);
|
|
1338
|
+
}
|
|
1339
|
+
function getDatePickerDropdownClasses({
|
|
1340
|
+
open,
|
|
1341
|
+
className
|
|
1342
|
+
}) {
|
|
1343
|
+
return cn(datePickerDropdownClass, open && datePickerDropdownOpenClass, className);
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
// src/components/date-picker/DatePicker.tsx
|
|
1347
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1348
|
+
function todayValue(picker) {
|
|
1349
|
+
const today = new Date;
|
|
1350
|
+
const year = today.getFullYear();
|
|
1351
|
+
const month = String(today.getMonth() + 1).padStart(2, "0");
|
|
1352
|
+
const day = String(today.getDate()).padStart(2, "0");
|
|
1353
|
+
if (picker === "month")
|
|
1354
|
+
return `${year}-${month}`;
|
|
1355
|
+
if (picker === "year")
|
|
1356
|
+
return String(year);
|
|
1357
|
+
if (picker === "time")
|
|
1358
|
+
return "00:00";
|
|
1359
|
+
return `${year}-${month}-${day}`;
|
|
1360
|
+
}
|
|
1361
|
+
function inputTypeForPicker(picker) {
|
|
1362
|
+
if (picker === "month")
|
|
1363
|
+
return "month";
|
|
1364
|
+
if (picker === "week")
|
|
1365
|
+
return "week";
|
|
1366
|
+
if (picker === "time")
|
|
1367
|
+
return "time";
|
|
1368
|
+
return picker === "year" || picker === "quarter" ? "text" : "date";
|
|
1369
|
+
}
|
|
1370
|
+
function placeholderForPicker(picker) {
|
|
1371
|
+
if (picker === "month")
|
|
1372
|
+
return "Select month";
|
|
1373
|
+
if (picker === "week")
|
|
1374
|
+
return "Select week";
|
|
1375
|
+
if (picker === "quarter")
|
|
1376
|
+
return "Select quarter";
|
|
1377
|
+
if (picker === "year")
|
|
1378
|
+
return "Select year";
|
|
1379
|
+
if (picker === "time")
|
|
1380
|
+
return "Select time";
|
|
1381
|
+
return "Select date";
|
|
1382
|
+
}
|
|
1383
|
+
function normalizeDateValue(value) {
|
|
1384
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
1385
|
+
}
|
|
1386
|
+
var DatePickerRoot = forwardRef4(({
|
|
1387
|
+
allowClear,
|
|
1388
|
+
className,
|
|
1389
|
+
inputProps,
|
|
1390
|
+
defaultOpen,
|
|
1391
|
+
defaultValue,
|
|
1392
|
+
disabled,
|
|
1393
|
+
disabledDate,
|
|
1394
|
+
onBlur,
|
|
1395
|
+
onChange,
|
|
1396
|
+
onFocus,
|
|
1397
|
+
onOpenChange,
|
|
1398
|
+
open,
|
|
1399
|
+
picker = "date",
|
|
1400
|
+
placeholder,
|
|
1401
|
+
presets,
|
|
1402
|
+
showNow,
|
|
1403
|
+
size = "md",
|
|
1404
|
+
status,
|
|
1405
|
+
value,
|
|
1406
|
+
...props
|
|
1407
|
+
}, ref) => {
|
|
1408
|
+
const [calendarMode, setCalendarMode] = useState5("month");
|
|
1409
|
+
const isValueControlled = value !== undefined;
|
|
1410
|
+
const [innerValue, setInnerValue] = useState5(() => normalizeDateValue(defaultValue));
|
|
1411
|
+
const dropdown = usePickerDropdown({
|
|
1412
|
+
open,
|
|
1413
|
+
defaultOpen,
|
|
1414
|
+
disabled,
|
|
1415
|
+
onOpenChange,
|
|
1416
|
+
ref
|
|
1417
|
+
});
|
|
1418
|
+
const currentValue = isValueControlled ? normalizeDateValue(value) : innerValue;
|
|
1419
|
+
const { visible, setVisible } = dropdown;
|
|
1420
|
+
const inputType = inputTypeForPicker(picker);
|
|
1421
|
+
function emitChange(nextValue) {
|
|
1422
|
+
if (nextValue && disabledDate?.(nextValue)) {
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
if (!isValueControlled) {
|
|
1426
|
+
setInnerValue(nextValue);
|
|
1427
|
+
}
|
|
1428
|
+
onChange?.(nextValue, nextValue ?? "");
|
|
1429
|
+
}
|
|
1430
|
+
function selectValue(nextValue) {
|
|
1431
|
+
if (disabledDate?.(nextValue))
|
|
1432
|
+
return;
|
|
1433
|
+
emitChange(nextValue);
|
|
1434
|
+
dropdown.closeAndFocus();
|
|
1435
|
+
}
|
|
1436
|
+
const presetItems = useMemo4(() => presets ?? [], [presets]);
|
|
1437
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
1438
|
+
...props,
|
|
1439
|
+
ref: dropdown.rootRef,
|
|
1440
|
+
onBlur: dropdown.onRootBlur,
|
|
1441
|
+
className: getDatePickerClasses({
|
|
1442
|
+
size,
|
|
1443
|
+
status,
|
|
1444
|
+
picker,
|
|
1445
|
+
open: visible,
|
|
1446
|
+
disabled,
|
|
1447
|
+
className
|
|
1448
|
+
}),
|
|
1449
|
+
children: [
|
|
1450
|
+
/* @__PURE__ */ jsx6("input", {
|
|
1451
|
+
...inputProps,
|
|
1452
|
+
ref: dropdown.inputRef,
|
|
1453
|
+
"aria-haspopup": "dialog",
|
|
1454
|
+
"aria-controls": visible ? dropdown.panelId : undefined,
|
|
1455
|
+
className: datePickerInputClass,
|
|
1456
|
+
disabled,
|
|
1457
|
+
type: inputType,
|
|
1458
|
+
value: currentValue ?? "",
|
|
1459
|
+
placeholder: placeholder ?? placeholderForPicker(picker),
|
|
1460
|
+
onFocus: (event) => {
|
|
1461
|
+
onFocus?.(event);
|
|
1462
|
+
dropdown.onInputFocus();
|
|
1463
|
+
},
|
|
1464
|
+
onBlur: (event) => {
|
|
1465
|
+
onBlur?.(event);
|
|
1466
|
+
},
|
|
1467
|
+
onClick: () => setVisible(true),
|
|
1468
|
+
onChange: (event) => emitChange(event.currentTarget.value || undefined)
|
|
1469
|
+
}),
|
|
1470
|
+
allowClear && currentValue && !disabled ? /* @__PURE__ */ jsx6("button", {
|
|
1471
|
+
type: "button",
|
|
1472
|
+
className: datePickerClearClass,
|
|
1473
|
+
"aria-label": "Clear date",
|
|
1474
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1475
|
+
onClick: () => emitChange(undefined),
|
|
1476
|
+
children: "x"
|
|
875
1477
|
}) : null,
|
|
876
|
-
|
|
1478
|
+
/* @__PURE__ */ jsx6("button", {
|
|
877
1479
|
type: "button",
|
|
878
|
-
className:
|
|
879
|
-
|
|
880
|
-
"aria-
|
|
881
|
-
|
|
1480
|
+
className: datePickerIconClass,
|
|
1481
|
+
"aria-label": "Open date picker",
|
|
1482
|
+
"aria-haspopup": "dialog",
|
|
1483
|
+
"aria-expanded": visible,
|
|
1484
|
+
"aria-controls": visible ? dropdown.panelId : undefined,
|
|
1485
|
+
disabled,
|
|
1486
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1487
|
+
onClick: () => setVisible(!visible),
|
|
1488
|
+
children: /* @__PURE__ */ jsxs5("svg", {
|
|
1489
|
+
"aria-hidden": "true",
|
|
1490
|
+
focusable: "false",
|
|
1491
|
+
width: "18",
|
|
1492
|
+
height: "18",
|
|
1493
|
+
viewBox: "0 0 24 24",
|
|
1494
|
+
fill: "none",
|
|
1495
|
+
stroke: "currentColor",
|
|
1496
|
+
strokeWidth: "1.75",
|
|
1497
|
+
strokeLinecap: "round",
|
|
1498
|
+
strokeLinejoin: "round",
|
|
1499
|
+
children: [
|
|
1500
|
+
/* @__PURE__ */ jsx6("rect", {
|
|
1501
|
+
x: "3",
|
|
1502
|
+
y: "5",
|
|
1503
|
+
width: "18",
|
|
1504
|
+
height: "16",
|
|
1505
|
+
rx: "2"
|
|
1506
|
+
}),
|
|
1507
|
+
/* @__PURE__ */ jsx6("path", {
|
|
1508
|
+
d: "M8 3v4M16 3v4M3 10h18"
|
|
1509
|
+
})
|
|
1510
|
+
]
|
|
1511
|
+
})
|
|
1512
|
+
}),
|
|
1513
|
+
visible ? /* @__PURE__ */ jsxs5("div", {
|
|
1514
|
+
id: dropdown.panelId,
|
|
1515
|
+
role: "dialog",
|
|
1516
|
+
"aria-label": "Choose date",
|
|
1517
|
+
className: getDatePickerDropdownClasses({ open: visible }),
|
|
882
1518
|
children: [
|
|
883
|
-
/* @__PURE__ */
|
|
884
|
-
|
|
885
|
-
|
|
1519
|
+
picker === "date" || picker === "month" ? /* @__PURE__ */ jsx6(Calendar, {
|
|
1520
|
+
fullscreen: false,
|
|
1521
|
+
value: currentValue,
|
|
1522
|
+
mode: picker === "month" ? "year" : calendarMode,
|
|
1523
|
+
onPanelChange: (_, mode) => {
|
|
1524
|
+
if (picker === "date")
|
|
1525
|
+
setCalendarMode(mode);
|
|
1526
|
+
},
|
|
1527
|
+
disabledDate: (date) => {
|
|
1528
|
+
if (!disabledDate)
|
|
1529
|
+
return false;
|
|
1530
|
+
if (picker === "month")
|
|
1531
|
+
return disabledDate(date.slice(0, 7));
|
|
1532
|
+
if (calendarMode === "year") {
|
|
1533
|
+
const [year, month] = date.split("-").map(Number);
|
|
1534
|
+
const days = new Date(year, month, 0).getDate();
|
|
1535
|
+
return Array.from({ length: days }, (_, index) => `${date.slice(0, 7)}-${String(index + 1).padStart(2, "0")}`).every((day) => disabledDate(day));
|
|
1536
|
+
}
|
|
1537
|
+
return disabledDate(date);
|
|
1538
|
+
},
|
|
1539
|
+
onSelect: (date, info) => {
|
|
1540
|
+
if (picker === "date" && info.source === "month") {
|
|
1541
|
+
setCalendarMode("month");
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
selectValue(picker === "month" ? date.slice(0, 7) : date);
|
|
1545
|
+
}
|
|
1546
|
+
}) : /* @__PURE__ */ jsx6("input", {
|
|
1547
|
+
type: inputType,
|
|
1548
|
+
"aria-label": placeholderForPicker(picker),
|
|
1549
|
+
value: currentValue ?? "",
|
|
1550
|
+
onChange: (event) => selectValue(event.currentTarget.value)
|
|
886
1551
|
}),
|
|
887
|
-
/* @__PURE__ */
|
|
888
|
-
|
|
889
|
-
|
|
1552
|
+
presetItems.map((preset, index) => /* @__PURE__ */ jsx6("button", {
|
|
1553
|
+
type: "button",
|
|
1554
|
+
className: datePickerPresetClass,
|
|
1555
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1556
|
+
disabled: Boolean(disabledDate?.(preset.value)),
|
|
1557
|
+
onClick: () => selectValue(preset.value),
|
|
1558
|
+
children: preset.label
|
|
1559
|
+
}, index)),
|
|
1560
|
+
showNow ? /* @__PURE__ */ jsx6("div", {
|
|
1561
|
+
className: datePickerFooterClass,
|
|
1562
|
+
children: /* @__PURE__ */ jsx6("button", {
|
|
1563
|
+
type: "button",
|
|
1564
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1565
|
+
disabled: Boolean(disabledDate?.(todayValue(picker))),
|
|
1566
|
+
onClick: () => selectValue(todayValue(picker)),
|
|
1567
|
+
children: "Now"
|
|
1568
|
+
})
|
|
1569
|
+
}) : null
|
|
890
1570
|
]
|
|
891
1571
|
}) : null
|
|
892
1572
|
]
|
|
893
1573
|
});
|
|
894
1574
|
});
|
|
895
|
-
|
|
1575
|
+
DatePickerRoot.displayName = "DatePicker";
|
|
1576
|
+
var RangePicker = forwardRef4(({
|
|
1577
|
+
allowClear,
|
|
1578
|
+
className,
|
|
1579
|
+
inputProps,
|
|
1580
|
+
defaultValue,
|
|
1581
|
+
disabled,
|
|
1582
|
+
disabledDate,
|
|
1583
|
+
onChange,
|
|
1584
|
+
picker = "date",
|
|
1585
|
+
placeholder,
|
|
1586
|
+
separator = "-",
|
|
1587
|
+
size = "md",
|
|
1588
|
+
status,
|
|
1589
|
+
value,
|
|
1590
|
+
...props
|
|
1591
|
+
}, ref) => {
|
|
1592
|
+
const isControlled = value !== undefined;
|
|
1593
|
+
const [innerValue, setInnerValue] = useState5(defaultValue ?? [undefined, undefined]);
|
|
1594
|
+
const currentValue = isControlled ? value : innerValue;
|
|
1595
|
+
const inputType = inputTypeForPicker(picker);
|
|
1596
|
+
function emitChange(nextValue) {
|
|
1597
|
+
if (nextValue.some((item) => item !== undefined && Boolean(disabledDate?.(item)))) {
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
if (!isControlled) {
|
|
1601
|
+
setInnerValue(nextValue);
|
|
1602
|
+
}
|
|
1603
|
+
onChange?.(nextValue, [nextValue[0] ?? "", nextValue[1] ?? ""]);
|
|
1604
|
+
}
|
|
1605
|
+
function updateIndex(index, nextItem) {
|
|
1606
|
+
emitChange(index === 0 ? [nextItem, currentValue?.[1]] : [currentValue?.[0], nextItem]);
|
|
1607
|
+
}
|
|
1608
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
1609
|
+
...props,
|
|
1610
|
+
ref,
|
|
1611
|
+
className: getDatePickerClasses({
|
|
1612
|
+
size,
|
|
1613
|
+
status,
|
|
1614
|
+
picker,
|
|
1615
|
+
disabled,
|
|
1616
|
+
range: true,
|
|
1617
|
+
className
|
|
1618
|
+
}),
|
|
1619
|
+
children: [
|
|
1620
|
+
/* @__PURE__ */ jsx6("input", {
|
|
1621
|
+
...inputProps,
|
|
1622
|
+
className: datePickerInputClass,
|
|
1623
|
+
disabled,
|
|
1624
|
+
type: inputType,
|
|
1625
|
+
value: currentValue?.[0] ?? "",
|
|
1626
|
+
placeholder: Array.isArray(placeholder) ? placeholder[0] : "Start date",
|
|
1627
|
+
onChange: (event) => updateIndex(0, event.currentTarget.value || undefined)
|
|
1628
|
+
}),
|
|
1629
|
+
/* @__PURE__ */ jsx6("span", {
|
|
1630
|
+
className: datePickerSeparatorClass,
|
|
1631
|
+
children: separator
|
|
1632
|
+
}),
|
|
1633
|
+
/* @__PURE__ */ jsx6("input", {
|
|
1634
|
+
...inputProps,
|
|
1635
|
+
id: inputProps?.id ? `${inputProps.id}-end` : undefined,
|
|
1636
|
+
className: datePickerInputClass,
|
|
1637
|
+
disabled,
|
|
1638
|
+
type: inputType,
|
|
1639
|
+
value: currentValue?.[1] ?? "",
|
|
1640
|
+
placeholder: Array.isArray(placeholder) ? placeholder[1] : "End date",
|
|
1641
|
+
onChange: (event) => updateIndex(1, event.currentTarget.value || undefined)
|
|
1642
|
+
}),
|
|
1643
|
+
allowClear && (currentValue?.[0] || currentValue?.[1]) && !disabled ? /* @__PURE__ */ jsx6("button", {
|
|
1644
|
+
type: "button",
|
|
1645
|
+
className: datePickerClearClass,
|
|
1646
|
+
"aria-label": "Clear date range",
|
|
1647
|
+
onClick: () => emitChange([undefined, undefined]),
|
|
1648
|
+
children: "x"
|
|
1649
|
+
}) : null
|
|
1650
|
+
]
|
|
1651
|
+
});
|
|
1652
|
+
});
|
|
1653
|
+
RangePicker.displayName = "DatePicker.RangePicker";
|
|
1654
|
+
function withPicker(picker, displayName) {
|
|
1655
|
+
const Picker = forwardRef4((props, ref) => /* @__PURE__ */ jsx6(DatePickerRoot, {
|
|
1656
|
+
...props,
|
|
1657
|
+
ref,
|
|
1658
|
+
picker
|
|
1659
|
+
}));
|
|
1660
|
+
Picker.displayName = displayName;
|
|
1661
|
+
return Picker;
|
|
1662
|
+
}
|
|
1663
|
+
var DatePicker = Object.assign(DatePickerRoot, {
|
|
1664
|
+
RangePicker,
|
|
1665
|
+
WeekPicker: withPicker("week", "DatePicker.WeekPicker"),
|
|
1666
|
+
MonthPicker: withPicker("month", "DatePicker.MonthPicker"),
|
|
1667
|
+
QuarterPicker: withPicker("quarter", "DatePicker.QuarterPicker"),
|
|
1668
|
+
YearPicker: withPicker("year", "DatePicker.YearPicker")
|
|
1669
|
+
});
|
|
896
1670
|
// src/components/input/Input.tsx
|
|
897
1671
|
import {
|
|
898
|
-
forwardRef as
|
|
899
|
-
useImperativeHandle,
|
|
900
|
-
useRef as
|
|
901
|
-
useState as
|
|
1672
|
+
forwardRef as forwardRef5,
|
|
1673
|
+
useImperativeHandle as useImperativeHandle2,
|
|
1674
|
+
useRef as useRef3,
|
|
1675
|
+
useState as useState6
|
|
902
1676
|
} from "react";
|
|
903
1677
|
|
|
904
1678
|
// src/classes/input.ts
|
|
@@ -987,14 +1761,14 @@ function getTextAreaCountClasses({ exceeded }) {
|
|
|
987
1761
|
}
|
|
988
1762
|
|
|
989
1763
|
// src/components/input/Input.tsx
|
|
990
|
-
import { jsx as
|
|
1764
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
991
1765
|
function toTextValue(value) {
|
|
992
1766
|
if (Array.isArray(value)) {
|
|
993
1767
|
return value.join(",");
|
|
994
1768
|
}
|
|
995
1769
|
return value == null ? "" : String(value);
|
|
996
1770
|
}
|
|
997
|
-
var InputRoot =
|
|
1771
|
+
var InputRoot = forwardRef5(({
|
|
998
1772
|
allowClear,
|
|
999
1773
|
className,
|
|
1000
1774
|
defaultValue,
|
|
@@ -1009,12 +1783,12 @@ var InputRoot = forwardRef4(({
|
|
|
1009
1783
|
variant = "outlined",
|
|
1010
1784
|
...props
|
|
1011
1785
|
}, ref) => {
|
|
1012
|
-
const inputRef =
|
|
1013
|
-
const [internalValue, setInternalValue] =
|
|
1786
|
+
const inputRef = useRef3(null);
|
|
1787
|
+
const [internalValue, setInternalValue] = useState6(() => toTextValue(defaultValue));
|
|
1014
1788
|
const isControlled = value !== undefined;
|
|
1015
1789
|
const currentValue = isControlled ? toTextValue(value) : internalValue;
|
|
1016
1790
|
const hasAffix = prefix != null || suffix != null || allowClear;
|
|
1017
|
-
|
|
1791
|
+
useImperativeHandle2(ref, () => inputRef.current);
|
|
1018
1792
|
function handleChange(event) {
|
|
1019
1793
|
if (!isControlled) {
|
|
1020
1794
|
setInternalValue(event.currentTarget.value);
|
|
@@ -1037,7 +1811,7 @@ var InputRoot = forwardRef4(({
|
|
|
1037
1811
|
});
|
|
1038
1812
|
input.focus();
|
|
1039
1813
|
}
|
|
1040
|
-
const control = /* @__PURE__ */
|
|
1814
|
+
const control = /* @__PURE__ */ jsx7("input", {
|
|
1041
1815
|
...props,
|
|
1042
1816
|
ref: inputRef,
|
|
1043
1817
|
type,
|
|
@@ -1050,22 +1824,22 @@ var InputRoot = forwardRef4(({
|
|
|
1050
1824
|
return control;
|
|
1051
1825
|
}
|
|
1052
1826
|
const showClear = allowClear && !disabled && currentValue.length > 0;
|
|
1053
|
-
return /* @__PURE__ */
|
|
1827
|
+
return /* @__PURE__ */ jsxs6("span", {
|
|
1054
1828
|
className: getInputWrapperClasses({ affixed: hasAffix }),
|
|
1055
1829
|
children: [
|
|
1056
|
-
prefix != null ? /* @__PURE__ */
|
|
1830
|
+
prefix != null ? /* @__PURE__ */ jsx7("span", {
|
|
1057
1831
|
className: inputPrefixClass,
|
|
1058
1832
|
children: prefix
|
|
1059
1833
|
}) : null,
|
|
1060
1834
|
control,
|
|
1061
|
-
showClear ? /* @__PURE__ */
|
|
1835
|
+
showClear ? /* @__PURE__ */ jsx7("button", {
|
|
1062
1836
|
type: "button",
|
|
1063
1837
|
className: inputClearClass,
|
|
1064
1838
|
"aria-label": "Clear input",
|
|
1065
1839
|
onClick: handleClear,
|
|
1066
1840
|
children: "x"
|
|
1067
1841
|
}) : null,
|
|
1068
|
-
suffix != null ? /* @__PURE__ */
|
|
1842
|
+
suffix != null ? /* @__PURE__ */ jsx7("span", {
|
|
1069
1843
|
className: inputSuffixClass,
|
|
1070
1844
|
children: suffix
|
|
1071
1845
|
}) : null
|
|
@@ -1073,7 +1847,7 @@ var InputRoot = forwardRef4(({
|
|
|
1073
1847
|
});
|
|
1074
1848
|
});
|
|
1075
1849
|
InputRoot.displayName = "Input";
|
|
1076
|
-
var Search =
|
|
1850
|
+
var Search = forwardRef5(({
|
|
1077
1851
|
className,
|
|
1078
1852
|
disabled,
|
|
1079
1853
|
enterButton,
|
|
@@ -1082,8 +1856,8 @@ var Search = forwardRef4(({
|
|
|
1082
1856
|
onSearch,
|
|
1083
1857
|
...props
|
|
1084
1858
|
}, ref) => {
|
|
1085
|
-
const inputRef =
|
|
1086
|
-
|
|
1859
|
+
const inputRef = useRef3(null);
|
|
1860
|
+
useImperativeHandle2(ref, () => inputRef.current);
|
|
1087
1861
|
function emitSearch(event) {
|
|
1088
1862
|
onSearch?.(inputRef.current?.value ?? "", event);
|
|
1089
1863
|
}
|
|
@@ -1094,16 +1868,16 @@ var Search = forwardRef4(({
|
|
|
1094
1868
|
}
|
|
1095
1869
|
}
|
|
1096
1870
|
const buttonContent = enterButton === true ? "Search" : enterButton ?? "Search";
|
|
1097
|
-
return /* @__PURE__ */
|
|
1871
|
+
return /* @__PURE__ */ jsxs6("span", {
|
|
1098
1872
|
className: getSearchWrapperClasses({ className }),
|
|
1099
1873
|
children: [
|
|
1100
|
-
/* @__PURE__ */
|
|
1874
|
+
/* @__PURE__ */ jsx7(InputRoot, {
|
|
1101
1875
|
...props,
|
|
1102
1876
|
ref: inputRef,
|
|
1103
1877
|
disabled,
|
|
1104
1878
|
onKeyDown: handleKeyDown
|
|
1105
1879
|
}),
|
|
1106
|
-
enterButton || loading ? /* @__PURE__ */
|
|
1880
|
+
enterButton || loading ? /* @__PURE__ */ jsx7("button", {
|
|
1107
1881
|
type: "button",
|
|
1108
1882
|
className: inputSearchButtonClass,
|
|
1109
1883
|
disabled: disabled || loading,
|
|
@@ -1115,10 +1889,10 @@ var Search = forwardRef4(({
|
|
|
1115
1889
|
});
|
|
1116
1890
|
});
|
|
1117
1891
|
Search.displayName = "Input.Search";
|
|
1118
|
-
var Password =
|
|
1119
|
-
const [visible, setVisible] =
|
|
1892
|
+
var Password = forwardRef5(({ className, disabled, visibilityToggle = true, ...props }, ref) => {
|
|
1893
|
+
const [visible, setVisible] = useState6(false);
|
|
1120
1894
|
const type = visible ? "text" : "password";
|
|
1121
|
-
const toggle = visibilityToggle ? /* @__PURE__ */
|
|
1895
|
+
const toggle = visibilityToggle ? /* @__PURE__ */ jsx7("button", {
|
|
1122
1896
|
type: "button",
|
|
1123
1897
|
className: inputPasswordToggleClass,
|
|
1124
1898
|
disabled,
|
|
@@ -1128,9 +1902,9 @@ var Password = forwardRef4(({ className, disabled, visibilityToggle = true, ...p
|
|
|
1128
1902
|
},
|
|
1129
1903
|
children: visible ? "Hide" : "Show"
|
|
1130
1904
|
}) : undefined;
|
|
1131
|
-
return /* @__PURE__ */
|
|
1905
|
+
return /* @__PURE__ */ jsx7("span", {
|
|
1132
1906
|
className: getPasswordWrapperClasses({ className }),
|
|
1133
|
-
children: /* @__PURE__ */
|
|
1907
|
+
children: /* @__PURE__ */ jsx7(InputRoot, {
|
|
1134
1908
|
...props,
|
|
1135
1909
|
ref,
|
|
1136
1910
|
disabled,
|
|
@@ -1140,7 +1914,7 @@ var Password = forwardRef4(({ className, disabled, visibilityToggle = true, ...p
|
|
|
1140
1914
|
});
|
|
1141
1915
|
});
|
|
1142
1916
|
Password.displayName = "Input.Password";
|
|
1143
|
-
var TextArea =
|
|
1917
|
+
var TextArea = forwardRef5(({
|
|
1144
1918
|
autoSize,
|
|
1145
1919
|
className,
|
|
1146
1920
|
defaultValue,
|
|
@@ -1154,7 +1928,7 @@ var TextArea = forwardRef4(({
|
|
|
1154
1928
|
variant = "outlined",
|
|
1155
1929
|
...props
|
|
1156
1930
|
}, ref) => {
|
|
1157
|
-
const [internalValue, setInternalValue] =
|
|
1931
|
+
const [internalValue, setInternalValue] = useState6(() => toTextValue(defaultValue));
|
|
1158
1932
|
const isControlled = value !== undefined;
|
|
1159
1933
|
const currentValue = isControlled ? toTextValue(value) : internalValue;
|
|
1160
1934
|
const count = currentValue.length;
|
|
@@ -1165,7 +1939,7 @@ var TextArea = forwardRef4(({
|
|
|
1165
1939
|
}
|
|
1166
1940
|
onChange?.(event);
|
|
1167
1941
|
}
|
|
1168
|
-
const control = /* @__PURE__ */
|
|
1942
|
+
const control = /* @__PURE__ */ jsx7("textarea", {
|
|
1169
1943
|
...props,
|
|
1170
1944
|
ref,
|
|
1171
1945
|
className: getTextAreaClasses({
|
|
@@ -1183,11 +1957,11 @@ var TextArea = forwardRef4(({
|
|
|
1183
1957
|
if (!showCount) {
|
|
1184
1958
|
return control;
|
|
1185
1959
|
}
|
|
1186
|
-
return /* @__PURE__ */
|
|
1960
|
+
return /* @__PURE__ */ jsxs6("span", {
|
|
1187
1961
|
className: textAreaWrapperClass,
|
|
1188
1962
|
children: [
|
|
1189
1963
|
control,
|
|
1190
|
-
/* @__PURE__ */
|
|
1964
|
+
/* @__PURE__ */ jsxs6("span", {
|
|
1191
1965
|
className: getTextAreaCountClasses({ exceeded }),
|
|
1192
1966
|
children: [
|
|
1193
1967
|
count,
|
|
@@ -1198,7 +1972,7 @@ var TextArea = forwardRef4(({
|
|
|
1198
1972
|
});
|
|
1199
1973
|
});
|
|
1200
1974
|
TextArea.displayName = "Input.TextArea";
|
|
1201
|
-
var Group =
|
|
1975
|
+
var Group = forwardRef5(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
1202
1976
|
...props,
|
|
1203
1977
|
ref,
|
|
1204
1978
|
className: cn(inputGroupClass, className),
|
|
@@ -1212,7 +1986,7 @@ var Input = Object.assign(InputRoot, {
|
|
|
1212
1986
|
Group
|
|
1213
1987
|
});
|
|
1214
1988
|
// src/components/select/Select.tsx
|
|
1215
|
-
import
|
|
1989
|
+
import React7, { forwardRef as forwardRef6, useMemo as useMemo5, useState as useState7 } from "react";
|
|
1216
1990
|
|
|
1217
1991
|
// src/classes/select.ts
|
|
1218
1992
|
var selectContainerClass = "select-container";
|
|
@@ -1268,7 +2042,7 @@ function getSelectOptionClasses({
|
|
|
1268
2042
|
}
|
|
1269
2043
|
|
|
1270
2044
|
// src/components/select/Select.tsx
|
|
1271
|
-
import { jsx as
|
|
2045
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1272
2046
|
function isGroup(option) {
|
|
1273
2047
|
return "options" in option;
|
|
1274
2048
|
}
|
|
@@ -1293,8 +2067,8 @@ function normalizeMultiValue(value) {
|
|
|
1293
2067
|
}
|
|
1294
2068
|
function optionsFromChildren(children) {
|
|
1295
2069
|
const result = [];
|
|
1296
|
-
|
|
1297
|
-
if (!
|
|
2070
|
+
React7.Children.forEach(children, (child) => {
|
|
2071
|
+
if (!React7.isValidElement(child)) {
|
|
1298
2072
|
return;
|
|
1299
2073
|
}
|
|
1300
2074
|
if (child.type === Option) {
|
|
@@ -1344,19 +2118,19 @@ function filterOptions(options, searchValue, filterOption) {
|
|
|
1344
2118
|
function renderValue(option) {
|
|
1345
2119
|
return option ? optionLabel(option) : null;
|
|
1346
2120
|
}
|
|
1347
|
-
var Option =
|
|
2121
|
+
var Option = forwardRef6(({ children, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
|
|
1348
2122
|
...props,
|
|
1349
2123
|
ref,
|
|
1350
2124
|
children
|
|
1351
2125
|
}));
|
|
1352
2126
|
Option.displayName = "Select.Option";
|
|
1353
|
-
var OptGroup =
|
|
2127
|
+
var OptGroup = forwardRef6(({ children, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
|
|
1354
2128
|
...props,
|
|
1355
2129
|
ref,
|
|
1356
2130
|
children
|
|
1357
2131
|
}));
|
|
1358
2132
|
OptGroup.displayName = "Select.OptGroup";
|
|
1359
|
-
var SelectRoot =
|
|
2133
|
+
var SelectRoot = forwardRef6(({
|
|
1360
2134
|
allowClear,
|
|
1361
2135
|
children,
|
|
1362
2136
|
className,
|
|
@@ -1375,11 +2149,11 @@ var SelectRoot = forwardRef5(({
|
|
|
1375
2149
|
...props
|
|
1376
2150
|
}, ref) => {
|
|
1377
2151
|
const multiple = mode === "multiple" || mode === "tags";
|
|
1378
|
-
const sourceOptions =
|
|
1379
|
-
const flatOptions =
|
|
1380
|
-
const [open, setOpen] =
|
|
1381
|
-
const [searchValue, setSearchValue] =
|
|
1382
|
-
const [internalValue, setInternalValue] =
|
|
2152
|
+
const sourceOptions = useMemo5(() => options ?? optionsFromChildren(children), [children, options]);
|
|
2153
|
+
const flatOptions = useMemo5(() => flattenOptions(sourceOptions), [sourceOptions]);
|
|
2154
|
+
const [open, setOpen] = useState7(false);
|
|
2155
|
+
const [searchValue, setSearchValue] = useState7("");
|
|
2156
|
+
const [internalValue, setInternalValue] = useState7(multiple ? normalizeMultiValue(defaultValue) : normalizeSingleValue(defaultValue));
|
|
1383
2157
|
const controlled = value !== undefined;
|
|
1384
2158
|
const currentValue = controlled ? value : internalValue;
|
|
1385
2159
|
const selectedValues = multiple ? normalizeMultiValue(currentValue) : normalizeSingleValue(currentValue) === undefined ? [] : [normalizeSingleValue(currentValue)];
|
|
@@ -1436,7 +2210,7 @@ var SelectRoot = forwardRef5(({
|
|
|
1436
2210
|
}
|
|
1437
2211
|
function renderOption(option) {
|
|
1438
2212
|
const selected = selectedKeys.has(valueKey(option.value));
|
|
1439
|
-
return /* @__PURE__ */
|
|
2213
|
+
return /* @__PURE__ */ jsx8("button", {
|
|
1440
2214
|
type: "button",
|
|
1441
2215
|
role: "option",
|
|
1442
2216
|
"aria-selected": selected,
|
|
@@ -1455,11 +2229,11 @@ var SelectRoot = forwardRef5(({
|
|
|
1455
2229
|
if (!isGroup(option)) {
|
|
1456
2230
|
return renderOption(option);
|
|
1457
2231
|
}
|
|
1458
|
-
return /* @__PURE__ */
|
|
2232
|
+
return /* @__PURE__ */ jsxs7("div", {
|
|
1459
2233
|
className: cn(selectGroupClass, option.className),
|
|
1460
2234
|
role: "group",
|
|
1461
2235
|
children: [
|
|
1462
|
-
/* @__PURE__ */
|
|
2236
|
+
/* @__PURE__ */ jsx8("div", {
|
|
1463
2237
|
className: selectGroupLabelClass,
|
|
1464
2238
|
children: option.label
|
|
1465
2239
|
}),
|
|
@@ -1468,11 +2242,11 @@ var SelectRoot = forwardRef5(({
|
|
|
1468
2242
|
}, `group-${index}`);
|
|
1469
2243
|
});
|
|
1470
2244
|
}
|
|
1471
|
-
const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */
|
|
2245
|
+
const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsx8("span", {
|
|
1472
2246
|
className: selectTagClass,
|
|
1473
2247
|
children: renderValue(option)
|
|
1474
2248
|
}, valueKey(option.value))) : renderValue(selectedOptions[0]);
|
|
1475
|
-
return /* @__PURE__ */
|
|
2249
|
+
return /* @__PURE__ */ jsxs7("div", {
|
|
1476
2250
|
...props,
|
|
1477
2251
|
ref,
|
|
1478
2252
|
className: getSelectContainerClasses({
|
|
@@ -1483,7 +2257,7 @@ var SelectRoot = forwardRef5(({
|
|
|
1483
2257
|
className
|
|
1484
2258
|
}),
|
|
1485
2259
|
children: [
|
|
1486
|
-
/* @__PURE__ */
|
|
2260
|
+
/* @__PURE__ */ jsxs7("button", {
|
|
1487
2261
|
type: "button",
|
|
1488
2262
|
className: getSelectClasses({ size, status, disabled }),
|
|
1489
2263
|
disabled: disabled || loading,
|
|
@@ -1491,33 +2265,33 @@ var SelectRoot = forwardRef5(({
|
|
|
1491
2265
|
"aria-expanded": open,
|
|
1492
2266
|
onClick: () => setOpen((current) => !current),
|
|
1493
2267
|
children: [
|
|
1494
|
-
/* @__PURE__ */
|
|
2268
|
+
/* @__PURE__ */ jsx8("span", {
|
|
1495
2269
|
className: selectSelectionClass,
|
|
1496
|
-
children: hasValue ? selection : /* @__PURE__ */
|
|
2270
|
+
children: hasValue ? selection : /* @__PURE__ */ jsx8("span", {
|
|
1497
2271
|
className: selectPlaceholderClass,
|
|
1498
2272
|
children: placeholder
|
|
1499
2273
|
})
|
|
1500
2274
|
}),
|
|
1501
|
-
/* @__PURE__ */
|
|
2275
|
+
/* @__PURE__ */ jsx8("span", {
|
|
1502
2276
|
className: selectIconClass,
|
|
1503
2277
|
"aria-hidden": "true",
|
|
1504
2278
|
children: "v"
|
|
1505
2279
|
})
|
|
1506
2280
|
]
|
|
1507
2281
|
}),
|
|
1508
|
-
allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */
|
|
2282
|
+
allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ jsx8("button", {
|
|
1509
2283
|
type: "button",
|
|
1510
2284
|
className: selectClearClass,
|
|
1511
2285
|
"aria-label": "Clear selection",
|
|
1512
2286
|
onClick: clearValue,
|
|
1513
2287
|
children: "x"
|
|
1514
2288
|
}) : null,
|
|
1515
|
-
open ? /* @__PURE__ */
|
|
2289
|
+
open ? /* @__PURE__ */ jsxs7("div", {
|
|
1516
2290
|
className: selectDropdownClass,
|
|
1517
2291
|
role: "listbox",
|
|
1518
2292
|
"aria-multiselectable": multiple || undefined,
|
|
1519
2293
|
children: [
|
|
1520
|
-
searchable ? /* @__PURE__ */
|
|
2294
|
+
searchable ? /* @__PURE__ */ jsx8("input", {
|
|
1521
2295
|
className: selectSearchClass,
|
|
1522
2296
|
value: searchValue,
|
|
1523
2297
|
placeholder: typeof placeholder === "string" ? placeholder : undefined,
|
|
@@ -1529,7 +2303,7 @@ var SelectRoot = forwardRef5(({
|
|
|
1529
2303
|
}
|
|
1530
2304
|
}
|
|
1531
2305
|
}) : null,
|
|
1532
|
-
visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */
|
|
2306
|
+
visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */ jsx8("div", {
|
|
1533
2307
|
className: selectEmptyClass,
|
|
1534
2308
|
children: "No data"
|
|
1535
2309
|
})
|
|
@@ -1543,32 +2317,7 @@ var Select = SelectRoot;
|
|
|
1543
2317
|
Select.Option = Option;
|
|
1544
2318
|
Select.OptGroup = OptGroup;
|
|
1545
2319
|
// src/components/dm-search/DmSearch.tsx
|
|
1546
|
-
import {
|
|
1547
|
-
forwardRef as forwardRef6,
|
|
1548
|
-
useEffect as useEffect2,
|
|
1549
|
-
useImperativeHandle as useImperativeHandle2,
|
|
1550
|
-
useMemo as useMemo5,
|
|
1551
|
-
useState as useState6
|
|
1552
|
-
} from "react";
|
|
1553
|
-
|
|
1554
|
-
// src/classes/dm-search.ts
|
|
1555
|
-
var dmSearchBaseClass = "dm-search";
|
|
1556
|
-
var dmSearchCompactClass = "dm-search-compact";
|
|
1557
|
-
var dmSearchCollapsedClass = "dm-search-collapsed";
|
|
1558
|
-
var dmSearchFieldsClass = "dm-search-fields";
|
|
1559
|
-
var dmSearchFieldClass = "dm-search-field";
|
|
1560
|
-
var dmSearchActionsClass = "dm-search-actions";
|
|
1561
|
-
var dmSearchFastFilterClass = "dm-search-fast-filter";
|
|
1562
|
-
function getDmSearchClasses({
|
|
1563
|
-
compact,
|
|
1564
|
-
collapsed,
|
|
1565
|
-
className
|
|
1566
|
-
}) {
|
|
1567
|
-
return cn(dmSearchBaseClass, compact && dmSearchCompactClass, collapsed && dmSearchCollapsedClass, className);
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
|
-
// src/components/dm-search/DmSearch.tsx
|
|
1571
|
-
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2320
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1572
2321
|
function initialValues(items, searchParams, useSearchParams = true) {
|
|
1573
2322
|
return items.reduce((acc, item) => {
|
|
1574
2323
|
const defaultValue = item.search.extraProps?.value ?? item.search.formProps?.initialValue;
|
|
@@ -1592,7 +2341,7 @@ function renderField({
|
|
|
1592
2341
|
return item.search.render?.(value, setValue, item) ?? null;
|
|
1593
2342
|
}
|
|
1594
2343
|
if (item.search.type === "select") {
|
|
1595
|
-
return /* @__PURE__ */
|
|
2344
|
+
return /* @__PURE__ */ jsx9(Select, {
|
|
1596
2345
|
...extraProps,
|
|
1597
2346
|
disabled: Boolean(loading || extraProps.disabled),
|
|
1598
2347
|
value,
|
|
@@ -1601,25 +2350,25 @@ function renderField({
|
|
|
1601
2350
|
});
|
|
1602
2351
|
}
|
|
1603
2352
|
if (item.search.type === "dateRange") {
|
|
1604
|
-
return /* @__PURE__ */
|
|
2353
|
+
return /* @__PURE__ */ jsx9(DatePicker.RangePicker, {
|
|
1605
2354
|
...extraProps,
|
|
1606
2355
|
value,
|
|
1607
2356
|
onChange: (nextValue) => setValue(nextValue)
|
|
1608
2357
|
});
|
|
1609
2358
|
}
|
|
1610
2359
|
if (item.search.type === "date") {
|
|
1611
|
-
return /* @__PURE__ */
|
|
2360
|
+
return /* @__PURE__ */ jsx9(DatePicker, {
|
|
1612
2361
|
...extraProps,
|
|
1613
2362
|
value,
|
|
1614
2363
|
onChange: (nextValue) => setValue(nextValue)
|
|
1615
2364
|
});
|
|
1616
2365
|
}
|
|
1617
2366
|
if (item.search.type === "radio" || item.search.type === "checkbox") {
|
|
1618
|
-
return /* @__PURE__ */
|
|
2367
|
+
return /* @__PURE__ */ jsx9("div", {
|
|
1619
2368
|
role: item.search.type === "radio" ? "radiogroup" : "group",
|
|
1620
|
-
children: optionList(extraProps).map((option) => /* @__PURE__ */
|
|
2369
|
+
children: optionList(extraProps).map((option) => /* @__PURE__ */ jsxs8("label", {
|
|
1621
2370
|
children: [
|
|
1622
|
-
/* @__PURE__ */
|
|
2371
|
+
/* @__PURE__ */ jsx9("input", {
|
|
1623
2372
|
type: item.search.type,
|
|
1624
2373
|
disabled: loading,
|
|
1625
2374
|
checked: item.search.type === "checkbox" ? Array.isArray(value) && value.includes(option.value) : value === option.value,
|
|
@@ -1637,7 +2386,7 @@ function renderField({
|
|
|
1637
2386
|
}, String(option.value)))
|
|
1638
2387
|
});
|
|
1639
2388
|
}
|
|
1640
|
-
return /* @__PURE__ */
|
|
2389
|
+
return /* @__PURE__ */ jsx9(Input, {
|
|
1641
2390
|
...extraProps,
|
|
1642
2391
|
type: item.search.type === "input-number" ? "number" : "text",
|
|
1643
2392
|
disabled: Boolean(loading || extraProps.disabled),
|
|
@@ -1651,8 +2400,11 @@ function renderField({
|
|
|
1651
2400
|
}
|
|
1652
2401
|
});
|
|
1653
2402
|
}
|
|
1654
|
-
var DmSearch =
|
|
2403
|
+
var DmSearch = forwardRef7(({
|
|
1655
2404
|
items = [],
|
|
2405
|
+
values: controlledValues,
|
|
2406
|
+
onValuesChange,
|
|
2407
|
+
onReset,
|
|
1656
2408
|
onSearch,
|
|
1657
2409
|
extra,
|
|
1658
2410
|
fastFilterItem,
|
|
@@ -1661,27 +2413,37 @@ var DmSearch = forwardRef6(({
|
|
|
1661
2413
|
compact = false,
|
|
1662
2414
|
searchParams,
|
|
1663
2415
|
loading = false,
|
|
2416
|
+
noValidate,
|
|
1664
2417
|
enableDefaultPlaceHolder = false,
|
|
1665
2418
|
className
|
|
1666
2419
|
}, ref) => {
|
|
1667
|
-
const allItems =
|
|
1668
|
-
const [collapsed, setCollapsed] =
|
|
1669
|
-
const [
|
|
2420
|
+
const allItems = useMemo6(() => fastFilterItem ? [fastFilterItem, ...items] : items, [fastFilterItem, items]);
|
|
2421
|
+
const [collapsed, setCollapsed] = useState8(defaultCollapsed);
|
|
2422
|
+
const [internalValues, setValues] = useState8(() => initialValues(allItems, searchParams));
|
|
2423
|
+
const controlled = controlledValues !== undefined;
|
|
2424
|
+
const values = controlled ? controlledValues : internalValues;
|
|
1670
2425
|
const visibleItems = collapsed ? allItems.slice(0, 1) : allItems;
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
2426
|
+
useEffect3(() => {
|
|
2427
|
+
if (!controlled)
|
|
2428
|
+
setValues(initialValues(allItems, searchParams));
|
|
2429
|
+
}, [allItems, searchParams, controlled]);
|
|
1674
2430
|
function reset(useSearchParams = false) {
|
|
1675
2431
|
const nextValues = initialValues(allItems, searchParams, useSearchParams);
|
|
1676
|
-
|
|
2432
|
+
if (!controlled)
|
|
2433
|
+
setValues(nextValues);
|
|
2434
|
+
if (onReset)
|
|
2435
|
+
onReset(nextValues);
|
|
2436
|
+
else if (controlled)
|
|
2437
|
+
onValuesChange?.(nextValues);
|
|
1677
2438
|
return nextValues;
|
|
1678
2439
|
}
|
|
1679
|
-
|
|
2440
|
+
useImperativeHandle3(ref, () => ({
|
|
1680
2441
|
onReset: () => {
|
|
1681
2442
|
reset(false);
|
|
1682
2443
|
}
|
|
1683
2444
|
}));
|
|
1684
|
-
return /* @__PURE__ */
|
|
2445
|
+
return /* @__PURE__ */ jsxs8("form", {
|
|
2446
|
+
noValidate,
|
|
1685
2447
|
id: "searchForm",
|
|
1686
2448
|
className: getDmSearchClasses({ compact, collapsed, className }),
|
|
1687
2449
|
onSubmit: (event) => {
|
|
@@ -1689,53 +2451,63 @@ var DmSearch = forwardRef6(({
|
|
|
1689
2451
|
onSearch?.(values);
|
|
1690
2452
|
},
|
|
1691
2453
|
children: [
|
|
1692
|
-
fastFilterItem ? /* @__PURE__ */
|
|
2454
|
+
fastFilterItem ? /* @__PURE__ */ jsx9("div", {
|
|
1693
2455
|
className: dmSearchFastFilterClass,
|
|
1694
2456
|
children: fastFilterItem.title
|
|
1695
2457
|
}) : null,
|
|
1696
|
-
/* @__PURE__ */
|
|
2458
|
+
/* @__PURE__ */ jsx9("div", {
|
|
1697
2459
|
className: dmSearchFieldsClass,
|
|
1698
|
-
children: visibleItems.map((item) =>
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
2460
|
+
children: visibleItems.map((item) => {
|
|
2461
|
+
const Field = item.search.type === "custom" ? "div" : "label";
|
|
2462
|
+
return /* @__PURE__ */ jsxs8(Field, {
|
|
2463
|
+
className: dmSearchFieldClass,
|
|
2464
|
+
children: [
|
|
2465
|
+
compact ? null : /* @__PURE__ */ jsx9("span", {
|
|
2466
|
+
children: item.title
|
|
2467
|
+
}),
|
|
2468
|
+
renderField({
|
|
2469
|
+
item,
|
|
2470
|
+
value: values[item.dataIndex],
|
|
2471
|
+
loading,
|
|
2472
|
+
enableDefaultPlaceHolder,
|
|
2473
|
+
setValue: (value) => {
|
|
2474
|
+
const nextValues = { ...values, [item.dataIndex]: value };
|
|
2475
|
+
if (!controlled)
|
|
2476
|
+
setValues(nextValues);
|
|
2477
|
+
onValuesChange?.(nextValues);
|
|
2478
|
+
}
|
|
2479
|
+
})
|
|
2480
|
+
]
|
|
2481
|
+
}, item.key);
|
|
2482
|
+
})
|
|
1716
2483
|
}),
|
|
1717
|
-
/* @__PURE__ */
|
|
2484
|
+
/* @__PURE__ */ jsxs8("div", {
|
|
1718
2485
|
className: dmSearchActionsClass,
|
|
1719
2486
|
children: [
|
|
1720
|
-
/* @__PURE__ */
|
|
2487
|
+
/* @__PURE__ */ jsx9(Button, {
|
|
1721
2488
|
type: "submit",
|
|
1722
2489
|
isLoading: loading,
|
|
1723
2490
|
children: "Search"
|
|
1724
2491
|
}),
|
|
1725
|
-
/* @__PURE__ */
|
|
2492
|
+
/* @__PURE__ */ jsx9(Button, {
|
|
1726
2493
|
type: "button",
|
|
1727
2494
|
color: "secondary",
|
|
1728
2495
|
appearance: "outline",
|
|
1729
|
-
onClick: () =>
|
|
2496
|
+
onClick: () => {
|
|
2497
|
+
const nextValues = reset(false);
|
|
2498
|
+
if (!onReset)
|
|
2499
|
+
onSearch?.(nextValues);
|
|
2500
|
+
},
|
|
1730
2501
|
children: "Reset"
|
|
1731
2502
|
}),
|
|
1732
|
-
!hideCollapseBtn && allItems.length > 1 ? /* @__PURE__ */
|
|
2503
|
+
!hideCollapseBtn && allItems.length > 1 ? /* @__PURE__ */ jsx9(Button, {
|
|
1733
2504
|
type: "button",
|
|
1734
2505
|
color: "secondary",
|
|
1735
2506
|
appearance: "text",
|
|
1736
2507
|
onClick: () => {
|
|
1737
2508
|
setCollapsed((current) => !current);
|
|
1738
|
-
|
|
2509
|
+
if (!controlled)
|
|
2510
|
+
setValues(initialValues(allItems, searchParams));
|
|
1739
2511
|
},
|
|
1740
2512
|
children: collapsed ? "Expand" : "Collapse"
|
|
1741
2513
|
}) : null,
|
|
@@ -1747,10 +2519,10 @@ var DmSearch = forwardRef6(({
|
|
|
1747
2519
|
});
|
|
1748
2520
|
DmSearch.displayName = "DmSearch";
|
|
1749
2521
|
// src/components/table/Table.tsx
|
|
1750
|
-
import
|
|
1751
|
-
forwardRef as
|
|
1752
|
-
useMemo as
|
|
1753
|
-
useState as
|
|
2522
|
+
import React9, {
|
|
2523
|
+
forwardRef as forwardRef8,
|
|
2524
|
+
useMemo as useMemo7,
|
|
2525
|
+
useState as useState9
|
|
1754
2526
|
} from "react";
|
|
1755
2527
|
|
|
1756
2528
|
// src/classes/table.ts
|
|
@@ -1800,7 +2572,7 @@ function getTableSorterClasses(active) {
|
|
|
1800
2572
|
}
|
|
1801
2573
|
|
|
1802
2574
|
// src/components/table/Table.tsx
|
|
1803
|
-
import { jsx as
|
|
2575
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1804
2576
|
import { createElement } from "react";
|
|
1805
2577
|
var defaultPageSize = 10;
|
|
1806
2578
|
var defaultSortDirections = ["ascend", "descend", null];
|
|
@@ -1833,8 +2605,8 @@ function getRecordKey(record, index, rowKey) {
|
|
|
1833
2605
|
return rowKey(record, index);
|
|
1834
2606
|
}
|
|
1835
2607
|
if (rowKey) {
|
|
1836
|
-
const
|
|
1837
|
-
return typeof
|
|
2608
|
+
const key = record[rowKey];
|
|
2609
|
+
return typeof key === "string" || typeof key === "number" ? key : index;
|
|
1838
2610
|
}
|
|
1839
2611
|
const key = record.key;
|
|
1840
2612
|
return typeof key === "string" || typeof key === "number" ? key : index;
|
|
@@ -1916,24 +2688,24 @@ function selectedRowsForKeys(data, keys, rowKey) {
|
|
|
1916
2688
|
const keySet = new Set(normalizeKeys(keys));
|
|
1917
2689
|
return data.filter((record, index) => keySet.has(String(getRecordKey(record, index, rowKey))));
|
|
1918
2690
|
}
|
|
1919
|
-
var Column =
|
|
2691
|
+
var Column = forwardRef8(() => null);
|
|
1920
2692
|
Column.displayName = "Table.Column";
|
|
1921
|
-
var ColumnGroup =
|
|
2693
|
+
var ColumnGroup = forwardRef8(() => null);
|
|
1922
2694
|
ColumnGroup.displayName = "Table.ColumnGroup";
|
|
1923
|
-
var SummaryRow =
|
|
2695
|
+
var SummaryRow = forwardRef8((props, ref) => /* @__PURE__ */ jsx10("tr", {
|
|
1924
2696
|
...props,
|
|
1925
2697
|
ref
|
|
1926
2698
|
}));
|
|
1927
2699
|
SummaryRow.displayName = "Table.Summary.Row";
|
|
1928
|
-
var SummaryCell =
|
|
1929
|
-
return /* @__PURE__ */
|
|
2700
|
+
var SummaryCell = forwardRef8(({ index, ...props }, ref) => {
|
|
2701
|
+
return /* @__PURE__ */ jsx10("td", {
|
|
1930
2702
|
...props,
|
|
1931
2703
|
ref
|
|
1932
2704
|
});
|
|
1933
2705
|
});
|
|
1934
2706
|
SummaryCell.displayName = "Table.Summary.Cell";
|
|
1935
|
-
var Summary = Object.assign(
|
|
1936
|
-
return /* @__PURE__ */
|
|
2707
|
+
var Summary = Object.assign(forwardRef8(({ fixed, ...props }, ref) => {
|
|
2708
|
+
return /* @__PURE__ */ jsx10("tfoot", {
|
|
1937
2709
|
...props,
|
|
1938
2710
|
ref
|
|
1939
2711
|
});
|
|
@@ -1943,8 +2715,8 @@ var Summary = Object.assign(forwardRef7(({ fixed, ...props }, ref) => {
|
|
|
1943
2715
|
});
|
|
1944
2716
|
Summary.displayName = "Table.Summary";
|
|
1945
2717
|
function columnsFromChildren(children) {
|
|
1946
|
-
return
|
|
1947
|
-
if (!
|
|
2718
|
+
return React9.Children.toArray(children).flatMap((child) => {
|
|
2719
|
+
if (!React9.isValidElement(child)) {
|
|
1948
2720
|
return [];
|
|
1949
2721
|
}
|
|
1950
2722
|
if (child.type === Column) {
|
|
@@ -1970,12 +2742,12 @@ function renderSummary(summary, pageData, colSpan) {
|
|
|
1970
2742
|
return null;
|
|
1971
2743
|
}
|
|
1972
2744
|
const node = summary(pageData);
|
|
1973
|
-
if (
|
|
2745
|
+
if (React9.isValidElement(node) && node.type === Summary) {
|
|
1974
2746
|
return node;
|
|
1975
2747
|
}
|
|
1976
|
-
return /* @__PURE__ */
|
|
1977
|
-
children: /* @__PURE__ */
|
|
1978
|
-
children: /* @__PURE__ */
|
|
2748
|
+
return /* @__PURE__ */ jsx10("tfoot", {
|
|
2749
|
+
children: /* @__PURE__ */ jsx10("tr", {
|
|
2750
|
+
children: /* @__PURE__ */ jsx10("td", {
|
|
1979
2751
|
className: tableCellClass,
|
|
1980
2752
|
colSpan,
|
|
1981
2753
|
children: node
|
|
@@ -2019,18 +2791,18 @@ function TableRoot({
|
|
|
2019
2791
|
className,
|
|
2020
2792
|
...props
|
|
2021
2793
|
}, ref) {
|
|
2022
|
-
const childColumns =
|
|
2023
|
-
const normalizedColumns =
|
|
2024
|
-
const leaves =
|
|
2025
|
-
const headerRows =
|
|
2026
|
-
const [sortStates, setSortStates] =
|
|
2027
|
-
const [filterStates, setFilterStates] =
|
|
2028
|
-
const [internalCurrent, setInternalCurrent] =
|
|
2029
|
-
const [internalPageSize, setInternalPageSize] =
|
|
2030
|
-
const [internalSelectedKeys, setInternalSelectedKeys] =
|
|
2031
|
-
const [internalExpandedKeys, setInternalExpandedKeys] =
|
|
2794
|
+
const childColumns = useMemo7(() => columnsFromChildren(children), [children]);
|
|
2795
|
+
const normalizedColumns = useMemo7(() => normalizeColumns(columns ?? childColumns), [childColumns, columns]);
|
|
2796
|
+
const leaves = useMemo7(() => leafColumns(normalizedColumns), [normalizedColumns]);
|
|
2797
|
+
const headerRows = useMemo7(() => buildHeaderRows(normalizedColumns, getDepth(normalizedColumns)), [normalizedColumns]);
|
|
2798
|
+
const [sortStates, setSortStates] = useState9({});
|
|
2799
|
+
const [filterStates, setFilterStates] = useState9({});
|
|
2800
|
+
const [internalCurrent, setInternalCurrent] = useState9(1);
|
|
2801
|
+
const [internalPageSize, setInternalPageSize] = useState9(defaultPageSize);
|
|
2802
|
+
const [internalSelectedKeys, setInternalSelectedKeys] = useState9(rowSelection?.defaultSelectedRowKeys ?? []);
|
|
2803
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState9(expandable?.defaultExpandedRowKeys ?? []);
|
|
2032
2804
|
const spinning = typeof loading === "object" ? loading.spinning : Boolean(loading);
|
|
2033
|
-
const activeFilters =
|
|
2805
|
+
const activeFilters = useMemo7(() => {
|
|
2034
2806
|
return leaves.reduce((result, column) => {
|
|
2035
2807
|
const value = filterValueFor(column, filterStates) ?? null;
|
|
2036
2808
|
if (value !== null) {
|
|
@@ -2039,7 +2811,7 @@ function TableRoot({
|
|
|
2039
2811
|
return result;
|
|
2040
2812
|
}, {});
|
|
2041
2813
|
}, [filterStates, leaves]);
|
|
2042
|
-
const activeSorter =
|
|
2814
|
+
const activeSorter = useMemo7(() => {
|
|
2043
2815
|
const column = leaves.find((item) => sortOrderFor(item, sortStates));
|
|
2044
2816
|
if (!column) {
|
|
2045
2817
|
return {};
|
|
@@ -2051,7 +2823,7 @@ function TableRoot({
|
|
|
2051
2823
|
order: sortOrderFor(column, sortStates) ?? null
|
|
2052
2824
|
};
|
|
2053
2825
|
}, [leaves, sortStates]);
|
|
2054
|
-
const filteredData =
|
|
2826
|
+
const filteredData = useMemo7(() => {
|
|
2055
2827
|
return leaves.reduce((records, column) => {
|
|
2056
2828
|
const values = filterValueFor(column, filterStates);
|
|
2057
2829
|
if (!values?.length || !column.onFilter) {
|
|
@@ -2060,7 +2832,7 @@ function TableRoot({
|
|
|
2060
2832
|
return records.filter((record) => values.some((value) => column.onFilter?.(value, record)));
|
|
2061
2833
|
}, dataSource);
|
|
2062
2834
|
}, [dataSource, filterStates, leaves]);
|
|
2063
|
-
const sortedData =
|
|
2835
|
+
const sortedData = useMemo7(() => {
|
|
2064
2836
|
const sorterColumn = leaves.find((column) => sortOrderFor(column, sortStates));
|
|
2065
2837
|
const order = sorterColumn ? sortOrderFor(sorterColumn, sortStates) : null;
|
|
2066
2838
|
const compare = sorterColumn ? sortCompare(sorterColumn.sorter) : undefined;
|
|
@@ -2203,18 +2975,18 @@ function TableRoot({
|
|
|
2203
2975
|
return null;
|
|
2204
2976
|
}
|
|
2205
2977
|
if (rowSelection.type === "radio" || rowSelection.hideSelectAll) {
|
|
2206
|
-
return /* @__PURE__ */
|
|
2978
|
+
return /* @__PURE__ */ jsx10("th", {
|
|
2207
2979
|
className: cn(tableHeaderCellClass, tableSelectionCellClass),
|
|
2208
2980
|
children: rowSelection.columnTitle
|
|
2209
2981
|
});
|
|
2210
2982
|
}
|
|
2211
2983
|
const pageKeys = pageData.map((record, index) => getRecordKey(record, index, rowKey));
|
|
2212
2984
|
const allSelected = pageKeys.length > 0 && pageKeys.every((key) => selectedKeySet.has(String(key)));
|
|
2213
|
-
return /* @__PURE__ */
|
|
2985
|
+
return /* @__PURE__ */ jsx10("th", {
|
|
2214
2986
|
className: cn(tableHeaderCellClass, tableSelectionCellClass),
|
|
2215
|
-
children: /* @__PURE__ */
|
|
2987
|
+
children: /* @__PURE__ */ jsxs9("label", {
|
|
2216
2988
|
children: [
|
|
2217
|
-
/* @__PURE__ */
|
|
2989
|
+
/* @__PURE__ */ jsx10("input", {
|
|
2218
2990
|
type: "checkbox",
|
|
2219
2991
|
"aria-label": "Select all rows",
|
|
2220
2992
|
checked: allSelected,
|
|
@@ -2241,26 +3013,26 @@ function TableRoot({
|
|
|
2241
3013
|
textAlign: column.align,
|
|
2242
3014
|
...headerProps.style
|
|
2243
3015
|
}
|
|
2244
|
-
}, /* @__PURE__ */
|
|
3016
|
+
}, /* @__PURE__ */ jsx10("span", {
|
|
2245
3017
|
children: title
|
|
2246
|
-
}), column.sorter ? /* @__PURE__ */
|
|
3018
|
+
}), column.sorter ? /* @__PURE__ */ jsx10("button", {
|
|
2247
3019
|
type: "button",
|
|
2248
3020
|
className: getTableSorterClasses(Boolean(sortOrder)),
|
|
2249
3021
|
"aria-label": `Sort ${textFromNode(title, String(column.columnKey))}`,
|
|
2250
3022
|
onClick: () => changeSorter(column),
|
|
2251
3023
|
children: sortOrder === "ascend" ? "Asc" : sortOrder === "descend" ? "Desc" : "Sort"
|
|
2252
|
-
}) : null, column.filters?.length ? /* @__PURE__ */
|
|
3024
|
+
}) : null, column.filters?.length ? /* @__PURE__ */ jsxs9("select", {
|
|
2253
3025
|
className: tableFilterClass,
|
|
2254
3026
|
"aria-label": `Filter ${textFromNode(title, String(column.columnKey))}`,
|
|
2255
3027
|
multiple: column.filterMultiple !== false,
|
|
2256
3028
|
value: column.filterMultiple === false ? String((filterValueFor(column, filterStates) ?? [])[0] ?? "") : (filterValueFor(column, filterStates) ?? []).map(String),
|
|
2257
3029
|
onChange: (event) => changeFilter(column, event),
|
|
2258
3030
|
children: [
|
|
2259
|
-
column.filterMultiple === false ? /* @__PURE__ */
|
|
3031
|
+
column.filterMultiple === false ? /* @__PURE__ */ jsx10("option", {
|
|
2260
3032
|
value: "",
|
|
2261
3033
|
children: "All"
|
|
2262
3034
|
}) : null,
|
|
2263
|
-
optionValues(column.filters).map((filter) => /* @__PURE__ */
|
|
3035
|
+
optionValues(column.filters).map((filter) => /* @__PURE__ */ jsx10("option", {
|
|
2264
3036
|
value: String(filter.value),
|
|
2265
3037
|
children: filter.text
|
|
2266
3038
|
}, String(filter.value)))
|
|
@@ -2285,14 +3057,14 @@ function TableRoot({
|
|
|
2285
3057
|
const key = getRecordKey(record, index, rowKey);
|
|
2286
3058
|
const checked = selectedKeySet.has(String(key));
|
|
2287
3059
|
const checkboxProps = rowSelection.getCheckboxProps?.(record) ?? {};
|
|
2288
|
-
const originNode = /* @__PURE__ */
|
|
3060
|
+
const originNode = /* @__PURE__ */ jsx10("input", {
|
|
2289
3061
|
...checkboxProps,
|
|
2290
3062
|
type: rowSelection.type === "radio" ? "radio" : "checkbox",
|
|
2291
3063
|
"aria-label": `Select row ${index + 1}`,
|
|
2292
3064
|
checked,
|
|
2293
3065
|
onChange: (event) => toggleRowSelection(record, index, event)
|
|
2294
3066
|
});
|
|
2295
|
-
return /* @__PURE__ */
|
|
3067
|
+
return /* @__PURE__ */ jsx10("td", {
|
|
2296
3068
|
className: cn(tableCellClass, tableSelectionCellClass),
|
|
2297
3069
|
children: rowSelection.renderCell ? rowSelection.renderCell(checked, record, index, originNode) : originNode
|
|
2298
3070
|
});
|
|
@@ -2304,9 +3076,9 @@ function TableRoot({
|
|
|
2304
3076
|
const key = getRecordKey(record, index, rowKey);
|
|
2305
3077
|
const expanded = expandedKeySet.has(String(key));
|
|
2306
3078
|
const expandableRow = expandable.rowExpandable?.(record) ?? true;
|
|
2307
|
-
return /* @__PURE__ */
|
|
3079
|
+
return /* @__PURE__ */ jsx10("td", {
|
|
2308
3080
|
className: cn(tableCellClass, tableExpandCellClass),
|
|
2309
|
-
children: expandableRow ? /* @__PURE__ */
|
|
3081
|
+
children: expandableRow ? /* @__PURE__ */ jsx10("button", {
|
|
2310
3082
|
type: "button",
|
|
2311
3083
|
className: tableExpandButtonClass,
|
|
2312
3084
|
"aria-label": `${expanded ? "Collapse" : "Expand"} row ${index + 1}`,
|
|
@@ -2319,7 +3091,7 @@ function TableRoot({
|
|
|
2319
3091
|
const key = getRecordKey(record, index, rowKey);
|
|
2320
3092
|
const expanded = expandedKeySet.has(String(key));
|
|
2321
3093
|
const selected = selectedKeySet.has(String(key));
|
|
2322
|
-
const row = /* @__PURE__ */
|
|
3094
|
+
const row = /* @__PURE__ */ jsxs9("tr", {
|
|
2323
3095
|
className: getTableRowClasses({ selected, expanded }),
|
|
2324
3096
|
onClick: () => {
|
|
2325
3097
|
if (expandable?.expandRowByClick) {
|
|
@@ -2335,12 +3107,12 @@ function TableRoot({
|
|
|
2335
3107
|
if (!expanded || !expandable?.expandedRowRender) {
|
|
2336
3108
|
return row;
|
|
2337
3109
|
}
|
|
2338
|
-
return /* @__PURE__ */
|
|
3110
|
+
return /* @__PURE__ */ jsxs9(React9.Fragment, {
|
|
2339
3111
|
children: [
|
|
2340
3112
|
row,
|
|
2341
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ jsx10("tr", {
|
|
2342
3114
|
className: "table-expanded-row",
|
|
2343
|
-
children: /* @__PURE__ */
|
|
3115
|
+
children: /* @__PURE__ */ jsx10("td", {
|
|
2344
3116
|
className: tableCellClass,
|
|
2345
3117
|
colSpan: structuralColumnCount,
|
|
2346
3118
|
children: expandable.expandedRowRender(record, index, 0, expanded)
|
|
@@ -2349,15 +3121,15 @@ function TableRoot({
|
|
|
2349
3121
|
]
|
|
2350
3122
|
}, String(key));
|
|
2351
3123
|
}
|
|
2352
|
-
const tableNode = /* @__PURE__ */
|
|
3124
|
+
const tableNode = /* @__PURE__ */ jsxs9("table", {
|
|
2353
3125
|
className: getTableClasses({ bordered, size }),
|
|
2354
3126
|
style: { tableLayout },
|
|
2355
3127
|
children: [
|
|
2356
|
-
/* @__PURE__ */
|
|
2357
|
-
children: headerRows.map((row, rowIndex) => /* @__PURE__ */
|
|
3128
|
+
/* @__PURE__ */ jsx10("thead", {
|
|
3129
|
+
children: headerRows.map((row, rowIndex) => /* @__PURE__ */ jsxs9("tr", {
|
|
2358
3130
|
children: [
|
|
2359
3131
|
rowIndex === 0 ? renderSelectionHeader() : null,
|
|
2360
|
-
rowIndex === 0 && hasExpandable ? /* @__PURE__ */
|
|
3132
|
+
rowIndex === 0 && hasExpandable ? /* @__PURE__ */ jsx10("th", {
|
|
2361
3133
|
className: cn(tableHeaderCellClass, tableExpandCellClass),
|
|
2362
3134
|
children: expandable?.columnTitle
|
|
2363
3135
|
}) : null,
|
|
@@ -2365,9 +3137,9 @@ function TableRoot({
|
|
|
2365
3137
|
]
|
|
2366
3138
|
}, rowIndex))
|
|
2367
3139
|
}),
|
|
2368
|
-
/* @__PURE__ */
|
|
2369
|
-
children: bodyEmpty ? /* @__PURE__ */
|
|
2370
|
-
children: /* @__PURE__ */
|
|
3140
|
+
/* @__PURE__ */ jsx10("tbody", {
|
|
3141
|
+
children: bodyEmpty ? /* @__PURE__ */ jsx10("tr", {
|
|
3142
|
+
children: /* @__PURE__ */ jsx10("td", {
|
|
2371
3143
|
className: tableEmptyClass,
|
|
2372
3144
|
colSpan: structuralColumnCount,
|
|
2373
3145
|
children: locale?.emptyText ?? "No data"
|
|
@@ -2377,12 +3149,12 @@ function TableRoot({
|
|
|
2377
3149
|
renderSummary(summary, pageData, structuralColumnCount)
|
|
2378
3150
|
]
|
|
2379
3151
|
});
|
|
2380
|
-
return /* @__PURE__ */
|
|
3152
|
+
return /* @__PURE__ */ jsxs9("div", {
|
|
2381
3153
|
...props,
|
|
2382
3154
|
ref,
|
|
2383
3155
|
className: getTableWrapperClasses({ loading: spinning, className }),
|
|
2384
3156
|
children: [
|
|
2385
|
-
scroll?.x || scroll?.y ? /* @__PURE__ */
|
|
3157
|
+
scroll?.x || scroll?.y ? /* @__PURE__ */ jsx10("div", {
|
|
2386
3158
|
style: {
|
|
2387
3159
|
overflow: "auto",
|
|
2388
3160
|
maxHeight: scroll.y,
|
|
@@ -2390,30 +3162,30 @@ function TableRoot({
|
|
|
2390
3162
|
},
|
|
2391
3163
|
children: tableNode
|
|
2392
3164
|
}) : tableNode,
|
|
2393
|
-
spinning ? /* @__PURE__ */
|
|
3165
|
+
spinning ? /* @__PURE__ */ jsx10("div", {
|
|
2394
3166
|
className: tableLoadingIndicatorClass,
|
|
2395
3167
|
role: "status",
|
|
2396
3168
|
children: typeof loading === "object" && loading.indicator ? loading.indicator : "Loading"
|
|
2397
3169
|
}) : null,
|
|
2398
|
-
paginationConfig && !(paginationConfig.hideOnSinglePage && pageCount <= 1) ? /* @__PURE__ */
|
|
3170
|
+
paginationConfig && !(paginationConfig.hideOnSinglePage && pageCount <= 1) ? /* @__PURE__ */ jsxs9("nav", {
|
|
2399
3171
|
className: tablePaginationClass,
|
|
2400
3172
|
"aria-label": "Table pagination",
|
|
2401
3173
|
children: [
|
|
2402
|
-
/* @__PURE__ */
|
|
3174
|
+
/* @__PURE__ */ jsx10("button", {
|
|
2403
3175
|
type: "button",
|
|
2404
3176
|
className: tablePaginationButtonClass,
|
|
2405
3177
|
disabled: paginationConfig.disabled || current <= 1,
|
|
2406
3178
|
onClick: () => changePage(current - 1),
|
|
2407
3179
|
children: "Previous"
|
|
2408
3180
|
}),
|
|
2409
|
-
/* @__PURE__ */
|
|
3181
|
+
/* @__PURE__ */ jsx10("span", {
|
|
2410
3182
|
className: tablePaginationInfoClass,
|
|
2411
3183
|
children: paginationConfig.showTotal ? paginationConfig.showTotal(paginationConfig.total ?? sortedData.length, [
|
|
2412
3184
|
bodyEmpty ? 0 : (current - 1) * pageSize + 1,
|
|
2413
3185
|
Math.min(current * pageSize, sortedData.length)
|
|
2414
3186
|
]) : `${current} / ${pageCount}`
|
|
2415
3187
|
}),
|
|
2416
|
-
/* @__PURE__ */
|
|
3188
|
+
/* @__PURE__ */ jsx10("button", {
|
|
2417
3189
|
type: "button",
|
|
2418
3190
|
className: tablePaginationButtonClass,
|
|
2419
3191
|
disabled: paginationConfig.disabled || current >= pageCount,
|
|
@@ -2425,7 +3197,7 @@ function TableRoot({
|
|
|
2425
3197
|
]
|
|
2426
3198
|
});
|
|
2427
3199
|
}
|
|
2428
|
-
var TableWithRef =
|
|
3200
|
+
var TableWithRef = forwardRef8(TableRoot);
|
|
2429
3201
|
var Table = Object.assign(TableWithRef, {
|
|
2430
3202
|
Column,
|
|
2431
3203
|
ColumnGroup,
|
|
@@ -2438,25 +3210,7 @@ var Table = Object.assign(TableWithRef, {
|
|
|
2438
3210
|
});
|
|
2439
3211
|
Table.displayName = "Table";
|
|
2440
3212
|
// src/components/dm-table/DmTable.tsx
|
|
2441
|
-
import {
|
|
2442
|
-
|
|
2443
|
-
// src/classes/dm-table.ts
|
|
2444
|
-
var dmTableBaseClass = "dm-table";
|
|
2445
|
-
var dmTableSearchClass = "dm-table-search";
|
|
2446
|
-
var dmTableCardClass = "dm-table-card";
|
|
2447
|
-
var dmTableHeaderClass = "dm-table-header";
|
|
2448
|
-
var dmTableTitleClass = "dm-table-title";
|
|
2449
|
-
var dmTableExtraClass = "dm-table-extra";
|
|
2450
|
-
var dmTableIndicatorsClass = "dm-table-indicators";
|
|
2451
|
-
var dmTableTableExtraClass = "dm-table-table-extra";
|
|
2452
|
-
var dmTableColumnSettingClass = "dm-table-column-setting";
|
|
2453
|
-
var dmTablePaginationClass = "dm-table-pagination";
|
|
2454
|
-
function getDmTableClasses({ className }) {
|
|
2455
|
-
return cn(dmTableBaseClass, className);
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
// src/components/dm-table/DmTable.tsx
|
|
2459
|
-
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3213
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2460
3214
|
function mapAndFilter(list, mapper) {
|
|
2461
3215
|
return list.map(mapper).filter((item) => item !== false && item != null);
|
|
2462
3216
|
}
|
|
@@ -2507,9 +3261,9 @@ function DmTable({
|
|
|
2507
3261
|
rowSelection,
|
|
2508
3262
|
...props
|
|
2509
3263
|
}) {
|
|
2510
|
-
const tableColumns =
|
|
2511
|
-
const [columns, setColumns] =
|
|
2512
|
-
const [columnSettingsOpen, setColumnSettingsOpen] =
|
|
3264
|
+
const tableColumns = useMemo8(() => mapAndFilter(inputColumns, filterDmTableColumn), [inputColumns]);
|
|
3265
|
+
const [columns, setColumns] = useState10(tableColumns);
|
|
3266
|
+
const [columnSettingsOpen, setColumnSettingsOpen] = useState10(false);
|
|
2513
3267
|
const items = searchProps?.items?.length ? searchProps.items : searchItems(inputColumns);
|
|
2514
3268
|
const paginationObj = typeof pagination === "object" ? pagination : undefined;
|
|
2515
3269
|
const paginationProps = paginationObj ? Object.fromEntries(Object.entries(paginationObj).filter(([key]) => key !== "ref")) : {};
|
|
@@ -2522,37 +3276,37 @@ function DmTable({
|
|
|
2522
3276
|
globalThis.localStorage?.removeItem(columnState.persistenceKey);
|
|
2523
3277
|
}
|
|
2524
3278
|
}
|
|
2525
|
-
return /* @__PURE__ */
|
|
3279
|
+
return /* @__PURE__ */ jsxs10("div", {
|
|
2526
3280
|
className: getDmTableClasses({ className }),
|
|
2527
3281
|
children: [
|
|
2528
|
-
items.length > 0 || searchProps?.fastFilterItem ? /* @__PURE__ */
|
|
3282
|
+
items.length > 0 || searchProps?.fastFilterItem ? /* @__PURE__ */ jsx11(Card, {
|
|
2529
3283
|
className: dmTableSearchClass,
|
|
2530
3284
|
padding: "md",
|
|
2531
|
-
children: /* @__PURE__ */
|
|
3285
|
+
children: /* @__PURE__ */ jsx11(DmSearch, {
|
|
2532
3286
|
...searchProps,
|
|
2533
3287
|
items
|
|
2534
3288
|
})
|
|
2535
3289
|
}) : null,
|
|
2536
|
-
indicators ? /* @__PURE__ */
|
|
3290
|
+
indicators ? /* @__PURE__ */ jsx11("div", {
|
|
2537
3291
|
className: dmTableIndicatorsClass,
|
|
2538
3292
|
children: indicators
|
|
2539
3293
|
}) : null,
|
|
2540
|
-
/* @__PURE__ */
|
|
3294
|
+
/* @__PURE__ */ jsxs10(Card, {
|
|
2541
3295
|
className: dmTableCardClass,
|
|
2542
3296
|
padding: "md",
|
|
2543
3297
|
children: [
|
|
2544
|
-
name || extra || columnSettingVisible ? /* @__PURE__ */
|
|
3298
|
+
name || extra || columnSettingVisible ? /* @__PURE__ */ jsxs10("div", {
|
|
2545
3299
|
className: dmTableHeaderClass,
|
|
2546
3300
|
children: [
|
|
2547
|
-
/* @__PURE__ */
|
|
3301
|
+
/* @__PURE__ */ jsx11("div", {
|
|
2548
3302
|
className: dmTableTitleClass,
|
|
2549
3303
|
children: name
|
|
2550
3304
|
}),
|
|
2551
|
-
/* @__PURE__ */
|
|
3305
|
+
/* @__PURE__ */ jsxs10("div", {
|
|
2552
3306
|
className: dmTableExtraClass,
|
|
2553
3307
|
children: [
|
|
2554
3308
|
extra,
|
|
2555
|
-
columnSettingVisible ? /* @__PURE__ */
|
|
3309
|
+
columnSettingVisible ? /* @__PURE__ */ jsx11(Button, {
|
|
2556
3310
|
type: "button",
|
|
2557
3311
|
color: "secondary",
|
|
2558
3312
|
appearance: "outline",
|
|
@@ -2564,20 +3318,20 @@ function DmTable({
|
|
|
2564
3318
|
})
|
|
2565
3319
|
]
|
|
2566
3320
|
}) : null,
|
|
2567
|
-
columnSettingsOpen ? /* @__PURE__ */
|
|
3321
|
+
columnSettingsOpen ? /* @__PURE__ */ jsx11("div", {
|
|
2568
3322
|
role: "dialog",
|
|
2569
3323
|
"aria-label": "Column settings",
|
|
2570
|
-
children: /* @__PURE__ */
|
|
3324
|
+
children: /* @__PURE__ */ jsx11(Button, {
|
|
2571
3325
|
type: "button",
|
|
2572
3326
|
onClick: resetColumns,
|
|
2573
3327
|
children: "Reset columns"
|
|
2574
3328
|
})
|
|
2575
3329
|
}) : null,
|
|
2576
|
-
tableExtra ? /* @__PURE__ */
|
|
3330
|
+
tableExtra ? /* @__PURE__ */ jsx11("div", {
|
|
2577
3331
|
className: dmTableTableExtraClass,
|
|
2578
3332
|
children: tableExtra
|
|
2579
3333
|
}) : null,
|
|
2580
|
-
/* @__PURE__ */
|
|
3334
|
+
/* @__PURE__ */ jsx11(Table, {
|
|
2581
3335
|
...props,
|
|
2582
3336
|
dataSource,
|
|
2583
3337
|
rowSelection,
|
|
@@ -2593,7 +3347,7 @@ function DmTable({
|
|
|
2593
3347
|
onChange: paginationObj?.onChange
|
|
2594
3348
|
} : false
|
|
2595
3349
|
}),
|
|
2596
|
-
pagination ? /* @__PURE__ */
|
|
3350
|
+
pagination ? /* @__PURE__ */ jsx11(DmPagination, {
|
|
2597
3351
|
...paginationProps,
|
|
2598
3352
|
className: dmTablePaginationClass,
|
|
2599
3353
|
total,
|
|
@@ -2607,6 +3361,6 @@ function DmTable({
|
|
|
2607
3361
|
}
|
|
2608
3362
|
DmTable.displayName = "DmTable";
|
|
2609
3363
|
export {
|
|
2610
|
-
|
|
2611
|
-
|
|
3364
|
+
DmTable,
|
|
3365
|
+
filterDmTableColumn
|
|
2612
3366
|
};
|