iss-ctrl 0.0.8 → 0.0.9

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.
Files changed (26) hide show
  1. package/fesm2022/{iss-ctrl-iss-ctrl-BLjj_Aqu.mjs → iss-ctrl-iss-ctrl-BN7L4PtW.mjs} +929 -438
  2. package/fesm2022/iss-ctrl-iss-ctrl-BN7L4PtW.mjs.map +1 -0
  3. package/fesm2022/{iss-ctrl-load-event-Co3HQu91.mjs → iss-ctrl-load-event-CGgv6kpn.mjs} +3 -3
  4. package/fesm2022/{iss-ctrl-load-event-Co3HQu91.mjs.map → iss-ctrl-load-event-CGgv6kpn.mjs.map} +1 -1
  5. package/fesm2022/{iss-ctrl-load-options-event-BIn0aiHl.mjs → iss-ctrl-load-options-event-ClRozxct.mjs} +3 -3
  6. package/fesm2022/{iss-ctrl-load-options-event-BIn0aiHl.mjs.map → iss-ctrl-load-options-event-ClRozxct.mjs.map} +1 -1
  7. package/fesm2022/{iss-ctrl-load-value-event-idouR9ST.mjs → iss-ctrl-load-value-event-3zloE5y4.mjs} +3 -3
  8. package/fesm2022/{iss-ctrl-load-value-event-idouR9ST.mjs.map → iss-ctrl-load-value-event-3zloE5y4.mjs.map} +1 -1
  9. package/fesm2022/{iss-ctrl-note.field-CuTQ3YwJ.mjs → iss-ctrl-note.field-BmQkVu8o.mjs} +4 -4
  10. package/fesm2022/{iss-ctrl-note.field-CuTQ3YwJ.mjs.map → iss-ctrl-note.field-BmQkVu8o.mjs.map} +1 -1
  11. package/fesm2022/{iss-ctrl-replace-api-keys-Df8ruZtV.mjs → iss-ctrl-replace-api-keys-CkdiTxRe.mjs} +2 -2
  12. package/fesm2022/{iss-ctrl-replace-api-keys-Df8ruZtV.mjs.map → iss-ctrl-replace-api-keys-CkdiTxRe.mjs.map} +1 -1
  13. package/fesm2022/{iss-ctrl-set-value-event-BNNMVIeT.mjs → iss-ctrl-set-value-event-OrkUS2nT.mjs} +2 -2
  14. package/fesm2022/{iss-ctrl-set-value-event-BNNMVIeT.mjs.map → iss-ctrl-set-value-event-OrkUS2nT.mjs.map} +1 -1
  15. package/fesm2022/{iss-ctrl-table.field-Bs6l5tWV.mjs → iss-ctrl-table.field-B42zKves.mjs} +126 -63
  16. package/fesm2022/iss-ctrl-table.field-B42zKves.mjs.map +1 -0
  17. package/fesm2022/{iss-ctrl-trigger-based-on-json-value-6yh7NOEH.mjs → iss-ctrl-trigger-based-on-json-value-C6jf7SSW.mjs} +2 -2
  18. package/fesm2022/{iss-ctrl-trigger-based-on-json-value-6yh7NOEH.mjs.map → iss-ctrl-trigger-based-on-json-value-C6jf7SSW.mjs.map} +1 -1
  19. package/fesm2022/{iss-ctrl-user-picker.field-Cx0CCAFC.mjs → iss-ctrl-user-picker.field-D5slkCaX.mjs} +36 -20
  20. package/fesm2022/iss-ctrl-user-picker.field-D5slkCaX.mjs.map +1 -0
  21. package/fesm2022/iss-ctrl.mjs +1 -1
  22. package/package.json +1 -1
  23. package/types/iss-ctrl.d.ts +44 -29
  24. package/fesm2022/iss-ctrl-iss-ctrl-BLjj_Aqu.mjs.map +0 -1
  25. package/fesm2022/iss-ctrl-table.field-Bs6l5tWV.mjs.map +0 -1
  26. package/fesm2022/iss-ctrl-user-picker.field-Cx0CCAFC.mjs.map +0 -1
@@ -2,8 +2,8 @@ import { HttpClient } from '@angular/common/http';
2
2
  import * as i0 from '@angular/core';
3
3
  import { InjectionToken, inject, Injectable } from '@angular/core';
4
4
  import { map, EMPTY } from 'rxjs';
5
- import { P as PLACEHOLDER_REGEX, H as HOST } from './iss-ctrl-iss-ctrl-BLjj_Aqu.mjs';
6
- import { ReplaceApiKeys } from './iss-ctrl-replace-api-keys-Df8ruZtV.mjs';
5
+ import { P as PLACEHOLDER_REGEX, H as HOST } from './iss-ctrl-iss-ctrl-BN7L4PtW.mjs';
6
+ import { ReplaceApiKeys } from './iss-ctrl-replace-api-keys-CkdiTxRe.mjs';
7
7
 
8
8
  const API_RESPONSE_MAPPER = new InjectionToken("Map backend response to required response interface.");
9
9
 
@@ -57,4 +57,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
57
57
  }] });
58
58
 
59
59
  export { IssHttp as I, LoadEvent as L };
