onekijs-ui 0.18.2 → 0.19.0
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/components/accordion/AccordionService.d.ts +2 -1
- package/dist/components/accordion/components/AccordionComponent.d.ts +1 -1
- package/dist/components/accordion/hooks/useAccordionPanel.d.ts +1 -1
- package/dist/components/accordion/index.d.ts +1 -1
- package/dist/components/accordion/typings.d.ts +5 -3
- package/dist/components/button/typings.d.ts +1 -0
- package/dist/components/icon/RefreshIcon.d.ts +4 -0
- package/dist/components/list/components/CollectionListComponent.d.ts +1 -1
- package/dist/components/list/components/ListBodyComponent.d.ts +1 -1
- package/dist/components/list/components/LoadingItem.d.ts +1 -0
- package/dist/components/list/components/VirtualListComponent.d.ts +1 -1
- package/dist/components/table/components/TableActionComponent.d.ts +3 -0
- package/dist/components/table/components/TableLoadingComponent.d.ts +1 -1
- package/dist/components/table/components/TableLoadingRowComponent.d.ts +2 -1
- package/dist/components/table/typings.d.ts +5 -0
- package/dist/index.js +190 -60
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +190 -60
- package/dist/index.module.js.map +1 -1
- package/dist/styles/border.d.ts +1 -1
- package/dist/styles/size.d.ts +6 -6
- package/dist/styles/typings.d.ts +21 -7
- package/dist/styles/typography.d.ts +2 -2
- package/package.json +3 -3
- package/src/components/accordion/AccordionService.ts +21 -6
- package/src/components/accordion/components/AccordionComponent.tsx +2 -2
- package/src/components/accordion/components/AccordionPanel.tsx +6 -3
- package/src/components/accordion/hooks/useAccordionPanel.ts +2 -2
- package/src/components/accordion/index.ts +1 -1
- package/src/components/accordion/style.ts +2 -2
- package/src/components/accordion/typings.ts +5 -3
- package/src/components/button/style.ts +16 -7
- package/src/components/button/typings.ts +1 -0
- package/src/components/icon/RefreshIcon.tsx +41 -0
- package/src/components/list/components/CollectionListComponent.tsx +1 -1
- package/src/components/list/components/ListBodyComponent.tsx +18 -5
- package/src/components/list/components/LoadingItem.tsx +4 -2
- package/src/components/list/components/VirtualListComponent.tsx +2 -2
- package/src/components/list/hooks/useListView.tsx +4 -1
- package/src/components/notifications/components/NotificationsComponent.tsx +7 -1
- package/src/components/notifications/style.ts +13 -2
- package/src/components/select/components/SelectOptionComponent.tsx +4 -2
- package/src/components/table/components/ControllerTableComponent.tsx +38 -19
- package/src/components/table/components/TableActionComponent.tsx +22 -0
- package/src/components/table/components/TableBodyComponent.tsx +12 -4
- package/src/components/table/components/TableBodyRowComponent.tsx +15 -14
- package/src/components/table/components/TableLoadingComponent.tsx +1 -1
- package/src/components/table/components/TableLoadingRowComponent.tsx +7 -3
- package/src/components/table/style.ts +16 -1
- package/src/components/table/typings.ts +5 -0
- package/src/styles/typings.ts +21 -7
- package/src/theme/base.tsx +21 -7
package/dist/index.js
CHANGED
|
@@ -42,28 +42,41 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
let AccordionService = class AccordionService extends onekijsFramework.DefaultService {
|
|
45
|
-
initPanel(uid, initialActive = false) {
|
|
45
|
+
initPanel(uid, initialActive = false, initialExpand = false) {
|
|
46
46
|
if (this.state.panels[uid] === undefined) {
|
|
47
47
|
this.state.panels[uid] = {
|
|
48
48
|
uid,
|
|
49
49
|
active: initialActive,
|
|
50
|
+
expanded: initialExpand,
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
activate(uid) {
|
|
55
|
+
const panel = this.state.panels[uid];
|
|
56
|
+
if (panel) {
|
|
57
|
+
Object.keys(this.state.panels).forEach((uid) => {
|
|
58
|
+
this.state.panels[uid].active = false;
|
|
59
|
+
});
|
|
60
|
+
panel.active = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
53
63
|
collapse(uid) {
|
|
54
64
|
const panel = this.state.panels[uid];
|
|
55
65
|
if (panel) {
|
|
56
66
|
panel.active = false;
|
|
67
|
+
panel.expanded = false;
|
|
57
68
|
}
|
|
58
69
|
}
|
|
59
70
|
expand(uid) {
|
|
60
71
|
const panel = this.state.panels[uid];
|
|
61
72
|
if (panel) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
Object.keys(this.state.panels).forEach((uid) => {
|
|
74
|
+
this.state.panels[uid].active = false;
|
|
75
|
+
if (!this.state.multiExpand) {
|
|
76
|
+
this.state.panels[uid].expanded = false;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
panel.expanded = true;
|
|
67
80
|
panel.active = true;
|
|
68
81
|
}
|
|
69
82
|
}
|
|
@@ -71,9 +84,15 @@ let AccordionService = class AccordionService extends onekijsFramework.DefaultSe
|
|
|
71
84
|
__decorate([
|
|
72
85
|
onekijsFramework.reducer,
|
|
73
86
|
__metadata("design:type", Function),
|
|
74
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
87
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
75
88
|
__metadata("design:returntype", void 0)
|
|
76
89
|
], AccordionService.prototype, "initPanel", null);
|
|
90
|
+
__decorate([
|
|
91
|
+
onekijsFramework.reducer,
|
|
92
|
+
__metadata("design:type", Function),
|
|
93
|
+
__metadata("design:paramtypes", [String]),
|
|
94
|
+
__metadata("design:returntype", void 0)
|
|
95
|
+
], AccordionService.prototype, "activate", null);
|
|
77
96
|
__decorate([
|
|
78
97
|
onekijsFramework.reducer,
|
|
79
98
|
__metadata("design:type", Function),
|
|
@@ -273,7 +292,7 @@ const AccordionContainer = ({ className, children }) => {
|
|
|
273
292
|
*
|
|
274
293
|
* @example
|
|
275
294
|
* ```tsx
|
|
276
|
-
* <AccordionComponent
|
|
295
|
+
* <AccordionComponent multiExpand="true" />
|
|
277
296
|
* ```
|
|
278
297
|
*
|
|
279
298
|
* @group Accordion
|
|
@@ -282,7 +301,7 @@ const AccordionContainer = ({ className, children }) => {
|
|
|
282
301
|
*/
|
|
283
302
|
const AccordionComponent = ({ Component = AccordionContainer, ...props }) => {
|
|
284
303
|
const [state, service] = onekijsFramework.useService(AccordionService, {
|
|
285
|
-
|
|
304
|
+
multiExpand: props.multiExpand,
|
|
286
305
|
panels: {},
|
|
287
306
|
animate: props.animate ?? 150,
|
|
288
307
|
mode: props.mode ?? 'push',
|
|
@@ -637,11 +656,11 @@ const accordionStyle = ({ border = false, animate = 150, theme }) => {
|
|
|
637
656
|
|
|
638
657
|
.o-accordion-panel-active {
|
|
639
658
|
.o-accordion-panel-title {
|
|
640
|
-
${backgroundColor(t.activeBgColor, { hover: t.
|
|
659
|
+
${backgroundColor(t.activeBgColor, { hover: t.activeBgColor })}
|
|
641
660
|
${color(t.activeFontColor, { hover: t.activeFontColor })}
|
|
642
661
|
}
|
|
643
662
|
.o-accordion-content {
|
|
644
|
-
|
|
663
|
+
|
|
645
664
|
}
|
|
646
665
|
}
|
|
647
666
|
|
|
@@ -672,7 +691,7 @@ const accordionStyle = ({ border = false, animate = 150, theme }) => {
|
|
|
672
691
|
*
|
|
673
692
|
* @example
|
|
674
693
|
* ```tsx
|
|
675
|
-
* <Accordion
|
|
694
|
+
* <Accordion multiExpand="false" />
|
|
676
695
|
* ```
|
|
677
696
|
*
|
|
678
697
|
* @see AccordionComponent
|
|
@@ -682,14 +701,14 @@ const Accordion = styled(AccordionComponent) `
|
|
|
682
701
|
${accordionStyle}
|
|
683
702
|
`;
|
|
684
703
|
|
|
685
|
-
const useAccordionPanel = (initialActive = false) => {
|
|
704
|
+
const useAccordionPanel = (initialActive = false, initialExpand = false) => {
|
|
686
705
|
const uid = React.useId();
|
|
687
706
|
const service = useAccordionService();
|
|
688
707
|
const state = useAccordionState();
|
|
689
708
|
const panel = state.panels[uid];
|
|
690
709
|
React.useEffect(() => {
|
|
691
710
|
if (panel === undefined) {
|
|
692
|
-
service.initPanel(uid, initialActive);
|
|
711
|
+
service.initPanel(uid, initialActive, initialExpand);
|
|
693
712
|
}
|
|
694
713
|
});
|
|
695
714
|
return panel;
|
|
@@ -847,8 +866,9 @@ const AccordionPanelTitle = ({ title, active, onClick }) => {
|
|
|
847
866
|
React.createElement("span", null, `${title}`)));
|
|
848
867
|
};
|
|
849
868
|
|
|
850
|
-
const AccordionPanel = ({ title, initialActive, children, Component = AccordionPanelTitle, link, }) => {
|
|
851
|
-
|
|
869
|
+
const AccordionPanel = ({ title, initialActive, initialExpand, children, Component = AccordionPanelTitle, link, }) => {
|
|
870
|
+
initialExpand = initialExpand ?? initialActive;
|
|
871
|
+
const panel = useAccordionPanel(initialActive, initialExpand);
|
|
852
872
|
const service = useAccordionService();
|
|
853
873
|
const { animate } = useAccordionState();
|
|
854
874
|
const router = onekijsFramework.useTryRouter();
|
|
@@ -889,8 +909,8 @@ const AccordionPanel = ({ title, initialActive, children, Component = AccordionP
|
|
|
889
909
|
}
|
|
890
910
|
return (React.createElement("div", { className: `o-accordion-panel${panel.active ? ' o-accordion-panel-active' : ''}` },
|
|
891
911
|
React.createElement(Component, { title: title, active: panel.active, onClick: toggle, link: link }),
|
|
892
|
-
React.createElement(reactTransitionGroup.CSSTransition, { in: panel.
|
|
893
|
-
React.createElement("div", null,
|
|
912
|
+
React.createElement(reactTransitionGroup.CSSTransition, { in: panel.expanded, classNames: "o-accordion-animate", timeout: animate, mountOnEnter: false, appear: false, unmountOnExit: true, onExiting: onExiting, onEntering: onEntering, onEntered: onEntered },
|
|
913
|
+
React.createElement("div", null, React.createElement("div", { className: "o-accordion-content" }, children)))));
|
|
894
914
|
};
|
|
895
915
|
|
|
896
916
|
const ButtonComponent = React.forwardRef((props, ref) => {
|
|
@@ -931,7 +951,8 @@ const zIndex = cssProperty('z-index');
|
|
|
931
951
|
const getColor = (key, pattern) => {
|
|
932
952
|
return `${key}${pattern === 'solid' ? '' : onekijsFramework.ucfirst(pattern)}`;
|
|
933
953
|
};
|
|
934
|
-
const buttonStyle = ({ kind = 'primary', pattern = 'solid', disabled, IconComponent, theme, }) => {
|
|
954
|
+
const buttonStyle = ({ kind = 'primary', pattern = 'solid', size = 'medium', disabled, IconComponent, theme, }) => {
|
|
955
|
+
const uSize = onekijsFramework.ucfirst(size);
|
|
935
956
|
const t = theme.buttons[kind];
|
|
936
957
|
const bgColor = onekijsFramework.get(t, getColor('bgColor', pattern));
|
|
937
958
|
const hoverBgColor = onekijsFramework.get(t, getColor('hoverBgColor', pattern));
|
|
@@ -939,6 +960,13 @@ const buttonStyle = ({ kind = 'primary', pattern = 'solid', disabled, IconCompon
|
|
|
939
960
|
const hoverFontColor = onekijsFramework.get(t, getColor('hoverColor', pattern));
|
|
940
961
|
const bColor = onekijsFramework.get(t, getColor('borderColor', pattern));
|
|
941
962
|
const hoverBorderColor = onekijsFramework.get(t, getColor('hoverBorderColor', pattern));
|
|
963
|
+
const tPaddingX = onekijsFramework.get(t, `paddingX${uSize}`);
|
|
964
|
+
const tPaddingY = onekijsFramework.get(t, `paddingY${uSize}`);
|
|
965
|
+
const tBorderRadius = onekijsFramework.get(t, `borderRadius${uSize}`);
|
|
966
|
+
const tBorderWidth = onekijsFramework.get(t, `borderWidth${uSize}`);
|
|
967
|
+
const tLineHeight = onekijsFramework.get(t, `lineHeight${uSize}`);
|
|
968
|
+
const tFontSize = onekijsFramework.get(t, `fontSize${uSize}`);
|
|
969
|
+
const tLetterSpacing = onekijsFramework.get(t, `letterSpacing${uSize}`);
|
|
942
970
|
return styled.css `
|
|
943
971
|
${display('inline-flex')}
|
|
944
972
|
${alignItems('center')}
|
|
@@ -948,11 +976,11 @@ const buttonStyle = ({ kind = 'primary', pattern = 'solid', disabled, IconCompon
|
|
|
948
976
|
${color(fontColor, {
|
|
949
977
|
hover: disabled ? fontColor : hoverFontColor,
|
|
950
978
|
})}
|
|
951
|
-
${paddingX(
|
|
952
|
-
${paddingY(
|
|
953
|
-
${borderRadius(
|
|
979
|
+
${paddingX(tPaddingX)}
|
|
980
|
+
${paddingY(tPaddingY)}
|
|
981
|
+
${borderRadius(tBorderRadius)}
|
|
954
982
|
${borderStyle(t.borderStyle)}
|
|
955
|
-
${borderWidth(
|
|
983
|
+
${borderWidth(tBorderWidth)}
|
|
956
984
|
${borderColor(bColor, {
|
|
957
985
|
hover: disabled ? bColor : hoverBorderColor,
|
|
958
986
|
})}
|
|
@@ -965,9 +993,9 @@ const buttonStyle = ({ kind = 'primary', pattern = 'solid', disabled, IconCompon
|
|
|
965
993
|
${whiteSpace(t.whiteSpace)}
|
|
966
994
|
${textOverflow(t.textOverflow)}
|
|
967
995
|
${textTransform(t.textTransform)}
|
|
968
|
-
${letterSpacing(
|
|
969
|
-
${lineHeight(
|
|
970
|
-
${fontSize(
|
|
996
|
+
${letterSpacing(tLetterSpacing)}
|
|
997
|
+
${lineHeight(tLineHeight)}
|
|
998
|
+
${fontSize(tFontSize)}
|
|
971
999
|
${opacity(disabled ? 0.6 : 1)}
|
|
972
1000
|
${marginLeft(IconComponent ? 'xs' : 'none')}
|
|
973
1001
|
${outline('none')}
|
|
@@ -4464,6 +4492,7 @@ const useListView = ({ controller, height, itemHeight = defaultItemHeight, overs
|
|
|
4464
4492
|
if (controller.status !== onekijsFramework.LoadingStatus.NotReady) {
|
|
4465
4493
|
if (isVirtual) {
|
|
4466
4494
|
if (controller.status === onekijsFramework.LoadingStatus.NotInitialized) {
|
|
4495
|
+
scrollToOffset(0);
|
|
4467
4496
|
controller.load(preload, undefined, true);
|
|
4468
4497
|
}
|
|
4469
4498
|
else {
|
|
@@ -4480,7 +4509,7 @@ const useListView = ({ controller, height, itemHeight = defaultItemHeight, overs
|
|
|
4480
4509
|
let to;
|
|
4481
4510
|
const first = Math.max(0, lastVirtualItemIndex - increment);
|
|
4482
4511
|
if (lastVirtualItemIndex > 0) {
|
|
4483
|
-
let slice = state.items.slice(first, lastVirtualItemIndex);
|
|
4512
|
+
let slice = state.items.slice(first, lastVirtualItemIndex).filter(() => true);
|
|
4484
4513
|
if (slice.length < lastVirtualItemIndex - first) {
|
|
4485
4514
|
const arr = new Array(lastVirtualItemIndex - first);
|
|
4486
4515
|
arr.splice(arr.length - slice.length, slice.length, ...slice);
|
|
@@ -4590,7 +4619,9 @@ const LoadingItem = ({ className }) => {
|
|
|
4590
4619
|
var LoadingItem$1 = styled(LoadingItem) `
|
|
4591
4620
|
${height('full')}
|
|
4592
4621
|
${width('full')}
|
|
4593
|
-
${
|
|
4622
|
+
${(props) => {
|
|
4623
|
+
return minHeight(`${props.minHeight ?? 37}px`);
|
|
4624
|
+
}}
|
|
4594
4625
|
${marginY('1px')}
|
|
4595
4626
|
animation: skeleton-loading 1s linear infinite alternate;
|
|
4596
4627
|
|
|
@@ -4795,8 +4826,9 @@ const ListBodyComponent = ({ autoRefresh, bodyRef, className, follow, height, it
|
|
|
4795
4826
|
mouseRef.current = false;
|
|
4796
4827
|
});
|
|
4797
4828
|
React.useEffect(() => {
|
|
4829
|
+
const ref = parentRef ? parentRef : bodyRef;
|
|
4830
|
+
//console.log('parentRef', parentRef, 'ref', ref)
|
|
4798
4831
|
const atBottom = () => {
|
|
4799
|
-
const ref = parentRef ? parentRef : bodyRef;
|
|
4800
4832
|
if (ref && ref.current) {
|
|
4801
4833
|
const sh = ref.current.scrollHeight;
|
|
4802
4834
|
const st = ref.current.scrollTop;
|
|
@@ -4806,9 +4838,21 @@ const ListBodyComponent = ({ autoRefresh, bodyRef, className, follow, height, it
|
|
|
4806
4838
|
}
|
|
4807
4839
|
return false;
|
|
4808
4840
|
};
|
|
4809
|
-
if (tail && scrollToIndex && totalSize &&
|
|
4810
|
-
|
|
4811
|
-
|
|
4841
|
+
if (tail && scrollToIndex && totalSize && ref && ref.current) {
|
|
4842
|
+
// console.log(
|
|
4843
|
+
// 'scrollTop',
|
|
4844
|
+
// ref.current.scrollTop,
|
|
4845
|
+
// 'mouseRef',
|
|
4846
|
+
// mouseRef.current,
|
|
4847
|
+
// 'wheelRef',
|
|
4848
|
+
// wheelRef.current,
|
|
4849
|
+
// 'applyTail',
|
|
4850
|
+
// tailRef.current.applyTail,
|
|
4851
|
+
// 'atBottom',
|
|
4852
|
+
// atBottom(),
|
|
4853
|
+
// );
|
|
4854
|
+
tailRef.current.lastScrollTop = ref.current.scrollTop;
|
|
4855
|
+
if (!atBottom() && (mouseRef.current || wheelRef.current)) {
|
|
4812
4856
|
tailRef.current.applyTail = false;
|
|
4813
4857
|
}
|
|
4814
4858
|
else if (tailRef.current.applyTail === true || atBottom()) {
|
|
@@ -5499,6 +5543,7 @@ const NotificationComponent = ({ className, notification, showTimer = true }) =>
|
|
|
5499
5543
|
const NotificationsComponent = ({ className, topics, NotificationComponent: NotificationComponent$1 = NotificationComponent, max, animate = 500, position = 'bottom-right', showTimer, }) => {
|
|
5500
5544
|
const classNames = addClassname('o-notifications', className);
|
|
5501
5545
|
const translateX = position === 'top-right' || position === 'bottom-right' ? '250px' : '-250px';
|
|
5546
|
+
const notificationService = onekijsFramework.useNotificationService();
|
|
5502
5547
|
let notifications = onekijsFramework.useNotifications(topics);
|
|
5503
5548
|
if (max) {
|
|
5504
5549
|
notifications = notifications.slice(0, max);
|
|
@@ -5560,6 +5605,8 @@ const NotificationsComponent = ({ className, topics, NotificationComponent: Noti
|
|
|
5560
5605
|
document.body.style.overflowY = bodyOverflowYRef.current;
|
|
5561
5606
|
};
|
|
5562
5607
|
const element = (React.createElement("div", { className: classNames },
|
|
5608
|
+
notifications.length > 1 && (React.createElement("div", { className: "o-notification-close-all" },
|
|
5609
|
+
React.createElement("span", { className: "o-notification-close-all-content", onClick: () => notificationService.clearAll() }, "Close all"))),
|
|
5563
5610
|
React.createElement(reactTransitionGroup.TransitionGroup, { component: null }, notifications.map((notification, index) => (React.createElement(reactTransitionGroup.CSSTransition, { timeout: {
|
|
5564
5611
|
appear: animate * 2,
|
|
5565
5612
|
enter: animate * 2,
|
|
@@ -5587,6 +5634,17 @@ const notifcationsStyle = ({ position: pos = 'bottom-right' }) => {
|
|
|
5587
5634
|
${opacity(0)}
|
|
5588
5635
|
${display('flex')}
|
|
5589
5636
|
}
|
|
5637
|
+
.o-notification-close-all {
|
|
5638
|
+
${textAlign('right')}
|
|
5639
|
+
${paddingRight('sm')}
|
|
5640
|
+
${paddingBottom('sm')}
|
|
5641
|
+
}
|
|
5642
|
+
.o-notification-close-all-content{
|
|
5643
|
+
${fontSize('lg')}
|
|
5644
|
+
${cursor('pointer')}
|
|
5645
|
+
${color('primary')}
|
|
5646
|
+
${fontWeight('medium')}
|
|
5647
|
+
}
|
|
5590
5648
|
.o-notification {
|
|
5591
5649
|
${minWidth('450px')}
|
|
5592
5650
|
${maxWidth('450px')}
|
|
@@ -6285,11 +6343,11 @@ const SelectOptionComponent = (props) => {
|
|
|
6285
6343
|
if (!item || !item.data)
|
|
6286
6344
|
return null;
|
|
6287
6345
|
return (React.createElement(React.Fragment, null,
|
|
6288
|
-
displayGroup && React.createElement(OptionGroupComponent, { ...props }),
|
|
6289
|
-
React.createElement("div", { className: classNames, onClick: () => onItemClick(item, index), onMouseEnter: () => hoverable && onMouseEnter && item && onMouseEnter(item, index), onMouseLeave: () => hoverable && onMouseLeave && item && onMouseLeave(item, index) },
|
|
6346
|
+
displayGroup && React.createElement(OptionGroupComponent, { ...props, key: "group" }),
|
|
6347
|
+
React.createElement("div", { className: classNames, onClick: () => onItemClick(item, index), onMouseEnter: () => hoverable && onMouseEnter && item && onMouseEnter(item, index), onMouseLeave: () => hoverable && onMouseLeave && item && onMouseLeave(item, index), key: "content" },
|
|
6290
6348
|
React.createElement("div", { style: { display: 'flex' }, ref: ref },
|
|
6291
|
-
service.config?.multiple && (React.createElement(Checkbox, { value: item?.selected ? true : false, onChange: () => onItemClick(item, index), color: "currentColor", className: "o-select-option-multiple-checkbox" })),
|
|
6292
|
-
React.createElement(OptionContentComponent, { ...props, onClick: () => onItemClick(item, index) })))));
|
|
6349
|
+
service.config?.multiple && (React.createElement(Checkbox, { value: item?.selected ? true : false, onChange: () => onItemClick(item, index), color: "currentColor", className: "o-select-option-multiple-checkbox", key: "checkbox" })),
|
|
6350
|
+
React.createElement(OptionContentComponent, { ...props, onClick: () => onItemClick(item, index), key: "option_content" })))));
|
|
6293
6351
|
};
|
|
6294
6352
|
SelectOptionComponent.displayName = 'SelectOptionComponent';
|
|
6295
6353
|
var SelectOptionComponent$1 = React.memo(SelectOptionComponent);
|
|
@@ -8831,6 +8889,33 @@ const useTableState = () => {
|
|
|
8831
8889
|
return React.useContext(TableStateContext);
|
|
8832
8890
|
};
|
|
8833
8891
|
|
|
8892
|
+
const RefreshIconComponent = (props) => {
|
|
8893
|
+
return (React.createElement("div", { ...props },
|
|
8894
|
+
React.createElement("svg", { className: "o-icon-refresh-svg", stroke: "currentColor", fill: "none", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg" },
|
|
8895
|
+
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }))));
|
|
8896
|
+
};
|
|
8897
|
+
var RefreshIcon = styled(RefreshIconComponent) `
|
|
8898
|
+
${({ width = '16px', height = '16px', color: cssColor = 'inherit' }) => styled.css `
|
|
8899
|
+
width: ${width};
|
|
8900
|
+
height: ${height};
|
|
8901
|
+
${display('flex')};
|
|
8902
|
+
${alignItems('center')};
|
|
8903
|
+
${color(cssColor)}
|
|
8904
|
+
.o-icon-refresh-svg {
|
|
8905
|
+
display: inline-block;
|
|
8906
|
+
}
|
|
8907
|
+
`}
|
|
8908
|
+
`;
|
|
8909
|
+
|
|
8910
|
+
const TableActionComponent = () => {
|
|
8911
|
+
const { showRefreshButton, refreshButtonKind } = useTableConfig();
|
|
8912
|
+
const table = useTableService();
|
|
8913
|
+
return (React.createElement("div", { className: "o-table-actions" },
|
|
8914
|
+
React.createElement("div", { className: "o-table-action" }),
|
|
8915
|
+
showRefreshButton && React.createElement("div", { className: "o-table-refresh" },
|
|
8916
|
+
React.createElement(Button, { kind: refreshButtonKind, size: "small", IconComponent: () => React.createElement(RefreshIcon, null), onClick: () => table.reload() }, "Refresh"))));
|
|
8917
|
+
};
|
|
8918
|
+
|
|
8834
8919
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8835
8920
|
const useTableColumns = () => {
|
|
8836
8921
|
return useTableState().columns;
|
|
@@ -8917,7 +9002,9 @@ const TableBodyCellComponent = React.memo((props) => {
|
|
|
8917
9002
|
TableBodyCellComponent.displayName = 'TableCell';
|
|
8918
9003
|
|
|
8919
9004
|
const TableLoadingRowComponent = (props) => {
|
|
8920
|
-
|
|
9005
|
+
const { itemHeight } = useTableConfig();
|
|
9006
|
+
const minHeight = typeof itemHeight === 'function' ? itemHeight(props.index) : itemHeight;
|
|
9007
|
+
return React.createElement(LoadingItem$1, { ...props, minHeight: minHeight });
|
|
8921
9008
|
};
|
|
8922
9009
|
const style = ({ theme }) => {
|
|
8923
9010
|
const t = theme.table;
|
|
@@ -8931,7 +9018,8 @@ var TableLoadingRowComponent$1 = styled(TableLoadingRowComponent) `
|
|
|
8931
9018
|
`;
|
|
8932
9019
|
|
|
8933
9020
|
const timeout = 500;
|
|
8934
|
-
const TableBodyRowComponent = (
|
|
9021
|
+
const TableBodyRowComponent = (props) => {
|
|
9022
|
+
const { item, index, columns, CellComponent = TableBodyCellComponent, className, onExpand, onExpanding, onExpanded, onCollapse, onCollapsing, onCollapsed, } = props;
|
|
8935
9023
|
const [hover, setHover] = React.useState(false);
|
|
8936
9024
|
const { highlightRow, stripRows, LoadingRowComponent = TableLoadingRowComponent$1, ExpandedComponent, } = useTableConfig();
|
|
8937
9025
|
const expandedHeightRef = React.useRef(0);
|
|
@@ -8961,7 +9049,7 @@ const TableBodyRowComponent = ({ item, index, columns, CellComponent = TableBody
|
|
|
8961
9049
|
if (onekijsFramework.isItemFetching(item)) {
|
|
8962
9050
|
return (React.createElement("div", { className: rowContainerClassName },
|
|
8963
9051
|
React.createElement("div", { className: "o-table-body-row" },
|
|
8964
|
-
React.createElement(LoadingRowComponent,
|
|
9052
|
+
React.createElement(LoadingRowComponent, { ...props }))));
|
|
8965
9053
|
}
|
|
8966
9054
|
return (React.createElement("div", { className: rowContainerClassName },
|
|
8967
9055
|
React.createElement("div", { className: rowClassName, onMouseEnter: highlightRow ? () => setHover(true) : undefined, onMouseLeave: highlightRow ? () => setHover(false) : undefined, style: { display: 'flex' } }, columns.map((column, colIndex) => {
|
|
@@ -8992,16 +9080,19 @@ const TableNotFoundComponent = ({ text = 'No data' }) => {
|
|
|
8992
9080
|
const TableBodyComponent = ({ className, tableRef, contentRef }) => {
|
|
8993
9081
|
const service = useTableService();
|
|
8994
9082
|
const state = useTableState();
|
|
8995
|
-
const { autoRefresh, follow, height, increment, onRowClick, onRowEnter, onRowLeave, paddingEnd, paddingStart, parentRef, preload, RowComponent = TableBodyRowComponent, rowClassName, LoadingComponent = TableLoadingComponent$1, NotFoundComponent = TableNotFoundComponent, tail, } = useTableConfig();
|
|
8996
|
-
const
|
|
8997
|
-
|
|
9083
|
+
const { autoRefresh, follow, height, itemHeight, increment, onRowClick, onRowEnter, onRowLeave, paddingEnd, paddingStart, parentRef, preload, RowComponent = TableBodyRowComponent, rowClassName, LoadingComponent = TableLoadingComponent$1, NotFoundComponent = TableNotFoundComponent, LoadingRowComponent = TableLoadingRowComponent$1, tail, } = useTableConfig();
|
|
9084
|
+
const itemHeightFunction = React.useCallback((index) => {
|
|
9085
|
+
if (typeof itemHeight === 'function') {
|
|
9086
|
+
return itemHeight(index);
|
|
9087
|
+
}
|
|
9088
|
+
return itemHeight || 37;
|
|
8998
9089
|
}, []);
|
|
8999
9090
|
const { items, isVirtual, totalSize, virtualItems, measure, scrollToIndex } = useListView({
|
|
9000
9091
|
controller: service,
|
|
9001
9092
|
height: height,
|
|
9002
9093
|
ref: parentRef || tableRef,
|
|
9003
9094
|
overscan: 10,
|
|
9004
|
-
itemHeight,
|
|
9095
|
+
itemHeight: itemHeightFunction,
|
|
9005
9096
|
paddingEnd,
|
|
9006
9097
|
paddingStart,
|
|
9007
9098
|
preload,
|
|
@@ -9022,7 +9113,7 @@ const TableBodyComponent = ({ className, tableRef, contentRef }) => {
|
|
|
9022
9113
|
if (service.status === onekijsFramework.LoadingStatus.Loaded && items.length === 0 && NotFoundComponent) {
|
|
9023
9114
|
return React.createElement(NotFoundComponent, null);
|
|
9024
9115
|
}
|
|
9025
|
-
return (React.createElement(ListBodyComponent, { autoRefresh: autoRefresh, className: addClassname('o-table-body', className), follow: follow, height: height, ItemComponent: ItemComponentRef.current, items: items, onItemSelect: onRowClick, onItemHighlight: onRowEnter, onItemUnhighlight: onRowLeave, parentRef: parentRef || tableRef, bodyRef: contentRef, service: service, state: state, totalSize: totalSize, tail: tail, virtualItems: isVirtual ? virtualItems : undefined, scrollToIndex: scrollToIndex }));
|
|
9116
|
+
return (React.createElement(ListBodyComponent, { autoRefresh: autoRefresh, className: addClassname('o-table-body', className), follow: follow, height: height, ItemComponent: ItemComponentRef.current, ItemLoadingComponent: LoadingRowComponent, items: items, onItemSelect: onRowClick, onItemHighlight: onRowEnter, onItemUnhighlight: onRowLeave, parentRef: parentRef || tableRef, bodyRef: contentRef, service: service, state: state, totalSize: totalSize, tail: tail, virtualItems: isVirtual ? virtualItems : undefined, scrollToIndex: scrollToIndex }));
|
|
9026
9117
|
};
|
|
9027
9118
|
TableBodyComponent.displayName = 'TableBody';
|
|
9028
9119
|
|
|
@@ -9146,6 +9237,18 @@ const tableStyle = ({ theme, fit = true }) => {
|
|
|
9146
9237
|
${() => (fit ? 'flex-grow: 1;' : '')}
|
|
9147
9238
|
}
|
|
9148
9239
|
|
|
9240
|
+
.o-table-actions {
|
|
9241
|
+
${display('flex')}
|
|
9242
|
+
}
|
|
9243
|
+
|
|
9244
|
+
.o-table-action {
|
|
9245
|
+
${flexGrow(1)}
|
|
9246
|
+
}
|
|
9247
|
+
|
|
9248
|
+
.o-table-refresh {
|
|
9249
|
+
${marginBottom('sm')}
|
|
9250
|
+
${marginRight('xl')}
|
|
9251
|
+
}
|
|
9149
9252
|
|
|
9150
9253
|
.o-table-not-found {
|
|
9151
9254
|
${display('flex')}
|
|
@@ -9167,6 +9270,7 @@ const tableStyle = ({ theme, fit = true }) => {
|
|
|
9167
9270
|
${borderBottomStyle(t.tdBorderBottomStyle)}
|
|
9168
9271
|
}
|
|
9169
9272
|
.o-table-body-row-expanded {
|
|
9273
|
+
${fontSize('default')}
|
|
9170
9274
|
.o-table-body-row {
|
|
9171
9275
|
${backgroundColor(t.tdExpandedBgColor)}
|
|
9172
9276
|
}
|
|
@@ -9368,6 +9472,7 @@ const tableStyle = ({ theme, fit = true }) => {
|
|
|
9368
9472
|
|
|
9369
9473
|
|
|
9370
9474
|
&.o-form-table {
|
|
9475
|
+
${flexGrow(1)}
|
|
9371
9476
|
${boxShadow('none')}
|
|
9372
9477
|
${paddingRight('none')}
|
|
9373
9478
|
.o-table-body-row:hover {
|
|
@@ -9602,7 +9707,7 @@ const ExpandedCellComponent = ({ item, className }) => {
|
|
|
9602
9707
|
React.createElement(TogglerIcon, { open: item.expanded, model: "plus", color: "primary" })));
|
|
9603
9708
|
};
|
|
9604
9709
|
|
|
9605
|
-
const ControllerTableComponent = ({ autoRefresh, controller, className, bodyClassName, BodyComponent = TableBodyComponent, ExpandedComponent, filterable, fit, fixHeader = true, follow, grow, FooterComponent = TableFooterComponent, footerClassName, header = true, headerClassName, HeaderComponent = TableHeaderComponent, increment, LoadingComponent, LoadingRowComponent, NotFoundComponent, footer = false, height, highlightRow, onRowClick, onRowEnter, onRowLeave, onRowOver, onRowOut, paddingEnd, paddingStart, parentRef, preload, rowClassName, RowComponent, sortable, stripRows, tail, }) => {
|
|
9710
|
+
const ControllerTableComponent = ({ ActionComponent = TableActionComponent, autoRefresh, controller, className, bodyClassName, BodyComponent = TableBodyComponent, ExpandedComponent, filterable, fit, fixHeader = true, follow, grow, FooterComponent = TableFooterComponent, footerClassName, header = true, headerClassName, HeaderComponent = TableHeaderComponent, increment, itemHeight, LoadingComponent, LoadingRowComponent, NotFoundComponent, footer = false, height, highlightRow, onRowClick, onRowEnter, onRowLeave, onRowOver, onRowOut, paddingEnd, paddingStart, parentRef, preload, refreshButtonKind = 'primary', rowClassName, RowComponent, showRefreshButton, sortable, stripRows, tail, }) => {
|
|
9606
9711
|
const classNames = addClassname('o-table', className);
|
|
9607
9712
|
const { columns, items } = controller.state;
|
|
9608
9713
|
const contentRef = React.useRef(null);
|
|
@@ -9610,6 +9715,7 @@ const ControllerTableComponent = ({ autoRefresh, controller, className, bodyClas
|
|
|
9610
9715
|
const service = controller.asService();
|
|
9611
9716
|
const config = React.useMemo(() => {
|
|
9612
9717
|
return {
|
|
9718
|
+
ActionComponent,
|
|
9613
9719
|
autoRefresh,
|
|
9614
9720
|
bodyClassName,
|
|
9615
9721
|
BodyComponent,
|
|
@@ -9629,6 +9735,7 @@ const ControllerTableComponent = ({ autoRefresh, controller, className, bodyClas
|
|
|
9629
9735
|
height,
|
|
9630
9736
|
highlightRow,
|
|
9631
9737
|
increment,
|
|
9738
|
+
itemHeight,
|
|
9632
9739
|
LoadingComponent,
|
|
9633
9740
|
LoadingRowComponent,
|
|
9634
9741
|
NotFoundComponent,
|
|
@@ -9641,13 +9748,16 @@ const ControllerTableComponent = ({ autoRefresh, controller, className, bodyClas
|
|
|
9641
9748
|
paddingStart,
|
|
9642
9749
|
parentRef,
|
|
9643
9750
|
preload,
|
|
9751
|
+
refreshButtonKind,
|
|
9644
9752
|
rowClassName,
|
|
9645
9753
|
RowComponent,
|
|
9754
|
+
showRefreshButton,
|
|
9646
9755
|
sortable,
|
|
9647
9756
|
stripRows,
|
|
9648
|
-
tail
|
|
9757
|
+
tail,
|
|
9649
9758
|
};
|
|
9650
9759
|
}, [
|
|
9760
|
+
ActionComponent,
|
|
9651
9761
|
autoRefresh,
|
|
9652
9762
|
bodyClassName,
|
|
9653
9763
|
BodyComponent,
|
|
@@ -9667,6 +9777,7 @@ const ControllerTableComponent = ({ autoRefresh, controller, className, bodyClas
|
|
|
9667
9777
|
height,
|
|
9668
9778
|
highlightRow,
|
|
9669
9779
|
increment,
|
|
9780
|
+
itemHeight,
|
|
9670
9781
|
LoadingComponent,
|
|
9671
9782
|
LoadingRowComponent,
|
|
9672
9783
|
NotFoundComponent,
|
|
@@ -9679,8 +9790,10 @@ const ControllerTableComponent = ({ autoRefresh, controller, className, bodyClas
|
|
|
9679
9790
|
paddingStart,
|
|
9680
9791
|
parentRef,
|
|
9681
9792
|
preload,
|
|
9793
|
+
refreshButtonKind,
|
|
9682
9794
|
rowClassName,
|
|
9683
9795
|
RowComponent,
|
|
9796
|
+
showRefreshButton,
|
|
9684
9797
|
sortable,
|
|
9685
9798
|
stripRows,
|
|
9686
9799
|
tail,
|
|
@@ -9701,16 +9814,19 @@ const ControllerTableComponent = ({ autoRefresh, controller, className, bodyClas
|
|
|
9701
9814
|
}
|
|
9702
9815
|
}
|
|
9703
9816
|
}, [service, ExpandedComponent]);
|
|
9817
|
+
const id = React.useId();
|
|
9704
9818
|
return (React.createElement(TableServiceContext.Provider, { value: controller.asService() },
|
|
9705
9819
|
React.createElement(TableStateContext.Provider, { value: controller.state },
|
|
9706
9820
|
React.createElement(TableConfigContext.Provider, { value: config },
|
|
9707
|
-
React.createElement("div", { className:
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9821
|
+
React.createElement("div", { className: className },
|
|
9822
|
+
React.createElement(ActionComponent, null),
|
|
9823
|
+
React.createElement("div", { id: id, className: classNames, ref: tableRef, style: {
|
|
9824
|
+
maxHeight: height,
|
|
9825
|
+
overflow: 'auto',
|
|
9826
|
+
} },
|
|
9827
|
+
header && React.createElement(HeaderComponent, { columns: columns, className: headerClassName }),
|
|
9828
|
+
React.createElement(BodyComponent, { items: items || [], columns: columns, tableRef: tableRef, contentRef: contentRef, className: bodyClassName }),
|
|
9829
|
+
footer && React.createElement(FooterComponent, { columns: columns, className: footerClassName })))))));
|
|
9714
9830
|
};
|
|
9715
9831
|
ControllerTableComponent.displayName = 'Table';
|
|
9716
9832
|
|
|
@@ -11520,15 +11636,21 @@ const baseTheme = (customTheme = {}) => {
|
|
|
11520
11636
|
borderColor: kind,
|
|
11521
11637
|
borderColorFlat: 'transparent',
|
|
11522
11638
|
borderColorOutline: kind,
|
|
11523
|
-
|
|
11639
|
+
borderRadiusMedium: 'sm',
|
|
11640
|
+
borderRadiusSmall: 'sm',
|
|
11641
|
+
borderRadiusLarge: 'sm',
|
|
11524
11642
|
borderStyle: 'solid',
|
|
11525
|
-
|
|
11643
|
+
borderWidthSmall: 1,
|
|
11644
|
+
borderWidthMedium: 1,
|
|
11645
|
+
borderWidthLarge: 1,
|
|
11526
11646
|
color: ['light', 'lightest', 'lighter', 'white'].includes(kind) ? 'darker' : 'white',
|
|
11527
11647
|
colorFlat: kind,
|
|
11528
11648
|
colorOutline: ['light', 'lightest', 'lighter', 'white'].includes(kind) ? 'darkest' : kind,
|
|
11529
11649
|
cursor: 'pointer',
|
|
11530
11650
|
cursorDisabled: 'not-allowed',
|
|
11531
|
-
|
|
11651
|
+
fontSizeMedium: 'md',
|
|
11652
|
+
fontSizeSmall: 'sm',
|
|
11653
|
+
fontSizeLarge: 'lg',
|
|
11532
11654
|
fontWeight: 'bold',
|
|
11533
11655
|
hoverColor: ['light', 'lightest', 'lighter', 'white'].includes(kind) ? 'black' : 'white',
|
|
11534
11656
|
hoverColorFlat: lighten(onekijsFramework.get(theme.colors, kind, ''), 100),
|
|
@@ -11539,12 +11661,20 @@ const baseTheme = (customTheme = {}) => {
|
|
|
11539
11661
|
hoverBorderColor: darken(onekijsFramework.get(theme.colors, kind, ''), 100),
|
|
11540
11662
|
hoverBorderColorFlat: 'transparent',
|
|
11541
11663
|
hoverBorderColorOutline: kind,
|
|
11542
|
-
|
|
11543
|
-
|
|
11664
|
+
letterSpacingMedium: 'normal',
|
|
11665
|
+
letterSpacingSmall: 'normal',
|
|
11666
|
+
letterSpacingLarge: 'normal',
|
|
11667
|
+
lineHeightMedium: '3xl',
|
|
11668
|
+
lineHeightSmall: '2xl',
|
|
11669
|
+
lineHeightLarge: '4xl',
|
|
11544
11670
|
opacity: 1,
|
|
11545
11671
|
opacityDisabled: 0.6,
|
|
11546
|
-
|
|
11547
|
-
|
|
11672
|
+
paddingYMedium: 'none',
|
|
11673
|
+
paddingYSmall: 'none',
|
|
11674
|
+
paddingYLarge: 'none',
|
|
11675
|
+
paddingXMedium: 'lg',
|
|
11676
|
+
paddingXSmall: 'md',
|
|
11677
|
+
paddingXLarge: 'xl',
|
|
11548
11678
|
textOverflow: 'ellipsis',
|
|
11549
11679
|
textTransform: 'none',
|
|
11550
11680
|
whiteSpace: 'nowrap',
|