superdesk-ui-framework 3.0.1-beta.9 → 3.0.2

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.
Files changed (160) hide show
  1. package/app/fonts/sd_icons.eot +0 -0
  2. package/app/fonts/sd_icons.svg +1 -0
  3. package/app/fonts/sd_icons.ttf +0 -0
  4. package/app/fonts/sd_icons.woff +0 -0
  5. package/app/scripts/toggleBoxNext.js +1 -1
  6. package/app/styles/_big-icon-font.scss +1 -1
  7. package/app/styles/_buttons.scss +11 -6
  8. package/app/styles/_content-divider.scss +63 -8
  9. package/app/styles/_helpers.scss +24 -1
  10. package/app/styles/_icon-font.scss +11 -10
  11. package/app/styles/_labels.scss +0 -1
  12. package/app/styles/_master-desk.scss +5 -4
  13. package/app/styles/_modals.scss +7 -3
  14. package/app/styles/_normalize.scss +4 -0
  15. package/app/styles/_sd-tag-input.scss +56 -2
  16. package/app/styles/_simple-list.scss +0 -2
  17. package/app/styles/_table-list.scss +116 -12
  18. package/app/styles/app.scss +3 -0
  19. package/app/styles/components/_list-item.scss +23 -16
  20. package/app/styles/components/_sd-collapse-box.scss +6 -6
  21. package/app/styles/components/_sd-comment-box.scss +8 -4
  22. package/app/styles/components/_sd-editor-popup.scss +4 -4
  23. package/app/styles/components/_sd-media-carousel.scss +37 -2
  24. package/app/styles/components/_sd-pagination.scss +41 -0
  25. package/app/styles/components/_sd-photo-preview.scss +2 -2
  26. package/app/styles/components/_subnav.scss +470 -470
  27. package/app/styles/design-tokens/_new-colors.scss +29 -12
  28. package/app/styles/dropdowns/_basic-dropdown.scss +6 -0
  29. package/app/styles/form-elements/_input-wrap.scss +138 -0
  30. package/app/styles/form-elements/_inputs.scss +230 -61
  31. package/app/styles/grids/_grid-layout.scss +13 -14
  32. package/app/styles/interface-elements/_side-panel.scss +1 -1
  33. package/app/styles/layout/_editor.scss +6 -0
  34. package/app/styles/menus/_sd-sidebar-menu.scss +1 -1
  35. package/app/styles/primereact/_pr-datepicker.scss +16 -2
  36. package/app/styles/primereact/_pr-dialog.scss +9 -0
  37. package/app/styles/primereact/_pr-menu.scss +6 -5
  38. package/app/styles/variables/_colors.scss +47 -47
  39. package/app/template/search-handler.html +2 -2
  40. package/app-typescript/components/ContentDivider.tsx +3 -0
  41. package/app-typescript/components/DatePicker.tsx +8 -9
  42. package/app-typescript/components/Dropdown.tsx +127 -82
  43. package/app-typescript/components/DurationInput.tsx +39 -14
  44. package/app-typescript/components/Form/FormLabel.tsx +8 -1
  45. package/app-typescript/components/Form/InputBase.tsx +12 -2
  46. package/app-typescript/components/Input.tsx +4 -4
  47. package/app-typescript/components/Label.tsx +17 -1
  48. package/app-typescript/components/Layouts/AuthoringFrame.tsx +2 -1
  49. package/app-typescript/components/Layouts/AuthoringFrameRightBar.tsx +21 -2
  50. package/app-typescript/components/Layouts/AuthoringInnerHeader.tsx +1 -1
  51. package/app-typescript/components/Layouts/AuthoringMain.tsx +4 -2
  52. package/app-typescript/components/Layouts/CoreLayout.tsx +3 -1
  53. package/app-typescript/components/Layouts/CoreLayoutMain.tsx +10 -1
  54. package/app-typescript/components/Lists/ContentList.tsx +64 -30
  55. package/app-typescript/components/Lists/TableList.tsx +255 -53
  56. package/app-typescript/components/Menu.tsx +2 -2
  57. package/app-typescript/components/Modal.tsx +6 -2
  58. package/app-typescript/components/MultiSelect.tsx +2 -2
  59. package/app-typescript/components/NavButton.tsx +2 -1
  60. package/app-typescript/components/Navigation/SideBarMenu.tsx +30 -4
  61. package/app-typescript/components/SearchBar.tsx +11 -3
  62. package/app-typescript/components/Spacer.tsx +87 -0
  63. package/app-typescript/components/TimePicker.tsx +2 -13
  64. package/app-typescript/components/TreeSelect.tsx +286 -180
  65. package/app-typescript/index.ts +1 -0
  66. package/dist/examples.bundle.css +110 -71
  67. package/dist/examples.bundle.js +24358 -22168
  68. package/dist/playgrounds/react-playgrounds/CoreLayout.tsx +505 -2
  69. package/dist/playgrounds/react-playgrounds/Index.tsx +1 -0
  70. package/dist/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
  71. package/dist/playgrounds/react-playgrounds/RundownEditor.tsx +17 -19
  72. package/dist/playgrounds/react-playgrounds/Rundowns.tsx +22 -23
  73. package/dist/playgrounds/react-playgrounds/TestGround.tsx +226 -25
  74. package/dist/react/ContentDivider.tsx +22 -18
  75. package/dist/react/ContentList.tsx +188 -12
  76. package/dist/react/DatePicker.tsx +50 -2
  77. package/dist/react/Dropdowns.tsx +580 -48
  78. package/dist/react/DurationInput.tsx +7 -3
  79. package/dist/react/Inputs.tsx +1 -7
  80. package/dist/react/Modal.tsx +154 -22
  81. package/dist/react/MultiSelect.tsx +5 -5
  82. package/dist/react/NavButtons.tsx +31 -1
  83. package/dist/react/TableList.tsx +52 -139
  84. package/dist/react/Togglebox.tsx +1 -1
  85. package/dist/react/TreeSelect.tsx +167 -176
  86. package/dist/sd_icons.eot +0 -0
  87. package/dist/sd_icons.svg +1 -0
  88. package/dist/sd_icons.ttf +0 -0
  89. package/dist/sd_icons.woff +0 -0
  90. package/dist/superdesk-ui.bundle.css +1100 -407
  91. package/dist/superdesk-ui.bundle.js +6594 -4035
  92. package/dist/vendor.bundle.js +27 -27
  93. package/examples/css/docs-page.css +4 -4
  94. package/examples/index.js +4 -0
  95. package/examples/pages/playgrounds/react-playgrounds/CoreLayout.tsx +505 -2
  96. package/examples/pages/playgrounds/react-playgrounds/Index.tsx +1 -0
  97. package/examples/pages/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
  98. package/examples/pages/playgrounds/react-playgrounds/RundownEditor.tsx +17 -19
  99. package/examples/pages/playgrounds/react-playgrounds/Rundowns.tsx +22 -23
  100. package/examples/pages/playgrounds/react-playgrounds/TestGround.tsx +226 -25
  101. package/examples/pages/react/ContentDivider.tsx +22 -18
  102. package/examples/pages/react/ContentList.tsx +188 -12
  103. package/examples/pages/react/DatePicker.tsx +50 -2
  104. package/examples/pages/react/Dropdowns.tsx +580 -48
  105. package/examples/pages/react/DurationInput.tsx +7 -3
  106. package/examples/pages/react/Inputs.tsx +1 -7
  107. package/examples/pages/react/Modal.tsx +154 -22
  108. package/examples/pages/react/MultiSelect.tsx +5 -5
  109. package/examples/pages/react/NavButtons.tsx +31 -1
  110. package/examples/pages/react/TableList.tsx +52 -139
  111. package/examples/pages/react/Togglebox.tsx +1 -1
  112. package/examples/pages/react/TreeSelect.tsx +167 -176
  113. package/package.json +3 -5
  114. package/react/components/ContentDivider.d.ts +1 -0
  115. package/react/components/ContentDivider.js +2 -0
  116. package/react/components/DatePicker.d.ts +2 -2
  117. package/react/components/DatePicker.js +3 -3
  118. package/react/components/Dropdown.d.ts +6 -5
  119. package/react/components/Dropdown.js +57 -30
  120. package/react/components/DurationInput.d.ts +1 -1
  121. package/react/components/DurationInput.js +46 -17
  122. package/react/components/Form/FormLabel.d.ts +4 -1
  123. package/react/components/Form/FormLabel.js +9 -3
  124. package/react/components/Form/InputBase.d.ts +0 -1
  125. package/react/components/Form/InputBase.js +15 -1
  126. package/react/components/Input.d.ts +3 -3
  127. package/react/components/Input.js +2 -1
  128. package/react/components/Label.d.ts +1 -0
  129. package/react/components/Label.js +17 -2
  130. package/react/components/Layouts/AuthoringFrame.d.ts +1 -0
  131. package/react/components/Layouts/AuthoringFrame.js +1 -1
  132. package/react/components/Layouts/AuthoringFrameRightBar.d.ts +9 -2
  133. package/react/components/Layouts/AuthoringFrameRightBar.js +14 -3
  134. package/react/components/Layouts/AuthoringInnerHeader.js +1 -1
  135. package/react/components/Layouts/AuthoringMain.js +1 -1
  136. package/react/components/Layouts/CoreLayout.d.ts +2 -0
  137. package/react/components/Layouts/CoreLayout.js +1 -1
  138. package/react/components/Layouts/CoreLayoutMain.d.ts +2 -0
  139. package/react/components/Layouts/CoreLayoutMain.js +8 -1
  140. package/react/components/Lists/ContentList.d.ts +6 -0
  141. package/react/components/Lists/ContentList.js +42 -16
  142. package/react/components/Lists/TableList.d.ts +30 -8
  143. package/react/components/Lists/TableList.js +127 -24
  144. package/react/components/Menu.js +1 -1
  145. package/react/components/Modal.d.ts +2 -0
  146. package/react/components/Modal.js +3 -3
  147. package/react/components/MultiSelect.d.ts +40 -0
  148. package/react/components/MultiSelect.js +73 -0
  149. package/react/components/NavButton.d.ts +1 -1
  150. package/react/components/Navigation/SideBarMenu.d.ts +6 -0
  151. package/react/components/Navigation/SideBarMenu.js +19 -2
  152. package/react/components/SearchBar.d.ts +1 -1
  153. package/react/components/SearchBar.js +15 -7
  154. package/react/components/TimePicker.d.ts +1 -5
  155. package/react/components/TimePicker.js +3 -7
  156. package/react/components/TreeSelect.d.ts +12 -5
  157. package/react/components/TreeSelect.js +189 -116
  158. package/react/index.d.ts +1 -0
  159. package/react/index.js +3 -0
  160. package/patches/@superdesk+primereact+5.0.2-4.patch +0 -66