60
- //# sourceMappingURL=iss-ctrl-load-event-Co3HQu91.mjs.map
60
+ //# sourceMappingURL=iss-ctrl-load-event-CGgv6kpn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"iss-ctrl-load-event-Co3HQu91.mjs","sources":["../../../projects/iss/src/shared/tokens/api-response-mapper.token.ts","../../../projects/iss/src/shared/utilities/is-valid-api.util.ts","../../../projects/iss/src/shared/utilities/http.util.service.ts","../../../projects/iss/src/events/load/load-event.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\nimport { Dto } from \"../interfaces/dto\";\r\n\r\nexport const API_RESPONSE_MAPPER: InjectionToken<(res: any) => Dto> = new InjectionToken(\"Map backend response to required response interface.\");\r\n","import { PLACEHOLDER_REGEX } from \"../constants/placeholder-regex.const\";\r\n\r\nexport function isValidEndpoint(api: string): boolean {\r\n if (api.includes(\"undefined\") || api.includes(\"null\")) {\r\n return false;\r\n }\r\n return !api.match(PLACEHOLDER_REGEX)?.length && ![\"undefined\", \"null\"].includes(api);\r\n}\r\n","import { HttpClient } from \"@angular/common/http\";\r\nimport { inject, Injectable } from \"@angular/core\";\r\nimport { EMPTY, map, Observable } from \"rxjs\";\r\nimport { Dto } from \"../interfaces/dto\";\r\nimport { API_RESPONSE_MAPPER } from \"../tokens/api-response-mapper.token\";\r\nimport { isValidEndpoint } from \"./is-valid-api.util\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class IssHttp {\r\n #http: HttpClient = inject(HttpClient);\r\n #apiResponseMapper = inject(API_RESPONSE_MAPPER);\r\n\r\n get<T>(url: string): Observable<Dto> {\r\n if (isValidEndpoint(url)) {\r\n return this.#http.get<T>(url).pipe(map((res: any): Dto => this.#apiResponseMapper(res)));\r\n }\r\n return EMPTY;\r\n }\r\n}\r\n","import { inject, Injectable } from \"@angular/core\";\r\nimport { EventArgument } from \"../../shared/interfaces/event-strategy\";\r\nimport { HOST } from \"../../shared/tokens/host.token\";\r\nimport { ReplaceApiKeys } from \"./replace-api-keys\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class LoadEvent {\r\n #replaceApiKeysService = inject(ReplaceApiKeys);\r\n #host: string = inject(HOST);\r\n\r\n getApi(args: EventArgument) {\r\n let api;\r\n if (args.action.config.fn) {\r\n api = args.action.config.fn.execute(args);\r\n } else {\r\n api = this.#replaceApiKeysService.execute(args);\r\n }\r\n\r\n return `${this.#host}${api}`;\r\n }\r\n\r\n fetchErrorHandler(args: EventArgument, err: any) {\r\n console.error(err);\r\n args.field.loading.set(false);\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;AAGO,MAAM,mBAAmB,GAAsC,IAAI,cAAc,CAAC,sDAAsD,CAAC;;ACD1I,SAAU,eAAe,CAAC,GAAW,EAAA;AACzC,IAAA,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AACrD,QAAA,OAAO,KAAK;IACd;IACA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;AACtF;;MCCa,OAAO,CAAA;AAClB,IAAA,KAAK,GAAe,MAAM,CAAC,UAAU,CAAC;AACtC,IAAA,kBAAkB,GAAG,MAAM,CAAC,mBAAmB,CAAC;AAEhD,IAAA,GAAG,CAAI,GAAW,EAAA;AAChB,QAAA,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE;YACxB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAQ,KAAU,IAA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,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,SAAS,cADG,MAAM,EAAA,CAAA;;2FAClB,SAAS,EAAA,UAAA,EAAA,CAAA;kBADrB,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;;;"}
1
+ {"version":3,"file":"iss-ctrl-load-event-CGgv6kpn.mjs","sources":["../../../projects/iss/src/shared/tokens/api-response-mapper.token.ts","../../../projects/iss/src/shared/utilities/is-valid-api.util.ts","../../../projects/iss/src/shared/utilities/http.util.service.ts","../../../projects/iss/src/events/load/load-event.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\nimport { Dto } from \"../interfaces/dto\";\r\n\r\nexport const API_RESPONSE_MAPPER: InjectionToken<(res: any) => Dto> = new InjectionToken(\"Map backend response to required response interface.\");\r\n","import { PLACEHOLDER_REGEX } from \"../constants/placeholder-regex.const\";\r\n\r\nexport function isValidEndpoint(api: string): boolean {\r\n if (api.includes(\"undefined\") || api.includes(\"null\")) {\r\n return false;\r\n }\r\n return !api.match(PLACEHOLDER_REGEX)?.length && ![\"undefined\", \"null\"].includes(api);\r\n}\r\n","import { HttpClient } from \"@angular/common/http\";\r\nimport { inject, Injectable } from \"@angular/core\";\r\nimport { EMPTY, map, Observable } from \"rxjs\";\r\nimport { Dto } from \"../interfaces/dto\";\r\nimport { API_RESPONSE_MAPPER } from \"../tokens/api-response-mapper.token\";\r\nimport { isValidEndpoint } from \"./is-valid-api.util\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class IssHttp {\r\n #http: HttpClient = inject(HttpClient);\r\n #apiResponseMapper = inject(API_RESPONSE_MAPPER);\r\n\r\n get<T>(url: string): Observable<Dto> {\r\n if (isValidEndpoint(url)) {\r\n return this.#http.get<T>(url).pipe(map((res: any): Dto => this.#apiResponseMapper(res)));\r\n }\r\n return EMPTY;\r\n }\r\n}\r\n","import { inject, Injectable } from \"@angular/core\";\r\nimport { EventArgument } from \"../../shared/interfaces/event-strategy\";\r\nimport { HOST } from \"../../shared/tokens/host.token\";\r\nimport { ReplaceApiKeys } from \"./replace-api-keys\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class LoadEvent {\r\n #replaceApiKeysService = inject(ReplaceApiKeys);\r\n #host: string = inject(HOST);\r\n\r\n getApi(args: EventArgument) {\r\n let api;\r\n if (args.action.config.fn) {\r\n api = args.action.config.fn.execute(args);\r\n } else {\r\n api = this.#replaceApiKeysService.execute(args);\r\n }\r\n\r\n return `${this.#host}${api}`;\r\n }\r\n\r\n fetchErrorHandler(args: EventArgument, err: any) {\r\n console.error(err);\r\n args.field.loading.set(false);\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;AAGO,MAAM,mBAAmB,GAAsC,IAAI,cAAc,CAAC,sDAAsD,CAAC;;ACD1I,SAAU,eAAe,CAAC,GAAW,EAAA;AACzC,IAAA,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AACrD,QAAA,OAAO,KAAK;IACd;IACA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;AACtF;;MCCa,OAAO,CAAA;AAClB,IAAA,KAAK,GAAe,MAAM,CAAC,UAAU,CAAC;AACtC,IAAA,kBAAkB,GAAG,MAAM,CAAC,mBAAmB,CAAC;AAEhD,IAAA,GAAG,CAAI,GAAW,EAAA;AAChB,QAAA,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE;YACxB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAQ,KAAU,IAAI,CAAC,kBAAkB,CAAC,GAAG,C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A,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,SAAS,cADG,MAAM,EAAA,CAAA;;2FAClB,SAAS,EAAA,UAAA,EAAA,CAAA;kBADrB,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable } from '@angular/core';
3
- import { g as getPropertyByPath } from './iss-ctrl-iss-ctrl-BLjj_Aqu.mjs';
4
- import { L as LoadEvent, I as IssHttp } from './iss-ctrl-load-event-Co3HQu91.mjs';
3
+ import { g as getPropertyByPath } from './iss-ctrl-iss-ctrl-BN7L4PtW.mjs';
4
+ import { L as LoadEvent, I as IssHttp } from './iss-ctrl-load-event-CGgv6kpn.mjs';
5
5
 
6
6
  class LoadOptionsEvent {
7
7
  loadEvent = inject(LoadEvent);
@@ -47,4 +47,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
47
47
  }] });
48
48
 
49
49
  export { LoadOptionsEvent };
