argous 1.2.134 → 1.2.138
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/dist/actions/index.d.ts +58 -0
- package/dist/actions/index.js +59 -0
- package/dist/api/WebSocket.d.ts +25 -0
- package/dist/api/WebSocket.js +170 -0
- package/dist/api/index.d.ts +63 -0
- package/dist/api/index.js +762 -0
- package/dist/api/ws.d.ts +4 -0
- package/dist/api/ws.js +36 -0
- package/dist/components/Alert/Alert.d.ts +8 -0
- package/dist/components/Alert/Alert.js +68 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/Alert/index.js +8 -0
- package/dist/components/ArgousAction/ArgousAction.d.ts +8 -0
- package/dist/components/ArgousAction/ArgousAction.js +87 -0
- package/dist/components/ArgousAction/index.d.ts +2 -0
- package/dist/components/ArgousAction/index.js +8 -0
- package/dist/components/ArgousAvatar/ArgousAvatar.d.ts +14 -0
- package/dist/components/ArgousAvatar/ArgousAvatar.js +124 -0
- package/dist/components/ArgousAvatar/index.d.ts +2 -0
- package/dist/components/ArgousAvatar/index.js +8 -0
- package/dist/components/ArgousComplexPagination/ArgousComplexPagination.d.ts +76 -0
- package/dist/components/ArgousComplexPagination/ArgousComplexPagination.js +156 -0
- package/dist/components/ArgousComplexPagination/index.d.ts +2 -0
- package/dist/components/ArgousComplexPagination/index.js +8 -0
- package/dist/components/ArgousComplexTable/ArgousComplexTable.d.ts +131 -0
- package/dist/components/ArgousComplexTable/ArgousComplexTable.js +333 -0
- package/dist/components/ArgousComplexTable/index.d.ts +2 -0
- package/dist/components/ArgousComplexTable/index.js +8 -0
- package/dist/components/ArgousComplexTableBody/ArgousComplexTableBody.d.ts +177 -0
- package/dist/components/ArgousComplexTableBody/ArgousComplexTableBody.js +155 -0
- package/dist/components/ArgousComplexTableBody/index.d.ts +2 -0
- package/dist/components/ArgousComplexTableBody/index.js +8 -0
- package/dist/components/ArgousComplexTableHead/ArgousComplexTableHead.d.ts +73 -0
- package/dist/components/ArgousComplexTableHead/ArgousComplexTableHead.js +88 -0
- package/dist/components/ArgousComplexTableHead/index.d.ts +2 -0
- package/dist/components/ArgousComplexTableHead/index.js +8 -0
- package/dist/components/ArgousComplexTableToolbar/ArgousComplexTableToolBar.d.ts +58 -0
- package/dist/components/ArgousComplexTableToolbar/ArgousComplexTableToolBar.js +70 -0
- package/dist/components/ArgousComplexTableToolbar/index.d.ts +2 -0
- package/dist/components/ArgousComplexTableToolbar/index.js +8 -0
- package/dist/components/ArgousInput/ArgousInput.d.ts +8 -0
- package/dist/components/ArgousInput/ArgousInput.js +578 -0
- package/dist/components/ArgousInput/index.d.ts +2 -0
- package/dist/components/ArgousInput/index.js +8 -0
- package/dist/components/ArgousPagination/ArgousPagination.d.ts +8 -0
- package/dist/components/ArgousPagination/ArgousPagination.js +29 -0
- package/dist/components/ArgousPagination/index.d.ts +2 -0
- package/dist/components/ArgousPagination/index.js +8 -0
- package/dist/components/ArgousProgressBar/ArgousProgressBar.d.ts +22 -0
- package/dist/components/ArgousProgressBar/ArgousProgressBar.js +162 -0
- package/dist/components/ArgousProgressBar/index.d.ts +2 -0
- package/dist/components/ArgousProgressBar/index.js +8 -0
- package/dist/components/ArgousSimpleTable/ArgousSimpleTable.d.ts +8 -0
- package/dist/components/ArgousSimpleTable/ArgousSimpleTable.js +201 -0
- package/dist/components/ArgousSimpleTable/index.d.ts +2 -0
- package/dist/components/ArgousSimpleTable/index.js +8 -0
- package/dist/components/AutoComplete/AutoComplete.d.ts +8 -0
- package/dist/components/AutoComplete/AutoComplete.js +185 -0
- package/dist/components/AutoComplete/index.d.ts +2 -0
- package/dist/components/AutoComplete/index.js +8 -0
- package/dist/components/AutoCompleteFavorites/AutoCompleteFavorites.d.ts +20 -0
- package/dist/components/AutoCompleteFavorites/AutoCompleteFavorites.js +331 -0
- package/dist/components/AutoCompleteFavorites/index.d.ts +1 -0
- package/dist/components/AutoCompleteFavorites/index.js +8 -0
- package/dist/components/BarChart/BarChart.d.ts +8 -0
- package/dist/components/BarChart/BarChart.js +125 -0
- package/dist/components/BarChart/index.d.ts +2 -0
- package/dist/components/BarChart/index.js +8 -0
- package/dist/components/BarraFerramentas/BarraFerramentas.d.ts +21 -0
- package/dist/components/BarraFerramentas/BarraFerramentas.js +228 -0
- package/dist/components/BarraFerramentas/index.d.ts +2 -0
- package/dist/components/BarraFerramentas/index.js +8 -0
- package/dist/components/Button/Button.d.ts +8 -0
- package/dist/components/Button/Button.js +144 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +8 -0
- package/dist/components/Cabecalho/Cabecalho.d.ts +8 -0
- package/dist/components/Cabecalho/Cabecalho.js +231 -0
- package/dist/components/Cabecalho/index.d.ts +2 -0
- package/dist/components/Cabecalho/index.js +8 -0
- package/dist/components/Calendar/Calendar.d.ts +8 -0
- package/dist/components/Calendar/Calendar.js +171 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Calendar/index.js +8 -0
- package/dist/components/CartaoUsuario/CartaoUsuario.d.ts +9 -0
- package/dist/components/CartaoUsuario/CartaoUsuario.js +165 -0
- package/dist/components/CartaoUsuario/index.d.ts +2 -0
- package/dist/components/CartaoUsuario/index.js +8 -0
- package/dist/components/Collapse/Collapse.d.ts +60 -0
- package/dist/components/Collapse/Collapse.js +290 -0
- package/dist/components/Collapse/index.d.ts +3 -0
- package/dist/components/Collapse/index.js +8 -0
- package/dist/components/Compartilhar/Compartilhar.d.ts +7 -0
- package/dist/components/Compartilhar/Compartilhar.js +266 -0
- package/dist/components/Compartilhar/index.d.ts +2 -0
- package/dist/components/Compartilhar/index.js +8 -0
- package/dist/components/ConfirmModal/BasicModal.d.ts +38 -0
- package/dist/components/ConfirmModal/BasicModal.js +29 -0
- package/dist/components/ConfirmModal/ModalProvider.d.ts +5 -0
- package/dist/components/ConfirmModal/ModalProvider.js +108 -0
- package/dist/components/ConfirmModal/WrapperModal.d.ts +18 -0
- package/dist/components/ConfirmModal/WrapperModal.js +41 -0
- package/dist/components/ConfirmModal/index.d.ts +20 -0
- package/dist/components/ConfirmModal/index.js +25 -0
- package/dist/components/DropArea/DropArea.d.ts +21 -0
- package/dist/components/DropArea/DropArea.js +149 -0
- package/dist/components/DropArea/Html5FileSelector.d.ts +16 -0
- package/dist/components/DropArea/Html5FileSelector.js +229 -0
- package/dist/components/DropArea/index.d.ts +2 -0
- package/dist/components/DropArea/index.js +8 -0
- package/dist/components/Editor/Events.d.ts +79 -0
- package/dist/components/Editor/Events.js +9 -0
- package/dist/components/Editor/ScriptLoader.d.ts +20 -0
- package/dist/components/Editor/ScriptLoader.js +70 -0
- package/dist/components/Editor/TinyMCE.d.ts +10 -0
- package/dist/components/Editor/TinyMCE.js +16 -0
- package/dist/components/Editor/Utils.d.ts +19 -0
- package/dist/components/Editor/Utils.js +62 -0
- package/dist/components/Editor/components/Editor.d.ts +67 -0
- package/dist/components/Editor/components/Editor.js +351 -0
- package/dist/components/Editor/components/EditorPropTypes.d.ts +18 -0
- package/dist/components/Editor/components/EditorPropTypes.js +110 -0
- package/dist/components/Editor/index.d.ts +9 -0
- package/dist/components/Editor/index.js +12 -0
- package/dist/components/Editor/tinymce/tinymce.d.ts +2963 -0
- package/dist/components/FilePreparer/FilePreparer.d.ts +26 -0
- package/dist/components/FilePreparer/FilePreparer.js +279 -0
- package/dist/components/FilePreparer/index.d.ts +2 -0
- package/dist/components/FilePreparer/index.js +8 -0
- package/dist/components/FileUploader/FileUploader.d.ts +9 -0
- package/dist/components/FileUploader/FileUploader.js +445 -0
- package/dist/components/FileUploader/index.d.ts +2 -0
- package/dist/components/FileUploader/index.js +8 -0
- package/dist/components/FormVisualizer/FormVisualizer.d.ts +92 -0
- package/dist/components/FormVisualizer/FormVisualizer.js +264 -0
- package/dist/components/FormVisualizer/index.d.ts +2 -0
- package/dist/components/FormVisualizer/index.js +8 -0
- package/dist/components/Highlight/Highlight.d.ts +7 -0
- package/dist/components/Highlight/Highlight.js +75 -0
- package/dist/components/Highlight/index.d.ts +2 -0
- package/dist/components/Highlight/index.js +8 -0
- package/dist/components/ImageResize/ImageResize.d.ts +28 -0
- package/dist/components/ImageResize/ImageResize.js +472 -0
- package/dist/components/ImageResize/index.d.ts +2 -0
- package/dist/components/ImageResize/index.js +8 -0
- package/dist/components/ImageResizeButton/ImageResizeButton.d.ts +26 -0
- package/dist/components/ImageResizeButton/ImageResizeButton.js +89 -0
- package/dist/components/ImageResizeButton/index.d.ts +2 -0
- package/dist/components/ImageResizeButton/index.js +8 -0
- package/dist/components/Input/Input.d.ts +8 -0
- package/dist/components/Input/Input.js +328 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +8 -0
- package/dist/components/InputTags/InputTags.d.ts +8 -0
- package/dist/components/InputTags/InputTags.js +129 -0
- package/dist/components/InputTags/index.d.ts +2 -0
- package/dist/components/InputTags/index.js +8 -0
- package/dist/components/ListSelect/ListSelect.d.ts +8 -0
- package/dist/components/ListSelect/ListSelect.js +126 -0
- package/dist/components/ListSelect/index.d.ts +2 -0
- package/dist/components/ListSelect/index.js +8 -0
- package/dist/components/MaterialButton/MaterialButton.d.ts +13 -0
- package/dist/components/MaterialButton/MaterialButton.js +192 -0
- package/dist/components/MaterialButton/index.d.ts +2 -0
- package/dist/components/MaterialButton/index.js +8 -0
- package/dist/components/MenuBar/MenuBar.d.ts +8 -0
- package/dist/components/MenuBar/MenuBar.js +157 -0
- package/dist/components/MenuBar/index.d.ts +2 -0
- package/dist/components/MenuBar/index.js +8 -0
- package/dist/components/MonthPicker/MonthPicker.d.ts +8 -0
- package/dist/components/MonthPicker/MonthPicker.js +288 -0
- package/dist/components/MonthPicker/index.d.ts +2 -0
- package/dist/components/MonthPicker/index.js +8 -0
- package/dist/components/MultipleSelect/MultipleSelect.d.ts +8 -0
- package/dist/components/MultipleSelect/MultipleSelect.js +139 -0
- package/dist/components/MultipleSelect/index.d.ts +2 -0
- package/dist/components/MultipleSelect/index.js +8 -0
- package/dist/components/OtpInput/OtpInput.d.ts +18 -0
- package/dist/components/OtpInput/OtpInput.js +207 -0
- package/dist/components/OtpInput/index.d.ts +2 -0
- package/dist/components/OtpInput/index.js +8 -0
- package/dist/components/OutputText/OutputText.d.ts +8 -0
- package/dist/components/OutputText/OutputText.js +89 -0
- package/dist/components/OutputText/index.d.ts +2 -0
- package/dist/components/OutputText/index.js +8 -0
- package/dist/components/Pagination/Pagination.d.ts +8 -0
- package/dist/components/Pagination/Pagination.js +64 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Pagination/index.js +8 -0
- package/dist/components/Programa/Programa.d.ts +31 -0
- package/dist/components/Programa/Programa.js +201 -0
- package/dist/components/Programa/index.d.ts +2 -0
- package/dist/components/Programa/index.js +8 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +8 -0
- package/dist/components/ProgressBar/ProgressBar.js +98 -0
- package/dist/components/ProgressBar/index.d.ts +2 -0
- package/dist/components/ProgressBar/index.js +8 -0
- package/dist/components/Select/Select.d.ts +8 -0
- package/dist/components/Select/Select.js +142 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +8 -0
- package/dist/components/SimpleTable/SimpleTable.d.ts +13 -0
- package/dist/components/SimpleTable/SimpleTable.js +390 -0
- package/dist/components/SimpleTable/index.d.ts +2 -0
- package/dist/components/SimpleTable/index.js +10 -0
- package/dist/components/Stepper/Stepper.d.ts +54 -0
- package/dist/components/Stepper/Stepper.js +157 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/Stepper/index.js +8 -0
- package/dist/components/TablePicker/TablePicker.d.ts +8 -0
- package/dist/components/TablePicker/TablePicker.js +222 -0
- package/dist/components/TablePicker/index.d.ts +2 -0
- package/dist/components/TablePicker/index.js +8 -0
- package/dist/components/Tabs/Tabs.d.ts +8 -0
- package/dist/components/Tabs/Tabs.js +76 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.js +8 -0
- package/dist/components/TextArea/TextArea.d.ts +8 -0
- package/dist/components/TextArea/TextArea.js +148 -0
- package/dist/components/TextArea/index.d.ts +2 -0
- package/dist/components/TextArea/index.js +8 -0
- package/dist/components/ThreadLog/ThreadLog.d.ts +8 -0
- package/dist/components/ThreadLog/ThreadLog.js +225 -0
- package/dist/components/ThreadLog/index.d.ts +2 -0
- package/dist/components/ThreadLog/index.js +8 -0
- package/dist/components/UtilAutoComplete/UtilAutoComplete.d.ts +93 -0
- package/dist/components/UtilAutoComplete/UtilAutoComplete.js +188 -0
- package/dist/components/UtilAutoComplete/index.d.ts +2 -0
- package/dist/components/UtilAutoComplete/index.js +8 -0
- package/dist/components/index.d.ts +148 -0
- package/dist/components/index.js +165 -0
- package/dist/fieldsRedux/createField.d.ts +8 -0
- package/dist/fieldsRedux/createField.js +149 -0
- package/dist/fieldsRedux/fieldsRedux.d.ts +71 -0
- package/dist/fieldsRedux/fieldsRedux.js +436 -0
- package/dist/fieldsRedux/index.d.ts +4 -0
- package/dist/fieldsRedux/index.js +27 -0
- package/dist/fieldsRedux/passFields.d.ts +5 -0
- package/dist/fieldsRedux/passFields.js +107 -0
- package/dist/reducers/argous.d.ts +76 -0
- package/dist/reducers/argous.js +63 -0
- package/dist/reducers/index.d.ts +4 -0
- package/dist/reducers/index.js +9 -0
- package/dist/types.d.ts +144 -0
- package/dist/utils/api.d.ts +29 -0
- package/dist/utils/api.js +255 -0
- package/dist/utils/config.d.ts +3 -0
- package/dist/utils/config.js +13 -0
- package/dist/utils/date.d.ts +8 -0
- package/dist/utils/date.js +60 -0
- package/dist/utils/index.d.ts +61 -0
- package/dist/utils/index.js +383 -0
- package/dist/utils/rippleEffect.d.ts +2 -0
- package/dist/utils/rippleEffect.js +173 -0
- package/dist/utils/store.d.ts +3 -0
- package/dist/utils/store.js +12 -0
- package/dist/utils/xmlToJson.d.ts +2 -0
- package/dist/utils/xmlToJson.js +158 -0
- package/lib/api/index.js +16 -0
- package/lib/components/AutoCompleteFavorites/AutoCompleteFavorites.js +298 -0
- package/lib/components/AutoCompleteFavorites/index.js +1 -0
- package/lib/components/index.js +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
|
+
var t = {};
|
|
34
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
+
t[p] = s[p];
|
|
36
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
+
t[p[i]] = s[p[i]];
|
|
40
|
+
}
|
|
41
|
+
return t;
|
|
42
|
+
};
|
|
43
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
44
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
var utils_1 = require("../../utils");
|
|
48
|
+
var core_1 = require("@material-ui/core");
|
|
49
|
+
var clsx_1 = __importDefault(require("clsx"));
|
|
50
|
+
var jquery_1 = __importDefault(require("jquery"));
|
|
51
|
+
var react_1 = __importStar(require("react"));
|
|
52
|
+
var md_1 = require("react-icons/md");
|
|
53
|
+
var useStyles = core_1.makeStyles(({
|
|
54
|
+
component: {
|
|
55
|
+
position: 'relative',
|
|
56
|
+
background: 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAAHmWi9wAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMBJREFUeNpinDFjemBgIAMaePv2zX8MwMSADdBKFCCAGF++fIEuBHQEYb3UFAIIIOwBQWzQEOvVwaMOIICwBDoWRZjRQKaNo4rorQgggBiBCVpISJiBGoCJgXpg1KxRs0aiWQABxPj79+93795SbhAwUxNVLo+G/ahZo2aNmjVq1qhZI8wsgADt1zERADAMAsD6t5B4bRHRgeGj4I8FctKPM3ObLp6fk7w1eSwsLCwsLCwsLCwsrE5WvrHdrTLF8wBDaPAHu14WwgAAAABJRU5ErkJggg==") repeat center center',
|
|
57
|
+
padding: '4em',
|
|
58
|
+
height: function (_a) {
|
|
59
|
+
var _b = _a.height, height = _b === void 0 ? 300 : _b;
|
|
60
|
+
return "calc(" + height + "px + 200px)";
|
|
61
|
+
},
|
|
62
|
+
border: '3px solid #49708A',
|
|
63
|
+
maxWidth: function (_a) {
|
|
64
|
+
var _b = _a.width, width = _b === void 0 ? 300 : _b;
|
|
65
|
+
return "calc(" + width + "px + 600px)";
|
|
66
|
+
},
|
|
67
|
+
overflow: 'hidden',
|
|
68
|
+
margin: '0 auto',
|
|
69
|
+
},
|
|
70
|
+
overlay: {
|
|
71
|
+
position: 'absolute',
|
|
72
|
+
left: function (_a) {
|
|
73
|
+
var _b = _a.width, width = _b === void 0 ? 300 : _b;
|
|
74
|
+
return "calc(50% - " + (width - 300) / 2 + "px)";
|
|
75
|
+
},
|
|
76
|
+
top: function (_a) {
|
|
77
|
+
var _b = _a.height, height = _b === void 0 ? 300 : _b;
|
|
78
|
+
return "calc(50% - " + (height - 300) / 2 + "px)";
|
|
79
|
+
},
|
|
80
|
+
marginLeft: '-150px',
|
|
81
|
+
marginTop: '-150px',
|
|
82
|
+
zIndex: 999,
|
|
83
|
+
width: function (_a) {
|
|
84
|
+
var width = _a.width;
|
|
85
|
+
return width !== null && width !== void 0 ? width : '300px';
|
|
86
|
+
},
|
|
87
|
+
height: function (_a) {
|
|
88
|
+
var height = _a.height;
|
|
89
|
+
return height !== null && height !== void 0 ? height : '300px';
|
|
90
|
+
},
|
|
91
|
+
border: 'solid 2px rgba(222,60,80,.9)',
|
|
92
|
+
borderRadius: function (_a) {
|
|
93
|
+
var borderRadius = _a.borderRadius;
|
|
94
|
+
return borderRadius !== null && borderRadius !== void 0 ? borderRadius : '50%';
|
|
95
|
+
},
|
|
96
|
+
boxSizing: 'content-box',
|
|
97
|
+
pointerEvents: 'none',
|
|
98
|
+
},
|
|
99
|
+
resizeContainer: {
|
|
100
|
+
position: 'relative',
|
|
101
|
+
display: 'inline-block',
|
|
102
|
+
cursor: 'move',
|
|
103
|
+
margin: '0 auto',
|
|
104
|
+
'&:hover, &:active': {
|
|
105
|
+
outline: '2px dashed rgba(222,60,80,.9)'
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
resizeHandle: {
|
|
109
|
+
position: 'absolute',
|
|
110
|
+
display: 'block',
|
|
111
|
+
width: '10px',
|
|
112
|
+
height: '10px',
|
|
113
|
+
background: 'rgba(222,60,80,.9)',
|
|
114
|
+
zIndex: 999,
|
|
115
|
+
},
|
|
116
|
+
resizeHandleNw: {
|
|
117
|
+
top: '-5px',
|
|
118
|
+
left: '-5px',
|
|
119
|
+
cursor: 'nw-resize',
|
|
120
|
+
},
|
|
121
|
+
resizeHandleSw: {
|
|
122
|
+
bottom: '-5px',
|
|
123
|
+
left: '-5px',
|
|
124
|
+
cursor: 'sw-resize',
|
|
125
|
+
},
|
|
126
|
+
resizeHandleNe: {
|
|
127
|
+
top: '-5px',
|
|
128
|
+
right: '-5px',
|
|
129
|
+
cursor: 'ne-resize',
|
|
130
|
+
},
|
|
131
|
+
resizeHandleSe: {
|
|
132
|
+
bottom: '-5px',
|
|
133
|
+
right: '-5px',
|
|
134
|
+
cursor: 'se-resize',
|
|
135
|
+
}
|
|
136
|
+
}));
|
|
137
|
+
var DEFAULT_OPTIONS = [
|
|
138
|
+
{
|
|
139
|
+
name: 'Brilho',
|
|
140
|
+
property: 'brightness',
|
|
141
|
+
value: 100,
|
|
142
|
+
range: {
|
|
143
|
+
min: 0,
|
|
144
|
+
max: 200
|
|
145
|
+
},
|
|
146
|
+
unit: '%'
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: 'Contraste',
|
|
150
|
+
property: 'contrast',
|
|
151
|
+
value: 100,
|
|
152
|
+
range: {
|
|
153
|
+
min: 0,
|
|
154
|
+
max: 200
|
|
155
|
+
},
|
|
156
|
+
unit: '%'
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'Saturação',
|
|
160
|
+
property: 'saturate',
|
|
161
|
+
value: 100,
|
|
162
|
+
range: {
|
|
163
|
+
min: 0,
|
|
164
|
+
max: 200
|
|
165
|
+
},
|
|
166
|
+
unit: '%'
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'Escala de Cinza',
|
|
170
|
+
property: 'grayscale',
|
|
171
|
+
value: 0,
|
|
172
|
+
range: {
|
|
173
|
+
min: 0,
|
|
174
|
+
max: 100
|
|
175
|
+
},
|
|
176
|
+
unit: '%'
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'Sépia',
|
|
180
|
+
property: 'sepia',
|
|
181
|
+
value: 0,
|
|
182
|
+
range: {
|
|
183
|
+
min: 0,
|
|
184
|
+
max: 100
|
|
185
|
+
},
|
|
186
|
+
unit: '%'
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: 'Rotacionar Tonalidade',
|
|
190
|
+
property: 'hue-rotate',
|
|
191
|
+
value: 0,
|
|
192
|
+
range: {
|
|
193
|
+
min: 0,
|
|
194
|
+
max: 360
|
|
195
|
+
},
|
|
196
|
+
unit: 'deg'
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: 'Embaçar',
|
|
200
|
+
property: 'blur',
|
|
201
|
+
value: 0,
|
|
202
|
+
range: {
|
|
203
|
+
min: 0,
|
|
204
|
+
max: 20
|
|
205
|
+
},
|
|
206
|
+
unit: 'px',
|
|
207
|
+
step: 0.1
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: 'Inverter',
|
|
211
|
+
property: 'invert',
|
|
212
|
+
value: 0,
|
|
213
|
+
range: {
|
|
214
|
+
min: 0,
|
|
215
|
+
max: 100
|
|
216
|
+
},
|
|
217
|
+
unit: '%',
|
|
218
|
+
step: 100
|
|
219
|
+
},
|
|
220
|
+
];
|
|
221
|
+
var ImageResize = function (_a) {
|
|
222
|
+
var imagem = _a.imagem, onImage = _a.onImage, _b = _a.finalImageProperties, finalImageProperties = _b === void 0 ? {} : _b, props = __rest(_a, ["imagem", "onImage", "finalImageProperties"]);
|
|
223
|
+
var classes = useStyles(finalImageProperties);
|
|
224
|
+
var _c = react_1.useState(undefined), urlImagem = _c[0], setUrlImagem = _c[1];
|
|
225
|
+
var _d = react_1.useState(undefined), key = _d[0], setKey = _d[1];
|
|
226
|
+
var image = react_1.useRef();
|
|
227
|
+
var button = react_1.useRef();
|
|
228
|
+
react_1.useEffect(function () {
|
|
229
|
+
setKey(Math.floor((Math.random() * 10000) + 1));
|
|
230
|
+
}, []);
|
|
231
|
+
utils_1.useUpdateEffect(function () {
|
|
232
|
+
if (!imagem || !key)
|
|
233
|
+
return;
|
|
234
|
+
var src = window.URL.createObjectURL(imagem);
|
|
235
|
+
setUrlImagem(src);
|
|
236
|
+
resizeableImage(image.current, src);
|
|
237
|
+
}, [imagem, key]);
|
|
238
|
+
var resizeableImage = function (imageTarget, src) {
|
|
239
|
+
// Some variable and settings
|
|
240
|
+
var $container, eventState = {}, constrain = false, minWidth = jquery_1.default("#overlay_" + key).width(), minHeight = jquery_1.default("#overlay_" + key).height(), origSrc = new Image(), resizeCanvas = document.createElement('canvas'), resized = false;
|
|
241
|
+
var init = function () {
|
|
242
|
+
// When resizing, we will always use this copy of the original as the base
|
|
243
|
+
origSrc.src = src;
|
|
244
|
+
// Assign the container to a variable
|
|
245
|
+
$container = jquery_1.default(imageTarget).parent("#container_" + key);
|
|
246
|
+
// Add events
|
|
247
|
+
$container.on('mousedown touchstart', ".resize-handle_" + key, startResize);
|
|
248
|
+
$container.on('mousedown touchstart', "#resizeImage_" + key, startMoving);
|
|
249
|
+
jquery_1.default("#js-crop_" + key).on('click', crop);
|
|
250
|
+
// button.addEventListener('click', crop)
|
|
251
|
+
// button.onclick = crop
|
|
252
|
+
};
|
|
253
|
+
var startResize = function (e) {
|
|
254
|
+
e.preventDefault();
|
|
255
|
+
e.stopPropagation();
|
|
256
|
+
saveEventState(e);
|
|
257
|
+
jquery_1.default(document).on('mousemove touchmove', resizing);
|
|
258
|
+
jquery_1.default(document).on('mouseup touchend', endResize);
|
|
259
|
+
};
|
|
260
|
+
var endResize = function (e) {
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
jquery_1.default(document).off('mouseup touchend', endResize);
|
|
263
|
+
jquery_1.default(document).off('mousemove touchmove', resizing);
|
|
264
|
+
};
|
|
265
|
+
var saveEventState = function (e) {
|
|
266
|
+
var _a, _b;
|
|
267
|
+
// Save the initial event details and container state
|
|
268
|
+
eventState.container_width = $container.width();
|
|
269
|
+
eventState.container_height = $container.height();
|
|
270
|
+
eventState.container_left = $container.offset().left;
|
|
271
|
+
eventState.container_top = $container.offset().top;
|
|
272
|
+
eventState.mouse_x = (e.clientX || e.pageX || ((_a = e.originalEvent.touches) === null || _a === void 0 ? void 0 : _a.at(0).clientX)) + jquery_1.default(window).scrollLeft();
|
|
273
|
+
eventState.mouse_y = (e.clientY || e.pageY || ((_b = e.originalEvent.touches) === null || _b === void 0 ? void 0 : _b.at(0).clientY)) + jquery_1.default(window).scrollTop();
|
|
274
|
+
// This is a fix for mobile safari
|
|
275
|
+
// For some reason it does not allow a direct copy of the touches property
|
|
276
|
+
if (typeof e.originalEvent.touches !== 'undefined') {
|
|
277
|
+
eventState.touches = [];
|
|
278
|
+
jquery_1.default.each(e.originalEvent.touches, function (i, ob) {
|
|
279
|
+
eventState.touches[i] = {};
|
|
280
|
+
eventState.touches[i].clientX = 0 + ob.clientX;
|
|
281
|
+
eventState.touches[i].clientY = 0 + ob.clientY;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
eventState.evnt = e;
|
|
285
|
+
};
|
|
286
|
+
var resizing = function (e) {
|
|
287
|
+
var _a, _b;
|
|
288
|
+
var mouse = {}, width, height, left, top;
|
|
289
|
+
mouse.x = (e.clientX || e.pageX || ((_a = e.originalEvent.touches) === null || _a === void 0 ? void 0 : _a.at(0).clientX)) + jquery_1.default(window).scrollLeft();
|
|
290
|
+
mouse.y = (e.clientY || e.pageY || ((_b = e.originalEvent.touches) === null || _b === void 0 ? void 0 : _b.at(0).clientY)) + jquery_1.default(window).scrollTop();
|
|
291
|
+
// Position image differently depending on the corner dragged and constraints
|
|
292
|
+
if (eventState.evnt.target.id === "resizeHandleSe_" + key) {
|
|
293
|
+
width = mouse.x - eventState.container_left;
|
|
294
|
+
height = mouse.y - eventState.container_top;
|
|
295
|
+
left = eventState.container_left;
|
|
296
|
+
top = eventState.container_top;
|
|
297
|
+
}
|
|
298
|
+
else if (eventState.evnt.target.id === "resizeHandleSw_" + key) {
|
|
299
|
+
width = eventState.container_width - (mouse.x - eventState.container_left);
|
|
300
|
+
height = mouse.y - eventState.container_top;
|
|
301
|
+
left = mouse.x;
|
|
302
|
+
top = eventState.container_top;
|
|
303
|
+
}
|
|
304
|
+
else if (eventState.evnt.target.id === "resizeHandleNw_" + key) {
|
|
305
|
+
width = eventState.container_width - (mouse.x - eventState.container_left);
|
|
306
|
+
height = eventState.container_height - (mouse.y - eventState.container_top);
|
|
307
|
+
left = mouse.x;
|
|
308
|
+
top = mouse.y;
|
|
309
|
+
if (constrain || !e.shiftKey) {
|
|
310
|
+
top = mouse.y - ((width / origSrc.width * origSrc.height) - height);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else if (eventState.evnt.target.id === "resizeHandleNe_" + key) {
|
|
314
|
+
width = mouse.x - eventState.container_left;
|
|
315
|
+
height = eventState.container_height - (mouse.y - eventState.container_top);
|
|
316
|
+
left = eventState.container_left;
|
|
317
|
+
top = mouse.y;
|
|
318
|
+
if (constrain || !e.shiftKey) {
|
|
319
|
+
top = mouse.y - ((width / origSrc.width * origSrc.height) - height);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
// Optionally maintain aspect ratio
|
|
323
|
+
if (constrain || !e.shiftKey) {
|
|
324
|
+
height = width / origSrc.width * origSrc.height;
|
|
325
|
+
}
|
|
326
|
+
if (width > minWidth && height > minHeight) {
|
|
327
|
+
// To improve performance you might limit how often resizeImage() is called
|
|
328
|
+
resizeImage(width, height);
|
|
329
|
+
//detecção de colisao para impedir q imagem saia do quadro
|
|
330
|
+
var wantedLeft = left;
|
|
331
|
+
var wantedTop = top;
|
|
332
|
+
var wantedMinLeft = wantedLeft + $container.width();
|
|
333
|
+
var wantedMinTop = wantedTop + $container.height();
|
|
334
|
+
var maxLeft = jquery_1.default("#overlay_" + key).offset().left;
|
|
335
|
+
var maxTop = jquery_1.default("#overlay_" + key).offset().top;
|
|
336
|
+
var minLeft = maxLeft + jquery_1.default("#overlay_" + key).width();
|
|
337
|
+
var minTop = maxTop + jquery_1.default("#overlay_" + key).height();
|
|
338
|
+
var finalLeft = wantedLeft > maxLeft ? maxLeft : wantedMinLeft < minLeft ? minLeft - $container.width() : wantedLeft;
|
|
339
|
+
var finalTop = wantedTop > maxTop ? maxTop : wantedMinTop < minTop ? minTop - $container.height() : wantedTop;
|
|
340
|
+
$container.offset({
|
|
341
|
+
'left': finalLeft,
|
|
342
|
+
'top': finalTop
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
var resizeImage = function (width, height) {
|
|
347
|
+
resizeCanvas.width = width;
|
|
348
|
+
resizeCanvas.height = height;
|
|
349
|
+
resizeCanvas.getContext('2d').drawImage(origSrc, 0, 0, width, height);
|
|
350
|
+
// setUrlImagem(resizeCanvas.toDataURL('image/png'))
|
|
351
|
+
jquery_1.default(imageTarget).attr('src', resizeCanvas.toDataURL('image/png'));
|
|
352
|
+
resized = true;
|
|
353
|
+
};
|
|
354
|
+
var startMoving = function (e) {
|
|
355
|
+
e.preventDefault();
|
|
356
|
+
e.stopPropagation();
|
|
357
|
+
saveEventState(e);
|
|
358
|
+
jquery_1.default(document).on('mousemove touchmove', moving);
|
|
359
|
+
jquery_1.default(document).on('mouseup touchend', endMoving);
|
|
360
|
+
};
|
|
361
|
+
var endMoving = function (e) {
|
|
362
|
+
e.preventDefault();
|
|
363
|
+
jquery_1.default(document).off('mouseup touchend', endMoving);
|
|
364
|
+
jquery_1.default(document).off('mousemove touchmove', moving);
|
|
365
|
+
};
|
|
366
|
+
var moving = function (e) {
|
|
367
|
+
var _a, _b, _c, _d, _e, _f;
|
|
368
|
+
var mouse = {}, touches;
|
|
369
|
+
e.preventDefault();
|
|
370
|
+
e.stopPropagation();
|
|
371
|
+
touches = e.originalEvent.touches;
|
|
372
|
+
mouse.x = (e.clientX || e.pageX || (touches === null || touches === void 0 ? void 0 : touches.at(0).clientX)) + jquery_1.default(window).scrollLeft();
|
|
373
|
+
mouse.y = (e.clientY || e.pageY || (touches === null || touches === void 0 ? void 0 : touches.at(0).clientY)) + jquery_1.default(window).scrollTop();
|
|
374
|
+
//detecção de colisao para impedir q imagem saia do quadro
|
|
375
|
+
var wantedLeft = mouse.x - (eventState.mouse_x - eventState.container_left);
|
|
376
|
+
var wantedTop = mouse.y - (eventState.mouse_y - eventState.container_top);
|
|
377
|
+
var wantedMinLeft = wantedLeft + $container.width();
|
|
378
|
+
var wantedMinTop = wantedTop + $container.height();
|
|
379
|
+
var maxLeft = jquery_1.default("#overlay_" + key).offset().left;
|
|
380
|
+
var maxTop = jquery_1.default("#overlay_" + key).offset().top;
|
|
381
|
+
var minLeft = maxLeft + jquery_1.default("#overlay_" + key).width();
|
|
382
|
+
var minTop = maxTop + jquery_1.default("#overlay_" + key).height();
|
|
383
|
+
var finalLeft = wantedLeft > maxLeft ? maxLeft : wantedMinLeft < minLeft ? minLeft - $container.width() : wantedLeft;
|
|
384
|
+
var finalTop = wantedTop > maxTop ? maxTop : wantedMinTop < minTop ? minTop - $container.height() : wantedTop;
|
|
385
|
+
$container.offset({
|
|
386
|
+
'left': finalLeft,
|
|
387
|
+
'top': finalTop
|
|
388
|
+
});
|
|
389
|
+
// Watch for pinch zoom gesture while moving
|
|
390
|
+
if (eventState.touches && eventState.touches.length > 1 && touches.length > 1) {
|
|
391
|
+
var width = eventState.container_width, height = eventState.container_height;
|
|
392
|
+
var a = ((_a = eventState.touches) === null || _a === void 0 ? void 0 : _a.at(0).clientX) - ((_b = eventState.touches) === null || _b === void 0 ? void 0 : _b.at(1).clientX);
|
|
393
|
+
a = a * a;
|
|
394
|
+
var b = ((_c = eventState.touches) === null || _c === void 0 ? void 0 : _c.at(0).clientY) - ((_d = eventState.touches) === null || _d === void 0 ? void 0 : _d.at(1).clientY);
|
|
395
|
+
b = b * b;
|
|
396
|
+
var dist1 = Math.sqrt(a + b);
|
|
397
|
+
a = ((_e = e.originalEvent.touches) === null || _e === void 0 ? void 0 : _e.at(0).clientX) - (touches === null || touches === void 0 ? void 0 : touches.at(1).clientX);
|
|
398
|
+
a = a * a;
|
|
399
|
+
b = ((_f = e.originalEvent.touches) === null || _f === void 0 ? void 0 : _f.at(0).clientY) - (touches === null || touches === void 0 ? void 0 : touches.at(1).clientY);
|
|
400
|
+
b = b * b;
|
|
401
|
+
var dist2 = Math.sqrt(a + b);
|
|
402
|
+
var ratio = dist2 / dist1;
|
|
403
|
+
width = width * ratio;
|
|
404
|
+
height = height * ratio;
|
|
405
|
+
// To improve performance you might limit how often resizeImage() is called
|
|
406
|
+
resizeImage(width, height);
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
var crop = function () {
|
|
410
|
+
//hack para a imagem ficar certa no caso de nao ter sido redimensionada
|
|
411
|
+
if (!resized) {
|
|
412
|
+
var _a = imageTarget.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
413
|
+
resizeImage(width, height);
|
|
414
|
+
}
|
|
415
|
+
setTimeout(function () {
|
|
416
|
+
//Find the part of the image that is inside the crop box
|
|
417
|
+
var cropCanvas, left = jquery_1.default("#overlay_" + key).offset().left - $container.offset().left, top = jquery_1.default("#overlay_" + key).offset().top - $container.offset().top, width = jquery_1.default("#overlay_" + key).width(), height = jquery_1.default("#overlay_" + key).height();
|
|
418
|
+
cropCanvas = document.createElement('canvas');
|
|
419
|
+
cropCanvas.width = width;
|
|
420
|
+
cropCanvas.height = height;
|
|
421
|
+
var ctx = cropCanvas.getContext('2d');
|
|
422
|
+
ctx.filter = jquery_1.default("#resizeImage_" + key).css('filter');
|
|
423
|
+
ctx.drawImage(imageTarget, left, top, width, height, 0, 0, width, height);
|
|
424
|
+
// window.open(cropCanvas.toDataURL('image/png'));
|
|
425
|
+
onImage(cropCanvas.toDataURL('image/png'));
|
|
426
|
+
}, 0);
|
|
427
|
+
};
|
|
428
|
+
init();
|
|
429
|
+
};
|
|
430
|
+
var _e = react_1.useState(0), selectedOptionIndex = _e[0], setSelectedOptionIndex = _e[1];
|
|
431
|
+
var _f = react_1.useState(DEFAULT_OPTIONS), options = _f[0], setOptions = _f[1];
|
|
432
|
+
var selectedOption = options[selectedOptionIndex];
|
|
433
|
+
function handleSliderChange(_, value) {
|
|
434
|
+
setOptions(function (prevOptions) {
|
|
435
|
+
return prevOptions.map(function (option, index) {
|
|
436
|
+
if (index !== selectedOptionIndex)
|
|
437
|
+
return option;
|
|
438
|
+
return __assign(__assign({}, option), { value: value });
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
var getImageStyle = function (onlyFilters) {
|
|
443
|
+
if (onlyFilters === void 0) { onlyFilters = false; }
|
|
444
|
+
var filters = options.map(function (option) { return option.property + "(" + option.value + option.unit + ")"; }).join(' ');
|
|
445
|
+
return onlyFilters ? filters : { filter: filters };
|
|
446
|
+
};
|
|
447
|
+
return react_1.default.createElement(core_1.Dialog, __assign({}, props, { maxWidth: 'lg', fullWidth: true, keepMounted: true }),
|
|
448
|
+
react_1.default.createElement(core_1.DialogTitle, null, "Ajustar Imagem"),
|
|
449
|
+
react_1.default.createElement(core_1.DialogContent, { style: { display: 'block', position: 'relative' } },
|
|
450
|
+
react_1.default.createElement(core_1.Grid, { container: true, spacing: 2 },
|
|
451
|
+
react_1.default.createElement(core_1.Grid, { item: true, xs: 8 },
|
|
452
|
+
react_1.default.createElement("div", { className: classes.component },
|
|
453
|
+
react_1.default.createElement("div", { id: "overlay_" + key, className: classes.overlay }),
|
|
454
|
+
react_1.default.createElement("div", { id: "container_" + key, className: classes.resizeContainer },
|
|
455
|
+
react_1.default.createElement("span", { id: "resizeHandleNw_" + key, className: clsx_1.default("resize-handle_" + key, classes.resizeHandle, classes.resizeHandleNw) }),
|
|
456
|
+
react_1.default.createElement("span", { id: "resizeHandleNe_" + key, className: clsx_1.default("resize-handle_" + key, classes.resizeHandle, classes.resizeHandleNe) }),
|
|
457
|
+
react_1.default.createElement("img", { ref: image, id: "resizeImage_" + key, style: __assign({ display: 'block', minWidth: jquery_1.default("#overlay_" + key).width(), minHeight: jquery_1.default("#overlay_" + key).height() }, getImageStyle()), src: urlImagem, alt: 'Imagem a ser Redimensionada' }),
|
|
458
|
+
react_1.default.createElement("span", { id: "resizeHandleSw_" + key, className: clsx_1.default("resize-handle_" + key, classes.resizeHandle, classes.resizeHandleSw) }),
|
|
459
|
+
react_1.default.createElement("span", { id: "resizeHandleSe_" + key, className: clsx_1.default("resize-handle_" + key, classes.resizeHandle, classes.resizeHandleSe) })))),
|
|
460
|
+
react_1.default.createElement(core_1.Grid, { item: true, xs: 2, style: { display: 'flex', alignItems: 'center' } },
|
|
461
|
+
react_1.default.createElement(core_1.Slider, { style: { height: 'calc(100% - 30px)' }, orientation: 'vertical',
|
|
462
|
+
// getAriaValueText={valuetext}
|
|
463
|
+
step: selectedOption.step, min: selectedOption.range.min, max: selectedOption.range.max, value: selectedOption.value, onChange: handleSliderChange })),
|
|
464
|
+
react_1.default.createElement(core_1.Grid, { item: true, xs: 2 },
|
|
465
|
+
react_1.default.createElement(core_1.List, null, options.map(function (option, index) { return (react_1.default.createElement(core_1.ListItem, { button: true, onClick: function () { return setSelectedOptionIndex(index); }, key: index, selected: index === selectedOptionIndex },
|
|
466
|
+
react_1.default.createElement(core_1.ListItemText, { primary: option.name }))); }))))),
|
|
467
|
+
react_1.default.createElement(core_1.DialogActions, null,
|
|
468
|
+
react_1.default.createElement(core_1.Button, { ref: button, id: "js-crop_" + key, color: 'primary', variant: 'contained' },
|
|
469
|
+
"Recortar",
|
|
470
|
+
react_1.default.createElement(md_1.MdCrop, { style: { marginLeft: 5 } }))));
|
|
471
|
+
};
|
|
472
|
+
exports.default = ImageResize;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var ImageResize_1 = require("./ImageResize");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ImageResize_1).default; } });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ImageResizeProps } from '../ImageResize/ImageResize';
|
|
2
|
+
import { ButtonClassKey, ExtendButtonBase } from '@material-ui/core';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface ImageResizeButtonTypeMap<P = {}, D extends React.ElementType = 'button'>{
|
|
5
|
+
props: P & {
|
|
6
|
+
/**
|
|
7
|
+
* Props repassados ao componente de resize
|
|
8
|
+
*/
|
|
9
|
+
ImageResizeProps?: ImageResizeProps,
|
|
10
|
+
/**
|
|
11
|
+
* Função chamada quando a imagem fica pronta
|
|
12
|
+
*
|
|
13
|
+
* @param image - Arquivo da imagem
|
|
14
|
+
* @param b64 - Imagem em Base64
|
|
15
|
+
*
|
|
16
|
+
* @returns {void} Sem Retorno
|
|
17
|
+
*/
|
|
18
|
+
onImage?: (image: File, b64: string) => void,
|
|
19
|
+
};
|
|
20
|
+
defaultComponent: D;
|
|
21
|
+
classKey: ButtonClassKey;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare const ImageResizeButton: ExtendButtonBase<ImageResizeButtonTypeMap>;
|
|
25
|
+
|
|
26
|
+
export default ImageResizeButton;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
|
+
var t = {};
|
|
34
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
+
t[p] = s[p];
|
|
36
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
+
t[p[i]] = s[p[i]];
|
|
40
|
+
}
|
|
41
|
+
return t;
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
var __1 = require("../");
|
|
45
|
+
var core_1 = require("@material-ui/core");
|
|
46
|
+
var react_1 = __importStar(require("react"));
|
|
47
|
+
var ImageResizeButton = react_1.forwardRef(function (_a, ref) {
|
|
48
|
+
var children = _a.children, ImageResizeProps = _a.ImageResizeProps, onImage = _a.onImage, _b = _a.Component, Component = _b === void 0 ? core_1.Button : _b, props = __rest(_a, ["children", "ImageResizeProps", "onImage", "Component"]);
|
|
49
|
+
var _c = react_1.useState(undefined), enviandoFoto = _c[0], setEnviandoFoto = _c[1];
|
|
50
|
+
var inputRef = react_1.useRef();
|
|
51
|
+
var handleClick = function () { return inputRef.current && inputRef.current.click(); };
|
|
52
|
+
var handleChange = function (e) { return setEnviandoFoto(e.target.files[0]); };
|
|
53
|
+
var handleImage = function (image) {
|
|
54
|
+
onImage(dataURLtoFile(image, enviandoFoto.name), image);
|
|
55
|
+
handleClose();
|
|
56
|
+
};
|
|
57
|
+
var handleClose = function () {
|
|
58
|
+
setEnviandoFoto(undefined);
|
|
59
|
+
clearInputFile(inputRef.current);
|
|
60
|
+
};
|
|
61
|
+
react_1.useImperativeHandle(ref, function () { return ({
|
|
62
|
+
handleChange: handleChange
|
|
63
|
+
}); }, []);
|
|
64
|
+
return react_1.default.createElement(react_1.default.Fragment, null,
|
|
65
|
+
react_1.default.createElement(Component, __assign({ onClick: handleClick }, props), children),
|
|
66
|
+
react_1.default.createElement("input", { ref: inputRef, type: 'file', style: { display: 'none' }, onChange: handleChange, accept: 'image/*' }),
|
|
67
|
+
react_1.default.createElement(__1.ImageResize, __assign({ imagem: enviandoFoto, open: !!enviandoFoto, onImage: handleImage, onClose: handleClose }, ImageResizeProps)));
|
|
68
|
+
});
|
|
69
|
+
exports.default = ImageResizeButton;
|
|
70
|
+
function clearInputFile(f) {
|
|
71
|
+
if (f === null || f === void 0 ? void 0 : f.value) {
|
|
72
|
+
try {
|
|
73
|
+
f.value = '';
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
var form = document.createElement('form'), parentNode = f.parentNode, ref = f.nextSibling;
|
|
77
|
+
form.appendChild(f);
|
|
78
|
+
form.reset();
|
|
79
|
+
parentNode.insertBefore(f, ref);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function dataURLtoFile(dataurl, filename) {
|
|
84
|
+
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
|
|
85
|
+
while (n--) {
|
|
86
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
87
|
+
}
|
|
88
|
+
return new File([u8arr], filename, { type: mime });
|
|
89
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var ImageResizeButton_1 = require("./ImageResizeButton");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ImageResizeButton_1).default; } });
|