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.umd.js
CHANGED
@@ -1893,37 +1893,22 @@
|
|
1893
1893
|
var TokenField = function TokenField(_ref) {
|
1894
1894
|
var id = _ref.id,
|
1895
1895
|
label = _ref.label,
|
1896
|
-
_ref$
|
1897
|
-
|
1896
|
+
_ref$tokens = _ref.tokens,
|
1897
|
+
tokens = _ref$tokens === void 0 ? [] : _ref$tokens,
|
1898
1898
|
readOnly = _ref.readOnly,
|
1899
1899
|
options = _ref.options,
|
1900
1900
|
onChange = _ref.onChange;
|
1901
|
-
var mounted = React.useRef(false);
|
1902
1901
|
|
1903
1902
|
var _useState = React.useState(),
|
1904
1903
|
value = _useState[0],
|
1905
1904
|
setValue = _useState[1];
|
1906
1905
|
|
1907
|
-
var _useState2 = React.useState(init),
|
1908
|
-
tokens = _useState2[0],
|
1909
|
-
setTokens = _useState2[1];
|
1910
|
-
|
1911
1906
|
React.useState(false);
|
1912
1907
|
|
1913
|
-
React.useEffect(function () {
|
1914
|
-
if (mounted.current) {
|
1915
|
-
if (onChange) {
|
1916
|
-
if (tokens) onChange(id, tokens);
|
1917
|
-
}
|
1918
|
-
} else {
|
1919
|
-
mounted.current = true;
|
1920
|
-
}
|
1921
|
-
}, [tokens]);
|
1922
|
-
|
1923
1908
|
function remove(index) {
|
1924
1909
|
var next = tokens.slice();
|
1925
1910
|
next.splice(index, 1);
|
1926
|
-
|
1911
|
+
if (onChange) onChange(id, next);
|
1927
1912
|
}
|
1928
1913
|
|
1929
1914
|
function change(event) {
|
@@ -1931,10 +1916,10 @@
|
|
1931
1916
|
setValue(value);
|
1932
1917
|
}
|
1933
1918
|
|
1934
|
-
function changeDropDown(
|
1919
|
+
function changeDropDown(fid, value) {
|
1935
1920
|
var next = tokens.concat(value);
|
1936
|
-
|
1937
|
-
setValue('
|
1921
|
+
if (onChange) onChange(id, next);
|
1922
|
+
setValue('');
|
1938
1923
|
}
|
1939
1924
|
|
1940
1925
|
function onEnter(event) {
|
@@ -1943,7 +1928,7 @@
|
|
1943
1928
|
event.stopPropagation();
|
1944
1929
|
var token = event.target.value;
|
1945
1930
|
var next = tokens.concat(token);
|
1946
|
-
|
1931
|
+
if (onChange) onChange(id, next);
|
1947
1932
|
setValue('');
|
1948
1933
|
}
|
1949
1934
|
|
@@ -4113,6 +4098,7 @@
|
|
4113
4098
|
Editor = field.Editor;
|
4114
4099
|
|
4115
4100
|
function change(id, value) {
|
4101
|
+
console.log(id, value);
|
4116
4102
|
if (onChange) onChange(id, value);
|
4117
4103
|
}
|
4118
4104
|
|
@@ -4150,14 +4136,12 @@
|
|
4150
4136
|
});
|
4151
4137
|
|
4152
4138
|
case FORMATS.TOKENS:
|
4153
|
-
var init = Array.isArray(value) ? value : [];
|
4154
4139
|
return /*#__PURE__*/React__default["default"].createElement(TokenField, {
|
4155
4140
|
id: id,
|
4156
4141
|
label: label,
|
4157
4142
|
onChange: change,
|
4158
|
-
readOnly: !editable,
|
4159
4143
|
options: buildOptions(),
|
4160
|
-
|
4144
|
+
tokens: value
|
4161
4145
|
});
|
4162
4146
|
|
4163
4147
|
default:
|