@topconsultnpm/sdkui-react 6.21.0-dev3.26 → 6.21.0-dev3.28

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.
@@ -28,6 +28,7 @@ export declare class FormulaDescriptor {
28
28
  metadataDataTypeDest?: MetadataDataTypes;
29
29
  tid?: number;
30
30
  description?: string;
31
+ syntax?: string;
31
32
  }
32
33
  export declare const renderFormulaIcon: (iconType: FormulaIconTypes, tid?: number, md?: MetadataDescriptor) => import("react/jsx-runtime").JSX.Element;
33
34
  declare const TMFormulaEditor: React.FunctionComponent<ITMApplyFormProps<FormulaDescriptor>>;
@@ -144,16 +144,16 @@ const TMFormulaEditor = (props) => {
144
144
  setSelectedItem(e.itemData);
145
145
  insertText(FormulaHelper.translateDescInFormula(e.itemData?.text));
146
146
  };
147
- return (_jsx(TMApplyForm, { isModal: props.isModal, formMode: props.formMode, isModified: formData.expression !== formDataOrig.expression, exception: exception, validationItems: validationItems, title: SDKUI_Localizator.Formula, hasNavigation: false, showBack: props.showBack, height: '600px', width: '800px', onApply: () => applyData(), onClose: props.onClose, onUndo: () => {
147
+ return (_jsxs(TMApplyForm, { isModal: props.isModal, formMode: props.formMode, isModified: formData.expression !== formDataOrig.expression, exception: exception, validationItems: validationItems, title: SDKUI_Localizator.Formula, hasNavigation: false, showBack: props.showBack, height: '600px', width: '800px', onApply: () => applyData(), onClose: props.onClose, onUndo: () => {
148
148
  setFormData(formDataOrig);
149
149
  setValidationItems([]);
150
- }, customToolbarElements: _jsx(TMButton, { caption: SDKUI_Localizator.EvaluateResult, onClick: () => { formulaValidator_BackEnd(); }, btnStyle: 'toolbar', icon: _jsx(IconNotification, {}) }), children: _jsxs("div", { ref: ref, style: { width: '100%', height: '100%' }, children: [selectedItem?.description && (_jsx(TMLayoutItem, { height: "max-content", children: _jsxs("div", { style: { padding: '6px 10px', background: TMColors.default_background, borderTop: `1px solid ${TMColors.border_normal}`, fontSize: FontSize.defaultFontSize }, children: [_jsx("span", { style: { fontWeight: 'bold', color: TMColors.info, marginRight: '8px' }, children: FormulaHelper.translateDescInFormula(selectedItem.text) }), _jsx("span", { style: { color: TMColors.info }, children: selectedItem.description })] }) })), _jsxs(TMSplitterLayout, { direction: isVertical ? 'vertical' : 'horizontal', showSeparator: true, separatorSize: 5, start: isVertical ? ['50%', '50%'] : ['35%', '65%'], min: ['0px', '0px'], children: [_jsx(TMCard, { scrollX: true, children: _jsx(TreeView, { id: "treeview", items: props.inputData?.items, width: '100%', height: '100%', scrollDirection: 'vertical', itemRender: renderTreeViewItem, onItemClick: handleTreeViewItemClick }) }), _jsxs(TMLayoutContainer, { direction: 'vertical', children: [_jsx(TMLayoutItem, { children: _jsx(TMCard, { scrollX: true, children: _jsx("textarea", { ref: textAreaRef, spellCheck: false, value: formData?.expression ?? '', onChange: (e) => {
150
+ }, customToolbarElements: _jsx(TMButton, { caption: SDKUI_Localizator.EvaluateResult, onClick: () => { formulaValidator_BackEnd(); }, btnStyle: 'toolbar', icon: _jsx(IconNotification, {}) }), children: [selectedItem?.description && (_jsx(TMLayoutItem, { height: "max-content", children: _jsxs("div", { style: { padding: '6px 10px', background: TMColors.default_background, borderTop: `1px solid ${TMColors.border_normal}`, fontSize: FontSize.defaultFontSize }, children: [_jsx("span", { style: { fontWeight: 'bold', color: TMColors.info, marginRight: '8px' }, children: selectedItem.syntax }), _jsx("span", { style: { color: TMColors.info }, children: selectedItem.description })] }) })), _jsx("div", { ref: ref, style: { width: '100%', height: '100%' }, children: _jsxs(TMSplitterLayout, { direction: isVertical ? 'vertical' : 'horizontal', showSeparator: true, separatorSize: 5, start: isVertical ? ['50%', '50%'] : ['35%', '65%'], min: ['0px', '0px'], children: [_jsx(TMCard, { scrollX: true, children: _jsx(TreeView, { id: "treeview", items: props.inputData?.items, width: '100%', height: '100%', scrollDirection: 'vertical', itemRender: renderTreeViewItem, onItemClick: handleTreeViewItemClick }) }), _jsxs(TMLayoutContainer, { direction: 'vertical', children: [_jsx(TMLayoutItem, { children: _jsx(TMCard, { scrollX: true, children: _jsx("textarea", { ref: textAreaRef, spellCheck: false, value: formData?.expression ?? '', onChange: (e) => {
151
151
  setFormData({ ...formData, expression: e.target.value });
152
152
  if (e.target.value != formDataOrig?.expression)
153
153
  insertValidationItem();
154
154
  else
155
155
  setValidationItems([]);
156
- }, style: { border: 'none', resize: 'none', color: TMColors.text_normal, fontSize: FontSize.defaultFontSize, padding: '5px', width: '100%', height: 'calc(100% - 4px)' } }) }) }), _jsx(TMLayoutItem, { height: "max-content", children: _jsx(TMVilViewer, { vil: validationItems }) })] })] })] }) }));
156
+ }, style: { border: 'none', resize: 'none', color: TMColors.text_normal, fontSize: FontSize.defaultFontSize, padding: '5px', width: '100%', height: 'calc(100% - 4px)' } }) }) }), _jsx(TMLayoutItem, { height: "max-content", children: _jsx(TMVilViewer, { vil: validationItems }) })] })] }) })] }));
157
157
  };
158
158
  export default TMFormulaEditor;
159
159
  export class FormulaHelper {
@@ -344,7 +344,8 @@ export class FormulaHelper {
344
344
  tid: -1,
345
345
  expanded: false,
346
346
  hasItems: false,
347
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_SS_CASE
347
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_SS_CASE,
348
+ syntax: "CASE...WHEN boolean_expression THEN result_expression ...ELSE else_result_expression...END"
348
349
  }, {
349
350
  id: '1_4_2',
350
351
  text: 'IS NULL',
@@ -352,7 +353,8 @@ export class FormulaHelper {
352
353
  tid: -1,
353
354
  expanded: false,
354
355
  hasItems: false,
355
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_SS_ISNULL
356
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_SS_ISNULL,
357
+ syntax: "expression IS [ NOT ] NULL"
356
358
  }];
357
359
  break;
358
360
  case DBBrands.Oracle:
@@ -364,7 +366,8 @@ export class FormulaHelper {
364
366
  tid: -1,
365
367
  expanded: false,
366
368
  hasItems: false,
367
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_CASE
369
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_CASE,
370
+ syntax: "CASE case_operand ...WHEN when_operand THEN statement...ELSE statement...END"
368
371
  }, {
369
372
  id: '1_4_2',
370
373
  text: 'IS NULL',
@@ -372,7 +375,8 @@ export class FormulaHelper {
372
375
  tid: -1,
373
376
  expanded: false,
374
377
  hasItems: false,
375
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_IS_NULL
378
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_IS_NULL,
379
+ syntax: "expression IS [ NOT ] NULL"
376
380
  }, {
377
381
  id: '1_4_3',
378
382
  text: 'GREATEST',
@@ -380,7 +384,8 @@ export class FormulaHelper {
380
384
  tid: -1,
381
385
  expanded: false,
382
386
  hasItems: false,
383
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_GREATEST
387
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_GREATEST,
388
+ syntax: "GREATEST(expr [, expr ])"
384
389
  }, {
385
390
  id: '1_4_4',
386
391
  text: 'LEAST',
@@ -388,7 +393,8 @@ export class FormulaHelper {
388
393
  tid: -1,
389
394
  expanded: false,
390
395
  hasItems: false,
391
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_LEAST
396
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_LEAST,
397
+ syntax: "LEAST(expr [, expr ])"
392
398
  }];
393
399
  break;
394
400
  }
@@ -437,6 +443,7 @@ export class FormulaHelper {
437
443
  expanded: false,
438
444
  hasItems: false,
439
445
  description: SDKUI_Localizator.FormulaEditor_DescInstruction_SS_CONVERT,
446
+ syntax: "CONVERT ( data_type [ ( length ) ] , expression [ , style ] )"
440
447
  }, {
441
448
  id: '3_1_2',
442
449
  text: 'CONVERT(nvarchar)',
@@ -444,6 +451,7 @@ export class FormulaHelper {
444
451
  expanded: false,
445
452
  hasItems: false,
446
453
  description: SDKUI_Localizator.FormulaEditor_DescInstruction_SS_CONVERTnvarchar,
454
+ syntax: "CONVERT ( NVARCHAR [ ( length ) ] , expression [ , style ] )"
447
455
  }, {
448
456
  id: '3_1_3',
449
457
  text: 'CONVERT(int)',
@@ -451,13 +459,15 @@ export class FormulaHelper {
451
459
  expanded: false,
452
460
  hasItems: false,
453
461
  description: SDKUI_Localizator.FormulaEditor_DescInstruction_SS_CONVERTint,
462
+ syntax: "CONVERT ( INT [ ( length ) ] , expression [ , style ] )"
454
463
  }, {
455
464
  id: '3_1_4',
456
465
  text: 'ISNULL',
457
466
  icon: FormulaIconTypes.Function,
458
467
  expanded: false,
459
468
  hasItems: false,
460
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_SS_ISNULL
469
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_SS_ISNULL,
470
+ syntax: "ISNULL ( expression , replacement_value )"
461
471
  }];
462
472
  break;
463
473
  case DBBrands.Oracle:
@@ -468,28 +478,32 @@ export class FormulaHelper {
468
478
  icon: FormulaIconTypes.Function,
469
479
  expanded: false,
470
480
  hasItems: false,
471
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_CAST
481
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_CAST,
482
+ syntax: "CAST( { expr | MULTISET ( subquery ) } AS type_name )"
472
483
  }, {
473
484
  id: '3_1_2',
474
485
  text: 'CAST(NVARCHAR2)',
475
486
  icon: FormulaIconTypes.Function,
476
487
  expanded: false,
477
488
  hasItems: false,
478
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_CASTnvarchar2
489
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_CASTnvarchar2,
490
+ syntax: "CAST ( expression | MULTISET ( subquery ) AS NVARCHAR2( length ) )"
479
491
  }, {
480
492
  id: '3_1_3',
481
493
  text: 'CAST(NUMERIC)',
482
494
  icon: FormulaIconTypes.Function,
483
495
  expanded: false,
484
496
  hasItems: false,
485
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_CASTnumeric
497
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_CASTnumeric,
498
+ syntax: "CAST ( expression | MULTISET ( subquery ) AS NUMERIC( precision, scale ) )"
486
499
  }, {
487
500
  id: '3_1_4',
488
501
  text: 'NVL',
489
502
  icon: FormulaIconTypes.Function,
490
503
  expanded: false,
491
504
  hasItems: false,
492
- description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_NVL
505
+ description: SDKUI_Localizator.FormulaEditor_DescInstruction_ORA_NVL,
506
+ syntax: "NVL ( expression , replacement_value )"
493
507
  }];
494
508
  break;
495
509
  }
@@ -506,84 +520,96 @@ export class FormulaHelper {
506
520
  icon: FormulaIconTypes.Function,
507
521
  expanded: false,
508
522
  hasItems: false,
509
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_LEN
523
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_LEN,
524
+ syntax: "LEN ( string_expression )"
510
525
  }, {
511
526
  id: '3_2_2',
512
527
  text: 'LEFT',
513
528
  icon: FormulaIconTypes.Function,
514
529
  expanded: false,
515
530
  hasItems: false,
516
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_LEFT
531
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_LEFT,
532
+ syntax: "LEFT ( character_expression , integer_expression )"
517
533
  }, {
518
534
  id: '3_2_3',
519
535
  text: 'LOWER',
520
536
  icon: FormulaIconTypes.Function,
521
537
  expanded: false,
522
538
  hasItems: false,
523
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_LOWER
539
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_LOWER,
540
+ syntax: "LOWER ( string_expression )"
524
541
  }, {
525
542
  id: '3_2_4',
526
543
  text: 'LTRIM',
527
544
  icon: FormulaIconTypes.Function,
528
545
  expanded: false,
529
546
  hasItems: false,
530
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_LTRIM
547
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_LTRIM,
548
+ syntax: "LTRIM ( string_expression )"
531
549
  }, {
532
550
  id: '3_2_5',
533
551
  text: 'REPLACE',
534
552
  icon: FormulaIconTypes.Function,
535
553
  expanded: false,
536
554
  hasItems: false,
537
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_REPLACE
555
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_REPLACE,
556
+ syntax: "REPLACE ( string_expression , string_pattern , string_replacement )"
538
557
  }, {
539
558
  id: '3_2_6',
540
559
  text: 'REPLICATE',
541
560
  icon: FormulaIconTypes.Function,
542
561
  expanded: false,
543
562
  hasItems: false,
544
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_REPLICATE
563
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_REPLICATE,
564
+ syntax: "REPLICATE ( string_expression , integer_expression )"
545
565
  }, {
546
566
  id: '3_2_7',
547
567
  text: 'RIGHT',
548
568
  icon: FormulaIconTypes.Function,
549
569
  expanded: false,
550
570
  hasItems: false,
551
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_RIGHT
571
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_RIGHT,
572
+ syntax: "RIGHT ( string_expression , integer_expression )"
552
573
  }, {
553
574
  id: '3_2_8',
554
575
  text: 'RTRIM',
555
576
  icon: FormulaIconTypes.Function,
556
577
  expanded: false,
557
578
  hasItems: false,
558
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_RTRIM
579
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_RTRIM,
580
+ syntax: "RTRIM ( string_expression )"
559
581
  }, {
560
582
  id: '3_2_9',
561
583
  text: 'SPACE',
562
584
  icon: FormulaIconTypes.Function,
563
585
  expanded: false,
564
586
  hasItems: false,
565
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_SPACE
587
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_SPACE,
588
+ syntax: "SPACE ( integer_expression )"
566
589
  }, {
567
590
  id: '3_2_10',
568
591
  text: 'STUFF',
569
592
  icon: FormulaIconTypes.Function,
570
593
  expanded: false,
571
594
  hasItems: false,
572
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_STUFF
595
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_STUFF,
596
+ syntax: "STUFF ( character_expression , start , length , replaceWith_character_expression )"
573
597
  }, {
574
598
  id: '3_2_11',
575
599
  text: 'SUBSTRING',
576
600
  icon: FormulaIconTypes.Function,
577
601
  expanded: false,
578
602
  hasItems: false,
579
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_SUBSTRING
603
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_SUBSTRING,
604
+ syntax: "SUBSTRING ( expression , start , length )"
580
605
  }, {
581
606
  id: '3_2_12',
582
607
  text: 'UPPER',
583
608
  icon: FormulaIconTypes.Function,
584
609
  expanded: false,
585
610
  hasItems: false,
586
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_UPPER
611
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_UPPER,
612
+ syntax: "UPPER ( string_expression )"
587
613
  }];
588
614
  break;
589
615
  case DBBrands.Oracle:
@@ -594,42 +620,48 @@ export class FormulaHelper {
594
620
  icon: FormulaIconTypes.Function,
595
621
  expanded: false,
596
622
  hasItems: false,
597
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_LENGTH
623
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_LENGTH,
624
+ syntax: "LENGTH ( string )"
598
625
  }, {
599
626
  id: '3_2_2',
600
627
  text: 'LOWER',
601
628
  icon: FormulaIconTypes.Function,
602
629
  expanded: false,
603
630
  hasItems: false,
604
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_LOWER
631
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_LOWER,
632
+ syntax: "LOWER ( string )"
605
633
  }, {
606
634
  id: '3_2_3',
607
635
  text: 'TRIM',
608
636
  icon: FormulaIconTypes.Function,
609
637
  expanded: false,
610
638
  hasItems: false,
611
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_TRIM
639
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_TRIM,
640
+ syntax: "TRIM ( [ trim_character FROM ] string )"
612
641
  }, {
613
642
  id: '3_2_4',
614
643
  text: 'REPLACE',
615
644
  icon: FormulaIconTypes.Function,
616
645
  expanded: false,
617
646
  hasItems: false,
618
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_REPLACE
647
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_REPLACE,
648
+ syntax: "REPLACE ( string, search_string, replacement_string )"
619
649
  }, {
620
650
  id: '3_2_5',
621
651
  text: 'SUBSTR',
622
652
  icon: FormulaIconTypes.Function,
623
653
  expanded: false,
624
654
  hasItems: false,
625
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_SUBSTR
655
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_SUBSTR,
656
+ syntax: "SUBSTR ( string, start_position [, length ] )"
626
657
  }, {
627
658
  id: '3_2_6',
628
659
  text: 'UPPER',
629
660
  icon: FormulaIconTypes.Function,
630
661
  expanded: false,
631
662
  hasItems: false,
632
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_UPPER
663
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_UPPER,
664
+ syntax: "UPPER ( string )"
633
665
  }];
