@singularsystems/neo-react 1.0.1 → 1.0.2
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/BootstrapUtils.d.ts +15 -0
- package/dist/ReactComponents/BootstrapUtils.js +35 -0
- package/dist/ReactComponents/DropDown/DropDown.js +1 -1
- package/dist/ReactComponents/Form.js +6 -1
- package/dist/ReactComponents/FormGroup/FormGroup.d.ts +1 -0
- package/dist/ReactComponents/FormGroup/FormGroup.js +5 -2
- package/dist/ReactComponents/GridLayout.js +4 -2
- package/dist/ReactComponents/Icons/IIconFactory.d.ts +2 -0
- package/dist/ReactComponents/Icons/IconFactory.js +5 -1
- package/dist/ReactComponents/Icons/MaterialSymbolsFontFactory.js +6 -1
- package/dist/ReactComponents/Input.js +8 -3
- package/dist/ReactComponents/InputHelpers.d.ts +1 -0
- package/dist/ReactComponents/InputHelpers.js +15 -8
- package/dist/ReactComponents/Modal/Modal.js +6 -6
- package/dist/ReactComponents/Notifications/Alert.js +2 -3
- package/dist/ReactComponents/Notifications/Toast.js +3 -3
- package/dist/ReactComponents/PropTypes.d.ts +5 -1
- package/dist/ReactComponents/PropTypes.js +4 -2
- package/dist/ReactComponents/RadioList.js +5 -3
- package/package.json +3 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { MouseEventHandler } from "react";
|
|
2
|
+
declare class BootstrapUtils {
|
|
3
|
+
constructor();
|
|
4
|
+
/** Bootstrap version is before v5 */
|
|
5
|
+
get isPre5(): boolean;
|
|
6
|
+
/** Class prefix (without -) for end margin / right margin. */
|
|
7
|
+
get marginE(): "mr" | "me";
|
|
8
|
+
/**
|
|
9
|
+
* Gets the close button used in component headers.
|
|
10
|
+
* @param pre5ClassName Class to add if bootstrap version is <5.
|
|
11
|
+
*/
|
|
12
|
+
getCloseButton(onClick: MouseEventHandler<HTMLButtonElement>, pre5ClassName?: string): React.JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: BootstrapUtils;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Misc, Utils } from "@singularsystems/neo-core";
|
|
2
|
+
import React from "react";
|
|
3
|
+
var BootstrapUtils = /** @class */ (function () {
|
|
4
|
+
function BootstrapUtils() {
|
|
5
|
+
}
|
|
6
|
+
Object.defineProperty(BootstrapUtils.prototype, "isPre5", {
|
|
7
|
+
/** Bootstrap version is before v5 */
|
|
8
|
+
get: function () {
|
|
9
|
+
return Misc.Settings.bootstrap.version < 5;
|
|
10
|
+
},
|
|
11
|
+
enumerable: false,
|
|
12
|
+
configurable: true
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(BootstrapUtils.prototype, "marginE", {
|
|
15
|
+
/** Class prefix (without -) for end margin / right margin. */
|
|
16
|
+
get: function () {
|
|
17
|
+
return this.isPre5 ? "mr" : "me";
|
|
18
|
+
},
|
|
19
|
+
enumerable: false,
|
|
20
|
+
configurable: true
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Gets the close button used in component headers.
|
|
24
|
+
* @param pre5ClassName Class to add if bootstrap version is <5.
|
|
25
|
+
*/
|
|
26
|
+
BootstrapUtils.prototype.getCloseButton = function (onClick, pre5ClassName) {
|
|
27
|
+
pre5ClassName = Utils.joinWithSpaces("close", pre5ClassName);
|
|
28
|
+
return this.isPre5 ?
|
|
29
|
+
React.createElement("button", { type: "button", className: pre5ClassName, "aria-label": "Close", onClick: onClick },
|
|
30
|
+
React.createElement("span", { "aria-hidden": "true" }, "\u00D7")) :
|
|
31
|
+
React.createElement("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: onClick });
|
|
32
|
+
};
|
|
33
|
+
return BootstrapUtils;
|
|
34
|
+
}());
|
|
35
|
+
export default new BootstrapUtils();
|
|
@@ -92,7 +92,7 @@ var DropDown = /** @class */ (function (_super) {
|
|
|
92
92
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
93
93
|
var splitProps = BindPropsHelper.normaliseEditorProps(this, this.props);
|
|
94
94
|
var domProps = BindPropsHelper.autoSetDomProperties(splitProps, this.context);
|
|
95
|
-
domProps.className = Utils.joinWithSpaces(domProps.className, splitProps.isBootstrap ? "form-control" : "neo-forms-editor");
|
|
95
|
+
domProps.className = Utils.joinWithSpaces(domProps.className, splitProps.isBootstrap ? "form-control form-select" : "neo-forms-editor");
|
|
96
96
|
this.sortByValue = (_a = splitProps.select) === null || _a === void 0 ? void 0 : _a.sortByValue;
|
|
97
97
|
if (splitProps.select) {
|
|
98
98
|
if (splitProps.select.valueMember)
|
|
@@ -14,6 +14,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
14
14
|
}
|
|
15
15
|
Form.prototype.onSubmit = function (e, model) {
|
|
16
16
|
var _this = this;
|
|
17
|
+
var _a;
|
|
17
18
|
e.preventDefault();
|
|
18
19
|
e.stopPropagation();
|
|
19
20
|
this.disposeReaction();
|
|
@@ -38,11 +39,15 @@ var Form = /** @class */ (function (_super) {
|
|
|
38
39
|
this.props.onInvalid(e, justValidated);
|
|
39
40
|
if (this.props.showSummaryModal || this.props.invalidSummaryText || this.props.invalidSummaryTitle) {
|
|
40
41
|
var onClose = this.disposeReaction.bind(this);
|
|
42
|
+
var closeButton = (_a = Misc.Settings.form.validationModalCloseButton) !== null && _a !== void 0 ? _a : { text: "Ok" };
|
|
43
|
+
if (closeButton) {
|
|
44
|
+
closeButton.onClick = onClose;
|
|
45
|
+
}
|
|
41
46
|
var codeModal_1 = ModalUtils.showModal(this.props.invalidSummaryTitle || "Invalid data", React.createElement(Observer, null, function () {
|
|
42
47
|
return React.createElement("div", null,
|
|
43
48
|
_this.props.invalidSummaryText || "Cannot continue due to the following issues:",
|
|
44
49
|
React.createElement(ValidationSummary, { graph: Validation.getValidationSummary(model), hideTopLevelTitle: !(model instanceof Array) }));
|
|
45
|
-
}), { onClose: onClose, closeButton:
|
|
50
|
+
}), { onClose: onClose, closeButton: closeButton });
|
|
46
51
|
// Listen for when isValid changes to true, in case there is an async rule running.
|
|
47
52
|
this.reactionDisposer = reaction(function () { return model.isValid; }, function () {
|
|
48
53
|
_this.disposeReaction();
|
|
@@ -29,6 +29,7 @@ export interface IFormGroupClasses {
|
|
|
29
29
|
export declare class FormGroupBase<T extends IFormGroupProps<TData>, TData> extends ComponentBase<T> {
|
|
30
30
|
static contextType: React.Context<import("../FormContext").FormContextParams>;
|
|
31
31
|
context: React.ContextType<typeof FormContext>;
|
|
32
|
+
protected isBsPre5: boolean;
|
|
32
33
|
protected getFormGroupClasses(domProps: React.HTMLProps<HTMLDivElement>, isCheckBox: boolean): IFormGroupClasses;
|
|
33
34
|
protected hideLabelForCheckboxes(): boolean;
|
|
34
35
|
render(): React.JSX.Element;
|
|
@@ -5,13 +5,16 @@ import { BindPropsHelper, CheckboxType } from '../PropTypes';
|
|
|
5
5
|
import { Validation, Utils } from '@singularsystems/neo-core';
|
|
6
6
|
import ComponentBase from '../ComponentBase';
|
|
7
7
|
import { EditorParentType, FormContext } from '../FormContext';
|
|
8
|
+
import BootstrapUtils from "../BootstrapUtils";
|
|
8
9
|
var FormGroupBase = /** @class */ (function (_super) {
|
|
9
10
|
__extends(FormGroupBase, _super);
|
|
10
11
|
function FormGroupBase() {
|
|
11
|
-
|
|
12
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
13
|
+
_this.isBsPre5 = BootstrapUtils.isPre5;
|
|
14
|
+
return _this;
|
|
12
15
|
}
|
|
13
16
|
FormGroupBase.prototype.getFormGroupClasses = function (domProps, isCheckBox) {
|
|
14
|
-
return { containerDom: domProps, container: "form-group", label: "", editor: "" };
|
|
17
|
+
return { containerDom: domProps, container: "form-group", label: this.isBsPre5 ? "" : "form-label", editor: "" };
|
|
15
18
|
};
|
|
16
19
|
FormGroupBase.prototype.hideLabelForCheckboxes = function () {
|
|
17
20
|
return true;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Utils } from '@singularsystems/neo-core';
|
|
4
|
+
import BootstrapUtils from "./BootstrapUtils";
|
|
4
5
|
var FormGroupLayoutContextParams = /** @class */ (function () {
|
|
5
6
|
function FormGroupLayoutContextParams() {
|
|
6
7
|
}
|
|
@@ -15,11 +16,12 @@ var GridLayout = /** @class */ (function (_super) {
|
|
|
15
16
|
}
|
|
16
17
|
GridLayout.prototype.render = function () {
|
|
17
18
|
var _a = this.props, gutterSize = _a.gutterSize, verticalSpace = _a.verticalSpace, withGaps = _a.withGaps, alignItems = _a.alignItems, formGroupProps = _a.formGroupProps, xs = _a.xs, sm = _a.sm, md = _a.md, lg = _a.lg, xl = _a.xl, xxl = _a.xxl, domProps = __rest(_a, ["gutterSize", "verticalSpace", "withGaps", "alignItems", "formGroupProps", "xs", "sm", "md", "lg", "xl", "xxl"]);
|
|
18
|
-
var
|
|
19
|
+
var isBsPre5 = BootstrapUtils.isPre5;
|
|
20
|
+
var columnClassName = Utils.joinWithSpaces((gutterSize !== undefined && isBsPre5) ? "px-" + gutterSize : undefined, xs && "col-" + 12 / xs, sm && "col-sm-" + 12 / sm, md && "col-md-" + 12 / md, lg && "col-lg-" + 12 / lg, xl && "col-xl-" + 12 / xl, xxl && "col-xxl-" + 12 / xxl);
|
|
19
21
|
if (!(xs || sm || md || lg || xl || xxl)) {
|
|
20
22
|
columnClassName = Utils.joinWithSpaces(columnClassName, "col-md-6");
|
|
21
23
|
}
|
|
22
|
-
var rowClassName = Utils.joinWithSpaces(domProps.className, "row", gutterSize && "mx-n" + this.props.gutterSize, alignItems && "align-items-" + this.props.alignItems);
|
|
24
|
+
var rowClassName = Utils.joinWithSpaces(domProps.className, "row", gutterSize && (isBsPre5 ? "mx-n" : "gx-") + this.props.gutterSize, alignItems && "align-items-" + this.props.alignItems);
|
|
23
25
|
var containerStyle = domProps.style;
|
|
24
26
|
var columnStyle = undefined;
|
|
25
27
|
if (withGaps && !verticalSpace) {
|
|
@@ -8,6 +8,8 @@ export interface IconStyle {
|
|
|
8
8
|
solid?: boolean;
|
|
9
9
|
/** How thin / thick the icon lines are. Only supported by material symbols. */
|
|
10
10
|
weight?: number;
|
|
11
|
+
/** Specific font size. Any valid css font size. */
|
|
12
|
+
size?: string;
|
|
11
13
|
}
|
|
12
14
|
export interface IIconFactory {
|
|
13
15
|
/**
|
|
@@ -27,6 +27,7 @@ var IconFactory = /** @class */ (function () {
|
|
|
27
27
|
};
|
|
28
28
|
IconFactory.prototype.mapStringToIcon = function (iconName, style) {
|
|
29
29
|
var className = Utils.getFontAwesomeClass(iconName);
|
|
30
|
+
var inlineStyle = undefined;
|
|
30
31
|
if ((style === null || style === void 0 ? void 0 : style.solid) === false) {
|
|
31
32
|
className = className.replace("fa ", "far ");
|
|
32
33
|
}
|
|
@@ -39,7 +40,10 @@ var IconFactory = /** @class */ (function () {
|
|
|
39
40
|
if (style === null || style === void 0 ? void 0 : style.spin) {
|
|
40
41
|
className += " fa-spin";
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
+
if (style === null || style === void 0 ? void 0 : style.size) {
|
|
44
|
+
inlineStyle = { fontSize: style.size };
|
|
45
|
+
}
|
|
46
|
+
return React.createElement("i", { className: className, style: inlineStyle });
|
|
43
47
|
};
|
|
44
48
|
IconFactory.prototype.createIconComponent = function (iconDescriptor, style) {
|
|
45
49
|
return iconDescriptor;
|
|
@@ -40,7 +40,8 @@ var MaterialSymbolsFontFactory = /** @class */ (function (_super) {
|
|
|
40
40
|
if (faProps.isSolid !== undefined) {
|
|
41
41
|
isFilled = faProps.isSolid;
|
|
42
42
|
}
|
|
43
|
-
var
|
|
43
|
+
var underscoreIndex = iconName.indexOf("_");
|
|
44
|
+
var mappedName = underscoreIndex === 0 ? iconName.substring(1) : underscoreIndex >= 0 ? iconName : this.mapFontAwesomeToMaterial(iconName);
|
|
44
45
|
if (mappedName === undefined) {
|
|
45
46
|
// replace common differences.
|
|
46
47
|
mappedName = iconName.replace(/-/g, "_")
|
|
@@ -61,6 +62,10 @@ var MaterialSymbolsFontFactory = /** @class */ (function (_super) {
|
|
|
61
62
|
}
|
|
62
63
|
cssStyle = { fontVariationSettings: styleText.trim() };
|
|
63
64
|
}
|
|
65
|
+
if (style === null || style === void 0 ? void 0 : style.size) {
|
|
66
|
+
cssStyle !== null && cssStyle !== void 0 ? cssStyle : (cssStyle = {});
|
|
67
|
+
cssStyle.fontSize = style.size;
|
|
68
|
+
}
|
|
64
69
|
return React.createElement("span", { className: className, style: cssStyle }, mappedName);
|
|
65
70
|
};
|
|
66
71
|
MaterialSymbolsFontFactory.prototype.mapFontAwesomeToMaterial = function (faName) {
|
|
@@ -8,6 +8,7 @@ import ComponentBase from './ComponentBase';
|
|
|
8
8
|
import { FormContext } from './FormContext';
|
|
9
9
|
import { Button } from './_Exports';
|
|
10
10
|
import { makeObservable, observable } from 'mobx';
|
|
11
|
+
import BootstrapUtils from "./BootstrapUtils";
|
|
11
12
|
var Input = /** @class */ (function (_super) {
|
|
12
13
|
__extends(Input, _super);
|
|
13
14
|
function Input(props) {
|
|
@@ -66,9 +67,10 @@ var Input = /** @class */ (function (_super) {
|
|
|
66
67
|
var displayInfo = this.props.bind.validator.getDisplayState(this.context.validationDisplayMode);
|
|
67
68
|
displayInfo.applyToDom(domProps, !splitProps.inGroup);
|
|
68
69
|
var bindValue = this.props.bind.value;
|
|
70
|
+
var isBsPre5 = BootstrapUtils.isPre5;
|
|
69
71
|
if (this.type === "checkbox" || this.type === "switch") {
|
|
70
72
|
domProps.checked = bindValue === true;
|
|
71
|
-
domProps.className = "
|
|
73
|
+
domProps.className = isBsPre5 ? "custom-control-input" : "form-check-input";
|
|
72
74
|
// Bootstrap custom checkboxes don't honour the readonly attribute.
|
|
73
75
|
if (domProps.readOnly) {
|
|
74
76
|
domProps.disabled = true;
|
|
@@ -94,9 +96,12 @@ var Input = /** @class */ (function (_super) {
|
|
|
94
96
|
inputElement = React.createElement("textarea", __assign({}, domProps, { ref: this.domRef, rows: inputProps.rows }));
|
|
95
97
|
}
|
|
96
98
|
if (this.type === "checkbox") {
|
|
97
|
-
|
|
99
|
+
var wrapperClassName = isBsPre5 ?
|
|
100
|
+
"custom-control custom-".concat((inputProps === null || inputProps === void 0 ? void 0 : inputProps.type) === "switch" ? "switch" : "checkbox") :
|
|
101
|
+
"form-check".concat((inputProps === null || inputProps === void 0 ? void 0 : inputProps.type) === "switch" ? " form-switch" : "");
|
|
102
|
+
inputElement = React.createElement("div", { className: wrapperClassName },
|
|
98
103
|
inputElement,
|
|
99
|
-
React.createElement("label", { htmlFor: domProps.id, className: "custom-control-label" }, (inputProps.label ? inputProps.label : "")));
|
|
104
|
+
React.createElement("label", { htmlFor: domProps.id, className: isBsPre5 ? "custom-control-label" : "form-check-label" }, (inputProps.label ? inputProps.label : "")));
|
|
100
105
|
}
|
|
101
106
|
if (showPasswordButton) {
|
|
102
107
|
var buttonOptions = { variant: "primary", isOutline: true };
|
|
@@ -3,4 +3,5 @@ import { ICommonEditorProps } from './PropTypes';
|
|
|
3
3
|
export declare class InputHelpers {
|
|
4
4
|
private static iconFactory?;
|
|
5
5
|
static surroundWithInputGroup<T extends React.ReactNode>(element: T, props: ICommonEditorProps, inputRef?: React.RefObject<HTMLElement>): React.JSX.Element | T;
|
|
6
|
+
private static getElement;
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
var InputHelpers = /** @class */ (function () {
|
|
5
6
|
function InputHelpers() {
|
|
6
7
|
}
|
|
@@ -9,21 +10,27 @@ var InputHelpers = /** @class */ (function () {
|
|
|
9
10
|
this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
10
11
|
}
|
|
11
12
|
if (props.requiresGroup) {
|
|
13
|
+
var isBsPre5 = BootstrapUtils.isPre5;
|
|
12
14
|
return (React.createElement("div", { className: "input-group" },
|
|
13
|
-
(props.prependText
|
|
14
|
-
React.createElement("div", { className: "input-group-prepend" },
|
|
15
|
-
props.prepend && (props.prepend instanceof Function ? props.prepend() : props.prepend),
|
|
16
|
-
props.prependText && 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(); } }, this.iconFactory.textOrIcon(props.prependText))),
|
|
15
|
+
this.getElement(isBsPre5, "input-group-prepend", inputRef, props.prependText, props.prependIcon, props.prepend),
|
|
17
16
|
element,
|
|
18
|
-
(props.appendText
|
|
19
|
-
React.createElement("div", { className: "input-group-append" },
|
|
20
|
-
props.append && (props.append instanceof Function ? props.append() : props.append),
|
|
21
|
-
props.appendText && 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(); } }, this.iconFactory.textOrIcon(props.appendText)))));
|
|
17
|
+
this.getElement(isBsPre5, "input-group-append", inputRef, props.appendText, props.appendIcon, props.append)));
|
|
22
18
|
}
|
|
23
19
|
else {
|
|
24
20
|
return element;
|
|
25
21
|
}
|
|
26
22
|
};
|
|
23
|
+
InputHelpers.getElement = function (isBsPre5, className, inputRef, text, icon, element) {
|
|
24
|
+
if (!text && !icon && !element) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
var innerElement = element ?
|
|
28
|
+
(element instanceof Function ? element() : element) :
|
|
29
|
+
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 isBsPre5 ?
|
|
31
|
+
React.createElement("div", { className: className }, innerElement) :
|
|
32
|
+
innerElement;
|
|
33
|
+
};
|
|
27
34
|
return InputHelpers;
|
|
28
35
|
}());
|
|
29
36
|
export { InputHelpers };
|
|
@@ -6,6 +6,7 @@ import Button from '../Button';
|
|
|
6
6
|
import { Settings } from '@singularsystems/neo-core/dist/Settings';
|
|
7
7
|
import { Neo } from '../..';
|
|
8
8
|
import { observer } from 'mobx-react';
|
|
9
|
+
import BootstrapUtils from "../BootstrapUtils";
|
|
9
10
|
var Modal = /** @class */ (function (_super) {
|
|
10
11
|
__extends(Modal, _super);
|
|
11
12
|
function Modal() {
|
|
@@ -104,9 +105,10 @@ var Modal = /** @class */ (function (_super) {
|
|
|
104
105
|
}
|
|
105
106
|
var content = this.visible && React.createElement(React.Fragment, null,
|
|
106
107
|
React.createElement("div", { className: "modal-body" }, this.props.children instanceof Function ? (show ? this.props.children(this.lastBindValue) : (renderOnCollapse ? this.props.children(this.lastBindValue) : undefined)) : this.props.children),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
(buttons.length > 0 || footerContent || footer) &&
|
|
109
|
+
React.createElement("div", { className: "modal-footer" }, footer ? footer : React.createElement(React.Fragment, null,
|
|
110
|
+
footerContent && React.createElement("div", { className: "modal-footer-content" }, footerContent),
|
|
111
|
+
buttons.map(function (buttonProps, index) { return React.createElement(Button, __assign({ key: index }, buttonProps)); }))));
|
|
110
112
|
var container;
|
|
111
113
|
if (suppressForm) {
|
|
112
114
|
container = React.createElement(React.Fragment, null, content);
|
|
@@ -120,9 +122,7 @@ var Modal = /** @class */ (function (_super) {
|
|
|
120
122
|
React.createElement("div", { className: "modal-content" },
|
|
121
123
|
React.createElement("div", { className: "modal-header" },
|
|
122
124
|
React.createElement("h5", { className: "modal-title" }, this.props.title),
|
|
123
|
-
this.props.showCancelButton !== false &&
|
|
124
|
-
React.createElement("button", { type: "button", className: "close", "aria-label": "Close", onClick: onClose },
|
|
125
|
-
React.createElement("span", { "aria-hidden": "true" }, "\u00D7"))),
|
|
125
|
+
this.props.showCancelButton !== false && BootstrapUtils.getCloseButton(onClose)),
|
|
126
126
|
container))));
|
|
127
127
|
};
|
|
128
128
|
Modal = __decorate([
|
|
@@ -4,6 +4,7 @@ import { Misc, Utils } from "@singularsystems/neo-core";
|
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
5
|
import CollapsableBase from '../CollapsableBase';
|
|
6
6
|
import { NeoReactTypes } from "../../Modules/Types";
|
|
7
|
+
import BootstrapUtils from "../BootstrapUtils";
|
|
7
8
|
var Alert = /** @class */ (function (_super) {
|
|
8
9
|
__extends(Alert, _super);
|
|
9
10
|
function Alert() {
|
|
@@ -26,9 +27,7 @@ var Alert = /** @class */ (function (_super) {
|
|
|
26
27
|
this.iconFactory.getIconComponent(icon),
|
|
27
28
|
React.createElement("div", null, this.props.children)),
|
|
28
29
|
!icon && this.props.children,
|
|
29
|
-
bindShow &&
|
|
30
|
-
React.createElement("button", { type: "button", className: "close", onClick: this.onClose },
|
|
31
|
-
React.createElement("span", null, "\u00D7"))));
|
|
30
|
+
bindShow && BootstrapUtils.getCloseButton(this.onClose)));
|
|
32
31
|
};
|
|
33
32
|
Alert = __decorate([
|
|
34
33
|
observer
|
|
@@ -4,6 +4,7 @@ import CollapsableBase from '../CollapsableBase';
|
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
5
|
import { Components, Misc } from '@singularsystems/neo-core';
|
|
6
6
|
import { NeoReactTypes } from '../../Modules/Types';
|
|
7
|
+
import BootstrapUtils from "../BootstrapUtils";
|
|
7
8
|
var Toast = /** @class */ (function (_super) {
|
|
8
9
|
__extends(Toast, _super);
|
|
9
10
|
function Toast() {
|
|
@@ -29,9 +30,8 @@ var Toast = /** @class */ (function (_super) {
|
|
|
29
30
|
this.shouldShow = show !== false && (!bindShow || bindShow.value);
|
|
30
31
|
return (React.createElement("div", { className: "toast show collapsable", role: "alert", "aria-live": "assertive", "aria-atomic": "true", ref: this.containerRef },
|
|
31
32
|
React.createElement("div", { className: "toast-header toast-header-" + variant },
|
|
32
|
-
React.createElement("strong", { className: "
|
|
33
|
-
bindShow &&
|
|
34
|
-
React.createElement("span", { "aria-hidden": "true" }, "\u00D7"))),
|
|
33
|
+
React.createElement("strong", { className: "".concat(BootstrapUtils.marginE, "-auto alert-heading") }, heading),
|
|
34
|
+
bindShow && BootstrapUtils.getCloseButton(this.onClose, "ml-2 mb-1")),
|
|
35
35
|
this.props.autoCloseTimeout && React.createElement("div", { className: "toast-count-down toast-count-down-" + variant, ref: this.countDownRef }),
|
|
36
36
|
React.createElement("div", { className: "toast-body" },
|
|
37
37
|
icon && React.createElement("div", { className: "notification-icon-container" },
|
|
@@ -42,6 +42,10 @@ export interface ICommonEditorProps {
|
|
|
42
42
|
prepend?: (() => JSX.Element) | JSX.Element | null;
|
|
43
43
|
/** Additional element to include after the input element */
|
|
44
44
|
append?: (() => JSX.Element) | JSX.Element | null;
|
|
45
|
+
/** Icon name or component */
|
|
46
|
+
prependIcon?: any;
|
|
47
|
+
/** Icon name or component */
|
|
48
|
+
appendIcon?: any;
|
|
45
49
|
/** True if append / prepend is set, which means this must be an editor as part of a bs editor group. */
|
|
46
50
|
requiresGroup?: boolean;
|
|
47
51
|
/** Reference to the input dom element */
|
|
@@ -137,7 +141,7 @@ export declare class BindPropsHelper {
|
|
|
137
141
|
static getBindProperty<T>(allProps: IEditorContainerProps<T, any>): Model.IPropertyInstance;
|
|
138
142
|
static splitCommonEditorProps<T extends ICommonEditorProps>(props: T): {
|
|
139
143
|
editor: ICommonEditorProps;
|
|
140
|
-
rest: Omit<T, "append" | "prepend" | "disabled" | "readOnly" | "isDisabled" | "isReadOnly" | "prependText" | "appendText" | "inputElement">;
|
|
144
|
+
rest: Omit<T, "append" | "prepend" | "disabled" | "readOnly" | "isDisabled" | "isReadOnly" | "prependText" | "appendText" | "prependIcon" | "appendIcon" | "inputElement">;
|
|
141
145
|
};
|
|
142
146
|
static normaliseContainerProps<T, TContainerDom = React.HTMLProps<T>, TData = any>(component: IComponentBase, props: IEditorContainerProps<T, TData>, inGroup: boolean, isBootstrap?: boolean): IEditorContainerNormalisedProps<TContainerDom, TData>;
|
|
143
147
|
static normaliseEditorProps<T, TDom = React.HTMLProps<T>>(component: IComponentBase, props: (IEditorAndSelectorProps<T, any> & TDom) | IEditorNormalisedProps<TDom, any>): IEditorNormalisedProps<TDom, any>;
|
|
@@ -102,16 +102,18 @@ var BindPropsHelper = /** @class */ (function () {
|
|
|
102
102
|
return (allProps.bind || allProps.display || allProps.bindContext);
|
|
103
103
|
};
|
|
104
104
|
BindPropsHelper.splitCommonEditorProps = function (props) {
|
|
105
|
-
var isReadOnly = props.isReadOnly, readOnly = props.readOnly, isDisabled = props.isDisabled, disabled = props.disabled, prependText = props.prependText, prepend = props.prepend, appendText = props.appendText, append = props.append, inputElement = props.inputElement, rest = __rest(props, ["isReadOnly", "readOnly", "isDisabled", "disabled", "prependText", "prepend", "appendText", "append", "inputElement"]);
|
|
105
|
+
var isReadOnly = props.isReadOnly, readOnly = props.readOnly, isDisabled = props.isDisabled, disabled = props.disabled, prependText = props.prependText, prepend = props.prepend, prependIcon = props.prependIcon, appendText = props.appendText, append = props.append, appendIcon = props.appendIcon, inputElement = props.inputElement, rest = __rest(props, ["isReadOnly", "readOnly", "isDisabled", "disabled", "prependText", "prepend", "prependIcon", "appendText", "append", "appendIcon", "inputElement"]);
|
|
106
106
|
return {
|
|
107
107
|
editor: {
|
|
108
108
|
isReadOnly: (isReadOnly !== null && isReadOnly !== void 0 ? isReadOnly : readOnly), isDisabled: (isDisabled !== null && isDisabled !== void 0 ? isDisabled : disabled),
|
|
109
109
|
prependText: prependText,
|
|
110
110
|
prepend: prepend,
|
|
111
|
+
prependIcon: prependIcon,
|
|
111
112
|
appendText: appendText,
|
|
112
113
|
append: append,
|
|
114
|
+
appendIcon: appendIcon,
|
|
113
115
|
inputElement: inputElement,
|
|
114
|
-
requiresGroup: prependText !== undefined || prepend !== undefined || appendText !== undefined || append !== undefined
|
|
116
|
+
requiresGroup: prependText !== undefined || prepend !== undefined || prependIcon !== undefined || appendText !== undefined || append !== undefined || appendIcon !== undefined
|
|
115
117
|
},
|
|
116
118
|
rest: rest
|
|
117
119
|
};
|
|
@@ -6,6 +6,7 @@ import { BindPropsHelper } from './PropTypes';
|
|
|
6
6
|
import ComponentBase from './ComponentBase';
|
|
7
7
|
import { FormContext } from './FormContext';
|
|
8
8
|
import LookupHelper from './DropDown/LookupHelper';
|
|
9
|
+
import BootstrapUtils from "./BootstrapUtils";
|
|
9
10
|
var RadioList = /** @class */ (function (_super) {
|
|
10
11
|
__extends(RadioList, _super);
|
|
11
12
|
function RadioList() {
|
|
@@ -41,13 +42,14 @@ var RadioList = /** @class */ (function (_super) {
|
|
|
41
42
|
// TODO, how must validation show if not in form group?
|
|
42
43
|
//const displayInfo = this.props.bind.validator.getDisplayState(this.context.validationDisplayMode);
|
|
43
44
|
//displayInfo.applyToDom(domProps, !splitProps.inGroup);
|
|
45
|
+
var isBsPre5 = BootstrapUtils.isPre5, prefix = isBsPre5 ? "custom-control" : "form-check";
|
|
44
46
|
var bindValue = this.props.bind.value;
|
|
45
47
|
var className = Utils.joinWithSpaces("neo-radio-list", (_a = splitProps.editorDom) === null || _a === void 0 ? void 0 : _a.className);
|
|
46
48
|
return React.createElement("div", { className: className }, this.items.map(function (item) {
|
|
47
49
|
var _a, _b;
|
|
48
|
-
return React.createElement("div", { className: "custom-
|
|
49
|
-
React.createElement("input", { type: "radio", id: splitProps.uniqueID + ((_a = item.id) !== null && _a !== void 0 ? _a : ""), name: splitProps.uniqueID, checked: bindValue === item.id, disabled: domProps.disabled || domProps.readOnly, onChange: function () { return _this.props.bind.value = item.id; }, className: "
|
|
50
|
-
React.createElement("label", { className: "
|
|
50
|
+
return React.createElement("div", { className: "custom-radio " + prefix + (_this.props.radioList.inline ? " ".concat(prefix, "-inline") : ""), key: item.id },
|
|
51
|
+
React.createElement("input", { type: "radio", id: splitProps.uniqueID + ((_a = item.id) !== null && _a !== void 0 ? _a : ""), name: splitProps.uniqueID, checked: bindValue === item.id, disabled: domProps.disabled || domProps.readOnly, onChange: function () { return _this.props.bind.value = item.id; }, className: "".concat(prefix, "-input") }),
|
|
52
|
+
React.createElement("label", { className: "".concat(prefix, "-label"), htmlFor: splitProps.uniqueID + ((_b = item.id) !== null && _b !== void 0 ? _b : "") }, item.name));
|
|
51
53
|
}));
|
|
52
54
|
};
|
|
53
55
|
RadioList.contextType = FormContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularsystems/neo-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typescript": "5.4.2"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@singularsystems/neo-core": "1.0.
|
|
34
|
+
"@singularsystems/neo-core": "1.0.2",
|
|
35
35
|
"@types/rc-slider": "^8.6.5",
|
|
36
36
|
"@types/react-color": "^3.0.1",
|
|
37
37
|
"axios": "1.6.7",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"tslib": "2.5.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@singularsystems/neo-core": ">=1.0.
|
|
52
|
+
"@singularsystems/neo-core": ">=1.0.2",
|
|
53
53
|
"axios": ">=1.6.2",
|
|
54
54
|
"inversify": ">=5.0.1",
|
|
55
55
|
"mobx": ">=6.9.0",
|