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,16 @@
import * as React from 'react';
import { IconDefinition } from '@ant-design/icons-svg/lib/types';
import { IconBaseProps } from './Icon';
import { getTwoToneColor, TwoToneColor, setTwoToneColor } from './twoTonePrimaryColor';
export interface AntdIconProps extends IconBaseProps {
twoToneColor?: TwoToneColor;
}
export interface IconComponentProps extends AntdIconProps {
icon: IconDefinition;
}
interface IconBaseComponent<Props> extends React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLSpanElement>> {
getTwoToneColor: typeof getTwoToneColor;
setTwoToneColor: typeof setTwoToneColor;
}
declare const Icon: IconBaseComponent<IconComponentProps>;
export default Icon;

View File

@@ -0,0 +1,76 @@
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; }
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 _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; }
import * as React from 'react';
import classNames from 'classnames';
import ReactIcon from './IconBase';
import { getTwoToneColor, setTwoToneColor } from './twoTonePrimaryColor';
import { normalizeTwoToneColors } from '../utils'; // Initial setting
// should move it to antd main repo?
setTwoToneColor('#1890ff');
var Icon = React.forwardRef(function (props, ref) {
var className = props.className,
icon = props.icon,
spin = props.spin,
rotate = props.rotate,
tabIndex = props.tabIndex,
onClick = props.onClick,
twoToneColor = props.twoToneColor,
restProps = _objectWithoutProperties(props, ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"]);
var classString = classNames('anticon', _defineProperty({}, "anticon-".concat(icon.name), Boolean(icon.name)), className);
var svgClassString = classNames({
'anticon-spin': !!spin || icon.name === 'loading'
});
var iconTabIndex = tabIndex;
if (iconTabIndex === undefined && onClick) {
iconTabIndex = -1;
}
var svgStyle = rotate ? {
msTransform: "rotate(".concat(rotate, "deg)"),
transform: "rotate(".concat(rotate, "deg)")
} : undefined;
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
primaryColor = _normalizeTwoToneColo2[0],
secondaryColor = _normalizeTwoToneColo2[1];
return React.createElement("span", Object.assign({
role: "img",
"aria-label": icon.name
}, restProps, {
ref: ref,
tabIndex: iconTabIndex,
onClick: onClick,
className: classString
}), React.createElement(ReactIcon, {
className: svgClassString,
icon: icon,
primaryColor: primaryColor,
secondaryColor: secondaryColor,
style: svgStyle
}));
});
Icon.displayName = 'AntdIcon';
Icon.getTwoToneColor = getTwoToneColor;
Icon.setTwoToneColor = setTwoToneColor;
export default Icon;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,78 @@
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 _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; }
import * as React from 'react';
import classNames from 'classnames';
import { svgBaseProps, warning, useInsertStyles } from '../utils';
var Icon = React.forwardRef(function (props, ref) {
var className = props.className,
Component = props.component,
viewBox = props.viewBox,
spin = props.spin,
rotate = props.rotate,
tabIndex = props.tabIndex,
onClick = props.onClick,
children = props.children,
restProps = _objectWithoutProperties(props, ["className", "component", "viewBox", "spin", "rotate", "tabIndex", "onClick", "children"]);
warning(Boolean(Component || children), 'Should have `component` prop or `children`.');
useInsertStyles();
var classString = classNames('anticon', className);
var svgClassString = classNames({
'anticon-spin': !!spin
});
var svgStyle = rotate ? {
msTransform: "rotate(".concat(rotate, "deg)"),
transform: "rotate(".concat(rotate, "deg)")
} : undefined;
var innerSvgProps = _objectSpread({}, svgBaseProps, {
className: svgClassString,
style: svgStyle,
viewBox: viewBox
});
if (!viewBox) {
delete innerSvgProps.viewBox;
} // component > children
var renderInnerNode = function renderInnerNode() {
if (Component) {
return React.createElement(Component, Object.assign({}, innerSvgProps), children);
}
if (children) {
warning(Boolean(viewBox) || React.Children.count(children) === 1 && React.isValidElement(children) && React.Children.only(children).type === 'use', 'Make sure that you provide correct `viewBox`' + ' prop (default `0 0 1024 1024`) to the icon.');
return React.createElement("svg", Object.assign({}, innerSvgProps, {
viewBox: viewBox
}), children);
}
return null;
};
var iconTabIndex = tabIndex;
if (iconTabIndex === undefined && onClick) {
iconTabIndex = -1;
}
return React.createElement("span", Object.assign({
role: "img"
}, restProps, {
ref: ref,
tabIndex: iconTabIndex,
onClick: onClick,
className: classString
}), renderInnerNode());
});
Icon.displayName = 'AntdIcon';
export default Icon;

View File

