@topconsultnpm/sdkui-react-beta 6.11.42 → 6.11.44
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/lib/components/base/TMFileManager.js +11 -6
- package/lib/components/editors/TMFormulaEditor.d.ts +33 -0
- package/lib/components/editors/TMFormulaEditor.js +678 -0
- package/lib/helper/SDKUI_Localizator.d.ts +17 -0
- package/lib/helper/SDKUI_Localizator.js +170 -0
- package/package.json +1 -1
- package/lib/assets/ImageLibrary/arrow_001.png +0 -0
- package/lib/assets/ImageLibrary/arrow_002.png +0 -0
- package/lib/assets/ImageLibrary/arrow_003.png +0 -0
- package/lib/assets/ImageLibrary/arrow_004.png +0 -0
- package/lib/assets/ImageLibrary/arrow_005.png +0 -0
- package/lib/assets/ImageLibrary/arrow_006.png +0 -0
- package/lib/assets/ImageLibrary/arrow_007.png +0 -0
- package/lib/assets/ImageLibrary/arrow_008.png +0 -0
- package/lib/assets/ImageLibrary/arrow_009.png +0 -0
- package/lib/assets/ImageLibrary/arrow_010.png +0 -0
- package/lib/assets/ImageLibrary/arrow_011.png +0 -0
- package/lib/assets/ImageLibrary/arrow_012.png +0 -0
- package/lib/assets/ImageLibrary/book_001.png +0 -0
- package/lib/assets/ImageLibrary/book_002.png +0 -0
- package/lib/assets/ImageLibrary/book_003.png +0 -0
- package/lib/assets/ImageLibrary/book_004.png +0 -0
- package/lib/assets/ImageLibrary/book_005.png +0 -0
- package/lib/assets/ImageLibrary/book_006.png +0 -0
- package/lib/assets/ImageLibrary/book_007.png +0 -0
- package/lib/assets/ImageLibrary/clock_001.png +0 -0
- package/lib/assets/ImageLibrary/clock_002.png +0 -0
- package/lib/assets/ImageLibrary/clock_003.png +0 -0
- package/lib/assets/ImageLibrary/cube_001.png +0 -0
- package/lib/assets/ImageLibrary/cube_002.png +0 -0
- package/lib/assets/ImageLibrary/cube_003.png +0 -0
- package/lib/assets/ImageLibrary/dcmt_001.png +0 -0
- package/lib/assets/ImageLibrary/dcmt_002.png +0 -0
- package/lib/assets/ImageLibrary/dcmt_003.png +0 -0
- package/lib/assets/ImageLibrary/dcmt_004.png +0 -0
- package/lib/assets/ImageLibrary/dcmt_005.png +0 -0
- package/lib/assets/ImageLibrary/dcmt_006.png +0 -0
- package/lib/assets/ImageLibrary/dcmt_007.png +0 -0
- package/lib/assets/ImageLibrary/dcmt_008.png +0 -0
- package/lib/assets/ImageLibrary/emoticon_001.png +0 -0
- package/lib/assets/ImageLibrary/emoticon_002.png +0 -0
- package/lib/assets/ImageLibrary/emoticon_003.png +0 -0
- package/lib/assets/ImageLibrary/emoticon_004.png +0 -0
- package/lib/assets/ImageLibrary/fld_001.png +0 -0
- package/lib/assets/ImageLibrary/fld_002.png +0 -0
- package/lib/assets/ImageLibrary/fld_003.png +0 -0
- package/lib/assets/ImageLibrary/fld_004.png +0 -0
- package/lib/assets/ImageLibrary/fld_005.png +0 -0
- package/lib/assets/ImageLibrary/fld_006.png +0 -0
- package/lib/assets/ImageLibrary/fld_007.png +0 -0
- package/lib/assets/ImageLibrary/fld_008.png +0 -0
- package/lib/assets/ImageLibrary/fld_009.png +0 -0
- package/lib/assets/ImageLibrary/fld_010.png +0 -0
- package/lib/assets/ImageLibrary/fld_011.png +0 -0
- package/lib/assets/ImageLibrary/fld_012.png +0 -0
- package/lib/assets/ImageLibrary/fld_013.png +0 -0
- package/lib/assets/ImageLibrary/fld_014.png +0 -0
- package/lib/assets/ImageLibrary/fld_015.png +0 -0
- package/lib/assets/ImageLibrary/fld_016.png +0 -0
- package/lib/assets/ImageLibrary/fld_017.png +0 -0
- package/lib/assets/ImageLibrary/fld_018.png +0 -0
- package/lib/assets/ImageLibrary/fld_019.png +0 -0
- package/lib/assets/ImageLibrary/fld_020.png +0 -0
- package/lib/assets/ImageLibrary/fld_021.png +0 -0
- package/lib/assets/ImageLibrary/fld_022.png +0 -0
- package/lib/assets/ImageLibrary/fld_023.png +0 -0
- package/lib/assets/ImageLibrary/fld_024.png +0 -0
- package/lib/assets/ImageLibrary/fld_025.png +0 -0
- package/lib/assets/ImageLibrary/fld_026.png +0 -0
- package/lib/assets/ImageLibrary/fld_027.png +0 -0
- package/lib/assets/ImageLibrary/fld_028.png +0 -0
- package/lib/assets/ImageLibrary/fld_029.png +0 -0
- package/lib/assets/ImageLibrary/fld_030.png +0 -0
- package/lib/assets/ImageLibrary/fld_031.png +0 -0
- package/lib/assets/ImageLibrary/fld_032.png +0 -0
- package/lib/assets/ImageLibrary/fld_033.png +0 -0
- package/lib/assets/ImageLibrary/gen_001.png +0 -0
- package/lib/assets/ImageLibrary/gen_002.png +0 -0
- package/lib/assets/ImageLibrary/gen_003.png +0 -0
- package/lib/assets/ImageLibrary/gen_004.png +0 -0
- package/lib/assets/ImageLibrary/gen_005.png +0 -0
- package/lib/assets/ImageLibrary/gen_006.png +0 -0
- package/lib/assets/ImageLibrary/gen_007.png +0 -0
- package/lib/assets/ImageLibrary/gen_008.png +0 -0
- package/lib/assets/ImageLibrary/gen_009.png +0 -0
- package/lib/assets/ImageLibrary/gen_010.png +0 -0
- package/lib/assets/ImageLibrary/gen_011.png +0 -0
- package/lib/assets/ImageLibrary/gen_012.png +0 -0
- package/lib/assets/ImageLibrary/gen_013.png +0 -0
- package/lib/assets/ImageLibrary/gen_014.png +0 -0
- package/lib/assets/ImageLibrary/gen_015.png +0 -0
- package/lib/assets/ImageLibrary/gen_016.png +0 -0
- package/lib/assets/ImageLibrary/gen_017.png +0 -0
- package/lib/assets/ImageLibrary/gen_018.png +0 -0
- package/lib/assets/ImageLibrary/gen_019.png +0 -0
- package/lib/assets/ImageLibrary/gen_020.png +0 -0
- package/lib/assets/ImageLibrary/gen_021.png +0 -0
- package/lib/assets/ImageLibrary/gen_022.png +0 -0
- package/lib/assets/ImageLibrary/gen_023.png +0 -0
- package/lib/assets/ImageLibrary/gen_024.png +0 -0
- package/lib/assets/ImageLibrary/gen_025.png +0 -0
- package/lib/assets/ImageLibrary/gen_026.png +0 -0
- package/lib/assets/ImageLibrary/gen_027.png +0 -0
- package/lib/assets/ImageLibrary/gen_028.png +0 -0
- package/lib/assets/ImageLibrary/gen_029.png +0 -0
- package/lib/assets/ImageLibrary/gen_030.png +0 -0
- package/lib/assets/ImageLibrary/gen_031.png +0 -0
- package/lib/assets/ImageLibrary/gen_032.png +0 -0
- package/lib/assets/ImageLibrary/gen_033.png +0 -0
- package/lib/assets/ImageLibrary/gen_034.png +0 -0
- package/lib/assets/ImageLibrary/gen_035.png +0 -0
- package/lib/assets/ImageLibrary/gen_036.png +0 -0
- package/lib/assets/ImageLibrary/gen_037.png +0 -0
- package/lib/assets/ImageLibrary/gen_038.png +0 -0
- package/lib/assets/ImageLibrary/gen_039.png +0 -0
- package/lib/assets/ImageLibrary/gen_040.png +0 -0
- package/lib/assets/ImageLibrary/gen_041.png +0 -0
- package/lib/assets/ImageLibrary/gen_042.png +0 -0
- package/lib/assets/ImageLibrary/gen_043.png +0 -0
- package/lib/assets/ImageLibrary/gen_044.png +0 -0
- package/lib/assets/ImageLibrary/gen_045.png +0 -0
- package/lib/assets/ImageLibrary/gen_046.png +0 -0
- package/lib/assets/ImageLibrary/gen_047.png +0 -0
- package/lib/assets/ImageLibrary/gen_048.png +0 -0
- package/lib/assets/ImageLibrary/gen_049.png +0 -0
- package/lib/assets/ImageLibrary/gen_050.png +0 -0
- package/lib/assets/ImageLibrary/gen_051.png +0 -0
- package/lib/assets/ImageLibrary/gen_052.png +0 -0
- package/lib/assets/ImageLibrary/hand_001.png +0 -0
- package/lib/assets/ImageLibrary/hand_002.png +0 -0
- package/lib/assets/ImageLibrary/hand_003.png +0 -0
- package/lib/assets/ImageLibrary/hand_004.png +0 -0
- package/lib/assets/ImageLibrary/hand_005.png +0 -0
- package/lib/assets/ImageLibrary/hand_006.png +0 -0
- package/lib/assets/ImageLibrary/law_001.png +0 -0
- package/lib/assets/ImageLibrary/law_002.png +0 -0
- package/lib/assets/ImageLibrary/law_003.png +0 -0
- package/lib/assets/ImageLibrary/lock_001.png +0 -0
- package/lib/assets/ImageLibrary/lock_002.png +0 -0
- package/lib/assets/ImageLibrary/lock_003.png +0 -0
- package/lib/assets/ImageLibrary/mail_001.png +0 -0
- package/lib/assets/ImageLibrary/mail_002.png +0 -0
- package/lib/assets/ImageLibrary/mail_003.png +0 -0
- package/lib/assets/ImageLibrary/mail_004.png +0 -0
- package/lib/assets/ImageLibrary/mail_005.png +0 -0
- package/lib/assets/ImageLibrary/mail_006.png +0 -0
- package/lib/assets/ImageLibrary/mail_007.png +0 -0
- package/lib/assets/ImageLibrary/mail_008.png +0 -0
- package/lib/assets/ImageLibrary/mail_009.png +0 -0
- package/lib/assets/ImageLibrary/mail_010.png +0 -0
- package/lib/assets/ImageLibrary/mail_011.png +0 -0
- package/lib/assets/ImageLibrary/mail_012.png +0 -0
- package/lib/assets/ImageLibrary/mail_013.png +0 -0
- package/lib/assets/ImageLibrary/mail_014.png +0 -0
- package/lib/assets/ImageLibrary/mail_015.png +0 -0
- package/lib/assets/ImageLibrary/net_001.png +0 -0
- package/lib/assets/ImageLibrary/net_002.png +0 -0
- package/lib/assets/ImageLibrary/net_003.png +0 -0
- package/lib/assets/ImageLibrary/net_004.png +0 -0
- package/lib/assets/ImageLibrary/nmbr_001.png +0 -0
- package/lib/assets/ImageLibrary/nmbr_002.png +0 -0
- package/lib/assets/ImageLibrary/nmbr_003.png +0 -0
- package/lib/assets/ImageLibrary/nmbr_004.png +0 -0
- package/lib/assets/ImageLibrary/nmbr_005.png +0 -0
- package/lib/assets/ImageLibrary/nmbr_006.png +0 -0
- package/lib/assets/ImageLibrary/nmbr_007.png +0 -0
- package/lib/assets/ImageLibrary/nmbr_008.png +0 -0
- package/lib/assets/ImageLibrary/nmbr_009.png +0 -0
- package/lib/assets/ImageLibrary/note_001.png +0 -0
- package/lib/assets/ImageLibrary/note_002.png +0 -0
- package/lib/assets/ImageLibrary/note_003.png +0 -0
- package/lib/assets/ImageLibrary/note_004.png +0 -0
- package/lib/assets/ImageLibrary/note_005.png +0 -0
- package/lib/assets/ImageLibrary/note_006.png +0 -0
- package/lib/assets/ImageLibrary/note_007.png +0 -0
- package/lib/assets/ImageLibrary/note_008.png +0 -0
- package/lib/assets/ImageLibrary/note_009.png +0 -0
- package/lib/assets/ImageLibrary/note_010.png +0 -0
- package/lib/assets/ImageLibrary/note_011.png +0 -0
- package/lib/assets/ImageLibrary/note_012.png +0 -0
- package/lib/assets/ImageLibrary/note_013.png +0 -0
- package/lib/assets/ImageLibrary/note_014.png +0 -0
- package/lib/assets/ImageLibrary/note_015.png +0 -0
- package/lib/assets/ImageLibrary/note_016.png +0 -0
- package/lib/assets/ImageLibrary/run_001.png +0 -0
- package/lib/assets/ImageLibrary/run_002.png +0 -0
- package/lib/assets/ImageLibrary/run_003.png +0 -0
- package/lib/assets/ImageLibrary/sem_001.png +0 -0
- package/lib/assets/ImageLibrary/sem_002.png +0 -0
- package/lib/assets/ImageLibrary/sem_003.png +0 -0
- package/lib/assets/ImageLibrary/sem_004.png +0 -0
- package/lib/assets/ImageLibrary/sem_005.png +0 -0
- package/lib/assets/ImageLibrary/star_001.png +0 -0
- package/lib/assets/ImageLibrary/star_002.png +0 -0
- package/lib/assets/ImageLibrary/star_003.png +0 -0
- package/lib/assets/ImageLibrary/star_004.png +0 -0
- package/lib/assets/ImageLibrary/star_005.png +0 -0
- package/lib/assets/ImageLibrary/star_006.png +0 -0
- package/lib/assets/ImageLibrary/state_001.png +0 -0
- package/lib/assets/ImageLibrary/state_002.png +0 -0
- package/lib/assets/ImageLibrary/state_003.png +0 -0
- package/lib/assets/ImageLibrary/state_004.png +0 -0
- package/lib/assets/ImageLibrary/state_005.png +0 -0
- package/lib/assets/ImageLibrary/study_001.png +0 -0
- package/lib/assets/ImageLibrary/study_002.png +0 -0
- package/lib/assets/ImageLibrary/user_001.png +0 -0
- package/lib/assets/ImageLibrary/user_002.png +0 -0
- package/lib/assets/ImageLibrary/user_003.png +0 -0
- package/lib/assets/ImageLibrary/user_004.png +0 -0
- package/lib/assets/ImageLibrary/user_005.png +0 -0
- package/lib/assets/ImageLibrary/user_006.png +0 -0
- package/lib/assets/ImageLibrary/user_007.png +0 -0
- package/lib/assets/ImageLibrary/user_008.png +0 -0
- package/lib/assets/ImageLibrary/user_009.png +0 -0
- package/lib/assets/ImageLibrary/user_010.png +0 -0
- package/lib/assets/ImageLibrary/user_011.png +0 -0
- package/lib/assets/ImageLibrary/user_012.png +0 -0
- package/lib/assets/ImageLibrary/user_013.png +0 -0
- package/lib/assets/ImageLibrary/user_014.png +0 -0
- package/lib/assets/ImageLibrary/user_015.png +0 -0
- package/lib/assets/ImageLibrary/user_016.png +0 -0
- package/lib/assets/ImageLibrary/user_017.png +0 -0
- package/lib/assets/ImageLibrary/user_018.png +0 -0
- package/lib/assets/ImageLibrary/user_019.png +0 -0
- package/lib/assets/ImageLibrary/user_020.png +0 -0
- package/lib/assets/ImageLibrary/user_021.png +0 -0
- package/lib/assets/ImageLibrary/user_022.png +0 -0
- package/lib/assets/ImageLibrary/user_023.png +0 -0
- package/lib/assets/ImageLibrary/vehicle_001.png +0 -0
- package/lib/assets/ImageLibrary/vehicle_002.png +0 -0
- package/lib/assets/ImageLibrary/vehicle_003.png +0 -0
- package/lib/assets/ImageLibrary/vehicle_004.png +0 -0
- package/lib/assets/ImageLibrary/vehicle_005.png +0 -0
- package/lib/assets/ImageLibrary/vehicle_006.png +0 -0
- package/lib/assets/ImageLibrary/vehicle_007.png +0 -0
- package/lib/assets/ImageLibrary/vehicle_008.png +0 -0
- package/lib/assets/Toppy-generico.png +0 -0
- package/lib/assets/icomoon.eot +0 -0
- package/lib/assets/icomoon.svg +0 -97
- package/lib/assets/icomoon.ttf +0 -0
- package/lib/assets/icomoon.woff +0 -0
- package/lib/assets/loading.png +0 -0
- package/lib/assets/login-bg.png +0 -0
- package/lib/assets/multipleSelectionManager.jpg +0 -0
- package/lib/assets/thumbnails/dicom.png +0 -0
- package/lib/assets/thumbnails/doc.png +0 -0
- package/lib/assets/thumbnails/docx.png +0 -0
- package/lib/assets/thumbnails/dwg.png +0 -0
- package/lib/assets/thumbnails/email.png +0 -0
- package/lib/assets/thumbnails/exe.png +0 -0
- package/lib/assets/thumbnails/folder.png +0 -0
- package/lib/assets/thumbnails/html.png +0 -0
- package/lib/assets/thumbnails/image.png +0 -0
- package/lib/assets/thumbnails/index.ts +0 -39
- package/lib/assets/thumbnails/mp4.png +0 -0
- package/lib/assets/thumbnails/other.png +0 -0
- package/lib/assets/thumbnails/p7m.png +0 -0
- package/lib/assets/thumbnails/pdf.png +0 -0
- package/lib/assets/thumbnails/ppt.png +0 -0
- package/lib/assets/thumbnails/slddrw.png +0 -0
- package/lib/assets/thumbnails/txt.png +0 -0
- package/lib/assets/thumbnails/xls.png +0 -0
- package/lib/assets/thumbnails/xml.png +0 -0
- package/lib/assets/thumbnails/zip.png +0 -0
- package/lib/css/tm-sdkui.css +0 -1
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
import { ValidationItem, SDK_Globals, MetadataDataTypes, DBBrands, ResultTypes } from '@topconsultnpm/sdk-ts-beta';
|
|
4
|
+
import { TreeView } from 'devextreme-react';
|
|
5
|
+
import { calcIsModified, IconActivityLog, IconAtSign, IconDcmtTypeSys, IconDetailDcmts, IconMetadata, IconMetadata_Numeric, IconMetadata_Text, IconNotification, IconPencil, IconSettings, SDKUI_Localizator } from '../../helper';
|
|
6
|
+
import { TMColors, FontSize } from '../../utils/theme';
|
|
7
|
+
import { StyledDivHorizontal } from '../base/Styled';
|
|
8
|
+
import ShowAlert from '../base/TMAlert';
|
|
9
|
+
import TMButton from '../base/TMButton';
|
|
10
|
+
import TMLayoutContainer, { TMSplitterLayout, TMLayoutItem, TMCard } from '../base/TMLayout';
|
|
11
|
+
import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
12
|
+
import TMSpinner from '../base/TMSpinner';
|
|
13
|
+
import TMVilViewer from '../base/TMVilViewer';
|
|
14
|
+
import TMApplyForm from '../forms/TMApplyForm';
|
|
15
|
+
import { TMMetadataIcon } from '../viewers/TMMidViewer';
|
|
16
|
+
import { useApplyForm } from '../../hooks/useForm';
|
|
17
|
+
// import CodeEditor from '@uiw/react-textarea-code-editor';
|
|
18
|
+
// npm i @uiw/react-textarea-code-editor
|
|
19
|
+
export var FormulaTargets;
|
|
20
|
+
(function (FormulaTargets) {
|
|
21
|
+
FormulaTargets[FormulaTargets["None"] = 0] = "None";
|
|
22
|
+
FormulaTargets[FormulaTargets["DefaultValue"] = 1] = "DefaultValue";
|
|
23
|
+
FormulaTargets[FormulaTargets["ComputedMetadata"] = 2] = "ComputedMetadata";
|
|
24
|
+
FormulaTargets[FormulaTargets["MetadataMapping"] = 3] = "MetadataMapping";
|
|
25
|
+
FormulaTargets[FormulaTargets["PDFCommandAddText"] = 4] = "PDFCommandAddText";
|
|
26
|
+
FormulaTargets[FormulaTargets["BatchUpdate"] = 5] = "BatchUpdate";
|
|
27
|
+
})(FormulaTargets || (FormulaTargets = {}));
|
|
28
|
+
export class FormulaDescriptor {
|
|
29
|
+
constructor() {
|
|
30
|
+
this.items = [];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export const TMFormulaEditor = (props) => {
|
|
34
|
+
const [validationItems, setValidationItems] = useState([]);
|
|
35
|
+
// const { formData, setFormData, formDataOrig, validationItems, setValidationItems, exception, applyData } = useOrchApplyForm<FormulaDescriptor>({ type: Descriptors.Formula }, props.formMode, props.inputData, props.onApplied)
|
|
36
|
+
const { formData, setFormData, formDataOrig, exception, applyData } = useApplyForm(props.formMode, props.inputData, () => new FormulaDescriptor(), props.onApplied);
|
|
37
|
+
// const [code, setCode] = useState(`function add(a, b) {\n return a + b;\n}` );
|
|
38
|
+
const textAreaRef = useRef(null);
|
|
39
|
+
/// esegue la validazione lato-backend
|
|
40
|
+
function formulaValidator_BackEnd() {
|
|
41
|
+
(async () => {
|
|
42
|
+
TMSpinner.show();
|
|
43
|
+
setValidationItems([]);
|
|
44
|
+
try {
|
|
45
|
+
switch (props.inputData?.formulaTarget) {
|
|
46
|
+
case FormulaTargets.ComputedMetadata:
|
|
47
|
+
await SDK_Globals.tmSession?.NewDcmtTypeEngine().MetadataValidateComputedFormulaAsync(props.inputData.tid, props.inputData.mid, textAreaRef.current?.value, undefined);
|
|
48
|
+
break;
|
|
49
|
+
case FormulaTargets.BatchUpdate:
|
|
50
|
+
case FormulaTargets.DefaultValue:
|
|
51
|
+
case FormulaTargets.MetadataMapping:
|
|
52
|
+
await SDK_Globals.tmSession?.NewDcmtTypeEngine().MetadataValidateDefaultValueAsync(props.inputData.tid, props.inputData.mid, props.inputData.metadataDataTypeDest, textAreaRef.current?.value, undefined);
|
|
53
|
+
break;
|
|
54
|
+
//In questa modalità non esiste un metadato da associare alla formula
|
|
55
|
+
case FormulaTargets.PDFCommandAddText:
|
|
56
|
+
await SDK_Globals.tmSession?.NewDcmtTypeEngine().MetadataValidateDefaultValueAsync(props.inputData.tid, 0, MetadataDataTypes.Varchar, textAreaRef.current?.value, undefined);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
TMSpinner.hide();
|
|
60
|
+
ShowAlert({ message: SDKUI_Localizator.FormulaEditor_ValidateOK, mode: 'success', title: `${SDKUI_Localizator.EvaluateResult}`, duration: 3000 });
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
64
|
+
insertValidationItem();
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
TMSpinner.hide();
|
|
68
|
+
}
|
|
69
|
+
})();
|
|
70
|
+
}
|
|
71
|
+
const insertValidationItem = () => {
|
|
72
|
+
let vil = [];
|
|
73
|
+
vil.push(new ValidationItem(ResultTypes.ERROR, SDKUI_Localizator.Validate, "Formula non validata"));
|
|
74
|
+
setValidationItems(vil);
|
|
75
|
+
};
|
|
76
|
+
/// Inserisce {@parameter} in cursor position
|
|
77
|
+
const insertText = (textToInsert) => {
|
|
78
|
+
if (textAreaRef == null || textAreaRef.current == null)
|
|
79
|
+
return;
|
|
80
|
+
if (textToInsert == undefined)
|
|
81
|
+
return;
|
|
82
|
+
try {
|
|
83
|
+
let cursorposition = textAreaRef.current?.selectionStart;
|
|
84
|
+
let textbeforecursorposition = textAreaRef.current?.value.substring(0, cursorposition);
|
|
85
|
+
let textaftercursorposition = textAreaRef.current?.value.substring(cursorposition, textAreaRef.current?.value.length);
|
|
86
|
+
let newValue = textbeforecursorposition + textToInsert + textaftercursorposition;
|
|
87
|
+
textAreaRef.current.value = newValue;
|
|
88
|
+
setFormData({ ...formData, expression: newValue });
|
|
89
|
+
insertValidationItem();
|
|
90
|
+
textAreaRef.current.focus();
|
|
91
|
+
textAreaRef.current.selectionStart = textAreaRef.current.selectionEnd = cursorposition + textToInsert.length;
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
return (_jsx(TMApplyForm, { isModal: props.isModal, formMode: props.formMode, isModified: calcIsModified(formData, formDataOrig), exception: exception, validationItems: validationItems, title: SDKUI_Localizator.Formula, hasNavigation: false, height: '600px', width: '800px', onApply: () => applyData(), onClose: props.onClose, onUndo: () => { setFormData(formDataOrig); setValidationItems([]); }, customToolbarElements: _jsx(TMButton, { caption: SDKUI_Localizator.EvaluateResult, onClick: () => { formulaValidator_BackEnd(); }, btnStyle: 'toolbar', icon: _jsx(IconNotification, {}) }), children: _jsxs(TMSplitterLayout, { direction: 'vertical', showSeparator: true, separatorSize: 2, start: ['50%', '50%'], min: ['0px', '0px'], children: [_jsx(TMLayoutItem, { children: _jsx(TMCard, { children: _jsx(TreeView, { id: "treeview", items: props.inputData?.items, width: '100%',
|
|
98
|
+
// onItemClick={(e) => { if (!e.itemData!.hasItems) { /* myItem = e; */ insertText(e.itemData!.text); } }}
|
|
99
|
+
scrollDirection: 'vertical', itemRender: (item) => {
|
|
100
|
+
if (item.icon == undefined)
|
|
101
|
+
return (item.text);
|
|
102
|
+
if (!item.hasItems) {
|
|
103
|
+
if (item.tid == undefined)
|
|
104
|
+
return (_jsxs("div", { children: [item.icon, _jsx("span", { style: { verticalAlign: 'middle', color: TMColors.primary, marginLeft: '5px' }, children: _jsx(IconPencil, { onClick: () => { insertText(item.text); } }) })] }));
|
|
105
|
+
else
|
|
106
|
+
return (_jsxs(StyledDivHorizontal, { children: [item.icon, _jsx("span", { style: { verticalAlign: 'middle' }, children: item.text }), _jsx("span", { style: { verticalAlign: 'middle', color: TMColors.primary, marginLeft: '5px' }, children: _jsx(IconPencil, { onClick: () => { insertText(item.text); } }) })] }));
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
if (item.tid == undefined)
|
|
110
|
+
return (_jsx("div", { children: item.icon }));
|
|
111
|
+
else
|
|
112
|
+
return (_jsxs("div", { children: [item.icon, _jsx("span", { style: { verticalAlign: 'middle' }, children: item.text })] }));
|
|
113
|
+
}
|
|
114
|
+
} }) }) }), _jsx(TMLayoutItem, { children: _jsxs(TMLayoutContainer, { direction: 'vertical', children: [_jsx(TMLayoutItem, { children: _jsx(TMCard, { scrollX: true, children: _jsx("textarea", { ref: textAreaRef, spellCheck: false, value: formData.expression, onChange: (e) => {
|
|
115
|
+
setFormData({ ...formData, expression: e.target.value });
|
|
116
|
+
if (e.target.value != formDataOrig.expression)
|
|
117
|
+
insertValidationItem();
|
|
118
|
+
else
|
|
119
|
+
setValidationItems([]);
|
|
120
|
+
}, style: { border: '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 }) })] }) })] }) }));
|
|
121
|
+
};
|
|
122
|
+
const instructionsIcon = () => _jsx(IconActivityLog, {});
|
|
123
|
+
const functionIcon = () => _jsx(IconDetailDcmts, {});
|
|
124
|
+
const variableIcon = () => _jsx(IconAtSign, {});
|
|
125
|
+
const systemVariablesIcon = () => _jsx(IconSettings, {});
|
|
126
|
+
const metadataIcon = () => _jsx(IconMetadata, {});
|
|
127
|
+
const metadataNumberIcon = () => _jsx(IconMetadata_Numeric, {});
|
|
128
|
+
const metadataVarcharIcon = () => _jsx(IconMetadata_Text, {});
|
|
129
|
+
export class FormulaHelper {
|
|
130
|
+
static TreeViewList(tid, systemMDs, userMDs, formulaTarget, dbBrand) {
|
|
131
|
+
let list = [{
|
|
132
|
+
id: '1',
|
|
133
|
+
text: SDKUI_Localizator.FormulaEditor_Variables,
|
|
134
|
+
icon: variableIcon,
|
|
135
|
+
hasItems: true,
|
|
136
|
+
items: this.jsonItems_LoadVariables(tid, formulaTarget, systemMDs, userMDs),
|
|
137
|
+
}, {
|
|
138
|
+
id: '2',
|
|
139
|
+
text: SDKUI_Localizator.FormulaEditor_Instructions,
|
|
140
|
+
icon: instructionsIcon,
|
|
141
|
+
hasItems: true,
|
|
142
|
+
items: this.jsonItems_LoadInstructions(dbBrand),
|
|
143
|
+
}, {
|
|
144
|
+
id: '3',
|
|
145
|
+
text: SDKUI_Localizator.FormulaEditor_Functions,
|
|
146
|
+
icon: functionIcon,
|
|
147
|
+
hasItems: true,
|
|
148
|
+
items: this.jsonItems_LoadFunctions(dbBrand, formulaTarget),
|
|
149
|
+
}];
|
|
150
|
+
return list;
|
|
151
|
+
}
|
|
152
|
+
static jsonItems_LoadVariables(tid, formulaTarget, systemMDs, userMDs) {
|
|
153
|
+
let items = [{
|
|
154
|
+
id: '1_1',
|
|
155
|
+
text: SDKUI_Localizator.MetadataSystem,
|
|
156
|
+
icon: _jsx(IconDcmtTypeSys, {}),
|
|
157
|
+
hasItems: true,
|
|
158
|
+
items: this.jsonItems_SystemMDs(tid, systemMDs),
|
|
159
|
+
}];
|
|
160
|
+
if (formulaTarget != FormulaTargets.BatchUpdate) {
|
|
161
|
+
items.push({
|
|
162
|
+
id: '1_2',
|
|
163
|
+
text: SDKUI_Localizator.MetadataUsers,
|
|
164
|
+
icon: metadataIcon,
|
|
165
|
+
hasItems: true,
|
|
166
|
+
items: this.jsonItems_UserMDs(tid, userMDs),
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (formulaTarget == FormulaTargets.DefaultValue || formulaTarget == FormulaTargets.MetadataMapping || formulaTarget == FormulaTargets.PDFCommandAddText) {
|
|
170
|
+
items.push({
|
|
171
|
+
id: '1_3',
|
|
172
|
+
text: SDKUI_Localizator.VariablesSystem,
|
|
173
|
+
icon: systemVariablesIcon,
|
|
174
|
+
hasItems: true,
|
|
175
|
+
items: this.jsonItems_SystemVariables(formulaTarget),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
return items;
|
|
179
|
+
}
|
|
180
|
+
static jsonItems_SystemMDs(tid, systemMDs) {
|
|
181
|
+
const items = systemMDs.map((md, index) => {
|
|
182
|
+
return {
|
|
183
|
+
id: '1_1_' + index,
|
|
184
|
+
text: "{@" + md.name + "}",
|
|
185
|
+
tid: tid,
|
|
186
|
+
md: md,
|
|
187
|
+
icon: _jsx(TMMetadataIcon, { tid: tid, md: md }),
|
|
188
|
+
expands: false,
|
|
189
|
+
hasItems: false
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
return items;
|
|
193
|
+
}
|
|
194
|
+
static jsonItems_UserMDs(tid, userMDs) {
|
|
195
|
+
const items = userMDs.map((md, index) => {
|
|
196
|
+
return {
|
|
197
|
+
id: '1_2_' + index,
|
|
198
|
+
text: "{@" + md.name + "}",
|
|
199
|
+
tid: tid,
|
|
200
|
+
md: md,
|
|
201
|
+
icon: _jsx(TMMetadataIcon, { tid: tid, md: md }),
|
|
202
|
+
expands: false,
|
|
203
|
+
hasItems: false
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
return items;
|
|
207
|
+
}
|
|
208
|
+
static jsonItems_SystemVariables(formulaTarget) {
|
|
209
|
+
let items = [{
|
|
210
|
+
id: '1_3_1',
|
|
211
|
+
text: '{@UserID}',
|
|
212
|
+
icon: metadataNumberIcon,
|
|
213
|
+
tid: -1,
|
|
214
|
+
expanded: false,
|
|
215
|
+
hasItems: false,
|
|
216
|
+
}, {
|
|
217
|
+
id: '1_3_2',
|
|
218
|
+
text: '{@UserName}',
|
|
219
|
+
icon: metadataVarcharIcon,
|
|
220
|
+
tid: -1,
|
|
221
|
+
expanded: false,
|
|
222
|
+
hasItems: false,
|
|
223
|
+
}];
|
|
224
|
+
if (formulaTarget == FormulaTargets.DefaultValue) {
|
|
225
|
+
items.push({
|
|
226
|
+
id: '1_3_3',
|
|
227
|
+
text: '{@GUID}',
|
|
228
|
+
icon: metadataVarcharIcon,
|
|
229
|
+
tid: -1,
|
|
230
|
+
expanded: false,
|
|
231
|
+
hasItems: false,
|
|
232
|
+
}, {
|
|
233
|
+
id: '1_3_4',
|
|
234
|
+
text: '{@ContentType}',
|
|
235
|
+
icon: metadataVarcharIcon,
|
|
236
|
+
tid: -1,
|
|
237
|
+
expanded: false,
|
|
238
|
+
hasItems: false,
|
|
239
|
+
}, {
|
|
240
|
+
id: '1_3_5',
|
|
241
|
+
text: '{@FileName}',
|
|
242
|
+
icon: metadataVarcharIcon,
|
|
243
|
+
tid: -1,
|
|
244
|
+
expanded: false,
|
|
245
|
+
hasItems: false,
|
|
246
|
+
}, {
|
|
247
|
+
id: '1_3_6',
|
|
248
|
+
text: '{@FileName_Original}',
|
|
249
|
+
icon: metadataVarcharIcon,
|
|
250
|
+
tid: -1,
|
|
251
|
+
expanded: false,
|
|
252
|
+
hasItems: false,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
if (formulaTarget == FormulaTargets.MetadataMapping || formulaTarget == FormulaTargets.PDFCommandAddText) {
|
|
256
|
+
items.push({
|
|
257
|
+
id: '1_3_3',
|
|
258
|
+
text: '{@FileName}',
|
|
259
|
+
icon: metadataVarcharIcon,
|
|
260
|
+
tid: -1,
|
|
261
|
+
expanded: false,
|
|
262
|
+
hasItems: false,
|
|
263
|
+
}, {
|
|
264
|
+
id: '1_3_4',
|
|
265
|
+
text: '{@FileName_Original}',
|
|
266
|
+
icon: metadataVarcharIcon,
|
|
267
|
+
tid: -1,
|
|
268
|
+
expanded: false,
|
|
269
|
+
hasItems: false,
|
|
270
|
+
}, {
|
|
271
|
+
id: '1_3_5',
|
|
272
|
+
text: '{@ProcessRunID}',
|
|
273
|
+
icon: metadataNumberIcon,
|
|
274
|
+
tid: -1,
|
|
275
|
+
expanded: false,
|
|
276
|
+
hasItems: false,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
return items;
|
|
280
|
+
}
|
|
281
|
+
static jsonItems_LoadInstructions(dbBrand) {
|
|
282
|
+
let items;
|
|
283
|
+
switch (dbBrand) {
|
|
284
|
+
case DBBrands.SQLServer:
|
|
285
|
+
items =
|
|
286
|
+
[{
|
|
287
|
+
id: '1_4_1',
|
|
288
|
+
text: 'CASE WHEN THEN ELSE END',
|
|
289
|
+
icon: instructionsIcon,
|
|
290
|
+
tid: -1,
|
|
291
|
+
expanded: false,
|
|
292
|
+
hasItems: false,
|
|
293
|
+
}, {
|
|
294
|
+
id: '1_4_2',
|
|
295
|
+
text: 'IS NULL',
|
|
296
|
+
icon: instructionsIcon,
|
|
297
|
+
tid: -1,
|
|
298
|
+
expanded: false,
|
|
299
|
+
hasItems: false,
|
|
300
|
+
}];
|
|
301
|
+
break;
|
|
302
|
+
case DBBrands.Oracle:
|
|
303
|
+
items =
|
|
304
|
+
[{
|
|
305
|
+
id: '1_4_1',
|
|
306
|
+
text: 'CASE WHEN THEN ELSE END',
|
|
307
|
+
icon: instructionsIcon,
|
|
308
|
+
tid: -1,
|
|
309
|
+
expanded: false,
|
|
310
|
+
hasItems: false,
|
|
311
|
+
}, {
|
|
312
|
+
id: '1_4_2',
|
|
313
|
+
text: 'IS NULL',
|
|
314
|
+
icon: instructionsIcon,
|
|
315
|
+
tid: -1,
|
|
316
|
+
expanded: false,
|
|
317
|
+
hasItems: false,
|
|
318
|
+
}, {
|
|
319
|
+
id: '1_4_3',
|
|
320
|
+
text: 'GREATEST',
|
|
321
|
+
icon: instructionsIcon,
|
|
322
|
+
tid: -1,
|
|
323
|
+
expanded: false,
|
|
324
|
+
hasItems: false,
|
|
325
|
+
}, {
|
|
326
|
+
id: '1_4_4',
|
|
327
|
+
text: 'LEAST',
|
|
328
|
+
icon: instructionsIcon,
|
|
329
|
+
tid: -1,
|
|
330
|
+
expanded: false,
|
|
331
|
+
hasItems: false,
|
|
332
|
+
}];
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
return items;
|
|
336
|
+
}
|
|
337
|
+
static jsonItems_LoadFunctions(dbBrand, formulaTarget) {
|
|
338
|
+
let items = [{
|
|
339
|
+
id: '3_1',
|
|
340
|
+
text: SDKUI_Localizator.FormulaEditor_FunctionConvert,
|
|
341
|
+
icon: functionIcon,
|
|
342
|
+
hasItems: true,
|
|
343
|
+
items: this.jsonItems_LoadFunctions_Convert(dbBrand),
|
|
344
|
+
}, {
|
|
345
|
+
id: '3_2',
|
|
346
|
+
text: SDKUI_Localizator.FormulaEditor_FunctionString,
|
|
347
|
+
icon: functionIcon,
|
|
348
|
+
hasItems: true,
|
|
349
|
+
items: this.jsonItems_LoadFunctions_String(dbBrand),
|
|
350
|
+
}, {
|
|
351
|
+
id: '3_3',
|
|
352
|
+
text: SDKUI_Localizator.FormulaEditor_FunctionDate,
|
|
353
|
+
icon: functionIcon,
|
|
354
|
+
hasItems: true,
|
|
355
|
+
items: this.jsonItems_LoadFunctions_Date(dbBrand, formulaTarget),
|
|
356
|
+
}];
|
|
357
|
+
if (formulaTarget == FormulaTargets.DefaultValue || formulaTarget == FormulaTargets.BatchUpdate) {
|
|
358
|
+
items.push({
|
|
359
|
+
id: '3_4',
|
|
360
|
+
text: SDKUI_Localizator.FormulaEditor_FunctionLink,
|
|
361
|
+
icon: functionIcon,
|
|
362
|
+
hasItems: true,
|
|
363
|
+
items: this.jsonItems_LoadFunctions_Link(),
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
return items;
|
|
367
|
+
}
|
|
368
|
+
static jsonItems_LoadFunctions_Convert(dbBrand) {
|
|
369
|
+
let items;
|
|
370
|
+
switch (dbBrand) {
|
|
371
|
+
case DBBrands.SQLServer:
|
|
372
|
+
items =
|
|
373
|
+
[{
|
|
374
|
+
id: '3_1_1',
|
|
375
|
+
text: 'CONVERT',
|
|
376
|
+
icon: functionIcon,
|
|
377
|
+
expanded: false,
|
|
378
|
+
hasItems: false,
|
|
379
|
+
}, {
|
|
380
|
+
id: '3_1_2',
|
|
381
|
+
text: 'CONVERT(nvarchar)',
|
|
382
|
+
icon: functionIcon,
|
|
383
|
+
expanded: false,
|
|
384
|
+
hasItems: false,
|
|
385
|
+
}, {
|
|
386
|
+
id: '3_1_3',
|
|
387
|
+
text: 'CONVERT(int)',
|
|
388
|
+
icon: functionIcon,
|
|
389
|
+
expanded: false,
|
|
390
|
+
hasItems: false,
|
|
391
|
+
}, {
|
|
392
|
+
id: '3_1_4',
|
|
393
|
+
text: 'ISNULL',
|
|
394
|
+
icon: functionIcon,
|
|
395
|
+
expanded: false,
|
|
396
|
+
hasItems: false,
|
|
397
|
+
}];
|
|
398
|
+
break;
|
|
399
|
+
case DBBrands.Oracle:
|
|
400
|
+
items =
|
|
401
|
+
[{
|
|
402
|
+
id: '3_1_1',
|
|
403
|
+
text: 'CAST',
|
|
404
|
+
icon: functionIcon,
|
|
405
|
+
expanded: false,
|
|
406
|
+
hasItems: false,
|
|
407
|
+
}, {
|
|
408
|
+
id: '3_1_2',
|
|
409
|
+
text: 'CAST(NVARCHAR2)',
|
|
410
|
+
icon: functionIcon,
|
|
411
|
+
expanded: false,
|
|
412
|
+
hasItems: false,
|
|
413
|
+
}, {
|
|
414
|
+
id: '3_1_3',
|
|
415
|
+
text: 'CAST(NUMERIC)',
|
|
416
|
+
icon: functionIcon,
|
|
417
|
+
expanded: false,
|
|
418
|
+
hasItems: false,
|
|
419
|
+
}, {
|
|
420
|
+
id: '3_1_4',
|
|
421
|
+
text: 'NVL',
|
|
422
|
+
icon: functionIcon,
|
|
423
|
+
expanded: false,
|
|
424
|
+
hasItems: false,
|
|
425
|
+
}];
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
return items;
|
|
429
|
+
}
|
|
430
|
+
static jsonItems_LoadFunctions_String(dbBrand) {
|
|
431
|
+
let items;
|
|
432
|
+
switch (dbBrand) {
|
|
433
|
+
case DBBrands.SQLServer:
|
|
434
|
+
items =
|
|
435
|
+
[{
|
|
436
|
+
id: '3_2_1',
|
|
437
|
+
text: 'LEN',
|
|
438
|
+
icon: functionIcon,
|
|
439
|
+
expanded: false,
|
|
440
|
+
hasItems: false,
|
|
441
|
+
}, {
|
|
442
|
+
id: '3_2_2',
|
|
443
|
+
text: 'LEFT',
|
|
444
|
+
icon: functionIcon,
|
|
445
|
+
expanded: false,
|
|
446
|
+
hasItems: false,
|
|
447
|
+
}, {
|
|
448
|
+
id: '3_2_3',
|
|
449
|
+
text: 'LOWER',
|
|
450
|
+
icon: functionIcon,
|
|
451
|
+
expanded: false,
|
|
452
|
+
hasItems: false,
|
|
453
|
+
}, {
|
|
454
|
+
id: '3_2_4',
|
|
455
|
+
text: 'LTRIM',
|
|
456
|
+
icon: functionIcon,
|
|
457
|
+
expanded: false,
|
|
458
|
+
hasItems: false,
|
|
459
|
+
}, {
|
|
460
|
+
id: '3_2_5',
|
|
461
|
+
text: 'REPLACE',
|
|
462
|
+
icon: functionIcon,
|
|
463
|
+
expanded: false,
|
|
464
|
+
hasItems: false,
|
|
465
|
+
}, {
|
|
466
|
+
id: '3_2_6',
|
|
467
|
+
text: 'REPLICATE',
|
|
468
|
+
icon: functionIcon,
|
|
469
|
+
expanded: false,
|
|
470
|
+
hasItems: false,
|
|
471
|
+
}, {
|
|
472
|
+
id: '3_2_7',
|
|
473
|
+
text: 'RIGHT',
|
|
474
|
+
icon: functionIcon,
|
|
475
|
+
expanded: false,
|
|
476
|
+
hasItems: false,
|
|
477
|
+
}, {
|
|
478
|
+
id: '3_2_8',
|
|
479
|
+
text: 'RTRIM',
|
|
480
|
+
icon: functionIcon,
|
|
481
|
+
expanded: false,
|
|
482
|
+
hasItems: false,
|
|
483
|
+
}, {
|
|
484
|
+
id: '3_2_9',
|
|
485
|
+
text: 'SPACE',
|
|
486
|
+
icon: functionIcon,
|
|
487
|
+
expanded: false,
|
|
488
|
+
hasItems: false,
|
|
489
|
+
}, {
|
|
490
|
+
id: '3_2_10',
|
|
491
|
+
text: 'STUFF',
|
|
492
|
+
icon: functionIcon,
|
|
493
|
+
expanded: false,
|
|
494
|
+
hasItems: false,
|
|
495
|
+
}, {
|
|
496
|
+
id: '3_2_11',
|
|
497
|
+
text: 'SUBSTRING',
|
|
498
|
+
icon: functionIcon,
|
|
499
|
+
expanded: false,
|
|
500
|
+
hasItems: false,
|
|
501
|
+
}, {
|
|
502
|
+
id: '3_2_12',
|
|
503
|
+
text: 'UPPER',
|
|
504
|
+
icon: functionIcon,
|
|
505
|
+
expanded: false,
|
|
506
|
+
hasItems: false,
|
|
507
|
+
}];
|
|
508
|
+
break;
|
|
509
|
+
case DBBrands.Oracle:
|
|
510
|
+
items =
|
|
511
|
+
[{
|
|
512
|
+
id: '3_2_1',
|
|
513
|
+
text: 'LENGTH',
|
|
514
|
+
icon: functionIcon,
|
|
515
|
+
expanded: false,
|
|
516
|
+
hasItems: false,
|
|
517
|
+
}, {
|
|
518
|
+
id: '3_2_2',
|
|
519
|
+
text: 'LOWER',
|
|
520
|
+
icon: functionIcon,
|
|
521
|
+
expanded: false,
|
|
522
|
+
hasItems: false,
|
|
523
|
+
}, {
|
|
524
|
+
id: '3_2_3',
|
|
525
|
+
text: 'TRIM',
|
|
526
|
+
icon: functionIcon,
|
|
527
|
+
expanded: false,
|
|
528
|
+
hasItems: false,
|
|
529
|
+
}, {
|
|
530
|
+
id: '3_2_4',
|
|
531
|
+
text: 'REPLACE',
|
|
532
|
+
icon: functionIcon,
|
|
533
|
+
expanded: false,
|
|
534
|
+
hasItems: false,
|
|
535
|
+
}, {
|
|
536
|
+
id: '3_2_5',
|
|
537
|
+
text: 'SUBSTR',
|
|
538
|
+
icon: functionIcon,
|
|
539
|
+
expanded: false,
|
|
540
|
+
hasItems: false,
|
|
541
|
+
}, {
|
|
542
|
+
id: '3_2_6',
|
|
543
|
+
text: 'UPPER',
|
|
544
|
+
icon: functionIcon,
|
|
545
|
+
expanded: false,
|
|
546
|
+
hasItems: false,
|
|
547
|
+
}];
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
return items;
|
|
551
|
+
}
|
|
552
|
+
static jsonItems_LoadFunctions_Date(dbBrand, formulaTarget) {
|
|
553
|
+
let items;
|
|
554
|
+
switch (dbBrand) {
|
|
555
|
+
case DBBrands.SQLServer:
|
|
556
|
+
items =
|
|
557
|
+
[{
|
|
558
|
+
id: '3_3_1',
|
|
559
|
+
text: 'DATEDIFF ( year )',
|
|
560
|
+
icon: functionIcon,
|
|
561
|
+
expanded: false,
|
|
562
|
+
hasItems: false,
|
|
563
|
+
}, {
|
|
564
|
+
id: '3_3_2',
|
|
565
|
+
text: 'DATEDIFF ( day )',
|
|
566
|
+
icon: functionIcon,
|
|
567
|
+
expanded: false,
|
|
568
|
+
hasItems: false,
|
|
569
|
+
}, {
|
|
570
|
+
id: '3_3_3',
|
|
571
|
+
text: 'DATEADD',
|
|
572
|
+
icon: functionIcon,
|
|
573
|
+
expanded: false,
|
|
574
|
+
hasItems: false,
|
|
575
|
+
}];
|
|
576
|
+
if (formulaTarget == FormulaTargets.DefaultValue || formulaTarget == FormulaTargets.BatchUpdate) {
|
|
577
|
+
items.push({
|
|
578
|
+
id: '3_3_4',
|
|
579
|
+
text: 'GETDATE()',
|
|
580
|
+
icon: functionIcon,
|
|
581
|
+
expanded: false,
|
|
582
|
+
hasItems: false,
|
|
583
|
+
}, {
|
|
584
|
+
id: '3_3_5',
|
|
585
|
+
text: 'DAY(GETDATE())',
|
|
586
|
+
icon: functionIcon,
|
|
587
|
+
expanded: false,
|
|
588
|
+
hasItems: false,
|
|
589
|
+
}, {
|
|
590
|
+
id: '3_3_6',
|
|
591
|
+
text: 'MONTH(GETDATE())',
|
|
592
|
+
icon: functionIcon,
|
|
593
|
+
expanded: false,
|
|
594
|
+
hasItems: false,
|
|
595
|
+
}, {
|
|
596
|
+
id: '3_3_7',
|
|
597
|
+
text: 'YEAR(GETDATE())',
|
|
598
|
+
icon: functionIcon,
|
|
599
|
+
expanded: false,
|
|
600
|
+
hasItems: false,
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
break;
|
|
604
|
+
case DBBrands.Oracle:
|
|
605
|
+
items =
|
|
606
|
+
[{
|
|
607
|
+
id: '3_3_1',
|
|
608
|
+
text: 'TO_DATE',
|
|
609
|
+
icon: functionIcon,
|
|
610
|
+
expanded: false,
|
|
611
|
+
hasItems: false,
|
|
612
|
+
}, {
|
|
613
|
+
id: '3_3_2',
|
|
614
|
+
text: 'LAST_DAY',
|
|
615
|
+
icon: functionIcon,
|
|
616
|
+
expanded: false,
|
|
617
|
+
hasItems: false,
|
|
618
|
+
}, {
|
|
619
|
+
id: '3_3_3',
|
|
620
|
+
text: 'ADD_MONTHS',
|
|
621
|
+
icon: functionIcon,
|
|
622
|
+
expanded: false,
|
|
623
|
+
hasItems: false,
|
|
624
|
+
}];
|
|
625
|
+
if (formulaTarget == FormulaTargets.DefaultValue || formulaTarget == FormulaTargets.BatchUpdate) {
|
|
626
|
+
items.push({
|
|
627
|
+
id: '3_3_4',
|
|
628
|
+
text: 'SYSDATE',
|
|
629
|
+
icon: functionIcon,
|
|
630
|
+
expanded: false,
|
|
631
|
+
hasItems: false,
|
|
632
|
+
}, {
|
|
633
|
+
id: '3_3_5',
|
|
634
|
+
text: 'TO_CHAR(SYSDATE, "DD")',
|
|
635
|
+
icon: functionIcon,
|
|
636
|
+
expanded: false,
|
|
637
|
+
hasItems: false,
|
|
638
|
+
}, {
|
|
639
|
+
id: '3_3_6',
|
|
640
|
+
text: 'TO_CHAR(SYSDATE, "MM")',
|
|
641
|
+
icon: functionIcon,
|
|
642
|
+
expanded: false,
|
|
643
|
+
hasItems: false,
|
|
644
|
+
}, {
|
|
645
|
+
id: '3_3_7',
|
|
646
|
+
text: 'TO_CHAR(SYSDATE, "YYYY")',
|
|
647
|
+
icon: functionIcon,
|
|
648
|
+
expanded: false,
|
|
649
|
+
hasItems: false,
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
return items;
|
|
655
|
+
}
|
|
656
|
+
static jsonItems_LoadFunctions_Link() {
|
|
657
|
+
let items = [{
|
|
658
|
+
id: '3_4_1',
|
|
659
|
+
text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithLogin})`,
|
|
660
|
+
icon: functionIcon,
|
|
661
|
+
expanded: false,
|
|
662
|
+
hasItems: false,
|
|
663
|
+
}, {
|
|
664
|
+
id: '3_4_2',
|
|
665
|
+
text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithoutLogin})`,
|
|
666
|
+
icon: functionIcon,
|
|
667
|
+
expanded: false,
|
|
668
|
+
hasItems: false,
|
|
669
|
+
}, {
|
|
670
|
+
id: '3_4_3',
|
|
671
|
+
text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithDate})`,
|
|
672
|
+
icon: functionIcon,
|
|
673
|
+
expanded: false,
|
|
674
|
+
hasItems: false,
|
|
675
|
+
}];
|
|
676
|
+
return items;
|
|
677
|
+
}
|
|
678
|
+
}
|