@hug/ngx-g11n
Version:
Angular helpers for internationalizing and localizing your application
1 lines • 2.39 kB
Source Map (JSON)
{"version":3,"file":"hug-ngx-g11n-material.mjs","sources":["../../../projects/lib/material/main.ts","../../../projects/lib/material/hug-ngx-g11n-material.ts"],"sourcesContent":["\nimport { APP_INITIALIZER, LOCALE_ID, type Provider } from '@angular/core';\nimport { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';\nimport { DateFnsAdapter, MAT_DATE_FNS_FORMATS } from '@angular/material-date-fns-adapter';\nimport { type G11nFeature, type G11nLocale, LOCALES } from '@hug/ngx-g11n/internal';\nimport { type Locale, setDefaultOptions } from 'date-fns';\n\nconst matDateFnsAdapter = (): Provider[] => [\n { provide: MAT_DATE_FORMATS, useValue: MAT_DATE_FNS_FORMATS },\n { provide: DateAdapter, useClass: DateFnsAdapter, deps: [MAT_DATE_LOCALE] },\n {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n provide: APP_INITIALIZER,\n useFactory: (localeId: string, locales: Record<string, G11nLocale>, dateAdapter: DateAdapter<Date, Locale>) =>\n async (): Promise<void> => {\n if (localeId in locales && locales[localeId].datefns) {\n const locale = (await locales[localeId].datefns()).default as Locale;\n dateAdapter.setLocale(locale);\n setDefaultOptions({ locale });\n }\n },\n deps: [LOCALE_ID, LOCALES, DateAdapter],\n multi: true\n }\n];\n\nexport const withDateFnsMaterial = (): G11nFeature => ({\n providers: [\n matDateFnsAdapter()\n ]\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,iBAAiB,GAAG,MAAkB;AACxC,IAAA,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,oBAAoB,EAAE;AAC7D,IAAA,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,eAAe,CAAC,EAAE;AAC3E,IAAA;;AAEI,QAAA,OAAO,EAAE,eAAe;AACxB,QAAA,UAAU,EAAE,CAAC,QAAgB,EAAE,OAAmC,EAAE,WAAsC,KACtG,YAA0B;YACtB,IAAI,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE;AAClD,gBAAA,MAAM,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,OAAiB;AACpE,gBAAA,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC;AAC7B,gBAAA,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;YACjC;QACJ,CAAC;AACL,QAAA,IAAI,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC;AACvC,QAAA,KAAK,EAAE;AACV;CACJ;AAEM,MAAM,mBAAmB,GAAG,OAAoB;AACnD,IAAA,SAAS,EAAE;AACP,QAAA,iBAAiB;AACpB;AACJ,CAAA;;AC9BD;;AAEG;;;;"}