ywana-core8 0.0.370 → 0.0.373

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.
@@ -22,7 +22,7 @@ function _catch$2(body, recover) {
22
22
  return result;
23
23
  }
24
24
 
25
- var fetchAsync = function fetchAsync(method, URL, body, token) {
25
+ var fetchAsync = function fetchAsync(method, URL, body, token, headers) {
26
26
  if (body === void 0) {
27
27
  body = null;
28
28
  }
@@ -32,11 +32,11 @@ var fetchAsync = function fetchAsync(method, URL, body, token) {
32
32
  var request = {
33
33
  method: method,
34
34
  mode: 'cors',
35
- headers: {
35
+ headers: Object.assign({
36
36
  "Accept": "application/json",
37
37
  "Content-Type": "application/json",
38
38
  "x-access-token": token
39
- },
39
+ }, headers),
40
40
  body: body
41
41
  };
42
42
  return Promise.resolve(_catch$2(function () {
@@ -84,9 +84,9 @@ var HTTPClient = function HTTPClient(domain, securityCtx) {
84
84
  var token = securityCtx ? securityCtx.token() : null;
85
85
  return fetchAsync('GET', domain + URL, undefined, token);
86
86
  },
87
- POST: function POST(URL, body) {
87
+ POST: function POST(URL, body, headers) {
88
88
  var token = securityCtx ? securityCtx.token() : null;
89
- return fetchAsync('POST', domain + URL, body, token);
89
+ return fetchAsync('POST', domain + URL, body, token, headers);
90
90
  },
91
91
  PUT: function PUT(URL, body) {
92
92
  var token = securityCtx ? securityCtx.token() : null;
@@ -928,7 +928,8 @@ var TextField = function TextField(props) {
928
928
  canClear = _props$canClear === void 0 ? true : _props$canClear,
929
929
  onChange = props.onChange,
930
930
  onEnter = props.onEnter,
931
- onClick = props.onClick;
931
+ onClick = props.onClick,
932
+ onBlur = props.onBlur;
932
933
 
933
934
  function onKeyPress(event) {
934
935
  var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
@@ -954,13 +955,8 @@ var TextField = function TextField(props) {
954
955
  }
955
956
  }
956
957
 
957
- function focusOut() {
958
- if (site && site.changeFocus) {
959
- site.changeFocus({
960
- lose: function lose() {// DO NOTHING
961
- }
962
- });
963
- }
958
+ function blur() {
959
+ if (onBlur) onBlur();
964
960
  }
965
961
 
966
962
  function clear() {
@@ -983,7 +979,7 @@ var TextField = function TextField(props) {
983
979
  onChange: change,
984
980
  onKeyDown: onKeyPress,
985
981
  onFocus: focus,
986
- onBlur: focusOut,
982
+ onBlur: blur,
987
983
  readOnly: readOnly
988
984
  }), canClear && value && value.length > 0 ? /*#__PURE__*/React.createElement(Icon, {
989
985
  icon: "close",
@@ -1026,7 +1022,6 @@ var TextArea = function TextArea(props) {
1026
1022
  event.stopPropagation();
1027
1023
  event.preventDefault();
1028
1024
  var value = event.target.value;
1029
- console.log(value);
1030
1025
  if (onChange) onChange(id, value);
1031
1026
  }
1032
1027
 
@@ -1058,7 +1053,7 @@ var TextArea = function TextArea(props) {
1058
1053
  onKeyDown: onKeyPress,
1059
1054
  onFocus: focus,
1060
1055
  readOnly: readOnly
1061
- }), !readOnly && canClear && value && value.length > 0 ? /*#__PURE__*/React.createElement(Icon, {
1056
+ }), canClear && value && value.length > 0 ? /*#__PURE__*/React.createElement(Icon, {
1062
1057
  icon: "close",
1063
1058
  clickable: true,
1064
1059
  size: "small",
@@ -1133,6 +1128,11 @@ var DropDown = function DropDown(props) {
1133
1128
  setOpen(false);
1134
1129
  }
1135
1130
 
1131
+ function blur() {
1132
+ console.log("BLUR DD");
1133
+ site.clearFocus();
1134
+ }
1135
+
1136
1136
  function renderOptions() {
1137
1137
  var canShow = open == true && Array.isArray(options);
1138
1138
 
@@ -1148,7 +1148,7 @@ var DropDown = function DropDown(props) {
1148
1148
  }, option.label);
1149
1149
  });
1150
1150
  return /*#__PURE__*/React.createElement("menu", null, /*#__PURE__*/React.createElement("ul", {
1151
- onClick: select
1151
+ onMouseDown: select
1152
1152
  }, lis));
1153
1153
  } else {
1154
1154
  return null;
@@ -1161,6 +1161,7 @@ var DropDown = function DropDown(props) {
1161
1161
  onClick: toggle,
1162
1162
  value: label,
1163
1163
  onChange: change,
1164
+ onBlur: blur,
1164
1165
  readOnly: !predictive
1165
1166
  })), !readOnly ? /*#__PURE__*/React.createElement(Icon, {
1166
1167
  icon: "expand_more",
@@ -3032,6 +3033,10 @@ var SiteProvider = function SiteProvider(_ref) {
3032
3033
  if (focused) focused.lose();
3033
3034
  setFocused(next);
3034
3035
  },
3036
+ clearFocus: function clearFocus() {
3037
+ if (focused) focused.lose();
3038
+ setFocused(null);
3039
+ },
3035
3040
  sideNav: sideNav,
3036
3041
  setSideNav: setSideNav,
3037
3042
  showNav: showNav,