@zohodesk/dot 1.0.0-beta.213 → 1.0.0-beta.214

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/README.md CHANGED
@@ -2,13 +2,18 @@
2
2
 
3
3
  In this Library, we Provide Some Basic Components to Build Your Application
4
4
 
5
+ # 1.0.0-beta.214
6
+
7
+ - Dot => Provider Config Added
8
+ - FreezeLayer => freezeLayer config added to control keyboard shortcut
9
+ - CurrencyField => formatCurrency prop added, exist formatCurrency function removed and moved to deprecated
5
10
  # 1.0.0-beta.213
6
11
 
7
12
  - ActionButton => Loader Bg Fix reverted (Directly Fixed in Button Component)
8
13
 
9
14
  # 1.0.0-beta.210
10
15
 
11
- - TextEditor => editor laoding issue fix
16
+ - TextEditor => editor loading issue fix
12
17
 
13
18
  # 1.0.0-beta.209
14
19
 
@@ -2,9 +2,10 @@ import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Container } from '@zohodesk/components/lib/Layout';
4
4
  import VelocityAnimationGroup from '@zohodesk/components/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup';
5
- import style from './FreezeLayer.module.css';
6
- import { Shortcut } from '../utils/KeyboardApi';
5
+ import style from './FreezeLayer.module.css'; //import { Shortcut } from '../utils/KeyboardApi';
6
+
7
7
  import { getZIndex } from '@zohodesk/components/lib/Provider/ZindexProvider';
