@interopio/groups-ui-react 2.4.0 → 2.4.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.
@@ -6,6 +6,11 @@ export interface ChannelProps {
6
6
  selectedChannel: string;
7
7
  showSelector: (bounds: Bounds) => void;
8
8
  selectedChannelColor: string;
9
+ channelRestrictions: {
10
+ read: boolean;
11
+ write: boolean;
12
+ };
13
+ channelLabel: string;
9
14
  }
10
15
  export interface FrameWindowOverlayProps {
11
16
  frameId: string;
@@ -54,16 +54,28 @@ export interface BaseChannelSelectorProps {
54
54
  contentClass: string;
55
55
  selectedChannel: string;
56
56
  selectedChannelColor: string;
57
+ direction: string;
58
+ channelLabel: string;
57
59
  }
58
60
  export interface FlatChannelSelectorProps {
59
61
  showSelector: (bounds: Bounds) => void;
60
62
  selectedChannel: string;
61
63
  selectedChannelColor: string;
64
+ channelRestrictions: {
65
+ read: boolean;
66
+ write: boolean;
67
+ };
68
+ channelLabel: string;
62
69
  }
63
70
  export interface TabChannelSelectorProps {
64
71
  showSelector: (bounds: Bounds) => void;
65
72
  selectedChannel: string;
66
73
  selectedChannelColor: string;
74
+ channelRestrictions: {
75
+ read: boolean;
76
+ write: boolean;
77
+ };
78
+ channelLabel: string;
67
79
  }
68
80
  export interface FlatCaptionEditorProps {
69
81
  frameId: string;
@@ -102,6 +102,11 @@ export interface CreateFrameCaptionBarRequestOptions extends CreateButtonsOption
102
102
  show: boolean;
103
103
  text?: string;
104
104
  };
105
+ channelRestrictions: {
106
+ read: boolean;
107
+ write: boolean;
108
+ };
109
+ channelLabel: string;
105
110
  }
106
111
  export interface CreateTabRequestOptions extends CreateElementRequestOptions {
107
112
  caption: string;
@@ -115,6 +120,11 @@ export interface CreateTabRequestOptions extends CreateElementRequestOptions {
115
120
  show: boolean;
116
121
  text?: string;
117
122
  };
123
+ channelRestrictions: {
124
+ read: boolean;
125
+ write: boolean;
126
+ };
127
+ channelLabel: string;
118
128
  }
119
129
  export interface UpdateStandardButtonRequestOptions extends CreateElementRequestOptions {
120
130
  buttonId: StandardButtons;
@@ -177,6 +187,8 @@ export interface CreateButtonsOptions extends CreateFrameElementRequestOptions {
177
187
  visible: boolean;
178
188
  };
179
189
  customButtons: UpdateCustomButtonOptions[];
190
+ hiddenTabsToTheLeft: OverflowedTabInfo[];
191
+ hiddenTabsToTheRight: OverflowedTabInfo[];
180
192
  }
181
193
  export interface RemoveRequestOptions {
182
194
  targetId: string;
@@ -1 +1,5 @@
1
1
  export declare function IsBlackReadable(color: string): boolean;
2
+ export declare function getChannelDirection(channelRestrictions: {
3
+ read: boolean;
4
+ write: boolean;
5
+ }): string;
package/dist/esm/index.js CHANGED
@@ -570,10 +570,30 @@ function IsBlackReadable(color) {
570
570
  console.error("Error while checking readable color for '" + color + "'", error);
571
571
  }
572
572
  return false;
573
+ }
574
+ function getChannelDirection(channelRestrictions) {
575
+ if (!channelRestrictions) {
576
+ return "";
577
+ }
578
+ if (typeof channelRestrictions.read === "boolean" && typeof channelRestrictions.write === "boolean") {
579
+ if (channelRestrictions.read && channelRestrictions.write) {
580
+ return "";
581
+ }
582
+ if (channelRestrictions.read) {
583
+ return "subscribe";
584
+ }
585
+ if (channelRestrictions.write) {
586
+ return "publish";
587
+ }
588
+ return "";
589
+ }
590
+ else {
591
+ return "";
592
+ }
573
593
  }
