mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
refactor: ♻️ Refactor del codice per adattarlo alla nuova configurazione di ESLint
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class Actions extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class Card extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class Content extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class Media extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import '@material/mwc-ripple';
|
||||
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class PrimaryAction extends Component {
|
||||
view(vnode) {
|
||||
|
@ -10,7 +10,8 @@ interface Attributes extends Collection {
|
||||
addStyles(...styles: string[]): void
|
||||
}
|
||||
|
||||
// noinspection SpellCheckingInspection
|
||||
// eslint-disable-next-line no-secrets/no-secrets
|
||||
// noinspection SpellCheckingInspection,JSUnusedGlobalSymbols
|
||||
/**
|
||||
* @abstract
|
||||
*
|
||||
@ -119,7 +120,7 @@ export default class Component implements ClassComponent {
|
||||
*/
|
||||
$(selector?: string): JQuery {
|
||||
const $element: JQuery<HTMLElement> = $(this.element);
|
||||
return selector ? $element.find((element) => selector(element)) : $element;
|
||||
return selector ? $element.find(element => selector(element)) : $element;
|
||||
}
|
||||
|
||||
|
||||
@ -129,7 +130,7 @@ export default class Component implements ClassComponent {
|
||||
*
|
||||
* @see https://js.org/hyperscript.html#mselector,-attributes,-children
|
||||
*/
|
||||
static component(attributes = {}, children): Vnode {
|
||||
static component(attributes: {...} = {}, children): Vnode {
|
||||
const componentAttributes: Record<string, any> = { ...attributes};
|
||||
|
||||
return m(this, componentAttributes, children);
|
||||
@ -141,7 +142,7 @@ export default class Component implements ClassComponent {
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
setAttrs(attributes: Object = {}): void {
|
||||
setAttrs(attributes: {...} = {}): void {
|
||||
this.initAttrs(attributes);
|
||||
if (attributes) {
|
||||
if ('children' in attributes) {
|
||||
@ -176,5 +177,5 @@ export default class Component implements ClassComponent {
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
initAttrs(attributes: Object): void {}
|
||||
initAttrs(attributes: {...}): void {}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ import '@material/mwc-linear-progress';
|
||||
import '@material/mwc-list/mwc-list-item';
|
||||
import '@material/mwc-select';
|
||||
|
||||
import Component from '../Component';
|
||||
import Mdi from '../Mdi';
|
||||
import Component from '../Component.jsx';
|
||||
import Mdi from '../Mdi.jsx';
|
||||
|
||||
export default class DataTable extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class TableBody extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
/**
|
||||
* Attributes:
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class TableFooter extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class TableHead extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
/**
|
||||
* Attributes:
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class TableHeadRow extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class TableRow extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class LayoutGrid extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from '../Component';
|
||||
import Component from '../Component.jsx';
|
||||
|
||||
export default class Row extends Component {
|
||||
view(vnode) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Component from './Component';
|
||||
import Component from './Component.jsx';
|
||||
|
||||
export default class Mdi extends Component {
|
||||
view(vnode) {
|
||||
@ -7,8 +7,8 @@ export default class Mdi extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Quando MWC supporterà pienamente le icone SVG potremo fare così:
|
||||
/**
|
||||
Quando MWC supporterà pienamente le icone SVG si potrà fare così:
|
||||
import * as mdi from '@mdi/js';
|
||||
import {camelCase} from 'lodash/string';
|
||||
|
||||
@ -16,4 +16,6 @@ export default class Mdi extends Component {
|
||||
{...vnode.attrs} viewBox={vnode.attrs.viewBox ?? '0 0 24 24'}>
|
||||
<path d={vnode.attrs.icon ? mdi[camelCase(`mdi-${vnode.attrs.icon}`)] : ''} />
|
||||
</svg>;
|
||||
|
||||
@see https://github.com/material-components/material-web/issues/1812
|
||||
*/
|
||||
|
@ -2,7 +2,7 @@ import {Vnode} from 'mithril';
|
||||
import {sync as render} from 'mithril-node-render';
|
||||
|
||||
import {containsHTML} from '../utils';
|
||||
import Component from './Component';
|
||||
import Component from './Component.jsx';
|
||||
|
||||
/**
|
||||
* The `Page` component
|
||||
@ -13,8 +13,8 @@ export default class Page extends Component {
|
||||
page: {
|
||||
component: string,
|
||||
locale: string,
|
||||
props: Object,
|
||||
translations: Object,
|
||||
props: {...},
|
||||
translations: {...},
|
||||
url: string,
|
||||
version: string,
|
||||
...
|
||||
@ -36,7 +36,7 @@ export default class Page extends Component {
|
||||
*/
|
||||
__(
|
||||
key: string | Vnode,
|
||||
replace: Object | boolean = {},
|
||||
replace: {...} | boolean = {},
|
||||
returnAsString: boolean = false
|
||||
): Vnode {
|
||||
let translation = (this.page.translations && this.page.translations[key])
|
||||
|
@ -4,15 +4,15 @@ import '@material/mwc-fab';
|
||||
import collect from 'collect.js';
|
||||
import {Children} from 'mithril';
|
||||
|
||||
import DataTable from '../DataTable/DataTable';
|
||||
import TableBody from '../DataTable/TableBody';
|
||||
import TableCell from '../DataTable/TableCell';
|
||||
import TableHead from '../DataTable/TableHead';
|
||||
import TableHeadCell from '../DataTable/TableHeadCell';
|
||||
import TableHeadRow from '../DataTable/TableHeadRow';
|
||||
import TableRow from '../DataTable/TableRow';
|
||||
import Mdi from '../Mdi';
|
||||
import Page from '../Page';
|
||||
import DataTable from '../DataTable/DataTable.jsx';
|
||||
import TableBody from '../DataTable/TableBody.jsx';
|
||||
import TableCell from '../DataTable/TableCell.jsx';
|
||||
import TableHead from '../DataTable/TableHead.jsx';
|
||||
import TableHeadCell from '../DataTable/TableHeadCell.jsx';
|
||||
import TableHeadRow from '../DataTable/TableHeadRow.jsx';
|
||||
import TableRow from '../DataTable/TableRow.jsx';
|
||||
import Mdi from '../Mdi.jsx';
|
||||
import Page from '../Page.jsx';
|
||||
|
||||
export type ColumnT = {
|
||||
id?: string,
|
||||
@ -24,11 +24,11 @@ export type ColumnT = {
|
||||
* @abstract
|
||||
*/
|
||||
export default class RecordsPage extends Page {
|
||||
columns: Object<string | ColumnT> | Array<ColumnT>;
|
||||
columns: string[] | {[string]: ColumnT} | ColumnT[];
|
||||
|
||||
rows: Array<Array<string>> = [];
|
||||
rows: string[][] = [];
|
||||
|
||||
dialogs: Array<Children>;
|
||||
dialogs: Children[];
|
||||
|
||||
tableColumns(): Children {
|
||||
return collect(this.columns)
|
||||
|
2
resources/js/Components/Pages/index.js
vendored
2
resources/js/Components/Pages/index.js
vendored
@ -1 +1 @@
|
||||
export {default as RecordsPage} from './RecordsPage';
|
||||
export {default as RecordsPage} from './RecordsPage.jsx';
|
||||
|
2
resources/js/Components/index.js
vendored
2
resources/js/Components/index.js
vendored
@ -1,3 +1,5 @@
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
|
||||
export * from './Card';
|
||||
export { default as Component } from './Component.jsx';
|
||||
export * from './DataTable';
|
||||
|
@ -13,13 +13,13 @@ import Mithril from 'mithril';
|
||||
|
||||
import logoUrl from '@/static/images/logo_completo.png';
|
||||
|
||||
import Card from '../Components/Card/Card';
|
||||
import Content from '../Components/Card/Content';
|
||||
import Cell from '../Components/Grid/Cell';
|
||||
import LayoutGrid from '../Components/Grid/LayoutGrid';
|
||||
import Row from '../Components/Grid/Row';
|
||||
import Mdi from '../Components/Mdi';
|
||||
import Page from '../Components/Page';
|
||||
import Card from '../Components/Card/Card.jsx';
|
||||
import Content from '../Components/Card/Content.jsx';
|
||||
import Cell from '../Components/Grid/Cell.jsx';
|
||||
import LayoutGrid from '../Components/Grid/LayoutGrid.jsx';
|
||||
import Row from '../Components/Grid/Row.jsx';
|
||||
import Mdi from '../Components/Mdi.jsx';
|
||||
import Page from '../Components/Page.jsx';
|
||||
|
||||
export default class SetupPage extends Page {
|
||||
languages() {
|
||||
|
2
resources/js/Views/index.js
vendored
2
resources/js/Views/index.js
vendored
@ -1,2 +1,4 @@
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
|
||||
export { default as SetupPage } from './SetupPage.jsx';
|
||||
|
||||
|
2
resources/js/WebComponents/index.js
vendored
2
resources/js/WebComponents/index.js
vendored
@ -1,3 +1,5 @@
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
|
||||
export { default as Drawer } from './MaterialDrawer';
|
||||
export { default as TopAppBar } from './TopAppBar';
|
||||
|
||||
|
2
resources/js/utils.js
vendored
2
resources/js/utils.js
vendored
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Check if class/object A is the same as or a subclass of class B.
|
||||
*/
|
||||
export function subclassOf(A: Object, B: Object): boolean {
|
||||
export function subclassOf(A: {...}, B: {...}): boolean {
|
||||
// noinspection JSUnresolvedVariable
|
||||
return A && (A === B || A.prototype instanceof B);
|
||||
}
|
||||
|
Reference in New Issue
Block a user