tablefilter 0.7.11 → 0.7.13
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/dist/starter.html +2 -2
- package/dist/tablefilter/tablefilter.js +2 -2
- package/dist/tablefilter/tf-1-545915aa28e08079de1d.js +1 -0
- package/dist/tablefilter/tf-1-d6cf56a93d309c087060.js +1 -0
- package/dist/tablefilter.cjs.js +80 -14
- package/dist/tablefilter.esm.js +80 -14
- package/dist/tablefilter.umd.js +80 -14
- package/package.json +5 -5
- package/src/components/tf-loader.js +99 -0
- package/src/modules/loader.js +92 -19
- package/src/tablefilter.js +15 -0
- package/dist/tablefilter/tf-1-173a9ad38a9f45ebd7ce.js +0 -1
- package/dist/tablefilter/tf-1-aeb96e8ee7faea4257ca.js +0 -1
package/dist/tablefilter.umd.js
CHANGED
|
@@ -16459,27 +16459,80 @@
|
|
|
16459
16459
|
* @type {Function}
|
|
16460
16460
|
*/
|
|
16461
16461
|
this.onHide = defaultsFn(f.on_hide_loader, EMPTY_FN);
|
|
16462
|
+
/**
|
|
16463
|
+
* Subscribed before-action handler
|
|
16464
|
+
* @type {Function|null}
|
|
16465
|
+
* @private
|
|
16466
|
+
*/
|
|
16467
|
+
this.boundShow = null;
|
|
16468
|
+
/**
|
|
16469
|
+
* Subscribed after-action handler
|
|
16470
|
+
* @type {Function|null}
|
|
16471
|
+
* @private
|
|
16472
|
+
*/
|
|
16473
|
+
this.boundHide = null;
|
|
16462
16474
|
}
|
|
16463
16475
|
/**
|
|
16464
16476
|
* Initializes Loader instance
|
|
16465
16477
|
*/
|
|
16466
16478
|
init() {
|
|
16467
16479
|
if (this.initialized) return;
|
|
16468
|
-
|
|
16469
|
-
|
|
16480
|
+
const targetEl = this.targetId ? elm(this.targetId) : null;
|
|
16481
|
+
if (this.canUseCE(targetEl)) this.initCE(targetEl);
|
|
16482
|
+
else this.initLegacy(targetEl);
|
|
16483
|
+
this.show(NONE);
|
|
16484
|
+
this.boundShow = () => this.show("");
|
|
16485
|
+
this.boundHide = () => this.show(NONE);
|
|
16486
|
+
this.emitter.on(BEFORE_ACTION_EVENTS, this.boundShow);
|
|
16487
|
+
this.emitter.on(AFTER_ACTION_EVENTS, this.boundHide);
|
|
16488
|
+
/** @inherited */
|
|
16489
|
+
this.initialized = true;
|
|
16490
|
+
}
|
|
16491
|
+
/**
|
|
16492
|
+
* Whether the feature renders through `<tf-loader>`.
|
|
16493
|
+
* @param {DOMElement} targetEl Resolved `target_id` container, if any
|
|
16494
|
+
* @returns {Boolean} True when the registered element exposes `setText`,
|
|
16495
|
+
* the configuration keeps the default `loader` class and a configured
|
|
16496
|
+
* `target_id` resolves
|
|
16497
|
+
* @private
|
|
16498
|
+
*/
|
|
16499
|
+
canUseCE(targetEl) {
|
|
16500
|
+
const LoaderElement = typeof customElements === "undefined" ? null : customElements.get("tf-loader");
|
|
16501
|
+
return Boolean(LoaderElement) && typeof LoaderElement.prototype.setText === "function" && this.cssClass === "loader" && (!this.targetId || Boolean(targetEl));
|
|
16502
|
+
}
|
|
16503
|
+
/**
|
|
16504
|
+
* Initialize using the <tf-loader> custom element
|
|
16505
|
+
* @param {DOMElement} targetEl Target container element
|
|
16506
|
+
* @private
|
|
16507
|
+
*/
|
|
16508
|
+
initCE(targetEl) {
|
|
16509
|
+
const host = document.createElement("tf-loader");
|
|
16510
|
+
host.className = this.cssClass;
|
|
16511
|
+
host.setText(this.html ? "" : this.text);
|
|
16512
|
+
if (this.html) host.innerHTML = sanitizeHtml(this.html);
|
|
16513
|
+
if (targetEl) targetEl.appendChild(host);
|
|
16514
|
+
else {
|
|
16515
|
+
const dom = this.tf.dom();
|
|
16516
|
+
dom.parentNode.insertBefore(host, dom);
|
|
16517
|
+
}
|
|
16518
|
+
this.cont = host;
|
|
16519
|
+
}
|
|
16520
|
+
/**
|
|
16521
|
+
* Initialize using the legacy div container
|
|
16522
|
+
* @param {DOMElement} targetEl Target container element
|
|
16523
|
+
* @private
|
|
16524
|
+
*/
|
|
16525
|
+
initLegacy(targetEl) {
|
|
16470
16526
|
let containerDiv = createElm("div");
|
|
16471
16527
|
containerDiv.className = this.cssClass;
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
|
|
16528
|
+
if (targetEl) targetEl.appendChild(containerDiv);
|
|
16529
|
+
else {
|
|
16530
|
+
const dom = this.tf.dom();
|
|
16531
|
+
dom.parentNode.insertBefore(containerDiv, dom);
|
|
16532
|
+
}
|
|
16475
16533
|
this.cont = containerDiv;
|
|
16476
16534
|
if (!this.html) this.cont.appendChild(createText(this.text));
|
|
16477
16535
|
else this.cont.innerHTML = this.html;
|
|
16478
|
-
this.show(NONE);
|
|
16479
|
-
emitter.on(BEFORE_ACTION_EVENTS, () => this.show(""));
|
|
16480
|
-
emitter.on(AFTER_ACTION_EVENTS, () => this.show(NONE));
|
|
16481
|
-
/** @inherited */
|
|
16482
|
-
this.initialized = true;
|
|
16483
16536
|
}
|
|
16484
16537
|
/**
|
|
16485
16538
|
* Shows or hides activity indicator
|
|
@@ -16502,10 +16555,12 @@
|
|
|
16502
16555
|
destroy() {
|
|
16503
16556
|
if (!this.initialized) return;
|
|
16504
16557
|
let emitter = this.emitter;
|
|
16505
|
-
removeElm(this.cont);
|
|
16558
|
+
if (this.cont && this.cont.parentNode) removeElm(this.cont);
|
|
16506
16559
|
this.cont = null;
|
|
16507
|
-
emitter.off(BEFORE_ACTION_EVENTS,
|
|
16508
|
-
emitter.off(AFTER_ACTION_EVENTS,
|
|
16560
|
+
emitter.off(BEFORE_ACTION_EVENTS, this.boundShow);
|
|
16561
|
+
emitter.off(AFTER_ACTION_EVENTS, this.boundHide);
|
|
16562
|
+
this.boundShow = null;
|
|
16563
|
+
this.boundHide = null;
|
|
16509
16564
|
this.initialized = false;
|
|
16510
16565
|
}
|
|
16511
16566
|
};
|
|
@@ -18682,7 +18737,7 @@
|
|
|
18682
18737
|
* Current version
|
|
18683
18738
|
* @type {String}
|
|
18684
18739
|
*/
|
|
18685
|
-
this.version = "0.7.
|
|
18740
|
+
this.version = "0.7.13";
|
|
18686
18741
|
/**
|
|
18687
18742
|
* Current year
|
|
18688
18743
|
* @type {Number}
|
|
@@ -19385,10 +19440,21 @@
|
|
|
19385
19440
|
this.instantiateFeatures(FEATURES);
|
|
19386
19441
|
}
|
|
19387
19442
|
/**
|
|
19443
|
+
* Throws when the table is not attached to the document.
|
|
19444
|
+
* @private
|
|
19445
|
+
*/
|
|
19446
|
+
assertTableAttached() {
|
|
19447
|
+
const rootEl = doc.documentElement;
|
|
19448
|
+
if (!rootEl || !rootEl.contains(this.dom())) throw new Error(`Could not initialise TableFilter: the HTML table
|
|
19449
|
+
is not attached to the document. Append it to the DOM before
|
|
19450
|
+
init().`);
|
|
19451
|
+
}
|
|
19452
|
+
/**
|
|
19388
19453
|
* Initialise features and layout
|
|
19389
19454
|
*/
|
|
19390
19455
|
init() {
|
|
19391
19456
|
if (this.initialized) return;
|
|
19457
|
+
this.assertTableAttached();
|
|
19392
19458
|
this.import(this.stylesheetId, this.getStylesheetPath(), null, "link");
|
|
19393
19459
|
let Mod = this.Mod;
|
|
19394
19460
|
let inpclass;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tablefilter",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.13",
|
|
4
4
|
"description": "A Javascript library making HTML tables filterable and a bit more",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"babel-eslint": "10.1.0",
|
|
61
61
|
"babel-loader": "^8.0.2",
|
|
62
62
|
"babel-preset-env": "1.7.0",
|
|
63
|
-
"clean-webpack-plugin": "^
|
|
63
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
64
64
|
"codecov": "3.7.1",
|
|
65
65
|
"diacritics": "1.3.0",
|
|
66
66
|
"esdoc": "1.1.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"grunt": "^1.0.1",
|
|
70
70
|
"grunt-cli": "1.5.0",
|
|
71
71
|
"grunt-contrib-clean": "^2.0.0",
|
|
72
|
-
"grunt-contrib-connect": "^
|
|
72
|
+
"grunt-contrib-connect": "^5.0.1",
|
|
73
73
|
"grunt-contrib-copy": "^1.0.0",
|
|
74
74
|
"grunt-contrib-watch": "^1.0.0",
|
|
75
75
|
"grunt-qunit-istanbul": "1.1.0",
|
|
@@ -78,13 +78,13 @@
|
|
|
78
78
|
"isparta-loader": "2.0.0",
|
|
79
79
|
"script-loader": "^0.7.0",
|
|
80
80
|
"string-replace-webpack-plugin": "^0.1.3",
|
|
81
|
-
"stylus": "^0.
|
|
81
|
+
"stylus": "^0.55.0",
|
|
82
82
|
"sugar-date": "2.0.6",
|
|
83
83
|
"uglifyjs-webpack-plugin": "2.2.0",
|
|
84
84
|
"vite": "8.3.4",
|
|
85
85
|
"webpack": "^4.38.0",
|
|
86
86
|
"webpack-cli": "^3.0.8",
|
|
87
|
-
"webpack-dev-server": "^
|
|
87
|
+
"webpack-dev-server": "^4.15.2"
|
|
88
88
|
},
|
|
89
89
|
"bugs": {
|
|
90
90
|
"url": "https://github.com/koalyptus/TableFilter/issues"
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<tf-loader>` custom element: accessible activity indicator.
|
|
3
|
+
*
|
|
4
|
+
* Scaffold: an open shadow root exposing the `message-slot` and
|
|
5
|
+
* `message` parts. Consumer content (legacy `loader.html`) renders
|
|
6
|
+
* through the default slot; the `text` attribute is the plain-text
|
|
7
|
+
* fallback and is rendered as text. `connectedCallback()` applies the
|
|
8
|
+
* shared live-region contract (`applyLiveRegion()`) to the host.
|
|
9
|
+
*
|
|
10
|
+
* The configurable loader class (`loader.css_class`, default `loader`)
|
|
11
|
+
* is applied to this host by the Loader bridge. The element ships
|
|
12
|
+
* structure and `::part()` hooks only; the look is defined by the
|
|
13
|
+
* stylesheet and themes.
|
|
14
|
+
*
|
|
15
|
+
* Importing this module registers the element. It is not part of the
|
|
16
|
+
* legacy webpack bundle (PhantomJS `_wrapNativeSuper`); consumers load
|
|
17
|
+
* it as a module.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import {applyLiveRegion} from './attributes.js';
|
|
21
|
+
|
|
22
|
+
// Cloned into every instance's shadow root. `part` is the internal
|
|
23
|
+
// contract (selected by _update() and themed via ::part()); the clone
|
|
24
|
+
// carries no class or stylesheet.
|
|
25
|
+
const TEMPLATE = document.createElement('template');
|
|
26
|
+
TEMPLATE.innerHTML = `
|
|
27
|
+
<slot part="message-slot"></slot>
|
|
28
|
+
<span part="message"></span>
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export class TfLoaderElement extends HTMLElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
this.attachShadow({ mode: 'open' });
|
|
35
|
+
this.shadowRoot.appendChild(TEMPLATE.content.cloneNode(true));
|
|
36
|
+
this._messageSlot =
|
|
37
|
+
this.shadowRoot.querySelector('[part="message-slot"]');
|
|
38
|
+
this._messageEl = this.shadowRoot.querySelector('[part="message"]');
|
|
39
|
+
|
|
40
|
+
this._messageSlot.addEventListener(
|
|
41
|
+
'slotchange', () => this._syncLayout());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static get observedAttributes() {
|
|
45
|
+
return ['text'];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
connectedCallback() {
|
|
49
|
+
// Live-region contract: `applyLiveRegion()` sets role=status,
|
|
50
|
+
// aria-live=polite and aria-atomic=true on the host.
|
|
51
|
+
applyLiveRegion(this);
|
|
52
|
+
this._update();
|
|
53
|
+
this._syncLayout();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
attributeChangedCallback() {
|
|
57
|
+
this._update();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Set the message text, rendered as text into the `message` part.
|
|
62
|
+
* Values are coerced to strings (0 renders as '0').
|
|
63
|
+
* @param {String} text Message text
|
|
64
|
+
*/
|
|
65
|
+
setText(text) {
|
|
66
|
+
this.setAttribute('text', text == null ? '' : String(text));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Render the `text` attribute as text into the `message` part.
|
|
71
|
+
*/
|
|
72
|
+
_update() {
|
|
73
|
+
if (this._messageEl) {
|
|
74
|
+
this._messageEl.textContent =
|
|
75
|
+
this.getAttribute('text') || '';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Show the element-rendered message part only when the default slot
|
|
81
|
+
* carries no element or non-whitespace text nodes.
|
|
82
|
+
*/
|
|
83
|
+
_syncLayout() {
|
|
84
|
+
if (!this._messageEl) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this._messageEl.hidden = this._messageSlot
|
|
88
|
+
.assignedNodes({ flatten: true })
|
|
89
|
+
.some((node) => node.nodeType === 1 ||
|
|
90
|
+
(node.nodeType === 3 && node.textContent.trim() !== ''));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Register once: loading this module twice (or on a page that already
|
|
95
|
+
// defined the element) must not throw.
|
|
96
|
+
if (typeof customElements !== 'undefined' &&
|
|
97
|
+
!customElements.get('tf-loader')) {
|
|
98
|
+
customElements.define('tf-loader', TfLoaderElement);
|
|
99
|
+
}
|
package/src/modules/loader.js
CHANGED
|
@@ -4,6 +4,7 @@ import {EMPTY_FN} from '../types';
|
|
|
4
4
|
import {root} from '../root';
|
|
5
5
|
import {NONE} from '../const';
|
|
6
6
|
import {defaultsStr, defaultsFn} from '../settings';
|
|
7
|
+
import {sanitizeHtml} from '../sanitize';
|
|
7
8
|
|
|
8
9
|
const BEFORE_ACTION_EVENTS = [
|
|
9
10
|
'before-filtering',
|
|
@@ -95,6 +96,20 @@ export class Loader extends Feature {
|
|
|
95
96
|
* @type {Function}
|
|
96
97
|
*/
|
|
97
98
|
this.onHide = defaultsFn(f.on_hide_loader, EMPTY_FN);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Subscribed before-action handler
|
|
102
|
+
* @type {Function|null}
|
|
103
|
+
* @private
|
|
104
|
+
*/
|
|
105
|
+
this.boundShow = null;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Subscribed after-action handler
|
|
109
|
+
* @type {Function|null}
|
|
110
|
+
* @private
|
|
111
|
+
*/
|
|
112
|
+
this.boundHide = null;
|
|
98
113
|
}
|
|
99
114
|
|
|
100
115
|
/**
|
|
@@ -105,18 +120,81 @@ export class Loader extends Feature {
|
|
|
105
120
|
return;
|
|
106
121
|
}
|
|
107
122
|
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
// Bridge to <tf-loader> (scaffold #916): a custom `css_class`, or an
|
|
124
|
+
// unresolvable `target_id`, routes to the legacy div container.
|
|
125
|
+
// TODO(#965): remove once the legacy webpack pipeline is retired.
|
|
126
|
+
const targetEl = this.targetId ? elm(this.targetId) : null;
|
|
127
|
+
if (this.canUseCE(targetEl)) {
|
|
128
|
+
this.initCE(targetEl);
|
|
129
|
+
} else {
|
|
130
|
+
this.initLegacy(targetEl);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
this.show(NONE);
|
|
134
|
+
|
|
135
|
+
// Subscribe to events
|
|
136
|
+
this.boundShow = () => this.show('');
|
|
137
|
+
this.boundHide = () => this.show(NONE);
|
|
138
|
+
this.emitter.on(BEFORE_ACTION_EVENTS, this.boundShow);
|
|
139
|
+
this.emitter.on(AFTER_ACTION_EVENTS, this.boundHide);
|
|
140
|
+
|
|
141
|
+
/** @inherited */
|
|
142
|
+
this.initialized = true;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Whether the feature renders through `<tf-loader>`.
|
|
147
|
+
* @param {DOMElement} targetEl Resolved `target_id` container, if any
|
|
148
|
+
* @returns {Boolean} True when the registered element exposes `setText`,
|
|
149
|
+
* the configuration keeps the default `loader` class and a configured
|
|
150
|
+
* `target_id` resolves
|
|
151
|
+
* @private
|
|
152
|
+
*/
|
|
153
|
+
canUseCE(targetEl) {
|
|
154
|
+
const LoaderElement = typeof customElements === 'undefined' ?
|
|
155
|
+
null : customElements.get('tf-loader');
|
|
156
|
+
return Boolean(LoaderElement) &&
|
|
157
|
+
typeof LoaderElement.prototype.setText === 'function' &&
|
|
158
|
+
this.cssClass === 'loader' &&
|
|
159
|
+
(!this.targetId || Boolean(targetEl));
|
|
160
|
+
}
|
|
110
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Initialize using the <tf-loader> custom element
|
|
164
|
+
* @param {DOMElement} targetEl Target container element
|
|
165
|
+
* @private
|
|
166
|
+
*/
|
|
167
|
+
initCE(targetEl) {
|
|
168
|
+
const host = document.createElement('tf-loader');
|
|
169
|
+
host.className = this.cssClass;
|
|
170
|
+
host.setText(this.html ? '' : this.text);
|
|
171
|
+
if (this.html) {
|
|
172
|
+
host.innerHTML = sanitizeHtml(this.html);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (targetEl) {
|
|
176
|
+
targetEl.appendChild(host);
|
|
177
|
+
} else {
|
|
178
|
+
const dom = this.tf.dom();
|
|
179
|
+
dom.parentNode.insertBefore(host, dom);
|
|
180
|
+
}
|
|
181
|
+
this.cont = host;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Initialize using the legacy div container
|
|
186
|
+
* @param {DOMElement} targetEl Target container element
|
|
187
|
+
* @private
|
|
188
|
+
*/
|
|
189
|
+
initLegacy(targetEl) {
|
|
111
190
|
let containerDiv = createElm('div');
|
|
112
191
|
containerDiv.className = this.cssClass;
|
|
113
192
|
|
|
114
|
-
|
|
115
|
-
tf.dom().parentNode : elm(this.targetId);
|
|
116
|
-
if (!this.targetId) {
|
|
117
|
-
targetEl.insertBefore(containerDiv, tf.dom());
|
|
118
|
-
} else {
|
|
193
|
+
if (targetEl) {
|
|
119
194
|
targetEl.appendChild(containerDiv);
|
|
195
|
+
} else {
|
|
196
|
+
const dom = this.tf.dom();
|
|
197
|
+
dom.parentNode.insertBefore(containerDiv, dom);
|
|
120
198
|
}
|
|
121
199
|
this.cont = containerDiv;
|
|
122
200
|
if (!this.html) {
|
|
@@ -124,15 +202,6 @@ export class Loader extends Feature {
|
|
|
124
202
|
} else {
|
|
125
203
|
this.cont.innerHTML = this.html;
|
|
126
204
|
}
|
|
127
|
-
|
|
128
|
-
this.show(NONE);
|
|
129
|
-
|
|
130
|
-
// Subscribe to events
|
|
131
|
-
emitter.on(BEFORE_ACTION_EVENTS, () => this.show(''));
|
|
132
|
-
emitter.on(AFTER_ACTION_EVENTS, () => this.show(NONE));
|
|
133
|
-
|
|
134
|
-
/** @inherited */
|
|
135
|
-
this.initialized = true;
|
|
136
205
|
}
|
|
137
206
|
|
|
138
207
|
/**
|
|
@@ -171,12 +240,16 @@ export class Loader extends Feature {
|
|
|
171
240
|
|
|
172
241
|
let emitter = this.emitter;
|
|
173
242
|
|
|
174
|
-
|
|
243
|
+
if (this.cont && this.cont.parentNode) {
|
|
244
|
+
removeElm(this.cont);
|
|
245
|
+
}
|
|
175
246
|
this.cont = null;
|
|
176
247
|
|
|
177
248
|
// Unsubscribe to events
|
|
178
|
-
emitter.off(BEFORE_ACTION_EVENTS,
|
|
179
|
-
emitter.off(AFTER_ACTION_EVENTS,
|
|
249
|
+
emitter.off(BEFORE_ACTION_EVENTS, this.boundShow);
|
|
250
|
+
emitter.off(AFTER_ACTION_EVENTS, this.boundHide);
|
|
251
|
+
this.boundShow = null;
|
|
252
|
+
this.boundHide = null;
|
|
180
253
|
|
|
181
254
|
this.initialized = false;
|
|
182
255
|
}
|
package/src/tablefilter.js
CHANGED
|
@@ -937,6 +937,19 @@ export class TableFilter {
|
|
|
937
937
|
this.instantiateFeatures(FEATURES);
|
|
938
938
|
}
|
|
939
939
|
|
|
940
|
+
/**
|
|
941
|
+
* Throws when the table is not attached to the document.
|
|
942
|
+
* @private
|
|
943
|
+
*/
|
|
944
|
+
assertTableAttached() {
|
|
945
|
+
const rootEl = doc.documentElement;
|
|
946
|
+
if (!rootEl || !rootEl.contains(this.dom())) {
|
|
947
|
+
throw new Error(`Could not initialise TableFilter: the HTML table
|
|
948
|
+
is not attached to the document. Append it to the DOM before
|
|
949
|
+
init().`);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
|
|
940
953
|
/**
|
|
941
954
|
* Initialise features and layout
|
|
942
955
|
*/
|
|
@@ -945,6 +958,8 @@ export class TableFilter {
|
|
|
945
958
|
return;
|
|
946
959
|
}
|
|
947
960
|
|
|
961
|
+
this.assertTableAttached();
|
|
962
|
+
|
|
948
963
|
// import main stylesheet
|
|
949
964
|
this.import(this.stylesheetId, this.getStylesheetPath(), null, 'link');
|
|
950
965
|
|