@ni/ok-components 1.17.0 → 1.18.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/dist/all-components-bundle.js +101 -0
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1572 -1556
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +697 -581
- package/dist/custom-elements.md +92 -76
- package/dist/esm/fv/all-fv.d.ts +1 -0
- package/dist/esm/fv/all-fv.js +1 -0
- package/dist/esm/fv/all-fv.js.map +1 -1
- package/dist/esm/fv/text-field/index.d.ts +39 -0
- package/dist/esm/fv/text-field/index.js +111 -0
- package/dist/esm/fv/text-field/index.js.map +1 -0
- package/package.json +1 -1
package/dist/custom-elements.md
CHANGED
|
@@ -8,6 +8,22 @@
|
|
|
8
8
|
|
|
9
9
|
<hr/>
|
|
10
10
|
|
|
11
|
+
## class: `TsIconDynamic`
|
|
12
|
+
|
|
13
|
+
### Superclass
|
|
14
|
+
|
|
15
|
+
| Name | Module | Package |
|
|
16
|
+
| ------ | ------ | ---------------------------------------- |
|
|
17
|
+
| `Icon` | | @ni/nimble-components/dist/esm/icon-base |
|
|
18
|
+
|
|
19
|
+
### Static Methods
|
|
20
|
+
|
|
21
|
+
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
22
|
+
| --------------------- | ------- | ----------- | ------------------------------ | ------ | -------------- |
|
|
23
|
+
| `registerIconDynamic` | public | | `tagName: string, url: string` | `void` | |
|
|
24
|
+
|
|
25
|
+
<hr/>
|
|
26
|
+
|
|
11
27
|
## class: `FvAccordionItem`
|
|
12
28
|
|
|
13
29
|
### Superclass
|
|
@@ -506,6 +522,43 @@
|
|
|
506
522
|
|
|
507
523
|
<hr/>
|
|
508
524
|
|
|
525
|
+
## class: `FvSplitButton`
|
|
526
|
+
|
|
527
|
+
### Superclass
|
|
528
|
+
|
|
529
|
+
| Name | Module | Package |
|
|
530
|
+
| ------------------- | ------ | ------------------- |
|
|
531
|
+
| `FoundationElement` | | @ni/fast-foundation |
|
|
532
|
+
|
|
533
|
+
### Fields
|
|
534
|
+
|
|
535
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
536
|
+
| ------------------- | ------- | ------------------------------------ | -------------------- | ----------- | -------------- |
|
|
537
|
+
| `label` | public | `string` | `'Primary function'` | | |
|
|
538
|
+
| `disabled` | public | `boolean` | `false` | | |
|
|
539
|
+
| `open` | public | `boolean` | `false` | | |
|
|
540
|
+
| `appearance` | public | `FvSplitButtonAppearanceType` | | | |
|
|
541
|
+
| `appearanceVariant` | public | `FvSplitButtonAppearanceVariantType` | | | |
|
|
542
|
+
|
|
543
|
+
### Events
|
|
544
|
+
|
|
545
|
+
| Name | Type | Description | Inherited From |
|
|
546
|
+
| --------- | ------------- | ----------- | -------------- |
|
|
547
|
+
| `trigger` | `CustomEvent` | | |
|
|
548
|
+
| `toggle` | `CustomEvent` | | |
|
|
549
|
+
|
|
550
|
+
### Attributes
|
|
551
|
+
|
|
552
|
+
| Name | Field | Inherited From |
|
|
553
|
+
| -------------------- | ----------------- | -------------- |
|
|
554
|
+
| `label` | label | |
|
|
555
|
+
| `disabled` | disabled | |
|
|
556
|
+
| `open` | open | |
|
|
557
|
+
| `appearance` | appearance | |
|
|
558
|
+
| `appearance-variant` | appearanceVariant | |
|
|
559
|
+
|
|
560
|
+
<hr/>
|
|
561
|
+
|
|
509
562
|
## class: `FvSplitButtonAnchor`
|
|
510
563
|
|
|
511
564
|
### Superclass
|
|
@@ -638,43 +691,6 @@
|
|
|
638
691
|
|
|
639
692
|
<hr/>
|
|
640
693
|
|
|
641
|
-
## class: `FvSplitButton`
|
|
642
|
-
|
|
643
|
-
### Superclass
|
|
644
|
-
|
|
645
|
-
| Name | Module | Package |
|
|
646
|
-
| ------------------- | ------ | ------------------- |
|
|
647
|
-
| `FoundationElement` | | @ni/fast-foundation |
|
|
648
|
-
|
|
649
|
-
### Fields
|
|
650
|
-
|
|
651
|
-
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
652
|
-
| ------------------- | ------- | ------------------------------------ | -------------------- | ----------- | -------------- |
|
|
653
|
-
| `label` | public | `string` | `'Primary function'` | | |
|
|
654
|
-
| `disabled` | public | `boolean` | `false` | | |
|
|
655
|
-
| `open` | public | `boolean` | `false` | | |
|
|
656
|
-
| `appearance` | public | `FvSplitButtonAppearanceType` | | | |
|
|
657
|
-
| `appearanceVariant` | public | `FvSplitButtonAppearanceVariantType` | | | |
|
|
658
|
-
|
|
659
|
-
### Events
|
|
660
|
-
|
|
661
|
-
| Name | Type | Description | Inherited From |
|
|
662
|
-
| --------- | ------------- | ----------- | -------------- |
|
|
663
|
-
| `trigger` | `CustomEvent` | | |
|
|
664
|
-
| `toggle` | `CustomEvent` | | |
|
|
665
|
-
|
|
666
|
-
### Attributes
|
|
667
|
-
|
|
668
|
-
| Name | Field | Inherited From |
|
|
669
|
-
| -------------------- | ----------------- | -------------- |
|
|
670
|
-
| `label` | label | |
|
|
671
|
-
| `disabled` | disabled | |
|
|
672
|
-
| `open` | open | |
|
|
673
|
-
| `appearance` | appearance | |
|
|
674
|
-
| `appearance-variant` | appearanceVariant | |
|
|
675
|
-
|
|
676
|
-
<hr/>
|
|
677
|
-
|
|
678
694
|
## class: `FvStickyHeader`
|
|
679
695
|
|
|
680
696
|
### Superclass
|
|
@@ -719,35 +735,19 @@
|
|
|
719
735
|
|
|
720
736
|
<hr/>
|
|
721
737
|
|
|
722
|
-
## class: `
|
|
738
|
+
## class: `FvTextField`
|
|
723
739
|
|
|
724
740
|
### Superclass
|
|
725
741
|
|
|
726
|
-
| Name
|
|
727
|
-
|
|
|
728
|
-
| `
|
|
742
|
+
| Name | Module | Package |
|
|
743
|
+
| ----------------- | ------ | ----------------------------------------- |
|
|
744
|
+
| `NimbleTextField` | | @ni/nimble-components/dist/esm/text-field |
|
|
729
745
|
|
|
730
746
|
### Fields
|
|
731
747
|
|
|
732
|
-
| Name
|
|
733
|
-
|
|
|
734
|
-
| `
|
|
735
|
-
| `label` | public | `string` | `''` | | |
|
|
736
|
-
| `legacyStyle` | public | `boolean` | `false` | | |
|
|
737
|
-
| `size` | public | `FvSummaryPanelSizeType` | | | |
|
|
738
|
-
| `selected` | public | `boolean` | `false` | | |
|
|
739
|
-
| `textPosition` | public | `FvSummaryPanelTileTextPositionType` | | | |
|
|
740
|
-
|
|
741
|
-
### Attributes
|
|
742
|
-
|
|
743
|
-
| Name | Field | Inherited From |
|
|
744
|
-
| --------------- | ------------ | -------------- |
|
|
745
|
-
| `count` | count | |
|
|
746
|
-
| `label` | label | |
|
|
747
|
-
| `legacy-style` | legacyStyle | |
|
|
748
|
-
| `size` | size | |
|
|
749
|
-
| `selected` | selected | |
|
|
750
|
-
| `text-position` | textPosition | |
|
|
748
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
749
|
+
| ------------- | ------- | ----------------------------- | ------- | ------------------------------------------------------------- | -------------- |
|
|
750
|
+
| `maskOptions` | public | `MaskitoOptions \| undefined` | | Maskito configuration applied to user and programmatic input. | |
|
|
751
751
|
|
|
752
752
|
<hr/>
|
|
753
753
|
|
|
@@ -774,22 +774,6 @@
|
|
|
774
774
|
|
|
775
775
|
<hr/>
|
|
776
776
|
|
|
777
|
-
## class: `TsIconDynamic`
|
|
778
|
-
|
|
779
|
-
### Superclass
|
|
780
|
-
|
|
781
|
-
| Name | Module | Package |
|
|
782
|
-
| ------ | ------ | ---------------------------------------- |
|
|
783
|
-
| `Icon` | | @ni/nimble-components/dist/esm/icon-base |
|
|
784
|
-
|
|
785
|
-
### Static Methods
|
|
786
|
-
|
|
787
|
-
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
788
|
-
| --------------------- | ------- | ----------- | ------------------------------ | ------ | -------------- |
|
|
789
|
-
| `registerIconDynamic` | public | | `tagName: string, url: string` | `void` | |
|
|
790
|
-
|
|
791
|
-
<hr/>
|
|
792
|
-
|
|
793
777
|
## class: `TsTableColumnBreakpoint`
|
|
794
778
|
|
|
795
779
|
### Superclass
|
|
@@ -829,6 +813,38 @@
|
|
|
829
813
|
|
|
830
814
|
<hr/>
|
|
831
815
|
|
|
816
|
+
## class: `FvSummaryPanelTile`
|
|
817
|
+
|
|
818
|
+
### Superclass
|
|
819
|
+
|
|
820
|
+
| Name | Module | Package |
|
|
821
|
+
| ------------------- | ------ | ------------------- |
|
|
822
|
+
| `FoundationElement` | | @ni/fast-foundation |
|
|
823
|
+
|
|
824
|
+
### Fields
|
|
825
|
+
|
|
826
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
827
|
+
| -------------- | ------- | ------------------------------------ | ------- | ----------- | -------------- |
|
|
828
|
+
| `count` | public | `string` | `''` | | |
|
|
829
|
+
| `label` | public | `string` | `''` | | |
|
|
830
|
+
| `legacyStyle` | public | `boolean` | `false` | | |
|
|
831
|
+
| `size` | public | `FvSummaryPanelSizeType` | | | |
|
|
832
|
+
| `selected` | public | `boolean` | `false` | | |
|
|
833
|
+
| `textPosition` | public | `FvSummaryPanelTileTextPositionType` | | | |
|
|
834
|
+
|
|
835
|
+
### Attributes
|
|
836
|
+
|
|
837
|
+
| Name | Field | Inherited From |
|
|
838
|
+
| --------------- | ------------ | -------------- |
|
|
839
|
+
| `count` | count | |
|
|
840
|
+
| `label` | label | |
|
|
841
|
+
| `legacy-style` | legacyStyle | |
|
|
842
|
+
| `size` | size | |
|
|
843
|
+
| `selected` | selected | |
|
|
844
|
+
| `text-position` | textPosition | |
|
|
845
|
+
|
|
846
|
+
<hr/>
|
|
847
|
+
|
|
832
848
|
## class: `TsTableColumnBreakpointCellView`
|
|
833
849
|
|
|
834
850
|
### Superclass
|
package/dist/esm/fv/all-fv.d.ts
CHANGED
package/dist/esm/fv/all-fv.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-fv.js","sourceRoot":"","sources":["../../../src/fv/all-fv.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,QAAQ,CAAC;AAChB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,CAAC;AACxB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,cAAc,CAAC;AACtB,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AACxB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,YAAY,CAAC;AACpB,OAAO,gBAAgB,CAAC;AACxB,OAAO,WAAW,CAAC","sourcesContent":["import './accordion-item';\nimport './card';\nimport './bulk-edit-field';\nimport './chip-selector';\nimport './context-help';\nimport './date-time-picker';\nimport './edit-commit-bar';\nimport './filter-bar';\nimport './master-detail-list-item';\nimport './master-detail-list';\nimport './multi-select';\nimport './split-button';\nimport './split-button-anchor';\nimport './sticky-header';\nimport './summary-panel';\nimport './summary-panel-tile';\nimport './search-input';\nimport './splitter';\nimport './split-layout';\nimport './toolbar';\n"]}
|
|
1
|
+
{"version":3,"file":"all-fv.js","sourceRoot":"","sources":["../../../src/fv/all-fv.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,QAAQ,CAAC;AAChB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,CAAC;AACxB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,cAAc,CAAC;AACtB,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AACxB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,cAAc,CAAC;AACtB,OAAO,YAAY,CAAC;AACpB,OAAO,gBAAgB,CAAC;AACxB,OAAO,WAAW,CAAC","sourcesContent":["import './accordion-item';\nimport './card';\nimport './bulk-edit-field';\nimport './chip-selector';\nimport './context-help';\nimport './date-time-picker';\nimport './edit-commit-bar';\nimport './filter-bar';\nimport './master-detail-list-item';\nimport './master-detail-list';\nimport './multi-select';\nimport './split-button';\nimport './split-button-anchor';\nimport './sticky-header';\nimport './summary-panel';\nimport './summary-panel-tile';\nimport './search-input';\nimport './text-field';\nimport './splitter';\nimport './split-layout';\nimport './toolbar';\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type MaskitoOptions } from '@maskito/core';
|
|
2
|
+
import { TextField as NimbleTextField } from '@ni/nimble-components/dist/esm/text-field';
|
|
3
|
+
export type { MaskitoOptions } from '@maskito/core';
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
'ok-fv-text-field': FvTextField;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A Nimble text field with optional Maskito input masking.
|
|
11
|
+
*/
|
|
12
|
+
export declare class FvTextField extends NimbleTextField {
|
|
13
|
+
/**
|
|
14
|
+
* Maskito configuration applied to user and programmatic input.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
* @remarks
|
|
18
|
+
* This property is not reflected to an HTML attribute because Maskito
|
|
19
|
+
* options can contain regular expressions and functions.
|
|
20
|
+
*/
|
|
21
|
+
maskOptions?: MaskitoOptions;
|
|
22
|
+
private maskito?;
|
|
23
|
+
private updatingValueFromControl;
|
|
24
|
+
private normalizingValue;
|
|
25
|
+
/** @internal */
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
/** @internal */
|
|
28
|
+
disconnectedCallback(): void;
|
|
29
|
+
/** @internal */
|
|
30
|
+
maskOptionsChanged(): void;
|
|
31
|
+
/** @internal */
|
|
32
|
+
handleTextInput(): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
valueChanged(previous: string, next: string): void;
|
|
35
|
+
private initializeMask;
|
|
36
|
+
private createMask;
|
|
37
|
+
private destroyMask;
|
|
38
|
+
}
|
|
39
|
+
export declare const fvTextFieldTag = "ok-fv-text-field";
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, observable } from '@ni/fast-element';
|
|
3
|
+
import { Maskito, maskitoTransform } from '@maskito/core';
|
|
4
|
+
import { TextField as NimbleTextField } from '@ni/nimble-components/dist/esm/text-field';
|
|
5
|
+
import { styles } from '@ni/nimble-components/dist/esm/text-field/styles';
|
|
6
|
+
import { template } from '@ni/nimble-components/dist/esm/text-field/template';
|
|
7
|
+
import { errorTextTemplate } from '@ni/nimble-components/dist/esm/patterns/error/template';
|
|
8
|
+
import { iconExclamationMarkTag } from '@ni/nimble-components/dist/esm/icons/exclamation-mark';
|
|
9
|
+
import { DesignSystem } from '@ni/fast-foundation';
|
|
10
|
+
/**
|
|
11
|
+
* A Nimble text field with optional Maskito input masking.
|
|
12
|
+
*/
|
|
13
|
+
export class FvTextField extends NimbleTextField {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.updatingValueFromControl = false;
|
|
17
|
+
this.normalizingValue = false;
|
|
18
|
+
}
|
|
19
|
+
/** @internal */
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
super.connectedCallback();
|
|
22
|
+
this.initializeMask();
|
|
23
|
+
}
|
|
24
|
+
/** @internal */
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
this.destroyMask();
|
|
27
|
+
super.disconnectedCallback();
|
|
28
|
+
}
|
|
29
|
+
/** @internal */
|
|
30
|
+
maskOptionsChanged() {
|
|
31
|
+
if (this.$fastController.isConnected) {
|
|
32
|
+
this.initializeMask();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** @internal */
|
|
36
|
+
handleTextInput() {
|
|
37
|
+
this.updatingValueFromControl = true;
|
|
38
|
+
super.handleTextInput();
|
|
39
|
+
this.updatingValueFromControl = false;
|
|
40
|
+
}
|
|
41
|
+
/** @internal */
|
|
42
|
+
valueChanged(previous, next) {
|
|
43
|
+
if (!this.maskOptions
|
|
44
|
+
|| this.updatingValueFromControl
|
|
45
|
+
|| this.normalizingValue) {
|
|
46
|
+
super.valueChanged(previous, next);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const maskedValue = maskitoTransform(next, this.maskOptions);
|
|
50
|
+
if (maskedValue !== next) {
|
|
51
|
+
this.normalizingValue = true;
|
|
52
|
+
this.value = maskedValue;
|
|
53
|
+
this.normalizingValue = false;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
super.valueChanged(previous, next);
|
|
57
|
+
}
|
|
58
|
+
if (this.$fastController.isConnected) {
|
|
59
|
+
this.control.value = maskedValue;
|
|
60
|
+
this.createMask();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
initializeMask() {
|
|
64
|
+
this.destroyMask();
|
|
65
|
+
if (!this.maskOptions) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const maskedValue = maskitoTransform(this.value, this.maskOptions);
|
|
69
|
+
if (maskedValue !== this.value) {
|
|
70
|
+
this.value = maskedValue;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.control.value = maskedValue;
|
|
74
|
+
this.createMask();
|
|
75
|
+
}
|
|
76
|
+
createMask() {
|
|
77
|
+
this.destroyMask();
|
|
78
|
+
if (this.maskOptions) {
|
|
79
|
+
this.maskito = new Maskito(this.control, this.maskOptions);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
destroyMask() {
|
|
83
|
+
this.maskito?.destroy();
|
|
84
|
+
this.maskito = undefined;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
__decorate([
|
|
88
|
+
observable
|
|
89
|
+
], FvTextField.prototype, "maskOptions", void 0);
|
|
90
|
+
const okFvTextField = FvTextField.compose({
|
|
91
|
+
baseName: 'fv-text-field',
|
|
92
|
+
baseClass: NimbleTextField,
|
|
93
|
+
template,
|
|
94
|
+
styles,
|
|
95
|
+
shadowOptions: {
|
|
96
|
+
delegatesFocus: true
|
|
97
|
+
},
|
|
98
|
+
end: html `
|
|
99
|
+
<${iconExclamationMarkTag}
|
|
100
|
+
severity="error"
|
|
101
|
+
class="error-icon"
|
|
102
|
+
></${iconExclamationMarkTag}>
|
|
103
|
+
<span part="actions">
|
|
104
|
+
<slot name="actions"></slot>
|
|
105
|
+
</span>
|
|
106
|
+
${errorTextTemplate}
|
|
107
|
+
`
|
|
108
|
+
});
|
|
109
|
+
DesignSystem.getOrCreate().withPrefix('ok').register(okFvTextField());
|
|
110
|
+
export const fvTextFieldTag = 'ok-fv-text-field';
|
|
111
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fv/text-field/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EACH,OAAO,EAEP,gBAAgB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,SAAS,IAAI,eAAe,EAC/B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,kDAAkD,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,oDAAoD,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAUnD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,eAAe;IAAh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AAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC","sourcesContent":["import { html, observable } from '@ni/fast-element';\nimport type { TextFieldOptions } from '@ni/fast-foundation';\nimport {\n Maskito,\n type MaskitoOptions,\n maskitoTransform\n} from '@maskito/core';\nimport {\n TextField as NimbleTextField\n} from '@ni/nimble-components/dist/esm/text-field';\nimport { styles } from '@ni/nimble-components/dist/esm/text-field/styles';\nimport { template } from '@ni/nimble-components/dist/esm/text-field/template';\nimport { errorTextTemplate } from '@ni/nimble-components/dist/esm/patterns/error/template';\nimport { iconExclamationMarkTag } from '@ni/nimble-components/dist/esm/icons/exclamation-mark';\nimport { DesignSystem } from '@ni/fast-foundation';\n\nexport type { MaskitoOptions } from '@maskito/core';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-fv-text-field': FvTextField;\n }\n}\n\n/**\n * A Nimble text field with optional Maskito input masking.\n */\nexport class FvTextField extends NimbleTextField {\n /**\n * Maskito configuration applied to user and programmatic input.\n *\n * @public\n * @remarks\n * This property is not reflected to an HTML attribute because Maskito\n * options can contain regular expressions and functions.\n */\n @observable\n public maskOptions?: MaskitoOptions;\n\n private maskito?: Maskito;\n private updatingValueFromControl = false;\n private normalizingValue = false;\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.initializeMask();\n }\n\n /** @internal */\n public override disconnectedCallback(): void {\n this.destroyMask();\n super.disconnectedCallback();\n }\n\n /** @internal */\n public maskOptionsChanged(): void {\n if (this.$fastController.isConnected) {\n this.initializeMask();\n }\n }\n\n /** @internal */\n public override handleTextInput(): void {\n this.updatingValueFromControl = true;\n super.handleTextInput();\n this.updatingValueFromControl = false;\n }\n\n /** @internal */\n public override valueChanged(previous: string, next: string): void {\n if (\n !this.maskOptions\n || this.updatingValueFromControl\n || this.normalizingValue\n ) {\n super.valueChanged(previous, next);\n return;\n }\n\n const maskedValue = maskitoTransform(next, this.maskOptions);\n if (maskedValue !== next) {\n this.normalizingValue = true;\n this.value = maskedValue;\n this.normalizingValue = false;\n } else {\n super.valueChanged(previous, next);\n }\n\n if (this.$fastController.isConnected) {\n this.control.value = maskedValue;\n this.createMask();\n }\n }\n\n private initializeMask(): void {\n this.destroyMask();\n if (!this.maskOptions) {\n return;\n }\n\n const maskedValue = maskitoTransform(this.value, this.maskOptions);\n if (maskedValue !== this.value) {\n this.value = maskedValue;\n return;\n }\n\n this.control.value = maskedValue;\n this.createMask();\n }\n\n private createMask(): void {\n this.destroyMask();\n if (this.maskOptions) {\n this.maskito = new Maskito(this.control, this.maskOptions);\n }\n }\n\n private destroyMask(): void {\n this.maskito?.destroy();\n this.maskito = undefined;\n }\n}\n\nconst okFvTextField = FvTextField.compose<TextFieldOptions>({\n baseName: 'fv-text-field',\n baseClass: NimbleTextField,\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n },\n end: html<FvTextField>`\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon\"\n ></${iconExclamationMarkTag}>\n <span part=\"actions\">\n <slot name=\"actions\"></slot>\n </span>\n ${errorTextTemplate}\n `\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okFvTextField());\nexport const fvTextFieldTag = 'ok-fv-text-field';"]}
|