@o3r/transloco 15.3.0-prerelease.15 → 15.3.0-prerelease.17
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/fesm2022/o3r-transloco-rules-engine.mjs +90 -64
- package/fesm2022/o3r-transloco-rules-engine.mjs.map +1 -1
- package/fesm2022/o3r-transloco.mjs +964 -1154
- package/fesm2022/o3r-transloco.mjs.map +1 -1
- package/package.json +7 -7
- package/types/o3r-transloco-rules-engine.d.ts +26 -32
- package/types/o3r-transloco-rules-engine.d.ts.map +1 -1
- package/types/o3r-transloco.d.ts +577 -603
- package/types/o3r-transloco.d.ts.map +1 -1
|
@@ -1,67 +1,93 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { Store } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
i0.ɵɵ
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Injectable, NgModule, inject, makeEnvironmentProviders } from "@angular/core";
|
|
3
|
+
import { Store } from "@ngrx/store";
|
|
4
|
+
import { LocalizationOverrideStoreModule, provideLocalizationOverrideStore, setLocalizationOverride } from "@o3r/transloco";
|
|
5
|
+
const RULES_ENGINE_LOCALIZATION_UPDATE_ACTION_TYPE = "UPDATE_LOCALISATION";
|
|
6
|
+
var LocalizationRulesEngineActionHandler = class LocalizationRulesEngineActionHandler {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.store = inject(Store);
|
|
9
|
+
this.supportingActions = [RULES_ENGINE_LOCALIZATION_UPDATE_ACTION_TYPE];
|
|
10
|
+
}
|
|
11
|
+
executeActions(actions) {
|
|
12
|
+
const localizationOverrides = actions.reduce((acc, { key, value }) => {
|
|
13
|
+
acc[key] = value;
|
|
14
|
+
return acc;
|
|
15
|
+
}, {});
|
|
16
|
+
this.store.dispatch(setLocalizationOverride({ state: { localizationOverrides } }));
|
|
17
|
+
}
|
|
18
|
+
static {
|
|
19
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
20
|
+
minVersion: "12.0.0",
|
|
21
|
+
version: "22.2.3",
|
|
22
|
+
ngImport: i0,
|
|
23
|
+
type: LocalizationRulesEngineActionHandler,
|
|
24
|
+
deps: [],
|
|
25
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
static {
|
|
29
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
30
|
+
minVersion: "12.0.0",
|
|
31
|
+
version: "22.2.3",
|
|
32
|
+
ngImport: i0,
|
|
33
|
+
type: LocalizationRulesEngineActionHandler
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
38
|
+
minVersion: "12.0.0",
|
|
39
|
+
version: "22.2.3",
|
|
40
|
+
ngImport: i0,
|
|
41
|
+
type: LocalizationRulesEngineActionHandler,
|
|
42
|
+
decorators: [{ type: Injectable }]
|
|
43
|
+
});
|
|
44
|
+
var LocalizationRulesEngineActionModule = class LocalizationRulesEngineActionModule {
|
|
45
|
+
static {
|
|
46
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
47
|
+
minVersion: "12.0.0",
|
|
48
|
+
version: "22.2.3",
|
|
49
|
+
ngImport: i0,
|
|
50
|
+
type: LocalizationRulesEngineActionModule,
|
|
51
|
+
deps: [],
|
|
52
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
static {
|
|
56
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
57
|
+
minVersion: "14.0.0",
|
|
58
|
+
version: "22.2.3",
|
|
59
|
+
ngImport: i0,
|
|
60
|
+
type: LocalizationRulesEngineActionModule,
|
|
61
|
+
imports: [LocalizationOverrideStoreModule]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
static {
|
|
65
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
66
|
+
minVersion: "12.0.0",
|
|
67
|
+
version: "22.2.3",
|
|
68
|
+
ngImport: i0,
|
|
69
|
+
type: LocalizationRulesEngineActionModule,
|
|
70
|
+
providers: [LocalizationRulesEngineActionHandler],
|
|
71
|
+
imports: [LocalizationOverrideStoreModule]
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
76
|
+
minVersion: "12.0.0",
|
|
77
|
+
version: "22.2.3",
|
|
78
|
+
ngImport: i0,
|
|
79
|
+
type: LocalizationRulesEngineActionModule,
|
|
80
|
+
decorators: [{
|
|
81
|
+
type: NgModule,
|
|
82
|
+
args: [{
|
|
83
|
+
imports: [LocalizationOverrideStoreModule],
|
|
84
|
+
providers: [LocalizationRulesEngineActionHandler]
|
|
85
|
+
}]
|
|
86
|
+
}]
|
|
87
|
+
});
|
|
55
88
|
function provideLocalizationRulesEngineAction() {
|
|
56
|
-
|
|
57
|
-
provideLocalizationOverrideStore(),
|
|
58
|
-
LocalizationRulesEngineActionHandler
|
|
59
|
-
]);
|
|
89
|
+
return makeEnvironmentProviders([provideLocalizationOverrideStore(), LocalizationRulesEngineActionHandler]);
|
|
60
90
|
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Generated bundle index. Do not edit.
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
91
|
export { LocalizationRulesEngineActionHandler, LocalizationRulesEngineActionModule, RULES_ENGINE_LOCALIZATION_UPDATE_ACTION_TYPE, provideLocalizationRulesEngineAction };
|
|
67
|
-
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=o3r-transloco-rules-engine.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o3r-transloco-rules-engine.mjs","sources":["../../src/rules-engine/localization-interfaces.ts","../../src/rules-engine/localization-rules-engine-action-handler.ts","../../src/rules-engine/localization-rules-engine-module.ts"
|
|
1
|
+
{"version":3,"file":"o3r-transloco-rules-engine.mjs","names":[],"sources":["../../src/rules-engine/localization-interfaces.ts","../../src/rules-engine/localization-rules-engine-action-handler.ts","../../src/rules-engine/localization-rules-engine-module.ts"],"sourcesContent":["import type {\n RulesEngineAction,\n} from '@o3r/core';\n\n/** Action type to update localization via the rules engine */\nexport const RULES_ENGINE_LOCALIZATION_UPDATE_ACTION_TYPE = 'UPDATE_LOCALISATION';\n\n/**\n * Content of action that updates localization\n */\nexport interface ActionUpdateLocalizationBlock extends RulesEngineAction {\n /** Type of the action */\n actionType: typeof RULES_ENGINE_LOCALIZATION_UPDATE_ACTION_TYPE;\n /** Localization key to override */\n key: string;\n /** New value for the localization key */\n value: string;\n}\n","import {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n Store,\n} from '@ngrx/store';\nimport type {\n RulesEngineActionHandler,\n} from '@o3r/core';\nimport {\n ActionUpdateLocalizationBlock,\n RULES_ENGINE_LOCALIZATION_UPDATE_ACTION_TYPE,\n} from './localization-interfaces';\nimport {\n LocalizationOverrideStore,\n setLocalizationOverride,\n} from '@o3r/transloco';\n\n/**\n * Service to handle async Localization actions\n */\n@Injectable()\nexport class LocalizationRulesEngineActionHandler implements RulesEngineActionHandler<ActionUpdateLocalizationBlock> {\n private readonly store = inject<Store<LocalizationOverrideStore>>(Store);\n\n /** @inheritdoc */\n public readonly supportingActions = [RULES_ENGINE_LOCALIZATION_UPDATE_ACTION_TYPE] as const;\n\n /** @inheritdoc */\n public executeActions(actions: ActionUpdateLocalizationBlock[]): void | Promise<void> {\n const localizationOverrides = actions.reduce<Record<string, string>>((acc, { key, value }) => {\n acc[key] = value;\n return acc;\n }, {});\n\n this.store.dispatch(setLocalizationOverride({ state: { localizationOverrides } }));\n }\n}\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n NgModule,\n} from '@angular/core';\nimport {\n LocalizationRulesEngineActionHandler,\n} from './localization-rules-engine-action-handler';\nimport {\n LocalizationOverrideStoreModule,\n provideLocalizationOverrideStore,\n} from '@o3r/transloco';\n\n/**\n * @deprecated Will be removed in v16. Use {@link provideLocalizationRulesEngineAction} instead.\n */\n@NgModule({\n imports: [\n LocalizationOverrideStoreModule\n ],\n providers: [\n LocalizationRulesEngineActionHandler\n ]\n})\nexport class LocalizationRulesEngineActionModule {}\n\n/** Provide localization rules engine action handler. */\nexport function provideLocalizationRulesEngineAction(): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideLocalizationOverrideStore(),\n LocalizationRulesEngineActionHandler\n ]);\n}\n"],"mappings":";;;;AAKA,MAAa,+CAA+C;ACkB5D,IAAa,uCAAb,MAAa,qCAAoC;CADjD,cAAA;EAEmB,KAAA,QAAQ,OAAyC,KAAK;EAGvD,KAAA,oBAAoB,CAAC,4CAA4C;CAWlF;CARQ,eAAe,SAAwC;EAC5D,MAAM,wBAAwB,QAAQ,QAAgC,KAAK,EAAE,KAAK,YAAW;GAC3F,IAAI,OAAO;GACX,OAAO;EACT,GAAG,CAAA,CAAE;EAEL,KAAK,MAAM,SAAS,wBAAwB,EAAE,OAAO,EAAE,sBAA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