@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,95 +1,116 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { observable } from 'mobx';
|
|
3
|
-
var ViewParameter = /** @class */ (function () {
|
|
4
|
-
function ViewParameter(parent, name, routeParameter) {
|
|
5
|
-
this.parent = parent;
|
|
6
|
-
this.name = name;
|
|
7
|
-
this.routeParameter = routeParameter;
|
|
8
|
-
this.hasPendingValue = false;
|
|
9
|
-
this.pendingValue = null;
|
|
10
|
-
this._value = null;
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { makeObservable, observable } from 'mobx';
|
|
3
|
+
export var ViewParameter = /** @class */ (function () {
|
|
4
|
+
function ViewParameter(parent, name, routeParameter) {
|
|
5
|
+
this.parent = parent;
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.routeParameter = routeParameter;
|
|
8
|
+
this.hasPendingValue = false;
|
|
9
|
+
this.pendingValue = null;
|
|
10
|
+
this._value = null;
|
|
11
|
+
this.prefixes = [];
|
|
12
|
+
this._description = "";
|
|
13
|
+
makeObservable(this);
|
|
14
|
+
}
|
|
15
|
+
ViewParameter.prototype.bindTo = function (propertyOrCallback) {
|
|
16
|
+
var _this = this;
|
|
17
|
+
if (propertyOrCallback.propertyInfo) {
|
|
18
|
+
this.parent.view.viewModel.registerReaction(function () { return propertyOrCallback.value; }, function (val) { return _this.value = val; });
|
|
19
|
+
}
|
|
20
|
+
else if (propertyOrCallback instanceof Function) {
|
|
21
|
+
this.parent.view.viewModel.registerReaction(propertyOrCallback, function (val) { return _this.value = val; });
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(ViewParameter.prototype, "value", {
|
|
25
|
+
get: function () {
|
|
26
|
+
return this._value;
|
|
27
|
+
},
|
|
28
|
+
set: function (value) {
|
|
29
|
+
var stringValue = value ? value.toString() : null;
|
|
30
|
+
if (stringValue !== this._value) {
|
|
31
|
+
this.hasPendingValue = true;
|
|
32
|
+
this.pendingValue = stringValue;
|
|
33
|
+
this.parent.setUrl(this);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
enumerable: false,
|
|
37
|
+
configurable: true
|
|
38
|
+
});
|
|
39
|
+
ViewParameter.prototype.reset = function () {
|
|
40
|
+
if (this._value) {
|
|
41
|
+
this.hasPendingValue = true;
|
|
42
|
+
this.pendingValue = null;
|
|
43
|
+
this.parent.setUrl(this, true);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(ViewParameter.prototype, "description", {
|
|
47
|
+
get: function () {
|
|
48
|
+
return this._description;
|
|
49
|
+
},
|
|
50
|
+
set: function (value) {
|
|
51
|
+
if (this.hasPendingValue) {
|
|
52
|
+
console.warn("Do not set view parameter description directly after setting value. Description should be set in the viewParamsUpdated() method.");
|
|
53
|
+
}
|
|
54
|
+
this._description = value;
|
|
55
|
+
},
|
|
56
|
+
enumerable: false,
|
|
57
|
+
configurable: true
|
|
58
|
+
});
|
|
59
|
+
ViewParameter.prototype.setDescription = function (description, getPrefixes) {
|
|
60
|
+
this.prefixes = getPrefixes ? getPrefixes(this.prefixes) : [];
|
|
61
|
+
this.description = description;
|
|
62
|
+
};
|
|
63
|
+
ViewParameter.prototype.asNullableInt = function () {
|
|
64
|
+
if (this._value) {
|
|
65
|
+
return parseInt(this._value, 10);
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
};
|
|
69
|
+
ViewParameter.prototype.asString = function () {
|
|
70
|
+
return this._value || "";
|
|
71
|
+
};
|
|
72
|
+
/** Updates the current value, and returns true if the value changed. */
|
|
73
|
+
ViewParameter.prototype.update = function (value) {
|
|
74
|
+
if (value) {
|
|
75
|
+
value = decodeURIComponent(value);
|
|
76
|
+
}
|
|
77
|
+
if (value != this._value) {
|
|
78
|
+
this.hasPendingValue = false;
|
|
79
|
+
this.pendingValue = value;
|
|
80
|
+
this._value = value;
|
|
81
|
+
if (!value) {
|
|
82
|
+
this._description = "";
|
|
83
|
+
this.prefixes = [];
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
};
|
|
89
|
+
ViewParameter.prototype.getParamString = function (state) {
|
|
90
|
+
var value = this.latestValue;
|
|
91
|
+
if (value) {
|
|
92
|
+
value = encodeURIComponent(value);
|
|
93
|
+
if (this.routeParameter.isQuery) {
|
|
94
|
+
var hasQuery = state.hasQuery;
|
|
95
|
+
state.hasQuery = true;
|
|
96
|
+
return (!hasQuery ? "?" : "&") + this.name + "=" + value;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return "/" + value;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return this.routeParameter.isQuery ? "" : "/";
|
|
103
|
+
};
|
|
104
|
+
Object.defineProperty(ViewParameter.prototype, "latestValue", {
|
|
105
|
+
get: function () {
|
|
106
|
+
return this.hasPendingValue ? this.pendingValue : this._value;
|
|
107
|
+
},
|
|
108
|
+
enumerable: false,
|
|
109
|
+
configurable: true
|
|
110
|
+
});
|
|
111
|
+
__decorate([
|
|
112
|
+
observable.ref,
|
|
113
|
+
__metadata("design:type", String)
|
|
114
|
+
], ViewParameter.prototype, "_description", void 0);
|
|
115
|
+
return ViewParameter;
|
|
116
|
+
}());
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { ViewParameter, IViewParameter } from './ViewParameter';
|
|
2
|
-
import { RouteParameterObject } from './IRouteParameter';
|
|
3
|
-
import { match } from 'react-router';
|
|
4
|
-
import { BreadCrumbItem } from './BreadCrumbItem';
|
|
5
|
-
import { IViewBase } from '../Views/ViewBase';
|
|
6
|
-
export
|
|
7
|
-
[P in keyof T]: IViewParameter;
|
|
8
|
-
};
|
|
9
|
-
export interface IViewParameterList {
|
|
10
|
-
/**
|
|
11
|
-
* Returns the breadcrumb items for all url parameters which have a value.
|
|
12
|
-
*/
|
|
13
|
-
getBreadCrumbList(): BreadCrumbItem[];
|
|
14
|
-
}
|
|
15
|
-
export interface IViewParameterListOfT<TParams extends RouteParameterObject<TParams>> extends IViewParameterList {
|
|
16
|
-
/**
|
|
17
|
-
* Set the view params for each of the provided values. Only 1 navigation event will occur.
|
|
18
|
-
* @param values New values.
|
|
19
|
-
* @param force True if the url should be set even if none of the values have changed.
|
|
20
|
-
*/
|
|
21
|
-
setValues(values: {
|
|
22
|
-
[P in keyof TParams]?: number | string | null;
|
|
23
|
-
}, force?: boolean): void;
|
|
24
|
-
}
|
|
25
|
-
export interface IViewParameterListInternal extends IViewParameterList {
|
|
26
|
-
update(match: match): boolean;
|
|
27
|
-
setUrl(viewParameter: ViewParameter | null, replace?: boolean): void;
|
|
28
|
-
view?: IViewBase;
|
|
29
|
-
readonly params: ViewParameter[];
|
|
30
|
-
}
|
|
31
|
-
export declare class ViewParameterList<TParams extends RouteParameterObject<TParams>> implements IViewParameterListInternal, IViewParameterListOfT<TParams> {
|
|
32
|
-
readonly view?: IViewBase | undefined;
|
|
33
|
-
readonly params: ViewParameter[];
|
|
34
|
-
private suppressNavigation;
|
|
35
|
-
private hasSuppressedNavigation;
|
|
36
|
-
constructor(routeParameterObject: TParams, view?: IViewBase | undefined);
|
|
37
|
-
getBreadCrumbList(upTo?: ViewParameter): BreadCrumbItem[];
|
|
38
|
-
private getQueryString;
|
|
39
|
-
setValues(values: {
|
|
40
|
-
[P in keyof TParams]?: number | string | null;
|
|
41
|
-
}, force?: boolean): void;
|
|
42
|
-
setUrl(viewParameter: ViewParameter | null, replace?: boolean): void;
|
|
43
|
-
/**
|
|
44
|
-
* Updates the parameter values from the values in the url. Returns true if any of the values have changed.
|
|
45
|
-
*/
|
|
46
|
-
update(match: match): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Gets a url for an object with view params specified.
|
|
49
|
-
* @param basePath Base path without parameters
|
|
50
|
-
* @param values Object of param names and values.
|
|
51
|
-
*/
|
|
52
|
-
static getPathForValues<TParams extends RouteParameterObject<TParams>>(basePath: string, params: TParams, values: {}): string;
|
|
53
|
-
}
|
|
1
|
+
import { ViewParameter, IViewParameter } from './ViewParameter';
|
|
2
|
+
import { RouteParameterObject } from './IRouteParameter';
|
|
3
|
+
import { match } from 'react-router';
|
|
4
|
+
import { BreadCrumbItem } from './BreadCrumbItem';
|
|
5
|
+
import { IViewBase } from '../Views/ViewBase';
|
|
6
|
+
export type TransformParamsType<T> = {
|
|
7
|
+
[P in keyof T]: IViewParameter;
|
|
8
|
+
};
|
|
9
|
+
export interface IViewParameterList {
|
|
10
|
+
/**
|
|
11
|
+
* Returns the breadcrumb items for all url parameters which have a value.
|
|
12
|
+
*/
|
|
13
|
+
getBreadCrumbList(): BreadCrumbItem[];
|
|
14
|
+
}
|
|
15
|
+
export interface IViewParameterListOfT<TParams extends RouteParameterObject<TParams>> extends IViewParameterList {
|
|
16
|
+
/**
|
|
17
|
+
* Set the view params for each of the provided values. Only 1 navigation event will occur.
|
|
18
|
+
* @param values New values.
|
|
19
|
+
* @param force True if the url should be set even if none of the values have changed.
|
|
20
|
+
*/
|
|
21
|
+
setValues(values: {
|
|
22
|
+
[P in keyof TParams]?: number | string | null;
|
|
23
|
+
}, force?: boolean): void;
|
|
24
|
+
}
|
|
25
|
+
export interface IViewParameterListInternal extends IViewParameterList {
|
|
26
|
+
update(match: match): boolean;
|
|
27
|
+
setUrl(viewParameter: ViewParameter | null, replace?: boolean): void;
|
|
28
|
+
view?: IViewBase;
|
|
29
|
+
readonly params: ViewParameter[];
|
|
30
|
+
}
|
|
31
|
+
export declare class ViewParameterList<TParams extends RouteParameterObject<TParams>> implements IViewParameterListInternal, IViewParameterListOfT<TParams> {
|
|
32
|
+
readonly view?: IViewBase | undefined;
|
|
33
|
+
readonly params: ViewParameter[];
|
|
34
|
+
private suppressNavigation;
|
|
35
|
+
private hasSuppressedNavigation;
|
|
36
|
+
constructor(routeParameterObject: TParams, view?: IViewBase | undefined);
|
|
37
|
+
getBreadCrumbList(upTo?: ViewParameter): BreadCrumbItem[];
|
|
38
|
+
private getQueryString;
|
|
39
|
+
setValues(values: {
|
|
40
|
+
[P in keyof TParams]?: number | string | null;
|
|
41
|
+
}, force?: boolean): void;
|
|
42
|
+
setUrl(viewParameter: ViewParameter | null, replace?: boolean): void;
|
|
43
|
+
/**
|
|
44
|
+
* Updates the parameter values from the values in the url. Returns true if any of the values have changed.
|
|
45
|
+
*/
|
|
46
|
+
update(match: match): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Gets a url for an object with view params specified.
|
|
49
|
+
* @param basePath Base path without parameters
|
|
50
|
+
* @param values Object of param names and values.
|
|
51
|
+
*/
|
|
52
|
+
static getPathForValues<TParams extends RouteParameterObject<TParams>>(basePath: string, params: TParams, values: {}): string;
|
|
53
|
+
}
|
|
@@ -1,145 +1,163 @@
|
|
|
1
|
-
import { ViewParameter } from './ViewParameter';
|
|
2
|
-
import { BreadCrumbSelectMode } from './IRouteParameter';
|
|
3
|
-
import { BreadCrumbItem } from './BreadCrumbItem';
|
|
4
|
-
import { Misc } from '@singularsystems/neo-core';
|
|
5
|
-
import { NeoReactTypes } from '..';
|
|
6
|
-
var ViewParameterList = /** @class */ (function () {
|
|
7
|
-
function ViewParameterList(routeParameterObject, view) {
|
|
8
|
-
this.view = view;
|
|
9
|
-
this.params = [];
|
|
10
|
-
this.suppressNavigation = false;
|
|
11
|
-
this.hasSuppressedNavigation = false;
|
|
12
|
-
if (routeParameterObject) {
|
|
13
|
-
for (var param in routeParameterObject) {
|
|
14
|
-
var viewParam = new ViewParameter(this, param, routeParameterObject[param]);
|
|
15
|
-
this[param] = viewParam;
|
|
16
|
-
this.params.push(viewParam);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
ViewParameterList.prototype.getBreadCrumbList = function (upTo) {
|
|
21
|
-
var _a;
|
|
22
|
-
var basePath = Misc.Globals.appService.get(NeoReactTypes.Routing.NavigationHelper).getCurrentViewPath();
|
|
23
|
-
var breadCrumbs = [];
|
|
24
|
-
var state = { hasQuery: false };
|
|
25
|
-
var queryPath = this.getQueryString();
|
|
26
|
-
var paramPath = basePath;
|
|
27
|
-
var selectablePath = basePath;
|
|
28
|
-
for (var _i = 0, _b = this.params; _i < _b.length; _i++) {
|
|
29
|
-
var viewParam = _b[_i];
|
|
30
|
-
if (!viewParam.routeParameter.isQuery
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var
|
|
92
|
-
if (
|
|
93
|
-
var
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
1
|
+
import { ViewParameter } from './ViewParameter';
|
|
2
|
+
import { BreadCrumbSelectMode } from './IRouteParameter';
|
|
3
|
+
import { BreadCrumbItem } from './BreadCrumbItem';
|
|
4
|
+
import { Misc } from '@singularsystems/neo-core';
|
|
5
|
+
import { NeoReactTypes } from '..';
|
|
6
|
+
var ViewParameterList = /** @class */ (function () {
|
|
7
|
+
function ViewParameterList(routeParameterObject, view) {
|
|
8
|
+
this.view = view;
|
|
9
|
+
this.params = [];
|
|
10
|
+
this.suppressNavigation = false;
|
|
11
|
+
this.hasSuppressedNavigation = false;
|
|
12
|
+
if (routeParameterObject) {
|
|
13
|
+
for (var param in routeParameterObject) {
|
|
14
|
+
var viewParam = new ViewParameter(this, param, routeParameterObject[param]);
|
|
15
|
+
this[param] = viewParam;
|
|
16
|
+
this.params.push(viewParam);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
ViewParameterList.prototype.getBreadCrumbList = function (upTo) {
|
|
21
|
+
var _a;
|
|
22
|
+
var basePath = Misc.Globals.appService.get(NeoReactTypes.Routing.NavigationHelper).getCurrentViewPath();
|
|
23
|
+
var breadCrumbs = [];
|
|
24
|
+
var state = { hasQuery: false };
|
|
25
|
+
var queryPath = this.getQueryString();
|
|
26
|
+
var paramPath = basePath;
|
|
27
|
+
var selectablePath = basePath;
|
|
28
|
+
for (var _i = 0, _b = this.params; _i < _b.length; _i++) {
|
|
29
|
+
var viewParam = _b[_i];
|
|
30
|
+
if (!viewParam.routeParameter.isQuery) {
|
|
31
|
+
if (!upTo) {
|
|
32
|
+
for (var _c = 0, _d = viewParam.prefixes; _c < _d.length; _c++) {
|
|
33
|
+
var prefix = _d[_c];
|
|
34
|
+
var breadcrumbItem = new BreadCrumbItem(prefix.label);
|
|
35
|
+
if (prefix.onClick) {
|
|
36
|
+
breadcrumbItem.onClick = prefix.onClick;
|
|
37
|
+
}
|
|
38
|
+
else if (prefix.link) {
|
|
39
|
+
breadcrumbItem.link = prefix.link;
|
|
40
|
+
}
|
|
41
|
+
else if (prefix.value) {
|
|
42
|
+
breadcrumbItem.link = paramPath + "/" + prefix.value;
|
|
43
|
+
}
|
|
44
|
+
breadCrumbs.push(breadcrumbItem);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
paramPath += viewParam.getParamString(state);
|
|
48
|
+
if (((_a = viewParam.routeParameter.selection) !== null && _a !== void 0 ? _a : BreadCrumbSelectMode.Default) === BreadCrumbSelectMode.Default) {
|
|
49
|
+
selectablePath = paramPath;
|
|
50
|
+
}
|
|
51
|
+
if (viewParam.description || (upTo && viewParam.latestValue !== null)) {
|
|
52
|
+
breadCrumbs.push(new BreadCrumbItem(viewParam.description, (!upTo && viewParam.routeParameter.selection === BreadCrumbSelectMode.None) ? "" : (selectablePath + queryPath)));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (upTo && upTo === viewParam) {
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return breadCrumbs;
|
|
60
|
+
};
|
|
61
|
+
ViewParameterList.prototype.getQueryString = function () {
|
|
62
|
+
var state = { hasQuery: false };
|
|
63
|
+
var queryPath = "";
|
|
64
|
+
for (var _i = 0, _a = this.params; _i < _a.length; _i++) {
|
|
65
|
+
var viewParam = _a[_i];
|
|
66
|
+
if (viewParam.routeParameter.isQuery) {
|
|
67
|
+
queryPath += viewParam.getParamString(state);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return queryPath;
|
|
71
|
+
};
|
|
72
|
+
ViewParameterList.prototype.setValues = function (values, force) {
|
|
73
|
+
var _a;
|
|
74
|
+
if (force === void 0) { force = false; }
|
|
75
|
+
this.suppressNavigation = true;
|
|
76
|
+
this.hasSuppressedNavigation = false;
|
|
77
|
+
for (var paramName in values) {
|
|
78
|
+
this[paramName].value = (_a = values[paramName]) !== null && _a !== void 0 ? _a : null;
|
|
79
|
+
}
|
|
80
|
+
this.suppressNavigation = false;
|
|
81
|
+
if (this.hasSuppressedNavigation || force) {
|
|
82
|
+
this.setUrl(this.params[this.params.length - 1]);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
ViewParameterList.prototype.setUrl = function (viewParameter, replace) {
|
|
86
|
+
if (replace === void 0) { replace = false; }
|
|
87
|
+
if (this.suppressNavigation) {
|
|
88
|
+
this.hasSuppressedNavigation = true;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
var navigationHelper = Misc.Globals.appService.get(NeoReactTypes.Routing.NavigationHelper);
|
|
92
|
+
if (viewParameter) {
|
|
93
|
+
var allItems = this.getBreadCrumbList(viewParameter);
|
|
94
|
+
if (allItems.length > 0) {
|
|
95
|
+
navigationHelper.navigateInternal(allItems[allItems.length - 1].link, replace);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
navigationHelper.navigateInternal(navigationHelper.getCurrentViewPath(), replace);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Updates the parameter values from the values in the url. Returns true if any of the values have changed.
|
|
104
|
+
*/
|
|
105
|
+
ViewParameterList.prototype.update = function (match) {
|
|
106
|
+
var hasChanged = false;
|
|
107
|
+
//Get url params
|
|
108
|
+
for (var param in match.params) {
|
|
109
|
+
var viewParam = this[param];
|
|
110
|
+
if (viewParam) {
|
|
111
|
+
var value = match.params[param];
|
|
112
|
+
if (value === undefined)
|
|
113
|
+
value = null;
|
|
114
|
+
if (viewParam.update(value))
|
|
115
|
+
hasChanged = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//Get query params
|
|
119
|
+
var queryParams = new URLSearchParams(location.search);
|
|
120
|
+
for (var _i = 0, _a = this.params; _i < _a.length; _i++) {
|
|
121
|
+
var viewParam = _a[_i];
|
|
122
|
+
if (viewParam.routeParameter.isQuery) {
|
|
123
|
+
if (viewParam.update(queryParams.get(viewParam.name)))
|
|
124
|
+
hasChanged = true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return hasChanged;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Gets a url for an object with view params specified.
|
|
131
|
+
* @param basePath Base path without parameters
|
|
132
|
+
* @param values Object of param names and values.
|
|
133
|
+
*/
|
|
134
|
+
ViewParameterList.getPathForValues = function (basePath, params, values) {
|
|
135
|
+
// TODO: This needs a rework.
|
|
136
|
+
var viewParameterList = new ViewParameterList(params);
|
|
137
|
+
for (var name_1 in values) {
|
|
138
|
+
var viewParam = viewParameterList[name_1];
|
|
139
|
+
if (viewParam) {
|
|
140
|
+
var value = values[name_1];
|
|
141
|
+
if (value === undefined)
|
|
142
|
+
value = null;
|
|
143
|
+
if (typeof value === "number") {
|
|
144
|
+
value = value.toString();
|
|
145
|
+
}
|
|
146
|
+
viewParam.update(value);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
var state = { hasQuery: false };
|
|
150
|
+
var paramPath = basePath;
|
|
151
|
+
for (var _i = 0, _a = viewParameterList.params.filter(function (c) { return !c.routeParameter.isQuery; }); _i < _a.length; _i++) {
|
|
152
|
+
var viewParam = _a[_i];
|
|
153
|
+
paramPath += viewParam.getParamString(state);
|
|
154
|
+
}
|
|
155
|
+
// trim trailing slashes
|
|
156
|
+
while (paramPath.endsWith("/")) {
|
|
157
|
+
paramPath = paramPath.substring(0, paramPath.length - 1);
|
|
158
|
+
}
|
|
159
|
+
return paramPath + viewParameterList.getQueryString();
|
|
160
|
+
};
|
|
161
|
+
return ViewParameterList;
|
|
162
|
+
}());
|
|
163
|
+
export { ViewParameterList };
|