type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
(newTimezone: string) => { setUsernameResetToken(v4()); setEmailResetToken(v4()); return updateProfile({ timezone: newTimezone }); }
Jskobos/manager
packages/manager/src/features/Profile/DisplaySettings/DisplaySettings.tsx
TypeScript
ArrowFunction
thisNotification => thisNotification.type === 'user_email_bounce'
Jskobos/manager
packages/manager/src/features/Profile/DisplaySettings/DisplaySettings.tsx
TypeScript
ArrowFunction
(theme: GrafanaTheme2) => { return { menu: css` label: grafana-select-menu; background: ${theme.components.dropdown.background}; box-shadow: ${theme.shadows.z3}; position: relative; min-width: 100%; z-index: 1; `, option: css` label: grafana-select-option; padding: 8px; display: flex; align-items: center; flex-direction: row; flex-shrink: 0; white-space: nowrap; cursor: pointer; border-left: 2px solid transparent; &:hover { background: ${theme.colors.action.hover}; } `, optionIcon: css` margin-right: ${theme.spacing(1)}; `, optionImage: css` ${/* LOGZ.IO GRAFANA CHANGE :: DEV-19985: add datasource logos */ ''} width: 45px; label: grafana-select-option-image; margin-right: 10px; `, optionDescription: css` label: grafana-select-option-description; font-weight: normal; font-size: ${theme.typography.size.sm}; color: ${theme.colors.text.secondary}; white-space: normal; line-height: ${theme.typography.body.lineHeight}; `, optionBody: css` label: grafana-select-option-body; display: flex; font-weight: ${theme.typography.fontWeightMedium}; flex-direction: column; flex-grow: 1; `, optionFocused: css` label: grafana-select-option-focused; background: ${theme.colors.action.focus}; `, optionSelected: css` background: ${theme.colors.action.selected}; `, optionDisabled: css` label: grafana-select-option-disabled; background-color: ${theme.colors.action.disabledBackground}; color: ${theme.colors.action.disabledText}; cursor: not-allowed; `, singleValue: css` label: grafana-select-single-value; color: ${theme.components.input.text}; grid-area: 1 / 1 / 2 / 3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; max-width: 100%; `, valueContainer: css` label: grafana-select-value-container; align-items: center; display: grid; position: relative; box-sizing: border-box; flex: 1 1 0%; outline: none; overflow: hidden; `, valueContainerMulti: css` label: grafana-select-value-container-multi; flex-wrap: wrap; display: flex; `, loadingMessage: css` label: grafana-select-loading-message; padding: ${theme.spacing(1)}; text-align: center; width: 100%; `, multiValueContainer: css` label: grafana-select-multi-value-container; display: flex; align-items: center; line-height: 1; background: ${theme.colors.background.secondary}; border-radius: ${theme.shape.borderRadius()}; margin: ${theme.spacing(0.25, 1, 0.25, 0)}; padding: ${theme.spacing(0.25, 0, 0.25, 1)}; color: ${theme.colors.text.primary}; font-size: ${theme.typography.size.sm}; &:hover { background: ${theme.colors.emphasize(theme.colors.background.secondary)}; } `, multiValueRemove: css` label: grafana-select-multi-value-remove; margin: ${theme.spacing(0, 0.5)}; cursor: pointer; svg { margin-bottom: 0; } `, singleValueRemove: css` cursor: pointer; &:hover { color: ${theme.colors.text.primary}; } `, }; }
logzio/grafana
packages/grafana-ui/src/components/Select/getSelectStyles.ts
TypeScript
InterfaceDeclaration
export interface CreateMessageRequest { messageId?: string | undefined; /** * is_system_message can only be true if the user is an administrator, * or turms server will return an error */ isSystemMessage?: boolean | undefined; groupId?: string | undefined; recipientId?: string | undefined; deliveryDate?: string | undefined; text?: string | undefined; records: Uint8Array[]; burnAfter?: number | undefined; }
IDiDidiDiDidi/turms
turms-client-js/src/model/proto/request/message/create_message_request.ts
TypeScript
MethodDeclaration
encode( message: CreateMessageRequest, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { if (message.messageId !== undefined) { writer.uint32(8).int64(message.messageId); } if (message.isSystemMessage !== undefined) { writer.uint32(16).bool(message.isSystemMessage); } if (message.groupId !== undefined) { writer.uint32(24).int64(message.groupId); } if (message.recipientId !== undefined) { writer.uint32(32).int64(message.recipientId); } if (message.deliveryDate !== undefined) { writer.uint32(40).int64(message.deliveryDate); } if (message.text !== undefined) { writer.uint32(50).string(message.text); } for (const v of message.records) { writer.uint32(58).bytes(v!); } if (message.burnAfter !== undefined) { writer.uint32(64).int32(message.burnAfter); } return writer; }
IDiDidiDiDidi/turms
turms-client-js/src/model/proto/request/message/create_message_request.ts
TypeScript
MethodDeclaration
decode( input: _m0.Reader | Uint8Array, length?: number ): CreateMessageRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseCreateMessageRequest } as CreateMessageRequest; message.records = []; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.messageId = longToString(reader.int64() as Long); break; case 2: message.isSystemMessage = reader.bool(); break; case 3: message.groupId = longToString(reader.int64() as Long); break; case 4: message.recipientId = longToString(reader.int64() as Long); break; case 5: message.deliveryDate = longToString(reader.int64() as Long); break; case 6: message.text = reader.string(); break; case 7: message.records.push(reader.bytes()); break; case 8: message.burnAfter = reader.int32(); break; default: reader.skipType(tag & 7); break; } } return message; }
IDiDidiDiDidi/turms
turms-client-js/src/model/proto/request/message/create_message_request.ts
TypeScript
FunctionDeclaration
function getWebViewContent(context: vscode.ExtensionContext, localizeHTML){ const htmlOnDiskPath = vscode.Uri.file(path.join(context.extensionPath, 'src', 'launcher', 'tdsReplay', 'tdsReplayLauncherConfig.html')); const cssOniskPath = vscode.Uri.file(path.join(context.extensionPath, 'resources', 'css', 'form.css')); const htmlContent = fs.readFileSync(htmlOnDiskPath.with({ scheme: 'vscode-resource' }).fsPath); const cssContent = fs.readFileSync(cssOniskPath.with({ scheme: 'vscode-resource' }).fsPath); let runTemplate = compile(htmlContent); return runTemplate({css: cssContent,localize: localizeHTML}); }
WesleyDesenvolvedorWebMobile/tds-vscode
src/launcher/tdsReplay/tdsReplayLauncherConfig.ts
TypeScript
FunctionDeclaration
function updateElement(element: any, message: any) { element.tdsReplayFile = message.tdsReplayFile; element.password = message.password; element.includeSources = message.includeSources; element.excludeSources = message.excludeSources; element.ignoreSourcesNotFound = message.ignoreSourcesNotFound; }
WesleyDesenvolvedorWebMobile/tds-vscode
src/launcher/tdsReplay/tdsReplayLauncherConfig.ts
TypeScript
FunctionDeclaration
function saveNewLauncher(message: any, launchersInfo: any): void { let element: any = { type: "totvs_tdsreplay_debug", request: "launch", cwb: "${workspaceRoot}", ignoreSourcesNotFound: true, name: message.launcherName }; updateElement(element, message); launchersInfo.configurations.push(element); }
WesleyDesenvolvedorWebMobile/tds-vscode
src/launcher/tdsReplay/tdsReplayLauncherConfig.ts
TypeScript
FunctionDeclaration
function addLaunchJsonListener(): void { let launchJson = Utils.getLaunchConfigFile(); if (!fs.existsSync(launchJson)) { Utils.createLaunchConfig(); } if (fs.existsSync(launchJson)) { fs.watch(launchJson, { encoding: 'buffer' }, (eventType, filename) => { if (filename && eventType === 'change') { let tmpLaunchIfo = Utils.getLaunchConfigFile(); let tmpContent = fs.readFileSync(tmpLaunchIfo, 'utf-8'); if(currentLaunchersInfoContent !== tmpContent) { currentLaunchersInfoContent = tmpContent; //Nao é possivel pedir para atualizar a pagina caso ela nao esteja visivel, o que esta acontecendo //se entrar aqui pois o usuario alterou o launch.json manualmente. //Portanto apenas seta a flag para que o painel seja atualizado assim que ficar visivel. //Obs.: Verficar chamada: currentPanel.onDidChangeViewState(...) launcherInfoChangedManually = true; } } }); } }
WesleyDesenvolvedorWebMobile/tds-vscode
src/launcher/tdsReplay/tdsReplayLauncherConfig.ts
TypeScript
ArrowFunction
() => { currentPanel = undefined; }
WesleyDesenvolvedorWebMobile/tds-vscode
src/launcher/tdsReplay/tdsReplayLauncherConfig.ts
TypeScript
ArrowFunction
(event) => { if(currentPanel !== undefined && currentPanel.visible) { if(launcherInfoChangedManually) { launcherInfoChangedManually = false; currentPanel.webview.postMessage(Utils.getLaunchConfig()); } } }
WesleyDesenvolvedorWebMobile/tds-vscode
src/launcher/tdsReplay/tdsReplayLauncherConfig.ts
TypeScript
ArrowFunction
message => { switch (message.command) { case 'saveLaunchConfig': const launcherName = message.launcherName; if(launchersInfo.configurations !== undefined) { if(launchersInfo.configurations.length > 0 !== undefined) { let updated: boolean = false; for(let i=0 ; i < launchersInfo.configurations.length; i++) { let element = launchersInfo.configurations[i]; if(element.name === launcherName) { updateElement(element, message); updated = true; break; } } if(!updated) { saveNewLauncher(message, launchersInfo); } } else { saveNewLauncher(message, launchersInfo); } } Utils.persistLaunchsInfo(launchersInfo); currentLaunchersInfoContent = fs.readFileSync(Utils.getLaunchConfigFile(),'utf8'); if(currentPanel !== undefined) { currentPanel.webview.postMessage(launchersInfo); } vscode.window.showInformationMessage(localize("tds.vscode.launcher.executor","Executor") + " " +message.launcherName+ " " + localize("tds.vscode.launcher.saved","saved.")); if (currentPanel) { if(message.close){ currentPanel.dispose(); } } return; } }
WesleyDesenvolvedorWebMobile/tds-vscode
src/launcher/tdsReplay/tdsReplayLauncherConfig.ts
TypeScript
ArrowFunction
(eventType, filename) => { if (filename && eventType === 'change') { let tmpLaunchIfo = Utils.getLaunchConfigFile(); let tmpContent = fs.readFileSync(tmpLaunchIfo, 'utf-8'); if(currentLaunchersInfoContent !== tmpContent) { currentLaunchersInfoContent = tmpContent; //Nao é possivel pedir para atualizar a pagina caso ela nao esteja visivel, o que esta acontecendo //se entrar aqui pois o usuario alterou o launch.json manualmente. //Portanto apenas seta a flag para que o painel seja atualizado assim que ficar visivel. //Obs.: Verficar chamada: currentPanel.onDidChangeViewState(...) launcherInfoChangedManually = true; } } }
WesleyDesenvolvedorWebMobile/tds-vscode
src/launcher/tdsReplay/tdsReplayLauncherConfig.ts
TypeScript
ClassDeclaration
export default class LauncherConfiguration { static show(context: vscode.ExtensionContext) { if (currentPanel) { currentPanel.reveal(); } else { addLaunchJsonListener(); currentPanel = vscode.window.createWebviewPanel( 'totvs-developer-studio.tdsreplay.configure.launcher', localize("tds.vscode.tdsreplay.launcher.configuration",'TDS Replay Launcher Configuration'), vscode.ViewColumn.One, { enableScripts: true, retainContextWhenHidden: true } ); currentPanel.webview.html = getWebViewContent(context,localizeHTML); currentPanel.onDidDispose(() => { currentPanel = undefined; },null ); currentPanel.onDidChangeViewState((event) => { if(currentPanel !== undefined && currentPanel.visible) { if(launcherInfoChangedManually) { launcherInfoChangedManually = false; currentPanel.webview.postMessage(Utils.getLaunchConfig()); } } }); let launchersInfo = Utils.getLaunchConfig(); currentPanel.webview.postMessage(launchersInfo); currentPanel.webview.onDidReceiveMessage(message => { switch (message.command) { case 'saveLaunchConfig': const launcherName = message.launcherName; if(launchersInfo.configurations !== undefined) { if(launchersInfo.configurations.length > 0 !== undefined) { let updated: boolean = false; for(let i=0 ; i < launchersInfo.configurations.length; i++) { let element = launchersInfo.configurations[i]; if(element.name === launcherName) { updateElement(element, message); updated = true; break; } } if(!updated) { saveNewLauncher(message, launchersInfo); } } else { saveNewLauncher(message, launchersInfo); } } Utils.persistLaunchsInfo(launchersInfo); currentLaunchersInfoContent = fs.readFileSync(Utils.getLaunchConfigFile(),'utf8'); if(currentPanel !== undefined) { currentPanel.webview.postMessage(launchersInfo); } vscode.window.showInformationMessage(localize("tds.vscode.launcher.executor","Executor") + " " +message.launcherName+ " " + localize("tds.vscode.launcher.saved","saved.")); if (currentPanel) { if(message.close){ currentPanel.dispose(); } } return; } }, undefined); } } }
WesleyDesenvolvedorWebMobile/tds-vscode
src/launcher/tdsReplay/tdsReplayLauncherConfig.ts
TypeScript
MethodDeclaration
static show(context: vscode.ExtensionContext) { if (currentPanel) { currentPanel.reveal(); } else { addLaunchJsonListener(); currentPanel = vscode.window.createWebviewPanel( 'totvs-developer-studio.tdsreplay.configure.launcher', localize("tds.vscode.tdsreplay.launcher.configuration",'TDS Replay Launcher Configuration'), vscode.ViewColumn.One, { enableScripts: true, retainContextWhenHidden: true } ); currentPanel.webview.html = getWebViewContent(context,localizeHTML); currentPanel.onDidDispose(() => { currentPanel = undefined; },null ); currentPanel.onDidChangeViewState((event) => { if(currentPanel !== undefined && currentPanel.visible) { if(launcherInfoChangedManually) { launcherInfoChangedManually = false; currentPanel.webview.postMessage(Utils.getLaunchConfig()); } } }); let launchersInfo = Utils.getLaunchConfig(); currentPanel.webview.postMessage(launchersInfo); currentPanel.webview.onDidReceiveMessage(message => { switch (message.command) { case 'saveLaunchConfig': const launcherName = message.launcherName; if(launchersInfo.configurations !== undefined) { if(launchersInfo.configurations.length > 0 !== undefined) { let updated: boolean = false; for(let i=0 ; i < launchersInfo.configurations.length; i++) { let element = launchersInfo.configurations[i]; if(element.name === launcherName) { updateElement(element, message); updated = true; break; } } if(!updated) { saveNewLauncher(message, launchersInfo); } } else { saveNewLauncher(message, launchersInfo); } } Utils.persistLaunchsInfo(launchersInfo); currentLaunchersInfoContent = fs.readFileSync(Utils.getLaunchConfigFile(),'utf8'); if(currentPanel !== undefined) { currentPanel.webview.postMessage(launchersInfo); } vscode.window.showInformationMessage(localize("tds.vscode.launcher.executor","Executor") + " " +message.launcherName+ " " + localize("tds.vscode.launcher.saved","saved.")); if (currentPanel) { if(message.close){ currentPanel.dispose(); } } return; } }, undefined); } }
WesleyDesenvolvedorWebMobile/tds-vscode
src/launcher/tdsReplay/tdsReplayLauncherConfig.ts
TypeScript
ArrowFunction
( ) => lyl `{ display: inline-block position: relative line-height: 1.125 ${classes.hint}, ${classes.error} { display: block } ${classes.label}, ${classes.placeholder} { ly-icon { font-size: inherit } } ${classes.prefix}, ${classes.suffix} { position: relative white-space: nowrap flex: none } { ...${ (theme.field && theme.field.root && (theme.field.root instanceof StyleCollection ? theme.field.root.setTransformer(fn => fn(classes)) : theme.field.root(classes)) ) } } }`
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
fn => fn(classes)
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
( ) => lyl `{ & ${classes.labelSpan} { transition: ${theme.animations.curves.deceleration} .${theme.animations.durations.complex}s } & ${classes.label} { transition: ${theme.animations.curves.deceleration} .${theme.animations.durations.complex}s } }`
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
() => lyl `{ &:not(${classes.errorState}) ${classes.fieldRequiredMarker} { color: ${theme.accent.default} } }`
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
( ) => lyl `{ &, & ${classes.label}, & ${classes.container}:after { color: ${theme.disabled.contrast} cursor: default } }`
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
( ) => lyl `{ & ${classes.label}, & ${classes.hintContainer}, &${classes.selectArrow} ${classes.infix}:after { color: ${theme.warn.default}!important } & ${classes.fieldset}, & ${classes.container}:after { border-color: ${theme.warn.default}!important } & ${classes.inputNative} { caret-color: ${theme.warn.default}!important } & ${classes.hintContainer} ly-hint:not(${classes.hintAfter}) { display: none } & ${classes.labelSpan} { animation: ${shake} ${theme.animations.durations.complex}ms ${theme.animations.curves.deceleration} } & ${classes.inputNative}::selection, & ${classes.inputNative}::-moz-selection { background-color: ${theme.warn.default} !important color: ${theme.warn.contrast} !important } }`
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
( ) => lyl `{ ${classes.infix} { &::after { position: absolute content: '' width: 0 height: 0 border-left: 0.3125em solid transparent border-right: 0.3125em solid transparent border-top: 0.3125em solid top: 0 ${after}: 0 pointer-events: none } } }`
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
(val, media) => ({ breakpoints }: ThemeVariables, ref) => { const classes = ref.selectorsOf(STYLES); return lyl `{ @media ${(media && breakpoints[media]) || 'all'} { ${classes.floatingLabel} ${classes.labelSpan} { transform: scale(${val}) width: ${Math.round(100 / 0.75)}% } } }`; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
({ breakpoints }: ThemeVariables, ref) => { const classes = ref.selectorsOf(STYLES); return lyl `{ @media ${(media && breakpoints[media]) || 'all'} { ${classes.floatingLabel} ${classes.labelSpan} { transform: scale(${val}) width: ${Math.round(100 / 0.75)}% } } }`; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
val => (theme: ThemeVariables, ref) => { const classes = ref.selectorsOf(STYLES); const color = theme.colorOf(val); const contrast = theme.colorOf(`${val}:contrast`); return lyl `{ &${classes.focused} ${classes.container}:after, &${classes.focused}${classes.selectArrow} ${classes.infix}:after { color: ${color} } &${classes.focused} ${classes.fieldset} { border-color: ${color} } &${classes.focused} ${classes.label} { color: ${color} } & ${classes.inputNative} { caret-color: ${color} } & ${classes.inputNative}::selection { background-color: ${color} color: ${contrast} } & ${classes.inputNative}::-moz-selection { background-color: ${color} color: ${contrast} } }`; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
(theme: ThemeVariables, ref) => { const classes = ref.selectorsOf(STYLES); const color = theme.colorOf(val); const contrast = theme.colorOf(`${val}:contrast`); return lyl `{ &${classes.focused} ${classes.container}:after, &${classes.focused}${classes.selectArrow} ${classes.infix}:after { color: ${color} } &${classes.focused} ${classes.fieldset} { border-color: ${color} } &${classes.focused} ${classes.label} { color: ${color} } & ${classes.inputNative} { caret-color: ${color} } & ${classes.inputNative}::selection { background-color: ${color} color: ${contrast} } & ${classes.inputNative}::-moz-selection { background-color: ${color} color: ${contrast} } }`; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
val => (theme: LyFieldVariables, ref) => { const classes = ref.selectorsOf(STYLES); if (theme.field?.appearance) { const appearance = theme.field.appearance[val]; if (appearance) { return appearance instanceof StyleCollection ? appearance.setTransformer((_) => _(classes)).css : appearance(classes); } } throw new Error(`[${val}] not found in theme.field.appearance`); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
(theme: LyFieldVariables, ref) => { const classes = ref.selectorsOf(STYLES); if (theme.field?.appearance) { const appearance = theme.field.appearance[val]; if (appearance) { return appearance instanceof StyleCollection ? appearance.setTransformer((_) => _(classes)).css : appearance(classes); } } throw new Error(`[${val}] not found in theme.field.appearance`); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
(_) => _(classes)
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
() => { this._updateFloatingLabel(); this._updateDisplayWith(); this._markForCheck(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
() => { this._updateFloatingLabel(); this._updateDisplayWith(); this._markForCheck(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
() => { this._ngZone.onStable.pipe(takeUntil(this._destroyed)).subscribe(() => { if (this._updateFielsetSpanOnStable) { this._updateFielsetSpan(); } }); this._ngZone.onStable.pipe(take(1), takeUntil(this._destroyed)).subscribe(() => { this._updateDisplayWith(); this._renderer.addClass(this._el.nativeElement, this.classes.animations); }); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
() => { if (this._updateFielsetSpanOnStable) { this._updateFielsetSpan(); } }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
() => { this._updateDisplayWith(); this._renderer.addClass(this._el.nativeElement, this.classes.animations); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
() => { this._updateFielsetSpanOnStable = true; this._markForCheck(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
type => type === nativeElement.type
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ArrowFunction
() => { this.disabled = !!ngControl.disabled; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ClassDeclaration
@Directive({ selector: 'input[lyInput], textarea[lyInput], input[lyNativeControl], textarea[lyNativeControl], select[lyNativeControl]', exportAs: 'LyNativeControl', providers: [ StyleRenderer, { provide: LyFieldControlBase, useExisting: LyNativeControl } ] }) export class LyNativeControl implements LyFieldControlBase, OnInit, DoCheck, OnDestroy { protected _disabled = false; protected _required = false; protected _placeholder: string; readonly stateChanges: Subject<void> = new Subject<void>(); private _hasDisabledClass?: boolean; private _errorClass?: string; private _cursorClass: string | null; private _isSelectInput: boolean; private _form: NgForm | FormGroupDirective | null = this._parentForm || this._parentFormGroup; _focused: boolean = false; errorState: boolean = false; @HostListener('input') _onInput() { this.stateChanges.next(); } @HostListener('blur') _onBlur() { if (this._focused !== false) { this._focused = false; this.stateChanges.next(); } } @HostListener('focus') _onFocus() { if (this._focused !== true) { this._focused = true; this.stateChanges.next(); } } /** @ignore */ @Input() set value(val) { if (val !== this.value) { this._getHostElement().value = val; this.stateChanges.next(); } } get value() { return this._getHostElement().value; } /** Whether the input is disabled. */ @HostBinding() @Input() set disabled(val: boolean) { if (val !== this._disabled) { this._disabled = toBoolean(val); if (this._field) { if (!val && this._hasDisabledClass) { this._renderer.removeClass(this._field._getHostElement(), this._field.classes.disabled); if (this._cursorClass) { this._renderer.addClass(this._field._getHostElement(), this._cursorClass); } this._hasDisabledClass = undefined; } else if (val) { this._renderer.addClass(this._field._getHostElement(), this._field.classes.disabled); if (this._cursorClass) { this._renderer.removeClass(this._field._getHostElement(), this._cursorClass); } this._hasDisabledClass = true; } } } } get disabled(): boolean { if (this.ngControl && this.ngControl.disabled !== null) { return this.ngControl.disabled; } return this._disabled; } @HostBinding() @Input() set required(value: boolean) { this._required = coerceBooleanProperty(value); } get required(): boolean { return this._required; } @Input() set placeholder(val: string) { this._placeholder = val; } get placeholder(): string { return this._placeholder; } get focused() { return this._focused; } get empty() { const val = this.value; return val === '' || val == null; } get floatingLabel() { return this.focused || !this.empty || (this._isSelectInput ? this._hasLabelSelectionOption() : false); } constructor( private _theme: LyTheme2, readonly sRenderer: StyleRenderer, private _el: ElementRef<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>, private _renderer: Renderer2, @Optional() private _field: LyField, /** @docs-private */ @Optional() @Self() public ngControl: NgControl, @Optional() private _parentForm: NgForm, @Optional() private _parentFormGroup: FormGroupDirective ) { } ngOnInit() { this._renderer.setAttribute(this._getHostElement(), 'placeholder', '­'); const { nativeElement } = this._el; if (nativeElement.nodeName.toLowerCase() === 'select') { this._isSelectInput = true; } // apply class {selectArrow} to `<select> not multiple` if (this._field && nativeElement.type === 'select-one') { this._renderer.addClass(this._field._getHostElement(), this._field.classes.selectArrow); } // apply style cursor only for input of type text if (nativeElement instanceof HTMLTextAreaElement || inputText.some(type => type === nativeElement.type)) { this._cursorClass = this._theme.addSimpleStyle('lyField.text', { '& {infix}': { cursor: 'text' } }, STYLE_PRIORITY, STYLES); } if (this._isSelectInput) { this._cursorClass = this._theme.addSimpleStyle('lyField.select', { '& {infix}': { cursor: 'pointer' } }, STYLE_PRIORITY, STYLES); } if (this._cursorClass) { this._renderer.addClass(this._field._getHostElement(), this._cursorClass); } // apply default styles this._renderer.addClass(nativeElement, this._field.classes.inputNative); const ngControl = this.ngControl; // update styles on disabled if (ngControl && ngControl.statusChanges) { ngControl.statusChanges.subscribe(() => { this.disabled = !!ngControl.disabled; }); } } ngDoCheck() { if (this._field._control) { const oldVal = this.errorState; const newVal = !!(this.ngControl && this.ngControl.invalid && (this.ngControl.touched || (this._form && this._form.submitted))); if (newVal !== oldVal) { this.errorState = newVal; if (this._field) { const errorClass = this._field.classes.errorState; if (newVal) { this._renderer.addClass(this._field._getHostElement(), errorClass); this._errorClass = errorClass; } else if (this._errorClass) { this._renderer.removeClass(this._field._getHostElement(), errorClass); this._errorClass = undefined; } this.stateChanges.next(); } } } } ngOnDestroy() { this.stateChanges.complete(); } /** @docs-private */ onContainerClick(_e: MouseEvent) { this._getHostElement().focus(); } /** Focuses the input. */ focus(): void { this._getHostElement().focus(); } _getHostElement() { return this._el.nativeElement; } private _hasLabelSelectionOption() { const el = this._getHostElement() as HTMLSelectElement; const option = el.selectedOptions ? el.selectedOptions.item(0) : null; return option ? !!option.label : false; } }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
InterfaceDeclaration
export interface LyFieldTheme { /** Styles for Field Component */ root?: StyleCollection<((classes: LyClasses<typeof STYLES>) => StyleTemplate)> | ((classes: LyClasses<typeof STYLES>) => StyleTemplate); appearance?: { standard?: StyleCollection<((classes: LyClasses<typeof STYLES>) => StyleTemplate)> | ((classes: LyClasses<typeof STYLES>) => StyleTemplate) filled?: StyleCollection<((classes: LyClasses<typeof STYLES>) => StyleTemplate)> | ((classes: LyClasses<typeof STYLES>) => StyleTemplate) outlined?: StyleCollection<((classes: LyClasses<typeof STYLES>) => StyleTemplate)> | ((classes: LyClasses<typeof STYLES>) => StyleTemplate) [name: string]: StyleCollection<((classes: LyClasses<typeof STYLES>) => StyleTemplate)> | ((classes: LyClasses<typeof STYLES>) => StyleTemplate) | undefined }; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
InterfaceDeclaration
export interface LyFieldVariables { field?: LyFieldTheme; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
InterfaceDeclaration
export interface LyFieldDefaultOptions { appearance?: string; /** * Whether the label is floating. * false (default): The label will only float when needed * true: The label will always be floating */ floatingLabel?: boolean; /** * Whether the hint will always show. * false (default): The hint will only be shown when the text is focused * true: The hint will always show */ persistentHint?: boolean; /** * Floating label size * Default: 0.75 */ floatingLabelSize?: number; /** * Whether the required marker should be hidden. */ hideRequiredMarker?: boolean; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
@HostListener('focus') onFocus() { this._el.nativeElement.focus(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
ngOnInit() { if (!this.color) { this.color = DEFAULT_WITH_COLOR; } if (this.floatingLabelSize == null) { this.floatingLabelSize = (this._defaults?.floatingLabelSize != null) ? this._defaults?.floatingLabelSize : DEFAULT_FLOATING_LABEL_SIZE; } if (!this.appearance) { this.appearance = this._defaults?.appearance ? this._defaults?.appearance : DEFAULT_APPEARANCE; } if (this.persistentHint == null) { this.persistentHint = (this._defaults?.persistentHint != null) ? this._defaults.persistentHint : false; } if (this.floatingLabel == null) { this.floatingLabel = (this._defaults?.floatingLabel != null) ? this._defaults.floatingLabel : false; } }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
ngAfterContentInit() { this._control!.stateChanges.subscribe(() => { this._updateFloatingLabel(); this._updateDisplayWith(); this._markForCheck(); }); const ngControl = this._control!.ngControl; // Run change detection if the value changes. if (ngControl && ngControl.valueChanges) { ngControl.valueChanges.pipe(takeUntil(this._destroyed)).subscribe(() => { this._updateFloatingLabel(); this._updateDisplayWith(); this._markForCheck(); }); } this._ngZone.runOutsideAngular(() => { this._ngZone.onStable.pipe(takeUntil(this._destroyed)).subscribe(() => { if (this._updateFielsetSpanOnStable) { this._updateFielsetSpan(); } }); this._ngZone.onStable.pipe(take(1), takeUntil(this._destroyed)).subscribe(() => { this._updateDisplayWith(); this._renderer.addClass(this._el.nativeElement, this.classes.animations); }); }); merge(this._prefixChildren.changes, this._suffixChildren.changes).subscribe(() => { this._updateFielsetSpanOnStable = true; this._markForCheck(); }); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
ngAfterViewInit() { this._updateFielsetSpan(); this._updateFloatingLabel(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
ngOnDestroy() { this._destroyed.next(); this._destroyed.complete(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
_updateFielsetSpan() { if (!this._platform.isBrowser) { return; } if (this.floatingLabelSize == null) { return; } if (this.appearance !== 'outlined') { return; } const label = this._isLabel() ? this._labelSpan.nativeElement : null; const labelChildren = this._isLabel() ? this._labelSpan.nativeElement.children : null; if (!label) { return; } const before = this._theme.variables.before; const fieldsetLegend = this._getHostElement().querySelector('legend'); if (!fieldsetLegend) { this._updateFielsetSpanOnStable = true; return; } const labelRect = label.getBoundingClientRect(); const container = this._container.nativeElement; const containerRect = this._container.nativeElement.getBoundingClientRect(); let width = 0; for (let index = 0; index < labelChildren!.length; index++) { width += labelChildren![index].getBoundingClientRect().width; } const percent = containerRect.width / container.offsetWidth; const labelPercent = labelRect.width / label.offsetWidth; let beforeMargin = Math.abs( (containerRect[before] - labelRect[before]) / percent) - 12; width /= labelPercent; width *= this.floatingLabelSize; // add 6px of space width += 6; width = width > (label.parentElement!.offsetWidth) ? (label.parentElement!.offsetWidth) : width; width = Math.round(width); beforeMargin = Math.round(beforeMargin); fieldsetLegend.style[`margin-right`] = ``; fieldsetLegend.style[`margin-left`] = ``; fieldsetLegend.style[`margin-${before}`] = `${beforeMargin}px`; this._updateFielsetSpanOnStable = false; this._fielsetSpanClass = this._theme.addStyle(`style.fieldsetSpanFocused:${width}`, { [`&.${this.classes.isFloatingLabel} .${this.classes.fieldsetSpan}`]: {width: `${width}px`} }, this._el.nativeElement, this._fielsetSpanClass, STYLE_PRIORITY); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
/** @ignore */ _isLabel() { if (this._control && this._control.placeholder && !this._labelChild) { return true; } else if (this._labelChild || this._placeholderChild) { return true; } return false; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
/** @ignore */ _isPlaceholder() { if ((this._labelChild && this._control && this._control.placeholder) || (this._labelChild && this._placeholderChild)) { return true; } return false; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
/** @ignore */ _isEmpty() { const val = this._control ? this._control.value : null; return val === '' || val === null || val === undefined; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
private _updateFloatingLabel() { if (this._labelContainer2) { const isFloating = this._control!.floatingLabel || this.floatingLabel; if (this._isFloating !== isFloating) { this._isFloating = isFloating; if (isFloating) { this._renderer.addClass(this._labelContainer2.nativeElement, this.classes.floatingLabel); this._renderer.addClass(this._el.nativeElement, this.classes.isFloatingLabel); } else { this._renderer.removeClass(this._labelContainer2.nativeElement, this.classes.floatingLabel); this._renderer.removeClass(this._el.nativeElement, this.classes.isFloatingLabel); } } } if (this._control) { if (this._control.focused) { this._renderer.addClass(this._el.nativeElement, this.classes.focused); } else { this._renderer.removeClass(this._el.nativeElement, this.classes.focused); } } }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
private _updateDisplayWith() { if (this._control) { this._control.sRenderer.toggleClass(this.classes._hiddenInput, this.displayWithStatus); } }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
private _markForCheck() { this._cd.markForCheck(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
_getHostElement() { return this._el.nativeElement; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
@HostListener('input') _onInput() { this.stateChanges.next(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
@HostListener('blur') _onBlur() { if (this._focused !== false) { this._focused = false; this.stateChanges.next(); } }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
@HostListener('focus') _onFocus() { if (this._focused !== true) { this._focused = true; this.stateChanges.next(); } }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
ngOnInit() { this._renderer.setAttribute(this._getHostElement(), 'placeholder', '­'); const { nativeElement } = this._el; if (nativeElement.nodeName.toLowerCase() === 'select') { this._isSelectInput = true; } // apply class {selectArrow} to `<select> not multiple` if (this._field && nativeElement.type === 'select-one') { this._renderer.addClass(this._field._getHostElement(), this._field.classes.selectArrow); } // apply style cursor only for input of type text if (nativeElement instanceof HTMLTextAreaElement || inputText.some(type => type === nativeElement.type)) { this._cursorClass = this._theme.addSimpleStyle('lyField.text', { '& {infix}': { cursor: 'text' } }, STYLE_PRIORITY, STYLES); } if (this._isSelectInput) { this._cursorClass = this._theme.addSimpleStyle('lyField.select', { '& {infix}': { cursor: 'pointer' } }, STYLE_PRIORITY, STYLES); } if (this._cursorClass) { this._renderer.addClass(this._field._getHostElement(), this._cursorClass); } // apply default styles this._renderer.addClass(nativeElement, this._field.classes.inputNative); const ngControl = this.ngControl; // update styles on disabled if (ngControl && ngControl.statusChanges) { ngControl.statusChanges.subscribe(() => { this.disabled = !!ngControl.disabled; }); } }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
ngDoCheck() { if (this._field._control) { const oldVal = this.errorState; const newVal = !!(this.ngControl && this.ngControl.invalid && (this.ngControl.touched || (this._form && this._form.submitted))); if (newVal !== oldVal) { this.errorState = newVal; if (this._field) { const errorClass = this._field.classes.errorState; if (newVal) { this._renderer.addClass(this._field._getHostElement(), errorClass); this._errorClass = errorClass; } else if (this._errorClass) { this._renderer.removeClass(this._field._getHostElement(), errorClass); this._errorClass = undefined; } this.stateChanges.next(); } } } }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
ngOnDestroy() { this.stateChanges.complete(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
/** @docs-private */ onContainerClick(_e: MouseEvent) { this._getHostElement().focus(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
/** Focuses the input. */ focus(): void { this._getHostElement().focus(); }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
MethodDeclaration
private _hasLabelSelectionOption() { const el = this._getHostElement() as HTMLSelectElement; const option = el.selectedOptions ? el.selectedOptions.item(0) : null; return option ? !!option.label : false; }
A-l-y-l-e/Alyle-UI
src/lib/field/field.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-mtk-chart-card-item2', templateUrl: './chart-card-item2.component.html', styleUrls: ['./chart-card-item2.component.scss'] }) export class ChartCardItem2Component implements OnInit { constructor(public chartData1: ChartCardData2Service) { } ngOnInit() { } }
re-architecture/nebula.webapp-angular
src/app/mtk/components/chart-card-item2/chart-card-item2.component.ts
TypeScript
MethodDeclaration
ngOnInit() { }
re-architecture/nebula.webapp-angular
src/app/mtk/components/chart-card-item2/chart-card-item2.component.ts
TypeScript
ArrowFunction
value => { if (!value.creditCardID) return; const type = getCreditCardType(value.creditCardID); if (type === 'Visa') { this.isVisa = true; this.isAmericanExpress = false; this.isMaster = false; this.isDiscover = false; } else if (type === 'Discover') { this.isDiscover = true; this.isVisa = false; this.isMaster = false; this.isAmericanExpress = false; } else if (type === 'MasterCard') { this.isMaster = true; this.isDiscover = false; this.isVisa = false; this.isAmericanExpress = false; } else if (type === 'AmericanExpress') { this.isAmericanExpress = true; this.isVisa = false; this.isDiscover = false; this.isMaster = false; } else { this.isVisa = false; this.isDiscover = false; this.isMaster = false; this.isAmericanExpress = false; } }
JayKan/digital-wallet
src/app/components/wallet-add.ts
TypeScript
ArrowFunction
card => { this.success.emit(card); }
JayKan/digital-wallet
src/app/components/wallet-add.ts
TypeScript
ClassDeclaration
@Component({ selector: 'wallet-add', encapsulation: ViewEncapsulation.None, template:` <section class="row"> <header class="add-wallet"> <h2 class="center"> <i class="fa fa-angle-left add-icon" aria-hidden="true" (click)="navigateTo('wallet')"></i> Add debit or credit card </h2> </header> </section> <form novalidate (submit)="submit()" [formGroup]="form" class="add-form"> <div class="input-row"> <div class="half padding-right-10"> <div class="form-group"> <input type="text" placeholder="First name" class="form-control" [formControlName]="'firstName'"> </div> </div> <div class="half"> <div class="form-group 50"> <input type="text" placeholder="Last name" class="form-control" [formControlName]="'lastName'"> </div> </div> </div> <div class="input-row"> <div class="form-group"> <div class="vertical"> <div class="card"></div> <div class="card"></div> <div class="card"></div> <div class="card"></div> <div class="card"></div> </div> </div> </div> <div class="input-row"> <div class="form-group"> <input type="text" placeholder="xxxx xxxx xxxx xxxx" class="form-control" [formControlName]="'creditCardID'"> <div class="credit-card-type" [ngClass]="{ 'visa-type': isVisa, 'master-type': isMaster, 'american-express': isAmericanExpress, 'discover': isDiscover }"></div> </div> </div> <div class="input-row"> <div class="half padding-right-10"> <div class="form-group"> <label for="expirationDate">Expires</label> <input type="text" id="expirationDate" class="form-control" placeholder="MM/YY" [formControlName]="'expiration'"> </div> </div> <div class="half"> <div class="form-group"> <label for="csc">CSC</label> <input type="text" id="csc" placeholder="3 digits" class="form-control" [formControlName]="'csc'"> </div> </div> </div> <footer> <button type="submit" [disabled]="!form.valid">Add</button> </footer> </form> ` }) export class WalletAddComponent implements OnInit { public form: FormGroup; public isVisa: boolean = false; public isMaster: boolean = false; public isAmericanExpress: boolean = false; public isDiscover: boolean = false; @Output() success: EventEmitter<any> = new EventEmitter<any>(); constructor( public wallet: WalletService, public store$: Store<AppState>, private formBuilder: FormBuilder ) {} ngOnInit(): void { this.form = this.formBuilder.group({ firstName: ['',[ Validators.required, Validators.pattern(stringRegex), Validators.maxLength(24), ]], lastName: ['', [ Validators.required, Validators.pattern(stringRegex), Validators.maxLength(24), ]], creditCardID: ['', [ Validators.required, Validators.pattern(cardCardNumberRegex) ]], expiration: ['', [ Validators.required, Validators.pattern(expirationRegex), ]], csc: ['', [ Validators.required, Validators.maxLength(3), Validators.pattern(numberRegex), ]], type: [''] }); this.form.valueChanges .debounceTime(300) .distinctUntilChanged() .subscribe(value => { if (!value.creditCardID) return; const type = getCreditCardType(value.creditCardID); if (type === 'Visa') { this.isVisa = true; this.isAmericanExpress = false; this.isMaster = false; this.isDiscover = false; } else if (type === 'Discover') { this.isDiscover = true; this.isVisa = false; this.isMaster = false; this.isAmericanExpress = false; } else if (type === 'MasterCard') { this.isMaster = true; this.isDiscover = false; this.isVisa = false; this.isAmericanExpress = false; } else if (type === 'AmericanExpress') { this.isAmericanExpress = true; this.isVisa = false; this.isDiscover = false; this.isMaster = false; } else { this.isVisa = false; this.isDiscover = false; this.isMaster = false; this.isAmericanExpress = false; } }); } navigateTo(nextState: string): void { this.wallet.changeCurrentSelectedState(nextState); } submit(): void { const type = getCreditCardType(this.form.value.creditCardID); this.form.patchValue({ type }); this.wallet.createCard(this.form.value).subscribe(card => { this.success.emit(card); }); } }
JayKan/digital-wallet
src/app/components/wallet-add.ts
TypeScript
MethodDeclaration
ngOnInit(): void { this.form = this.formBuilder.group({ firstName: ['',[ Validators.required, Validators.pattern(stringRegex), Validators.maxLength(24), ]], lastName: ['', [ Validators.required, Validators.pattern(stringRegex), Validators.maxLength(24), ]], creditCardID: ['', [ Validators.required, Validators.pattern(cardCardNumberRegex) ]], expiration: ['', [ Validators.required, Validators.pattern(expirationRegex), ]], csc: ['', [ Validators.required, Validators.maxLength(3), Validators.pattern(numberRegex), ]], type: [''] }); this.form.valueChanges .debounceTime(300) .distinctUntilChanged() .subscribe(value => { if (!value.creditCardID) return; const type = getCreditCardType(value.creditCardID); if (type === 'Visa') { this.isVisa = true; this.isAmericanExpress = false; this.isMaster = false; this.isDiscover = false; } else if (type === 'Discover') { this.isDiscover = true; this.isVisa = false; this.isMaster = false; this.isAmericanExpress = false; } else if (type === 'MasterCard') { this.isMaster = true; this.isDiscover = false; this.isVisa = false; this.isAmericanExpress = false; } else if (type === 'AmericanExpress') { this.isAmericanExpress = true; this.isVisa = false; this.isDiscover = false; this.isMaster = false; } else { this.isVisa = false; this.isDiscover = false; this.isMaster = false; this.isAmericanExpress = false; } }); }
JayKan/digital-wallet
src/app/components/wallet-add.ts
TypeScript
MethodDeclaration
navigateTo(nextState: string): void { this.wallet.changeCurrentSelectedState(nextState); }
JayKan/digital-wallet
src/app/components/wallet-add.ts
TypeScript
MethodDeclaration
submit(): void { const type = getCreditCardType(this.form.value.creditCardID); this.form.patchValue({ type }); this.wallet.createCard(this.form.value).subscribe(card => { this.success.emit(card); }); }
JayKan/digital-wallet
src/app/components/wallet-add.ts
TypeScript
FunctionDeclaration
function ListItem (props: ListItemProps) { const [cardRef] = useScrollIntoView(props.shouldScrollIntoView) const onClick = useReadArticleClickHandler(props.onReadFeedItem, { item: props.item }) const data = props.item.article?.data if (!data) { return null } return ( <Card.ListItem> <a onClick={onClick} href={data.url.url} ref={cardRef}> <Card.Content> <Card.Publisher>{props.publisher && props.publisher.publisherName}</Card.Publisher> <Card.Heading>{data.title}</Card.Heading> <Card.Time>{data.relativeTimeDescription}</Card.Time> </Card.Content> <Card.ListItemImageFrame> <CardImageFromFeedItem list={true} data={data} /> </Card.ListItemImageFrame> </a> </Card.ListItem> ) }
AnudeepGunukula/brave-core
components/brave_new_tab_ui/components/default/braveToday/cards/categoryGroup/index.tsx
TypeScript
FunctionDeclaration
export default function CategoryGroup (props: Props) { // No content no render® if (props.content.length < 3 || props.content.some(c => !c.article)) { return null } return ( <Card.BrandedList> <Card.Title>{props.categoryName}</Card.Title> <Card.List> { props.content.map((item, index) => { const data = item.article?.data // we already validated this, but typescript wants // us to do it again if (!data) { return <React.Fragment key={index} /> } const shouldScrollTo = ( !!props.articleToScrollTo && props.articleToScrollTo.url.url === data.url.url ) const publisher = props.publishers[data.publisherId] return <ListItem publisher={publisher} item={item} key={index} shouldScrollIntoView={shouldScrollTo} onReadFeedItem={props.onReadFeedItem} /> }) } </Card.List> </Card.BrandedList> ) }
AnudeepGunukula/brave-core
components/brave_new_tab_ui/components/default/braveToday/cards/categoryGroup/index.tsx
TypeScript
ArrowFunction
c => !c.article
AnudeepGunukula/brave-core
components/brave_new_tab_ui/components/default/braveToday/cards/categoryGroup/index.tsx
TypeScript
ArrowFunction
(item, index) => { const data = item.article?.data // we already validated this, but typescript wants // us to do it again if (!data) { return <React.Fragment key={index} /> } const shouldScrollTo = ( !!props.articleToScrollTo && props.articleToScrollTo.url.url === data.url.url ) const publisher = props.publishers[data.publisherId] return <ListItem publisher={publisher} item={item} key={index} shouldScrollIntoView={shouldScrollTo} onReadFeedItem={props.onReadFeedItem} /> }
AnudeepGunukula/brave-core
components/brave_new_tab_ui/components/default/braveToday/cards/categoryGroup/index.tsx
TypeScript
InterfaceDeclaration
interface Props { content: BraveNews.FeedItem[] publishers: BraveNews.Publishers categoryName: string articleToScrollTo?: BraveNews.FeedItemMetadata onReadFeedItem: OnReadFeedItem }
AnudeepGunukula/brave-core
components/brave_new_tab_ui/components/default/braveToday/cards/categoryGroup/index.tsx
TypeScript
TypeAliasDeclaration
type ListItemProps = { item: BraveNews.FeedItem publisher?: BraveNews.Publisher onReadFeedItem: OnReadFeedItem shouldScrollIntoView: boolean }
AnudeepGunukula/brave-core
components/brave_new_tab_ui/components/default/braveToday/cards/categoryGroup/index.tsx
TypeScript
ClassDeclaration
export class InterfaceDeclarationCompiler extends NodeCompiler<ts.InterfaceDeclaration> { public readonly kind = ts.SyntaxKind.InterfaceDeclaration; public visitNode(_sb: ScriptBuilder, _node: ts.InterfaceDeclaration, _optionsIn: VisitOptions): void { // do nothing } }
DanPopa46/neo-one
packages/neo-one-smart-contract-compiler/src/compile/declaration/InterfaceDeclarationCompiler.ts
TypeScript
MethodDeclaration
public visitNode(_sb: ScriptBuilder, _node: ts.InterfaceDeclaration, _optionsIn: VisitOptions): void { // do nothing }
DanPopa46/neo-one
packages/neo-one-smart-contract-compiler/src/compile/declaration/InterfaceDeclarationCompiler.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-language-modal', templateUrl: './languageModal.component.html', styleUrls: ['./languageModal.component.scss'], }) export class LanguageModalComponent implements OnInit { constructor(public modalController: ModalController) { } async presentModal() { const modal = await this.modalController.create({ swipeToClose: true, component: LanguageModal, }); return await modal.present(); } ngOnInit() { } }
maestrotype/LLE
src/app/components/languageModal/languageModal.component.ts
TypeScript
MethodDeclaration
async presentModal() { const modal = await this.modalController.create({ swipeToClose: true, component: LanguageModal, }); return await modal.present(); }
maestrotype/LLE
src/app/components/languageModal/languageModal.component.ts
TypeScript
ArrowFunction
() => import('./admin/admin-routing.module').then(m => m.AdminRoutingModule)
alvieira/jhipster-course
jblog/src/main/webapp/app/app-routing.module.ts
TypeScript
ArrowFunction
m => m.AdminRoutingModule
alvieira/jhipster-course
jblog/src/main/webapp/app/app-routing.module.ts
TypeScript
ArrowFunction
() => import('./account/account.module').then(m => m.AccountModule)
alvieira/jhipster-course
jblog/src/main/webapp/app/app-routing.module.ts
TypeScript
ArrowFunction
m => m.AccountModule
alvieira/jhipster-course
jblog/src/main/webapp/app/app-routing.module.ts
TypeScript
ClassDeclaration
@NgModule({ imports: [ RouterModule.forRoot( [ { path: 'admin', data: { authorities: [Authority.ADMIN], }, canActivate: [UserRouteAccessService], loadChildren: () => import('./admin/admin-routing.module').then(m => m.AdminRoutingModule), }, { path: 'account', loadChildren: () => import('./account/account.module').then(m => m.AccountModule), }, ...LAYOUT_ROUTES, ], { enableTracing: DEBUG_INFO_ENABLED } ), ], exports: [RouterModule], }) export class JblogAppRoutingModule {}
alvieira/jhipster-course
jblog/src/main/webapp/app/app-routing.module.ts
TypeScript
FunctionDeclaration
export declare function deleteFile(endpoint: string, hdNode: HDKey, fileID: string): Promise<import("axios").AxiosResponse<any>>;
opacity/opacity-electron-typescript
opaque/pkg/dist-types/core/requests/deleteFile.d.ts
TypeScript
InterfaceDeclaration
export interface CourseSertificate { cvId: string; courseName: string; certificateUrl: string; }
IvayloNikolov36/JobFinder-Front-end
JobFinder/src/app/core/models/cv/course-sertificate.ts
TypeScript
InterfaceDeclaration
// https://eips.ethereum.org/EIPS/eip-3085 export interface AddEthereumChainParameter { chainId: string blockExplorerUrls?: string[] chainName?: string iconUrls?: string[] nativeCurrency?: Currency rpcUrls?: any }
CatharsisNetwork/catharsis-interface
src/network/data/AddEthereumChainParameter.d.ts
TypeScript
ClassDeclaration
@Component({ selector: 'po-progress-bar', templateUrl: './po-progress-bar.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class PoProgressBarComponent { @Input('p-indeterminate') indeterminate: boolean; @Input('p-value') value: number; get valueScale() { return `${this.value / 100}`; } }
nicoleoliveira/portinari-angular-wai-aria
projects/ui/src/lib/components/po-progress/po-progress-bar/po-progress-bar.component.ts
TypeScript
FunctionDeclaration
/** * Tries to discover all possible plugins based on the provided plugin config. * Discovery result consists of two separate streams, the one (`plugin$`) is * for the successfully discovered plugins and the other one (`error$`) is for * all the errors that occurred during discovery process. * * @param config Plugin config instance. * @param coreContext Kibana core values. * @internal */ export function discover(config: PluginsConfig, coreContext: CoreContext) { const log = coreContext.logger.get('plugins-discovery'); log.debug('Discovering plugins...'); if (config.additionalPluginPaths.length && coreContext.env.mode.dev) { log.warn( `Explicit plugin paths [${config.additionalPluginPaths}] should only be used in development. Relative imports may not work properly in production.` ); } const discoveryResults$ = merge( from(config.additionalPluginPaths), processPluginSearchPaths$(config.pluginSearchPaths, log) ).pipe( mergeMap(pluginPathOrError => { return typeof pluginPathOrError === 'string' ? createPlugin$(pluginPathOrError, log, coreContext) : [pluginPathOrError]; }), shareReplay() ); return { plugin$: discoveryResults$.pipe( filter((entry): entry is PluginWrapper => entry instanceof PluginWrapper) ), error$: discoveryResults$.pipe( filter((entry): entry is PluginDiscoveryError => !(entry instanceof PluginWrapper)) ), }; }
ChanghunKang/kibana
src/core/server/plugins/discovery/plugins_discovery.ts
TypeScript
FunctionDeclaration
/** * Iterates over every plugin search path and returns a merged stream of all * sub-directories. If directory cannot be read or it's impossible to get stat * for any of the nested entries then error is added into the stream instead. * @param pluginDirs List of the top-level directories to process. * @param log Plugin discovery logger instance. */ function processPluginSearchPaths$(pluginDirs: readonly string[], log: Logger) { return from(pluginDirs).pipe( mergeMap(dir => { log.debug(`Scanning "${dir}" for plugin sub-directories...`); return fsReadDir$(dir).pipe( mergeMap((subDirs: string[]) => subDirs.map(subDir => resolve(dir, subDir))), mergeMap(path => fsStat$(path).pipe( // Filter out non-directory entries from target directories, it's expected that // these directories may contain files (e.g. `README.md` or `package.json`). // We shouldn't silently ignore the entries we couldn't get stat for though. mergeMap(pathStat => (pathStat.isDirectory() ? [path] : [])), catchError(err => [PluginDiscoveryError.invalidPluginPath(path, err)]) ) ), catchError(err => [PluginDiscoveryError.invalidSearchPath(dir, err)]) ); }) ); }
ChanghunKang/kibana
src/core/server/plugins/discovery/plugins_discovery.ts
TypeScript
FunctionDeclaration
/** * Tries to load and parse the plugin manifest file located at the provided plugin * directory path and produces an error result if it fails to do so or plugin manifest * isn't valid. * @param path Path to the plugin directory where manifest should be loaded from. * @param log Plugin discovery logger instance. * @param coreContext Kibana core context. */ function createPlugin$(path: string, log: Logger, coreContext: CoreContext) { return from(parseManifest(path, coreContext.env.packageInfo)).pipe( map(manifest => { log.debug(`Successfully discovered plugin "${manifest.id}" at "${path}"`); const opaqueId = Symbol(manifest.id); return new PluginWrapper({ path, manifest, opaqueId, initializerContext: createPluginInitializerContext(coreContext, opaqueId, manifest), }); }), catchError(err => [err]) ); }
ChanghunKang/kibana
src/core/server/plugins/discovery/plugins_discovery.ts
TypeScript
ArrowFunction
pluginPathOrError => { return typeof pluginPathOrError === 'string' ? createPlugin$(pluginPathOrError, log, coreContext) : [pluginPathOrError]; }
ChanghunKang/kibana
src/core/server/plugins/discovery/plugins_discovery.ts
TypeScript
ArrowFunction
(entry): entry is PluginWrapper => entry instanceof PluginWrapper
ChanghunKang/kibana
src/core/server/plugins/discovery/plugins_discovery.ts
TypeScript
ArrowFunction
(entry): entry is PluginDiscoveryError => !(entry instanceof PluginWrapper)
ChanghunKang/kibana
src/core/server/plugins/discovery/plugins_discovery.ts
TypeScript
ArrowFunction
dir => { log.debug(`Scanning "${dir}" for plugin sub-directories...`); return fsReadDir$(dir).pipe( mergeMap((subDirs: string[]) => subDirs.map(subDir => resolve(dir, subDir))), mergeMap(path => fsStat$(path).pipe( // Filter out non-directory entries from target directories, it's expected that // these directories may contain files (e.g. `README.md` or `package.json`). // We shouldn't silently ignore the entries we couldn't get stat for though. mergeMap(pathStat => (pathStat.isDirectory() ? [path] : [])), catchError(err => [PluginDiscoveryError.invalidPluginPath(path, err)]) ) ), catchError(err => [PluginDiscoveryError.invalidSearchPath(dir, err)]) ); }
ChanghunKang/kibana
src/core/server/plugins/discovery/plugins_discovery.ts
TypeScript
ArrowFunction
(subDirs: string[]) => subDirs.map(subDir => resolve(dir, subDir))
ChanghunKang/kibana
src/core/server/plugins/discovery/plugins_discovery.ts
TypeScript
ArrowFunction
subDir => resolve(dir, subDir)
ChanghunKang/kibana
src/core/server/plugins/discovery/plugins_discovery.ts
TypeScript