superdesk-ui-framework 3.0.1-beta.8 → 3.0.1
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/fonts/sd_icons.eot +0 -0
- package/app/fonts/sd_icons.svg +1 -0
- package/app/fonts/sd_icons.ttf +0 -0
- package/app/fonts/sd_icons.woff +0 -0
- package/app/scripts/toggleBoxNext.js +1 -1
- package/app/styles/_big-icon-font.scss +1 -1
- package/app/styles/_buttons.scss +11 -6
- package/app/styles/_content-divider.scss +63 -8
- package/app/styles/_helpers.scss +24 -1
- package/app/styles/_icon-font.scss +11 -10
- package/app/styles/_labels.scss +0 -1
- package/app/styles/_master-desk.scss +5 -4
- package/app/styles/_modals.scss +7 -3
- package/app/styles/_normalize.scss +4 -0
- package/app/styles/_sd-tag-input.scss +56 -2
- package/app/styles/_simple-list.scss +0 -2
- package/app/styles/_table-list.scss +116 -12
- package/app/styles/app.scss +3 -0
- package/app/styles/components/_list-item.scss +23 -16
- package/app/styles/components/_sd-collapse-box.scss +6 -6
- package/app/styles/components/_sd-comment-box.scss +8 -4
- package/app/styles/components/_sd-editor-popup.scss +4 -4
- package/app/styles/components/_sd-media-carousel.scss +37 -2
- package/app/styles/components/_sd-pagination.scss +41 -0
- package/app/styles/components/_sd-photo-preview.scss +2 -2
- package/app/styles/components/_subnav.scss +470 -470
- package/app/styles/design-tokens/_new-colors.scss +29 -12
- package/app/styles/dropdowns/_basic-dropdown.scss +6 -0
- package/app/styles/form-elements/_input-wrap.scss +138 -0
- package/app/styles/form-elements/_inputs.scss +230 -61
- package/app/styles/grids/_grid-layout.scss +13 -14
- package/app/styles/interface-elements/_side-panel.scss +1 -1
- package/app/styles/layout/_editor.scss +6 -0
- package/app/styles/menus/_sd-sidebar-menu.scss +1 -1
- package/app/styles/primereact/_pr-datepicker.scss +16 -2
- package/app/styles/primereact/_pr-dialog.scss +9 -0
- package/app/styles/primereact/_pr-menu.scss +6 -5
- package/app/styles/variables/_colors.scss +47 -47
- package/app/template/search-handler.html +2 -2
- package/app-typescript/components/ContentDivider.tsx +3 -0
- package/app-typescript/components/DatePicker.tsx +8 -9
- package/app-typescript/components/Dropdown.tsx +127 -82
- package/app-typescript/components/DurationInput.tsx +39 -14
- package/app-typescript/components/Form/FormLabel.tsx +8 -1
- package/app-typescript/components/Form/InputBase.tsx +12 -2
- package/app-typescript/components/Input.tsx +4 -4
- package/app-typescript/components/Label.tsx +17 -1
- package/app-typescript/components/Layouts/AuthoringFrame.tsx +2 -1
- package/app-typescript/components/Layouts/AuthoringFrameRightBar.tsx +21 -2
- package/app-typescript/components/Layouts/AuthoringInnerHeader.tsx +1 -1
- package/app-typescript/components/Layouts/AuthoringMain.tsx +4 -2
- package/app-typescript/components/Layouts/CoreLayout.tsx +3 -1
- package/app-typescript/components/Layouts/CoreLayoutMain.tsx +10 -1
- package/app-typescript/components/Lists/ContentList.tsx +64 -30
- package/app-typescript/components/Lists/TableList.tsx +255 -53
- package/app-typescript/components/Menu.tsx +2 -2
- package/app-typescript/components/Modal.tsx +6 -2
- package/app-typescript/components/MultiSelect.tsx +1 -1
- package/app-typescript/components/NavButton.tsx +2 -1
- package/app-typescript/components/Navigation/SideBarMenu.tsx +30 -4
- package/app-typescript/components/SearchBar.tsx +11 -3
- package/app-typescript/components/Spacer.tsx +87 -0
- package/app-typescript/components/TimePicker.tsx +2 -13
- package/app-typescript/components/TreeSelect.tsx +286 -180
- package/app-typescript/index.ts +1 -0
- package/dist/examples.bundle.css +110 -71
- package/dist/examples.bundle.js +23848 -21661
- package/dist/playgrounds/react-playgrounds/CoreLayout.tsx +505 -2
- package/dist/playgrounds/react-playgrounds/Index.tsx +1 -0
- package/dist/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
- package/dist/playgrounds/react-playgrounds/RundownEditor.tsx +17 -19
- package/dist/playgrounds/react-playgrounds/Rundowns.tsx +22 -23
- package/dist/playgrounds/react-playgrounds/TestGround.tsx +226 -25
- package/dist/react/ContentDivider.tsx +22 -18
- package/dist/react/ContentList.tsx +188 -12
- package/dist/react/DatePicker.tsx +50 -2
- package/dist/react/Dropdowns.tsx +580 -48
- package/dist/react/DurationInput.tsx +7 -3
- package/dist/react/Inputs.tsx +1 -7
- package/dist/react/Modal.tsx +154 -22
- package/dist/react/MultiSelect.tsx +5 -5
- package/dist/react/NavButtons.tsx +31 -1
- package/dist/react/TableList.tsx +52 -139
- package/dist/react/Togglebox.tsx +1 -1
- package/dist/react/TreeSelect.tsx +167 -176
- package/dist/sd_icons.eot +0 -0
- package/dist/sd_icons.svg +1 -0
- package/dist/sd_icons.ttf +0 -0
- package/dist/sd_icons.woff +0 -0
- package/dist/superdesk-ui.bundle.css +1100 -407
- package/dist/superdesk-ui.bundle.js +6591 -4035
- package/dist/vendor.bundle.js +27 -27
- package/examples/css/docs-page.css +4 -4
- package/examples/index.js +4 -0
- package/examples/pages/playgrounds/react-playgrounds/CoreLayout.tsx +505 -2
- package/examples/pages/playgrounds/react-playgrounds/Index.tsx +1 -0
- package/examples/pages/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
- package/examples/pages/playgrounds/react-playgrounds/RundownEditor.tsx +17 -19
- package/examples/pages/playgrounds/react-playgrounds/Rundowns.tsx +22 -23
- package/examples/pages/playgrounds/react-playgrounds/TestGround.tsx +226 -25
- package/examples/pages/react/ContentDivider.tsx +22 -18
- package/examples/pages/react/ContentList.tsx +188 -12
- package/examples/pages/react/DatePicker.tsx +50 -2
- package/examples/pages/react/Dropdowns.tsx +580 -48
- package/examples/pages/react/DurationInput.tsx +7 -3
- package/examples/pages/react/Inputs.tsx +1 -7
- package/examples/pages/react/Modal.tsx +154 -22
- package/examples/pages/react/MultiSelect.tsx +5 -5
- package/examples/pages/react/NavButtons.tsx +31 -1
- package/examples/pages/react/TableList.tsx +52 -139
- package/examples/pages/react/Togglebox.tsx +1 -1
- package/examples/pages/react/TreeSelect.tsx +167 -176
- package/package.json +3 -5
- package/react/components/ContentDivider.d.ts +1 -0
- package/react/components/ContentDivider.js +2 -0
- package/react/components/DatePicker.d.ts +2 -2
- package/react/components/DatePicker.js +3 -3
- package/react/components/Dropdown.d.ts +6 -5
- package/react/components/Dropdown.js +57 -30
- package/react/components/DurationInput.d.ts +1 -1
- package/react/components/DurationInput.js +46 -17
- package/react/components/Form/FormLabel.d.ts +4 -1
- package/react/components/Form/FormLabel.js +9 -3
- package/react/components/Form/InputBase.d.ts +0 -1
- package/react/components/Form/InputBase.js +15 -1
- package/react/components/Input.d.ts +3 -3
- package/react/components/Input.js +2 -1
- package/react/components/Label.d.ts +1 -0
- package/react/components/Label.js +17 -2
- package/react/components/Layouts/AuthoringFrame.d.ts +1 -0
- package/react/components/Layouts/AuthoringFrame.js +1 -1
- package/react/components/Layouts/AuthoringFrameRightBar.d.ts +9 -2
- package/react/components/Layouts/AuthoringFrameRightBar.js +14 -3
- package/react/components/Layouts/AuthoringInnerHeader.js +1 -1
- package/react/components/Layouts/AuthoringMain.js +1 -1
- package/react/components/Layouts/CoreLayout.d.ts +2 -0
- package/react/components/Layouts/CoreLayout.js +1 -1
- package/react/components/Layouts/CoreLayoutMain.d.ts +2 -0
- package/react/components/Layouts/CoreLayoutMain.js +8 -1
- package/react/components/Lists/ContentList.d.ts +6 -0
- package/react/components/Lists/ContentList.js +42 -16
- package/react/components/Lists/TableList.d.ts +30 -8
- package/react/components/Lists/TableList.js +127 -24
- package/react/components/Menu.js +1 -1
- package/react/components/Modal.d.ts +2 -0
- package/react/components/Modal.js +3 -3
- package/react/components/MultiSelect.d.ts +40 -0
- package/react/components/MultiSelect.js +70 -0
- package/react/components/NavButton.d.ts +1 -1
- package/react/components/Navigation/SideBarMenu.d.ts +6 -0
- package/react/components/Navigation/SideBarMenu.js +19 -2
- package/react/components/SearchBar.d.ts +1 -1
- package/react/components/SearchBar.js +15 -7
- package/react/components/TimePicker.d.ts +1 -5
- package/react/components/TimePicker.js +3 -7
- package/react/components/TreeSelect.d.ts +12 -5
- package/react/components/TreeSelect.js +189 -116
- package/react/index.d.ts +1 -0
- package/react/index.js +3 -0
- package/patches/@superdesk+primereact+5.0.2-4.patch +0 -66
@@ -14,12 +14,8 @@ interface IProps {
|
|
14
14
|
info?: string;
|
15
15
|
error?: string;
|
16
16
|
}
|
17
|
-
|
18
|
-
invalid: boolean;
|
19
|
-
}
|
20
|
-
export declare class TimePicker extends React.PureComponent<IProps, IState> {
|
17
|
+
export declare class TimePicker extends React.PureComponent<IProps> {
|
21
18
|
private htmlId;
|
22
|
-
constructor(props: IProps);
|
23
19
|
render(): JSX.Element;
|
24
20
|
}
|
25
21
|
export {};
|
@@ -39,22 +39,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
40
40
|
exports.TimePicker = void 0;
|
41
41
|
var React = __importStar(require("react"));
|
42
|
-
// import classNames from 'classnames';
|
43
42
|
var react_id_generator_1 = __importDefault(require("react-id-generator"));
|
44
43
|
var Form_1 = require("./Form");
|
45
44
|
var TimePicker = /** @class */ (function (_super) {
|
46
45
|
__extends(TimePicker, _super);
|
47
|
-
function TimePicker(
|
48
|
-
var _this = _super.
|
46
|
+
function TimePicker() {
|
47
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
49
48
|
_this.htmlId = (0, react_id_generator_1.default)();
|
50
|
-
_this.state = {
|
51
|
-
invalid: _this.props.invalid ? _this.props.invalid : false,
|
52
|
-
};
|
53
49
|
return _this;
|
54
50
|
}
|
55
51
|
TimePicker.prototype.render = function () {
|
56
52
|
var _this = this;
|
57
|
-
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.
|
53
|
+
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.props.invalid, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
58
54
|
React.createElement("input", { id: this.htmlId, "aria-labelledby": this.htmlId + 'label', type: "time", step: this.props.allowSeconds ? 1 : undefined, className: "sd-input__input", value: this.props.value, required: this.props.required, disabled: this.props.disabled, onChange: function (event) {
|
59
55
|
_this.props.onChange(event.target.value);
|
60
56
|
} })));
|
@@ -11,7 +11,6 @@ interface IState<T> {
|
|
11
11
|
buttonValue: any;
|
12
12
|
buttonMouseEvent: boolean;
|
13
13
|
loading: boolean;
|
14
|
-
invalid: boolean;
|
15
14
|
}
|
16
15
|
interface IPropsBase<T> {
|
17
16
|
value?: Array<T>;
|
@@ -22,6 +21,7 @@ interface IPropsBase<T> {
|
|
22
21
|
loading?: boolean;
|
23
22
|
singleLevelSearch?: boolean;
|
24
23
|
placeholder?: string;
|
24
|
+
searchPlaceholder?: string;
|
25
25
|
invalid?: boolean;
|
26
26
|
inlineLabel?: boolean;
|
27
27
|
labelHidden?: boolean;
|
@@ -34,8 +34,10 @@ interface IPropsBase<T> {
|
|
34
34
|
disabled?: boolean;
|
35
35
|
getLabel(item: T): string;
|
36
36
|
getId(item: T): string;
|
37
|
+
getBackgroundColor?(item: T): string;
|
38
|
+
getBorderColor?(item: T): string;
|
37
39
|
optionTemplate?(item: T): React.ComponentType<T> | JSX.Element;
|
38
|
-
valueTemplate?(item: T): React.ComponentType<T> | JSX.Element;
|
40
|
+
valueTemplate?(item: T, Wrapper: any): React.ComponentType<T> | JSX.Element;
|
39
41
|
onChange(e: Array<T>): void;
|
40
42
|
}
|
41
43
|
interface IPropsSync<T> extends IPropsBase<T> {
|
@@ -56,7 +58,11 @@ export declare class TreeSelect<T> extends React.Component<IProps<T>, IState<T>>
|
|
56
58
|
private dropdownRef;
|
57
59
|
private openDropdownRef;
|
58
60
|
private htmlId;
|
61
|
+
private popperInstance;
|
59
62
|
constructor(props: IProps<T>);
|
63
|
+
componentDidMount: () => void;
|
64
|
+
componentDidUpdate(prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void;
|
65
|
+
toggleMenu(): void;
|
60
66
|
removeClick(i: number): void;
|
61
67
|
handleMultiLevel(item: ITreeNode<T>): void;
|
62
68
|
handleButton(item: ITreeNode<T>): void;
|
@@ -66,10 +72,11 @@ export declare class TreeSelect<T> extends React.Component<IProps<T>, IState<T>>
|
|
66
72
|
backButton: () => false | undefined;
|
67
73
|
backButtonValue: () => void;
|
68
74
|
recursion(arr: Array<ITreeNode<T>>): void;
|
69
|
-
|
70
|
-
componentDidUpdate(prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void;
|
71
|
-
filteredItem(arr: Array<ITreeNode<T>>): JSX.Element[] | undefined;
|
75
|
+
filteredItem(arr: Array<ITreeNode<T>>): JSX.Element | JSX.Element[] | undefined;
|
72
76
|
banchButton(): JSX.Element;
|
77
|
+
private debounceFn;
|
78
|
+
private ICancelFn;
|
79
|
+
handleDebounce(): void;
|
73
80
|
render(): JSX.Element;
|
74
81
|
}
|
75
82
|
export {};
|
@@ -50,13 +50,26 @@ exports.TreeSelect = void 0;
|
|
50
50
|
var React = __importStar(require("react"));
|
51
51
|
var Icon_1 = require("./Icon");
|
52
52
|
var Loader_1 = require("./Loader");
|
53
|
-
var classnames_1 = __importDefault(require("classnames"));
|
54
53
|
var react_id_generator_1 = __importDefault(require("react-id-generator"));
|
54
|
+
var debounce_1 = __importDefault(require("lodash/debounce"));
|
55
|
+
var Form_1 = require("./Form");
|
56
|
+
var core_1 = require("@popperjs/core");
|
57
|
+
var lodash_1 = require("lodash");
|
58
|
+
var Label_1 = require("./Label");
|
55
59
|
var TreeSelect = /** @class */ (function (_super) {
|
56
60
|
__extends(TreeSelect, _super);
|
57
61
|
function TreeSelect(props) {
|
58
62
|
var _this = _super.call(this, props) || this;
|
59
63
|
_this.htmlId = (0, react_id_generator_1.default)();
|
64
|
+
_this.componentDidMount = function () {
|
65
|
+
_this.recursion(_this.state.options);
|
66
|
+
document.addEventListener("mousedown", function (event) {
|
67
|
+
if ((_this.dropdownRef.current && !_this.dropdownRef.current.contains(event.target))
|
68
|
+
&& (_this.openDropdownRef.current && !_this.openDropdownRef.current.contains(event.target))) {
|
69
|
+
_this.setState({ openDropdown: false });
|
70
|
+
}
|
71
|
+
});
|
72
|
+
};
|
60
73
|
_this.backButton = function () {
|
61
74
|
if (_this.state.activeTree.length > 0) {
|
62
75
|
_this.setState({
|
@@ -73,15 +86,7 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
73
86
|
buttonValue: _this.state.buttonTree.pop(),
|
74
87
|
});
|
75
88
|
};
|
76
|
-
_this.
|
77
|
-
_this.recursion(_this.state.options);
|
78
|
-
document.addEventListener("mousedown", function (event) {
|
79
|
-
if ((_this.dropdownRef.current && !_this.dropdownRef.current.contains(event.target))
|
80
|
-
&& (_this.openDropdownRef.current && !_this.openDropdownRef.current.contains(event.target))) {
|
81
|
-
_this.setState({ openDropdown: false });
|
82
|
-
}
|
83
|
-
});
|
84
|
-
};
|
89
|
+
_this.debounceFn = (0, debounce_1.default)(_this.handleDebounce, 500);
|
85
90
|
_this.state = {
|
86
91
|
value: _this.props.value ? _this.props.value : [],
|
87
92
|
options: _this.props.getOptions ? _this.props.getOptions() : [],
|
@@ -93,8 +98,8 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
93
98
|
buttonValue: [],
|
94
99
|
buttonMouseEvent: false,
|
95
100
|
openDropdown: false,
|
96
|
-
loading:
|
97
|
-
|
101
|
+
loading: false,
|
102
|
+
// provera: false
|
98
103
|
};
|
99
104
|
_this.removeClick = _this.removeClick.bind(_this);
|
100
105
|
_this.handleMultiLevel = _this.handleMultiLevel.bind(_this);
|
@@ -104,10 +109,47 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
104
109
|
_this.handleTree = _this.handleTree.bind(_this);
|
105
110
|
_this.filteredItem = _this.filteredItem.bind(_this);
|
106
111
|
_this.banchButton = _this.banchButton.bind(_this);
|
112
|
+
_this.handleDebounce = _this.handleDebounce.bind(_this);
|
113
|
+
_this.toggleMenu = _this.toggleMenu.bind(_this);
|
107
114
|
_this.dropdownRef = React.createRef();
|
108
115
|
_this.openDropdownRef = React.createRef();
|
109
116
|
return _this;
|
110
117
|
}
|
118
|
+
TreeSelect.prototype.componentDidUpdate = function (prevProps, prevState) {
|
119
|
+
if (!(0, lodash_1.isEqual)(prevState.value, this.state.value)) {
|
120
|
+
this.props.onChange(this.state.value);
|
121
|
+
}
|
122
|
+
else if (!(0, lodash_1.isEqual)(prevProps.value, this.props.value)) {
|
123
|
+
this.props.onChange(this.state.value);
|
124
|
+
}
|
125
|
+
if (prevState.openDropdown !== this.state.openDropdown) {
|
126
|
+
this.toggleMenu();
|
127
|
+
}
|
128
|
+
if (this.props.kind === 'synchronous') {
|
129
|
+
if ((prevState.activeTree !== this.state.activeTree)
|
130
|
+
|| (prevState.filterArr !== this.state.filterArr)
|
131
|
+
|| (prevState.options !== this.state.options)) {
|
132
|
+
this.popperInstance.update();
|
133
|
+
}
|
134
|
+
}
|
135
|
+
};
|
136
|
+
TreeSelect.prototype.toggleMenu = function () {
|
137
|
+
if (this.state.openDropdown) {
|
138
|
+
if (this.openDropdownRef.current && this.dropdownRef.current) {
|
139
|
+
this.popperInstance = (0, core_1.createPopper)(this.openDropdownRef.current, this.dropdownRef.current, {
|
140
|
+
placement: 'bottom-start',
|
141
|
+
modifiers: [
|
142
|
+
{
|
143
|
+
name: 'offset',
|
144
|
+
options: {
|
145
|
+
offset: [-4, 4],
|
146
|
+
},
|
147
|
+
},
|
148
|
+
],
|
149
|
+
});
|
150
|
+
}
|
151
|
+
}
|
152
|
+
};
|
111
153
|
TreeSelect.prototype.removeClick = function (i) {
|
112
154
|
var newTags = this.state.value;
|
113
155
|
newTags === null || newTags === void 0 ? void 0 : newTags.splice(i, 1);
|
@@ -248,18 +290,10 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
248
290
|
}
|
249
291
|
});
|
250
292
|
};
|
251
|
-
TreeSelect.prototype.componentDidUpdate = function (prevProps, prevState) {
|
252
|
-
if (prevState.value !== this.state.value) {
|
253
|
-
this.props.onChange(this.state.value);
|
254
|
-
}
|
255
|
-
else if (prevProps.value !== this.props.value) {
|
256
|
-
this.props.onChange(this.state.value);
|
257
|
-
}
|
258
|
-
};
|
259
293
|
TreeSelect.prototype.filteredItem = function (arr) {
|
260
294
|
var _this = this;
|
261
295
|
if (this.props.kind === 'synchronous') {
|
262
|
-
|
296
|
+
var filteredArr = arr.filter(function (item) {
|
263
297
|
if (_this.state.searchFieldValue) {
|
264
298
|
if (_this.props.getLabel(item.value)
|
265
299
|
.toLowerCase().includes(_this.state.searchFieldValue.toLowerCase())) {
|
@@ -272,25 +306,36 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
272
306
|
else {
|
273
307
|
return item.value;
|
274
308
|
}
|
275
|
-
}).map(function (option, i) {
|
276
|
-
var selectedItem = _this.state.value.some(function (obj) {
|
277
|
-
return _this.props.getId(obj) === _this.props.getId(option.value);
|
278
|
-
});
|
279
|
-
return React.createElement("li", { key: i, className: "suggestion-item suggestion-item--multi-select", onClick: function (event) {
|
280
|
-
_this.setState({
|
281
|
-
searchFieldValue: '',
|
282
|
-
}),
|
283
|
-
event.preventDefault();
|
284
|
-
event.stopPropagation();
|
285
|
-
_this.handleTree(event, option);
|
286
|
-
} },
|
287
|
-
_this.props.optionTemplate
|
288
|
-
? _this.props.optionTemplate(option.value)
|
289
|
-
: React.createElement("span", { className: selectedItem
|
290
|
-
? 'suggestion-item--disabled' : undefined }, _this.props.getLabel(option.value)),
|
291
|
-
option.children && React.createElement("span", { className: "suggestion-item__icon" },
|
292
|
-
React.createElement(Icon_1.Icon, { name: "chevron-right-thin" })));
|
293
309
|
});
|
310
|
+
if (filteredArr.length === 0) {
|
311
|
+
return React.createElement("li", { className: "suggestion-item--nothing-found" }, "Nothing fonud");
|
312
|
+
}
|
313
|
+
else {
|
314
|
+
return filteredArr.map(function (option, i) {
|
315
|
+
var selectedItem = _this.state.value.some(function (obj) {
|
316
|
+
return _this.props.getId(obj) === _this.props.getId(option.value);
|
317
|
+
});
|
318
|
+
return React.createElement("li", { key: i, className: "suggestion-item suggestion-item--multi-select", onClick: function (event) {
|
319
|
+
_this.setState({
|
320
|
+
searchFieldValue: '',
|
321
|
+
}),
|
322
|
+
event.preventDefault();
|
323
|
+
event.stopPropagation();
|
324
|
+
_this.handleTree(event, option);
|
325
|
+
} },
|
326
|
+
_this.props.getBorderColor
|
327
|
+
&& React.createElement("div", { className: "item-border", style: { backgroundColor: _this.props.getBorderColor(option.value) } }),
|
328
|
+
React.createElement("span", { style: _this.props.getBackgroundColor
|
329
|
+
? { backgroundColor: _this.props.getBackgroundColor(option.value),
|
330
|
+
color: (0, Label_1.getTextColor)(_this.props.getBackgroundColor(option.value)) }
|
331
|
+
: undefined, className: 'suggestion-item--bgcolor'
|
332
|
+
+ (selectedItem ? ' suggestion-item--disabled' : '') }, _this.props.optionTemplate
|
333
|
+
? _this.props.optionTemplate(option.value)
|
334
|
+
: _this.props.getLabel(option.value)),
|
335
|
+
option.children && React.createElement("span", { className: "suggestion-item__icon" },
|
336
|
+
React.createElement(Icon_1.Icon, { name: "chevron-right-thin" })));
|
337
|
+
});
|
338
|
+
}
|
294
339
|
}
|
295
340
|
else if (this.props.kind === 'asynchronous') {
|
296
341
|
return this.state.options.map(function (item, i) {
|
@@ -321,20 +366,29 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
321
366
|
return React.createElement("button", { className: 'autocomplete__button' + (this.props.selectBranchWithChildren ? ' autocomplete__button--multi-select' : '') + ' autocomplete__button--disabled', value: this.state.buttonValue }, "Category selected");
|
322
367
|
}
|
323
368
|
};
|
369
|
+
TreeSelect.prototype.handleDebounce = function () {
|
370
|
+
var _this = this;
|
371
|
+
this.setState({ options: [] });
|
372
|
+
if (this.props.kind === 'asynchronous') {
|
373
|
+
if (this.state.searchFieldValue) {
|
374
|
+
this.setState({
|
375
|
+
loading: true,
|
376
|
+
// provera: false
|
377
|
+
});
|
378
|
+
this.ICancelFn = this.props.searchOptions(this.state.searchFieldValue, function (items) {
|
379
|
+
// if (items.length === 0) {
|
380
|
+
// this.setState({provera: true, loading: false})
|
381
|
+
// } else {
|
382
|
+
_this.setState({ options: items, loading: false });
|
383
|
+
_this.popperInstance.update();
|
384
|
+
// }
|
385
|
+
});
|
386
|
+
}
|
387
|
+
}
|
388
|
+
};
|
324
389
|
TreeSelect.prototype.render = function () {
|
325
390
|
var _this = this;
|
326
|
-
|
327
|
-
'a11y-only': this.props.labelHidden,
|
328
|
-
});
|
329
|
-
var classesLabel = (0, classnames_1.default)('sd-input', {
|
330
|
-
'sd-input--inline-label': this.props.inlineLabel,
|
331
|
-
'sd-input--required': this.props.required,
|
332
|
-
'sd-input--disabled': this.props.disabled,
|
333
|
-
'sd-input--full-width': this.props.fullWidth,
|
334
|
-
'sd-input--invalid': this.props.invalid || this.state.invalid,
|
335
|
-
});
|
336
|
-
return (React.createElement("div", { className: classesLabel },
|
337
|
-
React.createElement("label", { className: labelClasses, htmlFor: this.htmlId, id: this.htmlId + 'label', tabIndex: this.props.tabindex === undefined ? undefined : -1 }, this.props.label),
|
391
|
+
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.props.invalid, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
338
392
|
React.createElement("div", { className: "tags-input tags-input--".concat(this.props.allowMultiple ? 'multi-select' : 'single-select', " sd-input__input") },
|
339
393
|
this.props.allowMultiple
|
340
394
|
? React.createElement("div", { className: "tags-input__tags" },
|
@@ -342,40 +396,58 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
342
396
|
|| React.createElement("button", { ref: this.openDropdownRef, className: "tags-input__add-button", onClick: function () { return _this.setState({ openDropdown: !_this.state.openDropdown }); } },
|
343
397
|
React.createElement("i", { className: "icon-plus-large" })),
|
344
398
|
React.createElement("ul", { className: "tags-input__tag-list" }, this.state.value.map(function (item, i) {
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
399
|
+
var Wrapper = function (_a) {
|
400
|
+
var backgroundColor = _a.backgroundColor, children = _a.children;
|
401
|
+
return (React.createElement("li", { className: "tags-input__tag-item tags-input__tag-item--multi-select"
|
402
|
+
+ (_this.props.readOnly ? ' tags-input__tag-item--readonly' : ''), onClick: function () { return !_this.props.readOnly && _this.removeClick(i); }, style: _this.props.valueTemplate
|
403
|
+
? { backgroundColor: backgroundColor }
|
404
|
+
: _this.props.getBackgroundColor
|
405
|
+
&& { backgroundColor: _this.props.getBackgroundColor(item) } },
|
406
|
+
React.createElement("span", { style: { color: backgroundColor
|
407
|
+
? (0, Label_1.getTextColor)(backgroundColor)
|
408
|
+
: _this.props.getBackgroundColor
|
409
|
+
&& (0, Label_1.getTextColor)(_this.props.getBackgroundColor(item)) }, className: "tags-input__helper-box" },
|
410
|
+
children,
|
411
|
+
!_this.props.readOnly && React.createElement("span", { className: "tags-input__remove-button" },
|
412
|
+
React.createElement(Icon_1.Icon, { name: "close-small" })))));
|
413
|
+
};
|
414
|
+
return (React.createElement(React.Fragment, { key: i }, _this.props.valueTemplate
|
415
|
+
? _this.props.valueTemplate(item, Wrapper)
|
416
|
+
: React.createElement(Wrapper, null,
|
417
|
+
React.createElement("span", null, _this.props.getLabel(item)))));
|
355
418
|
})),
|
356
|
-
this.state.value.length > 0
|
357
|
-
this.props.readOnly
|
358
|
-
|| React.createElement("button", { className: "tags-input__remove-value", onClick: function () { return _this.setState({ value: [] }); } },
|
419
|
+
this.state.value.length > 0
|
420
|
+
? this.props.readOnly
|
421
|
+
|| React.createElement("button", { className: "tags-input__remove-value", style: { position: 'relative', bottom: '2px' }, onClick: function () { return _this.setState({ value: [] }); } },
|
359
422
|
React.createElement(Icon_1.Icon, { name: 'remove-sign' })) : null)
|
360
423
|
: React.createElement("div", { className: "tags-input__tags" },
|
361
|
-
|
424
|
+
this.props.readOnly
|
425
|
+
|| React.createElement("button", { className: "tags-input__overlay-button", ref: this.openDropdownRef, onClick: function () { return _this.setState({ openDropdown: !_this.state.openDropdown }); } }),
|
362
426
|
this.state.value.length < 1 && React.createElement("span", { className: 'tags-input__single-item'
|
363
427
|
+ (this.props.readOnly ? ' tags-input__tag-item--readonly' : '') },
|
364
428
|
React.createElement("span", { className: "tags-input__placeholder" }, this.props.placeholder)),
|
365
429
|
this.state.value.map(function (item, i) {
|
366
|
-
|
367
|
-
|
430
|
+
var Wrapper = function (_a) {
|
431
|
+
var backgroundColor = _a.backgroundColor, borderColor = _a.borderColor, children = _a.children;
|
432
|
+
return (React.createElement("span", { className: 'tags-input__single-item'
|
368
433
|
+ (_this.props.readOnly ? ' tags-input__tag-item--readonly' : ''), onClick: function () { return _this.props.readOnly || _this.removeClick(i); } },
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
434
|
+
_this.props.getBorderColor
|
435
|
+
&& React.createElement("div", { className: "item-border item-border-selected", style: borderColor
|
436
|
+
? { backgroundColor: borderColor }
|
437
|
+
: { backgroundColor: _this.props.getBorderColor(item) } }),
|
438
|
+
React.createElement("span", { style: { color: backgroundColor && (0, Label_1.getTextColor)(backgroundColor) }, className: "tags-input__helper-box" },
|
439
|
+
React.createElement("span", { className: backgroundColor && "tags-input__tag-item", style: { backgroundColor: backgroundColor, margin: 0 } }, children),
|
373
440
|
_this.props.readOnly
|
374
441
|
|| React.createElement("span", { className: "tags-input__remove-button" },
|
375
442
|
React.createElement(Icon_1.Icon, { name: 'remove-sign' })))));
|
443
|
+
};
|
444
|
+
return React.createElement(React.Fragment, { key: i }, _this.props.valueTemplate
|
445
|
+
? _this.props.valueTemplate(item, Wrapper)
|
446
|
+
: React.createElement(Wrapper, null,
|
447
|
+
React.createElement("span", null, _this.props.getLabel(item))));
|
376
448
|
})),
|
377
|
-
this.state.openDropdown
|
378
|
-
React.createElement("div", { className: "autocomplete autocomplete--multi-select" + (this.props.width === 'medium' ? ' autocomplete--fixed-width' : ''), ref: this.dropdownRef },
|
449
|
+
this.state.openDropdown
|
450
|
+
&& React.createElement("div", { className: "autocomplete autocomplete--multi-select" + (this.props.width === 'medium' ? ' autocomplete--fixed-width' : ''), ref: this.dropdownRef },
|
379
451
|
React.createElement("div", { className: 'autocomplete__header' },
|
380
452
|
React.createElement("div", { className: "autocomplete__icon", onClick: function () {
|
381
453
|
_this.backButtonValue();
|
@@ -383,23 +455,28 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
383
455
|
} },
|
384
456
|
React.createElement(Icon_1.Icon, { name: "search", className: "search" })),
|
385
457
|
React.createElement("div", { className: 'autocomplete__filter' },
|
386
|
-
React.createElement("input", { placeholder: this.props.
|
387
|
-
|
388
|
-
|
389
|
-
_this.
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
_this.
|
394
|
-
|
395
|
-
|
458
|
+
React.createElement("input", { placeholder: this.props.searchPlaceholder, type: "text", className: "autocomplete__input", ref: function (input) { return input && input.focus(); }, value: this.state.searchFieldValue, onChange: function (event) {
|
459
|
+
if (_this.props.kind === 'synchronous') {
|
460
|
+
_this.setState({ searchFieldValue: event.target.value });
|
461
|
+
_this.popperInstance.update();
|
462
|
+
}
|
463
|
+
else if (_this.props.kind === 'asynchronous') {
|
464
|
+
if (_this.ICancelFn) {
|
465
|
+
_this.ICancelFn();
|
466
|
+
}
|
467
|
+
_this.setState({ searchFieldValue: event.target.value, options: [] });
|
468
|
+
_this.popperInstance.update();
|
469
|
+
_this.debounceFn();
|
396
470
|
}
|
397
|
-
else
|
398
|
-
|
471
|
+
else {
|
472
|
+
return;
|
399
473
|
}
|
474
|
+
// if(!this.state.searchFieldValue) {
|
475
|
+
// this.setState({provera: false});
|
476
|
+
// }
|
400
477
|
} }))),
|
401
|
-
this.state.activeTree.length > 0
|
402
|
-
React.createElement("div", { className: 'autocomplete__category-header' },
|
478
|
+
this.state.activeTree.length > 0
|
479
|
+
&& React.createElement("div", { className: 'autocomplete__category-header' },
|
403
480
|
React.createElement("div", { className: "autocomplete__icon", onClick: function () {
|
404
481
|
_this.backButtonValue();
|
405
482
|
_this.backButton();
|
@@ -413,35 +490,31 @@ var TreeSelect = /** @class */ (function (_super) {
|
|
413
490
|
this.state.loading
|
414
491
|
? React.createElement("ul", { className: "suggestion-list--loader" },
|
415
492
|
React.createElement(Loader_1.Loader, { overlay: true }))
|
416
|
-
:
|
417
|
-
this.
|
418
|
-
? this.
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
? _this.props.
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
React.createElement("div", { className: 'sd-input__hint' }, this.props.info) : null,
|
442
|
-
this.props.invalid || this.state.invalid ?
|
443
|
-
React.createElement("div", { className: 'sd-input__message' }, this.props.error)
|
444
|
-
: null)));
|
493
|
+
: this.state.searchFieldValue === ''
|
494
|
+
? this.props.getOptions
|
495
|
+
? React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select" }, this.state.options
|
496
|
+
.map(function (option, i) {
|
497
|
+
var selectedItem = _this.state.value.some(function (obj) {
|
498
|
+
return _this.props.getId(obj) === _this.props.getLabel(option.value);
|
499
|
+
});
|
500
|
+
return (React.createElement("li", { key: i, className: "suggestion-item suggestion-item--multi-select", onClick: function (event) {
|
501
|
+
event.preventDefault();
|
502
|
+
event.stopPropagation();
|
503
|
+
_this.handleTree(event, option);
|
504
|
+
} },
|
505
|
+
(_this.props.getBorderColor && !_this.props.allowMultiple) && React.createElement("div", { className: "item-border", style: { backgroundColor: _this.props.getBorderColor(option.value) } }),
|
506
|
+
React.createElement("span", { style: (_this.props.getBackgroundColor && option.value)
|
507
|
+
? { backgroundColor: _this.props.getBackgroundColor(option.value),
|
508
|
+
color: (0, Label_1.getTextColor)(_this.props.getBackgroundColor(option.value)) }
|
509
|
+
: undefined, className: 'suggestion-item--bgcolor'
|
510
|
+
+ (selectedItem ? ' suggestion-item--disabled' : '') }, _this.props.optionTemplate
|
511
|
+
? _this.props.optionTemplate(option.value)
|
512
|
+
: _this.props.getLabel(option.value)),
|
513
|
+
option.children && React.createElement("span", { className: "suggestion-item__icon" },
|
514
|
+
React.createElement(Icon_1.Icon, { name: "chevron-right-thin" }))));
|
515
|
+
})) : null
|
516
|
+
: React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select" }, this.filteredItem(this.props.singleLevelSearch
|
517
|
+
? this.state.options : this.state.filterArr))))));
|
445
518
|
};
|
446
519
|
return TreeSelect;
|
447
520
|
}(React.Component));
|
package/react/index.d.ts
CHANGED
@@ -82,5 +82,6 @@ export { BottomNav } from './components/Navigation/BottomNav';
|
|
82
82
|
export { TreeSelect } from './components/TreeSelect';
|
83
83
|
export { TableList, TableListItem } from './components/Lists/TableList';
|
84
84
|
export { ContentListItem } from './components/Lists/ContentList';
|
85
|
+
export { MultiSelect } from './components/MultiSelect';
|
85
86
|
export declare const ToggleBoxNext: any;
|
86
87
|
export declare const reactToAngular1: any;
|
package/react/index.js
CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
exports.DropdownLabel = exports.DropdownItem = exports.DropdownFirst = exports.HeadingText = exports.ContentDivider = exports.Divider = exports.Icon = exports.Prop = exports.PropsList = exports.StrechBar = exports.SlidingToolbar = exports.SubNavDivider = exports.SubNav = exports.LeftMenu = exports.TabList = exports.Tab = exports.NavButton = exports.CheckButtonGroup = exports.CheckGroup = exports.CheckboxButton = exports.RadioButtonGroup = exports.Checkbox = exports.RadioGroup = exports.Loader = exports.ButtonGroup = exports.SwitchGroup = exports.Switch = exports.FormLabel = exports.TimePicker = exports.DatePickerISO = exports.DatePicker = exports.getDurationString = exports.DurationInput = exports.Tooltip = exports.IconLabel = exports.IconButton = exports.AvatarGroup = exports.AvatarContentImage = exports.AvatarContentText = exports.AvatarWrapper = exports.Alert = exports.Badge = exports.Label = exports.Popover = exports.SelectWithTemplate = exports.Option = exports.Select = exports.Input = exports.Button = exports.HelloWorld = void 0;
|
16
16
|
exports.ContentListItem = exports.TableListItem = exports.TableList = exports.TreeSelect = exports.BottomNav = exports.Heading = exports.Time = exports.Text = exports.LoadingOverlay = exports.Spinner = exports.ListItemLoader = exports.Skeleton = exports.WithSizeObserver = exports.SearchBar = exports.CreateButton = exports.DropZone = exports.ThemeSelector = exports.IconPicker = exports.SelectGrid = exports.ToggleBox = exports.Menu = exports.toasted = exports.GridItemCheckWrapper = exports.GridItemTopActions = exports.GridItemFooterActions = exports.GridItemFooterBlock = exports.GridItemSlug = exports.GridItemText = exports.GridItemTitle = exports.GridItemTime = exports.GridItemContentBlock = exports.GridItemFooter = exports.GridItemMedia = exports.GridItemContent = exports.GridItem = exports.GridList = exports.TagInputTest = exports.TagInput = exports.Modal = exports.Carousel = exports.DonutChart = exports.Autocomplete = exports.EmptyState = exports.Tabs = exports.TabContent = exports.TabPanel = exports.TabLabel = exports.Tag = exports.Dropdown = exports.DropdownDivider = void 0;
|
17
|
+
exports.MultiSelect = void 0;
|
17
18
|
var HelloWorld_1 = require("./components/HelloWorld");
|
18
19
|
Object.defineProperty(exports, "HelloWorld", { enumerable: true, get: function () { return HelloWorld_1.HelloWorld; } });
|
19
20
|
var Button_1 = require("./components/Button");
|
@@ -197,3 +198,5 @@ Object.defineProperty(exports, "TableList", { enumerable: true, get: function ()
|
|
197
198
|
Object.defineProperty(exports, "TableListItem", { enumerable: true, get: function () { return TableList_1.TableListItem; } });
|
198
199
|
var ContentList_1 = require("./components/Lists/ContentList");
|
199
200
|
Object.defineProperty(exports, "ContentListItem", { enumerable: true, get: function () { return ContentList_1.ContentListItem; } });
|
201
|
+
var MultiSelect_1 = require("./components/MultiSelect");
|
202
|
+
Object.defineProperty(exports, "MultiSelect", { enumerable: true, get: function () { return MultiSelect_1.MultiSelect; } });
|
@@ -1,66 +0,0 @@
|
|
1
|
-
diff --git a/node_modules/@superdesk/primereact/components/dialog/Dialog.d.ts b/node_modules/@superdesk/primereact/components/dialog/Dialog.d.ts
|
2
|
-
index 80b0f8e..5343abf 100644
|
3
|
-
--- a/node_modules/@superdesk/primereact/components/dialog/Dialog.d.ts
|
4
|
-
+++ b/node_modules/@superdesk/primereact/components/dialog/Dialog.d.ts
|
5
|
-
@@ -18,7 +18,7 @@ interface DialogProps {
|
6
|
-
maskClassName?: string;
|
7
|
-
showHeader?: boolean;
|
8
|
-
appendTo?: HTMLElement;
|
9
|
-
- baseZIndex?: number;
|
10
|
-
+ zIndex?: number;
|
11
|
-
maximizable?: boolean;
|
12
|
-
blockScroll?: boolean;
|
13
|
-
ariaCloseIconLabel?: string;
|
14
|
-
diff --git a/node_modules/@superdesk/primereact/components/dialog/Dialog.js b/node_modules/@superdesk/primereact/components/dialog/Dialog.js
|
15
|
-
index 2e243f2..e7ce643 100644
|
16
|
-
--- a/node_modules/@superdesk/primereact/components/dialog/Dialog.js
|
17
|
-
+++ b/node_modules/@superdesk/primereact/components/dialog/Dialog.js
|
18
|
-
@@ -148,7 +148,7 @@ var Dialog = /*#__PURE__*/function (_Component) {
|
19
|
-
}, {
|
20
|
-
key: "zIndex",
|
21
|
-
get: function get() {
|
22
|
-
- return this.props.baseZIndex + _DomHandler.default.generateZIndex();
|
23
|
-
+ return this.props.zIndex;
|
24
|
-
}
|
25
|
-
}, {
|
26
|
-
key: "maximized",
|
27
|
-
@@ -301,7 +301,7 @@ var Dialog = /*#__PURE__*/function (_Component) {
|
28
|
-
this.setState({
|
29
|
-
maskVisible: true
|
30
|
-
}, function () {
|
31
|
-
- _this5.mask.style.zIndex = String(_this5.zIndex);
|
32
|
-
+ _this5.mask.style.zIndex = String(this.zIndex);
|
33
|
-
});
|
34
|
-
}
|
35
|
-
|
36
|
-
@@ -501,7 +501,7 @@ _defineProperty(Dialog, "defaultProps", {
|
37
|
-
maskClassName: null,
|
38
|
-
showHeader: true,
|
39
|
-
appendTo: null,
|
40
|
-
- baseZIndex: 0,
|
41
|
-
+ zIndex: 0,
|
42
|
-
maximizable: false,
|
43
|
-
blockScroll: false,
|
44
|
-
icons: null,
|
45
|
-
@@ -531,7 +531,7 @@ _defineProperty(Dialog, "propTypes", {
|
46
|
-
maskClassName: _propTypes.default.string,
|
47
|
-
showHeader: _propTypes.default.bool,
|
48
|
-
appendTo: _propTypes.default.object,
|
49
|
-
- baseZIndex: _propTypes.default.number,
|
50
|
-
+ zIndex: _propTypes.default.number,
|
51
|
-
maximizable: _propTypes.default.bool,
|
52
|
-
blockScroll: _propTypes.default.bool,
|
53
|
-
icons: _propTypes.default.any,
|
54
|
-
diff --git a/node_modules/@superdesk/primereact/components/tieredmenu/TieredMenu.d.ts b/node_modules/@superdesk/primereact/components/tieredmenu/TieredMenu.d.ts
|
55
|
-
index a91da27..3dd7822 100644
|
56
|
-
--- a/node_modules/@superdesk/primereact/components/tieredmenu/TieredMenu.d.ts
|
57
|
-
+++ b/node_modules/@superdesk/primereact/components/tieredmenu/TieredMenu.d.ts
|
58
|
-
@@ -9,7 +9,7 @@ interface TieredMenuProps {
|
59
|
-
style?: object;
|
60
|
-
className?: string;
|
61
|
-
autoZIndex?: boolean;
|
62
|
-
- bazeZIndex?: number;
|
63
|
-
+ baseZIndex?: number;
|
64
|
-
appendTo?: any;
|
65
|
-
onShow?(e: Event): void;
|
66
|
-
onHide?(e: Event): void;
|