634
666
  break;
635
667
  }
@@ -646,21 +678,24 @@ export class FormulaHelper {
646
678
  icon: FormulaIconTypes.Function,
647
679
  expanded: false,
648
680
  hasItems: false,
649
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_DATEDIFFyear
681
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_DATEDIFFyear,
682
+ syntax: "DATEDIFF ( datepart , startdate , enddate )"
650
683
  }, {
651
684
  id: '3_3_2',
652
685
  text: 'DATEDIFF ( day )',
653
686
  icon: FormulaIconTypes.Function,
654
687
  expanded: false,
655
688
  hasItems: false,
656
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_DATEDIFFday
689
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_DATEDIFFday,
690
+ syntax: "DATEDIFF ( datepart , startdate , enddate )"
657
691
  }, {
658
692
  id: '3_3_3',
659
693
  text: 'DATEADD',
660
694
  icon: FormulaIconTypes.Function,
661
695
  expanded: false,
662
696
  hasItems: false,
663
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_DATEADD
697
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_DATEADD,
698
+ syntax: "DATEADD ( datepart , number , date )"
664
699
  }];
665
700
  if (formulaTarget == FormulaTargets.DefaultValue || formulaTarget == FormulaTargets.BatchUpdate) {
666
701
  items.push({
@@ -669,28 +704,32 @@ export class FormulaHelper {
669
704
  icon: FormulaIconTypes.Function,
670
705
  expanded: false,
671
706
  hasItems: false,
672
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_GETDATE
707
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_GETDATE,
708
+ syntax: "GETDATE()"
673
709
  }, {
674
710
  id: '3_3_5',
675
711
  text: 'DAY(GETDATE())',
676
712
  icon: FormulaIconTypes.Function,
677
713
  expanded: false,
678
714
  hasItems: false,
679
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_DAYGETDATE
715
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_DAYGETDATE,
716
+ syntax: "DAY(GETDATE())"
680
717
  }, {
681
718
  id: '3_3_6',
682
719
  text: 'MONTH(GETDATE())',
683
720
  icon: FormulaIconTypes.Function,
684
721
  expanded: false,
685
722
  hasItems: false,
686
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_MONTHGETDATE
723
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_MONTHGETDATE,
724
+ syntax: "MONTH(GETDATE())"
687
725
  }, {
688
726
  id: '3_3_7',
689
727
  text: 'YEAR(GETDATE())',
690
728
  icon: FormulaIconTypes.Function,
691
729
  expanded: false,
692
730
  hasItems: false,
693
- description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_YEARGETDATE
731
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_SS_YEARGETDATE,
732
+ syntax: "YEAR(GETDATE())"
694
733
  });
695
734
  }
696
735
  break;
@@ -702,21 +741,24 @@ export class FormulaHelper {
702
741
  icon: FormulaIconTypes.Function,
703
742
  expanded: false,
704
743
  hasItems: false,
705
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_TO_DATE
744
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_TO_DATE,
745
+ syntax: "TO_DATE( string, format )"
706
746
  }, {
707
747
  id: '3_3_2',
708
748
  text: 'LAST_DAY',
709
749
  icon: FormulaIconTypes.Function,
710
750
  expanded: false,
711
751
  hasItems: false,
712
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_LAST_DAY
752
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_LAST_DAY,
753
+ syntax: "LAST_DAY( date )"
713
754
  }, {
714
755
  id: '3_3_3',
715
756
  text: 'ADD_MONTHS',
716
757
  icon: FormulaIconTypes.Function,
717
758
  expanded: false,
718
759
  hasItems: false,
719
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_ADD_MONTHS
760
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_ADD_MONTHS,
761
+ syntax: "ADD_MONTHS( date, n_months )"
720
762
  }];
