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

26
web/node_modules/rc-table/es/Body/BodyRow.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import * as React from 'react';
import { StickyOffsets, CustomizeComponent, GetComponentProps, Key, GetRowKey } from '../interface';
export interface BodyRowProps<RecordType> {
record: RecordType;
index: number;
className?: string;
style?: React.CSSProperties;
stickyOffsets: StickyOffsets;
recordKey: Key;
expandedKeys: Set<Key>;
rowComponent: CustomizeComponent;
cellComponent: CustomizeComponent;
onRow: GetComponentProps<RecordType>;
rowExpandable: (record: RecordType) => boolean;
indent?: number;
rowKey: React.Key;
getRowKey: GetRowKey<RecordType>;
childrenColumnName: string;
}
declare function BodyRow<RecordType extends {
children?: RecordType[];
}>(props: BodyRowProps<RecordType>): JSX.Element;
declare namespace BodyRow {
var displayName: string;
}
export default BodyRow;

209
web/node_modules/rc-table/es/Body/BodyRow.js generated vendored Normal file
View File

@@ -0,0 +1,209 @@
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 _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';
import classNames from 'classnames';
import Cell from '../Cell';
import TableContext from '../context/TableContext';
import BodyContext from '../context/BodyContext';
import { getColumnsKey } from '../utils/valueUtil';
import { getCellFixedInfo } from '../utils/fixUtil';
import ExpandedRow from './ExpandedRow';
function BodyRow(props) {
var className = props.className,
style = props.style,
stickyOffsets = props.stickyOffsets,
record = props.record,
index = props.index,
rowKey = props.rowKey,
getRowKey = props.getRowKey,
rowExpandable = props.rowExpandable,
onRow = props.onRow,
_props$indent = props.indent,
indent = _props$indent === void 0 ? 0 : _props$indent,
RowComponent = props.rowComponent,
cellComponent = props.cellComponent,
childrenColumnName = props.childrenColumnName;
var _React$useContext = React.useContext(TableContext),
prefixCls = _React$useContext.prefixCls,
direction = _React$useContext.direction;
var _React$useContext2 = React.useContext(BodyContext),
fixHeader = _React$useContext2.fixHeader,
fixColumn = _React$useContext2.fixColumn,
horizonScroll = _React$useContext2.horizonScroll,
componentWidth = _React$useContext2.componentWidth,
flattenColumns = _React$useContext2.flattenColumns,
expandableType = _React$useContext2.expandableType,
expandRowByClick = _React$useContext2.expandRowByClick,
onTriggerExpand = _React$useContext2.onTriggerExpand,
rowClassName = _React$useContext2.rowClassName,
expandedRowClassName = _React$useContext2.expandedRowClassName,
indentSize = _React$useContext2.indentSize,
expandIcon = _React$useContext2.expandIcon,
expandedRowRender = _React$useContext2.expandedRowRender,
expandIconColumnIndex = _React$useContext2.expandIconColumnIndex;
var _React$useState = React.useState(false),
_React$useState2 = _slicedToArray(_React$useState, 2),
expandRended = _React$useState2[0],
setExpandRended = _React$useState2[1];
var expanded = props.expandedKeys.has(props.recordKey);
React.useEffect(function () {
if (expanded) {
setExpandRended(true);
}
}, [expanded]); // Move to Body to enhance performance
var fixedInfoList = flattenColumns.map(function (column, colIndex) {
return getCellFixedInfo(colIndex, colIndex, flattenColumns, stickyOffsets, direction);
});
var rowSupportExpand = expandableType === 'row' && (!rowExpandable || rowExpandable(record)); // Only when row is not expandable and `children` exist in record
var nestExpandable = expandableType === 'nest';
var hasNestChildren = childrenColumnName in record && record[childrenColumnName];
var mergedExpandable = rowSupportExpand || nestExpandable; // =========================== onRow ===========================
var additionalProps;
if (onRow) {
additionalProps = onRow(record, index);
}
var onClick = function onClick(event) {
if (expandRowByClick && mergedExpandable) {
onTriggerExpand(record, event);
}
if (additionalProps && additionalProps.onClick) {
var _additionalProps;
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
(_additionalProps = additionalProps).onClick.apply(_additionalProps, [event].concat(args));
}
}; // ======================== Base tr row ========================
var computeRowClassName;
if (typeof rowClassName === 'string') {
computeRowClassName = rowClassName;
} else if (typeof rowClassName === 'function') {
computeRowClassName = rowClassName(record, index, indent);
}
var columnsKey = getColumnsKey(flattenColumns);
var baseRowNode = React.createElement(RowComponent, Object.assign({}, additionalProps, {
"data-row-key": rowKey,
className: classNames(className, "".concat(prefixCls, "-row"), "".concat(prefixCls, "-row-level-").concat(indent), computeRowClassName, additionalProps && additionalProps.className),
style: _objectSpread({}, style, {}, additionalProps ? additionalProps.style : null),
onClick: onClick
}), flattenColumns.map(function (column, colIndex) {
var render = column.render,
dataIndex = column.dataIndex,
columnClassName = column.className;
var key = columnsKey[colIndex];
var fixedInfo = fixedInfoList[colIndex]; // ============= Used for nest expandable =============
var appendCellNode;
if (colIndex === (expandIconColumnIndex || 0) && nestExpandable) {
appendCellNode = React.createElement(React.Fragment, null, React.createElement("span", {
style: {
paddingLeft: "".concat(indentSize * indent, "px")
},
className: "".concat(prefixCls, "-row-indent indent-level-").concat(indent)
}), expandIcon({
prefixCls: prefixCls,
expanded: expanded,
expandable: hasNestChildren,
record: record,
onExpand: onTriggerExpand
}));
}
var additionalCellProps;
if (column.onCell) {
additionalCellProps = column.onCell(record, index);
}
return React.createElement(Cell, Object.assign({
className: columnClassName,
ellipsis: column.ellipsis,
align: column.align,
component: cellComponent,
prefixCls: prefixCls,
key: key,
record: record,
index: index,
dataIndex: dataIndex,
render: render
}, fixedInfo, {
appendNode: appendCellNode,
additionalProps: additionalCellProps
}));
})); // ======================== Expand Row =========================
var expandRowNode;
if (rowSupportExpand && (expandRended || expanded)) {
var expandContent = expandedRowRender(record, index, indent + 1, expanded);
var computedExpandedRowClassName = expandedRowClassName && expandedRowClassName(record, index, indent);
expandRowNode = React.createElement(ExpandedRow, {
expanded: expanded,
className: classNames("".concat(prefixCls, "-expanded-row"), "".concat(prefixCls, "-expanded-row-level-").concat(indent + 1), computedExpandedRowClassName),
prefixCls: prefixCls,
fixHeader: fixHeader,
fixColumn: fixColumn,
horizonScroll: horizonScroll,
component: RowComponent,
componentWidth: componentWidth,
cellComponent: cellComponent,
colSpan: flattenColumns.length
}, expandContent);
} // ========================= Nest Row ==========================
var nestRowNode;
if (hasNestChildren && expanded) {
nestRowNode = (record[childrenColumnName] || []).map(function (subRecord, subIndex) {
var subKey = getRowKey(subRecord, subIndex);
return React.createElement(BodyRow, Object.assign({}, props, {
key: subKey,
rowKey: subKey,
record: subRecord,
recordKey: subKey,
index: subIndex,
indent: indent + 1
}));
});
}
return React.createElement(React.Fragment, null, baseRowNode, expandRowNode, nestRowNode);
}
BodyRow.displayName = 'BodyRow';
export default BodyRow;

