@plusscommunities/pluss-core-web 1.4.24 → 1.4.25

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/dist/index.cjs.js CHANGED
@@ -8885,6 +8885,55 @@ var UserListing = /*#__PURE__*/function (_Component) {
8885
8885
  value: function getSize() {
8886
8886
  return this.props.size || 30;
8887
8887
  }
8888
+ }, {
8889
+ key: "getImage",
8890
+ value: function getImage() {
8891
+ if (this.props.user && this.props.user.profilePic) {
8892
+ return this.props.user.profilePic;
8893
+ }
8894
+
8895
+ if (this.props.image) {
8896
+ return this.props.image;
8897
+ }
8898
+
8899
+ return undefined;
8900
+ }
8901
+ }, {
8902
+ key: "getKey",
8903
+ value: function getKey() {
8904
+ if (this.props.user && this.props.user.id) {
8905
+ return this.props.user.id;
8906
+ }
8907
+
8908
+ return this.props.id;
8909
+ }
8910
+ }, {
8911
+ key: "getText",
8912
+ value: function getText() {
8913
+ if (this.props.user && this.props.user.displayName) {
8914
+ return this.props.user.displayName;
8915
+ }
8916
+
8917
+ return this.props.title;
8918
+ }
8919
+ }, {
8920
+ key: "getBorderRadius",
8921
+ value: function getBorderRadius() {
8922
+ if (this.props.squareImage) {
8923
+ return 4;
8924
+ }
8925
+
8926
+ return this.getSize() / 2;
8927
+ }
8928
+ }, {
8929
+ key: "isLoading",
8930
+ value: function isLoading() {
8931
+ if (this.props.user && this.props.user.loading) {
8932
+ return this.props.user && this.props.user.loading;
8933
+ }
8934
+
8935
+ return this.props.isLoading;
8936
+ }
8888
8937
  }, {
8889
8938
  key: "renderRight",
8890
8939
  value: function renderRight() {
@@ -8903,25 +8952,45 @@ var UserListing = /*#__PURE__*/function (_Component) {
8903
8952
 
8904
8953
  return this.props.subContent;
8905
8954
  }
8955
+ }, {
8956
+ key: "renderImage",
8957
+ value: function renderImage() {
8958
+ if (this.props.squareImage) {
8959
+ return /*#__PURE__*/React__default['default'].createElement("div", {
8960
+ style: {
8961
+ height: this.getSize(),
8962
+ width: this.getSize(),
8963
+ borderRadius: this.getBorderRadius(),
8964
+ marginRight: 8,
8965
+ backgroundSize: 'cover',
8966
+ backgroundPosition: 'center',
8967
+ backgroundImage: "url(".concat(this.getImage(), ")")
8968
+ },
8969
+ alt: "".concat(this.getText(), " Image")
8970
+ });
8971
+ }
8972
+
8973
+ return /*#__PURE__*/React__default['default'].createElement(ProfilePic, {
8974
+ size: this.getSize(),
8975
+ className: "userListing_profilePic",
8976
+ image: this.getImage()
8977
+ });
8978
+ }
8906
8979
  }, {
8907
8980
  key: "render",
8908
8981
  value: function render() {
8909
8982
  return /*#__PURE__*/React__default['default'].createElement("div", {
8910
- key: this.props.user.userId || this.props.user.Id || this.props.user.id,
8983
+ key: this.getKey(),
8911
8984
  className: "userListing",
8912
8985
  style: {
8913
8986
  minHeight: this.getSize() + 5,
8914
8987
  cursor: this.props.onClick ? 'pointer' : 'inherit',
8915
- opacity: this.props.user && this.props.user.loading ? 0.5 : 1
8988
+ opacity: this.isLoading() ? 0.5 : 1
8916
8989
  },
8917
8990
  onClick: this.props.onClick
8918
8991
  }, /*#__PURE__*/React__default['default'].createElement("div", {
8919
8992
  className: "userListing_inner"
8920
- }, /*#__PURE__*/React__default['default'].createElement(ProfilePic, {
8921
- size: this.getSize(),
8922
- className: "userListing_profilePic",
8923
- image: this.props.user.profilePic
8924
- }), /*#__PURE__*/React__default['default'].createElement("div", {
8993
+ }, this.renderImage(), /*#__PURE__*/React__default['default'].createElement("div", {
8925
8994
  className: "userListing_middle",
8926
8995
  style: {
8927
8996
  height: this.getSize()
@@ -8932,7 +9001,7 @@ var UserListing = /*#__PURE__*/function (_Component) {
8932
9001
  color: '#fff'
8933
9002
  } : null,
8934
9003
  className: this.props.textClass
8935
- }, this.props.user.displayName), this.renderSub())), this.renderRight());
9004
+ }, this.getText()), this.renderSub())), this.renderRight());
8936
9005
  }