721
763
  if (formulaTarget == FormulaTargets.DefaultValue || formulaTarget == FormulaTargets.BatchUpdate) {
722
764
  items.push({
@@ -725,28 +767,32 @@ export class FormulaHelper {
725
767
  icon: FormulaIconTypes.Function,
726
768
  expanded: false,
727
769
  hasItems: false,
728
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_SYSDATE
770
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_SYSDATE,
771
+ syntax: "SYSDATE"
729
772
  }, {
730
773
  id: '3_3_5',
731
774
  text: 'TO_CHAR(SYSDATE, "DD")',
732
775
  icon: FormulaIconTypes.Function,
733
776
  expanded: false,
734
777
  hasItems: false,
735
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_TOCHARDATETIME
778
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_TOCHARDATETIME,
779
+ syntax: "TO_CHAR(SYSDATE, 'DD')"
736
780
  }, {
737
781
  id: '3_3_6',
738
782
  text: 'TO_CHAR(SYSDATE, "MM")',
739
783
  icon: FormulaIconTypes.Function,
740
784
  expanded: false,
741
785
  hasItems: false,
742
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_TOCHARDATETIME
786
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_TOCHARDATETIME,
787
+ syntax: "TO_CHAR(SYSDATE, 'MM')"
743
788
  }, {
744
789
  id: '3_3_7',
745
790
  text: 'TO_CHAR(SYSDATE, "YYYY")',
746
791
  icon: FormulaIconTypes.Function,
747
792
  expanded: false,
748
793
  hasItems: false,
749
- description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_TOCHARDATETIME
794
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_ORA_TOCHARDATETIME,
795
+ syntax: "TO_CHAR(SYSDATE, 'YYYY')"
750
796
  });
751
797
  }
752
798
  break;
@@ -760,21 +806,24 @@ export class FormulaHelper {
760
806
  icon: FormulaIconTypes.Function,
761
807
  expanded: false,
762
808
  hasItems: false,
763
- description: SDKUI_Localizator.FormulaEditor_DescFunction_TM_GetViewLink_WithoutLogin
809
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_TM_GetViewLink_WithoutLogin,
810
+ syntax: "TM_GetViewLink(Domain, UserName, Psw, CultureID, TID, DID, WithoutP7M, ExpDate, LastVer)"
764
811
  }, {
765
812
  id: '3_4_2',
766
813
  text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithLogin})`,
767
814
  icon: FormulaIconTypes.Function,
768
815
  expanded: false,
769
816
  hasItems: false,
770
- description: SDKUI_Localizator.FormulaEditor_DescFunction_TM_GetViewLink_WithLogin
817
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_TM_GetViewLink_WithLogin,
818
+ syntax: "TM_GetViewLink(Domain, UserName, Psw, CultureID, TID, DID, WithoutP7M, ExpDate, LastVer)"
771
819
  }, {
772
820
  id: '3_4_3',
773
821
  text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithDate})`,
774
822
  icon: FormulaIconTypes.Function,
775
823
  expanded: false,
776
824
  hasItems: false,
777
- description: SDKUI_Localizator.FormulaEditor_DescFunction_TM_GetViewLink_WithDate
825
+ description: SDKUI_Localizator.FormulaEditor_DescFunction_TM_GetViewLink_WithDate,
826
+ syntax: "TM_GetViewLink(Domain, UserName, Psw, CultureID, TID, DID, WithoutP7M, ExpDate, LastVer)"
778
827
  }];
779
828
  return items;
780
829
  }
@@ -429,5 +429,5 @@ const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCrea
429
429
  _jsx(TMDcmtForm, { groupId: 'tmFormOrResult', TID: focusedItem?.tid, DID: focusedItem.did, allowButtonsRefs: true, isClosable: deviceType !== DeviceType.MOBILE, allowNavigation: false, allowRelations: deviceType !== DeviceType.MOBILE, showDcmtFormSidebar: false, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onReferenceClick: handleNavigateToReference, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.tid, focusedItem?.did), openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, datagridUtility: {
430
430
  onRefreshSearchAsyncDatagrid,
431
431
  } }, refreshKey) :
432
- _jsx(TMSearchResult, { groupId: 'tmFormOrResult', isClosable: deviceType !== DeviceType.MOBILE, context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, showDcmtFormSidebar: false, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, enablePinIcons: false, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, showBackButton: false, onRefreshSearchAsyncDatagrid: onRefreshSearchResults, onReferenceClick: handleNavigateToReference }, refreshKey) }));
432
+ _jsx(TMSearchResult, { groupId: 'tmFormOrResult', isClosable: deviceType !== DeviceType.MOBILE, context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, showDcmtFormSidebar: false, autoFocusFirstRow: false, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, enablePinIcons: false, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, showBackButton: false, onRefreshSearchAsyncDatagrid: onRefreshSearchResults, onReferenceClick: handleNavigateToReference }, refreshKey) }));
433
433
  };
