ngssm-store 22.0.1 → 22.2.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.
@@ -1,254 +1,451 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, makeEnvironmentProviders, Pipe, input, inject, Directive, booleanAttribute, Component } from '@angular/core';
3
- import { NgSsmFeatureState, provideReducers, Store, createSignal } from 'ngssm-store';
4
- import { __decorate } from 'tslib';
5
- import update from 'immutability-helper';
6
- import { MatButtonToggleGroup, MatButtonToggle } from '@angular/material/button-toggle';
7
-
1
+ import * as i0 from "@angular/core";
2
+ import { Component, Directive, Injectable, Pipe, booleanAttribute, inject, input, makeEnvironmentProviders } from "@angular/core";
3
+ import { NgSsmFeatureState, Store, createSignal, provideReducers } from "ngssm-store";
4
+ import { __decorate } from "tslib";
5
+ import update from "immutability-helper";
6
+ import { MatButtonToggle, MatButtonToggleGroup } from "@angular/material/button-toggle";
8
7
  var NgssmVisibilityActionType;
9
- (function (NgssmVisibilityActionType) {
10
- NgssmVisibilityActionType["defineElementsGroup"] = "[NgssmVisibilityActionType] defineElementsGroup";
11
- NgssmVisibilityActionType["toggleElementVisibility"] = "[NgssmVisibilityActionType] toggleElementVisibility";
12
- NgssmVisibilityActionType["hideElement"] = "[NgssmVisibilityActionType] hideElement";
13
- NgssmVisibilityActionType["showElement"] = "[NgssmVisibilityActionType] showElement";
8
+ (function(NgssmVisibilityActionType) {
9
+ NgssmVisibilityActionType["defineElementsGroup"] = "[NgssmVisibilityActionType] defineElementsGroup";
10
+ NgssmVisibilityActionType["toggleElementVisibility"] = "[NgssmVisibilityActionType] toggleElementVisibility";
11
+ NgssmVisibilityActionType["hideElement"] = "[NgssmVisibilityActionType] hideElement";
12
+ NgssmVisibilityActionType["showElement"] = "[NgssmVisibilityActionType] showElement";
14
13
  })(NgssmVisibilityActionType || (NgssmVisibilityActionType = {}));
15
-
16
- class ToggleElementVisibilityAction {
17
- elementKey;
18
- type = NgssmVisibilityActionType.toggleElementVisibility;
19
- constructor(elementKey) {
20
- this.elementKey = elementKey;
21
- }
22
- }
23
-
24
- class ShowElementAction {
25
- elementKey;
26
- type = NgssmVisibilityActionType.showElement;
27
- constructor(elementKey) {
28
- this.elementKey = elementKey;
29
- }
30
- }
31
-
32
- class HideElementAction {
33
- elementKey;
34
- type = NgssmVisibilityActionType.hideElement;
35
- constructor(elementKey) {
36
- this.elementKey = elementKey;
37
- }
38
- }
39
-
40
- class DefineElementsGroupAction {
41
- elementKeys;
42
- type = NgssmVisibilityActionType.defineElementsGroup;
43
- constructor(elementKeys) {
44
- this.elementKeys = elementKeys;
45
- }
46
- }
47
-
14
+ var ToggleElementVisibilityAction = class {
15
+ elementKey;
16
+ type = NgssmVisibilityActionType.toggleElementVisibility;
17
+ constructor(elementKey) {
18
+ this.elementKey = elementKey;
19
+ }
20
+ };
21
+ var ShowElementAction = class {
22
+ elementKey;
23
+ type = NgssmVisibilityActionType.showElement;
24
+ constructor(elementKey) {
25
+ this.elementKey = elementKey;
26
+ }
27
+ };
28
+ var HideElementAction = class {
29
+ elementKey;
30
+ type = NgssmVisibilityActionType.hideElement;
31
+ constructor(elementKey) {
32
+ this.elementKey = elementKey;
33
+ }
34
+ };
35
+ var DefineElementsGroupAction = class {
36
+ elementKeys;
37
+ type = NgssmVisibilityActionType.defineElementsGroup;
38
+ constructor(elementKeys) {
39
+ this.elementKeys = elementKeys;
40
+ }
41
+ };
48
42
  const selectNgssmVisibilityState = (state) => state[NgssmVisibilityStateSpecification.featureStateKey];
49
- const updateNgssmVisibilityState = (state, command) => update(state, {
50
- [NgssmVisibilityStateSpecification.featureStateKey]: command
51
- });
43
+ const updateNgssmVisibilityState = (state, command) => update(state, { [NgssmVisibilityStateSpecification.featureStateKey]: command });
52
44
  let NgssmVisibilityStateSpecification = class NgssmVisibilityStateSpecification {
53
- static featureStateKey = 'ngssm-visibility-state';
54
- static initialState = {
55
- elements: {},
56
- elementsGroups: []
57
- };
45
+ static featureStateKey = "ngssm-visibility-state";
46
+ static initialState = {
47
+ elements: {},
48
+ elementsGroups: []
49
+ };
58
50
  };
59
- NgssmVisibilityStateSpecification = __decorate([
60
- NgSsmFeatureState({
61
- featureStateKey: NgssmVisibilityStateSpecification.featureStateKey,
62
- initialState: NgssmVisibilityStateSpecification.initialState
63
- })
64
- ], NgssmVisibilityStateSpecification);
65
-
66
- class VisibilityReducer {
67
- processedActions = [
68
- NgssmVisibilityActionType.toggleElementVisibility,
69
- NgssmVisibilityActionType.showElement,
70
- NgssmVisibilityActionType.hideElement,
71
- NgssmVisibilityActionType.defineElementsGroup
72
- ];
73
- updateState(state, action) {
74
- switch (action.type) {
75
- case NgssmVisibilityActionType.toggleElementVisibility: {
76
- const toggleVisibilityAction = action;
77
- if (selectNgssmVisibilityState(state).elements[toggleVisibilityAction.elementKey] === true) {
78
- return updateNgssmVisibilityState(state, {
79
- elements: {
80
- [toggleVisibilityAction.elementKey]: { $set: false }
81
- }
82
- });
83
- }
84
- return this.setElementVisible(state, toggleVisibilityAction.elementKey);
85
- }
86
- case NgssmVisibilityActionType.showElement: {
87
- const showAction = action;
88
- return this.setElementVisible(state, showAction.elementKey);
89
- }
90
- case NgssmVisibilityActionType.hideElement: {
91
- const hideAction = action;
92
- return updateNgssmVisibilityState(state, {
93
- elements: {
94
- [hideAction.elementKey]: { $set: false }
95
- }
96
- });
97
- }
98
- case NgssmVisibilityActionType.defineElementsGroup: {
99
- const defineElementsGroupAction = action;
100
- const keys = [...defineElementsGroupAction.elementKeys];
101
- keys.sort();
102
- if (this.groupExists(keys, selectNgssmVisibilityState(state).elementsGroups)) {
103
- break;
104
- }
105
- return updateNgssmVisibilityState(state, {
106
- elementsGroups: { $push: [keys] }
107
- });
108
- }
109
- }
110
- return state;
111
- }
112
- groupExists(keys, groups) {
113
- const index = groups.findIndex((group) => {
114
- return group.length === keys.length && group.findIndex((k, i) => k !== keys[i]) === -1;
115
- });
116
- return index !== -1;
117
- }
118
- getElementsKeysGroupedWith(key, groups) {
119
- const keys = groups.filter((g) => g.includes(key)).flatMap((g) => g);
120
- const distinctKeys = new Set(keys);
121
- distinctKeys.delete(key);
122
- return [...distinctKeys];
123
- }
124
- setElementVisible(state, key) {
125
- const elementsCommand = {
126
- [key]: { $set: true }
127
- };
128
- const associatedElements = this.getElementsKeysGroupedWith(key, selectNgssmVisibilityState(state).elementsGroups);
129
- associatedElements.forEach((el) => {
130
- elementsCommand[el] = { $set: false };
131
- });
132
- return updateNgssmVisibilityState(state, {
133
- elements: elementsCommand
134
- });
135
- }
136
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: VisibilityReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
137
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: VisibilityReducer });
138
- }
139
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: VisibilityReducer, decorators: [{
140
- type: Injectable
141
- }] });
142
-
51
+ NgssmVisibilityStateSpecification = __decorate([NgSsmFeatureState({
52
+ featureStateKey: NgssmVisibilityStateSpecification.featureStateKey,
53
+ initialState: NgssmVisibilityStateSpecification.initialState
54
+ })], NgssmVisibilityStateSpecification);
55
+ var VisibilityReducer = class VisibilityReducer {
56
+ processedActions = [
57
+ NgssmVisibilityActionType.toggleElementVisibility,
58
+ NgssmVisibilityActionType.showElement,
59
+ NgssmVisibilityActionType.hideElement,
60
+ NgssmVisibilityActionType.defineElementsGroup
61
+ ];
62
+ updateState(state, action) {
63
+ switch (action.type) {
64
+ case NgssmVisibilityActionType.toggleElementVisibility: {
65
+ const toggleVisibilityAction = action;
66
+ if (selectNgssmVisibilityState(state).elements[toggleVisibilityAction.elementKey] === true) return updateNgssmVisibilityState(state, { elements: { [toggleVisibilityAction.elementKey]: { $set: false } } });
67
+ return this.setElementVisible(state, toggleVisibilityAction.elementKey);
68
+ }
69
+ case NgssmVisibilityActionType.showElement: {
70
+ const showAction = action;
71
+ return this.setElementVisible(state, showAction.elementKey);
72
+ }
73
+ case NgssmVisibilityActionType.hideElement: return updateNgssmVisibilityState(state, { elements: { [action.elementKey]: { $set: false } } });
74
+ case NgssmVisibilityActionType.defineElementsGroup: {
75
+ const keys = [...action.elementKeys];
76
+ keys.sort();
77
+ if (this.groupExists(keys, selectNgssmVisibilityState(state).elementsGroups)) break;
78
+ return updateNgssmVisibilityState(state, { elementsGroups: { $push: [keys] } });
79
+ }
80
+ }
81
+ return state;
82
+ }
83
+ groupExists(keys, groups) {
84
+ return groups.findIndex((group) => {
85
+ return group.length === keys.length && group.findIndex((k, i) => k !== keys[i]) === -1;
86
+ }) !== -1;
87
+ }
88
+ getElementsKeysGroupedWith(key, groups) {
89
+ const keys = groups.filter((g) => g.includes(key)).flatMap((g) => g);
90
+ const distinctKeys = new Set(keys);
91
+ distinctKeys.delete(key);
92
+ return [...distinctKeys];
93
+ }
94
+ setElementVisible(state, key) {
95
+ const elementsCommand = { [key]: { $set: true } };
96
+ this.getElementsKeysGroupedWith(key, selectNgssmVisibilityState(state).elementsGroups).forEach((el) => {
97
+ elementsCommand[el] = { $set: false };
98
+ });
99
+ return updateNgssmVisibilityState(state, { elements: elementsCommand });
100
+ }
101
+ static ɵfac = i0.ɵɵngDeclareFactory({
102
+ minVersion: "12.0.0",
103
+ version: "22.2.0",
104
+ ngImport: i0,
105
+ type: VisibilityReducer,
106
+ deps: [],
107
+ target: i0.ɵɵFactoryTarget.Injectable
108
+ });
109
+ static ɵprov = i0.ɵɵngDeclareInjectable({
110
+ minVersion: "12.0.0",
111
+ version: "22.2.0",
112
+ ngImport: i0,
113
+ type: VisibilityReducer
114
+ });
115
+ };
116
+ i0.ɵɵngDeclareClassMetadata({
117
+ minVersion: "12.0.0",
118
+ version: "22.2.0",
119
+ ngImport: i0,
120
+ type: VisibilityReducer,
121
+ decorators: [{ type: Injectable }]
122
+ });
143
123
  const provideNgssmVisibility = () => {
144
- return makeEnvironmentProviders([provideReducers(VisibilityReducer)]);
124
+ return makeEnvironmentProviders([provideReducers(VisibilityReducer)]);
145
125
  };
