@etsoo/react 1.5.40 → 1.5.43
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/lib/mu/RLink.d.ts +2 -2
- package/lib/mu/RLink.js +11 -5
- package/package.json +1 -1
- package/src/mu/RLink.tsx +34 -15
package/lib/mu/RLink.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { LinkProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Router Link
|
|
5
5
|
* @param props Props
|
|
6
6
|
* @returns Component
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
8
|
+
export declare const RLink: React.ForwardRefExoticComponent<Pick<LinkProps<"a", {}>, "role" | "children" | "p" | "slot" | "title" | "maxWidth" | "type" | keyof import("@mui/material/OverridableComponent").CommonProps | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "href" | "variant" | "key" | "underline" | "media" | "target" | "hrefLang" | "referrerPolicy" | "rel" | "download" | "ping" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "TypographyClasses"> & React.RefAttributes<HTMLAnchorElement>>;
|
package/lib/mu/RLink.js
CHANGED
|
@@ -6,17 +6,23 @@ import { globalApp } from '../app/ReactApp';
|
|
|
6
6
|
* @param props Props
|
|
7
7
|
* @returns Component
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export const RLink = React.forwardRef((props, ref) => {
|
|
10
10
|
// Destruct
|
|
11
|
-
const { href, onClick, ...rest } = props;
|
|
11
|
+
const { href, target, onClick, ...rest } = props;
|
|
12
12
|
// Click handler
|
|
13
13
|
const onClickLocl = (event) => {
|
|
14
14
|
if (onClick)
|
|
15
15
|
onClick(event);
|
|
16
|
-
if (
|
|
16
|
+
if (!event.isDefaultPrevented() &&
|
|
17
|
+
href &&
|
|
18
|
+
(!target || target === '_self') && // Let browser handle "target=_blank" etc
|
|
19
|
+
globalApp) {
|
|
20
|
+
// Prevent href action
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
// Router push
|
|
17
23
|
globalApp.history.push(href);
|
|
18
24
|
}
|
|
19
25
|
};
|
|
20
26
|
// Component
|
|
21
|
-
return React.createElement(Link, { ...rest, onClick: onClickLocl });
|
|
22
|
-
}
|
|
27
|
+
return (React.createElement(Link, { ...rest, onClick: onClickLocl, href: href, target: target, ref: ref }));
|
|
28
|
+
});
|
package/package.json
CHANGED
package/src/mu/RLink.tsx
CHANGED
|
@@ -7,21 +7,40 @@ import { globalApp } from '../app/ReactApp';
|
|
|
7
7
|
* @param props Props
|
|
8
8
|
* @returns Component
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export const RLink = React.forwardRef<HTMLAnchorElement, LinkProps>(
|
|
11
|
+
(props, ref) => {
|
|
12
|
+
// Destruct
|
|
13
|
+
const { href, target, onClick, ...rest } = props;
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
// Click handler
|
|
16
|
+
const onClickLocl = (
|
|
17
|
+
event: React.MouseEvent<HTMLAnchorElement, MouseEvent>
|
|
18
|
+
) => {
|
|
19
|
+
if (onClick) onClick(event);
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (
|
|
22
|
+
!event.isDefaultPrevented() &&
|
|
23
|
+
href &&
|
|
24
|
+
(!target || target === '_self') && // Let browser handle "target=_blank" etc
|
|
25
|
+
globalApp
|
|
26
|
+
) {
|
|
27
|
+
// Prevent href action
|
|
28
|
+
event.preventDefault();
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
30
|
+
// Router push
|
|
31
|
+
globalApp.history.push(href);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// Component
|
|
36
|
+
return (
|
|
37
|
+
<Link
|
|
38
|
+
{...rest}
|
|
39
|
+
onClick={onClickLocl}
|
|
40
|
+
href={href}
|
|
41
|
+
target={target}
|
|
42
|
+
ref={ref}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|