17
web/node_modules/rc-table/es/Body/ExpandedRow.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import * as React from 'react';
import { CustomizeComponent } from '../interface';
export interface ExpandedRowProps<RecordType> {
prefixCls: string;
component: CustomizeComponent;
cellComponent: CustomizeComponent;
fixHeader: boolean;
fixColumn: boolean;
horizonScroll: boolean;
componentWidth: number;
className: string;
expanded: boolean;
children: React.ReactNode;
colSpan: number;
}
declare function ExpandedRow<RecordType>({ prefixCls, children, component: Component, cellComponent, fixHeader, fixColumn, horizonScroll, className, expanded, componentWidth, colSpan, }: ExpandedRowProps<RecordType>): JSX.Element;
export default ExpandedRow;

50
web/node_modules/rc-table/es/Body/ExpandedRow.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import * as React from 'react';
import Cell from '../Cell';
import TableContext from '../context/TableContext';
function ExpandedRow(_ref) {
var prefixCls = _ref.prefixCls,
children = _ref.children,
Component = _ref.component,
cellComponent = _ref.cellComponent,
fixHeader = _ref.fixHeader,
fixColumn = _ref.fixColumn,
horizonScroll = _ref.horizonScroll,
className = _ref.className,
expanded = _ref.expanded,
componentWidth = _ref.componentWidth,
colSpan = _ref.colSpan;
var _React$useContext = React.useContext(TableContext),
scrollbarSize = _React$useContext.scrollbarSize; // Cache render node
return React.useMemo(function () {
var contentNode = children;
if (fixColumn) {
contentNode = React.createElement("div", {
style: {
width: componentWidth - (fixHeader ? scrollbarSize : 0),
position: 'sticky',
left: 0,
overflow: 'hidden'
},
className: "".concat(prefixCls, "-expanded-row-fixed")
}, contentNode);
}
return React.createElement(Component, {
className: className,
style: {
display: expanded ? null : 'none'
}
}, React.createElement(Cell, {
component: cellComponent,
prefixCls: prefixCls,
colSpan: colSpan
}, contentNode));
}, [children, Component, fixHeader, horizonScroll, className, expanded, componentWidth, colSpan, scrollbarSize]);
}
export default ExpandedRow;

