@jsenv/navi 0.26.30 → 0.26.32
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/jsenv_navi.js +51 -28
- package/dist/jsenv_navi.js.map +7 -9
- package/package.json +2 -2
package/dist/jsenv_navi.js
CHANGED
|
@@ -6193,6 +6193,54 @@ const useCancelPrevious = () => {
|
|
|
6193
6193
|
return canceller;
|
|
6194
6194
|
};
|
|
6195
6195
|
|
|
6196
|
+
const moveArrayItemByIndex = (array, indexA, indexB) => {
|
|
6197
|
+
const newArray = [];
|
|
6198
|
+
const movedItem = array[indexA];
|
|
6199
|
+
const movingRight = indexA < indexB;
|
|
6200
|
+
|
|
6201
|
+
for (let i = 0; i < array.length; i++) {
|
|
6202
|
+
if (movingRight) {
|
|
6203
|
+
// Moving right: add target first, then moved item after
|
|
6204
|
+
if (i !== indexA) {
|
|
6205
|
+
newArray.push(array[i]);
|
|
6206
|
+
}
|
|
6207
|
+
if (i === indexB) {
|
|
6208
|
+
newArray.push(movedItem);
|
|
6209
|
+
}
|
|
6210
|
+
} else {
|
|
6211
|
+
// Moving left: add moved item first, then target after
|
|
6212
|
+
if (i === indexB) {
|
|
6213
|
+
newArray.push(movedItem);
|
|
6214
|
+
}
|
|
6215
|
+
if (i !== indexA) {
|
|
6216
|
+
newArray.push(array[i]);
|
|
6217
|
+
}
|
|
6218
|
+
}
|
|
6219
|
+
}
|
|
6220
|
+
return newArray;
|
|
6221
|
+
};
|
|
6222
|
+
|
|
6223
|
+
const swapArrayItemByIndex = (array, indexA, indexB) => {
|
|
6224
|
+
const newArray = [];
|
|
6225
|
+
const itemAtPositionA = array[indexA];
|
|
6226
|
+
const itemAtPositionB = array[indexB];
|
|
6227
|
+
for (let i = 0; i < array.length; i++) {
|
|
6228
|
+
if (i === indexB) {
|
|
6229
|
+
// At the new position, put the dragged column
|
|
6230
|
+
newArray.push(itemAtPositionA);
|
|
6231
|
+
continue;
|
|
6232
|
+
}
|
|
6233
|
+
if (i === indexA) {
|
|
6234
|
+
// At the old position, put what was at the new position
|
|
6235
|
+
newArray.push(itemAtPositionB);
|
|
6236
|
+
continue;
|
|
6237
|
+
}
|
|
6238
|
+
// Everything else stays the same
|
|
6239
|
+
newArray.push(array[i]);
|
|
6240
|
+
}
|
|
6241
|
+
return newArray;
|
|
6242
|
+
};
|
|
6243
|
+
|
|
6196
6244
|
/**
|
|
6197
6245
|
* Merges a component's base className with className received from props.
|
|
6198
6246
|
*
|
|
@@ -32628,7 +32676,7 @@ const useTableDragContextValue = ({
|
|
|
32628
32676
|
return;
|
|
32629
32677
|
}
|
|
32630
32678
|
const columnIds = columns.map(col => col.id);
|
|
32631
|
-
const columnIdsWithNewOrder =
|
|
32679
|
+
const columnIdsWithNewOrder = moveArrayItemByIndex(columnIds, columnIndex, newColumnIndex);
|
|
32632
32680
|
setColumnOrder(columnIdsWithNewOrder);
|
|
32633
32681
|
};
|
|
32634
32682
|
return useMemo(() => {
|
|
@@ -32643,31 +32691,6 @@ const useTableDragContextValue = ({
|
|
|
32643
32691
|
};
|
|
32644
32692
|
}, [grabTarget, canChangeColumnOrder]);
|
|
32645
32693
|
};
|
|
32646
|
-
const moveItem = (array, indexA, indexB) => {
|
|
32647
|
-
const newArray = [];
|
|
32648
|
-
const movedItem = array[indexA];
|
|
32649
|
-
const movingRight = indexA < indexB;
|
|
32650
|
-
for (let i = 0; i < array.length; i++) {
|
|
32651
|
-
if (movingRight) {
|
|
32652
|
-
// Moving right: add target first, then moved item after
|
|
32653
|
-
if (i !== indexA) {
|
|
32654
|
-
newArray.push(array[i]);
|
|
32655
|
-
}
|
|
32656
|
-
if (i === indexB) {
|
|
32657
|
-
newArray.push(movedItem);
|
|
32658
|
-
}
|
|
32659
|
-
} else {
|
|
32660
|
-
// Moving left: add moved item first, then target after
|
|
32661
|
-
if (i === indexB) {
|
|
32662
|
-
newArray.push(movedItem);
|
|
32663
|
-
}
|
|
32664
|
-
if (i !== indexA) {
|
|
32665
|
-
newArray.push(array[i]);
|
|
32666
|
-
}
|
|
32667
|
-
}
|
|
32668
|
-
}
|
|
32669
|
-
return newArray;
|
|
32670
|
-
};
|
|
32671
32694
|
const TableDragCloneContainer = forwardRef((props, ref) => {
|
|
32672
32695
|
import.meta.css = [css$h, "@jsenv/navi/src/field/table/drag/table_drag.jsx"];
|
|
32673
32696
|
const {
|
|
@@ -32825,7 +32848,7 @@ const initDragTableColumnViaPointer = (pointerdownEvent, {
|
|
|
32825
32848
|
const dropCandidateElements = colElements.filter(col => !(col.getAttribute("data-drag-obstacle") || "").includes("move-column"));
|
|
32826
32849
|
const updateDropTarget = dropTargetInfo => {
|
|
32827
32850
|
const targetColumn = dropTargetInfo.element;
|
|
32828
|
-
const targetColumnIndex =
|
|
32851
|
+
const targetColumnIndex = dropTargetInfo.index;
|
|
32829
32852
|
dropColumnIndex = targetColumnIndex;
|
|
32830
32853
|
if (dropColumnIndex === columnIndex) {
|
|
32831
32854
|
dropPreview.removeAttribute("data-visible");
|
|
@@ -37992,5 +38015,5 @@ const UserSvg = () => jsx("svg", {
|
|
|
37992
38015
|
})
|
|
37993
38016
|
});
|
|
37994
38017
|
|
|
37995
|
-
export { ActionRenderer, ActiveKeyboardShortcuts, Address, Badge, BadgeCount, Box, Button, ButtonCopyToClipboard, Caption, CheckSvg, Checkbox, CheckboxList, CloseSvg, Code, Col, Colgroup, ConstructionSvg, Details, Dialog, DialogLayout, Editable, ErrorBoundary, ErrorBoundaryContext, ExclamationSvg, EyeClosedSvg, EyeSvg, Form, Group, Head, HeartSvg, HomeSvg, Icon, Image, Input, Interpolate, Label, Link, LinkAnchorSvg, LinkBlankTargetSvg, LinkCurrentSvg, List, ListItem, ListItemFooter, ListItemGroup, ListItemHeader, Loading, LoadingDotsSvg, LoadingIndicator, LoadingIndicatorFluid, MessageBox, Meter, Nav, NaviDebug, Paragraph, Popover, Quantity, QuantityIntl, Radio, RadioList, Route, RowNumberCol, RowNumberTableCell, SVGMaskOverlay, SearchSvg, Select, SelectionContext, Separator, SettingsSvg, SidePanel, StarSvg, SummaryMarker, Svg, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, UserSvg, ViewportLayout, actionIntegratedVia, actionRunEffect, addCustomMessage, anyMatchingRouteSignal, applySearch, arraySignalMembership, compareTwoJsValues, createAction, createAvailableConstraint, createIntl, createRequestCanceller, createSearch, createSelectionKeyboardShortcuts, enableDebugActions, enableDebugOnDocumentLoading, filterTableSelection, forwardActionRequested, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, localStorageSignal, navBack, navForward, navTo, openCallout, rawUrlPart, reload, removeCustomMessage, requestAction, requestListClose, requestListOpen, rerunActions, resource, route, routeAction, setBaseUrl, setupRoutes, stateSignal, stopLoad, stringifyTableSelectionValue, syncOwnedResourceToSignals, syncResourceToSignals, updateActions, useActionStatus, useArraySignalMembership, useAsyncData, useCalloutClose, useCancelPrevious, useCellGridFromRows, useConstraintValidityState, useDependenciesDiff, useDisplayedLayoutEffect, useDocumentResource, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useOrderedColumns, useRouteStatus, useRunOnMount, useSearchText, useSelectRequestClose, useSelectableElement, useSelectionController, useSidePanelClose, useSignalSync, useStateArray, useTitleLevel, useUrlSearchParam, valueInLocalStorage, windowWidthSignal };
|
|
38018
|
+
export { ActionRenderer, ActiveKeyboardShortcuts, Address, Badge, BadgeCount, Box, Button, ButtonCopyToClipboard, Caption, CheckSvg, Checkbox, CheckboxList, CloseSvg, Code, Col, Colgroup, ConstructionSvg, Details, Dialog, DialogLayout, Editable, ErrorBoundary, ErrorBoundaryContext, ExclamationSvg, EyeClosedSvg, EyeSvg, Form, Group, Head, HeartSvg, HomeSvg, Icon, Image, Input, Interpolate, Label, Link, LinkAnchorSvg, LinkBlankTargetSvg, LinkCurrentSvg, List, ListItem, ListItemFooter, ListItemGroup, ListItemHeader, Loading, LoadingDotsSvg, LoadingIndicator, LoadingIndicatorFluid, MessageBox, Meter, Nav, NaviDebug, Paragraph, Popover, Quantity, QuantityIntl, Radio, RadioList, Route, RowNumberCol, RowNumberTableCell, SVGMaskOverlay, SearchSvg, Select, SelectionContext, Separator, SettingsSvg, SidePanel, StarSvg, SummaryMarker, Svg, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, UserSvg, ViewportLayout, actionIntegratedVia, actionRunEffect, addCustomMessage, anyMatchingRouteSignal, applySearch, arraySignalMembership, compareTwoJsValues, createAction, createAvailableConstraint, createIntl, createRequestCanceller, createSearch, createSelectionKeyboardShortcuts, enableDebugActions, enableDebugOnDocumentLoading, filterTableSelection, forwardActionRequested, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, localStorageSignal, moveArrayItemByIndex, navBack, navForward, navTo, openCallout, rawUrlPart, reload, removeCustomMessage, requestAction, requestListClose, requestListOpen, rerunActions, resource, route, routeAction, setBaseUrl, setupRoutes, stateSignal, stopLoad, stringifyTableSelectionValue, swapArrayItemByIndex, syncOwnedResourceToSignals, syncResourceToSignals, updateActions, useActionStatus, useArraySignalMembership, useAsyncData, useCalloutClose, useCancelPrevious, useCellGridFromRows, useConstraintValidityState, useDependenciesDiff, useDisplayedLayoutEffect, useDocumentResource, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useOrderedColumns, useRouteStatus, useRunOnMount, useSearchText, useSelectRequestClose, useSelectableElement, useSelectionController, useSidePanelClose, useSignalSync, useStateArray, useTitleLevel, useUrlSearchParam, valueInLocalStorage, windowWidthSignal };
|
|
37996
38019
|
//# sourceMappingURL=jsenv_navi.js.map
|