@leav/ui 1.5.1-339c20fb → 1.5.1-36ba391b
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/__mocks__/common/attribute.js +1 -0
- package/dist/__mocks__/common/attribute.js.map +1 -1
- package/dist/_gqlTypes/index.d.ts +115 -1
- package/dist/_gqlTypes/index.js +86 -0
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/attributes/attributeDetailsFragment.js +1 -0
- package/dist/_queries/attributes/attributeDetailsFragment.js.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +1 -1
- package/dist/components/Explorer/Explorer.js +15 -3
- package/dist/components/Explorer/Explorer.js.map +1 -1
- 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/edit-attribute/EditAttributeMassActionModal.d.ts +13 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js +20 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.d.ts +10 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js +38 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.d.ts +8 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js +16 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.d.ts +10 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js +28 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.d.ts +5 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js +12 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.d.ts +5 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js +20 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js.map +1 -0
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.d.ts +11 -0
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +106 -0
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -0
- 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/antdUtils.js +12 -3
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +4 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +6 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js +6 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js +9 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js +8 -7
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js +6 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js +6 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js +12 -11
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js +16 -7
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js +6 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.d.ts +3 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.js +10 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +4 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.d.ts +24 -24
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.js +34 -35
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.d.ts +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +15 -10
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.d.ts +1 -1
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js +4 -3
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/schema.d.ts +15 -4
- package/dist/hooks/useIFrameMessenger/schema.js +7 -1
- package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
- package/dist/locales/en/shared.json +20 -7
- package/dist/locales/fr/shared.json +20 -7
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValuesSummary.js","sourceRoot":"","sources":["../../../../../src/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,aAAa,EAAC,MAAM,sCAAsC,CA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EAAE,CACH,eACI,KAAK,EAAE;4CACH,OAAO,EAAE,MAAM;4CACf,UAAU,EAAE,QAAQ;4CACpB,cAAc,EAAE,eAAe;yCAClC,aAED,2BACI,KAAC,YAAY,KAAG,OAAE,CAAC,CAAC,uBAAuB,CAAC,IACzC,EACP,KAAC,QAAQ,IAAC,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAC,SAAS,GAAG,IAC7D,CACT;oCACD,QAAQ,EACJ,mBAAmB,CAAC,MAAM,GAAG,CAAC;wCAC1B,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;4CACvC,GAAG,EAAE,GAAG,cAAc,IAAI,KAAK,EAAE;4CACjC,KAAK,EAAE,KAAK;yCACf,CAAC,CAAC;wCACL,CAAC,CAAC;4CACI;gDACI,GAAG,EAAE,GAAG,cAAc,IAAI,CAAC,EAAE;gDAC7B,KAAK,EAAE,sBAAI,CAAC,CAAC,yBAAyB,CAAC,GAAK;6CAC/C;yCACJ;iCACd;6BACJ,GACH,GACgB,CACzB;iBACJ;gBACD;oBACI,GAAG,EAAE,SAAS;oBACd,KAAK,EAAE,CAAC,CAAC,wBAAwB,CAAC;oBAClC,UAAU,EAAE,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAI;iBAC1E;aACJ,GACH,GACoB,CAC7B,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,aAAa,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} from 'react';\nimport {type RecordFormElementsValueStandardValue} from '_ui/hooks/useGetRecordForm';\nimport {KitBadge, KitTabs, KitTree} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {FaLayerGroup, FaSquareRootAlt} from 'react-icons/fa';\nimport styled from 'styled-components';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport {RecordHistory} from '../../../RecordHistory/RecordHistory';\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nconst StyledDivContentWrapper = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n`;\n\ninterface IValuesSummaryProps {\n record: IRecordIdentityWhoAmI | null;\n attributeId: string;\n globalValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n calculatedValue?: RecordFormElementsValueStandardValue['payload'];\n}\n\nconst calculatedValueKey = '0';\nconst globalValueKey = '1';\n\n// https://stackoverflow.com/questions/822452/strip-html-tags-from-text-using-plain-javascript\nconst stripHtml = (html: string): string => {\n const doc = new DOMParser().parseFromString(html, 'text/html');\n return doc.body.textContent || '';\n};\n\nconst _isDateRangeValue = (value: any): value is {from: string; to: string} =>\n !!value && typeof value === 'object' && 'from' in value && 'to' in value;\n\nexport const ValuesSummary: FunctionComponent<IValuesSummaryProps> = ({\n record,\n attributeId,\n globalValues = [],\n calculatedValue,\n}) => {\n const {t} = useSharedTranslation();\n\n const stringifyValue = (value: RecordFormElementsValueStandardValue['payload']): string => {\n if (typeof value === 'string') {\n return stripHtml(value);\n }\n\n if (typeof value === 'boolean') {\n return value ? t('global.yes') : t('global.no');\n }\n\n if (_isDateRangeValue(value)) {\n return t('record_edition.date_range_value', {\n from: value.from,\n to: value.to,\n interpolation: {\n escapeValue: false,\n },\n });\n }\n\n return value;\n };\n\n const stripedGlobalValues = globalValues.map(stringifyValue);\n const stripedCalculatedValue = stringifyValue(calculatedValue);\n\n return (\n <StyledDivContentWrapper>\n <KitTabs\n items={[\n {\n key: 'version_values',\n label: t('record_summary.values_version'),\n tabContent: (\n <InformationsWrapper>\n <KitTree\n defaultExpandAll\n selectedKeys={\n calculatedValue && globalValues.length === 0\n ? [calculatedValueKey]\n : [globalValueKey]\n }\n treeData={[\n {\n key: calculatedValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FaSquareRootAlt /> {t('record_summary.calculated_value')}\n </span>\n <KitBadge\n count={stripedCalculatedValue ? 1 : undefined}\n color=\"primary\"\n />\n </div>\n ),\n children: [\n {\n key: `${calculatedValueKey}-0`,\n title: stripedCalculatedValue ?? (\n <i>{t('record_summary.no_value')}</i>\n ),\n },\n ],\n },\n {\n key: globalValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FaLayerGroup /> {t('record_summary.global')}\n </span>\n <KitBadge count={stripedGlobalValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedGlobalValues.length > 0\n ? stripedGlobalValues.map((value, index) => ({\n key: `${globalValueKey}-${index}`,\n title: value,\n }))\n : [\n {\n key: `${globalValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n ]}\n />\n </InformationsWrapper>\n ),\n },\n {\n key: 'history',\n label: t('record_summary.history'),\n tabContent: <RecordHistory record={record} attributeId={attributeId} />,\n },\n ]}\n />\n </StyledDivContentWrapper>\n );\n};\n\nexport default ValuesSummary;\n"]}
|
|
1
|
+
{"version":3,"file":"ValuesSummary.js","sourceRoot":"","sources":["../../../../../src/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,aAAa,EAAC,MAAM,sCAAsC,CAAC;AAEnE,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAErC,CAA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ACI;gDACI,GAAG,EAAE,GAAG,kBAAkB,IAAI,CAAC,EAAE;gDACjC,KAAK,EAAE,sBAAI,CAAC,CAAC,yBAAyB,CAAC,GAAK;6CAC/C;yCACJ;iCACd;gCACD;oCACI,GAAG,EAAE,cAAc;oCACnB,KAAK,EAAE,CACH,eACI,KAAK,EAAE;4CACH,OAAO,EAAE,MAAM;4CACf,UAAU,EAAE,QAAQ;4CACpB,cAAc,EAAE,eAAe;yCAClC,aAED,2BACI,KAAC,YAAY,KAAG,OAAE,CAAC,CAAC,uBAAuB,CAAC,IACzC,EACP,KAAC,QAAQ,IAAC,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAC,SAAS,GAAG,IAC7D,CACT;oCACD,QAAQ,EACJ,mBAAmB,CAAC,MAAM,GAAG,CAAC;wCAC1B,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;4CACvC,GAAG,EAAE,GAAG,cAAc,IAAI,KAAK,EAAE;4CACjC,KAAK,EAAE,KAAK;yCACf,CAAC,CAAC;wCACL,CAAC,CAAC;4CACI;gDACI,GAAG,EAAE,GAAG,cAAc,IAAI,CAAC,EAAE;gDAC7B,KAAK,EAAE,sBAAI,CAAC,CAAC,yBAAyB,CAAC,GAAK;6CAC/C;yCACJ;iCACd;6BACJ,GACH,GACgB,CACzB;iBACJ;gBACD;oBACI,GAAG,EAAE,SAAS;oBACd,KAAK,EAAE,CAAC,CAAC,wBAAwB,CAAC;oBAClC,UAAU,EAAE,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAI;iBAC1E;aACJ,GACH,GACoB,CAC7B,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,aAAa,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} from 'react';\nimport {type RecordFormElementsValueStandardValue} from '_ui/hooks/useGetRecordForm';\nimport {KitBadge, KitTabs, KitTree} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {FaLayerGroup, FaSquareRootAlt} from 'react-icons/fa';\nimport styled from 'styled-components';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport {RecordHistory} from '../../../RecordHistory/RecordHistory';\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nconst StyledDivContentWrapper = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n`;\n\ninterface IValuesSummaryProps {\n record: IRecordIdentityWhoAmI | null;\n attributeId: string;\n globalValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n calculatedValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n}\n\nconst calculatedValueKey = '0';\nconst globalValueKey = '1';\n\n// https://stackoverflow.com/questions/822452/strip-html-tags-from-text-using-plain-javascript\nconst stripHtml = (html: string): string => {\n const doc = new DOMParser().parseFromString(html, 'text/html');\n return doc.body.textContent || '';\n};\n\nconst _isDateRangeValue = (value: any): value is {from: string; to: string} =>\n !!value && typeof value === 'object' && 'from' in value && 'to' in value;\n\nexport const ValuesSummary: FunctionComponent<IValuesSummaryProps> = ({\n record,\n attributeId,\n globalValues = [],\n calculatedValues = [],\n}) => {\n const {t} = useSharedTranslation();\n\n const stringifyValue = (value: RecordFormElementsValueStandardValue['payload']): string => {\n if (typeof value === 'string') {\n return stripHtml(value);\n }\n\n if (typeof value === 'boolean') {\n return value ? t('global.yes') : t('global.no');\n }\n\n if (_isDateRangeValue(value)) {\n return t('record_edition.date_range_value', {\n from: value.from,\n to: value.to,\n interpolation: {\n escapeValue: false,\n },\n });\n }\n\n return value;\n };\n\n const stripedGlobalValues = globalValues.map(stringifyValue);\n const stripedCalculatedValues = calculatedValues.map(stringifyValue);\n\n return (\n <StyledDivContentWrapper>\n <KitTabs\n items={[\n {\n key: 'version_values',\n label: t('record_summary.values_version'),\n tabContent: (\n <InformationsWrapper>\n <KitTree\n defaultExpandAll\n selectedKeys={\n calculatedValues.length > 0 && globalValues.length === 0\n ? [calculatedValueKey]\n : [globalValueKey]\n }\n treeData={[\n {\n key: calculatedValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FaSquareRootAlt /> {t('record_summary.calculated_value')}\n </span>\n <KitBadge count={stripedCalculatedValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedCalculatedValues.length > 0\n ? stripedCalculatedValues.map((calculatedValue, index) => ({\n key: `${calculatedValueKey}-${index}`,\n title: calculatedValue,\n }))\n : [\n {\n key: `${calculatedValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n {\n key: globalValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FaLayerGroup /> {t('record_summary.global')}\n </span>\n <KitBadge count={stripedGlobalValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedGlobalValues.length > 0\n ? stripedGlobalValues.map((value, index) => ({\n key: `${globalValueKey}-${index}`,\n title: value,\n }))\n : [\n {\n key: `${globalValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n ]}\n />\n </InformationsWrapper>\n ),\n },\n {\n key: 'history',\n label: t('record_summary.history'),\n tabContent: <RecordHistory record={record} attributeId={attributeId} />,\n },\n ]}\n />\n </StyledDivContentWrapper>\n );\n};\n\nexport default ValuesSummary;\n"]}
|
|
@@ -4,7 +4,7 @@ import { type RecordFormElementsValueLinkValue, type RecordFormElementsValueStan
|
|
|
4
4
|
export interface IRecordPropertyWithAttribute {
|
|
5
5
|
attribute: RecordFormAttributeFragment;
|
|
6
6
|
globalValues?: Array<RecordFormElementsValueStandardValue['payload']>;
|
|
7
|
-
|
|
7
|
+
calculatedValues?: Array<RecordFormElementsValueStandardValue['payload']>;
|
|
8
8
|
}
|
|
9
9
|
export declare const EditRecordSidebarContentTypeMap: {
|
|
10
10
|
readonly SUMMARY: "summary";
|
|
@@ -82,8 +82,9 @@ const editRecordReducer = (state, action) => {
|
|
|
82
82
|
}
|
|
83
83
|
return value?.payload;
|
|
84
84
|
}),
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
calculatedValues: action.values
|
|
86
|
+
?.filter(value => value.isCalculated || value.isInherited)
|
|
87
|
+
.map(calculatedOrInheritedValue => {
|
|
87
88
|
if (TypeGuards.isRecordFormElementsValuesLinkValue(calculatedOrInheritedValue)) {
|
|
88
89
|
return (calculatedOrInheritedValue.linkValue.whoAmI.label ??
|
|
89
90
|
calculatedOrInheritedValue.linkValue.whoAmI.id);
|
|
@@ -93,7 +94,7 @@ const editRecordReducer = (state, action) => {
|
|
|
93
94
|
calculatedOrInheritedValue.treeValue.record.whoAmI.id);
|
|
94
95
|
}
|
|
95
96
|
return calculatedOrInheritedValue?.payload;
|
|
96
|
-
})
|
|
97
|
+
}) ?? [],
|
|
97
98
|
},
|
|
98
99
|
sidebarContent: newSidebarContent,
|
|
99
100
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editRecordReducer.js","sourceRoot":"","sources":["../../../../src/components/RecordEdition/editRecordReducer/editRecordReducer.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,UAAU,EAAC,MAAM,uEAAuE,CAAC;AAQjG,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC3C,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,cAAc;IAC7B,eAAe,EAAE,gBAAgB;IACjC,IAAI,EAAE,MAAM;CACN,CAAC;AA0BX,MAAM,CAAN,IAAY,6BAcX;AAdD,WAAY,6BAA6B;IACrC,0DAAyB,CAAA;IACzB,wEAAuC,CAAA;IACvC,sEAAqC,CAAA;IACrC,0EAAyC,CAAA;IACzC,0EAAyC,CAAA;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EAAC,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,aAAa,IAAI,EAAE,CAAC,EAAE,GAAG,SAAS,EAAC;aAChF,CAAC;YAEF,OAAO,QAAQ,CAAC;QACpB,KAAK,6BAA6B,CAAC,qBAAqB;YACpD,OAAO,EAAC,GAAG,KAAK,EAAE,cAAc,EAAE,EAAC,GAAG,YAAY,CAAC,cAAc,EAAC,EAAC,CAAC;QACxE;YACI,OAAO,CAAC,IAAI,CAAC,2CAA2C,EAAE,MAAM,CAAC,CAAC;YAClE,OAAO,KAAK,CAAC;IACrB,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,iBAAiB,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 IRecordIdentityWhoAmI, type SystemTranslation, type IValueVersion} from '_ui/types';\nimport {\n type RecordFormAttributeFragment,\n type RecordUpdateSubscription,\n type ValueDetailsFragment,\n} from '_ui/_gqlTypes';\nimport {\n type RecordFormElementsValueLinkValue,\n type RecordFormElementsValueStandardValue,\n type RecordFormElementsValueTreeValue,\n} from '_ui/hooks/useGetRecordForm';\nimport {TypeGuards} from '_ui/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards';\n\nexport interface IRecordPropertyWithAttribute {\n attribute: RecordFormAttributeFragment;\n globalValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n calculatedValue?: RecordFormElementsValueStandardValue['payload'];\n}\n\nexport const EditRecordSidebarContentTypeMap = {\n SUMMARY: 'summary',\n VALUE_DETAILS: 'valueDetails',\n VALUES_VERSIONS: 'valuesVersions',\n NONE: 'none',\n} as const;\n\ntype EditRecordSidebarContentType =\n (typeof EditRecordSidebarContentTypeMap)[keyof typeof EditRecordSidebarContentTypeMap];\n\nexport interface IEditRecordReducerState {\n record: IRecordIdentityWhoAmI;\n libraryId: string;\n libraryLabel: SystemTranslation | null;\n activeAttribute: IRecordPropertyWithAttribute;\n sidebarContent: EditRecordSidebarContentType;\n enableSidebar: boolean;\n isOpenSidebar: boolean;\n sidebarDefaultHidden?: boolean;\n valuesVersion: IValueVersion;\n originValuesVersion: IValueVersion;\n refreshRequested: boolean;\n externalUpdate: {\n modifiers: IRecordIdentityWhoAmI[];\n updatedValues: {\n [attribute: string]: ValueDetailsFragment[];\n };\n };\n withInfoButton: boolean;\n}\n\nexport enum EditRecordReducerActionsTypes {\n SET_RECORD = 'SET_RECORD',\n SET_LIBRARY_LABEL = 'SET_LIBRARY_LABEL',\n SET_ACTIVE_VALUE = 'SET_ACTIVE_VALUE',\n INITIALIZE_SIDEBAR = 'INITIALIZE_SIDEBAR',\n SET_ENABLE_SIDEBAR = 'SET_ENABLE_SIDEBAR',\n SET_SIDEBAR_CONTENT = 'SET_SIDEBAR_CONTENT',\n SET_SIDEBAR_IS_OPEN = 'SET_SIDEBAR_IS_OPEN',\n SET_SIDEBAR_DEFAULT_HIDDEN = 'SET_SIDEBAR_DEFAULT_HIDDEN',\n SET_VALUES_VERSION = 'SET_VALUES_VERSION',\n REQUEST_REFRESH = 'REQUEST_REFRESH',\n REFRESH_DONE = 'REFRESH_DONE',\n ADD_EXTERNAL_UPDATE = 'ADD_EXTERNAL_UPDATE',\n CLEAR_EXTERNAL_UPDATE = 'CLEAR_EXTERNAL_UPDATE',\n}\n\nexport type IEditRecordReducerActions =\n | {\n type: EditRecordReducerActionsTypes.SET_RECORD;\n record: IEditRecordReducerState['record'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_LIBRARY_LABEL;\n label: SystemTranslation;\n }\n | {\n type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE;\n attribute?: IEditRecordReducerState['activeAttribute']['attribute'];\n values?:\n | RecordFormElementsValueStandardValue[]\n | RecordFormElementsValueLinkValue[]\n | RecordFormElementsValueTreeValue[];\n }\n | {\n type: EditRecordReducerActionsTypes.INITIALIZE_SIDEBAR;\n enabled: IEditRecordReducerState['enableSidebar'];\n isOpenByDefault: IEditRecordReducerState['sidebarDefaultHidden'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_ENABLE_SIDEBAR;\n enabled: IEditRecordReducerState['enableSidebar'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_SIDEBAR_IS_OPEN;\n isOpen: IEditRecordReducerState['isOpenSidebar'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_SIDEBAR_CONTENT;\n content: IEditRecordReducerState['sidebarContent'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_SIDEBAR_DEFAULT_HIDDEN;\n value: IEditRecordReducerState['sidebarDefaultHidden'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_VALUES_VERSION;\n valuesVersion: IEditRecordReducerState['valuesVersion'];\n }\n | {\n type: EditRecordReducerActionsTypes.REQUEST_REFRESH;\n }\n | {\n type: EditRecordReducerActionsTypes.REFRESH_DONE;\n }\n | {\n type: EditRecordReducerActionsTypes.ADD_EXTERNAL_UPDATE;\n modifier: IRecordIdentityWhoAmI;\n updatedValues: RecordUpdateSubscription['recordUpdate']['updatedValues'];\n }\n | {\n type: EditRecordReducerActionsTypes.CLEAR_EXTERNAL_UPDATE;\n };\n\nexport const initialState: IEditRecordReducerState = {\n record: null,\n libraryId: null,\n libraryLabel: null,\n activeAttribute: null,\n enableSidebar: false,\n isOpenSidebar: false,\n sidebarContent: EditRecordSidebarContentTypeMap.NONE,\n sidebarDefaultHidden: false,\n valuesVersion: null,\n originValuesVersion: null,\n refreshRequested: false,\n externalUpdate: {\n modifiers: [],\n updatedValues: {},\n },\n withInfoButton: false,\n};\n\nconst editRecordReducer = (\n state: IEditRecordReducerState,\n action: IEditRecordReducerActions,\n): IEditRecordReducerState => {\n switch (action.type) {\n case EditRecordReducerActionsTypes.SET_RECORD:\n return {...state, record: action.record};\n case EditRecordReducerActionsTypes.SET_LIBRARY_LABEL:\n return {...state, libraryLabel: action.label};\n case EditRecordReducerActionsTypes.INITIALIZE_SIDEBAR: {\n const {enabled, isOpenByDefault} = action;\n // If the sidebar is not enabled, don't check for isOpenByDefault\n const isOpen = enabled && isOpenByDefault;\n return {\n ...state,\n enableSidebar: enabled,\n sidebarDefaultHidden: !isOpenByDefault,\n sidebarContent: isOpen ? EditRecordSidebarContentTypeMap.SUMMARY : EditRecordSidebarContentTypeMap.NONE,\n isOpenSidebar: isOpen,\n };\n }\n case EditRecordReducerActionsTypes.SET_ENABLE_SIDEBAR:\n return {...state, enableSidebar: action.enabled};\n case EditRecordReducerActionsTypes.SET_SIDEBAR_DEFAULT_HIDDEN:\n return {...state, sidebarDefaultHidden: action.value};\n case EditRecordReducerActionsTypes.SET_ACTIVE_VALUE:\n const newSidebarContent =\n action.attribute !== null\n ? EditRecordSidebarContentTypeMap.VALUE_DETAILS\n : state.sidebarDefaultHidden\n ? EditRecordSidebarContentTypeMap.NONE\n : EditRecordSidebarContentTypeMap.SUMMARY;\n return {\n ...state,\n activeAttribute: {\n attribute: action.attribute ?? state.activeAttribute?.attribute ?? null,\n globalValues: action.values\n ?.filter(value => !value.isCalculated && !value.isInherited)\n .map(value => {\n if (TypeGuards.isRecordFormElementsValuesLinkValue(value)) {\n return value.linkValue.whoAmI.label ?? value.linkValue.whoAmI.id;\n }\n\n if (TypeGuards.isRecordFormElementsValuesTreeValue(value)) {\n return value.treeValue.record.whoAmI.label ?? value.treeValue.record.whoAmI.id;\n }\n\n return value?.payload;\n }),\n calculatedValue: (() => {\n const calculatedOrInheritedValue = action.values?.filter(\n value => value.isCalculated || value.isInherited,\n )?.[0];\n\n if (TypeGuards.isRecordFormElementsValuesLinkValue(calculatedOrInheritedValue)) {\n return (\n calculatedOrInheritedValue.linkValue.whoAmI.label ??\n calculatedOrInheritedValue.linkValue.whoAmI.id\n );\n }\n\n if (TypeGuards.isRecordFormElementsValuesTreeValue(calculatedOrInheritedValue)) {\n return (\n calculatedOrInheritedValue.treeValue.record.whoAmI.label ??\n calculatedOrInheritedValue.treeValue.record.whoAmI.id\n );\n }\n\n return calculatedOrInheritedValue?.payload;\n })(),\n },\n sidebarContent: newSidebarContent,\n };\n case EditRecordReducerActionsTypes.SET_SIDEBAR_CONTENT:\n return {...state, sidebarContent: action.content};\n case EditRecordReducerActionsTypes.SET_SIDEBAR_IS_OPEN:\n return {\n ...state,\n sidebarContent: action.isOpen\n ? EditRecordSidebarContentTypeMap.SUMMARY\n : EditRecordSidebarContentTypeMap.NONE,\n isOpenSidebar: action.isOpen,\n };\n case EditRecordReducerActionsTypes.SET_VALUES_VERSION:\n return {...state, valuesVersion: action.valuesVersion};\n case EditRecordReducerActionsTypes.REQUEST_REFRESH:\n return {...state, refreshRequested: true};\n case EditRecordReducerActionsTypes.REFRESH_DONE:\n return {...state, refreshRequested: false};\n case EditRecordReducerActionsTypes.ADD_EXTERNAL_UPDATE:\n const newState = {...state};\n const newModifiers = state.externalUpdate?.modifiers.find(({id}) => id === action.modifier.id)\n ? (newState.externalUpdate?.modifiers ?? [])\n : [...(newState.externalUpdate?.modifiers ?? []), action.modifier];\n\n const newValues = action.updatedValues.reduce(\n (acc, updatedValue) => ({\n ...acc,\n [updatedValue.attribute]: [\n ...(newState.externalUpdate?.[updatedValue.attribute] ?? []),\n updatedValue.value,\n ],\n }),\n {},\n );\n\n newState.externalUpdate = {\n modifiers: newModifiers,\n updatedValues: {...(state.externalUpdate?.updatedValues ?? {}), ...newValues},\n };\n\n return newState;\n case EditRecordReducerActionsTypes.CLEAR_EXTERNAL_UPDATE:\n return {...state, externalUpdate: {...initialState.externalUpdate}};\n default:\n console.warn('Unknown action type in editRecordReducer:', action);\n return state;\n }\n};\n\nexport default editRecordReducer;\n"]}
|
|
1
|
+
{"version":3,"file":"editRecordReducer.js","sourceRoot":"","sources":["../../../../src/components/RecordEdition/editRecordReducer/editRecordReducer.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,UAAU,EAAC,MAAM,uEAAuE,CAAC;AAQjG,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC3C,OAAO,EAAE,S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AAG,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;oBAC5D,YAAY,CAAC,KAAK;iBACrB;aACJ,CAAC,EACF,EAAE,CACL,CAAC;YAEF,QAAQ,CAAC,cAAc,GAAG;gBACtB,SAAS,EAAE,YAAY;gBACvB,aAAa,EAAE,EAAC,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,aAAa,IAAI,EAAE,CAAC,EAAE,GAAG,SAAS,EAAC;aAChF,CAAC;YAEF,OAAO,QAAQ,CAAC;QACpB,KAAK,6BAA6B,CAAC,qBAAqB;YACpD,OAAO,EAAC,GAAG,KAAK,EAAE,cAAc,EAAE,EAAC,GAAG,YAAY,CAAC,cAAc,EAAC,EAAC,CAAC;QACxE;YACI,OAAO,CAAC,IAAI,CAAC,2CAA2C,EAAE,MAAM,CAAC,CAAC;YAClE,OAAO,KAAK,CAAC;IACrB,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,iBAAiB,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 IRecordIdentityWhoAmI, type SystemTranslation, type IValueVersion} from '_ui/types';\nimport {\n type RecordFormAttributeFragment,\n type RecordUpdateSubscription,\n type ValueDetailsFragment,\n} from '_ui/_gqlTypes';\nimport {\n type RecordFormElementsValueLinkValue,\n type RecordFormElementsValueStandardValue,\n type RecordFormElementsValueTreeValue,\n} from '_ui/hooks/useGetRecordForm';\nimport {TypeGuards} from '_ui/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards';\n\nexport interface IRecordPropertyWithAttribute {\n attribute: RecordFormAttributeFragment;\n globalValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n calculatedValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n}\n\nexport const EditRecordSidebarContentTypeMap = {\n SUMMARY: 'summary',\n VALUE_DETAILS: 'valueDetails',\n VALUES_VERSIONS: 'valuesVersions',\n NONE: 'none',\n} as const;\n\ntype EditRecordSidebarContentType =\n (typeof EditRecordSidebarContentTypeMap)[keyof typeof EditRecordSidebarContentTypeMap];\n\nexport interface IEditRecordReducerState {\n record: IRecordIdentityWhoAmI;\n libraryId: string;\n libraryLabel: SystemTranslation | null;\n activeAttribute: IRecordPropertyWithAttribute;\n sidebarContent: EditRecordSidebarContentType;\n enableSidebar: boolean;\n isOpenSidebar: boolean;\n sidebarDefaultHidden?: boolean;\n valuesVersion: IValueVersion;\n originValuesVersion: IValueVersion;\n refreshRequested: boolean;\n externalUpdate: {\n modifiers: IRecordIdentityWhoAmI[];\n updatedValues: {\n [attribute: string]: ValueDetailsFragment[];\n };\n };\n withInfoButton: boolean;\n}\n\nexport enum EditRecordReducerActionsTypes {\n SET_RECORD = 'SET_RECORD',\n SET_LIBRARY_LABEL = 'SET_LIBRARY_LABEL',\n SET_ACTIVE_VALUE = 'SET_ACTIVE_VALUE',\n INITIALIZE_SIDEBAR = 'INITIALIZE_SIDEBAR',\n SET_ENABLE_SIDEBAR = 'SET_ENABLE_SIDEBAR',\n SET_SIDEBAR_CONTENT = 'SET_SIDEBAR_CONTENT',\n SET_SIDEBAR_IS_OPEN = 'SET_SIDEBAR_IS_OPEN',\n SET_SIDEBAR_DEFAULT_HIDDEN = 'SET_SIDEBAR_DEFAULT_HIDDEN',\n SET_VALUES_VERSION = 'SET_VALUES_VERSION',\n REQUEST_REFRESH = 'REQUEST_REFRESH',\n REFRESH_DONE = 'REFRESH_DONE',\n ADD_EXTERNAL_UPDATE = 'ADD_EXTERNAL_UPDATE',\n CLEAR_EXTERNAL_UPDATE = 'CLEAR_EXTERNAL_UPDATE',\n}\n\nexport type IEditRecordReducerActions =\n | {\n type: EditRecordReducerActionsTypes.SET_RECORD;\n record: IEditRecordReducerState['record'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_LIBRARY_LABEL;\n label: SystemTranslation;\n }\n | {\n type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE;\n attribute?: IEditRecordReducerState['activeAttribute']['attribute'];\n values?:\n | RecordFormElementsValueStandardValue[]\n | RecordFormElementsValueLinkValue[]\n | RecordFormElementsValueTreeValue[];\n }\n | {\n type: EditRecordReducerActionsTypes.INITIALIZE_SIDEBAR;\n enabled: IEditRecordReducerState['enableSidebar'];\n isOpenByDefault: IEditRecordReducerState['sidebarDefaultHidden'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_ENABLE_SIDEBAR;\n enabled: IEditRecordReducerState['enableSidebar'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_SIDEBAR_IS_OPEN;\n isOpen: IEditRecordReducerState['isOpenSidebar'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_SIDEBAR_CONTENT;\n content: IEditRecordReducerState['sidebarContent'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_SIDEBAR_DEFAULT_HIDDEN;\n value: IEditRecordReducerState['sidebarDefaultHidden'];\n }\n | {\n type: EditRecordReducerActionsTypes.SET_VALUES_VERSION;\n valuesVersion: IEditRecordReducerState['valuesVersion'];\n }\n | {\n type: EditRecordReducerActionsTypes.REQUEST_REFRESH;\n }\n | {\n type: EditRecordReducerActionsTypes.REFRESH_DONE;\n }\n | {\n type: EditRecordReducerActionsTypes.ADD_EXTERNAL_UPDATE;\n modifier: IRecordIdentityWhoAmI;\n updatedValues: RecordUpdateSubscription['recordUpdate']['updatedValues'];\n }\n | {\n type: EditRecordReducerActionsTypes.CLEAR_EXTERNAL_UPDATE;\n };\n\nexport const initialState: IEditRecordReducerState = {\n record: null,\n libraryId: null,\n libraryLabel: null,\n activeAttribute: null,\n enableSidebar: false,\n isOpenSidebar: false,\n sidebarContent: EditRecordSidebarContentTypeMap.NONE,\n sidebarDefaultHidden: false,\n valuesVersion: null,\n originValuesVersion: null,\n refreshRequested: false,\n externalUpdate: {\n modifiers: [],\n updatedValues: {},\n },\n withInfoButton: false,\n};\n\nconst editRecordReducer = (\n state: IEditRecordReducerState,\n action: IEditRecordReducerActions,\n): IEditRecordReducerState => {\n switch (action.type) {\n case EditRecordReducerActionsTypes.SET_RECORD:\n return {...state, record: action.record};\n case EditRecordReducerActionsTypes.SET_LIBRARY_LABEL:\n return {...state, libraryLabel: action.label};\n case EditRecordReducerActionsTypes.INITIALIZE_SIDEBAR: {\n const {enabled, isOpenByDefault} = action;\n // If the sidebar is not enabled, don't check for isOpenByDefault\n const isOpen = enabled && isOpenByDefault;\n return {\n ...state,\n enableSidebar: enabled,\n sidebarDefaultHidden: !isOpenByDefault,\n sidebarContent: isOpen ? EditRecordSidebarContentTypeMap.SUMMARY : EditRecordSidebarContentTypeMap.NONE,\n isOpenSidebar: isOpen,\n };\n }\n case EditRecordReducerActionsTypes.SET_ENABLE_SIDEBAR:\n return {...state, enableSidebar: action.enabled};\n case EditRecordReducerActionsTypes.SET_SIDEBAR_DEFAULT_HIDDEN:\n return {...state, sidebarDefaultHidden: action.value};\n case EditRecordReducerActionsTypes.SET_ACTIVE_VALUE:\n const newSidebarContent =\n action.attribute !== null\n ? EditRecordSidebarContentTypeMap.VALUE_DETAILS\n : state.sidebarDefaultHidden\n ? EditRecordSidebarContentTypeMap.NONE\n : EditRecordSidebarContentTypeMap.SUMMARY;\n return {\n ...state,\n activeAttribute: {\n attribute: action.attribute ?? state.activeAttribute?.attribute ?? null,\n globalValues: action.values\n ?.filter(value => !value.isCalculated && !value.isInherited)\n .map(value => {\n if (TypeGuards.isRecordFormElementsValuesLinkValue(value)) {\n return value.linkValue.whoAmI.label ?? value.linkValue.whoAmI.id;\n }\n\n if (TypeGuards.isRecordFormElementsValuesTreeValue(value)) {\n return value.treeValue.record.whoAmI.label ?? value.treeValue.record.whoAmI.id;\n }\n\n return value?.payload;\n }),\n calculatedValues:\n action.values\n ?.filter(value => value.isCalculated || value.isInherited)\n .map(calculatedOrInheritedValue => {\n if (TypeGuards.isRecordFormElementsValuesLinkValue(calculatedOrInheritedValue)) {\n return (\n calculatedOrInheritedValue.linkValue.whoAmI.label ??\n calculatedOrInheritedValue.linkValue.whoAmI.id\n );\n }\n\n if (TypeGuards.isRecordFormElementsValuesTreeValue(calculatedOrInheritedValue)) {\n return (\n calculatedOrInheritedValue.treeValue.record.whoAmI.label ??\n calculatedOrInheritedValue.treeValue.record.whoAmI.id\n );\n }\n\n return calculatedOrInheritedValue?.payload;\n }) ?? [],\n },\n sidebarContent: newSidebarContent,\n };\n case EditRecordReducerActionsTypes.SET_SIDEBAR_CONTENT:\n return {...state, sidebarContent: action.content};\n case EditRecordReducerActionsTypes.SET_SIDEBAR_IS_OPEN:\n return {\n ...state,\n sidebarContent: action.isOpen\n ? EditRecordSidebarContentTypeMap.SUMMARY\n : EditRecordSidebarContentTypeMap.NONE,\n isOpenSidebar: action.isOpen,\n };\n case EditRecordReducerActionsTypes.SET_VALUES_VERSION:\n return {...state, valuesVersion: action.valuesVersion};\n case EditRecordReducerActionsTypes.REQUEST_REFRESH:\n return {...state, refreshRequested: true};\n case EditRecordReducerActionsTypes.REFRESH_DONE:\n return {...state, refreshRequested: false};\n case EditRecordReducerActionsTypes.ADD_EXTERNAL_UPDATE:\n const newState = {...state};\n const newModifiers = state.externalUpdate?.modifiers.find(({id}) => id === action.modifier.id)\n ? (newState.externalUpdate?.modifiers ?? [])\n : [...(newState.externalUpdate?.modifiers ?? []), action.modifier];\n\n const newValues = action.updatedValues.reduce(\n (acc, updatedValue) => ({\n ...acc,\n [updatedValue.attribute]: [\n ...(newState.externalUpdate?.[updatedValue.attribute] ?? []),\n updatedValue.value,\n ],\n }),\n {},\n );\n\n newState.externalUpdate = {\n modifiers: newModifiers,\n updatedValues: {...(state.externalUpdate?.updatedValues ?? {}), ...newValues},\n };\n\n return newState;\n case EditRecordReducerActionsTypes.CLEAR_EXTERNAL_UPDATE:\n return {...state, externalUpdate: {...initialState.externalUpdate}};\n default:\n console.warn('Unknown action type in editRecordReducer:', action);\n return state;\n }\n};\n\nexport default editRecordReducer;\n"]}
|
|
@@ -16,18 +16,21 @@ export declare const ExplorerPropsSchema: z.ZodObject<{
|
|
|
16
16
|
noPagination: z.ZodOptional<z.ZodLiteral<true>>;
|
|
17
17
|
showActionsLabels: z.ZodOptional<z.ZodBoolean>;
|
|
18
18
|
defaultPrimaryActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"create">]>>>;
|
|
19
|
-
defaultMassActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"deactivate">, z.ZodLiteral<"export">]>>>;
|
|
19
|
+
defaultMassActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"deactivate">, z.ZodLiteral<"export">, z.ZodLiteral<"editAttribute">]>>>;
|
|
20
20
|
defaultActionsForItem: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"replaceLink">, z.ZodLiteral<"remove">, z.ZodLiteral<"activate">]>>>;
|
|
21
21
|
}, z.core.$strip>;
|
|
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>;
|
|
@@ -66,12 +72,13 @@ export declare const attributeExplorerPanelSchema: z.ZodObject<{
|
|
|
66
72
|
noPagination: z.ZodOptional<z.ZodLiteral<true>>;
|
|
67
73
|
showActionsLabels: z.ZodOptional<z.ZodBoolean>;
|
|
68
74
|
defaultPrimaryActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"create">]>>>;
|
|
69
|
-
defaultMassActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"deactivate">, z.ZodLiteral<"export">]>>>;
|
|
75
|
+
defaultMassActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"deactivate">, z.ZodLiteral<"export">, z.ZodLiteral<"editAttribute">]>>>;
|
|
70
76
|
defaultActionsForItem: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"replaceLink">, z.ZodLiteral<"remove">, z.ZodLiteral<"activate">]>>>;
|
|
71
77
|
}, z.core.$strip>>;
|
|
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>;
|
|
@@ -98,7 +107,7 @@ export declare const PanelSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
98
107
|
noPagination: z.ZodOptional<z.ZodLiteral<true>>;
|
|
99
108
|
showActionsLabels: z.ZodOptional<z.ZodBoolean>;
|
|
100
109
|
defaultPrimaryActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"create">]>>>;
|
|
101
|
-
defaultMassActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"deactivate">, z.ZodLiteral<"export">]>>>;
|
|
110
|
+
defaultMassActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"deactivate">, z.ZodLiteral<"export">, z.ZodLiteral<"editAttribute">]>>>;
|
|
102
111
|
defaultActionsForItem: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"replaceLink">, z.ZodLiteral<"remove">, z.ZodLiteral<"activate">]>>>;
|
|
103
112
|
}, z.core.$strip>>;
|
|
104
113
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -112,7 +121,7 @@ export declare const PanelSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
112
121
|
noPagination: z.ZodOptional<z.ZodLiteral<true>>;
|
|
113
122
|
showActionsLabels: z.ZodOptional<z.ZodBoolean>;
|
|
114
123
|
defaultPrimaryActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"create">]>>>;
|
|
115
|
-
defaultMassActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"deactivate">, z.ZodLiteral<"export">]>>>;
|
|
124
|
+
defaultMassActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"deactivate">, z.ZodLiteral<"export">, z.ZodLiteral<"editAttribute">]>>>;
|
|
116
125
|
defaultActionsForItem: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"replaceLink">, z.ZodLiteral<"remove">, z.ZodLiteral<"activate">]>>>;
|
|
117
126
|
}, z.core.$strip>>;
|
|
118
127
|
}, z.core.$strip>]>>, z.ZodObject<{
|
|
@@ -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>;
|
|
@@ -19,7 +19,9 @@ export const ExplorerPropsSchema = z.object({
|
|
|
19
19
|
noPagination: z.literal(true).optional(),
|
|
20
20
|
showActionsLabels: z.boolean().optional(),
|
|
21
21
|
defaultPrimaryActions: z.array(z.union([z.literal('create')])).optional(),
|
|
22
|
-
defaultMassActions: z
|
|
22
|
+
defaultMassActions: z
|
|
23
|
+
.array(z.union([z.literal('deactivate'), z.literal('export'), z.literal('editAttribute')]))
|
|
24
|
+
.optional(),
|
|
23
25
|
defaultActionsForItem: z
|
|
24
26
|
.array(z.union([z.literal('replaceLink'), z.literal('remove'), z.literal('activate')]))
|
|
25
27
|
.optional(),
|
|
@@ -28,6 +30,8 @@ export const ItemActionsSchema = z
|
|
|
28
30
|
.array(z.object({
|
|
29
31
|
where: WhereSchema,
|
|
30
32
|
what: z.literal('record'),
|
|
33
|
+
targetPanelId: PanelIdSchema.optional(),
|
|
34
|
+
targetFlapPanelId: FlapPanelIdSchema.optional(),
|
|
31
35
|
icon: FontAwesomeIconSchema,
|
|
32
36
|
label: z.record(LanguageSchema, z.string()),
|
|
33
37
|
onRowClick: z.boolean().optional(),
|
|
@@ -37,6 +41,7 @@ export const ItemActionsSchema = z
|
|
|
37
41
|
});
|
|
38
42
|
export const basePanelSchema = z.object({
|
|
39
43
|
id: PanelIdSchema,
|
|
44
|
+
icon: FontAwesomeIconSchema,
|
|
40
45
|
name: z.record(LanguageSchema, z.string()).optional(),
|
|
41
46
|
isStandalone: z.boolean().optional(),
|
|
42
47
|
hideInSlider: z.boolean().optional(),
|
|
@@ -54,6 +59,7 @@ export const creationPanelSchema = z.object({
|
|
|
54
59
|
type: z.literal('creationForm'),
|
|
55
60
|
formId: z.string(),
|
|
56
61
|
attributeSource: z.string(),
|
|
62
|
+
isStandalone: z.literal(true),
|
|
57
63
|
});
|
|
58
64
|
export const baseExplorerPanelSchema = z.object({
|
|
59
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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AAC,MAAM,CAAC;IACjD,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,SAAS,EAAE,eAAe;IAC1B,aAAa,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,aAAa,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,GAAG,CACnD,CAAC,CAAC,KAAK,CAAC,CAAC,4BAA4B,EAAE,0BAA0B,CAAC,CAAC,CACtE,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,GAAG,CAC1C,CAAC,CAAC,KAAK,CAAC,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,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"]}
|
|
@@ -746,14 +746,27 @@
|
|
|
746
746
|
"deactivate": "Deactivate",
|
|
747
747
|
"deactivate_message": "Elements deleted",
|
|
748
748
|
"deactivate_description": "{{count, number}}/{{total, number}} element for which you have permissions have been deleted. Others remain unchanged.",
|
|
749
|
+
"editAttribute": "Edit an attribute",
|
|
750
|
+
"editAttribute_description_one": "{{count, number}} element will be updated.",
|
|
751
|
+
"editAttribute_description_other": "{{total, number}} elements will be updated.",
|
|
752
|
+
"editAttribute_attribute_select_title": "Attribute to edit",
|
|
753
|
+
"editAttribute_attribute_select_placeholder": "Select an attribute",
|
|
754
|
+
"editAttribute_value_select_placeholder": "Select a value",
|
|
755
|
+
"editAttribute_value_occurrences_to_edit_one": "{{count, number}} element to edit",
|
|
756
|
+
"editAttribute_value_occurrences_to_edit_other": "{{count, number}} elements to edit",
|
|
757
|
+
"editAttribute_value_undefined": "Undefined",
|
|
758
|
+
"editAttribute_submit_notification_title": "Bulk edit request",
|
|
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
|
+
"editAttribute_submit_error": "An error occurred while requesting a bulk edit. Please contact an administrator.",
|
|
749
761
|
"export": "Export",
|
|
750
|
-
"
|
|
751
|
-
"
|
|
752
|
-
"
|
|
753
|
-
"
|
|
754
|
-
"export_error_description_one": "An error occurred while exporting the selected record.",
|
|
755
|
-
"export_error_description_other": "An error occurred while exporting the selected records.",
|
|
756
|
-
"
|
|
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.",
|
|
757
770
|
"add-link": "Add",
|
|
758
771
|
"replace-link": "Replace",
|
|
759
772
|
"toggle_selection": {
|
|
@@ -746,14 +746,27 @@
|
|
|
746
746
|
"deactivate": "Supprimer",
|
|
747
747
|
"deactivate_message": "Élements supprimés",
|
|
748
748
|
"deactivate_description": "{{count, number}}/{{total, number}} éléments pour lesquels vous disposez des permissions nécessaires ont été supprimés. Les autres éléments restent inchangés.",
|
|
749
|
+
"editAttribute": "Modifier un attribut",
|
|
750
|
+
"editAttribute_description_one": "{{count, number}} élément à modifier",
|
|
751
|
+
"editAttribute_description_other": "{{count, number}} éléments à modifier",
|
|
752
|
+
"editAttribute_attribute_select_title": "Attribut à modifier",
|
|
753
|
+
"editAttribute_attribute_select_placeholder": "Sélectionnez un attribut",
|
|
754
|
+
"editAttribute_value_select_placeholder": "Sélectionnez une valeur",
|
|
755
|
+
"editAttribute_value_occurrences_to_edit_one": "{{count, number}} élément à traiter",
|
|
756
|
+
"editAttribute_value_occurrences_to_edit_other": "{{count, number}} éléments à traiter",
|
|
757
|
+
"editAttribute_value_undefined": "Non défini",
|
|
758
|
+
"editAttribute_submit_notification_title": "Demande de modification en masse",
|
|
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
|
+
"editAttribute_submit_error": "Une erreur est survenue lors de la demande d'une modification en masse. Veuillez contacter un administrateur.",
|
|
749
761
|
"export": "Exporter",
|
|
750
|
-
"
|
|
751
|
-
"
|
|
752
|
-
"
|
|
753
|
-
"
|
|
754
|
-
"export_error_description_one": "Une erreur s'est produite lors de l'
|
|
755
|
-
"export_error_description_other": "Une erreur s'est produite lors de l'
|
|
756
|
-
"
|
|
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.",
|
|
757
770
|
"add-link": "Ajouter",
|
|
758
771
|
"replace-link": "Remplacer",
|
|
759
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-36ba391b",
|
|
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",
|