您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AbstractDialogTab.ts 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { Component } from 'react';
  2. /**
  3. * The type of the React {@code Component} props of {@link AbstractDialogTab}.
  4. */
  5. export interface IProps {
  6. /**
  7. * Callback to invoke on change.
  8. */
  9. onTabStateChange: Function;
  10. /**
  11. * The id of the tab.
  12. */
  13. tabId: number;
  14. }
  15. /**
  16. * Abstract React {@code Component} for tabs of the DialogWithTabs component.
  17. *
  18. * @augments Component
  19. */
  20. class AbstractDialogTab<P extends IProps, S> extends Component<P, S> {
  21. /**
  22. * Initializes a new {@code AbstractDialogTab} instance.
  23. *
  24. * @param {P} props - The read-only properties with which the new
  25. * instance is to be initialized.
  26. */
  27. constructor(props: P) {
  28. super(props);
  29. // Bind event handler so it is only bound once for every instance.
  30. this._onChange = this._onChange.bind(this);
  31. }
  32. /**
  33. * Uses the onTabStateChange function to pass the changed state of the
  34. * controlled tab component to the controlling DialogWithTabs component.
  35. *
  36. * @param {Object} change - Object that contains the changed property and
  37. * value.
  38. * @returns {void}
  39. */
  40. _onChange(change: Object) {
  41. const { onTabStateChange, tabId } = this.props;
  42. onTabStateChange(tabId, {
  43. ...this.props,
  44. ...change
  45. });
  46. }
  47. }
  48. export default AbstractDialogTab;