16
web/node_modules/rc-table/es/Body/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import * as React from 'react';
import { GetRowKey, StickyOffsets, Key, GetComponentProps } from '../interface';
export interface BodyProps<RecordType> {
data: RecordType[];
getRowKey: GetRowKey<RecordType>;
measureColumnWidth: boolean;
stickyOffsets: StickyOffsets;
expandedKeys: Set<Key>;
onRow: GetComponentProps<RecordType>;
rowExpandable: (record: RecordType) => boolean;
emptyNode: React.ReactNode;
childrenColumnName: string;
}
declare function Body<RecordType>({ data, getRowKey, measureColumnWidth, stickyOffsets, expandedKeys, onRow, rowExpandable, emptyNode, childrenColumnName, }: BodyProps<RecordType>): JSX.Element;
declare const MemoBody: React.MemoExoticComponent<typeof Body>;
export default MemoBody;

103
web/node_modules/rc-table/es/Body/index.js generated vendored Normal file
View File

@@ -0,0 +1,103 @@
import * as React from 'react';
import ResizeObserver from 'rc-resize-observer';
import BodyRow from './BodyRow';
import TableContext from '../context/TableContext';
import ExpandedRow from './ExpandedRow';
import BodyContext from '../context/BodyContext';
import { getColumnsKey } from '../utils/valueUtil';
import ResizeContext from '../context/ResizeContext';
function Body(_ref) {
var data = _ref.data,
getRowKey = _ref.getRowKey,
measureColumnWidth = _ref.measureColumnWidth,
stickyOffsets = _ref.stickyOffsets,
expandedKeys = _ref.expandedKeys,
onRow = _ref.onRow,
rowExpandable = _ref.rowExpandable,
emptyNode = _ref.emptyNode,
childrenColumnName = _ref.childrenColumnName;
var _React$useContext = React.useContext(ResizeContext),
onColumnResize = _React$useContext.onColumnResize;
var _React$useContext2 = React.useContext(TableContext),
prefixCls = _React$useContext2.prefixCls,
getComponent = _React$useContext2.getComponent;
var _React$useContext3 = React.useContext(BodyContext),
fixHeader = _React$useContext3.fixHeader,
horizonScroll = _React$useContext3.horizonScroll,
flattenColumns = _React$useContext3.flattenColumns,
componentWidth = _React$useContext3.componentWidth;
return React.useMemo(function () {
var WrapperComponent = getComponent(['body', 'wrapper'], 'tbody');
var trComponent = getComponent(['body', 'row'], 'tr');
var tdComponent = getComponent(['body', 'cell'], 'td');
var rows;
if (data.length) {
rows = data.map(function (record, index) {
var key = getRowKey(record, index);
return [React.createElement(BodyRow, {
key: key,
rowKey: key,
record: record,
recordKey: key,
index: index,
rowComponent: trComponent,
cellComponent: tdComponent,
stickyOffsets: stickyOffsets,
expandedKeys: expandedKeys,
onRow: onRow,
getRowKey: getRowKey,
rowExpandable: rowExpandable,
childrenColumnName: childrenColumnName
})];
});
} else {
rows = React.createElement(ExpandedRow, {
expanded: true,
className: "".concat(prefixCls, "-placeholder"),
prefixCls: prefixCls,
fixHeader: fixHeader,
fixColumn: horizonScroll,
horizonScroll: horizonScroll,
component: trComponent,
componentWidth: componentWidth,
cellComponent: tdComponent,
colSpan: flattenColumns.length
}, emptyNode);
}
var columnsKey = getColumnsKey(flattenColumns);
return React.createElement(WrapperComponent, {
className: "".concat(prefixCls, "-tbody")
}, measureColumnWidth && React.createElement("tr", {
"aria-hidden": "true",
className: "".concat(prefixCls, "-measure-row"),
style: {
height: 0
}
}, columnsKey.map(function (columnKey) {
return React.createElement(ResizeObserver, {
key: columnKey,
onResize: function onResize(_ref2) {
var offsetWidth = _ref2.offsetWidth;
onColumnResize(columnKey, offsetWidth);
}
}, React.createElement("td", {
style: {
padding: 0,
border: 0,
height: 0
}
}));
})), rows);
}, [data, prefixCls, onRow, measureColumnWidth, stickyOffsets, expandedKeys, getRowKey, getComponent, componentWidth, emptyNode]);
}
var MemoBody = React.memo(Body);
MemoBody.displayName = 'Body';
export default MemoBody;