tablefilter 0.7.7 → 0.7.9
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/README.md +12 -4
- package/dist/starter.html +2 -2
- package/dist/tablefilter/tablefilter.js +6 -1
- package/dist/tablefilter/tf-1-6b8404107bb034797c71.js +1 -0
- package/dist/tablefilter.cjs.js +3129 -167
- package/dist/tablefilter.esm.js +3129 -167
- package/dist/tablefilter.umd.js +3129 -167
- package/package.json +8 -7
- package/src/components/tf-checklist.js +571 -0
- package/src/components/tf-help.js +386 -0
- package/src/modules/checkList.js +405 -93
- package/src/modules/help.js +292 -41
- package/src/number.js +13 -1
- package/dist/tablefilter/tf-1-7e29d0dbe6e0e0a4ff05.js +0 -1
- package/dist/tablefilter/tf-2-0ea691278d572212426a.js +0 -6
package/src/modules/help.js
CHANGED
|
@@ -5,12 +5,29 @@ import {NONE} from '../const';
|
|
|
5
5
|
import {root} from '../root';
|
|
6
6
|
import {isEmpty, isNull} from '../types';
|
|
7
7
|
import {defaultsStr, defaultsNb} from '../settings';
|
|
8
|
+
import {sanitizeHtml} from '../sanitize';
|
|
8
9
|
import {RIGHT} from './toolbar';
|
|
9
10
|
|
|
10
11
|
const WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' +
|
|
11
12
|
'4.-Filter-operators';
|
|
12
13
|
const WEBSITE_URL = 'https://www.tablefilter.com/';
|
|
13
14
|
|
|
15
|
+
// Default instructions markup, used when neither `text` nor `html` is
|
|
16
|
+
// configured (ROADMAP/content-projection-parity.md P3).
|
|
17
|
+
const DEFAULT_INSTR_HTML = 'Use the filters above each column to filter ' +
|
|
18
|
+
'and limit table data. Advanced searches can be performed by using ' +
|
|
19
|
+
'the following operators: <br /><b><</b>, <b><=</b>, <b>></b>, ' +
|
|
20
|
+
'<b>>=</b>, <b>=</b>, <b>*</b>, <b>!</b>, <b>{</b>, <b>}</b>, ' +
|
|
21
|
+
'<b>||</b>,<b>&&</b>, <b>[empty]</b>, <b>[nonempty]</b>, ' +
|
|
22
|
+
'<b>rgx:</b><br/><a href="' + WIKI_URL + '" target="_blank">' +
|
|
23
|
+
'Learn more</a><hr/>';
|
|
24
|
+
|
|
25
|
+
// Focusable trigger controls; slotted trigger markup without one is
|
|
26
|
+
// wrapped in a button. Matches FOCUSABLE in components/tf-help.js.
|
|
27
|
+
const FOCUSABLE_TRIGGER = 'button:not([disabled]), a[href], ' +
|
|
28
|
+
'input:not([disabled]), select:not([disabled]), ' +
|
|
29
|
+
'textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
30
|
+
|
|
14
31
|
/**
|
|
15
32
|
* Help UI component
|
|
16
33
|
*/
|
|
@@ -38,17 +55,10 @@ export class Help extends Feature {
|
|
|
38
55
|
this.contTgtId = defaultsStr(f.container_target_id, null);
|
|
39
56
|
|
|
40
57
|
/**
|
|
41
|
-
* Instructions text
|
|
58
|
+
* Instructions text, rendered with textContent
|
|
42
59
|
* @type {String}
|
|
43
60
|
*/
|
|
44
|
-
this.instrText = !isEmpty(f.text) ? f.text :
|
|
45
|
-
'Use the filters above each column to filter and limit table ' +
|
|
46
|
-
'data. Advanced searches can be performed by using the following ' +
|
|
47
|
-
'operators: <br /><b><</b>, <b><=</b>, <b>></b>, ' +
|
|
48
|
-
'<b>>=</b>, <b>=</b>, <b>*</b>, <b>!</b>, <b>{</b>, <b>}</b>, ' +
|
|
49
|
-
'<b>||</b>,<b>&&</b>, <b>[empty]</b>, <b>[nonempty]</b>, ' +
|
|
50
|
-
'<b>rgx:</b><br/><a href="' + WIKI_URL + '" target="_blank">' +
|
|
51
|
-
'Learn more</a><hr/>';
|
|
61
|
+
this.instrText = !isEmpty(f.text) ? f.text : null;
|
|
52
62
|
|
|
53
63
|
/**
|
|
54
64
|
* Instructions HTML
|
|
@@ -68,6 +78,12 @@ export class Help extends Feature {
|
|
|
68
78
|
*/
|
|
69
79
|
this.btnHtml = defaultsStr(f.btn_html, null);
|
|
70
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Accessible name for the help button
|
|
83
|
+
* @type {String}
|
|
84
|
+
*/
|
|
85
|
+
this.label = defaultsStr(f.label, null);
|
|
86
|
+
|
|
71
87
|
/**
|
|
72
88
|
* Css class for help button
|
|
73
89
|
* @type {String}
|
|
@@ -92,6 +108,13 @@ export class Help extends Feature {
|
|
|
92
108
|
*/
|
|
93
109
|
this.cont = null;
|
|
94
110
|
|
|
111
|
+
/**
|
|
112
|
+
* `<tf-help>` host element
|
|
113
|
+
* @type {DOMElement}
|
|
114
|
+
* @private
|
|
115
|
+
*/
|
|
116
|
+
this.el = null;
|
|
117
|
+
|
|
95
118
|
/**
|
|
96
119
|
* Adjust container left position when table's horizontal scroll is
|
|
97
120
|
* on, typically when `responsive` option is enabled.
|
|
@@ -102,21 +125,18 @@ export class Help extends Feature {
|
|
|
102
125
|
defaultsNb(f.container_adjust_left_position, 25);
|
|
103
126
|
|
|
104
127
|
/**
|
|
105
|
-
*
|
|
128
|
+
* Whether `container_adjust_left_position` is explicitly configured
|
|
129
|
+
* @type {Boolean}
|
|
106
130
|
* @private
|
|
107
131
|
*/
|
|
108
|
-
this.
|
|
132
|
+
this.hasContAdjustLeftPosition =
|
|
133
|
+
f.container_adjust_left_position != null;
|
|
109
134
|
|
|
110
135
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @
|
|
136
|
+
* Bound mouseup wrapper
|
|
137
|
+
* @private
|
|
113
138
|
*/
|
|
114
|
-
this.
|
|
115
|
-
'v' + tf.version + '</h4>' + '<a href="' + WEBSITE_URL +
|
|
116
|
-
'" target="_blank">' + WEBSITE_URL + '</a>' +
|
|
117
|
-
'<br/><span>©2015-' + tf.year + ' {AUTHOR}</span>' +
|
|
118
|
-
'<div align="center" style="margin-top:8px;">' +
|
|
119
|
-
'<a href="javascript:void(0);" class="close">Close</a></div></div>';
|
|
139
|
+
this.boundMouseup = null;
|
|
120
140
|
|
|
121
141
|
/**
|
|
122
142
|
* Default position in toolbar ('left'|'center'|'right')
|
|
@@ -157,54 +177,257 @@ export class Help extends Feature {
|
|
|
157
177
|
|
|
158
178
|
let tf = this.tf;
|
|
159
179
|
|
|
180
|
+
//help button is added to defined element
|
|
181
|
+
let targetEl = !this.tgtId ?
|
|
182
|
+
tf.feature('toolbar').container(this.toolbarPosition) :
|
|
183
|
+
elm(this.tgtId);
|
|
184
|
+
|
|
185
|
+
// Bridge to <tf-help> (scaffold #913): `target_id`,
|
|
186
|
+
// `container_target_id` and an explicit
|
|
187
|
+
// `container_adjust_left_position` keep the legacy span/div
|
|
188
|
+
// structure.
|
|
189
|
+
// TODO(#965): remove once the legacy webpack pipeline is retired.
|
|
190
|
+
if (this.canUseCE()) {
|
|
191
|
+
this.initCE(targetEl);
|
|
192
|
+
} else {
|
|
193
|
+
this.initLegacy(targetEl);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** @inherited */
|
|
197
|
+
this.initialized = true;
|
|
198
|
+
|
|
199
|
+
this.emitter.emit('feature-initialized', this);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Whether the feature renders through `<tf-help>`.
|
|
204
|
+
* @returns {Boolean} True when the element is registered and the
|
|
205
|
+
* configuration has no custom containers, scroll adjustment or CSS
|
|
206
|
+
* classes
|
|
207
|
+
* @private
|
|
208
|
+
*/
|
|
209
|
+
canUseCE() {
|
|
210
|
+
return typeof customElements !== 'undefined' &&
|
|
211
|
+
Boolean(customElements.get('tf-help')) &&
|
|
212
|
+
!this.tgtId && !this.contTgtId &&
|
|
213
|
+
!this.hasContAdjustLeftPosition &&
|
|
214
|
+
this.btnCssClass === 'helpBtn' &&
|
|
215
|
+
this.contCssClass === 'helpCont';
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Footer markup appended after the instructions
|
|
220
|
+
* @param {Boolean} withCloseLink Whether to include the legacy
|
|
221
|
+
* close link
|
|
222
|
+
* @returns {String} Footer HTML
|
|
223
|
+
* @private
|
|
224
|
+
*/
|
|
225
|
+
footerMarkup(withCloseLink) {
|
|
226
|
+
return '<div class="helpFooter"><h4>TableFilter v' +
|
|
227
|
+
this.tf.version + '</h4>' + '<a href="' + WEBSITE_URL +
|
|
228
|
+
'" target="_blank">' + WEBSITE_URL + '</a>' +
|
|
229
|
+
'<br/><span>©2015-' + this.tf.year + ' {AUTHOR}</span>' +
|
|
230
|
+
(withCloseLink ?
|
|
231
|
+
'<div align="center" style="margin-top:8px;">' +
|
|
232
|
+
'<a href="javascript:void(0);" class="close">Close</a>' +
|
|
233
|
+
'</div>' :
|
|
234
|
+
'') +
|
|
235
|
+
'</div>';
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Append markup nodes to the target element
|
|
240
|
+
* @param {DOMElement} target Node to append the markup to
|
|
241
|
+
* @param {String} markup Markup; passed through `sanitizeHtml()`
|
|
242
|
+
* @returns {Array} Appended top-level nodes
|
|
243
|
+
* @private
|
|
244
|
+
*/
|
|
245
|
+
appendMarkup(target, markup) {
|
|
246
|
+
const wrapper = createElm('div');
|
|
247
|
+
wrapper.innerHTML = sanitizeHtml(markup);
|
|
248
|
+
const nodes = [];
|
|
249
|
+
while (wrapper.firstChild) {
|
|
250
|
+
nodes.push(target.appendChild(wrapper.firstChild));
|
|
251
|
+
}
|
|
252
|
+
return nodes;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Initialize using the <tf-help> custom element
|
|
257
|
+
* @param {DOMElement} targetEl Target container element
|
|
258
|
+
* @private
|
|
259
|
+
*/
|
|
260
|
+
initCE(targetEl) {
|
|
261
|
+
const host = document.createElement('tf-help');
|
|
262
|
+
host.setAttribute('trigger-text', this.btnText);
|
|
263
|
+
host.setAttribute('close-text', 'Close');
|
|
264
|
+
if (this.label) {
|
|
265
|
+
host.setAttribute('label', this.label);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (this.btnHtml) {
|
|
269
|
+
const trigger = createElm('span');
|
|
270
|
+
trigger.innerHTML = sanitizeHtml(this.btnHtml);
|
|
271
|
+
if (!trigger.firstChild) {
|
|
272
|
+
// Fallback when btn_html is empty after sanitisation
|
|
273
|
+
// (e.g. script-only markup). tf-help renders its own
|
|
274
|
+
// default trigger, so skip assigning a custom trigger to
|
|
275
|
+
// avoid null‑ref crashes elsewhere in the bridge.
|
|
276
|
+
} else if (trigger.querySelector(FOCUSABLE_TRIGGER)) {
|
|
277
|
+
while (trigger.firstChild) {
|
|
278
|
+
const node = trigger.firstChild;
|
|
279
|
+
if (node.nodeType === 1) {
|
|
280
|
+
node.slot = 'trigger';
|
|
281
|
+
this.applyTriggerLabel(node);
|
|
282
|
+
} else if (node.nodeType === 3 &&
|
|
283
|
+
node.textContent.trim()) {
|
|
284
|
+
const text = createElm('span');
|
|
285
|
+
text.slot = 'trigger';
|
|
286
|
+
text.appendChild(node);
|
|
287
|
+
host.appendChild(text);
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
host.appendChild(node);
|
|
291
|
+
}
|
|
292
|
+
} else {
|
|
293
|
+
// The element hides its own trigger while the slot has
|
|
294
|
+
// nodes; non-focusable markup is wrapped in a button so
|
|
295
|
+
// the trigger stays keyboard-activatable.
|
|
296
|
+
const button = createElm('button');
|
|
297
|
+
button.type = 'button';
|
|
298
|
+
button.slot = 'trigger';
|
|
299
|
+
this.applyTriggerLabel(button);
|
|
300
|
+
while (trigger.firstChild) {
|
|
301
|
+
button.appendChild(trigger.firstChild);
|
|
302
|
+
}
|
|
303
|
+
host.appendChild(button);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const instructions = createElm('div');
|
|
308
|
+
instructions.slot = 'instructions';
|
|
309
|
+
if (this.instrHtml) {
|
|
310
|
+
instructions.innerHTML = sanitizeHtml(this.instrHtml);
|
|
311
|
+
} else if (this.instrText) {
|
|
312
|
+
instructions.appendChild(createText(this.instrText));
|
|
313
|
+
} else {
|
|
314
|
+
instructions.innerHTML = sanitizeHtml(DEFAULT_INSTR_HTML);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// TODO(#1083): the projected footer keeps no close link; the
|
|
318
|
+
// element renders its own close control.
|
|
319
|
+
this.appendMarkup(instructions, this.footerMarkup(false));
|
|
320
|
+
host.appendChild(instructions);
|
|
321
|
+
|
|
322
|
+
// The clear button stays the last control in the toolbar.
|
|
323
|
+
const clearFeature = this.tf.feature('clearButton');
|
|
324
|
+
const clearEl = clearFeature && clearFeature.container;
|
|
325
|
+
if (clearEl && clearEl.parentNode === targetEl) {
|
|
326
|
+
targetEl.insertBefore(host, clearEl);
|
|
327
|
+
} else {
|
|
328
|
+
targetEl.appendChild(host);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
this.el = host;
|
|
332
|
+
this.btn = host;
|
|
333
|
+
this.cont = host;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Apply the configured label to a trigger element, preferring the
|
|
338
|
+
* focusable control in its subtree and preserving an existing
|
|
339
|
+
* `aria-label`.
|
|
340
|
+
* @param {DOMElement} node Trigger element
|
|
341
|
+
* @private
|
|
342
|
+
*/
|
|
343
|
+
applyTriggerLabel(node) {
|
|
344
|
+
if (!this.label) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const target = node.matches(FOCUSABLE_TRIGGER) ?
|
|
348
|
+
node : node.querySelector(FOCUSABLE_TRIGGER) || node;
|
|
349
|
+
if (!target.hasAttribute('aria-label')) {
|
|
350
|
+
target.setAttribute('aria-label', this.label);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Append the default help anchor to the legacy button container
|
|
356
|
+
* @param {DOMElement} btn Button container
|
|
357
|
+
* @param {DOMElement} divContainer Container receiving the pop-up
|
|
358
|
+
* @param {DOMElement} cont Help pop-up container
|
|
359
|
+
* @private
|
|
360
|
+
*/
|
|
361
|
+
appendDefaultTrigger(btn, divContainer, cont) {
|
|
362
|
+
divContainer.appendChild(cont);
|
|
363
|
+
let helplink = createElm('a', ['href', 'javascript:void(0);']);
|
|
364
|
+
helplink.className = this.btnCssClass;
|
|
365
|
+
helplink.appendChild(createText(this.btnText));
|
|
366
|
+
this.applyTriggerLabel(helplink);
|
|
367
|
+
btn.appendChild(helplink);
|
|
368
|
+
addEvt(helplink, 'click', () => this.toggle());
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Initialize using the legacy span/div structure
|
|
373
|
+
* @param {DOMElement} targetEl Target container element
|
|
374
|
+
* @private
|
|
375
|
+
*/
|
|
376
|
+
initLegacy(targetEl) {
|
|
160
377
|
let btn = createElm('span');
|
|
161
378
|
let cont = createElm('div');
|
|
162
379
|
|
|
163
380
|
this.boundMouseup = this.onMouseup.bind(this);
|
|
164
381
|
|
|
165
|
-
//help button is added to defined element
|
|
166
|
-
let targetEl = !this.tgtId ?
|
|
167
|
-
tf.feature('toolbar').container(this.toolbarPosition) :
|
|
168
|
-
elm(this.tgtId);
|
|
169
382
|
targetEl.appendChild(btn);
|
|
170
383
|
|
|
171
384
|
let divContainer = !this.contTgtId ? btn : elm(this.contTgtId);
|
|
172
385
|
|
|
173
386
|
if (!this.btnHtml) {
|
|
174
|
-
|
|
175
|
-
let helplink = createElm('a', ['href', 'javascript:void(0);']);
|
|
176
|
-
helplink.className = this.btnCssClass;
|
|
177
|
-
helplink.appendChild(createText(this.btnText));
|
|
178
|
-
btn.appendChild(helplink);
|
|
179
|
-
addEvt(helplink, 'click', () => this.toggle());
|
|
387
|
+
this.appendDefaultTrigger(btn, divContainer, cont);
|
|
180
388
|
} else {
|
|
181
|
-
btn.innerHTML = this.btnHtml;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
389
|
+
btn.innerHTML = sanitizeHtml(this.btnHtml);
|
|
390
|
+
if (!btn.firstChild) {
|
|
391
|
+
this.appendDefaultTrigger(btn, divContainer, cont);
|
|
392
|
+
} else {
|
|
393
|
+
let helpEl = btn.firstChild;
|
|
394
|
+
if (helpEl.nodeType === 1) {
|
|
395
|
+
this.applyTriggerLabel(helpEl);
|
|
396
|
+
}
|
|
397
|
+
addEvt(helpEl, 'click', () => this.toggle());
|
|
398
|
+
divContainer.appendChild(cont);
|
|
399
|
+
}
|
|
185
400
|
}
|
|
186
401
|
|
|
187
402
|
if (!this.instrHtml) {
|
|
188
|
-
|
|
403
|
+
if (this.instrText) {
|
|
404
|
+
cont.appendChild(createText(this.instrText));
|
|
405
|
+
} else {
|
|
406
|
+
cont.innerHTML = sanitizeHtml(DEFAULT_INSTR_HTML);
|
|
407
|
+
}
|
|
189
408
|
cont.className = this.contCssClass;
|
|
190
409
|
} else {
|
|
191
410
|
if (this.contTgtId) {
|
|
192
411
|
divContainer.appendChild(cont);
|
|
193
412
|
}
|
|
194
|
-
cont.innerHTML = this.instrHtml;
|
|
413
|
+
cont.innerHTML = sanitizeHtml(this.instrHtml);
|
|
195
414
|
if (!this.contTgtId) {
|
|
196
415
|
cont.className = this.contCssClass;
|
|
197
416
|
}
|
|
198
417
|
}
|
|
199
|
-
|
|
418
|
+
const footer = this.appendMarkup(
|
|
419
|
+
cont, this.footerMarkup(true))[0];
|
|
420
|
+
// sanitizeHtml() drops `javascript:` URLs, which also drops the
|
|
421
|
+
// link cursor and focusability from the close link. The footer is
|
|
422
|
+
// internal markup, so its href is restored after sanitising.
|
|
423
|
+
const close = footer && footer.querySelector('a.close');
|
|
424
|
+
if (close) {
|
|
425
|
+
close.setAttribute('href', 'javascript:void(0);');
|
|
426
|
+
}
|
|
200
427
|
addEvt(cont, 'click', () => this.toggle());
|
|
201
428
|
|
|
202
429
|
this.cont = cont;
|
|
203
430
|
this.btn = btn;
|
|
204
|
-
/** @inherited */
|
|
205
|
-
this.initialized = true;
|
|
206
|
-
|
|
207
|
-
this.emitter.emit('feature-initialized', this);
|
|
208
431
|
}
|
|
209
432
|
|
|
210
433
|
/**
|
|
@@ -217,6 +440,11 @@ export class Help extends Feature {
|
|
|
217
440
|
return;
|
|
218
441
|
}
|
|
219
442
|
|
|
443
|
+
if (this.el) {
|
|
444
|
+
this.el.setOpen(!this.el.hasAttribute('open'));
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
220
448
|
// ensure mouseup event handler is removed
|
|
221
449
|
removeEvt(root, 'mouseup', this.boundMouseup);
|
|
222
450
|
|
|
@@ -241,6 +469,26 @@ export class Help extends Feature {
|
|
|
241
469
|
}
|
|
242
470
|
}
|
|
243
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Disable help and reflect the state on the `<tf-help>` host
|
|
474
|
+
*/
|
|
475
|
+
disable() {
|
|
476
|
+
super.disable();
|
|
477
|
+
if (this.el) {
|
|
478
|
+
this.el.setAttribute('disabled', '');
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Enable help and reflect the state on the `<tf-help>` host
|
|
484
|
+
*/
|
|
485
|
+
enable() {
|
|
486
|
+
super.enable();
|
|
487
|
+
if (this.el) {
|
|
488
|
+
this.el.removeAttribute('disabled');
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
244
492
|
/**
|
|
245
493
|
* Remove help UI
|
|
246
494
|
*/
|
|
@@ -251,8 +499,11 @@ export class Help extends Feature {
|
|
|
251
499
|
removeElm(this.btn);
|
|
252
500
|
this.btn = null;
|
|
253
501
|
|
|
254
|
-
|
|
502
|
+
if (this.cont !== this.el) {
|
|
503
|
+
removeElm(this.cont);
|
|
504
|
+
}
|
|
255
505
|
this.cont = null;
|
|
506
|
+
this.el = null;
|
|
256
507
|
|
|
257
508
|
this.boundMouseup = null;
|
|
258
509
|
this.initialized = false;
|
package/src/number.js
CHANGED
|
@@ -2,11 +2,23 @@ import {isNumber} from './types';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Formats a numeric value with configurable separators and affixes.
|
|
5
|
+
*
|
|
6
|
+
* Supported options: `locale`, `decimal`, `integerSeparator`, `precision`,
|
|
7
|
+
* `round`, `prefix` and `suffix`. The `format-number` options `truncate`,
|
|
8
|
+
* `padLeft`, `padRight`, `negativeType`, `negativeLeftSymbol`,
|
|
9
|
+
* `negativeRightSymbol`, `negativeOut`, `decimalsSeparator` and `noUnits`
|
|
10
|
+
* have no effect. `integerSeparator: null` disables grouping. Values of
|
|
11
|
+
* magnitude 1e21 and above are rendered in full instead of exponential
|
|
12
|
+
* notation.
|
|
13
|
+
*
|
|
14
|
+
* Requires `Intl.NumberFormat.prototype.formatToParts` (Chrome 64+, Edge 79+,
|
|
15
|
+
* Firefox 58+, Safari 11+, Node 10+).
|
|
5
16
|
* @param {Number|String} value Numeric value
|
|
6
17
|
* @param {Object} [options={}] Formatting options
|
|
7
18
|
* @param {String} [options.locale='en'] Intl locale
|
|
8
19
|
* @param {String} [options.decimal] Decimal separator override
|
|
9
|
-
* @param {String} [options.integerSeparator] Thousands separator override
|
|
20
|
+
* @param {String|null} [options.integerSeparator] Thousands separator override:
|
|
21
|
+
* `undefined` uses locale default grouping, `null` or `''` disables grouping
|
|
10
22
|
* @param {Number} [options.precision] Fixed number of fraction digits
|
|
11
23
|
* @param {Number} [options.round] Maximum number of fraction digits
|
|
12
24
|
* @param {String} [options.prefix=''] Value prefix
|