@leav/ui 1.5.1-78d78ec7 → 1.5.1-8967454c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Explorer/_queries/useExplorerData.js +13 -2
- package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useExportMassAction.js +4 -6
- package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js +10 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/schema.d.ts +11 -0
- package/dist/hooks/useIFrameMessenger/schema.js +4 -0
- package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
- package/dist/locales/en/shared.json +8 -7
- package/dist/locales/fr/shared.json +8 -7
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// This file is released under LGPL V3
|
|
3
3
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
4
4
|
import { localizedTranslation } from '@leav/utils';
|
|
5
|
-
import { useMemo } from 'react';
|
|
5
|
+
import { useEffect, useMemo } from 'react';
|
|
6
6
|
import { useGetRecordUpdatesSubscription, useLang } from '../../../hooks';
|
|
7
7
|
import { useExplorerLibraryDataQuery, useExplorerLinkAttributeQuery, useExplorerLinkDataQuery, } from '../../../_gqlTypes';
|
|
8
8
|
import { prepareFiltersForRequest } from '../../../components/Filters';
|
|
@@ -130,7 +130,18 @@ export const useExplorerData = ({ entrypoint, libraryId, attributeIds, fulltextS
|
|
|
130
130
|
return null;
|
|
131
131
|
}, [libraryData, linkData]);
|
|
132
132
|
const ids = memoizedData?.records.map(record => record.itemId);
|
|
133
|
-
useGetRecordUpdatesSubscription({ libraries: [libraryId], records: ids }, !libraryId);
|
|
133
|
+
const { data: updatedData } = useGetRecordUpdatesSubscription({ libraries: [libraryId], records: ids }, !libraryId);
|
|
134
|
+
// TOTO: change to useMemo, and use updatedData to update memoizedData with new Data. Good luck !
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (updatedData) {
|
|
137
|
+
if (isLibrary) {
|
|
138
|
+
libraryRefetch();
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
linkRefetch();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}, [updatedData]);
|
|
134
145
|
return {
|
|
135
146
|
data: memoizedData,
|
|
136
147
|
isMultivalue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExplorerData.js","sourceRoot":"","sources":["../../../../src/components/Explorer/_queries/useExplorerData.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,+BAA+B,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AAQnE,OAAO,EAKH,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,wBAAwB,EAAC,MAAM,wBAAwB,CAAC;AAEhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,MAAM,eAAe,GAAG,CACpB,IAA8B,EAC9B,SAAiB,EACjB,cAAwB,EACX,EAAE;IACf,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;QACvC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;YACrD,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG;gBACxB,GAAG,QAAQ,CAAC,mBAAmB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,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/E,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,MAAM,GAAG,GAAG,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/D,+BAA+B,CAAC,EAAC,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAEpF,OAAO;QACH,IAAI,EAAE,YAAY;QAClB,YAAY;QACZ,0BAA0B;QAC1B,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;QACjD,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;KACpD,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {localizedTranslation} from '@leav/utils';\nimport {useMemo} from 'react';\nimport {useGetRecordUpdatesSubscription, useLang} from '_ui/hooks';\nimport {\n type Entrypoint,\n type IEntrypointLink,\n type IExplorerData,\n type DefaultViewSettings,\n type IEntrypointLibrary,\n} from '../_types';\nimport {\n type ExplorerLibraryDataQuery,\n type ExplorerLinkDataQuery,\n type LinkPropertyLinkValueFragment,\n type SortOrder,\n useExplorerLibraryDataQuery,\n useExplorerLinkAttributeQuery,\n useExplorerLinkDataQuery,\n} from '_ui/_gqlTypes';\nimport {type UIFilter} from '_ui/components/Filters/_types';\nimport {prepareFiltersForRequest} from '_ui/components/Filters';\n\nexport const dateValuesSeparator = '\\n';\n\nconst _mappingLibrary = (\n data: ExplorerLibraryDataQuery,\n libraryId: string,\n availableLangs: string[],\n): IExplorerData => {\n const attributes = data.records.list.length\n ? data.records.list[0].properties.reduce((acc, property) => {\n acc[property.attributeId] = {\n ...property.attributeProperties,\n label: localizedTranslation(property.attributeProperties.label, availableLangs),\n };\n\n return acc;\n }, {})\n : {};\n\n const records = data.records.list.map(({whoAmI, active, permissions, properties}) => ({\n libraryId,\n key: whoAmI.id, // For <KitTable /> only\n itemId: whoAmI.id, // For <KitTable /> only\n active,\n canActivate: permissions.create_record,\n canDelete: permissions.delete_record,\n whoAmI: {\n label: null,\n subLabel: null,\n color: null,\n preview: null,\n ...whoAmI,\n },\n propertiesById: properties.reduce((acc, {attributeId, values}) => ({...acc, [attributeId]: values}), {}),\n }));\n\n return {\n totalCount: data.records.totalCount ?? 0,\n attributes,\n records,\n };\n};\n\nconst _mappingLink = (data: ExplorerLinkDataQuery, libraryId: string, availableLangs: string[]): IExplorerData => {\n const attributes = data.records.list.length\n ? ((data.records.list[0].property[0] as LinkPropertyLinkValueFragment)?.payload?.properties ?? []).reduce(\n (acc, property) => {\n acc[property.attributeId] = {\n ...property.attributeProperties,\n label: localizedTranslation(property.attributeProperties.label, availableLangs),\n };\n\n return acc;\n },\n {},\n )\n : {};\n\n const records =\n (data.records.list.length &&\n data.records.list[0].property\n .map((linkValue: LinkPropertyLinkValueFragment, index: number) => {\n if (!linkValue.payload) {\n return null;\n }\n\n return {\n libraryId,\n // same link id can be duplicated, so we add the index to the key\n key: linkValue.payload.whoAmI.id + index, // For <KitTable /> only\n itemId: linkValue.payload.whoAmI.id, // For <KitTable /> only\n canActivate: true,\n canDelete: true,\n active: true,\n whoAmI: {\n label: null,\n subLabel: null,\n color: null,\n preview: null,\n ...linkValue.payload.whoAmI,\n },\n propertiesById: linkValue.payload.properties.reduce(\n (acc, {attributeId, values}) => ({...acc, [attributeId]: values}),\n {},\n ),\n id_value: linkValue.id_value ?? undefined,\n };\n })\n .filter(Boolean)) ||\n [];\n\n return {\n totalCount: records.length,\n attributes,\n records,\n };\n};\n\nexport const useExplorerData = ({\n entrypoint,\n libraryId,\n attributeIds,\n fulltextSearch,\n sorts,\n pagination,\n filters,\n filtersOperator,\n skip,\n}: {\n entrypoint: Entrypoint;\n libraryId: string;\n attributeIds: string[];\n fulltextSearch: string;\n sorts: Array<{\n field: string;\n order: SortOrder;\n }>;\n pagination: null | {limit: number; offset: number};\n filters: UIFilter[];\n filtersOperator: DefaultViewSettings['filtersOperator'];\n skip: boolean;\n}) => {\n const {lang: availableLangs} = useLang();\n\n const isLibrary = entrypoint.type === 'library';\n const isLink = entrypoint.type === 'link';\n\n const {data: attributeData} = useExplorerLinkAttributeQuery({\n skip: isLibrary,\n variables: {\n id: (entrypoint as IEntrypointLink).linkAttributeId,\n },\n });\n\n const isLinkAttributeAllowed = attributeData?.attributes?.list?.[0]?.permissions?.access_attribute;\n const {\n data: linkData,\n loading: linkLoading,\n refetch: linkRefetch,\n } = useExplorerLinkDataQuery({\n fetchPolicy: 'network-only',\n skip: skip || !isLink || !isLinkAttributeAllowed,\n variables: {\n parentLibraryId: (entrypoint as IEntrypointLink).parentLibraryId,\n parentRecordId: (entrypoint as IEntrypointLink).parentRecordId,\n linkAttributeId: (entrypoint as IEntrypointLink).linkAttributeId,\n attributeIds,\n },\n });\n\n const allowFreeEntry = isLibrary ? (entrypoint as IEntrypointLibrary).allowFreeEntry : undefined;\n const valuesList =\n !isLibrary || (fulltextSearch && allowFreeEntry) ? undefined : (entrypoint as IEntrypointLibrary).valuesList; // Remove values list for free entry values list on search\n const preparedFilters = prepareFiltersForRequest(filters, filtersOperator, valuesList);\n\n const {\n data: libraryData,\n loading: libraryLoading,\n refetch: libraryRefetch,\n } = useExplorerLibraryDataQuery({\n fetchPolicy: 'network-only',\n skip: skip || !isLibrary,\n variables: {\n libraryId,\n attributeIds,\n pagination,\n searchQuery: fulltextSearch,\n multipleSort: sorts,\n filters: preparedFilters,\n },\n });\n\n const isMultivalue = !!attributeData?.attributes?.list?.[0]?.multiple_values;\n const canEditLinkAttributeValues = !!attributeData?.attributes?.list?.[0]?.permissions?.edit_value;\n\n const memoizedData = useMemo(() => {\n if (isLibrary) {\n return libraryData ? _mappingLibrary(libraryData, libraryId, availableLangs) : null;\n }\n\n if (isLink) {\n return linkData ? _mappingLink(linkData, libraryId, availableLangs) : null;\n }\n\n return null;\n }, [libraryData, linkData]);\n\n const ids = memoizedData?.records.map(record => record.itemId);\n useGetRecordUpdatesSubscription({libraries: [libraryId], records: ids}, !libraryId);\n\n return {\n data: memoizedData,\n isMultivalue,\n canEditLinkAttributeValues,\n loading: isLibrary ? libraryLoading : linkLoading,\n refetch: isLibrary ? libraryRefetch : linkRefetch,\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"useExplorerData.js","sourceRoot":"","sources":["../../../../src/components/Explorer/_queries/useExplorerData.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AACzC,OAAO,EAAC,+BAA+B,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AAQnE,OAAO,EAKH,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,wBAAwB,EAAC,MAAM,wBAAwB,CAAC;AAEhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,MAAM,eAAe,GAAG,CACpB,IAA8B,EAC9B,SAAiB,EACjB,cAAwB,EACX,EAAE;IACf,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;QACvC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,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c,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACxF,CAAC;QAED,IAAI,MAAM,EAAE,CAAC;YACT,OAAO,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/E,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,MAAM,GAAG,GAAG,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,EAAC,IAAI,EAAE,WAAW,EAAC,GAAG,+BAA+B,CAAC,EAAC,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAEhH,iGAAiG;IACjG,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,WAAW,EAAE,CAAC;YACd,IAAI,SAAS,EAAE,CAAC;gBACZ,cAAc,EAAE,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACJ,WAAW,EAAE,CAAC;YAClB,CAAC;QACL,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO;QACH,IAAI,EAAE,YAAY;QAClB,YAAY;QACZ,0BAA0B;QAC1B,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;QACjD,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;KACpD,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {localizedTranslation} from '@leav/utils';\nimport {useEffect, useMemo} from 'react';\nimport {useGetRecordUpdatesSubscription, useLang} from '_ui/hooks';\nimport {\n type Entrypoint,\n type IEntrypointLink,\n type IExplorerData,\n type DefaultViewSettings,\n type IEntrypointLibrary,\n} from '../_types';\nimport {\n type ExplorerLibraryDataQuery,\n type ExplorerLinkDataQuery,\n type LinkPropertyLinkValueFragment,\n type SortOrder,\n useExplorerLibraryDataQuery,\n useExplorerLinkAttributeQuery,\n useExplorerLinkDataQuery,\n} from '_ui/_gqlTypes';\nimport {type UIFilter} from '_ui/components/Filters/_types';\nimport {prepareFiltersForRequest} from '_ui/components/Filters';\n\nexport const dateValuesSeparator = '\\n';\n\nconst _mappingLibrary = (\n data: ExplorerLibraryDataQuery,\n libraryId: string,\n availableLangs: string[],\n): IExplorerData => {\n const attributes = data.records.list.length\n ? data.records.list[0].properties.reduce((acc, property) => {\n acc[property.attributeId] = {\n ...property.attributeProperties,\n label: localizedTranslation(property.attributeProperties.label, availableLangs),\n };\n\n return acc;\n }, {})\n : {};\n\n const records = data.records.list.map(({whoAmI, active, permissions, properties}) => ({\n libraryId,\n key: whoAmI.id, // For <KitTable /> only\n itemId: whoAmI.id, // For <KitTable /> only\n active,\n canActivate: permissions.create_record,\n canDelete: permissions.delete_record,\n whoAmI: {\n label: null,\n subLabel: null,\n color: null,\n preview: null,\n ...whoAmI,\n },\n propertiesById: properties.reduce((acc, {attributeId, values}) => ({...acc, [attributeId]: values}), {}),\n }));\n\n return {\n totalCount: data.records.totalCount ?? 0,\n attributes,\n records,\n };\n};\n\nconst _mappingLink = (data: ExplorerLinkDataQuery, libraryId: string, availableLangs: string[]): IExplorerData => {\n const attributes = data.records.list.length\n ? ((data.records.list[0].property[0] as LinkPropertyLinkValueFragment)?.payload?.properties ?? []).reduce(\n (acc, property) => {\n acc[property.attributeId] = {\n ...property.attributeProperties,\n label: localizedTranslation(property.attributeProperties.label, availableLangs),\n };\n\n return acc;\n },\n {},\n )\n : {};\n\n const records =\n (data.records.list.length &&\n data.records.list[0].property\n .map((linkValue: LinkPropertyLinkValueFragment, index: number) => {\n if (!linkValue.payload) {\n return null;\n }\n\n return {\n libraryId,\n // same link id can be duplicated, so we add the index to the key\n key: linkValue.payload.whoAmI.id + index, // For <KitTable /> only\n itemId: linkValue.payload.whoAmI.id, // For <KitTable /> only\n canActivate: true,\n canDelete: true,\n active: true,\n whoAmI: {\n label: null,\n subLabel: null,\n color: null,\n preview: null,\n ...linkValue.payload.whoAmI,\n },\n propertiesById: linkValue.payload.properties.reduce(\n (acc, {attributeId, values}) => ({...acc, [attributeId]: values}),\n {},\n ),\n id_value: linkValue.id_value ?? undefined,\n };\n })\n .filter(Boolean)) ||\n [];\n\n return {\n totalCount: records.length,\n attributes,\n records,\n };\n};\n\nexport const useExplorerData = ({\n entrypoint,\n libraryId,\n attributeIds,\n fulltextSearch,\n sorts,\n pagination,\n filters,\n filtersOperator,\n skip,\n}: {\n entrypoint: Entrypoint;\n libraryId: string;\n attributeIds: string[];\n fulltextSearch: string;\n sorts: Array<{\n field: string;\n order: SortOrder;\n }>;\n pagination: null | {limit: number; offset: number};\n filters: UIFilter[];\n filtersOperator: DefaultViewSettings['filtersOperator'];\n skip: boolean;\n}) => {\n const {lang: availableLangs} = useLang();\n\n const isLibrary = entrypoint.type === 'library';\n const isLink = entrypoint.type === 'link';\n\n const {data: attributeData} = useExplorerLinkAttributeQuery({\n skip: isLibrary,\n variables: {\n id: (entrypoint as IEntrypointLink).linkAttributeId,\n },\n });\n\n const isLinkAttributeAllowed = attributeData?.attributes?.list?.[0]?.permissions?.access_attribute;\n const {\n data: linkData,\n loading: linkLoading,\n refetch: linkRefetch,\n } = useExplorerLinkDataQuery({\n fetchPolicy: 'network-only',\n skip: skip || !isLink || !isLinkAttributeAllowed,\n variables: {\n parentLibraryId: (entrypoint as IEntrypointLink).parentLibraryId,\n parentRecordId: (entrypoint as IEntrypointLink).parentRecordId,\n linkAttributeId: (entrypoint as IEntrypointLink).linkAttributeId,\n attributeIds,\n },\n });\n\n const allowFreeEntry = isLibrary ? (entrypoint as IEntrypointLibrary).allowFreeEntry : undefined;\n const valuesList =\n !isLibrary || (fulltextSearch && allowFreeEntry) ? undefined : (entrypoint as IEntrypointLibrary).valuesList; // Remove values list for free entry values list on search\n const preparedFilters = prepareFiltersForRequest(filters, filtersOperator, valuesList);\n\n const {\n data: libraryData,\n loading: libraryLoading,\n refetch: libraryRefetch,\n } = useExplorerLibraryDataQuery({\n fetchPolicy: 'network-only',\n skip: skip || !isLibrary,\n variables: {\n libraryId,\n attributeIds,\n pagination,\n searchQuery: fulltextSearch,\n multipleSort: sorts,\n filters: preparedFilters,\n },\n });\n\n const isMultivalue = !!attributeData?.attributes?.list?.[0]?.multiple_values;\n const canEditLinkAttributeValues = !!attributeData?.attributes?.list?.[0]?.permissions?.edit_value;\n\n const memoizedData = useMemo(() => {\n if (isLibrary) {\n return libraryData ? _mappingLibrary(libraryData, libraryId, availableLangs) : null;\n }\n\n if (isLink) {\n return linkData ? _mappingLink(linkData, libraryId, availableLangs) : null;\n }\n\n return null;\n }, [libraryData, linkData]);\n\n const ids = memoizedData?.records.map(record => record.itemId);\n const {data: updatedData} = useGetRecordUpdatesSubscription({libraries: [libraryId], records: ids}, !libraryId);\n\n // TOTO: change to useMemo, and use updatedData to update memoizedData with new Data. Good luck !\n useEffect(() => {\n if (updatedData) {\n if (isLibrary) {\n libraryRefetch();\n } else {\n linkRefetch();\n }\n }\n }, [updatedData]);\n\n return {\n data: memoizedData,\n isMultivalue,\n canEditLinkAttributeValues,\n loading: isLibrary ? libraryLoading : linkLoading,\n refetch: isLibrary ? libraryRefetch : linkRefetch,\n };\n};\n"]}
|
|
@@ -55,7 +55,7 @@ export const useExportMassAction = ({ isEnabled, store: { view, dispatch }, tota
|
|
|
55
55
|
throw errorWithExtensions;
|
|
56
56
|
}
|
|
57
57
|
kitNotification.info({
|
|
58
|
-
message: t('explorer.massAction.export_message'
|
|
58
|
+
message: t('explorer.massAction.export_message'),
|
|
59
59
|
description: t('explorer.massAction.export_description', {
|
|
60
60
|
count: total,
|
|
61
61
|
total,
|
|
@@ -69,10 +69,8 @@ export const useExportMassAction = ({ isEnabled, store: { view, dispatch }, tota
|
|
|
69
69
|
KitAlert.error({
|
|
70
70
|
showIcon: true,
|
|
71
71
|
duration: ERROR_ALERT_DURATION,
|
|
72
|
-
message: t('
|
|
73
|
-
description: t('explorer.massAction.export_config_error_description',
|
|
74
|
-
library: view.libraryId,
|
|
75
|
-
}),
|
|
72
|
+
message: t('explorer.massAction.export_config_error_message'),
|
|
73
|
+
description: t('explorer.massAction.export_config_error_description'),
|
|
76
74
|
closable: true,
|
|
77
75
|
});
|
|
78
76
|
}
|
|
@@ -80,7 +78,7 @@ export const useExportMassAction = ({ isEnabled, store: { view, dispatch }, tota
|
|
|
80
78
|
KitAlert.error({
|
|
81
79
|
showIcon: true,
|
|
82
80
|
duration: ERROR_ALERT_DURATION,
|
|
83
|
-
message: t('
|
|
81
|
+
message: t('explorer.massAction.export_error_message'),
|
|
84
82
|
description: t('explorer.massAction.export_error_description', { count: total }),
|
|
85
83
|
closable: true,
|
|
86
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExportMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useExportMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAE,kCAAkC,EAAC,MAAM,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SAAS;gBACxC,UAAU,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI,SAAS;gBAC3C,IAAI,EAAE,KAAK,IAAI,EAAE;oBACb,MAAM,KAAK,GACP,IAAI,CAAC,aAAa,KAAK,kBAAkB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;oBACvF,IAAI,CAAC;wBACD,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,WAAW,CAAC;4BACpC,SAAS,EAAE;gCACP,OAAO,EAAE,IAAI,CAAC,SAAS;gCACvB,OAAO,EAAE,mBAAmB;gCAC5B,OAAO,EAAE,SAAS,EAAE,kFAAkF;6BACzG;yBACJ,CAAC,CAAC;wBACH,IAAI,KAAK,EAAE,CAAC;4BACR,iEAAiE;4BACjE,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC;4BAC9C,MAAM,mBAAmB,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;4BACpD,mBAA2B,CAAC,UAAU,GAAG,YAAY,EAAE,UAAU,CAAC;4BACnE,MAAM,mBAAmB,CAAC;wBAC9B,CAAC;wBAED,eAAe,CAAC,IAAI,CAAC;4BACjB,OAAO,EAAE,CAAC,CAAC,oCAAoC,
|
|
1
|
+
{"version":3,"file":"useExportMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useExportMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,oB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AAC,EAAE,CAAC;wBACT,IAAI,CAAC,CAAC,UAAU,EAAE,IAAI,KAAK,qBAAqB,EAAE,CAAC;4BAC/C,QAAQ,CAAC,KAAK,CAAC;gCACX,QAAQ,EAAE,IAAI;gCACd,QAAQ,EAAE,oBAAoB;gCAC9B,OAAO,EAAE,CAAC,CAAC,iDAAiD,CAAC;gCAC7D,WAAW,EAAE,CAAC,CAAC,qDAAqD,CAAC;gCACrE,QAAQ,EAAE,IAAI;6BACjB,CAAC,CAAC;wBACP,CAAC;6BAAM,CAAC;4BACJ,QAAQ,CAAC,KAAK,CAAC;gCACX,QAAQ,EAAE,IAAI;gCACd,QAAQ,EAAE,oBAAoB;gCAC9B,OAAO,EAAE,CAAC,CAAC,0CAA0C,CAAC;gCACtD,WAAW,EAAE,CAAC,CAAC,8CAA8C,EAAE,EAAC,KAAK,EAAE,KAAK,EAAC,CAAC;gCAC9E,QAAQ,EAAE,IAAI;6BACjB,CAAC,CAAC;wBACP,CAAC;oBACL,CAAC;gBACL,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,EACF,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CACjE,CAAC;IAEF,OAAO;QACH,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI;KACzD,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type Dispatch, useMemo} from 'react';\nimport {FaFileExport} from 'react-icons/fa';\nimport {KitAlert, KitModal, useKitNotification} from 'aristid-ds';\nimport {useExportLazyQuery} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type FeatureHook, type IMassActions} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState} from '../manage-view-settings';\nimport {BREAK_TWO_LINES, MASS_SELECTION_ALL} from '../_constants';\nimport {ERROR_ALERT_DURATION, INFO_NOTIFICATION_DURATION_SECONDS} from '_ui/constants';\n\n/**\n * Hook that provides a mass action configuration for exporting selected or all items\n * from a view/data set\n */\nexport const useExportMassAction = ({\n isEnabled,\n store: {view, dispatch},\n totalCount,\n onExport,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n totalCount: number;\n onExport?: IMassActions['callback'];\n}>) => {\n const {t} = useSharedTranslation();\n const {kitNotification} = useKitNotification();\n\n const [exportQuery] = useExportLazyQuery();\n\n const _exportMassAction: IMassActions = useMemo(\n () => ({\n label: t('explorer.massAction.export'),\n icon: <FaFileExport />,\n deselectAll: false,\n callback: massSelectionFilter => {\n KitModal.confirm({\n width: '100%',\n style: {content: {width: '90vw', maxWidth: '656px'}},\n icon: false,\n type: 'confirm',\n title:\n t('explorer.export_item', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) ?? undefined,\n content:\n t('explorer.export_item_description', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) +\n BREAK_TWO_LINES +\n t('global.are_you_sure'),\n okText: t('global.confirm') ?? undefined,\n cancelText: t('global.cancel') ?? undefined,\n onOk: async () => {\n const total =\n view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length;\n try {\n const {data, error} = await exportQuery({\n variables: {\n library: view.libraryId,\n filters: massSelectionFilter,\n profile: 'default', // Set 'default' by default, it'll change when we can select a profile from the UI\n },\n });\n if (error) {\n // Preserve the extensions property which contains the error code\n const graphQLError = error.graphQLErrors?.[0];\n const errorWithExtensions = new Error(error.message);\n (errorWithExtensions as any).extensions = graphQLError?.extensions;\n throw errorWithExtensions;\n }\n\n kitNotification.info({\n message: t('explorer.massAction.export_message'),\n description: t('explorer.massAction.export_description', {\n count: total,\n total,\n }),\n duration: INFO_NOTIFICATION_DURATION_SECONDS,\n });\n\n onExport?.(massSelectionFilter, view.massSelection);\n } catch (e) {\n if (e.extensions?.code === 'CUSTOM_CONFIG_ERROR') {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('explorer.massAction.export_config_error_message'),\n description: t('explorer.massAction.export_config_error_description'),\n closable: true,\n });\n } else {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('explorer.massAction.export_error_message'),\n description: t('explorer.massAction.export_error_description', {count: total}),\n closable: true,\n });\n }\n }\n },\n });\n },\n }),\n [t, exportQuery, view.massSelection, dispatch, view.libraryId],\n );\n\n return {\n exportMassAction: isEnabled ? _exportMassAction : null,\n };\n};\n"]}
|
|
@@ -7,7 +7,15 @@ import { Form } from 'antd';
|
|
|
7
7
|
import { KitRichText } from 'aristid-ds';
|
|
8
8
|
import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
|
|
9
9
|
import { EMPTY_INITIAL_VALUE_STRING } from '../../../antdUtils';
|
|
10
|
-
const
|
|
10
|
+
const LEADING_EMPTY_P_TAG = /^<p>(\s| )*<\/p>/;
|
|
11
|
+
const TRAILING_EMPTY_P_TAG = /(<p>(\s| )*<\/p>)+$/;
|
|
12
|
+
const cleanRichTextValue = (value) => {
|
|
13
|
+
if (!value) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const cleanedValue = value.replace(LEADING_EMPTY_P_TAG, '').replace(TRAILING_EMPTY_P_TAG, '').trim();
|
|
17
|
+
return cleanedValue === '' ? null : cleanedValue;
|
|
18
|
+
};
|
|
11
19
|
export const DSRichTextWrapper = ({ value, presentationValue, isLastValueOfMultivalues, removeLastValueOfMultivalues, onChange, attribute, readonly, handleSubmit, calculatedFlags, inheritedFlags, }) => {
|
|
12
20
|
if (!onChange) {
|
|
13
21
|
throw Error('DSRichTextWrapper should be used inside a antd Form.Item');
|
|
@@ -35,7 +43,7 @@ export const DSRichTextWrapper = ({ value, presentationValue, isLastValueOfMulti
|
|
|
35
43
|
};
|
|
36
44
|
const _handleOnBlur = async (inputValue) => {
|
|
37
45
|
setHasChanged(false);
|
|
38
|
-
const valueToSubmit =
|
|
46
|
+
const valueToSubmit = cleanRichTextValue(inputValue);
|
|
39
47
|
if (!hasChanged) {
|
|
40
48
|
onChange(valueToSubmit);
|
|
41
49
|
setIsFocused(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DSRichTextWrapper.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,QAAQ,EAAC,MAAM,OAAO,CAAC;AACvD,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,0BAA0B,EAAC,MAAM,oBAAoB,CAAC;AAE9D,MAAM,YAAY,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"DSRichTextWrapper.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,QAAQ,EAAC,MAAM,OAAO,CAAC;AACvD,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,0BAA0B,EAAC,MAAM,oBAAoB,CAAC;AAE9D,MAAM,mBA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C;QAChD,YAAY,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,UAAU,CAAC,EAAE;QACjC,aAAa,CAAC,IAAI,CAAC,CAAC;QACpB,QAAQ,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO,CACH,KAAC,WAAW,IACR,EAAE,EAAE,SAAS,CAAC,EAAE,EAChB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAChD,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EACtC,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,CAAC,CAAC,yCAAyC,CAAC,EACzD,SAAS,EAAE,SAAS,CAAC,eAAe,IAAI,SAAS,EACjD,SAAS,SACX,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, useState} from 'react';\nimport {Form} from 'antd';\nimport {KitRichText} from 'aristid-ds';\nimport {type IStandFieldValueContentProps} from './_types';\nimport {type KitRichTextProps} from 'aristid-ds/dist/Kit/DataEntry/RichText/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {EMPTY_INITIAL_VALUE_STRING} from '../../../antdUtils';\n\nconst LEADING_EMPTY_P_TAG = /^<p>(\\s| )*<\\/p>/;\nconst TRAILING_EMPTY_P_TAG = /(<p>(\\s| )*<\\/p>)+$/;\n\nconst cleanRichTextValue = (value: string) => {\n if (!value) {\n return null;\n }\n const cleanedValue = value.replace(LEADING_EMPTY_P_TAG, '').replace(TRAILING_EMPTY_P_TAG, '').trim();\n\n return cleanedValue === '' ? null : cleanedValue;\n};\n\nexport const DSRichTextWrapper: FunctionComponent<IStandFieldValueContentProps<KitRichTextProps>> = ({\n value,\n presentationValue,\n isLastValueOfMultivalues,\n removeLastValueOfMultivalues,\n onChange,\n attribute,\n readonly,\n handleSubmit,\n calculatedFlags,\n inheritedFlags,\n}) => {\n if (!onChange) {\n throw Error('DSRichTextWrapper should be used inside a antd Form.Item');\n }\n\n const isNewValueOfMultivalues = isLastValueOfMultivalues && value === EMPTY_INITIAL_VALUE_STRING;\n const focusedDefaultValue = attribute.multiple_values ? isNewValueOfMultivalues : false;\n\n const [hasChanged, setHasChanged] = useState(false);\n const [isFocused, setIsFocused] = useState(focusedDefaultValue);\n const {errors} = Form.Item.useStatus();\n const {t} = useSharedTranslation();\n\n const isErrors = errors.length > 0;\n const valueToDisplay = isFocused || isErrors || !presentationValue ? value : presentationValue;\n\n const _resetToInheritedOrCalculatedValue = async () => {\n setHasChanged(false);\n if (inheritedFlags.isInheritedValue) {\n onChange(inheritedFlags.inheritedValue.raw_payload);\n } else if (calculatedFlags.isCalculatedValue) {\n onChange(calculatedFlags.calculatedValue.raw_payload);\n }\n await handleSubmit(null, attribute.id);\n };\n\n const _handleFocus = () => {\n setIsFocused(true);\n };\n\n const _handleOnBlur = async (inputValue: string) => {\n setHasChanged(false);\n const valueToSubmit = cleanRichTextValue(inputValue);\n if (!hasChanged) {\n onChange(valueToSubmit);\n setIsFocused(false);\n\n if (isNewValueOfMultivalues) {\n removeLastValueOfMultivalues();\n }\n return;\n }\n\n if (valueToSubmit === null && (inheritedFlags.isInheritedValue || calculatedFlags.isCalculatedValue)) {\n _resetToInheritedOrCalculatedValue();\n return;\n }\n\n onChange(valueToSubmit);\n await handleSubmit(valueToSubmit, attribute.id);\n setIsFocused(false);\n };\n\n const _handleOnChange = inputValue => {\n setHasChanged(true);\n onChange(inputValue);\n };\n\n return (\n <KitRichText\n id={attribute.id}\n autoFocus={isFocused}\n helper={isErrors ? String(errors[0]) : undefined}\n status={isErrors ? 'error' : undefined}\n value={valueToDisplay}\n readonly={readonly}\n onChange={_handleOnChange}\n onFocus={_handleFocus}\n onBlur={_handleOnBlur}\n placeholder={t('record_edition.placeholder.enter_a_text')}\n maxLength={attribute.character_limit ?? undefined}\n showCount\n />\n );\n};\n"]}
|
|
@@ -22,12 +22,15 @@ export declare const ExplorerPropsSchema: z.ZodObject<{
|
|
|
22
22
|
export declare const ItemActionsSchema: z.ZodArray<z.ZodObject<{
|
|
23
23
|
where: z.ZodUnion<readonly [z.ZodLiteral<"popup">, z.ZodLiteral<"slider">, z.ZodLiteral<"fullpage">]>;
|
|
24
24
|
what: z.ZodLiteral<"record">;
|
|
25
|
+
targetPanelId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
targetFlapPanelId: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"info-history">, z.ZodLiteral<"thread">]>>;
|
|
25
27
|
icon: z.ZodOptional<z.ZodString>;
|
|
26
28
|
label: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
27
29
|
onRowClick: z.ZodOptional<z.ZodBoolean>;
|
|
28
30
|
}, z.core.$strip>>;
|
|
29
31
|
export declare const basePanelSchema: z.ZodObject<{
|
|
30
32
|
id: z.ZodString;
|
|
33
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
31
34
|
name: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
32
35
|
isStandalone: z.ZodOptional<z.ZodBoolean>;
|
|
33
36
|
hideInSlider: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -41,6 +44,7 @@ export declare const creationPanelSchema: z.ZodObject<{
|
|
|
41
44
|
type: z.ZodLiteral<"creationForm">;
|
|
42
45
|
formId: z.ZodString;
|
|
43
46
|
attributeSource: z.ZodString;
|
|
47
|
+
isStandalone: z.ZodLiteral<true>;
|
|
44
48
|
}, z.core.$strip>;
|
|
45
49
|
export declare const baseExplorerPanelSchema: z.ZodObject<{
|
|
46
50
|
type: z.ZodLiteral<"explorer">;
|
|
@@ -48,6 +52,8 @@ export declare const baseExplorerPanelSchema: z.ZodObject<{
|
|
|
48
52
|
actions: z.ZodArray<z.ZodObject<{
|
|
49
53
|
where: z.ZodUnion<readonly [z.ZodLiteral<"popup">, z.ZodLiteral<"slider">, z.ZodLiteral<"fullpage">]>;
|
|
50
54
|
what: z.ZodLiteral<"record">;
|
|
55
|
+
targetPanelId: z.ZodOptional<z.ZodString>;
|
|
56
|
+
targetFlapPanelId: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"info-history">, z.ZodLiteral<"thread">]>>;
|
|
51
57
|
icon: z.ZodOptional<z.ZodString>;
|
|
52
58
|
label: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
53
59
|
onRowClick: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -72,6 +78,7 @@ export declare const attributeExplorerPanelSchema: z.ZodObject<{
|
|
|
72
78
|
}, z.core.$strip>;
|
|
73
79
|
export declare const PanelSchema: z.ZodIntersection<z.ZodObject<{
|
|
74
80
|
id: z.ZodString;
|
|
81
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
75
82
|
name: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
76
83
|
isStandalone: z.ZodOptional<z.ZodBoolean>;
|
|
77
84
|
hideInSlider: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -81,6 +88,8 @@ export declare const PanelSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
81
88
|
actions: z.ZodArray<z.ZodObject<{
|
|
82
89
|
where: z.ZodUnion<readonly [z.ZodLiteral<"popup">, z.ZodLiteral<"slider">, z.ZodLiteral<"fullpage">]>;
|
|
83
90
|
what: z.ZodLiteral<"record">;
|
|
91
|
+
targetPanelId: z.ZodOptional<z.ZodString>;
|
|
92
|
+
targetFlapPanelId: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"info-history">, z.ZodLiteral<"thread">]>>;
|
|
84
93
|
icon: z.ZodOptional<z.ZodString>;
|
|
85
94
|
label: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
86
95
|
onRowClick: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -126,9 +135,11 @@ export declare const PanelSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
126
135
|
type: z.ZodLiteral<"creationForm">;
|
|
127
136
|
formId: z.ZodString;
|
|
128
137
|
attributeSource: z.ZodString;
|
|
138
|
+
isStandalone: z.ZodLiteral<true>;
|
|
129
139
|
}, z.core.$strip>]>>;
|
|
130
140
|
export declare const PanelIFrameSchema: z.ZodIntersection<z.ZodObject<{
|
|
131
141
|
id: z.ZodString;
|
|
142
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
132
143
|
name: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
133
144
|
isStandalone: z.ZodOptional<z.ZodBoolean>;
|
|
134
145
|
hideInSlider: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -30,6 +30,8 @@ export const ItemActionsSchema = z
|
|
|
30
30
|
.array(z.object({
|
|
31
31
|
where: WhereSchema,
|
|
32
32
|
what: z.literal('record'),
|
|
33
|
+
targetPanelId: PanelIdSchema.optional(),
|
|
34
|
+
targetFlapPanelId: FlapPanelIdSchema.optional(),
|
|
33
35
|
icon: FontAwesomeIconSchema,
|
|
34
36
|
label: z.record(LanguageSchema, z.string()),
|
|
35
37
|
onRowClick: z.boolean().optional(),
|
|
@@ -39,6 +41,7 @@ export const ItemActionsSchema = z
|
|
|
39
41
|
});
|
|
40
42
|
export const basePanelSchema = z.object({
|
|
41
43
|
id: PanelIdSchema,
|
|
44
|
+
icon: FontAwesomeIconSchema,
|
|
42
45
|
name: z.record(LanguageSchema, z.string()).optional(),
|
|
43
46
|
isStandalone: z.boolean().optional(),
|
|
44
47
|
hideInSlider: z.boolean().optional(),
|
|
@@ -56,6 +59,7 @@ export const creationPanelSchema = z.object({
|
|
|
56
59
|
type: z.literal('creationForm'),
|
|
57
60
|
formId: z.string(),
|
|
58
61
|
attributeSource: z.string(),
|
|
62
|
+
isStandalone: z.literal(true),
|
|
59
63
|
});
|
|
60
64
|
export const baseExplorerPanelSchema = z.object({
|
|
61
65
|
type: z.literal('explorer'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/hooks/useIFrameMessenger/schema.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,QAAQ,EAAE,CAAC;AAE1F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAErG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAE3F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,UAAU,EAAE,CAAC,CAAC,OAAO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CAAC,CAAC,CAC7F,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport * as z from 'zod/v4';\n\nexport const FONT_AWESOME_ICON_REGEX = /^fa-/;\n\nexport const PanelIdSchema = z.string();\nexport const LanguageSchema = z.string();\nexport const LibraryIdSchema = z.string();\nexport const FontAwesomeIconSchema = z.string().regex(FONT_AWESOME_ICON_REGEX).optional();\n\nexport const WhereSchema = z.union([z.literal('popup'), z.literal('slider'), z.literal('fullpage')]);\n\nexport const FlapPanelIdSchema = z.union([z.literal('info-history'), z.literal('thread')]);\n\nexport const ExplorerPropsSchema = z.object({\n showSearch: z.boolean().optional(),\n showFilters: z.boolean().optional(),\n showSorts: z.boolean().optional(),\n freezeView: z.boolean().optional(),\n showAttributeLabels: z.boolean().optional(),\n creationFormId: z.string().optional(),\n noPagination: z.literal(true).optional(),\n showActionsLabels: z.boolean().optional(),\n defaultPrimaryActions: z.array(z.union([z.literal('create')])).optional(),\n defaultMassActions: z\n .array(z.union([z.literal('deactivate'), z.literal('export'), z.literal('editAttribute')]))\n .optional(),\n defaultActionsForItem: z\n .array(z.union([z.literal('replaceLink'), z.literal('remove'), z.literal('activate')]))\n .optional(),\n});\n\nexport const ItemActionsSchema = z\n .array(\n z.object({\n where: WhereSchema,\n what: z.literal('record'),\n targetPanelId: PanelIdSchema.optional(),\n targetFlapPanelId: FlapPanelIdSchema.optional(),\n icon: FontAwesomeIconSchema,\n label: z.record(LanguageSchema, z.string()),\n onRowClick: z.boolean().optional(),\n }),\n )\n .refine(actions => actions.reduce((acc, action) => (action.onRowClick ? acc + 1 : acc), 0) <= 1, {\n message: 'At most one action must have onRowClick set to true',\n });\n\nexport const basePanelSchema = z.object({\n id: PanelIdSchema,\n icon: FontAwesomeIconSchema,\n name: z.record(LanguageSchema, z.string()).optional(),\n isStandalone: z.boolean().optional(),\n hideInSlider: z.boolean().optional(),\n});\n\nexport const iframePanelSchema = z.object({\n type: z.literal('custom'),\n iframeSource: z.string(),\n isSelfContaining: z.boolean().optional(),\n});\n\nconst editionPanelSchema = z.object({\n type: z.literal('editionForm'),\n formId: z.string(),\n});\n\nexport const creationPanelSchema = z.object({\n type: z.literal('creationForm'),\n formId: z.string(),\n attributeSource: z.string(),\n isStandalone: z.literal(true),\n});\n\nexport const baseExplorerPanelSchema = z.object({\n type: z.literal('explorer'),\n viewId: z.string().optional(),\n actions: ItemActionsSchema,\n});\n\nexport const attributeExplorerPanelSchema = z.object({\n attributeSource: z.string(),\n libraryId: LibraryIdSchema,\n explorerProps: ExplorerPropsSchema.optional(),\n});\n\nconst libraryExplorerPanelSchema = z.object({\n explorerProps: ExplorerPropsSchema.optional(),\n});\n\nconst explorerPanelSchema = baseExplorerPanelSchema.and(\n z.union([attributeExplorerPanelSchema, libraryExplorerPanelSchema]),\n);\n\nexport const PanelSchema = basePanelSchema.and(\n z.union([explorerPanelSchema, iframePanelSchema, editionPanelSchema, creationPanelSchema]),\n);\n\nexport const PanelIFrameSchema = basePanelSchema.and(iframePanelSchema);\n"]}
|
|
@@ -759,13 +759,14 @@
|
|
|
759
759
|
"editAttribute_submit_notification_description": "Your request to edit {{counter, number}} items has been received. You will be notified once the operation is complete.",
|
|
760
760
|
"editAttribute_submit_error": "An error occurred while requesting a bulk edit. Please contact an administrator.",
|
|
761
761
|
"export": "Export",
|
|
762
|
-
"
|
|
763
|
-
"
|
|
764
|
-
"
|
|
765
|
-
"
|
|
766
|
-
"export_error_description_one": "An error occurred while exporting the selected record.",
|
|
767
|
-
"export_error_description_other": "An error occurred while exporting the selected records.",
|
|
768
|
-
"
|
|
762
|
+
"export_message": "Export request",
|
|
763
|
+
"export_description_one": "Your request to export {{total, number}} item has been received. You will be notified as soon as the file is ready.",
|
|
764
|
+
"export_description_other": "Your request to export {{total, number}} items has been received. You will be notified as soon as the file is ready.",
|
|
765
|
+
"export_error_message": "Export error",
|
|
766
|
+
"export_error_description_one": "An error occurred while exporting the selected record. Please contact your administrator.",
|
|
767
|
+
"export_error_description_other": "An error occurred while exporting the selected records. Please contact your administrator.",
|
|
768
|
+
"export_config_error_message": "Export profile error",
|
|
769
|
+
"export_config_error_description": "No export profile is available for this library. Please contact your administrator.",
|
|
769
770
|
"add-link": "Add",
|
|
770
771
|
"replace-link": "Replace",
|
|
771
772
|
"toggle_selection": {
|
|
@@ -759,13 +759,14 @@
|
|
|
759
759
|
"editAttribute_submit_notification_description": "Votre demande de modification de {{counter, number}} éléments a bien été prise en compte. Vous serez notifié une fois l'opération terminée.",
|
|
760
760
|
"editAttribute_submit_error": "Une erreur est survenue lors de la demande d'une modification en masse. Veuillez contacter un administrateur.",
|
|
761
761
|
"export": "Exporter",
|
|
762
|
-
"
|
|
763
|
-
"
|
|
764
|
-
"
|
|
765
|
-
"
|
|
766
|
-
"export_error_description_one": "Une erreur s'est produite lors de l'
|
|
767
|
-
"export_error_description_other": "Une erreur s'est produite lors de l'
|
|
768
|
-
"
|
|
762
|
+
"export_message": "Demande d'export",
|
|
763
|
+
"export_description_one": "Votre demande d’export de {{total, number}} élément a bien été prise en compte. Vous recevrez une notification dès que le fichier sera prêt.",
|
|
764
|
+
"export_description_other": "Votre demande d’export de {{total, number}} éléments a bien été prise en compte. Vous recevrez une notification dès que le fichier sera prêt.",
|
|
765
|
+
"export_error_message": "Erreur d’export",
|
|
766
|
+
"export_error_description_one": "Une erreur s'est produite lors de l'export de l'enregistrements sélectionné. Veuillez contacter votre administrateur.",
|
|
767
|
+
"export_error_description_other": "Une erreur s'est produite lors de l'export des enregistrements sélectionnés. Veuillez contacter votre administrateur.",
|
|
768
|
+
"export_config_error_message": "Erreur de profil d’export",
|
|
769
|
+
"export_config_error_description": "Aucun profil d’export n’est disponible pour cette bibliothèque. Veuillez contacter votre administrateur.",
|
|
769
770
|
"add-link": "Ajouter",
|
|
770
771
|
"replace-link": "Remplacer",
|
|
771
772
|
"toggle_selection": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leav/ui",
|
|
3
|
-
"version": "1.5.1-
|
|
3
|
+
"version": "1.5.1-8967454c",
|
|
4
4
|
"description": "Shared React components and hooks",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepublishOnly": "yarn build",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/react-table": "7.7.12",
|
|
45
45
|
"@types/uuid": "^9",
|
|
46
46
|
"antd": "5.22.2",
|
|
47
|
-
"aristid-ds": "14.0.0-
|
|
47
|
+
"aristid-ds": "14.0.0-94337b1",
|
|
48
48
|
"babel-jest": "29.3.1",
|
|
49
49
|
"commander": "9.5.0",
|
|
50
50
|
"graphql": "16.12.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@ant-design/icons": ">=5.2",
|
|
67
67
|
"@apollo/client": ">=3.8.1",
|
|
68
68
|
"antd": "5.22.2",
|
|
69
|
-
"aristid-ds": "14.0.0-
|
|
69
|
+
"aristid-ds": "14.0.0-94337b1",
|
|
70
70
|
"dayjs": "^1.11.13",
|
|
71
71
|
"i18next": "22.5",
|
|
72
72
|
"react": "18.2.0",
|