react-dialogger 1.1.124 → 1.1.126
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/components/DialogContent.js +32 -15
- package/helpers/Resizeable.js +4 -2
- package/icons/MinusIcon.d.ts +5 -0
- package/icons/MinusIcon.js +18 -0
- package/icons/PlusIcon.d.ts +5 -0
- package/icons/PlusIcon.js +18 -0
- package/models/baseDialogOptions.js +2 -0
- package/package.json +1 -1
- package/styles/dialog.css +23 -0
- package/types/DialogTypes.d.ts +3 -1
|
@@ -71,15 +71,18 @@ var react_1 = require("react");
|
|
|
71
71
|
var jumper_animate_1 = require("../utils/effects/jumper-animate");
|
|
72
72
|
var _context_1 = require("../context/index.js");
|
|
73
73
|
var appLogger_1 = require("../helpers/appLogger");
|
|
74
|
+
var PlusIcon_1 = __importDefault(require("../icons/PlusIcon"));
|
|
75
|
+
var MinusIcon_1 = __importDefault(require("../icons/MinusIcon"));
|
|
74
76
|
var DialogContent = function (props) {
|
|
75
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
77
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
76
78
|
var firstUpdate = React.useRef(true);
|
|
77
|
-
var
|
|
79
|
+
var _j = (0, react_1.useContext)(_context_1.DialogContentContext), dialog = _j.dialog, dialogRef = _j.dialogRef, prevDialogRect = _j.prevDialogRect, backdropRef = _j.backdropRef, snackbarRef = _j.snackbarRef, footerRef = _j.footerRef, bodyRef = _j.bodyRef, headerRef = _j.headerRef, resizeableObject = _j.resizeableObject, body = _j.body;
|
|
78
80
|
var dialogOptions = dialog.dialogOptions;
|
|
79
81
|
var baseOptions = dialogOptions.base;
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
var
|
|
82
|
+
var _k = React.useState(false), fullscreenMode = _k[0], setFullscreenMode = _k[1];
|
|
83
|
+
var _l = React.useState(null), rect = _l[0], setRect = _l[1];
|
|
84
|
+
var _m = React.useState(((_a = dialogOptions === null || dialogOptions === void 0 ? void 0 : dialogOptions.scale) !== null && _a !== void 0 ? _a : 1)), zoom = _m[0], setZoom = _m[1];
|
|
85
|
+
var bounds = ((_b = dialog.dialogOptions.base) === null || _b === void 0 ? void 0 : _b.memoBounds) ? (0, _helpers_1.getDialogBounds)(dialog.dialogOptions.base.id) : null;
|
|
83
86
|
var domZIndex = window.getComputedStyle(dialog.getDom()).zIndex;
|
|
84
87
|
var positionSelector = function () {
|
|
85
88
|
var _a;
|
|
@@ -148,7 +151,13 @@ var DialogContent = function (props) {
|
|
|
148
151
|
dialogRef.current = null;
|
|
149
152
|
};
|
|
150
153
|
}, []);
|
|
151
|
-
|
|
154
|
+
// TODO Bi dene Zoom + Scale ile drag yapiliyor (Resize eksik) & Memo tam coordine degil!!
|
|
155
|
+
var scale = zoom; //dialogOptions?.scale ?? 1;
|
|
156
|
+
// Set Zoom
|
|
157
|
+
(0, react_1.useEffect)(function () {
|
|
158
|
+
dialogOptions.scale = zoom;
|
|
159
|
+
}, [zoom]);
|
|
160
|
+
return (0, jsx_runtime_1.jsx)(react_draggable_1.default, { disabled: !baseOptions.draggable || fullscreenMode, axis: 'both', handle: baseOptions.draggable ? '.drag-handle' : '', scale: scale, nodeRef: dialogRef, onDrag: function (event, data) {
|
|
152
161
|
event.stopPropagation();
|
|
153
162
|
dialog._dialogTranslate = { lastX: data.lastX, lastY: data.lastY };
|
|
154
163
|
}, onStop: function (event, data) {
|
|
@@ -158,13 +167,13 @@ var DialogContent = function (props) {
|
|
|
158
167
|
var _c = (_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(), width = _c.width, height = _c.height, x = _c.x, y = _c.y;
|
|
159
168
|
(0, appLogger_1.appLog)('onDragStop', 'fired', (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect());
|
|
160
169
|
(0, _helpers_1.setDialogBounds)(dialogOptions.base.id, {
|
|
161
|
-
width: width,
|
|
162
|
-
height: height,
|
|
163
|
-
x: x,
|
|
164
|
-
y: y,
|
|
170
|
+
width: width / scale,
|
|
171
|
+
height: height / scale,
|
|
172
|
+
x: x / scale,
|
|
173
|
+
y: y / scale,
|
|
165
174
|
fullscreen: false
|
|
166
175
|
}, dialogRef);
|
|
167
|
-
}, children: (0, jsx_runtime_1.
|
|
176
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { id: "dialog-main", ref: dialogRef, onClick: function (e) {
|
|
168
177
|
e.stopPropagation();
|
|
169
178
|
if (dialog.dialogOptions.backdrop.throughable) {
|
|
170
179
|
var toppest = dialog.props.zFinder();
|
|
@@ -187,9 +196,17 @@ var DialogContent = function (props) {
|
|
|
187
196
|
// @ts-ignore
|
|
188
197
|
dialog.props.keyboardListener(e.key, _this);
|
|
189
198
|
}
|
|
190
|
-
}, className: baseOptions.size.width === 'auto' ? 'auto' : "dialog-width-".concat(dialogOptions.base.size.width, " dialog-main show-opacity show-position-").concat(baseOptions.initialAnchor.vertical), style: __assign(__assign(__assign(__assign({ height: (
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
199
|
+
}, className: baseOptions.size.width === 'auto' ? 'auto' : "dialog-width-".concat(dialogOptions.base.size.width, " dialog-main show-opacity show-position-").concat(baseOptions.initialAnchor.vertical), style: __assign(__assign(__assign(__assign({ height: (_c = baseOptions.size.height) !== null && _c !== void 0 ? _c : 'auto' }, typeof baseOptions.size.width === "number" ? { width: "".concat(baseOptions.size.width, "px") } : { width: "".concat(baseOptions.size.width) }), { outline: 'none', fontFamily: (_d = baseOptions.style.fontFamily) !== null && _d !== void 0 ? _d : 'Arial' }), rect), { alignSelf: (_e = baseOptions.initialAnchor.vertical) !== null && _e !== void 0 ? _e : 'flex-start', justifySelf: (_f = baseOptions.initialAnchor.horizontal) !== null && _f !== void 0 ? _f : 'flex-start', zoom: scale !== null && scale !== void 0 ? scale : 1, overflow: 'unset' }), children: [dialog.dialogOptions.scaleable &&
|
|
200
|
+
(0, jsx_runtime_1.jsxs)("div", { className: 'dialog-zoom-root', style: { width: 36 }, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'dialog-zoom-wrapper', children: [(0, jsx_runtime_1.jsx)("div", { className: "zoom-action", onClick: function () {
|
|
201
|
+
setZoom(function (prev) { return Number((prev + 0.1).toFixed(2)); }); // 0.6 → 0.7
|
|
202
|
+
}, children: (0, jsx_runtime_1.jsx)(PlusIcon_1.default, { size: 22 }) }), (0, jsx_runtime_1.jsx)("div", { className: "zoom-action", onClick: function (event) {
|
|
203
|
+
setZoom(function (prev) { return Number((prev - 0.1).toFixed(2)); }); // 0.7 → 0.6
|
|
204
|
+
setTimeout(function () {
|
|
205
|
+
event.clientX;
|
|
206
|
+
});
|
|
207
|
+
}, children: (0, jsx_runtime_1.jsx)(MinusIcon_1.default, { size: 22 }) })] }), (0, jsx_runtime_1.jsxs)("span", { className: 'dialog-zoom-label', children: [(Math.round(zoom * 100)), "%"] })] }), (0, jsx_runtime_1.jsxs)(notistack_1.SnackbarProvider, { ref: snackbarRef, maxSnack: dialog.dialogOptions.snackbar.maxSnack, style: __assign({ width: 'min-content' }, (_h = (_g = dialog.dialogOptions) === null || _g === void 0 ? void 0 : _g.snackbar) === null || _h === void 0 ? void 0 : _h.style), children: [(dialog.props.header || dialogOptions.slot.header) && ((0, jsx_runtime_1.jsx)(_1.DialogContentHeader, { ref: headerRef, header: dialog.props.header, bounds: bounds })), (0, jsx_runtime_1.jsx)(_1.DialogContentBody, { ref: bodyRef, body: body }), (0, jsx_runtime_1.jsx)(_1.DialogContentFooter, { ref: footerRef }), (baseOptions.resizeable) &&
|
|
208
|
+
(0, jsx_runtime_1.jsx)(React.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "resizable-handle", style: {
|
|
209
|
+
zIndex: parseInt(domZIndex) + 1
|
|
210
|
+
}, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown, children: (0, jsx_runtime_1.jsx)(_icons_1.ResizeIcon, { color: '#286e94' }) }) })] })] }) });
|
|
194
211
|
};
|
|
195
212
|
exports.DialogContent = DialogContent;
|
package/helpers/Resizeable.js
CHANGED
|
@@ -41,6 +41,7 @@ var Resizeable = /** @class */ (function () {
|
|
|
41
41
|
_this.init();
|
|
42
42
|
};
|
|
43
43
|
this.resizeHandleMouseMove = function (e) {
|
|
44
|
+
var _a;
|
|
44
45
|
if (!_this.isResizing || !_this._container.current)
|
|
45
46
|
return;
|
|
46
47
|
if (!_this._container.current) {
|
|
@@ -55,8 +56,9 @@ var Resizeable = /** @class */ (function () {
|
|
|
55
56
|
if (typeof _this._onResizeListener === "function") {
|
|
56
57
|
_this._onResizeListener(_this._width, _this._height, rect);
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
_this._container.current.style.
|
|
59
|
+
var scale = ((_a = _this._dialogOptions) !== null && _a !== void 0 ? _a : { scale: 1 }).scale;
|
|
60
|
+
_this._container.current.style.width = (_this._width / scale) + 'px';
|
|
61
|
+
_this._container.current.style.height = (_this._height / scale) + 'px';
|
|
60
62
|
};
|
|
61
63
|
this.init = function () {
|
|
62
64
|
if (_this.isResizing) {
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
exports.default = (function (_a) {
|
|
16
|
+
var size = _a.size, color = _a.color;
|
|
17
|
+
return (0, jsx_runtime_1.jsx)("div", { className: 'close-icon icon-base', style: __assign({ fill: color }, size ? { width: size } : null), children: (0, jsx_runtime_1.jsx)("svg", { focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { d: "M5 12h14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) });
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
exports.default = (function (_a) {
|
|
16
|
+
var size = _a.size, color = _a.color;
|
|
17
|
+
return (0, jsx_runtime_1.jsx)("div", { className: 'close-icon icon-base', style: __assign({ fill: color }, size ? { width: size } : null), children: (0, jsx_runtime_1.jsx)("svg", { focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { d: "M12 5v14M5 12h14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) });
|
|
18
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dialogger",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.126",
|
|
4
4
|
"description": "This package is a continuation of the react-araci package. Due to an error, react-araci was removed, and it has been decided to continue under the new package name react-dialogger",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Sueleyman Topaloglu",
|
package/styles/dialog.css
CHANGED
|
@@ -215,6 +215,28 @@
|
|
|
215
215
|
overflow: clip;
|
|
216
216
|
pointer-events: auto;
|
|
217
217
|
}
|
|
218
|
+
.dialog-main .dialog-zoom-root {
|
|
219
|
+
display: flex;
|
|
220
|
+
flex-direction: column;
|
|
221
|
+
align-items: center;
|
|
222
|
+
row-gap: 11px;
|
|
223
|
+
padding-top: 10px;
|
|
224
|
+
padding-bottom: 20px;
|
|
225
|
+
position: absolute;
|
|
226
|
+
top: 4px;
|
|
227
|
+
/* height: 120px; */
|
|
228
|
+
right: -40px;
|
|
229
|
+
/* width: 80px; */
|
|
230
|
+
background: rgba(0, 0, 0, 0.1);
|
|
231
|
+
border: 1px solid #CCC;
|
|
232
|
+
border-radius: 32px;
|
|
233
|
+
}
|
|
234
|
+
.dialog-main .dialog-zoom-root .dialog-zoom-wrapper .zoom-action {
|
|
235
|
+
cursor: pointer;
|
|
236
|
+
}
|
|
237
|
+
.dialog-main .dialog-zoom-root .dialog-zoom-label {
|
|
238
|
+
transform: rotate(-90deg);
|
|
239
|
+
}
|
|
218
240
|
.dialog-main .actions-wrapper {
|
|
219
241
|
display: flex;
|
|
220
242
|
flex-direction: row;
|
|
@@ -293,6 +315,7 @@
|
|
|
293
315
|
align-items: center;
|
|
294
316
|
justify-content: space-between;
|
|
295
317
|
flex: 0;
|
|
318
|
+
overflow: hidden;
|
|
296
319
|
}
|
|
297
320
|
.dialog-main .resizable-handle {
|
|
298
321
|
position: absolute;
|
package/types/DialogTypes.d.ts
CHANGED
|
@@ -82,8 +82,10 @@ interface IDialogOptionsType {
|
|
|
82
82
|
busyMessage?: string;
|
|
83
83
|
[k: string]: any;
|
|
84
84
|
};
|
|
85
|
+
scale?: number;
|
|
86
|
+
scaleable?: boolean;
|
|
85
87
|
}
|
|
86
|
-
export type DialogOptionsType = Partial<Pick<IDialogOptionsType, 'base' | 'snackbar' | 'backdrop' | 'slotProps' | 'slot' | 'animate' | 'progress' | 'localText'>>;
|
|
88
|
+
export type DialogOptionsType = Partial<Pick<IDialogOptionsType, 'base' | 'snackbar' | 'backdrop' | 'slotProps' | 'slot' | 'animate' | 'progress' | 'scale' | 'scaleable' | 'localText'>>;
|
|
87
89
|
interface kSlot {
|
|
88
90
|
action?: React.JSXElementConstructor<any>;
|
|
89
91
|
footer?: React.JSXElementConstructor<any>;
|