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

View File

@@ -0,0 +1,5 @@
/**
* Similar with `useLock`, but this hook will always execute last value.
* When set to `true`, it will keep `true` for a short time even if `false` is set.
*/
export default function useDelayReset(timeout?: number): [boolean, (val: boolean, callback?: () => void) => void, () => void];

49
web/node_modules/rc-select/es/hooks/useDelayReset.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) 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';
/**
* Similar with `useLock`, but this hook will always execute last value.
* When set to `true`, it will keep `true` for a short time even if `false` is set.
*/
export default function useDelayReset() {
var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
var _React$useState = React.useState(false),
_React$useState2 = _slicedToArray(_React$useState, 2),
bool = _React$useState2[0],
setBool = _React$useState2[1];
var delayRef = React.useRef(null);
var cancelLatest = function cancelLatest() {
window.clearTimeout(delayRef.current);
};
React.useEffect(function () {
return cancelLatest;
}, []);
var delaySetBool = function delaySetBool(value, callback) {
cancelLatest();
delayRef.current = window.setTimeout(function () {
setBool(value);
if (callback) {
callback();
}
}, timeout);
};
return [bool, delaySetBool, cancelLatest];
}

View File

@@ -0,0 +1,5 @@
import * as React from 'react';
/**
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
*/
export default function useLayoutEffect(effect: React.EffectCallback, deps?: React.DependencyList): void;

17
web/node_modules/rc-select/es/hooks/useLayoutEffect.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/* eslint-disable react-hooks/rules-of-hooks */
import * as React from 'react';
import { isBrowserClient } from '../utils/commonUtil';
/**
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
*/
export default function useLayoutEffect(effect, deps) {
// Never happen in test env
if (isBrowserClient) {
/* istanbul ignore next */
React.useLayoutEffect(effect, deps);
} else {
React.useEffect(effect, deps);
}
}
/* eslint-enable */

7
web/node_modules/rc-select/es/hooks/useLock.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
/**
* Locker return cached mark.
* If set to `true`, will return `true` in a short time even if set `false`.
* If set to `false` and then set to `true`, will change to `true`.
* And after time duration, it will back to `null` automatically.
*/
export default function useLock(duration?: number): [() => boolean, (lock: boolean) => void];

34
web/node_modules/rc-select/es/hooks/useLock.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import * as React from 'react';
/**
* Locker return cached mark.
* If set to `true`, will return `true` in a short time even if set `false`.
* If set to `false` and then set to `true`, will change to `true`.
* And after time duration, it will back to `null` automatically.
*/
export default function useLock() {
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 250;
var lockRef = React.useRef(null);
var timeoutRef = React.useRef(null); // Clean up
React.useEffect(function () {
return function () {
window.clearTimeout(timeoutRef.current);
};
}, []);
function doLock(locked) {
if (locked || lockRef.current === null) {
lockRef.current = locked;
}
window.clearTimeout(timeoutRef.current);
timeoutRef.current = window.setTimeout(function () {
lockRef.current = null;
}, duration);
}
return [function () {
return lockRef.current;
}, doLock];
}

View File

@@ -0,0 +1 @@
export default function useSelectTriggerControl(elements: (HTMLElement | undefined)[], open: boolean, triggerOpen: (open: boolean) => void): void;

View File

@@ -0,0 +1,28 @@
import * as React from 'react';
export default function useSelectTriggerControl(elements, open, triggerOpen) {
var propsRef = React.useRef(null);
propsRef.current = {
elements: elements.filter(function (e) {
return e;
}),
open: open,
triggerOpen: triggerOpen
};
React.useEffect(function () {
function onGlobalMouseDown(event) {
var target = event.target;
if (propsRef.current.open && propsRef.current.elements.every(function (element) {
return !element.contains(target) && element !== target;
})) {
// Should trigger close
propsRef.current.triggerOpen(false);
}
}
window.addEventListener('mousedown', onGlobalMouseDown);
return function () {
return window.removeEventListener('mousedown', onGlobalMouseDown);
};
}, []);
}