semantic-ui-react-misc-components
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -11,9 +11,9 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { Icon, Label, Menu, Table, Message, Segment, Input } from "semantic-ui-react"; | ||
import _ from "lodash"; | ||
import styles from "../css/PaginationTable.css"; | ||
import LazyInput from "./LazyInput"; | ||
import { filterByMultiProperties, uuid } from "./utils"; | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Icon, Label, Menu, Table, Message, Segment, Input } from 'semantic-ui-react'; | ||
import _ from 'lodash'; | ||
import styles from '../css/PaginationTable.css'; | ||
import LazyInput from './LazyInput'; | ||
import { filterByMultiProperties, uuid } from './utils'; | ||
@@ -23,3 +23,3 @@ var SortingIcon = function SortingIcon(_ref) { | ||
asc = _ref$asc === undefined ? false : _ref$asc; | ||
return asc ? React.createElement(Icon, { name: "caret down" }) : React.createElement(Icon, { name: "caret up" }); | ||
return asc ? React.createElement(Icon, { name: 'caret down' }) : React.createElement(Icon, { name: 'caret up' }); | ||
}; | ||
@@ -109,3 +109,3 @@ | ||
}, | ||
searchBarText: "", | ||
searchBarText: '', | ||
accordionViewExpandedUuids: [] | ||
@@ -171,3 +171,3 @@ }; | ||
items = _props.items, | ||
props = _objectWithoutProperties(_props, ["currentPage", "columnOption", "pagination", "searchKeyProperties", "itemsPerPage", "isImmutable", "initSortingFields", "initSortingOrderAsc", "accordionRowRender", "customSearchFilterCreator", "searchBarPlaceholder", "items"]); | ||
props = _objectWithoutProperties(_props, ['currentPage', 'columnOption', 'pagination', 'searchKeyProperties', 'itemsPerPage', 'isImmutable', 'initSortingFields', 'initSortingOrderAsc', 'accordionRowRender', 'customSearchFilterCreator', 'searchBarPlaceholder', 'items']); | ||
@@ -184,5 +184,5 @@ var showingItems = items; | ||
if (currentSortingFields) { | ||
showingItems = _.orderBy(showingItems, currentSortingFields.join("."), [asc ? "asc" : "desc"]); | ||
showingItems = _.orderBy(showingItems, currentSortingFields.join('.'), [asc ? 'asc' : 'desc']); | ||
} | ||
if (typeof searchBarText === "string" && searchBarText.trim().length > 0) { | ||
if (typeof searchBarText === 'string' && searchBarText.trim().length > 0) { | ||
showingItems = this.hasSearchKeys() ? showingItems = filterByMultiProperties(showingItems, searchBarText, searchKeyProperties, !!customSearchFilterCreator && customSearchFilterCreator(searchBarText)) : showingItems; | ||
@@ -196,7 +196,7 @@ } | ||
onChange: this.onSearchBarTextChange, | ||
icon: "search", | ||
iconPosition: "left" | ||
icon: 'search', | ||
iconPosition: 'left' | ||
// label={"Search"} | ||
, fluid: true, | ||
placeholder: searchBarPlaceholder || "Search " + searchKeyProperties.join(", ") + " ...", | ||
placeholder: searchBarPlaceholder || 'Search ' + searchKeyProperties.join(', ') + ' ...', | ||
value: this.state.searchBarText | ||
@@ -210,3 +210,3 @@ }); | ||
Table, | ||
_extends({ unstackable: true, style: { margin: "0.5px 0" } }, props), | ||
_extends({ unstackable: true, style: { margin: '0.5px 0' } }, props), | ||
React.createElement( | ||
@@ -222,3 +222,3 @@ Table.Header, | ||
_extends({ | ||
style: { cursor: c.sortingFields ? "pointer" : "init" }, | ||
style: { cursor: c.sortingFields ? 'pointer' : 'init' }, | ||
onClick: function onClick() { | ||
@@ -237,4 +237,4 @@ if (!isImmutable && c.sortingFields) { | ||
key: i | ||
}, _.get(c, "headerCellProps", {})), | ||
c.header || "", | ||
}, _.get(c, 'headerCellProps', {})), | ||
c.header || '', | ||
!isImmutable && c && c.sortingFields && _.isEqual(c.sortingFields, currentSortingFields) && React.createElement(SortingIcon, { asc: _this2.state.sorting.asc }) | ||
@@ -266,3 +266,3 @@ ); | ||
key: ii, | ||
style: { cursor: c.onItemClick ? "pointer" : "auto" }, | ||
style: { cursor: c.onItemClick ? 'pointer' : 'auto' }, | ||
onClick: function onClick() { | ||
@@ -287,4 +287,4 @@ if (c.onItemClick) { | ||
}, | ||
ii === 0 && accordionRowRender ? accordionViewExpandedUuids.includes(item.uuid) ? React.createElement(Icon, { name: "caret down" }) : React.createElement(Icon, { name: "caret right" }) : null, | ||
typeof c.cellValue === "string" ? isImmutable ? item.get(c.cellValue) : item[c.cellValue] : c.cellValue(item) | ||
ii === 0 && accordionRowRender ? accordionViewExpandedUuids.includes(item.uuid) ? React.createElement(Icon, { name: 'caret down' }) : React.createElement(Icon, { name: 'caret right' }) : null, | ||
typeof c.cellValue === 'string' ? isImmutable ? item.get(c.cellValue) : item[c.cellValue] : c.cellValue(item) | ||
); | ||
@@ -312,7 +312,7 @@ }) | ||
{ warning: true }, | ||
"No result found for query \"" + searchBarText + "\"" | ||
'No result found for query "' + searchBarText + '"' | ||
) : React.createElement( | ||
Message, | ||
null, | ||
"No items to display" | ||
'No items to display' | ||
) | ||
@@ -323,11 +323,11 @@ ) | ||
var PaginationBar = pagination && (showingItems.length > 0 ? React.createElement( | ||
"div", | ||
{ style: { display: "flex" } }, | ||
'div', | ||
{ style: { display: 'flex' } }, | ||
React.createElement( | ||
Menu, | ||
{ pagination: true, style: { margin: "0 auto" } }, | ||
{ pagination: true, style: { margin: '0 auto' } }, | ||
React.createElement( | ||
Menu.Item, | ||
{ | ||
as: "a", | ||
as: 'a', | ||
icon: true, | ||
@@ -337,3 +337,3 @@ onClick: this.prevPage, | ||
}, | ||
React.createElement(Icon, { name: "chevron left" }) | ||
React.createElement(Icon, { name: 'chevron left' }) | ||
), | ||
@@ -344,3 +344,3 @@ this.pageNumArray().map(function (num, i) { | ||
{ | ||
as: "a", | ||
as: 'a', | ||
key: i, | ||
@@ -358,3 +358,3 @@ onClick: function onClick() { | ||
{ | ||
as: "a", | ||
as: 'a', | ||
icon: true, | ||
@@ -364,7 +364,7 @@ onClick: this.nextPage, | ||
}, | ||
React.createElement(Icon, { name: "chevron right" }) | ||
React.createElement(Icon, { name: 'chevron right' }) | ||
) | ||
) | ||
) : null); | ||
return typeof this.props.children === "function" ? this.props.children({ SearchBar: SearchBar, TableEle: TableEle, PaginationBar: PaginationBar }) : React.createElement( | ||
return typeof this.props.children === 'function' ? this.props.children({ SearchBar: SearchBar, TableEle: TableEle, PaginationBar: PaginationBar }) : React.createElement( | ||
React.Fragment, | ||
@@ -384,3 +384,3 @@ null, | ||
header: PropTypes.string, | ||
cellValue: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), | ||
cellValue: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired, | ||
onItemClick: PropTypes.func, | ||
@@ -417,3 +417,3 @@ sortingFields: PropTypes.arrayOf(PropTypes.string), | ||
id: 1, | ||
name: "test-item-1 ???", | ||
name: 'test-item-1 ???', | ||
nestedSortingTestProps: { | ||
@@ -424,3 +424,3 @@ s: 5 | ||
id: 2, | ||
name: "test-item-2", | ||
name: 'test-item-2', | ||
nestedSortingTestProps: { | ||
@@ -431,3 +431,3 @@ s: 3 | ||
id: 3, | ||
name: "test-item-3", | ||
name: 'test-item-3', | ||
nestedSortingTestProps: { | ||
@@ -438,12 +438,12 @@ s: 2 | ||
columnOption: [{ | ||
header: "idHeader", | ||
cellValue: "id", | ||
header: 'idHeader', | ||
cellValue: 'id', | ||
onItemClick: function onItemClick(item) { | ||
console.log("onClick qq " + item.id + " "); | ||
console.log('onClick qq ' + item.id + ' '); | ||
}, | ||
sortingFields: ["id"] | ||
sortingFields: ['id'] | ||
}, { | ||
header: "Name~", | ||
header: 'Name~', | ||
cellValue: function cellValue(item) { | ||
return "*custom text cannot be searched* property can item.name => " + item.name + " "; | ||
return '*custom text cannot be searched* property can item.name => ' + item.name + ' '; | ||
}, | ||
@@ -453,15 +453,15 @@ onItemClick: function onItemClick(item) { | ||
}, | ||
sortingFields: ["name"] | ||
sortingFields: ['name'] | ||
}, { | ||
header: "NestingSortTest~", | ||
header: 'NestingSortTest~', | ||
cellValue: function cellValue(item) { | ||
return item.nestedSortingTestProps.s; | ||
}, | ||
sortingFields: ["nestedSortingTestProps", "s"] | ||
sortingFields: ['nestedSortingTestProps', 's'] | ||
}], | ||
initSortingFields: ["id"], | ||
initSortingFields: ['id'], | ||
initSortingOrderAsc: false, | ||
pagination: true, | ||
itemsPerPage: 5, | ||
searchKeyProperties: ["id", "name"] | ||
searchKeyProperties: ['id', 'name'] | ||
}); | ||
@@ -477,21 +477,21 @@ }; | ||
id: 1, | ||
name: "test-item-1 ???" | ||
name: 'test-item-1 ???' | ||
}, { | ||
id: 2, | ||
name: "test-item-2" | ||
name: 'test-item-2' | ||
}, { | ||
id: 3, | ||
name: "test-item-3" | ||
name: 'test-item-3' | ||
}], | ||
columnOption: [{ | ||
header: "idHeader", | ||
cellValue: "id", | ||
header: 'idHeader', | ||
cellValue: 'id', | ||
onItemClick: function onItemClick(item) { | ||
alert(item.id); | ||
}, | ||
sortingFields: ["id"] | ||
sortingFields: ['id'] | ||
}, { | ||
header: "Name~", | ||
header: 'Name~', | ||
cellValue: function cellValue(item) { | ||
return "*custom text cannot be searched* property can item.name => " + item.name + " "; | ||
return '*custom text cannot be searched* property can item.name => ' + item.name + ' '; | ||
}, | ||
@@ -501,9 +501,9 @@ onItemClick: function onItemClick(item) { | ||
}, | ||
sortingFields: ["name"] | ||
sortingFields: ['name'] | ||
}], | ||
initSortingFields: ["id"], | ||
initSortingFields: ['id'], | ||
initSortingOrderAsc: false, | ||
pagination: true, | ||
itemsPerPage: 2, | ||
searchKeyProperties: ["id", "name"] | ||
searchKeyProperties: ['id', 'name'] | ||
}, | ||
@@ -515,3 +515,3 @@ function (_ref2) { | ||
return React.createElement( | ||
"div", | ||
'div', | ||
null, | ||
@@ -533,36 +533,36 @@ PaginationBar, | ||
id: 1, | ||
name: "item name 1" | ||
name: 'item name 1' | ||
}, { | ||
id: 2, | ||
name: "item name 2" | ||
name: 'item name 2' | ||
}, { | ||
id: 3, | ||
name: "item name 3" | ||
name: 'item name 3' | ||
}], | ||
columnOption: [{ | ||
header: "idHeader", | ||
cellValue: "id", | ||
header: 'idHeader', | ||
cellValue: 'id', | ||
onItemClick: function onItemClick(item) { | ||
console.log("PaginationTableUsage3 onItemClick " + item.id); | ||
console.log('PaginationTableUsage3 onItemClick ' + item.id); | ||
}, | ||
sortingFields: ["id"] | ||
sortingFields: ['id'] | ||
}, { | ||
header: "Name~", | ||
header: 'Name~', | ||
cellValue: function cellValue(item) { | ||
return "*custom text cannot be searched* property can item.name => " + item.name + " "; | ||
return '*custom text cannot be searched* property can item.name => ' + item.name + ' '; | ||
}, | ||
sortingFields: ["name"] | ||
sortingFields: ['name'] | ||
}], | ||
initSortingFields: ["id"], | ||
initSortingFields: ['id'], | ||
initSortingOrderAsc: false, | ||
pagination: true, | ||
itemsPerPage: 2, | ||
searchKeyProperties: ["id", "name"], | ||
searchKeyProperties: ['id', 'name'], | ||
accordionRowRender: function accordionRowRender(item) { | ||
return React.createElement( | ||
"div", | ||
{ style: { border: "red solid 2px " } }, | ||
"item id : ", | ||
'div', | ||
{ style: { border: 'red solid 2px ' } }, | ||
'item id : ', | ||
item.id, | ||
" render anything over here" | ||
' render anything over here' | ||
); | ||
@@ -576,3 +576,3 @@ } | ||
return React.createElement( | ||
"div", | ||
'div', | ||
null, | ||
@@ -590,5 +590,5 @@ PaginationBar, | ||
var indexNameMap = { | ||
1: "nestedIndex ohoh index 1 name", | ||
2: "nestedIndex nono index 2 name", | ||
3: "nestedIndex yaya index 3 name" | ||
1: 'nestedIndex ohoh index 1 name', | ||
2: 'nestedIndex nono index 2 name', | ||
3: 'nestedIndex yaya index 3 name' | ||
}; | ||
@@ -600,3 +600,3 @@ return React.createElement( | ||
id: 1, | ||
name: "item name 1", | ||
name: 'item name 1', | ||
nestedIndexCollections: { | ||
@@ -608,3 +608,3 @@ c1: [1], | ||
id: 2, | ||
name: "item name 2", | ||
name: 'item name 2', | ||
nestedIndexCollections: { | ||
@@ -616,3 +616,3 @@ c1: [2], | ||
id: 3, | ||
name: "item name 3", | ||
name: 'item name 3', | ||
nestedIndexCollections: { | ||
@@ -624,8 +624,8 @@ c1: [1, 3], | ||
columnOption: [{ | ||
header: "idHeader", | ||
cellValue: "id", | ||
header: 'idHeader', | ||
cellValue: 'id', | ||
onItemClick: function onItemClick(item) { | ||
console.log("PaginationTableUsage3 onItemClick " + item.id); | ||
console.log('PaginationTableUsage3 onItemClick ' + item.id); | ||
}, | ||
sortingFields: ["id"], | ||
sortingFields: ['id'], | ||
headerCellProps: { | ||
@@ -635,28 +635,28 @@ width: 5 | ||
}, { | ||
header: "Name~", | ||
header: 'Name~', | ||
cellValue: function cellValue(item) { | ||
return "*custom text cannot be searched* property can item.name => " + item.name + " "; | ||
return '*custom text cannot be searched* property can item.name => ' + item.name + ' '; | ||
}, | ||
sortingFields: ["name"] | ||
sortingFields: ['name'] | ||
}], | ||
initSortingFields: ["id"], | ||
initSortingFields: ['id'], | ||
initSortingOrderAsc: false, | ||
pagination: true, | ||
itemsPerPage: 2, | ||
searchKeyProperties: ["id", "name"], | ||
searchKeyProperties: ['id', 'name'], | ||
accordionRowRender: function accordionRowRender(item) { | ||
return React.createElement( | ||
"div", | ||
{ style: { border: "yellow solid 2px " } }, | ||
'div', | ||
{ style: { border: 'yellow solid 2px ' } }, | ||
React.createElement( | ||
"h3", | ||
'h3', | ||
null, | ||
"item.nestedIndexCollections.c1" | ||
'item.nestedIndexCollections.c1' | ||
), | ||
React.createElement( | ||
"ol", | ||
'ol', | ||
null, | ||
_.get(item, "nestedIndexCollections.c1", []).map(function (i, ii) { | ||
_.get(item, 'nestedIndexCollections.c1', []).map(function (i, ii) { | ||
return React.createElement( | ||
"li", | ||
'li', | ||
{ key: ii }, | ||
@@ -668,12 +668,12 @@ indexNameMap[i] | ||
React.createElement( | ||
"h4", | ||
'h4', | ||
null, | ||
"item.nestedIndexCollections.c2" | ||
'item.nestedIndexCollections.c2' | ||
), | ||
React.createElement( | ||
"ol", | ||
'ol', | ||
null, | ||
_.get(item, "nestedIndexCollections.c2", []).map(function (i, ii) { | ||
_.get(item, 'nestedIndexCollections.c2', []).map(function (i, ii) { | ||
return React.createElement( | ||
"li", | ||
'li', | ||
{ key: ii }, | ||
@@ -688,6 +688,6 @@ indexNameMap[i] | ||
return function (item) { | ||
console.log("customSearchFilterCreator item", item); | ||
console.log('customSearchFilterCreator item', item); | ||
if (keyword) { | ||
return _.get(item, "nestedIndexCollections.c1", []).some(function (index) { | ||
return new RegExp(_.escapeRegExp(keyword), "ig").test(indexNameMap[index]); | ||
return _.get(item, 'nestedIndexCollections.c1', []).some(function (index) { | ||
return new RegExp(_.escapeRegExp(keyword), 'ig').test(indexNameMap[index]); | ||
}); | ||
@@ -698,3 +698,3 @@ } | ||
}, | ||
searchBarPlaceholder: "Search by collection name, id, name....." | ||
searchBarPlaceholder: 'Search by collection name, id, name.....' | ||
}, | ||
@@ -706,3 +706,3 @@ function (_ref4) { | ||
return React.createElement( | ||
"div", | ||
'div', | ||
null, | ||
@@ -709,0 +709,0 @@ PaginationBar, |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -8,25 +8,25 @@ exports.__esModule = true; | ||
var _react = require("react"); | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = require("prop-types"); | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _semanticUiReact = require("semantic-ui-react"); | ||
var _semanticUiReact = require('semantic-ui-react'); | ||
var _lodash = require("lodash"); | ||
var _lodash = require('lodash'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _PaginationTable = require("../css/PaginationTable.css"); | ||
var _PaginationTable = require('../css/PaginationTable.css'); | ||
var _PaginationTable2 = _interopRequireDefault(_PaginationTable); | ||
var _LazyInput = require("./LazyInput"); | ||
var _LazyInput = require('./LazyInput'); | ||
var _LazyInput2 = _interopRequireDefault(_LazyInput); | ||
var _utils = require("./utils"); | ||
var _utils = require('./utils'); | ||
@@ -46,3 +46,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
asc = _ref$asc === undefined ? false : _ref$asc; | ||
return asc ? _react2.default.createElement(_semanticUiReact.Icon, { name: "caret down" }) : _react2.default.createElement(_semanticUiReact.Icon, { name: "caret up" }); | ||
return asc ? _react2.default.createElement(_semanticUiReact.Icon, { name: 'caret down' }) : _react2.default.createElement(_semanticUiReact.Icon, { name: 'caret up' }); | ||
}; | ||
@@ -132,3 +132,3 @@ | ||
}, | ||
searchBarText: "", | ||
searchBarText: '', | ||
accordionViewExpandedUuids: [] | ||
@@ -194,3 +194,3 @@ }; | ||
items = _props.items, | ||
props = _objectWithoutProperties(_props, ["currentPage", "columnOption", "pagination", "searchKeyProperties", "itemsPerPage", "isImmutable", "initSortingFields", "initSortingOrderAsc", "accordionRowRender", "customSearchFilterCreator", "searchBarPlaceholder", "items"]); | ||
props = _objectWithoutProperties(_props, ['currentPage', 'columnOption', 'pagination', 'searchKeyProperties', 'itemsPerPage', 'isImmutable', 'initSortingFields', 'initSortingOrderAsc', 'accordionRowRender', 'customSearchFilterCreator', 'searchBarPlaceholder', 'items']); | ||
@@ -207,5 +207,5 @@ var showingItems = items; | ||
if (currentSortingFields) { | ||
showingItems = _lodash2.default.orderBy(showingItems, currentSortingFields.join("."), [asc ? "asc" : "desc"]); | ||
showingItems = _lodash2.default.orderBy(showingItems, currentSortingFields.join('.'), [asc ? 'asc' : 'desc']); | ||
} | ||
if (typeof searchBarText === "string" && searchBarText.trim().length > 0) { | ||
if (typeof searchBarText === 'string' && searchBarText.trim().length > 0) { | ||
showingItems = this.hasSearchKeys() ? showingItems = (0, _utils.filterByMultiProperties)(showingItems, searchBarText, searchKeyProperties, !!customSearchFilterCreator && customSearchFilterCreator(searchBarText)) : showingItems; | ||
@@ -219,7 +219,7 @@ } | ||
onChange: this.onSearchBarTextChange, | ||
icon: "search", | ||
iconPosition: "left" | ||
icon: 'search', | ||
iconPosition: 'left' | ||
// label={"Search"} | ||
, fluid: true, | ||
placeholder: searchBarPlaceholder || "Search " + searchKeyProperties.join(", ") + " ...", | ||
placeholder: searchBarPlaceholder || 'Search ' + searchKeyProperties.join(', ') + ' ...', | ||
value: this.state.searchBarText | ||
@@ -233,3 +233,3 @@ }); | ||
_semanticUiReact.Table, | ||
_extends({ unstackable: true, style: { margin: "0.5px 0" } }, props), | ||
_extends({ unstackable: true, style: { margin: '0.5px 0' } }, props), | ||
_react2.default.createElement( | ||
@@ -245,3 +245,3 @@ _semanticUiReact.Table.Header, | ||
_extends({ | ||
style: { cursor: c.sortingFields ? "pointer" : "init" }, | ||
style: { cursor: c.sortingFields ? 'pointer' : 'init' }, | ||
onClick: function onClick() { | ||
@@ -260,4 +260,4 @@ if (!isImmutable && c.sortingFields) { | ||
key: i | ||
}, _lodash2.default.get(c, "headerCellProps", {})), | ||
c.header || "", | ||
}, _lodash2.default.get(c, 'headerCellProps', {})), | ||
c.header || '', | ||
!isImmutable && c && c.sortingFields && _lodash2.default.isEqual(c.sortingFields, currentSortingFields) && _react2.default.createElement(SortingIcon, { asc: _this2.state.sorting.asc }) | ||
@@ -289,3 +289,3 @@ ); | ||
key: ii, | ||
style: { cursor: c.onItemClick ? "pointer" : "auto" }, | ||
style: { cursor: c.onItemClick ? 'pointer' : 'auto' }, | ||
onClick: function onClick() { | ||
@@ -310,4 +310,4 @@ if (c.onItemClick) { | ||
}, | ||
ii === 0 && accordionRowRender ? accordionViewExpandedUuids.includes(item.uuid) ? _react2.default.createElement(_semanticUiReact.Icon, { name: "caret down" }) : _react2.default.createElement(_semanticUiReact.Icon, { name: "caret right" }) : null, | ||
typeof c.cellValue === "string" ? isImmutable ? item.get(c.cellValue) : item[c.cellValue] : c.cellValue(item) | ||
ii === 0 && accordionRowRender ? accordionViewExpandedUuids.includes(item.uuid) ? _react2.default.createElement(_semanticUiReact.Icon, { name: 'caret down' }) : _react2.default.createElement(_semanticUiReact.Icon, { name: 'caret right' }) : null, | ||
typeof c.cellValue === 'string' ? isImmutable ? item.get(c.cellValue) : item[c.cellValue] : c.cellValue(item) | ||
); | ||
@@ -335,7 +335,7 @@ }) | ||
{ warning: true }, | ||
"No result found for query \"" + searchBarText + "\"" | ||
'No result found for query "' + searchBarText + '"' | ||
) : _react2.default.createElement( | ||
_semanticUiReact.Message, | ||
null, | ||
"No items to display" | ||
'No items to display' | ||
) | ||
@@ -346,11 +346,11 @@ ) | ||
var PaginationBar = pagination && (showingItems.length > 0 ? _react2.default.createElement( | ||
"div", | ||
{ style: { display: "flex" } }, | ||
'div', | ||
{ style: { display: 'flex' } }, | ||
_react2.default.createElement( | ||
_semanticUiReact.Menu, | ||
{ pagination: true, style: { margin: "0 auto" } }, | ||
{ pagination: true, style: { margin: '0 auto' } }, | ||
_react2.default.createElement( | ||
_semanticUiReact.Menu.Item, | ||
{ | ||
as: "a", | ||
as: 'a', | ||
icon: true, | ||
@@ -360,3 +360,3 @@ onClick: this.prevPage, | ||
}, | ||
_react2.default.createElement(_semanticUiReact.Icon, { name: "chevron left" }) | ||
_react2.default.createElement(_semanticUiReact.Icon, { name: 'chevron left' }) | ||
), | ||
@@ -367,3 +367,3 @@ this.pageNumArray().map(function (num, i) { | ||
{ | ||
as: "a", | ||
as: 'a', | ||
key: i, | ||
@@ -381,3 +381,3 @@ onClick: function onClick() { | ||
{ | ||
as: "a", | ||
as: 'a', | ||
icon: true, | ||
@@ -387,7 +387,7 @@ onClick: this.nextPage, | ||
}, | ||
_react2.default.createElement(_semanticUiReact.Icon, { name: "chevron right" }) | ||
_react2.default.createElement(_semanticUiReact.Icon, { name: 'chevron right' }) | ||
) | ||
) | ||
) : null); | ||
return typeof this.props.children === "function" ? this.props.children({ SearchBar: SearchBar, TableEle: TableEle, PaginationBar: PaginationBar }) : _react2.default.createElement( | ||
return typeof this.props.children === 'function' ? this.props.children({ SearchBar: SearchBar, TableEle: TableEle, PaginationBar: PaginationBar }) : _react2.default.createElement( | ||
_react2.default.Fragment, | ||
@@ -407,3 +407,3 @@ null, | ||
header: _propTypes2.default.string, | ||
cellValue: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]), | ||
cellValue: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]).isRequired, | ||
onItemClick: _propTypes2.default.func, | ||
@@ -441,3 +441,3 @@ sortingFields: _propTypes2.default.arrayOf(_propTypes2.default.string), | ||
id: 1, | ||
name: "test-item-1 ???", | ||
name: 'test-item-1 ???', | ||
nestedSortingTestProps: { | ||
@@ -448,3 +448,3 @@ s: 5 | ||
id: 2, | ||
name: "test-item-2", | ||
name: 'test-item-2', | ||
nestedSortingTestProps: { | ||
@@ -455,3 +455,3 @@ s: 3 | ||
id: 3, | ||
name: "test-item-3", | ||
name: 'test-item-3', | ||
nestedSortingTestProps: { | ||
@@ -462,12 +462,12 @@ s: 2 | ||
columnOption: [{ | ||
header: "idHeader", | ||
cellValue: "id", | ||
header: 'idHeader', | ||
cellValue: 'id', | ||
onItemClick: function onItemClick(item) { | ||
console.log("onClick qq " + item.id + " "); | ||
console.log('onClick qq ' + item.id + ' '); | ||
}, | ||
sortingFields: ["id"] | ||
sortingFields: ['id'] | ||
}, { | ||
header: "Name~", | ||
header: 'Name~', | ||
cellValue: function cellValue(item) { | ||
return "*custom text cannot be searched* property can item.name => " + item.name + " "; | ||
return '*custom text cannot be searched* property can item.name => ' + item.name + ' '; | ||
}, | ||
@@ -477,15 +477,15 @@ onItemClick: function onItemClick(item) { | ||
}, | ||
sortingFields: ["name"] | ||
sortingFields: ['name'] | ||
}, { | ||
header: "NestingSortTest~", | ||
header: 'NestingSortTest~', | ||
cellValue: function cellValue(item) { | ||
return item.nestedSortingTestProps.s; | ||
}, | ||
sortingFields: ["nestedSortingTestProps", "s"] | ||
sortingFields: ['nestedSortingTestProps', 's'] | ||
}], | ||
initSortingFields: ["id"], | ||
initSortingFields: ['id'], | ||
initSortingOrderAsc: false, | ||
pagination: true, | ||
itemsPerPage: 5, | ||
searchKeyProperties: ["id", "name"] | ||
searchKeyProperties: ['id', 'name'] | ||
}); | ||
@@ -501,21 +501,21 @@ }; | ||
id: 1, | ||
name: "test-item-1 ???" | ||
name: 'test-item-1 ???' | ||
}, { | ||
id: 2, | ||
name: "test-item-2" | ||
name: 'test-item-2' | ||
}, { | ||
id: 3, | ||
name: "test-item-3" | ||
name: 'test-item-3' | ||
}], | ||
columnOption: [{ | ||
header: "idHeader", | ||
cellValue: "id", | ||
header: 'idHeader', | ||
cellValue: 'id', | ||
onItemClick: function onItemClick(item) { | ||
alert(item.id); | ||
}, | ||
sortingFields: ["id"] | ||
sortingFields: ['id'] | ||
}, { | ||
header: "Name~", | ||
header: 'Name~', | ||
cellValue: function cellValue(item) { | ||
return "*custom text cannot be searched* property can item.name => " + item.name + " "; | ||
return '*custom text cannot be searched* property can item.name => ' + item.name + ' '; | ||
}, | ||
@@ -525,9 +525,9 @@ onItemClick: function onItemClick(item) { | ||
}, | ||
sortingFields: ["name"] | ||
sortingFields: ['name'] | ||
}], | ||
initSortingFields: ["id"], | ||
initSortingFields: ['id'], | ||
initSortingOrderAsc: false, | ||
pagination: true, | ||
itemsPerPage: 2, | ||
searchKeyProperties: ["id", "name"] | ||
searchKeyProperties: ['id', 'name'] | ||
}, | ||
@@ -539,3 +539,3 @@ function (_ref2) { | ||
return _react2.default.createElement( | ||
"div", | ||
'div', | ||
null, | ||
@@ -557,36 +557,36 @@ PaginationBar, | ||
id: 1, | ||
name: "item name 1" | ||
name: 'item name 1' | ||
}, { | ||
id: 2, | ||
name: "item name 2" | ||
name: 'item name 2' | ||
}, { | ||
id: 3, | ||
name: "item name 3" | ||
name: 'item name 3' | ||
}], | ||
columnOption: [{ | ||
header: "idHeader", | ||
cellValue: "id", | ||
header: 'idHeader', | ||
cellValue: 'id', | ||
onItemClick: function onItemClick(item) { | ||
console.log("PaginationTableUsage3 onItemClick " + item.id); | ||
console.log('PaginationTableUsage3 onItemClick ' + item.id); | ||
}, | ||
sortingFields: ["id"] | ||
sortingFields: ['id'] | ||
}, { | ||
header: "Name~", | ||
header: 'Name~', | ||
cellValue: function cellValue(item) { | ||
return "*custom text cannot be searched* property can item.name => " + item.name + " "; | ||
return '*custom text cannot be searched* property can item.name => ' + item.name + ' '; | ||
}, | ||
sortingFields: ["name"] | ||
sortingFields: ['name'] | ||
}], | ||
initSortingFields: ["id"], | ||
initSortingFields: ['id'], | ||
initSortingOrderAsc: false, | ||
pagination: true, | ||
itemsPerPage: 2, | ||
searchKeyProperties: ["id", "name"], | ||
searchKeyProperties: ['id', 'name'], | ||
accordionRowRender: function accordionRowRender(item) { | ||
return _react2.default.createElement( | ||
"div", | ||
{ style: { border: "red solid 2px " } }, | ||
"item id : ", | ||
'div', | ||
{ style: { border: 'red solid 2px ' } }, | ||
'item id : ', | ||
item.id, | ||
" render anything over here" | ||
' render anything over here' | ||
); | ||
@@ -600,3 +600,3 @@ } | ||
return _react2.default.createElement( | ||
"div", | ||
'div', | ||
null, | ||
@@ -614,5 +614,5 @@ PaginationBar, | ||
var indexNameMap = { | ||
1: "nestedIndex ohoh index 1 name", | ||
2: "nestedIndex nono index 2 name", | ||
3: "nestedIndex yaya index 3 name" | ||
1: 'nestedIndex ohoh index 1 name', | ||
2: 'nestedIndex nono index 2 name', | ||
3: 'nestedIndex yaya index 3 name' | ||
}; | ||
@@ -624,3 +624,3 @@ return _react2.default.createElement( | ||
id: 1, | ||
name: "item name 1", | ||
name: 'item name 1', | ||
nestedIndexCollections: { | ||
@@ -632,3 +632,3 @@ c1: [1], | ||
id: 2, | ||
name: "item name 2", | ||
name: 'item name 2', | ||
nestedIndexCollections: { | ||
@@ -640,3 +640,3 @@ c1: [2], | ||
id: 3, | ||
name: "item name 3", | ||
name: 'item name 3', | ||
nestedIndexCollections: { | ||
@@ -648,8 +648,8 @@ c1: [1, 3], | ||
columnOption: [{ | ||
header: "idHeader", | ||
cellValue: "id", | ||
header: 'idHeader', | ||
cellValue: 'id', | ||
onItemClick: function onItemClick(item) { | ||
console.log("PaginationTableUsage3 onItemClick " + item.id); | ||
console.log('PaginationTableUsage3 onItemClick ' + item.id); | ||
}, | ||
sortingFields: ["id"], | ||
sortingFields: ['id'], | ||
headerCellProps: { | ||
@@ -659,28 +659,28 @@ width: 5 | ||
}, { | ||
header: "Name~", | ||
header: 'Name~', | ||
cellValue: function cellValue(item) { | ||
return "*custom text cannot be searched* property can item.name => " + item.name + " "; | ||
return '*custom text cannot be searched* property can item.name => ' + item.name + ' '; | ||
}, | ||
sortingFields: ["name"] | ||
sortingFields: ['name'] | ||
}], | ||
initSortingFields: ["id"], | ||
initSortingFields: ['id'], | ||
initSortingOrderAsc: false, | ||
pagination: true, | ||
itemsPerPage: 2, | ||
searchKeyProperties: ["id", "name"], | ||
searchKeyProperties: ['id', 'name'], | ||
accordionRowRender: function accordionRowRender(item) { | ||
return _react2.default.createElement( | ||
"div", | ||
{ style: { border: "yellow solid 2px " } }, | ||
'div', | ||
{ style: { border: 'yellow solid 2px ' } }, | ||
_react2.default.createElement( | ||
"h3", | ||
'h3', | ||
null, | ||
"item.nestedIndexCollections.c1" | ||
'item.nestedIndexCollections.c1' | ||
), | ||
_react2.default.createElement( | ||
"ol", | ||
'ol', | ||
null, | ||
_lodash2.default.get(item, "nestedIndexCollections.c1", []).map(function (i, ii) { | ||
_lodash2.default.get(item, 'nestedIndexCollections.c1', []).map(function (i, ii) { | ||
return _react2.default.createElement( | ||
"li", | ||
'li', | ||
{ key: ii }, | ||
@@ -692,12 +692,12 @@ indexNameMap[i] | ||
_react2.default.createElement( | ||
"h4", | ||
'h4', | ||
null, | ||
"item.nestedIndexCollections.c2" | ||
'item.nestedIndexCollections.c2' | ||
), | ||
_react2.default.createElement( | ||
"ol", | ||
'ol', | ||
null, | ||
_lodash2.default.get(item, "nestedIndexCollections.c2", []).map(function (i, ii) { | ||
_lodash2.default.get(item, 'nestedIndexCollections.c2', []).map(function (i, ii) { | ||
return _react2.default.createElement( | ||
"li", | ||
'li', | ||
{ key: ii }, | ||
@@ -712,6 +712,6 @@ indexNameMap[i] | ||
return function (item) { | ||
console.log("customSearchFilterCreator item", item); | ||
console.log('customSearchFilterCreator item', item); | ||
if (keyword) { | ||
return _lodash2.default.get(item, "nestedIndexCollections.c1", []).some(function (index) { | ||
return new RegExp(_lodash2.default.escapeRegExp(keyword), "ig").test(indexNameMap[index]); | ||
return _lodash2.default.get(item, 'nestedIndexCollections.c1', []).some(function (index) { | ||
return new RegExp(_lodash2.default.escapeRegExp(keyword), 'ig').test(indexNameMap[index]); | ||
}); | ||
@@ -722,3 +722,3 @@ } | ||
}, | ||
searchBarPlaceholder: "Search by collection name, id, name....." | ||
searchBarPlaceholder: 'Search by collection name, id, name.....' | ||
}, | ||
@@ -730,3 +730,3 @@ function (_ref4) { | ||
return _react2.default.createElement( | ||
"div", | ||
'div', | ||
null, | ||
@@ -733,0 +733,0 @@ PaginationBar, |
{ | ||
"name": "semantic-ui-react-misc-components", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "semantic-ui-react-misc-components React component", | ||
"main": "lib/index.js", | ||
@@ -42,11 +41,10 @@ "module": "es/index.js", | ||
"homepage": "https://github.com/JaosnHsieh/semantic-ui-react-misc-components", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://github.com/JaosnHsieh/semantic-ui-react-misc-components.git" | ||
}, | ||
"repository": "", | ||
"license": "MIT", | ||
"repository": "", | ||
"keywords": [ | ||
"react-component","semantic-ui-react","pagination","table" | ||
"react-component", | ||
"semantic-ui-react", | ||
"pagination", | ||
"table" | ||
] | ||
} |
@@ -5,2 +5,3 @@ # semantic-ui-react-misc-components | ||
![](demo.gif) | ||
## online demo | ||
@@ -7,0 +8,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67
257417