From 6d664ee89502b7305665c925556ed3d45aaba896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Boixader=20G=C3=BCell?= Date: Sun, 17 Mar 2024 21:34:51 +0100 Subject: [PATCH 01/14] wip: strict mode --- .../components/fields/editComponent.tsx | 56 ++++--- .../components/fields/editableField.tsx | 22 ++- .../components/input/input_list.tsx | 9 +- src/guillo-gmi/components/input/select.tsx | 12 +- .../components/input/select_vocabulary.tsx | 8 +- src/guillo-gmi/components/input/upload.tsx | 6 +- .../components/panel/permissions.tsx | 8 +- .../components/panel/permissions_prinperm.tsx | 20 ++- .../components/panel/permissions_prinrole.tsx | 16 +- .../components/panel/permissions_roleperm.tsx | 16 +- src/guillo-gmi/contexts/index.tsx | 23 ++- src/guillo-gmi/hooks/useConfig.tsx | 40 +++-- src/guillo-gmi/hooks/useCrudContext.tsx | 147 ++++++++++-------- src/guillo-gmi/lib/client.tsx | 115 ++++++++------ src/guillo-gmi/lib/rest.ts | 50 +++--- src/guillo-gmi/lib/utils.ts | 13 +- ...eneric_messages.js => generic_messages.ts} | 0 src/guillo-gmi/models/index.ts | 4 +- src/guillo-gmi/types/global.ts | 13 ++ src/guillo-gmi/types/guillotina.ts | 58 +++++++ 20 files changed, 395 insertions(+), 241 deletions(-) rename src/guillo-gmi/locales/{generic_messages.js => generic_messages.ts} (100%) diff --git a/src/guillo-gmi/components/fields/editComponent.tsx b/src/guillo-gmi/components/fields/editComponent.tsx index be219cd..7d30797 100644 --- a/src/guillo-gmi/components/fields/editComponent.tsx +++ b/src/guillo-gmi/components/fields/editComponent.tsx @@ -10,13 +10,17 @@ import { SearchInputList } from '../input/search_input_list' import { SearchInput } from '../input/search_input' import { useTraversal } from '../../contexts' import { Ref, forwardRef } from 'react' -import { GuillotinaItemsProperty } from '../../types/guillotina' -import { IndexSignature } from '../../types/global' +import { GuillotinaFile, GuillotinaItemsProperty } from '../../types/guillotina' +import { + EditableFieldValue, + IndexSignature, + LightFile, +} from '../../types/global' interface Props { schema: GuillotinaItemsProperty - val: any - setValue: (value: any) => void + val: EditableFieldValue + setValue: (value: EditableFieldValue) => void dataTest?: string className?: string placeholder?: string @@ -45,7 +49,7 @@ export const EditComponent = forwardRef( <> {placeholder && } setValue(ev)} queryCondition={ @@ -55,7 +59,7 @@ export const EditComponent = forwardRef( labelProperty={ schema?.labelProperty ? schema.labelProperty : 'title' } - typeNameQuery={schema?.typeNameQuery ? schema.typeNameQuery : null} + typeNameQuery={schema?.typeNameQuery} /> ) @@ -64,7 +68,7 @@ export const EditComponent = forwardRef( <> {placeholder && } setValue(ev)} queryCondition={ @@ -74,14 +78,14 @@ export const EditComponent = forwardRef( labelProperty={ schema?.labelProperty ? schema.labelProperty : 'title' } - typeNameQuery={schema?.typeNameQuery ? schema.typeNameQuery : null} + typeNameQuery={schema?.typeNameQuery} /> ) } else if (schema?.widget === 'textarea' || schema?.widget === 'richtext') { return (