8937
9006
  }]);
8938
9007
 
package/dist/index.esm.js CHANGED
@@ -8855,6 +8855,55 @@ var UserListing = /*#__PURE__*/function (_Component) {
8855
8855
  value: function getSize() {
8856
8856
  return this.props.size || 30;
8857
8857
  }
8858
+ }, {
8859
+ key: "getImage",
8860
+ value: function getImage() {
8861
+ if (this.props.user && this.props.user.profilePic) {
8862
+ return this.props.user.profilePic;
8863
+ }
8864
+
8865
+ if (this.props.image) {
8866
+ return this.props.image;
8867
+ }
8868
+
8869
+ return undefined;
8870
+ }
8871
+ }, {
8872
+ key: "getKey",
8873
+ value: function getKey() {
8874
+ if (this.props.user && this.props.user.id) {
8875
+ return this.props.user.id;
8876
+ }
8877
+
8878
+ return this.props.id;
8879
+ }
8880
+ }, {
8881
+ key: "getText",
8882
+ value: function getText() {
8883
+ if (this.props.user && this.props.user.displayName) {
8884
+ return this.props.user.displayName;
8885
+ }
8886
+
8887
+ return this.props.title;
8888
+ }
8889
+ }, {
8890
+ key: "getBorderRadius",
8891
+ value: function getBorderRadius() {
8892
+ if (this.props.squareImage) {
8893
+ return 4;
8894
+ }
8895
+
8896
+ return this.getSize() / 2;
8897
+ }
8898
+ }, {
8899
+ key: "isLoading",
8900
+ value: function isLoading() {
8901
+ if (this.props.user && this.props.user.loading) {
8902
+ return this.props.user && this.props.user.loading;
8903
+ }
8904
+
8905
+ return this.props.isLoading;
8906
+ }
8858
8907
  }, {
8859
8908
  key: "renderRight",
8860
8909
  value: function renderRight() {
@@ -8873,25 +8922,45 @@ var UserListing = /*#__PURE__*/function (_Component) {
8873
8922
 
8874
8923
  return this.props.subContent;
8875
8924
  }
8925
+ }, {
8926
+ key: "renderImage",
8927
+ value: function renderImage() {
8928
+ if (this.props.squareImage) {
8929
+ return /*#__PURE__*/React.createElement("div", {
8930
+ style: {
8931
+ height: this.getSize(),
8932
+ width: this.getSize(),
8933
+ borderRadius: this.getBorderRadius(),
8934
+ marginRight: 8,
8935
+ backgroundSize: 'cover',
8936
+ backgroundPosition: 'center',
8937
+ backgroundImage: "url(".concat(this.getImage(), ")")
8938
+ },
8939
+ alt: "".concat(this.getText(), " Image")
8940
+ });
8941
+ }
8942
+
8943
+ return /*#__PURE__*/React.createElement(ProfilePic, {
8944
+ size: this.getSize(),
8945
+ className: "userListing_profilePic",
8946
+ image: this.getImage()
8947
+ });
8948
+ }
8876
8949
  }, {
8877
8950
  key: "render",
8878
8951
  value: function render() {
8879
8952
  return /*#__PURE__*/React.createElement("div", {
8880
- key: this.props.user.userId || this.props.user.Id || this.props.user.id,
8953
+ key: this.getKey(),
8881
8954
  className: "userListing",
8882
8955
  style: {
8883
8956
  minHeight: this.getSize() + 5,
8884
8957
  cursor: this.props.onClick ? 'pointer' : 'inherit',
8885
- opacity: this.props.user && this.props.user.loading ? 0.5 : 1
8958
+ opacity: this.isLoading() ? 0.5 : 1
8886
8959
  },
8887
8960
  onClick: this.props.onClick
8888
8961
  }, /*#__PURE__*/React.createElement("div", {
8889
8962
  className: "userListing_inner"
8890
- }, /*#__PURE__*/React.createElement(ProfilePic, {
8891
- size: this.getSize(),
8892
- className: "userListing_profilePic",
8893
- image: this.props.user.profilePic
8894
- }), /*#__PURE__*/React.createElement("div", {
8963
+ }, this.renderImage(), /*#__PURE__*/React.createElement("div", {
8895
8964
  className: "userListing_middle",
8896
8965
  style: {
8897
8966
  height: this.getSize()
@@ -8902,7 +8971,7 @@ var UserListing = /*#__PURE__*/function (_Component) {
8902
8971
  color: '#fff'
8903
8972
  } : null,
8904
8973
  className: this.props.textClass
8905
- }, this.props.user.displayName), this.renderSub())), this.renderRight());
8974
+ }, this.getText()), this.renderSub())), this.renderRight());
8906
8975
  }
