@dtjoy/dt-design 1.0.0 → 1.0.2

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.
Files changed (161) hide show
  1. package/esm/_util/gapSize.d.ts +3 -0
  2. package/esm/_util/gapSize.js +10 -0
  3. package/esm/_util/hooks/index.d.ts +1 -0
  4. package/esm/_util/hooks/index.js +1 -0
  5. package/esm/_util/hooks/useOrientation.d.ts +2 -0
  6. package/esm/_util/hooks/useOrientation.js +19 -0
  7. package/esm/_util/isNonNullable.d.ts +2 -0
  8. package/esm/_util/isNonNullable.js +4 -0
  9. package/esm/_util/type.d.ts +2 -1
  10. package/esm/blockHeader/index.d.ts +1 -1
  11. package/esm/blockHeader/index.js +13 -10
  12. package/esm/blockHeader/style/index.d.ts +2 -0
  13. package/esm/blockHeader/style/index.js +2 -0
  14. package/esm/blockHeader/{style.less → style/index.less} +143 -141
  15. package/esm/button/index.d.ts +10 -0
  16. package/esm/button/index.js +29 -0
  17. package/esm/button/style/index.d.ts +2 -0
  18. package/esm/button/style/index.js +2 -0
  19. package/esm/button/style/index.less +134 -0
  20. package/esm/button/style/mixin.less +47 -0
  21. package/esm/collapsible/index.d.ts +97 -0
  22. package/esm/collapsible/index.js +234 -0
  23. package/esm/collapsible/style/index.d.ts +1 -0
  24. package/esm/collapsible/style/index.js +1 -0
  25. package/esm/collapsible/style/index.less +24 -0
  26. package/esm/collapsibleActionItems/index.d.ts +24 -0
  27. package/esm/collapsibleActionItems/index.js +74 -0
  28. package/esm/collapsibleActionItems/style/index.d.ts +2 -0
  29. package/esm/collapsibleActionItems/style/index.js +2 -0
  30. package/esm/collapsibleActionItems/style/index.less +7 -0
  31. package/esm/flex/index.d.ts +7 -0
  32. package/esm/flex/index.js +62 -0
  33. package/esm/flex/interface.d.ts +16 -0
  34. package/esm/flex/interface.js +1 -0
  35. package/esm/flex/style/index.d.ts +2 -0
  36. package/esm/flex/style/index.js +2 -0
  37. package/esm/flex/style/index.less +77 -0
  38. package/esm/flex/utils.d.ts +7 -0
  39. package/esm/flex/utils.js +33 -0
  40. package/esm/index.d.ts +10 -1
  41. package/esm/index.js +8 -7
  42. package/esm/resize/index.d.ts +8 -0
  43. package/esm/resize/index.js +29 -0
  44. package/esm/splitter/Panel.d.ts +7 -0
  45. package/esm/splitter/Panel.js +38 -0
  46. package/esm/splitter/SplitBar.d.ts +24 -0
  47. package/esm/splitter/SplitBar.js +185 -0
  48. package/esm/splitter/Splitter.d.ts +5 -0
  49. package/esm/splitter/Splitter.js +215 -0
  50. package/esm/splitter/hooks/sizeUtil.d.ts +3 -0
  51. package/esm/splitter/hooks/sizeUtil.js +63 -0
  52. package/esm/splitter/hooks/useItems.d.ts +14 -0
  53. package/esm/splitter/hooks/useItems.js +44 -0
  54. package/esm/splitter/hooks/useResizable.d.ts +10 -0
  55. package/esm/splitter/hooks/useResizable.js +73 -0
  56. package/esm/splitter/hooks/useResize.d.ts +6 -0
  57. package/esm/splitter/hooks/useResize.js +158 -0
  58. package/esm/splitter/hooks/useSizes.d.ts +4 -0
  59. package/esm/splitter/hooks/useSizes.js +80 -0
  60. package/esm/splitter/index.d.ts +8 -0
  61. package/esm/splitter/index.js +5 -0
  62. package/esm/splitter/interface.d.ts +68 -0
  63. package/esm/splitter/interface.js +1 -0
  64. package/esm/splitter/style/index.d.ts +2 -0
  65. package/esm/splitter/style/index.js +2 -0
  66. package/esm/splitter/style/index.less +312 -0
  67. package/esm/statusTag/index.d.ts +28 -0
  68. package/esm/statusTag/index.js +122 -0
  69. package/esm/statusTag/style/index.d.ts +2 -0
  70. package/esm/statusTag/style/index.js +2 -0
  71. package/esm/statusTag/style/index.less +70 -0
  72. package/esm/statusTag/style/mixin.less +39 -0
  73. package/esm/style/index.d.ts +1 -0
  74. package/esm/style/index.js +1 -0
  75. package/esm/style/index.less +1 -0
  76. package/esm/style/mixins/index.less +0 -0
  77. package/esm/style/themes/index.less +2 -0
  78. package/esm/style/themes/variable.less +1 -0
  79. package/lib/_util/gapSize.d.ts +3 -0
  80. package/lib/_util/gapSize.js +17 -0
  81. package/lib/_util/hooks/index.d.ts +1 -0
  82. package/lib/_util/hooks/index.js +16 -0
  83. package/lib/_util/hooks/useOrientation.d.ts +2 -0
  84. package/lib/_util/hooks/useOrientation.js +26 -0
  85. package/lib/_util/isNonNullable.d.ts +2 -0
  86. package/lib/_util/isNonNullable.js +10 -0
  87. package/lib/_util/type.d.ts +2 -1
  88. package/lib/blockHeader/index.d.ts +1 -1
  89. package/lib/blockHeader/index.js +13 -11
  90. package/lib/blockHeader/style/index.d.ts +2 -0
  91. package/lib/blockHeader/style/index.js +4 -0
  92. package/lib/blockHeader/{style.less → style/index.less} +143 -141
  93. package/lib/button/index.d.ts +10 -0
  94. package/lib/button/index.js +33 -0
  95. package/lib/button/style/index.d.ts +2 -0
  96. package/lib/button/style/index.js +4 -0
  97. package/lib/button/style/index.less +134 -0
  98. package/lib/button/style/mixin.less +47 -0
  99. package/lib/collapsible/index.d.ts +97 -0
  100. package/lib/collapsible/index.js +199 -0
  101. package/lib/collapsible/style/index.d.ts +1 -0
  102. package/lib/collapsible/style/index.js +3 -0
  103. package/lib/collapsible/style/index.less +24 -0
  104. package/lib/collapsibleActionItems/index.d.ts +24 -0
  105. package/lib/collapsibleActionItems/index.js +68 -0
  106. package/lib/collapsibleActionItems/style/index.d.ts +2 -0
  107. package/lib/collapsibleActionItems/style/index.js +4 -0
  108. package/lib/collapsibleActionItems/style/index.less +7 -0
  109. package/lib/flex/index.d.ts +7 -0
  110. package/lib/flex/index.js +60 -0
  111. package/lib/flex/interface.d.ts +16 -0
  112. package/lib/flex/interface.js +5 -0
  113. package/lib/flex/style/index.d.ts +2 -0
  114. package/lib/flex/style/index.js +4 -0
  115. package/lib/flex/style/index.less +77 -0
  116. package/lib/flex/utils.d.ts +7 -0
  117. package/lib/flex/utils.js +39 -0
  118. package/lib/index.d.ts +10 -1
  119. package/lib/index.js +72 -1
  120. package/lib/resize/index.d.ts +8 -0
  121. package/lib/resize/index.js +38 -0
  122. package/lib/splitter/Panel.d.ts +7 -0
  123. package/lib/splitter/Panel.js +44 -0
  124. package/lib/splitter/SplitBar.d.ts +24 -0
  125. package/lib/splitter/SplitBar.js +179 -0
  126. package/lib/splitter/Splitter.d.ts +5 -0
  127. package/lib/splitter/Splitter.js +202 -0
  128. package/lib/splitter/hooks/sizeUtil.d.ts +3 -0
  129. package/lib/splitter/hooks/sizeUtil.js +56 -0
  130. package/lib/splitter/hooks/useItems.d.ts +14 -0
  131. package/lib/splitter/hooks/useItems.js +46 -0
  132. package/lib/splitter/hooks/useResizable.d.ts +10 -0
  133. package/lib/splitter/hooks/useResizable.js +83 -0
  134. package/lib/splitter/hooks/useResize.d.ts +6 -0
  135. package/lib/splitter/hooks/useResize.js +142 -0
  136. package/lib/splitter/hooks/useSizes.d.ts +4 -0
  137. package/lib/splitter/hooks/useSizes.js +62 -0
  138. package/lib/splitter/index.d.ts +8 -0
  139. package/lib/splitter/index.js +12 -0
  140. package/lib/splitter/interface.d.ts +68 -0
  141. package/lib/splitter/interface.js +5 -0
  142. package/lib/splitter/style/index.d.ts +2 -0
  143. package/lib/splitter/style/index.js +4 -0
  144. package/lib/splitter/style/index.less +312 -0
  145. package/lib/statusTag/index.d.ts +28 -0
  146. package/lib/statusTag/index.js +125 -0
  147. package/lib/statusTag/style/index.d.ts +2 -0
  148. package/lib/statusTag/style/index.js +4 -0
  149. package/lib/statusTag/style/index.less +70 -0
  150. package/lib/statusTag/style/mixin.less +39 -0
  151. package/lib/style/index.d.ts +1 -0
  152. package/lib/style/index.js +3 -0
  153. package/lib/style/index.less +1 -0
  154. package/lib/style/mixins/index.less +0 -0
  155. package/lib/style/themes/index.less +2 -0
  156. package/lib/style/themes/variable.less +1 -0
  157. package/package.json +142 -141
  158. package/esm/styles/entry.less +0 -6
  159. package/esm/styles/variables.less +0 -1
  160. package/lib/styles/entry.less +0 -6
  161. package/lib/styles/variables.less +0 -1
