@etsoo/react 1.5.38 → 1.5.41

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 CHANGED
@@ -1,13 +1,8 @@
1
- /// <reference types="react" />
2
1
  import { LinkProps } from '@mui/material';
3
- import { LinkProps as RouterLinkProps } from 'react-router-dom';
4
- /**
5
- * Router Link props
6
- */
7
- export declare type RLinkProps = LinkProps & RouterLinkProps;
2
+ import React from 'react';
8
3
  /**
9
4
  * Router Link
10
5
  * @param props Props
11
6
  * @returns Component
12
7
  */
13
- export declare function RLink(props: RLinkProps): JSX.Element;
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
@@ -1,11 +1,26 @@
1
1
  import { Link } from '@mui/material';
2
- import { Link as RouterLink } from 'react-router-dom';
3
2
  import React from 'react';
3
+ import { globalApp } from '../app/ReactApp';
4
4
  /**
5
5
  * Router Link
6
6
  * @param props Props
7
7
  * @returns Component
8
8
  */
9
- export function RLink(props) {
10
- return React.createElement(Link, { component: RouterLink, ...props });
11
- }
9
+ export const RLink = React.forwardRef((props, ref) => {
10
+ // Destruct
11
+ const { href, onClick, ...rest } = props;
12
+ // Click handler
13
+ const onClickLocl = (event) => {
14
+ if (onClick)
15
+ onClick(event);
16
+ if (!event.isDefaultPrevented && href && globalApp) {
17
+ // Router push
18
+ globalApp.history.push(href);
19
+ // Cancel further processing
20
+ event.preventDefault();
21
+ event.stopPropagation();
22
+ }
23
+ };
24
+ // Component
25
+ return React.createElement(Link, { ...rest, onClick: onClickLocl, href: href, ref: ref });
26
+ });
@@ -18,9 +18,13 @@ export const CommonPageScrollContainer = global;
18
18
  */
19
19
  export function CommonPage(props) {
20
20
  // Destruct
21
- const { children, disableGutters = true, fabButtons, fabColumnDirection, fabPaddingAdjust = 1.5, fabSize = 'small', maxWidth = false, moreActions, onRefresh, onUpdate, onUpdateAll, paddings = MUGlobal.pagePaddings, scrollContainer, supportBack = false, targetFields, sx = { padding: paddings }, ...rest } = props;
21
+ const { children, disableGutters = true, fabButtons, fabColumnDirection, fabPaddingAdjust = 1.5, fabSize = 'small', maxWidth = false, moreActions, onRefresh, onUpdate, onUpdateAll, paddings = MUGlobal.pagePaddings, scrollContainer, supportBack = false, targetFields, sx = {}, ...rest } = props;
22
22
  // Fab padding
23
23
  const fabPadding = MUGlobal.increase(MUGlobal.pagePaddings, fabPaddingAdjust);
24
+ if (typeof sx === 'object' && sx != null && !Reflect.has(sx, 'padding')) {
25
+ // Set default padding
26
+ Reflect.set(sx, 'padding', paddings);
27
+ }
24
28
  // Labels
25
29
  const labels = Labels.CommonPage;
26
30
  // Update
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.5.38",
3
+ "version": "1.5.41",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/mu/RLink.tsx CHANGED
@@ -1,20 +1,34 @@
1
1
  import { Link, LinkProps } from '@mui/material';
2
- import {
3
- Link as RouterLink,
4
- LinkProps as RouterLinkProps
5
- } from 'react-router-dom';
6
2
  import React from 'react';
7
-
8
- /**
9
- * Router Link props
10
- */
11
- export type RLinkProps = LinkProps & RouterLinkProps;
3
+ import { globalApp } from '../app/ReactApp';
12
4
 
13
5
  /**
14
6
  * Router Link
15
7
  * @param props Props
16
8
  * @returns Component
17
9
  */
18
- export function RLink(props: RLinkProps) {
19
- return <Link component={RouterLink} {...props} />;
20
- }
10
+ export const RLink = React.forwardRef<HTMLAnchorElement, LinkProps>(
11
+ (props, ref) => {
12
+ // Destruct
13
+ const { href, onClick, ...rest } = props;
14
+
15
+ // Click handler
16
+ const onClickLocl = (
17
+ event: React.MouseEvent<HTMLAnchorElement, MouseEvent>
18
+ ) => {
19
+ if (onClick) onClick(event);
20
+
21
+ if (!event.isDefaultPrevented && href && globalApp) {
22
+ // Router push
23
+ globalApp.history.push(href);
24
+
25
+ // Cancel further processing
26
+ event.preventDefault();
27
+ event.stopPropagation();
28
+ }
29
+ };
30
+
31
+ // Component
32
+ return <Link {...rest} onClick={onClickLocl} href={href} ref={ref} />;
33
+ }
34
+ );
@@ -37,7 +37,7 @@ export function CommonPage(props: CommonPageProps) {
37
37
  scrollContainer,
38
38
  supportBack = false,
39
39
  targetFields,
40
- sx = { padding: paddings },
40
+ sx = {},
41
41
  ...rest
42
42
  } = props;
43
43
 
@@ -47,6 +47,11 @@ export function CommonPage(props: CommonPageProps) {
47
47
  fabPaddingAdjust
48
48
  );
49
49
 
50
+ if (typeof sx === 'object' && sx != null && !Reflect.has(sx, 'padding')) {
51
+ // Set default padding
52
+ Reflect.set(sx, 'padding', paddings);
53
+ }
54
+
50
55
  // Labels
51
56
  const labels = Labels.CommonPage;
52
57