Skip to content

Commit db1cf5d

Browse files
1) change ShowMoreTabs props : remove components prop and add openTabIDs and selectedTabID props
2) moreButtonPlugin_buttonComponent option and default button component should have same props 3) remove btnContainerPropsGenerator and btnPropsGenerator methods from api 4) create test snapshot for showMoreTabs
1 parent 16376f6 commit db1cf5d

File tree

9 files changed

+247
-263
lines changed

9 files changed

+247
-263
lines changed
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React, {useState, useCallback, useRef, useEffect} from 'react';
22
import PropTypes from 'prop-types';
33
export default function Button(getDeps, props) {
4-
const {Popper, Api} = getDeps();
4+
const {Popper, Api, ctx, components} = getDeps();
55
const [open, setOpen] = useState(false);
66
const btnRef = useRef();
77
const ref = useRef();
8-
props.components.useForceUpdate();
9-
ref.current = ref.current || Api.call(props.instance, props.components, setOpen);
8+
components.useForceUpdate();
9+
ref.current = ref.current || Api.call(ctx, components, setOpen);
1010

1111
const onClick = useCallback(
1212
(ev) => {
@@ -20,19 +20,17 @@ export default function Button(getDeps, props) {
2020
ref?.current && ref.current.onDestroy && ref.current.onDestroy();
2121
};
2222
}, []);
23-
24-
const IconComponent = props.instance.optionsManager.options.moreButtonPlugin_iconComponent;
23+
const IconComponent = ctx.getOption('moreButtonPlugin_iconComponent');
2524
return (
2625
<>
2726
<div {...ref.current.btnPropsGenerator(onClick, btnRef, open)}>
28-
<IconComponent instance={props.instance.userProxy} />
27+
<IconComponent instance={props.instance} />
2928
</div>
30-
{open ? <Popper {...props} TabsComponent={ref.current.TabsComponent} btnRef={btnRef} /> : null}
29+
{open ? <Popper {...props} instance={ctx} TabsComponent={ref.current.TabsComponent} btnRef={btnRef} /> : null}
3130
</>
3231
);
3332
}
3433
Button.propTypes /* remove-proptypes */ = {
3534
instance: PropTypes.object,
3635
hiddenTabIDs: PropTypes.string,
37-
components: PropTypes.object,
3836
};

0 commit comments

Comments
 (0)