@singularsystems/neo-react 1.0.3 → 1.0.5
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/DropDown/AutoCompleteDropDown.d.ts +1 -0
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +24 -18
- package/dist/ReactComponents/Icons/IconFactory.js +1 -0
- package/dist/ReactComponents/Icons/MaterialSymbolsFontFactory.js +1 -1
- package/dist/ReactComponents/Notifications/Alert.d.ts +1 -0
- package/dist/ReactComponents/Notifications/Alert.js +25 -10
- package/package.json +2 -2
- package/styles/Misc.scss +13 -0
|
@@ -90,6 +90,7 @@ export default class AutoCompleteDropDown<T> extends DropDownBase<T, IAutoComple
|
|
|
90
90
|
private bindIdsProperty?;
|
|
91
91
|
static getBindProp<T>(props: IAutoCompleteProps | IAutoCompleteMultiSelectProps): Model.IPropertyInstance<any>;
|
|
92
92
|
private onKeyPress;
|
|
93
|
+
private setBindProperty;
|
|
93
94
|
private mapTArrayToOptions;
|
|
94
95
|
private onItemSelected;
|
|
95
96
|
render(): React.JSX.Element;
|
|
@@ -11,29 +11,11 @@ import { NeoReactTypes } from '../../Modules/Types';
|
|
|
11
11
|
var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
12
12
|
__extends(AutoCompleteDropDown, _super);
|
|
13
13
|
function AutoCompleteDropDown(props) {
|
|
14
|
-
var _a;
|
|
15
14
|
var _this = _super.call(this, props) || this;
|
|
16
15
|
_this.asyncSelectImplementation = Misc.Globals.appService.get(NeoReactTypes.Components.AsyncSelect);
|
|
17
16
|
_this.selectImplementation = Misc.Globals.appService.get(NeoReactTypes.Components.ReactSelect);
|
|
18
17
|
_this.onKeyPress = _this.onKeyPress.bind(_this);
|
|
19
18
|
_this.onItemSelected = _this.onItemSelected.bind(_this);
|
|
20
|
-
var singleProps = _this.props, multiProps = _this.props;
|
|
21
|
-
_this.bindProperty = (_a = singleProps.bind) !== null && _a !== void 0 ? _a : multiProps.bindItems;
|
|
22
|
-
_this.fieldInfoContainer = Model.ModelFieldInfo.asModelFieldInfoContainer(_this.bindProperty.attachedTo);
|
|
23
|
-
if (multiProps.bindIds) {
|
|
24
|
-
if (multiProps.bindIds.propertyInfo) {
|
|
25
|
-
var bindIdsProperty = multiProps.bindIds;
|
|
26
|
-
_this.bindIdsProperty = bindIdsProperty;
|
|
27
|
-
_this.bindIdsList = bindIdsProperty.value;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
_this.bindIdsList = multiProps.bindIds;
|
|
31
|
-
if (_this.fieldInfoContainer) {
|
|
32
|
-
console.error("Warning: Pass a property instance as 'bindIds', otherwise the display values will not be captured.");
|
|
33
|
-
_this.fieldInfoContainer = null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
19
|
return _this;
|
|
38
20
|
}
|
|
39
21
|
AutoCompleteDropDown.getBindProp = function (props) {
|
|
@@ -62,6 +44,29 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
62
44
|
Utils.clearDebounce(this);
|
|
63
45
|
}
|
|
64
46
|
};
|
|
47
|
+
AutoCompleteDropDown.prototype.setBindProperty = function () {
|
|
48
|
+
var _a;
|
|
49
|
+
var singleProps = this.props, multiProps = this.props;
|
|
50
|
+
var newBind = (_a = singleProps.bind) !== null && _a !== void 0 ? _a : multiProps.bindItems;
|
|
51
|
+
if (this.bindProperty !== newBind) {
|
|
52
|
+
this.bindProperty = newBind;
|
|
53
|
+
this.fieldInfoContainer = Model.ModelFieldInfo.asModelFieldInfoContainer(this.bindProperty.attachedTo);
|
|
54
|
+
if (multiProps.bindIds) {
|
|
55
|
+
if (multiProps.bindIds.propertyInfo) {
|
|
56
|
+
var bindIdsProperty = multiProps.bindIds;
|
|
57
|
+
this.bindIdsProperty = bindIdsProperty;
|
|
58
|
+
this.bindIdsList = bindIdsProperty.value;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.bindIdsList = multiProps.bindIds;
|
|
62
|
+
if (this.fieldInfoContainer) {
|
|
63
|
+
console.error("Warning: Pass a property instance as 'bindIds', otherwise the display values will not be captured.");
|
|
64
|
+
this.fieldInfoContainer = null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
65
70
|
AutoCompleteDropDown.prototype.mapTArrayToOptions = function (items) {
|
|
66
71
|
var _this = this;
|
|
67
72
|
if (items.length) {
|
|
@@ -124,6 +129,7 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
124
129
|
var _this = this;
|
|
125
130
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
126
131
|
var _j = this.props, bind = _j.bind, bindDisplay = _j.bindDisplay, bindItems = _j.bindItems, bindIds = _j.bindIds, itemSource = _j.itemSource, items = _j.items, displayMember = _j.displayMember, valueMember = _j.valueMember, descriptionMember = _j.descriptionMember, option = _j.option, noRecordsPrompt = _j.noRecordsPrompt, typeToSearchPrompt = _j.typeToSearchPrompt, delayMs = _j.delayMs, minCharacters = _j.minCharacters, onItemSelected = _j.onItemSelected, fieldInfoLimit = _j.fieldInfoLimit, otherProps = __rest(_j, ["bind", "bindDisplay", "bindItems", "bindIds", "itemSource", "items", "displayMember", "valueMember", "descriptionMember", "option", "noRecordsPrompt", "typeToSearchPrompt", "delayMs", "minCharacters", "onItemSelected", "fieldInfoLimit"]);
|
|
132
|
+
this.setBindProperty();
|
|
127
133
|
var splitProps = BindPropsHelper.splitCommonEditorProps(otherProps);
|
|
128
134
|
var nativeProps = splitProps.rest;
|
|
129
135
|
var bindItemsProperty = bindItems;
|
|
@@ -43,6 +43,7 @@ var IconFactory = /** @class */ (function () {
|
|
|
43
43
|
if (style === null || style === void 0 ? void 0 : style.size) {
|
|
44
44
|
inlineStyle = { fontSize: style.size };
|
|
45
45
|
}
|
|
46
|
+
className += " neo-icon";
|
|
46
47
|
return React.createElement("i", { className: className, style: inlineStyle });
|
|
47
48
|
};
|
|
48
49
|
IconFactory.prototype.createIconComponent = function (iconDescriptor, style) {
|
|
@@ -27,7 +27,7 @@ var MaterialSymbolsFontFactory = /** @class */ (function (_super) {
|
|
|
27
27
|
}
|
|
28
28
|
MaterialSymbolsFontFactory.prototype.mapStringToIcon = function (iconName, style) {
|
|
29
29
|
var _a;
|
|
30
|
-
var className = "material-symbols-outlined";
|
|
30
|
+
var className = "material-symbols-outlined neo-icon";
|
|
31
31
|
var isFilled = (_a = style === null || style === void 0 ? void 0 : style.solid) !== null && _a !== void 0 ? _a : this.filledByDefault;
|
|
32
32
|
// TODO: copy spin animation from font-awesome
|
|
33
33
|
if (style === null || style === void 0 ? void 0 : style.spin) {
|
|
@@ -3,6 +3,7 @@ import { Components } from "@singularsystems/neo-core";
|
|
|
3
3
|
import CollapsableBase from '../CollapsableBase';
|
|
4
4
|
interface IAlertProps {
|
|
5
5
|
isOutline?: boolean;
|
|
6
|
+
iconPosition?: "body" | "left";
|
|
6
7
|
}
|
|
7
8
|
export default class Alert extends CollapsableBase<Components.INotificationOptions & IAlertProps & React.HTMLProps<HTMLDivElement>> {
|
|
8
9
|
private iconFactory;
|
|
@@ -13,21 +13,36 @@ var Alert = /** @class */ (function (_super) {
|
|
|
13
13
|
return _this;
|
|
14
14
|
}
|
|
15
15
|
Alert.prototype.render = function () {
|
|
16
|
-
var _a
|
|
17
|
-
var
|
|
16
|
+
var _a, _b;
|
|
17
|
+
var _c = this.props, variant = _c.variant, heading = _c.heading, show = _c.show, bindShow = _c.bindShow, autoCloseTimeout = _c.autoCloseTimeout, animateInitial = _c.animateInitial, state = _c.state, onHidden = _c.onHidden, refreshValue = _c.refreshValue, icon = _c.icon, native = __rest(_c, ["variant", "heading", "show", "bindShow", "autoCloseTimeout", "animateInitial", "state", "onHidden", "refreshValue", "icon"]);
|
|
18
|
+
var isOutline = (_a = this.props.isOutline) !== null && _a !== void 0 ? _a : Misc.Settings.alerts.isOutline;
|
|
19
|
+
var iconPosition = (_b = this.props.iconPosition) !== null && _b !== void 0 ? _b : Misc.Settings.alerts.iconPosition;
|
|
20
|
+
var className = Utils.joinWithSpaces(native.className, "alert", "alert-" + variant, "collapsable" + (isOutline ? " alert-outline" : "") + (iconPosition === "left" ? " alert-left-icon" : ""));
|
|
18
21
|
if (bindShow) {
|
|
19
22
|
className += " alert-dismissible";
|
|
20
23
|
}
|
|
24
|
+
if (heading) {
|
|
25
|
+
className += " with-heading";
|
|
26
|
+
}
|
|
21
27
|
this.shouldShow = show !== false && (!bindShow || bindShow.value);
|
|
22
28
|
return (React.createElement("div", __assign({}, native, { className: className, ref: this.containerRef }),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
bindShow && BootstrapUtils.getCloseButton(this.onClose),
|
|
30
|
+
iconPosition === "body" &&
|
|
31
|
+
React.createElement(React.Fragment, null,
|
|
32
|
+
heading &&
|
|
33
|
+
React.createElement("h6", null, heading),
|
|
34
|
+
icon &&
|
|
35
|
+
React.createElement("div", { className: "notification-icon-container" },
|
|
36
|
+
this.iconFactory.getIconComponent(icon),
|
|
37
|
+
React.createElement("div", null, this.props.children)),
|
|
38
|
+
!icon && this.props.children),
|
|
39
|
+
iconPosition === "left" &&
|
|
40
|
+
React.createElement("div", null,
|
|
41
|
+
icon &&
|
|
42
|
+
React.createElement("div", { className: "notification-icon-container" }, this.iconFactory.getIconComponent(icon)),
|
|
43
|
+
React.createElement("div", null,
|
|
44
|
+
heading && React.createElement("h6", null, heading),
|
|
45
|
+
React.createElement("div", { className: "alert-body" }, this.props.children)))));
|
|
31
46
|
};
|
|
32
47
|
Alert = __decorate([
|
|
33
48
|
observer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularsystems/neo-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
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.4",
|
|
35
35
|
"@types/rc-slider": "^8.6.5",
|
|
36
36
|
"@types/react-color": "^3.0.1",
|
|
37
37
|
"axios": "1.6.7",
|
package/styles/Misc.scss
CHANGED
|
@@ -141,4 +141,17 @@ div.tabs-header {
|
|
|
141
141
|
.neo-file-progress-container {
|
|
142
142
|
font-size: 0.9rem;
|
|
143
143
|
margin-top: 0.5rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.alert.alert-left-icon {
|
|
147
|
+
>div {
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: flex-start;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.notification-icon-container {
|
|
153
|
+
position: relative;
|
|
154
|
+
left: -0.5rem;
|
|
155
|
+
font-size: 1.5rem;
|
|
156
|
+
}
|
|
144
157
|
}
|