@faasjs/ant-design 0.0.3-beta.97 → 0.0.3-beta.99

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/index.d.mts CHANGED
@@ -440,12 +440,14 @@ declare namespace Form {
440
440
 
441
441
  interface LinkProps {
442
442
  href: string;
443
- target?: string;
443
+ target?: '_blank';
444
444
  text?: string | number;
445
445
  children?: ReactNode;
446
446
  style?: CSSProperties;
447
447
  button?: ButtonProps;
448
448
  block?: boolean;
449
+ /** only use for text without button */
450
+ copyable?: boolean;
449
451
  }
450
452
  /**
451
453
  * Link component with button.
package/dist/index.d.ts CHANGED
@@ -440,12 +440,14 @@ declare namespace Form {
440
440
 
441
441
  interface LinkProps {
442
442
  href: string;
443
- target?: string;
443
+ target?: '_blank';
444
444
  text?: string | number;
445
445
  children?: ReactNode;
446
446
  style?: CSSProperties;
447
447
  button?: ButtonProps;
448
448
  block?: boolean;
449
+ /** only use for text without button */
450
+ copyable?: boolean;
449
451
  }
450
452
  /**
451
453
  * Link component with button.
package/dist/index.js CHANGED
@@ -862,10 +862,11 @@ Form.List = antd.Form.List;
862
862
  Form.ErrorList = antd.Form.ErrorList;
863
863
  Form.Provider = antd.Form.Provider;
864
864
  function Link(props) {
865
- var _a, _b, _c, _d;
866
- const { Link: Link2 } = useConfigContext();
865
+ var _a, _b;
866
+ const { Link: Config } = useConfigContext();
867
+ const navigate = reactRouterDom.useNavigate();
867
868
  let style = {
868
- ...Link2.style || {},
869
+ ...Config.style || {},
869
870
  cursor: "pointer",
870
871
  ...props.style
871
872
  };
@@ -880,45 +881,62 @@ function Link(props) {
880
881
  antd.Button,
881
882
  {
882
883
  ...props.button,
883
- target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
884
+ target: props.target || (Config == null ? void 0 : Config.target) || "_blank",
884
885
  style,
885
886
  href: props.href,
886
887
  children: (_a = props.text) != null ? _a : props.children
887
888
  }
888
889
  );
890
+ if (props.children)
891
+ return /* @__PURE__ */ jsxRuntime.jsx(
892
+ "a",
893
+ {
894
+ href: props.href,
895
+ target: props.target || (Config == null ? void 0 : Config.target),
896
+ style,
897
+ children: props.children
898
+ }
899
+ );
889
900
  return /* @__PURE__ */ jsxRuntime.jsx(
890
- "a",
901
+ antd.Typography.Link,
891
902
  {
892
903
  href: props.href,
893
- target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
904
+ target: props.target || (Config == null ? void 0 : Config.target) || "_blank",
894
905
  style,
895
- children: (_b = props.text) != null ? _b : props.children
906
+ copyable: props.copyable,
907
+ children: props.text
896
908
  }
897
909
  );
898
910
  }
899
911
  if (props.button)
912
+ return /* @__PURE__ */ jsxRuntime.jsx(
913
+ antd.Button,
914
+ {
915
+ ...props.button,
916
+ style,
917
+ onClick: () => (props.target || (Config == null ? void 0 : Config.target)) === "_blank" ? window.open(props.href) : navigate(props.href),
918
+ children: (_b = props.text) != null ? _b : props.children
919
+ }
920
+ );
921
+ if (props.children)
900
922
  return /* @__PURE__ */ jsxRuntime.jsx(
901
923
  reactRouterDom.Link,
902
924
  {
903
925
  to: props.href,
904
- target: props.target || (Link2 == null ? void 0 : Link2.target),
905
- children: /* @__PURE__ */ jsxRuntime.jsx(
906
- antd.Button,
907
- {
908
- ...props.button,
909
- style,
910
- children: (_c = props.text) != null ? _c : props.children
911
- }
912
- )
926
+ target: props.target || (Config == null ? void 0 : Config.target),
927
+ style,
928
+ children: props.children
913
929
  }
914
930
  );
915
931
  return /* @__PURE__ */ jsxRuntime.jsx(
916
- reactRouterDom.Link,
932
+ antd.Typography.Link,
917
933
  {
918
- to: props.href,
919
- target: props.target || (Link2 == null ? void 0 : Link2.target),
934
+ href: props.href,
935
+ target: props.target || (Config == null ? void 0 : Config.target),
920
936
  style,
921
- children: (_d = props.text) != null ? _d : props.children
937
+ copyable: props.copyable,
938
+ onClick: () => (props.target || (Config == null ? void 0 : Config.target)) === "_blank" ? window.open(props.href) : navigate(props.href),
939
+ children: props.text
922
940
  }
923
941
  );
