@try-at-software/input-elements 1.2.0-alpha.29 → 1.2.0-alpha.33

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.
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ interface IClearButtonProps {
3
+ className?: string;
4
+ isDisabled?: boolean;
5
+ onClick: () => void;
6
+ }
7
+ export declare class ClearButton extends React.Component<IClearButtonProps> {
8
+ render(): JSX.Element;
9
+ }
10
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClearButton = void 0;
4
+ const React = require("react");
5
+ const react_1 = require("@fluentui/react");
6
+ class ClearButton extends React.Component {
7
+ render() {
8
+ const { className, isDisabled, onClick } = this.props;
9
+ return React.createElement(react_1.DefaultButton, { className: className, disabled: isDisabled, iconProps: { iconName: 'Clear' }, onClick: onClick });
10
+ }
11
+ }
12
+ exports.ClearButton = ClearButton;
@@ -0,0 +1 @@
1
+ export * from './ClearButton';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./ClearButton"), exports);
@@ -0,0 +1 @@
1
+ export * from './Buttons';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Buttons"), exports);
@@ -80,7 +80,7 @@ class SingleValueInputElement extends ExtendedInputElement_1.ExtendedInputElemen
80
80
  get isValid() {
81
81
  if (this._isInvalidated)
82
82
  return false;
83
- if (this.isLoading || !this.isVisible)
83
+ if (this.isLoading)
84
84
  return false;
85
85
  if (this.errorMessage && this.errorMessage.length > 0)
86
86
  return false;
@@ -1,5 +1,7 @@
1
1
  import { IBaseInputElementProps } from '../IBaseInputElementProps';
2
2
  export interface ITimePickerProps extends IBaseInputElementProps {
3
+ inputClassName?: string;
4
+ clearButtonClassName?: string;
3
5
  formatDate?: (date: Date) => string;
4
6
  showGoToToday?: boolean;
5
7
  showMonthPicker?: boolean;
@@ -5,4 +5,5 @@ import { ITimePickerProps } from './ITimePickerProps';
5
5
  export declare class TimePicker extends React.Component<ISingleValueInputElementProps<Date> & ITimePickerProps & IBaseInputElementDynamicProps> {
6
6
  render(): JSX.Element;
7
7
  private onChange;
8
+ private clearDate;
8
9
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimePicker = void 0;
4
4
  const React = require("react");
5
5
  const react_1 = require("@fluentui/react");
6
+ const ClearButton_1 = require("../../Components/Buttons/ClearButton");
6
7
  class TimePicker extends React.Component {
7
8
  constructor() {
8
9
  super(...arguments);
@@ -10,6 +11,9 @@ class TimePicker extends React.Component {
10
11
  var _a;
11
12
  (_a = this.props) === null || _a === void 0 ? void 0 : _a.onChange(newValue);
12
13
  };
14
+ this.clearDate = () => {
15
+ this.onChange(null);
16
+ };
13
17
  }
14
18
  render() {
15
19
  var _a;
@@ -18,6 +22,8 @@ class TimePicker extends React.Component {
18
22
  return (React.createElement(React.Fragment, null,
19
23
  !!((_a = this.props) === null || _a === void 0 ? void 0 : _a.label) && React.createElement(react_1.Label, { required: !!this.props.renderRequiredIndicator }, this.props.label),
20
24
  React.createElement(react_1.DatePicker, { "data-automationid": "time-input", placeholder: this.props.placeholder, onSelectDate: this.onChange, textField: {
25
+ onRenderSuffix: () => (React.createElement(ClearButton_1.ClearButton, { onClick: this.clearDate, className: this.props.clearButtonClassName })),
26
+ inputClassName: this.props.inputClassName,
21
27
  errorMessage: this.props.errorMessage,
22
28
  disabled: this.props.isDisabled
23
29
  }, showGoToToday: !!this.props.showGoToToday, formatDate: this.props.formatDate, firstDayOfWeek: this.props.startWeekOnSunday ? react_1.DayOfWeek.Sunday : react_1.DayOfWeek.Monday, isMonthPickerVisible: !!this.props.showMonthPicker, highlightSelectedMonth: !!this.props.showMonthPicker, value: this.props.value })));
@@ -53,6 +53,7 @@ DropdownHelper.toNormalizedDropdownOption = (inputOption) => {
53
53
  return {
54
54
  text: inputOption.text,
55
55
  key: inputOption.key,
56
- itemType: itemType
56
+ itemType: itemType,
57
+ disabled: !!inputOption.disabled
57
58
  };
58
59
  };
@@ -8,8 +8,14 @@ function getFormState(inputs) {
8
8
  let hasChanges = false;
9
9
  let index = 0;
10
10
  while ((isValid || !hasChanges) && index < inputs.length) {
11
- isValid = isValid && inputs[index].isValid;
12
- hasChanges = hasChanges || inputs[index].hasChanges;
11
+ const currentInput = inputs[index];
12
+ if (!currentInput) {
13
+ isValid = false;
14
+ }
15
+ else {
16
+ isValid = isValid && currentInput.isValid;
17
+ hasChanges = hasChanges || currentInput.hasChanges;
18
+ }
13
19
  index++;
14
20
  }
15
21
  return {
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './Components';
1
2
  export * from './ExtendedInputElement';
2
3
  export * from './IChangingInputElement';
3
4
  export * from './IHidingInputElement';
package/lib/index.js CHANGED
@@ -10,6 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Components"), exports);
13
14
  __exportStar(require("./ExtendedInputElement"), exports);
14
15
  __exportStar(require("./IChangingInputElement"), exports);
15
16
  __exportStar(require("./IHidingInputElement"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@try-at-software/input-elements",
3
- "version": "1.2.0-alpha.29",
3
+ "version": "1.2.0-alpha.33",
4
4
  "description": "A package providing different input elements that are extensible and easily configurable for your custom needs.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",