8907
8976
  }]);
8908
8977
 
package/dist/index.umd.js CHANGED
@@ -8853,6 +8853,55 @@
8853
8853
  value: function getSize() {
8854
8854
  return this.props.size || 30;
8855
8855
  }
8856
+ }, {
8857
+ key: "getImage",
8858
+ value: function getImage() {
8859
+ if (this.props.user && this.props.user.profilePic) {
8860
+ return this.props.user.profilePic;
8861
+ }
8862
+
8863
+ if (this.props.image) {
8864
+ return this.props.image;
8865
+ }
8866
+
8867
+ return undefined;
8868
+ }
8869
+ }, {
8870
+ key: "getKey",
8871
+ value: function getKey() {
8872
+ if (this.props.user && this.props.user.id) {
8873
+ return this.props.user.id;
8874
+ }
8875
+
8876
+ return this.props.id;
8877
+ }
8878
+ }, {
8879
+ key: "getText",
8880
+ value: function getText() {
8881
+ if (this.props.user && this.props.user.displayName) {
8882
+ return this.props.user.displayName;
8883
+ }
8884
+
8885
+ return this.props.title;
8886
+ }
8887
+ }, {
8888
+ key: "getBorderRadius",
8889
+ value: function getBorderRadius() {
8890
+ if (this.props.squareImage) {
8891
+ return 4;
8892
+ }
8893
+
8894
+ return this.getSize() / 2;
8895
+ }
8896
+ }, {
8897
+ key: "isLoading",
8898
+ value: function isLoading() {
8899
+ if (this.props.user && this.props.user.loading) {
8900
+ return this.props.user && this.props.user.loading;
8901
+ }
8902
+
8903
+ return this.props.isLoading;
8904
+ }
8856
8905
  }, {
8857
8906
  key: "renderRight",
8858
8907
  value: function renderRight() {
@@ -8871,25 +8920,45 @@
8871
8920
 
8872
8921
  return this.props.subContent;
8873
8922
  }
8923
+ }, {
8924
+ key: "renderImage",
8925
+ value: function renderImage() {
8926
+ if (this.props.squareImage) {
8927
+ return /*#__PURE__*/React__default['default'].createElement("div", {
8928
+ style: {
8929
+ height: this.getSize(),
8930
+ width: this.getSize(),
8931
+ borderRadius: this.getBorderRadius(),
8932
+ marginRight: 8,
8933
+ backgroundSize: 'cover',
8934
+ backgroundPosition: 'center',
8935
+ backgroundImage: "url(".concat(this.getImage(), ")")
8936
+ },
8937
+ alt: "".concat(this.getText(), " Image")
8938
+ });
8939
+ }
8940
+
8941
+ return /*#__PURE__*/React__default['default'].createElement(ProfilePic, {
8942
+ size: this.getSize(),
8943
+ className: "userListing_profilePic",
8944
+ image: this.getImage()
8945
+ });
8946
+ }
8874
8947
  }, {
8875
8948
  key: "render",
8876
8949
  value: function render() {
8877
8950
  return /*#__PURE__*/React__default['default'].createElement("div", {
8878
- key: this.props.user.userId || this.props.user.Id || this.props.user.id,
8951
+ key: this.getKey(),
8879
8952
  className: "userListing",
8880
8953
  style: {
8881
8954
  minHeight: this.getSize() + 5,
8882
8955
  cursor: this.props.onClick ? 'pointer' : 'inherit',
8883
- opacity: this.props.user && this.props.user.loading ? 0.5 : 1
8956
+ opacity: this.isLoading() ? 0.5 : 1
8884
8957
  },
8885
8958
  onClick: this.props.onClick
8886
8959
  }, /*#__PURE__*/React__default['default'].createElement("div", {
8887
8960
  className: "userListing_inner"
8888
- }, /*#__PURE__*/React__default['default'].createElement(ProfilePic, {
8889
- size: this.getSize(),
8890
- className: "userListing_profilePic",
8891
- image: this.props.user.profilePic
8892
- }), /*#__PURE__*/React__default['default'].createElement("div", {
8961
+ }, this.renderImage(), /*#__PURE__*/React__default['default'].createElement("div", {
8893
8962
  className: "userListing_middle",
8894
8963
  style: {
8895
8964
  height: this.getSize()
@@ -8900,7 +8969,7 @@
8900
8969
  color: '#fff'
8901
8970
  } : null,
8902
8971
  className: this.props.textClass
8903
- }, this.props.user.displayName), this.renderSub())), this.renderRight());
8972
+ }, this.getText()), this.renderSub())), this.renderRight());
8904
8973
  }
