@scaleflex/widget-pixaforge 4.3.0 → 4.4.0
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/CHANGELOG.md +8 -0
- package/package.json +6 -6
- package/dist/style.css +0 -317
- package/dist/style.min.css +0 -1
- package/lib/api.service.js +0 -93
- package/lib/common.slice.js +0 -77
- package/lib/components/CategoriesCards/CategoryCard.js +0 -33
- package/lib/components/CategoriesCards/index.js +0 -48
- package/lib/components/CustomizeIcons/ColorCustomization.js +0 -159
- package/lib/components/CustomizeIcons/index.js +0 -105
- package/lib/components/GalleryViewsOptionsMenu.js +0 -97
- package/lib/components/IconsGallery/SingleIcon.js +0 -49
- package/lib/components/IconsGallery/index.js +0 -153
- package/lib/components/ImagesGallery/ImageCell.js +0 -59
- package/lib/components/ImagesGallery/LandscapesContainer.js +0 -28
- package/lib/components/ImagesGallery/PortraitsColumns.js +0 -72
- package/lib/components/ImagesGallery/index.js +0 -183
- package/lib/components/MainView.js +0 -102
- package/lib/components/TagsAndFoundLabel/TagItem.js +0 -23
- package/lib/components/TagsAndFoundLabel/index.js +0 -72
- package/lib/components/TopBar.js +0 -113
- package/lib/constants.js +0 -19
- package/lib/defaultLocale.js +0 -22
- package/lib/index.js +0 -327
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
5
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
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); }
|
|
7
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
-
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."); }
|
|
9
|
-
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; } }
|
|
10
|
-
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; }
|
|
11
|
-
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; } }
|
|
12
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
14
|
-
import { IconLabeledButton } from '@scaleflex/widget-common';
|
|
15
|
-
import { Remove } from '@scaleflex/icons';
|
|
16
|
-
import { Input, MenuItem, Select } from '@scaleflex/ui/core';
|
|
17
|
-
import hexToRgb from '@scaleflex/widget-utils/lib/hexToRgb';
|
|
18
|
-
import rgbToHex from '@scaleflex/widget-utils/lib/rgbToHex';
|
|
19
|
-
import ColorPicker from '@scaleflex/widget-common/lib/ColorPicker';
|
|
20
|
-
import { DEFAULT_ICONS_COLOR } from '../../constants';
|
|
21
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
var fixtureColors = ['green', '#cccccc', 'blue', 'magenta', '#ff0000', '#000000', 'cyan', '#ffffff', 'brown'];
|
|
23
|
-
var colorFormatOptions = {
|
|
24
|
-
HEX: 'HEX',
|
|
25
|
-
RGB: 'RGB'
|
|
26
|
-
};
|
|
27
|
-
var colorFormats = Object.values(colorFormatOptions);
|
|
28
|
-
var defaultIconsColorInRgb = hexToRgb(DEFAULT_ICONS_COLOR);
|
|
29
|
-
var inputChangeTimeout = null;
|
|
30
|
-
var ColorCustomization = function ColorCustomization(_ref) {
|
|
31
|
-
var color = _ref.color,
|
|
32
|
-
onChange = _ref.onChange,
|
|
33
|
-
iconPrimaryColor = _ref.iconPrimaryColor;
|
|
34
|
-
var _useState = useState(colorFormatOptions.HEX),
|
|
35
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
-
colorFormat = _useState2[0],
|
|
37
|
-
setColorFormat = _useState2[1];
|
|
38
|
-
var hexColor = useMemo(function () {
|
|
39
|
-
return _typeof(color) === 'object' ? rgbToHex(color.r, color.g, color.b) : color;
|
|
40
|
-
}, [color]);
|
|
41
|
-
var rgbColor = useMemo(function () {
|
|
42
|
-
return _typeof(color) === 'object' ? color : hexToRgb(color);
|
|
43
|
-
}, [color]);
|
|
44
|
-
var updateColorFromPicker = useCallback(function (newColor) {
|
|
45
|
-
onChange(colorFormat === colorFormatOptions.RGB ? rgbToHex(newColor) : newColor);
|
|
46
|
-
}, [colorFormat]);
|
|
47
|
-
var updateColorInHex = useCallback(function (event) {
|
|
48
|
-
var newColor = event.target.value;
|
|
49
|
-
if (inputChangeTimeout) {
|
|
50
|
-
clearTimeout(inputChangeTimeout);
|
|
51
|
-
}
|
|
52
|
-
inputChangeTimeout = setTimeout(function () {
|
|
53
|
-
onChange(newColor);
|
|
54
|
-
inputChangeTimeout = null;
|
|
55
|
-
}, 15);
|
|
56
|
-
}, []);
|
|
57
|
-
var updateColorInRgb = useCallback(function (event) {
|
|
58
|
-
var newColor = +event.target.value;
|
|
59
|
-
var colorChannel = event.target.name;
|
|
60
|
-
if (inputChangeTimeout) {
|
|
61
|
-
clearTimeout(inputChangeTimeout);
|
|
62
|
-
}
|
|
63
|
-
inputChangeTimeout = setTimeout(function () {
|
|
64
|
-
if (newColor >= 0 && newColor <= 255) {
|
|
65
|
-
onChange(function (latestVals) {
|
|
66
|
-
return _objectSpread(_objectSpread({}, latestVals), {}, _defineProperty({}, colorChannel, newColor));
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
inputChangeTimeout = null;
|
|
70
|
-
}, 15);
|
|
71
|
-
}, []);
|
|
72
|
-
var resetToDefaultColor = useCallback(function () {
|
|
73
|
-
onChange(DEFAULT_ICONS_COLOR);
|
|
74
|
-
}, []);
|
|
75
|
-
var changeColorFormat = useCallback(function (value) {
|
|
76
|
-
setColorFormat(function (latestValue) {
|
|
77
|
-
onChange(latestValue === colorFormatOptions.HEX ? rgbColor : hexColor);
|
|
78
|
-
return value;
|
|
79
|
-
});
|
|
80
|
-
}, [color]);
|
|
81
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
82
|
-
children: [/*#__PURE__*/_jsx(ColorPicker, {
|
|
83
|
-
colors: fixtureColors,
|
|
84
|
-
value: hexColor,
|
|
85
|
-
onChange: updateColorFromPicker,
|
|
86
|
-
width: 24,
|
|
87
|
-
height: 24,
|
|
88
|
-
itemMargin: "0 6px 8px 4px",
|
|
89
|
-
showPickerPanel: true
|
|
90
|
-
}), /*#__PURE__*/_jsx(Select, {
|
|
91
|
-
value: colorFormat,
|
|
92
|
-
className: "filerobot-Pixaforge-ColorCustomization",
|
|
93
|
-
onChange: changeColorFormat,
|
|
94
|
-
style: {
|
|
95
|
-
maxWidth: 80
|
|
96
|
-
},
|
|
97
|
-
children: colorFormats.map(function (format) {
|
|
98
|
-
return /*#__PURE__*/_jsx(MenuItem, {
|
|
99
|
-
value: format,
|
|
100
|
-
children: format
|
|
101
|
-
}, format);
|
|
102
|
-
})
|
|
103
|
-
}), colorFormat === colorFormatOptions.HEX && /*#__PURE__*/_jsx(Input, {
|
|
104
|
-
background: "primary",
|
|
105
|
-
onChange: updateColorInHex,
|
|
106
|
-
size: "md",
|
|
107
|
-
value: color,
|
|
108
|
-
placeholder: DEFAULT_ICONS_COLOR,
|
|
109
|
-
minLength: 3,
|
|
110
|
-
maxLength: 7
|
|
111
|
-
}), colorFormat === colorFormatOptions.RGB && /*#__PURE__*/_jsxs(_Fragment, {
|
|
112
|
-
children: [/*#__PURE__*/_jsx(Input, {
|
|
113
|
-
background: "primary",
|
|
114
|
-
onChange: updateColorInRgb,
|
|
115
|
-
size: "md",
|
|
116
|
-
name: "r",
|
|
117
|
-
value: rgbColor.r,
|
|
118
|
-
placeholder: defaultIconsColorInRgb.r,
|
|
119
|
-
inputMode: "numeric",
|
|
120
|
-
type: "number",
|
|
121
|
-
min: 1,
|
|
122
|
-
max: 255,
|
|
123
|
-
className: "filerobot-Pixaforge-ColorCustomization-rgbField"
|
|
124
|
-
}), /*#__PURE__*/_jsx(Input, {
|
|
125
|
-
background: "primary",
|
|
126
|
-
onChange: updateColorInRgb,
|
|
127
|
-
name: "g",
|
|
128
|
-
size: "md",
|
|
129
|
-
value: rgbColor.g,
|
|
130
|
-
placeholder: defaultIconsColorInRgb.g,
|
|
131
|
-
inputMode: "numeric",
|
|
132
|
-
type: "number",
|
|
133
|
-
min: 0,
|
|
134
|
-
max: 255,
|
|
135
|
-
className: "filerobot-Pixaforge-ColorCustomization-rgbField"
|
|
136
|
-
}), /*#__PURE__*/_jsx(Input, {
|
|
137
|
-
background: "primary",
|
|
138
|
-
onChange: updateColorInRgb,
|
|
139
|
-
name: "b",
|
|
140
|
-
size: "md",
|
|
141
|
-
value: rgbColor.b,
|
|
142
|
-
placeholder: defaultIconsColorInRgb.b,
|
|
143
|
-
inputMode: "numeric",
|
|
144
|
-
type: "number",
|
|
145
|
-
min: 0,
|
|
146
|
-
max: 255,
|
|
147
|
-
className: "filerobot-Pixaforge-ColorCustomization-rgbField"
|
|
148
|
-
})]
|
|
149
|
-
}), /*#__PURE__*/_jsx(IconLabeledButton, {
|
|
150
|
-
icon: /*#__PURE__*/_jsx(Remove, {
|
|
151
|
-
color: iconPrimaryColor
|
|
152
|
-
}),
|
|
153
|
-
onClick: resetToDefaultColor,
|
|
154
|
-
classes: "filerobot-Pixaforge-ColorCustomization-removeButton",
|
|
155
|
-
size: "small"
|
|
156
|
-
})]
|
|
157
|
-
});
|
|
158
|
-
};
|
|
159
|
-
export default ColorCustomization;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
5
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
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); }
|
|
7
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
10
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
11
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
12
|
-
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."); }
|
|
13
|
-
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; } }
|
|
14
|
-
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; }
|
|
15
|
-
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; } }
|
|
16
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
17
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
18
|
-
import { useDispatch } from 'react-redux';
|
|
19
|
-
import { QuestionMarkOutline } from '@scaleflex/icons';
|
|
20
|
-
import { TooltipV2 } from '@scaleflex/ui/core';
|
|
21
|
-
import rgbToHex from '@scaleflex/widget-utils/lib/rgbToHex';
|
|
22
|
-
import { PC } from '@scaleflex/widget-common';
|
|
23
|
-
import { useTheme } from '@scaleflex/ui/theme/hooks';
|
|
24
|
-
import { DEFAULT_ICONS_COLOR } from '../../constants';
|
|
25
|
-
import SingleIcon from '../IconsGallery/SingleIcon';
|
|
26
|
-
import ColorCustomization from './ColorCustomization';
|
|
27
|
-
import { customizedIconsUpdated, pixaforgeCommonStateUpdated } from '../../common.slice';
|
|
28
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
|
-
var CustomizeIcons = function CustomizeIcons(_ref) {
|
|
30
|
-
var icons = _ref.icons,
|
|
31
|
-
i18n = _ref.i18n;
|
|
32
|
-
var dispatch = useDispatch();
|
|
33
|
-
var theme = useTheme();
|
|
34
|
-
var iconPrimaryColor = theme.palette[PC.IconsPrimary];
|
|
35
|
-
var _useState = useState([]),
|
|
36
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
-
selectedIconsUids = _useState2[0],
|
|
38
|
-
setSelectedIconsUids = _useState2[1];
|
|
39
|
-
var _useState3 = useState(DEFAULT_ICONS_COLOR),
|
|
40
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
-
color = _useState4[0],
|
|
42
|
-
setColor = _useState4[1];
|
|
43
|
-
var toggleSelection = useCallback(function (icon, isSelected) {
|
|
44
|
-
setSelectedIconsUids(isSelected ? selectedIconsUids.filter(function (uid) {
|
|
45
|
-
return uid !== icon.uid;
|
|
46
|
-
}) : [].concat(_toConsumableArray(selectedIconsUids), [icon.uid]));
|
|
47
|
-
}, [selectedIconsUids]);
|
|
48
|
-
var checkIsSelected = useCallback(function (checkedIcon) {
|
|
49
|
-
return selectedIconsUids.includes(checkedIcon.uid);
|
|
50
|
-
}, [selectedIconsUids]);
|
|
51
|
-
useEffect(function () {
|
|
52
|
-
if (selectedIconsUids.length > 0) {
|
|
53
|
-
var hexColor = _typeof(color) === 'object' ? rgbToHex(color.r, color.g, color.b) : color;
|
|
54
|
-
var updatedCustomizedIcons = icons.map(function (icon) {
|
|
55
|
-
return checkIsSelected(icon) && icon.color !== hexColor ? _objectSpread(_objectSpread({}, icon), {}, {
|
|
56
|
-
color: hexColor
|
|
57
|
-
}) : icon;
|
|
58
|
-
});
|
|
59
|
-
dispatch(customizedIconsUpdated(updatedCustomizedIcons));
|
|
60
|
-
}
|
|
61
|
-
}, [selectedIconsUids, color]);
|
|
62
|
-
|
|
63
|
-
// Reset state after closing the component.
|
|
64
|
-
useEffect(function () {
|
|
65
|
-
return function () {
|
|
66
|
-
dispatch(pixaforgeCommonStateUpdated({
|
|
67
|
-
currentSelection: [],
|
|
68
|
-
customizedIcons: []
|
|
69
|
-
}));
|
|
70
|
-
};
|
|
71
|
-
}, []);
|
|
72
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
73
|
-
className: "filerobot-Pixaforge-CustomizeIcons",
|
|
74
|
-
children: [/*#__PURE__*/_jsxs("div", {
|
|
75
|
-
className: "filerobot-Pixaforge-CustomizedIcons-title",
|
|
76
|
-
children: [i18n('pixaforgeCustomizedIconsLabel', {
|
|
77
|
-
smart_count: icons.length
|
|
78
|
-
}), /*#__PURE__*/_jsx(TooltipV2, {
|
|
79
|
-
arrow: true,
|
|
80
|
-
position: "right",
|
|
81
|
-
size: "sm",
|
|
82
|
-
title: i18n('pixaforgeCustomizedIconsTitle'),
|
|
83
|
-
children: /*#__PURE__*/_jsx(QuestionMarkOutline, {
|
|
84
|
-
color: iconPrimaryColor
|
|
85
|
-
})
|
|
86
|
-
})]
|
|
87
|
-
}), /*#__PURE__*/_jsx(ColorCustomization, {
|
|
88
|
-
color: color,
|
|
89
|
-
onChange: setColor,
|
|
90
|
-
iconPrimaryColor: iconPrimaryColor
|
|
91
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
92
|
-
className: "filerobot-Pixaforge-CustomizeIcons-iconsWrapper",
|
|
93
|
-
children: icons.map(function (icon) {
|
|
94
|
-
return /*#__PURE__*/_jsx(SingleIcon, _objectSpread(_objectSpread({
|
|
95
|
-
toggleIconSelection: toggleSelection,
|
|
96
|
-
isSelected: checkIsSelected(icon),
|
|
97
|
-
loadingErrorMsg: i18n('pixaforgeFailedToLoadIconError')
|
|
98
|
-
}, icon), {}, {
|
|
99
|
-
children: icon.svgStringified
|
|
100
|
-
}), icon.uid);
|
|
101
|
-
})
|
|
102
|
-
})]
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
export default CustomizeIcons;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
-
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."); }
|
|
3
|
-
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; } }
|
|
4
|
-
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; }
|
|
5
|
-
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; } }
|
|
6
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
-
import { useCallback, useState } from 'react';
|
|
8
|
-
import { IconLabeledButton, PC, Radiobox } from '@scaleflex/widget-common';
|
|
9
|
-
import { ViewOptions } from '@scaleflex/icons';
|
|
10
|
-
import { Menu, MenuItem } from '@scaleflex/ui/core';
|
|
11
|
-
import { IMAGES_GALLERY_VIEWS } from '../constants';
|
|
12
|
-
import { useTheme } from '@scaleflex/ui/theme/hooks';
|
|
13
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
14
|
-
import { galleryViewChanged, selectGalleryView } from '../common.slice';
|
|
15
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
var GalleryViewsOptionsMenu = function GalleryViewsOptionsMenu(_ref) {
|
|
17
|
-
var i18n = _ref.i18n;
|
|
18
|
-
var dispatch = useDispatch();
|
|
19
|
-
var theme = useTheme();
|
|
20
|
-
var galleryView = useSelector(selectGalleryView);
|
|
21
|
-
var _useState = useState(null),
|
|
22
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
-
anchorEl = _useState2[0],
|
|
24
|
-
setAnchorEl = _useState2[1];
|
|
25
|
-
var iconPrimaryColor = theme.palette[PC.IconsPrimary];
|
|
26
|
-
var iconAccentColor = theme.palette[PC.AccentPrimary];
|
|
27
|
-
var setElement = useCallback(function (e) {
|
|
28
|
-
setAnchorEl(e.currentTarget);
|
|
29
|
-
}, []);
|
|
30
|
-
var clearElement = useCallback(function () {
|
|
31
|
-
setAnchorEl(null);
|
|
32
|
-
}, []);
|
|
33
|
-
var selectOption = useCallback(function (newOption) {
|
|
34
|
-
dispatch(galleryViewChanged(newOption));
|
|
35
|
-
clearElement();
|
|
36
|
-
}, []);
|
|
37
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
38
|
-
children: [/*#__PURE__*/_jsx(IconLabeledButton, {
|
|
39
|
-
icon: /*#__PURE__*/_jsx(ViewOptions, {
|
|
40
|
-
color: iconPrimaryColor
|
|
41
|
-
}),
|
|
42
|
-
onClick: setElement
|
|
43
|
-
}), /*#__PURE__*/_jsx(Menu, {
|
|
44
|
-
anchorEl: anchorEl,
|
|
45
|
-
enableOverlay: true,
|
|
46
|
-
onClose: clearElement,
|
|
47
|
-
open: Boolean(anchorEl),
|
|
48
|
-
position: "bottom",
|
|
49
|
-
children: /*#__PURE__*/_jsx(MenuItem, {
|
|
50
|
-
list: [{
|
|
51
|
-
content: i18n('pixaforgeStandardPortraitsTitle'),
|
|
52
|
-
key: IMAGES_GALLERY_VIEWS.STANDARD_PORTRAITS,
|
|
53
|
-
onClick: function onClick() {
|
|
54
|
-
return selectOption(IMAGES_GALLERY_VIEWS.STANDARD_PORTRAITS);
|
|
55
|
-
},
|
|
56
|
-
prefix: /*#__PURE__*/_jsx(Radiobox, {
|
|
57
|
-
style: {
|
|
58
|
-
padding: 0
|
|
59
|
-
},
|
|
60
|
-
color: iconAccentColor,
|
|
61
|
-
iconPrimaryColor: iconPrimaryColor,
|
|
62
|
-
checked: galleryView === IMAGES_GALLERY_VIEWS.STANDARD_PORTRAITS
|
|
63
|
-
})
|
|
64
|
-
}, {
|
|
65
|
-
content: i18n('pixaforgeSmallPortraitsTitle'),
|
|
66
|
-
key: IMAGES_GALLERY_VIEWS.SMALL_PORTRAITS,
|
|
67
|
-
onClick: function onClick() {
|
|
68
|
-
return selectOption(IMAGES_GALLERY_VIEWS.SMALL_PORTRAITS);
|
|
69
|
-
},
|
|
70
|
-
prefix: /*#__PURE__*/_jsx(Radiobox, {
|
|
71
|
-
style: {
|
|
72
|
-
padding: 0
|
|
73
|
-
},
|
|
74
|
-
color: iconAccentColor,
|
|
75
|
-
iconPrimaryColor: iconPrimaryColor,
|
|
76
|
-
checked: galleryView === IMAGES_GALLERY_VIEWS.SMALL_PORTRAITS
|
|
77
|
-
})
|
|
78
|
-
}, {
|
|
79
|
-
content: i18n('pixaforgeStandardLandscapesTitle'),
|
|
80
|
-
key: IMAGES_GALLERY_VIEWS.STANDARD_LANDSCAPES,
|
|
81
|
-
onClick: function onClick() {
|
|
82
|
-
return selectOption(IMAGES_GALLERY_VIEWS.STANDARD_LANDSCAPES);
|
|
83
|
-
},
|
|
84
|
-
prefix: /*#__PURE__*/_jsx(Radiobox, {
|
|
85
|
-
style: {
|
|
86
|
-
padding: 0
|
|
87
|
-
},
|
|
88
|
-
color: iconAccentColor,
|
|
89
|
-
iconPrimaryColor: iconPrimaryColor,
|
|
90
|
-
checked: galleryView === IMAGES_GALLERY_VIEWS.STANDARD_LANDSCAPES
|
|
91
|
-
})
|
|
92
|
-
}]
|
|
93
|
-
})
|
|
94
|
-
})]
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
export default GalleryViewsOptionsMenu;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var _excluded = ["isSelected", "toggleIconSelection", "loadingErrorMsg", "children"];
|
|
2
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
3
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import { memo, useCallback, useRef } from 'react';
|
|
5
|
-
import { Checkbox, SVGUrlToElement } from '@scaleflex/widget-common';
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
var SingleIcon = function SingleIcon(_ref) {
|
|
8
|
-
var isSelected = _ref.isSelected,
|
|
9
|
-
toggleIconSelection = _ref.toggleIconSelection,
|
|
10
|
-
loadingErrorMsg = _ref.loadingErrorMsg,
|
|
11
|
-
children = _ref.children,
|
|
12
|
-
icon = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
-
var svgElementStringified = useRef();
|
|
14
|
-
var onIconLoad = useCallback(function (svgElementString) {
|
|
15
|
-
if (!svgElementStringified.current) {
|
|
16
|
-
svgElementStringified.current = svgElementString;
|
|
17
|
-
}
|
|
18
|
-
}, []);
|
|
19
|
-
var toggleSelection = useCallback(function () {
|
|
20
|
-
toggleIconSelection(icon, isSelected, svgElementStringified.current);
|
|
21
|
-
}, [icon, isSelected]);
|
|
22
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
23
|
-
onClick: toggleSelection,
|
|
24
|
-
className: "filerobot-Pixaforge-SingleIcon".concat(isSelected ? ' filerobot-Pixaforge-SingleIcon--selected' : ''),
|
|
25
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
26
|
-
className: "filerobot-Pixaforge-overlay",
|
|
27
|
-
children: /*#__PURE__*/_jsx(Checkbox, {
|
|
28
|
-
checked: isSelected,
|
|
29
|
-
style: {
|
|
30
|
-
margin: 4
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
34
|
-
className: "filerobot-Pixaforge-SingleIcon-icon",
|
|
35
|
-
style: {
|
|
36
|
-
color: icon.color
|
|
37
|
-
},
|
|
38
|
-
dangerouslySetInnerHTML: children ? {
|
|
39
|
-
__html: children
|
|
40
|
-
} : undefined,
|
|
41
|
-
children: !children ? /*#__PURE__*/_jsx(SVGUrlToElement, {
|
|
42
|
-
url: icon.src,
|
|
43
|
-
errorMsg: "".concat(loadingErrorMsg).concat(icon.alt ? ": ".concat(icon.alt) : ''),
|
|
44
|
-
onLoad: onIconLoad
|
|
45
|
-
}) : undefined
|
|
46
|
-
})]
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
export default /*#__PURE__*/memo(SingleIcon);
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
10
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
11
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
12
|
-
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."); }
|
|
13
|
-
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; } }
|
|
14
|
-
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; }
|
|
15
|
-
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; } }
|
|
16
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
17
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
18
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
19
|
-
import { Spinner } from '@scaleflex/widget-common';
|
|
20
|
-
import { useCore } from '@scaleflex/widget-core/lib/hooks';
|
|
21
|
-
import { getIconsAndTags } from '../../api.service';
|
|
22
|
-
import TagsAndFoundLabel from '../TagsAndFoundLabel';
|
|
23
|
-
import SingleIcon from './SingleIcon';
|
|
24
|
-
import { currentSelectionsUpdated, selectCurrentSelection } from '../../common.slice';
|
|
25
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
-
var _isScrollingFetchAvailable = true;
|
|
27
|
-
var spinnerStyles = {
|
|
28
|
-
height: 'auto',
|
|
29
|
-
bottom: 0,
|
|
30
|
-
position: 'absolute'
|
|
31
|
-
};
|
|
32
|
-
var IconsGallery = function IconsGallery(_ref) {
|
|
33
|
-
var i18n = _ref.i18n,
|
|
34
|
-
setIsLoading = _ref.setIsLoading,
|
|
35
|
-
info = _ref.info,
|
|
36
|
-
searchKeyword = _ref.searchKeyword;
|
|
37
|
-
var dispatch = useDispatch();
|
|
38
|
-
var _useCore = useCore(),
|
|
39
|
-
isFileRestrictedToGetAdded = _useCore.isFileRestrictedToGetAdded;
|
|
40
|
-
var currentSelection = useSelector(selectCurrentSelection);
|
|
41
|
-
var _useState = useState([]),
|
|
42
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
-
icons = _useState2[0],
|
|
44
|
-
setIcons = _useState2[1];
|
|
45
|
-
var _useState3 = useState([]),
|
|
46
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
-
tags = _useState4[0],
|
|
48
|
-
setTags = _useState4[1];
|
|
49
|
-
var _useState5 = useState(),
|
|
50
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
51
|
-
totalCount = _useState6[0],
|
|
52
|
-
setTotalCount = _useState6[1];
|
|
53
|
-
var _useState7 = useState(false),
|
|
54
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
55
|
-
isFetching = _useState8[0],
|
|
56
|
-
setIsFetching = _useState8[1];
|
|
57
|
-
var _useState9 = useState(true),
|
|
58
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
59
|
-
isFirstRender = _useState10[0],
|
|
60
|
-
setIsFirstRender = _useState10[1];
|
|
61
|
-
var latestFilters = useRef();
|
|
62
|
-
var fetchIconsAndTags = useCallback(function (filters) {
|
|
63
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
64
|
-
if (!isFirstRender && offset !== 0) {
|
|
65
|
-
setIsFetching(true);
|
|
66
|
-
} else if (offset === 0) {
|
|
67
|
-
setIsLoading(true);
|
|
68
|
-
}
|
|
69
|
-
getIconsAndTags(filters, offset).then(function (_ref2) {
|
|
70
|
-
var tags = _ref2.tags,
|
|
71
|
-
icons = _ref2.icons,
|
|
72
|
-
totalCount = _ref2.totalCount;
|
|
73
|
-
setTags(function (latestTags) {
|
|
74
|
-
return _toConsumableArray(new Set([].concat(_toConsumableArray(latestTags), _toConsumableArray(tags.map(function (t) {
|
|
75
|
-
return t.tag;
|
|
76
|
-
})))));
|
|
77
|
-
});
|
|
78
|
-
setIcons(function (latestIcons) {
|
|
79
|
-
return offset ? [].concat(_toConsumableArray(latestIcons), _toConsumableArray(icons)) : icons;
|
|
80
|
-
});
|
|
81
|
-
setTotalCount(totalCount);
|
|
82
|
-
})["finally"](function () {
|
|
83
|
-
latestFilters.current = filters;
|
|
84
|
-
setIsLoading(false);
|
|
85
|
-
setIsFetching(false);
|
|
86
|
-
_isScrollingFetchAvailable = true;
|
|
87
|
-
});
|
|
88
|
-
}, []);
|
|
89
|
-
var toggleIconSelection = useCallback(function (icon, isSelected, svgElementStringified) {
|
|
90
|
-
if (!isSelected && isFileRestrictedToGetAdded(currentSelection, icon)) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (!svgElementStringified) {
|
|
94
|
-
info(i18n('pixaforgeIconSelectError'), 'error', 4000);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
dispatch(currentSelectionsUpdated(isSelected ? currentSelection.filter(function (selectedIcon) {
|
|
98
|
-
return selectedIcon.uid !== icon.uid;
|
|
99
|
-
}) : [].concat(_toConsumableArray(currentSelection), [_objectSpread(_objectSpread({}, icon), {}, {
|
|
100
|
-
svgStringified: svgElementStringified
|
|
101
|
-
})])));
|
|
102
|
-
}, [currentSelection]);
|
|
103
|
-
var checkIsSelected = useCallback(function (icon) {
|
|
104
|
-
return currentSelection.some(function (selectedIcon) {
|
|
105
|
-
return selectedIcon.uid === icon.uid;
|
|
106
|
-
});
|
|
107
|
-
}, [currentSelection]);
|
|
108
|
-
var handleTagsChange = useCallback(function (tags) {
|
|
109
|
-
fetchIconsAndTags(searchKeyword ? [searchKeyword].concat(_toConsumableArray(tags)) : tags);
|
|
110
|
-
}, [searchKeyword]);
|
|
111
|
-
var handleScroll = useCallback(function (e) {
|
|
112
|
-
var elem = e.currentTarget;
|
|
113
|
-
var iconsCount = icons.length;
|
|
114
|
-
if (_isScrollingFetchAvailable && elem.scrollHeight - (elem.scrollTop + elem.offsetHeight) < 75 && iconsCount !== totalCount) {
|
|
115
|
-
_isScrollingFetchAvailable = false;
|
|
116
|
-
fetchIconsAndTags(latestFilters.current, iconsCount);
|
|
117
|
-
}
|
|
118
|
-
}, [icons, totalCount]);
|
|
119
|
-
useEffect(function () {
|
|
120
|
-
fetchIconsAndTags(searchKeyword ? [searchKeyword] : undefined);
|
|
121
|
-
if (isFirstRender) {
|
|
122
|
-
setIsFirstRender(false);
|
|
123
|
-
}
|
|
124
|
-
}, [searchKeyword]);
|
|
125
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
126
|
-
className: "filerobot-Pixaforge-IconsGallery",
|
|
127
|
-
children: [!isFirstRender && /*#__PURE__*/_jsx(TagsAndFoundLabel, {
|
|
128
|
-
tags: tags,
|
|
129
|
-
foundLabelCount: totalCount,
|
|
130
|
-
i18n: i18n,
|
|
131
|
-
onChange: handleTagsChange
|
|
132
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
133
|
-
className: "filerobot-Pixaforge-IconsGallery-icons",
|
|
134
|
-
onScroll: handleScroll,
|
|
135
|
-
children: [!isFirstRender && totalCount === 0 && icons.length === 0 && /*#__PURE__*/_jsx("div", {
|
|
136
|
-
className: "filerobot-c-empty",
|
|
137
|
-
children: i18n('pixaforgeNoIconsFoundText')
|
|
138
|
-
}), icons.length > 0 && icons.map(function (icon, i) {
|
|
139
|
-
return /*#__PURE__*/_jsx(SingleIcon
|
|
140
|
-
// TODO: [change this] index of the array is used as temp solutin till BE fix the issue of repeated vals on fetching more
|
|
141
|
-
, _objectSpread({
|
|
142
|
-
toggleIconSelection: toggleIconSelection,
|
|
143
|
-
isSelected: checkIsSelected(icon),
|
|
144
|
-
loadingErrorMsg: i18n('pixaforgeFailedToLoadIconError')
|
|
145
|
-
}, icon), "".concat(icon.uid, "-").concat(i));
|
|
146
|
-
}), isFetching && /*#__PURE__*/_jsx(Spinner, {
|
|
147
|
-
style: spinnerStyles,
|
|
148
|
-
fillContainer: true
|
|
149
|
-
})]
|
|
150
|
-
})]
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
export default IconsGallery;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var _excluded = ["isSelected", "toggleImageSelection", "showImageInfo"];
|
|
2
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
3
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
import { Checkbox, Image } from '@scaleflex/widget-common';
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
var ImageCell = function ImageCell(_ref) {
|
|
8
|
-
var _image$ratio, _image$preview;
|
|
9
|
-
var isSelected = _ref.isSelected,
|
|
10
|
-
toggleImageSelection = _ref.toggleImageSelection,
|
|
11
|
-
showImageInfo = _ref.showImageInfo,
|
|
12
|
-
image = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
14
|
-
className: "filerobot-Pixaforge-ImageCell".concat(isSelected ? ' filerobot-Pixaforge-ImageCell--selected' : ''),
|
|
15
|
-
onClick: function onClick() {
|
|
16
|
-
return toggleImageSelection(image, isSelected);
|
|
17
|
-
},
|
|
18
|
-
children: [/*#__PURE__*/_jsxs("div", {
|
|
19
|
-
className: "filerobot-Pixaforge-overlay",
|
|
20
|
-
children: [/*#__PURE__*/_jsx(Checkbox, {
|
|
21
|
-
checked: isSelected,
|
|
22
|
-
style: {
|
|
23
|
-
margin: 4
|
|
24
|
-
}
|
|
25
|
-
}), showImageInfo && /*#__PURE__*/_jsxs("div", {
|
|
26
|
-
className: "filerobot-Pixaforge-ImageCell-imageInfo",
|
|
27
|
-
children: [/*#__PURE__*/_jsxs("div", {
|
|
28
|
-
className: "filerobot-Pixaforge-ImageCell-authorAndTitle",
|
|
29
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
30
|
-
className: "filerobot-Pixaforge-ImageCell-author",
|
|
31
|
-
children: image.author
|
|
32
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
33
|
-
className: "filerobot-Pixaforge-ImageCell-title",
|
|
34
|
-
children: image.title
|
|
35
|
-
})]
|
|
36
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
37
|
-
className: "filerobot-Pixaforge-ImageCell-imageMeta",
|
|
38
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
39
|
-
children: image.type
|
|
40
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
41
|
-
children: image.size
|
|
42
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
43
|
-
children: image.resolution
|
|
44
|
-
})]
|
|
45
|
-
})]
|
|
46
|
-
})]
|
|
47
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
48
|
-
className: "filerobot-Pixaforge-ImageCell-imageWrapper",
|
|
49
|
-
style: {
|
|
50
|
-
aspectRatio: "".concat((_image$ratio = image.ratio) !== null && _image$ratio !== void 0 ? _image$ratio : 1)
|
|
51
|
-
},
|
|
52
|
-
children: /*#__PURE__*/_jsx(Image, {
|
|
53
|
-
src: (_image$preview = image.preview) !== null && _image$preview !== void 0 ? _image$preview : image.src,
|
|
54
|
-
alt: image.tags.join(', ')
|
|
55
|
-
})
|
|
56
|
-
})]
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
export default /*#__PURE__*/memo(ImageCell);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
import { useMemo } from 'react';
|
|
8
|
-
import ImageCell from './ImageCell';
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
var LandscapesContainer = function LandscapesContainer(_ref) {
|
|
11
|
-
var images = _ref.images,
|
|
12
|
-
checkIsSelected = _ref.checkIsSelected,
|
|
13
|
-
toggleImageSelection = _ref.toggleImageSelection;
|
|
14
|
-
var renderImagesCells = useMemo(function () {
|
|
15
|
-
return images.map(function (image) {
|
|
16
|
-
return /*#__PURE__*/_jsx(ImageCell, _objectSpread({
|
|
17
|
-
toggleImageSelection: toggleImageSelection,
|
|
18
|
-
isSelected: checkIsSelected(image),
|
|
19
|
-
showImageInfo: true
|
|
20
|
-
}, image), image.id);
|
|
21
|
-
});
|
|
22
|
-
}, [images, checkIsSelected]);
|
|
23
|
-
return /*#__PURE__*/_jsx("div", {
|
|
24
|
-
className: "filerobot-Pixaforge-LandscapesContainer",
|
|
25
|
-
children: renderImagesCells
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
export default LandscapesContainer;
|