Skip to content

Commit

Permalink
pick 120
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-WorkGH committed Aug 6, 2024
1 parent e51a054 commit 6e3ab89
Show file tree
Hide file tree
Showing 148 changed files with 1,128 additions and 3,612 deletions.
52 changes: 26 additions & 26 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"root": true,
"extends": [
"airbnb",
"airbnb-typescript",
"airbnb/hooks",
"plugin:prettier/recommended",
"plugin:react/jsx-runtime"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"ignorePatterns": [
// node_modules is implicitly always ignored
"dist",
"vite.config.mts",
"jest.config.ts",
"jest.setup.ts"
],
"rules": {
"prettier/prettier": "warn",
"curly": "error",
"no-console": "off",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off",
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }]
}
"root": true,
"extends": [
"airbnb",
"airbnb-typescript",
"airbnb/hooks",
"plugin:prettier/recommended",
"plugin:react/jsx-runtime"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"ignorePatterns": [
// node_modules is implicitly always ignored
"dist",
"vite.config.mts",
"jest.config.ts",
"jest.setup.ts"
],
"rules": {
"prettier/prettier": "warn",
"curly": "error",
"no-console": "off",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off",
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }]
}
}
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"printWidth": 120,
"singleQuote": true
}
4 changes: 1 addition & 3 deletions babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
"@babel/preset-typescript",
"babel-preset-vite"
],
"plugins": [
"@babel/plugin-transform-runtime"
]
"plugins": ["@babel/plugin-transform-runtime"]
}
8 changes: 2 additions & 6 deletions demo/data/EquipmentSearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,8 @@ const searchEquipments = (searchTerm, equipmentLabelling) => {
if (searchTerm) {
return getEquipmentsInfosForSearchBar(
equipmentLabelling
? EQUIPMENTS.filter((equipment) =>
(equipment.name || equipment.id).includes(searchTerm)
)
: EQUIPMENTS.filter((equipment) =>
equipment.id.includes(searchTerm)
),
? EQUIPMENTS.filter((equipment) => (equipment.name || equipment.id).includes(searchTerm))
: EQUIPMENTS.filter((equipment) => equipment.id.includes(searchTerm)),
equipmentLabelling ? (e) => e.name || e.id : (e) => e.id
);
}
Expand Down
9 changes: 3 additions & 6 deletions demo/data/ReportViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ const LOGS_JSON = {
},
{
taskKey: 'postLoading',
defaultName:
'Post loading process on network CC${numNetworkCc} SC${numNetworkSc}',
defaultName: 'Post loading process on network CC${numNetworkCc} SC${numNetworkSc}',
taskValues: {
numNetworkCc: {
value: 0,
Expand Down Expand Up @@ -154,8 +153,7 @@ const LOGS_JSON = {
},
{
reportKey: 'NoMismatchDistribution',
defaultMessage:
'Iteration ${iteration}: already balanced',
defaultMessage: 'Iteration ${iteration}: already balanced',
values: {
reportSeverity: {
value: 'FATAL',
Expand Down Expand Up @@ -194,8 +192,7 @@ const LOGS_JSON = {
reports: [
{
reportKey: 'NoMismatchDistribution',
defaultMessage:
'Iteration ${iteration}: already balanced',
defaultMessage: 'Iteration ${iteration}: already balanced',
values: {
reportSeverity: {
value: 'WARN',
Expand Down
4 changes: 1 addition & 3 deletions demo/src/FlatParametersTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ function FlatParametersTab() {
onChange={onChange}
variant="standard"
showSeparator
selectionWithDialog={(param) =>
param?.possibleValues?.length > 10
}
selectionWithDialog={(param) => param?.possibleValues?.length > 10}
/>
</RightResizableBox>
</div>
Expand Down
42 changes: 7 additions & 35 deletions demo/src/InputsTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ const options = [
{ id: 'ibra', label: 'inputs/ibra' },
];

const basicOptions = [
'Kylian Mbappe',
'Neymar',
'Lionel Messi',
'Zlatan Ibrahimovic',
];
const basicOptions = ['Kylian Mbappe', 'Neymar', 'Lionel Messi', 'Zlatan Ibrahimovic'];

const gridSize = 4;

Expand Down Expand Up @@ -141,20 +136,10 @@ function InputsTab() {
/>
</Grid>
<Grid item xs={gridSize}>
<SliderInput
name={SLIDER_INPUT}
label="inputs/slider"
min={0.0}
max={100.0}
step={0.1}
/>
<SliderInput name={SLIDER_INPUT} label="inputs/slider" min={0.0} max={100.0} step={0.1} />
</Grid>
<Grid item xs={gridSize}>
<SelectInput
name={SELECT_INPUT}
label="inputs/select"
options={options}
/>
<SelectInput name={SELECT_INPUT} label="inputs/select" options={options} />
</Grid>
<Grid item xs={gridSize}>
<SelectClearable
Expand All @@ -165,32 +150,19 @@ function InputsTab() {
/>
</Grid>
<Grid item xs={gridSize}>
<RadioInput
name={RADIO_INPUT}
label="inputs/radio"
options={options}
/>
<RadioInput name={RADIO_INPUT} label="inputs/radio" options={options} />
</Grid>
<Grid item xs={gridSize}>
<IntegerInput
name={INTEGER_INPUT}
label="inputs/integer"
/>
<IntegerInput name={INTEGER_INPUT} label="inputs/integer" />
</Grid>
<Grid item xs={gridSize}>
<FloatInput name={FLOAT_INPUT} label="inputs/float" />
</Grid>
<Grid item xs={gridSize}>
<CheckboxInput
name={CHECKBOX_INPUT}
label="inputs/checkbox"
/>
<CheckboxInput name={CHECKBOX_INPUT} label="inputs/checkbox" />
</Grid>
<Grid item xs={gridSize}>
<SwitchInput
name={SWITCH_INPUT}
label="inputs/switch"
/>
<SwitchInput name={SWITCH_INPUT} label="inputs/switch" />
</Grid>
</Grid>
<Box
Expand Down
63 changes: 12 additions & 51 deletions demo/src/TableTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@

import { useCallback, useMemo, useState } from 'react';
import { styled } from '@mui/system';
import {
Box,
Button,
FormControlLabel,
Stack,
Switch,
TextField,
} from '@mui/material';
import { Box, Button, FormControlLabel, Stack, Switch, TextField } from '@mui/material';
import { DEFAULT_CELL_PADDING } from '../../src';
import {
ChangeWays,
Expand Down Expand Up @@ -52,8 +45,7 @@ const stylesVirtualizedTable = (theme) => ({
// https://github.com/bvaughn/react-virtualized/issues/454
'& .ReactVirtualized__Table__headerRow': {
flip: false,
paddingRight:
theme.direction === 'rtl' ? '0 !important' : undefined,
paddingRight: theme.direction === 'rtl' ? '0 !important' : undefined,
},
},
'& .tableRow': {
Expand Down Expand Up @@ -88,18 +80,13 @@ const stylesVirtualizedTable = (theme) => ({
});

const stylesEmotion = ({ theme }) =>
toNestedGlobalSelectors(
stylesVirtualizedTable(theme),
generateMuiVirtualizedTableClass
);
toNestedGlobalSelectors(stylesVirtualizedTable(theme), generateMuiVirtualizedTableClass);
const StyledVirtualizedTable = styled(MuiVirtualizedTable)(stylesEmotion);

function TableTab() {
const [usesCustomStyles, setUsesCustomStyles] = useState(true);

const VirtualizedTable = usesCustomStyles
? StyledVirtualizedTable
: MuiVirtualizedTable;
const VirtualizedTable = usesCustomStyles ? StyledVirtualizedTable : MuiVirtualizedTable;

const columns = useMemo(
() => [
Expand Down Expand Up @@ -174,20 +161,12 @@ function TableTab() {
);
const sort = useCallback(
(dataKey, reverse, isNumeric) => {
let filtered = rows
.map((r, i) => [r, i])
.filter(([r]) => !filter || filter(r));
let filtered = rows.map((r, i) => [r, i]).filter(([r]) => !filter || filter(r));
if (dataKey) {
filtered = filtered
.map(([r, j]) => [r[dataKey], j])
.map(([r, j]) => [
isNumeric ? r : Number(r.replace(/[^0-9.]/g, '')),
j,
]); // for demo, extract any number from a string..
filtered.sort(
([a], [b]) =>
evenThenOddOrderingKey(b) - evenThenOddOrderingKey(a)
);
.map(([r, j]) => [isNumeric ? r : Number(r.replace(/[^0-9.]/g, '')), j]); // for demo, extract any number from a string..
filtered.sort(([a], [b]) => evenThenOddOrderingKey(b) - evenThenOddOrderingKey(a));
if (reverse) {
filtered = filtered.reverse();
}
Expand Down Expand Up @@ -226,30 +205,18 @@ function TableTab() {
function renderParams() {
return (
<Stack sx={{ margin: '1ex' }}>
{mkSwitch(
'Custom theme (emotion)',
usesCustomStyles,
setUsesCustomStyles
)}
{mkSwitch('Custom theme (emotion)', usesCustomStyles, setUsesCustomStyles)}
{mkSwitch('Sortable', sortable, setSortable)}
{mkSwitch('Instance renewal', recreates, setRecreates)}
{mkSwitch(
'Uses external indexer',
isIndexerExternal,
setIndexerIsExternal
)}
{mkSwitch('Uses external indexer', isIndexerExternal, setIndexerIsExternal)}
<Button
disabled={!isIndexerExternal}
onClick={() => setIndexer(makeIndexer(indexer))}
variant="contained"
>
New external indexer
</Button>
{mkSwitch(
'External sort (even then odds)',
doesSort,
setDoesSort
)}
{mkSwitch('External sort (even then odds)', doesSort, setDoesSort)}
<TextField
label="header2 filter"
size="small"
Expand All @@ -258,11 +225,7 @@ function TableTab() {
setFilterValue(event.target.value);
}}
/>
{mkSwitch(
'Defer filter changes',
defersFilterChanges,
setDefersFilterChanges
)}
{mkSwitch('Defer filter changes', defersFilterChanges, setDefersFilterChanges)}
<TextField
label="Header height"
size="small"
Expand Down Expand Up @@ -293,9 +256,7 @@ function TableTab() {
columns={columns}
enableExportCSV
exportCSVDataKeys={['key2', 'key4']}
headerHeight={
!headerHeight ? undefined : Number(headerHeight)
}
headerHeight={!headerHeight ? undefined : Number(headerHeight)}
onRowClick={(...args) => console.log('onRowClick', args)}
onClick={(...args) => console.log('onClick', args)}
onCellClick={(...args) => console.log('onCellClick', args)}
Expand Down
Loading

0 comments on commit 6e3ab89

Please sign in to comment.