mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
feat: ✨ Aggiunti tipi agli attributi dei componenti
This commit is contained in:
1
.idea/codeStyles/Project.xml
generated
1
.idea/codeStyles/Project.xml
generated
@ -6,6 +6,7 @@
|
|||||||
<option name="USE_DOUBLE_QUOTES" value="false" />
|
<option name="USE_DOUBLE_QUOTES" value="false" />
|
||||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||||
|
<option name="JSX_ATTRIBUTE_VALUE" value="Based on type" />
|
||||||
<option name="USE_EXPLICIT_JS_EXTENSION" value="TRUE" />
|
<option name="USE_EXPLICIT_JS_EXTENSION" value="TRUE" />
|
||||||
<option name="VAR_DECLARATION_WRAP" value="2" />
|
<option name="VAR_DECLARATION_WRAP" value="2" />
|
||||||
<option name="IMPORTS_WRAP" value="2" />
|
<option name="IMPORTS_WRAP" value="2" />
|
||||||
|
2
.idea/jsLibraryMappings.xml
generated
2
.idea/jsLibraryMappings.xml
generated
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="JavaScriptLibraryMappings">
|
<component name="JavaScriptLibraryMappings">
|
||||||
<file url="PROJECT" libraries="{@types/mithril, es-module-shims}" />
|
<file url="PROJECT" libraries="{@types/mithril, @types/prop-types, es-module-shims}" />
|
||||||
<includedPredefinedLibrary name="Node.js Core" />
|
<includedPredefinedLibrary name="Node.js Core" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
1
.idea/osm_rewrite.iml
generated
1
.idea/osm_rewrite.iml
generated
@ -96,5 +96,6 @@
|
|||||||
<orderEntry type="library" name="@types/mithril" level="application" />
|
<orderEntry type="library" name="@types/mithril" level="application" />
|
||||||
<orderEntry type="library" name="es-module-shims" level="application" />
|
<orderEntry type="library" name="es-module-shims" level="application" />
|
||||||
<orderEntry type="library" name="es-module-shims" level="application" />
|
<orderEntry type="library" name="es-module-shims" level="application" />
|
||||||
|
<orderEntry type="library" name="@types/prop-types" level="application" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -58,6 +58,7 @@
|
|||||||
"mithril": "^2.0.4",
|
"mithril": "^2.0.4",
|
||||||
"mithril-node-render": "^3.0.2",
|
"mithril-node-render": "^3.0.2",
|
||||||
"modern-normalize": "^1.1.0",
|
"modern-normalize": "^1.1.0",
|
||||||
|
"prop-types": "^15.7.2",
|
||||||
"redaxios": "^0.4.1"
|
"redaxios": "^0.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
7
pnpm-lock.yaml
generated
7
pnpm-lock.yaml
generated
@ -84,6 +84,7 @@ specifiers:
|
|||||||
modern-normalize: ^1.1.0
|
modern-normalize: ^1.1.0
|
||||||
postcss: ^8.4.4
|
postcss: ^8.4.4
|
||||||
postcss-html: ^1.3.0
|
postcss-html: ^1.3.0
|
||||||
|
prop-types: ^15.7.2
|
||||||
redaxios: ^0.4.1
|
redaxios: ^0.4.1
|
||||||
sass: ^1.44.0
|
sass: ^1.44.0
|
||||||
stylelint: ^14.1.0
|
stylelint: ^14.1.0
|
||||||
@ -140,6 +141,7 @@ dependencies:
|
|||||||
mithril: 2.0.4
|
mithril: 2.0.4
|
||||||
mithril-node-render: 3.0.2_mithril@2.0.4
|
mithril-node-render: 3.0.2_mithril@2.0.4
|
||||||
modern-normalize: 1.1.0
|
modern-normalize: 1.1.0
|
||||||
|
prop-types: 15.7.2
|
||||||
redaxios: 0.4.1
|
redaxios: 0.4.1
|
||||||
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
@ -4955,7 +4957,6 @@ packages:
|
|||||||
|
|
||||||
/js-tokens/4.0.0:
|
/js-tokens/4.0.0:
|
||||||
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
||||||
dev: true
|
|
||||||
|
|
||||||
/js-yaml/3.14.1:
|
/js-yaml/3.14.1:
|
||||||
resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==}
|
resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==}
|
||||||
@ -5183,7 +5184,6 @@ packages:
|
|||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
js-tokens: 4.0.0
|
js-tokens: 4.0.0
|
||||||
dev: true
|
|
||||||
|
|
||||||
/lottie-web/5.8.1:
|
/lottie-web/5.8.1:
|
||||||
resolution: {integrity: sha512-9gIizWADlaHC2GCt+D+yNpk5l2clZQFqnVWWIVdY0LnxC/uLa39dYltAe3fcmC/hrZ2IUQ8dLlY0O934Npjs7Q==}
|
resolution: {integrity: sha512-9gIizWADlaHC2GCt+D+yNpk5l2clZQFqnVWWIVdY0LnxC/uLa39dYltAe3fcmC/hrZ2IUQ8dLlY0O934Npjs7Q==}
|
||||||
@ -5378,7 +5378,6 @@ packages:
|
|||||||
/object-assign/4.1.1:
|
/object-assign/4.1.1:
|
||||||
resolution: {integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=}
|
resolution: {integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
dev: true
|
|
||||||
|
|
||||||
/object-inspect/1.11.0:
|
/object-inspect/1.11.0:
|
||||||
resolution: {integrity: sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==}
|
resolution: {integrity: sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==}
|
||||||
@ -5725,7 +5724,6 @@ packages:
|
|||||||
loose-envify: 1.4.0
|
loose-envify: 1.4.0
|
||||||
object-assign: 4.1.1
|
object-assign: 4.1.1
|
||||||
react-is: 16.13.1
|
react-is: 16.13.1
|
||||||
dev: true
|
|
||||||
|
|
||||||
/punycode/2.1.1:
|
/punycode/2.1.1:
|
||||||
resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==}
|
resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==}
|
||||||
@ -5750,7 +5748,6 @@ packages:
|
|||||||
|
|
||||||
/react-is/16.13.1:
|
/react-is/16.13.1:
|
||||||
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
|
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
|
||||||
dev: true
|
|
||||||
|
|
||||||
/read-pkg-up/7.0.1:
|
/read-pkg-up/7.0.1:
|
||||||
resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==}
|
resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==}
|
||||||
|
@ -7,6 +7,7 @@ import {
|
|||||||
type Children,
|
type Children,
|
||||||
type Vnode
|
type Vnode
|
||||||
} from 'mithril';
|
} from 'mithril';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import Component from '../Component.jsx';
|
import Component from '../Component.jsx';
|
||||||
import Mdi from '../Mdi.jsx';
|
import Mdi from '../Mdi.jsx';
|
||||||
@ -15,6 +16,14 @@ import TableFooter from './TableFooter.jsx';
|
|||||||
import TableRow from './TableRow.jsx';
|
import TableRow from './TableRow.jsx';
|
||||||
|
|
||||||
export default class DataTable extends Component {
|
export default class DataTable extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
'rows-per-page': PropTypes.number,
|
||||||
|
'default-rows-per-page': PropTypes.number,
|
||||||
|
'aria-label': PropTypes.string,
|
||||||
|
checkable: PropTypes.bool,
|
||||||
|
paginated: PropTypes.bool
|
||||||
|
};
|
||||||
|
|
||||||
rows: Cash[] = [];
|
rows: Cash[] = [];
|
||||||
columns: Children[];
|
columns: Children[];
|
||||||
footer: Children[];
|
footer: Children[];
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import {type Cash} from 'cash-dom/dist/cash';
|
import {type Cash} from 'cash-dom/dist/cash';
|
||||||
import {inRange} from 'lodash-es';
|
import {inRange} from 'lodash-es';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import Component from '../Component.jsx';
|
import Component from '../Component.jsx';
|
||||||
|
|
||||||
/**
|
|
||||||
* Attributes:
|
|
||||||
* - type: numeric, checkbox
|
|
||||||
*/
|
|
||||||
export default class TableCell extends Component {
|
export default class TableCell extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
type: PropTypes.string
|
||||||
|
};
|
||||||
|
|
||||||
view(vnode) {
|
view(vnode) {
|
||||||
this.attrs.addClassNames('mdc-data-table__cell', {
|
this.attrs.addClassNames('mdc-data-table__cell', {
|
||||||
[`mdc-data-table__cell--${this.attrs.get('type')}`]: this.attrs.has('type')
|
[`mdc-data-table__cell--${this.attrs.get('type')}`]: this.attrs.has('type')
|
||||||
@ -28,7 +29,7 @@ export default class TableCell extends Component {
|
|||||||
.find('tbody tr[checkable] mwc-checkbox');
|
.find('tbody tr[checkable] mwc-checkbox');
|
||||||
|
|
||||||
const cell: Cash = $(this.element);
|
const cell: Cash = $(this.element);
|
||||||
cell.children('mwc-checkbox').on('change', (event) => {
|
cell.children('mwc-checkbox').on('change', () => {
|
||||||
const row = cell.parent();
|
const row = cell.parent();
|
||||||
row.toggleClass('mdc-data-table__row--selected');
|
row.toggleClass('mdc-data-table__row--selected');
|
||||||
|
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
import '@material/mwc-icon-button-toggle';
|
import '@material/mwc-icon-button-toggle';
|
||||||
|
|
||||||
import {type Cash} from 'cash-dom/dist/cash';
|
import {type Cash} from 'cash-dom';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import Component from '../Component.jsx';
|
import Component from '../Component.jsx';
|
||||||
import Mdi from '../Mdi.jsx';
|
import Mdi from '../Mdi.jsx';
|
||||||
|
|
||||||
/**
|
|
||||||
* Attributes:
|
|
||||||
* - type?: numeric, checkbox
|
|
||||||
*/
|
|
||||||
export default class TableColumn extends Component {
|
export default class TableColumn extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
type: PropTypes.oneOf(['numeric', 'checkbox']),
|
||||||
|
id: PropTypes.string,
|
||||||
|
sortable: PropTypes.bool,
|
||||||
|
filterable: PropTypes.bool
|
||||||
|
};
|
||||||
|
|
||||||
view(vnode) {
|
view(vnode) {
|
||||||
this.attrs.addClassNames('mdc-data-table__header-cell', {
|
this.attrs.addClassNames('mdc-data-table__header-cell', {
|
||||||
[`mdc-data-table__header-cell--${this.attrs.get('type')}`]: this.attrs.has('type')
|
[`mdc-data-table__header-cell--${this.attrs.get('type')}`]: this.attrs.has('type')
|
||||||
@ -111,10 +115,11 @@ export default class TableColumn extends Component {
|
|||||||
const index = $(this.element).index();
|
const index = $(this.element).index();
|
||||||
const rows: Cash = $(this.element).closest('table').find('tbody tr');
|
const rows: Cash = $(this.element).closest('table').find('tbody tr');
|
||||||
rows.hide();
|
rows.hide();
|
||||||
rows.filter((index_, element) => $(element)
|
rows.filter((index_, element) => (
|
||||||
.find(`td:nth-child(${index + 1})`)
|
$(element)
|
||||||
.text()
|
.find(`td:nth-child(${index + 1})`)
|
||||||
.search(event.target.value) !== -1
|
.text()
|
||||||
).show();
|
.search(event.target.value) !== -1
|
||||||
|
)).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,16 @@ import {
|
|||||||
type Children,
|
type Children,
|
||||||
type Vnode
|
type Vnode
|
||||||
} from 'mithril';
|
} from 'mithril';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import Component from '../Component.jsx';
|
import Component from '../Component.jsx';
|
||||||
import TableCell from './TableCell.jsx';
|
import TableCell from './TableCell.jsx';
|
||||||
|
|
||||||
export default class TableRow extends Component {
|
export default class TableRow extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
checkable: PropTypes.bool
|
||||||
|
};
|
||||||
|
|
||||||
view(vnode) {
|
view(vnode) {
|
||||||
this.attrs.addClassNames('mdc-data-table__row');
|
this.attrs.addClassNames('mdc-data-table__row');
|
||||||
|
|
||||||
|
@ -3,11 +3,18 @@ import '@material/mwc-circular-progress';
|
|||||||
import {type Button} from '@material/mwc-button';
|
import {type Button} from '@material/mwc-button';
|
||||||
import type CSS from 'csstype';
|
import type CSS from 'csstype';
|
||||||
import {type ClassComponent} from 'mithril';
|
import {type ClassComponent} from 'mithril';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import Component from './Component.jsx';
|
import Component from './Component.jsx';
|
||||||
import Mdi from './Mdi.jsx';
|
import Mdi from './Mdi.jsx';
|
||||||
|
|
||||||
export default class LoadingButton extends Component implements ClassComponent<Button> {
|
class LoadingButton extends Component implements ClassComponent<{ ...Button, icon?: string }> {
|
||||||
|
static propTypes = {
|
||||||
|
icon: PropTypes.string,
|
||||||
|
raised: PropTypes.bool,
|
||||||
|
outlined: PropTypes.bool
|
||||||
|
};
|
||||||
|
|
||||||
view(vnode) {
|
view(vnode) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -47,3 +54,5 @@ export default class LoadingButton extends Component implements ClassComponent<B
|
|||||||
.attr('density', -7);
|
.attr('density', -7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default LoadingButton;
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
import {type ClassComponent} from 'mithril';
|
import {type ClassComponent} from 'mithril';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import Component from './Component.jsx';
|
import Component from './Component.jsx';
|
||||||
|
|
||||||
export default class Mdi extends Component implements ClassComponent<{icon?: string}> {
|
export default class Mdi extends Component implements ClassComponent<{icon?: string}> {
|
||||||
|
static propTypes = {
|
||||||
|
icon: PropTypes.string
|
||||||
|
};
|
||||||
|
|
||||||
view(vnode) {
|
view(vnode) {
|
||||||
this.attrs.addClassNames('mdi', `mdi-${this.attrs.pull('icon')}`);
|
this.attrs.addClassNames('mdi', `mdi-${this.attrs.pull('icon')}`);
|
||||||
return <i {...this.attrs.all()} />;
|
return <i {...this.attrs.all()} />;
|
||||||
|
Reference in New Issue
Block a user