mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-05-17 13:56:38 +02:00
Continued date
This commit is contained in:
parent
d656ec90b0
commit
a0707554bb
8
dist/tablefilter/tablefilter.js
vendored
8
dist/tablefilter/tablefilter.js
vendored
|
@ -161,8 +161,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
var _const = __webpack_require__(7);
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
// import {formatDate, isValidDate} from './date';
|
||||
|
||||
|
||||
var doc = _root.root.document;
|
||||
|
||||
|
@ -1991,10 +1989,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
sA = (0, _string.matchCase)(sA, this.caseSensitive);
|
||||
|
||||
var occurence = false;
|
||||
// let dtType = this.hasColDateType ?
|
||||
// this.colDateType[colIdx] : this.defaultDateType;
|
||||
// let dtType = this.hasType(colIdx, [DATE]) ?
|
||||
// this.colTypes[colIdx] : this.defaultDateType;
|
||||
|
||||
//Search arg operator tests
|
||||
var hasLO = re_l.test(sA),
|
||||
|
@ -10236,7 +10230,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
var _this = this;
|
||||
|
||||
var types = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
|
||||
|
||||
console.log(types);
|
||||
types.forEach(function (type, idx) {
|
||||
var options = _this.getOptions(idx, types);
|
||||
if (options.hasOwnProperty('format')) {
|
||||
|
|
56
dist/tablefilter/tf-1.js
vendored
56
dist/tablefilter/tf-1.js
vendored
|
@ -2425,8 +2425,6 @@ webpackJsonp([1],{
|
|||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
// import {formatDate} from '../../date';
|
||||
|
||||
|
||||
/**
|
||||
* SortableTable Adapter module
|
||||
|
@ -2807,8 +2805,16 @@ webpackJsonp([1],{
|
|||
|
||||
|
||||
AdapterSortableTable.prototype.addSortType = function addSortType() {
|
||||
var args = arguments;
|
||||
SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]);
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
// Extract the arguments
|
||||
var id = args[0];
|
||||
var caster = args[1];
|
||||
var sorter = args[2];
|
||||
|
||||
SortableTable.prototype.addSortType(id, caster, sorter);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -2822,23 +2828,17 @@ webpackJsonp([1],{
|
|||
|
||||
var tf = this.tf,
|
||||
sortTypes = this.sortTypes,
|
||||
_sortTypes = [];
|
||||
_sortTypes = [],
|
||||
dateType = tf.feature('dateType');
|
||||
dateType.addConfigFormats(sortTypes);
|
||||
|
||||
for (var i = 0; i < tf.getCellsNb(); i++) {
|
||||
var colType = void 0;
|
||||
|
||||
if (sortTypes[i]) {
|
||||
colType = sortTypes[i];
|
||||
if (isObj(colType)) {
|
||||
// colType = colType.type;
|
||||
if ((0, _types.isObj)(colType)) {
|
||||
if (colType.type === _const.DATE) {
|
||||
// let dateType = tf.feature('dateType');
|
||||
// let locale=dateType.getOptions(i,sortTypes).locale ||
|
||||
// tf.locale;
|
||||
// colType = `${DATE}-${locale}`;
|
||||
// this.addSortType(colType, (dateStr) => {
|
||||
// return dateType.parse(dateStr, locale);
|
||||
// });
|
||||
colType = this._addDateType(i, sortTypes);
|
||||
}
|
||||
}
|
||||
|
@ -2850,15 +2850,7 @@ webpackJsonp([1],{
|
|||
// resolve column types
|
||||
if (tf.hasType(i, [_const.NUMBER, _const.FORMATTED_NUMBER, _const.FORMATTED_NUMBER_EU, _const.IP_ADDRESS])) {
|
||||
colType = tf.colTypes[i].toLowerCase();
|
||||
// } else if (tf.hasColDateType && tf.colDateType[i] !== null) {
|
||||
// colType = tf.colDateType[i].toLowerCase() + 'date';
|
||||
} else if (tf.hasType(i, [_const.DATE])) {
|
||||
// let dateType = tf.feature('dateType');
|
||||
// let locale = dateType.getOptions(i).locale || tf.locale;
|
||||
// colType = `${DATE}-${locale}`;
|
||||
// this.addSortType(colType, (dateStr) => {
|
||||
// return dateType.parse(dateStr, locale);
|
||||
// });
|
||||
colType = this._addDateType(i);
|
||||
} else {
|
||||
colType = _const.STRING;
|
||||
|
@ -2872,14 +2864,9 @@ webpackJsonp([1],{
|
|||
//Custom sort types
|
||||
this.addSortType(_const.NUMBER, Number);
|
||||
this.addSortType('caseinsensitivestring', SortableTable.toUpperCase);
|
||||
// this.addSortType(DATE, SortableTable.toDate);
|
||||
this.addSortType(_const.STRING);
|
||||
this.addSortType(_const.FORMATTED_NUMBER, usNumberConverter);
|
||||
this.addSortType(_const.FORMATTED_NUMBER_EU, euNumberConverter);
|
||||
// this.addSortType('dmydate', dmyDateConverter);
|
||||
// this.addSortType('ymddate', ymdDateConverter);
|
||||
// this.addSortType('mdydate', mdyDateConverter);
|
||||
// this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter);
|
||||
this.addSortType(_const.IP_ADDRESS, ipAddress, sortIP);
|
||||
|
||||
this.stt = new SortableTable(tf.tbl, _sortTypes);
|
||||
|
@ -2966,21 +2953,6 @@ webpackJsonp([1],{
|
|||
function euNumberConverter(s) {
|
||||
return (0, _number.unformat)(s, _const.FORMATTED_NUMBER_EU);
|
||||
}
|
||||
// function dateConverter(s, format) {
|
||||
// return formatDate(s, format);
|
||||
// }
|
||||
// function dmyDateConverter(s) {
|
||||
// return dateConverter(s, 'DMY');
|
||||
// }
|
||||
// function mdyDateConverter(s) {
|
||||
// return dateConverter(s, 'MDY');
|
||||
// }
|
||||
// function ymdDateConverter(s) {
|
||||
// return dateConverter(s, 'YMD');
|
||||
// }
|
||||
// function ddmmmyyyyDateConverter(s) {
|
||||
// return dateConverter(s, 'DDMMMYYYY');
|
||||
// }
|
||||
|
||||
function ipAddress(value) {
|
||||
var vals = value.split('.');
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import {Feature} from '../../feature';
|
||||
import {isArray, isFn, isUndef} from '../../types';
|
||||
import {isArray, isFn, isUndef, isObj} from '../../types';
|
||||
import {createElm, elm, getText, tag} from '../../dom';
|
||||
import {addEvt} from '../../event';
|
||||
// import {formatDate} from '../../date';
|
||||
import {unformat as unformatNb} from '../../number';
|
||||
import {
|
||||
NONE, CELL_TAG, HEADER_TAG, STRING, NUMBER, DATE, FORMATTED_NUMBER,
|
||||
|
@ -381,9 +380,10 @@ export default class AdapterSortableTable extends Feature {
|
|||
/**
|
||||
* Adds a sort type
|
||||
*/
|
||||
addSortType() {
|
||||
var args = arguments;
|
||||
SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]);
|
||||
addSortType(...args) {
|
||||
// Extract the arguments
|
||||
let [id, caster, sorter] = args;
|
||||
SortableTable.prototype.addSortType(id, caster, sorter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -393,7 +393,9 @@ export default class AdapterSortableTable extends Feature {
|
|||
setSortTypes() {
|
||||
let tf = this.tf,
|
||||
sortTypes = this.sortTypes,
|
||||
_sortTypes = [];
|
||||
_sortTypes = [],
|
||||
dateType = tf.feature('dateType');
|
||||
dateType.addConfigFormats(sortTypes);
|
||||
|
||||
for (let i = 0; i < tf.getCellsNb(); i++) {
|
||||
let colType;
|
||||
|
@ -401,15 +403,7 @@ export default class AdapterSortableTable extends Feature {
|
|||
if (sortTypes[i]) {
|
||||
colType = sortTypes[i];
|
||||
if (isObj(colType)) {
|
||||
// colType = colType.type;
|
||||
if (colType.type === DATE) {
|
||||
// let dateType = tf.feature('dateType');
|
||||
// let locale=dateType.getOptions(i,sortTypes).locale ||
|
||||
// tf.locale;
|
||||
// colType = `${DATE}-${locale}`;
|
||||
// this.addSortType(colType, (dateStr) => {
|
||||
// return dateType.parse(dateStr, locale);
|
||||
// });
|
||||
colType = this._addDateType(i, sortTypes);
|
||||
}
|
||||
}
|
||||
|
@ -421,15 +415,7 @@ export default class AdapterSortableTable extends Feature {
|
|||
if (tf.hasType(i, [NUMBER, FORMATTED_NUMBER,
|
||||
FORMATTED_NUMBER_EU, IP_ADDRESS])) {
|
||||
colType = tf.colTypes[i].toLowerCase();
|
||||
// } else if (tf.hasColDateType && tf.colDateType[i] !== null) {
|
||||
// colType = tf.colDateType[i].toLowerCase() + 'date';
|
||||
} else if (tf.hasType(i, [DATE])) {
|
||||
// let dateType = tf.feature('dateType');
|
||||
// let locale = dateType.getOptions(i).locale || tf.locale;
|
||||
// colType = `${DATE}-${locale}`;
|
||||
// this.addSortType(colType, (dateStr) => {
|
||||
// return dateType.parse(dateStr, locale);
|
||||
// });
|
||||
colType = this._addDateType(i);
|
||||
} else {
|
||||
colType = STRING;
|
||||
|
@ -443,14 +429,9 @@ export default class AdapterSortableTable extends Feature {
|
|||
//Custom sort types
|
||||
this.addSortType(NUMBER, Number);
|
||||
this.addSortType('caseinsensitivestring', SortableTable.toUpperCase);
|
||||
// this.addSortType(DATE, SortableTable.toDate);
|
||||
this.addSortType(STRING);
|
||||
this.addSortType(FORMATTED_NUMBER, usNumberConverter);
|
||||
this.addSortType(FORMATTED_NUMBER_EU, euNumberConverter);
|
||||
// this.addSortType('dmydate', dmyDateConverter);
|
||||
// this.addSortType('ymddate', ymdDateConverter);
|
||||
// this.addSortType('mdydate', mdyDateConverter);
|
||||
// this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter);
|
||||
this.addSortType(IP_ADDRESS, ipAddress, sortIP);
|
||||
|
||||
this.stt = new SortableTable(tf.tbl, _sortTypes);
|
||||
|
@ -526,21 +507,6 @@ function usNumberConverter(s) {
|
|||
function euNumberConverter(s) {
|
||||
return unformatNb(s, FORMATTED_NUMBER_EU);
|
||||
}
|
||||
// function dateConverter(s, format) {
|
||||
// return formatDate(s, format);
|
||||
// }
|
||||
// function dmyDateConverter(s) {
|
||||
// return dateConverter(s, 'DMY');
|
||||
// }
|
||||
// function mdyDateConverter(s) {
|
||||
// return dateConverter(s, 'MDY');
|
||||
// }
|
||||
// function ymdDateConverter(s) {
|
||||
// return dateConverter(s, 'YMD');
|
||||
// }
|
||||
// function ddmmmyyyyDateConverter(s) {
|
||||
// return dateConverter(s, 'DDMMMYYYY');
|
||||
// }
|
||||
|
||||
function ipAddress(value) {
|
||||
let vals = value.split('.');
|
||||
|
|
|
@ -51,7 +51,7 @@ export class DateType {
|
|||
return isObj(colType) ? colType : {};
|
||||
}
|
||||
|
||||
addConfigFormats(types=[]) {
|
||||
addConfigFormats(types=[]) {console.log(types);
|
||||
types.forEach((type, idx) => {
|
||||
let options = this.getOptions(idx, types);
|
||||
if (options.hasOwnProperty('format')) {
|
||||
|
|
|
@ -8,7 +8,6 @@ import {isEmpty as isEmptyString} from './string';
|
|||
import {
|
||||
isArray, isEmpty, isFn, isNumber, isObj, isString, isUndef
|
||||
} from './types';
|
||||
// import {formatDate, isValidDate} from './date';
|
||||
import {unformat as unformatNb} from './number'
|
||||
|
||||
import {root} from './root';
|
||||
|
@ -1794,10 +1793,6 @@ export class TableFilter {
|
|||
sA = matchCase(sA, this.caseSensitive);
|
||||
|
||||
let occurence = false;
|
||||
// let dtType = this.hasColDateType ?
|
||||
// this.colDateType[colIdx] : this.defaultDateType;
|
||||
// let dtType = this.hasType(colIdx, [DATE]) ?
|
||||
// this.colTypes[colIdx] : this.defaultDateType;
|
||||
|
||||
//Search arg operator tests
|
||||
let hasLO = re_l.test(sA),
|
||||
|
|
|
@ -52,7 +52,7 @@ var tfConfig = {
|
|||
name: 'sort',
|
||||
types: [
|
||||
'number', 'string', 'string',
|
||||
'US', 'none', 'string'
|
||||
'formatted-number', 'none', 'string'
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -76,13 +76,15 @@ var tfConfig = {
|
|||
status_bar: true,
|
||||
col_types: [
|
||||
'string', 'string', 'string',
|
||||
'formatted-number-eu', 'formatted-number', 'string',
|
||||
{
|
||||
type: 'date', locale: 'fr'/*,
|
||||
format: ['{dd}/{MM}/{yyyy}', '{dd}-{MM}-{yyyy|yy}']*/
|
||||
type: 'number', decimal: ',', thousands: '.'
|
||||
}, 'formatted-number', 'string',
|
||||
{
|
||||
type: 'date', locale: 'en',
|
||||
format: ['{dd}/{MM}/{yyyy}', '{dd}-{MM}-{yyyy|yy}']
|
||||
},
|
||||
{ type: 'date', locale: 'en'/*, format: '{dd}-{MM}-{yyyy|yy}'*/ },
|
||||
'date',
|
||||
{ type: 'date', locale: 'en', format: '{dd}-{MM}-{yyyy|yy}' },
|
||||
{ type: 'date', locale: 'en', format: '{dd}-{months}-{yyyy|yy}' },
|
||||
'ipaddress'
|
||||
],
|
||||
rows_always_visible: [totRowIndex],
|
||||
|
@ -93,9 +95,8 @@ var tfConfig = {
|
|||
o.filter();
|
||||
},
|
||||
extensions:[
|
||||
{ name: 'sort' },
|
||||
{
|
||||
name: 'sort'
|
||||
},{
|
||||
name: 'colOps',
|
||||
id: ['sum1', 'sum2'],
|
||||
col: [3, 4],
|
||||
|
|
Loading…
Reference in a new issue