50
- //# sourceMappingURL=iss-ctrl-load-options-event-BIn0aiHl.mjs.map
50
+ //# sourceMappingURL=iss-ctrl-load-options-event-ClRozxct.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"iss-ctrl-load-options-event-BIn0aiHl.mjs","sources":["../../../projects/iss/src/events/load/load-options-event.ts"],"sourcesContent":["import { inject, Injectable } from \"@angular/core\";\r\nimport { Dto } from \"../../shared/interfaces/dto\";\r\nimport { EventArgument, EventStrategy } from \"../../shared/interfaces/event-strategy\";\r\nimport { getPropertyByPath } from \"../../shared/utilities/get-property-by-path.util\";\r\nimport { IssHttp } from \"../../shared/utilities/http.util.service\";\r\nimport { LoadEvent } from \"./load-event\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class LoadOptionsEvent implements EventStrategy {\r\n loadEvent = inject(LoadEvent);\r\n #http: IssHttp = inject(IssHttp);\r\n\r\n fire(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Load Event Fired\", \"color: green\");\r\n const api = this.loadEvent.getApi(args);\r\n\r\n args.field.loading.set(true);\r\n this.#http.get(api).subscribe({\r\n next: (response: Dto) => {\r\n args.field.response.set(response.data);\r\n args.field.apiResponse.next(response.data);\r\n\r\n if (args.action.config.afterFetchFn) {\r\n args.action.config.afterFetchFn?.execute(args);\r\n } else {\r\n args.field.options.set(args.field.response());\r\n\r\n if (args.action.config.setValueFromApiResponse) {\r\n args.control.setValue(getPropertyByPath(args.field.response(), args.action.config.setValueFromApiResponse));\r\n }\r\n\r\n if (args.action.config.disableAfterFetching) {\r\n args.control.disable();\r\n }\r\n }\r\n args.field.loading.set(false);\r\n },\r\n error: (err) => {\r\n // todo handle errors\r\n this.loadEvent.fetchErrorHandler(args, err);\r\n },\r\n });\r\n args.action.triggered = true;\r\n }\r\n\r\n revert(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Load Event Reverted\", \"color: red\");\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;MAQa,gBAAgB,CAAA;AAC3B,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,IAAA,KAAK,GAAY,MAAM,CAAC,OAAO,CAAC;AAEhC,IAAA,IAAI,CAAC,IAAmB,EAAA;QACtB,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA,YAAA,EAAe,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAA,GAAA,CAAK,GAAG,qBAAqB,EAAE,cAAc,CAAC;QACvH,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;QAEvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,GAAG,C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C,KAAK,CAAC,IAAI,CAAA,YAAA,EAAe,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAA,GAAA,CAAK,GAAG,wBAAwB,EAAE,YAAY,CAAC;IAC1H;uGAvCW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADJ,MAAM,EAAA,CAAA;;2FAClB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;;;"}
1
+ {"version":3,"file":"iss-ctrl-load-options-event-ClRozxct.mjs","sources":["../../../projects/iss/src/events/load/load-options-event.ts"],"sourcesContent":["import { inject, Injectable } from \"@angular/core\";\r\nimport { Dto } from \"../../shared/interfaces/dto\";\r\nimport { EventArgument, EventStrategy } from \"../../shared/interfaces/event-strategy\";\r\nimport { getPropertyByPath } from \"../../shared/utilities/get-property-by-path.util\";\r\nimport { IssHttp } from \"../../shared/utilities/http.util.service\";\r\nimport { LoadEvent } from \"./load-event\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class LoadOptionsEvent implements EventStrategy {\r\n loadEvent = inject(LoadEvent);\r\n #http: IssHttp = inject(IssHttp);\r\n\r\n fire(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Load Event Fired\", \"color: green\");\r\n const api = this.loadEvent.getApi(args);\r\n\r\n args.field.loading.set(true);\r\n this.#http.get(api).subscribe({\r\n next: (response: Dto) => {\r\n args.field.response.set(response.data);\r\n args.field.apiResponse.next(response.data);\r\n\r\n if (args.action.config.afterFetchFn) {\r\n args.action.config.afterFetchFn?.execute(args);\r\n } else {\r\n args.field.options.set(args.field.response());\r\n\r\n if (args.action.config.setValueFromApiResponse) {\r\n args.control.setValue(getPropertyByPath(args.field.response(), args.action.config.setValueFromApiResponse));\r\n }\r\n\r\n if (args.action.config.disableAfterFetching) {\r\n args.control.disable();\r\n }\r\n }\r\n args.field.loading.set(false);\r\n },\r\n error: (err) => {\r\n // todo handle errors\r\n this.loadEvent.fetchErrorHandler(args, err);\r\n },\r\n });\r\n args.action.triggered = true;\r\n }\r\n\r\n revert(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Load Event Reverted\", \"color: red\");\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;MAQa,gBAAgB,CAAA;AAC3B,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,IAAA,KAAK,GAAY,MAAM,CAAC,OAAO,CAAC;AAEhC,IAAA,IAAI,CAAC,IAAmB,EAAA;QACtB,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA,YAAA,EAAe,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAA,GAAA,CAAK,GAAG,qBAAqB,EAAE,cAAc,CAAC;QACvH,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;QAEvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;AAC5B,YAAA,IAAI,EAAE,CAAC,QAAa,KAAI;gBACtB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACtC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAE1C,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;oBACnC,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EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADJ,MAAM,EAAA,CAAA;;2FAClB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable } from '@angular/core';
3
- import { g as getPropertyByPath } from './iss-ctrl-iss-ctrl-BLjj_Aqu.mjs';
4
- import { L as LoadEvent, I as IssHttp } from './iss-ctrl-load-event-Co3HQu91.mjs';
3
+ import { g as getPropertyByPath } from './iss-ctrl-iss-ctrl-BN7L4PtW.mjs';
4
+ import { L as LoadEvent, I as IssHttp } from './iss-ctrl-load-event-CGgv6kpn.mjs';
5
5
 
6
6
  class LoadValueEvent {
7
7
  loadEvent = inject(LoadEvent);
@@ -49,4 +49,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
49
49
  }] });
50
50
 
51
51
  export { LoadValueEvent };
