@topconsultnpm/sdkui-react-beta 6.15.82 → 6.15.84

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.
@@ -26,7 +26,7 @@ export var AdvancedMenuButtons;
26
26
  AdvancedMenuButtons[AdvancedMenuButtons["FormulaEditor"] = 2] = "FormulaEditor";
27
27
  AdvancedMenuButtons[AdvancedMenuButtons["DistinctValues"] = 3] = "DistinctValues";
28
28
  })(AdvancedMenuButtons || (AdvancedMenuButtons = {}));
29
- const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerms = true, isReadOnly = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, customMenuItems = [], showNullValueCheckBoxes, isOpenDistinctValues = false, openChooserBySingleClick, selectedMID, onFocusedItemChanged, layoutMode = LayoutModes.Update, metadataValues = [], metadataValuesOrig = [], TID, onValueChanged, onAdvancedMenuClick, validationItems }) => {
29
+ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerms = true, isReadOnly = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, customMenuItems = [], showNullValueCheckBoxes, isOpenDistinctValues = false, openChooserBySingleClick, selectedMID, onFocusedItemChanged, layoutMode = LayoutModes.Update, metadataValues = [], metadataValuesOrig = [], TID, onValueChanged, onAdvancedMenuClick, validationItems, inputMids = [] }) => {
30
30
  const [dynDataListsToBeRefreshed, setDynDataListsToBeRefreshed] = useState([]);
31
31
  const [currentDTD, setCurrentDTD] = useState();
32
32
  const [isEditableList, addOrRemoveEditableList] = useMetadataEditableList();
@@ -93,6 +93,22 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
93
93
  setDynDataListsToBeRefreshed(result);
94
94
  });
95
95
  }, [metadataValues, currentDTD]);