@@ -1236,9 +1236,9 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
1236
1236
  border: `1px solid ${TMColors.border_normal}`,
1237
1237
  borderRadius: '4px',
1238
1238
  cursor: 'pointer',
1239
- lineHeight: 1,
1240
- whiteSpace: 'nowrap'
1241
- }, children: [allExpanded ? _jsx(IconChevronRight, { fontSize: 14 }) : _jsx(IconChevronDown, { fontSize: 14 }), _jsx("span", { children: allExpanded ? SDKUI_Localizator.CollapseAll : SDKUI_Localizator.ExpandAll })] }) })), _jsx("div", { style: { flex: 1, minHeight: 0, overflow: 'auto' }, children: _jsx(TMTreeView, { dataSource: mergedTreeData, itemRender: finalItemRender, calculateItemsForNode: calculateItemsForNode, onDataChanged: handleDataChanged, focusedItem: focusedItem, onFocusedItemChanged: handleFocusedItemChanged, allowMultipleSelection: allowMultipleSelection, selectedItems: selectedItems, itemsPerPage: 100, onSelectionChanged: handleSelectedItemsChanged, onItemContextMenu: onItemContextMenu, shouldDelayFocusOnEvent: (node, e) => {
1239
+ whiteSpace: 'nowrap',
1240
+ outline: 'none'
1241
+ }, children: [_jsx("span", { style: { display: 'flex', alignItems: 'center' }, children: allExpanded ? _jsx(IconChevronRight, { fontSize: 14 }) : _jsx(IconChevronDown, { fontSize: 14 }) }), _jsx("span", { children: allExpanded ? SDKUI_Localizator.CollapseAll : SDKUI_Localizator.ExpandAll })] }) })), _jsx("div", { style: { flex: 1, minHeight: 0, overflow: 'auto' }, children: _jsx(TMTreeView, { dataSource: mergedTreeData, itemRender: finalItemRender, calculateItemsForNode: calculateItemsForNode, onDataChanged: handleDataChanged, focusedItem: focusedItem, onFocusedItemChanged: handleFocusedItemChanged, allowMultipleSelection: allowMultipleSelection, selectedItems: selectedItems, itemsPerPage: 100, onSelectionChanged: handleSelectedItemsChanged, onItemContextMenu: onItemContextMenu, shouldDelayFocusOnEvent: (node, e) => {
1242
1242
  // Ritarda il focus quando si clicca sull'icona del documento
1243
1243
  // per permettere al doppio click di funzionare
1244
1244
  const target = e.target;
@@ -12,6 +12,7 @@ interface ITMSearchResultProps {
12
12
  floatingActionConfig?: TMSearchResultFloatingActionConfig;
13
13
  workingGroupContext?: WorkingGroupDescriptor;
14
14
  inputDID?: number;
15
+ autoFocusFirstRow?: boolean;
15
16
  formAutoOpen?: boolean;
16
17
  allowFloatingBar?: boolean;
17
18
  allowRelations?: boolean;
@@ -54,7 +54,7 @@ const TMSearchResult = ({
54
54
  // Data
55
55
  groupId, searchResults = [], context = SearchResultContext.METADATA_SEARCH, title, selectedSearchResultTID, floatingActionConfig, workingGroupContext = undefined, inputDID,
56
56
  // Boolean flags to enable/disable features
57
- formAutoOpen, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, showSearchResultSidebar = true, showDcmtFormSidebar = true, showSelector = false, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, showBackButton = true, disableAccordionIfSingleCategory = false, editPdfForm = false, openS4TViewer = false, showTodoDcmtForm = false, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, showNoDcmtFoundMessage = true, enablePinIcons = true,
57
+ autoFocusFirstRow = true, formAutoOpen, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, showSearchResultSidebar = true, showDcmtFormSidebar = true, showSelector = false, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, showBackButton = true, disableAccordionIfSingleCategory = false, editPdfForm = false, openS4TViewer = false, showTodoDcmtForm = false, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, showNoDcmtFoundMessage = true, enablePinIcons = true,
58
58
  // Callbacks (optional)
59
59
  openInOffice, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsyncDatagrid, onSelectedTIDChanged, onWFOperationCompleted, onClose, onFileOpened, onTaskCreateRequest, openWGsCopyMoveForm, openCommentFormCallback, openAddDocumentForm, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, passToArchiveCallback, onReferenceClick,
60
60
  // Tasks
@@ -63,6 +63,11 @@ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCa
63
63
  handleNavigateToWGs, handleNavigateToDossiers, }) => {
64
64
  // Ref for the floating bar container (used to position the floating action buttons)
65
65
  const floatingBarContainerRef = useRef(null);
66
+ // Ref per tracciare se autoFocusFirstRow=false deve bloccare l'auto-focus.
67
+ // Resta true finché l'utente non clicca manualmente sulla griglia per selezionare una riga.
68
+ // Quando l'utente seleziona manualmente, il ref viene settato a false e il focus automatico
69
+ // torna al comportamento normale.
70
+ const isFirstAutoFocusRef = useRef(true);
66
71
  // ID state to force remount of components
67
72
  const [id, setID] = useState('');
68
73
  // Document type descriptor of the currently document
@@ -139,6 +144,12 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
139
144
  }
140
145
  }
141
146
  };
147
+ // Handler unico per tutte le azioni utente che cambiano il focus (click, navigazione, etc.).
148
+ // Resetta isFirstAutoFocusRef perché da questo momento autoFocusFirstRow non deve più essere considerato.
149
+ const handleFocusedItemChangedFromGrid = useCallback((item) => {
150
+ isFirstAutoFocusRef.current = false;
151
+ setFocusedItem(item);
152
+ }, []);
142
153
  const onNavigateHandler = (dir) => {
143
154
  let index = -1;
144
155
  if (visibleItems && focusedItem) {
@@ -146,10 +157,10 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
146
157
  }
147
158
  switch (dir) {
148
159
  case 'next':
149
- setFocusedItem(visibleItems[index + 1]);
160
+ handleFocusedItemChangedFromGrid(visibleItems[index + 1]);
150
161
  break;
151
162
  default:
152
- setFocusedItem(visibleItems[index - 1]);
163
+ handleFocusedItemChangedFromGrid(visibleItems[index - 1]);
153
164
  break;
154
165
  }
155
166
  };
@@ -378,6 +389,9 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
378
389
  updateBatchUpdateForm(false);
379
390
  closeDcmtFormHandler();
380
391
  setCurrentSearchResults(searchResults);
392
+ // Resetta il ref quando arrivano nuovi risultati di ricerca,
393
+ // così la logica autoFocusFirstRow=false si riapplica per ogni nuova ricerca
394
+ isFirstAutoFocusRef.current = true;
381
395
  if (searchResults.length <= 0) {
382
396
  setSelectedSearchResult(undefined);
383
397
  return;
@@ -413,6 +427,12 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
413
427
  });
414
428
  checkRelatedDcmtsArchiveCapability();
415
429
  checkManyToManyCapability();
430
+ // se autoFocusFirstRow è false, non selezionare automaticamente la prima riga del nuovo risultato della ricerca
431
+ // Il ref resta true finché l'utente non clicca manualmente sulla griglia
432
+ if (autoFocusFirstRow === false && isFirstAutoFocusRef.current) {
433
+ setFocusedItem(undefined);
434
+ return;
435
+ }
416
436
  // Ricava il nuovo dataSource
417
437
  const newDataSource = searchResultDescriptorToSimpleArray(selectedSearchResult);
418
438
  // Se esiste almeno una riga, seleziona la prima
@@ -420,6 +440,12 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
420
440
  }, [selectedSearchResult, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability]);
421
441
  // Quando inputDID è fornito e i dati della griglia sono pronti, seleziona il documento corrispondente
422
442
  useEffect(() => {
443
+ // Se autoFocusFirstRow è false, non selezionare automaticamente la riga corrispondente a inputDID
444
+ // Il ref resta true finché l'utente non clicca manualmente sulla griglia
445
+ if (autoFocusFirstRow === false && isFirstAutoFocusRef.current) {
446
+ setFocusedItem(undefined);
447
+ return;
448
+ }
423
449
  if (!inputDID || visibleItems.length === 0)
424
450
  return;
425
451
  const targetItem = visibleItems.find((item) => item.DID == inputDID);
@@ -635,7 +661,7 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
635
661
  _jsxs(_Fragment, { children: [_jsxs(TMLayoutItem, { height: '100%', children: [_jsxs("div", { ref: floatingBarContainerRef, style: { position: 'relative', height: '100%', width: '100%' }, children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: Gutters.getGutters(), separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && deviceType !== DeviceType.MOBILE, start: showSelector ? deviceType !== DeviceType.MOBILE ? ['30%', '70%'] : splitterSize : ['0%', '100%'], children: [showSelector ?
636
662
  _jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, selectedSearchResult: selectedSearchResult, autoSelectFirst: !isMobile || currentSearchResults.length === 1, onSelectionChanged: onSearchResultSelectionChanged }) })
637
663
  :
638
- _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsx(TMSearchResultGrid, { openInOffice: openInOffice, fromDTD: fromDTD, operationItems: operationItems, allUsers: allUsers, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, showExportForm: showExportForm, onFocusedItemChanged: setFocusedItem, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync({ inputDcmts, downloadType, downloadMode, onFileDownloaded: onFileOpened, confirmAttachments }), lastUpdateSearchTime: lastUpdateSearchTime, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], onSelectionChanged: (items) => { setSelectedItems(items); }, onDblClick: () => openFormHandler(LayoutModes.Update), showSearchTMDatagrid: showSearchTMDatagrid, onVisibleItemChanged: setVisibleItems, updateDataColumnsFromDataGrid: updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid: updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid: updateSelectedRowKeysFromDataGrid }) })] }), renderFloatingBar] }), _jsx(TMToppyDraggableHelpCenter, { usePortal: toppyHelpCenterUsePortal, isVisible: isToppyHelpCenterVisible, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, onApprove: () => {
664
+ _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsx(TMSearchResultGrid, { openInOffice: openInOffice, fromDTD: fromDTD, operationItems: operationItems, allUsers: allUsers, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, showExportForm: showExportForm, onFocusedItemChanged: handleFocusedItemChangedFromGrid, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync({ inputDcmts, downloadType, downloadMode, onFileDownloaded: onFileOpened, confirmAttachments }), lastUpdateSearchTime: lastUpdateSearchTime, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], onSelectionChanged: (items) => { setSelectedItems(items); }, onDblClick: () => openFormHandler(LayoutModes.Update), showSearchTMDatagrid: showSearchTMDatagrid, onVisibleItemChanged: setVisibleItems, updateDataColumnsFromDataGrid: updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid: updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid: updateSelectedRowKeysFromDataGrid, disableAutoFocus: autoFocusFirstRow === false && isFirstAutoFocusRef.current }) })] }), renderFloatingBar] }), _jsx(TMToppyDraggableHelpCenter, { usePortal: toppyHelpCenterUsePortal, isVisible: isToppyHelpCenterVisible, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, onApprove: () => {
639
665
  updateShowApprovePopup(true);
640
666
  }, onSignApprove: () => {
641
667
  handleSignApprove();
@@ -826,7 +852,7 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
826
852
  _jsxs(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', children: [_jsx(PanelDisabledStateHandler, { isBoardDisabled: isBoardDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })] }) }) }) }), renderDcmtOperations] }));
827
853
  };
828
854
  export default TMSearchResult;
829
- const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, inputFocusedItem, allowMultipleSelection = true, showExportForm = false, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onSelectionChanged, onDblClick, showSearchTMDatagrid, updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid }) => {
855
+ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, inputFocusedItem, allowMultipleSelection = true, showExportForm = false, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onSelectionChanged, onDblClick, showSearchTMDatagrid, updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid, disableAutoFocus = false }) => {
830
856
  const [dataSource, setDataSource] = useState();
831
857
  const [columns, setColumns] = useState([]);
832
858
  const [selectedRowKeys, setSelectedRowKeys] = useState([]);
@@ -850,6 +876,7 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
850
876
  const { loadDataListsAsync, renderDataListCell, dataListsCache } = useDataListItem();
851
877
  const { loadUsersAsync, renderUserIdViewer, usersCache } = useDataUserIdItem();
852
878
  useEffect(() => {
879
+ // Sincronizza focusedItem con inputFocusedItem dal padre
853
880
  if (deepCompare(inputFocusedItem, focusedItem))
854
881
  return;
855
882
  setFocusedItem(inputFocusedItem);
@@ -1142,7 +1169,6 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
1142
1169
  useEffect(() => {
1143
1170
  let newDataSource = searchResultDescriptorToSimpleArray(searchResult);
1144
1171
  setDataSource(newDataSource);
1145
- // setFocusedItem(newDataSource?.find(o => o?.rowIndex === focusedItem?.rowIndex));
1146
1172
  }, [lastUpdateSearchTime]);
1147
1173
  // Handles selection change in the data grid
1148
1174
  const handleSelectionChange = useCallback((e) => {
@@ -1153,14 +1179,9 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
1153
1179
  }, [onSelectionChanged]);
1154
1180
  // Handles focus change in the data grid
1155
1181
  const handleFocusedRowChange = useCallback((e) => {
1156
- // if (setFocusedItem === undefined) return;
1157
- // if (e.row === undefined) { setFocusedItem(undefined); return; }
1158
- // setFocusedItem(e.row.data);
1182
+ // Non bloccare mai questo handler: è chiamato quando l'utente clicca su una riga
1159
1183
  onFocusedItemChanged?.(e.row?.data);
1160
- }, [setFocusedItem]);
1161
- // useEffect(() => {
1162
- // onFocusedItemChanged?.(focusedItem)
1163
- // }, [focusedItem])
1184
+ }, [onFocusedItemChanged]);
1164
1185
  // Handler for double-click row event
1165
1186
  const onRowDblClick = useCallback((e) => {
1166
1187
  if (onDblClick === undefined)
@@ -1181,7 +1202,6 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
1181
1202
  });
1182
1203
  return;
1183
1204
  }
