superdesk-ui-framework 3.0.35 → 3.0.38
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/app/styles/_sd-tag-input.scss +3 -5
- package/app/styles/_tag-labels.scss +0 -2
- package/app/styles/app.scss +1 -0
- package/app/styles/form-elements/_checkbox.scss +3 -0
- package/app/styles/form-elements/_input-preview.scss +70 -0
- package/app/styles/form-elements/_inputs.scss +10 -14
- package/app/styles/primereact/_pr-tag-input.scss +1 -1
- package/app-typescript/components/DatePicker.tsx +101 -101
- package/app-typescript/components/DurationInput.tsx +76 -76
- package/app-typescript/components/Form/InputNew.tsx +1 -1
- package/app-typescript/components/Form/InputWrapper.tsx +34 -18
- package/app-typescript/components/Input.tsx +38 -62
- package/app-typescript/components/MultiSelect.tsx +49 -47
- package/app-typescript/components/Select.tsx +13 -22
- package/app-typescript/components/SelectPreview.tsx +100 -0
- package/app-typescript/components/SelectWithTemplate.tsx +2 -12
- package/app-typescript/components/TagInput.tsx +25 -24
- package/app-typescript/components/TimePicker.tsx +13 -16
- package/app-typescript/components/TreeSelect.tsx +218 -158
- package/dist/examples.bundle.js +2400 -2258
- package/dist/react/Autocomplete.tsx +32 -31
- package/dist/react/DatePicker.tsx +56 -73
- package/dist/react/DurationInput.tsx +36 -47
- package/dist/react/Inputs.tsx +86 -248
- package/dist/react/MultiSelect.tsx +30 -23
- package/dist/react/Selects.tsx +12 -44
- package/dist/react/TagInputDocs.tsx +15 -21
- package/dist/react/TimePicker.tsx +25 -32
- package/dist/react/TreeSelect.tsx +97 -90
- package/dist/superdesk-ui.bundle.css +85 -18
- package/dist/superdesk-ui.bundle.js +1973 -1816
- package/dist/vendor.bundle.js +14 -14
- package/examples/pages/react/Autocomplete.tsx +32 -31
- package/examples/pages/react/DatePicker.tsx +56 -73
- package/examples/pages/react/DurationInput.tsx +36 -47
- package/examples/pages/react/Inputs.tsx +86 -248
- package/examples/pages/react/MultiSelect.tsx +30 -23
- package/examples/pages/react/Selects.tsx +12 -44
- package/examples/pages/react/TagInputDocs.tsx +15 -21
- package/examples/pages/react/TimePicker.tsx +25 -32
- package/examples/pages/react/TreeSelect.tsx +97 -90
- package/package.json +1 -1
- package/react/components/DatePicker.d.ts +2 -12
- package/react/components/DatePicker.js +14 -8
- package/react/components/DurationInput.d.ts +2 -11
- package/react/components/DurationInput.js +14 -4
- package/react/components/Form/InputNew.d.ts +1 -1
- package/react/components/Form/InputWrapper.d.ts +11 -5
- package/react/components/Form/InputWrapper.js +6 -9
- package/react/components/Input.d.ts +3 -19
- package/react/components/Input.js +8 -21
- package/react/components/MultiSelect.d.ts +4 -13
- package/react/components/MultiSelect.js +6 -2
- package/react/components/Select.d.ts +3 -15
- package/react/components/Select.js +7 -8
- package/react/components/SelectPreview.d.ts +17 -0
- package/react/components/SelectPreview.js +109 -0
- package/react/components/SelectWithTemplate.d.ts +2 -11
- package/react/components/SelectWithTemplate.js +0 -1
- package/react/components/TagInput.d.ts +3 -12
- package/react/components/TagInput.js +6 -2
- package/react/components/TimePicker.d.ts +2 -11
- package/react/components/TimePicker.js +6 -2
- package/react/components/TreeSelect.d.ts +5 -11
- package/react/components/TreeSelect.js +78 -47
@@ -1,18 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
|
3
|
-
|
2
|
+
import { IInputCommon } from './Form/InputWrapper';
|
3
|
+
interface IPropsBase extends IInputCommon {
|
4
4
|
maxLength?: number;
|
5
|
-
info?: string;
|
6
|
-
error?: string;
|
7
|
-
required?: boolean;
|
8
|
-
disabled?: boolean;
|
9
|
-
invalid?: boolean;
|
10
|
-
inlineLabel?: boolean;
|
11
|
-
labelHidden?: boolean;
|
12
|
-
tabindex?: number;
|
13
|
-
fullWidth?: boolean;
|
14
|
-
boxedStyle?: boolean;
|
15
|
-
boxedLable?: boolean;
|
16
5
|
placeholder?: string;
|
17
6
|
size?: 'medium' | 'large' | 'x-large';
|
18
7
|
}
|
@@ -32,15 +21,10 @@ interface IPropsNumber extends IPropsBase {
|
|
32
21
|
onChange(newValue: number): void;
|
33
22
|
}
|
34
23
|
type IProps = IPropsText | IPropsNumber | IPropsPassword;
|
35
|
-
|
36
|
-
value: string | number;
|
37
|
-
invalid: boolean;
|
38
|
-
}
|
39
|
-
export declare class Input extends React.Component<IProps, IState> {
|
24
|
+
export declare class Input extends React.Component<IProps> {
|
40
25
|
constructor(props: IProps);
|
41
26
|
htmlId: string;
|
42
27
|
handleChange(event: React.ChangeEvent<HTMLInputElement>): void;
|
43
|
-
componentDidUpdate(prevProps: any): void;
|
44
28
|
render(): JSX.Element;
|
45
29
|
}
|
46
30
|
export {};
|
@@ -43,45 +43,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
44
44
|
exports.Input = void 0;
|
45
45
|
var React = __importStar(require("react"));
|
46
|
-
// import classNames from 'classnames';
|
47
46
|
var react_id_generator_1 = __importDefault(require("react-id-generator"));
|
48
|
-
var
|
47
|
+
var InputWrapper_1 = require("./Form/InputWrapper");
|
49
48
|
var Input = /** @class */ (function (_super) {
|
50
49
|
__extends(Input, _super);
|
51
50
|
function Input(props) {
|
52
|
-
var _this = this;
|
53
|
-
var _a, _b;
|
54
|
-
_this = _super.call(this, props) || this;
|
51
|
+
var _this = _super.call(this, props) || this;
|
55
52
|
_this.htmlId = (0, react_id_generator_1.default)();
|
56
|
-
_this.state = {
|
57
|
-
value: (_a = _this.props.value) !== null && _a !== void 0 ? _a : '',
|
58
|
-
invalid: (_b = _this.props.invalid) !== null && _b !== void 0 ? _b : false,
|
59
|
-
};
|
60
53
|
_this.handleChange = _this.handleChange.bind(_this);
|
61
54
|
return _this;
|
62
55
|
}
|
63
56
|
Input.prototype.handleChange = function (event) {
|
64
|
-
this.setState({ value: event.target.value });
|
65
57
|
if (this.props.type === 'number') {
|
66
58
|
this.props.onChange(Number(event.target.value));
|
67
59
|
}
|
68
60
|
else {
|
69
61
|
this.props.onChange(event.target.value);
|
70
62
|
}
|
71
|
-
if (this.props.maxLength && !this.props.invalid) {
|
72
|
-
this.setState({ invalid: event.target.value.length > this.props.maxLength });
|
73
|
-
}
|
74
|
-
};
|
75
|
-
Input.prototype.componentDidUpdate = function (prevProps) {
|
76
|
-
var _a;
|
77
|
-
if (prevProps.value !== this.props.value) {
|
78
|
-
this.setState({ value: (_a = this.props.value) !== null && _a !== void 0 ? _a : '' });
|
79
|
-
}
|
80
63
|
};
|
81
64
|
Input.prototype.render = function () {
|
82
65
|
var _a, _b;
|
83
|
-
|
84
|
-
React.createElement("
|
66
|
+
if (this.props.preview) {
|
67
|
+
return (React.createElement("div", null,
|
68
|
+
React.createElement("span", null, this.props.value)));
|
69
|
+
}
|
70
|
+
return (React.createElement(InputWrapper_1.InputWrapper, { label: this.props.label, required: this.props.required, disabled: this.props.disabled, value: this.props.value, invalid: this.props.error != null ? true : false, error: this.props.error, info: this.props.info, maxLength: this.props.maxLength, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, size: (_a = this.props.size) !== null && _a !== void 0 ? _a : 'medium', fullWidth: this.props.fullWidth, htmlId: this.htmlId, boxedStyle: this.props.boxedStyle, boxedLable: this.props.boxedLable, tabindex: this.props.tabindex },
|
71
|
+
React.createElement("input", { className: 'sd-input__input', type: (_b = this.props.type) !== null && _b !== void 0 ? _b : 'text', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId + 'label', tabIndex: this.props.tabindex, onChange: this.handleChange, placeholder: this.props.placeholder, disabled: this.props.disabled })));
|
85
72
|
};
|
86
73
|
return Input;
|
87
74
|
}(React.Component));
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import * as React from "react";
|
2
|
-
|
2
|
+
import { IInputWrapper } from './Form/InputWrapper';
|
3
|
+
interface IProps<T> extends IInputWrapper {
|
3
4
|
value: Array<T>;
|
4
5
|
options: Array<T>;
|
5
6
|
placeholder?: string;
|
@@ -14,19 +15,9 @@ interface IProps<T> {
|
|
14
15
|
showSelectAll?: boolean;
|
15
16
|
zIndex?: number;
|
16
17
|
optionLabel: (option: T) => string;
|
17
|
-
itemTemplate?(item:
|
18
|
-
selectedItemTemplate?(value:
|
18
|
+
itemTemplate?(item: T): JSX.Element | undefined;
|
19
|
+
selectedItemTemplate?(value: T): JSX.Element | undefined;
|
19
20
|
onChange(newValue: Array<T>): void;
|
20
|
-
invalid?: boolean;
|
21
|
-
inlineLabel?: boolean;
|
22
|
-
labelHidden?: boolean;
|
23
|
-
tabindex?: number;
|
24
|
-
fullWidth?: boolean;
|
25
|
-
info?: string;
|
26
|
-
error?: string;
|
27
|
-
required?: boolean;
|
28
|
-
label?: string;
|
29
|
-
disabled?: boolean;
|
30
21
|
}
|
31
22
|
interface IState<T> {
|
32
23
|
options: Array<T>;
|
@@ -47,13 +47,14 @@ var multiselect_1 = require("@superdesk/primereact/multiselect");
|
|
47
47
|
var classnames_1 = __importDefault(require("classnames"));
|
48
48
|
var react_id_generator_1 = __importDefault(require("react-id-generator"));
|
49
49
|
var Form_1 = require("./Form");
|
50
|
+
var SelectPreview_1 = require("./SelectPreview");
|
50
51
|
var MultiSelect = /** @class */ (function (_super) {
|
51
52
|
__extends(MultiSelect, _super);
|
52
53
|
function MultiSelect(props) {
|
53
54
|
var _this = _super.call(this, props) || this;
|
54
55
|
_this.htmlId = (0, react_id_generator_1.default)();
|
55
56
|
_this.state = {
|
56
|
-
value: [],
|
57
|
+
value: _this.props.value != null ? _this.props.value : [],
|
57
58
|
options: [],
|
58
59
|
invalid: _this.props.invalid ? _this.props.invalid : false,
|
59
60
|
};
|
@@ -66,7 +67,10 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
66
67
|
'showSelectAll': this.props.showSelectAll,
|
67
68
|
'showFilter': this.props.filter,
|
68
69
|
});
|
69
|
-
|
70
|
+
if (this.props.preview) {
|
71
|
+
return (React.createElement(SelectPreview_1.SelectPreview, { kind: { mode: 'multi-select' }, items: this.state.value, valueTemplate: this.props.selectedItemTemplate, getLabel: this.props.optionLabel }));
|
72
|
+
}
|
73
|
+
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
70
74
|
React.createElement(multiselect_1.MultiSelect, { panelClassName: classes, value: this.props.value, options: this.props.options, onChange: function (_a) {
|
71
75
|
var value = _a.value;
|
72
76
|
return _this.props.onChange(value);
|
@@ -1,22 +1,10 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
|
2
|
+
import { IInputWrapper } from './Form/InputWrapper';
|
3
|
+
interface ISelect extends IInputWrapper {
|
3
4
|
value?: string;
|
4
|
-
label: string;
|
5
|
-
info?: string;
|
6
|
-
error?: string;
|
7
|
-
required?: boolean;
|
8
|
-
disabled?: boolean;
|
9
|
-
invalid?: boolean;
|
10
|
-
inlineLabel?: boolean;
|
11
|
-
labelHidden?: boolean;
|
12
|
-
tabindex?: number;
|
13
|
-
fullWidth?: boolean;
|
14
5
|
onChange(newValue: string): void;
|
15
6
|
}
|
16
|
-
|
17
|
-
invalid: boolean;
|
18
|
-
}
|
19
|
-
declare class Select extends React.Component<ISelect, IState> {
|
7
|
+
declare class Select extends React.Component<ISelect> {
|
20
8
|
private htmlId;
|
21
9
|
constructor(props: ISelect);
|
22
10
|
handleChange(event: React.ChangeEvent<HTMLSelectElement>): void;
|
@@ -48,13 +48,8 @@ var Form_1 = require("./Form");
|
|
48
48
|
var Select = /** @class */ (function (_super) {
|
49
49
|
__extends(Select, _super);
|
50
50
|
function Select(props) {
|
51
|
-
var _this = this;
|
52
|
-
var _a;
|
53
|
-
_this = _super.call(this, props) || this;
|
51
|
+
var _this = _super.call(this, props) || this;
|
54
52
|
_this.htmlId = (0, react_id_generator_1.default)();
|
55
|
-
_this.state = {
|
56
|
-
invalid: (_a = _this.props.invalid) !== null && _a !== void 0 ? _a : false,
|
57
|
-
};
|
58
53
|
_this.handleChange = _this.handleChange.bind(_this);
|
59
54
|
return _this;
|
60
55
|
}
|
@@ -62,8 +57,12 @@ var Select = /** @class */ (function (_super) {
|
|
62
57
|
this.props.onChange(event.target.value);
|
63
58
|
};
|
64
59
|
Select.prototype.render = function () {
|
65
|
-
|
66
|
-
React.createElement("
|
60
|
+
if (this.props.preview) {
|
61
|
+
return (React.createElement("div", null,
|
62
|
+
React.createElement("span", null, this.props.value)));
|
63
|
+
}
|
64
|
+
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, readonly: this.props.readonly, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
65
|
+
React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.props.value, "aria-describedby": this.htmlId, tabIndex: this.props.tabindex, onChange: this.handleChange, disabled: this.props.disabled || this.props.readonly }, this.props.children)));
|
67
66
|
};
|
68
67
|
return Select;
|
69
68
|
}(React.Component));
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface IProps<T> {
|
3
|
+
items: Array<T>;
|
4
|
+
kind: {
|
5
|
+
mode: 'single-select';
|
6
|
+
getBorderColor?(item: T): string;
|
7
|
+
} | {
|
8
|
+
mode: 'multi-select';
|
9
|
+
getBackgroundColor?(item: T): string;
|
10
|
+
};
|
11
|
+
getLabel(item: T): string;
|
12
|
+
valueTemplate?(item: T, Wrapper?: React.ElementType): React.ComponentType<T> | JSX.Element | undefined;
|
13
|
+
}
|
14
|
+
export declare class SelectPreview<T> extends React.Component<IProps<T>> {
|
15
|
+
render(): JSX.Element;
|
16
|
+
}
|
17
|
+
export {};
|
@@ -0,0 +1,109 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
18
|
+
if (k2 === undefined) k2 = k;
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
22
|
+
}
|
23
|
+
Object.defineProperty(o, k2, desc);
|
24
|
+
}) : (function(o, m, k, k2) {
|
25
|
+
if (k2 === undefined) k2 = k;
|
26
|
+
o[k2] = m[k];
|
27
|
+
}));
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
30
|
+
}) : function(o, v) {
|
31
|
+
o["default"] = v;
|
32
|
+
});
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
34
|
+
if (mod && mod.__esModule) return mod;
|
35
|
+
var result = {};
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
37
|
+
__setModuleDefault(result, mod);
|
38
|
+
return result;
|
39
|
+
};
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
42
|
+
};
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
44
|
+
exports.SelectPreview = void 0;
|
45
|
+
var classnames_1 = __importDefault(require("classnames"));
|
46
|
+
var React = __importStar(require("react"));
|
47
|
+
var Label_1 = require("./Label");
|
48
|
+
var SelectPreview = /** @class */ (function (_super) {
|
49
|
+
__extends(SelectPreview, _super);
|
50
|
+
function SelectPreview() {
|
51
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
52
|
+
}
|
53
|
+
SelectPreview.prototype.render = function () {
|
54
|
+
var _this = this;
|
55
|
+
return (React.createElement("div", { className: "tags-preview" },
|
56
|
+
React.createElement("ul", { className: "tags-preview__tag-list" }, this.props.items.map(function (item, i) {
|
57
|
+
var Wrapper = function (_a) {
|
58
|
+
var backgroundColor = _a.backgroundColor, borderColor = _a.borderColor, children = _a.children;
|
59
|
+
var classes = (0, classnames_1.default)('tags-preview__tag-item', {
|
60
|
+
'tags-preview__tag-item--single-select': _this.props.kind.mode === 'single-select',
|
61
|
+
'tags-preview__tag-item--border': (_this.props.kind.mode === 'single-select' && _this.props.kind.getBorderColor)
|
62
|
+
|| borderColor,
|
63
|
+
});
|
64
|
+
return (React.createElement("li", { className: classes, style: (function () {
|
65
|
+
if (_this.props.valueTemplate != null) {
|
66
|
+
return { backgroundColor: backgroundColor, borderColor: borderColor };
|
67
|
+
}
|
68
|
+
else {
|
69
|
+
if (_this.props.kind.mode === 'multi-select'
|
70
|
+
&& _this.props.kind.getBackgroundColor != null) {
|
71
|
+
return {
|
72
|
+
backgroundColor: _this.props.kind.getBackgroundColor(item),
|
73
|
+
};
|
74
|
+
}
|
75
|
+
else if (_this.props.kind.mode === 'single-select'
|
76
|
+
&& _this.props.kind.getBorderColor != null) {
|
77
|
+
return {
|
78
|
+
borderLeftColor: _this.props.kind.getBorderColor(item),
|
79
|
+
};
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
return undefined;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
})() },
|
86
|
+
React.createElement("span", { className: "tags-input__helper-box", style: (function () {
|
87
|
+
if (backgroundColor != null) {
|
88
|
+
return { color: (0, Label_1.getTextColor)(backgroundColor) };
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
if (_this.props.kind.mode === 'multi-select'
|
92
|
+
&& _this.props.kind.getBackgroundColor != null) {
|
93
|
+
return { color: (0, Label_1.getTextColor)(_this.props.kind.getBackgroundColor(item)) };
|
94
|
+
}
|
95
|
+
else {
|
96
|
+
return undefined;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
})() }, children)));
|
100
|
+
};
|
101
|
+
return (React.createElement(React.Fragment, { key: i }, _this.props.valueTemplate
|
102
|
+
? _this.props.valueTemplate(item, Wrapper)
|
103
|
+
: React.createElement(Wrapper, null,
|
104
|
+
React.createElement("span", null, _this.props.getLabel(item)))));
|
105
|
+
}))));
|
106
|
+
};
|
107
|
+
return SelectPreview;
|
108
|
+
}(React.Component));
|
109
|
+
exports.SelectPreview = SelectPreview;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { Dropdown } from '@superdesk/primereact/dropdown';
|
3
|
-
|
3
|
+
import { IInputWrapper } from './Form/InputWrapper';
|
4
|
+
interface IProps<T> extends IInputWrapper {
|
4
5
|
getItems(searchString: string | null): Promise<Array<T>>;
|
5
6
|
value: T;
|
6
7
|
getLabel(option: T): string;
|
@@ -11,21 +12,11 @@ interface IProps<T> {
|
|
11
12
|
}>;
|
12
13
|
noResultsFoundMessage: string;
|
13
14
|
filterPlaceholder?: string;
|
14
|
-
disabled?: boolean;
|
15
15
|
autoFocus?: boolean;
|
16
16
|
autoOpen?: boolean;
|
17
17
|
width?: 'min' | '100%';
|
18
18
|
zIndex?: number;
|
19
19
|
'data-test-id'?: string;
|
20
|
-
inlineLabel?: boolean;
|
21
|
-
required?: boolean;
|
22
|
-
fullWidth?: boolean;
|
23
|
-
invalid?: boolean;
|
24
|
-
labelHidden?: boolean;
|
25
|
-
tabindex?: number;
|
26
|
-
label?: string;
|
27
|
-
info?: string;
|
28
|
-
error?: string;
|
29
20
|
}
|
30
21
|
interface IState<T> {
|
31
22
|
options: Array<T>;
|
@@ -44,7 +44,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
44
|
exports.SelectWithTemplate = void 0;
|
45
45
|
var React = __importStar(require("react"));
|
46
46
|
var dropdown_1 = require("@superdesk/primereact/dropdown");
|
47
|
-
// import classNames from 'classnames';
|
48
47
|
var react_id_generator_1 = __importDefault(require("react-id-generator"));
|
49
48
|
var Form_1 = require("./Form");
|
50
49
|
var labelKey = 'label';
|
@@ -1,18 +1,9 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
|
2
|
+
import { IInputWrapper } from './Form/InputWrapper';
|
3
|
+
interface IProps extends IInputWrapper {
|
3
4
|
value: Array<string>;
|
4
5
|
onChange(value: Array<string>): void;
|
5
|
-
placeholder
|
6
|
-
invalid?: boolean;
|
7
|
-
inlineLabel?: boolean;
|
8
|
-
labelHidden?: boolean;
|
9
|
-
tabindex?: number;
|
10
|
-
fullWidth?: boolean;
|
11
|
-
info?: string;
|
12
|
-
error?: string;
|
13
|
-
required?: boolean;
|
14
|
-
label?: string;
|
15
|
-
disabled?: boolean;
|
6
|
+
placeholder?: string;
|
16
7
|
}
|
17
8
|
export declare class TagInput extends React.Component<IProps> {
|
18
9
|
private htmlId;
|
@@ -46,6 +46,7 @@ var React = __importStar(require("react"));
|
|
46
46
|
var chips_1 = require("@superdesk/primereact/chips");
|
47
47
|
var Form_1 = require("./Form");
|
48
48
|
var react_id_generator_1 = __importDefault(require("react-id-generator"));
|
49
|
+
var SelectPreview_1 = require("./SelectPreview");
|
49
50
|
var TagInput = /** @class */ (function (_super) {
|
50
51
|
__extends(TagInput, _super);
|
51
52
|
function TagInput() {
|
@@ -55,8 +56,11 @@ var TagInput = /** @class */ (function (_super) {
|
|
55
56
|
}
|
56
57
|
TagInput.prototype.render = function () {
|
57
58
|
var _a = this.props, onChange = _a.onChange, value = _a.value, placeholder = _a.placeholder;
|
58
|
-
|
59
|
-
React.createElement(
|
59
|
+
if (this.props.preview) {
|
60
|
+
return (React.createElement(SelectPreview_1.SelectPreview, { kind: { mode: 'multi-select' }, items: this.props.value, getLabel: function (item) { return item; } }));
|
61
|
+
}
|
62
|
+
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
63
|
+
React.createElement(chips_1.Chips, { className: "tags-input--multi-select sd-input__input ".concat(this.props.disabled ? ' tags-input__padding-disabled' : ''), allowDuplicate: false, separator: ",", onChange: function (event) { return onChange(event.value); }, value: value, placeholder: this.props.disabled ? undefined : placeholder, disabled: this.props.disabled })));
|
60
64
|
};
|
61
65
|
return TagInput;
|
62
66
|
}(React.Component));
|
@@ -1,18 +1,9 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
|
2
|
+
import { IInputWrapper } from './Form/InputWrapper';
|
3
|
+
interface IProps extends IInputWrapper {
|
3
4
|
value: string;
|
4
5
|
onChange(valueNext: string): void;
|
5
6
|
allowSeconds?: boolean;
|
6
|
-
disabled?: boolean;
|
7
|
-
inlineLabel?: boolean;
|
8
|
-
required?: boolean;
|
9
|
-
fullWidth?: boolean;
|
10
|
-
invalid?: boolean;
|
11
|
-
labelHidden?: boolean;
|
12
|
-
tabindex?: number;
|
13
|
-
label?: string;
|
14
|
-
info?: string;
|
15
|
-
error?: string;
|
16
7
|
}
|
17
8
|
export declare class TimePicker extends React.PureComponent<IProps> {
|
18
9
|
private htmlId;
|
@@ -54,8 +54,12 @@ var TimePicker = /** @class */ (function (_super) {
|
|
54
54
|
}
|
55
55
|
TimePicker.prototype.render = function () {
|
56
56
|
var _this = this;
|
57
|
-
|
58
|
-
React.createElement("
|
57
|
+
if (this.props.preview) {
|
58
|
+
return (React.createElement("div", null,
|
59
|
+
React.createElement("span", null, this.props.value)));
|
60
|
+
}
|
61
|
+
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
62
|
+
React.createElement("input", { value: this.props.value, type: "time", className: "sd-input__input", id: this.htmlId, "aria-labelledby": this.htmlId + 'label', step: this.props.allowSeconds ? 1 : undefined, required: this.props.required, disabled: this.props.disabled, onChange: function (event) {
|
59
63
|
_this.props.onChange(event.target.value);
|
60
64
|
} })));
|
61
65
|
};
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import * as React from "react";
|
2
|
+
import { IInputWrapper } from './Form/InputWrapper';
|
2
3
|
interface IState<T> {
|
3
4
|
value: Array<T>;
|
4
5
|
options: Array<ITreeNode<T>>;
|
@@ -13,7 +14,7 @@ interface IState<T> {
|
|
13
14
|
loading: boolean;
|
14
15
|
buttonTarget: Array<string>;
|
15
16
|
}
|
16
|
-
interface IPropsBase<T> {
|
17
|
+
interface IPropsBase<T> extends IInputWrapper {
|
17
18
|
value?: Array<T>;
|
18
19
|
selectBranchWithChildren?: boolean;
|
19
20
|
readOnly?: boolean;
|
@@ -23,16 +24,6 @@ interface IPropsBase<T> {
|
|
23
24
|
singleLevelSearch?: boolean;
|
24
25
|
placeholder?: string;
|
25
26
|
searchPlaceholder?: string;
|
26
|
-
invalid?: boolean;
|
27
|
-
inlineLabel?: boolean;
|
28
|
-
labelHidden?: boolean;
|
29
|
-
tabindex?: number;
|
30
|
-
fullWidth?: boolean;
|
31
|
-
info?: string;
|
32
|
-
error?: string;
|
33
|
-
required?: boolean;
|
34
|
-
label?: string;
|
35
|
-
disabled?: boolean;
|
36
27
|
zIndex?: number;
|
37
28
|
getLabel(item: T): string;
|
38
29
|
getId(item: T): string;
|
@@ -69,7 +60,10 @@ export declare class TreeSelect<T> extends React.Component<IProps<T>, IState<T>>
|
|
69
60
|
inputFocus: () => void;
|
70
61
|
listNavigation: () => void;
|
71
62
|
buttonFocus: () => void;
|
63
|
+
onMouseDown: (event: MouseEvent) => void;
|
64
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
72
65
|
componentDidMount: () => void;
|
66
|
+
componentWillUnmount(): void;
|
73
67
|
componentDidUpdate(prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void;
|
74
68
|
toggleMenu(): void;
|
75
69
|
removeClick(i: number): void;
|