@@ -43,28 +43,54 @@ var classnames_1 = __importDefault(require("classnames"));
43
43
  var ContentListItem = /** @class */ (function (_super) {
44
44
  __extends(ContentListItem, _super);
45
45
  function ContentListItem() {
46
- return _super !== null && _super.apply(this, arguments) || this;
46
+ var _this = _super !== null && _super.apply(this, arguments) || this;
47
+ _this.delay = 200;
48
+ _this.prevent = false;
49
+ _this.onSingleClick = function () {
50
+ var selection = window.getSelection();
51
+ _this.timer = setTimeout(function () {
52
+ if (!_this.prevent && _this.props.onClick && selection) {
53
+ if (selection.toString().length < 1) {
54
+ _this.props.onClick();
55
+ }
56
+ }
57
+ }, _this.delay);
58
+ };
59
+ _this.onDoubleClick = function () {
60
+ clearTimeout(_this.timer);
61
+ _this.prevent = true;
62
+ if (_this.props.onDoubleClick) {
63
+ _this.props.onDoubleClick();
64
+ }
65
+ setTimeout(function () {
66
+ _this.prevent = false;
67
+ }, _this.delay);
68
+ };
69
+ _this.onActionMenuClick = function (event) {
70
+ event.preventDefault();
71
+ event.stopPropagation();
72
+ };
73
+ return _this;
47
74
  }
48
75
  ContentListItem.prototype.render = function () {
49
- var classes = (0, classnames_1.default)('sd-list-item sd-list-item-group sd-list-item-group--space-between-items', {
76
+ var classes = (0, classnames_1.default)('sd-list-item sd-shadow--z1', {
50
77
  'sd-list-item--activated': this.props.activated,
51
78
  'sd-list-item--selected': this.props.selected,
52
79
  'fetched': this.props.archived,
53
80
  'actioning': this.props.loading,
54
81
  });
55
- return (React.createElement("div", { className: classes, onClick: this.props.onClick, onDoubleClick: this.props.onDoubleClick },
56
- React.createElement("div", { className: "sd-list-item sd-shadow--z1" },
57
- this.props.locked
58
- ? React.createElement("div", { className: "sd-list-item__border sd-list-item__border--locked" })
59
- : React.createElement("div", { className: "sd-list-item__border" }),
60
- this.props.itemColum.map(function (item, index) {
61
- return React.createElement("div", { className: "sd-list-item__column ".concat(item.fullwidth && 'sd-list-item__column--grow', " ").concat(!item.border && 'sd-list-item__column--no-border'), key: index }, item.itemRow.map(function (e, i) {
62
- return (item.itemRow.length <= 1
63
- ? React.createElement(React.Fragment, { key: i }, e.content)
64
- : React.createElement("div", { className: "sd-list-item__row", key: i }, e.content));
65
- }));
66
- }),
67
- React.createElement("div", { className: "sd-list-item__action-menu" }, this.props.action))));
82
+ return (React.createElement("div", { role: 'listitem', className: classes, onClick: this.onSingleClick, onDoubleClick: this.onDoubleClick },
83
+ this.props.locked
84
+ ? React.createElement("div", { className: "sd-list-item__border sd-list-item__border--locked" })
85
+ : React.createElement("div", { className: "sd-list-item__border" }),
86
+ this.props.itemColum.map(function (item, index) {
87
+ return React.createElement("div", { className: "sd-list-item__column ".concat(item.fullwidth && 'sd-list-item__column--grow', " ").concat(!item.border && 'sd-list-item__column--no-border'), key: index }, item.itemRow.map(function (e, i) {
88
+ return (item.itemRow.length <= 1
89
+ ? React.createElement(React.Fragment, { key: i }, e.content)
90
+ : React.createElement("div", { className: "sd-list-item__row", key: i }, e.content));
91
+ }));
92
+ }),
93
+ React.createElement("div", { className: "sd-list-item__action-menu", onClick: this.onActionMenuClick }, this.props.action)));
68
94
  };
69
95
  return ContentListItem;
70
96
  }(React.PureComponent));
@@ -76,7 +102,7 @@ var ContentList = /** @class */ (function (_super) {
76
102
  }
77
103
  ContentList.prototype.render = function () {
78
104
  var classes = (0, classnames_1.default)('sd-list-item-group sd-list-item-group--space-between-items');
79
- return (React.createElement("ul", { className: classes }, this.props.items.map(function (item, index) {
105
+ return (React.createElement("div", { role: 'list', className: classes }, this.props.items.map(function (item, index) {
80
106
  return React.createElement(ContentListItem, { key: index, itemColum: item.itemColum, locked: item.locked, action: item.action, loading: item.loading, activated: item.activated, selected: item.selected, archived: item.archived, onClick: item.onClick, onDoubleClick: item.onDoubleClick });
81
107
  })));
82
108
  };
@@ -2,29 +2,38 @@ import * as React from 'react';
2
2
  import { DropResult } from "react-beautiful-dnd";
3
3
  import { IMenuItem, ISubmenu, IMenuGroup } from '../Dropdown';
4
4
  export interface IProps {
5
- children?: React.ReactNode;
6
5
  array: Array<IPropsArrayItem>;
7
6
  addItem?: boolean;
8
7
  dragAndDrop?: boolean;
9
- itemsDropdown?: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
10
8
  className?: string;
9
+ readOnly?: boolean;
10
+ showDragHandle?: 'always' | 'onHover' | 'none';
11
+ append?: boolean;
11
12
  onDrag?(start: number, end: number): void;
13
+ onAddItem?(index: number, item?: IPropsArrayItem): void;
14
+ itemsDropdown?(index?: number): Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
12
15
  }
13
16
  export interface IPropsArrayItem {
14
17
  start?: React.ReactNode;
15
18
  center?: React.ReactNode;
16
19
  end?: React.ReactNode;
17
20
  action?: React.ReactNode;
21
+ hexColor?: string;
18
22
  onClick?(): void;
23
+ onDoubleClick?(): void;
24
+ locked?: boolean;
25
+ positionLocked?: boolean;
19
26
  }
20
- declare class TableList extends React.PureComponent<IProps, {
27
+ interface IState {
21
28
  items: Array<IPropsArrayItem>;
22
- }> {
23
- constructor(props: Readonly<IProps>);
29
+ }
30
+ declare class TableList extends React.PureComponent<IProps, IState> {
31
+ constructor(props: IProps);
24
32
  componentDidMount(): void;
25
- componentDidUpdate(prevProps: Readonly<IProps>): void;
33
+ componentDidUpdate(prevProps: IProps): void;
26
34
  onDragEnd(result: DropResult): void | null;
27
- render(): false | "" | 0 | JSX.Element | null | undefined;
35
+ dropDown(): JSX.Element;
36
+ render(): JSX.Element | null;
28
37
  }
29
38
  export interface IPropsItem {
30
39
  start?: React.ReactNode;
@@ -32,11 +41,24 @@ export interface IPropsItem {
32
41
  end?: React.ReactNode;
33
42
  action?: React.ReactNode;
34
43
  addItem?: boolean;
35
- itemsDropdown?: any;
36
44
  dragAndDrop?: boolean;
45
+ hexColor?: string;
46
+ showDragHandle?: 'always' | 'onHover' | 'none';
47
+ locked?: boolean;
48
+ positionLocked?: boolean;
37
49
  onClick?(): void;
50
+ onDoubleClick?(): void;
51
+ onSelect?(): void;
52
+ onAddItem?(e: number): void;
53
+ itemsDropdown?(index?: number): Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
38
54
  }
39
55
  declare class TableListItem extends React.PureComponent<IPropsItem> {
56
+ private timer;
57
+ private delay;
58
+ private prevent;
59
+ onSingleClick: () => void;
60
+ onDoubleClick: () => void;
61
+ onActionMenuClick: (event: React.MouseEvent<HTMLElement>) => void;
40
62
  render(): JSX.Element;
41
63
  }
42
64
  export { TableList, TableListItem };
@@ -55,6 +55,7 @@ var react_beautiful_dnd_1 = require("react-beautiful-dnd");
55
55
  var Tooltip_1 = require("../Tooltip");
56
56
  var Button_1 = require("../Button");
57
57
  var Dropdown_1 = require("../Dropdown");
58
+ var react_dom_1 = __importDefault(require("react-dom"));
58
59
  var reorder = function (list, startIndex, endIndex) {
59
60
  var result = Array.from(list);
60
61
  var removed = result.splice(startIndex, 1)[0];
@@ -69,16 +70,21 @@ var TableList = /** @class */ (function (_super) {
69
70
  items: [],
70
71
  };
71
72
  _this.onDragEnd = _this.onDragEnd.bind(_this);
73
+ _this.dropDown = _this.dropDown.bind(_this);
72
74
  return _this;
73
75
  }
74
76
  TableList.prototype.componentDidMount = function () {
75
- this.setState({ items: this.props.array });
77
+ if (this.props.array) {
78
+ this.setState({ items: this.props.array });
79
+ }
76
80
  };
77
81
  TableList.prototype.componentDidUpdate = function (prevProps) {
78
- if (prevProps.array !== this.props.array) {
79
- this.setState({
80
- items: this.props.array,
81
- });
82
+ if (this.props.array) {
83
+ if (prevProps.array !== this.props.array) {
84
+ this.setState({
85
+ items: this.props.array,
86
+ });
87
+ }
82
88
  }
83
89
  };
84
90
  TableList.prototype.onDragEnd = function (result) {
@@ -92,24 +98,54 @@ var TableList = /** @class */ (function (_super) {
92
98
  return this.props.onDrag ?
93
99
  this.props.onDrag(result.source.index, result.destination.index) : null;
94
100
  };
101
+ TableList.prototype.dropDown = function () {
102
+ return (React.createElement(Dropdown_1.Dropdown, { items: this.props.itemsDropdown ? this.props.itemsDropdown() : [] },
103
+ React.createElement(Button_1.Button, { type: "primary", icon: "plus-large", text: "Add item", size: "small", shape: "round", iconOnly: true, onClick: function () { return false; } })));
104
+ };
95
105
  TableList.prototype.render = function () {
96
106
  var _a;
97
107
  var _this = this;
98
- var classes = (0, classnames_1.default)((_a = {
99
- 'table-list': !this.props.addItem
108
+ var classes = (0, classnames_1.default)('', (_a = {
109
+ 'table-list': !this.props.addItem,
110
+ 'table-list--read-only': this.props.readOnly
100
111
  },
101
112
  _a["".concat(this.props.className)] = this.props.className,
102
113
  _a));
103
- return (this.props.array ?
104
- this.props.dragAndDrop ?
105
- React.createElement(react_beautiful_dnd_1.DragDropContext, { onDragEnd: this.onDragEnd },
106
- React.createElement(react_beautiful_dnd_1.Droppable, { droppableId: "droppable" }, function (provided, _snapshot) { return (React.createElement("ul", __assign({ className: classes, ref: provided.innerRef }, provided.droppableProps),
107
- _this.state.items.map(function (item, index) { return (React.createElement(react_beautiful_dnd_1.Draggable, { key: index, draggableId: "".concat(index), index: index }, function (provided2, _snapshot2) { return (React.createElement("div", __assign({ ref: provided2.innerRef }, provided2.draggableProps, provided2.dragHandleProps),
108
- React.createElement(TableListItem, { dragAndDrop: _this.props.dragAndDrop, start: item.start, center: item.center, end: item.end, action: item.action, onClick: item.onClick ? item.onClick : undefined, addItem: _this.props.addItem, itemsDropdown: _this.props.itemsDropdown }))); })); }),
109
- provided.placeholder)); }))
110
- : React.createElement("ul", { className: classes }, this.state.items.map(function (item, index) { return (React.createElement(TableListItem, { key: index, start: item.start, center: item.center, end: item.end, action: item.action, onClick: item.onClick ? item.onClick : undefined, addItem: _this.props.addItem, itemsDropdown: _this.props.itemsDropdown })); }))
111
- : this.props.children &&
112
- React.createElement("ul", { className: classes }, this.props.children));
114
+ return (this.state.items.length > 0
115
+ ? this.props.dragAndDrop
116
+ ? React.createElement(react_beautiful_dnd_1.DragDropContext, { onDragEnd: this.onDragEnd },
117
+ React.createElement(react_beautiful_dnd_1.Droppable, { droppableId: "droppable" }, function (provided, _snapshot) { return (React.createElement("div", __assign({ role: 'list', className: classes, ref: provided.innerRef }, provided.droppableProps),
118
+ _this.state.items.map(function (item, index) { return (React.createElement(react_beautiful_dnd_1.Draggable, { key: index, draggableId: "".concat(index), index: index }, function (provided2, snapshot) { return (_this.props.append
119
+ ? React.createElement(PortalItem, { provided: provided2, snapshot: snapshot, item: item, index: index, dragAndDrop: _this.props.dragAndDrop, showDragHandle: _this.props.showDragHandle, addItem: _this.props.addItem, onAddItem: function () { return _this.props.onAddItem
120
+ && _this.props.onAddItem(index, item); }, itemsDropdown: function () { return _this.props.itemsDropdown
121
+ ? _this.props.itemsDropdown(index)
122
+ : []; } })
123
+ : React.createElement("div", __assign({ ref: provided2.innerRef }, provided2.draggableProps, provided2.dragHandleProps),
124
+ React.createElement(TableListItem, { dragAndDrop: _this.props.dragAndDrop, start: item.start, center: item.center, end: item.end, action: item.action, onClick: item.onClick ? item.onClick : undefined, onDoubleClick: item.onDoubleClick
125
+ ? item.onDoubleClick
126
+ : undefined, addItem: _this.props.addItem, itemsDropdown: function () { return _this.props.itemsDropdown
127
+ ? _this.props.itemsDropdown(index)
128
+ : []; }, hexColor: item.hexColor, locked: item.locked, positionLocked: item.positionLocked, onAddItem: function () { return _this.props.onAddItem
129
+ && _this.props.onAddItem(index, item); }, showDragHandle: _this.props.showDragHandle }))); })); }),
130
+ provided.placeholder,
131
+ (_this.props.addItem && !_this.props.readOnly) &&
132
+ React.createElement("div", { className: "table-list__add-item table-list__item--margin" },
133
+ React.createElement(Tooltip_1.Tooltip, { text: 'Add item', flow: 'top', appendToBody: true },
134
+ React.createElement("div", { className: 'table-list__add-item--container sd-margin-x--auto' }, _this.dropDown()))))); }))
135
+ : React.createElement("div", { role: 'list', className: classes },
136
+ this.state.items.map(function (item, index) { return (React.createElement(TableListItem, { key: index, start: item.start, center: item.center, end: item.end, action: item.action, onClick: item.onClick ? item.onClick : undefined, onDoubleClick: item.onDoubleClick
137
+ ? item.onDoubleClick
138
+ : undefined, addItem: _this.props.addItem, itemsDropdown: function () { return _this.props.itemsDropdown ? _this.props.itemsDropdown(index) : []; }, hexColor: item.hexColor, locked: item.locked, positionLocked: item.positionLocked, onAddItem: function () { return _this.props.onAddItem
139
+ && _this.props.onAddItem(index, item); } })); }),
140
+ (this.props.addItem && !this.props.readOnly) &&
141
+ React.createElement("div", { className: "table-list__add-item table-list__item--margin" },
142
+ React.createElement(Tooltip_1.Tooltip, { text: 'Add item', flow: 'top', appendToBody: true },
143
+ React.createElement("div", { className: 'table-list__add-item--container sd-margin-x--auto' }, this.dropDown()))))
144
+ : (this.props.addItem && !this.props.readOnly) ? React.createElement("div", { role: 'list', className: classes },
145
+ React.createElement("div", { className: "table-list__add-item table-list__item--margin" },
146
+ React.createElement(Tooltip_1.Tooltip, { text: 'Add item', flow: 'top', appendToBody: true },
147
+ React.createElement("div", { className: 'table-list__add-item--container sd-margin-x--auto' }, this.dropDown()))))
148
+ : null);
113
149
  };
114
150
  return TableList;
115
151
  }(React.PureComponent));
@@ -117,29 +153,96 @@ exports.TableList = TableList;
117
153
  var TableListItem = /** @class */ (function (_super) {
118
154
  __extends(TableListItem, _super);
119
155
  function TableListItem() {
120
- return _super !== null && _super.apply(this, arguments) || this;
156
+ var _this = _super !== null && _super.apply(this, arguments) || this;
157
+ _this.delay = 200;
158
+ _this.prevent = false;
159
+ _this.onSingleClick = function () {
160
+ var selection = window.getSelection();
161
+ _this.timer = setTimeout(function () {
162
+ if (!_this.prevent && _this.props.onClick && selection) {
163
+ if (_this.props.dragAndDrop) {
164
+ _this.props.onClick();
165
+ }
166
+ else {
167
+ if (selection.toString().length < 1) {
168
+ _this.props.onClick();
169
+ }
170
+ }
171
+ }
172
+ }, _this.delay);
173
+ };
174
+ _this.onDoubleClick = function () {
175
+ clearTimeout(_this.timer);
176
+ _this.prevent = true;
177
+ if (_this.props.onDoubleClick) {
178
+ _this.props.onDoubleClick();
179
+ }
180
+ setTimeout(function () {
181
+ _this.prevent = false;
182
+ }, _this.delay);
183
+ };
184
+ _this.onActionMenuClick = function (event) {
185
+ event.preventDefault();
186
+ event.stopPropagation();
187
+ };
188
+ return _this;
121
189
  }
122
190
  TableListItem.prototype.render = function () {
191
+ var _this = this;
192
+ var classes = (0, classnames_1.default)('table-list__item', {
193
+ 'table-list__item--clickable': this.props.onClick,
194
+ 'table-list__item--draggable': this.props.dragAndDrop,
195
+ 'table-list__item--locked': this.props.locked,
196
+ 'table-list__item--position-locked': this.props.positionLocked,
197
+ 'table-list__item--drag-handles-always': !this.props.showDragHandle,
198
+ 'table-list__item--drag-handles-none': this.props.showDragHandle === 'none',
199
+ });
123
200
  return (this.props.addItem ?
124
- React.createElement("li", { className: 'table-list__item-container' },
125
- React.createElement("div", { onClick: this.props.onClick, className: "table-list__item ".concat(this.props.onClick && 'table-list__item--clickable', " ").concat(this.props.dragAndDrop && 'table-list__item--draggable') },
201
+ React.createElement("div", { className: 'table-list__item-container' },
202
+ React.createElement("div", { role: 'listitem', onClick: function () { return _this.onSingleClick(); }, onDoubleClick: function () { return _this.onDoubleClick(); }, className: classes },
203
+ React.createElement("div", { className: 'table-list__item-border', style: { backgroundColor: this.props.hexColor } }),
126
204
  React.createElement("div", { className: 'table-list__item-content' },
127
205
  React.createElement("div", { className: 'table-list__item-content-block' }, this.props.start && this.props.start),
128
206
  React.createElement("div", { className: 'table-list__item-content-block table-list__item-content-block--center' }, this.props.center && this.props.center),
129
207
  React.createElement("div", { className: 'table-list__item-content-block' }, this.props.end && this.props.end)),
130
- this.props.action && React.createElement("div", { className: 'table-list__slide-in-actions' }, this.props.action)),
208
+ this.props.action &&
209
+ React.createElement("div", { className: 'table-list__slide-in-actions', onClick: this.onActionMenuClick }, this.props.action)),
131
210
  React.createElement("div", { className: 'table-list__add-bar-container' },
132
211
  React.createElement(Tooltip_1.Tooltip, { text: 'Add item', flow: 'top', appendToBody: true },
133
212
  React.createElement("div", { className: 'table-list__add-bar' },
134
- React.createElement(Dropdown_1.Dropdown, { items: this.props.itemsDropdown },
213
+ React.createElement(Dropdown_1.Dropdown, { onChange: this.props.onAddItem, items: this.props.itemsDropdown ? this.props.itemsDropdown() : [] },
135
214
  React.createElement(Button_1.Button, { type: "primary", icon: "plus-large", text: "Add item", size: "small", shape: "round", iconOnly: true, onClick: function () { return false; } }))))))
136
- : React.createElement("li", { className: "table-list__item ".concat(this.props.onClick && 'table-list__item--clickable', " ").concat(this.props.dragAndDrop && 'table-list__item--draggable', " table-list__item--margin"), onClick: this.props.onClick },
215
+ : React.createElement("div", { role: 'listitem', className: "".concat(classes, " table-list__item--margin"), onClick: function () { return _this.onSingleClick(); }, onDoubleClick: function () { return _this.onDoubleClick(); } },
216
+ React.createElement("div", { className: 'table-list__item-border', style: { backgroundColor: this.props.hexColor } }),
137
217
  React.createElement("div", { className: 'table-list__item-content' },
138
218
  React.createElement("div", { className: 'table-list__item-content-block' }, this.props.start && this.props.start),
139
219
  React.createElement("div", { className: 'table-list__item-content-block table-list__item-content-block--center' }, this.props.center && this.props.center),
140
220
  React.createElement("div", { className: 'table-list__item-content-block' }, this.props.end && this.props.end)),
141
- this.props.action && React.createElement("div", { className: 'table-list__slide-in-actions' }, this.props.action)));
221
+ this.props.action &&
222
+ React.createElement("div", { className: 'table-list__slide-in-actions', onClick: this.onActionMenuClick }, this.props.action)));
142
223
  };
143
224
  return TableListItem;
144
225
  }(React.PureComponent));
145
226
  exports.TableListItem = TableListItem;
227
+ var PortalItem = /** @class */ (function (_super) {
228
+ __extends(PortalItem, _super);
229
+ function PortalItem() {
230
+ return _super !== null && _super.apply(this, arguments) || this;
231
+ }
232
+ PortalItem.prototype.render = function () {
233
+ var _this = this;
234
+ var provided = this.props.provided;
235
+ var snapshot = this.props.snapshot;
236
+ var usePortal = snapshot.isDragging;
237
+ var child = (React.createElement("div", __assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps),
238
+ React.createElement(TableListItem, { dragAndDrop: this.props.dragAndDrop, start: this.props.item.start, center: this.props.item.center, end: this.props.item.end, action: this.props.item.action, onClick: this.props.item.onClick ? this.props.item.onClick : undefined, onDoubleClick: this.props.item.onDoubleClick
239
+ ? this.props.item.onDoubleClick
240
+ : undefined, addItem: this.props.addItem, itemsDropdown: this.props.itemsDropdown, hexColor: this.props.item.hexColor, locked: this.props.item.locked, positionLocked: this.props.item.positionLocked, onAddItem: function () { return _this.props.onAddItem; }, showDragHandle: this.props.showDragHandle })));
241
+ if (!usePortal) {
242
+ return child;
243
+ }
244
+ // if dragging - put the item in a portal
245
+ return react_dom_1.default.createPortal(child, document.body);
246
+ };
247
+ return PortalItem;
248
+ }(React.PureComponent));
@@ -104,7 +104,7 @@ var Menu = /** @class */ (function (_super) {
104
104
  Menu.prototype.render = function () {
105
105
  var _this = this;
106
106
  var _a;
107
- return (React.createElement("div", null,
107
+ return (React.createElement(React.Fragment, null,
108
108
  this.props.children(this.toggle),
109
109
  React.createElement("div", { onKeyDown: function (event) {
110
110
  if (event.key === 'Escape') {
@@ -7,7 +7,9 @@ interface IProps {
7
7
  contentBg?: 'default' | 'medium' | 'dark';
8
8
  contentPadding?: 'none' | 'small' | 'medium' | 'large';
9
9
  size?: 'small' | 'medium' | 'large' | 'x-large';
10
+ position?: "center" | "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
10
11
  maximized?: boolean;
12
+ maximizable?: boolean;
11
13
  headerTemplate?: JSX.Element | string;
12
14
  footerTemplate?: JSX.Element | string;
13
15
  closeOnEscape?: boolean;
@@ -50,13 +50,13 @@ var Modal = /** @class */ (function (_super) {
50
50
  var _a;
51
51
  var classes = (0, classnames_1.default)((_a = {},
52
52
  _a["p-dialog-content--".concat(this.props.size)] = this.props.size,
53
- _a['p-dialog-content--default'] = this.props.contentBg === undefined,
54
- _a["p-dialog-content--".concat(this.props.contentBg)] = this.props.contentBg,
53
+ _a['p-dialog-content-bg--default'] = this.props.contentBg === undefined,
54
+ _a["p-dialog-content-bg--".concat(this.props.contentBg)] = this.props.contentBg,
55
55
  _a['p-dialog-content--s-padding'] = this.props.contentPadding === undefined,
56
56
  _a["p-dialog-content--".concat(this.props.contentPadding)] = this.props.contentPadding,
57
57
  _a), this.props.className);
58
58
  return (React.createElement("div", { style: { display: 'content' }, "data-theme": this.props.theme !== 'dark' ? null : 'dark-ui' },
59
- React.createElement(dialog_1.Dialog, { id: this.props.id, visible: this.props.visible, header: this.props.headerTemplate, footer: this.props.footerTemplate, closeOnEscape: this.props.closeOnEscape, maximized: this.props.maximized, contentClassName: classes, onShow: this.props.onShow, onHide: this.props.onHide, zIndex: this.props.zIndex }, this.props.children)));
59
+ React.createElement(dialog_1.Dialog, { id: this.props.id, visible: this.props.visible, header: this.props.headerTemplate, footer: this.props.footerTemplate, closeOnEscape: this.props.closeOnEscape, maximized: this.props.maximized, maximizable: this.props.maximizable, contentClassName: classes, onShow: this.props.onShow, onHide: this.props.onHide, zIndex: this.props.zIndex, position: this.props.position && this.props.position }, this.props.children)));
60
60
  };
61
61
  return Modal;
62
62
  }(React.Component));
@@ -0,0 +1,40 @@
1
+ import * as React from "react";
2
+ interface IProps<T> {
3
+ value: Array<T>;
4
+ options: Array<T>;
5
+ placeholder?: string;
6
+ optionLabel: string;
7
+ emptyFilterMessage?: string;
8
+ filterPlaceholder?: string;
9
+ maxSelectedLabels?: number;
10
+ selectedItemsLabel?: string;
11
+ ariaLabelledBy?: string;
12
+ tabIndex?: string | any;
13
+ filter?: boolean;
14
+ showClear?: boolean;
15
+ showSelectAll?: boolean;
16
+ itemTemplate?(item: any): JSX.Element | undefined;
17
+ selectedItemTemplate?(value: any): JSX.Element | undefined;
18
+ onChange(newValue: Array<T>): void;
19
+ invalid?: boolean;
20
+ inlineLabel?: boolean;
21
+ labelHidden?: boolean;
22
+ tabindex?: number;
23
+ fullWidth?: boolean;
24
+ info?: string;
25
+ error?: string;
26
+ required?: boolean;
27
+ label?: string;
28
+ disabled?: boolean;
29
+ }
30
+ interface IState<T> {
31
+ options: Array<T>;
32
+ value: Array<T>;
33
+ invalid: boolean;
34
+ }
35
+ export declare class MultiSelect<T> extends React.Component<IProps<T>, IState<T>> {
36
+ private htmlId;
37
+ constructor(props: IProps<T>);
38
+ render(): JSX.Element;
39
+ }
40
+ export {};
@@ -0,0 +1,73 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.MultiSelect = void 0;
41
+ var React = __importStar(require("react"));
42
+ var multiselect_1 = require("@superdesk/primereact/multiselect");
43
+ var classnames_1 = __importDefault(require("classnames"));
44
+ var react_id_generator_1 = __importDefault(require("react-id-generator"));
45
+ var Form_1 = require("./Form");
46
+ var MultiSelect = /** @class */ (function (_super) {
47
+ __extends(MultiSelect, _super);
48
+ function MultiSelect(props) {
49
+ var _this = _super.call(this, props) || this;
50
+ _this.htmlId = (0, react_id_generator_1.default)();
51
+ _this.state = {
52
+ value: [],
53
+ options: [],
54
+ invalid: _this.props.invalid ? _this.props.invalid : false,
55
+ };
56
+ return _this;
57
+ }
58
+ MultiSelect.prototype.render = function () {
59
+ var _this = this;
60
+ var _a;
61
+ var classes = (0, classnames_1.default)({
62
+ 'showSelectAll': this.props.showSelectAll,
63
+ 'showFilter': this.props.filter,
64
+ });
65
+ return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.state.invalid, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
66
+ React.createElement(multiselect_1.MultiSelect, { panelClassName: classes, value: this.props.value, options: this.props.options, onChange: function (_a) {
67
+ var value = _a.value;
68
+ return _this.props.onChange(value);
69
+ }, display: "chip", filter: this.props.filter, filterBy: this.props.optionLabel, appendTo: document.body, placeholder: this.props.placeholder, optionLabel: this.props.optionLabel, emptyFilterMessage: this.props.emptyFilterMessage, filterPlaceholder: this.props.filterPlaceholder, itemTemplate: this.props.itemTemplate, selectedItemTemplate: this.props.selectedItemTemplate, maxSelectedLabels: (_a = this.props.maxSelectedLabels) !== null && _a !== void 0 ? _a : 4, selectedItemsLabel: this.props.selectedItemsLabel, ariaLabelledBy: this.htmlId + 'label', tabIndex: this.props.tabIndex ? this.props.tabIndex : '0', showClear: this.props.showClear, disabled: this.props.disabled, inputId: this.htmlId })));
70
+ };
71
+ return MultiSelect;
72
+ }(React.Component));
73
+ exports.MultiSelect = MultiSelect;
@@ -5,7 +5,7 @@ interface IProps {
5
5
  text?: string;
6
6
  iconSize?: 'small' | 'big';
7
7
  theme?: 'light' | 'dark';
8
- type?: 'default' | 'primary' | 'highlight' | 'darker';
8
+ type?: 'default' | 'primary' | 'highlight' | 'darker' | 'dark';
9
9
  state?: 'normal' | 'active';
10
10
  value?: 'button' | 'submit' | 'reset';
11
11
  onClick(): void;
@@ -2,20 +2,26 @@ import * as React from 'react';
2
2
  interface IProps {
3
3
  items: Array<IItem | 'divider'>;
4
4
  side?: 'none' | 'left' | 'right';
5
+ hover?: boolean;
6
+ onCLick?(): void;
5
7
  }
6
8
  interface IItem {
7
9
  icon: string;
8
10
  size: 'small' | 'big';
9
11
  tooltip?: string;
10
12
  active?: boolean;
13
+ hover?: boolean;
14
+ onCLick?(): void;
11
15
  }
12
16
  interface IState {
13
17
  index: number;
14
18
  closeIndex: number;
19
+ hover: boolean;
15
20
  }
16
21
  export declare class SideBarMenu extends React.PureComponent<IProps, IState> {
17
22
  constructor(props: IProps);
18
23
  handleClick(indexNumber: number): void;
24
+ handleArrows(): void;
19
25
  render(): JSX.Element;
20
26
  }
21
27
  export {};
@@ -44,8 +44,10 @@ var SideBarMenu = /** @class */ (function (_super) {
44
44
  _this.state = {
45
45
  index: -1,
46
46
  closeIndex: -1,
47
+ hover: _this.props.hover ? _this.props.hover : false,
47
48
  };
48
49
  _this.handleClick = _this.handleClick.bind(_this);
50
+ _this.handleArrows = _this.handleArrows.bind(_this);
49
51
  return _this;
50
52
  }
51
53
  SideBarMenu.prototype.handleClick = function (indexNumber) {
@@ -58,6 +60,11 @@ var SideBarMenu = /** @class */ (function (_super) {
58
60
  });
59
61
  }
60
62
  };
63
+ SideBarMenu.prototype.handleArrows = function () {
64
+ this.setState({
65
+ hover: !this.state.hover,
66
+ });
67
+ };
61
68
  SideBarMenu.prototype.render = function () {
62
69
  var _this = this;
63
70
  return (React.createElement("div", { className: 'sd-sidebar-menu sd-content-wrapper__left-tabs' },
@@ -66,8 +73,18 @@ var SideBarMenu = /** @class */ (function (_super) {
66
73
  return (React.createElement("li", { key: index, className: 'sd-sidebar-menu__spacer' }));
67
74
  }
68
75
  else {
69
- return (React.createElement("li", { key: index, "data-sd-tooltip": item['tooltip'], "data-flow": 'right' },
70
- React.createElement("a", { className: 'sd-sidebar-menu__btn' + (index === _this.state.closeIndex ? ' sd-sidebar-menu__btn--closed ' : '') + (item['active'] ? ' sd-sidebar-menu__btn--active' : (index === _this.state.index ? ' sd-sidebar-menu__btn--active' : '')), onClick: function () { return _this.handleClick(index); } },
76
+ return (React.createElement("li", { key: index, "data-sd-tooltip": item['tooltip'], "data-flow": 'right', className: item.hover ? 'authoring-active__item' : '' },
77
+ React.createElement("a", { className: 'sd-sidebar-menu__btn'
78
+ + (_this.state.hover ? ' sd-sidebar-menu__btn--closed ' : '')
79
+ + (item['active'] ? ' sd-sidebar-menu__btn--active' : (index === _this.state.index ? ' sd-sidebar-menu__btn--active' : '')), onClick: function () {
80
+ _this.handleClick(index);
81
+ if (item.hover) {
82
+ _this.handleArrows();
83
+ if (item.onCLick) {
84
+ item.onCLick();
85
+ }
86
+ }
87
+ } },
71
88
  React.createElement("span", { className: 'sd-sidebar-menu__main-icon ' },
72
89
  React.createElement(Icon_1.Icon, { size: item['size'], name: item['icon'] })),
73
90
  React.createElement("i", { className: 'sd-sidebar-menu__helper-icon big-icon--chevron-left' }))));
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  interface IProps {
3
- value?: string | number;
3
+ value?: string;
4
4
  type?: 'expanded' | 'collapsed' | 'boxed';
5
5
  placeholder: string;
6
6
  focused?: boolean;