8905
8974
  }]);
8906
8975
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-core-web",
3
- "version": "1.4.24",
3
+ "version": "1.4.25",
4
4
  "description": "Core extension package for Pluss Communities platform",
5
5
  "main": "dist/index.cjs.js",
6
6
  "scripts": {
@@ -7,6 +7,44 @@ class UserListing extends Component {
7
7
  return this.props.size || 30;
8
8
  }
9
9
 
10
+ getImage() {
11
+ if (this.props.user && this.props.user.profilePic) {
12
+ return this.props.user.profilePic;
13
+ }
14
+ if (this.props.image) {
15
+ return this.props.image;
16
+ }
17
+ return undefined;
18
+ }
19
+
20
+ getKey() {
21
+ if (this.props.user && this.props.user.id) {
22
+ return this.props.user.id;
23
+ }
24
+ return this.props.id;
25
+ }
26
+
27
+ getText() {
28
+ if (this.props.user && this.props.user.displayName) {
29
+ return this.props.user.displayName;
30
+ }
31
+ return this.props.title;
32
+ }
33
+
34
+ getBorderRadius() {
35
+ if (this.props.squareImage) {
36
+ return 4;
37
+ }
38
+ return this.getSize() / 2;
39
+ }
40
+
41
+ isLoading() {
42
+ if (this.props.user && this.props.user.loading) {
43
+ return this.props.user && this.props.user.loading;
44
+ }
45
+ return this.props.isLoading;
46
+ }
47
+
10
48
  renderRight() {
11
49
  if (!this.props.rightContent) {
12
50
  return null;
@@ -21,23 +59,43 @@ class UserListing extends Component {
21
59
  return this.props.subContent;
22
60
  }
23
61
 
62
+ renderImage() {
63
+ if (this.props.squareImage) {
64
+ return (
65
+ <div
66
+ style={{
67
+ height: this.getSize(),
68
+ width: this.getSize(),
69
+ borderRadius: this.getBorderRadius(),
70
+ marginRight: 8,
71
+ backgroundSize: 'cover',
72
+ backgroundPosition: 'center',
73
+ backgroundImage: `url(${this.getImage()})`,
74
+ }}
75
+ alt={`${this.getText()} Image`}
76
+ />
77
+ );
78
+ }
79
+ return <ProfilePic size={this.getSize()} className="userListing_profilePic" image={this.getImage()} />;
80
+ }
81
+
24
82
  render() {
25
83
  return (
26
84
  <div
27
- key={this.props.user.userId || this.props.user.Id || this.props.user.id}
85
+ key={this.getKey()}
28
86
  className="userListing"
29
87
  style={{
30
88
  minHeight: this.getSize() + 5,
31
89
  cursor: this.props.onClick ? 'pointer' : 'inherit',
32
- opacity: this.props.user && this.props.user.loading ? 0.5 : 1,
90
+ opacity: this.isLoading() ? 0.5 : 1,
33
91
  }}
34
92
  onClick={this.props.onClick}
35
93
  >
36
94
  <div className="userListing_inner">
37
- <ProfilePic size={this.getSize()} className="userListing_profilePic" image={this.props.user.profilePic} />
95
+ {this.renderImage()}
38
96
  <div className="userListing_middle" style={{ height: this.getSize() }}>
39
97
  <Text type="name" style={this.props.whiteText ? { color: '#fff' } : null} className={this.props.textClass}>
40
- {this.props.user.displayName}
98
+ {this.getText()}
41
99
  </Text>
42
100
  {this.renderSub()}
43
101
  </div>