574
594
 
575
595
  var BaseChannelSelector = function (_a) {
576
- var outsideClass = _a.outsideClass, contentClass = _a.contentClass, showSelector = _a.showSelector, selectedChannel = _a.selectedChannel, selectedChannelColor = _a.selectedChannelColor;
596
+ var outsideClass = _a.outsideClass, contentClass = _a.contentClass, showSelector = _a.showSelector, selectedChannel = _a.selectedChannel, selectedChannelColor = _a.selectedChannelColor, direction = _a.direction, channelLabel = _a.channelLabel;
577
597
  var ref = useRef(null);
578
598
  var wrappedOnClick = function () {
579
599
  if (!ref.current) {
@@ -600,13 +620,15 @@ var BaseChannelSelector = function (_a) {
600
620
  var style = {
601
621
  background: selectedChannelColor
602
622
  };
603
- return React.createElement("div", { title: selectedChannel !== null && selectedChannel !== void 0 ? selectedChannel : "", ref: ref, style: style, onClick: wrappedOnClick, className: "t42-buttons " + outsideClass },
604
- React.createElement("div", { className: className }));
623
+ return React.createElement("div", { title: selectedChannel !== null && selectedChannel !== void 0 ? selectedChannel : "", ref: ref, style: style, onClick: wrappedOnClick, className: "t42-buttons " + outsideClass }, channelLabel ?
624
+ React.createElement("div", { className: className + " icon" },
625
+ channelLabel,
626
+ direction && React.createElement("i", { className: "icon-" + direction })) : React.createElement("div", { className: className }));
605
627
  };
606
628
 
607
629
  var FlatChannelSelector = function (_a) {
608
- var showSelector = _a.showSelector, selectedChannel = _a.selectedChannel, selectedChannelColor = _a.selectedChannelColor;
609
- return React.createElement(BaseChannelSelector, { outsideClass: "t42-frame-caption-bar-element t42-frame-channel-selector", contentClass: "t42-frame-channel-selector-content", showSelector: showSelector, selectedChannel: selectedChannel, selectedChannelColor: selectedChannelColor });
630
+ var showSelector = _a.showSelector, selectedChannel = _a.selectedChannel, selectedChannelColor = _a.selectedChannelColor, channelRestrictions = _a.channelRestrictions, channelLabel = _a.channelLabel;
631
+ return React.createElement(BaseChannelSelector, { outsideClass: channelLabel ? "t42-frame-caption-bar-element t42-frame-channel-selector t42-channel-selector-direction" : "t42-frame-caption-bar-element t42-frame-channel-selector", contentClass: !channelLabel ? "t42-frame-channel-selector-content" : "", showSelector: showSelector, selectedChannel: selectedChannel, selectedChannelColor: selectedChannelColor, direction: getChannelDirection(channelRestrictions), channelLabel: channelLabel });
610
632
  };
611
633
 
612
634
  var ExtractButton = function (_a) {
@@ -1764,7 +1786,7 @@ var FlatMoveArea = function (_a) {
1764
1786
  var FlatCaptionBar = function (_a) {
1765
1787
  var moveAreaId = _a.moveAreaId, caption = _a.caption, channels = _a.channels, captionEditor = _a.captionEditor, notifyCaptionBoundsChanged = _a.notifyCaptionBoundsChanged, rest = __rest(_a, ["moveAreaId", "caption", "channels", "captionEditor", "notifyCaptionBoundsChanged"]);
1766
1788
  return (React.createElement("div", { className: "t42-react-caption-bar" },
1767
- (channels === null || channels === void 0 ? void 0 : channels.visible) && React.createElement(FlatChannelSelector, { showSelector: channels === null || channels === void 0 ? void 0 : channels.showSelector, selectedChannel: channels === null || channels === void 0 ? void 0 : channels.selectedChannel, selectedChannelColor: channels === null || channels === void 0 ? void 0 : channels.selectedChannelColor }),
1789
+ (channels === null || channels === void 0 ? void 0 : channels.visible) && React.createElement(FlatChannelSelector, { showSelector: channels === null || channels === void 0 ? void 0 : channels.showSelector, selectedChannel: channels === null || channels === void 0 ? void 0 : channels.selectedChannel, selectedChannelColor: channels === null || channels === void 0 ? void 0 : channels.selectedChannelColor, channelRestrictions: channels === null || channels === void 0 ? void 0 : channels.channelRestrictions, channelLabel: channels === null || channels === void 0 ? void 0 : channels.channelLabel }),
1768
1790
  React.createElement(FlatMoveArea, { moveAreaId: moveAreaId }, captionEditor.show ? React.createElement(FlatCaptionEditor, __assign({}, captionEditor, { caption: captionEditor.text, frameId: rest.frameId })) : React.createElement(FlatCaption, { notifyBoundsChanged: notifyCaptionBoundsChanged, caption: caption })),
1769
1791
  React.createElement(FlatButtons, __assign({}, rest))));
1770
1792
  };
@@ -1805,8 +1827,8 @@ var GroupCaptionBar = function (_a) {
1805
1827
  };
1806
1828
 
1807
1829
  var TabChannelSelector = function (_a) {
1808
- var showSelector = _a.showSelector, selectedChannel = _a.selectedChannel, selectedChannelColor = _a.selectedChannelColor;
1809
- return React.createElement(BaseChannelSelector, { outsideClass: "t42-tab-bar-element t42-tab-channel-selector", contentClass: "t42-tab-channel-selector-content", showSelector: showSelector, selectedChannel: selectedChannel, selectedChannelColor: selectedChannelColor });
1830
+ var showSelector = _a.showSelector, selectedChannel = _a.selectedChannel, selectedChannelColor = _a.selectedChannelColor, channelRestrictions = _a.channelRestrictions, channelLabel = _a.channelLabel;
1831
+ return React.createElement(BaseChannelSelector, { outsideClass: channelLabel ? "t42-tab-bar-element t42-tab-channel-selector t42-channel-selector-direction" : "t42-tab-bar-element t42-tab-channel-selector", contentClass: !channelLabel ? "t42-tab-channel-selector-content" : "", showSelector: showSelector, selectedChannel: selectedChannel, selectedChannelColor: selectedChannelColor, direction: getChannelDirection(channelRestrictions), channelLabel: channelLabel });
1810
1832
  };
1811
1833
 
1812
1834
  var TabCaption = function (_a) {
@@ -3016,7 +3038,9 @@ var GroupElementCreationWrapper = function (_a) {
3016
3038
  showSelector: showSelector,
3017
3039
  visible: options.channelSelectorVisible,
3018
3040
  selectedChannel: options.selectedChannel,
3019
- selectedChannelColor: options.selectedChannelColor
3041
+ selectedChannelColor: options.selectedChannelColor,
3042
+ channelRestrictions: options.channelRestrictions,
3043
+ channelLabel: options.channelLabel
3020
3044
  };
3021
3045
  var captionEditor = __assign(__assign({}, options.captionEditor), { commitChanges: function (text) {
3022
3046
  webGroupsManager.commitCaptionEditing(TargetType.Frame, options.targetId, text);
@@ -3134,7 +3158,9 @@ var GroupElementCreationWrapper = function (_a) {
3134
3158
  showSelector: showSelector,
3135
3159
  visible: options.channelSelectorVisible,
3136
3160
  selectedChannel: options.selectedChannel,
3137
- selectedChannelColor: (_a = options.selectedChannelColor) !== null && _a !== void 0 ? _a : options.selectedChannel // TODO remove the null check when the variable has been added
3161
+ selectedChannelColor: (_a = options.selectedChannelColor) !== null && _a !== void 0 ? _a : options.selectedChannel,
3162
+ channelRestrictions: options.channelRestrictions,
3163
+ channelLabel: options.channelLabel
3138
3164
  };
3139
3165
  var captionEditor = __assign(__assign({}, options.captionEditor), { commitChanges: function (text) {
3140
3166
  webGroupsManager.commitCaptionEditing(TargetType.Tab, options.targetId, text);