Latest updates from IceHrmPro

This commit is contained in:
Thilina Pituwala
2020-05-20 18:47:29 +02:00
parent 60c92d7935
commit 7453a58aad
18012 changed files with 2089245 additions and 10173 deletions

33
web/node_modules/rc-notification/es/Notice.d.ts generated vendored Normal file
View File

@@ -0,0 +1,33 @@
import React, { Component } from 'react';
export interface NoticeProps {
prefixCls: string;
style?: React.CSSProperties;
className?: string;
duration?: number | null;
children?: React.ReactNode;
update?: boolean;
closeIcon?: React.ReactNode;
closable?: boolean;
onClick?: React.MouseEventHandler<HTMLDivElement>;
onClose?: () => void;
/** @private Only for internal usage. We don't promise that we will refactor this */
holder?: HTMLDivElement;
}
export default class Notice extends Component<NoticeProps> {
static defaultProps: {
onClose(): void;
duration: number;
style: {
right: string;
};
};
closeTimer: number;
componentDidMount(): void;
componentDidUpdate(prevProps: NoticeProps): void;
componentWillUnmount(): void;
close: (e?: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
startCloseTimer: () => void;
clearCloseTimer: () => void;
restartCloseTimer(): void;
render(): JSX.Element;
}

135
web/node_modules/rc-notification/es/Notice.js generated vendored Normal file
View File

@@ -0,0 +1,135 @@
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
var Notice =
/*#__PURE__*/
function (_Component) {
_inherits(Notice, _Component);
function Notice() {
var _this;
_classCallCheck(this, Notice);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Notice).apply(this, arguments));
_this.close = function (e) {
if (e) {
e.stopPropagation();
}
_this.clearCloseTimer();
_this.props.onClose();
};
_this.startCloseTimer = function () {
if (_this.props.duration) {
_this.closeTimer = window.setTimeout(function () {
_this.close();
}, _this.props.duration * 1000);
}
};
_this.clearCloseTimer = function () {
if (_this.closeTimer) {
clearTimeout(_this.closeTimer);
_this.closeTimer = null;
}
};
return _this;
}
_createClass(Notice, [{
key: "componentDidMount",
value: function componentDidMount() {
this.startCloseTimer();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (this.props.duration !== prevProps.duration || this.props.update) {
this.restartCloseTimer();
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.clearCloseTimer();
}
}, {
key: "restartCloseTimer",
value: function restartCloseTimer() {
this.clearCloseTimer();
this.startCloseTimer();
}
}, {
key: "render",
value: function render() {
var _this$props = this.props,
prefixCls = _this$props.prefixCls,
className = _this$props.className,
closable = _this$props.closable,
closeIcon = _this$props.closeIcon,
style = _this$props.style,
onClick = _this$props.onClick,
children = _this$props.children,
holder = _this$props.holder;
var componentClass = "".concat(prefixCls, "-notice");
var node = React.createElement("div", {
className: classNames(componentClass, className, _defineProperty({}, "".concat(componentClass, "-closable"), closable)),
style: style,
onMouseEnter: this.clearCloseTimer,
onMouseLeave: this.startCloseTimer,
onClick: onClick
}, React.createElement("div", {
className: "".concat(componentClass, "-content")
}, children), closable ? React.createElement("a", {
tabIndex: 0,
onClick: this.close,
className: "".concat(componentClass, "-close")
}, closeIcon || React.createElement("span", {
className: "".concat(componentClass, "-close-x")
})) : null);
if (holder) {
return ReactDOM.createPortal(node, holder);
}
return node;
}
}]);
return Notice;
}(Component);
export { Notice as default };
Notice.defaultProps = {
onClose: function onClose() {},
duration: 1.5,
style: {
right: '50%'
}
};

54
web/node_modules/rc-notification/es/Notification.d.ts generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import React, { Component } from 'react';
import { NoticeProps } from './Notice';
export interface NoticeContent extends Omit<NoticeProps, 'prefixCls' | 'children'> {
prefixCls?: string;
key?: React.Key;
updateKey?: React.Key;
content?: React.ReactNode;
}
export declare type NoticeFunc = (noticeProps: NoticeContent) => void;
export declare type HolderReadyCallback = (div: HTMLDivElement, noticeProps: NoticeProps & {
key: React.Key;
}) => void;
export interface NotificationInstance {
notice: NoticeFunc;
removeNotice: (key: React.Key) => void;
destroy: () => void;
component: Notification;
useNotification: () => [NoticeFunc, React.ReactElement];
}
export interface NotificationProps {
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
transitionName?: string;
animation?: string | object;
maxCount?: number;
closeIcon?: React.ReactNode;
}
interface NotificationState {
notices: {
notice: NoticeContent;
holderCallback?: HolderReadyCallback;
}[];
}
declare class Notification extends Component<NotificationProps, NotificationState> {
static newInstance: (properties: NotificationProps & {
getContainer?: () => HTMLElement;
}, callback: (instance: NotificationInstance) => void) => void;
static defaultProps: {
prefixCls: string;
animation: string;
style: {
top: number;
left: string;
};
};
state: NotificationState;
private hookRefs;
getTransitionName(): string;
add: (notice: NoticeContent, holderCallback?: HolderReadyCallback) => void;
remove: (key: string | number) => void;
render(): JSX.Element;
}
export default Notification;

249
web/node_modules/rc-notification/es/Notification.js generated vendored Normal file
View File

