@uxf/cms 11.92.3 → 11.93.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/cms",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.93.1",
|
|
4
4
|
"description": "UXF Cms",
|
|
5
5
|
"author": "UXFans <dev@uxf.cz>",
|
|
6
6
|
"homepage": "https://gitlab.com/uxf-npm/cms#readme",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"@dnd-kit/sortable": "10.0.0",
|
|
30
30
|
"@dnd-kit/utilities": "3.2.2",
|
|
31
31
|
"@floating-ui/react": "0.27.16",
|
|
32
|
-
"@uxf/core": "11.
|
|
33
|
-
"@uxf/core-react": "11.
|
|
34
|
-
"@uxf/data-grid": "11.
|
|
35
|
-
"@uxf/form": "11.
|
|
32
|
+
"@uxf/core": "11.93.0",
|
|
33
|
+
"@uxf/core-react": "11.93.0",
|
|
34
|
+
"@uxf/data-grid": "11.93.1",
|
|
35
|
+
"@uxf/form": "11.93.1",
|
|
36
36
|
"@uxf/router": "11.92.0",
|
|
37
|
-
"@uxf/ui": "11.
|
|
38
|
-
"@uxf/wysiwyg": "11.
|
|
37
|
+
"@uxf/ui": "11.93.1",
|
|
38
|
+
"@uxf/wysiwyg": "11.93.1",
|
|
39
39
|
"axios": "1.13.2",
|
|
40
40
|
"axios-hooks": "5.1.1",
|
|
41
41
|
"es6-error": "4.1.1",
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ContentField = void 0;
|
|
7
7
|
const core_1 = require("@dnd-kit/core");
|
|
8
8
|
const sortable_1 = require("@dnd-kit/sortable");
|
|
9
|
+
const use_sortable_items_1 = require("@uxf/core-react/dnd/hooks/use-sortable-items");
|
|
9
10
|
const button_1 = require("@uxf/ui/button");
|
|
10
11
|
const dialog_panel_1 = require("@uxf/ui/dialog/dialog-panel");
|
|
11
12
|
const icon_1 = require("@uxf/ui/icon");
|
|
@@ -14,7 +15,6 @@ const react_1 = __importDefault(require("react"));
|
|
|
14
15
|
const react_hook_form_1 = require("react-hook-form");
|
|
15
16
|
const form_content_1 = require("./components/form-content");
|
|
16
17
|
const details_visibility_context_1 = require("./context/details-visibility-context");
|
|
17
|
-
const use_sortable_1 = require("./hooks/use-sortable");
|
|
18
18
|
const ContentField = (props) => {
|
|
19
19
|
const { fields, remove, insert, move } = (0, react_hook_form_1.useFieldArray)({
|
|
20
20
|
name: `${props.name}.data`,
|
|
@@ -24,8 +24,8 @@ const ContentField = (props) => {
|
|
|
24
24
|
insert(index + 1, { type: component.getConfig().type, content: null });
|
|
25
25
|
(0, modal_service_1.closeModal)();
|
|
26
26
|
};
|
|
27
|
-
const { memoizedSensors, activeItem, itemsIds, dropAnimationConfig, onDragStart, onDragEnd, onDragCancel } = (0,
|
|
28
|
-
fields,
|
|
27
|
+
const { memoizedSensors, activeItem, itemsIds, dropAnimationConfig, onDragStart, onDragEnd, onDragCancel } = (0, use_sortable_items_1.useSortableItems)({
|
|
28
|
+
items: fields,
|
|
29
29
|
handleDragEnd: move,
|
|
30
30
|
});
|
|
31
31
|
const activeItemIndex = fields.findIndex((f) => f.id === (activeItem === null || activeItem === void 0 ? void 0 : activeItem.id));
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DragEndEvent, DragStartEvent } from "@dnd-kit/core";
|
|
2
|
-
type Props = {
|
|
3
|
-
fields: any[];
|
|
4
|
-
handleDragEnd: (activeIndex: number, overIndex: number) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare const useSortable: ({ fields, handleDragEnd }: Props) => {
|
|
7
|
-
memoizedSensors: import("@dnd-kit/core").SensorDescriptor<import("@dnd-kit/core").SensorOptions>[];
|
|
8
|
-
dropAnimationConfig: import("@dnd-kit/core/dist/components/DragOverlay/hooks/useDropAnimation").DropAnimationOptions;
|
|
9
|
-
itemsIds: any[];
|
|
10
|
-
activeItem: any;
|
|
11
|
-
onDragStart: ({ active }: DragStartEvent) => void;
|
|
12
|
-
onDragEnd: ({ active, over }: DragEndEvent) => void;
|
|
13
|
-
onDragCancel: () => void;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSortable = void 0;
|
|
4
|
-
const core_1 = require("@dnd-kit/core");
|
|
5
|
-
const sortable_1 = require("@dnd-kit/sortable");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const useSortable = ({ fields, handleDragEnd }) => {
|
|
8
|
-
const [sortableItems, setSortableItems] = (0, react_1.useState)(fields);
|
|
9
|
-
const [activeElement, setActiveElement] = (0, react_1.useState)(null);
|
|
10
|
-
const activeItem = (0, react_1.useMemo)(() => sortableItems.find((item) => item.id === (activeElement === null || activeElement === void 0 ? void 0 : activeElement.id)), [activeElement, sortableItems]);
|
|
11
|
-
const sensors = (0, core_1.useSensors)((0, core_1.useSensor)(core_1.PointerSensor), (0, core_1.useSensor)(core_1.KeyboardSensor, {
|
|
12
|
-
coordinateGetter: sortable_1.sortableKeyboardCoordinates,
|
|
13
|
-
}));
|
|
14
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15
|
-
const memoizedSensors = (0, react_1.useMemo)(() => sensors, []);
|
|
16
|
-
const idsStringified = JSON.stringify(sortableItems.map((i) => i.id));
|
|
17
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
|
-
const itemsIds = (0, react_1.useMemo)(() => sortableItems.map((i) => i.id), [idsStringified]);
|
|
19
|
-
(0, react_1.useEffect)(() => {
|
|
20
|
-
setSortableItems(fields);
|
|
21
|
-
}, [fields]);
|
|
22
|
-
const dropAnimationConfig = {
|
|
23
|
-
sideEffects: (0, core_1.defaultDropAnimationSideEffects)({
|
|
24
|
-
styles: {
|
|
25
|
-
active: {
|
|
26
|
-
opacity: "0.4",
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
31
|
-
const onDragStart = (0, react_1.useCallback)(({ active }) => {
|
|
32
|
-
setActiveElement(active);
|
|
33
|
-
}, [setActiveElement]);
|
|
34
|
-
const onDragEnd = (0, react_1.useCallback)(({ active, over }) => {
|
|
35
|
-
if (over && active.id !== over.id) {
|
|
36
|
-
const activeIndex = sortableItems.findIndex(({ id }) => id === active.id);
|
|
37
|
-
const overIndex = sortableItems.findIndex(({ id }) => id === over.id);
|
|
38
|
-
const resorted = (0, sortable_1.arrayMove)(sortableItems, activeIndex, overIndex);
|
|
39
|
-
handleDragEnd(activeIndex, overIndex);
|
|
40
|
-
setSortableItems(resorted);
|
|
41
|
-
}
|
|
42
|
-
setActiveElement(null);
|
|
43
|
-
}, [setActiveElement, setSortableItems, handleDragEnd, sortableItems]);
|
|
44
|
-
const onDragCancel = (0, react_1.useCallback)(() => {
|
|
45
|
-
setActiveElement(null);
|
|
46
|
-
}, [setActiveElement]);
|
|
47
|
-
return {
|
|
48
|
-
memoizedSensors,
|
|
49
|
-
dropAnimationConfig,
|
|
50
|
-
itemsIds,
|
|
51
|
-
activeItem,
|
|
52
|
-
onDragStart,
|
|
53
|
-
onDragEnd,
|
|
54
|
-
onDragCancel,
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
exports.useSortable = useSortable;
|