@tradly/asset 1.0.12 → 1.0.14
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/README.md +257 -13
- package/dist/components/FileUpload.js +8 -247
- package/dist/components/FileUpload.native.js +13 -0
- package/dist/components/Icons.js +10 -33
- package/dist/components/Icons.native.js +16 -0
- package/dist/components/ImagesSkeleton.js +7 -15
- package/dist/components/ImagesSkeleton.native.js +13 -0
- package/dist/components/MediaGallery.js +8 -148
- package/dist/components/MediaGallery.native.js +13 -0
- package/dist/components/MediaPopup.js +8 -99
- package/dist/components/MediaPopup.native.js +13 -0
- package/dist/components/MediaTab.js +7 -180
- package/dist/components/MediaTab.native.js +13 -0
- package/dist/components/Pagination.js +8 -136
- package/dist/components/Pagination.native.js +13 -0
- package/dist/components/VideosGallery.js +8 -148
- package/dist/components/VideosGallery.native.js +13 -0
- package/dist/core/MediaApiService.js +396 -0
- package/dist/esm/components/FileUpload.js +1 -246
- package/dist/esm/components/FileUpload.native.js +1 -0
- package/dist/esm/components/Icons.js +1 -32
- package/dist/esm/components/Icons.native.js +1 -0
- package/dist/esm/components/ImagesSkeleton.js +1 -14
- package/dist/esm/components/ImagesSkeleton.native.js +1 -0
- package/dist/esm/components/MediaGallery.js +1 -144
- package/dist/esm/components/MediaGallery.native.js +1 -0
- package/dist/esm/components/MediaPopup.js +1 -97
- package/dist/esm/components/MediaPopup.native.js +1 -0
- package/dist/esm/components/MediaTab.js +1 -177
- package/dist/esm/components/MediaTab.native.js +1 -0
- package/dist/esm/components/Pagination.js +1 -134
- package/dist/esm/components/Pagination.native.js +1 -0
- package/dist/esm/components/VideosGallery.js +1 -144
- package/dist/esm/components/VideosGallery.native.js +1 -0
- package/dist/esm/core/MediaApiService.js +390 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/native/FileUpload.native.js +298 -0
- package/dist/esm/native/Icons.native.js +51 -0
- package/dist/esm/native/ImagesSkeleton.native.js +45 -0
- package/dist/esm/native/MediaGallery.native.js +221 -0
- package/dist/esm/native/MediaPopup.native.js +151 -0
- package/dist/esm/native/MediaTab.native.js +175 -0
- package/dist/esm/native/Pagination.native.js +186 -0
- package/dist/esm/native/VideosGallery.native.js +233 -0
- package/dist/esm/services/apiService.js +1 -372
- package/dist/esm/web/FileUpload.web.js +253 -0
- package/dist/esm/web/Icons.web.js +32 -0
- package/dist/esm/web/ImagesSkeleton.web.js +14 -0
- package/dist/esm/web/MediaGallery.web.js +144 -0
- package/dist/esm/web/MediaPopup.web.js +97 -0
- package/dist/esm/web/MediaTab.web.js +177 -0
- package/dist/esm/web/Pagination.web.js +134 -0
- package/dist/esm/web/VideosGallery.web.js +144 -0
- package/dist/index.js +2 -2
- package/dist/native/FileUpload.native.js +304 -0
- package/dist/native/Icons.native.js +59 -0
- package/dist/native/ImagesSkeleton.native.js +52 -0
- package/dist/native/MediaGallery.native.js +230 -0
- package/dist/native/MediaPopup.native.js +158 -0
- package/dist/native/MediaTab.native.js +184 -0
- package/dist/native/Pagination.native.js +193 -0
- package/dist/native/VideosGallery.native.js +241 -0
- package/dist/services/apiService.js +2 -372
- package/dist/web/FileUpload.web.js +259 -0
- package/dist/web/Icons.web.js +39 -0
- package/dist/web/ImagesSkeleton.web.js +21 -0
- package/dist/web/MediaGallery.web.js +153 -0
- package/dist/web/MediaPopup.web.js +104 -0
- package/dist/web/MediaTab.web.js +186 -0
- package/dist/web/Pagination.web.js +141 -0
- package/dist/web/VideosGallery.web.js +153 -0
- package/package.json +4 -3
|
@@ -3,139 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
pageCount = _ref.pageCount,
|
|
15
|
-
navClassName = _ref.navClassName,
|
|
16
|
-
previousButtonClassName = _ref.previousButtonClassName,
|
|
17
|
-
nextButtonClassName = _ref.nextButtonClassName,
|
|
18
|
-
pageButtonClassName = _ref.pageButtonClassName,
|
|
19
|
-
pageButtonActiveClassName = _ref.pageButtonActiveClassName,
|
|
20
|
-
ellipsisClassName = _ref.ellipsisClassName;
|
|
21
|
-
var totalPages = Math.ceil(pageCount) || 1;
|
|
22
|
-
var currentPage = current_page || 1;
|
|
23
|
-
|
|
24
|
-
// Generate page numbers to display
|
|
25
|
-
var getPageNumbers = function getPageNumbers() {
|
|
26
|
-
var pages = [];
|
|
27
|
-
var maxVisible = 5;
|
|
28
|
-
var startPage = Math.max(1, currentPage - Math.floor(maxVisible / 2));
|
|
29
|
-
var endPage = Math.min(totalPages, startPage + maxVisible - 1);
|
|
30
|
-
if (endPage - startPage < maxVisible - 1) {
|
|
31
|
-
startPage = Math.max(1, endPage - maxVisible + 1);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Add first page and ellipsis
|
|
35
|
-
if (startPage > 1) {
|
|
36
|
-
pages.push(1);
|
|
37
|
-
if (startPage > 2) {
|
|
38
|
-
pages.push('...');
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Add visible pages
|
|
43
|
-
for (var i = startPage; i <= endPage; i++) {
|
|
44
|
-
pages.push(i);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Add ellipsis and last page
|
|
48
|
-
if (endPage < totalPages) {
|
|
49
|
-
if (endPage < totalPages - 1) {
|
|
50
|
-
pages.push('...');
|
|
51
|
-
}
|
|
52
|
-
pages.push(totalPages);
|
|
53
|
-
}
|
|
54
|
-
return pages;
|
|
55
|
-
};
|
|
56
|
-
var handlePageClick = function handlePageClick(page) {
|
|
57
|
-
if (page !== currentPage && page >= 1 && page <= totalPages) {
|
|
58
|
-
nextPage(page);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var handlePrevious = function handlePrevious() {
|
|
62
|
-
if (currentPage > 1) {
|
|
63
|
-
nextPage(currentPage - 1);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var handleNext = function handleNext() {
|
|
67
|
-
if (currentPage < totalPages) {
|
|
68
|
-
nextPage(currentPage + 1);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
if (totalPages <= 1) return null;
|
|
72
|
-
var pageNumbers = getPageNumbers();
|
|
73
|
-
|
|
74
|
-
// Default classes with customization support
|
|
75
|
-
var defaultContainerClass = 'flex justify-center';
|
|
76
|
-
var defaultNavClass = 'relative z-0 inline-flex flex-wrap justify-center rounded-md shadow-sm -space-x-px';
|
|
77
|
-
var defaultPreviousButtonClass = 'relative inline-flex items-center px-2 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50';
|
|
78
|
-
var defaultNextButtonClass = 'relative inline-flex items-center px-2 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50';
|
|
79
|
-
var defaultPageButtonClass = 'relative inline-flex items-center px-4 py-2 border bg-white border-gray-300 text-gray-500 hover:bg-gray-50 text-sm font-medium';
|
|
80
|
-
var defaultPageButtonActiveClass = 'z-10 bg-primary border-primary text-white relative inline-flex items-center px-4 py-2 border text-md font-semibold';
|
|
81
|
-
var defaultEllipsisClass = 'relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700';
|
|
82
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
83
|
-
className: className || defaultContainerClass,
|
|
84
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("nav", {
|
|
85
|
-
className: navClassName || defaultNavClass,
|
|
86
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
87
|
-
onClick: handlePrevious,
|
|
88
|
-
disabled: currentPage === 1,
|
|
89
|
-
className: "".concat(previousButtonClassName || defaultPreviousButtonClass, " ").concat(currentPage === 1 ? 'opacity-50 cursor-not-allowed' : ''),
|
|
90
|
-
"aria-label": "Previous page",
|
|
91
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
92
|
-
className: "h-5 w-5",
|
|
93
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
94
|
-
viewBox: "0 0 20 20",
|
|
95
|
-
fill: "currentColor",
|
|
96
|
-
"aria-hidden": "true",
|
|
97
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
98
|
-
fillRule: "evenodd",
|
|
99
|
-
d: "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",
|
|
100
|
-
clipRule: "evenodd"
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
}), pageNumbers.map(function (page, index) {
|
|
104
|
-
if (page === '...') {
|
|
105
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
106
|
-
className: ellipsisClassName || defaultEllipsisClass,
|
|
107
|
-
children: "..."
|
|
108
|
-
}, "ellipsis-".concat(index));
|
|
109
|
-
}
|
|
110
|
-
var isActive = page === currentPage;
|
|
111
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
112
|
-
onClick: function onClick() {
|
|
113
|
-
return handlePageClick(page);
|
|
114
|
-
},
|
|
115
|
-
className: isActive ? pageButtonActiveClassName || defaultPageButtonActiveClass : pageButtonClassName || defaultPageButtonClass,
|
|
116
|
-
"aria-label": "Page ".concat(page),
|
|
117
|
-
"aria-current": isActive ? 'page' : undefined,
|
|
118
|
-
children: page
|
|
119
|
-
}, page);
|
|
120
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
121
|
-
onClick: handleNext,
|
|
122
|
-
disabled: currentPage === totalPages,
|
|
123
|
-
className: "".concat(nextButtonClassName || defaultNextButtonClass, " ").concat(currentPage === totalPages ? 'opacity-50 cursor-not-allowed' : ''),
|
|
124
|
-
"aria-label": "Next page",
|
|
125
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
126
|
-
className: "h-5 w-5",
|
|
127
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
128
|
-
viewBox: "0 0 20 20",
|
|
129
|
-
fill: "currentColor",
|
|
130
|
-
"aria-hidden": "true",
|
|
131
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
132
|
-
fillRule: "evenodd",
|
|
133
|
-
d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
|
|
134
|
-
clipRule: "evenodd"
|
|
135
|
-
})
|
|
136
|
-
})
|
|
137
|
-
})]
|
|
138
|
-
})
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
var _default = exports.default = Pagination;
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _Pagination.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _Pagination = _interopRequireDefault(require("../web/Pagination.web"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _Pagination.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _Pagination = _interopRequireDefault(require("../native/Pagination.native"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1,153 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
16
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
17
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
18
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
19
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
20
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
22
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
23
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
24
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
25
|
-
var VIDEO_MIME_TYPES = ['video/mp4', 'video/quicktime', 'video/x-ms-wmv', 'video/h265', 'video/hevc', 'video/webm'];
|
|
26
|
-
var VideosGallery = function VideosGallery(_ref) {
|
|
27
|
-
var update_data = _ref.update_data,
|
|
28
|
-
closePopup = _ref.closePopup,
|
|
29
|
-
apiService = _ref.apiService,
|
|
30
|
-
onError = _ref.onError,
|
|
31
|
-
className = _ref.className,
|
|
32
|
-
gridClassName = _ref.gridClassName,
|
|
33
|
-
videoItemClassName = _ref.videoItemClassName,
|
|
34
|
-
paginationContainerClassName = _ref.paginationContainerClassName;
|
|
35
|
-
var _useState = (0, _react.useState)([]),
|
|
36
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
-
videos = _useState2[0],
|
|
38
|
-
setVideos = _useState2[1];
|
|
39
|
-
var _useState3 = (0, _react.useState)(0),
|
|
40
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
-
total_count = _useState4[0],
|
|
42
|
-
setTotalCount = _useState4[1];
|
|
43
|
-
var _useState5 = (0, _react.useState)(1),
|
|
44
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
45
|
-
currentPage = _useState6[0],
|
|
46
|
-
setCurrentPage = _useState6[1];
|
|
47
|
-
var _useState7 = (0, _react.useState)(false),
|
|
48
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
49
|
-
isLoading = _useState8[0],
|
|
50
|
-
setISLoading = _useState8[1];
|
|
51
|
-
|
|
52
|
-
// Fetch videos
|
|
53
|
-
(0, _react.useEffect)(function () {
|
|
54
|
-
loadMedia();
|
|
55
|
-
}, []);
|
|
56
|
-
var loadMedia = /*#__PURE__*/function () {
|
|
57
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
58
|
-
var page_number,
|
|
59
|
-
_response$data,
|
|
60
|
-
_response$data2,
|
|
61
|
-
response,
|
|
62
|
-
mediaData,
|
|
63
|
-
count,
|
|
64
|
-
_args = arguments,
|
|
65
|
-
_t;
|
|
66
|
-
return _regenerator().w(function (_context) {
|
|
67
|
-
while (1) switch (_context.p = _context.n) {
|
|
68
|
-
case 0:
|
|
69
|
-
page_number = _args.length > 0 && _args[0] !== undefined ? _args[0] : 1;
|
|
70
|
-
_context.p = 1;
|
|
71
|
-
_context.n = 2;
|
|
72
|
-
return apiService.fetchMedia({
|
|
73
|
-
mimeTypes: VIDEO_MIME_TYPES,
|
|
74
|
-
page: page_number,
|
|
75
|
-
setISLoading: setISLoading,
|
|
76
|
-
isLoading: isLoading
|
|
77
|
-
});
|
|
78
|
-
case 2:
|
|
79
|
-
response = _context.v;
|
|
80
|
-
// Handle different response formats
|
|
81
|
-
// Response might be: { media: [...], count: ... } or { data: { media: [...], count: ... } } or directly [...]
|
|
82
|
-
mediaData = (response === null || response === void 0 ? void 0 : response.media) || (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.media) || (response === null || response === void 0 ? void 0 : response.data) || response || [];
|
|
83
|
-
count = (response === null || response === void 0 ? void 0 : response.count) || (response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.count) || (response === null || response === void 0 ? void 0 : response.total) || 0;
|
|
84
|
-
setVideos(Array.isArray(mediaData) ? mediaData : []);
|
|
85
|
-
setTotalCount(count);
|
|
86
|
-
setCurrentPage(page_number);
|
|
87
|
-
_context.n = 4;
|
|
88
|
-
break;
|
|
89
|
-
case 3:
|
|
90
|
-
_context.p = 3;
|
|
91
|
-
_t = _context.v;
|
|
92
|
-
console.error('Error loading videos:', _t);
|
|
93
|
-
if (onError) {
|
|
94
|
-
onError(_t);
|
|
95
|
-
}
|
|
96
|
-
case 4:
|
|
97
|
-
return _context.a(2);
|
|
98
|
-
}
|
|
99
|
-
}, _callee, null, [[1, 3]]);
|
|
100
|
-
}));
|
|
101
|
-
return function loadMedia() {
|
|
102
|
-
return _ref2.apply(this, arguments);
|
|
103
|
-
};
|
|
104
|
-
}();
|
|
105
|
-
var handleVideoClick = function handleVideoClick(video) {
|
|
106
|
-
if (update_data) {
|
|
107
|
-
update_data(video.url || video);
|
|
108
|
-
}
|
|
109
|
-
if (closePopup) {
|
|
110
|
-
closePopup();
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
// Default classes with customization support
|
|
115
|
-
var defaultContainerClass = 'h-full flex flex-col justify-between';
|
|
116
|
-
var defaultGridClass = 'grid grid-cols-[repeat(auto-fill,minmax(calc(180px),1fr))] gap-5';
|
|
117
|
-
var defaultVideoItemClass = 'cursor-pointer w-full h-40 object-contain overflow-hidden bg-white rounded-md shadow-md hover:shadow-lg transition-shadow';
|
|
118
|
-
var defaultPaginationContainerClass = 'mb-4 bg-gray-100/90 p-4 sticky bottom-0';
|
|
119
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
120
|
-
className: className || defaultContainerClass,
|
|
121
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
122
|
-
className: gridClassName || defaultGridClass,
|
|
123
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FileUpload.default, {
|
|
124
|
-
loadMedia: loadMedia,
|
|
125
|
-
accept: "video/*",
|
|
126
|
-
title: "Add Video",
|
|
127
|
-
apiService: apiService,
|
|
128
|
-
onUploadError: onError
|
|
129
|
-
}), isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagesSkeleton.default, {}) : videos === null || videos === void 0 ? void 0 : videos.map(function (video, index) {
|
|
130
|
-
var videoUrl = typeof video === 'string' ? video : video.url;
|
|
131
|
-
var videoKey = video.id || video.url || index;
|
|
132
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("video", {
|
|
133
|
-
onClick: function onClick() {
|
|
134
|
-
return handleVideoClick(video);
|
|
135
|
-
},
|
|
136
|
-
className: videoItemClassName || defaultVideoItemClass,
|
|
137
|
-
controls: true,
|
|
138
|
-
src: videoUrl
|
|
139
|
-
}, videoKey);
|
|
140
|
-
})]
|
|
141
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
142
|
-
className: paginationContainerClassName || defaultPaginationContainerClass,
|
|
143
|
-
children: total_count > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pagination.default, {
|
|
144
|
-
nextPage: function nextPage(value) {
|
|
145
|
-
return loadMedia(value);
|
|
146
|
-
},
|
|
147
|
-
pageCount: Math.ceil(total_count / 30),
|
|
148
|
-
current_page: currentPage
|
|
149
|
-
})
|
|
150
|
-
})]
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
var _default = exports.default = VideosGallery;
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _VideosGallery.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _VideosGallery = _interopRequireDefault(require("../web/VideosGallery.web"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _VideosGallery.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _VideosGallery = _interopRequireDefault(require("../native/VideosGallery.native"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|