@panneau/app 1.0.0-alpha.257 → 1.0.0-alpha.258
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/es/index.js +23 -5
- package/lib/index.js +24 -5
- package/package.json +15 -15
package/es/index.js
CHANGED
@@ -30,6 +30,7 @@ import isString from 'lodash/isString';
|
|
30
30
|
import Alert from '@panneau/element-alert';
|
31
31
|
import Dropdown from '@panneau/element-dropdown';
|
32
32
|
import Pagination from '@panneau/element-pagination';
|
33
|
+
import _toPropertyKey from '@babel/runtime/helpers/toPropertyKey';
|
33
34
|
import { faUndo } from '@fortawesome/free-solid-svg-icons';
|
34
35
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
35
36
|
import FormGroup from '@panneau/element-form-group';
|
@@ -775,6 +776,8 @@ var propTypes$c = {
|
|
775
776
|
onReset: PropTypes$1.func,
|
776
777
|
withContainer: PropTypes$1.bool,
|
777
778
|
withReset: PropTypes$1.bool,
|
779
|
+
defaultValue: PropTypes$1.objectOf(PropTypes$1.object),
|
780
|
+
// eslint-disable-line react/forbid-prop-types
|
778
781
|
className: PropTypes$1.string
|
779
782
|
};
|
780
783
|
var defaultProps$c = {
|
@@ -784,6 +787,9 @@ var defaultProps$c = {
|
|
784
787
|
onReset: null,
|
785
788
|
withContainer: false,
|
786
789
|
withReset: true,
|
790
|
+
defaultValue: {
|
791
|
+
page: null
|
792
|
+
},
|
787
793
|
className: null
|
788
794
|
};
|
789
795
|
|
@@ -794,6 +800,7 @@ var ResourceFilters = function ResourceFilters(_ref) {
|
|
794
800
|
onReset = _ref.onReset,
|
795
801
|
withContainer = _ref.withContainer,
|
796
802
|
withReset = _ref.withReset,
|
803
|
+
defaultValue = _ref.defaultValue,
|
797
804
|
className = _ref.className;
|
798
805
|
var FilterComponents = useFiltersComponents();
|
799
806
|
|
@@ -812,7 +819,8 @@ var ResourceFilters = function ResourceFilters(_ref) {
|
|
812
819
|
}
|
813
820
|
|
814
821
|
return isActive;
|
815
|
-
}, false);
|
822
|
+
}, false); // console.log('value', value);
|
823
|
+
|
816
824
|
return /*#__PURE__*/React.createElement(Navbar, {
|
817
825
|
className: classNames([_defineProperty({
|
818
826
|
'navbar-expand-md': withContainer
|
@@ -829,18 +837,28 @@ var ResourceFilters = function ResourceFilters(_ref) {
|
|
829
837
|
var filterValue = value !== null && value[name] ? value[name] : null;
|
830
838
|
var onFilterChange = useCallback(function (newFilterValue) {
|
831
839
|
if (name !== null && onChange !== null) {
|
832
|
-
onChange(_objectSpread(_objectSpread({}, value), {}, _defineProperty({}, name, newFilterValue)));
|
840
|
+
onChange(_objectSpread(_objectSpread({}, value), {}, _defineProperty({}, name, newFilterValue), defaultValue));
|
841
|
+
}
|
842
|
+
}, [onChange, name, value, defaultValue]);
|
843
|
+
var onFilterClear = useCallback(function () {
|
844
|
+
if (name !== null && onChange !== null) {
|
845
|
+
var _ref4 = value || {};
|
846
|
+
_ref4[name];
|
847
|
+
var newValue = _objectWithoutProperties(_ref4, [name].map(_toPropertyKey));
|
848
|
+
|
849
|
+
onChange(_objectSpread(_objectSpread({}, newValue), defaultValue));
|
833
850
|
}
|
834
|
-
}, [onChange, name]);
|
851
|
+
}, [onChange, name, value, defaultValue]);
|
835
852
|
return FilterComponent !== null ? /*#__PURE__*/React.createElement(FormGroup, {
|
836
853
|
key: "filter-".concat(name, "-").concat(index + 1),
|
837
854
|
label: groupLabel,
|
838
855
|
className: "me-4"
|
839
856
|
}, /*#__PURE__*/React.createElement(FilterComponent, Object.assign({}, filterProps, {
|
840
857
|
value: filterValue,
|
841
|
-
onChange: onFilterChange
|
858
|
+
onChange: onFilterChange,
|
859
|
+
onClear: onFilterClear
|
842
860
|
}))) : null;
|
843
|
-
}), withReset && hasActiveFilter && currentFilters.length >
|
861
|
+
}), withReset && hasActiveFilter && currentFilters.length > 0 ? /*#__PURE__*/React.createElement(Button, {
|
844
862
|
theme: "primary",
|
845
863
|
onClick: onFiltersReset
|
846
864
|
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
package/lib/index.js
CHANGED
@@ -34,6 +34,7 @@ var isString = require('lodash/isString');
|
|
34
34
|
var Alert = require('@panneau/element-alert');
|
35
35
|
var Dropdown = require('@panneau/element-dropdown');
|
36
36
|
var Pagination = require('@panneau/element-pagination');
|
37
|
+
var _toPropertyKey = require('@babel/runtime/helpers/toPropertyKey');
|
37
38
|
var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
38
39
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
39
40
|
var FormGroup = require('@panneau/element-form-group');
|
@@ -61,6 +62,7 @@ var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString);
|
|
61
62
|
var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
|
62
63
|
var Dropdown__default = /*#__PURE__*/_interopDefaultLegacy(Dropdown);
|
63
64
|
var Pagination__default = /*#__PURE__*/_interopDefaultLegacy(Pagination);
|
65
|
+
var _toPropertyKey__default = /*#__PURE__*/_interopDefaultLegacy(_toPropertyKey);
|
64
66
|
var FormGroup__default = /*#__PURE__*/_interopDefaultLegacy(FormGroup);
|
65
67
|
|
66
68
|
var _excluded$5 = ["resource", "action", "previous", "status", "value", "onSubmit", "errors", "generalError", "className"];
|
@@ -804,6 +806,8 @@ var propTypes$c = {
|
|
804
806
|
onReset: PropTypes__default["default"].func,
|
805
807
|
withContainer: PropTypes__default["default"].bool,
|
806
808
|
withReset: PropTypes__default["default"].bool,
|
809
|
+
defaultValue: PropTypes__default["default"].objectOf(PropTypes__default["default"].object),
|
810
|
+
// eslint-disable-line react/forbid-prop-types
|
807
811
|
className: PropTypes__default["default"].string
|
808
812
|
};
|
809
813
|
var defaultProps$c = {
|
@@ -813,6 +817,9 @@ var defaultProps$c = {
|
|
813
817
|
onReset: null,
|
814
818
|
withContainer: false,
|
815
819
|
withReset: true,
|
820
|
+
defaultValue: {
|
821
|
+
page: null
|
822
|
+
},
|
816
823
|
className: null
|
817
824
|
};
|
818
825
|
|
@@ -823,6 +830,7 @@ var ResourceFilters = function ResourceFilters(_ref) {
|
|
823
830
|
onReset = _ref.onReset,
|
824
831
|
withContainer = _ref.withContainer,
|
825
832
|
withReset = _ref.withReset,
|
833
|
+
defaultValue = _ref.defaultValue,
|
826
834
|
className = _ref.className;
|
827
835
|
var FilterComponents = contexts.useFiltersComponents();
|
828
836
|
|
@@ -841,7 +849,8 @@ var ResourceFilters = function ResourceFilters(_ref) {
|
|
841
849
|
}
|
842
850
|
|
843
851
|
return isActive;
|
844
|
-
}, false);
|
852
|
+
}, false); // console.log('value', value);
|
853
|
+
|
845
854
|
return /*#__PURE__*/React__default["default"].createElement(Navbar__default["default"], {
|
846
855
|
className: classNames__default["default"]([_defineProperty__default["default"]({
|
847
856
|
'navbar-expand-md': withContainer
|
@@ -858,18 +867,28 @@ var ResourceFilters = function ResourceFilters(_ref) {
|
|
858
867
|
var filterValue = value !== null && value[name] ? value[name] : null;
|
859
868
|
var onFilterChange = React.useCallback(function (newFilterValue) {
|
860
869
|
if (name !== null && onChange !== null) {
|
861
|
-
onChange(_objectSpread__default["default"](_objectSpread__default["default"]({}, value), {}, _defineProperty__default["default"]({}, name, newFilterValue)));
|
870
|
+
onChange(_objectSpread__default["default"](_objectSpread__default["default"]({}, value), {}, _defineProperty__default["default"]({}, name, newFilterValue), defaultValue));
|
871
|
+
}
|
872
|
+
}, [onChange, name, value, defaultValue]);
|
873
|
+
var onFilterClear = React.useCallback(function () {
|
874
|
+
if (name !== null && onChange !== null) {
|
875
|
+
var _ref4 = value || {};
|
876
|
+
_ref4[name];
|
877
|
+
var newValue = _objectWithoutProperties__default["default"](_ref4, [name].map(_toPropertyKey__default["default"]));
|
878
|
+
|
879
|
+
onChange(_objectSpread__default["default"](_objectSpread__default["default"]({}, newValue), defaultValue));
|
862
880
|
}
|
863
|
-
}, [onChange, name]);
|
881
|
+
}, [onChange, name, value, defaultValue]);
|
864
882
|
return FilterComponent !== null ? /*#__PURE__*/React__default["default"].createElement(FormGroup__default["default"], {
|
865
883
|
key: "filter-".concat(name, "-").concat(index + 1),
|
866
884
|
label: groupLabel,
|
867
885
|
className: "me-4"
|
868
886
|
}, /*#__PURE__*/React__default["default"].createElement(FilterComponent, Object.assign({}, filterProps, {
|
869
887
|
value: filterValue,
|
870
|
-
onChange: onFilterChange
|
888
|
+
onChange: onFilterChange,
|
889
|
+
onClear: onFilterClear
|
871
890
|
}))) : null;
|
872
|
-
}), withReset && hasActiveFilter && currentFilters.length >
|
891
|
+
}), withReset && hasActiveFilter && currentFilters.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Button__default["default"], {
|
873
892
|
theme: "primary",
|
874
893
|
onClick: onFiltersReset
|
875
894
|
}, /*#__PURE__*/React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@panneau/app",
|
3
|
-
"version": "1.0.0-alpha.
|
3
|
+
"version": "1.0.0-alpha.258",
|
4
4
|
"description": "",
|
5
5
|
"keywords": [
|
6
6
|
"javascript"
|
@@ -67,25 +67,25 @@
|
|
67
67
|
"@panneau/core": "^1.0.0-alpha.256",
|
68
68
|
"@panneau/data": "^1.0.0-alpha.256",
|
69
69
|
"@panneau/displays": "^1.0.0-alpha.256",
|
70
|
-
"@panneau/element-alert": "^1.0.0-alpha.
|
71
|
-
"@panneau/element-button": "^1.0.0-alpha.
|
72
|
-
"@panneau/element-buttons": "^1.0.0-alpha.
|
73
|
-
"@panneau/element-dropdown": "^1.0.0-alpha.
|
74
|
-
"@panneau/element-form": "^1.0.0-alpha.
|
75
|
-
"@panneau/element-form-group": "^1.0.0-alpha.
|
70
|
+
"@panneau/element-alert": "^1.0.0-alpha.258",
|
71
|
+
"@panneau/element-button": "^1.0.0-alpha.258",
|
72
|
+
"@panneau/element-buttons": "^1.0.0-alpha.258",
|
73
|
+
"@panneau/element-dropdown": "^1.0.0-alpha.258",
|
74
|
+
"@panneau/element-form": "^1.0.0-alpha.258",
|
75
|
+
"@panneau/element-form-group": "^1.0.0-alpha.258",
|
76
76
|
"@panneau/element-label": "^1.0.0-alpha.256",
|
77
77
|
"@panneau/element-link": "^1.0.0-alpha.256",
|
78
78
|
"@panneau/element-loading": "^1.0.0-alpha.256",
|
79
|
-
"@panneau/element-menu": "^1.0.0-alpha.
|
80
|
-
"@panneau/element-navbar": "^1.0.0-alpha.
|
79
|
+
"@panneau/element-menu": "^1.0.0-alpha.258",
|
80
|
+
"@panneau/element-navbar": "^1.0.0-alpha.258",
|
81
81
|
"@panneau/element-pagination": "^1.0.0-alpha.256",
|
82
82
|
"@panneau/element-radios": "^1.0.0-alpha.256",
|
83
|
-
"@panneau/fields": "^1.0.0-alpha.
|
84
|
-
"@panneau/filters": "^1.0.0-alpha.
|
85
|
-
"@panneau/forms": "^1.0.0-alpha.
|
83
|
+
"@panneau/fields": "^1.0.0-alpha.258",
|
84
|
+
"@panneau/filters": "^1.0.0-alpha.258",
|
85
|
+
"@panneau/forms": "^1.0.0-alpha.258",
|
86
86
|
"@panneau/intl": "^1.0.0-alpha.256",
|
87
|
-
"@panneau/lists": "^1.0.0-alpha.
|
88
|
-
"@panneau/modals": "^1.0.0-alpha.
|
87
|
+
"@panneau/lists": "^1.0.0-alpha.258",
|
88
|
+
"@panneau/modals": "^1.0.0-alpha.258",
|
89
89
|
"@panneau/themes": "^1.0.0-alpha.256",
|
90
90
|
"classnames": "^2.2.6",
|
91
91
|
"lodash": "^4.17.21",
|
@@ -98,5 +98,5 @@
|
|
98
98
|
"publishConfig": {
|
99
99
|
"access": "public"
|
100
100
|
},
|
101
|
-
"gitHead": "
|
101
|
+
"gitHead": "6cca9a9bd5bf9fe3b47d779b93e4d13ce179325e"
|
102
102
|
}
|