@topconsultnpm/sdkui-react-beta 6.11.77 → 6.11.78
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/editors/TMFormulaEditor.d.ts +13 -10
- package/lib/components/editors/TMFormulaEditor.js +25 -1
- package/lib/components/editors/TMMetadataEditor.d.ts +3 -4
- package/lib/components/editors/TMMetadataEditor.js +35 -35
- package/lib/components/query/TMQueryEditor.js +1 -1
- package/lib/helper/helpers.d.ts +2 -1
- package/lib/helper/helpers.js +165 -1
- package/lib/helper/queryHelper.d.ts +2 -2
- package/package.json +1 -1
@@ -32,15 +32,18 @@ export declare const renderFormulaIcon: (iconType: FormulaIconTypes, tid?: numbe
|
|
32
32
|
declare const TMFormulaEditor: React.FunctionComponent<ITMApplyFormProps<FormulaDescriptor>>;
|
33
33
|
export default TMFormulaEditor;
|
34
34
|
export declare class FormulaHelper {
|
35
|
+
static isFormula(value: string | undefined): boolean;
|
36
|
+
static removeFormulaTag(value: string | undefined): string | undefined;
|
37
|
+
static addFormulaTag(value: string | undefined): string | undefined;
|
35
38
|
static TreeViewList(tid: number, systemMDs: MetadataDescriptor[] | undefined, userMDs: MetadataDescriptor[] | undefined, formulaTarget: FormulaTargets, dbBrand: DBBrands): any;
|
36
|
-
static jsonItems_LoadVariables
|
37
|
-
static jsonItems_SystemMDs
|
38
|
-
static jsonItems_UserMDs
|
39
|
-
static jsonItems_SystemVariables
|
40
|
-
static jsonItems_LoadInstructions
|
41
|
-
static jsonItems_LoadFunctions
|
42
|
-
static jsonItems_LoadFunctions_Convert
|
43
|
-
static jsonItems_LoadFunctions_String
|
44
|
-
static jsonItems_LoadFunctions_Date
|
45
|
-
static jsonItems_LoadFunctions_Link
|
39
|
+
private static jsonItems_LoadVariables;
|
40
|
+
private static jsonItems_SystemMDs;
|
41
|
+
private static jsonItems_UserMDs;
|
42
|
+
private static jsonItems_SystemVariables;
|
43
|
+
private static jsonItems_LoadInstructions;
|
44
|
+
private static jsonItems_LoadFunctions;
|
45
|
+
private static jsonItems_LoadFunctions_Convert;
|
46
|
+
private static jsonItems_LoadFunctions_String;
|
47
|
+
private static jsonItems_LoadFunctions_Date;
|
48
|
+
private static jsonItems_LoadFunctions_Link;
|
46
49
|
}
|
@@ -122,7 +122,7 @@ const TMFormulaEditor = (props) => {
|
|
122
122
|
const renderTreeViewItem = useCallback((item) => {
|
123
123
|
return (_jsxs(StyledDivHorizontal, { style: { display: 'flex', gap: '5px' }, children: [renderFormulaIcon(item.icon, item.tid, item.md), _jsx("span", { style: { verticalAlign: 'middle' }, children: item.text }), !item.hasItems && _jsx("span", { style: { verticalAlign: 'middle', color: TMColors.primary }, children: _jsx(IconPencil, { onClick: () => { insertText(item.text); } }) })] }));
|
124
124
|
}, []);
|
125
|
-
return (_jsx(TMApplyForm, { isModal: props.isModal, formMode: props.formMode, isModified: formData.expression !== formDataOrig.expression, exception: exception, validationItems: validationItems, title: SDKUI_Localizator.Formula, hasNavigation: false, height: '600px', width: '800px', onApply: () => applyData(), onClose: props.onClose, onUndo: () => {
|
125
|
+
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: () => {
|
126
126
|
setFormData(formDataOrig);
|
127
127
|
setValidationItems([]);
|
128
128
|
}, 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%', scrollDirection: 'vertical', itemRender: renderTreeViewItem }) }) }), _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) => {
|
@@ -135,6 +135,30 @@ const TMFormulaEditor = (props) => {
|
|
135
135
|
};
|
136
136
|
export default TMFormulaEditor;
|
137
137
|
export class FormulaHelper {
|
138
|
+
static isFormula(value) {
|
139
|
+
if (!value)
|
140
|
+
return false;
|
141
|
+
if (value === "=")
|
142
|
+
return false;
|
143
|
+
if (value.startsWith("=="))
|
144
|
+
return false;
|
145
|
+
// Per intercettare alcuni Oggetti delle e-mail del tipo "=?ISO-8859-1?Q?Everything_for_=A35_-_Box_Sets,_Games_?=
|
146
|
+
if (value.startsWith("=?ISO-8859-1"))
|
147
|
+
return false;
|
148
|
+
return value.startsWith("=");
|
149
|
+
}
|
150
|
+
static removeFormulaTag(value) {
|
151
|
+
if (!this.isFormula(value))
|
152
|
+
return value;
|
153
|
+
return value?.substring(1);
|
154
|
+
}
|
155
|
+
static addFormulaTag(value) {
|
156
|
+
if (!value)
|
157
|
+
return value;
|
158
|
+
if (this.isFormula(value))
|
159
|
+
return value;
|
160
|
+
return `=${value}`;
|
161
|
+
}
|
138
162
|
static TreeViewList(tid, systemMDs, userMDs, formulaTarget, dbBrand) {
|
139
163
|
let list = [{
|
140
164
|
id: '1',
|
@@ -6,7 +6,7 @@ interface ITMMetadataEditorProps {
|
|
6
6
|
mid?: number;
|
7
7
|
value: string | undefined;
|
8
8
|
queryParamsDynDataList?: string[];
|
9
|
-
autoFocus
|
9
|
+
autoFocus?: boolean;
|
10
10
|
containerElement: Element | undefined;
|
11
11
|
disabled?: boolean;
|
12
12
|
validationItems?: ValidationItem[];
|
@@ -15,12 +15,11 @@ interface ITMMetadataEditorProps {
|
|
15
15
|
layoutMode?: LayoutModes;
|
16
16
|
queryOperator?: QueryOperators;
|
17
17
|
isModifiedWhen?: boolean;
|
18
|
-
|
18
|
+
isEditable?: boolean;
|
19
19
|
openChooserBySingleClick?: boolean;
|
20
20
|
iconContextMenu?: React.ReactNode;
|
21
21
|
customLabel?: string;
|
22
|
-
|
23
|
-
onEditorClick?: () => void;
|
22
|
+
isSelected?: boolean;
|
24
23
|
onValueChanged?: (value: any) => void;
|
25
24
|
onValueChange?: (value: any) => void;
|
26
25
|
onCascadeRefreshDynDataLists?: (dynDataListsToBeRefreshed: DynDataListsToBeRefreshed[]) => void;
|
@@ -37,13 +37,13 @@ const getDateDisplayType = (format) => {
|
|
37
37
|
default: return DateDisplayTypes.Date;
|
38
38
|
}
|
39
39
|
};
|
40
|
-
const TMMetadataEditor = ({
|
40
|
+
const TMMetadataEditor = ({ isSelected = false, customLabel, isReadOnly, isLexProt, layoutMode, queryOperator, isEditable, isModifiedWhen = false, tid, mid, value, queryParamsDynDataList, containerElement, autoFocus, validationItems = [], disabled = false, openChooserBySingleClick = true, iconContextMenu, onValueChanged, onValueChange, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs }) => {
|
41
41
|
const [md, setMd] = useState();
|
42
42
|
useEffect(() => {
|
43
43
|
DcmtTypeListCacheService.GetAsync(tid).then((dtd) => {
|
44
44
|
setMd(dtd?.metadata?.find(o => o.id == mid));
|
45
45
|
});
|
46
|
-
}, [mid]);
|
46
|
+
}, [tid, mid]);
|
47
47
|
const isReadOnlyInternal = () => {
|
48
48
|
if (!md)
|
49
49
|
return false;
|
@@ -65,47 +65,47 @@ const TMMetadataEditor = ({ isMetadataSelected = false, onEditorClick, customLab
|
|
65
65
|
if (layoutMode === LayoutModes.None && showAsText)
|
66
66
|
maxLength = 1000;
|
67
67
|
let isReadOnlyResult = isReadOnly ?? isReadOnlyInternal();
|
68
|
-
let icon = renderMetadataIcon(tid, md, layoutMode,
|
69
|
-
if (value?.startsWith("{@QueryParam") || value == "{@UserName}" || value == "{@UserID}" || queryOperator == QueryOperators.Custom)
|
70
|
-
return
|
71
|
-
if (md?.dataDomain == MetadataDataDomains.DynamicDataList
|
72
|
-
return
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
if (md?.dataDomain == MetadataDataDomains.DataList
|
79
|
-
return
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
if (md?.dataDomain == MetadataDataDomains.UserID
|
86
|
-
return
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
68
|
+
let icon = renderMetadataIcon(tid, md, layoutMode, isSelected, iconContextMenu);
|
69
|
+
if (value?.startsWith("{@QueryParam") || value == "{@UserName}" || value == "{@UserID}" || queryOperator == QueryOperators.Custom || isEditable)
|
70
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (SDK_Globals.appModule !== AppModules.SURFER || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'text', maxLength: isEditable ? undefined : maxLength, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
71
|
+
if (md?.dataDomain == MetadataDataDomains.DynamicDataList)
|
72
|
+
return _jsx(TMDynDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, layoutMode: layoutMode, isModifiedWhen: isModifiedWhenInternal(), label: (SDK_Globals.appModule !== AppModules.SURFER || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, md: md, tid: tid, openChooserBySingleClick: openChooserBySingleClick, queryParamsDynDataList: queryParamsDynDataList, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, allowMultipleSelection: multipleSelectionIsenabled, values: value ? [value] : [], showClearButton: !isReadOnlyResult, onValueChanged: (IDs) => {
|
73
|
+
if (!IDs || IDs.length <= 0)
|
74
|
+
onValueChanged?.(undefined);
|
75
|
+
else
|
76
|
+
onValueChanged?.(IDs[0]);
|
77
|
+
} });
|
78
|
+
if (md?.dataDomain == MetadataDataDomains.DataList)
|
79
|
+
return _jsx(TMDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, isModifiedWhen: isModifiedWhenInternal(), label: (SDK_Globals.appModule !== AppModules.SURFER || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, dataListId: md.dataListID, openChooserBySingleClick: openChooserBySingleClick, allowMultipleSelection: multipleSelectionIsenabled, values: value?.split(',').map((item) => !item.startsWith("'") ? item : item.slice(1, -1)) ?? [], showClearButton: !isReadOnlyResult, onValueChanged: (IDs) => {
|
80
|
+
if (!IDs || IDs.length <= 0)
|
81
|
+
onValueChanged?.(undefined);
|
82
|
+
else
|
83
|
+
onValueChanged?.(IDs.join(","));
|
84
|
+
} });
|
85
|
+
if (md?.dataDomain == MetadataDataDomains.UserID)
|
86
|
+
return _jsx(TMUserChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, isModifiedWhen: isModifiedWhenInternal(), label: (SDK_Globals.appModule !== AppModules.SURFER || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, openChooserBySingleClick: openChooserBySingleClick, backgroundColor: TMColors.default_background, showClearButton: !isReadOnlyResult, allowMultipleSelection: multipleSelectionIsenabled, values: value?.split(',').map((item) => !item.startsWith("'") ? Number(item) : Number(item.slice(1, -1))) ?? [], onValueChanged: (IDs) => {
|
87
|
+
if (!IDs || IDs.length <= 0)
|
88
|
+
onValueChanged?.(undefined);
|
89
|
+
else
|
90
|
+
onValueChanged?.(IDs.join(","));
|
91
|
+
} });
|
92
92
|
if (showAsText)
|
93
|
-
return
|
93
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (SDK_Globals.appModule !== AppModules.SURFER || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'text', showClearButton: !isReadOnlyResult, maxLength: maxLength, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
94
94
|
if (showAsNumber)
|
95
|
-
return
|
95
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (SDK_Globals.appModule !== AppModules.SURFER || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'number', showClearButton: !isReadOnlyResult, precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
96
96
|
switch (md?.dataType) {
|
97
97
|
case MetadataDataTypes.DateTime:
|
98
|
-
return _jsx(
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
case MetadataDataTypes.Number: return
|
98
|
+
return _jsx(TMDateBox, { placeholder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', dateDisplayType: getDateDisplayType(md.format?.format), displayFormat: getDateDisplayFormat(md.format?.format), isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, icon: showLabelTop ? icon : undefined, label: (SDK_Globals.appModule !== AppModules.SURFER || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, validationItems: validationItems, disabled: disabled, width: '100%', value: value, showClearButton: !isReadOnlyResult, useDateSerializationFormat: true, containerElement: containerElement, onValueChange: (newValue) => {
|
99
|
+
onValueChange?.(newValue ? newValue.toString() : undefined);
|
100
|
+
onValueChanged?.(newValue ? newValue.toString() : undefined);
|
101
|
+
} });
|
102
|
+
case MetadataDataTypes.Number: return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (SDK_Globals.appModule !== AppModules.SURFER || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'number', showClearButton: !isReadOnlyResult, precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
103
103
|
default:
|
104
104
|
if (showByTextarea) {
|
105
|
-
return
|
105
|
+
return _jsx(TMTextArea, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', rows: 1, readOnly: isReadOnlyResult, label: (SDK_Globals.appModule !== AppModules.SURFER || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, isModifiedWhen: isModifiedWhenInternal(), validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, showClearButton: !isReadOnlyResult, autoFocus: autoFocus, maxLength: maxLength, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => { onValueChanged?.(newValue); }, resize: false });
|
106
106
|
}
|
107
107
|
else {
|
108
|
-
return
|
108
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (SDK_Globals.appModule !== AppModules.SURFER || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, disabled: disabled, validationItems: validationItems, type: 'text', elementStyle: { width: '100%' }, showClearButton: !isReadOnlyResult, autoFocus: autoFocus, maxLength: maxLength, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => { onValueChanged?.(newValue); } });
|
109
109
|
}
|
110
110
|
}
|
111
111
|
};
|
@@ -916,7 +916,7 @@ const TMQdWhereItemValue = ({ whereItem, index, queryParamsDynDataList, onlyEdit
|
|
916
916
|
};
|
917
917
|
const mdValueEmptyDescr = `<${SDKUI_Localizator.Search_EnterValue}...>`;
|
918
918
|
return (_jsxs("div", { ref: ref, id: containerId, style: { width: isEditing && whereItem.operator == QueryOperators.Custom && !onlyEditing ? "100%" : undefined }, children: [(isEditing || onlyEditing) &&
|
919
|
-
_jsxs(StyledRowItem, { children: [showValue1 && _jsx(TMMetadataEditor, { tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None,
|
919
|
+
_jsxs(StyledRowItem, { children: [showValue1 && _jsx(TMMetadataEditor, { tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: whereItem.value1, queryOperator: whereItem.operator, autoFocus: !onlyEditing, containerElement: containerElement, onValueChange: (value) => setCurrentValue1(value), onValueChanged: (value) => { normalizeValue(value, true); } }), showValue2 && _jsx(TMMetadataEditor, { tid: whereItem.tid, mid: whereItem.mid, layoutMode: LayoutModes.None, isEditable: isEditableList, value: whereItem.value1, queryOperator: whereItem.operator, autoFocus: !onlyEditing, containerElement: containerElement, onValueChange: (value) => setCurrentValue2(value), onValueChanged: (value) => { normalizeValue(value, false); } })] }), !isEditing && !onlyEditing && (showValue1 || showValue2) &&
|
920
920
|
_jsxs(StyledDivHorizontal, { children: [(editingMode == EditingModes.Chooser) &&
|
921
921
|
_jsxs(_Fragment, { children: [showDataListChooseForm && !isEditableList &&
|
922
922
|
_jsx(TMDataListItemChooserForm, { height: '500px', width: '450px', allowMultipleSelection: whereItem.operator == QueryOperators.In || whereItem.operator == QueryOperators.NotIn, dataListId: md?.dataListID, selectedIDs: whereItem.value1?.split(',').map((item) => !item.startsWith("'") ? item : item.slice(1, -1)) ?? [], onClose: () => setShowDataListChooseForm(false), onChoose: (IDs) => { IDs && normalizeValue(IDs.length == 1 ? IDs[0] : IDs.map((item) => `${item}`).join(","), true); } }), showDynDataListChooseForm && !isEditableList &&
|
package/lib/helper/helpers.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Colors as ColorsType } from "../components/base/TMEditorBase";
|
2
2
|
import { DeviceType } from "../components";
|
3
|
-
import { AppModules, DataColumnDescriptor, ITopMediaSession, QueryDescriptor, SearchResultDescriptor } from "@topconsultnpm/sdk-ts-beta";
|
3
|
+
import { AppModules, DataColumnDescriptor, ITopMediaSession, MetadataDescriptor, QueryDescriptor, SearchResultDescriptor } from "@topconsultnpm/sdk-ts-beta";
|
4
4
|
import { FormModes, moduleTypes } from "../ts";
|
5
5
|
declare const TABLET_WIDTH = 1024;
|
6
6
|
declare const MOBILE_WIDTH = 640;
|
@@ -18,6 +18,7 @@ export declare const searchResultDescriptorToSimpleArray: (searchResult: SearchR
|
|
18
18
|
export declare const getCompleteMetadataName: (dcmtTypeName: string | undefined, metadataName: string | undefined) => string;
|
19
19
|
export declare const getQueryCountAsync: (qd: QueryDescriptor, showSpinner: boolean) => Promise<void>;
|
20
20
|
export declare function getTIDByMID(mid: number | undefined, defaultTid?: number): number;
|
21
|
+
export declare const getSystemMetadata: (withPerm?: boolean) => MetadataDescriptor[];
|
21
22
|
export declare const canNext: (visibleItems: any[], selectedItems: any[]) => boolean;
|
22
23
|
export declare const getNext: (visibleItems: any[], selectedItems: any[]) => any;
|
23
24
|
export declare const canPrev: (visibleItems: any[], selectedItems: any[]) => boolean;
|
package/lib/helper/helpers.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Colors } from "../utils/theme";
|
2
2
|
import { ButtonNames, DeviceType, TMExceptionBoxManager, TMMessageBoxManager, TMSpinner } from "../components";
|
3
|
-
import { SDK_Globals, SystemMIDsAsNumber, TopMediaServer } from "@topconsultnpm/sdk-ts-beta";
|
3
|
+
import { AccessLevels, MetadataDataDomains, MetadataDataTypes, MetadataDescriptor, MetadataFormatDescriptor, MetadataFormats, MetadataPermission, SDK_Globals, SystemMIDs, SystemMIDsAsNumber, TopMediaServer } from "@topconsultnpm/sdk-ts-beta";
|
4
4
|
import { Buffer } from 'buffer';
|
5
5
|
import { buildTypes, FormModes, moduleTypes } from "../ts";
|
6
6
|
import { SDKUI_Localizator } from "./SDKUI_Localizator";
|
@@ -197,6 +197,170 @@ export function getTIDByMID(mid, defaultTid = 0) {
|
|
197
197
|
return defaultTid;
|
198
198
|
return tid;
|
199
199
|
}
|
200
|
+
export const getSystemMetadata = (withPerm) => {
|
201
|
+
let sysMDs = [];
|
202
|
+
let md = new MetadataDescriptor();
|
203
|
+
md.dataType = MetadataDataTypes.Number;
|
204
|
+
md.length = 10;
|
205
|
+
md.isRequired = 1;
|
206
|
+
md.isSystem = 1;
|
207
|
+
md.id = SystemMIDsAsNumber.TID;
|
208
|
+
md.name = SystemMIDs.TID;
|
209
|
+
md.nameLoc = SystemMIDs.TID;
|
210
|
+
sysMDs.push(md);
|
211
|
+
md = new MetadataDescriptor();
|
212
|
+
md.dataType = MetadataDataTypes.Number;
|
213
|
+
md.length = 10;
|
214
|
+
md.isRequired = 1;
|
215
|
+
md.isSystem = 1;
|
216
|
+
md.id = SystemMIDsAsNumber.DID;
|
217
|
+
md.name = SystemMIDs.DID;
|
218
|
+
md.nameLoc = SystemMIDs.DID;
|
219
|
+
sysMDs.push(md);
|
220
|
+
md = new MetadataDescriptor();
|
221
|
+
md.dataType = MetadataDataTypes.Number;
|
222
|
+
md.length = 10;
|
223
|
+
md.isRequired = 1;
|
224
|
+
md.isSystem = 1;
|
225
|
+
md.dataDomain = MetadataDataDomains.UserID;
|
226
|
+
md.id = SystemMIDsAsNumber.OwnerID;
|
227
|
+
md.name = SystemMIDs.OwnerID;
|
228
|
+
md.nameLoc = SystemMIDs.OwnerID;
|
229
|
+
sysMDs.push(md);
|
230
|
+
md = new MetadataDescriptor();
|
231
|
+
md.dataType = MetadataDataTypes.Number;
|
232
|
+
md.length = 10;
|
233
|
+
md.isRequired = 1;
|
234
|
+
md.isSystem = 1;
|
235
|
+
md.dataDomain = MetadataDataDomains.UserID;
|
236
|
+
md.id = SystemMIDsAsNumber.UpdaterID;
|
237
|
+
md.name = SystemMIDs.UpdaterID;
|
238
|
+
md.nameLoc = SystemMIDs.UpdaterID;
|
239
|
+
sysMDs.push(md);
|
240
|
+
md = new MetadataDescriptor();
|
241
|
+
md.dataType = MetadataDataTypes.Number;
|
242
|
+
md.length = 10;
|
243
|
+
md.isRequired = 1;
|
244
|
+
md.isSystem = 1;
|
245
|
+
md.id = SystemMIDsAsNumber.FileCount;
|
246
|
+
md.name = SystemMIDs.FileCount;
|
247
|
+
md.nameLoc = SystemMIDs.FileCount;
|
248
|
+
sysMDs.push(md);
|
249
|
+
md = new MetadataDescriptor();
|
250
|
+
md.dataType = MetadataDataTypes.Varchar;
|
251
|
+
md.length = 10;
|
252
|
+
md.isSystem = 1;
|
253
|
+
md.id = SystemMIDsAsNumber.FileExt;
|
254
|
+
md.name = SystemMIDs.FileExt;
|
255
|
+
md.nameLoc = SystemMIDs.FileExt;
|
256
|
+
sysMDs.push(md);
|
257
|
+
md = new MetadataDescriptor();
|
258
|
+
md.dataType = MetadataDataTypes.Number;
|
259
|
+
md.length = 10;
|
260
|
+
md.isRequired = 1;
|
261
|
+
md.isSystem = 1;
|
262
|
+
md.format = new MetadataFormatDescriptor();
|
263
|
+
md.format.format = MetadataFormats.NumberWithThousandsSeparator;
|
264
|
+
md.id = SystemMIDsAsNumber.FileSize;
|
265
|
+
md.name = SystemMIDs.FileSize;
|
266
|
+
md.nameLoc = SystemMIDs.FileSize;
|
267
|
+
sysMDs.push(md);
|
268
|
+
md = new MetadataDescriptor();
|
269
|
+
md.dataType = MetadataDataTypes.Number;
|
270
|
+
md.length = 10;
|
271
|
+
md.isRequired = 1;
|
272
|
+
md.isSystem = 1;
|
273
|
+
md.id = SystemMIDsAsNumber.PageCount;
|
274
|
+
md.name = SystemMIDs.PageCount;
|
275
|
+
md.nameLoc = SystemMIDs.PageCount;
|
276
|
+
sysMDs.push(md);
|
277
|
+
md = new MetadataDescriptor();
|
278
|
+
md.dataType = MetadataDataTypes.Number;
|
279
|
+
md.length = 10;
|
280
|
+
md.isRequired = 1;
|
281
|
+
md.isSystem = 1;
|
282
|
+
md.id = SystemMIDsAsNumber.IsSigned;
|
283
|
+
md.name = SystemMIDs.IsSigned;
|
284
|
+
md.nameLoc = SystemMIDs.IsSigned;
|
285
|
+
sysMDs.push(md);
|
286
|
+
md = new MetadataDescriptor();
|
287
|
+
md.dataType = MetadataDataTypes.Number;
|
288
|
+
md.length = 10;
|
289
|
+
md.isRequired = 1;
|
290
|
+
md.isSystem = 1;
|
291
|
+
md.id = SystemMIDsAsNumber.IsShared;
|
292
|
+
md.name = SystemMIDs.IsShared;
|
293
|
+
md.nameLoc = SystemMIDs.IsShared;
|
294
|
+
sysMDs.push(md);
|
295
|
+
md = new MetadataDescriptor();
|
296
|
+
md.dataType = MetadataDataTypes.Number;
|
297
|
+
md.length = 10;
|
298
|
+
md.isRequired = 1;
|
299
|
+
md.isSystem = 1;
|
300
|
+
md.id = SystemMIDsAsNumber.IsMail;
|
301
|
+
md.name = SystemMIDs.IsMail;
|
302
|
+
md.nameLoc = SystemMIDs.IsMail;
|
303
|
+
sysMDs.push(md);
|
304
|
+
md = new MetadataDescriptor();
|
305
|
+
md.dataType = MetadataDataTypes.Number;
|
306
|
+
md.length = 10;
|
307
|
+
md.isRequired = 1;
|
308
|
+
md.isSystem = 1;
|
309
|
+
md.id = SystemMIDsAsNumber.IsLogDel;
|
310
|
+
md.name = SystemMIDs.IsLogDel;
|
311
|
+
md.nameLoc = SystemMIDs.IsLogDel;
|
312
|
+
sysMDs.push(md);
|
313
|
+
md = new MetadataDescriptor();
|
314
|
+
md.dataType = MetadataDataTypes.DateTime;
|
315
|
+
md.isRequired = 1;
|
316
|
+
md.isSystem = 1;
|
317
|
+
md.format = new MetadataFormatDescriptor();
|
318
|
+
md.format.format = MetadataFormats.ShortDateLongTime;
|
319
|
+
md.id = SystemMIDsAsNumber.IsLex;
|
320
|
+
md.name = SystemMIDs.IsLex;
|
321
|
+
md.nameLoc = SystemMIDs.IsLex;
|
322
|
+
sysMDs.push(md);
|
323
|
+
md = new MetadataDescriptor();
|
324
|
+
md.dataType = MetadataDataTypes.DateTime;
|
325
|
+
md.isRequired = 1;
|
326
|
+
md.isSystem = 1;
|
327
|
+
md.format = new MetadataFormatDescriptor();
|
328
|
+
md.format.format = MetadataFormats.ShortDateLongTime;
|
329
|
+
md.id = SystemMIDsAsNumber.IsLex;
|
330
|
+
md.name = SystemMIDs.IsLex;
|
331
|
+
md.nameLoc = SystemMIDs.IsLex;
|
332
|
+
sysMDs.push(md);
|
333
|
+
md = new MetadataDescriptor();
|
334
|
+
md.dataType = MetadataDataTypes.DateTime;
|
335
|
+
md.isRequired = 1;
|
336
|
+
md.isSystem = 1;
|
337
|
+
md.format = new MetadataFormatDescriptor();
|
338
|
+
md.format.format = MetadataFormats.ShortDateLongTime;
|
339
|
+
md.id = SystemMIDsAsNumber.CreationTime;
|
340
|
+
md.name = SystemMIDs.CreationTime;
|
341
|
+
md.nameLoc = SystemMIDs.CreationTime;
|
342
|
+
sysMDs.push(md);
|
343
|
+
md = new MetadataDescriptor();
|
344
|
+
md.dataType = MetadataDataTypes.DateTime;
|
345
|
+
md.isRequired = 1;
|
346
|
+
md.isSystem = 1;
|
347
|
+
md.format = new MetadataFormatDescriptor();
|
348
|
+
md.format.format = MetadataFormats.ShortDateLongTime;
|
349
|
+
md.id = SystemMIDsAsNumber.LastUpdateTime;
|
350
|
+
md.name = SystemMIDs.LastUpdateTime;
|
351
|
+
md.nameLoc = SystemMIDs.LastUpdateTime;
|
352
|
+
sysMDs.push(md);
|
353
|
+
if (withPerm) {
|
354
|
+
sysMDs.forEach((md) => {
|
355
|
+
md.perm = new MetadataPermission();
|
356
|
+
md.perm.canArchive = AccessLevels.No;
|
357
|
+
md.perm.canView = AccessLevels.Yes;
|
358
|
+
md.perm.canSearch = AccessLevels.Yes;
|
359
|
+
md.perm.canUpdate = AccessLevels.No;
|
360
|
+
});
|
361
|
+
}
|
362
|
+
return sysMDs;
|
363
|
+
};
|
200
364
|
//#region Form, Page Helpers
|
201
365
|
export const canNext = (visibleItems, selectedItems) => {
|
202
366
|
if (!visibleItems)
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import { MetadataDescriptor, SystemMIDsAsNumber, QueryDescriptor, SelectItem } from '@topconsultnpm/sdk-ts-beta';
|
2
2
|
export type TID_Alias = {
|
3
3
|
tid: number;
|
4
4
|
alias: string | undefined;
|
5
5
|
};
|
6
6
|
export declare const getTIDsByQd: (qd: QueryDescriptor | undefined) => TID_Alias[];
|
7
|
-
export declare const getDcmtTypesByQdAsync: (qd: QueryDescriptor) => Promise<DcmtTypeDescriptor[]>;
|
7
|
+
export declare const getDcmtTypesByQdAsync: (qd: QueryDescriptor) => Promise<import("@topconsultnpm/sdk-ts-beta").DcmtTypeDescriptor[]>;
|
8
8
|
export declare const displayMetadataValue: (md: MetadataDescriptor | undefined, value: string | undefined, valueEmptyDescription?: string) => string;
|
9
9
|
export declare const IsParametricQuery: (qd: QueryDescriptor | undefined) => boolean;
|
10
10
|
export declare const addHiddenSelectItem: (select: SelectItem[], tid: number | undefined, mid: SystemMIDsAsNumber) => void;
|