@mtes-mct/monitor-ui 8.0.0 → 8.1.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/CHANGELOG.md +10 -0
- package/index.js +175 -82
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/src/elements/Table/SimpleTable.d.ts +3 -1
- package/src/elements/Table/TableWithSelectableRows.d.ts +10 -0
- package/src/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# [8.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v7.6.2...v8.0.0) (2023-07-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
* build(deps)!: upgrade rsuite ([e17df4c](https://github.com/MTES-MCT/monitor-ui/commit/e17df4c0b8c41ee0803b2596f9a20ec6beab28e7))
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* upgrade rsuite peer deps
|
|
10
|
+
|
|
1
11
|
## [7.6.2](https://github.com/MTES-MCT/monitor-ui/compare/v7.6.1...v7.6.2) (2023-07-17)
|
|
2
12
|
|
|
3
13
|
|
package/index.js
CHANGED
|
@@ -2517,6 +2517,8 @@ class NewWindow extends PureComponent {
|
|
|
2517
2517
|
if (!mounted || !this.container) {
|
|
2518
2518
|
return null;
|
|
2519
2519
|
}
|
|
2520
|
+
// For some reason `ReactNode` type is inconsistent
|
|
2521
|
+
// between `@types/react` (=> `children`) and `react-dom` (=> `ReactDOM.createPortal()`)
|
|
2520
2522
|
return ReactDOM.createPortal(children, this.container);
|
|
2521
2523
|
}
|
|
2522
2524
|
}
|
|
@@ -2687,6 +2689,7 @@ function Notifier({ isSideWindow = false }) {
|
|
|
2687
2689
|
draggable: false }));
|
|
2688
2690
|
}
|
|
2689
2691
|
// TODO Style the notifications with Adeline.
|
|
2692
|
+
// We need to retype `ToastContainer` manually because `styled-components` mess up with the `children` prop
|
|
2690
2693
|
const StyledToastContainer = styled(k) ``;
|
|
2691
2694
|
|
|
2692
2695
|
const ICON_SIZE = {
|
|
@@ -3517,13 +3520,13 @@ const TagGroup = styled.div.attrs(props => ({
|
|
|
3517
3520
|
gap: 8px;
|
|
3518
3521
|
`;
|
|
3519
3522
|
|
|
3520
|
-
const Table = styled.table `
|
|
3523
|
+
const Table$1 = styled.table `
|
|
3521
3524
|
width: 100%;
|
|
3522
3525
|
table-layout: auto;
|
|
3523
3526
|
overflow: auto;
|
|
3524
3527
|
border-collapse: separate;
|
|
3525
3528
|
`;
|
|
3526
|
-
const Head = styled.thead `
|
|
3529
|
+
const Head$1 = styled.thead `
|
|
3527
3530
|
position: sticky;
|
|
3528
3531
|
top: 0;
|
|
3529
3532
|
z-index: 1;
|
|
@@ -3532,7 +3535,7 @@ const Head = styled.thead `
|
|
|
3532
3535
|
border-left: 1px solid ${p => p.theme.color.lightGray};
|
|
3533
3536
|
}
|
|
3534
3537
|
`;
|
|
3535
|
-
const SortContainer = styled.div `
|
|
3538
|
+
const SortContainer$1 = styled.div `
|
|
3536
3539
|
display: flex;
|
|
3537
3540
|
justify-content: space-between;
|
|
3538
3541
|
align-items: center;
|
|
@@ -3542,7 +3545,7 @@ const SortContainer = styled.div `
|
|
|
3542
3545
|
cursor: pointer;
|
|
3543
3546
|
}
|
|
3544
3547
|
`;
|
|
3545
|
-
const Th = styled.th `
|
|
3548
|
+
const Th$1 = styled.th `
|
|
3546
3549
|
background-color: ${p => p.theme.color.gainsboro};
|
|
3547
3550
|
border-top: 1px solid ${p => p.theme.color.lightGray};
|
|
3548
3551
|
border-bottom: 1px solid ${p => p.theme.color.lightGray};
|
|
@@ -3555,26 +3558,21 @@ const Th = styled.th `
|
|
|
3555
3558
|
text-overflow: ellipsis;
|
|
3556
3559
|
white-space: nowrap;
|
|
3557
3560
|
`;
|
|
3558
|
-
const BodyTr = styled.tr `
|
|
3561
|
+
const BodyTr$1 = styled.tr `
|
|
3559
3562
|
:hover {
|
|
3560
|
-
|
|
3563
|
+
> td {
|
|
3564
|
+
background-color: ${p => p.theme.color.blueYonder[25]};
|
|
3565
|
+
}
|
|
3561
3566
|
}
|
|
3562
3567
|
td:first-child {
|
|
3563
3568
|
border-left: 1px solid ${p => p.theme.color.lightGray};
|
|
3564
3569
|
}
|
|
3565
|
-
|
|
3566
|
-
td:nth-child(10) {
|
|
3567
|
-
text-align: center;
|
|
3568
|
-
}
|
|
3569
|
-
td:nth-child(11) {
|
|
3570
|
-
text-align: center;
|
|
3571
|
-
}
|
|
3572
3570
|
`;
|
|
3573
|
-
const Td = styled.td `
|
|
3571
|
+
const Td$1 = styled.td `
|
|
3574
3572
|
font-size: 13px;
|
|
3575
3573
|
font-weight: 500;
|
|
3576
3574
|
color: ${p => p.theme.color.gunMetal};
|
|
3577
|
-
text-align: left;
|
|
3575
|
+
text-align: ${p => (p.$isCenter ? 'center' : 'left')};
|
|
3578
3576
|
border-bottom: 1px solid ${p => p.theme.color.lightGray};
|
|
3579
3577
|
border-right: 1px solid ${p => p.theme.color.lightGray};
|
|
3580
3578
|
overflow: hidden;
|
|
@@ -3583,6 +3581,45 @@ const Td = styled.td `
|
|
|
3583
3581
|
white-space: nowrap;
|
|
3584
3582
|
`;
|
|
3585
3583
|
const SimpleTable = {
|
|
3584
|
+
BodyTr: BodyTr$1,
|
|
3585
|
+
Head: Head$1,
|
|
3586
|
+
SortContainer: SortContainer$1,
|
|
3587
|
+
Table: Table$1,
|
|
3588
|
+
Td: Td$1,
|
|
3589
|
+
Th: Th$1
|
|
3590
|
+
};
|
|
3591
|
+
|
|
3592
|
+
const Table = styled(SimpleTable.Table) `
|
|
3593
|
+
border-collapse: separate;
|
|
3594
|
+
border-spacing: 0 5px;
|
|
3595
|
+
`;
|
|
3596
|
+
const Head = styled(SimpleTable.Head) `
|
|
3597
|
+
th:last-child {
|
|
3598
|
+
border-right: 1px solid ${p => p.theme.color.lightGray};
|
|
3599
|
+
}
|
|
3600
|
+
`;
|
|
3601
|
+
const SortContainer = styled(SimpleTable.SortContainer) `
|
|
3602
|
+
justify-content: start;
|
|
3603
|
+
gap: 8px;
|
|
3604
|
+
`;
|
|
3605
|
+
const Th = styled(SimpleTable.Th) `
|
|
3606
|
+
background-color: ${p => p.theme.color.white};
|
|
3607
|
+
border-top: 1px solid ${p => p.theme.color.lightGray};
|
|
3608
|
+
border-bottom: 1px solid ${p => p.theme.color.lightGray};
|
|
3609
|
+
border-right: none;
|
|
3610
|
+
`;
|
|
3611
|
+
const BodyTr = styled(SimpleTable.BodyTr) `
|
|
3612
|
+
td:last-child {
|
|
3613
|
+
border-right: 1px solid ${p => p.theme.color.lightGray};
|
|
3614
|
+
}
|
|
3615
|
+
`;
|
|
3616
|
+
const Td = styled(SimpleTable.Td) `
|
|
3617
|
+
background-color: ${p => p.theme.color.cultured};
|
|
3618
|
+
border-top: 1px solid ${p => p.theme.color.lightGray};
|
|
3619
|
+
border-right: none;
|
|
3620
|
+
padding: 4px 10px;
|
|
3621
|
+
`;
|
|
3622
|
+
const TableWithSelectableRows = {
|
|
3586
3623
|
BodyTr,
|
|
3587
3624
|
Head,
|
|
3588
3625
|
SortContainer,
|
|
@@ -31469,7 +31506,7 @@ function isString(str) {
|
|
|
31469
31506
|
/** Checks if value is object */
|
|
31470
31507
|
function isObject(obj) {
|
|
31471
31508
|
var _obj$constructor;
|
|
31472
|
-
return typeof obj === 'object' && obj != null && (obj == null
|
|
31509
|
+
return typeof obj === 'object' && obj != null && (obj == null || (_obj$constructor = obj.constructor) == null ? void 0 : _obj$constructor.name) === 'Object';
|
|
31473
31510
|
}
|
|
31474
31511
|
function pick(obj, keys) {
|
|
31475
31512
|
if (Array.isArray(keys)) return pick(obj, (_, k) => keys.includes(k));
|
|
@@ -32418,7 +32455,7 @@ class Masked {
|
|
|
32418
32455
|
|
|
32419
32456
|
/** Value that includes raw user input */
|
|
32420
32457
|
get rawInputValue() {
|
|
32421
|
-
return this.extractInput(0, this.
|
|
32458
|
+
return this.extractInput(0, this.displayValue.length, {
|
|
32422
32459
|
raw: true
|
|
32423
32460
|
});
|
|
32424
32461
|
}
|
|
@@ -32446,9 +32483,9 @@ class Masked {
|
|
|
32446
32483
|
fromPos = 0;
|
|
32447
32484
|
}
|
|
32448
32485
|
if (toPos === void 0) {
|
|
32449
|
-
toPos = this.
|
|
32486
|
+
toPos = this.displayValue.length;
|
|
32450
32487
|
}
|
|
32451
|
-
return Math.min(this.
|
|
32488
|
+
return Math.min(this.displayValue.length, toPos - fromPos);
|
|
32452
32489
|
}
|
|
32453
32490
|
|
|
32454
32491
|
/** Extracts value in range considering flags */
|
|
@@ -32457,9 +32494,9 @@ class Masked {
|
|
|
32457
32494
|
fromPos = 0;
|
|
32458
32495
|
}
|
|
32459
32496
|
if (toPos === void 0) {
|
|
32460
|
-
toPos = this.
|
|
32497
|
+
toPos = this.displayValue.length;
|
|
32461
32498
|
}
|
|
32462
|
-
return this.
|
|
32499
|
+
return this.displayValue.slice(fromPos, toPos);
|
|
32463
32500
|
}
|
|
32464
32501
|
|
|
32465
32502
|
/** Extracts tail in range */
|
|
@@ -32468,7 +32505,7 @@ class Masked {
|
|
|
32468
32505
|
fromPos = 0;
|
|
32469
32506
|
}
|
|
32470
32507
|
if (toPos === void 0) {
|
|
32471
|
-
toPos = this.
|
|
32508
|
+
toPos = this.displayValue.length;
|
|
32472
32509
|
}
|
|
32473
32510
|
return new ContinuousTailDetails(this.extractInput(fromPos, toPos), fromPos);
|
|
32474
32511
|
}
|
|
@@ -32506,7 +32543,7 @@ class Masked {
|
|
|
32506
32543
|
const beforeTailState = this.state;
|
|
32507
32544
|
if (this.overwrite === true) {
|
|
32508
32545
|
consistentTail = checkTail.state;
|
|
32509
|
-
checkTail.unshift(this.
|
|
32546
|
+
checkTail.unshift(this.displayValue.length - details.tailShift);
|
|
32510
32547
|
}
|
|
32511
32548
|
let tailDetails = this.appendTail(checkTail);
|
|
32512
32549
|
appended = tailDetails.rawInserted === checkTail.toString();
|
|
@@ -32575,9 +32612,9 @@ class Masked {
|
|
|
32575
32612
|
fromPos = 0;
|
|
32576
32613
|
}
|
|
32577
32614
|
if (toPos === void 0) {
|
|
32578
|
-
toPos = this.
|
|
32615
|
+
toPos = this.displayValue.length;
|
|
32579
32616
|
}
|
|
32580
|
-
this._value = this.
|
|
32617
|
+
this._value = this.displayValue.slice(0, fromPos) + this.displayValue.slice(toPos);
|
|
32581
32618
|
return new ChangeDetails();
|
|
32582
32619
|
}
|
|
32583
32620
|
|
|
@@ -32591,7 +32628,7 @@ class Masked {
|
|
|
32591
32628
|
this.rawInputValue = rawInput;
|
|
32592
32629
|
// append lost trailing chars at the end
|
|
32593
32630
|
if (this.value && this.value !== value && value.indexOf(this.value) === 0) {
|
|
32594
|
-
this.append(value.slice(this.
|
|
32631
|
+
this.append(value.slice(this.displayValue.length), {}, '');
|
|
32595
32632
|
}
|
|
32596
32633
|
delete this._refreshing;
|
|
32597
32634
|
return ret;
|
|
@@ -32667,7 +32704,7 @@ class Masked {
|
|
|
32667
32704
|
if (eagerRemove && removeDirection !== DIRECTION.NONE && oldRawValue === this.rawInputValue) {
|
|
32668
32705
|
if (removeDirection === DIRECTION.FORCE_LEFT) {
|
|
32669
32706
|
let valLength;
|
|
32670
|
-
while (oldRawValue === this.rawInputValue && (valLength = this.
|
|
32707
|
+
while (oldRawValue === this.rawInputValue && (valLength = this.displayValue.length)) {
|
|
32671
32708
|
details.aggregate(new ChangeDetails({
|
|
32672
32709
|
tailShift: -1
|
|
32673
32710
|
})).aggregate(this.remove(valLength - 1));
|
|
@@ -32753,7 +32790,7 @@ class ChunksTailDetails {
|
|
|
32753
32790
|
const details = new ChangeDetails();
|
|
32754
32791
|
for (let ci = 0; ci < this.chunks.length && !details.skip; ++ci) {
|
|
32755
32792
|
const chunk = this.chunks[ci];
|
|
32756
|
-
const lastBlockIter = masked._mapPosToBlock(masked.
|
|
32793
|
+
const lastBlockIter = masked._mapPosToBlock(masked.displayValue.length);
|
|
32757
32794
|
const stop = chunk.stop;
|
|
32758
32795
|
let chunkBlock;
|
|
32759
32796
|
if (stop != null && (
|
|
@@ -32901,13 +32938,13 @@ class PatternCursor {
|
|
|
32901
32938
|
}
|
|
32902
32939
|
if (this.index >= this.masked._blocks.length) {
|
|
32903
32940
|
this.index = this.masked._blocks.length - 1;
|
|
32904
|
-
this.offset = this.block.
|
|
32941
|
+
this.offset = this.block.displayValue.length; // TODO this is stupid type error, `block` depends on index that was changed above
|
|
32905
32942
|
}
|
|
32906
32943
|
}
|
|
32907
32944
|
|
|
32908
32945
|
_pushLeft(fn) {
|
|
32909
32946
|
this.pushState();
|
|
32910
|
-
for (this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((_this$block = this.block) == null ? void 0 : _this$block.
|
|
32947
|
+
for (this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((_this$block = this.block) == null ? void 0 : _this$block.displayValue.length) || 0) {
|
|
32911
32948
|
var _this$block;
|
|
32912
32949
|
if (fn()) return this.ok = true;
|
|
32913
32950
|
}
|
|
@@ -33284,7 +33321,7 @@ class PatternInputDefinition {
|
|
|
33284
33321
|
var _flags$_beforeTailSta;
|
|
33285
33322
|
return {
|
|
33286
33323
|
...flags,
|
|
33287
|
-
_beforeTailState: (flags == null
|
|
33324
|
+
_beforeTailState: (flags == null || (_flags$_beforeTailSta = flags._beforeTailState) == null ? void 0 : _flags$_beforeTailSta.masked) || (flags == null ? void 0 : flags._beforeTailState)
|
|
33288
33325
|
};
|
|
33289
33326
|
}
|
|
33290
33327
|
}
|
|
@@ -33352,6 +33389,7 @@ class MaskedPattern extends Masked {
|
|
|
33352
33389
|
_rebuildMask() {
|
|
33353
33390
|
const defs = this.definitions;
|
|
33354
33391
|
this._blocks = [];
|
|
33392
|
+
this.exposeBlock = undefined;
|
|
33355
33393
|
this._stops = [];
|
|
33356
33394
|
this._maskedBlocks = {};
|
|
33357
33395
|
const pattern = this.mask;
|
|
@@ -33367,17 +33405,22 @@ class MaskedPattern extends Masked {
|
|
|
33367
33405
|
// use block name with max length
|
|
33368
33406
|
const bName = bNames[0];
|
|
33369
33407
|
if (bName) {
|
|
33408
|
+
const {
|
|
33409
|
+
expose,
|
|
33410
|
+
...blockOpts
|
|
33411
|
+
} = normalizeOpts(this.blocks[bName]);
|
|
33370
33412
|
const maskedBlock = createMask({
|
|
33371
33413
|
lazy: this.lazy,
|
|
33372
33414
|
eager: this.eager,
|
|
33373
33415
|
placeholderChar: this.placeholderChar,
|
|
33374
33416
|
displayChar: this.displayChar,
|
|
33375
33417
|
overwrite: this.overwrite,
|
|
33376
|
-
...
|
|
33418
|
+
...blockOpts,
|
|
33377
33419
|
parent: this
|
|
33378
33420
|
});
|
|
33379
33421
|
if (maskedBlock) {
|
|
33380
33422
|
this._blocks.push(maskedBlock);
|
|
33423
|
+
if (expose) this.exposeBlock = maskedBlock;
|
|
33381
33424
|
|
|
33382
33425
|
// store block index
|
|
33383
33426
|
if (!this._maskedBlocks[bName]) this._maskedBlocks[bName] = [];
|
|
@@ -33442,7 +33485,7 @@ class MaskedPattern extends Masked {
|
|
|
33442
33485
|
this._blocks.forEach(b => b.reset());
|
|
33443
33486
|
}
|
|
33444
33487
|
get isComplete() {
|
|
33445
|
-
return this._blocks.every(b => b.isComplete);
|
|
33488
|
+
return this.exposeBlock ? this.exposeBlock.isComplete : this._blocks.every(b => b.isComplete);
|
|
33446
33489
|
}
|
|
33447
33490
|
get isFilled() {
|
|
33448
33491
|
return this._blocks.every(b => b.isFilled);
|
|
@@ -33458,17 +33501,39 @@ class MaskedPattern extends Masked {
|
|
|
33458
33501
|
super.doCommit();
|
|
33459
33502
|
}
|
|
33460
33503
|
get unmaskedValue() {
|
|
33461
|
-
return this._blocks.reduce((str, b) => str += b.unmaskedValue, '');
|
|
33504
|
+
return this.exposeBlock ? this.exposeBlock.unmaskedValue : this._blocks.reduce((str, b) => str += b.unmaskedValue, '');
|
|
33462
33505
|
}
|
|
33463
33506
|
set unmaskedValue(unmaskedValue) {
|
|
33464
|
-
|
|
33507
|
+
if (this.exposeBlock) {
|
|
33508
|
+
const tail = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
|
|
33509
|
+
this.exposeBlock.unmaskedValue = unmaskedValue;
|
|
33510
|
+
this.appendTail(tail);
|
|
33511
|
+
this.doCommit();
|
|
33512
|
+
} else super.unmaskedValue = unmaskedValue;
|
|
33465
33513
|
}
|
|
33466
33514
|
get value() {
|
|
33515
|
+
return this.exposeBlock ? this.exposeBlock.value :
|
|
33467
33516
|
// TODO return _value when not in change?
|
|
33468
|
-
|
|
33517
|
+
this._blocks.reduce((str, b) => str += b.value, '');
|
|
33469
33518
|
}
|
|
33470
33519
|
set value(value) {
|
|
33471
|
-
|
|
33520
|
+
if (this.exposeBlock) {
|
|
33521
|
+
const tail = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
|
|
33522
|
+
this.exposeBlock.value = value;
|
|
33523
|
+
this.appendTail(tail);
|
|
33524
|
+
this.doCommit();
|
|
33525
|
+
} else super.value = value;
|
|
33526
|
+
}
|
|
33527
|
+
get typedValue() {
|
|
33528
|
+
return this.exposeBlock ? this.exposeBlock.typedValue : super.typedValue;
|
|
33529
|
+
}
|
|
33530
|
+
set typedValue(value) {
|
|
33531
|
+
if (this.exposeBlock) {
|
|
33532
|
+
const tail = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
|
|
33533
|
+
this.exposeBlock.typedValue = value;
|
|
33534
|
+
this.appendTail(tail);
|
|
33535
|
+
this.doCommit();
|
|
33536
|
+
} else super.typedValue = value;
|
|
33472
33537
|
}
|
|
33473
33538
|
get displayValue() {
|
|
33474
33539
|
return this._blocks.reduce((str, b) => str += b.displayValue, '');
|
|
@@ -33479,7 +33544,7 @@ class MaskedPattern extends Masked {
|
|
|
33479
33544
|
_appendEager() {
|
|
33480
33545
|
var _this$_mapPosToBlock;
|
|
33481
33546
|
const details = new ChangeDetails();
|
|
33482
|
-
let startBlockIndex = (_this$_mapPosToBlock = this._mapPosToBlock(this.
|
|
33547
|
+
let startBlockIndex = (_this$_mapPosToBlock = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : _this$_mapPosToBlock.index;
|
|
33483
33548
|
if (startBlockIndex == null) return details;
|
|
33484
33549
|
|
|
33485
33550
|
// TODO test if it works for nested pattern masks
|
|
@@ -33495,16 +33560,16 @@ class MaskedPattern extends Masked {
|
|
|
33495
33560
|
if (flags === void 0) {
|
|
33496
33561
|
flags = {};
|
|
33497
33562
|
}
|
|
33498
|
-
const blockIter = this._mapPosToBlock(this.
|
|
33563
|
+
const blockIter = this._mapPosToBlock(this.displayValue.length);
|
|
33499
33564
|
const details = new ChangeDetails();
|
|
33500
33565
|
if (!blockIter) return details;
|
|
33501
33566
|
for (let bi = blockIter.index;; ++bi) {
|
|
33502
|
-
var _flags$_beforeTailSta
|
|
33567
|
+
var _flags$_beforeTailSta;
|
|
33503
33568
|
const block = this._blocks[bi];
|
|
33504
33569
|
if (!block) break;
|
|
33505
33570
|
const blockDetails = block._appendChar(ch, {
|
|
33506
33571
|
...flags,
|
|
33507
|
-
_beforeTailState: (_flags$_beforeTailSta = flags._beforeTailState) == null
|
|
33572
|
+
_beforeTailState: (_flags$_beforeTailSta = flags._beforeTailState) == null || (_flags$_beforeTailSta = _flags$_beforeTailSta._blocks) == null ? void 0 : _flags$_beforeTailSta[bi]
|
|
33508
33573
|
});
|
|
33509
33574
|
const skip = blockDetails.skip;
|
|
33510
33575
|
details.aggregate(blockDetails);
|
|
@@ -33518,7 +33583,7 @@ class MaskedPattern extends Masked {
|
|
|
33518
33583
|
fromPos = 0;
|
|
33519
33584
|
}
|
|
33520
33585
|
if (toPos === void 0) {
|
|
33521
|
-
toPos = this.
|
|
33586
|
+
toPos = this.displayValue.length;
|
|
33522
33587
|
}
|
|
33523
33588
|
const chunkTail = new ChunksTailDetails();
|
|
33524
33589
|
if (fromPos === toPos) return chunkTail;
|
|
@@ -33536,7 +33601,7 @@ class MaskedPattern extends Masked {
|
|
|
33536
33601
|
fromPos = 0;
|
|
33537
33602
|
}
|
|
33538
33603
|
if (toPos === void 0) {
|
|
33539
|
-
toPos = this.
|
|
33604
|
+
toPos = this.displayValue.length;
|
|
33540
33605
|
}
|
|
33541
33606
|
if (flags === void 0) {
|
|
33542
33607
|
flags = {};
|
|
@@ -33561,7 +33626,7 @@ class MaskedPattern extends Masked {
|
|
|
33561
33626
|
_appendPlaceholder(toBlockIndex) {
|
|
33562
33627
|
const details = new ChangeDetails();
|
|
33563
33628
|
if (this.lazy && toBlockIndex == null) return details;
|
|
33564
|
-
const startBlockIter = this._mapPosToBlock(this.
|
|
33629
|
+
const startBlockIter = this._mapPosToBlock(this.displayValue.length);
|
|
33565
33630
|
if (!startBlockIter) return details;
|
|
33566
33631
|
const startBlockIndex = startBlockIter.index;
|
|
33567
33632
|
const endBlockIndex = toBlockIndex != null ? toBlockIndex : this._blocks.length;
|
|
@@ -33582,7 +33647,7 @@ class MaskedPattern extends Masked {
|
|
|
33582
33647
|
for (let bi = 0; bi < this._blocks.length; ++bi) {
|
|
33583
33648
|
const block = this._blocks[bi];
|
|
33584
33649
|
const blockStartPos = accVal.length;
|
|
33585
|
-
accVal += block.
|
|
33650
|
+
accVal += block.displayValue;
|
|
33586
33651
|
if (pos <= accVal.length) {
|
|
33587
33652
|
return {
|
|
33588
33653
|
index: bi,
|
|
@@ -33592,11 +33657,11 @@ class MaskedPattern extends Masked {
|
|
|
33592
33657
|
}
|
|
33593
33658
|
}
|
|
33594
33659
|
_blockStartPos(blockIndex) {
|
|
33595
|
-
return this._blocks.slice(0, blockIndex).reduce((pos, b) => pos += b.
|
|
33660
|
+
return this._blocks.slice(0, blockIndex).reduce((pos, b) => pos += b.displayValue.length, 0);
|
|
33596
33661
|
}
|
|
33597
33662
|
_forEachBlocksInRange(fromPos, toPos, fn) {
|
|
33598
33663
|
if (toPos === void 0) {
|
|
33599
|
-
toPos = this.
|
|
33664
|
+
toPos = this.displayValue.length;
|
|
33600
33665
|
}
|
|
33601
33666
|
const fromBlockIter = this._mapPosToBlock(fromPos);
|
|
33602
33667
|
if (fromBlockIter) {
|
|
@@ -33604,12 +33669,12 @@ class MaskedPattern extends Masked {
|
|
|
33604
33669
|
// process first block
|
|
33605
33670
|
const isSameBlock = toBlockIter && fromBlockIter.index === toBlockIter.index;
|
|
33606
33671
|
const fromBlockStartPos = fromBlockIter.offset;
|
|
33607
|
-
const fromBlockEndPos = toBlockIter && isSameBlock ? toBlockIter.offset : this._blocks[fromBlockIter.index].
|
|
33672
|
+
const fromBlockEndPos = toBlockIter && isSameBlock ? toBlockIter.offset : this._blocks[fromBlockIter.index].displayValue.length;
|
|
33608
33673
|
fn(this._blocks[fromBlockIter.index], fromBlockIter.index, fromBlockStartPos, fromBlockEndPos);
|
|
33609
33674
|
if (toBlockIter && !isSameBlock) {
|
|
33610
33675
|
// process intermediate blocks
|
|
33611
33676
|
for (let bi = fromBlockIter.index + 1; bi < toBlockIter.index; ++bi) {
|
|
33612
|
-
fn(this._blocks[bi], bi, 0, this._blocks[bi].
|
|
33677
|
+
fn(this._blocks[bi], bi, 0, this._blocks[bi].displayValue.length);
|
|
33613
33678
|
}
|
|
33614
33679
|
|
|
33615
33680
|
// process last block
|
|
@@ -33622,7 +33687,7 @@ class MaskedPattern extends Masked {
|
|
|
33622
33687
|
fromPos = 0;
|
|
33623
33688
|
}
|
|
33624
33689
|
if (toPos === void 0) {
|
|
33625
|
-
toPos = this.
|
|
33690
|
+
toPos = this.displayValue.length;
|
|
33626
33691
|
}
|
|
33627
33692
|
const removeDetails = super.remove(fromPos, toPos);
|
|
33628
33693
|
this._forEachBlocksInRange(fromPos, toPos, (b, _, bFromPos, bToPos) => {
|
|
@@ -33643,7 +33708,7 @@ class MaskedPattern extends Masked {
|
|
|
33643
33708
|
if (cursor.pushRightBeforeInput()) return cursor.pos;
|
|
33644
33709
|
cursor.popState();
|
|
33645
33710
|
if (cursor.pushLeftBeforeInput()) return cursor.pos;
|
|
33646
|
-
return this.
|
|
33711
|
+
return this.displayValue.length;
|
|
33647
33712
|
}
|
|
33648
33713
|
|
|
33649
33714
|
// FORCE is only about a|* otherwise is 0
|
|
@@ -33682,7 +33747,7 @@ class MaskedPattern extends Masked {
|
|
|
33682
33747
|
cursor.pushRightBeforeInput();
|
|
33683
33748
|
cursor.pushRightBeforeRequired();
|
|
33684
33749
|
if (cursor.pushRightBeforeFilled()) return cursor.pos;
|
|
33685
|
-
if (direction === DIRECTION.FORCE_RIGHT) return this.
|
|
33750
|
+
if (direction === DIRECTION.FORCE_RIGHT) return this.displayValue.length;
|
|
33686
33751
|
|
|
33687
33752
|
// backward flow
|
|
33688
33753
|
cursor.popState();
|
|
@@ -33698,7 +33763,7 @@ class MaskedPattern extends Masked {
|
|
|
33698
33763
|
fromPos = 0;
|
|
33699
33764
|
}
|
|
33700
33765
|
if (toPos === void 0) {
|
|
33701
|
-
toPos = this.
|
|
33766
|
+
toPos = this.displayValue.length;
|
|
33702
33767
|
}
|
|
33703
33768
|
let total = 0;
|
|
33704
33769
|
this._forEachBlocksInRange(fromPos, toPos, (b, _, bFromPos, bToPos) => {
|
|
@@ -33950,6 +34015,8 @@ IMask.MaskedDate = MaskedDate;
|
|
|
33950
34015
|
class MaskedDynamic extends Masked {
|
|
33951
34016
|
/** Currently chosen mask */
|
|
33952
34017
|
|
|
34018
|
+
/** Currently chosen mask */
|
|
34019
|
+
|
|
33953
34020
|
/** Compliled {@link Masked} options */
|
|
33954
34021
|
|
|
33955
34022
|
/** Chooses {@link Masked} depending on input value */
|
|
@@ -33967,13 +34034,22 @@ class MaskedDynamic extends Masked {
|
|
|
33967
34034
|
_update(opts) {
|
|
33968
34035
|
super._update(opts);
|
|
33969
34036
|
if ('mask' in opts) {
|
|
34037
|
+
this.exposeMask = undefined;
|
|
33970
34038
|
// mask could be totally dynamic with only `dispatch` option
|
|
33971
|
-
this.compiledMasks = Array.isArray(opts.mask) ? opts.mask.map(m =>
|
|
33972
|
-
|
|
33973
|
-
|
|
33974
|
-
|
|
33975
|
-
|
|
33976
|
-
|
|
34039
|
+
this.compiledMasks = Array.isArray(opts.mask) ? opts.mask.map(m => {
|
|
34040
|
+
const {
|
|
34041
|
+
expose,
|
|
34042
|
+
...maskOpts
|
|
34043
|
+
} = normalizeOpts(m);
|
|
34044
|
+
const masked = createMask({
|
|
34045
|
+
overwrite: this._overwrite,
|
|
34046
|
+
eager: this._eager,
|
|
34047
|
+
skipInvalid: this._skipInvalid,
|
|
34048
|
+
...maskOpts
|
|
34049
|
+
});
|
|
34050
|
+
if (expose) this.exposeMask = masked;
|
|
34051
|
+
return masked;
|
|
34052
|
+
}) : [];
|
|
33977
34053
|
|
|
33978
34054
|
// this.currentMask = this.doDispatch(''); // probably not needed but lets see
|
|
33979
34055
|
}
|
|
@@ -34105,28 +34181,40 @@ class MaskedDynamic extends Masked {
|
|
|
34105
34181
|
this.compiledMasks.forEach(m => m.reset());
|
|
34106
34182
|
}
|
|
34107
34183
|
get value() {
|
|
34108
|
-
return this.currentMask ? this.currentMask.value : '';
|
|
34184
|
+
return this.exposeMask ? this.exposeMask.value : this.currentMask ? this.currentMask.value : '';
|
|
34109
34185
|
}
|
|
34110
34186
|
set value(value) {
|
|
34111
|
-
|
|
34187
|
+
if (this.exposeMask) {
|
|
34188
|
+
this.exposeMask.value = value;
|
|
34189
|
+
this.currentMask = this.exposeMask;
|
|
34190
|
+
this._applyDispatch();
|
|
34191
|
+
} else super.value = value;
|
|
34112
34192
|
}
|
|
34113
34193
|
get unmaskedValue() {
|
|
34114
|
-
return this.currentMask ? this.currentMask.unmaskedValue : '';
|
|
34194
|
+
return this.exposeMask ? this.exposeMask.unmaskedValue : this.currentMask ? this.currentMask.unmaskedValue : '';
|
|
34115
34195
|
}
|
|
34116
34196
|
set unmaskedValue(unmaskedValue) {
|
|
34117
|
-
|
|
34197
|
+
if (this.exposeMask) {
|
|
34198
|
+
this.exposeMask.unmaskedValue = unmaskedValue;
|
|
34199
|
+
this.currentMask = this.exposeMask;
|
|
34200
|
+
this._applyDispatch();
|
|
34201
|
+
} else super.unmaskedValue = unmaskedValue;
|
|
34118
34202
|
}
|
|
34119
34203
|
get typedValue() {
|
|
34120
|
-
return this.currentMask ? this.currentMask.typedValue : '';
|
|
34204
|
+
return this.exposeMask ? this.exposeMask.typedValue : this.currentMask ? this.currentMask.typedValue : '';
|
|
34121
34205
|
}
|
|
34122
|
-
|
|
34123
|
-
|
|
34124
|
-
|
|
34125
|
-
|
|
34206
|
+
set typedValue(typedValue) {
|
|
34207
|
+
if (this.exposeMask) {
|
|
34208
|
+
this.exposeMask.typedValue = typedValue;
|
|
34209
|
+
this.currentMask = this.exposeMask;
|
|
34210
|
+
this._applyDispatch();
|
|
34211
|
+
return;
|
|
34212
|
+
}
|
|
34213
|
+
let unmaskedValue = String(typedValue);
|
|
34126
34214
|
|
|
34127
34215
|
// double check it
|
|
34128
34216
|
if (this.currentMask) {
|
|
34129
|
-
this.currentMask.typedValue =
|
|
34217
|
+
this.currentMask.typedValue = typedValue;
|
|
34130
34218
|
unmaskedValue = this.currentMask.unmaskedValue;
|
|
34131
34219
|
}
|
|
34132
34220
|
this.unmaskedValue = unmaskedValue;
|
|
@@ -34230,7 +34318,7 @@ MaskedDynamic.DEFAULTS = {
|
|
|
34230
34318
|
// simulate input
|
|
34231
34319
|
const inputs = masked.compiledMasks.map((m, index) => {
|
|
34232
34320
|
const isCurrent = masked.currentMask === m;
|
|
34233
|
-
const startInputPos = isCurrent ? m.
|
|
34321
|
+
const startInputPos = isCurrent ? m.displayValue.length : m.nearestInputPos(m.displayValue.length, DIRECTION.FORCE_LEFT);
|
|
34234
34322
|
if (m.rawInputValue !== inputValue) {
|
|
34235
34323
|
m.reset();
|
|
34236
34324
|
m.append(inputValue, {
|
|
@@ -34244,7 +34332,7 @@ MaskedDynamic.DEFAULTS = {
|
|
|
34244
34332
|
return {
|
|
34245
34333
|
index,
|
|
34246
34334
|
weight: m.rawInputValue.length,
|
|
34247
|
-
totalInputPositions: m.totalInputPositions(0, Math.max(startInputPos, m.nearestInputPos(m.
|
|
34335
|
+
totalInputPositions: m.totalInputPositions(0, Math.max(startInputPos, m.nearestInputPos(m.displayValue.length, DIRECTION.FORCE_LEFT)))
|
|
34248
34336
|
};
|
|
34249
34337
|
});
|
|
34250
34338
|
|
|
@@ -34257,6 +34345,10 @@ IMask.MaskedDynamic = MaskedDynamic;
|
|
|
34257
34345
|
|
|
34258
34346
|
/** Pattern which validates enum values */
|
|
34259
34347
|
class MaskedEnum extends MaskedPattern {
|
|
34348
|
+
constructor(opts) {
|
|
34349
|
+
super(opts); // mask will be created in _update
|
|
34350
|
+
}
|
|
34351
|
+
|
|
34260
34352
|
updateOptions(opts) {
|
|
34261
34353
|
super.updateOptions(opts);
|
|
34262
34354
|
}
|
|
@@ -34266,13 +34358,17 @@ class MaskedEnum extends MaskedPattern {
|
|
|
34266
34358
|
...eopts
|
|
34267
34359
|
} = opts;
|
|
34268
34360
|
if (_enum) {
|
|
34269
|
-
|
|
34361
|
+
const lengths = _enum.map(e => e.length);
|
|
34362
|
+
const requiredLength = Math.min(...lengths);
|
|
34363
|
+
const optionalLength = Math.max(...lengths) - requiredLength;
|
|
34364
|
+
eopts.mask = '*'.repeat(requiredLength);
|
|
34365
|
+
if (optionalLength) eopts.mask += '[' + '*'.repeat(optionalLength) + ']';
|
|
34270
34366
|
this.enum = _enum;
|
|
34271
34367
|
}
|
|
34272
34368
|
super._update(eopts);
|
|
34273
34369
|
}
|
|
34274
34370
|
doValidate(flags) {
|
|
34275
|
-
return this.enum.some(e => e.indexOf(this.unmaskedValue)
|
|
34371
|
+
return this.enum.some(e => e.indexOf(this.unmaskedValue) === 0) && super.doValidate(flags);
|
|
34276
34372
|
}
|
|
34277
34373
|
}
|
|
34278
34374
|
IMask.MaskedEnum = MaskedEnum;
|
|
@@ -34299,9 +34395,7 @@ class MaskedFunction extends Masked {
|
|
|
34299
34395
|
}
|
|
34300
34396
|
IMask.MaskedFunction = MaskedFunction;
|
|
34301
34397
|
|
|
34302
|
-
/**
|
|
34303
|
-
Number mask
|
|
34304
|
-
*/
|
|
34398
|
+
/** Number mask */
|
|
34305
34399
|
class MaskedNumber extends Masked {
|
|
34306
34400
|
/** Single char */
|
|
34307
34401
|
|
|
@@ -34363,7 +34457,7 @@ class MaskedNumber extends Masked {
|
|
|
34363
34457
|
if (flags === void 0) {
|
|
34364
34458
|
flags = {};
|
|
34365
34459
|
}
|
|
34366
|
-
|
|
34460
|
+
const [prepCh, details] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && (
|
|
34367
34461
|
/*
|
|
34368
34462
|
radix should be mapped when
|
|
34369
34463
|
1) input is done from keyboard = flags.input && flags.raw
|
|
@@ -34372,8 +34466,7 @@ class MaskedNumber extends Masked {
|
|
|
34372
34466
|
1) value is set = flags.input && !flags.raw
|
|
34373
34467
|
2) raw value is set = !flags.input && flags.raw
|
|
34374
34468
|
*/
|
|
34375
|
-
flags.input && flags.raw || !flags.input && !flags.raw) ? ch.replace(this._mapToRadixRegExp, this.radix) : ch);
|
|
34376
|
-
const [prepCh, details] = super.doPrepareChar(ch, flags);
|
|
34469
|
+
flags.input && flags.raw || !flags.input && !flags.raw) ? ch.replace(this._mapToRadixRegExp, this.radix) : ch), flags);
|
|
34377
34470
|
if (ch && !prepCh) details.skip = true;
|
|
34378
34471
|
if (prepCh && !this.allowPositive && !this.value && prepCh !== '-') details.aggregate(this._appendChar('-'));
|
|
34379
34472
|
return [prepCh, details];
|
|
@@ -34402,7 +34495,7 @@ class MaskedNumber extends Masked {
|
|
|
34402
34495
|
fromPos = 0;
|
|
34403
34496
|
}
|
|
34404
34497
|
if (toPos === void 0) {
|
|
34405
|
-
toPos = this.
|
|
34498
|
+
toPos = this.displayValue.length;
|
|
34406
34499
|
}
|
|
34407
34500
|
[fromPos, toPos] = this._adjustRangeWithSeparators(fromPos, toPos);
|
|
34408
34501
|
return this._removeThousandsSeparators(super.extractInput(fromPos, toPos, flags));
|
|
@@ -34443,7 +34536,7 @@ class MaskedNumber extends Masked {
|
|
|
34443
34536
|
fromPos = 0;
|
|
34444
34537
|
}
|
|
34445
34538
|
if (toPos === void 0) {
|
|
34446
|
-
toPos = this.
|
|
34539
|
+
toPos = this.displayValue.length;
|
|
34447
34540
|
}
|
|
34448
34541
|
[fromPos, toPos] = this._adjustRangeWithSeparators(fromPos, toPos);
|
|
34449
34542
|
const valueBeforePos = this.value.slice(0, fromPos);
|
|
@@ -36326,5 +36419,5 @@ function logSoftError({ context = {}, isSideWindowError = false, message, origin
|
|
|
36326
36419
|
}
|
|
36327
36420
|
}
|
|
36328
36421
|
|
|
36329
|
-
export { Accent, Button$1 as Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, FieldError, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NotificationEvent, Notifier, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SideMenu, SimpleTable, SingleTag, Size, THEME, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, logSoftError, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
|
|
36422
|
+
export { Accent, Button$1 as Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, FieldError, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NotificationEvent, Notifier, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SideMenu, SimpleTable, SingleTag, Size, THEME, TableWithSelectableRows, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, logSoftError, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
|
|
36330
36423
|
//# sourceMappingURL=index.js.map
|