@@ -0,0 +1,249 @@
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import Animate from 'rc-animate';
import createChainedFunction from "rc-util/es/createChainedFunction";
import classnames from 'classnames';
import Notice from './Notice';
import _useNotification from './useNotification';
var seed = 0;
var now = Date.now();
function getUuid() {
var id = seed;
seed += 1;
return "rcNotification_".concat(now, "_").concat(id);
}
var Notification =
/*#__PURE__*/
function (_Component) {
_inherits(Notification, _Component);
function Notification() {
var _this;
_classCallCheck(this, Notification);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Notification).apply(this, arguments));
_this.state = {
notices: []
};
_this.hookRefs = new Map();
_this.add = function (notice, holderCallback) {
notice.key = notice.key || getUuid();
var key = notice.key;
var maxCount = _this.props.maxCount;
_this.setState(function (previousState) {
var notices = previousState.notices;
var noticeIndex = notices.map(function (v) {
return v.notice.key;
}).indexOf(key);
var updatedNotices = notices.concat();
if (noticeIndex !== -1) {
updatedNotices.splice(noticeIndex, 1, {
notice: notice,
holderCallback: holderCallback
});
} else {
if (maxCount && notices.length >= maxCount) {
// XXX, use key of first item to update new added (let React to move exsiting
// instead of remove and mount). Same key was used before for both a) external
// manual control and b) internal react 'key' prop , which is not that good.
notice.updateKey = updatedNotices[0].notice.updateKey || updatedNotices[0].notice.key;
updatedNotices.shift();
}
updatedNotices.push({
notice: notice,
holderCallback: holderCallback
});
}
return {
notices: updatedNotices
};
});
};
_this.remove = function (key) {
_this.setState(function (previousState) {
return {
notices: previousState.notices.filter(function (_ref) {
var notice = _ref.notice;
return notice.key !== key;
})
};
});
};
return _this;
}
_createClass(Notification, [{
key: "getTransitionName",
value: function getTransitionName() {
var _this$props = this.props,
prefixCls = _this$props.prefixCls,
animation = _this$props.animation;
var transitionName = this.props.transitionName;
if (!transitionName && animation) {
transitionName = "".concat(prefixCls, "-").concat(animation);
}
return transitionName;
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var notices = this.state.notices;
var _this$props2 = this.props,
prefixCls = _this$props2.prefixCls,
className = _this$props2.className,
closeIcon = _this$props2.closeIcon,
style = _this$props2.style;
var noticeNodes = notices.map(function (_ref2, index) {
var notice = _ref2.notice,
holderCallback = _ref2.holderCallback;
var update = Boolean(index === notices.length - 1 && notice.updateKey);
var key = notice.updateKey ? notice.updateKey : notice.key;
var onClose = createChainedFunction(_this2.remove.bind(_this2, notice.key), notice.onClose);
var noticeProps = _objectSpread({
prefixCls: prefixCls,
closeIcon: closeIcon
}, notice, {
key: key,
update: update,
onClose: onClose,
onClick: notice.onClick,
children: notice.content
});
if (holderCallback) {
return React.createElement("div", {
key: key,
className: "".concat(prefixCls, "-hook-holder"),
ref: function ref(div) {
if (div) {
_this2.hookRefs.set(key, div);
holderCallback(div, noticeProps);
} else {
_this2.hookRefs.delete(key);
}
}
});
}
return React.createElement(Notice, Object.assign({}, noticeProps));
});
return React.createElement("div", {
className: classnames(prefixCls, className),
style: style
}, React.createElement(Animate, {
transitionName: this.getTransitionName()
}, noticeNodes));
}
}]);
return Notification;
}(Component);
Notification.defaultProps = {
prefixCls: 'rc-notification',
animation: 'fade',
style: {
top: 65,
left: '50%'
}
};
Notification.newInstance = function newNotificationInstance(properties, callback) {
var _ref3 = properties || {},
getContainer = _ref3.getContainer,
props = _objectWithoutProperties(_ref3, ["getContainer"]);
var div = document.createElement('div');
if (getContainer) {
var root = getContainer();
root.appendChild(div);
} else {
document.body.appendChild(div);
}
var called = false;
function ref(notification) {
if (called) {
return;
}
called = true;
callback({
notice: function notice(noticeProps) {
notification.add(noticeProps);
},
removeNotice: function removeNotice(key) {
notification.remove(key);
},
component: notification,
destroy: function destroy() {
ReactDOM.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
},
// Hooks
useNotification: function useNotification() {
return _useNotification(notification);
}
});
} // Only used for test case usage
if (process.env.NODE_ENV === 'test' && properties.TEST_RENDER) {
properties.TEST_RENDER(React.createElement(Notification, Object.assign({}, props, {
ref: ref
})));
return;
}
ReactDOM.render(React.createElement(Notification, Object.assign({}, props, {
ref: ref
})), div);
};
export default Notification;

2
web/node_modules/rc-notification/es/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import Notification from './Notification';
export default Notification;

2
web/node_modules/rc-notification/es/index.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import Notification from './Notification';
export default Notification;

View File

@@ -0,0 +1,3 @@
import * as React from 'react';
import Notification, { NoticeFunc } from './Notification';
export default function useNotification(notificationInstance: Notification): [NoticeFunc, React.ReactElement];

44
web/node_modules/rc-notification/es/useNotification.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import * as React from 'react';
import Notice from './Notice';
export default function useNotification(notificationInstance) {
var createdRef = React.useRef({});
var _React$useState = React.useState([]),
_React$useState2 = _slicedToArray(_React$useState, 2),
elements = _React$useState2[0],
setElements = _React$useState2[1];
function notify(noticeProps) {
notificationInstance.add(noticeProps, function (div, props) {
var key = props.key;
if (div && !createdRef.current[key]) {
var noticeEle = React.createElement(Notice, Object.assign({}, props, {
holder: div
}));
createdRef.current[key] = noticeEle;
setElements(function (originElements) {
return [].concat(_toConsumableArray(originElements), [noticeEle]);
});
}
});
}
return [notify, React.createElement(React.Fragment, null, elements)];
}