96
+ // Process inputMids to set values for specific metadata items
97
+ useEffect(() => {
98
+ if (!inputMids || inputMids.length === 0)
99
+ return;
100
+ if (!metadataValues || metadataValues.length === 0)
101
+ return;
102
+ // Process each inputMid and apply the values using onChangeHandler
103
+ inputMids.forEach(inputMid => {
104
+ // Check if this mid exists in the current metadata values
105
+ const existingMetadata = metadataValues.find(mv => mv.mid === inputMid.mid);
106
+ if (existingMetadata) {
107
+ // Apply the value using onChangeHandler
108
+ onChangeHandler(inputMid.value, inputMid.mid);
109
+ }
110
+ });
111
+ }, [inputMids, metadataValues]); // Run when inputMids or metadataValues change
96
112
  const loadDynDataListToBeRefreshedCascadeAsync = async (tid, mvdList) => {
97
113
  if (!tid)
98
114
  return [];
@@ -4,6 +4,10 @@ interface ITMArchiveProps {
4
4
  inputFile?: File | null;
5
5
  connectorFileSave?: () => Promise<File>;
6
6
  onSavedAsyncCallback?: (tid: number | undefined, did: number | undefined) => Promise<void>;
7
+ inputMids?: Array<{
8
+ mid: number;
9
+ value: string;
10
+ }>;
7
11
  }
8
12
  declare const TMArchive: React.FunctionComponent<ITMArchiveProps>;
9
13
  export default TMArchive;
@@ -12,7 +12,7 @@ import TMTreeSelector from '../search/TMTreeSelector';
12
12
  import TMPanel from '../../base/TMPanel';
13
13
  import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
14
14
  import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
15
- const TMArchive = ({ inputTID, inputFile = null, connectorFileSave = undefined, onSavedAsyncCallback }) => {
15
+ const TMArchive = ({ inputTID, inputFile = null, connectorFileSave = undefined, onSavedAsyncCallback, inputMids = [] }) => {
16
16
  const [currentTID, setCurrentTID] = useState(0);
17
17
  const [mruTIDs, setMruTIDs] = useState([]);
18
18
  const [currentMruTID, setCurrentMruTID] = useState(0);
@@ -49,9 +49,9 @@ const TMArchive = ({ inputTID, inputFile = null, connectorFileSave = undefined,
49
49
  setMruTIDs(newMruTIDS);
50
50
  } }), [mruTIDs, currentMruTID, deviceType]);
51
51
  const tmFormElement = useMemo(() => currentTID ?
52
- _jsx(TMDcmtForm, { TID: currentTID, DID: undefined, groupId: 'tmForm', layoutMode: LayoutModes.Ark, onClose: deviceType === DeviceType.MOBILE ? () => setCurrentTID(undefined) : undefined, onSaveRecents: (TIDs) => setMruTIDs(TIDs), showDcmtFormSidebar: false, inputFile: inputFile, connectorFileSave: connectorFileSave, onSavedAsyncCallback: onSavedAsyncCallback })
52
+ _jsx(TMDcmtForm, { TID: currentTID, DID: undefined, groupId: 'tmForm', layoutMode: LayoutModes.Ark, onClose: deviceType === DeviceType.MOBILE ? () => setCurrentTID(undefined) : undefined, onSaveRecents: (TIDs) => setMruTIDs(TIDs), showDcmtFormSidebar: false, inputFile: inputFile, connectorFileSave: connectorFileSave, onSavedAsyncCallback: onSavedAsyncCallback, inputMids: inputMids })
53
53
  :
54
- _jsx(TMPanel, { title: 'Archiviazione', allowMaximize: false, children: _jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsx(StyledToppyTextContainer, { children: _jsx(StyledToppyText, { children: SDKUI_Localizator.DcmtTypeSelect }) }), _jsx(StyledToppyImage, { src: Logo, alt: 'Toppy' })] }) }), [currentTID, deviceType, mruTIDs, inputFile]);
54
+ _jsx(TMPanel, { title: 'Archiviazione', allowMaximize: false, children: _jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsx(StyledToppyTextContainer, { children: _jsx(StyledToppyText, { children: SDKUI_Localizator.DcmtTypeSelect }) }), _jsx(StyledToppyImage, { src: Logo, alt: 'Toppy' })] }) }), [currentTID, deviceType, mruTIDs, inputFile, inputMids]);
55
55
  const allInitialPanelVisibility = {
56
56
  'tmTreeSelector': true,
57
57
  'tmRecentsManager': true,
@@ -34,6 +34,10 @@ interface ITMDcmtFormProps {
34
34
  widthModal?: string;
35
35
  heightModal?: string;
36
36
  inputFile?: File | null;
37
+ inputMids?: Array<{
38
+ mid: number;
39
+ value: string;
40
+ }>;
37
41
  }
38
42
  declare const TMDcmtForm: React.FC<ITMDcmtFormProps>;
39
43
  export default TMDcmtForm;
@@ -35,7 +35,7 @@ import ToppyHelpCenter from '../assistant/ToppyHelpCenter';
35
35
  import TMBlogCommentForm from '../blog/TMBlogCommentForm';
36
36
  let abortControllerLocal = new AbortController();
37
37
  //#endregion
38
- const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtFormSidebar = true, invokedByTodo = false, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, }) => {
38
+ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtFormSidebar = true, invokedByTodo = false, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, inputMids = [], }) => {
39
39
  const [id, setID] = useState('');
40
40
  const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
41
41
  const [waitPanelTitleLocal, setWaitPanelTitleLocal] = useState('');
@@ -474,7 +474,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
474
474
  setShowAll(true);
475
475
  }, [isApprView, TID]);
476
476
  const tmDcmtForm = useMemo(() => _jsx(_Fragment, { children: metadataValuesSource.length > 0 &&
477
- _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
477
+ _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
478
478
  setFormData((prevItems) => prevItems.map((item) => {
479
479
  const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
480
480
  return newItem ? { ...item, ...newItem } : item;
@@ -489,9 +489,9 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
489
489
  break;
490
490
  }
491
491
  } }), _jsxs(StyledFormButtonsContainer, { children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, children: _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: layoutMode === LayoutModes.Update ? _jsxs(_Fragment, { children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: isModified, formMode: formMode, errorsCount: validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length, onSaveAsync: confirmActionPopup }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: formMode, onUndo: onUndoHandler })] }) :
