@panneau/medias 3.0.208 → 3.0.209

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 CHANGED
@@ -905,9 +905,9 @@ function MediasBrowser(_ref) {
905
905
  var baseQuery = useMemo(function () {
906
906
  return _objectSpread(_objectSpread({
907
907
  count: 12
908
- }, initialQuery), {}, {
908
+ }, initialQuery), types !== null ? {
909
909
  types: types
910
- });
910
+ } : null);
911
911
  }, [initialQuery, types]);
912
912
  var _useQuery = useQuery(baseQuery),
913
913
  fullQuery = _useQuery.query,
@@ -937,8 +937,9 @@ function MediasBrowser(_ref) {
937
937
  // eslint-disable-next-line no-unused-vars
938
938
  var _ref3 = query || {};
939
939
  _ref3.types;
940
- _ref3.trashed;
941
- var queryWithoutTypes = _objectWithoutProperties(_ref3, _excluded2);
940
+ var _ref3$trashed = _ref3.trashed,
941
+ trashed = _ref3$trashed === void 0 ? null : _ref3$trashed,
942
+ queryWithoutTypes = _objectWithoutProperties(_ref3, _excluded2);
942
943
  var _useMediaTrash = useMediaTrash$1(),
943
944
  mediaTrash = _useMediaTrash.mediaTrash,
944
945
  trashing = _useMediaTrash.trashing;
@@ -1125,6 +1126,10 @@ function MediasBrowser(_ref) {
1125
1126
  return column;
1126
1127
  }) : columns;
1127
1128
  }, [columns, withTrash, showTrashed]);
