@singularsystems/neo-react 1.0.0-alpha.2 → 1.0.0-beta.0
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/CHANGELOG.md +98 -0
- package/README.md +4 -0
- package/dist/Modules/NeoReactModule.d.ts +4 -4
- package/dist/Modules/NeoReactModule.js +28 -26
- package/dist/Modules/ReactSetup.d.ts +2 -2
- package/dist/Modules/ReactSetup.js +17 -17
- package/dist/Modules/Types.d.ts +63 -61
- package/dist/Modules/Types.js +13 -12
- package/dist/React/AutoRunner.d.ts +5 -5
- package/dist/React/AutoRunner.js +94 -92
- package/dist/React/DataView.d.ts +6 -6
- package/dist/React/DataView.js +11 -11
- package/dist/React/ReactModelCreator.d.ts +11 -11
- package/dist/React/ReactModelCreator.js +165 -162
- package/dist/ReactComponents/Button.d.ts +24 -23
- package/dist/ReactComponents/Button.js +131 -123
- package/dist/ReactComponents/Card.d.ts +24 -23
- package/dist/ReactComponents/Card.js +56 -54
- package/dist/ReactComponents/Collapsable.d.ts +23 -23
- package/dist/ReactComponents/Collapsable.js +38 -38
- package/dist/ReactComponents/CollapsableBase.d.ts +13 -13
- package/dist/ReactComponents/CollapsableBase.js +42 -42
- package/dist/ReactComponents/ColorPicker.d.ts +26 -26
- package/dist/ReactComponents/ColorPicker.js +67 -67
- package/dist/ReactComponents/ComponentBase.d.ts +17 -17
- package/dist/ReactComponents/ComponentBase.js +33 -33
- package/dist/ReactComponents/ContextMenu/ContextMenu.d.ts +25 -24
- package/dist/ReactComponents/ContextMenu/ContextMenu.js +91 -88
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.d.ts +14 -14
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.js +48 -48
- package/dist/ReactComponents/ContextMenu/ContextMenuState.d.ts +8 -7
- package/dist/ReactComponents/ContextMenu/ContextMenuState.js +23 -23
- package/dist/ReactComponents/DatePicker.d.ts +19 -19
- package/dist/ReactComponents/DatePicker.js +53 -53
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.d.ts +93 -83
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +222 -188
- package/dist/ReactComponents/DropDown/DropDown.d.ts +44 -44
- package/dist/ReactComponents/DropDown/DropDown.js +138 -134
- package/dist/ReactComponents/DropDown/DropDownBase.d.ts +16 -15
- package/dist/ReactComponents/DropDown/DropDownBase.js +86 -108
- package/dist/ReactComponents/DropDown/LookupHelper.d.ts +13 -0
- package/dist/ReactComponents/DropDown/LookupHelper.js +45 -0
- package/dist/ReactComponents/ErrorHandler.d.ts +9 -8
- package/dist/ReactComponents/ErrorHandler.js +92 -91
- package/dist/ReactComponents/FileManager/FileBasicInput.d.ts +20 -20
- package/dist/ReactComponents/FileManager/FileBasicInput.js +70 -70
- package/dist/ReactComponents/FileManager/FileContext.d.ts +16 -16
- package/dist/ReactComponents/FileManager/FileContext.js +24 -24
- package/dist/ReactComponents/FileManager/FileDropArea.d.ts +19 -18
- package/dist/ReactComponents/FileManager/FileDropArea.js +66 -64
- package/dist/ReactComponents/FileManager/FileInput.d.ts +44 -42
- package/dist/ReactComponents/FileManager/FileInput.js +191 -189
- package/dist/ReactComponents/FileManager/FileUploadButton.d.ts +17 -17
- package/dist/ReactComponents/FileManager/FileUploadButton.js +49 -49
- package/dist/ReactComponents/FileManager/FileUploadProgress.d.ts +14 -14
- package/dist/ReactComponents/FileManager/FileUploadProgress.js +35 -35
- package/dist/ReactComponents/Form.d.ts +19 -18
- package/dist/ReactComponents/Form.js +90 -90
- package/dist/ReactComponents/FormContext.d.ts +33 -31
- package/dist/ReactComponents/FormContext.js +39 -40
- package/dist/ReactComponents/FormGroup/FormGroup.d.ts +37 -37
- package/dist/ReactComponents/FormGroup/FormGroup.js +83 -84
- package/dist/ReactComponents/FormGroup/FormGroupFloating.d.ts +19 -19
- package/dist/ReactComponents/FormGroup/FormGroupFloating.js +97 -97
- package/dist/ReactComponents/FormGroup/FormGroupInline.d.ts +11 -11
- package/dist/ReactComponents/FormGroup/FormGroupInline.js +43 -43
- package/dist/ReactComponents/Grid/ButtonColumn.d.ts +47 -47
- package/dist/ReactComponents/Grid/ButtonColumn.js +81 -82
- package/dist/ReactComponents/Grid/Column.d.ts +47 -47
- package/dist/ReactComponents/Grid/Column.js +205 -205
- package/dist/ReactComponents/Grid/ColumnHelper.d.ts +12 -12
- package/dist/ReactComponents/Grid/ColumnHelper.js +19 -19
- package/dist/ReactComponents/Grid/Grid.d.ts +87 -90
- package/dist/ReactComponents/Grid/Grid.js +203 -203
- package/dist/ReactComponents/Grid/Row.d.ts +81 -81
- package/dist/ReactComponents/Grid/Row.js +200 -201
- package/dist/ReactComponents/Grid/_Exports.d.ts +5 -5
- package/dist/ReactComponents/Grid/_Exports.js +5 -5
- package/dist/ReactComponents/GridLayout.d.ts +20 -20
- package/dist/ReactComponents/GridLayout.js +38 -38
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.d.ts +23 -0
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.js +43 -0
- package/dist/ReactComponents/Icons/IIconFactory.d.ts +21 -0
- package/dist/ReactComponents/Icons/IIconFactory.js +1 -0
- package/dist/ReactComponents/Icons/IconFactory.d.ts +9 -0
- package/dist/ReactComponents/Icons/IconFactory.js +45 -0
- package/dist/ReactComponents/Icons/index.d.ts +3 -0
- package/dist/ReactComponents/Icons/index.js +2 -0
- package/dist/ReactComponents/Input.d.ts +45 -45
- package/dist/ReactComponents/Input.js +153 -152
- package/dist/ReactComponents/InputHelpers.d.ts +6 -5
- package/dist/ReactComponents/InputHelpers.js +29 -33
- package/dist/ReactComponents/Link.d.ts +13 -13
- package/dist/ReactComponents/Link.js +28 -28
- package/dist/ReactComponents/Loader.d.ts +18 -18
- package/dist/ReactComponents/Loader.js +57 -57
- package/dist/ReactComponents/Misc.d.ts +15 -15
- package/dist/ReactComponents/Misc.js +28 -28
- package/dist/ReactComponents/Modal/Modal.d.ts +11 -11
- package/dist/ReactComponents/Modal/Modal.js +129 -129
- package/dist/ReactComponents/Modal/ModalContainer.d.ts +17 -17
- package/dist/ReactComponents/Modal/ModalContainer.js +37 -37
- package/dist/ReactComponents/Modal/ModalPortal.d.ts +16 -15
- package/dist/ReactComponents/Modal/ModalPortal.js +27 -27
- package/dist/ReactComponents/Notifications/Alert.d.ts +7 -6
- package/dist/ReactComponents/Notifications/Alert.js +38 -35
- package/dist/ReactComponents/Notifications/Toast.d.ts +9 -8
- package/dist/ReactComponents/Notifications/Toast.js +47 -45
- package/dist/ReactComponents/Notifications/ToastContainer.d.ts +8 -8
- package/dist/ReactComponents/Notifications/ToastContainer.js +18 -18
- package/dist/ReactComponents/NumberInput.d.ts +57 -50
- package/dist/ReactComponents/NumberInput.js +260 -246
- package/dist/ReactComponents/Paging/BasicPagerControls.d.ts +26 -25
- package/dist/ReactComponents/Paging/BasicPagerControls.js +57 -55
- package/dist/ReactComponents/Paging/PageSizeControl.d.ts +11 -11
- package/dist/ReactComponents/Paging/PageSizeControl.js +21 -21
- package/dist/ReactComponents/Paging/Pager.d.ts +24 -24
- package/dist/ReactComponents/Paging/Pager.js +41 -41
- package/dist/ReactComponents/ProgressBar.d.ts +19 -19
- package/dist/ReactComponents/ProgressBar.js +52 -52
- package/dist/ReactComponents/PropTypes.d.ts +161 -161
- package/dist/ReactComponents/PropTypes.js +253 -236
- package/dist/ReactComponents/RadioList.d.ts +29 -29
- package/dist/ReactComponents/RadioList.js +59 -77
- package/dist/ReactComponents/Slider.d.ts +28 -28
- package/dist/ReactComponents/Slider.js +76 -76
- package/dist/ReactComponents/StateObserver.d.ts +15 -15
- package/dist/ReactComponents/StateObserver.js +35 -35
- package/dist/ReactComponents/Tabs/Tab.d.ts +42 -41
- package/dist/ReactComponents/Tabs/Tab.js +71 -72
- package/dist/ReactComponents/Tabs/TabContainer.d.ts +44 -44
- package/dist/ReactComponents/Tabs/TabContainer.js +98 -98
- package/dist/ReactComponents/Tabs/TabManager.d.ts +62 -62
- package/dist/ReactComponents/Tabs/TabManager.js +154 -154
- package/dist/ReactComponents/Tooltip.d.ts +20 -19
- package/dist/ReactComponents/Tooltip.js +51 -51
- package/dist/ReactComponents/TooltipHelper.d.ts +8 -8
- package/dist/ReactComponents/TooltipHelper.js +84 -84
- package/dist/ReactComponents/TooltipProvider.d.ts +30 -30
- package/dist/ReactComponents/TooltipProvider.js +111 -111
- package/dist/ReactComponents/ValidationSummary.d.ts +23 -22
- package/dist/ReactComponents/ValidationSummary.js +46 -43
- package/dist/ReactComponents/_Exports.d.ts +41 -41
- package/dist/ReactComponents/_Exports.js +41 -41
- package/dist/ReactComponents/_Managers.d.ts +4 -4
- package/dist/ReactComponents/_Managers.js +4 -4
- package/dist/Routing/BreadCrumbItem.d.ts +14 -14
- package/dist/Routing/BreadCrumbItem.js +12 -12
- package/dist/Routing/IRouteChangedProps.d.ts +31 -31
- package/dist/Routing/IRouteChangedProps.js +1 -1
- package/dist/Routing/IRouteParameter.d.ts +22 -22
- package/dist/Routing/IRouteParameter.js +9 -9
- package/dist/Routing/MenuRoute.d.ts +25 -24
- package/dist/Routing/MenuRoute.js +24 -24
- package/dist/Routing/NavigationHelper.d.ts +41 -40
- package/dist/Routing/NavigationHelper.js +61 -61
- package/dist/Routing/PageLeaveHandler.d.ts +13 -13
- package/dist/Routing/PageLeaveHandler.js +74 -74
- package/dist/Routing/RouteProvider.d.ts +31 -31
- package/dist/Routing/RouteProvider.js +92 -92
- package/dist/Routing/RouteView.d.ts +50 -50
- package/dist/Routing/RouteView.js +143 -144
- package/dist/Routing/RoutingState.d.ts +18 -15
- package/dist/Routing/RoutingState.js +45 -40
- package/dist/Routing/ViewParameter.d.ts +80 -58
- package/dist/Routing/ViewParameter.js +116 -95
- package/dist/Routing/ViewParameterList.d.ts +53 -53
- package/dist/Routing/ViewParameterList.js +163 -145
- package/dist/Routing/index.d.ts +9 -9
- package/dist/Routing/index.js +6 -6
- package/dist/Services/DisposeHelper.d.ts +15 -15
- package/dist/Services/DisposeHelper.js +40 -41
- package/dist/Services/IDisposeHelper.d.ts +12 -12
- package/dist/Services/IDisposeHelper.js +1 -1
- package/dist/Views/EmptyViewModel.d.ts +5 -5
- package/dist/Views/EmptyViewModel.js +14 -14
- package/dist/Views/IViewModel.d.ts +16 -16
- package/dist/Views/IViewModel.js +1 -1
- package/dist/Views/PersistentViewBase.d.ts +10 -10
- package/dist/Views/PersistentViewBase.js +21 -21
- package/dist/Views/ViewBase.d.ts +70 -71
- package/dist/Views/ViewBase.js +166 -153
- package/dist/Views/ViewComponentBase.d.ts +19 -13
- package/dist/Views/ViewComponentBase.js +24 -21
- package/dist/Views/ViewModelBase.d.ts +57 -56
- package/dist/Views/ViewModelBase.js +122 -118
- package/dist/Views/ViewState.d.ts +13 -13
- package/dist/Views/ViewState.js +9 -9
- package/dist/Views/index.d.ts +5 -5
- package/dist/Views/index.js +5 -5
- package/dist/index.d.ts +11 -10
- package/dist/index.js +10 -9
- package/package.json +26 -26
- package/styles/DatePicker.scss +2 -2
- package/styles/Forms.scss +5 -0
- package/styles/Validation.scss +0 -9
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
import { Model, Components } from '@singularsystems/neo-core';
|
|
2
|
-
import { IInputSpecificProps } from './Input';
|
|
3
|
-
import DropDown, { IDropDownSpecificProps } from './DropDown/DropDown';
|
|
4
|
-
import NumberInput, { INumberInputSpecificProps } from './NumberInput';
|
|
5
|
-
import DatePicker from './DatePicker';
|
|
6
|
-
import Input from './Input';
|
|
7
|
-
import RadioList, { IRadioListSpecificProps } from './RadioList';
|
|
8
|
-
import * as React from 'react';
|
|
9
|
-
import { TransformMetaType } from '@singularsystems/neo-core/dist/Model/IModelBase';
|
|
10
|
-
import PropertyInfo from '@singularsystems/neo-core/dist/Model/PropertyInfo';
|
|
11
|
-
import { IComponentBase } from './ComponentBase';
|
|
12
|
-
import FileInput, { IFileEditorProps } from './FileManager/FileInput';
|
|
13
|
-
import { FormContextParams } from './FormContext';
|
|
14
|
-
export
|
|
15
|
-
export declare enum ControlType {
|
|
16
|
-
Date = 0,
|
|
17
|
-
Number = 1,
|
|
18
|
-
DropDown = 2,
|
|
19
|
-
Text = 3,
|
|
20
|
-
File = 4,
|
|
21
|
-
RadioList = 5
|
|
22
|
-
}
|
|
23
|
-
export declare enum CheckboxType {
|
|
24
|
-
None = 0,
|
|
25
|
-
Checkbox = 1,
|
|
26
|
-
Switch = 2
|
|
27
|
-
}
|
|
28
|
-
export interface ICommonEditorProps {
|
|
29
|
-
/** True if the editor should be readonly. This is set automatically if you use display instead of bind on a FormGroup / Column. */
|
|
30
|
-
isReadOnly?: boolean;
|
|
31
|
-
/** True if the editor should be readonly. This is set automatically if you use display instead of bind on a FormGroup / Column. */
|
|
32
|
-
readOnly?: boolean;
|
|
33
|
-
/** True if the editor should be disabled */
|
|
34
|
-
isDisabled?: boolean;
|
|
35
|
-
/** True if the editor should be disabled */
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
/** Will show this text in a block before the input */
|
|
38
|
-
prependText?: string;
|
|
39
|
-
/** Will show this text in a block after the input */
|
|
40
|
-
appendText?: string;
|
|
41
|
-
/** Additional element to include before the input element */
|
|
42
|
-
prepend?: (() => JSX.Element) | JSX.Element | null;
|
|
43
|
-
/** Additional element to include after the input element */
|
|
44
|
-
append?: (() => JSX.Element) | JSX.Element | null;
|
|
45
|
-
/** True if append / prepend is set, which means this must be an editor as part of a bs editor group. */
|
|
46
|
-
requiresGroup?: boolean;
|
|
47
|
-
/** Reference to the input dom element */
|
|
48
|
-
inputElement?: React.RefObject<HTMLElement>;
|
|
49
|
-
}
|
|
50
|
-
export interface IBindableEditorPropsNoBase extends ICommonEditorProps {
|
|
51
|
-
bind: Model.IPropertyInstance;
|
|
52
|
-
placeholder?: string | boolean;
|
|
53
|
-
}
|
|
54
|
-
export interface IBindableEditorProps<T = HTMLElement> extends IBindableEditorPropsNoBase, React.HTMLProps<T> {
|
|
55
|
-
/**
|
|
56
|
-
* HTML Placeholder to display when the input control has no value.
|
|
57
|
-
* Value of true results in the readable property name being used.
|
|
58
|
-
*/
|
|
59
|
-
placeholder?: any;
|
|
60
|
-
}
|
|
61
|
-
interface IEditorSelectorProps<T> {
|
|
62
|
-
/** Drop down props if this editor must be a drop down */
|
|
63
|
-
select?: IDropDownSpecificProps<T>;
|
|
64
|
-
/** Input props if this editor is a text / check input */
|
|
65
|
-
input?: IInputSpecificProps;
|
|
66
|
-
/** Number props if this editor is a numeric editor */
|
|
67
|
-
numProps?: INumberInputSpecificProps;
|
|
68
|
-
/** Date props if this editor is a date editor */
|
|
69
|
-
dateProps?: Components.IPartialDateProps;
|
|
70
|
-
/** Radio list props if this is a radio button list. */
|
|
71
|
-
radioList?: IRadioListSpecificProps
|
|
72
|
-
/** File props if this editor is a file editor */
|
|
73
|
-
fileProps?: IFileEditorProps;
|
|
74
|
-
}
|
|
75
|
-
interface ICommonContainerOwnProps {
|
|
76
|
-
/** Label / header text */
|
|
77
|
-
label?: string | JSX.Element;
|
|
78
|
-
/** True if the editor / display value should be suppressed. Children will still be rendered. */
|
|
79
|
-
suppressDefaultContent?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Allows use of a custom component in a form group / column.
|
|
82
|
-
* Child components can read information from the container using the EditorContainerContext.
|
|
83
|
-
* suppressDefaultContent will be set to true if unset.
|
|
84
|
-
*/
|
|
85
|
-
bindContext?: Model.IPropertyInstance;
|
|
86
|
-
/**
|
|
87
|
-
* Tooltip to display on hover of the editor.
|
|
88
|
-
*/
|
|
89
|
-
editorTooltip?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Classname to add to the editor.
|
|
92
|
-
*/
|
|
93
|
-
editorClassName?: string;
|
|
94
|
-
/**
|
|
95
|
-
* Styles to apply to the editor.
|
|
96
|
-
*/
|
|
97
|
-
editorStyle?: React.CSSProperties;
|
|
98
|
-
}
|
|
99
|
-
interface IEditorAndSelectorProps<TElement, TData> extends IBindableEditorProps<TElement>, IEditorSelectorProps<TData> {
|
|
100
|
-
}
|
|
101
|
-
export interface IEditorContainerProps<TElement, TData> extends Partial<IEditorAndSelectorProps<TElement, TData>>, ICommonContainerOwnProps {
|
|
102
|
-
label?: Components.ElementOrText;
|
|
103
|
-
/** Bind property if you want the editor to be readonly. */
|
|
104
|
-
display?: Model.IPropertyInstance;
|
|
105
|
-
/** Dom properties to apply to the underlying editor. */
|
|
106
|
-
editorProps?: React.HTMLProps<HTMLElement>;
|
|
107
|
-
}
|
|
108
|
-
export interface IEditorNormalisedProps<TDom, TData> extends IEditorSelectorProps<TData> {
|
|
109
|
-
bind: Model.IPropertyInstance;
|
|
110
|
-
editor: IBindableEditorProps;
|
|
111
|
-
editorDom: TDom;
|
|
112
|
-
/** True if the editor is in a form group with a label and error display. */
|
|
113
|
-
inGroup: boolean;
|
|
114
|
-
/** Unique id for the editor and label. */
|
|
115
|
-
uniqueID: string;
|
|
116
|
-
isBootstrap: boolean;
|
|
117
|
-
}
|
|
118
|
-
export interface IEditorContainerNormalisedProps<TDom, TData> extends IEditorNormalisedProps<any, TData> {
|
|
119
|
-
container: ICommonContainerOwnProps;
|
|
120
|
-
containerDom: TDom;
|
|
121
|
-
}
|
|
122
|
-
export declare class BindPropsHelper {
|
|
123
|
-
static readonly DataFieldName = "data-field-name";
|
|
124
|
-
private static _config;
|
|
125
|
-
private static get config();
|
|
126
|
-
/**
|
|
127
|
-
* Gets the correct input control type based on the props. E.g. Input / DatePicker / Select
|
|
128
|
-
* @param props Props passed to a multi type input container. E.g. FormGroup / Column
|
|
129
|
-
*/
|
|
130
|
-
static getFormControl(props: IEditorNormalisedProps<any, any>): React.CElement<import("./DatePicker").INeoDatePickerProps, DatePicker> | React.CElement<import("./NumberInput").INumberInputProps, NumberInput> | React.CElement<import("./DropDown/DropDown").IDropDownProps<unknown>, DropDown<unknown>> | React.CElement<IFileEditorProps, FileInput> | React.CElement<import("./Input").IInputProps, Input> | React.CElement<import("./RadioList").IRadioListProps
|
|
131
|
-
static getControlType(props: IEditorNormalisedProps<any, any>): ControlType;
|
|
132
|
-
static getCheckBoxType(props: IEditorNormalisedProps<any, any>, instance?: any): CheckboxType;
|
|
133
|
-
/**
|
|
134
|
-
* Get the main bind property from a props object
|
|
135
|
-
*/
|
|
136
|
-
static getBindProperty<T>(allProps: IEditorContainerProps<T, any>): Model.IPropertyInstance;
|
|
137
|
-
static splitCommonEditorProps<T extends ICommonEditorProps>(props: T): {
|
|
138
|
-
editor: {
|
|
139
|
-
isReadOnly: boolean | undefined;
|
|
140
|
-
isDisabled: boolean | undefined;
|
|
141
|
-
prependText: string | undefined;
|
|
142
|
-
prepend: JSX.Element | (() => JSX.Element) | null | undefined;
|
|
143
|
-
appendText: string | undefined;
|
|
144
|
-
append: JSX.Element | (() => JSX.Element) | null | undefined;
|
|
145
|
-
inputElement: React.RefObject<HTMLElement> | undefined;
|
|
146
|
-
requiresGroup: boolean;
|
|
147
|
-
};
|
|
148
|
-
rest: Omit<T, "disabled" | "readOnly" | "isReadOnly" | "isDisabled" | "prependText" | "appendText" | "prepend" | "append" | "inputElement">;
|
|
149
|
-
};
|
|
150
|
-
static normaliseContainerProps<T, TContainerDom = React.HTMLProps<T>, TData = any>(component: IComponentBase, props: IEditorContainerProps<T, TData>, inGroup: boolean, isBootstrap?: boolean): IEditorContainerNormalisedProps<TContainerDom, TData>;
|
|
151
|
-
static normaliseEditorProps<T, TDom = React.HTMLProps<T>>(component: IComponentBase, props: (IEditorAndSelectorProps<T, any> & TDom) | IEditorNormalisedProps<TDom, any>): IEditorNormalisedProps<TDom, any>;
|
|
152
|
-
static getPlaceholderText(placeholder: string | boolean | undefined, property: PropertyInfo): string | undefined;
|
|
153
|
-
static autoSetDomProperties<TDom extends React.HTMLProps<HTMLElement>>(props: IEditorNormalisedProps<TDom, any>, formContext: FormContextParams, componentBlurFn?: (e: React.FocusEvent<HTMLElement>) => void, componentFocusFn?: (e: React.FocusEvent<HTMLElement>) => void): TDom;
|
|
154
|
-
/**
|
|
155
|
-
* Intercept the user specified blur event, and run the validation onBlur logic first.
|
|
156
|
-
* @param props Props specified on component.
|
|
157
|
-
* @param blurFn Blur function used internally by component.
|
|
158
|
-
*/
|
|
159
|
-
private static blurIntercept;
|
|
160
|
-
}
|
|
161
|
-
export {};
|
|
1
|
+
import { Model, Components } from '@singularsystems/neo-core';
|
|
2
|
+
import { IInputSpecificProps } from './Input';
|
|
3
|
+
import DropDown, { IDropDownSpecificProps } from './DropDown/DropDown';
|
|
4
|
+
import NumberInput, { INumberInputSpecificProps } from './NumberInput';
|
|
5
|
+
import DatePicker from './DatePicker';
|
|
6
|
+
import Input from './Input';
|
|
7
|
+
import RadioList, { IRadioListSpecificProps } from './RadioList';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { TransformMetaType } from '@singularsystems/neo-core/dist/Model/IModelBase';
|
|
10
|
+
import PropertyInfo from '@singularsystems/neo-core/dist/Model/PropertyInfo';
|
|
11
|
+
import { IComponentBase } from './ComponentBase';
|
|
12
|
+
import FileInput, { IFileEditorProps } from './FileManager/FileInput';
|
|
13
|
+
import { FormContextParams } from './FormContext';
|
|
14
|
+
export type ItemCallback<T> = (item: T, meta: TransformMetaType<T>) => React.ReactNode;
|
|
15
|
+
export declare enum ControlType {
|
|
16
|
+
Date = 0,
|
|
17
|
+
Number = 1,
|
|
18
|
+
DropDown = 2,
|
|
19
|
+
Text = 3,
|
|
20
|
+
File = 4,
|
|
21
|
+
RadioList = 5
|
|
22
|
+
}
|
|
23
|
+
export declare enum CheckboxType {
|
|
24
|
+
None = 0,
|
|
25
|
+
Checkbox = 1,
|
|
26
|
+
Switch = 2
|
|
27
|
+
}
|
|
28
|
+
export interface ICommonEditorProps {
|
|
29
|
+
/** True if the editor should be readonly. This is set automatically if you use display instead of bind on a FormGroup / Column. */
|
|
30
|
+
isReadOnly?: boolean;
|
|
31
|
+
/** True if the editor should be readonly. This is set automatically if you use display instead of bind on a FormGroup / Column. */
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
/** True if the editor should be disabled */
|
|
34
|
+
isDisabled?: boolean;
|
|
35
|
+
/** True if the editor should be disabled */
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/** Will show this text in a block before the input */
|
|
38
|
+
prependText?: string;
|
|
39
|
+
/** Will show this text in a block after the input */
|
|
40
|
+
appendText?: string;
|
|
41
|
+
/** Additional element to include before the input element */
|
|
42
|
+
prepend?: (() => JSX.Element) | JSX.Element | null;
|
|
43
|
+
/** Additional element to include after the input element */
|
|
44
|
+
append?: (() => JSX.Element) | JSX.Element | null;
|
|
45
|
+
/** True if append / prepend is set, which means this must be an editor as part of a bs editor group. */
|
|
46
|
+
requiresGroup?: boolean;
|
|
47
|
+
/** Reference to the input dom element */
|
|
48
|
+
inputElement?: React.RefObject<HTMLElement>;
|
|
49
|
+
}
|
|
50
|
+
export interface IBindableEditorPropsNoBase extends ICommonEditorProps {
|
|
51
|
+
bind: Model.IPropertyInstance;
|
|
52
|
+
placeholder?: string | boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface IBindableEditorProps<T = HTMLElement> extends IBindableEditorPropsNoBase, React.HTMLProps<T> {
|
|
55
|
+
/**
|
|
56
|
+
* HTML Placeholder to display when the input control has no value.
|
|
57
|
+
* Value of true results in the readable property name being used.
|
|
58
|
+
*/
|
|
59
|
+
placeholder?: any;
|
|
60
|
+
}
|
|
61
|
+
interface IEditorSelectorProps<T> {
|
|
62
|
+
/** Drop down props if this editor must be a drop down */
|
|
63
|
+
select?: IDropDownSpecificProps<T>;
|
|
64
|
+
/** Input props if this editor is a text / check input */
|
|
65
|
+
input?: IInputSpecificProps;
|
|
66
|
+
/** Number props if this editor is a numeric editor */
|
|
67
|
+
numProps?: INumberInputSpecificProps;
|
|
68
|
+
/** Date props if this editor is a date editor */
|
|
69
|
+
dateProps?: Components.IPartialDateProps;
|
|
70
|
+
/** Radio list props if this is a radio button list. */
|
|
71
|
+
radioList?: IRadioListSpecificProps<T>;
|
|
72
|
+
/** File props if this editor is a file editor */
|
|
73
|
+
fileProps?: IFileEditorProps;
|
|
74
|
+
}
|
|
75
|
+
interface ICommonContainerOwnProps {
|
|
76
|
+
/** Label / header text */
|
|
77
|
+
label?: string | JSX.Element;
|
|
78
|
+
/** True if the editor / display value should be suppressed. Children will still be rendered. */
|
|
79
|
+
suppressDefaultContent?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Allows use of a custom component in a form group / column.
|
|
82
|
+
* Child components can read information from the container using the EditorContainerContext.
|
|
83
|
+
* suppressDefaultContent will be set to true if unset.
|
|
84
|
+
*/
|
|
85
|
+
bindContext?: Model.IPropertyInstance;
|
|
86
|
+
/**
|
|
87
|
+
* Tooltip to display on hover of the editor.
|
|
88
|
+
*/
|
|
89
|
+
editorTooltip?: string | Components.Tooltip.ITooltipOptions;
|
|
90
|
+
/**
|
|
91
|
+
* Classname to add to the editor.
|
|
92
|
+
*/
|
|
93
|
+
editorClassName?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Styles to apply to the editor.
|
|
96
|
+
*/
|
|
97
|
+
editorStyle?: React.CSSProperties;
|
|
98
|
+
}
|
|
99
|
+
interface IEditorAndSelectorProps<TElement, TData> extends IBindableEditorProps<TElement>, IEditorSelectorProps<TData> {
|
|
100
|
+
}
|
|
101
|
+
export interface IEditorContainerProps<TElement, TData> extends Partial<IEditorAndSelectorProps<TElement, TData>>, ICommonContainerOwnProps {
|
|
102
|
+
label?: Components.ElementOrText;
|
|
103
|
+
/** Bind property if you want the editor to be readonly. */
|
|
104
|
+
display?: Model.IPropertyInstance;
|
|
105
|
+
/** Dom properties to apply to the underlying editor. */
|
|
106
|
+
editorProps?: React.HTMLProps<HTMLElement>;
|
|
107
|
+
}
|
|
108
|
+
export interface IEditorNormalisedProps<TDom, TData> extends IEditorSelectorProps<TData> {
|
|
109
|
+
bind: Model.IPropertyInstance;
|
|
110
|
+
editor: IBindableEditorProps;
|
|
111
|
+
editorDom: TDom;
|
|
112
|
+
/** True if the editor is in a form group with a label and error display. */
|
|
113
|
+
inGroup: boolean;
|
|
114
|
+
/** Unique id for the editor and label. */
|
|
115
|
+
uniqueID: string;
|
|
116
|
+
isBootstrap: boolean;
|
|
117
|
+
}
|
|
118
|
+
export interface IEditorContainerNormalisedProps<TDom, TData> extends IEditorNormalisedProps<any, TData> {
|
|
119
|
+
container: ICommonContainerOwnProps;
|
|
120
|
+
containerDom: TDom;
|
|
121
|
+
}
|
|
122
|
+
export declare class BindPropsHelper {
|
|
123
|
+
static readonly DataFieldName = "data-field-name";
|
|
124
|
+
private static _config;
|
|
125
|
+
private static get config();
|
|
126
|
+
/**
|
|
127
|
+
* Gets the correct input control type based on the props. E.g. Input / DatePicker / Select
|
|
128
|
+
* @param props Props passed to a multi type input container. E.g. FormGroup / Column
|
|
129
|
+
*/
|
|
130
|
+
static getFormControl(props: IEditorNormalisedProps<any, any>): React.CElement<import("./DatePicker").INeoDatePickerProps, DatePicker> | React.CElement<import("./NumberInput").INumberInputProps, NumberInput> | React.CElement<import("./DropDown/DropDown").IDropDownProps<unknown>, DropDown<unknown>> | React.CElement<IFileEditorProps, FileInput> | React.CElement<import("./Input").IInputProps, Input> | React.CElement<import("./RadioList").IRadioListProps<unknown>, RadioList<unknown>>;
|
|
131
|
+
static getControlType(props: IEditorNormalisedProps<any, any>): ControlType;
|
|
132
|
+
static getCheckBoxType(props: IEditorNormalisedProps<any, any>, instance?: any): CheckboxType;
|
|
133
|
+
/**
|
|
134
|
+
* Get the main bind property from a props object
|
|
135
|
+
*/
|
|
136
|
+
static getBindProperty<T>(allProps: IEditorContainerProps<T, any>): Model.IPropertyInstance;
|
|
137
|
+
static splitCommonEditorProps<T extends ICommonEditorProps>(props: T): {
|
|
138
|
+
editor: {
|
|
139
|
+
isReadOnly: boolean | undefined;
|
|
140
|
+
isDisabled: boolean | undefined;
|
|
141
|
+
prependText: string | undefined;
|
|
142
|
+
prepend: JSX.Element | (() => JSX.Element) | null | undefined;
|
|
143
|
+
appendText: string | undefined;
|
|
144
|
+
append: JSX.Element | (() => JSX.Element) | null | undefined;
|
|
145
|
+
inputElement: React.RefObject<HTMLElement> | undefined;
|
|
146
|
+
requiresGroup: boolean;
|
|
147
|
+
};
|
|
148
|
+
rest: Omit<T, "disabled" | "readOnly" | "isReadOnly" | "isDisabled" | "prependText" | "appendText" | "prepend" | "append" | "inputElement">;
|
|
149
|
+
};
|
|
150
|
+
static normaliseContainerProps<T, TContainerDom = React.HTMLProps<T>, TData = any>(component: IComponentBase, props: IEditorContainerProps<T, TData>, inGroup: boolean, isBootstrap?: boolean): IEditorContainerNormalisedProps<TContainerDom, TData>;
|
|
151
|
+
static normaliseEditorProps<T, TDom = React.HTMLProps<T>>(component: IComponentBase, props: (IEditorAndSelectorProps<T, any> & TDom) | IEditorNormalisedProps<TDom, any>): IEditorNormalisedProps<TDom, any>;
|
|
152
|
+
static getPlaceholderText(placeholder: string | boolean | undefined, property: PropertyInfo): string | undefined;
|
|
153
|
+
static autoSetDomProperties<TDom extends React.HTMLProps<HTMLElement>>(props: IEditorNormalisedProps<TDom, any>, formContext: FormContextParams, componentBlurFn?: (e: React.FocusEvent<HTMLElement>) => void, componentFocusFn?: (e: React.FocusEvent<HTMLElement>) => void): TDom;
|
|
154
|
+
/**
|
|
155
|
+
* Intercept the user specified blur event, and run the validation onBlur logic first.
|
|
156
|
+
* @param props Props specified on component.
|
|
157
|
+
* @param blurFn Blur function used internally by component.
|
|
158
|
+
*/
|
|
159
|
+
private static blurIntercept;
|
|
160
|
+
}
|
|
161
|
+
export {};
|