@@ -0,0 +1,26 @@
import * as React from 'react';
import { IconDefinition } from '@ant-design/icons-svg/lib/types';
export interface IconProps {
icon: IconDefinition;
className?: string;
onClick?: React.MouseEventHandler<SVGSVGElement>;
style?: React.CSSProperties;
primaryColor?: string;
secondaryColor?: string;
focusable?: string;
}
export interface TwoToneColorPaletteSetter {
primaryColor: string;
secondaryColor?: string;
}
export interface TwoToneColorPalette extends TwoToneColorPaletteSetter {
calculated?: boolean;
}
declare function setTwoToneColors({ primaryColor, secondaryColor, }: TwoToneColorPaletteSetter): void;
declare function getTwoToneColors(): TwoToneColorPalette;
interface IconBaseComponent<P> extends React.FC<P> {
getTwoToneColors: typeof getTwoToneColors;
setTwoToneColors: typeof setTwoToneColors;
}
declare const IconBase: IconBaseComponent<IconProps>;
export default IconBase;

View File

@@ -0,0 +1,78 @@
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 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; }
import { generate, getSecondaryColor, isIconDefinition, warning, useInsertStyles } from '../utils';
var twoToneColorPalette = {
primaryColor: '#333',
secondaryColor: '#E6E6E6',
calculated: false
};
function setTwoToneColors(_ref) {
var primaryColor = _ref.primaryColor,
secondaryColor = _ref.secondaryColor;
twoToneColorPalette.primaryColor = primaryColor;
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
twoToneColorPalette.calculated = !!secondaryColor;
}
function getTwoToneColors() {
return _objectSpread({}, twoToneColorPalette);
}
var IconBase = function IconBase(props) {
var icon = props.icon,
className = props.className,
onClick = props.onClick,
style = props.style,
primaryColor = props.primaryColor,
secondaryColor = props.secondaryColor,
restProps = _objectWithoutProperties(props, ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"]);
var colors = twoToneColorPalette;
if (primaryColor) {
colors = {
primaryColor: primaryColor,
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
};
}
useInsertStyles();
warning(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
if (!isIconDefinition(icon)) {
return null;
}
var target = icon;
if (target && typeof target.icon === 'function') {
target = _objectSpread({}, target, {
icon: target.icon(colors.primaryColor, colors.secondaryColor)
});
}
return generate(target.icon, "svg-".concat(target.name), _objectSpread({
className: className,
onClick: onClick,
style: style,
'data-icon': target.name,
width: '1em',
height: '1em',
fill: 'currentColor',
'aria-hidden': 'true'
}, restProps));
};
IconBase.displayName = 'IconReact';
IconBase.getTwoToneColors = getTwoToneColors;
IconBase.setTwoToneColors = setTwoToneColors;
export default IconBase;

View File

@@ -0,0 +1,12 @@
import * as React from 'react';
import { IconBaseProps } from './Icon';
export interface CustomIconOptions {
scriptUrl?: string;
extraCommonProps?: {
[key: string]: any;
};
}
export interface IconFontProps extends IconBaseProps {
type: string;
}
export default function create(options?: CustomIconOptions): React.SFC<IconFontProps>;

View File

@@ -0,0 +1,52 @@
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; }
import * as React from 'react';
import Icon from './Icon';
var customCache = new Set();
export default function create() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var scriptUrl = options.scriptUrl,
_options$extraCommonP = options.extraCommonProps,
extraCommonProps = _options$extraCommonP === void 0 ? {} : _options$extraCommonP;
/**
* DOM API required.
* Make sure in browser environment.
* The Custom Icon will create a <script/>
* that loads SVG symbols and insert the SVG Element into the document body.
*/
if (typeof document !== 'undefined' && typeof window !== 'undefined' && typeof document.createElement === 'function' && typeof scriptUrl === 'string' && scriptUrl.length && !customCache.has(scriptUrl)) {
var script = document.createElement('script');
script.setAttribute('src', scriptUrl);
script.setAttribute('data-namespace', scriptUrl);
customCache.add(scriptUrl);
document.body.appendChild(script);
}
var Iconfont = React.forwardRef(function (props, ref) {
var type = props.type,
children = props.children,
restProps = _objectWithoutProperties(props, ["type", "children"]); // children > type
var content = null;
if (props.type) {
content = React.createElement("use", {
xlinkHref: "#".concat(type)
});
}
if (children) {
content = children;
}
return React.createElement(Icon, Object.assign({}, extraCommonProps, restProps, {
ref: ref
}), content);
});
Iconfont.displayName = 'Iconfont';
return Iconfont;
}

View File

@@ -0,0 +1,3 @@
export declare type TwoToneColor = string | [string, string];
export declare function setTwoToneColor(twoToneColor: TwoToneColor): void;
export declare function getTwoToneColor(): TwoToneColor;

View File

@@ -0,0 +1,34 @@
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 ReactIcon from './IconBase';
import { normalizeTwoToneColors } from '../utils';
export function setTwoToneColor(twoToneColor) {
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
primaryColor = _normalizeTwoToneColo2[0],
secondaryColor = _normalizeTwoToneColo2[1];
return ReactIcon.setTwoToneColors({
primaryColor: primaryColor,
secondaryColor: secondaryColor
});
}
export function getTwoToneColor() {
var colors = ReactIcon.getTwoToneColors();
if (!colors.calculated) {
return colors.primaryColor;
}
return [colors.primaryColor, colors.secondaryColor];
}