ywana-core8 0.0.417 → 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.
- package/dist/index.cjs +9 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +10 -26
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +9 -25
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentEditor.js +2 -2
- package/src/domain/ContentEditor.test.js +1 -2
- package/src/html/tokenfield.js +7 -18
package/dist/index.modern.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import 'material-design-icons-iconfont/dist/material-design-icons.css';
|
2
|
-
import React, { useContext, useState, useEffect, Fragment,
|
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';
|
@@ -1890,37 +1890,22 @@ var StringCellEditor = function StringCellEditor(_ref8) {
|
|
1890
1890
|
var TokenField = function TokenField(_ref) {
|
1891
1891
|
var id = _ref.id,
|
1892
1892
|
label = _ref.label,
|
1893
|
-
_ref$
|
1894
|
-
|
1893
|
+
_ref$tokens = _ref.tokens,
|
1894
|
+
tokens = _ref$tokens === void 0 ? [] : _ref$tokens,
|
1895
1895
|
readOnly = _ref.readOnly,
|
1896
1896
|
options = _ref.options,
|
1897
1897
|
onChange = _ref.onChange;
|
1898
|
-
var mounted = useRef(false);
|
1899
1898
|
|
1900
1899
|
var _useState = useState(),
|
1901
1900
|
value = _useState[0],
|
1902
1901
|
setValue = _useState[1];
|
1903
1902
|
|
1904
|
-
var _useState2 = useState(init),
|
1905
|
-
tokens = _useState2[0],
|
1906
|
-
setTokens = _useState2[1];
|
1907
|
-
|
1908
1903
|
useState(false);
|
1909
1904
|
|
1910
|
-
useEffect(function () {
|
1911
|
-
if (mounted.current) {
|
1912
|
-
if (onChange) {
|
1913
|
-
if (tokens) onChange(id, tokens);
|
1914
|
-
}
|
1915
|
-
} else {
|
1916
|
-
mounted.current = true;
|
1917
|
-
}
|
1918
|
-
}, [tokens]);
|
1919
|
-
|
1920
1905
|
function remove(index) {
|
1921
1906
|
var next = tokens.slice();
|
1922
1907
|
next.splice(index, 1);
|
1923
|
-
|
1908
|
+
if (onChange) onChange(id, next);
|
1924
1909
|
}
|
1925
1910
|
|
1926
1911
|
function change(event) {
|
@@ -1928,10 +1913,10 @@ var TokenField = function TokenField(_ref) {
|
|
1928
1913
|
setValue(value);
|
1929
1914
|
}
|
1930
1915
|
|
1931
|
-
function changeDropDown(
|
1916
|
+
function changeDropDown(fid, value) {
|
1932
1917
|
var next = tokens.concat(value);
|
1933
|
-
|
1934
|
-
setValue('
|
1918
|
+
if (onChange) onChange(id, next);
|
1919
|
+
setValue('');
|
1935
1920
|
}
|
1936
1921
|
|
1937
1922
|
function onEnter(event) {
|
@@ -1940,7 +1925,7 @@ var TokenField = function TokenField(_ref) {
|
|
1940
1925
|
event.stopPropagation();
|
1941
1926
|
var token = event.target.value;
|
1942
1927
|
var next = tokens.concat(token);
|
1943
|
-
|
1928
|
+
if (onChange) onChange(id, next);
|
1944
1929
|
setValue('');
|
1945
1930
|
}
|
1946
1931
|
|
@@ -4110,6 +4095,7 @@ var StringEditor = function StringEditor(_ref6) {
|
|
4110
4095
|
Editor = field.Editor;
|
4111
4096
|
|
4112
4097
|
function change(id, value) {
|
4098
|
+
console.log(id, value);
|
4113
4099
|
if (onChange) onChange(id, value);
|
4114
4100
|
}
|
4115
4101
|
|
@@ -4147,14 +4133,12 @@ var StringEditor = function StringEditor(_ref6) {
|
|
4147
4133
|
});
|
4148
4134
|
|
4149
4135
|
case FORMATS.TOKENS:
|
4150
|
-
var init = Array.isArray(value) ? value : [];
|
4151
4136
|
return /*#__PURE__*/React.createElement(TokenField, {
|
4152
4137
|
id: id,
|
4153
4138
|
label: label,
|
4154
4139
|
onChange: change,
|
4155
|
-
readOnly: !editable,
|
4156
4140
|
options: buildOptions(),
|
4157
|
-
|
4141
|
+
tokens: value
|
4158
4142
|
});
|
4159
4143
|
|
4160
4144
|
default:
|