datatables.net-searchbuilder-se 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/searchBuilder.semanticui.js +75 -60
- package/js/searchBuilder.semanticui.min.js +4 -7
- package/js/searchBuilder.semanticui.min.mjs +4 -0
- package/js/searchBuilder.semanticui.mjs +40 -0
- package/package.json +6 -4
- package/types/searchBuilder.semanticui.d.ts +4 -0
- package/types/types.d.ts +99 -0
|
@@ -1,64 +1,79 @@
|
|
|
1
1
|
/*! semantic ui integration for DataTables' SearchBuilder
|
|
2
|
-
* ©
|
|
2
|
+
* © SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
4
|
+
|
|
5
|
+
(function( factory ){
|
|
6
|
+
if ( typeof define === 'function' && define.amd ) {
|
|
7
|
+
// AMD
|
|
8
|
+
define( ['jquery', 'datatables.net-se', 'datatables.net-searchbuilder'], function ( $ ) {
|
|
9
|
+
return factory( $, window, document );
|
|
10
|
+
} );
|
|
11
|
+
}
|
|
12
|
+
else if ( typeof exports === 'object' ) {
|
|
13
|
+
// CommonJS
|
|
14
|
+
module.exports = function (root, $) {
|
|
15
|
+
if ( ! root ) {
|
|
16
|
+
// CommonJS environments without a window global must pass a
|
|
17
|
+
// root. This will give an error otherwise
|
|
18
|
+
root = window;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if ( ! $ ) {
|
|
22
|
+
$ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window
|
|
23
|
+
require('jquery') :
|
|
24
|
+
require('jquery')( root );
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if ( ! $.fn.dataTable ) {
|
|
28
|
+
require('datatables.net-se')(root, $);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if ( ! $.fn.dataTable ) {
|
|
32
|
+
require('datatables.net-searchbuilder')(root, $);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
return factory( $, root, root.document );
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// Browser
|
|
41
|
+
factory( jQuery, window, document );
|
|
42
|
+
}
|
|
43
|
+
}(function( $, window, document, undefined ) {
|
|
44
|
+
'use strict';
|
|
45
|
+
var DataTable = $.fn.dataTable;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
$.extend(true, DataTable.SearchBuilder.classes, {
|
|
49
|
+
clearAll: 'basic ui button dtsb-clearAll'
|
|
50
|
+
});
|
|
51
|
+
$.extend(true, DataTable.Group.classes, {
|
|
52
|
+
add: 'basic ui button dtsb-add',
|
|
53
|
+
clearGroup: 'basic ui button dtsb-clearGroup',
|
|
54
|
+
logic: 'basic ui button dtsb-logic'
|
|
55
|
+
});
|
|
56
|
+
$.extend(true, DataTable.Criteria.classes, {
|
|
57
|
+
condition: 'ui selection dropdown dtsb-condition',
|
|
58
|
+
data: 'ui selection dropdown dtsb-data',
|
|
59
|
+
"delete": 'basic ui button dtsb-delete',
|
|
60
|
+
left: 'basic ui button dtsb-left',
|
|
61
|
+
right: 'basic ui button dtsb-right',
|
|
62
|
+
value: 'basic ui selection dropdown dtsb-value'
|
|
63
|
+
});
|
|
64
|
+
DataTable.ext.buttons.searchBuilder.action = function (e, dt, node, config) {
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
this.popover(config._searchBuilder.getNode(), {
|
|
67
|
+
align: 'container',
|
|
68
|
+
span: 'container'
|
|
37
69
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
left: 'basic ui button dtsb-left',
|
|
48
|
-
right: 'basic ui button dtsb-right',
|
|
49
|
-
value: 'basic ui selection dropdown dtsb-value'
|
|
50
|
-
});
|
|
51
|
-
dataTable.ext.buttons.searchBuilder.action = function (e, dt, node, config) {
|
|
52
|
-
e.stopPropagation();
|
|
53
|
-
this.popover(config._searchBuilder.getNode(), {
|
|
54
|
-
align: 'container',
|
|
55
|
-
span: 'container'
|
|
56
|
-
});
|
|
57
|
-
// Need to redraw the contents to calculate the correct positions for the elements
|
|
58
|
-
if (config._searchBuilder.s.topGroup !== undefined) {
|
|
59
|
-
config._searchBuilder.s.topGroup.dom.container.trigger('dtsb-redrawContents');
|
|
60
|
-
}
|
|
61
|
-
$('div.dtsb-searchBuilder').removeClass('ui basic vertical buttons');
|
|
62
|
-
};
|
|
63
|
-
return dataTable.searchPanes;
|
|
70
|
+
// Need to redraw the contents to calculate the correct positions for the elements
|
|
71
|
+
if (config._searchBuilder.s.topGroup !== undefined) {
|
|
72
|
+
config._searchBuilder.s.topGroup.dom.container.trigger('dtsb-redrawContents');
|
|
73
|
+
}
|
|
74
|
+
$('div.dtsb-searchBuilder').removeClass('ui basic vertical buttons');
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
return DataTable;
|
|
64
79
|
}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
(function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net-se","datatables.net-searchbuilder"],function(a){return b(a)}):"object"===typeof exports?module.exports=function(a,c){a||(a=window);c&&c.fn.dataTable||(c=require("datatables.net-se")(a,c).$);c.fn.dataTable.searchBuilder||require("datatables.net-searchbuilder")(a,c);return b(c)}:b(jQuery)})(function(b){var a=b.fn.dataTable;b.extend(!0,a.SearchBuilder.classes,{clearAll:"basic ui button dtsb-clearAll"});b.extend(!0,a.Group.classes,
|
|
6
|
-
{add:"basic ui button dtsb-add",clearGroup:"basic ui button dtsb-clearGroup",logic:"basic ui button dtsb-logic"});b.extend(!0,a.Criteria.classes,{condition:"ui selection dropdown dtsb-condition",data:"ui selection dropdown dtsb-data","delete":"basic ui button dtsb-delete",left:"basic ui button dtsb-left",right:"basic ui button dtsb-right",value:"basic ui selection dropdown dtsb-value"});a.ext.buttons.searchBuilder.action=function(c,e,f,d){c.stopPropagation();this.popover(d._searchBuilder.getNode(),
|
|
7
|
-
{align:"container",span:"container"});void 0!==d._searchBuilder.s.topGroup&&d._searchBuilder.s.topGroup.dom.container.trigger("dtsb-redrawContents");b("div.dtsb-searchBuilder").removeClass("ui basic vertical buttons")};return a.searchPanes});
|
|
1
|
+
/*! semantic ui integration for DataTables' SearchBuilder
|
|
2
|
+
* © SpryMedia Ltd - datatables.net/license
|
|
3
|
+
*/
|
|
4
|
+
!function(i){"function"==typeof define&&define.amd?define(["jquery","datatables.net-se","datatables.net-searchbuilder"],function(e){return i(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,(t=t||("undefined"!=typeof window?require("jquery"):require("jquery")(e))).fn.dataTable||require("datatables.net-se")(e,t),t.fn.dataTable||require("datatables.net-searchbuilder")(e,t),i(t,0,e.document)}:i(jQuery,window,document)}(function(a,e,t,r){"use strict";var i=a.fn.dataTable;return a.extend(!0,i.SearchBuilder.classes,{clearAll:"basic ui button dtsb-clearAll"}),a.extend(!0,i.Group.classes,{add:"basic ui button dtsb-add",clearGroup:"basic ui button dtsb-clearGroup",logic:"basic ui button dtsb-logic"}),a.extend(!0,i.Criteria.classes,{condition:"ui selection dropdown dtsb-condition",data:"ui selection dropdown dtsb-data",delete:"basic ui button dtsb-delete",left:"basic ui button dtsb-left",right:"basic ui button dtsb-right",value:"basic ui selection dropdown dtsb-value"}),i.ext.buttons.searchBuilder.action=function(e,t,i,n){e.stopPropagation(),this.popover(n._searchBuilder.getNode(),{align:"container",span:"container"}),n._searchBuilder.s.topGroup!==r&&n._searchBuilder.s.topGroup.dom.container.trigger("dtsb-redrawContents"),a("div.dtsb-searchBuilder").removeClass("ui basic vertical buttons")},i});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! semantic ui integration for DataTables' SearchBuilder
|
|
2
|
+
* © SpryMedia Ltd - datatables.net/license
|
|
3
|
+
*/
|
|
4
|
+
import $ from"jquery";import DataTable from"datatables.net-se";import"datatables.net-searchbuilder";$.extend(!0,DataTable.SearchBuilder.classes,{clearAll:"basic ui button dtsb-clearAll"}),$.extend(!0,DataTable.Group.classes,{add:"basic ui button dtsb-add",clearGroup:"basic ui button dtsb-clearGroup",logic:"basic ui button dtsb-logic"}),$.extend(!0,DataTable.Criteria.classes,{condition:"ui selection dropdown dtsb-condition",data:"ui selection dropdown dtsb-data",delete:"basic ui button dtsb-delete",left:"basic ui button dtsb-left",right:"basic ui button dtsb-right",value:"basic ui selection dropdown dtsb-value"}),DataTable.ext.buttons.searchBuilder.action=function(t,e,a,i){t.stopPropagation(),this.popover(i._searchBuilder.getNode(),{align:"container",span:"container"}),void 0!==i._searchBuilder.s.topGroup&&i._searchBuilder.s.topGroup.dom.container.trigger("dtsb-redrawContents"),$("div.dtsb-searchBuilder").removeClass("ui basic vertical buttons")};export default DataTable;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*! semantic ui integration for DataTables' SearchBuilder
|
|
2
|
+
* © SpryMedia Ltd - datatables.net/license
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import $ from 'jquery';
|
|
6
|
+
import DataTable from 'datatables.net-se';
|
|
7
|
+
import 'datatables.net-searchbuilder';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
$.extend(true, DataTable.SearchBuilder.classes, {
|
|
11
|
+
clearAll: 'basic ui button dtsb-clearAll'
|
|
12
|
+
});
|
|
13
|
+
$.extend(true, DataTable.Group.classes, {
|
|
14
|
+
add: 'basic ui button dtsb-add',
|
|
15
|
+
clearGroup: 'basic ui button dtsb-clearGroup',
|
|
16
|
+
logic: 'basic ui button dtsb-logic'
|
|
17
|
+
});
|
|
18
|
+
$.extend(true, DataTable.Criteria.classes, {
|
|
19
|
+
condition: 'ui selection dropdown dtsb-condition',
|
|
20
|
+
data: 'ui selection dropdown dtsb-data',
|
|
21
|
+
"delete": 'basic ui button dtsb-delete',
|
|
22
|
+
left: 'basic ui button dtsb-left',
|
|
23
|
+
right: 'basic ui button dtsb-right',
|
|
24
|
+
value: 'basic ui selection dropdown dtsb-value'
|
|
25
|
+
});
|
|
26
|
+
DataTable.ext.buttons.searchBuilder.action = function (e, dt, node, config) {
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
this.popover(config._searchBuilder.getNode(), {
|
|
29
|
+
align: 'container',
|
|
30
|
+
span: 'container'
|
|
31
|
+
});
|
|
32
|
+
// Need to redraw the contents to calculate the correct positions for the elements
|
|
33
|
+
if (config._searchBuilder.s.topGroup !== undefined) {
|
|
34
|
+
config._searchBuilder.s.topGroup.dom.container.trigger('dtsb-redrawContents');
|
|
35
|
+
}
|
|
36
|
+
$('div.dtsb-searchBuilder').removeClass('ui basic vertical buttons');
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export default DataTable;
|
package/package.json
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
"name": "datatables.net-searchbuilder-se",
|
|
3
3
|
"description": "SearchBuilder for DataTables with styling for [SemanticUI](https://semantic-ui.com/)",
|
|
4
4
|
"main": "js/searchBuilder.semanticui.js",
|
|
5
|
+
"module": "js/searchBuilder.semanticui.mjs",
|
|
5
6
|
"style": "css/searchBuilder.semanticui.css",
|
|
6
|
-
"types": "./types/
|
|
7
|
-
"version": "1.
|
|
7
|
+
"types": "./types/types.d.ts",
|
|
8
|
+
"version": "1.4.0",
|
|
8
9
|
"files": [
|
|
9
10
|
"css/**/*.css",
|
|
10
11
|
"js/**/*.js",
|
|
12
|
+
"js/**/*.mjs",
|
|
11
13
|
"types/**/*.d.ts"
|
|
12
14
|
],
|
|
13
15
|
"keywords": [
|
|
@@ -24,8 +26,8 @@
|
|
|
24
26
|
"sort"
|
|
25
27
|
],
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"datatables.net-searchbuilder": ">=1.
|
|
28
|
-
"datatables.net-se": ">=1.
|
|
29
|
+
"datatables.net-searchbuilder": ">=1.3.4",
|
|
30
|
+
"datatables.net-se": ">=1.12.1",
|
|
29
31
|
"jquery": ">=1.7"
|
|
30
32
|
},
|
|
31
33
|
"moduleType": [
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Type definitions for DataTables SearchBuilder
|
|
2
|
+
//
|
|
3
|
+
// Project: https://datatables.net/extensions/searchbuilder/, https://datatables.net
|
|
4
|
+
|
|
5
|
+
/// <reference types="jquery" />
|
|
6
|
+
|
|
7
|
+
import DataTables, {Api} from 'datatables.net';
|
|
8
|
+
import {IDefaults, IDetails, II18n} from './searchBuilder';
|
|
9
|
+
|
|
10
|
+
export default DataTables;
|
|
11
|
+
|
|
12
|
+
type DeepPartial<T> = T extends object ? {
|
|
13
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
14
|
+
} : T;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
18
|
+
* DataTables' types integration
|
|
19
|
+
*/
|
|
20
|
+
declare module 'datatables.net' {
|
|
21
|
+
interface Config {
|
|
22
|
+
/**
|
|
23
|
+
* SearchBuilder extension options
|
|
24
|
+
*/
|
|
25
|
+
searchBuilder?: boolean | string[] | ConfigSearchBuilder | ConfigSearchBuilder[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface ConfigLanguage {
|
|
29
|
+
/**
|
|
30
|
+
* SearchBuilder language options
|
|
31
|
+
*/
|
|
32
|
+
searchBuilder?: ConfigSearchBuilderLanguage;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Api<T> {
|
|
36
|
+
/**
|
|
37
|
+
* SearchBuilder methods container
|
|
38
|
+
*
|
|
39
|
+
* @returns Api for chaining with the additional SearchBuilder methods
|
|
40
|
+
*/
|
|
41
|
+
searchBuilder: ApiSearchBuilder<T>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface ApiStatic {
|
|
45
|
+
/**
|
|
46
|
+
* SearchBuilder class
|
|
47
|
+
*/
|
|
48
|
+
SearchBuilder: {
|
|
49
|
+
/**
|
|
50
|
+
* Create a new SearchBuilder instance for the target DataTable
|
|
51
|
+
*/
|
|
52
|
+
new (dt: Api<any>, settings: string[] | ConfigSearchBuilder | ConfigSearchBuilder[]);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* SearchBuilder version
|
|
56
|
+
*/
|
|
57
|
+
version: string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Default configuration values
|
|
61
|
+
*/
|
|
62
|
+
defaults: ConfigSearchBuilder;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
69
|
+
* Options
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
interface ConfigSearchBuilder extends Partial<IDefaults> {}
|
|
73
|
+
|
|
74
|
+
interface ConfigSearchBuilderLanguage extends DeepPartial<II18n> {}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
78
|
+
* API
|
|
79
|
+
*/
|
|
80
|
+
interface ApiSearchBuilder<T> extends Api<T> {
|
|
81
|
+
/**
|
|
82
|
+
* Returns the node of the SearchBuilder Container
|
|
83
|
+
*/
|
|
84
|
+
container(): JQuery<HTMLElement>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Gets the details of the current SearchBuilder setup
|
|
88
|
+
*/
|
|
89
|
+
getDetails(): IDetails;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Rebuild the search to a given state.
|
|
93
|
+
*
|
|
94
|
+
* @param state Object of the same structure that is returned from searchBuilder.getDetails().
|
|
95
|
+
* This contains all of the details needed to rebuild the state.
|
|
96
|
+
* @returns self for chaining
|
|
97
|
+
*/
|
|
98
|
+
rebuild(state: IDetails): Api<T>;
|
|
99
|
+
}
|