52
- //# sourceMappingURL=iss-ctrl-load-value-event-idouR9ST.mjs.map
52
+ //# sourceMappingURL=iss-ctrl-load-value-event-3zloE5y4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"iss-ctrl-load-value-event-idouR9ST.mjs","sources":["../../../projects/iss/src/events/load/load-value-event.ts"],"sourcesContent":["import { inject, Injectable } from \"@angular/core\";\r\nimport { Dto } from \"../../shared/interfaces/dto\";\r\nimport { EventArgument, EventStrategy } from \"../../shared/interfaces/event-strategy\";\r\nimport { getPropertyByPath } from \"../../shared/utilities/get-property-by-path.util\";\r\nimport { IssHttp } from \"../../shared/utilities/http.util.service\";\r\nimport { LoadEvent } from \"./load-event\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class LoadValueEvent implements EventStrategy {\r\n loadEvent = inject(LoadEvent);\r\n #http: IssHttp = inject(IssHttp);\r\n\r\n fire(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Load Event Fired\", \"color: green\");\r\n const api = this.loadEvent.getApi(args);\r\n\r\n args.field.loading.set(true);\r\n this.#http.get(api).subscribe({\r\n next: (response: Dto) => {\r\n args.field.response.set(response.data);\r\n args.field.apiResponse.next(response.data);\r\n\r\n if (args.action.config.afterFetchFn) {\r\n args.action.config.afterFetchFn?.execute(args);\r\n } else {\r\n if (args.action?.config?.setValueFromApiResponse) {\r\n args.control.setValue(getPropertyByPath(args.field.response(), args.action.config.setValueFromApiResponse));\r\n } else {\r\n args.control.setValue(args.field.response());\r\n }\r\n\r\n if (args.action.config.disableAfterFetching) {\r\n args.control.disable();\r\n }\r\n }\r\n\r\n args.field.loading.set(false);\r\n },\r\n error: (err) => {\r\n // todo handle errors\r\n this.loadEvent.fetchErrorHandler(args, err);\r\n },\r\n });\r\n args.action.triggered = true;\r\n }\r\n\r\n revert(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Load Event Reverted\", \"color: red\");\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;MAQa,cAAc,CAAA;AACzB,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,IAAA,KAAK,GAAY,MAAM,CAAC,OAAO,CAAC;AAEhC,IAAA,IAAI,CAAC,IAAmB,EAAA;QACtB,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA,YAAA,EAAe,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAA,GAAA,CAAK,GAAG,qBAAqB,EAAE,cAAc,CAAC;QACvH,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;QAEvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,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CAAA,YAAA,EAAe,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAA,GAAA,CAAK,GAAG,wBAAwB,EAAE,YAAY,CAAC;IAC1H;uGAxCW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cADF,MAAM,EAAA,CAAA;;2FAClB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;;;"}
1
+ {"version":3,"file":"iss-ctrl-load-value-event-3zloE5y4.mjs","sources":["../../../projects/iss/src/events/load/load-value-event.ts"],"sourcesContent":["import { inject, Injectable } from \"@angular/core\";\r\nimport { Dto } from \"../../shared/interfaces/dto\";\r\nimport { EventArgument, EventStrategy } from \"../../shared/interfaces/event-strategy\";\r\nimport { getPropertyByPath } from \"../../shared/utilities/get-property-by-path.util\";\r\nimport { IssHttp } from \"../../shared/utilities/http.util.service\";\r\nimport { LoadEvent } from \"./load-event\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class LoadValueEvent implements EventStrategy {\r\n loadEvent = inject(LoadEvent);\r\n #http: IssHttp = inject(IssHttp);\r\n\r\n fire(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Load Event Fired\", \"color: green\");\r\n const api = this.loadEvent.getApi(args);\r\n\r\n args.field.loading.set(true);\r\n this.#http.get(api).subscribe({\r\n next: (response: Dto) => {\r\n args.field.response.set(response.data);\r\n args.field.apiResponse.next(response.data);\r\n\r\n if (args.action.config.afterFetchFn) {\r\n args.action.config.afterFetchFn?.execute(args);\r\n } else {\r\n if (args.action?.config?.setValueFromApiResponse) {\r\n args.control.setValue(getPropertyByPath(args.field.response(), args.action.config.setValueFromApiResponse));\r\n } else {\r\n args.control.setValue(args.field.response());\r\n }\r\n\r\n if (args.action.config.disableAfterFetching) {\r\n args.control.disable();\r\n }\r\n }\r\n\r\n args.field.loading.set(false);\r\n },\r\n error: (err) => {\r\n // todo handle errors\r\n this.loadEvent.fetchErrorHandler(args, err);\r\n },\r\n });\r\n args.action.triggered = true;\r\n }\r\n\r\n revert(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Load Event Reverted\", \"color: red\");\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;MAQa,cAAc,CAAA;AACzB,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,IAAA,KAAK,GAAY,MAAM,CAAC,OAAO,CAAC;AAEhC,IAAA,IAAI,CAAC,IAAmB,EAAA;QACtB,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA,YAAA,EAAe,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAA,GAAA,CAAK,GAAG,qBAAqB,EAAE,cAAc,CAAC;QACvH,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;QAEvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;AAC5B,YAAA,IAAI,EAAE,CAAC,QAAa,KAAI;gBACtB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACtC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAE1C,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;oBACnC,IAAI,CAAC,MAAM,CAAC,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AAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cADF,MAAM,EAAA,CAAA;;2FAClB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;;;"}
@@ -2,13 +2,13 @@ import * as i0 from '@angular/core';
2
2
  import { Component } from '@angular/core';
3
3
  import { ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatLabel } from '@angular/material/form-field';
5
- import { F as FieldBase, V as VIEW_PROVIDER } from './iss-ctrl-iss-ctrl-BLjj_Aqu.mjs';
5
+ import { F as FieldBase, V as VIEW_PROVIDER } from './iss-ctrl-iss-ctrl-BN7L4PtW.mjs';
6
6
 
7
7
  class NoteField extends FieldBase {
8
8
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NoteField, deps: null, target: i0.ɵɵFactoryTarget.Component });
9
9
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: NoteField, isStandalone: true, selector: "iss-field-note", usesInheritance: true, ngImport: i0, template: `
10
10
  @if (field.visible()) {
11
- @if (!(field.config.hideLabel)) {
11
+ @if (!field.config.hideLabel()) {
12
12
  <mat-label>{{ field.label() }}</mat-label>
13
13
  }
14
14
  <p>
@@ -28,7 +28,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
28
28
  ],
29
29
  template: `
30
30
  @if (field.visible()) {
31
- @if (!(field.config.hideLabel)) {
31
+ @if (!field.config.hideLabel()) {
32
32
  <mat-label>{{ field.label() }}</mat-label>
33
33
  }
34
34
  <p>
@@ -40,4 +40,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
40
40
  }] });
41
41
 
42
42
  export { NoteField };
43
- //# sourceMappingURL=iss-ctrl-note.field-CuTQ3YwJ.mjs.map
43
+ //# sourceMappingURL=iss-ctrl-note.field-BmQkVu8o.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"iss-ctrl-note.field-CuTQ3YwJ.mjs","sources":["../../../projects/iss/src/components/controls/note/note.field.ts"],"sourcesContent":["import { Component } from \"@angular/core\";\r\nimport { ReactiveFormsModule } from \"@angular/forms\";\r\nimport { MatLabel } from \"@angular/material/form-field\";\r\nimport { VIEW_PROVIDER } from \"../../../shared/constants/view-provider.const\";\r\nimport { FieldBase } from \"../base/field-base\";\r\n\r\n@Component({\r\n selector: \"iss-field-note\",\r\n viewProviders: [VIEW_PROVIDER],\r\n imports: [\r\n ReactiveFormsModule,\r\n MatLabel\r\n ],\r\n template: `\r\n @if (field.visible()) {\r\n @if (!(field.config.hideLabel)) {\r\n <mat-label>{{ field.label() }}</mat-label>\r\n }\r\n <p>\r\n {{ ctrlValueChange() }}\r\n </p>\r\n }\r\n `\r\n})\r\nexport class NoteField extends FieldBase {}\r\n"],"names":[],"mappings":";;;;;;AAwBM,MAAO,SAAU,SAAQ,SAAS,CAAA;uGAA3B,SAAS,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAT,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,SAAS,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAXV,CAAA;;;;;;;;;AAST,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAZC,mBAAmB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACnB,QAAQ,EAAA,QAAA,EAAA,WAAA,EAAA,CAAA,EAAA,aAAA,EAHK,CAAC,aAAa,CAAC,EAAA,CAAA;;2FAgBnB,SAAS,EAAA,UAAA,EAAA,CAAA;kBAlBrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;oBAC1B,aAAa,EAAE,CAAC,aAAa,CAAC;AAC9B,oBAAA,OAAO,EAAE;wBACP,mBAAmB;wBACnB;AACD,qBAAA;AACD,oBAAA,QAAQ,EAAE,CAAA;;;;;;;;;AAST,EAAA;AACF,iBAAA;;;;;"}
1
+ {"version":3,"file":"iss-ctrl-note.field-BmQkVu8o.mjs","sources":["../../../projects/iss/src/components/controls/note/note.field.ts"],"sourcesContent":["import { Component } from \"@angular/core\";\r\nimport { ReactiveFormsModule } from \"@angular/forms\";\r\nimport { MatLabel } from \"@angular/material/form-field\";\r\nimport { VIEW_PROVIDER } from \"../../../shared/constants/view-provider.const\";\r\nimport { FieldBase } from \"../base/field-base\";\r\n\r\n@Component({\r\n selector: \"iss-field-note\",\r\n viewProviders: [VIEW_PROVIDER],\r\n imports: [\r\n ReactiveFormsModule,\r\n MatLabel\r\n ],\r\n template: `\r\n @if (field.visible()) {\r\n @if (!field.config.hideLabel()) {\r\n <mat-label>{{ field.label() }}</mat-label>\r\n }\r\n <p>\r\n {{ ctrlValueChange() }}\r\n </p>\r\n }\r\n `\r\n})\r\nexport class NoteField extends FieldBase {}\r\n"],"names":[],"mappings":";;;;;;AAwBM,MAAO,SAAU,SAAQ,SAAS,CAAA;uGAA3B,SAAS,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAT,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,SAAS,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAXV,CAAA;;;;;;;;;AAST,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAZC,mBAAmB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACnB,QAAQ,EAAA,QAAA,EAAA,WAAA,EAAA,CAAA,EAAA,aAAA,EAHK,CAAC,aAAa,CAAC,EAAA,CAAA;;2FAgBnB,SAAS,EAAA,UAAA,EAAA,CAAA;kBAlBrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;oBAC1B,aAAa,EAAE,CAAC,aAAa,CAAC;AAC9B,oBAAA,OAAO,EAAE;wBACP,mBAAmB;wBACnB;AACD,qBAAA;AACD,oBAAA,QAAQ,EAAE,CAAA;;;;;;;;;AAST,EAAA;AACF,iBAAA;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable } from '@angular/core';
3
- import { P as PLACEHOLDER_REGEX, g as getPropertyByPath, r as replacePlaceholders } from './iss-ctrl-iss-ctrl-BLjj_Aqu.mjs';
3
+ import { P as PLACEHOLDER_REGEX, g as getPropertyByPath, r as replacePlaceholders } from './iss-ctrl-iss-ctrl-BN7L4PtW.mjs';
4
4
 
5
5
  class ReplaceApiKeys {
6
6
  // todo replace {key} with tracked field value [will be deprecated]
@@ -54,4 +54,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
54
54
  }] });