492
- _jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: confirmActionPopup }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: clearFormHandler }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: SDKUI_Localizator.Undo, advancedColor: TMColors.tertiary, onClick: onUndoHandler })] }) }) }), totalItems > listMaxItems && !isApprView && TID !== SystemTIDs.Drafts && _jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] }), _jsx(ConfirmAttachmentsDialog, {})] }) }), [TID, DID, formData, formDataOrig, dcmtFile, focusedMetadataValue, isOpenDistinctValues, isOpenFormulaEditor, validationItems, showAll, inputFile]);
492
+ _jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: confirmActionPopup }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: clearFormHandler }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: SDKUI_Localizator.Undo, advancedColor: TMColors.tertiary, onClick: onUndoHandler })] }) }) }), totalItems > listMaxItems && !isApprView && TID !== SystemTIDs.Drafts && _jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] }), _jsx(ConfirmAttachmentsDialog, {})] }) }), [TID, DID, formData, formDataOrig, dcmtFile, focusedMetadataValue, isOpenDistinctValues, isOpenFormulaEditor, validationItems, showAll, inputFile, inputMids]);
493
493
  const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID }), [TID, DID]);
494
- const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] }), [TID, layoutMode, formData, deviceType]);
494
+ const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [], inputMids: inputMids }), [TID, layoutMode, formData, deviceType, inputMids]);
495
495
  const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, fromDTD: fromDTD, layoutMode: layoutMode, onFileUpload: (setFile) => {
496
496
  setDcmtFile(setFile);
497
497
  } }), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile]);
@@ -86,8 +86,8 @@ const TMChooserForm = ({ children, title, allowMultipleSelection = false, allowA
86
86
  ...summaryItems ?? {}
87
87
  });
88
88
  }, [manageUseLocalizedName, summaryItems]);
89
- return (_jsx(TMModal, { title: renderTitle(), width: width ?? '550px', height: height ?? '600px', toolbar: _jsx(ToolbarButtons, {}), onClose: onClose, children: (children ??
90
- filteredItems.length > 0)
89
+ return (_jsx(TMModal, { title: renderTitle(), width: width ?? '550px', height: height ?? '600px', toolbar: _jsx(ToolbarButtons, {}), onClose: onClose, children: children ??
90
+ filteredItems.length > 0
91
91
  ? _jsx(TMDataGrid, { dataSource: filteredItems, keyExpr: keyName, dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, headerFilter: { visible: true }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single', showCheckBoxesMode: 'always', selectAllMode: 'allPages' }, grouping: allowGrouping ? { autoExpandAll: false, expandMode: 'rowClick' } : undefined, summary: customSummary, onFocusedRowChanged: handleFocusedRowChange, onSelectionChanged: handleSelectionChanged, onRowDblClick: handleRowDoubleClick })
92
92
  : _jsx(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: _jsx(TMLayoutItem, { children: _jsx("p", { style: { height: "100%", color: TMColors.primaryColor, fontSize: "1.5rem", display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: SDKUI_Localizator.NoDataToDisplay }) }) }) }));
93
93
  };
@@ -30,7 +30,7 @@ export const TMPanelManagerProvider = (props) => {
30
30
  const { visibilityMap, disabledMap } = getToolbarStates(panels);
31
31
  setToolbarButtonsVisibility(visibilityMap);
32
32
  setToolbarButtonsDisabled(disabledMap);
33
- }, []);
33
+ }, [panels]);
34
34
  // Callback to update the visibility state of a specific panel and its related hierarchy
35
35
  const adjustPanelVisibilityAndSize = useCallback((id, isVisible, prevVisibility) => {
36
36
  // Clone previous visibility state to work with
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.15.82",
3
+ "version": "6.15.84",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",