onekijs-ui 1.0.2 → 1.0.4
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/list/typings.d.ts +1 -1
- package/dist/components/select/SelectService.d.ts +3 -3
- package/dist/components/tree/components/VirtualTreeListComponent.d.ts +1 -1
- package/dist/components/wizard/WizardModal.d.ts +2 -2
- package/dist/components/wizard/index.d.ts +2 -2
- package/dist/index.js +53 -17
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +53 -17
- package/dist/index.module.js.map +1 -1
- package/package.json +3 -3
- package/src/components/list/components/ListBodyComponent.tsx +1 -0
- package/src/components/list/components/VirtualListComponent.tsx +2 -0
- package/src/components/list/hooks/useListView.tsx +0 -2
- package/src/components/list/typings.ts +1 -1
- package/src/components/table/components/FormTableComponent.tsx +1 -1
- package/src/components/tooltip/components/TooltipComponent.tsx +7 -2
- package/src/components/tree/components/VirtualTreeListComponent.tsx +61 -24
- package/src/vendor/reactVirtual.js +12 -3
package/dist/index.module.js
CHANGED
|
@@ -1703,7 +1703,7 @@ const TooltipComponent = (props) => {
|
|
|
1703
1703
|
const [show, setShow] = useState(true);
|
|
1704
1704
|
const [open, setOpen] = useState(false);
|
|
1705
1705
|
const arrowRef = useRef(null);
|
|
1706
|
-
const { context, floatingStyles, middlewareData, refs } = useFloating({
|
|
1706
|
+
const { context, floatingStyles, middlewareData, placement: resolvedPlacement, refs } = useFloating({
|
|
1707
1707
|
open,
|
|
1708
1708
|
onOpenChange: setOpen,
|
|
1709
1709
|
placement,
|
|
@@ -1735,7 +1735,7 @@ const TooltipComponent = (props) => {
|
|
|
1735
1735
|
document.removeEventListener('tooltipVisible', listener);
|
|
1736
1736
|
};
|
|
1737
1737
|
}, [uid]);
|
|
1738
|
-
const element = (jsxRuntimeExports.jsxs("div", { ref: refs.setFloating, style: floatingStyles, ...getFloatingProps({ className: 'o-tooltip-container' }), children: [jsxRuntimeExports.jsx("div", { ref: arrowRef, className: "o-tooltip-arrow", style: { left: middlewareData.arrow?.x, top: middlewareData.arrow?.y } }), content] }));
|
|
1738
|
+
const element = (jsxRuntimeExports.jsxs("div", { ref: refs.setFloating, style: floatingStyles, "data-popper-placement": resolvedPlacement, ...getFloatingProps({ className: 'o-tooltip-container' }), children: [jsxRuntimeExports.jsx("div", { ref: arrowRef, className: "o-tooltip-arrow", style: { left: middlewareData.arrow?.x, top: middlewareData.arrow?.y } }), content] }));
|
|
1739
1739
|
if (attachToBody) {
|
|
1740
1740
|
return (jsxRuntimeExports.jsxs("div", { ref: refs.setReference, ...getReferenceProps(), children: [children, show && open && content && ReactDOM.createPortal(jsxRuntimeExports.jsx("div", { className: classNames, children: element }), document.body)] }));
|
|
1741
1741
|
}
|
|
@@ -5181,7 +5181,10 @@ const useElementScroll = ({ parentRef, horizontal, useObserver, initialRect }) =
|
|
|
5181
5181
|
const [scrollOffset, setScrollOffset] = React.useState(0);
|
|
5182
5182
|
const [element, setElement] = React.useState(parentRef.current);
|
|
5183
5183
|
useIsomorphicLayoutEffect(() => {
|
|
5184
|
-
|
|
5184
|
+
const currentElement = parentRef.current;
|
|
5185
|
+
if (currentElement !== element) {
|
|
5186
|
+
setElement(currentElement);
|
|
5187
|
+
}
|
|
5185
5188
|
});
|
|
5186
5189
|
useIsomorphicLayoutEffect(() => {
|
|
5187
5190
|
if (!element) {
|
|
@@ -5218,7 +5221,10 @@ const useWindowRect = (windowRef, initialRect = { width: 0, height: 0 }) => {
|
|
|
5218
5221
|
const [rect, setRect] = React.useState(initialRect);
|
|
5219
5222
|
const [element, setElement] = React.useState(windowRef.current);
|
|
5220
5223
|
useIsomorphicLayoutEffect(() => {
|
|
5221
|
-
|
|
5224
|
+
const currentElement = windowRef.current;
|
|
5225
|
+
if (currentElement !== element) {
|
|
5226
|
+
setElement(currentElement);
|
|
5227
|
+
}
|
|
5222
5228
|
});
|
|
5223
5229
|
useIsomorphicLayoutEffect(() => {
|
|
5224
5230
|
if (!element) {
|
|
@@ -5246,7 +5252,10 @@ const useWindowScroll = ({ windowRef, parentRef, horizontal, useWindowObserver,
|
|
|
5246
5252
|
const rectKey = horizontal ? 'left' : 'top';
|
|
5247
5253
|
const scrollKey = horizontal ? 'scrollX' : 'scrollY';
|
|
5248
5254
|
useIsomorphicLayoutEffect(() => {
|
|
5249
|
-
|
|
5255
|
+
const currentElement = windowRef.current;
|
|
5256
|
+
if (currentElement !== element) {
|
|
5257
|
+
setElement(currentElement);
|
|
5258
|
+
}
|
|
5250
5259
|
});
|
|
5251
5260
|
useIsomorphicLayoutEffect(() => {
|
|
5252
5261
|
if (!element) {
|
|
@@ -5506,17 +5515,13 @@ const useListView = ({ controller, height, itemHeight = defaultItemHeight, overs
|
|
|
5506
5515
|
return itemHeight(index) || defaultItemHeight;
|
|
5507
5516
|
}
|
|
5508
5517
|
return itemHeight;
|
|
5509
|
-
},
|
|
5510
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5511
|
-
[itemHeight]);
|
|
5518
|
+
}, [itemHeight]);
|
|
5512
5519
|
// Trick for force recalcutate position without losing measurementCache
|
|
5513
5520
|
// In the react-virtual code, the position are recalculate if the forceExtractor function change
|
|
5514
5521
|
const forceKeyExtractor = useCallback((index) => {
|
|
5515
5522
|
const fn = keyExtractor || defaultKeyExtractor;
|
|
5516
5523
|
return fn(index);
|
|
5517
|
-
},
|
|
5518
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5519
|
-
[keyExtractor, force]);
|
|
5524
|
+
}, [keyExtractor, force]);
|
|
5520
5525
|
const state = controller.state;
|
|
5521
5526
|
const { totalSize, virtualItems, scrollToIndex, scrollToOffset } = useVirtual({
|
|
5522
5527
|
size: state.total ? state.total : state.items?.length || 0,
|
|
@@ -5684,6 +5689,7 @@ const StandardListComponent = ({ items, ItemComponent = ListItemComponent, ItemL
|
|
|
5684
5689
|
}) }));
|
|
5685
5690
|
};
|
|
5686
5691
|
|
|
5692
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
5687
5693
|
const VirtualItemWrapper = ({ virtualItem, listItem, ItemComponent = ListItemComponent, ItemContentComponent = ListItemContent, ItemLoadingComponent = LoadingItem, onItemClick, onItemMouseEnter, onItemMouseLeave, }) => {
|
|
5688
5694
|
const { index, measureRef, start } = virtualItem;
|
|
5689
5695
|
const ref = useRef(null);
|
|
@@ -5722,6 +5728,7 @@ const VirtualItemWrapper = ({ virtualItem, listItem, ItemComponent = ListItemCom
|
|
|
5722
5728
|
transform: `translateY(${start}px)`,
|
|
5723
5729
|
}, children: jsxRuntimeExports.jsxs("div", { ref: ref, children: [listItem?.loadingStatus === LoadingStatus.Loading && jsxRuntimeExports.jsx(ItemLoadingComponent, {}), listItem?.loadingStatus !== LoadingStatus.Loading && listItem && listItem.data !== undefined && (jsxRuntimeExports.jsx(ItemComponent, { index: index, item: listItem, data: listItem.data, onClick: onItemClick, onMouseEnter: onItemMouseEnter, onMouseLeave: onItemMouseLeave, ItemContentComponent: ItemContentComponent }, `item-${listItem.uid || index}`))] }) }));
|
|
5724
5730
|
};
|
|
5731
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
5725
5732
|
const VirtualListComponent = ({ items, ItemComponent = ListItemComponent, ItemLoadingComponent = LoadingItem, ItemContentComponent = ListItemContent, onItemClick, onItemMouseEnter, onItemMouseLeave, virtualItems, }) => {
|
|
5726
5733
|
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: virtualItems.map((virtualItem) => {
|
|
5727
5734
|
const listItem = items[virtualItem.index];
|
|
@@ -5743,6 +5750,7 @@ const findItemIndex = (items, uid) => {
|
|
|
5743
5750
|
return i.uid === uid;
|
|
5744
5751
|
});
|
|
5745
5752
|
};
|
|
5753
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
5746
5754
|
const ListBodyComponent = ({ autoRefresh, bodyRef, className, follow, height, items, ItemComponent = ListItemComponent, ItemLoadingComponent = LoadingItem, ItemContentComponent = ListItemContent, NotFoundComponent, keyboardNavigable, ListComponent = StandardListComponent, multiSelect, onItemActivate, onItemDeactivate, onItemSelect, onItemUnselect, onItemHighlight, onItemUnhighlight, parentRef, scrollToIndex, service, state, style, tail, totalSize, virtualItems, VirtualListComponent: VirtualListComponent$1 = VirtualListComponent, LoadingComponent = ListLoadingComponent, }) => {
|
|
5747
5755
|
const scrollAlignRef = useRef('center');
|
|
5748
5756
|
const lastActiveItemUid = useRef(undefined);
|
|
@@ -9120,12 +9128,15 @@ const TreeBodyComponent = ({ className, controller, NotFoundComponent, }) => {
|
|
|
9120
9128
|
TreeBodyComponent.displayName = 'TreeBody';
|
|
9121
9129
|
|
|
9122
9130
|
const timeout$1 = 500;
|
|
9131
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
9123
9132
|
const VirtualTreeListItemComponent = ({ itemClassName, ItemComponent, virtualItem, onClick, onMouseEnter, onMouseLeave, }) => {
|
|
9124
9133
|
const { index, measureRef, children, item } = virtualItem;
|
|
9125
9134
|
const className = typeof itemClassName !== 'function' ? itemClassName : item ? itemClassName(item) : undefined;
|
|
9126
9135
|
const service = useTreeService();
|
|
9127
9136
|
const { animate } = useTreeConfig();
|
|
9128
9137
|
const childrenRef = useRef(null);
|
|
9138
|
+
const ref = useRef(null);
|
|
9139
|
+
const previousHeightRef = useRef(undefined);
|
|
9129
9140
|
const expand = (item, index) => {
|
|
9130
9141
|
if (animate) {
|
|
9131
9142
|
service.expanding(item, index);
|
|
@@ -9161,11 +9172,35 @@ const VirtualTreeListItemComponent = ({ itemClassName, ItemComponent, virtualIte
|
|
|
9161
9172
|
}
|
|
9162
9173
|
};
|
|
9163
9174
|
const expanded = !!(item && isTreeItemExpanded(item, service));
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9175
|
+
const measure = useCallback((el) => {
|
|
9176
|
+
if (el?.offsetHeight !== previousHeightRef.current && el?.offsetHeight) {
|
|
9177
|
+
previousHeightRef.current = el.offsetHeight;
|
|
9178
|
+
measureRef(el);
|
|
9179
|
+
}
|
|
9180
|
+
}, [measureRef]);
|
|
9181
|
+
const measureThrottle = useThrottle(measure, 50);
|
|
9182
|
+
const resizeObserver = useMemo(() => {
|
|
9183
|
+
return new ResizeObserver(() => {
|
|
9184
|
+
measureThrottle(ref.current);
|
|
9185
|
+
});
|
|
9186
|
+
}, [measureThrottle]);
|
|
9187
|
+
useEffect(() => {
|
|
9188
|
+
const el = ref.current;
|
|
9189
|
+
if (el) {
|
|
9190
|
+
previousHeightRef.current = el.offsetHeight;
|
|
9191
|
+
resizeObserver.observe(el);
|
|
9192
|
+
}
|
|
9193
|
+
return () => {
|
|
9194
|
+
if (el) {
|
|
9195
|
+
resizeObserver.unobserve(el);
|
|
9196
|
+
}
|
|
9197
|
+
};
|
|
9198
|
+
}, [resizeObserver]);
|
|
9199
|
+
return (jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("div", { className: "o-virtual-item", ref: measureRef, children: jsxRuntimeExports.jsxs("div", { ref: ref, children: [(!item || !item.data) && jsxRuntimeExports.jsx(LoadingItem, {}), item && item.data && (jsxRuntimeExports.jsx(DefaultTreeItemContext.Provider, { value: {
|
|
9200
|
+
onExpand: expand,
|
|
9201
|
+
onCollapse: collapse,
|
|
9202
|
+
className,
|
|
9203
|
+
}, children: jsxRuntimeExports.jsx(ItemComponent, { index: index, item: item, data: item.data, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave }, `item-${item?.uid || index}`) }))] }) }, `virtual-item-${item?.uid || index}`), jsxRuntimeExports.jsx(CSSTransition, { in: expanded, nodeRef: childrenRef, classNames: "o-tree-item-children", timeout: timeout$1, mountOnEnter: true, appear: false, unmountOnExit: true, onExiting: () => {
|
|
9169
9204
|
if (childrenRef.current)
|
|
9170
9205
|
onExiting(childrenRef.current);
|
|
9171
9206
|
}, onEntering: () => {
|
|
@@ -9175,6 +9210,7 @@ const VirtualTreeListItemComponent = ({ itemClassName, ItemComponent, virtualIte
|
|
|
9175
9210
|
return (jsxRuntimeExports.jsx(VirtualTreeListItemComponent, { virtualItem: child, ItemComponent: ItemComponent, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave }, `virtual-item-${child.item?.uid || child.index}`));
|
|
9176
9211
|
}) }) }) })] }));
|
|
9177
9212
|
};
|
|
9213
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
9178
9214
|
const VirtualTreeListComponent = ({ items, onItemClick, onItemMouseEnter, onItemMouseLeave, virtualItems, }) => {
|
|
9179
9215
|
const logger = useLogger();
|
|
9180
9216
|
logger.debug('virtualItems', virtualItems);
|
|
@@ -11043,7 +11079,7 @@ const DefaultDeleteRowComponent = ({ rowIndex }) => {
|
|
|
11043
11079
|
};
|
|
11044
11080
|
const metadata = useFormMetadata(tableName);
|
|
11045
11081
|
let disabled = false;
|
|
11046
|
-
if (metadata.readOnly || (metadata.editable === false && form.config.reconfigure)) {
|
|
11082
|
+
if (metadata.disabled || metadata.readOnly || (metadata.editable === false && form.config.reconfigure)) {
|
|
11047
11083
|
disabled = true;
|
|
11048
11084
|
}
|
|
11049
11085
|
return (jsxRuntimeExports.jsx("div", { className: `o-form-table-remove${disabled ? ' o-form-table-remove-disabled' : ''}`, onClick: removeRow, children: jsxRuntimeExports.jsx(RemoveIcon, { width: "14px", height: "14px" }) }));
|