Skip to content

Commit

Permalink
chore(modifiers): set private and protected (#1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
doyakovlev authored and doyakovlev committed Feb 17, 2020
1 parent 564c79b commit 3ee881a
Show file tree
Hide file tree
Showing 53 changed files with 139 additions and 138 deletions.
2 changes: 1 addition & 1 deletion src/amount/amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export type AmountProps = {
*/
@performance(true)
export class Amount extends React.Component<AmountProps> {
cn = createCn('amount');
protected cn = createCn('amount');

static defaultProps: Partial<AmountProps> = {
size: 'm',
Expand Down
4 changes: 2 additions & 2 deletions src/attach/attach.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export type AttachProps = {
* Компонент прикрепления файлов.
*/
export class Attach extends React.PureComponent<AttachProps> {
cn = createCn('attach');
protected cn = createCn('attach');

static defaultProps: Partial<AttachProps> = {
buttonContent: 'Выберите файл',
Expand All @@ -197,8 +197,8 @@ export class Attach extends React.PureComponent<AttachProps> {
value: []
};

// TODO [issues/1018] переписать тесты нужно, что бы private был
input: HTMLInputElement;

root: HTMLSpanElement;

// eslint-disable-next-line camelcase
Expand Down
4 changes: 2 additions & 2 deletions src/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export type ButtonProps = {
* Компонент кнопки (да, она нажимается!).
*/
export class Button extends React.PureComponent<ButtonProps> {
cn = createCn('button');
protected cn = createCn('button');

static defaultProps: Partial<ButtonProps> = {
type: 'button',
Expand All @@ -195,7 +195,7 @@ export class Button extends React.PureComponent<ButtonProps> {
pressed: false
};

control: HTMLButtonElement | HTMLSpanElement;
private control: HTMLButtonElement | HTMLSpanElement;

// eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps) {
Expand Down
22 changes: 7 additions & 15 deletions src/calendar-input/calendar-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export type CalendarInputProps = {
*/
@performance(true)
export class CalendarInput extends React.Component<CalendarInputProps> {
cn = createCn('calendar-input');
protected cn = createCn('calendar-input');

static defaultProps: Partial<CalendarInputProps> = {
withIcon: true,
Expand All @@ -245,35 +245,27 @@ export class CalendarInput extends React.Component<CalendarInputProps> {
)
};

/**
* @type {Number}
*/
timeoutId;
private timeoutId;

/**
* @type {Number}
*/
changeCloseTimeoutId;
private changeCloseTimeoutId;

/**
* @type {Calendar}
*/
calendar;
private calendar;

/**
* @type {Popup}
*/
calendarPopup;
private calendarPopup;

/**
* @type {Input}
*/
// TODO [issues/1018] переписать тесты нужно, что бы private был
customCalendarTarget;

/**
* @type {HTMLInputElement}
*/
nativeCalendarTarget;
private nativeCalendarTarget;

componentDidMount() {
if (this.calendarPopup) {
Expand Down
18 changes: 9 additions & 9 deletions src/calendar/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ type CalendarState = {
*/
@performance(true)
export class Calendar extends React.Component<CalendarProps, CalendarState> {
cn = createCn('calendar');
protected cn = createCn('calendar');

static defaultProps: Partial<CalendarProps> = {
selectedFrom: null,
Expand All @@ -191,21 +191,21 @@ export class Calendar extends React.Component<CalendarProps, CalendarState> {
month: startOfMonth(new Date())
};

root: HTMLDivElement;
private root: HTMLDivElement;

blurTimeoutId: number = null;
private blurTimeoutId: number = null;

years = [];
private years = [];

earlierLimit: Date;
private earlierLimit: Date;

laterLimit: Date;
private laterLimit: Date;

value: Date;
private value: Date;

selectedTo: Date;
private selectedTo: Date;

selectedFrom: Date;
private selectedFrom: Date;

// eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
Expand Down
3 changes: 2 additions & 1 deletion src/card-input/card-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type CardInputProps = InputProps & {
* Поле ввода номера карты с маской.
*/
export class CardInput extends React.PureComponent<CardInputProps> {
cn = createCn('card-input');
protected cn = createCn('card-input');

static defaultProps: Partial<CardInputProps> = {
placeholder: '0000 0000 0000 0000 00'
Expand All @@ -26,6 +26,7 @@ export class CardInput extends React.PureComponent<CardInputProps> {
/**
* @type {Input}
*/
// TODO [issues/1018] переписать тесты нужно, что бы private был
root;

render() {
Expand Down
3 changes: 2 additions & 1 deletion src/checkbox-group/checkbox-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export type CheckBoxGroupProps = ({
* Компонент группы чекбоксов.
*/
export class CheckBoxGroup extends React.PureComponent<CheckBoxGroupProps> {
cn = createCn('checkbox-group');
protected cn = createCn('checkbox-group');

static defaultProps: Partial<CheckBoxGroupProps> = {
type: 'normal'
Expand All @@ -102,6 +102,7 @@ export class CheckBoxGroup extends React.PureComponent<CheckBoxGroupProps> {
value: []
};

// TODO [issues/1018] переписать тесты нужно, что бы private был
checkboxes: any[];

render() {
Expand Down
4 changes: 2 additions & 2 deletions src/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export type CheckboxProps = ({
* Компонент чекбокса.
*/
export class CheckBox extends React.PureComponent<CheckboxProps> {
cn = createCn('checkbox');
protected cn = createCn('checkbox');

static defaultProps: Partial<CheckboxProps> = {
type: 'normal',
Expand All @@ -139,7 +139,7 @@ export class CheckBox extends React.PureComponent<CheckboxProps> {
checked: false
};

root;
private root;

render() {
const checked = this.props.checked === undefined ? this.state.checked : this.props.checked;
Expand Down
3 changes: 2 additions & 1 deletion src/collapse/collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export type CollapseProps = {
* Компонент «подката» позволяет спрятать кусок текста за ссылку «Еще...».
*/
export class Collapse extends React.PureComponent<CollapseProps> {
cn = createCn('collapse');
protected cn = createCn('collapse');

static defaultProps: Partial<CollapseProps> = {
expandedLabel: 'Collapse',
Expand All @@ -73,6 +73,7 @@ export class Collapse extends React.PureComponent<CollapseProps> {
isExpanded: false
};

// TODO [issues/1018] переписать тесты нужно, что бы private был
content;
contentCase;

Expand Down
6 changes: 3 additions & 3 deletions src/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export type DropdownProps = {
* Компонент «выпадашка»: ссылка или кнопка. По клику показывается Popup.
*/
export class Dropdown extends React.PureComponent<DropdownProps> {
cn = createCn('dropdown');
protected cn = createCn('dropdown');

static defaultProps: Partial<DropdownProps> = {
switcherType: 'link',
Expand All @@ -137,8 +137,8 @@ export class Dropdown extends React.PureComponent<DropdownProps> {
popupHovered: false
};

popup;
switcher;
private popup;
private switcher;

componentDidMount() {
this.popup.setTarget(this.switcher.getNode());
Expand Down
5 changes: 3 additions & 2 deletions src/dropzone/dropzone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export type DropzoneProps = {
* Компонент drag-and-drop контейнер для прикрепления файлов.
*/
export class Dropzone extends React.PureComponent<DropzoneProps> {
cn = createCn('dropzone');
protected cn = createCn('dropzone');

static defaultProps: Partial<DropzoneProps> = {
theme: 'alfa-on-white',
Expand All @@ -82,9 +82,10 @@ export class Dropzone extends React.PureComponent<DropzoneProps> {
dragging: false
};

// TODO [issues/1018] на private ругается
root: HTMLSpanElement;

dragCounter: number;
private dragCounter: number;

private handleDragOver = (event) => {
event.preventDefault();
Expand Down
3 changes: 2 additions & 1 deletion src/email-input/email-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import Input, { InputProps } from '../input/input';
* @extends Input
*/
export class EmailInput extends React.PureComponent<InputProps> {
cn = createCn('email-input');
protected cn = createCn('email-input');

/**
* @type {Input}
*/
// TODO [issues/1018] переписать тесты нужно, что бы private был
root;

render() {
Expand Down
2 changes: 1 addition & 1 deletion src/flag-icon/flag-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export type FlagIconProps = {
* Компонент флага в виде иконки.
*/
export class FlagIcon extends React.PureComponent<FlagIconProps> {
cn = createCn('flag-icon');
protected cn = createCn('flag-icon');

static defaultProps: Partial<FlagIconProps> = {
isFlat: false,
Expand Down
2 changes: 1 addition & 1 deletion src/form-field/form-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export type FormFieldProps = {
* Необходим для вертикального ритма в форме.
*/
export class FormField extends React.PureComponent<FormFieldProps> {
cn = createCn('form-field');
protected cn = createCn('form-field');

static defaultProps: Partial<FormFieldProps> = {
size: 'm'
Expand Down
2 changes: 1 addition & 1 deletion src/form/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export type FormProps = {
* Компонент формы.
*/
export class Form extends React.PureComponent<FormProps> {
cn = createCn('form');
protected cn = createCn('form');

static defaultProps: Partial<FormProps> = {
action: '/',
Expand Down
2 changes: 1 addition & 1 deletion src/grid-col/grid-col.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export type GridColProps = {
* Колонки должны быть помещены в строки (компонент `GridRow`).
*/
export class GridCol extends React.PureComponent<GridColProps> {
cn = createCn('grid-col');
protected cn = createCn('grid-col');

static defaultProps: Partial<GridColProps> = {
tag: 'div'
Expand Down
4 changes: 2 additions & 2 deletions src/grid-row/grid-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export type GridRowProps = {
* Сетка имеет резиновую систему разметки, которая масштабируется до 12 столбцов.
*/
export class GridRow extends React.PureComponent<GridRowProps> {
cn = createCn('grid-row');
protected cn = createCn('grid-row');

static defaultProps: Partial<GridRowProps> = {
tag: 'div',
Expand All @@ -86,7 +86,7 @@ export class GridRow extends React.PureComponent<GridRowProps> {
/**
* Класс колонки
*/
classCol = 'grid-col'
private classCol = 'grid-col'

render() {
const {
Expand Down
2 changes: 1 addition & 1 deletion src/heading/heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export type HeadingProps = {
* Компонент заголовка.
*/
export class Heading extends React.PureComponent<HeadingProps> {
cn = createCn('heading');
protected cn = createCn('heading');

static defaultProps: Partial<HeadingProps> = {
size: 'xl',
Expand Down
2 changes: 1 addition & 1 deletion src/icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export type IconProps = {
* Базовый компонент иконки. Содержит в себе только необходимые для компонентов иконки.
*/
export class Icon extends React.PureComponent<IconProps> {
cn = createCn('icon');
protected cn = createCn('icon');

static defaultProps: Partial<IconProps> = {
size: 'm'
Expand Down
2 changes: 1 addition & 1 deletion src/input-autocomplete/input-autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ type InputAutocompleteState = {
*/
@performance(true)
export class InputAutocomplete extends React.Component<InputAutocompleteProps, InputAutocompleteState> {
cn = createCn('input');
protected cn = createCn('input');

static defaultProps: Partial<InputAutocompleteProps> = {
disabled: false,
Expand Down
2 changes: 1 addition & 1 deletion src/input-group/input-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export type InputGroupProps = {
* Компонент группы полей для текстового ввода.
*/
export class InputGroup extends React.PureComponent<InputGroupProps> {
cn = createCn('input-group');
protected cn = createCn('input-group');

render() {
let children = null;
Expand Down
9 changes: 4 additions & 5 deletions src/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export type InputProps = {
* Компонент текстового поля ввода.
*/
export class Input extends React.PureComponent<InputProps> {
cn = createCn('input');
protected cn = createCn('input');

static defaultProps: Partial<InputProps> = {
formNoValidate: false,
Expand All @@ -270,17 +270,16 @@ export class Input extends React.PureComponent<InputProps> {
/**
* @type {HTMLSpanElement}
*/
root;

private root;
/**
* @type {HTMLSpanElement}
*/
box;
private box;

/**
* @type {HTMLInputElement}
*/
control;
private control;

// eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps) {
Expand Down
Loading

0 comments on commit 3ee881a

Please sign in to comment.