Skip to content

Commit 567057f

Browse files
committed
feat(ui): add table component
1 parent cce0e71 commit 567057f

114 files changed

Lines changed: 2911 additions & 384 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
cache: 'yarn'
3535
- run: yarn install --frozen-lockfile
3636
- run: yarn test:affected
37-
- uses: codecov/codecov-action@v2
37+
- uses: codecov/codecov-action@v3
3838
build:
3939
runs-on: ubuntu-latest
4040
strategy:

.stylelintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414
],
1515
"declaration-property-value-allowed-list": {
16-
"/color/": ["/var/", "/\\$/", "currentColor", "transparent", "unset", "inherit"],
16+
"/color/": ["/var/", "/\\$/", "currentcolor", "transparent", "unset", "inherit"],
1717
"font-size": ["/var/", "/\\$/", "/[0-9]+em$/", "unset", "inherit"],
1818
"border-radius": ["/var/", "/\\$/", "50%", "0", "inherit"]
1919
},

packages/site/src/app/components/route/component/DemoBox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ ${'```'}
109109
</DTooltip>
110110
<DTooltip dTitle={copyCode ? t('Copied!') : t('Copy code')} afterVisibleChange={afterCopyTrige}>
111111
<div className="app-icon-button">
112-
{copyCode ? <CheckOutlined dSize={18} /> : <SnippetsOutlined dSize={18} onClick={handleCopyClick} />}
112+
{copyCode ? <CheckOutlined dSize={18} /> : <SnippetsOutlined onClick={handleCopyClick} dSize={18} />}
113113
</div>
114114
</DTooltip>
115115
<DTooltip dTitle={openCode ? t('Hide code') : t('Show code')}>
116-
<DCustomIcon className="app-icon-button" viewBox="0 0 1024 1024" dSize={18} onClick={handleOpenClick}>
116+
<DCustomIcon className="app-icon-button" viewBox="0 0 1024 1024" onClick={handleOpenClick} dSize={18}>
117117
{openCode ? (
118118
<path d="M1018.645 531.298c8.635-18.61 4.601-41.42-11.442-55.864l-205.108-184.68c-19.7-17.739-50.05-16.148-67.789 3.552-17.738 19.7-16.148 50.051 3.553 67.79l166.28 149.718-167.28 150.62c-19.7 17.738-21.291 48.088-3.553 67.789 17.739 19.7 48.089 21.291 67.79 3.553l205.107-184.68a47.805 47.805 0 0 0 12.442-17.798zM119.947 511.39l166.28-149.719c19.7-17.738 21.29-48.088 3.552-67.789-17.738-19.7-48.088-21.291-67.789-3.553L16.882 475.01C.84 489.456-3.194 512.264 5.44 530.874a47.805 47.805 0 0 0 12.442 17.798l205.108 184.68c19.7 17.739 50.05 16.148 67.79-3.552 17.738-19.7 16.147-50.051-3.553-67.79l-167.28-150.62zm529.545-377.146c24.911 9.066 37.755 36.61 28.688 61.522L436.03 861.068c-9.067 24.911-36.611 37.755-61.522 28.688-24.911-9.066-37.755-36.61-28.688-61.522l242.15-665.302c9.067-24.911 36.611-37.755 61.522-28.688z"></path>
119119
) : (

packages/site/src/app/styles/_app.scss

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ h3 {
225225
'Radio': 'radio',
226226
'Input': 'input',
227227
'Switch': 'switch',
228-
'Time-picker': 'time-picker',
229-
'Date-picker': 'date-picker',
230-
'Auto-complete': 'input',
228+
'TimePicker': 'time-picker',
229+
'DatePicker': 'date-picker',
230+
'AutoComplete': 'input',
231231
'Image': 'image'
232232
)
233233
{
@@ -313,6 +313,17 @@ h3 {
313313
min-width: 600px;
314314
}
315315
}
316+
317+
section[id^='Table'] {
318+
.d-table {
319+
min-width: 600px;
320+
}
321+
322+
.d-pagination {
323+
justify-content: flex-end;
324+
margin-top: 20px;
325+
}
326+
}
316327
}
317328

318329
.app-demo-col {

packages/site/src/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,14 @@
1313
</head>
1414
<body>
1515
<div id="app-root"></div>
16+
<script>
17+
var _hmt = _hmt || [];
18+
(function () {
19+
var hm = document.createElement('script');
20+
hm.src = 'https://hm.baidu.com/hm.js?0c8e27d8ae0d13fbef28c934b5464d5d';
21+
var s = document.getElementsByTagName('script')[0];
22+
s.parentNode.insertBefore(hm, s);
23+
})();
24+
</script>
1625
</body>
1726
</html>

packages/ui/src/components/_date-input/DateInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
229229
type="text"
230230
autoComplete="off"
231231
disabled={dDisabled}
232-
dFormControl={dFormControl}
233-
dFor={isLeft}
234232
onFocus={(e) => {
235233
inputProps?.onFocus?.(e);
236234

@@ -245,6 +243,8 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
245243
inputProps?.onKeyDown?.(e);
246244
ksProps.ksOnKeyDown(e);
247245
}}
246+
dFormControl={dFormControl}
247+
dFor={isLeft}
248248
/>
249249
);
250250
};

