linkmore-design 1.0.62 → 1.0.66
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/README.md +1 -1
- package/dist/Approval/demos/basic.d.ts +2 -0
- package/dist/Approval/index.d.ts +24 -0
- package/dist/Approval/style/index.d.ts +1 -0
- package/dist/AutoComplete/demos/basic.d.ts +3 -0
- package/dist/AutoComplete/index.d.ts +30 -0
- package/dist/AutoComplete/style/index.d.ts +1 -0
- package/dist/Avatar/demos/basic.d.ts +2 -0
- package/dist/Avatar/index.d.ts +3 -0
- package/dist/Avatar/style/index.d.ts +1 -0
- package/dist/Breadcrumb/demos/basic.d.ts +2 -0
- package/dist/Breadcrumb/demos/basic1.d.ts +2 -0
- package/dist/Breadcrumb/index.d.ts +4 -0
- package/dist/Breadcrumb/style/index.d.ts +1 -0
- package/dist/CardTable/utils.d.ts +1 -1
- package/dist/Col/demos/basic.d.ts +2 -0
- package/dist/Col/index.d.ts +3 -0
- package/dist/Col/style/index.d.ts +1 -0
- package/dist/Form/index.d.ts +1 -1
- package/dist/Grid/RowContext.d.ts +8 -0
- package/dist/Grid/col.d.ts +28 -0
- package/dist/Grid/demos/basic.d.ts +2 -0
- package/dist/Grid/hooks/useBreakpoint.d.ts +3 -0
- package/dist/Grid/index.d.ts +11 -0
- package/dist/Grid/row.d.ts +14 -0
- package/dist/Grid/style/index.d.ts +1 -0
- package/dist/Layout/demos/basic.d.ts +2 -0
- package/dist/Layout/index.d.ts +4 -0
- package/dist/Layout/style/index.d.ts +1 -0
- package/dist/LmEditTable/EditTable.d.ts +4 -1
- package/dist/LmEditTable/demos/colsort.d.ts +2 -0
- package/dist/LmEditTable/demos/size.d.ts +2 -0
- package/dist/LmEditTable/sortableBoxCol.d.ts +5 -0
- package/dist/LmEditTable/sortableItemCol.d.ts +1 -0
- package/dist/LmFilter/components/CustomSelectFilter.d.ts +4 -0
- package/dist/LmFilter/customFilter/drawer.d.ts +4 -0
- package/dist/LmFilter/customFilter/saveModal.d.ts +4 -0
- package/dist/LmFilter/customFilter/valueDrawer.d.ts +4 -0
- package/dist/LmFilter/filterFns/index.d.ts +35 -17
- package/dist/LmFilter/utils.d.ts +2 -0
- package/dist/Mentions/demos/basic.d.ts +2 -0
- package/dist/Mentions/index.d.ts +3 -0
- package/dist/Mentions/style/index.d.ts +1 -0
- package/dist/PageHeader/demos/basic.d.ts +2 -0
- package/dist/PageHeader/index.d.ts +24 -0
- package/dist/PageHeader/style/index.d.ts +1 -0
- package/dist/Popover/demos/basic.d.ts +2 -0
- package/dist/Popover/demos/basic1.d.ts +2 -0
- package/dist/Popover/index.d.ts +11 -0
- package/dist/Popover/style/index.d.ts +1 -0
- package/dist/Rate/demos/basic.d.ts +2 -0
- package/dist/Rate/index.d.ts +3 -0
- package/dist/Rate/style/index.d.ts +1 -0
- package/dist/Row/demos/basic.d.ts +2 -0
- package/dist/Row/index.d.ts +3 -0
- package/dist/Row/style/index.d.ts +1 -0
- package/dist/Steps/demos/basic.d.ts +2 -0
- package/dist/Steps/index.d.ts +3 -0
- package/dist/Steps/style/index.d.ts +1 -0
- package/dist/Tooltip/index.d.ts +43 -1
- package/dist/Typography/Base/Ellipsis.d.ts +14 -0
- package/dist/Typography/Base/EllipsisTooltip.d.ts +13 -0
- package/dist/Typography/Base/index.d.ts +54 -0
- package/dist/Typography/Editable.d.ts +20 -0
- package/dist/Typography/Link.d.ts +7 -0
- package/dist/Typography/Paragraph.d.ts +7 -0
- package/dist/Typography/Text.d.ts +8 -0
- package/dist/Typography/Title.d.ts +9 -0
- package/dist/Typography/Typography.d.ts +11 -0
- package/dist/Typography/demos/basic.d.ts +2 -0
- package/dist/Typography/hooks/useMergedConfig.d.ts +1 -0
- package/dist/Typography/hooks/useUpdatedEffect.d.ts +3 -0
- package/dist/Typography/index.d.ts +15 -0
- package/dist/Typography/style/index.d.ts +1 -0
- package/dist/_util/colors.d.ts +5 -0
- package/dist/_util/getRenderPropValue.d.ts +3 -0
- package/dist/_util/hooks/useFlexGapSupport.d.ts +2 -0
- package/dist/_util/hooks/useForceUpdate.d.ts +2 -0
- package/dist/_util/placements.d.ts +16 -0
- package/dist/_util/responsiveObserve.d.ts +21 -0
- package/dist/_util/styleChecker.d.ts +4 -0
- package/dist/_util/transButton.d.ts +9 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.umd.js +17449 -8958
- package/dist/index.umd.min.js +6 -6
- package/es/Approval/index.d.ts +24 -0
- package/es/Approval/index.js +210 -0
- package/es/Approval/style/index.css +592 -0
- package/es/Approval/style/index.d.ts +1 -0
- package/es/Approval/style/index.js +1 -0
- package/es/AutoComplete/index.d.ts +30 -0
- package/es/AutoComplete/index.js +101 -0
- package/es/AutoComplete/style/index.css +505 -0
- package/es/AutoComplete/style/index.d.ts +1 -0
- package/es/AutoComplete/style/index.js +1 -0
- package/es/Avatar/index.d.ts +3 -0
- package/es/Avatar/index.js +3 -0
- package/es/Avatar/style/index.css +505 -0
- package/es/Avatar/style/index.d.ts +1 -0
- package/es/Avatar/style/index.js +1 -0
- package/es/Breadcrumb/index.d.ts +4 -0
- package/es/Breadcrumb/index.js +3 -0
- package/es/Breadcrumb/style/index.css +505 -0
- package/es/Breadcrumb/style/index.d.ts +1 -0
- package/es/Breadcrumb/style/index.js +1 -0
- package/es/Col/README.md.old +22 -0
- package/es/Col/index.d.ts +3 -0
- package/es/Col/index.js +2 -0
- package/es/Col/style/index.css +505 -0
- package/es/Col/style/index.d.ts +1 -0
- package/es/Col/style/index.js +1 -0
- package/es/EditTable/README.md.old +66 -0
- package/es/Form/container.js +17 -1
- package/es/Form/index.d.ts +1 -1
- package/es/Form/index.js +5 -2
- package/es/Form/style/index.css +32 -17
- package/es/Grid/RowContext.d.ts +8 -0
- package/es/Grid/RowContext.js +3 -0
- package/es/Grid/col.d.ts +28 -0
- package/es/Grid/col.js +112 -0
- package/es/Grid/hooks/useBreakpoint.d.ts +3 -0
- package/es/Grid/hooks/useBreakpoint.js +24 -0
- package/es/Grid/index.d.ts +11 -0
- package/es/Grid/index.js +14 -0
- package/es/Grid/row.d.ts +14 -0
- package/es/Grid/row.js +142 -0
- package/es/Grid/style/index.css +505 -0
- package/es/Grid/style/index.d.ts +1 -0
- package/es/Grid/style/index.js +1 -0
- package/es/Layout/index.d.ts +4 -0
- package/es/Layout/index.js +3 -0
- package/es/Layout/style/index.css +505 -0
- package/es/Layout/style/index.d.ts +1 -0
- package/es/Layout/style/index.js +1 -0
- package/es/LmEditTable/EditTable.d.ts +4 -1
- package/es/LmEditTable/EditTable.js +241 -59
- package/es/LmEditTable/sortableBoxCol.d.ts +5 -0
- package/es/LmEditTable/sortableBoxCol.js +13 -0
- package/es/LmEditTable/sortableItemCol.d.ts +1 -0
- package/es/LmEditTable/sortableItemCol.js +48 -0
- package/es/LmFilter/{icon_placeholder.png → assets/empty.png} +0 -0
- package/es/LmFilter/clearFilter/index.js +3 -5
- package/es/LmFilter/complexFilter/drawer.js +26 -9
- package/es/LmFilter/components/CheckboxFilter.js +1 -1
- package/es/LmFilter/components/CustomSelectFilter.js +139 -0
- package/es/LmFilter/components/EmptyFilter.js +2 -2
- package/es/LmFilter/components/SelectFilter.js +15 -6
- package/es/LmFilter/components/index.js +9 -2
- package/es/LmFilter/customFilter/drawer.js +427 -0
- package/es/LmFilter/customFilter/index.js +107 -2
- package/es/LmFilter/customFilter/saveModal.js +187 -0
- package/es/LmFilter/customFilter/valueDrawer.js +238 -0
- package/es/LmFilter/filterFns/index.js +316 -70
- package/es/LmFilter/style/{style.css → index.css} +61 -6
- package/es/LmFilter/style/index.js +1 -1
- package/es/LmFilter/utils.js +34 -0
- package/es/LmFilter/wrapper/FilterRoot.js +63 -49
- package/es/Mentions/index.d.ts +3 -0
- package/es/Mentions/index.js +3 -0
- package/es/Mentions/style/index.css +505 -0
- package/es/Mentions/style/index.d.ts +1 -0
- package/es/Mentions/style/index.js +1 -0
- package/es/PageHeader/index.d.ts +24 -0
- package/es/PageHeader/index.js +169 -0
- package/es/PageHeader/style/index.css +505 -0
- package/es/PageHeader/style/index.d.ts +1 -0
- package/es/PageHeader/style/index.js +1 -0
- package/es/Popover/index.d.ts +11 -0
- package/es/Popover/index.js +63 -0
- package/es/Popover/style/index.css +505 -0
- package/es/Popover/style/index.d.ts +1 -0
- package/es/Popover/style/index.js +1 -0
- package/es/Rate/index.d.ts +3 -0
- package/es/Rate/index.js +3 -0
- package/es/Rate/style/index.css +505 -0
- package/es/Rate/style/index.d.ts +1 -0
- package/es/Rate/style/index.js +1 -0
- package/es/Row/README.md.old +22 -0
- package/es/Row/index.d.ts +3 -0
- package/es/Row/index.js +2 -0
- package/es/Row/style/index.css +505 -0
- package/es/Row/style/index.d.ts +1 -0
- package/es/Row/style/index.js +1 -0
- package/es/Steps/index.d.ts +3 -0
- package/es/Steps/index.js +3 -0
- package/es/Steps/style/index.css +505 -0
- package/es/Steps/style/index.d.ts +1 -0
- package/es/Steps/style/index.js +1 -0
- package/es/Tooltip/index.d.ts +43 -1
- package/es/Tooltip/index.js +236 -1
- package/es/Typography/Base/Ellipsis.d.ts +14 -0
- package/es/Typography/Base/Ellipsis.js +197 -0
- package/es/Typography/Base/EllipsisTooltip.d.ts +13 -0
- package/es/Typography/Base/EllipsisTooltip.js +23 -0
- package/es/Typography/Base/index.d.ts +54 -0
- package/es/Typography/Base/index.js +509 -0
- package/es/Typography/Editable.d.ts +20 -0
- package/es/Typography/Editable.js +117 -0
- package/es/Typography/Link.d.ts +7 -0
- package/es/Typography/Link.js +43 -0
- package/es/Typography/Paragraph.d.ts +7 -0
- package/es/Typography/Paragraph.js +12 -0
- package/es/Typography/Text.d.ts +8 -0
- package/es/Typography/Text.js +41 -0
- package/es/Typography/Title.d.ts +9 -0
- package/es/Typography/Title.js +41 -0
- package/es/Typography/Typography.d.ts +11 -0
- package/es/Typography/Typography.js +61 -0
- package/es/Typography/hooks/useMergedConfig.d.ts +1 -0
- package/es/Typography/hooks/useMergedConfig.js +8 -0
- package/es/Typography/hooks/useUpdatedEffect.d.ts +3 -0
- package/es/Typography/hooks/useUpdatedEffect.js +13 -0
- package/es/Typography/index.d.ts +15 -0
- package/es/Typography/index.js +14 -0
- package/es/Typography/style/index.css +505 -0
- package/es/Typography/style/index.d.ts +1 -0
- package/es/Typography/style/index.js +1 -0
- package/es/_util/colors.d.ts +5 -0
- package/es/_util/colors.js +4 -0
- package/es/_util/getRenderPropValue.d.ts +3 -0
- package/es/_util/getRenderPropValue.js +13 -0
- package/es/_util/hooks/useFlexGapSupport.d.ts +2 -0
- package/es/_util/hooks/useFlexGapSupport.js +14 -0
- package/es/_util/hooks/useForceUpdate.d.ts +2 -0
- package/es/_util/hooks/useForceUpdate.js +11 -0
- package/es/_util/placements.d.ts +16 -0
- package/es/_util/placements.js +87 -0
- package/es/_util/responsiveObserve.d.ts +21 -0
- package/es/_util/responsiveObserve.js +66 -0
- package/es/_util/styleChecker.d.ts +4 -0
- package/es/_util/styleChecker.js +31 -0
- package/es/_util/transButton.d.ts +9 -0
- package/es/_util/transButton.js +73 -0
- package/es/index.d.ts +14 -0
- package/es/index.js +8 -1
- package/lib/Approval/index.d.ts +24 -0
- package/lib/Approval/index.js +223 -0
- package/lib/Approval/style/index.css +592 -0
- package/lib/Approval/style/index.d.ts +1 -0
- package/lib/Approval/style/index.js +3 -0
- package/lib/AutoComplete/index.d.ts +30 -0
- package/lib/AutoComplete/index.js +125 -0
- package/lib/AutoComplete/style/index.css +505 -0
- package/lib/AutoComplete/style/index.d.ts +1 -0
- package/lib/AutoComplete/style/index.js +3 -0
- package/lib/Avatar/index.d.ts +3 -0
- package/lib/Avatar/index.js +15 -0
- package/lib/Avatar/style/index.css +505 -0
- package/lib/Avatar/style/index.d.ts +1 -0
- package/lib/Avatar/style/index.js +3 -0
- package/lib/Breadcrumb/index.d.ts +4 -0
- package/lib/Breadcrumb/index.js +15 -0
- package/lib/Breadcrumb/style/index.css +505 -0
- package/lib/Breadcrumb/style/index.d.ts +1 -0
- package/lib/Breadcrumb/style/index.js +3 -0
- package/lib/Col/README.md.old +22 -0
- package/lib/Col/index.d.ts +3 -0
- package/lib/Col/index.js +11 -0
- package/lib/Col/style/index.css +505 -0
- package/lib/Col/style/index.d.ts +1 -0
- package/lib/Col/style/index.js +3 -0
- package/lib/EditTable/README.md.old +66 -0
- package/lib/Form/container.js +17 -1
- package/lib/Form/index.d.ts +1 -1
- package/lib/Form/index.js +5 -2
- package/lib/Form/style/index.css +32 -17
- package/lib/Grid/RowContext.d.ts +8 -0
- package/lib/Grid/RowContext.js +12 -0
- package/lib/Grid/col.d.ts +28 -0
- package/lib/Grid/col.js +128 -0
- package/lib/Grid/hooks/useBreakpoint.d.ts +3 -0
- package/lib/Grid/hooks/useBreakpoint.js +37 -0
- package/lib/Grid/index.d.ts +11 -0
- package/lib/Grid/index.js +45 -0
- package/lib/Grid/row.d.ts +14 -0
- package/lib/Grid/row.js +164 -0
- package/lib/Grid/style/index.css +505 -0
- package/lib/Grid/style/index.d.ts +1 -0
- package/lib/Grid/style/index.js +3 -0
- package/lib/Layout/index.d.ts +4 -0
- package/lib/Layout/index.js +15 -0
- package/lib/Layout/style/index.css +505 -0
- package/lib/Layout/style/index.d.ts +1 -0
- package/lib/Layout/style/index.js +3 -0
- package/lib/LmEditTable/EditTable.d.ts +4 -1
- package/lib/LmEditTable/EditTable.js +242 -60
- package/lib/LmEditTable/sortableBoxCol.d.ts +5 -0
- package/lib/LmEditTable/sortableBoxCol.js +24 -0
- package/lib/LmEditTable/sortableItemCol.d.ts +1 -0
- package/lib/LmEditTable/sortableItemCol.js +61 -0
- package/lib/LmFilter/{icon_placeholder.png → assets/empty.png} +0 -0
- package/lib/LmFilter/clearFilter/index.js +3 -5
- package/lib/LmFilter/complexFilter/drawer.js +26 -9
- package/lib/LmFilter/components/CheckboxFilter.js +1 -1
- package/lib/LmFilter/components/CustomSelectFilter.js +139 -0
- package/lib/LmFilter/components/EmptyFilter.js +2 -2
- package/lib/LmFilter/components/SelectFilter.js +15 -6
- package/lib/LmFilter/components/index.js +9 -2
- package/lib/LmFilter/customFilter/drawer.js +427 -0
- package/lib/LmFilter/customFilter/index.js +107 -2
- package/lib/LmFilter/customFilter/saveModal.js +187 -0
- package/lib/LmFilter/customFilter/valueDrawer.js +238 -0
- package/lib/LmFilter/filterFns/index.js +316 -70
- package/lib/LmFilter/style/{style.css → index.css} +61 -6
- package/lib/LmFilter/style/index.js +1 -1
- package/lib/LmFilter/utils.js +34 -0
- package/lib/LmFilter/wrapper/FilterRoot.js +63 -49
- package/lib/Mentions/index.d.ts +3 -0
- package/lib/Mentions/index.js +15 -0
- package/lib/Mentions/style/index.css +505 -0
- package/lib/Mentions/style/index.d.ts +1 -0
- package/lib/Mentions/style/index.js +3 -0
- package/lib/PageHeader/index.d.ts +24 -0
- package/lib/PageHeader/index.js +194 -0
- package/lib/PageHeader/style/index.css +505 -0
- package/lib/PageHeader/style/index.d.ts +1 -0
- package/lib/PageHeader/style/index.js +3 -0
- package/lib/Popover/index.d.ts +11 -0
- package/lib/Popover/index.js +81 -0
- package/lib/Popover/style/index.css +505 -0
- package/lib/Popover/style/index.d.ts +1 -0
- package/lib/Popover/style/index.js +3 -0
- package/lib/Rate/index.d.ts +3 -0
- package/lib/Rate/index.js +15 -0
- package/lib/Rate/style/index.css +505 -0
- package/lib/Rate/style/index.d.ts +1 -0
- package/lib/Rate/style/index.js +3 -0
- package/lib/Row/README.md.old +22 -0
- package/lib/Row/index.d.ts +3 -0
- package/lib/Row/index.js +11 -0
- package/lib/Row/style/index.css +505 -0
- package/lib/Row/style/index.d.ts +1 -0
- package/lib/Row/style/index.js +3 -0
- package/lib/Steps/index.d.ts +3 -0
- package/lib/Steps/index.js +15 -0
- package/lib/Steps/style/index.css +505 -0
- package/lib/Steps/style/index.d.ts +1 -0
- package/lib/Steps/style/index.js +3 -0
- package/lib/Tooltip/index.d.ts +43 -1
- package/lib/Tooltip/index.js +247 -1
- package/lib/Typography/Base/Ellipsis.d.ts +14 -0
- package/lib/Typography/Base/Ellipsis.js +212 -0
- package/lib/Typography/Base/EllipsisTooltip.d.ts +13 -0
- package/lib/Typography/Base/EllipsisTooltip.js +36 -0
- package/lib/Typography/Base/index.d.ts +54 -0
- package/lib/Typography/Base/index.js +545 -0
- package/lib/Typography/Editable.d.ts +20 -0
- package/lib/Typography/Editable.js +137 -0
- package/lib/Typography/Link.d.ts +7 -0
- package/lib/Typography/Link.js +58 -0
- package/lib/Typography/Paragraph.d.ts +7 -0
- package/lib/Typography/Paragraph.js +26 -0
- package/lib/Typography/Text.d.ts +8 -0
- package/lib/Typography/Text.js +57 -0
- package/lib/Typography/Title.d.ts +9 -0
- package/lib/Typography/Title.js +58 -0
- package/lib/Typography/Typography.d.ts +11 -0
- package/lib/Typography/Typography.js +77 -0
- package/lib/Typography/hooks/useMergedConfig.d.ts +1 -0
- package/lib/Typography/hooks/useMergedConfig.js +21 -0
- package/lib/Typography/hooks/useUpdatedEffect.d.ts +3 -0
- package/lib/Typography/hooks/useUpdatedEffect.js +24 -0
- package/lib/Typography/index.d.ts +15 -0
- package/lib/Typography/index.js +31 -0
- package/lib/Typography/style/index.css +505 -0
- package/lib/Typography/style/index.d.ts +1 -0
- package/lib/Typography/style/index.js +3 -0
- package/lib/_util/colors.d.ts +5 -0
- package/lib/_util/colors.js +14 -0
- package/lib/_util/getRenderPropValue.d.ts +3 -0
- package/lib/_util/getRenderPropValue.js +22 -0
- package/lib/_util/hooks/useFlexGapSupport.d.ts +2 -0
- package/lib/_util/hooks/useFlexGapSupport.js +30 -0
- package/lib/_util/hooks/useForceUpdate.d.ts +2 -0
- package/lib/_util/hooks/useForceUpdate.js +24 -0
- package/lib/_util/placements.d.ts +16 -0
- package/lib/_util/placements.js +98 -0
- package/lib/_util/responsiveObserve.d.ts +21 -0
- package/lib/_util/responsiveObserve.js +79 -0
- package/lib/_util/styleChecker.d.ts +4 -0
- package/lib/_util/styleChecker.js +52 -0
- package/lib/_util/transButton.d.ts +9 -0
- package/lib/_util/transButton.js +87 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +57 -1
- package/package.json +2 -2
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
|
|
5
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
6
|
+
var t = {};
|
|
7
|
+
|
|
8
|
+
for (var p in s) {
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
13
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
14
|
+
}
|
|
15
|
+
return t;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
import CheckOutlined from '@ant-design/icons/CheckOutlined';
|
|
19
|
+
import CopyOutlined from '@ant-design/icons/CopyOutlined';
|
|
20
|
+
import EditOutlined from '@ant-design/icons/EditOutlined';
|
|
21
|
+
import classNames from 'classnames';
|
|
22
|
+
import copy from 'copy-to-clipboard';
|
|
23
|
+
import ResizeObserver from 'rc-resize-observer';
|
|
24
|
+
import toArray from 'rc-util/lib/Children/toArray';
|
|
25
|
+
import useIsomorphicLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
|
|
26
|
+
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
27
|
+
import omit from 'rc-util/lib/omit';
|
|
28
|
+
import { composeRef } from 'rc-util/lib/ref';
|
|
29
|
+
import * as React from 'react';
|
|
30
|
+
import { ConfigContext } from 'antd/es/config-provider';
|
|
31
|
+
import { useLocaleReceiver } from 'antd/es/locale-provider/LocaleReceiver';
|
|
32
|
+
import TransButton from '../../_util/transButton';
|
|
33
|
+
import { isStyleSupport } from '../../_util/styleChecker';
|
|
34
|
+
import Tooltip from '../../Tooltip';
|
|
35
|
+
import Editable from '../Editable';
|
|
36
|
+
import useMergedConfig from '../hooks/useMergedConfig';
|
|
37
|
+
import useUpdatedEffect from '../hooks/useUpdatedEffect';
|
|
38
|
+
import Typography from '../Typography';
|
|
39
|
+
import Ellipsis from './Ellipsis';
|
|
40
|
+
import EllipsisTooltip from './EllipsisTooltip';
|
|
41
|
+
|
|
42
|
+
function wrapperDecorations(_ref, content) {
|
|
43
|
+
var mark = _ref.mark,
|
|
44
|
+
code = _ref.code,
|
|
45
|
+
underline = _ref.underline,
|
|
46
|
+
del = _ref.delete,
|
|
47
|
+
strong = _ref.strong,
|
|
48
|
+
keyboard = _ref.keyboard,
|
|
49
|
+
italic = _ref.italic;
|
|
50
|
+
var currentContent = content;
|
|
51
|
+
|
|
52
|
+
function wrap(needed, tag) {
|
|
53
|
+
if (!needed) return;
|
|
54
|
+
currentContent = /*#__PURE__*/React.createElement(tag, {}, currentContent);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
wrap(strong, 'strong');
|
|
58
|
+
wrap(underline, 'u');
|
|
59
|
+
wrap(del, 'del');
|
|
60
|
+
wrap(code, 'code');
|
|
61
|
+
wrap(mark, 'mark');
|
|
62
|
+
wrap(keyboard, 'kbd');
|
|
63
|
+
wrap(italic, 'i');
|
|
64
|
+
return currentContent;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getNode(dom, defaultNode, needDom) {
|
|
68
|
+
if (dom === true || dom === undefined) {
|
|
69
|
+
return defaultNode;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return dom || needDom && defaultNode;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function toList(val) {
|
|
76
|
+
return Array.isArray(val) ? val : [val];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var ELLIPSIS_STR = '...';
|
|
80
|
+
var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
81
|
+
var customizePrefixCls = props.prefixCls,
|
|
82
|
+
className = props.className,
|
|
83
|
+
style = props.style,
|
|
84
|
+
type = props.type,
|
|
85
|
+
disabled = props.disabled,
|
|
86
|
+
children = props.children,
|
|
87
|
+
ellipsis = props.ellipsis,
|
|
88
|
+
editable = props.editable,
|
|
89
|
+
copyable = props.copyable,
|
|
90
|
+
component = props.component,
|
|
91
|
+
title = props.title,
|
|
92
|
+
restProps = __rest(props, ["prefixCls", "className", "style", "type", "disabled", "children", "ellipsis", "editable", "copyable", "component", "title"]);
|
|
93
|
+
|
|
94
|
+
var _React$useContext = React.useContext(ConfigContext),
|
|
95
|
+
getPrefixCls = _React$useContext.getPrefixCls,
|
|
96
|
+
direction = _React$useContext.direction;
|
|
97
|
+
|
|
98
|
+
var textLocale = useLocaleReceiver('Text')[0]; // Force TS get this
|
|
99
|
+
|
|
100
|
+
var typographyRef = React.useRef(null);
|
|
101
|
+
var editIconRef = React.useRef(null); // ============================ MISC ============================
|
|
102
|
+
|
|
103
|
+
var prefixCls = getPrefixCls('typography', customizePrefixCls);
|
|
104
|
+
var textProps = omit(restProps, ['mark', 'code', 'delete', 'underline', 'strong', 'keyboard', 'italic']); // ========================== Editable ==========================
|
|
105
|
+
|
|
106
|
+
var _useMergedConfig = useMergedConfig(editable),
|
|
107
|
+
_useMergedConfig2 = _slicedToArray(_useMergedConfig, 2),
|
|
108
|
+
enableEdit = _useMergedConfig2[0],
|
|
109
|
+
editConfig = _useMergedConfig2[1];
|
|
110
|
+
|
|
111
|
+
var _useMergedState = useMergedState(false, {
|
|
112
|
+
value: editConfig.editing
|
|
113
|
+
}),
|
|
114
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
115
|
+
editing = _useMergedState2[0],
|
|
116
|
+
setEditing = _useMergedState2[1];
|
|
117
|
+
|
|
118
|
+
var _editConfig$triggerTy = editConfig.triggerType,
|
|
119
|
+
triggerType = _editConfig$triggerTy === void 0 ? ['icon'] : _editConfig$triggerTy;
|
|
120
|
+
|
|
121
|
+
var triggerEdit = function triggerEdit(edit) {
|
|
122
|
+
var _a;
|
|
123
|
+
|
|
124
|
+
if (edit) {
|
|
125
|
+
(_a = editConfig.onStart) === null || _a === void 0 ? void 0 : _a.call(editConfig);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
setEditing(edit);
|
|
129
|
+
}; // Focus edit icon when back
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
useUpdatedEffect(function () {
|
|
133
|
+
var _a;
|
|
134
|
+
|
|
135
|
+
if (!editing) {
|
|
136
|
+
(_a = editIconRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
137
|
+
}
|
|
138
|
+
}, [editing]);
|
|
139
|
+
|
|
140
|
+
var onEditClick = function onEditClick(e) {
|
|
141
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
142
|
+
triggerEdit(true);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
var onEditChange = function onEditChange(value) {
|
|
146
|
+
var _a;
|
|
147
|
+
|
|
148
|
+
(_a = editConfig.onChange) === null || _a === void 0 ? void 0 : _a.call(editConfig, value);
|
|
149
|
+
triggerEdit(false);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
var onEditCancel = function onEditCancel() {
|
|
153
|
+
var _a;
|
|
154
|
+
|
|
155
|
+
(_a = editConfig.onCancel) === null || _a === void 0 ? void 0 : _a.call(editConfig);
|
|
156
|
+
triggerEdit(false);
|
|
157
|
+
}; // ========================== Copyable ==========================
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
var _useMergedConfig3 = useMergedConfig(copyable),
|
|
161
|
+
_useMergedConfig4 = _slicedToArray(_useMergedConfig3, 2),
|
|
162
|
+
enableCopy = _useMergedConfig4[0],
|
|
163
|
+
copyConfig = _useMergedConfig4[1];
|
|
164
|
+
|
|
165
|
+
var _React$useState = React.useState(false),
|
|
166
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
167
|
+
copied = _React$useState2[0],
|
|
168
|
+
setCopied = _React$useState2[1];
|
|
169
|
+
|
|
170
|
+
var copyIdRef = React.useRef();
|
|
171
|
+
var copyOptions = {};
|
|
172
|
+
|
|
173
|
+
if (copyConfig.format) {
|
|
174
|
+
copyOptions.format = copyConfig.format;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
var cleanCopyId = function cleanCopyId() {
|
|
178
|
+
clearTimeout(copyIdRef.current);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
var onCopyClick = function onCopyClick(e) {
|
|
182
|
+
var _a;
|
|
183
|
+
|
|
184
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
185
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
186
|
+
copy(copyConfig.text || String(children) || '', copyOptions);
|
|
187
|
+
setCopied(true); // Trigger tips update
|
|
188
|
+
|
|
189
|
+
cleanCopyId();
|
|
190
|
+
copyIdRef.current = setTimeout(function () {
|
|
191
|
+
setCopied(false);
|
|
192
|
+
}, 3000);
|
|
193
|
+
(_a = copyConfig.onCopy) === null || _a === void 0 ? void 0 : _a.call(copyConfig, e);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
React.useEffect(function () {
|
|
197
|
+
return cleanCopyId;
|
|
198
|
+
}, []); // ========================== Ellipsis ==========================
|
|
199
|
+
|
|
200
|
+
var _React$useState3 = React.useState(false),
|
|
201
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
202
|
+
isLineClampSupport = _React$useState4[0],
|
|
203
|
+
setIsLineClampSupport = _React$useState4[1];
|
|
204
|
+
|
|
205
|
+
var _React$useState5 = React.useState(false),
|
|
206
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
207
|
+
isTextOverflowSupport = _React$useState6[0],
|
|
208
|
+
setIsTextOverflowSupport = _React$useState6[1];
|
|
209
|
+
|
|
210
|
+
var _React$useState7 = React.useState(false),
|
|
211
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
212
|
+
expanded = _React$useState8[0],
|
|
213
|
+
setExpanded = _React$useState8[1];
|
|
214
|
+
|
|
215
|
+
var _React$useState9 = React.useState(false),
|
|
216
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
217
|
+
isJsEllipsis = _React$useState10[0],
|
|
218
|
+
setIsJsEllipsis = _React$useState10[1];
|
|
219
|
+
|
|
220
|
+
var _React$useState11 = React.useState(false),
|
|
221
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
222
|
+
isNativeEllipsis = _React$useState12[0],
|
|
223
|
+
setIsNativeEllipsis = _React$useState12[1];
|
|
224
|
+
|
|
225
|
+
var _React$useState13 = React.useState(true),
|
|
226
|
+
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
227
|
+
isNativeVisible = _React$useState14[0],
|
|
228
|
+
setIsNativeVisible = _React$useState14[1];
|
|
229
|
+
|
|
230
|
+
var _useMergedConfig5 = useMergedConfig(ellipsis, {
|
|
231
|
+
expandable: false
|
|
232
|
+
}),
|
|
233
|
+
_useMergedConfig6 = _slicedToArray(_useMergedConfig5, 2),
|
|
234
|
+
enableEllipsis = _useMergedConfig6[0],
|
|
235
|
+
ellipsisConfig = _useMergedConfig6[1];
|
|
236
|
+
|
|
237
|
+
var mergedEnableEllipsis = enableEllipsis && !expanded; // Shared prop to reduce bundle size
|
|
238
|
+
|
|
239
|
+
var _ellipsisConfig$rows = ellipsisConfig.rows,
|
|
240
|
+
rows = _ellipsisConfig$rows === void 0 ? 1 : _ellipsisConfig$rows;
|
|
241
|
+
var needMeasureEllipsis = React.useMemo(function () {
|
|
242
|
+
return (// Disable ellipsis
|
|
243
|
+
!mergedEnableEllipsis || // Provide suffix
|
|
244
|
+
ellipsisConfig.suffix !== undefined || ellipsisConfig.onEllipsis || // Can't use css ellipsis since we need to provide the place for button
|
|
245
|
+
ellipsisConfig.expandable || enableEdit || enableCopy
|
|
246
|
+
);
|
|
247
|
+
}, [mergedEnableEllipsis, ellipsisConfig, enableEdit, enableCopy]);
|
|
248
|
+
useIsomorphicLayoutEffect(function () {
|
|
249
|
+
if (enableEllipsis && !needMeasureEllipsis) {
|
|
250
|
+
setIsLineClampSupport(isStyleSupport('webkitLineClamp'));
|
|
251
|
+
setIsTextOverflowSupport(isStyleSupport('textOverflow'));
|
|
252
|
+
}
|
|
253
|
+
}, [needMeasureEllipsis, enableEllipsis]);
|
|
254
|
+
var cssEllipsis = React.useMemo(function () {
|
|
255
|
+
if (needMeasureEllipsis) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (rows === 1) {
|
|
260
|
+
return isTextOverflowSupport;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return isLineClampSupport;
|
|
264
|
+
}, [needMeasureEllipsis, isTextOverflowSupport, isLineClampSupport]);
|
|
265
|
+
var isMergedEllipsis = mergedEnableEllipsis && (cssEllipsis ? isNativeEllipsis : isJsEllipsis);
|
|
266
|
+
var cssTextOverflow = mergedEnableEllipsis && rows === 1 && cssEllipsis;
|
|
267
|
+
var cssLineClamp = mergedEnableEllipsis && rows > 1 && cssEllipsis; // >>>>> Expand
|
|
268
|
+
|
|
269
|
+
var onExpandClick = function onExpandClick(e) {
|
|
270
|
+
var _a;
|
|
271
|
+
|
|
272
|
+
setExpanded(true);
|
|
273
|
+
(_a = ellipsisConfig.onExpand) === null || _a === void 0 ? void 0 : _a.call(ellipsisConfig, e);
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
var _React$useState15 = React.useState(0),
|
|
277
|
+
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
|
278
|
+
ellipsisWidth = _React$useState16[0],
|
|
279
|
+
setEllipsisWidth = _React$useState16[1];
|
|
280
|
+
|
|
281
|
+
var onResize = function onResize(_ref2) {
|
|
282
|
+
var offsetWidth = _ref2.offsetWidth;
|
|
283
|
+
setEllipsisWidth(offsetWidth);
|
|
284
|
+
}; // >>>>> JS Ellipsis
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
var onJsEllipsis = function onJsEllipsis(jsEllipsis) {
|
|
288
|
+
var _a;
|
|
289
|
+
|
|
290
|
+
setIsJsEllipsis(jsEllipsis); // Trigger if changed
|
|
291
|
+
|
|
292
|
+
if (isJsEllipsis !== jsEllipsis) {
|
|
293
|
+
(_a = ellipsisConfig.onEllipsis) === null || _a === void 0 ? void 0 : _a.call(ellipsisConfig, jsEllipsis);
|
|
294
|
+
}
|
|
295
|
+
}; // >>>>> Native ellipsis
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
React.useEffect(function () {
|
|
299
|
+
var textEle = typographyRef.current;
|
|
300
|
+
|
|
301
|
+
if (enableEllipsis && cssEllipsis && textEle) {
|
|
302
|
+
var currentEllipsis = cssLineClamp ? textEle.offsetHeight < textEle.scrollHeight : textEle.offsetWidth < textEle.scrollWidth;
|
|
303
|
+
|
|
304
|
+
if (isNativeEllipsis !== currentEllipsis) {
|
|
305
|
+
setIsNativeEllipsis(currentEllipsis);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}, [enableEllipsis, cssEllipsis, children, cssLineClamp, isNativeVisible]); // https://github.com/ant-design/ant-design/issues/36786
|
|
309
|
+
// Use IntersectionObserver to check if element is invisible
|
|
310
|
+
|
|
311
|
+
React.useEffect(function () {
|
|
312
|
+
var textEle = typographyRef.current;
|
|
313
|
+
|
|
314
|
+
if (typeof IntersectionObserver === 'undefined' || !textEle || !cssEllipsis || !mergedEnableEllipsis) {
|
|
315
|
+
// @ts-ignore
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
/* eslint-disable-next-line compat/compat */
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
var observer = new IntersectionObserver(function () {
|
|
322
|
+
setIsNativeVisible(!!textEle.offsetParent);
|
|
323
|
+
});
|
|
324
|
+
observer.observe(textEle);
|
|
325
|
+
return function () {
|
|
326
|
+
observer.disconnect();
|
|
327
|
+
};
|
|
328
|
+
}, [cssEllipsis, mergedEnableEllipsis]); // ========================== Tooltip ===========================
|
|
329
|
+
|
|
330
|
+
var tooltipProps = {};
|
|
331
|
+
|
|
332
|
+
if (ellipsisConfig.tooltip === true) {
|
|
333
|
+
tooltipProps = {
|
|
334
|
+
title: children
|
|
335
|
+
};
|
|
336
|
+
} else if ( /*#__PURE__*/React.isValidElement(ellipsisConfig.tooltip)) {
|
|
337
|
+
tooltipProps = {
|
|
338
|
+
title: ellipsisConfig.tooltip
|
|
339
|
+
};
|
|
340
|
+
} else if (_typeof(ellipsisConfig.tooltip) === 'object') {
|
|
341
|
+
tooltipProps = Object.assign({
|
|
342
|
+
title: children
|
|
343
|
+
}, ellipsisConfig.tooltip);
|
|
344
|
+
} else {
|
|
345
|
+
tooltipProps = {
|
|
346
|
+
title: ellipsisConfig.tooltip
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
var topAriaLabel = React.useMemo(function () {
|
|
351
|
+
var isValid = function isValid(val) {
|
|
352
|
+
return ['string', 'number'].includes(_typeof(val));
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
if (!enableEllipsis || cssEllipsis) {
|
|
356
|
+
return undefined;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (isValid(children)) {
|
|
360
|
+
return children;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (isValid(title)) {
|
|
364
|
+
return title;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (isValid(tooltipProps.title)) {
|
|
368
|
+
return tooltipProps.title;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return undefined;
|
|
372
|
+
}, [enableEllipsis, cssEllipsis, title, tooltipProps.title, isMergedEllipsis]); // =========================== Render ===========================
|
|
373
|
+
// >>>>>>>>>>> Editing input
|
|
374
|
+
|
|
375
|
+
if (editing) {
|
|
376
|
+
return /*#__PURE__*/React.createElement(Editable, {
|
|
377
|
+
value: typeof children === 'string' ? children : '',
|
|
378
|
+
onSave: onEditChange,
|
|
379
|
+
onCancel: onEditCancel,
|
|
380
|
+
onEnd: editConfig.onEnd,
|
|
381
|
+
prefixCls: prefixCls,
|
|
382
|
+
className: className,
|
|
383
|
+
style: style,
|
|
384
|
+
direction: direction,
|
|
385
|
+
component: component,
|
|
386
|
+
maxLength: editConfig.maxLength,
|
|
387
|
+
autoSize: editConfig.autoSize,
|
|
388
|
+
enterIcon: editConfig.enterIcon
|
|
389
|
+
});
|
|
390
|
+
} // >>>>>>>>>>> Typography
|
|
391
|
+
// Expand
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
var renderExpand = function renderExpand() {
|
|
395
|
+
var expandable = ellipsisConfig.expandable,
|
|
396
|
+
symbol = ellipsisConfig.symbol;
|
|
397
|
+
if (!expandable) return null;
|
|
398
|
+
var expandContent;
|
|
399
|
+
|
|
400
|
+
if (symbol) {
|
|
401
|
+
expandContent = symbol;
|
|
402
|
+
} else {
|
|
403
|
+
expandContent = textLocale.expand;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
407
|
+
key: "expand",
|
|
408
|
+
className: "".concat(prefixCls, "-expand"),
|
|
409
|
+
onClick: onExpandClick,
|
|
410
|
+
"aria-label": textLocale.expand
|
|
411
|
+
}, expandContent);
|
|
412
|
+
}; // Edit
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
var renderEdit = function renderEdit() {
|
|
416
|
+
// @ts-ignore
|
|
417
|
+
if (!enableEdit) return;
|
|
418
|
+
var icon = editConfig.icon,
|
|
419
|
+
tooltip = editConfig.tooltip;
|
|
420
|
+
var editTitle = toArray(tooltip)[0] || textLocale.edit;
|
|
421
|
+
var ariaLabel = typeof editTitle === 'string' ? editTitle : '';
|
|
422
|
+
return triggerType.includes('icon') ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
423
|
+
key: "edit",
|
|
424
|
+
title: tooltip === false ? '' : editTitle
|
|
425
|
+
}, /*#__PURE__*/React.createElement(TransButton, {
|
|
426
|
+
ref: editIconRef,
|
|
427
|
+
className: "".concat(prefixCls, "-edit"),
|
|
428
|
+
onClick: onEditClick,
|
|
429
|
+
"aria-label": ariaLabel
|
|
430
|
+
}, icon || /*#__PURE__*/React.createElement(EditOutlined, {
|
|
431
|
+
role: "button"
|
|
432
|
+
}))) : null;
|
|
433
|
+
}; // Copy
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
var renderCopy = function renderCopy() {
|
|
437
|
+
// @ts-ignore
|
|
438
|
+
if (!enableCopy) return;
|
|
439
|
+
var tooltips = copyConfig.tooltips,
|
|
440
|
+
icon = copyConfig.icon;
|
|
441
|
+
var tooltipNodes = toList(tooltips);
|
|
442
|
+
var iconNodes = toList(icon);
|
|
443
|
+
var copyTitle = copied ? getNode(tooltipNodes[1], textLocale.copied) : getNode(tooltipNodes[0], textLocale.copy);
|
|
444
|
+
var systemStr = copied ? textLocale.copied : textLocale.copy;
|
|
445
|
+
var ariaLabel = typeof copyTitle === 'string' ? copyTitle : systemStr;
|
|
446
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
447
|
+
key: "copy",
|
|
448
|
+
title: copyTitle
|
|
449
|
+
}, /*#__PURE__*/React.createElement(TransButton, {
|
|
450
|
+
className: classNames("".concat(prefixCls, "-copy"), copied && "".concat(prefixCls, "-copy-success")),
|
|
451
|
+
onClick: onCopyClick,
|
|
452
|
+
"aria-label": ariaLabel
|
|
453
|
+
}, copied ? getNode(iconNodes[1], /*#__PURE__*/React.createElement(CheckOutlined, null), true) : getNode(iconNodes[0], /*#__PURE__*/React.createElement(CopyOutlined, null), true)));
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
var renderOperations = function renderOperations(renderExpanded) {
|
|
457
|
+
return [renderExpanded && renderExpand(), renderEdit(), renderCopy()];
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
var renderEllipsis = function renderEllipsis(needEllipsis) {
|
|
461
|
+
return [needEllipsis && /*#__PURE__*/React.createElement("span", {
|
|
462
|
+
"aria-hidden": true,
|
|
463
|
+
key: "ellipsis"
|
|
464
|
+
}, ELLIPSIS_STR), ellipsisConfig.suffix, renderOperations(needEllipsis)];
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
return /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
468
|
+
onResize: onResize,
|
|
469
|
+
disabled: !mergedEnableEllipsis || cssEllipsis
|
|
470
|
+
}, function (resizeRef) {
|
|
471
|
+
var _classNames;
|
|
472
|
+
|
|
473
|
+
return /*#__PURE__*/React.createElement(EllipsisTooltip, {
|
|
474
|
+
tooltipProps: tooltipProps,
|
|
475
|
+
enabledEllipsis: mergedEnableEllipsis,
|
|
476
|
+
isEllipsis: isMergedEllipsis
|
|
477
|
+
}, /*#__PURE__*/React.createElement(Typography, Object.assign({
|
|
478
|
+
className: classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(type), type), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames, "".concat(prefixCls, "-ellipsis"), enableEllipsis), _defineProperty(_classNames, "".concat(prefixCls, "-single-line"), mergedEnableEllipsis && rows === 1), _defineProperty(_classNames, "".concat(prefixCls, "-ellipsis-single-line"), cssTextOverflow), _defineProperty(_classNames, "".concat(prefixCls, "-ellipsis-multiple-line"), cssLineClamp), _classNames), className),
|
|
479
|
+
style: Object.assign(Object.assign({}, style), {
|
|
480
|
+
WebkitLineClamp: cssLineClamp ? rows : undefined
|
|
481
|
+
}),
|
|
482
|
+
component: component,
|
|
483
|
+
ref: composeRef(resizeRef, typographyRef, ref),
|
|
484
|
+
direction: direction,
|
|
485
|
+
onClick: triggerType.includes('text') ? onEditClick : null,
|
|
486
|
+
"aria-label": topAriaLabel,
|
|
487
|
+
title: title
|
|
488
|
+
}, textProps), /*#__PURE__*/React.createElement(Ellipsis, {
|
|
489
|
+
enabledMeasure: mergedEnableEllipsis && !cssEllipsis,
|
|
490
|
+
text: children,
|
|
491
|
+
rows: rows,
|
|
492
|
+
width: ellipsisWidth,
|
|
493
|
+
onEllipsis: onJsEllipsis
|
|
494
|
+
}, function (node, needEllipsis) {
|
|
495
|
+
var renderNode = node;
|
|
496
|
+
|
|
497
|
+
if (node.length && needEllipsis && topAriaLabel) {
|
|
498
|
+
renderNode = /*#__PURE__*/React.createElement("span", {
|
|
499
|
+
key: "show-content",
|
|
500
|
+
"aria-hidden": true
|
|
501
|
+
}, renderNode);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
var wrappedContext = wrapperDecorations(props, /*#__PURE__*/React.createElement(React.Fragment, null, renderNode, renderEllipsis(needEllipsis)));
|
|
505
|
+
return wrappedContext;
|
|
506
|
+
})));
|
|
507
|
+
});
|
|
508
|
+
});
|
|
509
|
+
export default Base;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AutoSizeType } from 'rc-textarea/lib/ResizableTextArea';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { DirectionType } from 'antd/es/config-provider';
|
|
4
|
+
interface EditableProps {
|
|
5
|
+
prefixCls?: string;
|
|
6
|
+
value: string;
|
|
7
|
+
['aria-label']?: string;
|
|
8
|
+
onSave: (value: string) => void;
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
onEnd?: () => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
direction?: DirectionType;
|
|
14
|
+
maxLength?: number;
|
|
15
|
+
autoSize?: boolean | AutoSizeType;
|
|
16
|
+
enterIcon?: React.ReactNode;
|
|
17
|
+
component?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const Editable: React.FC<EditableProps>;
|
|
20
|
+
export default Editable;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import EnterOutlined from '@ant-design/icons/EnterOutlined';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import KeyCode from 'rc-util/lib/KeyCode';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { Input } from 'linkmore-design';
|
|
8
|
+
import { cloneElement } from '../_util/reactNode';
|
|
9
|
+
var TextArea = Input.TextArea;
|
|
10
|
+
|
|
11
|
+
var Editable = function Editable(_ref) {
|
|
12
|
+
var prefixCls = _ref.prefixCls,
|
|
13
|
+
ariaLabel = _ref['aria-label'],
|
|
14
|
+
className = _ref.className,
|
|
15
|
+
style = _ref.style,
|
|
16
|
+
direction = _ref.direction,
|
|
17
|
+
maxLength = _ref.maxLength,
|
|
18
|
+
_ref$autoSize = _ref.autoSize,
|
|
19
|
+
autoSize = _ref$autoSize === void 0 ? true : _ref$autoSize,
|
|
20
|
+
value = _ref.value,
|
|
21
|
+
onSave = _ref.onSave,
|
|
22
|
+
onCancel = _ref.onCancel,
|
|
23
|
+
onEnd = _ref.onEnd,
|
|
24
|
+
component = _ref.component,
|
|
25
|
+
_ref$enterIcon = _ref.enterIcon,
|
|
26
|
+
enterIcon = _ref$enterIcon === void 0 ? /*#__PURE__*/React.createElement(EnterOutlined, null) : _ref$enterIcon;
|
|
27
|
+
var ref = React.useRef();
|
|
28
|
+
var inComposition = React.useRef(false);
|
|
29
|
+
var lastKeyCode = React.useRef();
|
|
30
|
+
|
|
31
|
+
var _React$useState = React.useState(value),
|
|
32
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
33
|
+
current = _React$useState2[0],
|
|
34
|
+
setCurrent = _React$useState2[1];
|
|
35
|
+
|
|
36
|
+
React.useEffect(function () {
|
|
37
|
+
setCurrent(value);
|
|
38
|
+
}, [value]);
|
|
39
|
+
React.useEffect(function () {
|
|
40
|
+
if (ref.current && ref.current.resizableTextArea) {
|
|
41
|
+
var textArea = ref.current.resizableTextArea.textArea;
|
|
42
|
+
textArea.focus();
|
|
43
|
+
var length = textArea.value.length;
|
|
44
|
+
textArea.setSelectionRange(length, length);
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
48
|
+
var onChange = function onChange(_ref2) {
|
|
49
|
+
var target = _ref2.target;
|
|
50
|
+
setCurrent(target.value.replace(/[\n\r]/g, ''));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var onCompositionStart = function onCompositionStart() {
|
|
54
|
+
inComposition.current = true;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var onCompositionEnd = function onCompositionEnd() {
|
|
58
|
+
inComposition.current = false;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var onKeyDown = function onKeyDown(_ref3) {
|
|
62
|
+
var keyCode = _ref3.keyCode;
|
|
63
|
+
// We don't record keyCode when IME is using
|
|
64
|
+
if (inComposition.current) return;
|
|
65
|
+
lastKeyCode.current = keyCode;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var confirmChange = function confirmChange() {
|
|
69
|
+
onSave(current.trim());
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var onKeyUp = function onKeyUp(_ref4) {
|
|
73
|
+
var keyCode = _ref4.keyCode,
|
|
74
|
+
ctrlKey = _ref4.ctrlKey,
|
|
75
|
+
altKey = _ref4.altKey,
|
|
76
|
+
metaKey = _ref4.metaKey,
|
|
77
|
+
shiftKey = _ref4.shiftKey;
|
|
78
|
+
|
|
79
|
+
// Check if it's a real key
|
|
80
|
+
if (lastKeyCode.current === keyCode && !inComposition.current && !ctrlKey && !altKey && !metaKey && !shiftKey) {
|
|
81
|
+
if (keyCode === KeyCode.ENTER) {
|
|
82
|
+
confirmChange();
|
|
83
|
+
onEnd === null || onEnd === void 0 ? void 0 : onEnd();
|
|
84
|
+
} else if (keyCode === KeyCode.ESC) {
|
|
85
|
+
onCancel();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var onBlur = function onBlur() {
|
|
91
|
+
confirmChange();
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
var textClassName = component ? "".concat(prefixCls, "-").concat(component) : '';
|
|
95
|
+
var textAreaClassName = classNames(prefixCls, "".concat(prefixCls, "-edit-content"), _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), className, textClassName);
|
|
96
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: textAreaClassName,
|
|
98
|
+
style: style
|
|
99
|
+
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
100
|
+
ref: ref,
|
|
101
|
+
maxLength: maxLength,
|
|
102
|
+
value: current,
|
|
103
|
+
onChange: onChange,
|
|
104
|
+
onKeyDown: onKeyDown,
|
|
105
|
+
onKeyUp: onKeyUp,
|
|
106
|
+
onCompositionStart: onCompositionStart,
|
|
107
|
+
onCompositionEnd: onCompositionEnd,
|
|
108
|
+
onBlur: onBlur,
|
|
109
|
+
"aria-label": ariaLabel,
|
|
110
|
+
rows: 1,
|
|
111
|
+
autoSize: autoSize
|
|
112
|
+
}), enterIcon !== null ? cloneElement(enterIcon, {
|
|
113
|
+
className: "".concat(prefixCls, "-edit-content-confirm")
|
|
114
|
+
}) : null);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export default Editable;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { BlockProps } from './Base';
|
|
3
|
+
export interface LinkProps extends BlockProps, Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'type'> {
|
|
4
|
+
ellipsis?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLElement>>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
+
|
|
3
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
|
|
6
|
+
for (var p in s) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
11
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
import warning from '../_util/warning';
|
|
18
|
+
import Base from './Base';
|
|
19
|
+
|
|
20
|
+
var Link = function Link(_a, ref) {
|
|
21
|
+
var ellipsis = _a.ellipsis,
|
|
22
|
+
rel = _a.rel,
|
|
23
|
+
restProps = __rest(_a, ["ellipsis", "rel"]);
|
|
24
|
+
|
|
25
|
+
warning(_typeof(ellipsis) !== 'object', 'Typography.Link', '`ellipsis` only supports boolean value.');
|
|
26
|
+
var baseRef = React.useRef(null);
|
|
27
|
+
React.useImperativeHandle(ref, function () {
|
|
28
|
+
return baseRef.current;
|
|
29
|
+
});
|
|
30
|
+
var mergedProps = Object.assign(Object.assign({}, restProps), {
|
|
31
|
+
rel: rel === undefined && restProps.target === '_blank' ? 'noopener noreferrer' : rel
|
|
32
|
+
}); // https://github.com/ant-design/ant-design/issues/26622
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
|
|
35
|
+
delete mergedProps.navigate;
|
|
36
|
+
return /*#__PURE__*/React.createElement(Base, Object.assign({}, mergedProps, {
|
|
37
|
+
ref: baseRef,
|
|
38
|
+
ellipsis: !!ellipsis,
|
|
39
|
+
component: "a"
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default /*#__PURE__*/React.forwardRef(Link);
|