@baloise/angular-output-target 1.0.7 → 1.0.18
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 +63 -0
- package/dist/generate-angular-component.js +2 -2
- package/dist/generate-value-accessors.js +5 -8
- package/dist/index.cjs.js +11 -14
- package/dist/index.js +11 -14
- package/package.json +11 -4
- package/resources/control-value-accessors/boolean-value-accessor.ts +9 -9
- package/resources/control-value-accessors/number-value-accessor.ts +10 -10
- package/resources/control-value-accessors/radio-value-accessor.ts +8 -8
- package/resources/control-value-accessors/select-value-accessor.ts +8 -8
- package/resources/control-value-accessors/text-value-accessor.ts +8 -8
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,69 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.0.18](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.0.13...@baloise/angular-output-target@1.0.18) (2021-12-02)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* **angular:** import statements for types ([f9ae53e](https://github.com/baloise/stencil-ds-output-targets/commit/f9ae53e272b98c69a94d2874ab4f6e1953364977))
|
12
|
+
* **angular:** return detail instead of target.value ([19abbf2](https://github.com/baloise/stencil-ds-output-targets/commit/19abbf2b8e3b977c3ce055ee58b1f5663ccb6ad2))
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
## [1.0.13](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.0.12...@baloise/angular-output-target@1.0.13) (2021-06-01)
|
19
|
+
|
20
|
+
**Note:** Version bump only for package @baloise/angular-output-target
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
## [1.0.12](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.0.11...@baloise/angular-output-target@1.0.12) (2021-05-07)
|
27
|
+
|
28
|
+
**Note:** Version bump only for package @baloise/angular-output-target
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
## [1.0.11](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.0.10...@baloise/angular-output-target@1.0.11) (2021-05-07)
|
35
|
+
|
36
|
+
|
37
|
+
### Bug Fixes
|
38
|
+
|
39
|
+
* remove ui-library and use variable instead ([f86568a](https://github.com/baloise/stencil-ds-output-targets/commit/f86568a27f9e2c80b35d1e201ab7822cc5e58d03))
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
## [1.0.10](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.0.9...@baloise/angular-output-target@1.0.10) (2021-04-15)
|
46
|
+
|
47
|
+
**Note:** Version bump only for package @baloise/angular-output-target
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
## [1.0.9](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.0.8...@baloise/angular-output-target@1.0.9) (2021-04-15)
|
54
|
+
|
55
|
+
**Note:** Version bump only for package @baloise/angular-output-target
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
## [1.0.8](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.0.7...@baloise/angular-output-target@1.0.8) (2021-04-13)
|
62
|
+
|
63
|
+
**Note:** Version bump only for package @baloise/angular-output-target
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
6
69
|
## [1.0.7](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.0.6...@baloise/angular-output-target@1.0.7) (2021-02-13)
|
7
70
|
|
8
71
|
|
@@ -26,11 +26,11 @@ export const createComponentDefinition = (componentCorePackage, distTypesDir, ro
|
|
26
26
|
.filter(output => !!output.complexType.references &&
|
27
27
|
Object.prototype.hasOwnProperty.call(output.complexType.references, output.complexType.original) &&
|
28
28
|
output.complexType.references[output.complexType.original].location === 'import')
|
29
|
-
.map(output => output.complexType.
|
29
|
+
.map(output => output.complexType.original)
|
30
30
|
.filter((item, pos, self) => self.indexOf(item) === pos)
|
31
31
|
.join(', ');
|
32
32
|
if (outputsTypes.length > 0) {
|
33
|
-
outputsTypes = `import { ${outputsTypes} } from '
|
33
|
+
outputsTypes = `import { ${outputsTypes} } from '${componentCorePackage}';`;
|
34
34
|
}
|
35
35
|
const lines = [
|
36
36
|
`
|
@@ -1,14 +1,11 @@
|
|
1
1
|
import path from 'path';
|
2
2
|
export default async function generateValueAccessors(compilerCtx, components, outputTarget, config) {
|
3
|
-
if (!Array.isArray(outputTarget.valueAccessorConfigs) ||
|
4
|
-
outputTarget.valueAccessorConfigs.length === 0) {
|
3
|
+
if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {
|
5
4
|
return;
|
6
5
|
}
|
7
6
|
const targetDir = path.dirname(outputTarget.directivesProxyFile);
|
8
7
|
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => {
|
9
|
-
const elementSelectors = Array.isArray(va.elementSelectors)
|
10
|
-
? va.elementSelectors
|
11
|
-
: [va.elementSelectors];
|
8
|
+
const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors];
|
12
9
|
const type = va.type;
|
13
10
|
let allElementSelectors = [];
|
14
11
|
let allEventTargets = [];
|
@@ -33,7 +30,7 @@ export default async function generateValueAccessors(compilerCtx, components, ou
|
|
33
30
|
await copyResources(config, ['value-accessor.ts'], targetDir);
|
34
31
|
}
|
35
32
|
function createValueAccessor(srcFileContents, valueAccessor) {
|
36
|
-
const hostContents = valueAccessor.eventTargets.map(
|
33
|
+
const hostContents = valueAccessor.eventTargets.map(listItem => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
37
34
|
return srcFileContents
|
38
35
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
39
36
|
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(',\n'));
|
@@ -42,7 +39,7 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
42
39
|
if (!config.sys || !config.sys.copy) {
|
43
40
|
throw new Error('stencil is not properly intialized at this step. Notify the developer');
|
44
41
|
}
|
45
|
-
const copyTasks = resourcesFilesToCopy.map(
|
42
|
+
const copyTasks = resourcesFilesToCopy.map(rf => {
|
46
43
|
return {
|
47
44
|
src: path.join(__dirname, '../resources/control-value-accessors/', rf),
|
48
45
|
dest: path.join(directory, rf),
|
@@ -55,4 +52,4 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
55
52
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
56
53
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
57
54
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
58
|
-
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.
|
55
|
+
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.detail)'`;
|
package/dist/index.cjs.js
CHANGED
@@ -114,11 +114,11 @@ const createComponentDefinition = (componentCorePackage, distTypesDir, rootDir)
|
|
114
114
|
.filter(output => !!output.complexType.references &&
|
115
115
|
Object.prototype.hasOwnProperty.call(output.complexType.references, output.complexType.original) &&
|
116
116
|
output.complexType.references[output.complexType.original].location === 'import')
|
117
|
-
.map(output => output.complexType.
|
117
|
+
.map(output => output.complexType.original)
|
118
118
|
.filter((item, pos, self) => self.indexOf(item) === pos)
|
119
119
|
.join(', ');
|
120
120
|
if (outputsTypes.length > 0) {
|
121
|
-
outputsTypes = `import { ${outputsTypes} } from '
|
121
|
+
outputsTypes = `import { ${outputsTypes} } from '${componentCorePackage}';`;
|
122
122
|
}
|
123
123
|
const lines = [
|
124
124
|
`
|
@@ -181,15 +181,12 @@ ${directives}
|
|
181
181
|
}
|
182
182
|
|
183
183
|
async function generateValueAccessors(compilerCtx, components, outputTarget, config) {
|
184
|
-
if (!Array.isArray(outputTarget.valueAccessorConfigs) ||
|
185
|
-
outputTarget.valueAccessorConfigs.length === 0) {
|
184
|
+
if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {
|
186
185
|
return;
|
187
186
|
}
|
188
187
|
const targetDir = path__default['default'].dirname(outputTarget.directivesProxyFile);
|
189
188
|
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => {
|
190
|
-
const elementSelectors = Array.isArray(va.elementSelectors)
|
191
|
-
? va.elementSelectors
|
192
|
-
: [va.elementSelectors];
|
189
|
+
const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors];
|
193
190
|
const type = va.type;
|
194
191
|
let allElementSelectors = [];
|
195
192
|
let allEventTargets = [];
|
@@ -211,19 +208,19 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
211
208
|
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
212
209
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
213
210
|
}));
|
214
|
-
await copyResources(config, ['value-accessor.ts'], targetDir);
|
211
|
+
await copyResources$1(config, ['value-accessor.ts'], targetDir);
|
215
212
|
}
|
216
213
|
function createValueAccessor(srcFileContents, valueAccessor) {
|
217
|
-
const hostContents = valueAccessor.eventTargets.map(
|
214
|
+
const hostContents = valueAccessor.eventTargets.map(listItem => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
218
215
|
return srcFileContents
|
219
216
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
220
217
|
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(',\n'));
|
221
218
|
}
|
222
|
-
function copyResources(config, resourcesFilesToCopy, directory) {
|
219
|
+
function copyResources$1(config, resourcesFilesToCopy, directory) {
|
223
220
|
if (!config.sys || !config.sys.copy) {
|
224
221
|
throw new Error('stencil is not properly intialized at this step. Notify the developer');
|
225
222
|
}
|
226
|
-
const copyTasks = resourcesFilesToCopy.map(
|
223
|
+
const copyTasks = resourcesFilesToCopy.map(rf => {
|
227
224
|
return {
|
228
225
|
src: path__default['default'].join(__dirname, '../resources/control-value-accessors/', rf),
|
229
226
|
dest: path__default['default'].join(directory, rf),
|
@@ -236,7 +233,7 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
236
233
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
237
234
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
238
235
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
239
|
-
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.
|
236
|
+
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.detail)'`;
|
240
237
|
|
241
238
|
async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components, config) {
|
242
239
|
const filteredComponents = getFilteredComponents(outputTarget.excludeComponents, components);
|
@@ -245,7 +242,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
245
242
|
const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
|
246
243
|
await Promise.all([
|
247
244
|
compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
|
248
|
-
copyResources
|
245
|
+
copyResources(config, outputTarget),
|
249
246
|
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
|
250
247
|
generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
|
251
248
|
]);
|
@@ -253,7 +250,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
253
250
|
function getFilteredComponents(excludeComponents = [], cmps) {
|
254
251
|
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
255
252
|
}
|
256
|
-
async function copyResources
|
253
|
+
async function copyResources(config, outputTarget) {
|
257
254
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
258
255
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
259
256
|
}
|
package/dist/index.js
CHANGED
@@ -105,11 +105,11 @@ const createComponentDefinition = (componentCorePackage, distTypesDir, rootDir)
|
|
105
105
|
.filter(output => !!output.complexType.references &&
|
106
106
|
Object.prototype.hasOwnProperty.call(output.complexType.references, output.complexType.original) &&
|
107
107
|
output.complexType.references[output.complexType.original].location === 'import')
|
108
|
-
.map(output => output.complexType.
|
108
|
+
.map(output => output.complexType.original)
|
109
109
|
.filter((item, pos, self) => self.indexOf(item) === pos)
|
110
110
|
.join(', ');
|
111
111
|
if (outputsTypes.length > 0) {
|
112
|
-
outputsTypes = `import { ${outputsTypes} } from '
|
112
|
+
outputsTypes = `import { ${outputsTypes} } from '${componentCorePackage}';`;
|
113
113
|
}
|
114
114
|
const lines = [
|
115
115
|
`
|
@@ -172,15 +172,12 @@ ${directives}
|
|
172
172
|
}
|
173
173
|
|
174
174
|
async function generateValueAccessors(compilerCtx, components, outputTarget, config) {
|
175
|
-
if (!Array.isArray(outputTarget.valueAccessorConfigs) ||
|
176
|
-
outputTarget.valueAccessorConfigs.length === 0) {
|
175
|
+
if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {
|
177
176
|
return;
|
178
177
|
}
|
179
178
|
const targetDir = path.dirname(outputTarget.directivesProxyFile);
|
180
179
|
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => {
|
181
|
-
const elementSelectors = Array.isArray(va.elementSelectors)
|
182
|
-
? va.elementSelectors
|
183
|
-
: [va.elementSelectors];
|
180
|
+
const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors];
|
184
181
|
const type = va.type;
|
185
182
|
let allElementSelectors = [];
|
186
183
|
let allEventTargets = [];
|
@@ -202,19 +199,19 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
202
199
|
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
203
200
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
204
201
|
}));
|
205
|
-
await copyResources(config, ['value-accessor.ts'], targetDir);
|
202
|
+
await copyResources$1(config, ['value-accessor.ts'], targetDir);
|
206
203
|
}
|
207
204
|
function createValueAccessor(srcFileContents, valueAccessor) {
|
208
|
-
const hostContents = valueAccessor.eventTargets.map(
|
205
|
+
const hostContents = valueAccessor.eventTargets.map(listItem => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
209
206
|
return srcFileContents
|
210
207
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
211
208
|
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(',\n'));
|
212
209
|
}
|
213
|
-
function copyResources(config, resourcesFilesToCopy, directory) {
|
210
|
+
function copyResources$1(config, resourcesFilesToCopy, directory) {
|
214
211
|
if (!config.sys || !config.sys.copy) {
|
215
212
|
throw new Error('stencil is not properly intialized at this step. Notify the developer');
|
216
213
|
}
|
217
|
-
const copyTasks = resourcesFilesToCopy.map(
|
214
|
+
const copyTasks = resourcesFilesToCopy.map(rf => {
|
218
215
|
return {
|
219
216
|
src: path.join(__dirname, '../resources/control-value-accessors/', rf),
|
220
217
|
dest: path.join(directory, rf),
|
@@ -227,7 +224,7 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
227
224
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
228
225
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
229
226
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
230
|
-
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.
|
227
|
+
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.detail)'`;
|
231
228
|
|
232
229
|
async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components, config) {
|
233
230
|
const filteredComponents = getFilteredComponents(outputTarget.excludeComponents, components);
|
@@ -236,7 +233,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
236
233
|
const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
|
237
234
|
await Promise.all([
|
238
235
|
compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
|
239
|
-
copyResources
|
236
|
+
copyResources(config, outputTarget),
|
240
237
|
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
|
241
238
|
generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
|
242
239
|
]);
|
@@ -244,7 +241,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
244
241
|
function getFilteredComponents(excludeComponents = [], cmps) {
|
245
242
|
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
246
243
|
}
|
247
|
-
async function copyResources
|
244
|
+
async function copyResources(config, outputTarget) {
|
248
245
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
249
246
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
250
247
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@baloise/angular-output-target",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.18",
|
4
4
|
"description": "Angular output target for @stencil/core components.",
|
5
5
|
"main": "dist/index.cjs.js",
|
6
6
|
"module": "dist/index.js",
|
@@ -37,8 +37,15 @@
|
|
37
37
|
"url": "https://github.com/baloise/stencil-ds-output-targets/issues"
|
38
38
|
},
|
39
39
|
"devDependencies": {
|
40
|
-
"@angular/
|
41
|
-
"@angular/
|
40
|
+
"@angular/common": "^10.2.5",
|
41
|
+
"@angular/core": "^10.2.5",
|
42
|
+
"@angular/forms": "^10.2.5",
|
43
|
+
"@angular/platform-browser": "^10.2.5",
|
44
|
+
"jest": "^26.6.3",
|
45
|
+
"rollup": "^2.56.3",
|
46
|
+
"rxjs": "^6.6.7",
|
47
|
+
"typescript": "^4.0.8",
|
48
|
+
"zone.js": "^0.10.3"
|
42
49
|
},
|
43
50
|
"jest": {
|
44
51
|
"transform": {
|
@@ -54,5 +61,5 @@
|
|
54
61
|
],
|
55
62
|
"testURL": "http://localhost"
|
56
63
|
},
|
57
|
-
"gitHead": "
|
64
|
+
"gitHead": "b1d49c9c5adecade9b6c5c3ed9e3f97d88669fb9"
|
58
65
|
}
|
@@ -1,27 +1,27 @@
|
|
1
|
-
import { Directive, ElementRef } from '@angular/core'
|
2
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
1
|
+
import { Directive, ElementRef } from '@angular/core'
|
2
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
3
3
|
|
4
|
-
import { ValueAccessor } from './value-accessor'
|
4
|
+
import { ValueAccessor } from './value-accessor'
|
5
5
|
|
6
6
|
@Directive({
|
7
7
|
/* tslint:disable-next-line:directive-selector */
|
8
8
|
selector: '<VALUE_ACCESSOR_SELECTORS>',
|
9
9
|
host: {
|
10
|
-
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.
|
10
|
+
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.detail)',
|
11
11
|
},
|
12
12
|
providers: [
|
13
13
|
{
|
14
14
|
provide: NG_VALUE_ACCESSOR,
|
15
15
|
useExisting: BooleanValueAccessor,
|
16
|
-
multi: true
|
17
|
-
}
|
18
|
-
]
|
16
|
+
multi: true,
|
17
|
+
},
|
18
|
+
],
|
19
19
|
})
|
20
20
|
export class BooleanValueAccessor extends ValueAccessor {
|
21
21
|
constructor(el: ElementRef) {
|
22
|
-
super(el)
|
22
|
+
super(el)
|
23
23
|
}
|
24
24
|
writeValue(value: any) {
|
25
|
-
this.el.nativeElement.checked = this.lastValue = value == null ? false : value
|
25
|
+
this.el.nativeElement.checked = this.lastValue = value == null ? false : value
|
26
26
|
}
|
27
27
|
}
|
@@ -1,29 +1,29 @@
|
|
1
|
-
import { Directive, ElementRef } from '@angular/core'
|
2
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
1
|
+
import { Directive, ElementRef } from '@angular/core'
|
2
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
3
3
|
|
4
|
-
import { ValueAccessor } from './value-accessor'
|
4
|
+
import { ValueAccessor } from './value-accessor'
|
5
5
|
|
6
6
|
@Directive({
|
7
7
|
/* tslint:disable-next-line:directive-selector */
|
8
8
|
selector: '<VALUE_ACCESSOR_SELECTORS>',
|
9
9
|
host: {
|
10
|
-
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.
|
10
|
+
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.detail)',
|
11
11
|
},
|
12
12
|
providers: [
|
13
13
|
{
|
14
14
|
provide: NG_VALUE_ACCESSOR,
|
15
15
|
useExisting: NumericValueAccessor,
|
16
|
-
multi: true
|
17
|
-
}
|
18
|
-
]
|
16
|
+
multi: true,
|
17
|
+
},
|
18
|
+
],
|
19
19
|
})
|
20
20
|
export class NumericValueAccessor extends ValueAccessor {
|
21
21
|
constructor(el: ElementRef) {
|
22
|
-
super(el)
|
22
|
+
super(el)
|
23
23
|
}
|
24
24
|
registerOnChange(fn: (_: number | null) => void) {
|
25
25
|
super.registerOnChange(value => {
|
26
|
-
fn(value === '' ? null : parseFloat(value))
|
27
|
-
})
|
26
|
+
fn(value === '' ? null : parseFloat(value))
|
27
|
+
})
|
28
28
|
}
|
29
29
|
}
|
@@ -1,24 +1,24 @@
|
|
1
|
-
import { Directive, ElementRef } from '@angular/core'
|
2
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
1
|
+
import { Directive, ElementRef } from '@angular/core'
|
2
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
3
3
|
|
4
|
-
import { ValueAccessor } from './value-accessor'
|
4
|
+
import { ValueAccessor } from './value-accessor'
|
5
5
|
|
6
6
|
@Directive({
|
7
7
|
/* tslint:disable-next-line:directive-selector */
|
8
8
|
selector: '<VALUE_ACCESSOR_SELECTORS>',
|
9
9
|
host: {
|
10
|
-
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.
|
10
|
+
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.detail)',
|
11
11
|
},
|
12
12
|
providers: [
|
13
13
|
{
|
14
14
|
provide: NG_VALUE_ACCESSOR,
|
15
15
|
useExisting: RadioValueAccessor,
|
16
|
-
multi: true
|
17
|
-
}
|
18
|
-
]
|
16
|
+
multi: true,
|
17
|
+
},
|
18
|
+
],
|
19
19
|
})
|
20
20
|
export class RadioValueAccessor extends ValueAccessor {
|
21
21
|
constructor(el: ElementRef) {
|
22
|
-
super(el)
|
22
|
+
super(el)
|
23
23
|
}
|
24
24
|
}
|
@@ -1,24 +1,24 @@
|
|
1
|
-
import { Directive, ElementRef } from '@angular/core'
|
2
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
1
|
+
import { Directive, ElementRef } from '@angular/core'
|
2
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
3
3
|
|
4
|
-
import { ValueAccessor } from './value-accessor'
|
4
|
+
import { ValueAccessor } from './value-accessor'
|
5
5
|
|
6
6
|
@Directive({
|
7
7
|
/* tslint:disable-next-line:directive-selector */
|
8
8
|
selector: '<VALUE_ACCESSOR_SELECTORS>',
|
9
9
|
host: {
|
10
|
-
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.
|
10
|
+
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.detail)',
|
11
11
|
},
|
12
12
|
providers: [
|
13
13
|
{
|
14
14
|
provide: NG_VALUE_ACCESSOR,
|
15
15
|
useExisting: SelectValueAccessor,
|
16
|
-
multi: true
|
17
|
-
}
|
18
|
-
]
|
16
|
+
multi: true,
|
17
|
+
},
|
18
|
+
],
|
19
19
|
})
|
20
20
|
export class SelectValueAccessor extends ValueAccessor {
|
21
21
|
constructor(el: ElementRef) {
|
22
|
-
super(el)
|
22
|
+
super(el)
|
23
23
|
}
|
24
24
|
}
|
@@ -1,24 +1,24 @@
|
|
1
|
-
import { Directive, ElementRef } from '@angular/core'
|
2
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
1
|
+
import { Directive, ElementRef } from '@angular/core'
|
2
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
3
3
|
|
4
|
-
import { ValueAccessor } from './value-accessor'
|
4
|
+
import { ValueAccessor } from './value-accessor'
|
5
5
|
|
6
6
|
@Directive({
|
7
7
|
/* tslint:disable-next-line:directive-selector */
|
8
8
|
selector: '<VALUE_ACCESSOR_SELECTORS>',
|
9
9
|
host: {
|
10
|
-
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.
|
10
|
+
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.detail)',
|
11
11
|
},
|
12
12
|
providers: [
|
13
13
|
{
|
14
14
|
provide: NG_VALUE_ACCESSOR,
|
15
15
|
useExisting: TextValueAccessor,
|
16
|
-
multi: true
|
17
|
-
}
|
18
|
-
]
|
16
|
+
multi: true,
|
17
|
+
},
|
18
|
+
],
|
19
19
|
})
|
20
20
|
export class TextValueAccessor extends ValueAccessor {
|
21
21
|
constructor(el: ElementRef) {
|
22
|
-
super(el)
|
22
|
+
super(el)
|
23
23
|
}
|
24
24
|
}
|