@atomic-ui/ui-angular 0.3.0 → 0.5.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/README.md +10 -10
- package/dist/index.d.ts +22 -22
- package/dist/index.js +102 -102
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,26 +6,26 @@ Angular value accessors for the `@atomic-ui/ui` form elements, so they work with
|
|
|
6
6
|
pnpm add @atomic-ui/ui @atomic-ui/ui-angular
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Angular renders custom elements as they are, so there is no wrapper per element. A component that uses them does two things. It declares `CUSTOM_ELEMENTS_SCHEMA`, which tells Angular that tags it does not know are custom elements. And it imports `
|
|
9
|
+
Angular renders custom elements as they are, so there is no wrapper per element. A component that uses them does two things. It declares `CUSTOM_ELEMENTS_SCHEMA`, which tells Angular that tags it does not know are custom elements. And it imports `ImpaktFormsModule`, which gives the form elements a value accessor each:
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
13
13
|
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
14
|
-
import {
|
|
14
|
+
import { ImpaktFormsModule } from '@atomic-ui/ui-angular';
|
|
15
15
|
|
|
16
16
|
@Component({
|
|
17
17
|
selector: 'app-vehicle',
|
|
18
18
|
standalone: true,
|
|
19
|
-
imports: [ReactiveFormsModule,
|
|
19
|
+
imports: [ReactiveFormsModule, ImpaktFormsModule],
|
|
20
20
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
21
21
|
template: `
|
|
22
22
|
<form [formGroup]="form">
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
23
|
+
<impakt-text-input label="Full name" formControlName="name"></impakt-text-input>
|
|
24
|
+
<impakt-date-input label="Arrival date" formControlName="arrival"></impakt-date-input>
|
|
25
|
+
<impakt-money-input label="Value of the vehicle" formControlName="value"></impakt-money-input>
|
|
26
|
+
<impakt-file-upload label="Proof of ownership" formControlName="proof" many-files></impakt-file-upload>
|
|
27
27
|
</form>
|
|
28
|
-
<
|
|
28
|
+
<impakt-table caption="Open cases" [columns]="columns" [rows]="rows" stack (impakt-sort)="sortBy($event.detail)"></impakt-table>
|
|
29
29
|
`,
|
|
30
30
|
})
|
|
31
31
|
export class VehicleComponent {
|
|
@@ -39,7 +39,7 @@ Importing this package defines the elements, so nothing else needs importing fir
|
|
|
39
39
|
|
|
40
40
|
## The accessors
|
|
41
41
|
|
|
42
|
-
Every form element has one: `
|
|
42
|
+
Every form element has one: `impakt-text-input`, `impakt-textarea`, `impakt-select`, `impakt-checkbox`, `impakt-radio-group`, `impakt-checkbox-group`, `impakt-date-input`, `impakt-money-input`, `impakt-range-input`, `impakt-file-upload`, `impakt-address-lookup` and `impakt-slot-picker`. Each listens for the element's `impakt-change` and writes the form's value back to the element's `value`. Leaving the field marks the control touched.
|
|
43
43
|
|
|
44
44
|
Three differ. A checkbox's value is a boolean. A money input's value is the plain number as text, such as `250000`. A file upload's value is the files, as `File[]`, and writing an empty value clears it; a browser does not let code choose files.
|
|
45
45
|
|
|
@@ -47,4 +47,4 @@ A test checks that every form element in the component manifest has an accessor.
|
|
|
47
47
|
|
|
48
48
|
## Events and properties
|
|
49
49
|
|
|
50
|
-
Bind arrays and objects with `[property]`, which sets a DOM property, and listen with `(
|
|
50
|
+
Bind arrays and objects with `[property]`, which sets a DOM property, and listen with `(impakt-sort)`, which receives the event with its `detail`.
|
package/dist/index.d.ts
CHANGED
|
@@ -11,20 +11,20 @@
|
|
|
11
11
|
* What does not work without help is **forms**. `formControlName` and
|
|
12
12
|
* `ngModel` need a `ControlValueAccessor`, and Angular ships one for `<input>`
|
|
13
13
|
* and `<select>` and nothing else. Without one, a reactive form containing
|
|
14
|
-
* `<
|
|
14
|
+
* `<impakt-text-input>` silently never receives a value — the control stays
|
|
15
15
|
* `null`, validation passes, and the bug surfaces as an empty field in an order
|
|
16
16
|
* request.
|
|
17
17
|
*
|
|
18
18
|
* So this package is value accessors, and that is the whole of it.
|
|
19
19
|
*
|
|
20
20
|
* ```ts
|
|
21
|
-
* import {
|
|
21
|
+
* import { ImpaktFormsModule } from '@atomic-ui/ui-angular';
|
|
22
22
|
*
|
|
23
23
|
* @Component({
|
|
24
24
|
* standalone: true,
|
|
25
|
-
* imports: [ReactiveFormsModule,
|
|
25
|
+
* imports: [ReactiveFormsModule, ImpaktFormsModule],
|
|
26
26
|
* schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
27
|
-
* template: `<
|
|
27
|
+
* template: `<impakt-text-input label="Postcode" formControlName="postcode"></impakt-text-input>`,
|
|
28
28
|
* })
|
|
29
29
|
* ```
|
|
30
30
|
*
|
|
@@ -43,13 +43,13 @@ interface ValueElement extends HTMLElement {
|
|
|
43
43
|
/**
|
|
44
44
|
* The shared accessor.
|
|
45
45
|
*
|
|
46
|
-
* It listens for `
|
|
46
|
+
* It listens for `impakt-change` — the one event every control in the library
|
|
47
47
|
* dispatches — and writes back to the element's `value` property. One
|
|
48
48
|
* implementation covers every control because they all agree on that contract,
|
|
49
49
|
* which is the payoff for having settled it in the component base rather than
|
|
50
50
|
* per component.
|
|
51
51
|
*/
|
|
52
|
-
declare abstract class
|
|
52
|
+
declare abstract class ImpaktValueAccessor implements ControlValueAccessor {
|
|
53
53
|
protected readonly ref: ElementRef<ValueElement>;
|
|
54
54
|
protected onChange: (value: string) => void;
|
|
55
55
|
protected onTouched: () => void;
|
|
@@ -69,35 +69,35 @@ declare abstract class ImpktValueAccessor implements ControlValueAccessor {
|
|
|
69
69
|
registerOnTouched(fn: () => void): void;
|
|
70
70
|
setDisabledState(isDisabled: boolean): void;
|
|
71
71
|
}
|
|
72
|
-
export declare class
|
|
72
|
+
export declare class ImpaktTextInputAccessor extends ImpaktValueAccessor {
|
|
73
73
|
}
|
|
74
|
-
export declare class
|
|
74
|
+
export declare class ImpaktTextareaAccessor extends ImpaktValueAccessor {
|
|
75
75
|
}
|
|
76
|
-
export declare class
|
|
76
|
+
export declare class ImpaktSelectAccessor extends ImpaktValueAccessor {
|
|
77
77
|
}
|
|
78
|
-
export declare class
|
|
78
|
+
export declare class ImpaktRadioGroupAccessor extends ImpaktValueAccessor {
|
|
79
79
|
}
|
|
80
|
-
export declare class
|
|
80
|
+
export declare class ImpaktCheckboxGroupAccessor extends ImpaktValueAccessor {
|
|
81
81
|
}
|
|
82
|
-
export declare class
|
|
82
|
+
export declare class ImpaktDateInputAccessor extends ImpaktValueAccessor {
|
|
83
83
|
}
|
|
84
84
|
/** An amount, as the plain number typed, such as `250000`. */
|
|
85
|
-
export declare class
|
|
85
|
+
export declare class ImpaktMoneyInputAccessor extends ImpaktValueAccessor {
|
|
86
86
|
}
|
|
87
|
-
export declare class
|
|
87
|
+
export declare class ImpaktRangeInputAccessor extends ImpaktValueAccessor {
|
|
88
88
|
}
|
|
89
89
|
/** The address chosen or typed, on one line. */
|
|
90
|
-
export declare class
|
|
90
|
+
export declare class ImpaktAddressLookupAccessor extends ImpaktValueAccessor {
|
|
91
91
|
}
|
|
92
|
-
export declare class
|
|
92
|
+
export declare class ImpaktSlotPickerAccessor extends ImpaktValueAccessor {
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* A file upload's form value is the files themselves, as `File[]`, because that
|
|
96
|
-
* is what a form uploads. The element's own `
|
|
97
|
-
* names, so this listens for `
|
|
96
|
+
* is what a form uploads. The element's own `impakt-change` carries only their
|
|
97
|
+
* names, so this listens for `impakt-files` instead. A file input cannot be given
|
|
98
98
|
* files from code, so writing a value can only clear it, as a form reset does.
|
|
99
99
|
*/
|
|
100
|
-
export declare class
|
|
100
|
+
export declare class ImpaktFileUploadAccessor extends ImpaktValueAccessor {
|
|
101
101
|
handleChange(): void;
|
|
102
102
|
handleFiles(event: CustomEvent<{
|
|
103
103
|
files: File[];
|
|
@@ -108,14 +108,14 @@ export declare class ImpktFileUploadAccessor extends ImpktValueAccessor {
|
|
|
108
108
|
* A checkbox is the one that differs: its form value is a boolean to Angular
|
|
109
109
|
* and a string to the element, so it translates rather than passing through.
|
|
110
110
|
*/
|
|
111
|
-
export declare class
|
|
111
|
+
export declare class ImpaktCheckboxAccessor extends ImpaktValueAccessor {
|
|
112
112
|
handleChange(event: CustomEvent<{
|
|
113
113
|
value: string;
|
|
114
114
|
}>): void;
|
|
115
115
|
writeValue(value: unknown): void;
|
|
116
116
|
}
|
|
117
|
-
export declare const
|
|
117
|
+
export declare const IMPAKT_FORM_ACCESSORS: readonly [typeof ImpaktTextInputAccessor, typeof ImpaktTextareaAccessor, typeof ImpaktSelectAccessor, typeof ImpaktCheckboxAccessor, typeof ImpaktRadioGroupAccessor, typeof ImpaktCheckboxGroupAccessor, typeof ImpaktDateInputAccessor, typeof ImpaktMoneyInputAccessor, typeof ImpaktRangeInputAccessor, typeof ImpaktFileUploadAccessor, typeof ImpaktAddressLookupAccessor, typeof ImpaktSlotPickerAccessor];
|
|
118
118
|
/** Import this where you use the elements in a form. */
|
|
119
|
-
export declare class
|
|
119
|
+
export declare class ImpaktFormsModule {
|
|
120
120
|
}
|
|
121
121
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
13
|
import { Directive, HostListener, NgModule, forwardRef } from "@angular/core";
|
|
14
14
|
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
15
15
|
import "@atomic-ui/ui";
|
|
16
|
-
var
|
|
16
|
+
var ImpaktValueAccessor = class {
|
|
17
17
|
constructor(ref) {
|
|
18
18
|
this.ref = ref;
|
|
19
19
|
this.onChange = () => {
|
|
@@ -41,110 +41,110 @@ var ImpktValueAccessor = class {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
__decorateClass([
|
|
44
|
-
HostListener("
|
|
45
|
-
],
|
|
44
|
+
HostListener("impakt-change", ["$event"])
|
|
45
|
+
], ImpaktValueAccessor.prototype, "handleChange", 1);
|
|
46
46
|
__decorateClass([
|
|
47
47
|
HostListener("blur")
|
|
48
|
-
],
|
|
49
|
-
|
|
48
|
+
], ImpaktValueAccessor.prototype, "handleBlur", 1);
|
|
49
|
+
ImpaktValueAccessor = __decorateClass([
|
|
50
50
|
Directive()
|
|
51
|
-
],
|
|
51
|
+
], ImpaktValueAccessor);
|
|
52
52
|
var accessor = (directive) => ({
|
|
53
53
|
provide: NG_VALUE_ACCESSOR,
|
|
54
54
|
useExisting: forwardRef(() => directive),
|
|
55
55
|
multi: true
|
|
56
56
|
});
|
|
57
|
-
var
|
|
57
|
+
var ImpaktTextInputAccessor = class extends ImpaktValueAccessor {
|
|
58
58
|
};
|
|
59
|
-
|
|
59
|
+
ImpaktTextInputAccessor = __decorateClass([
|
|
60
60
|
Directive({
|
|
61
|
-
selector: "
|
|
61
|
+
selector: "impakt-text-input",
|
|
62
62
|
standalone: true,
|
|
63
|
-
providers: [accessor(
|
|
63
|
+
providers: [accessor(ImpaktTextInputAccessor)]
|
|
64
64
|
})
|
|
65
|
-
],
|
|
66
|
-
var
|
|
65
|
+
], ImpaktTextInputAccessor);
|
|
66
|
+
var ImpaktTextareaAccessor = class extends ImpaktValueAccessor {
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
ImpaktTextareaAccessor = __decorateClass([
|
|
69
69
|
Directive({
|
|
70
|
-
selector: "
|
|
70
|
+
selector: "impakt-textarea",
|
|
71
71
|
standalone: true,
|
|
72
|
-
providers: [accessor(
|
|
72
|
+
providers: [accessor(ImpaktTextareaAccessor)]
|
|
73
73
|
})
|
|
74
|
-
],
|
|
75
|
-
var
|
|
74
|
+
], ImpaktTextareaAccessor);
|
|
75
|
+
var ImpaktSelectAccessor = class extends ImpaktValueAccessor {
|
|
76
76
|
};
|
|
77
|
-
|
|
77
|
+
ImpaktSelectAccessor = __decorateClass([
|
|
78
78
|
Directive({
|
|
79
|
-
selector: "
|
|
79
|
+
selector: "impakt-select",
|
|
80
80
|
standalone: true,
|
|
81
|
-
providers: [accessor(
|
|
81
|
+
providers: [accessor(ImpaktSelectAccessor)]
|
|
82
82
|
})
|
|
83
|
-
],
|
|
84
|
-
var
|
|
83
|
+
], ImpaktSelectAccessor);
|
|
84
|
+
var ImpaktRadioGroupAccessor = class extends ImpaktValueAccessor {
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
ImpaktRadioGroupAccessor = __decorateClass([
|
|
87
87
|
Directive({
|
|
88
|
-
selector: "
|
|
88
|
+
selector: "impakt-radio-group",
|
|
89
89
|
standalone: true,
|
|
90
|
-
providers: [accessor(
|
|
90
|
+
providers: [accessor(ImpaktRadioGroupAccessor)]
|
|
91
91
|
})
|
|
92
|
-
],
|
|
93
|
-
var
|
|
92
|
+
], ImpaktRadioGroupAccessor);
|
|
93
|
+
var ImpaktCheckboxGroupAccessor = class extends ImpaktValueAccessor {
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
ImpaktCheckboxGroupAccessor = __decorateClass([
|
|
96
96
|
Directive({
|
|
97
|
-
selector: "
|
|
97
|
+
selector: "impakt-checkbox-group",
|
|
98
98
|
standalone: true,
|
|
99
|
-
providers: [accessor(
|
|
99
|
+
providers: [accessor(ImpaktCheckboxGroupAccessor)]
|
|
100
100
|
})
|
|
101
|
-
],
|
|
102
|
-
var
|
|
101
|
+
], ImpaktCheckboxGroupAccessor);
|
|
102
|
+
var ImpaktDateInputAccessor = class extends ImpaktValueAccessor {
|
|
103
103
|
};
|
|
104
|
-
|
|
104
|
+
ImpaktDateInputAccessor = __decorateClass([
|
|
105
105
|
Directive({
|
|
106
|
-
selector: "
|
|
106
|
+
selector: "impakt-date-input",
|
|
107
107
|
standalone: true,
|
|
108
|
-
providers: [accessor(
|
|
108
|
+
providers: [accessor(ImpaktDateInputAccessor)]
|
|
109
109
|
})
|
|
110
|
-
],
|
|
111
|
-
var
|
|
110
|
+
], ImpaktDateInputAccessor);
|
|
111
|
+
var ImpaktMoneyInputAccessor = class extends ImpaktValueAccessor {
|
|
112
112
|
};
|
|
113
|
-
|
|
113
|
+
ImpaktMoneyInputAccessor = __decorateClass([
|
|
114
114
|
Directive({
|
|
115
|
-
selector: "
|
|
115
|
+
selector: "impakt-money-input",
|
|
116
116
|
standalone: true,
|
|
117
|
-
providers: [accessor(
|
|
117
|
+
providers: [accessor(ImpaktMoneyInputAccessor)]
|
|
118
118
|
})
|
|
119
|
-
],
|
|
120
|
-
var
|
|
119
|
+
], ImpaktMoneyInputAccessor);
|
|
120
|
+
var ImpaktRangeInputAccessor = class extends ImpaktValueAccessor {
|
|
121
121
|
};
|
|
122
|
-
|
|
122
|
+
ImpaktRangeInputAccessor = __decorateClass([
|
|
123
123
|
Directive({
|
|
124
|
-
selector: "
|
|
124
|
+
selector: "impakt-range-input",
|
|
125
125
|
standalone: true,
|
|
126
|
-
providers: [accessor(
|
|
126
|
+
providers: [accessor(ImpaktRangeInputAccessor)]
|
|
127
127
|
})
|
|
128
|
-
],
|
|
129
|
-
var
|
|
128
|
+
], ImpaktRangeInputAccessor);
|
|
129
|
+
var ImpaktAddressLookupAccessor = class extends ImpaktValueAccessor {
|
|
130
130
|
};
|
|
131
|
-
|
|
131
|
+
ImpaktAddressLookupAccessor = __decorateClass([
|
|
132
132
|
Directive({
|
|
133
|
-
selector: "
|
|
133
|
+
selector: "impakt-address-lookup",
|
|
134
134
|
standalone: true,
|
|
135
|
-
providers: [accessor(
|
|
135
|
+
providers: [accessor(ImpaktAddressLookupAccessor)]
|
|
136
136
|
})
|
|
137
|
-
],
|
|
138
|
-
var
|
|
137
|
+
], ImpaktAddressLookupAccessor);
|
|
138
|
+
var ImpaktSlotPickerAccessor = class extends ImpaktValueAccessor {
|
|
139
139
|
};
|
|
140
|
-
|
|
140
|
+
ImpaktSlotPickerAccessor = __decorateClass([
|
|
141
141
|
Directive({
|
|
142
|
-
selector: "
|
|
142
|
+
selector: "impakt-slot-picker",
|
|
143
143
|
standalone: true,
|
|
144
|
-
providers: [accessor(
|
|
144
|
+
providers: [accessor(ImpaktSlotPickerAccessor)]
|
|
145
145
|
})
|
|
146
|
-
],
|
|
147
|
-
var
|
|
146
|
+
], ImpaktSlotPickerAccessor);
|
|
147
|
+
var ImpaktFileUploadAccessor = class extends ImpaktValueAccessor {
|
|
148
148
|
handleChange() {
|
|
149
149
|
}
|
|
150
150
|
handleFiles(event) {
|
|
@@ -159,16 +159,16 @@ var ImpktFileUploadAccessor = class extends ImpktValueAccessor {
|
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
161
|
__decorateClass([
|
|
162
|
-
HostListener("
|
|
163
|
-
],
|
|
164
|
-
|
|
162
|
+
HostListener("impakt-files", ["$event"])
|
|
163
|
+
], ImpaktFileUploadAccessor.prototype, "handleFiles", 1);
|
|
164
|
+
ImpaktFileUploadAccessor = __decorateClass([
|
|
165
165
|
Directive({
|
|
166
|
-
selector: "
|
|
166
|
+
selector: "impakt-file-upload",
|
|
167
167
|
standalone: true,
|
|
168
|
-
providers: [accessor(
|
|
168
|
+
providers: [accessor(ImpaktFileUploadAccessor)]
|
|
169
169
|
})
|
|
170
|
-
],
|
|
171
|
-
var
|
|
170
|
+
], ImpaktFileUploadAccessor);
|
|
171
|
+
var ImpaktCheckboxAccessor = class extends ImpaktValueAccessor {
|
|
172
172
|
handleChange(event) {
|
|
173
173
|
this.onChange(Boolean(event.detail.value));
|
|
174
174
|
}
|
|
@@ -177,51 +177,51 @@ var ImpktCheckboxAccessor = class extends ImpktValueAccessor {
|
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
179
|
__decorateClass([
|
|
180
|
-
HostListener("
|
|
181
|
-
],
|
|
182
|
-
|
|
180
|
+
HostListener("impakt-change", ["$event"])
|
|
181
|
+
], ImpaktCheckboxAccessor.prototype, "handleChange", 1);
|
|
182
|
+
ImpaktCheckboxAccessor = __decorateClass([
|
|
183
183
|
Directive({
|
|
184
|
-
selector: "
|
|
184
|
+
selector: "impakt-checkbox",
|
|
185
185
|
standalone: true,
|
|
186
|
-
providers: [accessor(
|
|
186
|
+
providers: [accessor(ImpaktCheckboxAccessor)]
|
|
187
187
|
})
|
|
188
|
-
],
|
|
189
|
-
var
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
188
|
+
], ImpaktCheckboxAccessor);
|
|
189
|
+
var IMPAKT_FORM_ACCESSORS = [
|
|
190
|
+
ImpaktTextInputAccessor,
|
|
191
|
+
ImpaktTextareaAccessor,
|
|
192
|
+
ImpaktSelectAccessor,
|
|
193
|
+
ImpaktCheckboxAccessor,
|
|
194
|
+
ImpaktRadioGroupAccessor,
|
|
195
|
+
ImpaktCheckboxGroupAccessor,
|
|
196
|
+
ImpaktDateInputAccessor,
|
|
197
|
+
ImpaktMoneyInputAccessor,
|
|
198
|
+
ImpaktRangeInputAccessor,
|
|
199
|
+
ImpaktFileUploadAccessor,
|
|
200
|
+
ImpaktAddressLookupAccessor,
|
|
201
|
+
ImpaktSlotPickerAccessor
|
|
202
202
|
];
|
|
203
|
-
var
|
|
203
|
+
var ImpaktFormsModule = class {
|
|
204
204
|
};
|
|
205
|
-
|
|
205
|
+
ImpaktFormsModule = __decorateClass([
|
|
206
206
|
NgModule({
|
|
207
|
-
imports: [...
|
|
208
|
-
exports: [...
|
|
207
|
+
imports: [...IMPAKT_FORM_ACCESSORS],
|
|
208
|
+
exports: [...IMPAKT_FORM_ACCESSORS]
|
|
209
209
|
})
|
|
210
|
-
],
|
|
210
|
+
], ImpaktFormsModule);
|
|
211
211
|
export {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
212
|
+
IMPAKT_FORM_ACCESSORS,
|
|
213
|
+
ImpaktAddressLookupAccessor,
|
|
214
|
+
ImpaktCheckboxAccessor,
|
|
215
|
+
ImpaktCheckboxGroupAccessor,
|
|
216
|
+
ImpaktDateInputAccessor,
|
|
217
|
+
ImpaktFileUploadAccessor,
|
|
218
|
+
ImpaktFormsModule,
|
|
219
|
+
ImpaktMoneyInputAccessor,
|
|
220
|
+
ImpaktRadioGroupAccessor,
|
|
221
|
+
ImpaktRangeInputAccessor,
|
|
222
|
+
ImpaktSelectAccessor,
|
|
223
|
+
ImpaktSlotPickerAccessor,
|
|
224
|
+
ImpaktTextInputAccessor,
|
|
225
|
+
ImpaktTextareaAccessor
|
|
226
226
|
};
|
|
227
227
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Angular bindings for `@atomic-ui/ui`.\n *\n * ## What Angular actually needs\n *\n * Not wrappers. Angular renders custom elements as-is once a component\n * declares `CUSTOM_ELEMENTS_SCHEMA`, and `[options]=\"…\"` already sets a DOM\n * property rather than an attribute, so arrays arrive intact. Writing a\n * component per element would add a layer that does nothing.\n *\n * What does not work without help is **forms**. `formControlName` and\n * `ngModel` need a `ControlValueAccessor`, and Angular ships one for `<input>`\n * and `<select>` and nothing else. Without one, a reactive form containing\n * `<impkt-text-input>` silently never receives a value — the control stays\n * `null`, validation passes, and the bug surfaces as an empty field in an order\n * request.\n *\n * So this package is value accessors, and that is the whole of it.\n *\n * ```ts\n * import { ImpktFormsModule } from '@atomic-ui/ui-angular';\n *\n * @Component({\n * standalone: true,\n * imports: [ReactiveFormsModule, ImpktFormsModule],\n * schemas: [CUSTOM_ELEMENTS_SCHEMA],\n * template: `<impkt-text-input label=\"Postcode\" formControlName=\"postcode\"></impkt-text-input>`,\n * })\n * ```\n *\n * `CUSTOM_ELEMENTS_SCHEMA` stays the consumer's to declare. It tells Angular\n * to stop checking unknown tags for a whole component, which is a real\n * loosening of its template checking, and a library should not switch that off\n * on an application's behalf.\n */\nimport { Directive, ElementRef, HostListener, NgModule, forwardRef } from '@angular/core';\nimport { NG_VALUE_ACCESSOR, type ControlValueAccessor } from '@angular/forms';\nimport '@atomic-ui/ui';\n\ninterface ValueElement extends HTMLElement {\n value: string;\n disabled: boolean;\n}\n\n/**\n * The shared accessor.\n *\n * It listens for `impkt-change` — the one event every control in the library\n * dispatches — and writes back to the element's `value` property. One\n * implementation covers every control because they all agree on that contract,\n * which is the payoff for having settled it in the component base rather than\n * per component.\n */\n@Directive()\nabstract class ImpktValueAccessor implements ControlValueAccessor {\n protected onChange: (value: string) => void = () => {};\n protected onTouched: () => void = () => {};\n\n constructor(protected readonly ref: ElementRef<ValueElement>) {}\n\n @HostListener('impkt-change', ['$event'])\n handleChange(event: CustomEvent<{ value: string }>): void {\n this.onChange(event.detail.value);\n }\n\n /**\n * Blur marks the control touched, which is what makes \"required\" errors\n * appear after someone leaves a field rather than while they are still\n * typing in it. A form that reports an error on the first keystroke gets\n * worked around.\n */\n @HostListener('blur')\n handleBlur(): void {\n this.onTouched();\n }\n\n writeValue(value: string | null): void {\n this.ref.nativeElement.value = value ?? '';\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.ref.nativeElement.disabled = isDisabled;\n }\n}\n\nconst accessor = (directive: unknown) => ({\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => directive),\n multi: true,\n});\n\n@Directive({\n selector: 'impkt-text-input',\n standalone: true,\n providers: [accessor(ImpktTextInputAccessor)],\n})\nexport class ImpktTextInputAccessor extends ImpktValueAccessor {}\n\n@Directive({\n selector: 'impkt-textarea',\n standalone: true,\n providers: [accessor(ImpktTextareaAccessor)],\n})\nexport class ImpktTextareaAccessor extends ImpktValueAccessor {}\n\n@Directive({\n selector: 'impkt-select',\n standalone: true,\n providers: [accessor(ImpktSelectAccessor)],\n})\nexport class ImpktSelectAccessor extends ImpktValueAccessor {}\n\n@Directive({\n selector: 'impkt-radio-group',\n standalone: true,\n providers: [accessor(ImpktRadioGroupAccessor)],\n})\nexport class ImpktRadioGroupAccessor extends ImpktValueAccessor {}\n\n@Directive({\n selector: 'impkt-checkbox-group',\n standalone: true,\n providers: [accessor(ImpktCheckboxGroupAccessor)],\n})\nexport class ImpktCheckboxGroupAccessor extends ImpktValueAccessor {}\n\n@Directive({\n selector: 'impkt-date-input',\n standalone: true,\n providers: [accessor(ImpktDateInputAccessor)],\n})\nexport class ImpktDateInputAccessor extends ImpktValueAccessor {}\n\n/** An amount, as the plain number typed, such as `250000`. */\n@Directive({\n selector: 'impkt-money-input',\n standalone: true,\n providers: [accessor(ImpktMoneyInputAccessor)],\n})\nexport class ImpktMoneyInputAccessor extends ImpktValueAccessor {}\n\n@Directive({\n selector: 'impkt-range-input',\n standalone: true,\n providers: [accessor(ImpktRangeInputAccessor)],\n})\nexport class ImpktRangeInputAccessor extends ImpktValueAccessor {}\n\n/** The address chosen or typed, on one line. */\n@Directive({\n selector: 'impkt-address-lookup',\n standalone: true,\n providers: [accessor(ImpktAddressLookupAccessor)],\n})\nexport class ImpktAddressLookupAccessor extends ImpktValueAccessor {}\n\n@Directive({\n selector: 'impkt-slot-picker',\n standalone: true,\n providers: [accessor(ImpktSlotPickerAccessor)],\n})\nexport class ImpktSlotPickerAccessor extends ImpktValueAccessor {}\n\n/**\n * A file upload's form value is the files themselves, as `File[]`, because that\n * is what a form uploads. The element's own `impkt-change` carries only their\n * names, so this listens for `impkt-files` instead. A file input cannot be given\n * files from code, so writing a value can only clear it, as a form reset does.\n */\n@Directive({\n selector: 'impkt-file-upload',\n standalone: true,\n providers: [accessor(ImpktFileUploadAccessor)],\n})\nexport class ImpktFileUploadAccessor extends ImpktValueAccessor {\n override handleChange(): void {\n // The names are not the value; impkt-files below carries the files.\n }\n\n @HostListener('impkt-files', ['$event'])\n handleFiles(event: CustomEvent<{ files: File[] }>): void {\n (this.onChange as unknown as (v: File[]) => void)(event.detail.files);\n }\n\n override writeValue(value: unknown): void {\n const el = this.ref.nativeElement as ValueElement & { files: File[] };\n if (!Array.isArray(value) || !value.length) {\n el.files = [];\n el.value = '';\n } else el.files = value as File[];\n }\n}\n\n/**\n * A checkbox is the one that differs: its form value is a boolean to Angular\n * and a string to the element, so it translates rather than passing through.\n */\n@Directive({\n selector: 'impkt-checkbox',\n standalone: true,\n providers: [accessor(ImpktCheckboxAccessor)],\n})\nexport class ImpktCheckboxAccessor extends ImpktValueAccessor {\n @HostListener('impkt-change', ['$event'])\n override handleChange(event: CustomEvent<{ value: string }>): void {\n (this.onChange as unknown as (v: boolean) => void)(Boolean(event.detail.value));\n }\n\n override writeValue(value: unknown): void {\n (this.ref.nativeElement as ValueElement & { checked: boolean }).checked = Boolean(value);\n }\n}\n\nexport const IMPKT_FORM_ACCESSORS = [\n ImpktTextInputAccessor,\n ImpktTextareaAccessor,\n ImpktSelectAccessor,\n ImpktCheckboxAccessor,\n ImpktRadioGroupAccessor,\n ImpktCheckboxGroupAccessor,\n ImpktDateInputAccessor,\n ImpktMoneyInputAccessor,\n ImpktRangeInputAccessor,\n ImpktFileUploadAccessor,\n ImpktAddressLookupAccessor,\n ImpktSlotPickerAccessor,\n] as const;\n\n/** Import this where you use the elements in a form. */\n@NgModule({\n imports: [...IMPKT_FORM_ACCESSORS],\n exports: [...IMPKT_FORM_ACCESSORS],\n})\nexport class ImpktFormsModule {}\n"],"mappings":";;;;;;;;;;;;AAmCA,SAAS,WAAuB,cAAc,UAAU,kBAAkB;AAC1E,SAAS,yBAAoD;AAC7D,OAAO;AAiBP,IAAe,qBAAf,MAAkE;AAAA,EAIhE,YAA+B,KAA+B;AAA/B;AAH/B,SAAU,WAAoC,MAAM;AAAA,IAAC;AACrD,SAAU,YAAwB,MAAM;AAAA,IAAC;AAAA,EAEsB;AAAA,EAG/D,aAAa,OAA6C;AACxD,SA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AAG,oBAAoB;AAAA,EACnC,CAAC;AAAA,GACY;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Angular bindings for `@atomic-ui/ui`.\n *\n * ## What Angular actually needs\n *\n * Not wrappers. Angular renders custom elements as-is once a component\n * declares `CUSTOM_ELEMENTS_SCHEMA`, and `[options]=\"…\"` already sets a DOM\n * property rather than an attribute, so arrays arrive intact. Writing a\n * component per element would add a layer that does nothing.\n *\n * What does not work without help is **forms**. `formControlName` and\n * `ngModel` need a `ControlValueAccessor`, and Angular ships one for `<input>`\n * and `<select>` and nothing else. Without one, a reactive form containing\n * `<impakt-text-input>` silently never receives a value — the control stays\n * `null`, validation passes, and the bug surfaces as an empty field in an order\n * request.\n *\n * So this package is value accessors, and that is the whole of it.\n *\n * ```ts\n * import { ImpaktFormsModule } from '@atomic-ui/ui-angular';\n *\n * @Component({\n * standalone: true,\n * imports: [ReactiveFormsModule, ImpaktFormsModule],\n * schemas: [CUSTOM_ELEMENTS_SCHEMA],\n * template: `<impakt-text-input label=\"Postcode\" formControlName=\"postcode\"></impakt-text-input>`,\n * })\n * ```\n *\n * `CUSTOM_ELEMENTS_SCHEMA` stays the consumer's to declare. It tells Angular\n * to stop checking unknown tags for a whole component, which is a real\n * loosening of its template checking, and a library should not switch that off\n * on an application's behalf.\n */\nimport { Directive, ElementRef, HostListener, NgModule, forwardRef } from '@angular/core';\nimport { NG_VALUE_ACCESSOR, type ControlValueAccessor } from '@angular/forms';\nimport '@atomic-ui/ui';\n\ninterface ValueElement extends HTMLElement {\n value: string;\n disabled: boolean;\n}\n\n/**\n * The shared accessor.\n *\n * It listens for `impakt-change` — the one event every control in the library\n * dispatches — and writes back to the element's `value` property. One\n * implementation covers every control because they all agree on that contract,\n * which is the payoff for having settled it in the component base rather than\n * per component.\n */\n@Directive()\nabstract class ImpaktValueAccessor implements ControlValueAccessor {\n protected onChange: (value: string) => void = () => {};\n protected onTouched: () => void = () => {};\n\n constructor(protected readonly ref: ElementRef<ValueElement>) {}\n\n @HostListener('impakt-change', ['$event'])\n handleChange(event: CustomEvent<{ value: string }>): void {\n this.onChange(event.detail.value);\n }\n\n /**\n * Blur marks the control touched, which is what makes \"required\" errors\n * appear after someone leaves a field rather than while they are still\n * typing in it. A form that reports an error on the first keystroke gets\n * worked around.\n */\n @HostListener('blur')\n handleBlur(): void {\n this.onTouched();\n }\n\n writeValue(value: string | null): void {\n this.ref.nativeElement.value = value ?? '';\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.ref.nativeElement.disabled = isDisabled;\n }\n}\n\nconst accessor = (directive: unknown) => ({\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => directive),\n multi: true,\n});\n\n@Directive({\n selector: 'impakt-text-input',\n standalone: true,\n providers: [accessor(ImpaktTextInputAccessor)],\n})\nexport class ImpaktTextInputAccessor extends ImpaktValueAccessor {}\n\n@Directive({\n selector: 'impakt-textarea',\n standalone: true,\n providers: [accessor(ImpaktTextareaAccessor)],\n})\nexport class ImpaktTextareaAccessor extends ImpaktValueAccessor {}\n\n@Directive({\n selector: 'impakt-select',\n standalone: true,\n providers: [accessor(ImpaktSelectAccessor)],\n})\nexport class ImpaktSelectAccessor extends ImpaktValueAccessor {}\n\n@Directive({\n selector: 'impakt-radio-group',\n standalone: true,\n providers: [accessor(ImpaktRadioGroupAccessor)],\n})\nexport class ImpaktRadioGroupAccessor extends ImpaktValueAccessor {}\n\n@Directive({\n selector: 'impakt-checkbox-group',\n standalone: true,\n providers: [accessor(ImpaktCheckboxGroupAccessor)],\n})\nexport class ImpaktCheckboxGroupAccessor extends ImpaktValueAccessor {}\n\n@Directive({\n selector: 'impakt-date-input',\n standalone: true,\n providers: [accessor(ImpaktDateInputAccessor)],\n})\nexport class ImpaktDateInputAccessor extends ImpaktValueAccessor {}\n\n/** An amount, as the plain number typed, such as `250000`. */\n@Directive({\n selector: 'impakt-money-input',\n standalone: true,\n providers: [accessor(ImpaktMoneyInputAccessor)],\n})\nexport class ImpaktMoneyInputAccessor extends ImpaktValueAccessor {}\n\n@Directive({\n selector: 'impakt-range-input',\n standalone: true,\n providers: [accessor(ImpaktRangeInputAccessor)],\n})\nexport class ImpaktRangeInputAccessor extends ImpaktValueAccessor {}\n\n/** The address chosen or typed, on one line. */\n@Directive({\n selector: 'impakt-address-lookup',\n standalone: true,\n providers: [accessor(ImpaktAddressLookupAccessor)],\n})\nexport class ImpaktAddressLookupAccessor extends ImpaktValueAccessor {}\n\n@Directive({\n selector: 'impakt-slot-picker',\n standalone: true,\n providers: [accessor(ImpaktSlotPickerAccessor)],\n})\nexport class ImpaktSlotPickerAccessor extends ImpaktValueAccessor {}\n\n/**\n * A file upload's form value is the files themselves, as `File[]`, because that\n * is what a form uploads. The element's own `impakt-change` carries only their\n * names, so this listens for `impakt-files` instead. A file input cannot be given\n * files from code, so writing a value can only clear it, as a form reset does.\n */\n@Directive({\n selector: 'impakt-file-upload',\n standalone: true,\n providers: [accessor(ImpaktFileUploadAccessor)],\n})\nexport class ImpaktFileUploadAccessor extends ImpaktValueAccessor {\n override handleChange(): void {\n // The names are not the value; impakt-files below carries the files.\n }\n\n @HostListener('impakt-files', ['$event'])\n handleFiles(event: CustomEvent<{ files: File[] }>): void {\n (this.onChange as unknown as (v: File[]) => void)(event.detail.files);\n }\n\n override writeValue(value: unknown): void {\n const el = this.ref.nativeElement as ValueElement & { files: File[] };\n if (!Array.isArray(value) || !value.length) {\n el.files = [];\n el.value = '';\n } else el.files = value as File[];\n }\n}\n\n/**\n * A checkbox is the one that differs: its form value is a boolean to Angular\n * and a string to the element, so it translates rather than passing through.\n */\n@Directive({\n selector: 'impakt-checkbox',\n standalone: true,\n providers: [accessor(ImpaktCheckboxAccessor)],\n})\nexport class ImpaktCheckboxAccessor extends ImpaktValueAccessor {\n @HostListener('impakt-change', ['$event'])\n override handleChange(event: CustomEvent<{ value: string }>): void {\n (this.onChange as unknown as (v: boolean) => void)(Boolean(event.detail.value));\n }\n\n override writeValue(value: unknown): void {\n (this.ref.nativeElement as ValueElement & { checked: boolean }).checked = Boolean(value);\n }\n}\n\nexport const IMPAKT_FORM_ACCESSORS = [\n ImpaktTextInputAccessor,\n ImpaktTextareaAccessor,\n ImpaktSelectAccessor,\n ImpaktCheckboxAccessor,\n ImpaktRadioGroupAccessor,\n ImpaktCheckboxGroupAccessor,\n ImpaktDateInputAccessor,\n ImpaktMoneyInputAccessor,\n ImpaktRangeInputAccessor,\n ImpaktFileUploadAccessor,\n ImpaktAddressLookupAccessor,\n ImpaktSlotPickerAccessor,\n] as const;\n\n/** Import this where you use the elements in a form. */\n@NgModule({\n imports: [...IMPAKT_FORM_ACCESSORS],\n exports: [...IMPAKT_FORM_ACCESSORS],\n})\nexport class ImpaktFormsModule {}\n"],"mappings":";;;;;;;;;;;;AAmCA,SAAS,WAAuB,cAAc,UAAU,kBAAkB;AAC1E,SAAS,yBAAoD;AAC7D,OAAO;AAiBP,IAAe,sBAAf,MAAmE;AAAA,EAIjE,YAA+B,KAA+B;AAA/B;AAH/B,SAAU,WAAoC,MAAM;AAAA,IAAC;AACrD,SAAU,YAAwB,MAAM;AAAA,IAAC;AAAA,EAEsB;AAAA,EAG/D,aAAa,OAA6C;AACxD,SAAK,SAAS,MAAM,OAAO,KAAK;AAAA,EAClC;AAAA,EASA,aAAmB;AACjB,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,WAAW,OAA4B;AACrC,SAAK,IAAI,cAAc,QAAQ,SAAS;AAAA,EAC1C;AAAA,EAEA,iBAAiB,IAAmC;AAClD,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,kBAAkB,IAAsB;AACtC,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA,iBAAiB,YAA2B;AAC1C,SAAK,IAAI,cAAc,WAAW;AAAA,EACpC;AACF;AA9BE;AAAA,EADC,aAAa,iBAAi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AAN;AAAA,EALN,UAAU;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW,CAAC,SAAS,wBAAwB,CAAC;AAAA,EAChD,CAAC;AAAA,GACY;AA4BN,IAAM,yBAAN,cAAqC,oBAAoB;AAAA,EAErD,aAAa,OAA6C;AACjE,IAAC,KAAK,SAA6C,QAAQ,MAAM,OAAO,KAAK,CAAC;AAAA,EAChF;AAAA,EAES,WAAW,OAAsB;AACxC,IAAC,KAAK,IAAI,cAAsD,UAAU,QAAQ,KAAK;AAAA,EACzF;AACF;AAPW;AAAA,EADR,aAAa,iBAAiB,CAAC,QAAQ,CAAC;AAAA,GAD9B,uBAEF;AAFE,yBAAN;AAAA,EALN,UAAU;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW,CAAC,SAAS,sBAAsB,CAAC;AAAA,EAC9C,CAAC;AAAA,GACY;AAWN,IAAM,wBAAwB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,IAAM,oBAAN,MAAwB;AAAC;AAAnB,oBAAN;AAAA,EAJN,SAAS;AAAA,IACR,SAAS,CAAC,GAAG,qBAAqB;AAAA,IAClC,SAAS,CAAC,GAAG,qBAAqB;AAAA,EACpC,CAAC;AAAA,GACY;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomic-ui/ui-angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Angular bindings for @atomic-ui/ui: value accessors so the elements work with reactive forms and ngModel.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@atomic-ui/ui": "^0.
|
|
20
|
+
"@atomic-ui/ui": "^0.5.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@angular/core": ">=17",
|