@uxf/core-react 11.106.0 → 11.108.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.
|
@@ -38,7 +38,6 @@ exports.ViewportHeightPolyfill = ViewportHeightPolyfill;
|
|
|
38
38
|
const use_is_mounted_1 = require("@uxf/core-react/hooks/use-is-mounted");
|
|
39
39
|
const use_on_mount_1 = require("@uxf/core-react/hooks/use-on-mount");
|
|
40
40
|
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
41
|
-
const with_unit_1 = require("@uxf/styles/units/with-unit");
|
|
42
41
|
const react_1 = __importStar(require("react"));
|
|
43
42
|
function ViewportHeightPolyfill() {
|
|
44
43
|
const isMounted = (0, use_is_mounted_1.useIsMounted)();
|
|
@@ -53,7 +52,7 @@ function ViewportHeightPolyfill() {
|
|
|
53
52
|
return () => window.removeEventListener("resize", updateViewportHeight);
|
|
54
53
|
});
|
|
55
54
|
if (isMounted && (0, is_not_nil_1.isNotNil)(viewportHeight)) {
|
|
56
|
-
return react_1.default.createElement("style", null, `:root { --viewport-height: ${
|
|
55
|
+
return react_1.default.createElement("style", null, `:root { --viewport-height: ${viewportHeight}px; }`);
|
|
57
56
|
}
|
|
58
57
|
return null;
|
|
59
58
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DragEndEvent } from "@dnd-kit/core";
|
|
2
|
+
export declare const EMPTY_VISIBLE_COLUMNS_PLACEHOLDER_ID = "__empty-visible-placeholder__";
|
|
3
|
+
export declare const EMPTY_HIDDEN_COLUMNS_PLACEHOLDER_ID = "__empty-hidden-placeholder__";
|
|
2
4
|
export declare function useSortableMulti<T extends {
|
|
3
5
|
id: string;
|
|
4
6
|
}, SectionMap extends Record<string, T[]>>(sections: SectionMap, setSections: (next: SectionMap) => void, onMove?: (source: keyof SectionMap, destination: keyof SectionMap, fromIndex: number, toIndex: number, nextState: SectionMap) => void): {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EMPTY_HIDDEN_COLUMNS_PLACEHOLDER_ID = exports.EMPTY_VISIBLE_COLUMNS_PLACEHOLDER_ID = void 0;
|
|
3
4
|
exports.useSortableMulti = useSortableMulti;
|
|
4
5
|
const sortable_1 = require("@dnd-kit/sortable");
|
|
5
|
-
const types_1 = require("@uxf/data-grid/hidden-columns/types");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const use_sortable_core_1 = require("./use-sortable-core");
|
|
8
|
+
exports.EMPTY_VISIBLE_COLUMNS_PLACEHOLDER_ID = "__empty-visible-placeholder__";
|
|
9
|
+
exports.EMPTY_HIDDEN_COLUMNS_PLACEHOLDER_ID = "__empty-hidden-placeholder__";
|
|
8
10
|
function useSortableMulti(sections, setSections, onMove) {
|
|
9
11
|
const { activeElement, setActiveElement, onDragStart, onDragCancel, sensors, dropAnimationConfig } = (0, use_sortable_core_1.useSortableCore)();
|
|
10
12
|
const activeItem = (0, react_1.useMemo)(() => {
|
|
@@ -24,7 +26,7 @@ function useSortableMulti(sections, setSections, onMove) {
|
|
|
24
26
|
setActiveElement(null);
|
|
25
27
|
return;
|
|
26
28
|
}
|
|
27
|
-
const isDroppingToEmptyPlaceholder = over.id ===
|
|
29
|
+
const isDroppingToEmptyPlaceholder = over.id === exports.EMPTY_HIDDEN_COLUMNS_PLACEHOLDER_ID || over.id === exports.EMPTY_VISIBLE_COLUMNS_PLACEHOLDER_ID;
|
|
28
30
|
let sourceKey = null;
|
|
29
31
|
let destKey = null;
|
|
30
32
|
// Determine source key by checking where the active item currently is
|
|
@@ -35,7 +37,7 @@ function useSortableMulti(sections, setSections, onMove) {
|
|
|
35
37
|
}
|
|
36
38
|
// Determine destination key based on over.id
|
|
37
39
|
if (isDroppingToEmptyPlaceholder) {
|
|
38
|
-
destKey = over.id ===
|
|
40
|
+
destKey = over.id === exports.EMPTY_VISIBLE_COLUMNS_PLACEHOLDER_ID ? "visible" : "hidden";
|
|
39
41
|
}
|
|
40
42
|
else {
|
|
41
43
|
for (const key in sections) {
|
|
@@ -74,7 +76,7 @@ function useSortableMulti(sections, setSections, onMove) {
|
|
|
74
76
|
const ids = sections[section].map((i) => i.id);
|
|
75
77
|
if (ids.length === 0) {
|
|
76
78
|
return [
|
|
77
|
-
section === "visible" ?
|
|
79
|
+
section === "visible" ? exports.EMPTY_VISIBLE_COLUMNS_PLACEHOLDER_ID : exports.EMPTY_HIDDEN_COLUMNS_PLACEHOLDER_ID,
|
|
78
80
|
];
|
|
79
81
|
}
|
|
80
82
|
return ids;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/core-react",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.108.0",
|
|
4
4
|
"description": "UXF Core",
|
|
5
5
|
"author": "UX Fans s.r.o",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,16 +11,20 @@
|
|
|
11
11
|
"build": "tsc -P tsconfig.json",
|
|
12
12
|
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
13
13
|
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@uxf/core": "11.106.0",
|
|
16
|
-
"@dnd-kit/core": "6.3.1",
|
|
17
|
-
"@dnd-kit/sortable": "10.0.0"
|
|
18
|
-
},
|
|
19
14
|
"peerDependencies": {
|
|
20
|
-
"
|
|
15
|
+
"@dnd-kit/core": "^6.3.1",
|
|
16
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
17
|
+
"@uxf/core": "11.108.0",
|
|
18
|
+
"react": ">=18.2.0",
|
|
19
|
+
"react-dom": ">=18.2.0"
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
22
|
+
"@dnd-kit/core": "^6.3.1",
|
|
23
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
23
24
|
"@types/react": "18.3.27",
|
|
24
|
-
"react": "18.3.
|
|
25
|
+
"@types/react-dom": "18.3.7",
|
|
26
|
+
"@uxf/core": "11.108.0",
|
|
27
|
+
"react": "18.3.1",
|
|
28
|
+
"react-dom": "18.3.1"
|
|
25
29
|
}
|
|
26
30
|
}
|