type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
(chart: any) => { const isStackedChart = isStacked(chart); const hasLabelsStacked = areLabelsStacked(chart); const visibleSeries = getVisibleSeries(chart); const visiblePoints = getDataPoints(visibleSeries); const minAxisValue = get(chart, ['yAxis', 0, 'min'], 0); if (isStackedChart) { toggleStackedChartLabels(visiblePoints, minAxisValue); } else { toggleNonStackedChartLabels(visiblePoints, minAxisValue, true); } if (hasLabelsStacked) { toggleStackedLabels.call(chart); } }
imnutz/gooddata-react-components
src/components/visualizations/chart/highcharts/plugins/autohideLabels/autohideColumnLabels.ts
TypeScript
ArrowFunction
(e: KeyboardEvent) => { if (e.key === 'Escape') { this.props.onSkip(); } }
Ayush2061111/kibana
src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
TypeScript
ArrowFunction
() => { this.services.trackUiMetric(METRIC_TYPE.CLICK, 'sampleDataDecline'); this.props.onSkip(); }
Ayush2061111/kibana
src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
TypeScript
ArrowFunction
() => { this.services.trackUiMetric(METRIC_TYPE.CLICK, 'sampleDataConfirm'); this.redirecToSampleData(); }
Ayush2061111/kibana
src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
TypeScript
ArrowFunction
() => { const { telemetry } = this.props; if (!telemetry) { return null; } const isOptedIn = telemetry.telemetryService.getIsOptedIn(); if (isOptedIn) { return ( <Fragment> <FormattedMessage id="kbn.home.dataManagementDisableCollection" defaultMessage=" To stop collection, " /> <EuiLink href="#/management/kibana/settings"> <FormattedMessage id="kbn.home.dataManagementDisableCollectionLink" defaultMessage="disable usage data here." /> </EuiLink> </Fragment> ); } else { return ( <Fragment> <FormattedMessage id="kbn.home.dataManagementEnableCollection" defaultMessage=" To start collection, " /> <EuiLink href="#/management/kibana/settings"> <FormattedMessage id="kbn.home.dataManagementEnableCollectionLink" defaultMessage="enable usage data here." /> </EuiLink> </Fragment> ); } }
Ayush2061111/kibana
src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
TypeScript
ClassDeclaration
/** * Shows a full-screen welcome page that gives helpful quick links to beginners. */ export class Welcome extends React.Component<Props> { private services = getServices(); private hideOnEsc = (e: KeyboardEvent) => { if (e.key === 'Escape') { this.props.onSkip(); } }; private redirecToSampleData() { const path = this.services.addBasePath('#/home/tutorial_directory/sampleData'); window.location.href = path; } private onSampleDataDecline = () => { this.services.trackUiMetric(METRIC_TYPE.CLICK, 'sampleDataDecline'); this.props.onSkip(); }; private onSampleDataConfirm = () => { this.services.trackUiMetric(METRIC_TYPE.CLICK, 'sampleDataConfirm'); this.redirecToSampleData(); }; componentDidMount() { const { telemetry } = this.props; this.services.trackUiMetric(METRIC_TYPE.LOADED, 'welcomeScreenMount'); if (telemetry) { telemetry.telemetryNotifications.setOptedInNoticeSeen(); } document.addEventListener('keydown', this.hideOnEsc); } componentWillUnmount() { document.removeEventListener('keydown', this.hideOnEsc); } private renderTelemetryEnabledOrDisabledText = () => { const { telemetry } = this.props; if (!telemetry) { return null; } const isOptedIn = telemetry.telemetryService.getIsOptedIn(); if (isOptedIn) { return ( <Fragment> <FormattedMessage id="kbn.home.dataManagementDisableCollection" defaultMessage=" To stop collection, " /> <EuiLink href="#/management/kibana/settings"> <FormattedMessage id="kbn.home.dataManagementDisableCollectionLink" defaultMessage="disable usage data here." /> </EuiLink> </Fragment> ); } else { return ( <Fragment> <FormattedMessage id="kbn.home.dataManagementEnableCollection" defaultMessage=" To start collection, " /> <EuiLink href="#/management/kibana/settings"> <FormattedMessage id="kbn.home.dataManagementEnableCollectionLink" defaultMessage="enable usage data here." /> </EuiLink> </Fragment> ); } }; render() { const { urlBasePath, telemetry } = this.props; return ( <EuiPortal> <div className="homWelcome"> <header className="homWelcome__header"> <div className="homWelcome__content eui-textCenter"> <EuiSpacer size="xl" /> <span className="homWelcome__logo"> <EuiIcon type="logoKibana" size="xxl" /> </span> <EuiTitle size="l" className="homWelcome__title"> <h1> <FormattedMessage id="kbn.home.welcomeTitle" defaultMessage="Welcome to Kibana" /> </h1> </EuiTitle> <EuiText size="s" color="subdued" className="homWelcome__subtitle"> <p> <FormattedMessage id="kbn.home.welcomeDescription" defaultMessage="Your window into the Elastic Stack" /> </p> </EuiText> <EuiSpacer size="m" /> </div> </header> <div className="homWelcome__content homWelcome-body"> <EuiFlexGroup gutterSize="l"> <EuiFlexItem> <SampleDataCard urlBasePath={urlBasePath} onConfirm={this.onSampleDataConfirm} onDecline={this.onSampleDataDecline} /> <EuiSpacer size="s" /> {!!telemetry && ( <Fragment> <EuiTextColor className="euiText--small" color="subdued"> <FormattedMessage id="kbn.home.dataManagementDisclaimerPrivacy" defaultMessage="To learn about how usage data helps us manage and improve our products and services, see our " /> <EuiLink href={PRIVACY_STATEMENT_URL} target="_blank" rel="noopener"> <FormattedMessage id="kbn.home.dataManagementDisclaimerPrivacyLink" defaultMessage="Privacy Statement." /> </EuiLink> {this.renderTelemetryEnabledOrDisabledText()} </EuiTextColor> <EuiSpacer size="xs" /> </Fragment> )}
Ayush2061111/kibana
src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
TypeScript
InterfaceDeclaration
interface Props { urlBasePath: string; onSkip: () => void; telemetry?: TelemetryPluginStart; }
Ayush2061111/kibana
src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
TypeScript
MethodDeclaration
private redirecToSampleData() { const path = this.services.addBasePath('#/home/tutorial_directory/sampleData'); window.location.href = path; }
Ayush2061111/kibana
src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
TypeScript
MethodDeclaration
componentDidMount() { const { telemetry } = this.props; this.services.trackUiMetric(METRIC_TYPE.LOADED, 'welcomeScreenMount'); if (telemetry) { telemetry.telemetryNotifications.setOptedInNoticeSeen(); } document.addEventListener('keydown', this.hideOnEsc); }
Ayush2061111/kibana
src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
TypeScript
MethodDeclaration
componentWillUnmount() { document.removeEventListener('keydown', this.hideOnEsc); }
Ayush2061111/kibana
src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
TypeScript
MethodDeclaration
render() { const { urlBasePath, telemetry } = this.props; return ( <EuiPortal> <div className="homWelcome"> <header className="homWelcome__header"> <div className="homWelcome__content eui-textCenter"> <EuiSpacer size="xl" /> <span className="homWelcome__logo"> <EuiIcon type="logoKibana" size="xxl" /> </span> <EuiTitle size="l" className="homWelcome__title"> <h1> <FormattedMessage id="kbn.home.welcomeTitle" defaultMessage="Welcome to Kibana" /> </h1> </EuiTitle> <EuiText size="s" color="subdued" className="homWelcome__subtitle"> <p> <FormattedMessage id="kbn.home.welcomeDescription" defaultMessage="Your window into the Elastic Stack" /> </p> </EuiText> <EuiSpacer size="m" /> </div> </header> <div className="homWelcome__content homWelcome-body"> <EuiFlexGroup gutterSize="l"> <EuiFlexItem> <SampleDataCard urlBasePath={urlBasePath} onConfirm={this.onSampleDataConfirm} onDecline={this.onSampleDataDecline} /> <EuiSpacer size="s" /> {!!telemetry && ( <Fragment> <EuiTextColor className="euiText--small" color="subdued"> <FormattedMessage id="kbn.home.dataManagementDisclaimerPrivacy" defaultMessage="To learn about how usage data helps us manage and improve our products and services, see our " /> <EuiLink href={PRIVACY_STATEMENT_URL} target="_blank" rel="noopener"> <FormattedMessage id="kbn.home.dataManagementDisclaimerPrivacyLink" defaultMessage="Privacy Statement." /> </EuiLink> {this.renderTelemetryEnabledOrDisabledText()} </EuiTextColor> <EuiSpacer size="xs" /> </Fragment> )}
Ayush2061111/kibana
src/legacy/core_plugins/kibana/public/home/np_ready/components/welcome.tsx
TypeScript
ArrowFunction
() => { test('renders correctly', () => { const tree = shallow( <Loader active /> ); expect(tree).toMatchSnapshot(); }); test('renders non-active Loader correctly', () => { const tree = shallow( <Loader active /> ); expect(tree).toMatchSnapshot(); }); test('Renders with custom loader and animation', () => { const component = shallow( <Loader active loader="someImage" animation="someAnimation" /> ); expect(component.find('img').prop('src')).toEqual('someImage'); expect(component.find('img').prop('className')).toContain('someAnimation'); }); }
yamadron/mooskin-ui
components/Loader/Loader.spec.tsx
TypeScript
ArrowFunction
() => { const tree = shallow( <Loader active /> ); expect(tree).toMatchSnapshot(); }
yamadron/mooskin-ui
components/Loader/Loader.spec.tsx
TypeScript
ArrowFunction
() => { const component = shallow( <Loader active loader="someImage" animation="someAnimation" /> ); expect(component.find('img').prop('src')).toEqual('someImage'); expect(component.find('img').prop('className')).toContain('someAnimation'); }
yamadron/mooskin-ui
components/Loader/Loader.spec.tsx
TypeScript
FunctionDeclaration
/** * A logger that just throws away all messages. * * @public */ export function getVoidLogger(): winston.Logger { return winston.createLogger({ transports: [new winston.transports.Console({ silent: true })], }); }
Bonial-International-GmbH/backstage
packages/backend-common/src/logging/voidLogger.ts
TypeScript
ArrowFunction
() => { let diagnosticService: UnitTestDiagnosticService; suiteSetup(() => { diagnosticService = new UnitTestDiagnosticService(); }); suite('TestStatus: Error', () => { let actualPrefix: string; let actualSeverity: DiagnosticSeverity; let expectedPrefix: string; let expectedSeverity: DiagnosticSeverity; suiteSetup(() => { actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Error)!; actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Error)!; expectedPrefix = localize.Testing.testErrorDiagnosticMessage(); expectedSeverity = DiagnosticSeverity.Error; }); test('Message Prefix', () => { assert.equal(actualPrefix, expectedPrefix); }); test('Severity', () => { assert.equal(actualSeverity, expectedSeverity); }); }); suite('TestStatus: Fail', () => { let actualPrefix: string; let actualSeverity: DiagnosticSeverity; let expectedPrefix: string; let expectedSeverity: DiagnosticSeverity; suiteSetup(() => { actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Fail)!; actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Failure)!; expectedPrefix = localize.Testing.testFailDiagnosticMessage(); expectedSeverity = DiagnosticSeverity.Error; }); test('Message Prefix', () => { assert.equal(actualPrefix, expectedPrefix); }); test('Severity', () => { assert.equal(actualSeverity, expectedSeverity); }); }); suite('TestStatus: Skipped', () => { let actualPrefix: string; let actualSeverity: DiagnosticSeverity; let expectedPrefix: string; let expectedSeverity: DiagnosticSeverity; suiteSetup(() => { actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Skipped)!; actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Skip)!; expectedPrefix = localize.Testing.testSkippedDiagnosticMessage(); expectedSeverity = DiagnosticSeverity.Information; }); test('Message Prefix', () => { assert.equal(actualPrefix, expectedPrefix); }); test('Severity', () => { assert.equal(actualSeverity, expectedSeverity); }); }); }
AgrawalAmey/vscode-python
src/test/testing/unittest/unittest.diagnosticService.unit.test.ts
TypeScript
ArrowFunction
() => { diagnosticService = new UnitTestDiagnosticService(); }
AgrawalAmey/vscode-python
src/test/testing/unittest/unittest.diagnosticService.unit.test.ts
TypeScript
ArrowFunction
() => { let actualPrefix: string; let actualSeverity: DiagnosticSeverity; let expectedPrefix: string; let expectedSeverity: DiagnosticSeverity; suiteSetup(() => { actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Error)!; actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Error)!; expectedPrefix = localize.Testing.testErrorDiagnosticMessage(); expectedSeverity = DiagnosticSeverity.Error; }); test('Message Prefix', () => { assert.equal(actualPrefix, expectedPrefix); }); test('Severity', () => { assert.equal(actualSeverity, expectedSeverity); }); }
AgrawalAmey/vscode-python
src/test/testing/unittest/unittest.diagnosticService.unit.test.ts
TypeScript
ArrowFunction
() => { actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Error)!; actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Error)!; expectedPrefix = localize.Testing.testErrorDiagnosticMessage(); expectedSeverity = DiagnosticSeverity.Error; }
AgrawalAmey/vscode-python
src/test/testing/unittest/unittest.diagnosticService.unit.test.ts
TypeScript
ArrowFunction
() => { assert.equal(actualPrefix, expectedPrefix); }
AgrawalAmey/vscode-python
src/test/testing/unittest/unittest.diagnosticService.unit.test.ts
TypeScript
ArrowFunction
() => { assert.equal(actualSeverity, expectedSeverity); }
AgrawalAmey/vscode-python
src/test/testing/unittest/unittest.diagnosticService.unit.test.ts
TypeScript
ArrowFunction
() => { let actualPrefix: string; let actualSeverity: DiagnosticSeverity; let expectedPrefix: string; let expectedSeverity: DiagnosticSeverity; suiteSetup(() => { actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Fail)!; actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Failure)!; expectedPrefix = localize.Testing.testFailDiagnosticMessage(); expectedSeverity = DiagnosticSeverity.Error; }); test('Message Prefix', () => { assert.equal(actualPrefix, expectedPrefix); }); test('Severity', () => { assert.equal(actualSeverity, expectedSeverity); }); }
AgrawalAmey/vscode-python
src/test/testing/unittest/unittest.diagnosticService.unit.test.ts
TypeScript
ArrowFunction
() => { actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Fail)!; actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Failure)!; expectedPrefix = localize.Testing.testFailDiagnosticMessage(); expectedSeverity = DiagnosticSeverity.Error; }
AgrawalAmey/vscode-python
src/test/testing/unittest/unittest.diagnosticService.unit.test.ts
TypeScript
ArrowFunction
() => { let actualPrefix: string; let actualSeverity: DiagnosticSeverity; let expectedPrefix: string; let expectedSeverity: DiagnosticSeverity; suiteSetup(() => { actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Skipped)!; actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Skip)!; expectedPrefix = localize.Testing.testSkippedDiagnosticMessage(); expectedSeverity = DiagnosticSeverity.Information; }); test('Message Prefix', () => { assert.equal(actualPrefix, expectedPrefix); }); test('Severity', () => { assert.equal(actualSeverity, expectedSeverity); }); }
AgrawalAmey/vscode-python
src/test/testing/unittest/unittest.diagnosticService.unit.test.ts
TypeScript
ArrowFunction
() => { actualPrefix = diagnosticService.getMessagePrefix(TestStatus.Skipped)!; actualSeverity = diagnosticService.getSeverity(PythonTestMessageSeverity.Skip)!; expectedPrefix = localize.Testing.testSkippedDiagnosticMessage(); expectedSeverity = DiagnosticSeverity.Information; }
AgrawalAmey/vscode-python
src/test/testing/unittest/unittest.diagnosticService.unit.test.ts
TypeScript
ClassDeclaration
export default class FirebaseModel { @observable status: STATUS = STATUS.LOADING; @observable error: Error = null; protected readonly ref: Reference; constructor(database: Database, ref: string) { this.ref = database.ref(ref); } @action.bound protected setCancelled(error: Error) { this.error = error; this.status = STATUS.CANCELLED; } }
gamliela/playground
src/app/shared_modules/firebase-mobx/FirebaseModel.ts
TypeScript
MethodDeclaration
@action.bound protected setCancelled(error: Error) { this.error = error; this.status = STATUS.CANCELLED; }
gamliela/playground
src/app/shared_modules/firebase-mobx/FirebaseModel.ts
TypeScript
ArrowFunction
({ label, value, noDataValue = "-", }: DataRowItemProps): JSX.Element => ( <> {label ? label + ": "
madetech/mca-beacons-webapp
src/components/domain/DataRowItem.tsx
TypeScript
InterfaceDeclaration
interface DataRowItemProps { label?: string; value?: string; noDataValue?: string; }
madetech/mca-beacons-webapp
src/components/domain/DataRowItem.tsx
TypeScript
ClassDeclaration
export default class Client { constructor() { } async hello(): Promise<void> { let request_ = new $tea.Request(); request_.method = "GET"; request_.pathname = "/"; request_.headers = { host: "www.test.com", }; if (true) { request_.headers["host"] = "www.test2.com"; } let response_ = await $tea.doAction(request_); if (true) { throw $tea.newRetryError(request_, response_); } else { true; } Client.helloIf(); !false; let a : string = null; a = "string"; return ; } static helloIf(): void { if (true) { } if (true) { } else if (true) { } else { } } static helloThrow(): void { throw $tea.newError({ }); } static helloForBreak(): void { for (let item of [ ]) { break; } } static helloWhile(): void { while (true) { break; } } static helloDeclare(): void { let hello = "world"; let helloNull : string = null; hello = "\"hehe\""; } }
1048711390/darabonba-typescript-generator
test/fixtures/statements/client.ts
TypeScript
MethodDeclaration
async hello(): Promise<void> { let request_ = new $tea.Request(); request_.method = "GET"; request_.pathname = "/"; request_.headers = { host: "www.test.com", }; if (true) { request_.headers["host"] = "www.test2.com"; } let response_ = await $tea.doAction(request_); if (true) { throw $tea.newRetryError(request_, response_); } else { true; } Client.helloIf(); !false; let a : string = null; a = "string"; return ; }
1048711390/darabonba-typescript-generator
test/fixtures/statements/client.ts
TypeScript
MethodDeclaration
static helloIf(): void { if (true) { } if (true) { } else if (true) { } else { } }
1048711390/darabonba-typescript-generator
test/fixtures/statements/client.ts
TypeScript
MethodDeclaration
static helloThrow(): void { throw $tea.newError({ }); }
1048711390/darabonba-typescript-generator
test/fixtures/statements/client.ts
TypeScript
MethodDeclaration
static helloForBreak(): void { for (let item of [ ]) { break; } }
1048711390/darabonba-typescript-generator
test/fixtures/statements/client.ts
TypeScript
MethodDeclaration
static helloWhile(): void { while (true) { break; } }
1048711390/darabonba-typescript-generator
test/fixtures/statements/client.ts
TypeScript
MethodDeclaration
static helloDeclare(): void { let hello = "world"; let helloNull : string = null; hello = "\"hehe\""; }
1048711390/darabonba-typescript-generator
test/fixtures/statements/client.ts
TypeScript
ClassDeclaration
@Injectable() export class NotificationService { getHello(): string { return 'Hello World from notification!'; } }
vanvutuan/nestjs-multi-tenant
apps/notification/src/notification.service.ts
TypeScript
MethodDeclaration
getHello(): string { return 'Hello World from notification!'; }
vanvutuan/nestjs-multi-tenant
apps/notification/src/notification.service.ts
TypeScript
InterfaceDeclaration
export interface StandardProps { /** * An optional theme which can be passed down to a component. */ theme?: 'default' /** * The style prop for explicitly overriding some CSS styles. */ style?: React.CSSProperties }
zbruno/fullsend-ui
src/constants/types.ts
TypeScript
FunctionDeclaration
function loadable<Props extends Record<string, unknown> = Record<string, unknown>>(load: { importAsync: () => Promise<{ default: ComponentType<Props> }>; }): ComponentType<Props> { let Component: ComponentType<Props>; const loadPromise = load.importAsync().then((val) => { Component = val.default; }); const Loadable: FC<Props> & { load: () => Promise<void> } = (props: Props) => { if (!Component) { throw new Error( // eslint-disable-next-line max-len `Bundle split module not loaded yet, ensure you beforeAll(() => MyLazyComponent.load()) in your test, import statement: ${load.toString()}`, ); } return <Component {...props} />; }; Loadable.load = (): Promise<void> => loadPromise; return Loadable; }
felamaslen/budget
src/client/__mocks__/@loadable/component.tsx
TypeScript
ArrowFunction
(val) => { Component = val.default; }
felamaslen/budget
src/client/__mocks__/@loadable/component.tsx
TypeScript
ArrowFunction
(props: Props) => { if (!Component) { throw new Error( // eslint-disable-next-line max-len `Bundle split module not loaded yet, ensure you beforeAll(() => MyLazyComponent.load()) in your test, import statement: ${load.toString()}`, ); } return <Component {...props} />; }
felamaslen/budget
src/client/__mocks__/@loadable/component.tsx
TypeScript
ArrowFunction
(): Promise<void> => loadPromise
felamaslen/budget
src/client/__mocks__/@loadable/component.tsx
TypeScript
ClassDeclaration
@Component({ selector: 'app-account-footer', templateUrl: './account-footer.component.html', styleUrls: ['./account-footer.component.scss'] }) export class AccountFooterComponent implements OnInit { constructor() { } ngOnInit(): void { } }
bhavesh-eigital/olo-orderos
src/Pages/my-account/account-footer/account-footer.component.ts
TypeScript
ArrowFunction
(shape, overlay) => { if ( tooltip == null && (trigger === shape.elem || trigger.parentNode === shape.elem) ) { tooltip = this.graph.getOverlayTooltip(state.cell, overlay) } }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
ArrowFunction
() => { if (this.willShow() && state != null) { const tip = this.getTooltip(state, elem, x, y) this.show(state.cell, elem, tip, x, y) this.state = state this.sourceElem = elem this.isStateSource = isStateSource } }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
ClassDeclaration
export class TooltipHandler extends MouseHandler { ignoreTouchEvents: boolean = true hideOnHover: boolean = false delay: number = 500 zIndex: number = 9999 protected doHide: (() => void) | null protected doShow: ((args: ShowTooltipArgs) => void) | null protected lastX: number protected lastY: number protected timer: number | null protected state: State | null protected sourceElem: HTMLElement protected isStateSource: boolean protected showing: boolean = false constructor(graph: Graph) { super(graph) this.config() } config() { const options = this.graph.options.tooltip this.delay = options.delay this.zIndex = options.zIndex this.hideOnHover = options.hideOnHover this.ignoreTouchEvents = options.ignoreTouchEvents this.doShow = options.show || null this.doHide = options.hide || null this.setEnadled(options.enabled) } isHidden() { return !this.showing } mouseDown(e: MouseEventEx) { this.reset(e, false) this.hideTooltip() } mouseUp(e: MouseEventEx) { this.reset(e, true) this.hideTooltip() } mouseMove(e: MouseEventEx) { const clientX = e.getClientX() const clientY = e.getClientY() if (clientX !== this.lastX || clientY !== this.lastY) { this.reset(e, true) const state = this.getState(e) // prettier-ignore if ( this.hideOnHover || this.state !== state || ( e.getSource() !== this.sourceElem && ( !this.isStateSource || ( state && this.isStateSource === (e.isSource(state.shape) || !e.isSource(state.text)) ) ) ) ) { // hide current tooltip this.hideTooltip() } } this.lastX = e.getClientX() this.lastY = e.getClientY() } show( cell: Cell, elem: HTMLElement, tip: string | HTMLElement | null | undefined, x: number, y: number, ) { if (this.canShow(tip)) { this.showing = true if (this.doShow) { this.doShow.call(this.graph, { cell, elem, x, y, tip: tip! }) } } } hide() { this.clearTimer() this.hideTooltip() } protected willShow() { return ( !this.disposed && !this.isMouseDown() && !this.graph.isEditing() && !this.graph.isContextMenuShowing() ) } protected canShow(tip?: string | HTMLElement | null) { return !this.disposed && this.enabled && this.validateTooltip(tip) } protected validateTooltip(tip?: string | HTMLElement | null) { return ( tip != null && ((typeof tip === 'string' && tip.length > 0) || DomUtil.isHtmlElement(tip)) ) } protected getTooltip( state: State | null, trigger: HTMLElement, x: number, y: number, ) { let tooltip: string | HTMLElement | null | undefined = null if (state != null) { // Checks if the mouse is over the folding icon if ( state.control != null && (trigger === state.control.elem || trigger.parentNode === state.control.elem) ) { tooltip = this.graph.getCollapseTooltip(state.cell) } if (tooltip == null && state.overlays != null) { state.overlays.each((shape, overlay) => { if ( tooltip == null && (trigger === shape.elem || trigger.parentNode === shape.elem) ) { tooltip = this.graph.getOverlayTooltip(state.cell, overlay) } }) } if (tooltip == null) { const handler = this.graph.selectionHandler.getHandler(state.cell) const getTooltipForNode = handler && (handler as any).getTooltipForNode if (getTooltipForNode && typeof getTooltipForNode === 'function') { tooltip = getTooltipForNode(trigger) } } if (tooltip == null) { tooltip = this.graph.getTooltip(state.cell) } } return tooltip } protected reset( e: MouseEventEx, restart: boolean = false, state: State | null = null, ) { if (!this.ignoreTouchEvents || DomEvent.isMouseEvent(e.getEvent())) { this.clearTimer() if (restart && this.isEnabled() && this.isHidden()) { state = state || this.getState(e) // tslint:disable-line if (state != null) { const x = e.getClientX() const y = e.getClientY() const elem = e.getSource() const isStateSource = e.isSource(state.shape) || e.isSource(state.text) this.timer = window.setTimeout(() => { if (this.willShow() && state != null) { const tip = this.getTooltip(state, elem, x, y) this.show(state.cell, elem, tip, x, y) this.state = state this.sourceElem = elem this.isStateSource = isStateSource } }, this.delay) } } } } protected clearTimer() { if (this.timer != null) { window.clearTimeout(this.timer) this.timer = null } } protected hideTooltip() { this.showing = false this.doHide && this.doHide.call(this.graph) } @MouseHandler.dispose() dispose() { this.graph.removeHandler(this) } }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
config() { const options = this.graph.options.tooltip this.delay = options.delay this.zIndex = options.zIndex this.hideOnHover = options.hideOnHover this.ignoreTouchEvents = options.ignoreTouchEvents this.doShow = options.show || null this.doHide = options.hide || null this.setEnadled(options.enabled) }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
isHidden() { return !this.showing }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
mouseDown(e: MouseEventEx) { this.reset(e, false) this.hideTooltip() }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
mouseUp(e: MouseEventEx) { this.reset(e, true) this.hideTooltip() }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
mouseMove(e: MouseEventEx) { const clientX = e.getClientX() const clientY = e.getClientY() if (clientX !== this.lastX || clientY !== this.lastY) { this.reset(e, true) const state = this.getState(e) // prettier-ignore if ( this.hideOnHover || this.state !== state || ( e.getSource() !== this.sourceElem && ( !this.isStateSource || ( state && this.isStateSource === (e.isSource(state.shape) || !e.isSource(state.text)) ) ) ) ) { // hide current tooltip this.hideTooltip() } } this.lastX = e.getClientX() this.lastY = e.getClientY() }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
show( cell: Cell, elem: HTMLElement, tip: string | HTMLElement | null | undefined, x: number, y: number, ) { if (this.canShow(tip)) { this.showing = true if (this.doShow) { this.doShow.call(this.graph, { cell, elem, x, y, tip: tip! }) } } }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
hide() { this.clearTimer() this.hideTooltip() }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
protected willShow() { return ( !this.disposed && !this.isMouseDown() && !this.graph.isEditing() && !this.graph.isContextMenuShowing() ) }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
protected canShow(tip?: string | HTMLElement | null) { return !this.disposed && this.enabled && this.validateTooltip(tip) }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
protected validateTooltip(tip?: string | HTMLElement | null) { return ( tip != null && ((typeof tip === 'string' && tip.length > 0) || DomUtil.isHtmlElement(tip)) ) }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
protected getTooltip( state: State | null, trigger: HTMLElement, x: number, y: number, ) { let tooltip: string | HTMLElement | null | undefined = null if (state != null) { // Checks if the mouse is over the folding icon if ( state.control != null && (trigger === state.control.elem || trigger.parentNode === state.control.elem) ) { tooltip = this.graph.getCollapseTooltip(state.cell) } if (tooltip == null && state.overlays != null) { state.overlays.each((shape, overlay) => { if ( tooltip == null && (trigger === shape.elem || trigger.parentNode === shape.elem) ) { tooltip = this.graph.getOverlayTooltip(state.cell, overlay) } }) } if (tooltip == null) { const handler = this.graph.selectionHandler.getHandler(state.cell) const getTooltipForNode = handler && (handler as any).getTooltipForNode if (getTooltipForNode && typeof getTooltipForNode === 'function') { tooltip = getTooltipForNode(trigger) } } if (tooltip == null) { tooltip = this.graph.getTooltip(state.cell) } } return tooltip }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
protected reset( e: MouseEventEx, restart: boolean = false, state: State | null = null, ) { if (!this.ignoreTouchEvents || DomEvent.isMouseEvent(e.getEvent())) { this.clearTimer() if (restart && this.isEnabled() && this.isHidden()) { state = state || this.getState(e) // tslint:disable-line if (state != null) { const x = e.getClientX() const y = e.getClientY() const elem = e.getSource() const isStateSource = e.isSource(state.shape) || e.isSource(state.text) this.timer = window.setTimeout(() => { if (this.willShow() && state != null) { const tip = this.getTooltip(state, elem, x, y) this.show(state.cell, elem, tip, x, y) this.state = state this.sourceElem = elem this.isStateSource = isStateSource } }, this.delay) } } } }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
protected clearTimer() { if (this.timer != null) { window.clearTimeout(this.timer) this.timer = null } }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
protected hideTooltip() { this.showing = false this.doHide && this.doHide.call(this.graph) }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
MethodDeclaration
@MouseHandler.dispose() dispose() { this.graph.removeHandler(this) }
lyn-boyu/x6
packages/x6/src/handler/tooltip/handler.ts
TypeScript
ArrowFunction
(propTypes: PropsInterface) => { const defaultProps: any = {}; const unions: any = {}; for (const [prop, type] of Object.entries(propTypes)) { if (isNumber(type)) defaultProps[prop] = 0; if (isBoolean(type)) defaultProps[prop] = false; if (isString(type)) defaultProps[prop] = "Text"; if (isNumberArray(type)) defaultProps[prop] = [1, 2, 3]; if (isStringArray(type)) defaultProps[prop] = ["Text", "Text", "Text"]; if (isBoolArray(type)) defaultProps[prop] = [true, true, true]; if (isStringUnion(type)) { defaultProps[prop] = "Variant1"; unions[prop] = ["Variant1", "Variant2"]; } if (isNumberUnion(type)) { defaultProps[prop] = 0; unions[prop] = [0, 1]; } if (isStringLiteralUnion(type) || isNumberLiteralUnion(type)) { defaultProps[prop] = type[0]; unions[prop] = type; } if (isInterface(type)) defaultProps[prop] = setDefaultValues(type).props; } return { unions, props: defaultProps }; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is PrimitiveType.String => { return t === PrimitiveType.String; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is PrimitiveType.Boolean => { return t === PrimitiveType.Boolean; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is PrimitiveType.Number => { return t === PrimitiveType.Number; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is [PrimitiveType.String] => { return Array.isArray(t) && t.length === 1 && t[0] === PrimitiveType.String; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is [PrimitiveType.Number] => { return Array.isArray(t) && t.length === 1 && t[0] === PrimitiveType.Number; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is [PrimitiveType.Boolean] => { return Array.isArray(t) && t.length === 1 && t[0] === PrimitiveType.Boolean; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is string[] => { return ( Array.isArray(t) && t.length > 1 && typeof t[0] === "string" && t[0] !== PrimitiveType.String && t[0] !== PrimitiveType.Number ); }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is PrimitiveType.String[] => { return Array.isArray(t) && t.length > 1 && t[0] === PrimitiveType.String; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is number[] => { return Array.isArray(t) && t.length > 1 && typeof t[0] === "number"; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is PrimitiveType.Number[] => { return Array.isArray(t) && t.length > 1 && t[0] === PrimitiveType.Number; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(t: PropType): t is PropsInterface => { return typeof t === "object" && t !== null && !Array.isArray(t); }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
(componentName: string) => ( interfaces: Interfaces ) => { const propTypes = `${componentName}Props`; return interfaces[propTypes]; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ArrowFunction
( interfaces: Interfaces ) => { const propTypes = `${componentName}Props`; return interfaces[propTypes]; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
InterfaceDeclaration
export interface Interfaces { [name: string]: PropsInterface; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
InterfaceDeclaration
export interface PropsInterface { [prop: string]: | PrimitiveType | [PrimitiveType] | string[] | number[] | PropsInterface; }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
EnumDeclaration
export enum ArrayType { String, Number, Boolean, Nothing, }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
EnumDeclaration
export enum PrimitiveType { String = "string", Boolean = "boolean", Number = "number", Nothing = "nothing", }
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
TypeAliasDeclaration
export type PropType = PropsInterface[keyof PropsInterface];
jlkiri/looc
looc-loader/src/helpers.ts
TypeScript
ClassDeclaration
@Component({ templateUrl: "build/pages/discover/exam-list/index.html", }) export class ExamListPage { constructor(public nav:NavController) { this.nav = nav; } openExamDetailPage(domain) { this.nav.push(ExamDetailPage, {domain: domain}); } }
awesome-archive/growth
app/pages/discover/exam-list/index.ts
TypeScript
MethodDeclaration
openExamDetailPage(domain) { this.nav.push(ExamDetailPage, {domain: domain}); }
awesome-archive/growth
app/pages/discover/exam-list/index.ts
TypeScript
ClassDeclaration
export class AuthStatusChanged implements Action { readonly type = JitsiConferenceEventTypes.AuthStatusChanged; constructor(public payload: [boolean, string]) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class ConferenceJoined implements Action { readonly type = JitsiConferenceEventTypes.Joined; constructor( public payload: { role: string; myUserId: string; roomname: string; isHidden: boolean; } ) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class ConferenceLeft implements Action { readonly type = JitsiConferenceEventTypes.Left; constructor(public payload = null) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class TrackRemoved implements Action { readonly type = JitsiConferenceEventTypes.TrackRemoved; constructor(public payload: JitsiTrack) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class TrackAdded implements Action { readonly type = JitsiConferenceEventTypes.TrackAdded; constructor(public payload: JitsiTrack) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class TrackMuteChanged implements Action { readonly type = JitsiConferenceEventTypes.TrackMuteChanged; constructor(public payload: JitsiTrack[] | JitsiTrack) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class UserLeft implements Action { readonly type = JitsiConferenceEventTypes.UserLeft; constructor(public payload: [string, JitsiParticipant]) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class UserKicked implements Action { readonly type = JitsiConferenceEventTypes.kicked; constructor(public payload: [JitsiParticipant, string]) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class UserJoined implements Action { readonly type = JitsiConferenceEventTypes.UserJoined; constructor(public payload: [string, JitsiParticipant]) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class SetCreatedTimestamp implements Action { readonly type = JitsiConferenceEventTypes.CreatedTimestamp; constructor(public payload: number) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class ConnectionEstablished implements Action { readonly type = JitsiConferenceEventTypes.ConnectionEstablished; constructor(public payload: number) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class AudioLevelsChanged implements Action { readonly type = JitsiConferenceEventTypes.AudioLevelsChanged; constructor(public payload: [string, number]) {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ClassDeclaration
export class ConferenceFailed implements Action { readonly type = JitsiConferenceEventTypes.ConferenceFailed; constructor(public payload: 'conference.passwordRequired') {} }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
EnumDeclaration
export enum JitsiConferenceEventTypes { AudioLevelsChanged = 'conference.audioLevelsChanged', AuthStatusChanged = 'conference.auth_status_changed', BeforeStatisticsDisposed = 'conference.beforeStatisticsDisposed', Joined = 'conference.joined', Left = 'conference.left', kicked = 'conference.kicked', CreatedTimestamp = 'conference.createdTimestamp', PropertiesChanged = 'conference.propertiesChanged', RoleChange = 'conference.roleChanged', TrackAdded = 'conference.trackAdded', TrackMuteChanged = 'conference.trackMuteChanged', TrackRemoved = 'conference.trackRemoved', UserLeft = 'conference.userLeft', UserJoined = 'conference.userJoined', ConnectionEstablished = 'conference.connectionEstablished', ConferenceFailed = 'conference.failed' }
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
TypeAliasDeclaration
export type JitsiConferenceEvents = | AuthStatusChanged | ConferenceJoined | ConferenceLeft | TrackAdded | TrackRemoved | TrackMuteChanged | UserLeft | UserKicked | SetCreatedTimestamp | UserJoined | ConnectionEstablished | AudioLevelsChanged | ConferenceFailed;
stottle-uk/stottle-lib-jitsi-meet-react
src/conference/models/events/conference.ts
TypeScript
ArrowFunction
(obj) => referenceFor(obj) === referenceForModel(SubscriptionModel)
VeereshAradhya/console
frontend/packages/operator-lifecycle-manager/src/components/clusterserviceversion.tsx
TypeScript
ArrowFunction
(obj): obj is ClusterServiceVersionKind => referenceFor(obj) === referenceForModel(ClusterServiceVersionModel)
VeereshAradhya/console
frontend/packages/operator-lifecycle-manager/src/components/clusterserviceversion.tsx
TypeScript