ywana-core8 0.0.751 → 0.0.753

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.
@@ -195,6 +195,29 @@ function _extends() {
195
195
  return _extends.apply(this, arguments);
196
196
  }
197
197
 
198
+ /**
199
+ * Tooltip
200
+ */
201
+
202
+ var Tooltip = function Tooltip(props) {
203
+ var _props$text = props.text,
204
+ text = _props$text === void 0 ? "" : _props$text,
205
+ _props$top = props.top,
206
+ top = _props$top === void 0 ? "1rem" : _props$top,
207
+ _props$left = props.left,
208
+ left = _props$left === void 0 ? "1rem" : _props$left;
209
+ var style = {
210
+ top: top,
211
+ left: left
212
+ };
213
+ return /*#__PURE__*/React.createElement("div", {
214
+ className: "tooltip"
215
+ }, /*#__PURE__*/React.createElement("span", {
216
+ className: "tooltip-text",
217
+ style: style
218
+ }, text), props.children);
219
+ };
220
+
198
221
  /**
199
222
  * Icon
200
223
  */
@@ -203,6 +226,7 @@ var Icon = function Icon(_ref) {
203
226
  var icon = _ref.icon,
204
227
  _ref$size = _ref.size,
205
228
  size = _ref$size === void 0 ? "normal" : _ref$size,
229
+ tooltip = _ref.tooltip,
206
230
  _ref$clickable = _ref.clickable,
207
231
  clickable = _ref$clickable === void 0 ? false : _ref$clickable,
208
232
  _ref$disabled = _ref.disabled,
@@ -222,7 +246,10 @@ var Icon = function Icon(_ref) {
222
246
  }
223
247
 
224
248
  var style = disabled ? "disabled" : clickable ? "clickable" : "";
225
- return /*#__PURE__*/React.createElement("i", {
249
+ return tooltip ? /*#__PURE__*/React.createElement(Tooltip, tooltip, /*#__PURE__*/React.createElement("i", {
250
+ className: "icon " + size + " " + style + " " + className + " material-icons",
251
+ onClick: click
252
+ }, icon)) : /*#__PURE__*/React.createElement("i", {
226
253
  className: "icon " + size + " " + style + " " + className + " material-icons",
227
254
  onClick: click
228
255
  }, icon);
@@ -744,6 +771,7 @@ var ListItem = function ListItem(_ref) {
744
771
  onSelect = _ref.onSelect;
745
772
  var id = item.id,
746
773
  icon = item.icon,
774
+ iconTooltip = item.iconTooltip,
747
775
  line1 = item.line1,
748
776
  line2 = item.line2,
749
777
  meta = item.meta;
@@ -759,7 +787,8 @@ var ListItem = function ListItem(_ref) {
759
787
  onClick: select
760
788
  }, icon ? /*#__PURE__*/React.createElement(Icon, {
761
789
  icon: icon,
762
- size: "small"
790
+ size: "small",
791
+ tooltip: iconTooltip
763
792
  }) : null, /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement("div", {
764
793
  className: "primary-line"
765
794
  }, /*#__PURE__*/React.createElement(Text, null, line1)), line2 ? /*#__PURE__*/React.createElement("div", {
@@ -2412,29 +2441,6 @@ var Switch = function Switch(props) {
2412
2441
  }));
2413
2442
  };
2414
2443
 
2415
- /**
2416
- * Tooltip
2417
- */
2418
-
2419
- var Tooltip = function Tooltip(props) {
2420
- var _props$text = props.text,
2421
- text = _props$text === void 0 ? "" : _props$text,
2422
- _props$top = props.top,
2423
- top = _props$top === void 0 ? "1rem" : _props$top,
2424
- _props$left = props.left,
2425
- left = _props$left === void 0 ? "1rem" : _props$left;
2426
- var style = {
2427
- top: top,
2428
- left: left
2429
- };
2430
- return /*#__PURE__*/React.createElement("div", {
2431
- className: "tooltip"
2432
- }, /*#__PURE__*/React.createElement("span", {
2433
- className: "tooltip-text",
2434
- style: style
2435
- }, text), props.children);
2436
- };
2437
-
2438
2444
  /**
2439
2445
  * Thumbnail
2440
2446
  */
@@ -4307,6 +4313,156 @@ var EmptyMessage = function EmptyMessage(_ref) {
4307
4313
  }, text));
4308
4314
  };
4309
4315
 