1129
+ var hasQueryItem = useMemo(function () {
1130
+ var showOnTopQuery = types === null ? query : queryWithoutTypes;
1131
+ return showOnTopQuery !== null && !trashed ? Object.keys(showOnTopQuery).length > 0 : false;
1132
+ }, [types, query, queryWithoutTypes, trashed]);
1128
1133
  var finalItems = useMemo(function () {
1129
1134
  if (withStickySelection && (extraItems !== null || uploadedMedias !== null || uploadProcessing === true)) {
1130
1135
  return uniqBy([].concat(_toConsumableArray(uploadProcessing ? [{
@@ -1132,7 +1137,7 @@ function MediasBrowser(_ref) {
1132
1137
  loading: true,
1133
1138
  actionsDisabled: true,
1134
1139
  selectionDisabled: true
1135
- }] : []), _toConsumableArray(page === 1 ? uploadedMedias || [] : []), _toConsumableArray(page === 1 ? (extraItems || []).map(function (item) {
1140
+ }] : []), _toConsumableArray(page === 1 && !hasQueryItem ? uploadedMedias || [] : []), _toConsumableArray(page === 1 && !hasQueryItem ? (extraItems || []).map(function (item) {
1136
1141
  var _item$id = item.id,
1137
1142
  itemId = _item$id === void 0 ? null : _item$id;
1138
1143
  return (allItems || []).find(function () {
@@ -1148,7 +1153,13 @@ function MediasBrowser(_ref) {
1148
1153
  });
1149
1154
  }
1150
1155
  return items;
1151
- }, [items, page, allItems, withStickySelection, extraItems, uploadProcessing]);
1156
+ }, [items, page, allItems, withStickySelection, extraItems, uploadProcessing, hasQueryItem]);
1157
+
1158
+ // const emptyWithSticky = useMemo(
1159
+ // () => (items || []).length === 0 && (finalItems || []).length > 0,
1160
+ // [items, finalItems],
1161
+ // );
1162
+
1152
1163
  return /*#__PURE__*/React.createElement("div", {
1153
1164
  className: className
1154
1165
  }, currentMedia !== null ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -1227,6 +1238,7 @@ function MediasBrowser(_ref) {
1227
1238
  items: finalItems || [],
1228
1239
  loading: loading,
1229
1240
  loaded: loaded
1241
+ // empty={emptyWithSticky}
1230
1242
  }) : null, layout === 'table' ? /*#__PURE__*/React.createElement(Table, {
1231
1243
  theme: theme,
1232
1244
  columns: finalColumns,
@@ -1239,7 +1251,9 @@ function MediasBrowser(_ref) {
1239
1251
  multipleSelection: multipleSelection,
1240
1252
  items: finalItems,
1241
1253
  loading: loading,
1242
- loaded: loaded,
1254
+ loaded: loaded
1255
+ // empty={emptyWithSticky}
1256
+ ,
1243
1257
  actionsProps: {
1244
1258
  getDeletePropsFromItem: function getDeletePropsFromItem() {
1245
1259
  var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
package/lib/index.js CHANGED
@@ -907,9 +907,9 @@ function MediasBrowser(_ref) {
907
907
  var baseQuery = React.useMemo(function () {
908
908
  return _objectSpread(_objectSpread({
909
909
  count: 12
910
- }, initialQuery), {}, {
910
+ }, initialQuery), types !== null ? {
911
911
  types: types
912
- });
912
+ } : null);
913
913
  }, [initialQuery, types]);
914
914
  var _useQuery = hooks.useQuery(baseQuery),
915
915
  fullQuery = _useQuery.query,
@@ -939,8 +939,9 @@ function MediasBrowser(_ref) {
939
939
  // eslint-disable-next-line no-unused-vars
940
940
  var _ref3 = query || {};
941
941
  _ref3.types;
942
- _ref3.trashed;
943
- var queryWithoutTypes = _objectWithoutProperties(_ref3, _excluded2);
942
+ var _ref3$trashed = _ref3.trashed,
943
+ trashed = _ref3$trashed === void 0 ? null : _ref3$trashed,
944
+ queryWithoutTypes = _objectWithoutProperties(_ref3, _excluded2);
944
945
  var _useMediaTrash = useMediaTrash$1(),
945
946
  mediaTrash = _useMediaTrash.mediaTrash,
946
947
  trashing = _useMediaTrash.trashing;
@@ -1127,6 +1128,10 @@ function MediasBrowser(_ref) {
1127
1128
  return column;
1128
1129
  }) : columns;
1129
1130
  }, [columns, withTrash, showTrashed]);
1131
+ var hasQueryItem = React.useMemo(function () {
1132
+ var showOnTopQuery = types === null ? query : queryWithoutTypes;
1133
+ return showOnTopQuery !== null && !trashed ? Object.keys(showOnTopQuery).length > 0 : false;
1134
+ }, [types, query, queryWithoutTypes, trashed]);
1130
1135
  var finalItems = React.useMemo(function () {
1131
1136
  if (withStickySelection && (extraItems !== null || uploadedMedias !== null || uploadProcessing === true)) {
1132
1137
  return uniqBy([].concat(_toConsumableArray(uploadProcessing ? [{
@@ -1134,7 +1139,7 @@ function MediasBrowser(_ref) {
1134
1139
  loading: true,
1135
1140
  actionsDisabled: true,
1136
1141
  selectionDisabled: true
1137
- }] : []), _toConsumableArray(page === 1 ? uploadedMedias || [] : []), _toConsumableArray(page === 1 ? (extraItems || []).map(function (item) {
1142
+ }] : []), _toConsumableArray(page === 1 && !hasQueryItem ? uploadedMedias || [] : []), _toConsumableArray(page === 1 && !hasQueryItem ? (extraItems || []).map(function (item) {
1138
1143
  var _item$id = item.id,
1139
1144
  itemId = _item$id === void 0 ? null : _item$id;
1140
1145
  return (allItems || []).find(function () {
@@ -1150,7 +1155,13 @@ function MediasBrowser(_ref) {
1150
1155
  });
1151
1156
  }
1152
1157
  return items;
1153
- }, [items, page, allItems, withStickySelection, extraItems, uploadProcessing]);
1158
+ }, [items, page, allItems, withStickySelection, extraItems, uploadProcessing, hasQueryItem]);
1159
+
1160
+ // const emptyWithSticky = useMemo(
1161
+ // () => (items || []).length === 0 && (finalItems || []).length > 0,
1162
+ // [items, finalItems],
1163
+ // );
1164
+
1154
1165
  return /*#__PURE__*/React.createElement("div", {
1155
1166
  className: className
1156
1167
  }, currentMedia !== null ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -1229,6 +1240,7 @@ function MediasBrowser(_ref) {
1229
1240
  items: finalItems || [],
1230
1241
  loading: loading,
1231
1242
  loaded: loaded
1243
+ // empty={emptyWithSticky}
1232
1244
  }) : null, layout === 'table' ? /*#__PURE__*/React.createElement(Table, {
1233
1245
  theme: theme,
1234
1246
  columns: finalColumns,
@@ -1241,7 +1253,9 @@ function MediasBrowser(_ref) {
1241
1253
  multipleSelection: multipleSelection,
1242
1254
  items: finalItems,
1243
1255
  loading: loading,
1244
- loaded: loaded,
1256
+ loaded: loaded
1257
+ // empty={emptyWithSticky}
1258
+ ,
1245
1259
  actionsProps: {
1246
1260
  getDeletePropsFromItem: function getDeletePropsFromItem() {
1247
1261
  var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/medias",
3
- "version": "3.0.208",
3
+ "version": "3.0.209",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -47,19 +47,19 @@
47
47
  "dependencies": {
48
48
  "@babel/runtime": "^7.12.5",
49
49
  "@panneau/core": "^3.0.194",
50
- "@panneau/data": "^3.0.208",
50
+ "@panneau/data": "^3.0.209",
51
51
  "@panneau/display-image": "^3.0.201",
52
52
  "@panneau/element-button": "^3.0.194",
53
53
  "@panneau/element-buttons": "^3.0.194",
54
54
  "@panneau/element-form": "^3.0.199",
55
55
  "@panneau/element-form-status": "^3.0.194",
56
- "@panneau/element-grid": "^3.0.200",
56
+ "@panneau/element-grid": "^3.0.209",
57
57
  "@panneau/element-icon": "^3.0.194",
58
58
  "@panneau/element-media-card": "^3.0.201",
59
59
  "@panneau/element-media-player": "^3.0.199",
60
60
  "@panneau/element-pagination": "^3.0.194",
61
- "@panneau/element-table": "^3.0.200",
62
- "@panneau/field-upload": "^3.0.208",
61
+ "@panneau/element-table": "^3.0.209",
62
+ "@panneau/field-upload": "^3.0.209",
63
63
  "@panneau/filter-filters": "^3.0.208",
64
64
  "classnames": "^2.5.1",
65
65
  "lodash": "^4.17.21",
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "784e87ce65299b81ce5f139a676ded4d70f5cfb1"
72
+ "gitHead": "35ea686893c9fbbd809ad9738634ae5c30344842"
73
73
  }