@topconsultnpm/sdkui-react-beta 6.12.144 → 6.12.145

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.
@@ -147,25 +147,48 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
147
147
  }
148
148
  return toBeRefreshed;
149
149
  };
150
- const getAdvancedMenuItems = (tid, mid) => {
151
- let md = currentDTD?.metadata?.find(o => o.id == mid);
150
+ const getAdvancedMenuItems = (mvd) => {
151
+ let md = mvd.md;
152
152
  if (!md)
153
153
  return [];
154
- let isEditable = isEditableList(mid);
154
+ // let isEditable = isEditableList(mvd.mid);
155
155
  let isDisabledOper = checkPerms && (md.dataDomain === MetadataDataDomains.Computed || md?.perm?.canUpdate !== AccessLevels.Yes);
156
156
  let menu = [
157
157
  {
158
- text: isEditable ? SDKUI_Localizator.Restore : SDKUI_Localizator.MakeEditable,
159
- icon: isEditable ? _jsx(IconUndo, {}) : _jsx(IconPencil, {}),
158
+ text: mvd.isEditable ? SDKUI_Localizator.Restore : SDKUI_Localizator.MakeEditable,
159
+ icon: mvd.isEditable ? _jsx(IconUndo, {}) : _jsx(IconPencil, {}),
160
160
  disabled: isDisabledOper,
161
161
  onClick: () => {
162
- addOrRemoveEditableList(mid);
163
- onAdvancedMenuClick?.({ tid: tid, mid: mid, button: AdvancedMenuButtons.MakeEditable });
164
- onValueChanged?.(metadataValues.map((item) => item.tid == tid && item.mid === mid ? { ...item, isEditable: !item.isEditable } : item));
162
+ // addOrRemoveEditableList(mvd.mid);
163
+ onAdvancedMenuClick?.({ tid: mvd.tid, mid: mvd.mid, button: AdvancedMenuButtons.MakeEditable });
164
+ onValueChanged?.(metadataValues.map((item) => {
165
+ if (item.tid == mvd.tid && item.mid === mvd.mid) {
166
+ // If DateTime and value is a formula, clear value but keep formulaValue
167
+ if (item.md?.dataType === MetadataDataTypes.DateTime && FormulaHelper.isFormula(item.value)) {
168
+ return {
169
+ ...item,
170
+ isEditable: !item.isEditable,
171
+ formulaValue: item.value, // store formula
172
+ value: null // clear value for DateBox
173
+ };
174
+ }
175
+ // If restoring and formulaValue exists, restore it
176
+ if (item.md?.dataType === MetadataDataTypes.DateTime && !item.isEditable && item.formulaValue) {
177
+ return {
178
+ ...item,
179
+ isEditable: !item.isEditable,
180
+ value: item.formulaValue, // restore formula
181
+ formulaValue: undefined // clear formulaValue
182
+ };
183
+ }
184
+ return { ...item, isEditable: !item.isEditable };
185
+ }
186
+ return item;
187
+ }));
165
188
  }
166
189
  },
167
- { text: SDKUI_Localizator.FormulaEditorTitle, icon: _jsx(IconFunction, {}), disabled: isDisabledOper, onClick: () => onAdvancedMenuClick?.({ tid: tid, mid: mid, button: AdvancedMenuButtons.FormulaEditor }) },
168
- { text: SDKUI_Localizator.DistinctValues, icon: _jsx(IconDataList, {}), onClick: () => onAdvancedMenuClick?.({ tid: tid, mid: mid, button: AdvancedMenuButtons.DistinctValues }) }
190
+ { text: SDKUI_Localizator.FormulaEditorTitle, icon: _jsx(IconFunction, {}), disabled: isDisabledOper, onClick: () => onAdvancedMenuClick?.({ tid: mvd.tid, mid: mvd.mid, button: AdvancedMenuButtons.FormulaEditor }) },
191
+ { text: SDKUI_Localizator.DistinctValues, icon: _jsx(IconDataList, {}), onClick: () => onAdvancedMenuClick?.({ tid: mvd.tid, mid: mvd.mid, button: AdvancedMenuButtons.DistinctValues }) }
169
192
  ];
170
193
  if (customMenuItems.length > 0)
171
194
  menu.push(...customMenuItems);
@@ -178,7 +201,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
178
201
  if (mvd)
179
202
  mvd.isSelected = newValue;
180
203
  onValueChanged?.(newValues);
181
- } }), _jsxs("div", { style: { position: 'relative', height: '100%', width: '100%', opacity: showNullValueCheckBoxes && item.isNull ? 0.4 : 1 }, children: [_jsx(TMMetadataEditor, { tid: TID, mid: item.mid, layoutMode: layoutMode, isLexProt: item.isLexProt, isSelected: isOpenDistinctValues && item.mid === selectedMID, isModifiedWhen: (item.value ?? '') !== (metadataValuesOrig.find(m => m.mid === item.mid)?.value ?? ''), isReadOnly: showNullValueCheckBoxes ? item.isNull : undefined, isEditable: isEditable(item.mid) || item.isEditable, validationItems: editorValidationHandler(item.mid ?? 0), value: item.value, openChooserBySingleClick: openChooserBySingleClick, onValueChanged: (newValue) => { onChangeHandler(newValue, item.mid ?? 0); }, onValueChange: (newValue) => { onChangeHandler(newValue, item.mid ?? 0); }, queryParamsDynDataList: dynDataListsToBeRefreshed.find(o => o.mid == item.mid)?.queryParams ?? [], onCascadeRefreshDynDataLists: (ddlToBeRefreshed) => {
204
+ } }), _jsxs("div", { style: { position: 'relative', height: '100%', width: '100%', opacity: showNullValueCheckBoxes && item.isNull ? 0.4 : 1 }, children: [_jsx(TMMetadataEditor, { tid: TID, mid: item.mid, layoutMode: layoutMode, isLexProt: item.isLexProt, isSelected: isOpenDistinctValues && item.mid === selectedMID, isModifiedWhen: (item.value ?? '') !== (metadataValuesOrig.find(m => m.mid === item.mid)?.value ?? ''), isReadOnly: showNullValueCheckBoxes ? item.isNull : undefined, isEditable: item.isEditable, validationItems: editorValidationHandler(item.mid ?? 0), value: item.value, openChooserBySingleClick: openChooserBySingleClick, onValueChanged: (newValue) => { onChangeHandler(newValue, item.mid ?? 0); }, onValueChange: (newValue) => { onChangeHandler(newValue, item.mid ?? 0); }, queryParamsDynDataList: dynDataListsToBeRefreshed.find(o => o.mid == item.mid)?.queryParams ?? [], onCascadeRefreshDynDataLists: (ddlToBeRefreshed) => {
182
205
  let newDynDataListsToBeRefreshed = [];
183
206
  for (const item of dynDataListsToBeRefreshed) {
184
207
  let index = ddlToBeRefreshed.findIndex(o => o.mid == item.mid || (o.mid == -1 && o.midStarter == item.midStarter));
@@ -224,7 +247,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
224
247
  mvd.isSelected = !stringIsNullOrEmpty(mvd.value);
225
248
  }
226
249
  onValueChanged?.(newValues);
227
- } }) }), isExpertMode && _jsx("div", { style: { marginTop: item.md?.dataType === MetadataDataTypes.DateTime ? '12px' : '18px' }, onClick: () => { handleMetadataValueSelection(item); }, children: _jsx(TMDropDownMenu, { backgroundColor: 'white', color: TMColors.button_icon, borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconMenuVertical, {}), showTooltip: false }), disabled: item.isLexProt === 1, items: getAdvancedMenuItems(TID, item.mid) }) })] }, item.mid))) }));
250
+ } }) }), isExpertMode && _jsx("div", { style: { marginTop: item.md?.dataType === MetadataDataTypes.DateTime ? '12px' : '18px' }, onClick: () => { handleMetadataValueSelection(item); }, children: _jsx(TMDropDownMenu, { backgroundColor: 'white', color: TMColors.button_icon, borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconMenuVertical, {}), showTooltip: false }), disabled: item.isLexProt === 1, items: getAdvancedMenuItems(item) }) })] }, item.mid))) }));
228
251
  };
229
252
  export default TMMetadataValues;
230
253
  //#region Styled Components
package/lib/ts/types.d.ts CHANGED
@@ -68,6 +68,7 @@ export declare class MetadataValueDescriptorEx extends MetadataValueDescriptor {
68
68
  isLexProt?: number;
69
69
  isSelected?: boolean;
70
70
  isNull?: boolean;
71
+ formulaValue?: string;
71
72
  }
72
73
  export type TaskContext = {
73
74
  workingGroup?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.12.144",
3
+ "version": "6.12.145",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -42,7 +42,7 @@
42
42
  "lib"
43
43
  ],
44
44
  "dependencies": {
45
- "@topconsultnpm/sdk-ts-beta": "^6.12.15",
45
+ "@topconsultnpm/sdk-ts-beta": "6.12.15",
46
46
  "buffer": "^6.0.3",
47
47
  "devextreme": "24.2.6",
48
48
  "devextreme-react": "24.2.6",