4316
+ var SCROLL_SENSITIVITY = 0.0005;
4317
+ var MAX_ZOOM = 5;
4318
+ var MIN_ZOOM = 0.1;
4319
+ var ImageViewer = function ImageViewer(_ref) {
4320
+ var image = _ref.image;
4321
+
4322
+ var _useState = useState({
4323
+ x: 0,
4324
+ y: 0
4325
+ }),
4326
+ offset = _useState[0],
4327
+ setOffset = _useState[1];
4328
+
4329
+ var _useState2 = useState(1),
4330
+ zoom = _useState2[0],
4331
+ setZoom = _useState2[1];
4332
+
4333
+ var _useState3 = useState(false),
4334
+ draggind = _useState3[0],
4335
+ setDragging = _useState3[1];
4336
+
4337
+ var touch = useRef({
4338
+ x: 0,
4339
+ y: 0
4340
+ });
4341
+ var canvasRef = useRef(null);
4342
+ var containerRef = useRef(null);
4343
+ var observer = useRef(null);
4344
+ var background = useMemo(function () {
4345
+ return new Image();
4346
+ }, [image]);
4347
+
4348
+ var clamp = function clamp(num, min, max) {
4349
+ return Math.min(Math.max(num, min), max);
4350
+ };
4351
+
4352
+ var handleWheel = function handleWheel(event) {
4353
+ var deltaY = event.deltaY;
4354
+
4355
+ if (!draggind) {
4356
+ setZoom(function (zoom) {
4357
+ return clamp(zoom + deltaY * SCROLL_SENSITIVITY * -1, MIN_ZOOM, MAX_ZOOM);
4358
+ });
4359
+ }
4360
+ };
4361
+
4362
+ var handleMouseMove = function handleMouseMove(event) {
4363
+ if (draggind) {
4364
+ var _touch$current = touch.current,
4365
+ x = _touch$current.x,
4366
+ y = _touch$current.y;
4367
+ var clientX = event.clientX,
4368
+ clientY = event.clientY;
4369
+ setOffset({
4370
+ x: offset.x + (x - clientX),
4371
+ y: offset.y + (y - clientY)
4372
+ });
4373
+ touch.current = {
4374
+ x: clientX,
4375
+ y: clientY
4376
+ };
4377
+ }
4378
+ };
4379
+
4380
+ var handleMouseDown = function handleMouseDown(event) {
4381
+ var clientX = event.clientX,
4382
+ clientY = event.clientY;
4383
+ touch.current = {
4384
+ x: clientX,
4385
+ y: clientY
4386
+ };
4387
+ setDragging(true);
4388
+ };
4389
+
4390
+ var handleMouseUp = function handleMouseUp() {
4391
+ return setDragging(false);
4392
+ };
4393
+
4394
+ var draw = function draw() {
4395
+ if (canvasRef.current) {
4396
+ var _canvasRef$current = canvasRef.current,
4397
+ width = _canvasRef$current.width,
4398
+ height = _canvasRef$current.height;
4399
+ var context = canvasRef.current.getContext("2d"); // Set canvas dimensions
4400
+
4401
+ canvasRef.current.width = width;
4402
+ canvasRef.current.height = height; // Clear canvas and scale it
4403
+
4404
+ context.translate(-offset.x, -offset.y);
4405
+ context.scale(zoom, zoom);
4406
+ context.clearRect(0, 0, width, height); // Make sure we're zooming to the center
4407
+
4408
+ var x = (context.canvas.width / zoom - background.width) / 2;
4409
+ var y = (context.canvas.height / zoom - background.height) / 2; // Draw image
4410
+
4411
+ context.drawImage(background, x, y);
4412
+ }
4413
+ };
4414
+
4415
+ useEffect(function () {
4416
+ observer.current = new ResizeObserver(function (entries) {
4417
+ entries.forEach(function (_ref2) {
4418
+ var target = _ref2.target;
4419
+ var width = background.width,
4420
+ height = background.height; // If width of the container is smaller than image, scale image down
4421
+
4422
+ if (target.clientWidth < width) {
4423
+ // Calculate scale
4424
+ var scale = target.clientWidth / width; // Redraw image
4425
+
4426
+ canvasRef.current.width = width * scale;
4427
+ canvasRef.current.height = height * scale;
4428
+ canvasRef.current.getContext("2d").drawImage(background, 0, 0, width * scale, height * scale);
4429
+ }
4430
+ });
4431
+ });
4432
+ observer.current.observe(containerRef.current);
4433
+ return function () {
4434
+ return observer.current.unobserve(containerRef.current);
4435
+ };
4436
+ }, []);
4437
+ useEffect(function () {
4438
+ background.src = image;
4439
+
4440
+ if (canvasRef.current) {
4441
+ background.onload = function () {
4442
+ // Get the image dimensions
4443
+ var width = background.width,
4444
+ height = background.height;
4445
+ canvasRef.current.width = width;
4446
+ canvasRef.current.height = height; // Set image as background
4447
+
4448
+ canvasRef.current.getContext("2d").drawImage(background, 0, 0);
4449
+ };
4450
+ }
4451
+ }, [background]);
4452
+ useEffect(function () {
4453
+ draw();
4454
+ }, [zoom, offset]);
4455
+ return /*#__PURE__*/React.createElement("div", {
4456
+ ref: containerRef
4457
+ }, /*#__PURE__*/React.createElement("canvas", {
4458
+ onMouseDown: handleMouseDown,
4459
+ onMouseUp: handleMouseUp,
4460
+ onWheel: handleWheel,
4461
+ onMouseMove: handleMouseMove,
4462
+ ref: canvasRef
4463
+ }));
4464
+ };
4465
+
4310
4466
  /**
4311
4467
  * Content Form
4312
4468
  */