55
55
 
56
56
  export { ReplaceApiKeys };
57
- //# sourceMappingURL=iss-ctrl-replace-api-keys-Df8ruZtV.mjs.map
57
+ //# sourceMappingURL=iss-ctrl-replace-api-keys-CkdiTxRe.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"iss-ctrl-replace-api-keys-Df8ruZtV.mjs","sources":["../../../projects/iss/src/events/load/replace-api-keys.ts"],"sourcesContent":["import { Injectable } from \"@angular/core\";\r\nimport { PLACEHOLDER_REGEX } from \"../../shared/constants/placeholder-regex.const\";\r\nimport { EventArgument, EventConfigFn } from \"../../shared/interfaces/event-strategy\";\r\nimport { getPropertyByPath } from \"../../shared/utilities/get-property-by-path.util\";\r\nimport { replacePlaceholders } from \"../../shared/utilities/replace-placeholder.util\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class ReplaceApiKeys implements EventConfigFn {\r\n // todo replace {key} with tracked field value [will be deprecated]\r\n execute(args: EventArgument): string {\r\n // console.log(\"Replace API keys - Default Implementation\");\r\n const api = args.field.api();\r\n const matches = api.match(PLACEHOLDER_REGEX);\r\n if (matches) {\r\n const replacements: any = {};\r\n matches.forEach((match) => {\r\n const replacement = match.replace(\"{\", \"\").replace(\"}\", \"\");\r\n\r\n if (replacement.includes(\".\")) {\r\n const path = this.getPath(replacement);\r\n\r\n if (replacement.includes(args.change.trackedField.name)) {\r\n replacements[replacement] = getPropertyByPath(args.change.trackedField, path);\r\n }\r\n\r\n if (replacement.includes(\"loggedInUser\")) {\r\n const loggedInUserProfileStr = localStorage.getItem(\"profile\");\r\n if (loggedInUserProfileStr) {\r\n const loggedInUserProfile = JSON.parse(loggedInUserProfileStr);\r\n replacements[replacement] = getPropertyByPath(loggedInUserProfile, path);\r\n } else {\r\n throw new Error(\"User profile not found in localStorage. Make sure that localStorage has profile key with user profile.\");\r\n }\r\n }\r\n\r\n if (replacement.includes(\"requestDto\")) {\r\n // todo replace {fromRequestDto}\r\n // todo from where to get requestDto?\r\n }\r\n } else {\r\n replacements[replacement] = args.form.get(replacement)?.getRawValue();\r\n }\r\n });\r\n return replacePlaceholders(api, replacements);\r\n }\r\n\r\n return api;\r\n }\r\n\r\n getPath(replacement: string): string {\r\n const arr = replacement.split(\".\");\r\n arr.shift();\r\n return arr.join(\".\");\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;MAOa,cAAc,CAAA;;AAEzB,IAAA,OAAO,CAAC,IAAmB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AI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE;gBACvE;AACF,YAAA,CAAC,CAAC;AACF,YAAA,OAAO,mBAAmB,CAAC,GAAG,EAAE,YAAY,CAAC;QAC/C;AAEA,QAAA,OAAO,GAAG;IACZ;AAEA,IAAA,OAAO,CAAC,WAAmB,EAAA;QACzB,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC;QAClC,GAAG,CAAC,KAAK,EAAE;AACX,QAAA,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;IACtB;uGA9CW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cADF,MAAM,EAAA,CAAA;;2FAClB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;;;"}
1
+ {"version":3,"file":"iss-ctrl-replace-api-keys-CkdiTxRe.mjs","sources":["../../../projects/iss/src/events/load/replace-api-keys.ts"],"sourcesContent":["import { Injectable } from \"@angular/core\";\r\nimport { PLACEHOLDER_REGEX } from \"../../shared/constants/placeholder-regex.const\";\r\nimport { EventArgument, EventConfigFn } from \"../../shared/interfaces/event-strategy\";\r\nimport { getPropertyByPath } from \"../../shared/utilities/get-property-by-path.util\";\r\nimport { replacePlaceholders } from \"../../shared/utilities/replace-placeholder.util\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class ReplaceApiKeys implements EventConfigFn {\r\n // todo replace {key} with tracked field value [will be deprecated]\r\n execute(args: EventArgument): string {\r\n // console.log(\"Replace API keys - Default Implementation\");\r\n const api = args.field.api();\r\n const matches = api.match(PLACEHOLDER_REGEX);\r\n if (matches) {\r\n const replacements: any = {};\r\n matches.forEach((match) => {\r\n const replacement = match.replace(\"{\", \"\").replace(\"}\", \"\");\r\n\r\n if (replacement.includes(\".\")) {\r\n const path = this.getPath(replacement);\r\n\r\n if (replacement.includes(args.change.trackedField.name)) {\r\n replacements[replacement] = getPropertyByPath(args.change.trackedField, path);\r\n }\r\n\r\n if (replacement.includes(\"loggedInUser\")) {\r\n const loggedInUserProfileStr = localStorage.getItem(\"profile\");\r\n if (loggedInUserProfileStr) {\r\n const loggedInUserProfile = JSON.parse(loggedInUserProfileStr);\r\n replacements[replacement] = getPropertyByPath(loggedInUserProfile, path);\r\n } else {\r\n throw new Error(\"User profile not found in localStorage. Make sure that localStorage has profile key with user profile.\");\r\n }\r\n }\r\n\r\n if (replacement.includes(\"requestDto\")) {\r\n // todo replace {fromRequestDto}\r\n // todo from where to get requestDto?\r\n }\r\n } else {\r\n replacements[replacement] = args.form.get(replacement)?.getRawValue();\r\n }\r\n });\r\n return replacePlaceholders(api, replacements);\r\n }\r\n\r\n return api;\r\n }\r\n\r\n getPath(replacement: string): string {\r\n const arr = replacement.split(\".\");\r\n arr.shift();\r\n return arr.join(\".\");\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;MAOa,cAAc,CAAA;;AAEzB,IAAA,OAAO,CAAC,IAAmB,EAAA;;QAEzB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;QAC5B,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC;QAC5C,IAAI,OAAO,EAAE;YACX,MAAM,YAAY,GAAQ,EAAE;AAC5B,YAAA,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;AACxB,gBAAA,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;AAE3D,gBAAA,IAAI,WAAW,CAAC,QAAQ,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MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cADF,MAAM,EAAA,CAAA;;2FAClB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, inject } from '@angular/core';
3
3
  import { of, map } from 'rxjs';
4
- import { g as getPropertyByPath } from './iss-ctrl-iss-ctrl-BLjj_Aqu.mjs';
4
+ import { g as getPropertyByPath } from './iss-ctrl-iss-ctrl-BN7L4PtW.mjs';
5
5
 
6
6
  class GetValueToSet {
7
7
  execute(args) {
@@ -58,4 +58,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
58
58
  }] });
