@farmzone/fz-react-ui 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +154 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +154 -119
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -976,6 +976,7 @@ type SelectOption<P> = BaseOption<P> & {
|
|
|
976
976
|
type RadioOption<P> = BaseOption<P> & {
|
|
977
977
|
type: "radio";
|
|
978
978
|
options: Array<SelectableOption>;
|
|
979
|
+
autoSubmit?: boolean;
|
|
979
980
|
};
|
|
980
981
|
type DateOption<P> = BaseOption<P> & {
|
|
981
982
|
type: "date";
|
|
@@ -988,6 +989,7 @@ type DateRangeOption<P> = BaseOption<P> & {
|
|
|
988
989
|
type CheckboxOption<P> = BaseOption<P> & {
|
|
989
990
|
type: "checkbox";
|
|
990
991
|
options: Array<SelectableOption>;
|
|
992
|
+
autoSubmit?: boolean;
|
|
991
993
|
};
|
|
992
994
|
type FilterOption<P> = InputOption<P> | SelectOption<P> | RadioOption<P> | DateOption<P> | DateRangeOption<P> | CheckboxOption<P>;
|
|
993
995
|
interface FilterRow<P> {
|
package/dist/index.d.ts
CHANGED
|
@@ -976,6 +976,7 @@ type SelectOption<P> = BaseOption<P> & {
|
|
|
976
976
|
type RadioOption<P> = BaseOption<P> & {
|
|
977
977
|
type: "radio";
|
|
978
978
|
options: Array<SelectableOption>;
|
|
979
|
+
autoSubmit?: boolean;
|
|
979
980
|
};
|
|
980
981
|
type DateOption<P> = BaseOption<P> & {
|
|
981
982
|
type: "date";
|
|
@@ -988,6 +989,7 @@ type DateRangeOption<P> = BaseOption<P> & {
|
|
|
988
989
|
type CheckboxOption<P> = BaseOption<P> & {
|
|
989
990
|
type: "checkbox";
|
|
990
991
|
options: Array<SelectableOption>;
|
|
992
|
+
autoSubmit?: boolean;
|
|
991
993
|
};
|
|
992
994
|
type FilterOption<P> = InputOption<P> | SelectOption<P> | RadioOption<P> | DateOption<P> | DateRangeOption<P> | CheckboxOption<P>;
|
|
993
995
|
interface FilterRow<P> {
|
package/dist/index.js
CHANGED
|
@@ -717,7 +717,7 @@ function Slider(props) {
|
|
|
717
717
|
RadixSlider.Track,
|
|
718
718
|
{
|
|
719
719
|
className: cn(
|
|
720
|
-
"relative h-[3px] grow rounded-full bg-
|
|
720
|
+
"relative h-[3px] grow rounded-full bg-gray-200",
|
|
721
721
|
orientation === "vertical" && "w-[3px] h-full",
|
|
722
722
|
trackClassName
|
|
723
723
|
),
|
|
@@ -725,7 +725,7 @@ function Slider(props) {
|
|
|
725
725
|
RadixSlider.Range,
|
|
726
726
|
{
|
|
727
727
|
className: cn(
|
|
728
|
-
"absolute h-full rounded-full bg-
|
|
728
|
+
"absolute h-full rounded-full bg-[#009fe3]",
|
|
729
729
|
orientation === "vertical" && "w-full",
|
|
730
730
|
rangeClassName
|
|
731
731
|
)
|
|
@@ -733,17 +733,18 @@ function Slider(props) {
|
|
|
733
733
|
)
|
|
734
734
|
}
|
|
735
735
|
),
|
|
736
|
-
/* @__PURE__ */ jsx(
|
|
736
|
+
(value ?? defaultValue).map((_, index) => /* @__PURE__ */ jsx(
|
|
737
737
|
RadixSlider.Thumb,
|
|
738
738
|
{
|
|
739
739
|
className: cn(
|
|
740
|
-
"block size-
|
|
740
|
+
"block size-4 rounded-full bg-white border-2 border-[#009fe3] shadow-md hover:border-[#0090cf] focus:outline-none focus:ring-2 focus:ring-[#009fe3]/40 focus:ring-offset-1",
|
|
741
741
|
disabled && "cursor-not-allowed opacity-50",
|
|
742
742
|
thumbClassName
|
|
743
743
|
),
|
|
744
|
-
"aria-label": ariaLabel
|
|
745
|
-
}
|
|
746
|
-
|
|
744
|
+
"aria-label": index === 0 ? ariaLabel : `${ariaLabel} max`
|
|
745
|
+
},
|
|
746
|
+
index
|
|
747
|
+
))
|
|
747
748
|
]
|
|
748
749
|
}
|
|
749
750
|
);
|
|
@@ -4105,45 +4106,15 @@ function TableHeader(props) {
|
|
|
4105
4106
|
};
|
|
4106
4107
|
};
|
|
4107
4108
|
const renderColumnTitle = (column, isClickableHead) => {
|
|
4108
|
-
const baseClasses = "pt-0.5 select-none";
|
|
4109
|
+
const baseClasses = "pt-0.5 select-none truncate";
|
|
4109
4110
|
const subTitleClasses = column.key === "subTitle" ? "inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800" : "";
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
children: renderSortIcon(column.key)
|
|
4118
|
-
}
|
|
4119
|
-
)
|
|
4120
|
-
] });
|
|
4121
|
-
}
|
|
4122
|
-
if (column.align === "center") {
|
|
4123
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex justify-center w-full", children: [
|
|
4124
|
-
/* @__PURE__ */ jsx("div", { className: `flex items-center justify-center ${column.sortable ? "pl-5" : ""}`, children: /* @__PURE__ */ jsx("span", { className: `whitespace-nowrap ${baseClasses} ${isClickableHead} ${subTitleClasses}`, children: column.title }) }),
|
|
4125
|
-
column.sortable && /* @__PURE__ */ jsx(
|
|
4126
|
-
"div",
|
|
4127
|
-
{
|
|
4128
|
-
className: `w-5 flex flex-col gap-[1.5px] items-center justify-center cursor-pointer ${isClickableHead}`,
|
|
4129
|
-
children: renderSortIcon(column.key)
|
|
4130
|
-
}
|
|
4131
|
-
)
|
|
4132
|
-
] });
|
|
4133
|
-
}
|
|
4134
|
-
if (column.align === "right") {
|
|
4135
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex justify-end w-full", children: [
|
|
4136
|
-
column.sortable && /* @__PURE__ */ jsx(
|
|
4137
|
-
"div",
|
|
4138
|
-
{
|
|
4139
|
-
className: `w-5 flex flex-col gap-[1.5px] items-center justify-center cursor-pointer ${isClickableHead}`,
|
|
4140
|
-
children: renderSortIcon(column.key)
|
|
4141
|
-
}
|
|
4142
|
-
),
|
|
4143
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: `pr-3 truncate ${baseClasses} ${isClickableHead} ${subTitleClasses}`, children: column.title }) })
|
|
4144
|
-
] });
|
|
4145
|
-
}
|
|
4146
|
-
return /* @__PURE__ */ jsx("span", { className: `px-1.5 truncate ${baseClasses} ${isClickableHead} ${subTitleClasses}`, children: column.title });
|
|
4111
|
+
const hasSortIcon = column.sortable;
|
|
4112
|
+
const textAlignClass = column.align === "center" ? "text-center" : column.align === "right" ? "text-right" : "text-left";
|
|
4113
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center w-full", children: [
|
|
4114
|
+
hasSortIcon && column.align === "center" && /* @__PURE__ */ jsx("div", { className: "w-5 shrink-0" }),
|
|
4115
|
+
/* @__PURE__ */ jsx("span", { className: `flex-1 px-3 ${textAlignClass} ${baseClasses} ${isClickableHead} ${subTitleClasses}`, children: column.title }),
|
|
4116
|
+
hasSortIcon && /* @__PURE__ */ jsx("div", { className: `w-6 shrink-0 flex items-center justify-center cursor-pointer ${isClickableHead}`, children: renderSortIcon(column.key) })
|
|
4117
|
+
] });
|
|
4147
4118
|
};
|
|
4148
4119
|
const createGroupHeaders = () => {
|
|
4149
4120
|
const mainGroups2 = {};
|
|
@@ -4563,32 +4534,64 @@ function TableEmpty(props) {
|
|
|
4563
4534
|
/* @__PURE__ */ jsx("span", { className: "text-md text-gray-500", children: "\uB4F1\uB85D\uB41C \uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4." })
|
|
4564
4535
|
] }) }) });
|
|
4565
4536
|
}
|
|
4537
|
+
function TableCellTooltip({ children, content }) {
|
|
4538
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { delayDuration: 0, children: /* @__PURE__ */ jsxs(TooltipPrimitive.Root, { children: [
|
|
4539
|
+
/* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { asChild: true, children }),
|
|
4540
|
+
/* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
4541
|
+
TooltipPrimitive.Content,
|
|
4542
|
+
{
|
|
4543
|
+
side: "bottom",
|
|
4544
|
+
sideOffset: 5,
|
|
4545
|
+
collisionPadding: 8,
|
|
4546
|
+
className: "relative animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 z-50 w-full max-w-[500px] origin-(--radix-tooltip-content-transform-origin) rounded-md bg-neutral-700 text-sm font-medium text-white",
|
|
4547
|
+
style: { zIndex: Z_INDEX.TOOLTIP },
|
|
4548
|
+
children: [
|
|
4549
|
+
/* @__PURE__ */ jsx(
|
|
4550
|
+
"div",
|
|
4551
|
+
{
|
|
4552
|
+
className: "px-3 py-[5px] break-words whitespace-normal custom-view-scrollbar",
|
|
4553
|
+
style: { overflowY: "auto", maxHeight: "250px" },
|
|
4554
|
+
children: content
|
|
4555
|
+
}
|
|
4556
|
+
),
|
|
4557
|
+
/* @__PURE__ */ jsx(
|
|
4558
|
+
TooltipPrimitive.Arrow,
|
|
4559
|
+
{
|
|
4560
|
+
className: cn(
|
|
4561
|
+
"z-50 w-2.5 h-2.5 translate-y-[calc(-50%_-_0px)] rotate-45 rounded-[2px]",
|
|
4562
|
+
"bg-neutral-700 !fill-neutral-700"
|
|
4563
|
+
),
|
|
4564
|
+
style: { fill: "currentColor" }
|
|
4565
|
+
}
|
|
4566
|
+
)
|
|
4567
|
+
]
|
|
4568
|
+
}
|
|
4569
|
+
) })
|
|
4570
|
+
] }) });
|
|
4571
|
+
}
|
|
4566
4572
|
function TableCellContent(props) {
|
|
4567
4573
|
const { cellContent, tooltipText, align, tooltipConfig, onCellClick } = props;
|
|
4568
|
-
const textRef = useRef(null);
|
|
4569
4574
|
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4575
|
+
const observerRef = useRef(null);
|
|
4576
|
+
const refCallback = useCallback(
|
|
4577
|
+
(el) => {
|
|
4578
|
+
observerRef.current?.disconnect();
|
|
4579
|
+
observerRef.current = null;
|
|
4580
|
+
if (!el || tooltipConfig !== "overflow") return;
|
|
4581
|
+
const check = () => setIsOverflowing(el.scrollWidth > el.clientWidth);
|
|
4582
|
+
const observer = new ResizeObserver(check);
|
|
4583
|
+
observer.observe(el);
|
|
4584
|
+
observerRef.current = observer;
|
|
4585
|
+
},
|
|
4586
|
+
[tooltipConfig]
|
|
4587
|
+
);
|
|
4580
4588
|
const shouldShowTooltip = tooltipConfig === "always" || tooltipConfig === "overflow" && isOverflowing;
|
|
4581
4589
|
const textAlign = align === "center" ? "center" : align === "right" ? "right" : "left";
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
{
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
style: { textAlign },
|
|
4588
|
-
onClick: onCellClick,
|
|
4589
|
-
children: shouldShowTooltip ? /* @__PURE__ */ jsx(Tooltip2, { content: tooltipText, position: "bottom", asChild: true, children: /* @__PURE__ */ jsx("span", { children: cellContent }) }) : cellContent
|
|
4590
|
-
}
|
|
4591
|
-
);
|
|
4590
|
+
const divClassName = `ellipsis-1-line table-item w-full min-w-0 ${onCellClick ? "hover:text-main cursor-pointer" : "cursor-default"}`;
|
|
4591
|
+
if (!shouldShowTooltip) {
|
|
4592
|
+
return /* @__PURE__ */ jsx("div", { ref: refCallback, className: divClassName, style: { textAlign }, onClick: onCellClick, children: cellContent });
|
|
4593
|
+
}
|
|
4594
|
+
return /* @__PURE__ */ jsx(TableCellTooltip, { content: tooltipText, children: /* @__PURE__ */ jsx("div", { ref: refCallback, className: divClassName, style: { textAlign }, onClick: onCellClick, children: cellContent }) });
|
|
4592
4595
|
}
|
|
4593
4596
|
|
|
4594
4597
|
// src/components/Table/config/utils.ts
|
|
@@ -5018,6 +5021,11 @@ function Table(props) {
|
|
|
5018
5021
|
}
|
|
5019
5022
|
}
|
|
5020
5023
|
}, [orderedColumns]);
|
|
5024
|
+
const tableMinWidth = useMemo(() => {
|
|
5025
|
+
const allUserColsHaveWidth = orderedColumns.every((col) => col.key === "__checkbox__" || col.width !== void 0);
|
|
5026
|
+
if (!allUserColsHaveWidth) return void 0;
|
|
5027
|
+
return orderedColumns.reduce((sum, col) => sum + parseColPx(col), 0);
|
|
5028
|
+
}, [orderedColumns]);
|
|
5021
5029
|
const estimatedLeadingPinnedWidth = useMemo(
|
|
5022
5030
|
() => leadingPinnedCols.reduce((sum, col) => sum + parseColPx(col), 0),
|
|
5023
5031
|
[leadingPinnedCols]
|
|
@@ -5187,51 +5195,63 @@ function Table(props) {
|
|
|
5187
5195
|
ref: scrollRef,
|
|
5188
5196
|
className: "relative w-full overflow-y-auto overflow-x-auto custom-view-scrollbar bg-white",
|
|
5189
5197
|
style: { height: `${tableHeight}px` },
|
|
5190
|
-
children: /* @__PURE__ */ jsxs(
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
{
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
{
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5198
|
+
children: /* @__PURE__ */ jsxs(
|
|
5199
|
+
"table",
|
|
5200
|
+
{
|
|
5201
|
+
className: `table-fixed border-spacing-0${tableMinWidth === void 0 ? " w-full" : ""}`,
|
|
5202
|
+
style: tableMinWidth !== void 0 ? { width: tableMinWidth, minWidth: tableMinWidth } : {
|
|
5203
|
+
minWidth: orderedColumns.reduce(
|
|
5204
|
+
(sum, col) => sum + (col.key === "__checkbox__" || col.width !== void 0 ? parseColPx(col) : 80),
|
|
5205
|
+
0
|
|
5206
|
+
)
|
|
5207
|
+
},
|
|
5208
|
+
children: [
|
|
5209
|
+
/* @__PURE__ */ jsx(
|
|
5210
|
+
TableHeader,
|
|
5211
|
+
{
|
|
5212
|
+
columns: orderedColumns,
|
|
5213
|
+
getAlignStyle,
|
|
5214
|
+
sortOption,
|
|
5215
|
+
onSortChange,
|
|
5216
|
+
onColumnDragStartCapture: handleColumnDragStartCapture,
|
|
5217
|
+
onColumnDragStart: handleColumnDragStart,
|
|
5218
|
+
onColumnDrop: handleColumnDrop,
|
|
5219
|
+
onColumnDragEnd: handleColumnDragEnd,
|
|
5220
|
+
onColumnDragOver: handleColumnDragOver,
|
|
5221
|
+
isColumnDraggable
|
|
5222
|
+
}
|
|
5223
|
+
),
|
|
5224
|
+
/* @__PURE__ */ jsx("tbody", { className: "w-full h-full", children: showSkeleton ? Array.from({ length: 3 }).map((_, rowIdx) => /* @__PURE__ */ jsxs("tr", { className: "hover:bg-gray-50", children: [
|
|
5225
|
+
leadingPinnedCols.map((col, idx) => /* @__PURE__ */ jsx(SkeletonTd, { col, showSquare: idx === 0 && !!checkboxInfo }, `leading-${idx}`)),
|
|
5226
|
+
leftColspan > 0 && /* @__PURE__ */ jsx("td", { colSpan: leftColspan, style: { padding: 0, border: "none" } }),
|
|
5227
|
+
virtualItems.map((vc) => /* @__PURE__ */ jsx(SkeletonTd, { col: groupCols[vc.index] }, `group-${vc.index}`)),
|
|
5228
|
+
rightColspan > 0 && /* @__PURE__ */ jsx("td", { colSpan: rightColspan, style: { padding: 0, border: "none" } }),
|
|
5229
|
+
trailingPinnedCols.map((col, idx) => /* @__PURE__ */ jsx(SkeletonTd, { col }, `trailing-${idx}`))
|
|
5230
|
+
] }, rowIdx)) : showEmpty ? /* @__PURE__ */ jsx(TableEmpty, { columnCount: allColumns.length }) : rows.map((row) => {
|
|
5231
|
+
const rowId = String(getRowKey(row.original, row.index));
|
|
5232
|
+
return /* @__PURE__ */ jsx(
|
|
5233
|
+
TableDataRow,
|
|
5234
|
+
{
|
|
5235
|
+
record: row.original,
|
|
5236
|
+
rowIdx: row.index,
|
|
5237
|
+
rowId,
|
|
5238
|
+
draggable: rowDraggable && !showSkeleton,
|
|
5239
|
+
onDragStart: handleRowDragStart,
|
|
5240
|
+
onDragOver: handleRowDragOver,
|
|
5241
|
+
onDrop: handleRowDrop,
|
|
5242
|
+
onDragEnd: handleRowDragEnd,
|
|
5243
|
+
leftColspan,
|
|
5244
|
+
rightColspan,
|
|
5245
|
+
renderLeadingPinnedCols,
|
|
5246
|
+
renderVisibleGroupCols,
|
|
5247
|
+
renderTrailingPinnedCols
|
|
5248
|
+
},
|
|
5249
|
+
row.id
|
|
5250
|
+
);
|
|
5251
|
+
}) })
|
|
5252
|
+
]
|
|
5253
|
+
}
|
|
5254
|
+
)
|
|
5235
5255
|
}
|
|
5236
5256
|
),
|
|
5237
5257
|
!showSkeleton && (paginationInfo || renderFooter?.renderLeft || renderFooter?.renderRight) && /* @__PURE__ */ jsx("div", { ref: footerRef, children: /* @__PURE__ */ jsx(
|
|
@@ -6095,7 +6115,7 @@ function FilePreviewViewerSession(props) {
|
|
|
6095
6115
|
useEffect(() => {
|
|
6096
6116
|
if (!showNavigation) return;
|
|
6097
6117
|
const [prevIndex, nextIndex] = getAdjacentIndexes(currentIndex, fileArray.length);
|
|
6098
|
-
const urlsToPreload = [prevIndex, nextIndex].filter((idx) => idx !== currentIndex).map((idx) => fileArray[idx]);
|
|
6118
|
+
const urlsToPreload = [prevIndex, nextIndex].filter((idx) => idx !== currentIndex).map((idx) => fileArray[idx]).filter((url) => url !== void 0);
|
|
6099
6119
|
preloadPreviewImages(urlsToPreload);
|
|
6100
6120
|
}, [showNavigation, currentIndex, fileArray]);
|
|
6101
6121
|
useEffect(() => {
|
|
@@ -7731,7 +7751,7 @@ var SubmitForm = Object.assign(SubmitFormRoot, {
|
|
|
7731
7751
|
function LabeledFilterOption(props) {
|
|
7732
7752
|
const { label, children, gap } = props;
|
|
7733
7753
|
return /* @__PURE__ */ jsxs("div", { style: { marginLeft: gap }, className: "flex flex-row items-center gap-4", children: [
|
|
7734
|
-
label && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-gray-60 shrink-0", children: label }),
|
|
7754
|
+
label && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-gray-60 shrink-0 select-none", children: label }),
|
|
7735
7755
|
children
|
|
7736
7756
|
] });
|
|
7737
7757
|
}
|
|
@@ -7750,15 +7770,26 @@ function PageFilter(props) {
|
|
|
7750
7770
|
primaryColor
|
|
7751
7771
|
} = props;
|
|
7752
7772
|
const initialValuesRef = useRef(values);
|
|
7773
|
+
const pendingAutoSubmitRef = useRef(null);
|
|
7774
|
+
const onSubmitRef = useRef(onSubmit);
|
|
7775
|
+
onSubmitRef.current = onSubmit;
|
|
7776
|
+
useEffect(() => {
|
|
7777
|
+
const pending = pendingAutoSubmitRef.current;
|
|
7778
|
+
if (pending && String(values[pending.key] ?? "") === pending.value) {
|
|
7779
|
+
pendingAutoSubmitRef.current = null;
|
|
7780
|
+
onSubmitRef.current();
|
|
7781
|
+
}
|
|
7782
|
+
}, [values]);
|
|
7753
7783
|
const handleInputChange = (key) => (e) => {
|
|
7754
7784
|
onChange({ [key]: e.target.value });
|
|
7755
7785
|
};
|
|
7756
7786
|
const handleSelectChange = (key, autoSubmit) => (value) => {
|
|
7757
7787
|
onChange({ [key]: value });
|
|
7758
|
-
if (autoSubmit)
|
|
7788
|
+
if (autoSubmit) pendingAutoSubmitRef.current = { key, value };
|
|
7759
7789
|
};
|
|
7760
|
-
const handleRadioChange = (key) => (value) => {
|
|
7790
|
+
const handleRadioChange = (key, autoSubmit) => (value) => {
|
|
7761
7791
|
onChange({ [key]: value });
|
|
7792
|
+
if (autoSubmit) pendingAutoSubmitRef.current = { key, value };
|
|
7762
7793
|
};
|
|
7763
7794
|
const handleDateChange = (key) => (date) => {
|
|
7764
7795
|
onChange({ [key]: date });
|
|
@@ -7766,13 +7797,17 @@ function PageFilter(props) {
|
|
|
7766
7797
|
const handleRangeChangeCurried = (startKey, endKey) => (start, end) => {
|
|
7767
7798
|
onChange({ [startKey]: start, [endKey]: end });
|
|
7768
7799
|
};
|
|
7769
|
-
const handleCheckboxChange = (key) => (checked) => {
|
|
7770
|
-
|
|
7800
|
+
const handleCheckboxChange = (key, autoSubmit) => (checked) => {
|
|
7801
|
+
const value = checked ? "true" : "false";
|
|
7802
|
+
onChange({ [key]: value });
|
|
7803
|
+
if (autoSubmit) pendingAutoSubmitRef.current = { key, value };
|
|
7771
7804
|
};
|
|
7772
7805
|
const handleSubmit = () => {
|
|
7806
|
+
pendingAutoSubmitRef.current = null;
|
|
7773
7807
|
onSubmit();
|
|
7774
7808
|
};
|
|
7775
7809
|
const handleReset = () => {
|
|
7810
|
+
pendingAutoSubmitRef.current = null;
|
|
7776
7811
|
onChange(initialValuesRef.current);
|
|
7777
7812
|
onReset?.();
|
|
7778
7813
|
};
|
|
@@ -7811,7 +7846,7 @@ function PageFilter(props) {
|
|
|
7811
7846
|
{
|
|
7812
7847
|
name: String(optionKey),
|
|
7813
7848
|
value: currentValue,
|
|
7814
|
-
onChange: handleRadioChange(optionKey),
|
|
7849
|
+
onChange: handleRadioChange(optionKey, option.autoSubmit),
|
|
7815
7850
|
options: option.options,
|
|
7816
7851
|
direction: "horizontal"
|
|
7817
7852
|
}
|
|
@@ -7843,7 +7878,7 @@ function PageFilter(props) {
|
|
|
7843
7878
|
checked: currentValue === "true",
|
|
7844
7879
|
name: String(optionKey),
|
|
7845
7880
|
value: currentValue,
|
|
7846
|
-
onChange: handleCheckboxChange(optionKey)
|
|
7881
|
+
onChange: handleCheckboxChange(optionKey, option.autoSubmit)
|
|
7847
7882
|
}
|
|
7848
7883
|
) }, String(optionKey));
|
|
7849
7884
|
default: {
|