@public-ui/sample-react 2.1.7 → 2.1.8
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/1487.js +1 -1
- package/dist/1636.js +1 -1
- package/dist/1792.js +1 -1
- package/dist/1795.js +1 -1
- package/dist/2017.js +1 -1
- package/dist/2322.js +1 -1
- package/dist/2538.js +1 -1
- package/dist/2567.js +1 -1
- package/dist/263.js +1 -1
- package/dist/2719.js +1 -1
- package/dist/3064.js +1 -1
- package/dist/3077.js +1 -1
- package/dist/3238.js +1 -1
- package/dist/3301.js +2 -0
- package/dist/3395.js +1 -1
- package/dist/35.js +1 -1
- package/dist/3521.js +1 -1
- package/dist/356.js +1 -1
- package/dist/3714.js +1 -1
- package/dist/3735.js +1 -1
- package/dist/3766.js +1 -1
- package/dist/3994.js +1 -1
- package/dist/4025.js +1 -1
- package/dist/4065.js +2 -0
- package/dist/4118.js +1 -1
- package/dist/4182.js +1 -1
- package/dist/4188.js +1 -1
- package/dist/4332.js +1 -1
- package/dist/4402.js +1 -1
- package/dist/4795.js +2 -0
- package/dist/4818.js +1 -1
- package/dist/4892.js +1 -1
- package/dist/4933.js +1 -1
- package/dist/4943.js +1 -1
- package/dist/495.js +1 -1
- package/dist/5034.js +1 -1
- package/dist/5056.js +1 -1
- package/dist/5138.js +1 -1
- package/dist/5296.js +1 -1
- package/dist/5356.js +1 -1
- package/dist/5551.js +1 -1
- package/dist/5835.js +1 -1
- package/dist/5840.js +1 -1
- package/dist/5889.js +1 -1
- package/dist/5912.js +1 -1
- package/dist/6082.js +1 -1
- package/dist/6099.js +1 -1
- package/dist/6181.js +1 -1
- package/dist/619.js +1 -1
- package/dist/6671.js +1 -1
- package/dist/6775.js +1 -1
- package/dist/7274.js +1 -1
- package/dist/7440.js +2 -0
- package/dist/7795.js +1 -1
- package/dist/7802.js +1 -1
- package/dist/7860.js +1 -1
- package/dist/8092.js +1 -1
- package/dist/8111.js +1 -1
- package/dist/8146.js +1 -1
- package/dist/8427.js +1 -1
- package/dist/8495.js +1 -1
- package/dist/8672.js +1 -1
- package/dist/8737.js +1 -1
- package/dist/8786.js +1 -1
- package/dist/8796.js +1 -1
- package/dist/8977.js +1 -1
- package/dist/9333.js +1 -1
- package/dist/9389.js +1 -1
- package/dist/9561.js +1 -1
- package/dist/9599.js +1 -1
- package/dist/9612.js +1 -1
- package/dist/9890.js +1 -1
- package/dist/index.html +1 -1
- package/dist/main.css +3 -3
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +2 -2
- package/package.json +16 -16
- package/public/index.html +1 -1
- package/src/@shared/_mixins.scss +3 -0
- package/src/App.tsx +1 -1
- package/src/components/FormWrap.tsx +1 -1
- package/src/components/Navigation.tsx +63 -0
- package/src/components/Sidebar.tsx +5 -41
- package/src/components/abbr/basic.tsx +12 -12
- package/src/components/alert/card-msg.tsx +3 -1
- package/src/components/alert/html.tsx +4 -2
- package/src/components/button/access-key.tsx +34 -25
- package/src/components/button/aria-description.tsx +20 -11
- package/src/components/button/baselined.tsx +22 -13
- package/src/components/button/icons.tsx +33 -26
- package/src/components/button/partials/cases.tsx +13 -6
- package/src/components/button/partials/variants.tsx +15 -17
- package/src/components/button/width.tsx +33 -28
- package/src/components/button-group/basic.tsx +25 -16
- package/src/components/button-link/basic.tsx +3 -3
- package/src/components/button-link/image.tsx +0 -1
- package/src/components/card/basic.tsx +1 -1
- package/src/components/combobox/partials/variants.tsx +1 -1
- package/src/components/details/basic.tsx +2 -2
- package/src/components/form/basic.tsx +1 -1
- package/src/components/form/error-list.tsx +1 -0
- package/src/components/handout/basic.tsx +304 -279
- package/src/components/input-checkbox/partials/variants.tsx +22 -10
- package/src/components/input-date/reset.tsx +1 -1
- package/src/components/input-password/show-password.tsx +1 -1
- package/src/components/input-text/partials/cases.tsx +1 -1
- package/src/components/input-text/routes.ts +2 -0
- package/src/components/input-text/smart-button.tsx +33 -0
- package/src/components/input-text/text-formatter.tsx +98 -45
- package/src/components/link/image.tsx +0 -1
- package/src/components/link/target.tsx +1 -1
- package/src/components/modal/basic.tsx +1 -1
- package/src/components/nav/basic.tsx +23 -12
- package/src/components/nav/horizontal.tsx +12 -3
- package/src/components/nav/links.ts +36 -0
- package/src/components/table/column-alignment.tsx +64 -62
- package/src/components/table/complex-headers.tsx +80 -78
- package/src/components/table/horizontal-scrollbar.tsx +30 -28
- package/src/components/table/interactive-child-elements.tsx +81 -69
- package/src/components/table/pagination-position.tsx +15 -13
- package/src/components/table/render-cell.tsx +14 -3
- package/src/components/table/sort-data.tsx +11 -8
- package/src/components/table/stateful-with-selection.tsx +47 -27
- package/src/components/table/stateful-with-single-selection.tsx +47 -27
- package/src/components/table/stateless-with-selection.tsx +37 -17
- package/src/components/table/stateless-with-single-selection.tsx +37 -17
- package/src/components/table/stateless.tsx +29 -27
- package/src/components/table/with-footer.tsx +1 -0
- package/src/components/table/with-pagination.tsx +1 -1
- package/src/components/tabs/behavior.tsx +61 -0
- package/src/components/tabs/routes.ts +2 -0
- package/src/components/textarea/adjust-height.tsx +1 -1
- package/src/components/textarea/counter.tsx +4 -1
- package/src/components/textarea/resize.tsx +1 -1
- package/src/components/textarea/rows.tsx +1 -1
- package/src/components/toast/basic.tsx +13 -11
- package/src/hooks/useToasterService.ts +21 -0
- package/src/react.main.tsx +6 -1
- package/src/scenarios/appointment-form/AppointmentForm.tsx +1 -0
- package/src/scenarios/custom-tooltip-width.tsx +26 -11
- package/src/scenarios/disabled-interactive-elements.tsx +123 -114
- package/src/scenarios/focus-elements.tsx +21 -16
- package/src/scenarios/horizontal-scrollbar-advanced/TableHorizontalScrollbarAdvanced.tsx +1 -1
- package/src/scenarios/horizontal-scrollbar-advanced/layout.scss +19 -0
- package/src/scenarios/input-group-with-error.tsx +41 -0
- package/src/scenarios/inputs-get-value.tsx +121 -119
- package/src/scenarios/routes.ts +4 -2
- package/src/scenarios/static-form.tsx +65 -62
- package/src/style.scss +10 -13
- package/tsconfig.json +1 -2
- package/unocss.config.ts +213 -0
- package/dist/3171.js +0 -2
- package/dist/4262.js +0 -2
- package/dist/479.js +0 -2
- package/dist/8710.js +0 -2
- package/src/scenarios/horizontal-scrollbar-advanced/layout.css +0 -31
- /package/dist/{3171.js.LICENSE.txt → 3301.js.LICENSE.txt} +0 -0
- /package/dist/{4262.js.LICENSE.txt → 4065.js.LICENSE.txt} +0 -0
- /package/dist/{479.js.LICENSE.txt → 4795.js.LICENSE.txt} +0 -0
- /package/dist/{8710.js.LICENSE.txt → 7440.js.LICENSE.txt} +0 -0
|
@@ -9,84 +9,86 @@ export const TableComplexHeaders: FC = () => (
|
|
|
9
9
|
<p>This sample shows KolTable using vertical and horizontal headers, applying colspan and rowspan.</p>
|
|
10
10
|
</SampleDescription>
|
|
11
11
|
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
[
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
12
|
+
<section className="w-full flex flex-col">
|
|
13
|
+
<KolTable
|
|
14
|
+
_label="Business hours"
|
|
15
|
+
_data={[
|
|
16
|
+
{
|
|
17
|
+
asp: 'Center',
|
|
18
|
+
monday: '08:00',
|
|
19
|
+
tuesday: '08:00',
|
|
20
|
+
wednesday: '10:00',
|
|
21
|
+
thursday: '11:00',
|
|
22
|
+
friday: '08:00',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
asp: 'Tiergarten',
|
|
26
|
+
monday: '08:00',
|
|
27
|
+
tuesday: '08:00',
|
|
28
|
+
wednesday: '10:00',
|
|
29
|
+
thursday: '11:00',
|
|
30
|
+
friday: '08:00',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
asp: 'Maxvorstadt',
|
|
34
|
+
monday: '08:00',
|
|
35
|
+
tuesday: '08:00',
|
|
36
|
+
wednesday: '10:00',
|
|
37
|
+
thursday: '11:00',
|
|
38
|
+
friday: '08:00',
|
|
39
|
+
},
|
|
40
|
+
]}
|
|
41
|
+
_headers={{
|
|
42
|
+
vertical: [[{ label: 'Berlin', rowSpan: 2 }, { label: 'München' }]],
|
|
43
|
+
horizontal: [
|
|
44
|
+
[
|
|
45
|
+
{
|
|
46
|
+
label: '',
|
|
47
|
+
colSpan: 7,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: 'Weekend',
|
|
51
|
+
colSpan: 2,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
{ label: '' },
|
|
56
|
+
{
|
|
57
|
+
label: 'District',
|
|
58
|
+
key: 'asp',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: 'Monday',
|
|
62
|
+
key: 'monday',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: 'Tuesday',
|
|
66
|
+
key: 'tuesday',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: 'Wednesday',
|
|
70
|
+
key: 'wednesday',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: 'Thursday',
|
|
74
|
+
key: 'thursday',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: 'Friday',
|
|
78
|
+
key: 'friday',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: 'Saturday',
|
|
82
|
+
key: 'saturday',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: 'Sunday',
|
|
86
|
+
key: 'sunday',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
52
89
|
],
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
label: 'District',
|
|
57
|
-
key: 'asp',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
label: 'Monday',
|
|
61
|
-
key: 'monday',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
label: 'Tuesday',
|
|
65
|
-
key: 'tuesday',
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
label: 'Wednesday',
|
|
69
|
-
key: 'wednesday',
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: 'Thursday',
|
|
73
|
-
key: 'thursday',
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
label: 'Friday',
|
|
77
|
-
key: 'friday',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
label: 'Saturday',
|
|
81
|
-
key: 'saturday',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
label: 'Sunday',
|
|
85
|
-
key: 'sunday',
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
],
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
</section>
|
|
91
93
|
</>
|
|
92
94
|
);
|
|
@@ -29,34 +29,36 @@ export const TableHorizontalScrollbar: FC = () => {
|
|
|
29
29
|
</p>
|
|
30
30
|
</SampleDescription>
|
|
31
31
|
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
<section className="w-full flex flex-col">
|
|
33
|
+
<KolHeading _label="Table with scrollbar" _level={2} />
|
|
34
|
+
|
|
35
|
+
<KolTable
|
|
36
|
+
_label="Table for demonstration purposes with horizontal scrollbar."
|
|
37
|
+
_minWidth={hasWidthRestriction ? '600px' : 'auto'}
|
|
38
|
+
_headers={HEADERS}
|
|
39
|
+
_data={DATA}
|
|
40
|
+
className="block"
|
|
41
|
+
style={{ width: '400px' }}
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
<KolInputCheckbox
|
|
45
|
+
_checked={hasWidthRestriction}
|
|
46
|
+
_label="Toggle width restriction"
|
|
47
|
+
_variant="switch"
|
|
48
|
+
_on={{
|
|
49
|
+
onChange: (_event, value) => {
|
|
50
|
+
setHasWidthRestriction(Boolean(value));
|
|
51
|
+
},
|
|
52
|
+
}}
|
|
53
|
+
></KolInputCheckbox>
|
|
54
|
+
|
|
55
|
+
<KolHeading _label="Same table without scrollbar" _level={2} className="block mt-4" />
|
|
56
|
+
<p className="mt-0">
|
|
57
|
+
<i>Scrollbar appears on very small viewport sizes</i>
|
|
58
|
+
</p>
|
|
59
|
+
|
|
60
|
+
<KolTable _label="Table for demonstration purposes without horizontal scrollbar" _minWidth="600px" _headers={HEADERS} _data={DATA} className="block" />
|
|
61
|
+
</section>
|
|
60
62
|
</>
|
|
61
63
|
);
|
|
62
64
|
};
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
import type { ButtonProps, ButtonVariantPropType, KoliBriTableCell, KoliBriTableHeaderCell } from '@public-ui/components';
|
|
2
|
+
import { createReactRenderElement, KolButton, KolButtonLink, KolLink, KolLinkButton, KolTableStateless } from '@public-ui/react';
|
|
1
3
|
import type { FC } from 'react';
|
|
2
4
|
import React from 'react';
|
|
3
|
-
import { createReactRenderElement, KolButton, KolButtonLink, KolLink, KolLinkButton, KolTableStateless } from '@public-ui/react';
|
|
4
|
-
import { SampleDescription } from '../SampleDescription';
|
|
5
5
|
import { getRoot } from '../../shares/react-roots';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import { SampleDescription } from '../SampleDescription';
|
|
7
|
+
import { useToasterService } from '../../hooks/useToasterService';
|
|
8
|
+
|
|
9
|
+
function KolButtonWrapper({ _on, ...other }: ButtonProps) {
|
|
10
|
+
const { dummyClickEventHandler } = useToasterService();
|
|
11
|
+
|
|
12
|
+
const dummyEventHandler = {
|
|
13
|
+
onClick: dummyClickEventHandler,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return <KolButton {...other} _on={dummyEventHandler} />;
|
|
17
|
+
}
|
|
8
18
|
|
|
9
19
|
const getButtonHeaderCell = (variant: ButtonVariantPropType): KoliBriTableHeaderCell => {
|
|
10
20
|
const capitalizedVariant = variant.charAt(0).toUpperCase() + variant.slice(1);
|
|
@@ -19,7 +29,7 @@ const getButtonHeaderCell = (variant: ButtonVariantPropType): KoliBriTableHeader
|
|
|
19
29
|
_icons: { right: 'codicon codicon-squirrel' },
|
|
20
30
|
};
|
|
21
31
|
getRoot(createReactRenderElement(element)).render(
|
|
22
|
-
cell.label === 'button' ? <
|
|
32
|
+
cell.label === 'button' ? <KolButtonWrapper {...commonProps} /> : <KolLinkButton _href="#/back-page" {...commonProps} />,
|
|
23
33
|
);
|
|
24
34
|
},
|
|
25
35
|
};
|
|
@@ -33,73 +43,75 @@ export const InteractiveChildElements: FC = () => (
|
|
|
33
43
|
</p>
|
|
34
44
|
</SampleDescription>
|
|
35
45
|
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
[
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
<section className="w-full flex flex-col">
|
|
47
|
+
<KolTableStateless
|
|
48
|
+
_label="Button styles"
|
|
49
|
+
_headerCells={{
|
|
50
|
+
horizontal: [
|
|
51
|
+
[
|
|
52
|
+
{ label: '', asTd: true, width: '20ex' },
|
|
53
|
+
getButtonHeaderCell('primary'),
|
|
54
|
+
getButtonHeaderCell('secondary'),
|
|
55
|
+
getButtonHeaderCell('normal'),
|
|
56
|
+
getButtonHeaderCell('danger'),
|
|
57
|
+
getButtonHeaderCell('ghost'),
|
|
58
|
+
],
|
|
47
59
|
],
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/>
|
|
60
|
+
vertical: [[{ label: 'Button' }, { label: 'Link-Button' }]],
|
|
61
|
+
}}
|
|
62
|
+
_data={[
|
|
63
|
+
{
|
|
64
|
+
primary: 'button',
|
|
65
|
+
secondary: 'button',
|
|
66
|
+
normal: 'button',
|
|
67
|
+
danger: 'button',
|
|
68
|
+
ghost: 'button',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
primary: 'link-button',
|
|
72
|
+
secondary: 'link-button',
|
|
73
|
+
normal: 'link-button',
|
|
74
|
+
danger: 'link-button',
|
|
75
|
+
ghost: 'link-button',
|
|
76
|
+
},
|
|
77
|
+
]}
|
|
78
|
+
className="block"
|
|
79
|
+
/>
|
|
69
80
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
<KolTableStateless
|
|
82
|
+
_label="Link styles"
|
|
83
|
+
_headerCells={{
|
|
84
|
+
horizontal: [
|
|
85
|
+
[
|
|
86
|
+
{ label: '', asTd: true, width: '20ex' },
|
|
87
|
+
{
|
|
88
|
+
key: 'regular',
|
|
89
|
+
label: 'Regular',
|
|
90
|
+
textAlign: 'left',
|
|
91
|
+
render: (element: HTMLElement, cell: KoliBriTableCell) => {
|
|
92
|
+
const commonProps = {
|
|
93
|
+
_label: cell.label,
|
|
94
|
+
_icons: { right: 'codicon codicon-squirrel' },
|
|
95
|
+
};
|
|
96
|
+
getRoot(createReactRenderElement(element)).render(
|
|
97
|
+
cell.label === 'button-link' ? <KolButtonLink {...commonProps} /> : <KolLink _href="#/back-page" {...commonProps} />,
|
|
98
|
+
);
|
|
99
|
+
},
|
|
88
100
|
},
|
|
89
|
-
|
|
101
|
+
],
|
|
90
102
|
],
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
vertical: [[{ label: 'Link' }, { label: 'Button-Link' }]],
|
|
104
|
+
}}
|
|
105
|
+
_data={[
|
|
106
|
+
{
|
|
107
|
+
regular: 'link',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
regular: 'button-link',
|
|
111
|
+
},
|
|
112
|
+
]}
|
|
113
|
+
className="block mt"
|
|
114
|
+
/>
|
|
115
|
+
</section>
|
|
104
116
|
</>
|
|
105
117
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
-
import { KolTable } from '@public-ui/react';
|
|
4
|
+
import { KolHeading, KolTable } from '@public-ui/react';
|
|
5
5
|
|
|
6
6
|
import { SampleDescription } from '../SampleDescription';
|
|
7
7
|
import { DATE_FORMATTER } from './formatter';
|
|
@@ -21,22 +21,24 @@ const HEADERS: KoliBriTableHeaders = {
|
|
|
21
21
|
const PAGINATION: KoliBriTablePaginationProps = { _page: 2 };
|
|
22
22
|
|
|
23
23
|
export const PaginationPosition: FC = () => (
|
|
24
|
-
<div className="grid gap-14">
|
|
24
|
+
<div className="w-full grid gap-14">
|
|
25
25
|
<SampleDescription>
|
|
26
26
|
<p>This sample shows KolTable with different pagination positions.</p>
|
|
27
27
|
</SampleDescription>
|
|
28
28
|
|
|
29
|
-
<section>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
|
|
29
|
+
<section className="w-full flex flex-col gap-14">
|
|
30
|
+
<section className="grid gap-4">
|
|
31
|
+
<KolHeading _level={2} _label="Table with pagination at the bottom."></KolHeading>
|
|
32
|
+
<KolTable _label="Tabellenbeschreibung" _data={DATA} _headers={HEADERS} _pagination={PAGINATION} _paginationPosition="bottom"></KolTable>
|
|
33
|
+
</section>
|
|
34
|
+
<section className="grid gap-4">
|
|
35
|
+
<KolHeading _level={2} _label="Table with pagination at the top."></KolHeading>
|
|
36
|
+
<KolTable _label="Tabellenbeschreibung" _data={DATA} _headers={HEADERS} _pagination={PAGINATION} _paginationPosition="top"></KolTable>
|
|
37
|
+
</section>
|
|
38
|
+
<section className="grid gap-4">
|
|
39
|
+
<KolHeading _level={2} _label="Table with pagination at both top and bottom."></KolHeading>
|
|
40
|
+
<KolTable _label="Tabellenbeschreibung" _data={DATA} _headers={HEADERS} _pagination={PAGINATION} _paginationPosition="both"></KolTable>
|
|
41
|
+
</section>
|
|
40
42
|
</section>
|
|
41
43
|
</div>
|
|
42
44
|
);
|
|
@@ -7,7 +7,8 @@ import { getRoot } from '../../shares/react-roots';
|
|
|
7
7
|
import { SampleDescription } from '../SampleDescription';
|
|
8
8
|
import { DATE_FORMATTER } from './formatter';
|
|
9
9
|
|
|
10
|
-
import type { KoliBriTableHeaders } from '@public-ui/components';
|
|
10
|
+
import type { IconsPropType, KoliBriTableHeaders } from '@public-ui/components';
|
|
11
|
+
import { useToasterService } from '../../hooks/useToasterService';
|
|
11
12
|
|
|
12
13
|
type Data = {
|
|
13
14
|
order: number;
|
|
@@ -32,6 +33,16 @@ const DATA: Data[] = [
|
|
|
32
33
|
},
|
|
33
34
|
];
|
|
34
35
|
|
|
36
|
+
function KolButtonWrapper({ label, icons }: { label: string; icons: IconsPropType }) {
|
|
37
|
+
const { dummyClickEventHandler } = useToasterService();
|
|
38
|
+
|
|
39
|
+
const dummyEventHandler = {
|
|
40
|
+
onClick: dummyClickEventHandler,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return <KolButton _label={label} _icons={icons} _on={dummyEventHandler} />;
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
const HEADERS: KoliBriTableHeaders = {
|
|
36
47
|
horizontal: [
|
|
37
48
|
[
|
|
@@ -89,7 +100,7 @@ const HEADERS: KoliBriTableHeaders = {
|
|
|
89
100
|
}}
|
|
90
101
|
>
|
|
91
102
|
<KolInputText _label="Input" />
|
|
92
|
-
<
|
|
103
|
+
<KolButtonWrapper label="Save" icons={{ left: 'codicon codicon-save' }} />
|
|
93
104
|
</div>,
|
|
94
105
|
);
|
|
95
106
|
},
|
|
@@ -104,6 +115,6 @@ export const TableRenderCell: FC = () => (
|
|
|
104
115
|
<p>This sample shows KolTable using React render functions for the cell contents.</p>
|
|
105
116
|
</SampleDescription>
|
|
106
117
|
|
|
107
|
-
<KolTable _label="Sort by date column" _data={DATA} _headers={HEADERS} className="
|
|
118
|
+
<KolTable _label="Sort by date column" _data={DATA} _headers={HEADERS} className="w-full" />
|
|
108
119
|
</>
|
|
109
120
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
-
import { KolTable } from '@public-ui/react';
|
|
4
|
+
import { KolHeading, KolTable } from '@public-ui/react';
|
|
5
5
|
import type { KoliBriTableHeaders } from '@public-ui/components';
|
|
6
6
|
import type { Data } from './test-data';
|
|
7
7
|
import { DATA } from './test-data';
|
|
@@ -59,12 +59,15 @@ export const TableSortData: FC = () => (
|
|
|
59
59
|
<p>This sample shows KolTable with sortable columns. The sort-order can be changed by clicking the "date" header column.</p>
|
|
60
60
|
</SampleDescription>
|
|
61
61
|
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
<section className="w-full grid gap-4">
|
|
63
|
+
<section className="grid gap-4">
|
|
64
|
+
<KolHeading _level={2} _label="Vertical" />
|
|
65
|
+
<KolTable _label="Sort a date column" _data={DATA.slice(0, 10)} _headers={HEADERS_VERTICAL} className="block" />
|
|
66
|
+
</section>
|
|
67
|
+
<section className="grid gap-4">
|
|
68
|
+
<KolHeading _level={2} _label="Horizontal" />
|
|
69
|
+
<KolTable _label="Sort a date column" _data={DATA} _headers={HEADERS_HORIZONTAL} className="block" />
|
|
70
|
+
</section>
|
|
71
|
+
</section>
|
|
69
72
|
</>
|
|
70
73
|
);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { KolButton, KolTableStateful } from '@public-ui/react';
|
|
3
|
+
import { KolButton, KolTableStateful, createReactRenderElement } from '@public-ui/react';
|
|
4
4
|
import { SampleDescription } from '../SampleDescription';
|
|
5
5
|
import type { KoliBriTableDataType, KoliBriTableSelection } from '@public-ui/components';
|
|
6
|
+
import { getRoot } from '../../shares/react-roots';
|
|
7
|
+
import type { KoliBriTableCell } from '@public-ui/components';
|
|
8
|
+
import { useToasterService } from '../../hooks/useToasterService';
|
|
6
9
|
|
|
7
10
|
const DATA = [
|
|
8
11
|
{ id: '1001', name: 'Foo Bar', internalIdentifier: `AAA1001` },
|
|
@@ -10,6 +13,16 @@ const DATA = [
|
|
|
10
13
|
];
|
|
11
14
|
type Data = (typeof DATA)[0];
|
|
12
15
|
|
|
16
|
+
function KolButtonWrapper({ label }: { label: string }) {
|
|
17
|
+
const { dummyClickEventHandler } = useToasterService();
|
|
18
|
+
|
|
19
|
+
const dummyEventHandler = {
|
|
20
|
+
onClick: dummyClickEventHandler,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return <KolButton _label={label} _on={dummyEventHandler} />;
|
|
24
|
+
}
|
|
25
|
+
|
|
13
26
|
export const TableStatefulWithSelection: FC = () => {
|
|
14
27
|
const [selectedValue, setSelectedValue] = useState<Data[] | null>();
|
|
15
28
|
|
|
@@ -43,40 +56,47 @@ export const TableStatefulWithSelection: FC = () => {
|
|
|
43
56
|
};
|
|
44
57
|
}, [kolTableStatefulRef]);
|
|
45
58
|
|
|
59
|
+
const renderButton = (element: HTMLElement, cell: KoliBriTableCell) => {
|
|
60
|
+
getRoot(createReactRenderElement(element)).render(<KolButtonWrapper label={`Click ${cell.data?.id}`} />);
|
|
61
|
+
};
|
|
62
|
+
|
|
46
63
|
return (
|
|
47
64
|
<>
|
|
48
65
|
<SampleDescription>
|
|
49
66
|
<p>This sample shows KolTableStateful with checkboxes for selection enabled.</p>
|
|
50
67
|
</SampleDescription>
|
|
51
68
|
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
[
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
<section className="w-full">
|
|
70
|
+
<KolTableStateful
|
|
71
|
+
_label="Table with selection checkboxes"
|
|
72
|
+
_headers={{
|
|
73
|
+
horizontal: [
|
|
74
|
+
[
|
|
75
|
+
{ key: 'id', label: '#ID', textAlign: 'left' },
|
|
76
|
+
{ key: 'name', label: 'Name', textAlign: 'left' },
|
|
77
|
+
{ key: 'action', label: 'Action', textAlign: 'left', render: renderButton },
|
|
78
|
+
],
|
|
59
79
|
],
|
|
60
|
-
],
|
|
61
|
-
}}
|
|
62
|
-
_data={DATA}
|
|
63
|
-
_selection={selection}
|
|
64
|
-
_on={{ onSelectionChange: handleSelectionChangeCallback }}
|
|
65
|
-
className="block"
|
|
66
|
-
style={{ maxWidth: '600px' }}
|
|
67
|
-
ref={kolTableStatefulRef}
|
|
68
|
-
/>
|
|
69
|
-
<div className="grid grid-cols-3 items-end gap-4 mt-4">
|
|
70
|
-
<KolButton
|
|
71
|
-
_label="getSelection()"
|
|
72
|
-
_on={{
|
|
73
|
-
onClick: () => {
|
|
74
|
-
void handleButtonClick();
|
|
75
|
-
},
|
|
76
80
|
}}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
_data={DATA}
|
|
82
|
+
_selection={selection}
|
|
83
|
+
_on={{ onSelectionChange: handleSelectionChangeCallback }}
|
|
84
|
+
className="block"
|
|
85
|
+
style={{ maxWidth: '600px' }}
|
|
86
|
+
ref={kolTableStatefulRef}
|
|
87
|
+
/>
|
|
88
|
+
<div className="grid grid-cols-3 items-end gap-4 mt-4">
|
|
89
|
+
<KolButton
|
|
90
|
+
_label="getSelection()"
|
|
91
|
+
_on={{
|
|
92
|
+
onClick: () => {
|
|
93
|
+
void handleButtonClick();
|
|
94
|
+
},
|
|
95
|
+
}}
|
|
96
|
+
></KolButton>
|
|
97
|
+
<pre className="text-base">{JSON.stringify(selectedValue, null, 2)}</pre>
|
|
98
|
+
</div>
|
|
99
|
+
</section>
|
|
80
100
|
</>
|
|
81
101
|
);
|
|
82
102
|
};
|