packages/ui/src/components/_popup/Popup.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export function DPopup(props: DPopupProps): JSX.Element | null {
5555

5656
const dataRef = useRef<{
5757
clearTid?: () => void;
58+
clearClickOut?: () => void;
5859
}>({});
5960

6061
const asyncCapture = useAsync();
@@ -112,17 +113,15 @@ export function DPopup(props: DPopupProps): JSX.Element | null {
112113
}
113114
});
114115

115-
const clickOut = useRef(true);
116116
useEffect(() => {
117117
if (!dDisabled && dVisible && dTrigger === 'click') {
118118
const [asyncGroup, asyncId] = asyncCapture.createGroup();
119119

120-
asyncGroup.fromEvent(window, 'click').subscribe({
120+
asyncGroup.fromEvent(window, 'click', { capture: true }).subscribe({
121121
next: () => {
122-
if (clickOut.current) {
122+
dataRef.current.clearClickOut = asyncGroup.requestAnimationFrame(() => {
123123
handleTrigger(false);
124-
}
125-
clickOut.current = true;
124+
});
126125
},
127126
});
128127

@@ -239,7 +238,7 @@ export function DPopup(props: DPopupProps): JSX.Element | null {
239238

240239
case 'click':
241240
childProps.pOnClick = () => {
242-
clickOut.current = false;
241+
dataRef.current.clearClickOut?.();
243242
handleTrigger();
244243
};
245244
break;
@@ -264,7 +263,7 @@ export function DPopup(props: DPopupProps): JSX.Element | null {
264263

265264
case 'click':
266265
popupProps.pOnClick = () => {
267-
clickOut.current = false;
266+
dataRef.current.clearClickOut?.();
268267
};
269268
break;
270269

packages/ui/src/components/_selectbox/Selectbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ function Selectbox(props: DSelectboxProps, ref: React.ForwardedRef<DSelectboxRef
236236
role="combobox"
237237
aria-haspopup="listbox"
238238
aria-expanded={dVisible}
239-
dFormControl={dFormControl}
240239
onFocus={(e) => {
241240
dInputProps?.onFocus?.(e);
242241
fvOnFocus(e);
@@ -253,6 +252,7 @@ function Selectbox(props: DSelectboxProps, ref: React.ForwardedRef<DSelectboxRef
253252
dInputProps?.onKeyDown?.(e);
254253
fvOnKeyDown(e);
255254
}}
255+
dFormControl={dFormControl}
256256
/>
257257
)}
258258
</DFocusVisible>

packages/ui/src/components/alert/Alert.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { useComponentConfig, useDValue, usePrefixConfig } from '../../hooks';
22
import { checkNodeExist, getClassName, registerComponentMate } from '../../utils';
33
import { TTANSITION_DURING_BASE } from '../../utils/global';
44
import { DCollapseTransition } from '../_transition';
5-
import { DNotificationPanel } from '../notification/NotificationPanel';
6-
import { DToastPanel } from '../toast/ToastPanel';
5+
import { DPanel as DNotificationPanel } from '../notification/Panel';
6+
import { DPanel as DToastPanel } from '../toast/Panel';
77

88
export interface DAlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
99
dVisible?: boolean;

packages/ui/src/components/anchor/Anchor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function Anchor<T extends DAnchorItem>(props: DAnchorProps<T>, ref: React.Forwar
236236
}
237237

238238
export const DAnchor: {
239-
<T extends DAnchorItem>(props: DAnchorProps<T> & { ref?: React.ForwardedRef<DAnchorRef> }): ReturnType<typeof Anchor>;
239+
<T extends DAnchorItem>(props: DAnchorProps<T> & React.RefAttributes<DAnchorRef>): ReturnType<typeof Anchor>;
240240
DOT_INDICATOR: typeof DOT_INDICATOR;
241241
LINE_INDICATOR: typeof LINE_INDICATOR;
242242
} = React.forwardRef(Anchor) as any;

0 commit comments

Comments
 (0)