@@ -0,0 +1,80 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React from 'react';
8
+ import { autoPtgSizes } from "./sizeUtil";
9
+ export function getPtg(str) {
10
+ return Number(str.slice(0, -1)) / 100;
11
+ }
12
+ function isPtg(itemSize) {
13
+ return typeof itemSize === 'string' && itemSize.endsWith('%');
14
+ }
15
+ export default function useSizes(items, containerSize) {
16
+ var propSizes = items.map(function (item) {
17
+ return item.size;
18
+ });
19
+ var itemsCount = items.length;
20
+ var mergedContainerSize = containerSize || 0;
21
+ var ptg2px = function ptg2px(ptg) {
22
+ return ptg * mergedContainerSize;
23
+ };
24
+ var _React$useState = React.useState(function () {
25
+ return items.map(function (item) {
26
+ return item.defaultSize;
27
+ });
28
+ }),
29
+ _React$useState2 = _slicedToArray(_React$useState, 2),
30
+ innerSizes = _React$useState2[0],
31
+ setInnerSizes = _React$useState2[1];
32
+ var sizes = React.useMemo(function () {
33
+ var mergedSizes = [];
34
+ for (var i = 0; i < itemsCount; i += 1) {
35
+ var _propSizes$i;
36
+ mergedSizes[i] = (_propSizes$i = propSizes[i]) !== null && _propSizes$i !== void 0 ? _propSizes$i : innerSizes[i];
37
+ }
38
+ return mergedSizes;
39
+ }, [itemsCount, innerSizes, propSizes]);
40
+ var postPercentMinSizes = React.useMemo(function () {
41
+ return items.map(function (item) {
42
+ if (isPtg(item.min)) {
43
+ return getPtg(item.min);
44
+ }
45
+ return (item.min || 0) / mergedContainerSize;
46
+ });
47
+ }, [items, mergedContainerSize]);
48
+ var postPercentMaxSizes = React.useMemo(function () {
49
+ return items.map(function (item) {
50
+ if (isPtg(item.max)) {
51
+ return getPtg(item.max);
52
+ }
53
+ return (item.max || mergedContainerSize) / mergedContainerSize;
54
+ });
55
+ }, [items, mergedContainerSize]);
56
+ var postPercentSizes = React.useMemo(function () {
57
+ var ptgList = [];
58
+ for (var i = 0; i < itemsCount; i += 1) {
59
+ var itemSize = sizes[i];
60
+ if (isPtg(itemSize)) {
61
+ ptgList[i] = getPtg(itemSize);
62
+ } else if (itemSize || itemSize === 0) {
63
+ var num = Number(itemSize);
64
+ if (!Number.isNaN(num)) {
65
+ ptgList[i] = num / mergedContainerSize;
66
+ }
67
+ } else {
68
+ ptgList[i] = undefined;
69
+ }
70
+ }
71
+ return autoPtgSizes(ptgList, postPercentMinSizes, postPercentMaxSizes);
72
+ }, [sizes, mergedContainerSize, postPercentMinSizes, postPercentMaxSizes]);
73
+ var postPxSizes = React.useMemo(function () {
74
+ return postPercentSizes.map(ptg2px);
75
+ }, [postPercentSizes, mergedContainerSize]);
76
+ var panelSizes = React.useMemo(function () {
77
+ return containerSize ? postPxSizes : sizes;
78
+ }, [postPxSizes, containerSize]);
79
+ return [panelSizes, postPxSizes, postPercentSizes, postPercentMinSizes, postPercentMaxSizes, setInnerSizes];
80
+ }
@@ -0,0 +1,8 @@
1
+ import Panel from './Panel';
2
+ import SplitterComp from './Splitter';
3
+ export type { SplitterProps } from './interface';
4
+ declare type CompoundedComponent = typeof SplitterComp & {
5
+ Panel: typeof Panel;
6
+ };
7
+ declare const Splitter: CompoundedComponent;
8
+ export default Splitter;
@@ -0,0 +1,5 @@
1
+ import Panel from "./Panel";
2
+ import SplitterComp from "./Splitter";
3
+ var Splitter = SplitterComp;
4
+ Splitter.Panel = Panel;
5
+ export default Splitter;
@@ -0,0 +1,68 @@
1
+ /// <reference types="react" />
2
+ import { ShowCollapsibleIconMode } from './SplitBar';
3
+ export interface SplitterProps {
4
+ prefixCls?: string;
5
+ className?: string;
6
+ style?: React.CSSProperties;
7
+ rootClassName?: string;
8
+ layout?: 'horizontal' | 'vertical';
9
+ onResizeStart?: (sizes: number[]) => void;
10
+ onResize?: (sizes: number[]) => void;
11
+ onResizeEnd?: (sizes: number[]) => void;
12
+ lazy?: boolean;
13
+ }
14
+ export interface PanelProps {
15
+ className?: string;
16
+ style?: React.CSSProperties;
17
+ min?: number | string;
18
+ max?: number | string;
19
+ size?: number | string;
20
+ collapsible?: boolean | {
21
+ start?: boolean;
22
+ end?: boolean;
23
+ showCollapsibleIcon?: ShowCollapsibleIconMode;
24
+ };
25
+ resizable?: boolean;
26
+ defaultSize?: number | string;
27
+ }
28
+ export interface InternalPanelProps extends PanelProps {
29
+ className?: string;
30
+ prefixCls?: string;
31
+ }
32
+ export interface UseResizeProps extends Pick<SplitterProps, 'onResize'> {
33
+ basicsState: number[];
34
+ items: PanelProps[];
35
+ panelsRef: React.RefObject<(HTMLDivElement | null)[]>;
36
+ reverse: boolean;
37
+ setBasicsState: React.Dispatch<React.SetStateAction<number[]>>;
38
+ }
39
+ export interface UseResize {
40
+ setSize: (data: {
41
+ size: number;
42
+ index: number;
43
+ }[]) => void;
44
+ setOffset: (offset: number, containerSize: number, index: number) => void;
45
+ }
46
+ export interface UseHandleProps extends Pick<SplitterProps, 'layout' | 'onResizeStart' | 'onResizeEnd'> {
47
+ basicsState: number[];
48
+ containerRef?: React.RefObject<HTMLDivElement | null>;
49
+ setOffset: UseResize['setOffset'];
50
+ setResizing: React.Dispatch<React.SetStateAction<boolean>>;
51
+ }
52
+ export interface UseHandle {
53
+ onStart: (x: number, y: number, index: number) => void;
54
+ }
55
+ export interface UseCollapsibleProps {
56
+ basicsState: number[];
57
+ collapsible?: PanelProps['collapsible'];
58
+ index: number;
59
+ reverse: boolean;
60
+ setSize?: UseResize['setSize'];
61
+ }
62
+ export interface UseCollapsible {
63
+ nextIcon: boolean;
64
+ overlap: boolean;
65
+ previousIcon: boolean;
66
+ onFold: (type: 'previous' | 'next') => void;
67
+ setOldBasics: () => void;
68
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import '../../style';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import "../../style";
2
+ import "./index.less";
@@ -0,0 +1,312 @@
1
+ @import '../../style/themes/index.less';
2
+
3
+ @splitter-prefix-cls: ~'@{ant-prefix}-splitter';
4
+
5
+ @splitter-resize-spinner-size: 20px;
6
+ @splitter-split-bar-draggable-size: @splitter-resize-spinner-size;
7
+ @splitter-split-bar-size: 2px;
8
+ @splitter-split-trigger-size: 6px;
9
+
10
+ @splitterBarPreviewOffsetVar: ~'@{splitter-prefix-cls}-bar-preview-offset';
11
+ @splitter-transform-x: ~'translateX(var(--@{splitterBarPreviewOffsetVar}))';
12
+ @splitter-transform-y: ~'translateY(var(--@{splitterBarPreviewOffsetVar}))';
13
+
14
+ .center-position() {
15
+ position: absolute;
16
+ top: 50%;
17
+ left: 50%;
18
+ transform: translate(-50%, -50%);
19
+ }
20
+
21
+ .@{splitter-prefix-cls} {
22
+ display: flex;
23
+ width: 100%;
24
+ height: 100%;
25
+ align-items: stretch;
26
+
27
+ & > .@{splitter-prefix-cls}-bar {
28
+ flex: none;
29
+ position: relative;
30
+ user-select: none;
31
+
32
+ .@{splitter-prefix-cls}-bar-dragger {
33
+ .center-position();
34
+ z-index: 1;
35
+ pointer-events: auto;
36
+
37
+ &::before {
38
+ content: '';
39
+ background: @item-hover-bg;
40
+ .center-position();
41
+ }
42
+
43
+ &::after {
44
+ content: '';
45
+ background: rgba(0, 0, 0, 0.15);
46
+ .center-position();
47
+ }
48
+
49
+ &:hover:not(.@{splitter-prefix-cls}-bar-dragger-active) {
50
+ &::before {
51
+ background: @item-active-bg;
52
+ }
53
+ }
54
+
55
+ &.@{splitter-prefix-cls}-bar-dragger-active {
56
+ z-index: 2;
57
+
58
+ &::before {
59
+ background: @item-active-bg;
60
+ }
61
+ }
62
+
63
+ &.@{splitter-prefix-cls}-bar-dragger-disabled {
64
+ z-index: 0;
65
+ cursor: default;
66
+
67
+ &,
68
+ &:hover,
69
+ &.@{splitter-prefix-cls}-bar-dragger-active {
70
+ &::before {
71
+ background: @disabled-bg;
72
+ }
73
+ }
74
+
75
+ &::after {
76
+ display: none;
77
+ }
78
+ }
79
+ }
80
+
81
+ .@{splitter-prefix-cls}-bar-collapse-bar {
82
+ .center-position();
83
+ z-index: @zindex-popover;
84
+ background: @item-hover-bg;
85
+ font-size: @font-size-base;
86
+ border-radius: @border-radius-base;
87
+ color: @text-color;
88
+ cursor: pointer;
89
+ opacity: 0;
90
+ display: flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+
94
+ &:hover {
95
+ background: @item-active-bg;
96
+ }
97
+
98
+ &:active {
99
+ background: @item-active-bg;
100
+ }
101
+ }
102
+
103
+ &:hover,
104
+ &:active {
105
+ .@{splitter-prefix-cls}-bar-collapse-bar-hover-only {
106
+ opacity: 1;
107
+ }
108
+ }
109
+
110
+ .@{splitter-prefix-cls}-bar-collapse-bar-hover-only {
111
+ @media (hover: none) {
112
+ opacity: 1;
113
+ }
114
+ }
115
+
116
+ .@{splitter-prefix-cls}-bar-collapse-bar-always-hidden {
117
+ display: none;
118
+ }
119
+
120
+ .@{splitter-prefix-cls}-bar-collapse-bar-always-visible {
121
+ opacity: 1;
122
+ }
123
+ }
124
+
125
+ .@{splitter-prefix-cls}-mask {
126
+ position: fixed;
127
+ z-index: 9999;
128
+ top: 0;
129
+ right: 0;
130
+ bottom: 0;
131
+ left: 0;
132
+ background: transparent;
133
+
134
+ &.@{splitter-prefix-cls}-mask-horizontal {
135
+ cursor: col-resize;
136
+ }
137
+
138
+ &.@{splitter-prefix-cls}-mask-vertical {
139
+ cursor: row-resize;
140
+ }
141
+ }
142
+
143
+ &.@{splitter-prefix-cls}-horizontal {
144
+ flex-direction: row;
145
+
146
+ & > .@{splitter-prefix-cls}-bar {
147
+ width: 0;
148
+
149
+ .@{splitter-prefix-cls}-bar-preview {
150
+ height: 100%;
151
+ width: @splitter-split-bar-size;
152
+ position: absolute;
153
+ background: @primary-color;
154
+ opacity: 0.2;
155
+ pointer-events: none;
156
+ transition: none;
157
+ z-index: 1;
158
+ display: none;
159
+
160
+ &.@{splitter-prefix-cls}-bar-preview-active {
161
+ display: block;
162
+
163
+ transform: @splitter-transform-x;
164
+ }
165
+ }
166
+
167
+ .@{splitter-prefix-cls}-bar-dragger {
168
+ cursor: col-resize;
169
+ height: 100%;
170
+ width: @splitter-split-trigger-size;
171
+
172
+ &::before {
173
+ height: 100%;
174
+ width: @splitter-split-bar-size;
175
+ }
176
+
177
+ &::after {
178
+ height: @splitter-split-bar-draggable-size;
179
+ width: @splitter-split-bar-size;
180
+ }
181
+ }
182
+
183
+ .@{splitter-prefix-cls}-bar-collapse-bar {
184
+ width: @font-size-sm;
185
+ height: @btn-height-sm;
186
+
187
+ &.@{splitter-prefix-cls}-bar-collapse-bar-start {
188
+ left: auto;
189
+ right: (@splitter-split-trigger-size / 2);
190
+ transform: translateY(-50%);
191
+ }
192
+
193
+ &.@{splitter-prefix-cls}-bar-collapse-bar-end {
194
+ left: (@splitter-split-trigger-size / 2);
195
+ right: auto;
196
+ transform: translateY(-50%);
197
+ }
198
+ }
199
+ }
200
+ }
201
+
202
+ &.@{splitter-prefix-cls}-vertical {
203
+ flex-direction: column;
204
+
205
+ & > .@{splitter-prefix-cls}-bar {
206
+ height: 0;
207
+
208
+ .@{splitter-prefix-cls}-bar-preview {
209
+ height: @splitter-split-bar-size;
210
+ width: 100%;
211
+ position: absolute;
212
+ background: @primary-color;
213
+ opacity: 0.2;
214
+ pointer-events: none;
215
+ transition: none;
216
+ z-index: 1;
217
+ display: none;
218
+
219
+ &.@{splitter-prefix-cls}-bar-preview-active {
220
+ display: block;
221
+ transform: @splitter-transform-y;
222
+ }
223
+ }
224
+
225
+ .@{splitter-prefix-cls}-bar-dragger {
226
+ cursor: row-resize;
227
+ width: 100%;
228
+ height: @splitter-split-trigger-size;
229
+
230
+ &::before {
231
+ width: 100%;
232
+ height: @splitter-split-bar-size;
233
+ }
234
+
235
+ &::after {
236
+ width: @splitter-split-bar-draggable-size;
237
+ height: @splitter-split-bar-size;
238
+ }
239
+ }
240
+
241
+ .@{splitter-prefix-cls}-bar-collapse-bar {
242
+ height: @font-size-sm;
243
+ width: @btn-height-sm;
244
+
245
+ &.@{splitter-prefix-cls}-bar-collapse-bar-start {
246
+ top: auto;
247
+ bottom: (@splitter-split-trigger-size / 2);
248
+ transform: translateX(-50%);
249
+ }
250
+
251
+ &.@{splitter-prefix-cls}-bar-collapse-bar-end {
252
+ top: (@splitter-split-trigger-size / 2);
253
+ bottom: auto;
254
+ transform: translateX(-50%);
255
+ }
256
+ }
257
+ }
258
+ }
259
+
260
+ .@{splitter-prefix-cls}-panel {
261
+ overflow: auto;
262
+ padding: 0 1px;
263
+ box-sizing: border-box;
264
+
265
+ &::-webkit-scrollbar {
266
+ width: 8px;
267
+ height: 8px;
268
+ }
269
+
270
+ &::-webkit-scrollbar-thumb {
271
+ background: @table-sticky-scroll-bar-bg;
272
+ border-radius: @table-sticky-scroll-bar-radius;
273
+ }
274
+
275
+ &.@{splitter-prefix-cls}-panel-hidden {
276
+ padding: 0;
277
+ overflow: hidden;
278
+ }
279
+
280
+ &:has(.@{splitter-prefix-cls}:only-child) {
281
+ overflow: hidden;
282
+ }
283
+ }
284
+
285
+ &.@{ant-prefix}-rtl.@{splitter-prefix-cls}-horizontal {
286
+ & > .@{splitter-prefix-cls}-bar {
287
+ .@{splitter-prefix-cls}-bar-collapse-previous {
288
+ right: 0;
289
+ left: unset;
290
+ }
291
+
292
+ .@{splitter-prefix-cls}-bar-collapse-next {
293
+ right: unset;
294
+ left: 0;
295
+ }
296
+ }
297
+ }
298
+
299
+ &.@{ant-prefix}-rtl.@{splitter-prefix-cls}-vertical {
300
+ & > .@{splitter-prefix-cls}-bar {
301
+ .@{splitter-prefix-cls}-bar-collapse-previous {
302
+ right: 50%;
303
+ left: unset;
304
+ }
305
+
306
+ .@{splitter-prefix-cls}-bar-collapse-next {
307
+ right: 50%;
308
+ left: unset;
309
+ }
310
+ }
311
+ }
312
+ }
@@ -0,0 +1,28 @@
1
+ import React, { CSSProperties, HTMLAttributes, ReactNode } from 'react';
2
+ import './style';
3
+ export declare const PRESET_COLOR_TYPES: readonly ["blue", "yellow", "green", "gray", "red", "purple", "cyan", "pink"];
4
+ export declare const STATUS_TAG_TYPES: readonly ["default", "outline", "fill"];
5
+ export declare type PresetColorType = (typeof PRESET_COLOR_TYPES)[number] | (string & {});
6
+ export declare type StatusTagType = (typeof STATUS_TAG_TYPES)[number];
7
+ export interface IStatusTagProps extends HTMLAttributes<HTMLDivElement> {
8
+ /** 状态类型 */
9
+ type?: StatusTagType;
10
+ /** 是否圆角 */
11
+ rounded?: boolean;
12
+ /** 状态颜色(支持预设值/自定义十六进制/RGB) */
13
+ color?: PresetColorType;
14
+ /** 是否加载中 */
15
+ loading?: boolean;
16
+ /** 自定义图标 */
17
+ icon?: ReactNode;
18
+ /** 背景颜色(仅fill类型生效),未设置时使用color的0.15透明度 */
19
+ background?: string;
20
+ /** 类名 */
21
+ className?: string;
22
+ /** 子节点 */
23
+ children?: ReactNode;
24
+ /** 自定义样式 */
25
+ style?: CSSProperties;
26
+ }
27
+ declare const StatusTag: React.FC<IStatusTagProps>;
28
+ export default StatusTag;
@@ -0,0 +1,122 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["className", "type", "icon", "color", "loading", "rounded", "background", "style", "children"];
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
+ import React, { useMemo } from 'react';
12
+ import { SpinOutlined } from '@dtinsight/react-icons';
13
+ import { Spin } from 'antd';
14
+ import { globalConfig } from 'antd/es/config-provider';
15
+ import classNames from 'classnames';
16
+ import "./style";
17
+ export var PRESET_COLOR_TYPES = Object.freeze(['blue', 'yellow', 'green', 'gray', 'red', 'purple', 'cyan', 'pink']);
18
+ export var STATUS_TAG_TYPES = Object.freeze(['default', 'outline', 'fill']);
19
+ var DEFAULT_OPACITY = 0.15;
20
+ /**
21
+ * 校验是否为预设颜色
22
+ * @param color 待校验颜色值
23
+ */
24
+ function isPresetColor(color) {
25
+ if (!color || typeof color !== 'string') return false;
26
+ return PRESET_COLOR_TYPES.includes(color);
27
+ }
28
+
29
+ /**
30
+ * 计算颜色的透明版本
31
+ * @param color 原始颜色(支持hex/rgb/rgba)
32
+ * @param opacity 透明度(默认0.15)
33
+ */
34
+ function calculateTransparentColor(color) {
35
+ var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_OPACITY;
36
+ if (!color) return 'rgba(0, 0, 0, 0.15)';
37
+ if (color.startsWith('rgb')) {
38
+ if (color.startsWith('rgba')) return color.replace(/,\s*[\d.]+(?=\))/, ",".concat(opacity));
39
+ return "".concat(color.slice(0, -1), ",").concat(opacity, ")");
40
+ }
41
+ var hex = color.trim().replace(/^#/, '');
42
+ if (hex.length === 3) {
43
+ hex = hex.split('').map(function (char) {
44
+ return char + char;
45
+ }).join('');
46
+ }
47
+ if (!/^[0-9A-Fa-f]{6}$/.test(hex)) return 'rgba(0, 0, 0, 0.15)';
48
+ var r = parseInt(hex.substring(0, 2), 16);
49
+ var g = parseInt(hex.substring(2, 4), 16);
50
+ var b = parseInt(hex.substring(4, 6), 16);
51
+ return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(opacity, ")");
52
+ }
53
+ var StatusTag = /*#__PURE__*/React.memo(function (props) {
54
+ var className = props.className,
55
+ _props$type = props.type,
56
+ type = _props$type === void 0 ? 'default' : _props$type,
57
+ icon = props.icon,
58
+ _props$color = props.color,
59
+ color = _props$color === void 0 ? 'green' : _props$color,
60
+ _props$loading = props.loading,
61
+ loading = _props$loading === void 0 ? false : _props$loading,
62
+ _props$rounded = props.rounded,
63
+ rounded = _props$rounded === void 0 ? false : _props$rounded,
64
+ background = props.background,
65
+ style = props.style,
66
+ children = props.children,
67
+ restProps = _objectWithoutProperties(props, _excluded);
68
+ var prefixCls = globalConfig().getPrefixCls('status-tag');
69
+ var showDefaultIcon = useMemo(function () {
70
+ return icon === undefined;
71
+ }, [icon]);
72
+ var containerClasses = useMemo(function () {
73
+ return classNames(prefixCls, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "--border"), type === 'outline'), "".concat(prefixCls, "--fill"), type === 'fill'), "".concat(prefixCls, "--rounded"), rounded), "".concat(prefixCls, "__").concat(color, "--fill"), type === 'fill' && isPresetColor(color)));
74
+ }, [className, type, color, rounded, prefixCls]);
75
+ var customColorStyle = useMemo(function () {
76
+ if (type !== 'fill' || isPresetColor(color)) return {};
77
+ return {
78
+ color: color,
79
+ background: background || calculateTransparentColor(color)
80
+ };
81
+ }, [type, color, background]);
82
+ var iconStyleConfig = useMemo(function () {
83
+ if (isPresetColor(color)) {
84
+ return {
85
+ className: classNames('anticon', _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "__").concat(color, "--icon"), true), "".concat(prefixCls, "__icon--default"), !icon), "".concat(prefixCls, "__").concat(color, "--iconBg"), !icon)),
86
+ style: {}
87
+ };
88
+ }
89
+ return {
90
+ className: classNames('anticon', _defineProperty({}, "".concat(prefixCls, "__icon--default"), !icon)),
91
+ style: {
92
+ color: icon ? color : undefined,
93
+ background: !icon ? color : undefined
94
+ }
95
+ };
96
+ }, [color, icon, prefixCls]);
97
+ var loadingIndicator = useMemo(function () {
98
+ return /*#__PURE__*/React.createElement(SpinOutlined, {
99
+ className: "".concat(prefixCls, "__icon ").concat(prefixCls, "__icon--loading")
100
+ });
101
+ }, [prefixCls]);
102
+ return /*#__PURE__*/React.createElement("div", _extends({}, restProps, {
103
+ className: containerClasses,
104
+ style: _objectSpread(_objectSpread({}, customColorStyle), style),
105
+ "aria-busy": loading
106
+ }), loading ? /*#__PURE__*/React.createElement(Spin, {
107
+ spinning: true,
108
+ indicator: loadingIndicator,
109
+ size: "small"
110
+ }) : (icon || showDefaultIcon) && /*#__PURE__*/React.createElement("div", {
111
+ className: "".concat(prefixCls, "__icon")
112
+ }, /*#__PURE__*/React.createElement("span", {
113
+ className: iconStyleConfig.className,
114
+ style: iconStyleConfig.style
115
+ }, icon !== null && icon !== void 0 ? icon : null)), children && /*#__PURE__*/React.createElement("span", {
116
+ className: "".concat(prefixCls, "__text")
117
+ }, children));
118
+ });
119
+ if (process.env.NODE_ENV !== 'production') {
120
+ StatusTag.displayName = 'StatusTag';
121
+ }
122
+ export default StatusTag;
@@ -0,0 +1,2 @@
1
+ import '../../style/index.less';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import "../../style/index.less";
2
+ import "./index.less";