@@ -6345,6 +6501,9 @@ var CollectionEditor$1 = function CollectionEditor(props) {
6345
6501
  var _temp5 = function _temp5() {
6346
6502
  if (onChange) onChange(form);
6347
6503
  setPageContext(Object.assign({}, pageContext));
6504
+ site.notify({
6505
+ title: "Datos Guardados"
6506
+ });
6348
6507
  };
6349
6508
 
6350
6509
  var _temp6 = function () {
@@ -10971,5 +11130,5 @@ var isFunction = function isFunction(value) {
10971
11130
  return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
10972
11131
  };
10973
11132
 
10974
- export { Accordion, Avatar, Button, Calendar, CheckBox, Chip, Chips, CircularProgress, CollectionContext$1 as CollectionContext, CollectionContext as CollectionContext2, CollectionEditor$2 as CollectionEditor, CollectionFilters$1 as CollectionFilters, CollectionPage$1 as CollectionPage, CollectionPage as CollectionPage2, CollectionTree, ColorField, Content, ContentEditor, ContentForm, ContentViewer, CreateContentDialog, DataTable, DateRange, Dialog, DropDown, EditContentDialog, EmptyMessage, FORMATS$1 as FORMATS, FieldEditor, FileExplorer, FilesGrid, Form, HTTPClient, Header, Icon, Kanban, KanbanCard, KanbanColumn, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, MultiSelector, Page, PageContext, PageProvider, Planner, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, TEXTFORMATS, TYPES, Tab, TabbedContentEditor, TabbedTablePage, TabbedView, TableEditor$2 as TableEditor, TablePage, TablePage2, Tabs, TaskContext, TaskContextProvider, TaskMonitor, TaskProgress, Text, TextArea, TextField, Thumbnail, ToggleButton, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UploadArea, UploadDialog, UploadFile, UploadIcon, Uploader, View, Viewer, WaitScreen, Wizard, WizardContext, isEmpty, isFunction };
11133
+ export { Accordion, Avatar, Button, Calendar, CheckBox, Chip, Chips, CircularProgress, CollectionContext$1 as CollectionContext, CollectionContext as CollectionContext2, CollectionEditor$2 as CollectionEditor, CollectionFilters$1 as CollectionFilters, CollectionPage$1 as CollectionPage, CollectionPage as CollectionPage2, CollectionTree, ColorField, Content, ContentEditor, ContentForm, ContentViewer, CreateContentDialog, DataTable, DateRange, Dialog, DropDown, EditContentDialog, EmptyMessage, FORMATS$1 as FORMATS, FieldEditor, FileExplorer, FilesGrid, Form, HTTPClient, Header, Icon, ImageViewer, Kanban, KanbanCard, KanbanColumn, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, MultiSelector, Page, PageContext, PageProvider, Planner, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, TEXTFORMATS, TYPES, Tab, TabbedContentEditor, TabbedTablePage, TabbedView, TableEditor$2 as TableEditor, TablePage, TablePage2, Tabs, TaskContext, TaskContextProvider, TaskMonitor, TaskProgress, Text, TextArea, TextField, Thumbnail, ToggleButton, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UploadArea, UploadDialog, UploadFile, UploadIcon, Uploader, View, Viewer, WaitScreen, Wizard, WizardContext, isEmpty, isFunction };
10975
11134
  //# sourceMappingURL=index.modern.js.map