924
942
  }
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import { StyleProvider, legacyLogicalPropertiesTransformer } from '@ant-design/c
6
6
  import { createContext, useState, useMemo, useContext, useEffect, cloneElement, useCallback, isValidElement, Suspense } from 'react';
7
7
  export { lazy } from 'react';
8
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
- import { BrowserRouter, Link as Link$1, Routes as Routes$1, Route, useLocation } from 'react-router-dom';
9
+ import { BrowserRouter, useNavigate, Link as Link$1, Routes as Routes$1, Route, useLocation } from 'react-router-dom';
10
10
  import { defaultsDeep, isNil, upperFirst, isFunction, uniqBy } from 'lodash-es';
11
11
  import dayjs2 from 'dayjs';
12
12
  import { PlusOutlined, MinusCircleOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons';
@@ -859,10 +859,11 @@ Form.List = Form$1.List;
859
859
  Form.ErrorList = Form$1.ErrorList;
860
860
  Form.Provider = Form$1.Provider;
861
861
  function Link(props) {
862
- var _a, _b, _c, _d;
863
- const { Link: Link2 } = useConfigContext();
862
+ var _a, _b;
863
+ const { Link: Config } = useConfigContext();
864
+ const navigate = useNavigate();
864
865
  let style = {
865
- ...Link2.style || {},
866
+ ...Config.style || {},
866
867
  cursor: "pointer",
867
868
  ...props.style
868
869
  };
@@ -877,45 +878,62 @@ function Link(props) {
877
878
  Button,
878
879
  {
879
880
  ...props.button,
880
- target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
881
+ target: props.target || (Config == null ? void 0 : Config.target) || "_blank",
881
882
  style,
882
883
  href: props.href,
883
884
  children: (_a = props.text) != null ? _a : props.children
884
885
  }
885
886
  );
887
+ if (props.children)
888
+ return /* @__PURE__ */ jsx(
889
+ "a",
890
+ {
891
+ href: props.href,
892
+ target: props.target || (Config == null ? void 0 : Config.target),
893
+ style,
894
+ children: props.children
895
+ }
896
+ );
886
897
  return /* @__PURE__ */ jsx(
887
- "a",
898
+ Typography.Link,
888
899
  {
889
900
  href: props.href,
890
- target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
901
+ target: props.target || (Config == null ? void 0 : Config.target) || "_blank",
891
902
  style,
892
- children: (_b = props.text) != null ? _b : props.children
903
+ copyable: props.copyable,
904
+ children: props.text
893
905
  }
894
906
  );
895
907
  }
896
908
  if (props.button)
909
+ return /* @__PURE__ */ jsx(
910
+ Button,
911
+ {
912
+ ...props.button,
913
+ style,
914
+ onClick: () => (props.target || (Config == null ? void 0 : Config.target)) === "_blank" ? window.open(props.href) : navigate(props.href),
915
+ children: (_b = props.text) != null ? _b : props.children
916
+ }
917
+ );
918
+ if (props.children)
897
919
  return /* @__PURE__ */ jsx(
898
920
  Link$1,
899
921
  {
900
922
  to: props.href,
901
- target: props.target || (Link2 == null ? void 0 : Link2.target),
902
- children: /* @__PURE__ */ jsx(
903
- Button,
904
- {
905
- ...props.button,
906
- style,
907
- children: (_c = props.text) != null ? _c : props.children
908
- }
909
- )
923
+ target: props.target || (Config == null ? void 0 : Config.target),
924
+ style,
925
+ children: props.children
910
926
  }
911
927
  );
912
928
  return /* @__PURE__ */ jsx(
913
- Link$1,
929
+ Typography.Link,
914
930
  {
915
- to: props.href,
916
- target: props.target || (Link2 == null ? void 0 : Link2.target),
931
+ href: props.href,
932
+ target: props.target || (Config == null ? void 0 : Config.target),
917
933
  style,
918
- children: (_d = props.text) != null ? _d : props.children
934
+ copyable: props.copyable,
935
+ onClick: () => (props.target || (Config == null ? void 0 : Config.target)) === "_blank" ? window.open(props.href) : navigate(props.href),
936
+ children: props.text
919
937
  }
920
938
  );
921
939
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.3-beta.97",
3
+ "version": "0.0.3-beta.99",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -22,7 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@faasjs/react": "0.0.3-beta.97",
25
+ "@faasjs/react": "0.0.3-beta.99",
26
26
  "@ant-design/icons": "*",
27
27
  "lodash-es": "*",
28
28
  "dayjs": "*"