@@ -108,7 +113,7 @@ function LevelItem({
type="button"
variant={'ghost'}
size="sm"
- onClick={() => removeParent(index)}
+ onClick={handleRemove}
>
@@ -137,6 +142,10 @@ function CardBody({ cardName }: CardBodyProps) {
control: form.control,
});
+ const handleAppendLevel = useCallback(() => {
+ appendLevel({ expression: '' });
+ }, [appendLevel]);
+
return (
@@ -151,10 +160,7 @@ function CardBody({ cardName }: CardBodyProps) {
))}
- appendLevel({ expression: '' })}
- className="mt-4"
- >
+
{t('flow.addRegularExpressions')}
@@ -173,46 +179,53 @@ function RulesFieldArray({ name }: RulesFieldArrayProps) {
control: form.control,
});
+ const handleAppendRule = useCallback(() => {
+ append({
+ levels: [{ expression: '' }],
+ });
+ }, [append]);
+
return (
- {fields.map((cardField, cardIndex) => (
-
-
-
-
- {t('flow.rule', 'Rule')} {cardIndex + 1}
-
-
- {fields.length > 1 && (
-
- )}
-
-
-
- ))}
-
- append({
- levels: [{ expression: '' }],
- })
- }
- className="mt-4"
- >
+ {fields.map((cardField, cardIndex) => {
+ const handleRemoveCard = () => remove(cardIndex);
+
+ return (
+
+
+
+
+ {t('flow.rule', 'Rule')} {cardIndex + 1}
+
+
+ {fields.length > 1 && (
+
+ )}
+
+
+
+ );
+ })}
+
{t('flow.addRule', 'Add Rule')}
);
}
-const TitleChunkerForm = ({ node }: INextOperatorForm) => {
+const TitleChunkerForm = ({
+ node,
+ onValuesChange,
+ hideOutputs,
+}: INextOperatorForm) => {
const { t } = useTranslation();
const initialValues = useFormValues(initialTitleChunkerValues, node);
@@ -233,6 +246,11 @@ const TitleChunkerForm = ({ node }: INextOperatorForm) => {
const hierarchyOptions = useDynamicHierarchyOptions(form, activeRulesName);
useWatchFormChange(node?.id, form);
+ useFormChangeCallback(form, onValuesChange);
+
+ const handleToggleShowAllTip = useCallback(() => {
+ setShowAllTip((prev) => !prev);
+ }, []);
return (