1184
- // setFocusedItem(e.data);
1185
1205
  onFocusedItemChanged?.(e.data);
1186
1206
  onDblClick();
1187
1207
  }, [onDblClick]);
@@ -1211,7 +1231,7 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
1211
1231
  setVisibleItems(visibleData);
1212
1232
  }, []);
1213
1233
  useEffect(() => { onVisibleItemChanged?.(visibleItems); }, [visibleItems]);
1214
- return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [!isDataGridReady && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', gap: '10px' }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: SDKUI_Localizator.Loading })] })), isDataGridReady && _jsx(TMDataGrid, { ref: dataGridRef, id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: Number(focusedItem?.rowIndex ?? 0), showSearchPanel: showSearchTMDatagrid, showFilterPanel: true, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: pageSize, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, showHeaderColumnChooser: true, onKeyDown: onKeyDown, customContextMenuItems: operationItems, counterConfig: { show: true } })] });
1234
+ return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [!isDataGridReady && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', gap: '10px' }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: SDKUI_Localizator.Loading })] })), isDataGridReady && _jsx(TMDataGrid, { ref: dataGridRef, id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: disableAutoFocus ? undefined : Number(focusedItem?.rowIndex ?? 0), showSearchPanel: showSearchTMDatagrid, showFilterPanel: true, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: pageSize, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, showHeaderColumnChooser: true, onKeyDown: onKeyDown, customContextMenuItems: operationItems, counterConfig: { show: true } })] });
1215
1235
  };
1216
1236
  //#region TMSearchResultSelector
1217
1237
  const StyledItemTemplate = styled.div `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev3.26",
3
+ "version": "6.21.0-dev3.28",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",