siam-ui-utils 3.1.0 → 3.1.1
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/CustomBootstrap.js +9 -9
- package/dist/_virtual/_commonjsHelpers.js +7 -7
- package/dist/_virtual/events.js +6 -6
- package/dist/_virtual/events2.js +5 -5
- package/dist/_virtual/index.js +8 -8
- package/dist/_virtual/index2.js +5 -5
- package/dist/assets/img/copiar.png.js +5 -5
- package/dist/assets/img/take-photo.jpg.js +5 -5
- package/dist/constants.js +9 -9
- package/dist/copy-link/index.js +60 -60
- package/dist/copy-link/styles.css +37 -37
- package/dist/custom-input/CustomInputCheckbox.js +37 -37
- package/dist/custom-input/CustomInputCurrency.js +84 -84
- package/dist/custom-input/CustomInputFile.js +47 -47
- package/dist/custom-input/CustomInputRadio.js +68 -68
- package/dist/custom-input/constant.js +5 -5
- package/dist/custom-input/index.js +12 -12
- package/dist/drag-and-dropzone/DropzoneComponent.js +83 -83
- package/dist/drag-and-dropzone/config.js +59 -59
- package/dist/drag-and-dropzone/index.js +39 -39
- package/dist/dropzone/Input.js +77 -77
- package/dist/dropzone/Layout.js +50 -50
- package/dist/dropzone/Preview.js +117 -117
- package/dist/dropzone/SubmitButton.js +34 -34
- package/dist/dropzone/assets/cancel.svg.js +5 -5
- package/dist/dropzone/assets/remove.svg.js +5 -5
- package/dist/dropzone/assets/restart.svg.js +5 -5
- package/dist/dropzone/index.js +514 -514
- package/dist/dropzone/utils.js +93 -93
- package/dist/dropzone-uploader/base/index.js +135 -135
- package/dist/dropzone-uploader/index.js +7 -7
- package/dist/dropzone-uploader/styled/index.js +148 -148
- package/dist/iconos/constants-svg.js +666 -666
- package/dist/iconos/icon-button-svg.js +50 -50
- package/dist/iconos/index.js +24 -24
- package/dist/iconos/styled-icon.js +26 -26
- package/dist/index.js +4 -4
- package/dist/intl-messages/index.js +11 -11
- package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +8 -8
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -13
- package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +8 -8
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +13 -13
- package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +9 -9
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Button.js +111 -111
- package/dist/node_modules/@neolution-ch/reactstrap/esm/CloseButton.js +106 -106
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Col.js +125 -125
- package/dist/node_modules/@neolution-ch/reactstrap/esm/FormGroup.js +75 -75
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Input.js +225 -225
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Label.js +122 -122
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Row.js +83 -83
- package/dist/node_modules/@neolution-ch/reactstrap/esm/utils.js +68 -68
- package/dist/node_modules/classnames/index.js +62 -62
- package/dist/node_modules/dom-helpers/esm/addClass.js +10 -10
- package/dist/node_modules/dom-helpers/esm/hasClass.js +8 -8
- package/dist/node_modules/dom-helpers/esm/removeClass.js +16 -16
- package/dist/node_modules/dropzone/dist/dropzone.js +1968 -1968
- package/dist/node_modules/events/events.js +372 -372
- package/dist/node_modules/just-extend/index.esm.js +43 -43
- package/dist/node_modules/react-transition-group/esm/CSSTransition.js +275 -275
- package/dist/node_modules/react-transition-group/esm/Transition.js +441 -441
- package/dist/node_modules/react-transition-group/esm/TransitionGroup.js +146 -146
- package/dist/node_modules/react-transition-group/esm/TransitionGroupContext.js +6 -6
- package/dist/node_modules/react-transition-group/esm/config.js +7 -7
- package/dist/node_modules/react-transition-group/esm/utils/ChildMapping.js +100 -100
- package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js +24 -24
- package/dist/node_modules/react-transition-group/esm/utils/reflow.js +7 -7
- package/dist/react-notifications/Notification.js +73 -73
- package/dist/react-notifications/NotificationContainer.js +59 -59
- package/dist/react-notifications/NotificationManager.js +174 -174
- package/dist/react-notifications/Notifications.js +72 -72
- package/dist/react-notifications/constants.js +26 -26
- package/dist/react-notifications/index.js +11 -11
- package/dist/select/custom-select/constants.js +8 -8
- package/dist/select/custom-select/index.js +89 -89
- package/dist/select/custom-select-input/index.js +12 -12
- package/dist/select/index.js +9 -9
- package/dist/select/multi-select/badge-label-multi-select.js +29 -29
- package/dist/select/multi-select/index.css +36 -36
- package/dist/select/multi-select/index.js +170 -171
- package/dist/select/multi-select/index.js.map +1 -1
- package/dist/select/multi-select/styled-component.js +23 -23
- package/dist/timer/index.js +60 -60
- package/dist/timer/styles.css +58 -58
- package/dist/tomar-foto/index.js +62 -62
- package/dist/view-layout/button-editor.js +14 -14
- package/dist/view-layout/constants.js +11 -11
- package/dist/view-layout/editor-layer.js +28 -28
- package/dist/view-layout/index.js +53 -53
- package/dist/view-layout/slot-wrapper.js +39 -39
- package/dist/view-layout/styles.css +126 -126
- package/dist/where-by-room/index.js +20 -20
- package/dist/where-by-room/room.js +78 -78
- package/package.json +1 -4
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useEffect } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import classnames from "../_virtual/index.js";
|
|
5
|
-
const Notification = ({
|
|
6
|
-
title = null,
|
|
7
|
-
type = "info",
|
|
8
|
-
message = null,
|
|
9
|
-
customClassName = "",
|
|
10
|
-
timeOut = 5e3,
|
|
11
|
-
onClick = () => {
|
|
12
|
-
},
|
|
13
|
-
onRequestHide = () => {
|
|
14
|
-
}
|
|
15
|
-
}) => {
|
|
16
|
-
const mounted = useRef(true);
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
mounted.current = true;
|
|
19
|
-
let timer = null;
|
|
20
|
-
if (timeOut !== 0) {
|
|
21
|
-
timer = setTimeout(() => {
|
|
22
|
-
if (mounted.current) requestHide();
|
|
23
|
-
}, timeOut);
|
|
24
|
-
}
|
|
25
|
-
return () => {
|
|
26
|
-
mounted.current = false;
|
|
27
|
-
if (timer) {
|
|
28
|
-
clearTimeout(timer);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}, []);
|
|
32
|
-
const requestHide = () => {
|
|
33
|
-
if (mounted.current && onRequestHide) {
|
|
34
|
-
onRequestHide();
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const handleClick = () => {
|
|
38
|
-
if (onClick) {
|
|
39
|
-
onClick();
|
|
40
|
-
}
|
|
41
|
-
requestHide();
|
|
42
|
-
};
|
|
43
|
-
const className = classnames([
|
|
44
|
-
"notification",
|
|
45
|
-
`notification-${type}`,
|
|
46
|
-
customClassName
|
|
47
|
-
]);
|
|
48
|
-
const titleHtml = title ? /* @__PURE__ */ jsx("h4", { className: "title", children: title }) : null;
|
|
49
|
-
return /* @__PURE__ */ jsx("div", { className, onClick: handleClick, children: /* @__PURE__ */ jsxs("div", { className: "notification-message", role: "alert", children: [
|
|
50
|
-
titleHtml,
|
|
51
|
-
/* @__PURE__ */ jsx("div", { className: "message", children: message })
|
|
52
|
-
] }) });
|
|
53
|
-
};
|
|
54
|
-
Notification.propTypes = {
|
|
55
|
-
type: PropTypes.oneOf([
|
|
56
|
-
"info",
|
|
57
|
-
"success",
|
|
58
|
-
"warning",
|
|
59
|
-
"error",
|
|
60
|
-
"primary",
|
|
61
|
-
"secondary"
|
|
62
|
-
]),
|
|
63
|
-
title: PropTypes.node,
|
|
64
|
-
message: PropTypes.node,
|
|
65
|
-
timeOut: PropTypes.number,
|
|
66
|
-
onClick: PropTypes.func,
|
|
67
|
-
onRequestHide: PropTypes.func,
|
|
68
|
-
customClassName: PropTypes.string
|
|
69
|
-
};
|
|
70
|
-
export {
|
|
71
|
-
Notification as default
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=Notification.js.map
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import classnames from "../_virtual/index.js";
|
|
5
|
+
const Notification = ({
|
|
6
|
+
title = null,
|
|
7
|
+
type = "info",
|
|
8
|
+
message = null,
|
|
9
|
+
customClassName = "",
|
|
10
|
+
timeOut = 5e3,
|
|
11
|
+
onClick = () => {
|
|
12
|
+
},
|
|
13
|
+
onRequestHide = () => {
|
|
14
|
+
}
|
|
15
|
+
}) => {
|
|
16
|
+
const mounted = useRef(true);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
mounted.current = true;
|
|
19
|
+
let timer = null;
|
|
20
|
+
if (timeOut !== 0) {
|
|
21
|
+
timer = setTimeout(() => {
|
|
22
|
+
if (mounted.current) requestHide();
|
|
23
|
+
}, timeOut);
|
|
24
|
+
}
|
|
25
|
+
return () => {
|
|
26
|
+
mounted.current = false;
|
|
27
|
+
if (timer) {
|
|
28
|
+
clearTimeout(timer);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
const requestHide = () => {
|
|
33
|
+
if (mounted.current && onRequestHide) {
|
|
34
|
+
onRequestHide();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const handleClick = () => {
|
|
38
|
+
if (onClick) {
|
|
39
|
+
onClick();
|
|
40
|
+
}
|
|
41
|
+
requestHide();
|
|
42
|
+
};
|
|
43
|
+
const className = classnames([
|
|
44
|
+
"notification",
|
|
45
|
+
`notification-${type}`,
|
|
46
|
+
customClassName
|
|
47
|
+
]);
|
|
48
|
+
const titleHtml = title ? /* @__PURE__ */ jsx("h4", { className: "title", children: title }) : null;
|
|
49
|
+
return /* @__PURE__ */ jsx("div", { className, onClick: handleClick, children: /* @__PURE__ */ jsxs("div", { className: "notification-message", role: "alert", children: [
|
|
50
|
+
titleHtml,
|
|
51
|
+
/* @__PURE__ */ jsx("div", { className: "message", children: message })
|
|
52
|
+
] }) });
|
|
53
|
+
};
|
|
54
|
+
Notification.propTypes = {
|
|
55
|
+
type: PropTypes.oneOf([
|
|
56
|
+
"info",
|
|
57
|
+
"success",
|
|
58
|
+
"warning",
|
|
59
|
+
"error",
|
|
60
|
+
"primary",
|
|
61
|
+
"secondary"
|
|
62
|
+
]),
|
|
63
|
+
title: PropTypes.node,
|
|
64
|
+
message: PropTypes.node,
|
|
65
|
+
timeOut: PropTypes.number,
|
|
66
|
+
onClick: PropTypes.func,
|
|
67
|
+
onRequestHide: PropTypes.func,
|
|
68
|
+
customClassName: PropTypes.string
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
Notification as default
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=Notification.js.map
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Component } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import NotificationManager from "./NotificationManager.js";
|
|
5
|
-
import Notifications from "./Notifications.js";
|
|
6
|
-
class NotificationContainer extends Component {
|
|
7
|
-
constructor(props) {
|
|
8
|
-
super(props);
|
|
9
|
-
this._isMounted = false;
|
|
10
|
-
const { enterTimeout = 400, leaveTimeout = 400 } = props;
|
|
11
|
-
this.state = {
|
|
12
|
-
notifications: []
|
|
13
|
-
};
|
|
14
|
-
this.enterTimeout = enterTimeout;
|
|
15
|
-
this.leaveTimeout = leaveTimeout;
|
|
16
|
-
NotificationManager.addChangeListener(this.handleStoreChange);
|
|
17
|
-
}
|
|
18
|
-
componentDidMount = () => {
|
|
19
|
-
this._isMounted = true;
|
|
20
|
-
};
|
|
21
|
-
componentWillUnmount = () => {
|
|
22
|
-
this._isMounted = false;
|
|
23
|
-
NotificationManager.removeChangeListener(this.handleStoreChange);
|
|
24
|
-
};
|
|
25
|
-
handleStoreChange = (notifications) => {
|
|
26
|
-
if (this._isMounted) {
|
|
27
|
-
this.setState({
|
|
28
|
-
notifications
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
handleRequestHide = (notification) => {
|
|
33
|
-
NotificationManager.remove(notification);
|
|
34
|
-
};
|
|
35
|
-
render() {
|
|
36
|
-
const { notifications } = this.state;
|
|
37
|
-
return /* @__PURE__ */ jsx(
|
|
38
|
-
Notifications,
|
|
39
|
-
{
|
|
40
|
-
enterTimeout: this.enterTimeout,
|
|
41
|
-
leaveTimeout: this.leaveTimeout,
|
|
42
|
-
notifications,
|
|
43
|
-
onRequestHide: this.handleRequestHide
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
NotificationContainer.propTypes = {
|
|
49
|
-
enterTimeout: PropTypes.number,
|
|
50
|
-
leaveTimeout: PropTypes.number
|
|
51
|
-
};
|
|
52
|
-
NotificationContainer.defaultProps = {
|
|
53
|
-
enterTimeout: 400,
|
|
54
|
-
leaveTimeout: 400
|
|
55
|
-
};
|
|
56
|
-
export {
|
|
57
|
-
NotificationContainer as default
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=NotificationContainer.js.map
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import NotificationManager from "./NotificationManager.js";
|
|
5
|
+
import Notifications from "./Notifications.js";
|
|
6
|
+
class NotificationContainer extends Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this._isMounted = false;
|
|
10
|
+
const { enterTimeout = 400, leaveTimeout = 400 } = props;
|
|
11
|
+
this.state = {
|
|
12
|
+
notifications: []
|
|
13
|
+
};
|
|
14
|
+
this.enterTimeout = enterTimeout;
|
|
15
|
+
this.leaveTimeout = leaveTimeout;
|
|
16
|
+
NotificationManager.addChangeListener(this.handleStoreChange);
|
|
17
|
+
}
|
|
18
|
+
componentDidMount = () => {
|
|
19
|
+
this._isMounted = true;
|
|
20
|
+
};
|
|
21
|
+
componentWillUnmount = () => {
|
|
22
|
+
this._isMounted = false;
|
|
23
|
+
NotificationManager.removeChangeListener(this.handleStoreChange);
|
|
24
|
+
};
|
|
25
|
+
handleStoreChange = (notifications) => {
|
|
26
|
+
if (this._isMounted) {
|
|
27
|
+
this.setState({
|
|
28
|
+
notifications
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
handleRequestHide = (notification) => {
|
|
33
|
+
NotificationManager.remove(notification);
|
|
34
|
+
};
|
|
35
|
+
render() {
|
|
36
|
+
const { notifications } = this.state;
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
Notifications,
|
|
39
|
+
{
|
|
40
|
+
enterTimeout: this.enterTimeout,
|
|
41
|
+
leaveTimeout: this.leaveTimeout,
|
|
42
|
+
notifications,
|
|
43
|
+
onRequestHide: this.handleRequestHide
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
NotificationContainer.propTypes = {
|
|
49
|
+
enterTimeout: PropTypes.number,
|
|
50
|
+
leaveTimeout: PropTypes.number
|
|
51
|
+
};
|
|
52
|
+
NotificationContainer.defaultProps = {
|
|
53
|
+
enterTimeout: 400,
|
|
54
|
+
leaveTimeout: 400
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
NotificationContainer as default
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=NotificationContainer.js.map
|
|
@@ -1,174 +1,174 @@
|
|
|
1
|
-
import { e as eventsExports } from "../_virtual/events.js";
|
|
2
|
-
import { TYPES, TITLES, DEFAULT_VALUES } from "./constants.js";
|
|
3
|
-
const { CHANGE, PRIMARY, SECONDARY, WARNING, INFO, SUCCESS, ERROR } = TYPES;
|
|
4
|
-
const {
|
|
5
|
-
ERROR: ERROR_TITLE,
|
|
6
|
-
INFORMACION,
|
|
7
|
-
AVISO,
|
|
8
|
-
EXITO,
|
|
9
|
-
PRIMARIO,
|
|
10
|
-
SECUNDARIO
|
|
11
|
-
} = TITLES;
|
|
12
|
-
const { TIMEOUT } = DEFAULT_VALUES;
|
|
13
|
-
const createUUID = () => {
|
|
14
|
-
const pattern = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
15
|
-
return pattern.replace(/[xy]/g, (c) => {
|
|
16
|
-
const r = Math.random() * 16 | 0;
|
|
17
|
-
const v = c === "x" ? r : r & 3 | 8;
|
|
18
|
-
return v.toString(16);
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
class NotificationManager extends eventsExports.EventEmitter {
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
this.listNotify = [];
|
|
25
|
-
}
|
|
26
|
-
create(notify) {
|
|
27
|
-
const defaultNotify = {
|
|
28
|
-
customClassName: "",
|
|
29
|
-
id: createUUID(),
|
|
30
|
-
message: null,
|
|
31
|
-
timeOut: TIMEOUT,
|
|
32
|
-
title: INFORMACION,
|
|
33
|
-
type: INFO
|
|
34
|
-
};
|
|
35
|
-
if (notify.priority) {
|
|
36
|
-
this.listNotify.unshift(Object.assign(defaultNotify, notify));
|
|
37
|
-
} else {
|
|
38
|
-
this.listNotify.push(Object.assign(defaultNotify, notify));
|
|
39
|
-
}
|
|
40
|
-
this.emitChange();
|
|
41
|
-
}
|
|
42
|
-
primary({
|
|
43
|
-
customClassName = "",
|
|
44
|
-
message = "",
|
|
45
|
-
onClick = null,
|
|
46
|
-
priority = "",
|
|
47
|
-
timeOut = TIMEOUT,
|
|
48
|
-
title = PRIMARIO,
|
|
49
|
-
type = PRIMARY
|
|
50
|
-
}) {
|
|
51
|
-
this.create({
|
|
52
|
-
customClassName,
|
|
53
|
-
message,
|
|
54
|
-
onClick,
|
|
55
|
-
priority,
|
|
56
|
-
timeOut,
|
|
57
|
-
title,
|
|
58
|
-
type
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
secondary({
|
|
62
|
-
customClassName = "",
|
|
63
|
-
message = "",
|
|
64
|
-
onClick = null,
|
|
65
|
-
priority = "",
|
|
66
|
-
timeOut = TIMEOUT,
|
|
67
|
-
title = SECUNDARIO,
|
|
68
|
-
type = SECONDARY
|
|
69
|
-
}) {
|
|
70
|
-
this.create({
|
|
71
|
-
customClassName,
|
|
72
|
-
message,
|
|
73
|
-
onClick,
|
|
74
|
-
priority,
|
|
75
|
-
timeOut,
|
|
76
|
-
title,
|
|
77
|
-
type
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
info({
|
|
81
|
-
customClassName = "",
|
|
82
|
-
message = "",
|
|
83
|
-
onClick = null,
|
|
84
|
-
priority = "",
|
|
85
|
-
timeOut = TIMEOUT,
|
|
86
|
-
title = INFORMACION,
|
|
87
|
-
type = INFO
|
|
88
|
-
}) {
|
|
89
|
-
this.create({
|
|
90
|
-
customClassName,
|
|
91
|
-
message,
|
|
92
|
-
onClick,
|
|
93
|
-
priority,
|
|
94
|
-
timeOut,
|
|
95
|
-
title,
|
|
96
|
-
type
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
success({
|
|
100
|
-
customClassName = "",
|
|
101
|
-
message = "",
|
|
102
|
-
onClick = null,
|
|
103
|
-
priority = "",
|
|
104
|
-
timeOut = TIMEOUT,
|
|
105
|
-
title = EXITO,
|
|
106
|
-
type = SUCCESS
|
|
107
|
-
}) {
|
|
108
|
-
this.create({
|
|
109
|
-
customClassName,
|
|
110
|
-
message,
|
|
111
|
-
onClick,
|
|
112
|
-
priority,
|
|
113
|
-
timeOut,
|
|
114
|
-
title,
|
|
115
|
-
type
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
warning({
|
|
119
|
-
customClassName = "",
|
|
120
|
-
message = "",
|
|
121
|
-
onClick = null,
|
|
122
|
-
priority = "",
|
|
123
|
-
timeOut = TIMEOUT,
|
|
124
|
-
title = AVISO,
|
|
125
|
-
type = WARNING
|
|
126
|
-
}) {
|
|
127
|
-
this.create({
|
|
128
|
-
customClassName,
|
|
129
|
-
message,
|
|
130
|
-
onClick,
|
|
131
|
-
priority,
|
|
132
|
-
timeOut,
|
|
133
|
-
title,
|
|
134
|
-
type
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
error({
|
|
138
|
-
customClassName = "",
|
|
139
|
-
message = "",
|
|
140
|
-
onClick = null,
|
|
141
|
-
priority = "",
|
|
142
|
-
timeOut = TIMEOUT,
|
|
143
|
-
title = ERROR_TITLE,
|
|
144
|
-
type = ERROR
|
|
145
|
-
}) {
|
|
146
|
-
this.create({
|
|
147
|
-
customClassName,
|
|
148
|
-
message,
|
|
149
|
-
onClick,
|
|
150
|
-
priority,
|
|
151
|
-
timeOut,
|
|
152
|
-
title,
|
|
153
|
-
type
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
remove(notification) {
|
|
157
|
-
this.listNotify = this.listNotify.filter((n) => notification.id !== n.id);
|
|
158
|
-
this.emitChange();
|
|
159
|
-
}
|
|
160
|
-
emitChange() {
|
|
161
|
-
this.emit(CHANGE, this.listNotify);
|
|
162
|
-
}
|
|
163
|
-
addChangeListener(callback) {
|
|
164
|
-
this.addListener(CHANGE, callback);
|
|
165
|
-
}
|
|
166
|
-
removeChangeListener(callback) {
|
|
167
|
-
this.removeListener(CHANGE, callback);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
const NotificationManager$1 = new NotificationManager();
|
|
171
|
-
export {
|
|
172
|
-
NotificationManager$1 as default
|
|
173
|
-
};
|
|
174
|
-
//# sourceMappingURL=NotificationManager.js.map
|
|
1
|
+
import { e as eventsExports } from "../_virtual/events.js";
|
|
2
|
+
import { TYPES, TITLES, DEFAULT_VALUES } from "./constants.js";
|
|
3
|
+
const { CHANGE, PRIMARY, SECONDARY, WARNING, INFO, SUCCESS, ERROR } = TYPES;
|
|
4
|
+
const {
|
|
5
|
+
ERROR: ERROR_TITLE,
|
|
6
|
+
INFORMACION,
|
|
7
|
+
AVISO,
|
|
8
|
+
EXITO,
|
|
9
|
+
PRIMARIO,
|
|
10
|
+
SECUNDARIO
|
|
11
|
+
} = TITLES;
|
|
12
|
+
const { TIMEOUT } = DEFAULT_VALUES;
|
|
13
|
+
const createUUID = () => {
|
|
14
|
+
const pattern = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
15
|
+
return pattern.replace(/[xy]/g, (c) => {
|
|
16
|
+
const r = Math.random() * 16 | 0;
|
|
17
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
18
|
+
return v.toString(16);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
class NotificationManager extends eventsExports.EventEmitter {
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
this.listNotify = [];
|
|
25
|
+
}
|
|
26
|
+
create(notify) {
|
|
27
|
+
const defaultNotify = {
|
|
28
|
+
customClassName: "",
|
|
29
|
+
id: createUUID(),
|
|
30
|
+
message: null,
|
|
31
|
+
timeOut: TIMEOUT,
|
|
32
|
+
title: INFORMACION,
|
|
33
|
+
type: INFO
|
|
34
|
+
};
|
|
35
|
+
if (notify.priority) {
|
|
36
|
+
this.listNotify.unshift(Object.assign(defaultNotify, notify));
|
|
37
|
+
} else {
|
|
38
|
+
this.listNotify.push(Object.assign(defaultNotify, notify));
|
|
39
|
+
}
|
|
40
|
+
this.emitChange();
|
|
41
|
+
}
|
|
42
|
+
primary({
|
|
43
|
+
customClassName = "",
|
|
44
|
+
message = "",
|
|
45
|
+
onClick = null,
|
|
46
|
+
priority = "",
|
|
47
|
+
timeOut = TIMEOUT,
|
|
48
|
+
title = PRIMARIO,
|
|
49
|
+
type = PRIMARY
|
|
50
|
+
}) {
|
|
51
|
+
this.create({
|
|
52
|
+
customClassName,
|
|
53
|
+
message,
|
|
54
|
+
onClick,
|
|
55
|
+
priority,
|
|
56
|
+
timeOut,
|
|
57
|
+
title,
|
|
58
|
+
type
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
secondary({
|
|
62
|
+
customClassName = "",
|
|
63
|
+
message = "",
|
|
64
|
+
onClick = null,
|
|
65
|
+
priority = "",
|
|
66
|
+
timeOut = TIMEOUT,
|
|
67
|
+
title = SECUNDARIO,
|
|
68
|
+
type = SECONDARY
|
|
69
|
+
}) {
|
|
70
|
+
this.create({
|
|
71
|
+
customClassName,
|
|
72
|
+
message,
|
|
73
|
+
onClick,
|
|
74
|
+
priority,
|
|
75
|
+
timeOut,
|
|
76
|
+
title,
|
|
77
|
+
type
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
info({
|
|
81
|
+
customClassName = "",
|
|
82
|
+
message = "",
|
|
83
|
+
onClick = null,
|
|
84
|
+
priority = "",
|
|
85
|
+
timeOut = TIMEOUT,
|
|
86
|
+
title = INFORMACION,
|
|
87
|
+
type = INFO
|
|
88
|
+
}) {
|
|
89
|
+
this.create({
|
|
90
|
+
customClassName,
|
|
91
|
+
message,
|
|
92
|
+
onClick,
|
|
93
|
+
priority,
|
|
94
|
+
timeOut,
|
|
95
|
+
title,
|
|
96
|
+
type
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
success({
|
|
100
|
+
customClassName = "",
|
|
101
|
+
message = "",
|
|
102
|
+
onClick = null,
|
|
103
|
+
priority = "",
|
|
104
|
+
timeOut = TIMEOUT,
|
|
105
|
+
title = EXITO,
|
|
106
|
+
type = SUCCESS
|
|
107
|
+
}) {
|
|
108
|
+
this.create({
|
|
109
|
+
customClassName,
|
|
110
|
+
message,
|
|
111
|
+
onClick,
|
|
112
|
+
priority,
|
|
113
|
+
timeOut,
|
|
114
|
+
title,
|
|
115
|
+
type
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
warning({
|
|
119
|
+
customClassName = "",
|
|
120
|
+
message = "",
|
|
121
|
+
onClick = null,
|
|
122
|
+
priority = "",
|
|
123
|
+
timeOut = TIMEOUT,
|
|
124
|
+
title = AVISO,
|
|
125
|
+
type = WARNING
|
|
126
|
+
}) {
|
|
127
|
+
this.create({
|
|
128
|
+
customClassName,
|
|
129
|
+
message,
|
|
130
|
+
onClick,
|
|
131
|
+
priority,
|
|
132
|
+
timeOut,
|
|
133
|
+
title,
|
|
134
|
+
type
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
error({
|
|
138
|
+
customClassName = "",
|
|
139
|
+
message = "",
|
|
140
|
+
onClick = null,
|
|
141
|
+
priority = "",
|
|
142
|
+
timeOut = TIMEOUT,
|
|
143
|
+
title = ERROR_TITLE,
|
|
144
|
+
type = ERROR
|
|
145
|
+
}) {
|
|
146
|
+
this.create({
|
|
147
|
+
customClassName,
|
|
148
|
+
message,
|
|
149
|
+
onClick,
|
|
150
|
+
priority,
|
|
151
|
+
timeOut,
|
|
152
|
+
title,
|
|
153
|
+
type
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
remove(notification) {
|
|
157
|
+
this.listNotify = this.listNotify.filter((n) => notification.id !== n.id);
|
|
158
|
+
this.emitChange();
|
|
159
|
+
}
|
|
160
|
+
emitChange() {
|
|
161
|
+
this.emit(CHANGE, this.listNotify);
|
|
162
|
+
}
|
|
163
|
+
addChangeListener(callback) {
|
|
164
|
+
this.addListener(CHANGE, callback);
|
|
165
|
+
}
|
|
166
|
+
removeChangeListener(callback) {
|
|
167
|
+
this.removeListener(CHANGE, callback);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const NotificationManager$1 = new NotificationManager();
|
|
171
|
+
export {
|
|
172
|
+
NotificationManager$1 as default
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=NotificationManager.js.map
|