@steroidsjs/core 2.2.51 → 2.2.54

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/hooks/useFile.js CHANGED
@@ -54,8 +54,16 @@ function useFile(props) {
54
54
  }
55
55
  react_1.useEffect(function () {
56
56
  if (initialFiles) {
57
- uploader.queue.add([].concat(initialFiles || [])
58
- .filter(function (item) { return !!item.uid; })
57
+ var normalizedInitialFiles_1 = [].concat(initialFiles || [])
58
+ .filter(function (item) { return !!item.uid; });
59
+ // Remove not exists
60
+ var toDelete = uploader.queue.getFiles()
61
+ .filter(function (file) { return !normalizedInitialFiles_1.find(function (item) { return item.uid === file.getUid(); }); });
62
+ if (toDelete.length > 0) {
63
+ uploader.queue.remove(toDelete);
64
+ }
65
+ // Add or update
66
+ uploader.queue.add(normalizedInitialFiles_1
59
67
  .map(function (item) {
60
68
  var path = item.title || item.label || item.uid || item.id;
61
69
  var resultHttpMessage = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "2.2.51",
3
+ "version": "2.2.54",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -39,6 +39,7 @@ declare namespace DropDown {
39
39
  defaultVisible: boolean;
40
40
  gap: number;
41
41
  position: string;
42
+ closeMode: string;
42
43
  };
43
44
  }
44
45
  export default DropDown;
@@ -46,13 +46,15 @@ function DropDown(props) {
46
46
  onHide();
47
47
  }
48
48
  }
49
- });
49
+ }, ['mousedown', 'touchstart']);
50
50
  // Any click -> close
51
- react_use_1.useEvent('click', react_1.useCallback(function () {
51
+ var onAnyClick = react_1.useCallback(function () {
52
52
  if (isComponentExist && isComponentVisible && props.closeMode === 'click-any') {
53
53
  onHide();
54
54
  }
55
- }, [isComponentExist, isComponentVisible, onHide, props.closeMode]));
55
+ }, [isComponentExist, isComponentVisible, onHide, props.closeMode]);
56
+ react_use_1.useEvent('mousedown', onAnyClick);
57
+ react_use_1.useEvent('touchstart', onAnyClick);
56
58
  var calculatePosition = react_1.useCallback(function (componentSize) {
57
59
  calculateAbsolutePosition(position, childRef.current, componentSize);
58
60
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -83,6 +85,7 @@ DropDown.defaultProps = {
83
85
  componentDestroyDelay: 300,
84
86
  defaultVisible: false,
85
87
  gap: 15,
86
- position: 'bottom'
88
+ position: 'bottom',
89
+ closeMode: 'click-away'
87
90
  };
88
91
  exports["default"] = DropDown;
@@ -37,7 +37,9 @@ function RadioListField(props) {
37
37
  var inputProps = react_1.useMemo(function () { return (__assign(__assign({}, props.inputProps), { type: 'radio', name: props.input.name, disabled: props.disabled, onChange: function (value) { return props.input.onChange(value); } })); }, [props.disabled, props.input, props.inputProps]);
38
38
  // Sync with form
39
39
  react_1.useEffect(function () {
40
+ var _a;
40
41
  props.input.onChange.call(null, selectedIds[0]);
42
+ (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(null, selectedIds[0]);
41
43
  }, [props.input.onChange, selectedIds]);
42
44
  return components.ui.renderView(props.view || 'form.RadioListFieldView', __assign(__assign({}, props), { items: items,
43
45
  inputProps: inputProps,