146
-
147
- class NgssmIsElementVisiblePipe {
148
- transform(value, ...args) {
149
- return selectNgssmVisibilityState(value).elements[args[0]] === true;
150
- }
151
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgssmIsElementVisiblePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
152
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.0.5", ngImport: i0, type: NgssmIsElementVisiblePipe, isStandalone: true, name: "ngssmIsElementVisible" });
153
- }
154
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgssmIsElementVisiblePipe, decorators: [{
155
- type: Pipe,
156
- args: [{
157
- name: 'ngssmIsElementVisible'
158
- }]
159
- }] });
160
-
161
- class NgssmShowElement {
162
- ngssmShowElement = input(undefined, /* @ts-ignore */
163
- ...(ngDevMode ? [{ debugName: "ngssmShowElement" }] : /* istanbul ignore next */ []));
164
- store = inject(Store);
165
- showElement() {
166
- const elementKey = this.ngssmShowElement();
167
- if (elementKey) {
168
- this.store.dispatchAction(new ShowElementAction(elementKey));
169
- }
170
- }
171
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgssmShowElement, deps: [], target: i0.ɵɵFactoryTarget.Directive });
172
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: NgssmShowElement, isStandalone: true, selector: "[ngssmShowElement]", inputs: { ngssmShowElement: { classPropertyName: "ngssmShowElement", publicName: "ngssmShowElement", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "showElement()" } }, ngImport: i0 });
173
- }
174
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgssmShowElement, decorators: [{
175
- type: Directive,
176
- args: [{
177
- selector: '[ngssmShowElement]',
178
- host: {
179
- '(click)': 'showElement()'
180
- }
181
- }]
182
- }], propDecorators: { ngssmShowElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngssmShowElement", required: false }] }] } });
183
-
184
- class NgssmHideElement {
185
- ngssmHideElement = input(undefined, /* @ts-ignore */
186
- ...(ngDevMode ? [{ debugName: "ngssmHideElement" }] : /* istanbul ignore next */ []));
187
- store = inject(Store);
188
- hideElement() {
189
- const elementKey = this.ngssmHideElement();
190
- if (elementKey) {
191
- this.store.dispatchAction(new HideElementAction(elementKey));
192
- }
193
- }
194
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgssmHideElement, deps: [], target: i0.ɵɵFactoryTarget.Directive });
195
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: NgssmHideElement, isStandalone: true, selector: "[ngssmHideElement]", inputs: { ngssmHideElement: { classPropertyName: "ngssmHideElement", publicName: "ngssmHideElement", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "hideElement()" } }, ngImport: i0 });
196
- }
197
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgssmHideElement, decorators: [{
198
- type: Directive,
199
- args: [{
200
- selector: '[ngssmHideElement]',
201
- host: {
202
- '(click)': 'hideElement()'
203
- }
204
- }]
205
- }], propDecorators: { ngssmHideElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngssmHideElement", required: false }] }] } });
206
-
207
- class NgssmToggleElementVisibility {
208
- ngssmToggleElementVisibility = input(undefined, /* @ts-ignore */
209
- ...(ngDevMode ? [{ debugName: "ngssmToggleElementVisibility" }] : /* istanbul ignore next */ []));
210
- store = inject(Store);
211
- toggleElementVisibility() {
212
- const elementKey = this.ngssmToggleElementVisibility();
213
- if (elementKey) {
214
- this.store.dispatchAction(new ToggleElementVisibilityAction(elementKey));
215
- }
216
- }
217
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgssmToggleElementVisibility, deps: [], target: i0.ɵɵFactoryTarget.Directive });
218
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: NgssmToggleElementVisibility, isStandalone: true, selector: "[ngssmToggleElementVisibility]", inputs: { ngssmToggleElementVisibility: { classPropertyName: "ngssmToggleElementVisibility", publicName: "ngssmToggleElementVisibility", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "toggleElementVisibility()" } }, ngImport: i0 });
219
- }
220
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgssmToggleElementVisibility, decorators: [{
221
- type: Directive,
222
- args: [{
223
- selector: '[ngssmToggleElementVisibility]',
224
- host: {
225
- '(click)': 'toggleElementVisibility()'
226
- }
227
- }]
228
- }], propDecorators: { ngssmToggleElementVisibility: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngssmToggleElementVisibility", required: false }] }] } });
229
-
230
- class NgssmVisibilityToggleGroup {
231
- items = input([], /* @ts-ignore */
232
- ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
233
- hideMultipleSelectionIndicator = input(false, { ...(ngDevMode ? { debugName: "hideMultipleSelectionIndicator" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
234
- store = inject(Store);
235
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgssmVisibilityToggleGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
236
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: NgssmVisibilityToggleGroup, isStandalone: true, selector: "ngssm-visibility-toggle-group", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, hideMultipleSelectionIndicator: { classPropertyName: "hideMultipleSelectionIndicator", publicName: "hideMultipleSelectionIndicator", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mat-button-toggle-group [multiple]=\"true\" [hideMultipleSelectionIndicator]=\"hideMultipleSelectionIndicator()\">\n @for (item of items(); track item.key) {\n <mat-button-toggle\n [ngssmToggleElementVisibility]=\"item.key\"\n [checked]=\"store.state() | ngssmIsElementVisible: item.key\"\n [id]=\"item.key\">\n {{ item.label }}\n </mat-button-toggle>\n }\n</mat-button-toggle-group>\n", dependencies: [{ kind: "directive", type: MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "directive", type: NgssmToggleElementVisibility, selector: "[ngssmToggleElementVisibility]", inputs: ["ngssmToggleElementVisibility"] }, { kind: "pipe", type: NgssmIsElementVisiblePipe, name: "ngssmIsElementVisible" }] });
237
- }
238
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NgssmVisibilityToggleGroup, decorators: [{
239
- type: Component,
240
- args: [{ selector: 'ngssm-visibility-toggle-group', imports: [MatButtonToggleGroup, MatButtonToggle, NgssmToggleElementVisibility, NgssmIsElementVisiblePipe], template: "<mat-button-toggle-group [multiple]=\"true\" [hideMultipleSelectionIndicator]=\"hideMultipleSelectionIndicator()\">\n @for (item of items(); track item.key) {\n <mat-button-toggle\n [ngssmToggleElementVisibility]=\"item.key\"\n [checked]=\"store.state() | ngssmIsElementVisible: item.key\"\n [id]=\"item.key\">\n {{ item.label }}\n </mat-button-toggle>\n }\n</mat-button-toggle-group>\n" }]
241
- }], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], hideMultipleSelectionIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideMultipleSelectionIndicator", required: false }] }] } });
242
-
243
- // Creates a signal allowing to listen to changes in element visibility.
126
+ var NgssmIsElementVisiblePipe = class NgssmIsElementVisiblePipe {
127
+ transform(value, ...args) {
128
+ return selectNgssmVisibilityState(value).elements[args[0]] === true;
129
+ }
130
+ static ɵfac = i0.ɵɵngDeclareFactory({
131
+ minVersion: "12.0.0",
132
+ version: "22.2.0",
133
+ ngImport: i0,
134
+ type: NgssmIsElementVisiblePipe,
135
+ deps: [],
136
+ target: i0.ɵɵFactoryTarget.Pipe
137
+ });
138
+ static ɵpipe = i0.ɵɵngDeclarePipe({
139
+ minVersion: "14.0.0",
140
+ version: "22.2.0",
141
+ ngImport: i0,
142
+ type: NgssmIsElementVisiblePipe,
143
+ isStandalone: true,
144
+ name: "ngssmIsElementVisible"
145
+ });
146
+ };
147
+ i0.ɵɵngDeclareClassMetadata({
148
+ minVersion: "12.0.0",
149
+ version: "22.2.0",
150
+ ngImport: i0,
151
+ type: NgssmIsElementVisiblePipe,
152
+ decorators: [{
153
+ type: Pipe,
154
+ args: [{ name: "ngssmIsElementVisible" }]
155
+ }]
156
+ });
157
+ var NgssmShowElement = class NgssmShowElement {
158
+ ngssmShowElement = input(void 0, ...ngDevMode ? [{ debugName: "ngssmShowElement" }] : /* istanbul ignore next */ []);
159
+ store = inject(Store);
160
+ showElement() {
161
+ const elementKey = this.ngssmShowElement();
162
+ if (elementKey) this.store.dispatchAction(new ShowElementAction(elementKey));
163
+ }
164
+ static ɵfac = i0.ɵɵngDeclareFactory({
165
+ minVersion: "12.0.0",
166
+ version: "22.2.0",
167
+ ngImport: i0,
168
+ type: NgssmShowElement,
169
+ deps: [],
170
+ target: i0.ɵɵFactoryTarget.Directive
171
+ });
172
+ static ɵdir = i0.ɵɵngDeclareDirective({
173
+ minVersion: "17.1.0",
174
+ version: "22.2.0",
175
+ type: NgssmShowElement,
176
+ isStandalone: true,
177
+ selector: "[ngssmShowElement]",
178
+ inputs: { ngssmShowElement: {
179
+ classPropertyName: "ngssmShowElement",
180
+ publicName: "ngssmShowElement",
181
+ isSignal: true,
182
+ isRequired: false,
183
+ transformFunction: null
184
+ } },
185
+ host: { listeners: { "click": "showElement()" } },
186
+ ngImport: i0
187
+ });
188
+ };
189
+ i0.ɵɵngDeclareClassMetadata({
190
+ minVersion: "12.0.0",
191
+ version: "22.2.0",
192
+ ngImport: i0,
193
+ type: NgssmShowElement,
194
+ decorators: [{
195
+ type: Directive,
196
+ args: [{
197
+ selector: "[ngssmShowElement]",
198
+ host: { "(click)": "showElement()" }
199
+ }]
200
+ }],
201
+ propDecorators: { ngssmShowElement: [{
202
+ type: i0.Input,
203
+ args: [{
204
+ isSignal: true,
205
+ alias: "ngssmShowElement",
206
+ required: false
207
+ }]
208
+ }] }
209
+ });
210
+ var NgssmHideElement = class NgssmHideElement {
211
+ ngssmHideElement = input(void 0, ...ngDevMode ? [{ debugName: "ngssmHideElement" }] : /* istanbul ignore next */ []);
212
+ store = inject(Store);
213
+ hideElement() {
214
+ const elementKey = this.ngssmHideElement();
215
+ if (elementKey) this.store.dispatchAction(new HideElementAction(elementKey));
216
+ }
217
+ static ɵfac = i0.ɵɵngDeclareFactory({
218
+ minVersion: "12.0.0",
219
+ version: "22.2.0",
220
+ ngImport: i0,
221
+ type: NgssmHideElement,
222
+ deps: [],
223
+ target: i0.ɵɵFactoryTarget.Directive
224
+ });
225
+ static ɵdir = i0.ɵɵngDeclareDirective({
226
+ minVersion: "17.1.0",
227
+ version: "22.2.0",
228
+ type: NgssmHideElement,
229
+ isStandalone: true,
230
+ selector: "[ngssmHideElement]",
231
+ inputs: { ngssmHideElement: {
232
+ classPropertyName: "ngssmHideElement",
233
+ publicName: "ngssmHideElement",
234
+ isSignal: true,
235
+ isRequired: false,
236
+ transformFunction: null
237
+ } },
238
+ host: { listeners: { "click": "hideElement()" } },
239
+ ngImport: i0
240
+ });
241
+ };
242
+ i0.ɵɵngDeclareClassMetadata({
243
+ minVersion: "12.0.0",
244
+ version: "22.2.0",
245
+ ngImport: i0,
246
+ type: NgssmHideElement,
247
+ decorators: [{
248
+ type: Directive,
249
+ args: [{
250
+ selector: "[ngssmHideElement]",
251
+ host: { "(click)": "hideElement()" }
252
+ }]
253
+ }],
254
+ propDecorators: { ngssmHideElement: [{
255
+ type: i0.Input,
256
+ args: [{
257
+ isSignal: true,
258
+ alias: "ngssmHideElement",
259
+ required: false
260
+ }]
261
+ }] }
262
+ });
263
+ var NgssmToggleElementVisibility = class NgssmToggleElementVisibility {
264
+ ngssmToggleElementVisibility = input(void 0, ...ngDevMode ? [{ debugName: "ngssmToggleElementVisibility" }] : /* istanbul ignore next */ []);
265
+ store = inject(Store);
266
+ toggleElementVisibility() {
267
+ const elementKey = this.ngssmToggleElementVisibility();
268
+ if (elementKey) this.store.dispatchAction(new ToggleElementVisibilityAction(elementKey));
269
+ }
270
+ static ɵfac = i0.ɵɵngDeclareFactory({
271
+ minVersion: "12.0.0",
272
+ version: "22.2.0",
273
+ ngImport: i0,
274
+ type: NgssmToggleElementVisibility,
275
+ deps: [],
276
+ target: i0.ɵɵFactoryTarget.Directive
277
+ });
278
+ static ɵdir = i0.ɵɵngDeclareDirective({
279
+ minVersion: "17.1.0",
280
+ version: "22.2.0",
281
+ type: NgssmToggleElementVisibility,
282
+ isStandalone: true,
283
+ selector: "[ngssmToggleElementVisibility]",
284
+ inputs: { ngssmToggleElementVisibility: {
285
+ classPropertyName: "ngssmToggleElementVisibility",
286
+ publicName: "ngssmToggleElementVisibility",
287
+ isSignal: true,
288
+ isRequired: false,
289
+ transformFunction: null
290
+ } },
291
+ host: { listeners: { "click": "toggleElementVisibility()" } },
292
+ ngImport: i0
293
+ });
294
+ };
295
+ i0.ɵɵngDeclareClassMetadata({
296
+ minVersion: "12.0.0",
297
+ version: "22.2.0",
298
+ ngImport: i0,
299
+ type: NgssmToggleElementVisibility,
300
+ decorators: [{
301
+ type: Directive,
302
+ args: [{
303
+ selector: "[ngssmToggleElementVisibility]",
304
+ host: { "(click)": "toggleElementVisibility()" }
305
+ }]
306
+ }],
307
+ propDecorators: { ngssmToggleElementVisibility: [{
308
+ type: i0.Input,
309
+ args: [{
310
+ isSignal: true,
311
+ alias: "ngssmToggleElementVisibility",
312
+ required: false
313
+ }]
314
+ }] }
315
+ });
316
+ var NgssmVisibilityToggleGroup = class NgssmVisibilityToggleGroup {
317
+ items = input([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
318
+ hideMultipleSelectionIndicator = input(false, {
319
+ ...ngDevMode ? { debugName: "hideMultipleSelectionIndicator" } : /* istanbul ignore next */ {},
320
+ transform: booleanAttribute
321
+ });
322
+ store = inject(Store);
323
+ static ɵfac = i0.ɵɵngDeclareFactory({
324
+ minVersion: "12.0.0",
325
+ version: "22.2.0",
326
+ ngImport: i0,
327
+ type: NgssmVisibilityToggleGroup,
328
+ deps: [],
329
+ target: i0.ɵɵFactoryTarget.Component
330
+ });
331
+ static ɵcmp = i0.ɵɵngDeclareComponent({
332
+ minVersion: "17.0.0",
333
+ version: "22.2.0",
334
+ type: NgssmVisibilityToggleGroup,
335
+ isStandalone: true,
336
+ selector: "ngssm-visibility-toggle-group",
337
+ inputs: {
338
+ items: {
339
+ classPropertyName: "items",
340
+ publicName: "items",
341
+ isSignal: true,
342
+ isRequired: false,
343
+ transformFunction: null
344
+ },
345
+ hideMultipleSelectionIndicator: {
346
+ classPropertyName: "hideMultipleSelectionIndicator",
347
+ publicName: "hideMultipleSelectionIndicator",
348
+ isSignal: true,
349
+ isRequired: false,
350
+ transformFunction: null
351
+ }
352
+ },
353
+ ngImport: i0,
354
+ template: "<mat-button-toggle-group [multiple]=\"true\" [hideMultipleSelectionIndicator]=\"hideMultipleSelectionIndicator()\">\n @for (item of items(); track item.key) {\n <mat-button-toggle\n [ngssmToggleElementVisibility]=\"item.key\"\n [checked]=\"store.state() | ngssmIsElementVisible: item.key\"\n [id]=\"item.key\">\n {{ item.label }}\n </mat-button-toggle>\n }\n</mat-button-toggle-group>\n",
355
+ dependencies: [
356
+ {
357
+ kind: "directive",
358
+ type: MatButtonToggleGroup,
359
+ selector: "mat-button-toggle-group",
360
+ inputs: [
361
+ "appearance",
362
+ "name",
363
+ "vertical",
364
+ "value",
365
+ "multiple",
366
+ "disabled",
367
+ "disabledInteractive",
368
+ "hideSingleSelectionIndicator",
369
+ "hideMultipleSelectionIndicator"
370
+ ],
371
+ outputs: ["valueChange", "change"],
372
+ exportAs: ["matButtonToggleGroup"]
373
+ },
374
+ {
375
+ kind: "component",
376
+ type: MatButtonToggle,
377
+ selector: "mat-button-toggle",
378
+ inputs: [
379
+ "aria-label",
380
+ "aria-labelledby",
381
+ "id",
382
+ "name",
383
+ "value",
384
+ "tabIndex",
385
+ "disableRipple",
386
+ "appearance",
387
+ "checked",
388
+ "disabled",
389
+ "disabledInteractive"
390
+ ],
391
+ outputs: ["change"],
392
+ exportAs: ["matButtonToggle"]
393
+ },
394
+ {
395
+ kind: "directive",
396
+ type: NgssmToggleElementVisibility,
397
+ selector: "[ngssmToggleElementVisibility]",
398
+ inputs: ["ngssmToggleElementVisibility"]
399
+ },
400
+ {
401
+ kind: "pipe",
402
+ type: NgssmIsElementVisiblePipe,
403
+ name: "ngssmIsElementVisible"
404
+ }
405
+ ]
406
+ });
407
+ };
408
+ i0.ɵɵngDeclareClassMetadata({
409
+ minVersion: "12.0.0",
410
+ version: "22.2.0",
411
+ ngImport: i0,
412
+ type: NgssmVisibilityToggleGroup,
413
+ decorators: [{
414
+ type: Component,
415
+ args: [{
416
+ selector: "ngssm-visibility-toggle-group",
417
+ imports: [
418
+ MatButtonToggleGroup,
419
+ MatButtonToggle,
420
+ NgssmToggleElementVisibility,
421
+ NgssmIsElementVisiblePipe
422
+ ],
423
+ template: "<mat-button-toggle-group [multiple]=\"true\" [hideMultipleSelectionIndicator]=\"hideMultipleSelectionIndicator()\">\n @for (item of items(); track item.key) {\n <mat-button-toggle\n [ngssmToggleElementVisibility]=\"item.key\"\n [checked]=\"store.state() | ngssmIsElementVisible: item.key\"\n [id]=\"item.key\">\n {{ item.label }}\n </mat-button-toggle>\n }\n</mat-button-toggle-group>\n"
424
+ }]
425
+ }],
426
+ propDecorators: {
427
+ items: [{
428
+ type: i0.Input,
429
+ args: [{
430
+ isSignal: true,
431
+ alias: "items",
432
+ required: false
433
+ }]
434
+ }],
435
+ hideMultipleSelectionIndicator: [{
436
+ type: i0.Input,
437
+ args: [{
438
+ isSignal: true,
439
+ alias: "hideMultipleSelectionIndicator",
440
+ required: false
441
+ }]
442
+ }]
443
+ }
444
+ });
244
445
  const isElementVisible = (elementKey) => ({
245
- key: elementKey,
246
- visible: createSignal((state) => selectNgssmVisibilityState(state).elements[elementKey] === true)
446
+ key: elementKey,
447
+ visible: createSignal((state) => selectNgssmVisibilityState(state).elements[elementKey] === true)
247
448
  });
248
-
249
- /**
250
- * Generated bundle index. Do not edit.
251
- */
252
-
253
449
  export { DefineElementsGroupAction, HideElementAction, NgssmHideElement, NgssmIsElementVisiblePipe, NgssmShowElement, NgssmToggleElementVisibility, NgssmVisibilityActionType, NgssmVisibilityStateSpecification, NgssmVisibilityToggleGroup, ShowElementAction, ToggleElementVisibilityAction, VisibilityReducer, isElementVisible, provideNgssmVisibility, selectNgssmVisibilityState, updateNgssmVisibilityState };
254
- //# sourceMappingURL=ngssm-store-visibility.mjs.map
450
+
451
+ //# sourceMappingURL=ngssm-store-visibility.mjs.map