@michalrakus/x-react-web-lib 1.24.1 → 1.25.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.
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
2
  import { XFormComponentProps } from "./XFormComponent";
3
3
  import { XInput } from "./XInput";
4
+ import { XDateScale } from "../serverApi/XUtilsConversions";
4
5
  export interface XInputDateProps extends XFormComponentProps<number> {
5
6
  field: string;
7
+ scale?: XDateScale;
6
8
  }
7
9
  export declare class XInputDate extends XInput<Date, XInputDateProps> {
8
10
  constructor(props: XInputDateProps);
@@ -39,10 +39,11 @@ var XInputDate = /** @class */ (function (_super) {
39
39
  this.onValueChangeBase(value, this.props.onChange);
40
40
  };
41
41
  XInputDate.prototype.render = function () {
42
+ var _a;
42
43
  // note: style overrides size (width of the input according to character count)
43
44
  return (react_1.default.createElement("div", { className: "field grid" },
44
45
  react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
45
- react_1.default.createElement(XCalendar_1.XCalendar, { id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), error: this.getError(), scale: this.xField.scale, datetime: this.xField.type === 'datetime' })));
46
+ react_1.default.createElement(XCalendar_1.XCalendar, { id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), error: this.getError(), scale: (_a = this.props.scale) !== null && _a !== void 0 ? _a : this.xField.scale, datetime: this.xField.type === 'datetime' })));
46
47
  };
47
48
  return XInputDate;
48
49
  }(XInput_1.XInput));
@@ -60,21 +60,30 @@ var XInputText = /** @class */ (function (_super) {
60
60
  };
61
61
  XInputText.prototype.render = function () {
62
62
  var _a, _b;
63
+ var label = this.getLabel();
63
64
  var value = this.getValue();
64
65
  var labelTooltip = undefined;
65
66
  var labelElemId = undefined;
67
+ var inputTooltip = this.props.tooltip;
66
68
  if (value) {
67
- // nevidno placeholder, tak zobrazime desc ako label tooltip
68
- labelTooltip = this.props.desc;
69
- labelElemId = "".concat(this.props.field, "_label_id");
69
+ // nevidno placeholder, tak zobrazime desc ako label tooltip (ak mam label)
70
+ if (label !== undefined) {
71
+ labelTooltip = this.props.desc;
72
+ labelElemId = "".concat(this.props.field, "_label_id");
73
+ }
74
+ else {
75
+ // nemame label, dame pripadny desc ako tooltip na input
76
+ if (inputTooltip === undefined) {
77
+ inputTooltip = this.props.desc;
78
+ }
79
+ }
70
80
  }
71
81
  var size = (_a = this.props.size) !== null && _a !== void 0 ? _a : this.xField.length;
72
82
  // note: style overrides size (width of the input according to character count)
73
- var label = this.getLabel();
74
83
  return (react_1.default.createElement("div", { className: "field grid" },
75
84
  label !== undefined ? react_1.default.createElement("label", { id: labelElemId, htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, label) : null,
76
85
  labelTooltip ? react_1.default.createElement(tooltip_1.Tooltip, { target: "#".concat(labelElemId), content: labelTooltip }) : null,
77
- react_1.default.createElement(inputtext_1.InputText, __assign({ id: this.props.field, value: value, onChange: this.onValueChange, onBlur: this.onBlur, readOnly: this.isReadOnly(), maxLength: this.xField.length, size: size, style: this.props.inputStyle }, XUtils_1.XUtils.createTooltipOrErrorProps(this.getError(), this.props.tooltip), { placeholder: (_b = this.props.placeholder) !== null && _b !== void 0 ? _b : this.props.desc }))));
86
+ react_1.default.createElement(inputtext_1.InputText, __assign({ id: this.props.field, value: value, onChange: this.onValueChange, onBlur: this.onBlur, readOnly: this.isReadOnly(), maxLength: this.xField.length, size: size, style: this.props.inputStyle }, XUtils_1.XUtils.createTooltipOrErrorProps(this.getError(), inputTooltip), { placeholder: (_b = this.props.placeholder) !== null && _b !== void 0 ? _b : this.props.desc }))));
78
87
  };
79
88
  return XInputText;
80
89
  }(XInput_1.XInput));
@@ -5,6 +5,7 @@ export interface XInputTextareaProps extends XInputProps<string> {
5
5
  cols?: number | "full";
6
6
  labelOnTop?: boolean;
7
7
  autoResize?: boolean;
8
+ fieldStyle?: React.CSSProperties;
8
9
  }
9
10
  export declare class XInputTextarea extends XInput<string, XInputTextareaProps> {
10
11
  static defaultProps: {
@@ -43,7 +43,7 @@ var XInputTextarea = /** @class */ (function (_super) {
43
43
  };
44
44
  XInputTextarea.prototype.render = function () {
45
45
  var _a, _b;
46
- var fieldStyle = undefined;
46
+ var fieldStyle = this.props.fieldStyle;
47
47
  var labelStyle = this.getLabelStyle();
48
48
  var inputStyle = (_a = this.props.inputStyle) !== null && _a !== void 0 ? _a : {};
49
49
  var cols;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michalrakus/x-react-web-lib",
3
- "version": "1.24.1",
3
+ "version": "1.25.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "clean": "rimraf lib",