@aj-shadow/z-abs-complayer-bootstrap-client 0.0.0-aj-beta.221 → 0.0.0-aj-beta.224

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@aj-shadow/z-abs-complayer-bootstrap-client",
3
- "version": "0.0.0-aj-beta.221",
3
+ "version": "0.0.0-aj-beta.224",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@aj-shadow/z-abs-complayer-bootstrap-client",
9
- "version": "0.0.0-aj-beta.221",
9
+ "version": "0.0.0-aj-beta.224",
10
10
  "license": "SEE LICENSE IN LICENSE.txt"
11
11
  }
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aj-shadow/z-abs-complayer-bootstrap-client",
3
- "version": "0.0.0-aj-beta.221",
3
+ "version": "0.0.0-aj-beta.224",
4
4
  "release-step": "delivery",
5
5
  "description": "Library used by @actorjs/actorjs",
6
6
  "author": "ActorJs",
@@ -8,18 +8,30 @@ import React from 'react';
8
8
 
9
9
  export default class RealtimePressDownButton extends ReactComponentBase {
10
10
  constructor(props) {
11
- super(props);
11
+ super(props, {
12
+ buttonValue: props.buttonValue
13
+ });
14
+ this.toolTipHeadingIsArray = Array.isArray(props.toolTipHeading);
15
+ this.toolTipContentIsArray = Array.isArray(props.toolTipContent);
12
16
  this.textNodes = new Map();
17
+ this.isRealtime = false;
13
18
  }
14
19
 
15
20
  shouldUpdate(nextProps, nextState) {
16
- return !this.shallowCompare(this.props.buttonValue, nextProps.buttonValue)
17
- || !this.shallowCompare(this.props.buttonIndex, nextProps.buttonIndex)
18
- || !this.shallowCompare(this.props.active, nextProps.active)
19
- || !this.shallowCompare(this.props.colorMark, nextProps.colorMark)
20
- || !this.shallowCompare(this.props.toolTipContent, nextProps.toolTipContent);
21
+ const buttonValuePropsCmp = this.isArray ? !this.shallowCompareArrayValues(this.props.buttonValue, nextProps.buttonValue) : !this.shallowCompare(this.props.buttonValue, nextProps.buttonValue);
22
+ const activeCmp = !this.shallowCompare(this.props.active, nextProps.active);
23
+ const colorMarkCmp = !this.shallowCompare(this.props.colorMark, nextProps.colorMark);
24
+ const toolTipHeadingCmp = this.toolTipHeadingIsArray ? !this.shallowCompareArrayValues(this.props.toolTipHeading, nextProps.toolTipHeading) : !this.shallowCompare(this.props.toolTipHeading, nextProps.toolTipHeading);
25
+ const toolTipContentCmp = this.toolTipContentIsArray ? !this.shallowCompareArrayValues(this.props.toolTipContent, nextProps.toolTipContent) : !this.shallowCompare(this.props.toolTipContent, nextProps.toolTipContent);
26
+ const buttonStatePropsCmp = this.isArray ? !this.shallowCompareArrayValues(this.state.buttonValue, nextState.buttonValue) : !this.shallowCompare(this.state.buttonValue, nextState.buttonValue);
27
+ return buttonValuePropsCmp
28
+ || activeCmp
29
+ || colorMarkCmp
30
+ || toolTipHeadingCmp
31
+ || toolTipContentCmp
32
+ || buttonStatePropsCmp;
21
33
  }
22
-
34
+
23
35
  render() {
24
36
  const toolTipContent = this.props.toolTipContent;
25
37
  let toolTipContents = [];
@@ -39,24 +51,23 @@ export default class RealtimePressDownButton extends ReactComponentBase {
39
51
  toolTipHeadings.push(toolTipHeading);
40
52
  toolTipHeadings.push(toolTipHeading);
41
53
  }
42
- const buttonIndex = undefined !== this.props.buttonIndex ? Number.parseInt(this.props.buttonIndex) : undefined;
43
- let buttonValue = undefined !== buttonIndex ? this.props.buttonValue[buttonIndex] : this.props.buttonValue;
44
- let active = buttonValue ? 1 : 0;
54
+ let buttonValue = this.isRealtime ? this.state.buttonValue : this.props.buttonValue;
55
+ const active = buttonValue;
56
+ const activeIndex = active ? 1 : 0;
57
+ this.isRealtime = false;
45
58
  const onLoad = this.props.onLoad ? {onLoad: this.props.onLoad} : {};
46
59
  const size = this.props.size ? this.props.size : 'aj_btn_sm';
47
60
  return (
48
- <ButtonNew icon={this.props.icon} size={size} active={active} colorMark={this.props.colorMark} placement="bottom" heading={toolTipHeadings[(active)]} content={toolTipContents[(active)]}
61
+ <ButtonNew icon={this.props.icon} size={size} active={active} colorMark={this.props.colorMark} placement="bottom" heading={toolTipHeadings[activeIndex]} content={toolTipContents[activeIndex]}
49
62
  onClick={(e) => {
50
- buttonValue = !buttonValue;
51
- if(undefined !== buttonIndex) {
52
- const values = this.deepCopy(this.props.buttonValue);
53
- values[buttonIndex] = buttonValue;
54
- if(this.props.onAction) {
55
- this.props.onAction(values);
56
- }
57
- }
58
- else if(this.props.onAction) {
59
- this.props.onAction(buttonValue);
63
+ if(this.props.onAction) {
64
+ buttonValue = !buttonValue;
65
+ this.props.onAction(buttonValue, (isRealtime) => {
66
+ if(isRealtime) {
67
+ this.isRealtime = true;
68
+ this.updateState({buttonValue: {$set:buttonValue}});
69
+ }
70
+ });
60
71
  }
61
72
  }}
62
73
  {...onLoad}