59
59
 
60
60
  export { SetValueEvent };
61
- //# sourceMappingURL=iss-ctrl-set-value-event-BNNMVIeT.mjs.map
61
+ //# sourceMappingURL=iss-ctrl-set-value-event-OrkUS2nT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"iss-ctrl-set-value-event-BNNMVIeT.mjs","sources":["../../../projects/iss/src/events/set-value/get-value-to-set.ts","../../../projects/iss/src/events/set-value/set-value-event.ts"],"sourcesContent":["import { Injectable } from \"@angular/core\";\r\nimport { map, Observable, of } from \"rxjs\";\r\nimport { EventArgument, EventConfigFn } from \"../../shared/interfaces/event-strategy\";\r\nimport { getPropertyByPath } from \"../../shared/utilities/get-property-by-path.util\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class GetValueToSet implements EventConfigFn {\r\n execute(args: EventArgument): Observable<string> {\r\n if (args.action?.config?.setValueFromJsonValue) {\r\n return of(getPropertyByPath(args.field.ctrlJsonValue(), args.action.config.setValueFromJsonValue));\r\n }\r\n\r\n if (args.action?.config?.setValueFromApiResponse) {\r\n return args.field.apiResponse.pipe(\r\n map((value: any) => getPropertyByPath(value, args.action.config.setValueFromApiResponse))\r\n );\r\n }\r\n\r\n if (args.action?.config?.setValueFromLoggedInUser) {\r\n\r\n }\r\n\r\n if (args.action?.config?.setValueFromRequestDto) {\r\n\r\n }\r\n\r\n return of(args.change.value);\r\n }\r\n}\r\n","import { inject, Injectable } from \"@angular/core\";\r\nimport { EventArgument, EventStrategy } from \"../../shared/interfaces/event-strategy\";\r\nimport { GetValueToSet } from \"./get-value-to-set\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class SetValueEvent implements EventStrategy {\r\n getValueToSetService = inject(GetValueToSet);\r\n\r\n fire(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Set Value Event Fired\", \"color: green\");\r\n let valueToSet;\r\n if (args.action.config.fn) {\r\n valueToSet = args.action.config.fn.execute(args);\r\n } else {\r\n valueToSet = this.getValueToSetService.execute(args);\r\n }\r\n\r\n valueToSet.subscribe((value: string) => {\r\n args.control.setValue(value, {emitEvent: false});\r\n });\r\n\r\n if (args.action.config.disableAfterSetValue) {\r\n args.control.disable();\r\n }\r\n args.action.triggered = true;\r\n }\r\n\r\n revert(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Set Value Event Reverted\", \"color: red\");\r\n args.control.setValue(null);\r\n args.action.triggered = false;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;MAMa,aAAa,CAAA;AACxB,IAAA,OAAO,CAAC,IAAmB,EAAA;QACzB,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE;YAC9C,OAAO,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB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file":"iss-ctrl-set-value-event-OrkUS2nT.mjs","sources":["../../../projects/iss/src/events/set-value/get-value-to-set.ts","../../../projects/iss/src/events/set-value/set-value-event.ts"],"sourcesContent":["import { Injectable } from \"@angular/core\";\r\nimport { map, Observable, of } from \"rxjs\";\r\nimport { EventArgument, EventConfigFn } from \"../../shared/interfaces/event-strategy\";\r\nimport { getPropertyByPath } from \"../../shared/utilities/get-property-by-path.util\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class GetValueToSet implements EventConfigFn {\r\n execute(args: EventArgument): Observable<string> {\r\n if (args.action?.config?.setValueFromJsonValue) {\r\n return of(getPropertyByPath(args.field.ctrlJsonValue(), args.action.config.setValueFromJsonValue));\r\n }\r\n\r\n if (args.action?.config?.setValueFromApiResponse) {\r\n return args.field.apiResponse.pipe(\r\n map((value: any) => getPropertyByPath(value, args.action.config.setValueFromApiResponse))\r\n );\r\n }\r\n\r\n if (args.action?.config?.setValueFromLoggedInUser) {\r\n\r\n }\r\n\r\n if (args.action?.config?.setValueFromRequestDto) {\r\n\r\n }\r\n\r\n return of(args.change.value);\r\n }\r\n}\r\n","import { inject, Injectable } from \"@angular/core\";\r\nimport { EventArgument, EventStrategy } from \"../../shared/interfaces/event-strategy\";\r\nimport { GetValueToSet } from \"./get-value-to-set\";\r\n\r\n@Injectable({providedIn: \"root\"})\r\nexport class SetValueEvent implements EventStrategy {\r\n getValueToSetService = inject(GetValueToSet);\r\n\r\n fire(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Set Value Event Fired\", \"color: green\");\r\n let valueToSet;\r\n if (args.action.config.fn) {\r\n valueToSet = args.action.config.fn.execute(args);\r\n } else {\r\n valueToSet = this.getValueToSetService.execute(args);\r\n }\r\n\r\n valueToSet.subscribe((value: string) => {\r\n args.control.setValue(value, {emitEvent: false});\r\n });\r\n\r\n if (args.action.config.disableAfterSetValue) {\r\n args.control.disable();\r\n }\r\n args.action.triggered = true;\r\n }\r\n\r\n revert(args: EventArgument) {\r\n console.log(`${args.field.name} listens to ${args.action.trackedFieldName} =>` + \"%c Set Value Event Reverted\", \"color: red\");\r\n args.control.setValue(null);\r\n args.action.triggered = false;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;MAMa,aAAa,CAAA;AACxB,IAAA,OAAO,CAAC,IAAmB,EAAA;QACzB,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE;YAC9C,OAAO,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;QACpG;QAEA,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,uBAAuB,EAAE;AAChD,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAChC,GAAG,CAAC,CAAC,KAAU,KAAK,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAC1F;QACH;QAEA,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,wBAAwB,EAAE;QAEnD;QAEA,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE;QAEjD;QAEA,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC9B;uGArBW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAb,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cADD,MAAM,EAAA,CAAA;;2FAClB,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,UAAU;mBAAC,EAAC,UAAU,EAA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S,GAAG,KAAK;IAC/B;uGA1BW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAb,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cADD,MAAM,EAAA,CAAA;;2FAClB,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;;;"}
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { viewChild, ViewContainerRef, effect, Component, inject, signal, computed, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import { viewChild, ViewContainerRef, inject, DestroyRef, effect, Component, signal, computed, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3
4
  import * as i1$1 from '@angular/forms';
4
5
  import { FormGroup, ReactiveFormsModule } from '@angular/forms';
5
6
  import { MatFormFieldModule } from '@angular/material/form-field';
@@ -13,30 +14,46 @@ import * as i3 from '@angular/material/sort';
13
14
  import { MatSort, MatSortModule } from '@angular/material/sort';
14
15
  import * as i2 from '@angular/material/table';
15
16
  import { MatTableDataSource, MatTableModule } from '@angular/material/table';
16
- import { a as ViewerBase, S as SelectViewer, F as FieldBase, L as Loader, b as FormEngine, I as IssField, V as VIEW_PROVIDER, O as Outlet } from './iss-ctrl-iss-ctrl-BLjj_Aqu.mjs';
17
+ import { a as ViewerBase, L as Loader, F as FieldBase, b as FormEngine, I as IssField, V as VIEW_PROVIDER, O as Outlet } from './iss-ctrl-iss-ctrl-BN7L4PtW.mjs';
18
+ import { take } from 'rxjs';
17
19
 
18
20
  class FieldViewer extends ViewerBase {
19
21
  containerRef = viewChild("container", { ...(ngDevMode ? { debugName: "containerRef" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
22
+ #loader = inject(Loader);
23
+ #destroyRef = inject(DestroyRef);
20
24
  #fieldEffectRef = effect(() => {
21
- const componentRef = this.containerRef()?.createComponent(SelectViewer);
22
- if (componentRef) {
23
- componentRef.setInput("field", this.field());
25
+ const container = this.containerRef();
26
+ const field = this.field();
27
+ if (!container || !field) {
28
+ return;
24
29
  }
30
+ this.#loader.loadViewer(field.type)
31
+ .pipe(take(1), takeUntilDestroyed(this.#destroyRef))
32
+ .subscribe((viewer) => {
33
+ // the effect re-runs whenever the field changes, so the previously rendered
34
+ // viewer has to go before a new one takes its place
35
+ container.clear();
36
+ if (!viewer) {
37
+ return;
38
+ }
39
+ const componentRef = container.createComponent(viewer);
40
+ componentRef.setInput("field", field);
41
+ });
25
42
  }, ...(ngDevMode ? [{ debugName: "#fieldEffectRef" }] : /* istanbul ignore next */ []));
26
43
  ngOnDestroy() {
27
44
  this.#fieldEffectRef.destroy();
28
45
  }
29
46
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FieldViewer, deps: null, target: i0.ɵɵFactoryTarget.Component });
30
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.9", type: FieldViewer, isStandalone: true, selector: "iss-viewer-field", viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
31
- <ng-container #container></ng-container>
47
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.9", type: FieldViewer, isStandalone: true, selector: "iss-viewer-field", viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
48
+ <ng-container #container></ng-container>
32
49
  `, isInline: true });
33
50
  }
34
51
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FieldViewer, decorators: [{
35
52
  type: Component,
36
53
  args: [{
37
54
  selector: "iss-viewer-field",
38
- template: `
39
- <ng-container #container></ng-container>
55
+ template: `
56
+ <ng-container #container></ng-container>
40
57
  `,
41
58
  }]
42
59
  }], propDecorators: { containerRef: [{ type: i0.ViewChild, args: ["container", { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
@@ -46,7 +63,6 @@ class TableField extends FieldBase {
46
63
  drawer = viewChild("drawer", ...(ngDevMode ? [{ debugName: "drawer" }] : /* istanbul ignore next */ []));
47
64
  tableOutletForm = new FormGroup({});
48
65
  fields = signal(this.constructFieldChildren(this.field.children), ...(ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []));
49
- fieldsWithValueInViewMode = signal([], ...(ngDevMode ? [{ debugName: "fieldsWithValueInViewMode" }] : /* istanbul ignore next */ []));
50
66
  columnLabels = computed(() => {
51
67
  const labels = this.fields().map((f) => f.label());
52
68
  labels.push("");
@@ -69,16 +85,25 @@ class TableField extends FieldBase {
69
85
  paginator = viewChild(MatPaginator, ...(ngDevMode ? [{ debugName: "paginator" }] : /* istanbul ignore next */ []));
70
86
  sort = viewChild(MatSort, ...(ngDevMode ? [{ debugName: "sort" }] : /* istanbul ignore next */ []));
71
87
  #formEngine = inject(FormEngine);
72
- ngOnInit() {
73
- super.ngOnInit();
74
- this.drawer()?.closedStart.subscribe(() => {
75
- this.tableOutletForm.reset();
76
- this.tableOutletForm.enable();
77
- });
78
- }
88
+ // view-mode cells are keyed by the row object itself, not by position: sorting and
89
+ // paging reorder dataSource.data while keeping the row references, so an array indexed
90
+ // by the rendered row index would show another row's values
91
+ #rowViewFields = new WeakMap();
92
+ // the values the row editor's fields were built with; viewRow overwrites them to show a
93
+ // stored row, so they have to be put back before the editor is used to add a new one
94
+ #pristineFieldValues = new Map(this.fields().map((f) => [f.name, f.value]));
95
+ #fieldValuesOverridden = false;
96
+ // the drawer is a viewChild, so it only exists once the view is initialised
79
97
  ngAfterViewInit() {
80
98
  this.dataSource.paginator = this.paginator() ?? null;
81
99
  this.dataSource.sort = this.sort() ?? null;
100
+ this.drawer()?.closedStart
101
+ .pipe(takeUntilDestroyed(this.destroyRef))
102
+ .subscribe(() => {
103
+ this.tableOutletForm.reset();
104
+ this.tableOutletForm.enable();
105
+ this.#restoreFieldValues();
106
+ });
82
107
  }
83
108
  applyFilter(event) {
84
109
  const filterValue = event.target.value;
@@ -90,48 +115,98 @@ class TableField extends FieldBase {
90
115
  onRowClick(row) {
91
116
  this.clickedRows.add(row);
92
117
  }
118
+ // the cell of a row rendered in view mode; the row's cells are built once and cached
119
+ // against the row itself, so they follow it through sorting, filtering and paging
120
+ viewFieldOf(row, index) {
121
+ let viewFields = this.#rowViewFields.get(row);
122
+ if (!viewFields) {
123
+ viewFields = this.#fieldValuesMapper(row);
124
+ this.#rowViewFields.set(row, viewFields);
125
+ }
126
+ return viewFields[index];
127
+ }
128
+ // rows are the raw values of the row editor and carry no id, so they can only be
129
+ // identified by reference
93
130
  removeRow(row) {
94
- const newData = this.dataSource.data.filter((r) => r.id !== row.id);
131
+ if (!this.#canModify()) {
132
+ return;
133
+ }
134
+ const index = this.dataSource.data.indexOf(row);
135
+ if (index === -1) {
136
+ return;
137
+ }
138
+ const newData = this.dataSource.data.filter((_, i) => i !== index);
95
139
  this.renderRows(newData);
96
140
  if (!newData.length) {
97
141
  this.ctrl.setValue(null);
98
142
  }
99
143
  }
100
144
  addRow(rows) {
145
+ if (!this.#canModify()) {
146
+ return;
147
+ }
148
+ this.#rowViewFields.set(rows, this.#fieldValuesMapper(rows));
101
149
  this.renderRows([...this.dataSource.data, rows]);
102
- this.fieldsWithValueInViewMode.update((fields) => {
103
- return [...fields, this.#fieldValuesMapper(rows)];
104
- });
105
150
  this.ctrl.setValue("*");
106
151
  }
107
152
  renderRows(rows) {
108
153
  this.dataSource = new MatTableDataSource(rows);
109
154
  this.dataSource.paginator = this.paginator() ?? null;
110
155
  this.dataSource.sort = this.sort() ?? null;
111
- this.field.jsonValue = this.dataSource.data;
156
+ this.field.ctrlJsonValue.set(this.dataSource.data);
112
157
  }
113
158
  viewRow(row) {
114
- this.fields.update((fields) => {
115
- fields = fields.map((field) => {
116
- field.value = row[field.name];
117
- return field;
118
- });
119
- return [...fields];
120
- });
159
+ this.#applyFieldValues((field) => row[field.name]);
160
+ this.#fieldValuesOverridden = true;
121
161
  this.tableOutletForm.patchValue(row);
122
162
  this.tableOutletForm.disable();
123
163
  this.drawer()?.open();
124
164
  }
125
165
  editRow(row) {
166
+ if (!this.#canModify()) {
167
+ return;
168
+ }
169
+ this.tableOutletForm.enable();
126
170
  this.tableOutletForm.patchValue(row);
127
171
  this.drawer()?.open();
128
172
  }
173
+ openNewRow() {
174
+ if (!this.#canModify()) {
175
+ return;
176
+ }
177
+ this.drawer()?.toggle();
178
+ }
179
+ saveRow(closeDrawer) {
180
+ if (!this.#canModify()) {
181
+ return;
182
+ }
183
+ this.addRow(this.tableOutletForm.getRawValue());
184
+ this.tableOutletForm.reset();
185
+ if (closeDrawer) {
186
+ this.drawer()?.close();
187
+ }
188
+ }
129
189
  constructFieldChildren(fields) {
130
190
  return fields.map((f) => new IssField(f, this.loader));
131
191
  }
192
+ #restoreFieldValues() {
193
+ if (!this.#fieldValuesOverridden) {
194
+ return;
195
+ }
196
+ this.#applyFieldValues((field) => this.#pristineFieldValues.get(field.name));
197
+ this.#fieldValuesOverridden = false;
198
+ }
199
+ #applyFieldValues(valueOf) {
200
+ this.fields.update((fields) => fields.map((field) => {
201
+ field.value = valueOf(field);
202
+ return field;
203
+ }));
204
+ }
132
205
  #fieldValuesMapper(values) {
133
206
  return this.fields().map((field) => {
134
- const fieldWithJsonValue = this.#formEngine.fields.find((f) => f.name === field.name);
207
+ // the row editor's fields are registered by the nested outlet against tableOutletForm,
208
+ // not against the host form this table lives in
209
+ const fieldWithJsonValue = this.#formEngine.getField(this.tableOutletForm, field.name) ?? field;
135
210
  return {
136
211
  name: fieldWithJsonValue.name,
137
212
  type: fieldWithJsonValue.type,
@@ -141,33 +216,23 @@ class TableField extends FieldBase {
141
216
  };
142
217
  });
143
218
  }
144
- #viewFieldsFactory() {
145
- const viewData = [];
146
- this.fields().forEach((f) => {
147
- viewData.push({
148
- name: f.name,
149
- type: f.type,
150
- ctrlValue: signal(f.ctrlValue()),
151
- ctrlJsonValue: signal(f.ctrlJsonValue()),
152
- config: f.config,
153
- });
154
- });
155
- return viewData;
219
+ #canModify() {
220
+ return !this.ctrl.disabled && !this.field.config.readonly();
156
221
  }
157
222
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TableField, deps: null, target: i0.ɵɵFactoryTarget.Component });
158
223
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: TableField, isStandalone: true, selector: "iss-field-table", viewQueries: [{ propertyName: "drawer", first: true, predicate: ["drawer"], descendants: true, isSignal: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, isSignal: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
159
224
  <mat-sidenav-container [hasBackdrop]="true">
160
225
  <mat-sidenav #drawer [mode]="'over'" [position]="'start'" [autoFocus]="false">
161
226
  <form [formGroup]="tableOutletForm">
162
- <iss-form-outlet [fields]="fields()" />
227
+ <iss-form-outlet [fields]="fields()"/>
163
228
  </form>
164
- <ds-button (click)="drawer.close();addRow(tableOutletForm.getRawValue());tableOutletForm.reset()">save
229
+ <ds-button (click)="saveRow(true)">save
165
230
  </ds-button>
166
- <ds-button (click)="addRow(tableOutletForm.getRawValue());tableOutletForm.reset()">save and add more</ds-button>
231
+ <ds-button (click)="saveRow(false)">save and add more</ds-button>
167
232
  </mat-sidenav>
168
233
  <mat-sidenav-content>
169
234
  <div>
170
- <ds-button icon="true" (click)="drawer.toggle()">
235
+ <ds-button icon="true" (click)="openNewRow()">
171
236
  <ds-icon icon="plus"></ds-icon>
172
237
  </ds-button>
173
238
  <!--<button mat-raised-button (click)="removeRow()" class="demo-button">Remove data</button>-->
@@ -186,14 +251,13 @@ class TableField extends FieldBase {
186
251
  @for (col of fieldNames(); track col) {
187
252
  @if (col !== "actions") {
188
253
  <ng-container [matColumnDef]="col">
189
- <th
190
- mat-header-cell *matHeaderCellDef mat-sort-header
191
- [disabled]="!fieldsMap().get(col)?.config?.tableWithSort()"
192
- >
254
+ <th mat-header-cell *matHeaderCellDef mat-sort-header [disabled]="!fieldsMap().get(col)?.config?.tableWithSort()">
193
255
  {{ columnLabels()[$index] }}
194
256
  </th>
195
- <td mat-cell *matCellDef="let row; let i = index">
196
- <iss-viewer-field [field]="fieldsWithValueInViewMode()[i][$index]" />
257
+ <td mat-cell *matCellDef="let row">
258
+ @if (viewFieldOf(row, $index); as viewField) {
259
+ <iss-viewer-field [field]="viewField"/>
260
+ }
197
261
  </td>
198
262
  </ng-container>
199
263
  }
@@ -240,15 +304,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
240
304
  <mat-sidenav-container [hasBackdrop]="true">
241
305
  <mat-sidenav #drawer [mode]="'over'" [position]="'start'" [autoFocus]="false">
242
306
  <form [formGroup]="tableOutletForm">
243
- <iss-form-outlet [fields]="fields()" />
307
+ <iss-form-outlet [fields]="fields()"/>
244
308
  </form>
245
- <ds-button (click)="drawer.close();addRow(tableOutletForm.getRawValue());tableOutletForm.reset()">save
309
+ <ds-button (click)="saveRow(true)">save
246
310
  </ds-button>
247
- <ds-button (click)="addRow(tableOutletForm.getRawValue());tableOutletForm.reset()">save and add more</ds-button>
311
+ <ds-button (click)="saveRow(false)">save and add more</ds-button>
248
312
  </mat-sidenav>
249
313
  <mat-sidenav-content>
250
314
  <div>
251
- <ds-button icon="true" (click)="drawer.toggle()">
315
+ <ds-button icon="true" (click)="openNewRow()">
252
316
  <ds-icon icon="plus"></ds-icon>
253
317
  </ds-button>
254
318
  <!--<button mat-raised-button (click)="removeRow()" class="demo-button">Remove data</button>-->
@@ -267,14 +331,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
267
331
  @for (col of fieldNames(); track col) {
268
332
  @if (col !== "actions") {
269
333
  <ng-container [matColumnDef]="col">
270
- <th
271
- mat-header-cell *matHeaderCellDef mat-sort-header
272
- [disabled]="!fieldsMap().get(col)?.config?.tableWithSort()"
273
- >
334
+ <th mat-header-cell *matHeaderCellDef mat-sort-header [disabled]="!fieldsMap().get(col)?.config?.tableWithSort()">
274
335
  {{ columnLabels()[$index] }}
275
336
  </th>
276
- <td mat-cell *matCellDef="let row; let i = index">
277
- <iss-viewer-field [field]="fieldsWithValueInViewMode()[i][$index]" />
337
+ <td mat-cell *matCellDef="let row">
338
+ @if (viewFieldOf(row, $index); as viewField) {
339
+ <iss-viewer-field [field]="viewField"/>
340
+ }
278
341
  </td>
279
342
  </ng-container>
280
343
  }
@@ -307,4 +370,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
307
370
  }], propDecorators: { drawer: [{ type: i0.ViewChild, args: ["drawer", { isSignal: true }] }], paginator: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatPaginator), { isSignal: true }] }], sort: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatSort), { isSignal: true }] }] } });
308
371
 
309
372
  export { TableField };
310
- //# sourceMappingURL=iss-ctrl-table.field-Bs6l5tWV.mjs.map
373
+ //# sourceMappingURL=iss-ctrl-table.field-B42zKves.mjs.map