Skip to content

Commit

Permalink
Merge branch 'master' into context_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
pavish committed Mar 23, 2022
2 parents 8e89315 + 0269ad4 commit 249090e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
10 changes: 10 additions & 0 deletions mathesar_ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
rules: {
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'no-console': ['warn', { allow: ['error'] }],
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
Expand Down Expand Up @@ -106,6 +107,15 @@ module.exports = {
'@typescript-eslint/require-await': 'off',
},
},
{
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/explicit-member-accessibility': [
'error',
{ accessibility: 'no-public' },
],
},
},
],
env: {
es6: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export type ValidationResultStore = Writable<boolean>;
const VALIDATION_CONTEXT_KEY = 'validationContext';

class ContextBasedValidator {
public validationResult: Writable<boolean> = writable(true);
validationResult: Writable<boolean> = writable(true);

public validationFunctionMap: Map<string, ValidationFunction> = new Map();
validationFunctionMap: Map<string, ValidationFunction> = new Map();

public validate(): boolean {
validate(): boolean {
let isValid = true;
// eslint-disable-next-line no-restricted-syntax
for (const validationFn of this.validationFunctionMap.values()) {
Expand All @@ -22,7 +22,7 @@ class ContextBasedValidator {
return isValid;
}

public addValidator(key: string, fn: ValidationFunction) {
addValidator(key: string, fn: ValidationFunction) {
this.validationFunctionMap.set(key, fn);

onDestroy(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import { tick, createEventDispatcher } from 'svelte';
import {
faAngleDoubleLeft,
faAngleDoubleRight,
Expand Down Expand Up @@ -46,14 +46,17 @@
$: pageCount = Math.ceil(total / pageSize);
$: pageInfo = calculatePages(currentPage, pageCount);
function setPage(e: Event, _page: number) {
async function setPage(e: Event, _page: number) {
if (_page > 0 && _page <= pageCount && currentPage !== _page) {
currentPage = _page;
dispatch('change', {
currentPage,
originalEvent: e,
});
}
await tick();
const pagebutton = document.querySelector(`[data-page="${currentPage}"]`);
(pagebutton as HTMLElement)?.focus();
}
</script>

Expand Down Expand Up @@ -125,6 +128,7 @@
: `Goto Page ${_page}`}
aria-selected={currentPage === _page}
on:click={(e) => setPage(e, _page)}
data-page={_page}
data-tinro-ignore
>
{_page}
Expand All @@ -138,6 +142,7 @@
: `Goto Page ${_page}`}
class="page"
on:click={(e) => setPage(e, _page)}
data-page={_page}
aria-selected={currentPage === _page}
>
{_page}
Expand Down

0 comments on commit 249090e

Please sign in to comment.