@energinet/watt 4.3.25 → 4.3.28
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/core/styles/typography/index.scss +9 -1
- package/fesm2022/energinet-watt-badge.mjs +18 -4
- package/fesm2022/energinet-watt-badge.mjs.map +1 -1
- package/fesm2022/energinet-watt-core-date.mjs +1 -0
- package/fesm2022/energinet-watt-core-date.mjs.map +1 -1
- package/fesm2022/energinet-watt-json-viewer.mjs +163 -47
- package/fesm2022/energinet-watt-json-viewer.mjs.map +1 -1
- package/package.json +1 -1
- package/types/energinet-watt-badge.d.ts +4 -1
- package/types/energinet-watt-core-date.d.ts +1 -0
- package/types/energinet-watt-json-viewer.d.ts +5 -1
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
+
@use "../../breakpoints/breakpoints.import" as breakpoints;
|
|
14
15
|
@use "./typography.import" as typography;
|
|
15
16
|
|
|
16
17
|
body h1,
|
|
@@ -47,7 +48,14 @@ body h6,
|
|
|
47
48
|
@include typography.watt-text-l;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
body
|
|
51
|
+
body {
|
|
52
|
+
@include typography.watt-text-m;
|
|
53
|
+
|
|
54
|
+
@include breakpoints.media("XSmall") {
|
|
55
|
+
@include typography.watt-text-s;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
.watt-text-m {
|
|
52
60
|
@include typography.watt-text-m;
|
|
53
61
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, computed, Component } from '@angular/core';
|
|
3
|
+
import { WattIconComponent } from '@energinet/watt/icon';
|
|
3
4
|
|
|
4
5
|
//#region License
|
|
5
6
|
/**
|
|
@@ -26,18 +27,31 @@ import { input, computed, Component } from '@angular/core';
|
|
|
26
27
|
class WattBadgeComponent {
|
|
27
28
|
type = input('info', ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
28
29
|
size = input('normal', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
30
|
+
icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
|
|
29
31
|
badgeType = computed(() => `watt-badge-${this.type()}`, ...(ngDevMode ? [{ debugName: "badgeType" }] : []));
|
|
30
32
|
isLarge = computed(() => this.size() === 'large', ...(ngDevMode ? [{ debugName: "isLarge" }] : []));
|
|
33
|
+
iconSize = computed(() => (this.isLarge() ? 'm' : 's'), ...(ngDevMode ? [{ debugName: "iconSize" }] : []));
|
|
31
34
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: WattBadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
32
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
35
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: WattBadgeComponent, isStandalone: true, selector: "watt-badge", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "badgeType()", "class.watt-badge-large": "isLarge()", "class.watt-badge-icon": "!!icon()" } }, ngImport: i0, template: `
|
|
36
|
+
@if (icon()) {
|
|
37
|
+
<watt-icon [name]="icon()" [size]="iconSize()" [attr.aria-hidden]="true" />
|
|
38
|
+
}
|
|
39
|
+
<ng-content />
|
|
40
|
+
`, isInline: true, styles: [":host{border-radius:4px;padding:.125rem var(--watt-space-xs);color:var(--watt-typography-label-color);font-size:.875rem;line-height:1.25rem;font-weight:600;color:var(--watt-color-primary-dark)}:host.watt-badge-large{font-size:1rem;line-height:1.5rem;font-weight:700}:host.watt-badge-neutral{color:var(--watt-color-neutral-grey-600);background:var(--watt-color-neutral-grey-200)}:host.watt-badge-info{background:var(--watt-color-state-info-light)}:host.watt-badge-success{background:var(--watt-color-state-success-light)}:host.watt-badge-warning{background:var(--watt-color-state-warning-light)}:host.watt-badge-danger{color:var(--watt-color-state-danger);background:var(--watt-color-state-danger-light)}:host.watt-badge-version{color:var(--watt-on-light-high-emphasis);background:var(--watt-color-secondary)}:host.watt-badge-skeleton{color:transparent;animation:shine 1.6s infinite linear;background-color:var(--watt-color-neutral-grey-200);background-size:600px;background-image:linear-gradient(90deg,var(--watt-color-neutral-grey-300) 0px,var(--watt-color-neutral-grey-200) 40px,var(--watt-color-neutral-grey-300) 80px)}:host.watt-badge-icon{display:inline-flex;align-items:center;gap:var(--watt-space-xs)}@keyframes shine{0%{background-position:-100px}40%,to{background-position:140px}}\n"], dependencies: [{ kind: "component", type: WattIconComponent, selector: "watt-icon", inputs: ["name", "label", "size", "state"] }] });
|
|
33
41
|
}
|
|
34
42
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: WattBadgeComponent, decorators: [{
|
|
35
43
|
type: Component,
|
|
36
|
-
args: [{ selector: 'watt-badge',
|
|
44
|
+
args: [{ selector: 'watt-badge', imports: [WattIconComponent], template: `
|
|
45
|
+
@if (icon()) {
|
|
46
|
+
<watt-icon [name]="icon()" [size]="iconSize()" [attr.aria-hidden]="true" />
|
|
47
|
+
}
|
|
48
|
+
<ng-content />
|
|
49
|
+
`, host: {
|
|
37
50
|
'[class]': 'badgeType()',
|
|
38
51
|
'[class.watt-badge-large]': 'isLarge()',
|
|
39
|
-
|
|
40
|
-
|
|
52
|
+
'[class.watt-badge-icon]': '!!icon()',
|
|
53
|
+
}, styles: [":host{border-radius:4px;padding:.125rem var(--watt-space-xs);color:var(--watt-typography-label-color);font-size:.875rem;line-height:1.25rem;font-weight:600;color:var(--watt-color-primary-dark)}:host.watt-badge-large{font-size:1rem;line-height:1.5rem;font-weight:700}:host.watt-badge-neutral{color:var(--watt-color-neutral-grey-600);background:var(--watt-color-neutral-grey-200)}:host.watt-badge-info{background:var(--watt-color-state-info-light)}:host.watt-badge-success{background:var(--watt-color-state-success-light)}:host.watt-badge-warning{background:var(--watt-color-state-warning-light)}:host.watt-badge-danger{color:var(--watt-color-state-danger);background:var(--watt-color-state-danger-light)}:host.watt-badge-version{color:var(--watt-on-light-high-emphasis);background:var(--watt-color-secondary)}:host.watt-badge-skeleton{color:transparent;animation:shine 1.6s infinite linear;background-color:var(--watt-color-neutral-grey-200);background-size:600px;background-image:linear-gradient(90deg,var(--watt-color-neutral-grey-300) 0px,var(--watt-color-neutral-grey-200) 40px,var(--watt-color-neutral-grey-300) 80px)}:host.watt-badge-icon{display:inline-flex;align-items:center;gap:var(--watt-space-xs)}@keyframes shine{0%{background-position:-100px}40%,to{background-position:140px}}\n"] }]
|
|
54
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }] } });
|
|
41
55
|
|
|
42
56
|
//#region License
|
|
43
57
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-badge.mjs","sources":["../../../libs/watt/package/badge/watt-badge.component.ts","../../../libs/watt/package/badge/index.ts","../../../libs/watt/package/badge/energinet-watt-badge.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Component, computed, input } from '@angular/core';\n\nexport type WattBadgeType =\n | 'warning'\n | 'success'\n | 'danger'\n | 'info'\n | 'neutral'\n | 'version'\n | 'skeleton';\n\nexport type WattBadgeSize = 'normal' | 'large';\n\n/**\n * Usage:\n * `import { WattBadgeComponent } from '@energinet/watt/badge';`\n */\n@Component({\n selector: 'watt-badge',\n styleUrls: ['./watt-badge.component.scss'],\n template:
|
|
1
|
+
{"version":3,"file":"energinet-watt-badge.mjs","sources":["../../../libs/watt/package/badge/watt-badge.component.ts","../../../libs/watt/package/badge/index.ts","../../../libs/watt/package/badge/energinet-watt-badge.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Component, computed, input } from '@angular/core';\nimport { WattIcon, WattIconComponent, WattIconSize } from '@energinet/watt/icon';\n\nexport type WattBadgeType =\n | 'warning'\n | 'success'\n | 'danger'\n | 'info'\n | 'neutral'\n | 'version'\n | 'skeleton';\n\nexport type WattBadgeSize = 'normal' | 'large';\n\n/**\n * Usage:\n * `import { WattBadgeComponent } from '@energinet/watt/badge';`\n */\n@Component({\n selector: 'watt-badge',\n styleUrls: ['./watt-badge.component.scss'],\n imports: [WattIconComponent],\n template: `\n @if (icon()) {\n <watt-icon [name]=\"icon()\" [size]=\"iconSize()\" [attr.aria-hidden]=\"true\" />\n }\n <ng-content />\n `,\n host: {\n '[class]': 'badgeType()',\n '[class.watt-badge-large]': 'isLarge()',\n '[class.watt-badge-icon]': '!!icon()',\n },\n})\nexport class WattBadgeComponent {\n type = input<WattBadgeType>('info');\n size = input<WattBadgeSize>('normal');\n icon = input<WattIcon>();\n badgeType = computed(() => `watt-badge-${this.type()}`);\n isLarge = computed(() => this.size() === 'large');\n iconSize = computed<WattIconSize>(() => (this.isLarge() ? 'm' : 's'));\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattBadgeComponent, WattBadgeType, WattBadgeSize } from './watt-badge.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAeA;;;AAGG;MAiBU,kBAAkB,CAAA;AAC7B,IAAA,IAAI,GAAG,KAAK,CAAgB,MAAM,gDAAC;AACnC,IAAA,IAAI,GAAG,KAAK,CAAgB,QAAQ,gDAAC;IACrC,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAY;AACxB,IAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAA,WAAA,EAAc,IAAI,CAAC,IAAI,EAAE,CAAA,CAAE,qDAAC;AACvD,IAAA,OAAO,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,OAAO,mDAAC;IACjD,QAAQ,GAAG,QAAQ,CAAe,OAAO,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC,EAAA,IA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AA,OAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAahB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAhB9B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,YAAY,EAAA,OAAA,EAEb,CAAC,iBAAiB,CAAC,EAAA,QAAA,EAClB;;;;;GAKT,EAAA,IAAA,EACK;AACJ,wBAAA,SAAS,EAAE,aAAa;AACxB,wBAAA,0BAA0B,EAAE,WAAW;AACvC,wBAAA,yBAAyB,EAAE,UAAU;AACtC,qBAAA,EAAA,MAAA,EAAA,CAAA,6wCAAA,CAAA,EAAA;;;AClDH;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-core-date.mjs","sources":["../../../libs/watt/package/core/date/dayjs.ts","../../../libs/watt/package/core/date/watt-date-adapter.ts","../../../libs/watt/package/core/date/watt-danish-datetime.providers.ts","../../../libs/watt/package/core/date/watt-format-date.ts","../../../libs/watt/package/core/date/watt-date.pipe.ts","../../../libs/watt/package/core/date/watt-locale.service.ts","../../../libs/watt/package/core/date/index.ts","../../../libs/watt/package/core/date/energinet-watt-core-date.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport dayjs from 'dayjs'; // eslint-disable-line no-restricted-imports\nimport utc from 'dayjs/plugin/utc';\nimport timezone from 'dayjs/plugin/timezone';\nimport duration from 'dayjs/plugin/duration';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\n\n// Force import of plugins in generated .d.ts file by exporting their types\ntype __ngPackagrDayjsTypeScriptWorkaround =\n | typeof utc\n | typeof timezone\n | typeof duration\n | typeof customParseFormat;\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\ndayjs.extend(duration);\ndayjs.extend(customParseFormat);\n\nexport { dayjs, __ngPackagrDayjsTypeScriptWorkaround };\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { NativeDateAdapter } from '@angular/material/core';\n\nexport type WattSupportedLocales = 'da' | 'en';\nconst danishLocale = 'da';\n\nexport class WattDateAdapter extends NativeDateAdapter {\n setActiveLocale(language: WattSupportedLocales): void {\n this.setLocale(language === danishLocale ? danishLocale : 'en-GB');\n }\n\n /**\n * This is necessary to remove the dots from the date (ordinals) for danish locale in the calendar view.\n * due to `Intl.DateTimeFormat`\n */\n override getDateNames(): string[] {\n const dateNames = super.getDateNames();\n\n return this.locale === danishLocale\n ? dateNames.map((dateName) => dateName.replace(/\\./g, ''))\n : dateNames;\n }\n\n /**\n * Our week starts on Monday\n * @returns 0 for Sunday, 1 for Monday, etc.\n */\n override getFirstDayOfWeek(): number {\n return 1;\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n DateAdapter,\n MAT_DATE_FORMATS,\n MAT_DATE_LOCALE,\n MAT_NATIVE_DATE_FORMATS,\n} from '@angular/material/core';\nimport { makeEnvironmentProviders } from '@angular/core';\n\nimport { WattDateAdapter } from './watt-date-adapter';\n\nexport const danishDatetimeProviders = makeEnvironmentProviders([\n { provide: MAT_DATE_LOCALE, useValue: 'da' },\n {\n provide: DateAdapter,\n useClass: WattDateAdapter,\n deps: [MAT_DATE_LOCALE],\n },\n { provide: MAT_DATE_FORMATS, useValue: MAT_NATIVE_DATE_FORMATS },\n]);\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { dayjs } from './dayjs';\nimport { WattRange } from './watt-date-range';\n\nexport const formatStrings = {\n monthYear: 'MMMM YYYY',\n short: 'DD-MM-YYYY',\n shortAbbr: 'DD. MMM YYYY',\n long: 'DD-MM-YYYY HH:mm',\n longAbbr: 'DD. MMM YYYY HH:mm',\n time: 'HH:mm',\n longAbbrWithSeconds: 'DD-MMM YYYY HH:mm:ss',\n};\n\nexport function wattFormatDate(\n input?: WattRange<Date> | WattRange<string> | Date | string | number | null,\n format: keyof typeof formatStrings = 'short',\n timeZone = 'Europe/Copenhagen'\n): string | null {\n if (!input) return null;\n\n if (input instanceof Date || typeof input === 'string') {\n return dayjs(input).tz(timeZone).format(formatStrings[format]);\n } else if (typeof input === 'number') {\n return dayjs(new Date(input)).tz(timeZone).format(formatStrings[format]);\n } else {\n return transformRange(input, format);\n }\n}\n\nfunction transformRange(\n input: WattRange<Date | string>,\n format: keyof typeof formatStrings\n): string | null {\n if (dayjs(input.start).isSame(dayjs(input.end), 'day') || input.end === null) {\n return wattFormatDate(input.start, format);\n } else {\n return `${wattFormatDate(input.start, format)} ― ${wattFormatDate(input.end, format)}`;\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Pipe, PipeTransform } from '@angular/core';\n\nimport { WattRange } from './watt-date-range';\nimport { formatStrings, wattFormatDate } from './watt-format-date';\n\n@Pipe({\n name: 'wattDate',\n})\nexport class WattDatePipe implements PipeTransform {\n /**\n * @param input WattDateRange or string in ISO 8601 format or unix timestamp number\n */\n transform(\n input?: WattRange<Date> | WattRange<string> | Date | string | number | null,\n format: keyof typeof formatStrings = 'short',\n timeZone = 'Europe/Copenhagen'\n ): string | null {\n return wattFormatDate(input, format, timeZone);\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { computed, inject, Injectable, LOCALE_ID, signal } from '@angular/core';\nimport { DateAdapter } from '@angular/material/core';\n\nimport { WattDateAdapter, WattSupportedLocales } from './watt-date-adapter';\nimport { dayjs } from './dayjs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class WattLocaleService {\n private readonly dateAdapter = inject<DateAdapter<unknown>>(DateAdapter);\n\n locale = signal(inject<WattSupportedLocales>(LOCALE_ID));\n isDanish = computed(() => this.locale() == 'da');\n isEnglish = computed(() => this.locale() == 'en');\n\n async setActiveLocale(locale: WattSupportedLocales): Promise<void> {\n if (locale === 'da') {\n await import('dayjs/locale/da');\n }\n\n if (locale === 'en') {\n await import('dayjs/locale/en');\n }\n\n dayjs.locale(locale);\n (this.dateAdapter as WattDateAdapter).setActiveLocale(locale);\n this.locale.set(locale);\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { dayjs, __ngPackagrDayjsTypeScriptWorkaround } from './dayjs';\nexport { danishDatetimeProviders } from './watt-danish-datetime.providers';\nexport { WattDateAdapter, WattSupportedLocales } from './watt-date-adapter';\nexport { type WattRange, type WattDateRange } from './watt-date-range';\nexport { WattDatePipe } from './watt-date.pipe';\nexport { wattFormatDate } from './watt-format-date';\nexport { WattLocaleService } from './watt-locale.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAcA,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;AACjB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AACtB,KAAK,CAA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AA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,cAFhB,MAAM,EAAA,CAAA;;2FAEP,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAH7B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC1BD;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"energinet-watt-core-date.mjs","sources":["../../../libs/watt/package/core/date/dayjs.ts","../../../libs/watt/package/core/date/watt-date-adapter.ts","../../../libs/watt/package/core/date/watt-danish-datetime.providers.ts","../../../libs/watt/package/core/date/watt-format-date.ts","../../../libs/watt/package/core/date/watt-date.pipe.ts","../../../libs/watt/package/core/date/watt-locale.service.ts","../../../libs/watt/package/core/date/index.ts","../../../libs/watt/package/core/date/energinet-watt-core-date.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport dayjs from 'dayjs'; // eslint-disable-line no-restricted-imports\nimport utc from 'dayjs/plugin/utc';\nimport timezone from 'dayjs/plugin/timezone';\nimport duration from 'dayjs/plugin/duration';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\n\n// Force import of plugins in generated .d.ts file by exporting their types\ntype __ngPackagrDayjsTypeScriptWorkaround =\n | typeof utc\n | typeof timezone\n | typeof duration\n | typeof customParseFormat;\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\ndayjs.extend(duration);\ndayjs.extend(customParseFormat);\n\nexport { dayjs, __ngPackagrDayjsTypeScriptWorkaround };\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { NativeDateAdapter } from '@angular/material/core';\n\nexport type WattSupportedLocales = 'da' | 'en';\nconst danishLocale = 'da';\n\nexport class WattDateAdapter extends NativeDateAdapter {\n setActiveLocale(language: WattSupportedLocales): void {\n this.setLocale(language === danishLocale ? danishLocale : 'en-GB');\n }\n\n /**\n * This is necessary to remove the dots from the date (ordinals) for danish locale in the calendar view.\n * due to `Intl.DateTimeFormat`\n */\n override getDateNames(): string[] {\n const dateNames = super.getDateNames();\n\n return this.locale === danishLocale\n ? dateNames.map((dateName) => dateName.replace(/\\./g, ''))\n : dateNames;\n }\n\n /**\n * Our week starts on Monday\n * @returns 0 for Sunday, 1 for Monday, etc.\n */\n override getFirstDayOfWeek(): number {\n return 1;\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n DateAdapter,\n MAT_DATE_FORMATS,\n MAT_DATE_LOCALE,\n MAT_NATIVE_DATE_FORMATS,\n} from '@angular/material/core';\nimport { makeEnvironmentProviders } from '@angular/core';\n\nimport { WattDateAdapter } from './watt-date-adapter';\n\nexport const danishDatetimeProviders = makeEnvironmentProviders([\n { provide: MAT_DATE_LOCALE, useValue: 'da' },\n {\n provide: DateAdapter,\n useClass: WattDateAdapter,\n deps: [MAT_DATE_LOCALE],\n },\n { provide: MAT_DATE_FORMATS, useValue: MAT_NATIVE_DATE_FORMATS },\n]);\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { dayjs } from './dayjs';\nimport { WattRange } from './watt-date-range';\n\nexport const formatStrings = {\n year: 'YYYY',\n monthYear: 'MMMM YYYY',\n short: 'DD-MM-YYYY',\n shortAbbr: 'DD. MMM YYYY',\n long: 'DD-MM-YYYY HH:mm',\n longAbbr: 'DD. MMM YYYY HH:mm',\n time: 'HH:mm',\n longAbbrWithSeconds: 'DD-MMM YYYY HH:mm:ss',\n};\n\nexport function wattFormatDate(\n input?: WattRange<Date> | WattRange<string> | Date | string | number | null,\n format: keyof typeof formatStrings = 'short',\n timeZone = 'Europe/Copenhagen'\n): string | null {\n if (!input) return null;\n\n if (input instanceof Date || typeof input === 'string') {\n return dayjs(input).tz(timeZone).format(formatStrings[format]);\n } else if (typeof input === 'number') {\n return dayjs(new Date(input)).tz(timeZone).format(formatStrings[format]);\n } else {\n return transformRange(input, format);\n }\n}\n\nfunction transformRange(\n input: WattRange<Date | string>,\n format: keyof typeof formatStrings\n): string | null {\n if (dayjs(input.start).isSame(dayjs(input.end), 'day') || input.end === null) {\n return wattFormatDate(input.start, format);\n } else {\n return `${wattFormatDate(input.start, format)} ― ${wattFormatDate(input.end, format)}`;\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Pipe, PipeTransform } from '@angular/core';\n\nimport { WattRange } from './watt-date-range';\nimport { formatStrings, wattFormatDate } from './watt-format-date';\n\n@Pipe({\n name: 'wattDate',\n})\nexport class WattDatePipe implements PipeTransform {\n /**\n * @param input WattDateRange or string in ISO 8601 format or unix timestamp number\n */\n transform(\n input?: WattRange<Date> | WattRange<string> | Date | string | number | null,\n format: keyof typeof formatStrings = 'short',\n timeZone = 'Europe/Copenhagen'\n ): string | null {\n return wattFormatDate(input, format, timeZone);\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { computed, inject, Injectable, LOCALE_ID, signal } from '@angular/core';\nimport { DateAdapter } from '@angular/material/core';\n\nimport { WattDateAdapter, WattSupportedLocales } from './watt-date-adapter';\nimport { dayjs } from './dayjs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class WattLocaleService {\n private readonly dateAdapter = inject<DateAdapter<unknown>>(DateAdapter);\n\n locale = signal(inject<WattSupportedLocales>(LOCALE_ID));\n isDanish = computed(() => this.locale() == 'da');\n isEnglish = computed(() => this.locale() == 'en');\n\n async setActiveLocale(locale: WattSupportedLocales): Promise<void> {\n if (locale === 'da') {\n await import('dayjs/locale/da');\n }\n\n if (locale === 'en') {\n await import('dayjs/locale/en');\n }\n\n dayjs.locale(locale);\n (this.dateAdapter as WattDateAdapter).setActiveLocale(locale);\n this.locale.set(locale);\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { dayjs, __ngPackagrDayjsTypeScriptWorkaround } from './dayjs';\nexport { danishDatetimeProviders } from './watt-danish-datetime.providers';\nexport { WattDateAdapter, WattSupportedLocales } from './watt-date-adapter';\nexport { type WattRange, type WattDateRange } from './watt-date-range';\nexport { WattDatePipe } from './watt-date.pipe';\nexport { wattFormatDate } from './watt-format-date';\nexport { WattLocaleService } from './watt-locale.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAcA,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;AACjB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AACtB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AACtB,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC;;AClC/B;AACA;;;;;;;;;;;;;;;A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AA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,cAFhB,MAAM,EAAA,CAAA;;2FAEP,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAH7B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC1BD;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, linkedSignal } from '@angular/core';
|
|
3
|
+
import * as i1 from '@energinet/watt/vater';
|
|
4
|
+
import { VATER } from '@energinet/watt/vater';
|
|
3
5
|
import { WattIconComponent } from '@energinet/watt/icon';
|
|
4
6
|
|
|
5
7
|
//#region License
|
|
@@ -20,20 +22,64 @@ import { WattIconComponent } from '@energinet/watt/icon';
|
|
|
20
22
|
* limitations under the License.
|
|
21
23
|
*/
|
|
22
24
|
//#endregion
|
|
25
|
+
/** Compares two values. When deep is false, objects/arrays compare by type only. */
|
|
26
|
+
function isEqual(a, b, { deep }) {
|
|
27
|
+
try {
|
|
28
|
+
if (typeof a !== typeof b)
|
|
29
|
+
return false;
|
|
30
|
+
if (typeof a !== 'object')
|
|
31
|
+
return a === b;
|
|
32
|
+
if (a === null || b === null)
|
|
33
|
+
return a === b;
|
|
34
|
+
const replacer = !deep ? (_, v) => (Array.isArray(v) ? [] : {}) : undefined;
|
|
35
|
+
return JSON.stringify(a, replacer) === JSON.stringify(b, replacer);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return a === b;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Type guard that checks if a value is a non-empty array or object. */
|
|
42
|
+
function isNonEmpty(value) {
|
|
43
|
+
return typeof value === 'object' && value !== null ? Object.keys(value).length > 0 : false;
|
|
44
|
+
}
|
|
45
|
+
/** Merges two arrays by alternating elements, preserving the order. */
|
|
46
|
+
function interleave(a, b) {
|
|
47
|
+
return Array.from({ length: Math.max(a.length, b.length) })
|
|
48
|
+
.flatMap((_, i) => [a[i], b[i]])
|
|
49
|
+
.filter((k) => k !== undefined);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//#region License
|
|
23
53
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
54
|
+
* @license
|
|
55
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
56
|
+
*
|
|
57
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
58
|
+
* you may not use this file except in compliance with the License.
|
|
59
|
+
* You may obtain a copy of the License at
|
|
60
|
+
*
|
|
61
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
62
|
+
*
|
|
63
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
64
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
65
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
66
|
+
* See the License for the specific language governing permissions and
|
|
67
|
+
* limitations under the License.
|
|
28
68
|
*/
|
|
69
|
+
//#endregion
|
|
29
70
|
const JSON_TOKEN_REGEX = /"(?:[^"\\]|\\.)*":?|-?\d+\.?\d*|\b(true|false|null)\b/g;
|
|
30
|
-
class
|
|
31
|
-
|
|
71
|
+
class WattJsonRow {
|
|
72
|
+
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
|
|
73
|
+
isOriginal = input.required(...(ngDevMode ? [{ debugName: "isOriginal" }] : []));
|
|
74
|
+
isSame = input.required(...(ngDevMode ? [{ debugName: "isSame" }] : []));
|
|
75
|
+
expanded = input.required(...(ngDevMode ? [{ debugName: "expanded" }] : []));
|
|
76
|
+
value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
|
|
77
|
+
expandable = computed(() => isNonEmpty(this.value()), ...(ngDevMode ? [{ debugName: "expandable" }] : []));
|
|
32
78
|
colorized = computed(() => {
|
|
33
79
|
try {
|
|
34
|
-
const json = JSON.stringify(this.
|
|
80
|
+
const json = JSON.stringify(this.value(), null, ' ');
|
|
35
81
|
return json === undefined
|
|
36
|
-
? `<span class='watt-json-invalid'>${this.
|
|
82
|
+
? `<span class='watt-json-invalid'>${this.value()?.toString() || typeof this.value()}</span>`
|
|
37
83
|
: json.replace(JSON_TOKEN_REGEX, (match) => {
|
|
38
84
|
switch (true) {
|
|
39
85
|
case match.endsWith(':'):
|
|
@@ -51,13 +97,32 @@ class WattJsonColorize {
|
|
|
51
97
|
return `<span class='watt-json-invalid'>[Circular]</span>`;
|
|
52
98
|
}
|
|
53
99
|
}, ...(ngDevMode ? [{ debugName: "colorized" }] : []));
|
|
54
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type:
|
|
55
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: WattJsonRow, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
101
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: WattJsonRow, isStandalone: true, selector: "watt-json-row", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, isOriginal: { classPropertyName: "isOriginal", publicName: "isOriginal", isSignal: true, isRequired: true, transformFunction: null }, isSame: { classPropertyName: "isSame", publicName: "isSame", isSignal: true, isRequired: true, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.watt-json-row-added": "!isOriginal() && !isSame()", "class.watt-json-row-removed": "isOriginal() && !isSame()" } }, ngImport: i0, template: `
|
|
102
|
+
@if (value() !== undefined) {
|
|
103
|
+
@if (expandable()) {
|
|
104
|
+
<watt-icon size="s" [name]="expanded() ? 'down' : 'right'" />
|
|
105
|
+
}
|
|
106
|
+
<span>{{ label() }}: </span>
|
|
107
|
+
<span [hidden]="expandable() && expanded()" [innerHTML]="colorized()"></span>
|
|
108
|
+
}
|
|
109
|
+
`, isInline: true, styles: ["watt-json-row{position:relative;padding-left:calc(var(--watt-json-level) * 20px);padding-right:calc(var(--watt-json-level) * 20px);color:var(--watt-color-primary)}watt-json-row>watt-icon{position:absolute;top:2px;transform:translate(-100%)}.watt-json-row-added:not(:empty){background-color:var(--watt-color-state-success-light)}.watt-json-row-removed:not(:empty){background-color:var(--watt-color-state-danger-light)}.watt-json-invalid{color:var(--watt-on-light-low-emphasis)}.watt-json-key{color:var(--watt-color-primary)}.watt-json-string{color:var(--watt-color-state-success)}.watt-json-number{color:var(--watt-color-state-warning)}.watt-json-keyword{color:var(--watt-color-state-danger)}\n"], dependencies: [{ kind: "component", type: WattIconComponent, selector: "watt-icon", inputs: ["name", "label", "size", "state"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
56
110
|
}
|
|
57
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type:
|
|
111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: WattJsonRow, decorators: [{
|
|
58
112
|
type: Component,
|
|
59
|
-
args: [{ selector: 'watt-json-
|
|
60
|
-
|
|
113
|
+
args: [{ selector: 'watt-json-row', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [WattIconComponent], host: {
|
|
114
|
+
'[class.watt-json-row-added]': '!isOriginal() && !isSame()',
|
|
115
|
+
'[class.watt-json-row-removed]': 'isOriginal() && !isSame()',
|
|
116
|
+
}, template: `
|
|
117
|
+
@if (value() !== undefined) {
|
|
118
|
+
@if (expandable()) {
|
|
119
|
+
<watt-icon size="s" [name]="expanded() ? 'down' : 'right'" />
|
|
120
|
+
}
|
|
121
|
+
<span>{{ label() }}: </span>
|
|
122
|
+
<span [hidden]="expandable() && expanded()" [innerHTML]="colorized()"></span>
|
|
123
|
+
}
|
|
124
|
+
`, styles: ["watt-json-row{position:relative;padding-left:calc(var(--watt-json-level) * 20px);padding-right:calc(var(--watt-json-level) * 20px);color:var(--watt-color-primary)}watt-json-row>watt-icon{position:absolute;top:2px;transform:translate(-100%)}.watt-json-row-added:not(:empty){background-color:var(--watt-color-state-success-light)}.watt-json-row-removed:not(:empty){background-color:var(--watt-color-state-danger-light)}.watt-json-invalid{color:var(--watt-on-light-low-emphasis)}.watt-json-key{color:var(--watt-color-primary)}.watt-json-string{color:var(--watt-color-state-success)}.watt-json-number{color:var(--watt-color-state-warning)}.watt-json-keyword{color:var(--watt-color-state-danger)}\n"] }]
|
|
125
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], isOriginal: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOriginal", required: true }] }], isSame: [{ type: i0.Input, args: [{ isSignal: true, alias: "isSame", required: true }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
|
|
61
126
|
|
|
62
127
|
//#region License
|
|
63
128
|
/**
|
|
@@ -79,72 +144,105 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
79
144
|
//#endregion
|
|
80
145
|
class WattJson {
|
|
81
146
|
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
|
|
82
|
-
|
|
147
|
+
left = input(...(ngDevMode ? [undefined, { debugName: "left" }] : []));
|
|
148
|
+
right = input(...(ngDevMode ? [undefined, { debugName: "right" }] : []));
|
|
149
|
+
diff = input(false, ...(ngDevMode ? [{ debugName: "diff" }] : []));
|
|
83
150
|
tree = input.required(...(ngDevMode ? [{ debugName: "tree" }] : []));
|
|
84
151
|
level = input(0, ...(ngDevMode ? [{ debugName: "level" }] : []));
|
|
85
|
-
|
|
152
|
+
toMap = (v) => new Map(Object.entries(isNonEmpty(v) ? v : []));
|
|
86
153
|
children = computed(() => {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
154
|
+
const left = this.toMap(this.left());
|
|
155
|
+
const right = this.toMap(this.right());
|
|
156
|
+
const keys = new Set(interleave([...left.keys()], [...right.keys()]));
|
|
157
|
+
return [...keys].map((key) => ({ key, left: left.get(key), right: right.get(key) }));
|
|
91
158
|
}, ...(ngDevMode ? [{ debugName: "children" }] : []));
|
|
92
|
-
|
|
93
|
-
|
|
159
|
+
isRoot = computed(() => this.level() === 0, ...(ngDevMode ? [{ debugName: "isRoot" }] : []));
|
|
160
|
+
isSame = computed(() => {
|
|
161
|
+
if (!this.diff())
|
|
162
|
+
return true;
|
|
163
|
+
return isEqual(this.left(), this.right(), { deep: !this.expanded() });
|
|
164
|
+
}, ...(ngDevMode ? [{ debugName: "isSame" }] : []));
|
|
165
|
+
expandable = computed(() => this.children().length > 0, ...(ngDevMode ? [{ debugName: "expandable" }] : []));
|
|
94
166
|
expanded = linkedSignal({ ...(ngDevMode ? { debugName: "expanded" } : {}), source: this.tree,
|
|
95
167
|
computation: (t) => this.level() < t.maxDepth && t.expanded ? this.expandable() : this.isRoot() });
|
|
96
168
|
toggleExpanded = () =>
|
|
97
169
|
// Prevent toggle when text is being selected
|
|
98
170
|
this.expanded.update((e) => (getSelection()?.isCollapsed && this.expandable() ? !e : e));
|
|
99
171
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: WattJson, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
100
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: WattJson, isStandalone: true, selector: "watt-json", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null },
|
|
172
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: WattJson, isStandalone: true, selector: "watt-json", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, left: { classPropertyName: "left", publicName: "left", isSignal: true, isRequired: false, transformFunction: null }, right: { classPropertyName: "right", publicName: "right", isSignal: true, isRequired: false, transformFunction: null }, diff: { classPropertyName: "diff", publicName: "diff", isSignal: true, isRequired: false, transformFunction: null }, tree: { classPropertyName: "tree", publicName: "tree", isSignal: true, isRequired: true, transformFunction: null }, level: { classPropertyName: "level", publicName: "level", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.--watt-json-level": "level()" } }, ngImport: i0, template: `
|
|
101
173
|
@if (!isRoot()) {
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
174
|
+
<vater-flex class="watt-json-row" direction="row" (click)="toggleExpanded()">
|
|
175
|
+
<watt-json-row
|
|
176
|
+
[label]="label()"
|
|
177
|
+
[isOriginal]="true"
|
|
178
|
+
[isSame]="isSame()"
|
|
179
|
+
[expanded]="expanded()"
|
|
180
|
+
[value]="left()"
|
|
181
|
+
/>
|
|
182
|
+
@if (diff()) {
|
|
183
|
+
<watt-json-row
|
|
184
|
+
[label]="label()"
|
|
185
|
+
[isOriginal]="false"
|
|
186
|
+
[isSame]="isSame()"
|
|
187
|
+
[expanded]="expanded()"
|
|
188
|
+
[value]="right()"
|
|
189
|
+
/>
|
|
105
190
|
}
|
|
106
|
-
|
|
107
|
-
<watt-json-colorize [hidden]="expanded()" [json]="json()" />
|
|
108
|
-
</div>
|
|
191
|
+
</vater-flex>
|
|
109
192
|
}
|
|
110
193
|
@defer (when expanded()) {
|
|
111
|
-
@for (child of children(); track child
|
|
194
|
+
@for (child of children(); track child.key) {
|
|
112
195
|
<watt-json
|
|
113
196
|
[hidden]="!expanded()"
|
|
114
|
-
[label]="child
|
|
115
|
-
[
|
|
197
|
+
[label]="child.key"
|
|
198
|
+
[left]="child.left"
|
|
199
|
+
[right]="child.right"
|
|
200
|
+
[diff]="diff()"
|
|
116
201
|
[tree]="tree()"
|
|
117
202
|
[level]="level() + 1"
|
|
118
203
|
/>
|
|
119
204
|
}
|
|
120
205
|
}
|
|
121
|
-
`, isInline: true, styles: ["watt-json{cursor:default}.watt-json-
|
|
206
|
+
`, isInline: true, styles: ["watt-json{cursor:default}.watt-json-row{position:relative}.watt-json-row:after{content:\"\";position:absolute;inset:0;border-radius:4px;background-color:#0000;pointer-events:none}.watt-json-row:hover:after{background-color:#0000001a;outline:1px solid var(--watt-color-neutral-grey-500);outline-offset:-1px}\n"], dependencies: [{ kind: "component", type: i1.VaterFlexComponent, selector: "vater-flex, [vater-flex]", inputs: ["autoSize"] }, { kind: "component", type: WattJsonRow, selector: "watt-json-row", inputs: ["label", "isOriginal", "isSame", "expanded", "value"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None, deferBlockDependencies: [() => [WattJson]] });
|
|
122
207
|
}
|
|
123
208
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: WattJson, decorators: [{
|
|
124
209
|
type: Component,
|
|
125
|
-
args: [{ selector: 'watt-json', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
210
|
+
args: [{ selector: 'watt-json', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [VATER, WattJsonRow], host: { '[style.--watt-json-level]': 'level()' }, template: `
|
|
126
211
|
@if (!isRoot()) {
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
212
|
+
<vater-flex class="watt-json-row" direction="row" (click)="toggleExpanded()">
|
|
213
|
+
<watt-json-row
|
|
214
|
+
[label]="label()"
|
|
215
|
+
[isOriginal]="true"
|
|
216
|
+
[isSame]="isSame()"
|
|
217
|
+
[expanded]="expanded()"
|
|
218
|
+
[value]="left()"
|
|
219
|
+
/>
|
|
220
|
+
@if (diff()) {
|
|
221
|
+
<watt-json-row
|
|
222
|
+
[label]="label()"
|
|
223
|
+
[isOriginal]="false"
|
|
224
|
+
[isSame]="isSame()"
|
|
225
|
+
[expanded]="expanded()"
|
|
226
|
+
[value]="right()"
|
|
227
|
+
/>
|
|
130
228
|
}
|
|
131
|
-
|
|
132
|
-
<watt-json-colorize [hidden]="expanded()" [json]="json()" />
|
|
133
|
-
</div>
|
|
229
|
+
</vater-flex>
|
|
134
230
|
}
|
|
135
231
|
@defer (when expanded()) {
|
|
136
|
-
@for (child of children(); track child
|
|
232
|
+
@for (child of children(); track child.key) {
|
|
137
233
|
<watt-json
|
|
138
234
|
[hidden]="!expanded()"
|
|
139
|
-
[label]="child
|
|
140
|
-
[
|
|
235
|
+
[label]="child.key"
|
|
236
|
+
[left]="child.left"
|
|
237
|
+
[right]="child.right"
|
|
238
|
+
[diff]="diff()"
|
|
141
239
|
[tree]="tree()"
|
|
142
240
|
[level]="level() + 1"
|
|
143
241
|
/>
|
|
144
242
|
}
|
|
145
243
|
}
|
|
146
|
-
`, styles: ["watt-json{cursor:default}.watt-json-
|
|
147
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }],
|
|
244
|
+
`, styles: ["watt-json{cursor:default}.watt-json-row{position:relative}.watt-json-row:after{content:\"\";position:absolute;inset:0;border-radius:4px;background-color:#0000;pointer-events:none}.watt-json-row:hover:after{background-color:#0000001a;outline:1px solid var(--watt-color-neutral-grey-500);outline-offset:-1px}\n"] }]
|
|
245
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], left: [{ type: i0.Input, args: [{ isSignal: true, alias: "left", required: false }] }], right: [{ type: i0.Input, args: [{ isSignal: true, alias: "right", required: false }] }], diff: [{ type: i0.Input, args: [{ isSignal: true, alias: "diff", required: false }] }], tree: [{ type: i0.Input, args: [{ isSignal: true, alias: "tree", required: true }] }], level: [{ type: i0.Input, args: [{ isSignal: true, alias: "level", required: false }] }] } });
|
|
148
246
|
|
|
149
247
|
//#region License
|
|
150
248
|
/**
|
|
@@ -169,6 +267,10 @@ class WattJsonViewer {
|
|
|
169
267
|
* The JSON data to display. Accepts any value that can be serialized by JSON.stringify.
|
|
170
268
|
*/
|
|
171
269
|
json = input.required(...(ngDevMode ? [{ debugName: "json" }] : []));
|
|
270
|
+
/**
|
|
271
|
+
* Optional value to compare against. When provided, enables diff mode with side-by-side view.
|
|
272
|
+
*/
|
|
273
|
+
compare = input(...(ngDevMode ? [undefined, { debugName: "compare" }] : []));
|
|
172
274
|
/**
|
|
173
275
|
* Maximum depth for `expandAll()`. Beyond this depth nodes start collapsed but can be
|
|
174
276
|
* expanded manually. Useful when dealing with large objects or circular references.
|
|
@@ -195,7 +297,14 @@ class WattJsonViewer {
|
|
|
195
297
|
maxDepth: this.maxDepth(),
|
|
196
298
|
}), ...(ngDevMode ? [{ debugName: "tree" }] : []));
|
|
197
299
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: WattJsonViewer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
198
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.5", type: WattJsonViewer, isStandalone: true, selector: "watt-json-viewer", inputs: { json: { classPropertyName: "json", publicName: "json", isSignal: true, isRequired: true, transformFunction: null },
|
|
300
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.5", type: WattJsonViewer, isStandalone: true, selector: "watt-json-viewer", inputs: { json: { classPropertyName: "json", publicName: "json", isSignal: true, isRequired: true, transformFunction: null }, compare: { classPropertyName: "compare", publicName: "compare", isSignal: true, isRequired: false, transformFunction: null }, maxDepth: { classPropertyName: "maxDepth", publicName: "maxDepth", isSignal: true, isRequired: false, transformFunction: null }, initialExpanded: { classPropertyName: "initialExpanded", publicName: "initialExpanded", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
301
|
+
<watt-json
|
|
302
|
+
[left]="json()"
|
|
303
|
+
[right]="compare()"
|
|
304
|
+
[diff]="compare() !== undefined"
|
|
305
|
+
[tree]="tree()"
|
|
306
|
+
/>
|
|
307
|
+
`, isInline: true, dependencies: [{ kind: "component", type: WattJson, selector: "watt-json", inputs: ["label", "left", "right", "diff", "tree", "level"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
199
308
|
}
|
|
200
309
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: WattJsonViewer, decorators: [{
|
|
201
310
|
type: Component,
|
|
@@ -204,9 +313,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
204
313
|
selector: 'watt-json-viewer',
|
|
205
314
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
206
315
|
imports: [WattJson],
|
|
207
|
-
template:
|
|
316
|
+
template: `
|
|
317
|
+
<watt-json
|
|
318
|
+
[left]="json()"
|
|
319
|
+
[right]="compare()"
|
|
320
|
+
[diff]="compare() !== undefined"
|
|
321
|
+
[tree]="tree()"
|
|
322
|
+
/>
|
|
323
|
+
`,
|
|
208
324
|
}]
|
|
209
|
-
}], propDecorators: { json: [{ type: i0.Input, args: [{ isSignal: true, alias: "json", required: true }] }], maxDepth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDepth", required: false }] }], initialExpanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialExpanded", required: false }] }] } });
|
|
325
|
+
}], propDecorators: { json: [{ type: i0.Input, args: [{ isSignal: true, alias: "json", required: true }] }], compare: [{ type: i0.Input, args: [{ isSignal: true, alias: "compare", required: false }] }], maxDepth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDepth", required: false }] }], initialExpanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialExpanded", required: false }] }] } });
|
|
210
326
|
|
|
211
327
|
//#region License
|
|
212
328
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-json-viewer.mjs","sources":["../../../libs/watt/package/json-viewer/watt-json-colorize.component.ts","../../../libs/watt/package/json-viewer/watt-json.component.ts","../../../libs/watt/package/json-viewer/watt-json-viewer.component.ts","../../../libs/watt/package/json-viewer/index.ts","../../../libs/watt/package/json-viewer/energinet-watt-json-viewer.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n} from '@angular/core';\n\n/**\n * Matches JSON tokens for syntax highlighting:\n * - `\"(?:[^\"\\\\]|\\\\.)*\":?` - Strings and keys (supports escaped quotes)\n * - `-?\\d+\\.?\\d*` - Numbers (including negative and decimals)\n * - `\\b(true|false|null)\\b` - Keywords\n */\nconst JSON_TOKEN_REGEX = /\"(?:[^\"\\\\]|\\\\.)*\":?|-?\\d+\\.?\\d*|\\b(true|false|null)\\b/g;\n\n@Component({\n selector: 'watt-json-colorize',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styles: `\n .watt-json-invalid {\n color: var(--watt-on-light-low-emphasis);\n }\n\n .watt-json-key {\n color: var(--watt-color-primary);\n }\n\n .watt-json-string {\n color: var(--watt-color-state-success);\n }\n\n .watt-json-number {\n color: var(--watt-color-state-warning);\n }\n\n .watt-json-keyword {\n color: var(--watt-color-state-danger);\n }\n `,\n template: `<span [innerHTML]=\"colorized()\"></span>`,\n})\nexport class WattJsonColorize {\n readonly json = input.required<unknown>();\n protected readonly colorized = computed(() => {\n try {\n const json = JSON.stringify(this.json(), null, ' ');\n return json === undefined\n ? `<span class='watt-json-invalid'>${this.json()?.toString() || typeof this.json()}</span>`\n : json.replace(JSON_TOKEN_REGEX, (match) => {\n switch (true) {\n case match.endsWith(':'):\n return `<span class='watt-json-key'>${match.slice(1, -2)}</span>:`;\n case match.startsWith('\"'):\n return `<span class='watt-json-string'>${match}</span>`;\n case /\\d/.test(match):\n return `<span class='watt-json-number'>${match}</span>`;\n default:\n return `<span class='watt-json-keyword'>${match}</span>`;\n }\n });\n } catch {\n return `<span class='watt-json-invalid'>[Circular]</span>`;\n }\n });\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n linkedSignal,\n} from '@angular/core';\nimport { WattIconComponent } from '@energinet/watt/icon';\nimport { WattJsonColorize } from './watt-json-colorize.component';\n\nexport type TreeState = {\n expanded: boolean;\n maxDepth: number;\n};\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'watt-json',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [WattIconComponent, WattJsonColorize],\n styles: `\n watt-json {\n cursor: default;\n }\n\n .watt-json-label {\n position: relative;\n padding-left: calc(var(--watt-json-level) * 20px);\n color: var(--watt-color-primary);\n }\n\n .watt-json-label:hover {\n background: var(--watt-color-neutral-grey-100);\n }\n\n .watt-json-label > watt-icon {\n position: absolute;\n top: 2px;\n transform: translateX(-100%);\n }\n `,\n host: { '[style.--watt-json-level]': 'level()' },\n template: `\n @if (!isRoot()) {\n <div class=\"watt-json-label\" (click)=\"toggleExpanded()\">\n @if (expandable()) {\n <watt-icon size=\"s\" [name]=\"expanded() ? 'down' : 'right'\" />\n }\n <span>{{ label() }}: </span>\n <watt-json-colorize [hidden]=\"expanded()\" [json]=\"json()\" />\n </div>\n }\n @defer (when expanded()) {\n @for (child of children(); track child[0]) {\n <watt-json\n [hidden]=\"!expanded()\"\n [label]=\"child[0]\"\n [json]=\"child[1]\"\n [tree]=\"tree()\"\n [level]=\"level() + 1\"\n />\n }\n }\n `,\n})\nexport class WattJson {\n readonly label = input<string>();\n readonly json = input.required<unknown>();\n readonly tree = input.required<TreeState>();\n readonly level = input(0);\n\n protected readonly isRoot = computed(() => this.level() === 0);\n protected readonly children = computed(() => {\n const json = this.json();\n return typeof json === 'object' && json && Object.keys(json).length\n ? Object.entries(json)\n : null;\n });\n\n // The linkedSignal makes it possible to recursively toggle all nodes\n protected readonly expandable = computed(() => Boolean(this.children()));\n protected readonly expanded = linkedSignal({\n source: this.tree,\n computation: (t) =>\n this.level() < t.maxDepth && t.expanded ? this.expandable() : this.isRoot(),\n });\n\n protected readonly toggleExpanded = () =>\n // Prevent toggle when text is being selected\n this.expanded.update((e) => (getSelection()?.isCollapsed && this.expandable() ? !e : e));\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { ChangeDetectionStrategy, Component, computed, input, linkedSignal } from '@angular/core';\nimport { TreeState, WattJson } from './watt-json.component';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'watt-json-viewer',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [WattJson],\n template: `<watt-json [json]=\"json()\" [tree]=\"tree()\" />`,\n})\nexport class WattJsonViewer {\n /**\n * The JSON data to display. Accepts any value that can be serialized by JSON.stringify.\n */\n readonly json = input.required<unknown>();\n\n /**\n * Maximum depth for `expandAll()`. Beyond this depth nodes start collapsed but can be\n * expanded manually. Useful when dealing with large objects or circular references.\n */\n readonly maxDepth = input(50);\n\n /**\n * Whether the tree starts expanded or collapsed.\n */\n readonly initialExpanded = input(false);\n\n /**\n * Expands all nodes up to `maxDepth`.\n */\n readonly expandAll = () => this.expanded.set(true);\n\n /**\n * Collapses all nodes.\n */\n readonly collapseAll = () => this.expanded.set(false);\n\n // Use equality function + computed object to always return a new reference, even\n // when `expanded` is \"updated\" to its current value. This ensures that \"Expand all\"\n // and \"Collapse all\" always works, regardless of the current state of `expanded`.\n protected readonly expanded = linkedSignal(this.initialExpanded, { equal: () => false });\n protected readonly tree = computed<TreeState>(() => ({\n expanded: this.expanded(),\n maxDepth: this.maxDepth(),\n }));\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattJsonViewer } from './watt-json-viewer.component';\n","/**\n * Generated bundle index. Do not ed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,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,eAAA,EAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAFf,CAAA,6CAAA,CAA+C,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAD/C,QAAQ,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAGP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAP1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;;AAET,oBAAA,QAAQ,EAAE,kBAAkB;oBAC5B,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,OAAO,EAAE,CAAC,QAAQ,CAAC;AACnB,oBAAA,QAAQ,EAAE,CAAA,6CAAA,CAA+C;AAC1D,iBAAA;;;AC3BD;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"energinet-watt-json-viewer.mjs","sources":["../../../libs/watt/package/json-viewer/watt-json.utils.ts","../../../libs/watt/package/json-viewer/watt-json-row.component.ts","../../../libs/watt/package/json-viewer/watt-json.component.ts","../../../libs/watt/package/json-viewer/watt-json-viewer.component.ts","../../../libs/watt/package/json-viewer/index.ts","../../../libs/watt/package/json-viewer/energinet-watt-json-viewer.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\n\n/** Compares two values. When deep is false, objects/arrays compare by type only. */\nexport function isEqual(a: unknown, b: unknown, { deep }: { deep: boolean }): boolean {\n try {\n if (typeof a !== typeof b) return false;\n if (typeof a !== 'object') return a === b;\n if (a === null || b === null) return a === b;\n const replacer = !deep ? (_: string, v: unknown) => (Array.isArray(v) ? [] : {}) : undefined;\n return JSON.stringify(a, replacer) === JSON.stringify(b, replacer);\n } catch {\n return a === b;\n }\n}\n\n/** Type guard that checks if a value is a non-empty array or object. */\nexport function isNonEmpty(value: unknown): value is Record<string, unknown> | unknown[] {\n return typeof value === 'object' && value !== null ? Object.keys(value).length > 0 : false;\n}\n\n/** Merges two arrays by alternating elements, preserving the order. */\nexport function interleave<T>(a: T[], b: T[]): T[] {\n return Array.from({ length: Math.max(a.length, b.length) })\n .flatMap((_, i) => [a[i], b[i]])\n .filter((k) => k !== undefined);\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n} from '@angular/core';\nimport { WattIconComponent } from '@energinet/watt/icon';\nimport { isNonEmpty } from './watt-json.utils';\n\nconst JSON_TOKEN_REGEX = /\"(?:[^\"\\\\]|\\\\.)*\":?|-?\\d+\\.?\\d*|\\b(true|false|null)\\b/g;\n\n@Component({\n selector: 'watt-json-row',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [WattIconComponent],\n styles: `\n watt-json-row {\n position: relative;\n padding-left: calc(var(--watt-json-level) * 20px);\n padding-right: calc(var(--watt-json-level) * 20px);\n color: var(--watt-color-primary);\n }\n\n watt-json-row > watt-icon {\n position: absolute;\n top: 2px;\n transform: translateX(-100%);\n }\n\n .watt-json-row-added:not(:empty) {\n background-color: var(--watt-color-state-success-light);\n }\n\n .watt-json-row-removed:not(:empty) {\n background-color: var(--watt-color-state-danger-light);\n }\n\n .watt-json-invalid {\n color: var(--watt-on-light-low-emphasis);\n }\n\n .watt-json-key {\n color: var(--watt-color-primary);\n }\n\n .watt-json-string {\n color: var(--watt-color-state-success);\n }\n\n .watt-json-number {\n color: var(--watt-color-state-warning);\n }\n\n .watt-json-keyword {\n color: var(--watt-color-state-danger);\n }\n `,\n host: {\n '[class.watt-json-row-added]': '!isOriginal() && !isSame()',\n '[class.watt-json-row-removed]': 'isOriginal() && !isSame()',\n },\n template: `\n @if (value() !== undefined) {\n @if (expandable()) {\n <watt-icon size=\"s\" [name]=\"expanded() ? 'down' : 'right'\" />\n }\n <span>{{ label() }}: </span>\n <span [hidden]=\"expandable() && expanded()\" [innerHTML]=\"colorized()\"></span>\n }\n `,\n})\nexport class WattJsonRow {\n readonly label = input<string>();\n readonly isOriginal = input.required<boolean>();\n readonly isSame = input.required<boolean>();\n readonly expanded = input.required<boolean>();\n readonly value = input<unknown>();\n\n protected readonly expandable = computed(() => isNonEmpty(this.value()));\n protected readonly colorized = computed(() => {\n try {\n const json = JSON.stringify(this.value(), null, ' ');\n return json === undefined\n ? `<span class='watt-json-invalid'>${this.value()?.toString() || typeof this.value()}</span>`\n : json.replace(JSON_TOKEN_REGEX, (match) => {\n switch (true) {\n case match.endsWith(':'):\n return `<span class='watt-json-key'>${match.slice(1, -2)}</span>:`;\n case match.startsWith('\"'):\n return `<span class='watt-json-string'>${match}</span>`;\n case /\\d/.test(match):\n return `<span class='watt-json-number'>${match}</span>`;\n default:\n return `<span class='watt-json-keyword'>${match}</span>`;\n }\n });\n } catch {\n return `<span class='watt-json-invalid'>[Circular]</span>`;\n }\n });\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n linkedSignal,\n} from '@angular/core';\nimport { VATER } from '@energinet/watt/vater';\nimport { WattJsonRow } from './watt-json-row.component';\nimport { interleave, isNonEmpty, isEqual } from './watt-json.utils';\n\nexport type TreeState = {\n expanded: boolean;\n maxDepth: number;\n};\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'watt-json',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [VATER, WattJsonRow],\n styles: `\n watt-json {\n cursor: default;\n }\n\n .watt-json-row {\n position: relative;\n }\n\n .watt-json-row::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: 4px;\n background-color: rgba(0, 0, 0, 0);\n pointer-events: none;\n }\n\n .watt-json-row:hover::after {\n background-color: rgba(0, 0, 0, 0.1);\n outline: 1px solid var(--watt-color-neutral-grey-500);\n outline-offset: -1px;\n }\n `,\n host: { '[style.--watt-json-level]': 'level()' },\n template: `\n @if (!isRoot()) {\n <vater-flex class=\"watt-json-row\" direction=\"row\" (click)=\"toggleExpanded()\">\n <watt-json-row\n [label]=\"label()\"\n [isOriginal]=\"true\"\n [isSame]=\"isSame()\"\n [expanded]=\"expanded()\"\n [value]=\"left()\"\n />\n @if (diff()) {\n <watt-json-row\n [label]=\"label()\"\n [isOriginal]=\"false\"\n [isSame]=\"isSame()\"\n [expanded]=\"expanded()\"\n [value]=\"right()\"\n />\n }\n </vater-flex>\n }\n @defer (when expanded()) {\n @for (child of children(); track child.key) {\n <watt-json\n [hidden]=\"!expanded()\"\n [label]=\"child.key\"\n [left]=\"child.left\"\n [right]=\"child.right\"\n [diff]=\"diff()\"\n [tree]=\"tree()\"\n [level]=\"level() + 1\"\n />\n }\n }\n `,\n})\nexport class WattJson {\n readonly label = input<string>();\n readonly left = input<unknown>();\n readonly right = input<unknown>();\n readonly diff = input(false);\n readonly tree = input.required<TreeState>();\n readonly level = input(0);\n\n protected readonly toMap = (v: unknown) => new Map(Object.entries(isNonEmpty(v) ? v : []));\n protected readonly children = computed(() => {\n const left = this.toMap(this.left());\n const right = this.toMap(this.right());\n const keys = new Set(interleave([...left.keys()], [...right.keys()]));\n return [...keys].map((key) => ({ key, left: left.get(key), right: right.get(key) }));\n });\n\n protected readonly isRoot = computed(() => this.level() === 0);\n protected readonly isSame = computed(() => {\n if (!this.diff()) return true;\n return isEqual(this.left(), this.right(), { deep: !this.expanded() });\n });\n\n protected readonly expandable = computed(() => this.children().length > 0);\n protected readonly expanded = linkedSignal({\n source: this.tree,\n computation: (t) =>\n this.level() < t.maxDepth && t.expanded ? this.expandable() : this.isRoot(),\n });\n\n protected readonly toggleExpanded = () =>\n // Prevent toggle when text is being selected\n this.expanded.update((e) => (getSelection()?.isCollapsed && this.expandable() ? !e : e));\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { ChangeDetectionStrategy, Component, computed, input, linkedSignal } from '@angular/core';\nimport { TreeState, WattJson } from './watt-json.component';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'watt-json-viewer',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [WattJson],\n template: `\n <watt-json\n [left]=\"json()\"\n [right]=\"compare()\"\n [diff]=\"compare() !== undefined\"\n [tree]=\"tree()\"\n />\n `,\n})\nexport class WattJsonViewer {\n /**\n * The JSON data to display. Accepts any value that can be serialized by JSON.stringify.\n */\n readonly json = input.required<unknown>();\n\n /**\n * Optional value to compare against. When provided, enables diff mode with side-by-side view.\n */\n readonly compare = input<unknown>();\n\n /**\n * Maximum depth for `expandAll()`. Beyond this depth nodes start collapsed but can be\n * expanded manually. Useful when dealing with large objects or circular references.\n */\n readonly maxDepth = input(50);\n\n /**\n * Whether the tree starts expanded or collapsed.\n */\n readonly initialExpanded = input(false);\n\n /**\n * Expands all nodes up to `maxDepth`.\n */\n readonly expandAll = () => this.expanded.set(true);\n\n /**\n * Collapses all nodes.\n */\n readonly collapseAll = () => this.expanded.set(false);\n\n // Use equality function + computed object to always return a new reference, even\n // when `expanded` is \"updated\" to its current value. This ensures that \"Expand all\"\n // and \"Collapse all\" always works, regardless of the current state of `expanded`.\n protected readonly expanded = linkedSignal(this.initialExpanded, { equal: () => false });\n protected readonly tree = computed<TreeState>(() => ({\n expanded: this.expanded(),\n maxDepth: this.maxDepth(),\n }));\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattJsonViewer } from './watt-json-viewer.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAEA;AACM,SAAU,OAAO,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE,IAAI,EAAqB,EAAA;AACzE,IAAA,IAAI;AACF,QAAA,IAAI,OAAO,CAAC,KAAK,OAAO,CAAC;AAAE,YAAA,OAAO,KAAK;QACvC,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,OAAO,CAAC,KAAK,CAAC;AACzC,QAAA,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI;YAAE,OAAO,CAAC,KAAK,CAAC;AAC5C,QAAA,MAAM,QAAQ,GAAG,CAAC,IAAI,GAAG,CAAC,CAAS,EAAE,CAAU,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,SAAS;AAC5F,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC;IACpE;AAAE,IAAA,MAAM;QACN,OAAO,CAAC,KAAK,CAAC;IAChB;AACF;AAEA;AACM,SAAU,UAAU,CAAC,KAAc,EAAA;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK;AAC5F;AA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A,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,eAAA,EAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EATf;;;;;;;AAOT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EARS,QAAQ,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAUP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAd1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;;AAET,oBAAA,QAAQ,EAAE,kBAAkB;oBAC5B,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,OAAO,EAAE,CAAC,QAAQ,CAAC;AACnB,oBAAA,QAAQ,EAAE;;;;;;;AAOT,EAAA,CAAA;AACF,iBAAA;;;AClCD;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { WattIconSize } from '@energinet/watt/icon';
|
|
2
3
|
|
|
3
4
|
type WattBadgeType = 'warning' | 'success' | 'danger' | 'info' | 'neutral' | 'version' | 'skeleton';
|
|
4
5
|
type WattBadgeSize = 'normal' | 'large';
|
|
@@ -9,10 +10,12 @@ type WattBadgeSize = 'normal' | 'large';
|
|
|
9
10
|
declare class WattBadgeComponent {
|
|
10
11
|
type: _angular_core.InputSignal<WattBadgeType>;
|
|
11
12
|
size: _angular_core.InputSignal<WattBadgeSize>;
|
|
13
|
+
icon: _angular_core.InputSignal<"warning" | "success" | "danger" | "info" | "search" | "filter" | "plus" | "minus" | "edit" | "redo" | "undo" | "remove" | "removeForever" | "close" | "cancel" | "checkmark" | "user" | "settings" | "contentCopy" | "date" | "time" | "email" | "markEmailUnread" | "link" | "openInNew" | "monetization" | "payments" | "forwardMessage" | "forward" | "menu" | "moreVertical" | "logout" | "login" | "help" | "alternateEmail" | "refresh" | "language" | "pendingActions" | "toggleOn" | "toggleOff" | "personCheck" | "send" | "left" | "right" | "up" | "down" | "arrowDropDown" | "arrowRightAlt" | "arrowLeftAlt" | "feedback" | "save" | "upload" | "download" | "fileDownload" | "fileUpload" | "print" | "preview" | "attachFile" | "article" | "contract" | "power" | "location" | "smartDisplay" | "windmill" | "solarPower" | "priorityHigh" | "notifications" | "notificationsUnread" | "horizontalRule" | "wrongLocation" | "heatPump" | "inventory" | "globe" | "calculate" | "bar_chart_4_bars" | "view_list" | "view_stream" | "construction" | "factory" | "nest_eco_leaf" | "flash_on" | undefined>;
|
|
12
14
|
badgeType: _angular_core.Signal<string>;
|
|
13
15
|
isLarge: _angular_core.Signal<boolean>;
|
|
16
|
+
iconSize: _angular_core.Signal<WattIconSize>;
|
|
14
17
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WattBadgeComponent, never>;
|
|
15
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WattBadgeComponent, "watt-badge", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
18
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WattBadgeComponent, "watt-badge", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
export { WattBadgeComponent };
|
|
@@ -10,6 +10,10 @@ declare class WattJsonViewer {
|
|
|
10
10
|
* The JSON data to display. Accepts any value that can be serialized by JSON.stringify.
|
|
11
11
|
*/
|
|
12
12
|
readonly json: _angular_core.InputSignal<unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* Optional value to compare against. When provided, enables diff mode with side-by-side view.
|
|
15
|
+
*/
|
|
16
|
+
readonly compare: _angular_core.InputSignal<unknown>;
|
|
13
17
|
/**
|
|
14
18
|
* Maximum depth for `expandAll()`. Beyond this depth nodes start collapsed but can be
|
|
15
19
|
* expanded manually. Useful when dealing with large objects or circular references.
|
|
@@ -30,7 +34,7 @@ declare class WattJsonViewer {
|
|
|
30
34
|
protected readonly expanded: _angular_core.WritableSignal<boolean>;
|
|
31
35
|
protected readonly tree: _angular_core.Signal<TreeState>;
|
|
32
36
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WattJsonViewer, never>;
|
|
33
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WattJsonViewer, "watt-json-viewer", never, { "json": { "alias": "json"; "required": true; "isSignal": true; }; "maxDepth": { "alias": "maxDepth"; "required": false; "isSignal": true; }; "initialExpanded": { "alias": "initialExpanded"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
37
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WattJsonViewer, "watt-json-viewer", never, { "json": { "alias": "json"; "required": true; "isSignal": true; }; "compare": { "alias": "compare"; "required": false; "isSignal": true; }; "maxDepth": { "alias": "maxDepth"; "required": false; "isSignal": true; }; "initialExpanded": { "alias": "initialExpanded"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
export { WattJsonViewer };
|