@singularsystems/neo-react 1.0.18 → 1.0.20
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/dist/React/ReactModelCreator.js +2 -1
- package/dist/ReactComponents/Card.d.ts +2 -0
- package/dist/ReactComponents/Card.js +14 -9
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +6 -2
- package/dist/Views/ViewBase.d.ts +3 -1
- package/dist/Views/ViewBase.js +30 -15
- package/package.json +2 -2
|
@@ -150,7 +150,8 @@ var ReactModelCreator = /** @class */ (function (_super) {
|
|
|
150
150
|
currentValue.length = 0;
|
|
151
151
|
}
|
|
152
152
|
else {
|
|
153
|
-
|
|
153
|
+
var newValueAsList = newValue;
|
|
154
|
+
if (newValueAsList.createChild !== undefined && newValueAsList.addNew !== undefined) {
|
|
154
155
|
// Cannot re-assign this property, so we have to clear the array, and copy the items from the source array.
|
|
155
156
|
Utils.batchUpdate(function () {
|
|
156
157
|
currentValue.length = 0;
|
|
@@ -15,6 +15,8 @@ interface ICardProps {
|
|
|
15
15
|
initiallyCollapsed?: boolean;
|
|
16
16
|
/** Allows the collapse state to be set externally. Sets the collapsible prop to true. */
|
|
17
17
|
isExpanded?: Model.IObservableValue<boolean>;
|
|
18
|
+
/** Indicates whether the icon should be on the right of the header (default), or left of the icon/title. */
|
|
19
|
+
expandIconPosition?: "none" | "left" | "right";
|
|
18
20
|
}
|
|
19
21
|
export default class Card extends React.Component<ICardProps & React.HTMLProps<HTMLDivElement>> {
|
|
20
22
|
private iconFactory;
|
|
@@ -14,19 +14,23 @@ var Card = /** @class */ (function (_super) {
|
|
|
14
14
|
return _this;
|
|
15
15
|
}
|
|
16
16
|
Card.prototype.render = function () {
|
|
17
|
-
var _a = this.props, icon = _a.icon, title = _a.title, children = _a.children, headerElements = _a.headerElements, useCustomScrollbar = _a.useCustomScrollbar, collapsible = _a.collapsible, initiallyCollapsed = _a.initiallyCollapsed, isExpanded = _a.isExpanded, domProps = __rest(_a, ["icon", "title", "children", "headerElements", "useCustomScrollbar", "collapsible", "initiallyCollapsed", "isExpanded"]);
|
|
17
|
+
var _a = this.props, icon = _a.icon, title = _a.title, children = _a.children, headerElements = _a.headerElements, useCustomScrollbar = _a.useCustomScrollbar, collapsible = _a.collapsible, initiallyCollapsed = _a.initiallyCollapsed, isExpanded = _a.isExpanded, expandIconPosition = _a.expandIconPosition, domProps = __rest(_a, ["icon", "title", "children", "headerElements", "useCustomScrollbar", "collapsible", "initiallyCollapsed", "isExpanded", "expandIconPosition"]);
|
|
18
18
|
var className = Utils.joinWithSpaces("neo-card card", domProps.className);
|
|
19
|
+
expandIconPosition !== null && expandIconPosition !== void 0 ? expandIconPosition : (expandIconPosition = "right");
|
|
19
20
|
var isCollapsible = collapsible || isExpanded !== undefined || initiallyCollapsed !== undefined;
|
|
20
21
|
var expandState = isExpanded !== null && isExpanded !== void 0 ? isExpanded : this.expandState;
|
|
22
|
+
var expandIndicator = undefined;
|
|
21
23
|
if (isCollapsible) {
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
headerElements,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
expandIndicator = React.createElement("i", { onClick: function (e) { return expandState.value = !expandState.value; }, className: "card-expand-indicator fa fa-fw fa-angle-".concat(expandState.value ? "up" : "down") });
|
|
25
|
+
if (expandIconPosition === "right") {
|
|
26
|
+
if (headerElements) {
|
|
27
|
+
headerElements = React.createElement(React.Fragment, null,
|
|
28
|
+
headerElements,
|
|
29
|
+
expandIndicator);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
headerElements = expandIndicator;
|
|
33
|
+
}
|
|
30
34
|
}
|
|
31
35
|
if (!expandState.value) {
|
|
32
36
|
className += " collapsed";
|
|
@@ -44,6 +48,7 @@ var Card = /** @class */ (function (_super) {
|
|
|
44
48
|
(icon || title) &&
|
|
45
49
|
React.createElement("div", { className: "card-header", onClick: function (e) { return expandState.value = !expandState.value; } },
|
|
46
50
|
React.createElement("div", { className: "card-header-title" },
|
|
51
|
+
expandIconPosition === "left" && expandIndicator,
|
|
47
52
|
this.iconFactory.getIconComponent(icon),
|
|
48
53
|
React.createElement("span", null, title)),
|
|
49
54
|
headerElements && React.createElement("div", { className: "card-header-right-section", onClick: function (e) { return e.stopPropagation(); } }, headerElements)),
|
|
@@ -72,7 +72,11 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
72
72
|
if (items.length) {
|
|
73
73
|
this.findMembers(items[0]);
|
|
74
74
|
}
|
|
75
|
-
return items.map(function (item) { return (
|
|
75
|
+
return items.map(function (item) { return ({
|
|
76
|
+
item: item,
|
|
77
|
+
value: item[_this.valueMember],
|
|
78
|
+
label: item[_this.displayMember]
|
|
79
|
+
}); });
|
|
76
80
|
};
|
|
77
81
|
AutoCompleteDropDown.prototype.onItemSelected = function (args, action) {
|
|
78
82
|
var _a;
|
|
@@ -205,7 +209,7 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
205
209
|
React.createElement("div", { className: "react-select-description" }, item[descriptionMember])); }, "with-description");
|
|
206
210
|
}
|
|
207
211
|
if (nativeProps.isClearable === undefined) {
|
|
208
|
-
nativeProps.isClearable =
|
|
212
|
+
nativeProps.isClearable = !bindValue || bindValue.propertyInfo.allowNulls;
|
|
209
213
|
}
|
|
210
214
|
if (BindPropsHelper.isReadOnly(splitProps.editor, this.context) || BindPropsHelper.isDisabled(splitProps.editor, this.context)) {
|
|
211
215
|
nativeProps.isDisabled = true;
|
package/dist/Views/ViewBase.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export default abstract class ViewBase<TViewModel extends IViewModel = EmptyView
|
|
|
25
25
|
viewName: string;
|
|
26
26
|
/** Indicates that the view requests to be displayed full screen. Up to the main layout to accommodate this. */
|
|
27
27
|
fullScreen: boolean;
|
|
28
|
+
/** Indicates that the VM has initialised, and viewParamsUpdated() has been called. */
|
|
29
|
+
hasInitialised: boolean;
|
|
28
30
|
static get currentView(): IViewBase | null;
|
|
29
31
|
private routingState;
|
|
30
32
|
navigation: import("../Routing").INavigationHelper;
|
|
@@ -42,7 +44,7 @@ export default abstract class ViewBase<TViewModel extends IViewModel = EmptyView
|
|
|
42
44
|
get viewParams(): IViewParameterListOfT<TParams> & TransformParamsType<TParams>;
|
|
43
45
|
protected getStoredViewState(viewModel: valueOrLazy<TViewModel>): ViewState<TViewModel, TParams>;
|
|
44
46
|
protected createViewState(viewModel: valueOrLazy<TViewModel>): ViewState<TViewModel, TParams>;
|
|
45
|
-
componentDidMount(): void
|
|
47
|
+
componentDidMount(): Promise<void>;
|
|
46
48
|
componentWillUnmount(): void;
|
|
47
49
|
updateViewParams(match: match): void;
|
|
48
50
|
/**
|
package/dist/Views/ViewBase.js
CHANGED
|
@@ -20,6 +20,8 @@ var ViewBase = /** @class */ (function (_super) {
|
|
|
20
20
|
_this.viewName = "";
|
|
21
21
|
/** Indicates that the view requests to be displayed full screen. Up to the main layout to accommodate this. */
|
|
22
22
|
_this.fullScreen = false;
|
|
23
|
+
/** Indicates that the VM has initialised, and viewParamsUpdated() has been called. */
|
|
24
|
+
_this.hasInitialised = false;
|
|
23
25
|
_this.routingState = Misc.Globals.appService.get(NeoReactTypes.Routing.GlobalRoutingState);
|
|
24
26
|
_this.navigation = Misc.Globals.appService.get(NeoReactTypes.Routing.NavigationHelper);
|
|
25
27
|
if (typeof viewName !== "string") {
|
|
@@ -70,21 +72,30 @@ var ViewBase = /** @class */ (function (_super) {
|
|
|
70
72
|
return new ViewState(paramsList, viewModelInstance);
|
|
71
73
|
};
|
|
72
74
|
ViewBase.prototype.componentDidMount = function () {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
var paramsUpdated;
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
switch (_a.label) {
|
|
79
|
+
case 0:
|
|
80
|
+
paramsUpdated = this.navigation.currentRouteProps ? this.viewState.viewParams.update(this.navigation.currentRouteProps.match) : false;
|
|
81
|
+
if (!!this.viewState.hasSetup) return [3 /*break*/, 2];
|
|
82
|
+
this.viewState.hasSetup = true;
|
|
83
|
+
return [4 /*yield*/, this.initialise()];
|
|
84
|
+
case 1:
|
|
85
|
+
_a.sent();
|
|
86
|
+
_a.label = 2;
|
|
87
|
+
case 2:
|
|
88
|
+
if (!paramsUpdated) return [3 /*break*/, 4];
|
|
89
|
+
return [4 /*yield*/, this.viewParamsUpdated()];
|
|
90
|
+
case 3:
|
|
91
|
+
_a.sent();
|
|
92
|
+
_a.label = 4;
|
|
93
|
+
case 4:
|
|
94
|
+
this.hasInitialised = true;
|
|
95
|
+
return [2 /*return*/];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
88
99
|
};
|
|
89
100
|
ViewBase.prototype.componentWillUnmount = function () {
|
|
90
101
|
this.disposeViewModel();
|
|
@@ -168,6 +179,10 @@ var ViewBase = /** @class */ (function (_super) {
|
|
|
168
179
|
observable.ref,
|
|
169
180
|
__metadata("design:type", Boolean)
|
|
170
181
|
], ViewBase.prototype, "fullScreen", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
observable.ref,
|
|
184
|
+
__metadata("design:type", Boolean)
|
|
185
|
+
], ViewBase.prototype, "hasInitialised", void 0);
|
|
171
186
|
return ViewBase;
|
|
172
187
|
}(React.Component));
|
|
173
188
|
export default ViewBase;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularsystems/neo-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "React application logic and components for the Neo client library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@singularsystems/neo-core": "1.0.14",
|
|
35
35
|
"@types/rc-slider": "^8.6.5",
|
|
36
36
|
"@types/react-color": "^3.0.1",
|
|
37
|
-
"axios": "1.7.
|
|
37
|
+
"axios": "1.7.5",
|
|
38
38
|
"history": "4.10.1",
|
|
39
39
|
"inversify": "^6.0.2",
|
|
40
40
|
"memoize-one": "6.0.0",
|