ywana-core8 0.0.415 → 0.0.418

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,5 +1,5 @@
1
1
  import 'material-design-icons-iconfont/dist/material-design-icons.css';
2
- import React, { useContext, useState, useEffect, Fragment, useRef, useMemo, Children } from 'react';
2
+ import React, { useContext, useState, useEffect, Fragment, useMemo, useRef, Children } from 'react';
3
3
  import RSwitch from 'react-switch';
4
4
  import moment from 'moment';
5
5
  import { extendMoment } from 'moment-range';
@@ -1847,7 +1847,6 @@ var StringCellViewer = function StringCellViewer(_ref7) {
1847
1847
  break;
1848
1848
  }
1849
1849
 
1850
- console.log(value, format);
1851
1850
  return /*#__PURE__*/React.createElement("div", {
1852
1851
  className: "field-editor string-viewer"
1853
1852
  }, text);
@@ -1891,37 +1890,22 @@ var StringCellEditor = function StringCellEditor(_ref8) {
1891
1890
  var TokenField = function TokenField(_ref) {
1892
1891
  var id = _ref.id,
1893
1892
  label = _ref.label,
1894
- _ref$init = _ref.init,
1895
- init = _ref$init === void 0 ? [] : _ref$init,
1893
+ _ref$tokens = _ref.tokens,
1894
+ tokens = _ref$tokens === void 0 ? [] : _ref$tokens,
1896
1895
  readOnly = _ref.readOnly,
1897
1896
  options = _ref.options,
1898
1897
  onChange = _ref.onChange;
1899
- var mounted = useRef(false);
1900
1898
 
1901
1899
  var _useState = useState(),
1902
1900
  value = _useState[0],
1903
1901
  setValue = _useState[1];
1904
1902
 
1905
- var _useState2 = useState(init),
1906
- tokens = _useState2[0],
1907
- setTokens = _useState2[1];
1908
-
1909
1903
  useState(false);
1910
1904
 
1911
- useEffect(function () {
1912
- if (mounted.current) {
1913
- if (onChange) {
1914
- if (tokens) onChange(id, tokens);
1915
- }
1916
- } else {
1917
- mounted.current = true;
1918
- }
1919
- }, [tokens]);
1920
-
1921
1905
  function remove(index) {
1922
1906
  var next = tokens.slice();
1923
1907
  next.splice(index, 1);
1924
- setTokens(next);
1908
+ if (onChange) onChange(id, next);
1925
1909
  }
1926
1910
 
1927
1911
  function change(event) {
@@ -1929,10 +1913,10 @@ var TokenField = function TokenField(_ref) {
1929
1913
  setValue(value);
1930
1914
  }
1931
1915
 
1932
- function changeDropDown(id, value) {
1916
+ function changeDropDown(fid, value) {
1933
1917
  var next = tokens.concat(value);
1934
- setTokens(next);
1935
- setValue('xxx');
1918
+ if (onChange) onChange(id, next);
1919
+ setValue('');
1936
1920
  }
1937
1921
 
1938
1922
  function onEnter(event) {
@@ -1941,7 +1925,7 @@ var TokenField = function TokenField(_ref) {
1941
1925
  event.stopPropagation();
1942
1926
  var token = event.target.value;
1943
1927
  var next = tokens.concat(token);
1944
- setTokens(next);
1928
+ if (onChange) onChange(id, next);
1945
1929
  setValue('');
1946
1930
  }
1947
1931
 
@@ -4111,6 +4095,7 @@ var StringEditor = function StringEditor(_ref6) {
4111
4095
  Editor = field.Editor;
4112
4096
 
4113
4097
  function change(id, value) {
4098
+ console.log(id, value);
4114
4099
  if (onChange) onChange(id, value);
4115
4100
  }
4116
4101
 
@@ -4152,8 +4137,8 @@ var StringEditor = function StringEditor(_ref6) {
4152
4137
  id: id,
4153
4138
  label: label,
4154
4139
  onChange: change,
4155
- readOnly: !editable,
4156
- options: buildOptions()
4140
+ options: buildOptions(),
4141
+ tokens: value
4157
4142
  });
4158
4143
 
4159
4144
  default: