szld-libs 0.2.19 → 0.2.20

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.
@@ -3,7 +3,7 @@ interface AuthProps {
3
3
  PId: number;
4
4
  }
5
5
  export interface CoralButtonProps extends ButtonProps {
6
- PId: number;
6
+ PId: number | number[];
7
7
  auths?: AuthProps[];
8
8
  }
9
9
  declare const CoralButton: (props: CoralButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -4,7 +4,13 @@ import AuthButton from "../AuthButton";
4
4
  const CoralButton = (props) => {
5
5
  const { PId, auths, ...rest } = props;
6
6
  const auth = useMemo(() => {
7
- if (auths && auths.find((v) => v.PId === PId)) {
7
+ if (!auths) {
8
+ return false;
9
+ }
10
+ if (typeof PId === "number" && auths.find((v) => v.PId === PId)) {
11
+ return true;
12
+ }
13
+ if (Array.isArray(PId) && auths.filter((v) => PId.includes(v.PId)).length > 0) {
8
14
  return true;
9
15
  }
10
16
  return false;
@@ -3,7 +3,7 @@ interface AuthProps {
3
3
  PId: number;
4
4
  }
5
5
  export interface CoralButtonProps extends ButtonProps {
6
- PId: number;
6
+ PId: number | number[];
7
7
  auths?: AuthProps[];
8
8
  }
9
9
  declare const CoralButton: (props: CoralButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,7 +5,13 @@ const AuthButton = require("../AuthButton");
5
5
  const CoralButton = (props) => {
6
6
  const { PId, auths, ...rest } = props;
7
7
  const auth = react.useMemo(() => {
8
- if (auths && auths.find((v) => v.PId === PId)) {
8
+ if (!auths) {
9
+ return false;
10
+ }
11
+ if (typeof PId === "number" && auths.find((v) => v.PId === PId)) {
12
+ return true;
13
+ }
14
+ if (Array.isArray(PId) && auths.filter((v) => PId.includes(v.PId)).length > 0) {
9
15
  return true;
10
16
  }
11
17
  return false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.2.19",
4
+ "version": "0.2.20",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",