@octaviaflow/core 3.0.18-beta.4 → 3.0.18-beta.6
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/components/DataTable/DataTable.d.ts +19 -1
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/index.cjs +44 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -76
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4744,7 +4744,7 @@ var Select = forwardRef14(function Select2({
|
|
|
4744
4744
|
const dropdownRef = useRef8(null);
|
|
4745
4745
|
const searchRef = useRef8(null);
|
|
4746
4746
|
const [searchQuery, setSearchQuery] = useState7("");
|
|
4747
|
-
const [dropdownPos, setDropdownPos] = useState7({
|
|
4747
|
+
const [dropdownPos, setDropdownPos] = useState7({ left: 0, width: 0, maxHeight: 240, direction: "down" });
|
|
4748
4748
|
const setTriggerRef = (node) => {
|
|
4749
4749
|
triggerRef.current = node;
|
|
4750
4750
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
@@ -4805,10 +4805,19 @@ var Select = forwardRef14(function Select2({
|
|
|
4805
4805
|
const updatePosition = useCallback7(() => {
|
|
4806
4806
|
if (!triggerRef.current) return;
|
|
4807
4807
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
4808
|
+
const viewportH = window.innerHeight;
|
|
4809
|
+
const margin = 8;
|
|
4810
|
+
const gap = 4;
|
|
4811
|
+
const spaceBelow = viewportH - rect.bottom - gap - margin;
|
|
4812
|
+
const spaceAbove = rect.top - gap - margin;
|
|
4813
|
+
const PREFERRED_MIN = 200;
|
|
4814
|
+
const openUp = spaceBelow < PREFERRED_MIN && spaceAbove > spaceBelow;
|
|
4808
4815
|
setDropdownPos({
|
|
4809
|
-
top: rect.bottom +
|
|
4816
|
+
...openUp ? { bottom: viewportH - rect.top + gap } : { top: rect.bottom + gap },
|
|
4810
4817
|
left: rect.left,
|
|
4811
|
-
width: rect.width
|
|
4818
|
+
width: rect.width,
|
|
4819
|
+
maxHeight: Math.max(120, openUp ? spaceAbove : spaceBelow),
|
|
4820
|
+
direction: openUp ? "up" : "down"
|
|
4812
4821
|
});
|
|
4813
4822
|
}, []);
|
|
4814
4823
|
useEffect3(() => {
|
|
@@ -4900,7 +4909,8 @@ var Select = forwardRef14(function Select2({
|
|
|
4900
4909
|
className: "ods-select__dropdown",
|
|
4901
4910
|
style: {
|
|
4902
4911
|
position: "fixed",
|
|
4903
|
-
top: dropdownPos.top,
|
|
4912
|
+
...dropdownPos.top !== void 0 && { top: dropdownPos.top },
|
|
4913
|
+
...dropdownPos.bottom !== void 0 && { bottom: dropdownPos.bottom },
|
|
4904
4914
|
left: dropdownPos.left,
|
|
4905
4915
|
// `minWidth` (not `width`) keeps the popover at
|
|
4906
4916
|
// least as wide as the trigger — preserves visual
|
|
@@ -4910,7 +4920,12 @@ var Select = forwardRef14(function Select2({
|
|
|
4910
4920
|
// Avoids the previous `max-content` recipe which
|
|
4911
4921
|
// made the popover grow uncomfortably wide on
|
|
4912
4922
|
// searchable / long-option menus.
|
|
4913
|
-
minWidth: Math.max(dropdownPos.width, dropdownMinWidth ?? 0)
|
|
4923
|
+
minWidth: Math.max(dropdownPos.width, dropdownMinWidth ?? 0),
|
|
4924
|
+
// Bound the popover to the available viewport edge so
|
|
4925
|
+
// it never spills off-screen on tall pages. Pairs with
|
|
4926
|
+
// `overflow-y: auto` from the .ods-select__dropdown
|
|
4927
|
+
// SCSS so long option lists scroll internally.
|
|
4928
|
+
maxHeight: dropdownPos.maxHeight
|
|
4914
4929
|
},
|
|
4915
4930
|
initial: { opacity: 0, scale: 0.95 },
|
|
4916
4931
|
animate: { opacity: 1, scale: 1 },
|
|
@@ -10340,7 +10355,6 @@ import {
|
|
|
10340
10355
|
ColumnIcon,
|
|
10341
10356
|
DownloadIcon,
|
|
10342
10357
|
FilterIcon as DsFilterIcon,
|
|
10343
|
-
MenuIcon,
|
|
10344
10358
|
OverflowMenuHorizontalIcon,
|
|
10345
10359
|
RenewIcon,
|
|
10346
10360
|
SearchIcon as DsSearchIcon
|
|
@@ -10479,44 +10493,6 @@ function FilterPopover({
|
|
|
10479
10493
|
] }) })
|
|
10480
10494
|
] });
|
|
10481
10495
|
}
|
|
10482
|
-
function DensityPopover({
|
|
10483
|
-
density,
|
|
10484
|
-
setDensity,
|
|
10485
|
-
open,
|
|
10486
|
-
setOpen
|
|
10487
|
-
}) {
|
|
10488
|
-
const triggerRef = useRef20(null);
|
|
10489
|
-
return /* @__PURE__ */ jsxs34("div", { className: "ods-datatable__filter", children: [
|
|
10490
|
-
/* @__PURE__ */ jsx35(
|
|
10491
|
-
"button",
|
|
10492
|
-
{
|
|
10493
|
-
ref: triggerRef,
|
|
10494
|
-
type: "button",
|
|
10495
|
-
className: "ods-datatable__icon-btn",
|
|
10496
|
-
onClick: () => setOpen(!open),
|
|
10497
|
-
"aria-label": "Row density",
|
|
10498
|
-
"aria-haspopup": "listbox",
|
|
10499
|
-
"aria-expanded": open,
|
|
10500
|
-
children: DensityIcon
|
|
10501
|
-
}
|
|
10502
|
-
),
|
|
10503
|
-
/* @__PURE__ */ jsx35(PortalMenu, { open, onClose: () => setOpen(false), triggerRef, align: "end", children: /* @__PURE__ */ jsx35("ul", { role: "listbox", style: { listStyle: "none", margin: 0, padding: 0 }, children: ["compact", "default", "comfortable"].map((d) => /* @__PURE__ */ jsx35("li", { children: /* @__PURE__ */ jsx35(
|
|
10504
|
-
"button",
|
|
10505
|
-
{
|
|
10506
|
-
type: "button",
|
|
10507
|
-
className: cn(
|
|
10508
|
-
"ods-datatable__menu-item",
|
|
10509
|
-
density === d && "ods-datatable__menu-item--active"
|
|
10510
|
-
),
|
|
10511
|
-
onClick: () => {
|
|
10512
|
-
setDensity(d);
|
|
10513
|
-
setOpen(false);
|
|
10514
|
-
},
|
|
10515
|
-
children: d.charAt(0).toUpperCase() + d.slice(1)
|
|
10516
|
-
}
|
|
10517
|
-
) }, d)) }) })
|
|
10518
|
-
] });
|
|
10519
|
-
}
|
|
10520
10496
|
function ColumnsPopover({
|
|
10521
10497
|
columns,
|
|
10522
10498
|
hidden,
|
|
@@ -10577,7 +10553,6 @@ var SortDesc = /* @__PURE__ */ jsx35(CaretDownIcon, { width: 10, height: 10, "ar
|
|
|
10577
10553
|
var SortIdle = /* @__PURE__ */ jsx35(CaretSortIcon, { width: 10, height: 10, "aria-hidden": "true", style: { opacity: 0.5 } });
|
|
10578
10554
|
var FilterIcon = /* @__PURE__ */ jsx35(DsFilterIcon, { width: 12, height: 12, "aria-hidden": "true" });
|
|
10579
10555
|
var ColumnsIcon = /* @__PURE__ */ jsx35(ColumnIcon, { width: 12, height: 12, "aria-hidden": "true" });
|
|
10580
|
-
var DensityIcon = /* @__PURE__ */ jsx35(MenuIcon, { width: 12, height: 12, "aria-hidden": "true" });
|
|
10581
10556
|
var MoreHIcon = () => /* @__PURE__ */ jsx35(OverflowMenuHorizontalIcon, { width: 12, height: 12, "aria-hidden": "true" });
|
|
10582
10557
|
var XIcon2 = () => /* @__PURE__ */ jsx35(CloseIcon6, { width: 12, height: 12, "aria-hidden": "true" });
|
|
10583
10558
|
var RefreshIcon = (props) => /* @__PURE__ */ jsx35(RenewIcon, { width: 12, height: 12, ...props });
|
|
@@ -10667,8 +10642,7 @@ function DataTable(props) {
|
|
|
10667
10642
|
expandable = false,
|
|
10668
10643
|
renderExpanded,
|
|
10669
10644
|
pagination,
|
|
10670
|
-
density: densityProp = "
|
|
10671
|
-
showDensityToggle = true,
|
|
10645
|
+
density: densityProp = "comfortable",
|
|
10672
10646
|
showColumnSettings = true,
|
|
10673
10647
|
loading = false,
|
|
10674
10648
|
error,
|
|
@@ -10732,9 +10706,7 @@ function DataTable(props) {
|
|
|
10732
10706
|
);
|
|
10733
10707
|
}, [filters, filterValues]);
|
|
10734
10708
|
const [columnWidths, setColumnWidths] = useState18({});
|
|
10735
|
-
const
|
|
10736
|
-
const [densityOpen, setDensityOpen] = useState18(false);
|
|
10737
|
-
useEffect15(() => setDensity(densityProp), [densityProp]);
|
|
10709
|
+
const density = densityProp;
|
|
10738
10710
|
const [hiddenCols, setHiddenCols] = useState18(
|
|
10739
10711
|
() => new Set(columns.filter((c) => c.visible === false).map((c) => c.key))
|
|
10740
10712
|
);
|
|
@@ -10745,11 +10717,21 @@ function DataTable(props) {
|
|
|
10745
10717
|
const [internalPage, setInternalPage] = useState18(1);
|
|
10746
10718
|
const [internalPageSize, setInternalPageSize] = useState18(pgCfg?.pageSize ?? 10);
|
|
10747
10719
|
const page = pgCfg?.page ?? internalPage;
|
|
10748
|
-
|
|
10720
|
+
useEffect15(() => {
|
|
10721
|
+
if (pgCfg?.pageSize !== void 0 && pgCfg.pageSize !== internalPageSize) {
|
|
10722
|
+
setInternalPageSize(pgCfg.pageSize);
|
|
10723
|
+
}
|
|
10724
|
+
}, [pgCfg?.pageSize]);
|
|
10725
|
+
const pageSize = internalPageSize;
|
|
10749
10726
|
const setPage = (p) => {
|
|
10750
10727
|
pgCfg?.onPageChange?.(p);
|
|
10751
10728
|
if (pgCfg?.page === void 0) setInternalPage(p);
|
|
10752
10729
|
};
|
|
10730
|
+
const setPageSize = (n) => {
|
|
10731
|
+
setInternalPageSize(n);
|
|
10732
|
+
pgCfg?.onPageSizeChange?.(n);
|
|
10733
|
+
setPage(1);
|
|
10734
|
+
};
|
|
10753
10735
|
const idOf = useCallback16(
|
|
10754
10736
|
(row, idx) => getRowId ? getRowId(row, idx) : String(idx),
|
|
10755
10737
|
[getRowId]
|
|
@@ -10911,27 +10893,16 @@ function DataTable(props) {
|
|
|
10911
10893
|
f.key
|
|
10912
10894
|
))
|
|
10913
10895
|
] }),
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
showColumnSettings && /* @__PURE__ */ jsx35(
|
|
10925
|
-
ColumnsPopover,
|
|
10926
|
-
{
|
|
10927
|
-
columns,
|
|
10928
|
-
hidden: hiddenCols,
|
|
10929
|
-
setHidden: setHiddenCols,
|
|
10930
|
-
open: colSettingsOpen,
|
|
10931
|
-
setOpen: setColSettingsOpen
|
|
10932
|
-
}
|
|
10933
|
-
)
|
|
10934
|
-
] }),
|
|
10896
|
+
showColumnSettings && /* @__PURE__ */ jsx35("div", { className: "ods-datatable__toolbar-section ods-datatable__toolbar-section--view", children: /* @__PURE__ */ jsx35(
|
|
10897
|
+
ColumnsPopover,
|
|
10898
|
+
{
|
|
10899
|
+
columns,
|
|
10900
|
+
hidden: hiddenCols,
|
|
10901
|
+
setHidden: setHiddenCols,
|
|
10902
|
+
open: colSettingsOpen,
|
|
10903
|
+
setOpen: setColSettingsOpen
|
|
10904
|
+
}
|
|
10905
|
+
) }),
|
|
10935
10906
|
(showRefresh || showExport) && /* @__PURE__ */ jsxs34("div", { className: "ods-datatable__toolbar-section ods-datatable__toolbar-section--data", children: [
|
|
10936
10907
|
showRefresh && /* @__PURE__ */ jsx35(
|
|
10937
10908
|
"button",
|
|
@@ -11207,10 +11178,7 @@ function DataTable(props) {
|
|
|
11207
11178
|
"aria-label": "Rows per page",
|
|
11208
11179
|
value: String(pageSize),
|
|
11209
11180
|
options: pageSizes.map((n) => ({ value: String(n), label: String(n) })),
|
|
11210
|
-
onChange: (v) =>
|
|
11211
|
-
setInternalPageSize(Number(v));
|
|
11212
|
-
setPage(1);
|
|
11213
|
-
}
|
|
11181
|
+
onChange: (v) => setPageSize(Number(v))
|
|
11214
11182
|
}
|
|
11215
11183
|
)
|
|
11216
11184
|
] }),
|