New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

morse-react-tables

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

morse-react-tables - npm Package Compare versions

Comparing version 0.4.5 to 0.4.6

38

dist/components/ExpandableDatasetTable.d.ts

@@ -16,3 +16,39 @@ import React, { ComponentProps } from "react";

};
export declare const ExpandableDatasetTable: React.ForwardRefExoticComponent<Pick<ExpandableDatasetTableProps<unknown>, "hidden" | "dir" | "slot" | "style" | "summary" | "title" | "color" | "grid" | "translate" | "width" | "prefix" | "children" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "dataset" | "rowRender" | "cellPadding" | "cellSpacing" | "lined" | "ruled" | "framed" | "barred" | "striped" | "chequered" | "paddedCells" | "expandedRowContent"> & React.RefAttributes<any>>;
declare type ExpandableDatasetTableState<T> = {
expandedItem?: T;
};
/**
*
* So - you're probably wondering why this is a class based component . . .
*
* We had a need to be able to pass a `ref` into this component so the parent component could have
* access to the toggleOrSetExpanded function to control the table.
*
* We first tried this with the existing functional component using React.forwardRef, however,
* this method broke the type inference of `T`, hence props like `expandedRowContent` were inferring
* `T` as `unknown`. Converting this to a class based component allows the parent to make use of the
* ref as such
*
* const tableRef = useRef<any>();
*
* ...
*
* <ExpandableDatasetTable
* ref={(el: any) => tableRef.current = el}
* dataset={[user]}
* expandedRowContent={(item: User) => <UserRow item={item} />
* />
*
* ...
*
* tableRef.current.toggleOrSetExpanded(expandedItem)
* OR
* tableRef.current.toggleOrSetExpanded(undefined)
*
*/
export declare class ExpandableDatasetTable<T> extends React.Component<ExpandableDatasetTableProps<T>, ExpandableDatasetTableState<T>> {
componentDidMount(): void;
toggleOrSetExpanded(item: T): void;
render(): JSX.Element;
}
export {};

104

dist/components/ExpandableDatasetTable.js
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {

@@ -13,21 +26,2 @@ __assign = Object.assign || function(t) {

};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __rest = (this && this.__rest) || function (s, e) {

@@ -44,5 +38,8 @@ var t = {};

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExpandableDatasetTable = exports.ExpandableRow = void 0;
var react_1 = __importStar(require("react"));
var react_1 = __importDefault(require("react"));
var morse_react_1 = require("morse-react");

@@ -60,20 +57,59 @@ var DatasetTable_1 = require("./DatasetTable");

};
exports.ExpandableDatasetTable = react_1.default.forwardRef(function (props, ref) {
var expandedRowContent = props.expandedRowContent, datasetTableProps = __rest(props, ["expandedRowContent"]);
var _a = react_1.useState(undefined), expandedItem = _a[0], setExpandedItem = _a[1];
var toggleOrSetExpanded = function (item) {
if (expandedItem === item) {
setExpandedItem(undefined);
/**
*
* So - you're probably wondering why this is a class based component . . .
*
* We had a need to be able to pass a `ref` into this component so the parent component could have
* access to the toggleOrSetExpanded function to control the table.
*
* We first tried this with the existing functional component using React.forwardRef, however,
* this method broke the type inference of `T`, hence props like `expandedRowContent` were inferring
* `T` as `unknown`. Converting this to a class based component allows the parent to make use of the
* ref as such
*
* const tableRef = useRef<any>();
*
* ...
*
* <ExpandableDatasetTable
* ref={(el: any) => tableRef.current = el}
* dataset={[user]}
* expandedRowContent={(item: User) => <UserRow item={item} />
* />
*
* ...
*
* tableRef.current.toggleOrSetExpanded(expandedItem)
* OR
* tableRef.current.toggleOrSetExpanded(undefined)
*
*/
var ExpandableDatasetTable = /** @class */ (function (_super) {
__extends(ExpandableDatasetTable, _super);
function ExpandableDatasetTable() {
return _super !== null && _super.apply(this, arguments) || this;
}
ExpandableDatasetTable.prototype.componentDidMount = function () {
this.setState({});
};
ExpandableDatasetTable.prototype.toggleOrSetExpanded = function (item) {
if (this.state && this.state.expandedItem === item) {
this.setState({ expandedItem: undefined });
}
else {
setExpandedItem(item);
this.setState({ expandedItem: item });
}
};
react_1.useImperativeHandle(ref, function () { return ({
toggleOrSetExpanded: toggleOrSetExpanded,
}); });
return (react_1.default.createElement(DatasetTable_1.DatasetTable, __assign({}, datasetTableProps, { rowRender: function (item, rowElements, index) {
return (react_1.default.createElement(exports.ExpandableRow, { key: "expanded-table-row-" + index, expandedRowContent: props.expandedRowContent(item), toggleExpanded: function () { return toggleOrSetExpanded(item); }, expanded: item === expandedItem }, rowElements));
} })));
});
;
ExpandableDatasetTable.prototype.render = function () {
var _this = this;
var _a = this.props, expandedRowContent = _a.expandedRowContent, ref = _a.ref, datasetTableProps = __rest(_a, ["expandedRowContent", "ref"]);
return (react_1.default.createElement(DatasetTable_1.DatasetTable, __assign({}, datasetTableProps, { rowRender: function (item, rowElements, index) {
return (react_1.default.createElement(exports.ExpandableRow, { key: "expanded-table-row-" + index, expandedRowContent: _this.props.expandedRowContent(item), toggleExpanded: function () { return _this.toggleOrSetExpanded(item); }, expanded: _this.state && item === _this.state.expandedItem }, rowElements));
} })));
};
;
return ExpandableDatasetTable;
}(react_1.default.Component));
exports.ExpandableDatasetTable = ExpandableDatasetTable;
//# sourceMappingURL=ExpandableDatasetTable.js.map
{
"name": "morse-react-tables",
"version": "0.4.5",
"version": "0.4.6",
"description": "Patterns for building tables",

@@ -38,3 +38,3 @@ "repository": {

],
"gitHead": "bea7011f7fd575e0ab8041f1f6dccadbccc5f054"
"gitHead": "6be06c4f635fd7c3affe5c610bf7c4740b24c477"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc