mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 22:19:36 +02:00
feat: group list ui
This commit is contained in:
31
.idea/workspace.xml
generated
31
.idea/workspace.xml
generated
@@ -4,11 +4,10 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="fix: style">
|
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="feat: find unique ui">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/list/find-unique/find-unique.service.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/find-unique/find-unique.service.test.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/list/find-unique/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/find-unique/index.tsx" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/list/find-unique/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/find-unique/index.tsx" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/list/find-unique/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/find-unique/service.ts" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/list/group/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/group/index.tsx" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -205,15 +204,9 @@
|
|||||||
<workItem from="1719496624579" duration="6148000" />
|
<workItem from="1719496624579" duration="6148000" />
|
||||||
<workItem from="1720542757452" duration="5355000" />
|
<workItem from="1720542757452" duration="5355000" />
|
||||||
<workItem from="1720557527691" duration="3245000" />
|
<workItem from="1720557527691" duration="3245000" />
|
||||||
<workItem from="1720564427492" duration="1153000" />
|
<workItem from="1720564427492" duration="1523000" />
|
||||||
</task>
|
<workItem from="1720613598176" duration="8000" />
|
||||||
<task id="LOCAL-00043" summary="fix: create-tool.mjs">
|
<workItem from="1720655252208" duration="1526000" />
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1719187088285</created>
|
|
||||||
<option name="number" value="00043" />
|
|
||||||
<option name="presentableId" value="LOCAL-00043" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1719187088285</updated>
|
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00044" summary="fix: readme">
|
<task id="LOCAL-00044" summary="fix: readme">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -599,7 +592,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1720564711406</updated>
|
<updated>1720564711406</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="92" />
|
<task id="LOCAL-00092" summary="feat: find unique ui">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1720565760853</created>
|
||||||
|
<option name="number" value="00092" />
|
||||||
|
<option name="presentableId" value="LOCAL-00092" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1720565760853</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="93" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -643,7 +644,6 @@
|
|||||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
<option name="CHECK_NEW_TODO" value="false" />
|
<option name="CHECK_NEW_TODO" value="false" />
|
||||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||||
<MESSAGE value="fix: generate numbers" />
|
|
||||||
<MESSAGE value="fix: merging branches" />
|
<MESSAGE value="fix: merging branches" />
|
||||||
<MESSAGE value="feat: make responsive" />
|
<MESSAGE value="feat: make responsive" />
|
||||||
<MESSAGE value="feat: make tool responsive" />
|
<MESSAGE value="feat: make tool responsive" />
|
||||||
@@ -668,7 +668,8 @@
|
|||||||
<MESSAGE value="feat: find most popular ui" />
|
<MESSAGE value="feat: find most popular ui" />
|
||||||
<MESSAGE value="fix: misc" />
|
<MESSAGE value="fix: misc" />
|
||||||
<MESSAGE value="fix: style" />
|
<MESSAGE value="fix: style" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="fix: style" />
|
<MESSAGE value="feat: find unique ui" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="feat: find unique ui" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
|
@@ -4,12 +4,11 @@ import ToolTextInput from '../../../components/input/ToolTextInput';
|
|||||||
import ToolTextResult from '../../../components/result/ToolTextResult';
|
import ToolTextResult from '../../../components/result/ToolTextResult';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import ToolOptions from '../../../components/options/ToolOptions';
|
import ToolOptions from '../../../components/options/ToolOptions';
|
||||||
import { SplitOperatorType, findUniqueCompute } from './service';
|
import { findUniqueCompute, SplitOperatorType } from './service';
|
||||||
import ToolInputAndResult from '../../../components/ToolInputAndResult';
|
import ToolInputAndResult from '../../../components/ToolInputAndResult';
|
||||||
import SimpleRadio from '../../../components/options/SimpleRadio';
|
import SimpleRadio from '../../../components/options/SimpleRadio';
|
||||||
import TextFieldWithDesc from '../../../components/options/TextFieldWithDesc';
|
import TextFieldWithDesc from '../../../components/options/TextFieldWithDesc';
|
||||||
import CheckboxWithDesc from '../../../components/options/CheckboxWithDesc';
|
import CheckboxWithDesc from '../../../components/options/CheckboxWithDesc';
|
||||||
import SelectWithDesc from '../../../components/options/SelectWithDesc';
|
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
splitOperatorType: 'symbol' as SplitOperatorType,
|
splitOperatorType: 'symbol' as SplitOperatorType,
|
||||||
@@ -143,6 +142,14 @@ export default function FindUnique() {
|
|||||||
checked={values.absolutelyUnique}
|
checked={values.absolutelyUnique}
|
||||||
onChange={(value) => updateField('absolutelyUnique', value)}
|
onChange={(value) => updateField('absolutelyUnique', value)}
|
||||||
/>
|
/>
|
||||||
|
<CheckboxWithDesc
|
||||||
|
title={'Case Sensitive Items'}
|
||||||
|
description={
|
||||||
|
'Output items with different case as unique elements in the list.'
|
||||||
|
}
|
||||||
|
checked={values.caseSensitive}
|
||||||
|
onChange={(value) => updateField('caseSensitive', value)}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,187 @@
|
|||||||
import { Box } from '@mui/material';
|
import { Box } from '@mui/material';
|
||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
|
import ToolTextInput from '../../../components/input/ToolTextInput';
|
||||||
|
import ToolTextResult from '../../../components/result/ToolTextResult';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
|
import ToolOptions from '../../../components/options/ToolOptions';
|
||||||
|
import { groupList, SplitOperatorType } from './service';
|
||||||
|
import ToolInputAndResult from '../../../components/ToolInputAndResult';
|
||||||
|
import SimpleRadio from '../../../components/options/SimpleRadio';
|
||||||
|
import TextFieldWithDesc from '../../../components/options/TextFieldWithDesc';
|
||||||
|
import CheckboxWithDesc from '../../../components/options/CheckboxWithDesc';
|
||||||
|
|
||||||
const initialValues = {};
|
const initialValues = {
|
||||||
const validationSchema = Yup.object({
|
splitOperatorType: 'symbol' as SplitOperatorType,
|
||||||
|
splitSeparator: ',',
|
||||||
|
groupNumber: 2,
|
||||||
|
itemSeparator: ',',
|
||||||
|
leftWrap: '[',
|
||||||
|
rightWrap: ']',
|
||||||
|
groupSeparator: '\\n',
|
||||||
|
deleteEmptyItems: true,
|
||||||
|
padNonFullGroup: false,
|
||||||
|
paddingChar: '...'
|
||||||
|
};
|
||||||
|
const splitOperators: {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
type: SplitOperatorType;
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
title: 'Use a Symbol for Splitting',
|
||||||
|
description: 'Delimit input list items with a character.',
|
||||||
|
type: 'symbol'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Use a Regex for Splitting',
|
||||||
|
type: 'regex',
|
||||||
|
description: 'Delimit input list items with a regular expression.'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
export default function FindUnique() {
|
||||||
|
const [input, setInput] = useState<string>('');
|
||||||
|
const [result, setResult] = useState<string>('');
|
||||||
|
const compute = (optionsValues: typeof initialValues, input: any) => {
|
||||||
|
const {
|
||||||
|
splitOperatorType,
|
||||||
|
splitSeparator,
|
||||||
|
groupNumber,
|
||||||
|
itemSeparator,
|
||||||
|
leftWrap,
|
||||||
|
rightWrap,
|
||||||
|
groupSeparator,
|
||||||
|
deleteEmptyItems,
|
||||||
|
padNonFullGroup,
|
||||||
|
paddingChar
|
||||||
|
} = optionsValues;
|
||||||
|
|
||||||
|
setResult(
|
||||||
|
groupList(
|
||||||
|
splitOperatorType,
|
||||||
|
splitSeparator,
|
||||||
|
input,
|
||||||
|
groupNumber,
|
||||||
|
itemSeparator,
|
||||||
|
leftWrap,
|
||||||
|
rightWrap,
|
||||||
|
groupSeparator,
|
||||||
|
deleteEmptyItems,
|
||||||
|
padNonFullGroup,
|
||||||
|
paddingChar
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const validationSchema = Yup.object({
|
||||||
// splitSeparator: Yup.string().required('The separator is required')
|
// splitSeparator: Yup.string().required('The separator is required')
|
||||||
});
|
});
|
||||||
export default function Group() {
|
|
||||||
return <Box>Lorem ipsum</Box>;
|
return (
|
||||||
|
<Box>
|
||||||
|
<ToolInputAndResult
|
||||||
|
input={
|
||||||
|
<ToolTextInput
|
||||||
|
title={'Input list'}
|
||||||
|
value={input}
|
||||||
|
onChange={setInput}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
result={<ToolTextResult title={'Grouped items'} value={result} />}
|
||||||
|
/>
|
||||||
|
<ToolOptions
|
||||||
|
compute={compute}
|
||||||
|
getGroups={({ values, updateField }) => [
|
||||||
|
{
|
||||||
|
title: 'Input Item Separator',
|
||||||
|
component: (
|
||||||
|
<Box>
|
||||||
|
{splitOperators.map(({ title, description, type }) => (
|
||||||
|
<SimpleRadio
|
||||||
|
key={type}
|
||||||
|
onClick={() => updateField('splitOperatorType', type)}
|
||||||
|
title={title}
|
||||||
|
description={description}
|
||||||
|
checked={values.splitOperatorType === type}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
<TextFieldWithDesc
|
||||||
|
description={'Set a delimiting symbol or regular expression.'}
|
||||||
|
value={values.splitSeparator}
|
||||||
|
onOwnChange={(val) => updateField('splitSeparator', val)}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Group Size and Separators',
|
||||||
|
component: (
|
||||||
|
<Box>
|
||||||
|
<TextFieldWithDesc
|
||||||
|
value={values.groupNumber}
|
||||||
|
description={'Number of items in a group'}
|
||||||
|
type={'number'}
|
||||||
|
onOwnChange={(value) =>
|
||||||
|
updateField('groupNumber', Number(value))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<TextFieldWithDesc
|
||||||
|
value={values.itemSeparator}
|
||||||
|
description={'Item separator character'}
|
||||||
|
onOwnChange={(value) => updateField('itemSeparator', value)}
|
||||||
|
/>
|
||||||
|
<TextFieldWithDesc
|
||||||
|
value={values.groupSeparator}
|
||||||
|
description={'Group separator character'}
|
||||||
|
onOwnChange={(value) => updateField('groupSeparator', value)}
|
||||||
|
/>
|
||||||
|
<TextFieldWithDesc
|
||||||
|
value={values.leftWrap}
|
||||||
|
description={"Group's left wrap symbol."}
|
||||||
|
onOwnChange={(value) => updateField('leftWrap', value)}
|
||||||
|
/>
|
||||||
|
<TextFieldWithDesc
|
||||||
|
value={values.rightWrap}
|
||||||
|
description={"Group's right wrap symbol."}
|
||||||
|
onOwnChange={(value) => updateField('rightWrap', value)}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Empty Items and Padding',
|
||||||
|
component: (
|
||||||
|
<Box>
|
||||||
|
<CheckboxWithDesc
|
||||||
|
title={'Delete Empty Items'}
|
||||||
|
description={
|
||||||
|
"Ignore empty items and don't include them in the groups."
|
||||||
|
}
|
||||||
|
checked={values.deleteEmptyItems}
|
||||||
|
onChange={(value) => updateField('deleteEmptyItems', value)}
|
||||||
|
/>
|
||||||
|
<CheckboxWithDesc
|
||||||
|
title={'Pad Non-full Groups'}
|
||||||
|
description={
|
||||||
|
'Fill non-full groups with a custom item (enter below).'
|
||||||
|
}
|
||||||
|
checked={values.padNonFullGroup}
|
||||||
|
onChange={(value) => updateField('padNonFullGroup', value)}
|
||||||
|
/>
|
||||||
|
<TextFieldWithDesc
|
||||||
|
value={values.paddingChar}
|
||||||
|
description={
|
||||||
|
'Use this character or item to pad non-full groups.'
|
||||||
|
}
|
||||||
|
onOwnChange={(value) => updateField('paddingChar', value)}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
initialValues={initialValues}
|
||||||
|
input={input}
|
||||||
|
validationSchema={validationSchema}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user