@singularsystems/neo-react 1.0.19 → 1.0.21
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/ReactComponents/Badge.js +6 -4
- package/dist/ReactComponents/Card.d.ts +2 -0
- package/dist/ReactComponents/Card.js +16 -9
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +6 -2
- package/dist/ReactComponents/Icons/MaterialSymbolsFontFactory.js +2 -0
- package/dist/ReactComponents/InputHelpers.js +5 -8
- package/dist/Views/ViewBase.d.ts +3 -1
- package/dist/Views/ViewBase.js +30 -15
- package/package.json +2 -2
- package/styles/Card.scss +2 -4
|
@@ -2,17 +2,19 @@ import { __assign, __decorate, __extends, __metadata, __rest } from "tslib";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { Utils } from '@singularsystems/neo-core';
|
|
5
|
+
import BootstrapUtils from "./BootstrapUtils";
|
|
5
6
|
var Badge = /** @class */ (function (_super) {
|
|
6
7
|
__extends(Badge, _super);
|
|
7
8
|
function Badge(props) {
|
|
8
9
|
return _super.call(this, props) || this;
|
|
9
10
|
}
|
|
10
11
|
Badge.prototype.render = function () {
|
|
11
|
-
var _a;
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var _a, _b;
|
|
13
|
+
var _c = this.props, text = _c.text, variant = _c.variant, customVariant = _c.customVariant, isLarge = _c.isLarge, isPill = _c.isPill, children = _c.children, domProps = __rest(_c, ["text", "variant", "customVariant", "isLarge", "isPill", "children"]);
|
|
14
|
+
var isBsPre5 = BootstrapUtils.isPre5;
|
|
15
|
+
var variantClassName = isBsPre5 ? "badge badge-".concat(((_a = customVariant !== null && customVariant !== void 0 ? customVariant : variant) !== null && _a !== void 0 ? _a : "primary")) : "badge bg-".concat(((_b = customVariant !== null && customVariant !== void 0 ? customVariant : variant) !== null && _b !== void 0 ? _b : "primary"));
|
|
14
16
|
var largeBadgeClassName = isLarge ? "badge-lg" : "";
|
|
15
|
-
var pillClassName = isPill ? "badge-pill" : "";
|
|
17
|
+
var pillClassName = isPill ? (isBsPre5 ? "badge-pill" : "rounded-pill") : "";
|
|
16
18
|
domProps.className = Utils.joinWithSpaces(domProps.className, variantClassName, pillClassName, largeBadgeClassName);
|
|
17
19
|
return (React.createElement("div", __assign({}, domProps), children !== null && children !== void 0 ? children : text));
|
|
18
20
|
};
|
|
@@ -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;
|
|
@@ -5,6 +5,7 @@ import { observer } from 'mobx-react';
|
|
|
5
5
|
import Scrollbar from 'react-custom-scrollbars';
|
|
6
6
|
import Collapsable from './Collapsable';
|
|
7
7
|
import { NeoReactTypes } from '../Modules/Types';
|
|
8
|
+
import { Icon } from "./_Exports";
|
|
8
9
|
var Card = /** @class */ (function (_super) {
|
|
9
10
|
__extends(Card, _super);
|
|
10
11
|
function Card() {
|
|
@@ -14,19 +15,24 @@ var Card = /** @class */ (function (_super) {
|
|
|
14
15
|
return _this;
|
|
15
16
|
}
|
|
16
17
|
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"]);
|
|
18
|
+
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
19
|
var className = Utils.joinWithSpaces("neo-card card", domProps.className);
|
|
20
|
+
expandIconPosition !== null && expandIconPosition !== void 0 ? expandIconPosition : (expandIconPosition = "right");
|
|
19
21
|
var isCollapsible = collapsible || isExpanded !== undefined || initiallyCollapsed !== undefined;
|
|
20
22
|
var expandState = isExpanded !== null && isExpanded !== void 0 ? isExpanded : this.expandState;
|
|
23
|
+
var expandIndicator = undefined;
|
|
21
24
|
if (isCollapsible) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
expandIndicator = React.createElement("span", { className: "card-expand-indicator", onClick: function (e) { expandState.value = !expandState.value; e.stopPropagation(); } },
|
|
26
|
+
React.createElement(Icon, { fixedWidth: true, name: "fa-angle-".concat(expandState.value ? "up" : "down") }));
|
|
27
|
+
if (expandIconPosition === "right") {
|
|
28
|
+
if (headerElements) {
|
|
29
|
+
headerElements = React.createElement(React.Fragment, null,
|
|
30
|
+
headerElements,
|
|
31
|
+
expandIndicator);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
headerElements = expandIndicator;
|
|
35
|
+
}
|
|
30
36
|
}
|
|
31
37
|
if (!expandState.value) {
|
|
32
38
|
className += " collapsed";
|
|
@@ -44,6 +50,7 @@ var Card = /** @class */ (function (_super) {
|
|
|
44
50
|
(icon || title) &&
|
|
45
51
|
React.createElement("div", { className: "card-header", onClick: function (e) { return expandState.value = !expandState.value; } },
|
|
46
52
|
React.createElement("div", { className: "card-header-title" },
|
|
53
|
+
expandIconPosition === "left" && expandIndicator,
|
|
47
54
|
this.iconFactory.getIconComponent(icon),
|
|
48
55
|
React.createElement("span", null, title)),
|
|
49
56
|
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;
|
|
@@ -81,6 +81,8 @@ var neoFontAwesomeMappings = [
|
|
|
81
81
|
["minus-square", "indeterminate_check_box"],
|
|
82
82
|
["arrow-left", "arrow_back"],
|
|
83
83
|
["angle-left", "chevron_left"],
|
|
84
|
+
["angle-up", "keyboard_arrow_up"],
|
|
85
|
+
["angle-down", "keyboard_arrow_down"],
|
|
84
86
|
["caret-left", "arrow_left"],
|
|
85
87
|
["trash", "delete"],
|
|
86
88
|
["user", "person"],
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Misc } from '@singularsystems/neo-core';
|
|
3
3
|
import { NeoReactTypes } from '../Modules/Types';
|
|
4
|
-
import BootstrapUtils from "./BootstrapUtils";
|
|
5
4
|
var InputHelpers = /** @class */ (function () {
|
|
6
5
|
function InputHelpers() {
|
|
7
6
|
}
|
|
@@ -10,26 +9,24 @@ var InputHelpers = /** @class */ (function () {
|
|
|
10
9
|
this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
11
10
|
}
|
|
12
11
|
if (props.requiresGroup) {
|
|
13
|
-
var
|
|
12
|
+
var isDisabled = domProps.disabled || domProps.readOnly;
|
|
14
13
|
return (React.createElement("div", { className: "input-group" + (isDisabled ? " input-group-disabled" : "") },
|
|
15
|
-
this.getElement(
|
|
14
|
+
this.getElement("input-group-prepend", inputRef, props.prependText, props.prependIcon, props.prepend),
|
|
16
15
|
element,
|
|
17
|
-
this.getElement(
|
|
16
|
+
this.getElement("input-group-append", inputRef, props.appendText, props.appendIcon, props.append)));
|
|
18
17
|
}
|
|
19
18
|
else {
|
|
20
19
|
return element;
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
|
-
InputHelpers.getElement = function (
|
|
22
|
+
InputHelpers.getElement = function (className, inputRef, text, icon, element) {
|
|
24
23
|
if (!text && !icon && !element) {
|
|
25
24
|
return undefined;
|
|
26
25
|
}
|
|
27
26
|
var innerElement = element ?
|
|
28
27
|
(element instanceof Function ? element() : element) :
|
|
29
28
|
React.createElement("span", { className: "input-group-text", onClick: function () { var _a; return (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, text ? this.iconFactory.textOrIcon(text) : this.iconFactory.getIconComponent(icon));
|
|
30
|
-
return
|
|
31
|
-
React.createElement("div", { className: className }, innerElement) :
|
|
32
|
-
innerElement;
|
|
29
|
+
return React.createElement("div", { className: className }, innerElement);
|
|
33
30
|
};
|
|
34
31
|
return InputHelpers;
|
|
35
32
|
}());
|
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.21",
|
|
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",
|
package/styles/Card.scss
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
justify-content: space-between;
|
|
5
5
|
align-items: center;
|
|
6
6
|
|
|
7
|
-
.card-header-title
|
|
8
|
-
margin-right:
|
|
7
|
+
.card-header-title .neo-icon {
|
|
8
|
+
margin-right: 0.5rem;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.card-header-right-section {
|
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
|
|
16
16
|
.card-expand-indicator {
|
|
17
17
|
margin-left: 0.5rem;
|
|
18
|
-
padding-top: 0.5rem;
|
|
19
|
-
padding-bottom: 0.5rem;
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
20
|
}
|