8
+ import { getDotLibraryConfig } from '../Provider/Config';
8
9
  export default class FreezeLayer extends Component {
9
10
  constructor(props) {
10
11
  super(props);
@@ -13,6 +14,23 @@ export default class FreezeLayer extends Component {
13
14
  isChildActive: false
14
15
  };
15
16
  this.getNextIndex = getZIndex(this);
17
+ this.isFreezeLayerEnabled = false;
18
+ }
19
+
20
+ enableFreeze() {
21
+ if (!this.isFreezeLayerEnabled) {
22
+ this.isFreezeLayerEnabled = true;
23
+ const freezeLayerEnable = (getDotLibraryConfig('freezeLayer') || {}).enable;
24
+ freezeLayerEnable && freezeLayerEnable();
25
+ }
26
+ }
27
+
28
+ disableFreeze() {
29
+ if (this.isFreezeLayerEnabled) {
30
+ this.isFreezeLayerEnabled = false;
31
+ const freezeLayerDisable = (getDotLibraryConfig('freezeLayer') || {}).disable;
32
+ freezeLayerDisable && freezeLayerDisable();
33
+ }
16
34
  }
17
35
 
18
36
  componentDidMount() {
@@ -24,6 +42,7 @@ export default class FreezeLayer extends Component {
24
42
  this.setState({
25
43
  isChildActive: true
26
44
  });
45
+ this.enableFreeze();
27
46
  }
28
47
  }
29
48
 
@@ -34,7 +53,8 @@ export default class FreezeLayer extends Component {
34
53
 
35
54
  if (isActive != prevProps.isActive) {
36
55
  if (isActive) {
37
- Shortcut && Shortcut.setState(false);
56
+ this.enableFreeze(); // Shortcut && Shortcut.setState(false);
57
+
38
58
  this.setState({
39
59
  isActive: true
40
60
  }, () => {
@@ -43,7 +63,8 @@ export default class FreezeLayer extends Component {
43
63
  });
44
64
  });
45
65
  } else {
46
- Shortcut && Shortcut.setState(true);
66
+ this.disableFreeze(); // Shortcut && Shortcut.setState(true);
67
+
47
68
  this.setState({
48
69
  isChildActive: false
49
70
  }, () => {
@@ -55,6 +76,10 @@ export default class FreezeLayer extends Component {
55
76
  }
56
77
  }
57
78
 
79
+ componentWillUnmount() {
80
+ this.disableFreeze();
81
+ }
82
+
58
83
  render() {
59
84
  let {
60
85
  children,
@@ -0,0 +1,12 @@
1
+ let config = {
2
+ freezeLayer: {
3
+ enable: () => {},
4
+ disable: () => {}
5
+ }
6
+ };
7
+ export function getDotLibraryConfig(key) {
8
+ return config[key];
9
+ }
10
+ export function setDotLibraryConfig(configObj) {
11
+ config = Object.assign({}, config, configObj);
12
+ }
@@ -0,0 +1,19 @@
1
+ export function formatCurrency(number, symbol) {
2
+ // format number 1000000 to 1,234,567
3
+ if (number && number != 0) {
4
+ let typeOfData = typeof number;
5
+ let isDecimal = typeOfData == 'string' ? number.indexOf('.') != -1 : !Number.isInteger(number);
6
+
7
+ if (isDecimal) {
8
+ let val = number.toString().split('.');
9
+ let arr1 = `${val[0].replace(/\D/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`;
10
+ let finalVal = `${symbol}${arr1}.${val[1]}`;
11
+ return finalVal;
12
+ } else {
13
+ let value = `${symbol}${number.toString().replace(/\D/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`;
14
+ return value;
15
+ }
16
+ }
17
+
18
+ return number;
19
+ }
@@ -15,7 +15,6 @@ import Icon from '@zohodesk/icons/lib/Icon';
15
15
  /**** CSS ****/
16
16
 
17
17
  import style from '../Fields.module.css';
18
- import { formatCurrency } from '../../../utils/General';
19
18
  export default class CurrencyField extends PureComponent {
20
19
  constructor(props) {
21
20
  super(props);
@@ -99,7 +98,8 @@ export default class CurrencyField extends PureComponent {
99
98
  needReadOnlyStyle,
100
99
  isClickable,
101
100
  userCurrencyType,
102
- customProps
101
+ customProps,
102
+ formatCurrency
103
103
  } = this.props;
104
104
  const {
105
105
  LabelProps = {},
@@ -217,7 +217,8 @@ CurrencyField.propTypes = {
217
217
  TextBoxProps: PropTypes.object,
218
218
  ValidationMessageProps1: PropTypes.object,
219
219
  ValidationMessageProps2: PropTypes.object
220
- })
220
+ }),
221
+ formatCurrency: PropTypes.func
221
222
  };
222
223
  CurrencyField.defaultProps = {
223
224
  errorType: 'primary',
@@ -233,7 +234,8 @@ CurrencyField.defaultProps = {
233
234
  labelCustomClass: '',
234
235
  isClickable: false,
235
236
  needReadOnlyStyle: true,
236
- customProps: {}
237
+ customProps: {},
238
+ formatCurrency: () => {}
237
239
  };
238
240
 
239
241
  if (false) {
@@ -42,23 +42,4 @@ export function formatPhoneUrl(phone) {
42
42
  }
43
43
 
44
44
  return phone;
45
- }
46
- export function formatCurrency(number, symbol) {
47
- // format number 1000000 to 1,234,567
48
- if (number && number != 0) {
49
- let typeOfData = typeof number;
50
- let isDecimal = typeOfData == 'string' ? number.indexOf('.') != -1 : !Number.isInteger(number);
51
-
52
- if (isDecimal) {
53
- let val = number.toString().split('.');
54
- let arr1 = `${val[0].replace(/\D/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`;
55
- let finalVal = `${symbol}${arr1}.${val[1]}`;
56
- return finalVal;
57
- } else {
58
- let value = `${symbol}${number.toString().replace(/\D/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`;
59
- return value;
60
- }
61
- }
62
-
63
- return number;
64
45
  }
@@ -17,10 +17,10 @@ var _VelocityAnimationGroup = _interopRequireDefault(require("@zohodesk/componen
17
17
 
18
18
  var _FreezeLayerModule = _interopRequireDefault(require("./FreezeLayer.module.css"));
19
19
 
20
- var _KeyboardApi = require("../utils/KeyboardApi");
21
-
22
20
  var _ZindexProvider = require("@zohodesk/components/lib/Provider/ZindexProvider");
23
21
 
22
+ var _Config = require("../Provider/Config");
23
+
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
25
 
26
26
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -63,10 +63,29 @@ var FreezeLayer = /*#__PURE__*/function (_Component) {
63
63
  isChildActive: false
64
64
  };
65
65
  _this.getNextIndex = (0, _ZindexProvider.getZIndex)(_assertThisInitialized(_this));
66
+ _this.isFreezeLayerEnabled = false;
66
67
  return _this;
67
68
  }
68
69
 
69
70
  _createClass(FreezeLayer, [{
71
+ key: "enableFreeze",
72
+ value: function enableFreeze() {
73
+ if (!this.isFreezeLayerEnabled) {
74
+ this.isFreezeLayerEnabled = true;
75
+ var freezeLayerEnable = ((0, _Config.getDotLibraryConfig)('freezeLayer') || {}).enable;
76
+ freezeLayerEnable && freezeLayerEnable();
77
+ }
78
+ }
79
+ }, {
80
+ key: "disableFreeze",
81
+ value: function disableFreeze() {
82
+ if (this.isFreezeLayerEnabled) {
83
+ this.isFreezeLayerEnabled = false;
84
+ var freezeLayerDisable = ((0, _Config.getDotLibraryConfig)('freezeLayer') || {}).disable;
85
+ freezeLayerDisable && freezeLayerDisable();
86
+ }
87
+ }
88
+ }, {
70
89
  key: "componentDidMount",
71
90
  value: function componentDidMount() {
72
91
  var isActive = this.props.isActive;
@@ -75,6 +94,7 @@ var FreezeLayer = /*#__PURE__*/function (_Component) {
75
94
  this.setState({
76
95
  isChildActive: true
77
96
  });
97
+ this.enableFreeze();
78
98
  }
79
99
  }
80
100
  }, {
@@ -86,7 +106,8 @@ var FreezeLayer = /*#__PURE__*/function (_Component) {
86
106
 
87
107
  if (isActive != prevProps.isActive) {
88
108
  if (isActive) {
89
- _KeyboardApi.Shortcut && _KeyboardApi.Shortcut.setState(false);
109
+ this.enableFreeze(); // Shortcut && Shortcut.setState(false);
110
+
90
111
  this.setState({
91
112
  isActive: true
92
113
  }, function () {
@@ -95,7 +116,8 @@ var FreezeLayer = /*#__PURE__*/function (_Component) {
95
116
  });
96
117
  });
97
118
  } else {
98
- _KeyboardApi.Shortcut && _KeyboardApi.Shortcut.setState(true);
119
+ this.disableFreeze(); // Shortcut && Shortcut.setState(true);
120
+
99
121
  this.setState({
100
122
  isChildActive: false
101
123
  }, function () {
@@ -106,6 +128,11 @@ var FreezeLayer = /*#__PURE__*/function (_Component) {
106
128
  }
107
129
  }
108
130
  }
131
+ }, {
132
+ key: "componentWillUnmount",
133
+ value: function componentWillUnmount() {
134
+ this.disableFreeze();
135
+ }
109
136
  }, {
110
137
  key: "render",
111
138
  value: function render() {
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDotLibraryConfig = getDotLibraryConfig;
7
+ exports.setDotLibraryConfig = setDotLibraryConfig;
8
+ var config = {
9
+ freezeLayer: {
10
+ enable: function enable() {},
11
+ disable: function disable() {}
12
+ }
13
+ };
14
+
15
+ function getDotLibraryConfig(key) {
16
+ return config[key];
17
+ }
18
+
19
+ function setDotLibraryConfig(configObj) {
20
+ config = Object.assign({}, config, configObj);
21
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatCurrency = formatCurrency;
7
+
8
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9
+
10
+ function formatCurrency(number, symbol) {
11
+ // format number 1000000 to 1,234,567
12
+ if (number && number != 0) {
13
+ var typeOfData = _typeof(number);
14
+
15
+ var isDecimal = typeOfData == 'string' ? number.indexOf('.') != -1 : !Number.isInteger(number);
16
+
17
+ if (isDecimal) {
18
+ var val = number.toString().split('.');
19
+ var arr1 = "".concat(val[0].replace(/\D/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ','));
20
+ var finalVal = "".concat(symbol).concat(arr1, ".").concat(val[1]);
21
+ return finalVal;
22
+ } else {
23
+ var value = "".concat(symbol).concat(number.toString().replace(/\D/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ','));
24
+ return value;
25
+ }
26
+ }
27
+
28
+ return number;
29
+ }
@@ -23,8 +23,6 @@ var _Icon = _interopRequireDefault(require("@zohodesk/icons/lib/Icon"));
23
23
 
24
24
  var _FieldsModule = _interopRequireDefault(require("../Fields.module.css"));
25
25
 
26
- var _General = require("../../../utils/General");
27
-
28
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
27
 
30
28
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -145,7 +143,8 @@ var CurrencyField = /*#__PURE__*/function (_PureComponent) {
145
143
  needReadOnlyStyle = _this$props3.needReadOnlyStyle,
146
144
  isClickable = _this$props3.isClickable,
147
145
  userCurrencyType = _this$props3.userCurrencyType,
148
- customProps = _this$props3.customProps;
146
+ customProps = _this$props3.customProps,
147
+ formatCurrency = _this$props3.formatCurrency;
149
148
  var _customProps$LabelPro = customProps.LabelProps,
150
149
  LabelProps = _customProps$LabelPro === void 0 ? {} : _customProps$LabelPro,
151
150
  _customProps$TextBoxP = customProps.TextBoxProps,
@@ -158,7 +157,7 @@ var CurrencyField = /*#__PURE__*/function (_PureComponent) {
158
157
  var formatValue = value;
159
158
 
160
159
  if (!isActive && value != 0) {
161
- formatValue = (0, _General.formatCurrency)(value, userCurrencyType);
160
+ formatValue = formatCurrency(value, userCurrencyType);
162
161
  } else {
163
162
  formatValue = value;
164
163
  }
@@ -266,7 +265,8 @@ CurrencyField.propTypes = {
266
265
  TextBoxProps: _propTypes["default"].object,
267
266
  ValidationMessageProps1: _propTypes["default"].object,
268
267
  ValidationMessageProps2: _propTypes["default"].object
269
- })
268
+ }),
269
+ formatCurrency: _propTypes["default"].func
270
270
  };
271
271
  CurrencyField.defaultProps = {
272
272
  errorType: 'primary',
@@ -282,7 +282,8 @@ CurrencyField.defaultProps = {
282
282
  labelCustomClass: '',
283
283
  isClickable: false,
284
284
  needReadOnlyStyle: true,
285
- customProps: {}
285
+ customProps: {},
286
+ formatCurrency: function formatCurrency() {}
286
287
  };
287
288
 
288
289
  if (false) {
@@ -3,14 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.formatCurrency = formatCurrency;
7
6
  exports.formatPhoneUrl = formatPhoneUrl;
8
7
  exports.getFullName = getFullName;
9
8
  exports.shallowDiff = shallowDiff;
10
9
  exports.stopBubbling = stopBubbling;
11
10
 
12
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
13
-
14
11
  function stopBubbling(event) {
15
12
  event.preventDefault();
16
13
  event.stopPropagation && event.stopPropagation();
@@ -58,25 +55,4 @@ function formatPhoneUrl(phone) {
58
55
  }
59
56
 
60
57
  return phone;
61
- }
62
-
63
- function formatCurrency(number, symbol) {
64
- // format number 1000000 to 1,234,567
65
- if (number && number != 0) {
66
- var typeOfData = _typeof(number);
67
-
68
- var isDecimal = typeOfData == 'string' ? number.indexOf('.') != -1 : !Number.isInteger(number);
69
-
70
- if (isDecimal) {
71
- var val = number.toString().split('.');
72
- var arr1 = "".concat(val[0].replace(/\D/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ','));
73
- var finalVal = "".concat(symbol).concat(arr1, ".").concat(val[1]);
74
- return finalVal;
75
- } else {
76
- var value = "".concat(symbol).concat(number.toString().replace(/\D/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ','));
77
- return value;
78
- }
79
- }
80
-
81
- return number;
82
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/dot",
3
- "version": "1.0.0-beta.213",
3
+ "version": "1.0.0-beta.214",
4
4
  "main": "lib/index",
5
5
  "module": "es/index.js",
6
6
  "jsnext:main": "es/index.js",
@@ -43,9 +43,9 @@
43
43
  "velocity-react": "^1.4.3",
44
44
  "@zohodesk/variables": "^1.0.0-beta.29",
45
45
  "@zohodesk/i18n": "^1.0.0-beta.7",
46
- "@zohodesk/components": "1.0.0-alpha-228",
46
+ "@zohodesk/components": "^1.0.0-alpha-228",
47
47
  "@zohodesk/icons": "^1.0.0-beta.85",
48
- "@zohodesk/svg": "1.0.0-beta.41"
48
+ "@zohodesk/svg": "^1.0.0-beta.41"
49
49
  },
50
50
  "react-cli": {
51
51
  "preprocessor": {