@sdcorejs/angular 21.2.4 → 22.2.5
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/README.md +11 -9
- package/assets/fonts/fonts.scss +2 -2
- package/assets/images/coming-soon.svg +6 -6
- package/assets/images/data-empty.svg +2 -2
- package/assets/images/expired.svg +6 -6
- package/assets/images/file-error.svg +6 -6
- package/assets/images/filter-empty.svg +2 -2
- package/assets/images/filter-required.svg +2 -2
- package/assets/images/forbidden.svg +2 -2
- package/assets/images/image-error.svg +8 -8
- package/assets/images/maintenance.svg +3 -3
- package/assets/images/not-found.svg +2 -2
- package/assets/images/offline.svg +5 -5
- package/assets/images/submitted.svg +5 -5
- package/assets/images/success.svg +3 -3
- package/assets/images/unauthorized.svg +2 -2
- package/assets/images/unknown-error.svg +2 -2
- package/fesm2022/sdcorejs-angular-components-anchor.mjs +46 -29
- package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +167 -94
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-audit-diff.mjs +20 -13
- package/fesm2022/sdcorejs-angular-components-audit-diff.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs +65 -40
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-avatar.mjs +15 -9
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +31 -17
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs +17 -10
- package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +17 -10
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-card.mjs +185 -0
- package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-chart.mjs +52 -32
- package/fesm2022/sdcorejs-angular-components-chart.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs +15 -9
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +32 -19
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor.mjs +38 -21
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +396 -306
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-history.mjs +10 -10
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +12 -12
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +42 -24
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-job-progress.mjs +39 -21
- package/fesm2022/sdcorejs-angular-components-job-progress.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +9 -8
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +22 -14
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +36 -14
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-operator.mjs +17 -10
- package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs +26 -16
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-preview.mjs +288 -147
- package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +279 -153
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +69 -36
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs +7 -5
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +17 -13
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +26 -16
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-splitter.mjs +58 -37
- package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs +36 -21
- package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +27 -23
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +34 -20
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +1630 -998
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +86 -46
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +65 -40
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-view.mjs +25 -14
- package/fesm2022/sdcorejs-angular-components-view.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components.mjs +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-configurations.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +42 -33
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +80 -42
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +15 -9
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +41 -24
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +37 -22
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +55 -30
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +63 -34
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +65 -35
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +12 -12
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +94 -53
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs +33 -18
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs +25 -14
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +123 -42
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +94 -49
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-label.mjs +3 -3
- package/fesm2022/sdcorejs-angular-forms-label.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-models.mjs +13 -8
- package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +41 -22
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +112 -59
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +21 -12
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +48 -26
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time-range.mjs +83 -43
- package/fesm2022/sdcorejs-angular-forms-time-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time.mjs +72 -38
- package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +76 -41
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms.mjs +4 -4
- package/fesm2022/sdcorejs-angular-forms.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-handlers.mjs +3 -3
- package/fesm2022/sdcorejs-angular-handlers.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +97 -9
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs +6 -6
- package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-auth.mjs +11 -10
- package/fesm2022/sdcorejs-angular-modules-auth.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +19 -11
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-keycloak.mjs +7 -7
- package/fesm2022/sdcorejs-angular-modules-keycloak.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +387 -247
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-permission.mjs +13 -11
- package/fesm2022/sdcorejs-angular-modules-permission.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-pipes.mjs +25 -25
- package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-api.mjs +15 -10
- package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-cache.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-cache.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +9 -9
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-loading.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-loading.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-notify.mjs +21 -16
- package/fesm2022/sdcorejs-angular-services-notify.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-persistence.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-persistence.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-storage.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-task.mjs +19 -11
- package/fesm2022/sdcorejs-angular-services-task.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +17 -10
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-viewport.mjs +15 -9
- package/fesm2022/sdcorejs-angular-services-viewport.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-models.mjs.map +1 -1
- package/package.json +17 -13
- package/types/sdcorejs-angular-components-card.d.ts +58 -0
- package/types/sdcorejs-angular-components-modal.d.ts +1 -0
- package/types/sdcorejs-angular-components-quick-action.d.ts +6 -4
- package/types/sdcorejs-angular-components-table.d.ts +294 -233
- package/types/sdcorejs-angular-components.d.ts +1 -0
- package/types/sdcorejs-angular-i18n.d.ts +17 -0
|
@@ -1281,13 +1281,17 @@ function sdApiContractInvalidSample() {
|
|
|
1281
1281
|
* usable from a screen reader.
|
|
1282
1282
|
*/
|
|
1283
1283
|
class SdApiContractDiagnosticList {
|
|
1284
|
-
diagnostics = input([],
|
|
1285
|
-
|
|
1284
|
+
diagnostics = input([], /* @ts-ignore */
|
|
1285
|
+
...(ngDevMode ? [{ debugName: "diagnostics" }] : /* istanbul ignore next */ []));
|
|
1286
|
+
autoId = input(/* @ts-ignore */
|
|
1287
|
+
...(ngDevMode ? [undefined, { debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1286
1288
|
navigate = output();
|
|
1287
|
-
errorCount = computed(() => this.diagnostics().filter(diagnostic => diagnostic.severity === 'error').length,
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1289
|
+
errorCount = computed(() => this.diagnostics().filter(diagnostic => diagnostic.severity === 'error').length, /* @ts-ignore */
|
|
1290
|
+
...(ngDevMode ? [{ debugName: "errorCount" }] : /* istanbul ignore next */ []));
|
|
1291
|
+
warningCount = computed(() => this.diagnostics().filter(diagnostic => diagnostic.severity === 'warning').length, /* @ts-ignore */
|
|
1292
|
+
...(ngDevMode ? [{ debugName: "warningCount" }] : /* istanbul ignore next */ []));
|
|
1293
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractDiagnosticList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1294
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdApiContractDiagnosticList, isStandalone: true, selector: "sd-api-contract-diagnostic-list", inputs: { diagnostics: { classPropertyName: "diagnostics", publicName: "diagnostics", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { navigate: "navigate" }, ngImport: i0, template: `
|
|
1291
1295
|
@let _diagnostics = diagnostics();
|
|
1292
1296
|
@let _errors = errorCount();
|
|
1293
1297
|
@let _warnings = warningCount();
|
|
@@ -1333,7 +1337,7 @@ class SdApiContractDiagnosticList {
|
|
|
1333
1337
|
</div>
|
|
1334
1338
|
`, isInline: true, styles: [":host{display:block}.sd-acb-diagnostics__summary{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:10px}.sd-acb-diagnostics__badge{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600}.sd-acb-diagnostics__badge[data-severity=ok]{color:var(--sd-success, #1c6c3a)}.sd-acb-diagnostics__badge[data-severity=error]{color:var(--sd-error, #b3261e)}.sd-acb-diagnostics__badge[data-severity=warning]{color:var(--sd-warning, #8a5a00)}.sd-acb-diagnostics__list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.sd-acb-diagnostics__nav{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px;width:100%;text-align:left;background:none;border:1px solid transparent;border-radius:6px;padding:6px 8px;cursor:pointer;font:inherit;font-size:12px}.sd-acb-diagnostics__nav:hover,.sd-acb-diagnostics__nav:focus-visible{border-color:var(--sd-border-color, #e6e6e6);background:var(--sd-surface-muted, #f3f5f8)}.sd-acb-diagnostics__item[data-severity=error] .sd-acb-diagnostics__nav{color:var(--sd-error, #b3261e)}.sd-acb-diagnostics__item[data-severity=warning] .sd-acb-diagnostics__nav{color:var(--sd-warning, #8a5a00)}.sd-acb-diagnostics__path{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-weight:600}.sd-acb-diagnostics__message{color:var(--sd-text, #1f2937)}.sd-acb-diagnostics__code{margin-left:auto;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;color:var(--sd-text-secondary, #6b6b6b)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1335
1339
|
}
|
|
1336
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1340
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractDiagnosticList, decorators: [{
|
|
1337
1341
|
type: Component,
|
|
1338
1342
|
args: [{ selector: 'sd-api-contract-diagnostic-list', standalone: true, imports: [SdIcon, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
1339
1343
|
@let _diagnostics = diagnostics();
|
|
@@ -1394,11 +1398,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1394
1398
|
*/
|
|
1395
1399
|
class SdApiContractNodeSummary {
|
|
1396
1400
|
#i18n = inject(I18nService);
|
|
1397
|
-
name = input.required(
|
|
1398
|
-
|
|
1401
|
+
name = input.required(/* @ts-ignore */
|
|
1402
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
1403
|
+
node = input.required(/* @ts-ignore */
|
|
1404
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
1399
1405
|
/** `view` mode and `disabled` both land here: the row becomes text, with no action at all. */
|
|
1400
1406
|
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1401
|
-
autoId = input(
|
|
1407
|
+
autoId = input(/* @ts-ignore */
|
|
1408
|
+
...(ngDevMode ? [undefined, { debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1402
1409
|
edit = output();
|
|
1403
1410
|
remove = output();
|
|
1404
1411
|
requiredLabel = this.#i18n.t('core.component.api-contract-builder.field.required');
|
|
@@ -1408,7 +1415,8 @@ class SdApiContractNodeSummary {
|
|
|
1408
1415
|
if (node.source !== undefined || node.value !== undefined)
|
|
1409
1416
|
return false;
|
|
1410
1417
|
return !(node.type === 'object' && node.properties);
|
|
1411
|
-
},
|
|
1418
|
+
}, /* @ts-ignore */
|
|
1419
|
+
...(ngDevMode ? [{ debugName: "unmapped" }] : /* istanbul ignore next */ []));
|
|
1412
1420
|
/**
|
|
1413
1421
|
* One line describing where the value comes from.
|
|
1414
1422
|
*
|
|
@@ -1431,7 +1439,8 @@ class SdApiContractNodeSummary {
|
|
|
1431
1439
|
});
|
|
1432
1440
|
}
|
|
1433
1441
|
return this.#i18n.t('core.component.api-contract-builder.summary.unmapped');
|
|
1434
|
-
},
|
|
1442
|
+
}, /* @ts-ignore */
|
|
1443
|
+
...(ngDevMode ? [{ debugName: "mappingSummary" }] : /* istanbul ignore next */ []));
|
|
1435
1444
|
requestEdit() {
|
|
1436
1445
|
if (this.readonly())
|
|
1437
1446
|
return;
|
|
@@ -1447,8 +1456,8 @@ class SdApiContractNodeSummary {
|
|
|
1447
1456
|
return;
|
|
1448
1457
|
this.remove.emit();
|
|
1449
1458
|
}
|
|
1450
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1451
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1459
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractNodeSummary, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1460
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdApiContractNodeSummary, isStandalone: true, selector: "sd-api-contract-node-summary", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null }, node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { edit: "edit", remove: "remove" }, ngImport: i0, template: `
|
|
1452
1461
|
@let _autoId = autoId();
|
|
1453
1462
|
@let _readonly = readonly();
|
|
1454
1463
|
|
|
@@ -1484,7 +1493,7 @@ class SdApiContractNodeSummary {
|
|
|
1484
1493
|
</div>
|
|
1485
1494
|
`, isInline: true, styles: [":host{display:block;width:100%}.sd-acb-row{display:flex;gap:10px;align-items:center;padding:8px 10px;border:1px solid var(--sd-border-color, #e6e6e6);border-radius:6px;background:var(--sd-surface, #fff);font-size:13px;cursor:pointer}.sd-acb-row:hover{border-color:var(--sd-primary, #005cbb)}.sd-acb-row--readonly{cursor:default}.sd-acb-row--readonly:hover{border-color:var(--sd-border-color, #e6e6e6)}.sd-acb-row__name{min-width:0;font-weight:600;overflow-wrap:anywhere}.sd-acb-row__type{padding:1px 6px;border-radius:4px;background:var(--sd-surface-muted, #f3f5f8);color:var(--sd-text-secondary, #6b6b6b);font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:12px}.sd-acb-row__required{padding:1px 6px;border-radius:4px;background:color-mix(in srgb,var(--sd-primary, #005cbb) 12%,transparent);color:var(--sd-primary, #005cbb);font-size:11px}.sd-acb-row__mapping{min-width:0;margin-left:auto;overflow:hidden;color:var(--sd-text-secondary, #6b6b6b);font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:12px;text-overflow:ellipsis;white-space:nowrap}.sd-acb-row__mapping--unmapped{color:var(--sd-warning, #8a5a00);font-style:italic}.sd-acb-row__remove{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sd-error, #b3261e);cursor:pointer}.sd-acb-row__remove:hover{background:color-mix(in srgb,var(--sd-error, #b3261e) 12%,transparent)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1486
1495
|
}
|
|
1487
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1496
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractNodeSummary, decorators: [{
|
|
1488
1497
|
type: Component,
|
|
1489
1498
|
args: [{ selector: 'sd-api-contract-node-summary', standalone: true, imports: [SdIcon], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
1490
1499
|
@let _autoId = autoId();
|
|
@@ -1547,10 +1556,13 @@ function formatLiteral(value) {
|
|
|
1547
1556
|
*/
|
|
1548
1557
|
class SdApiContractSourceEditor {
|
|
1549
1558
|
#i18n = inject(I18nService);
|
|
1550
|
-
node = input.required(
|
|
1551
|
-
|
|
1559
|
+
node = input.required(/* @ts-ignore */
|
|
1560
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
1561
|
+
suggestions = input([], /* @ts-ignore */
|
|
1562
|
+
...(ngDevMode ? [{ debugName: "suggestions" }] : /* istanbul ignore next */ []));
|
|
1552
1563
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1553
|
-
autoId = input(
|
|
1564
|
+
autoId = input(/* @ts-ignore */
|
|
1565
|
+
...(ngDevMode ? [undefined, { debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1554
1566
|
nodeChange = output();
|
|
1555
1567
|
advancedPlaceholder = 'Bearer ${env.token}';
|
|
1556
1568
|
// why: dựng MỘT lần trong field initializer. `[items]` nhận mảng mới mỗi CD sẽ kích
|
|
@@ -1605,7 +1617,8 @@ class SdApiContractSourceEditor {
|
|
|
1605
1617
|
modeValue = computed(() => {
|
|
1606
1618
|
const mode = this.mode();
|
|
1607
1619
|
return mode === 'none' ? null : mode;
|
|
1608
|
-
},
|
|
1620
|
+
}, /* @ts-ignore */
|
|
1621
|
+
...(ngDevMode ? [{ debugName: "modeValue" }] : /* istanbul ignore next */ []));
|
|
1609
1622
|
modeOptions = computed(() => {
|
|
1610
1623
|
const type = this.node().type;
|
|
1611
1624
|
if (type === 'object')
|
|
@@ -1613,7 +1626,8 @@ class SdApiContractSourceEditor {
|
|
|
1613
1626
|
if (type === 'array')
|
|
1614
1627
|
return this.#arrayModes;
|
|
1615
1628
|
return this.#scalarModes;
|
|
1616
|
-
},
|
|
1629
|
+
}, /* @ts-ignore */
|
|
1630
|
+
...(ngDevMode ? [{ debugName: "modeOptions" }] : /* istanbul ignore next */ []));
|
|
1617
1631
|
suggestionOptions = computed(() => {
|
|
1618
1632
|
const type = this.node().type;
|
|
1619
1633
|
const all = [...this.suggestions()];
|
|
@@ -1621,7 +1635,8 @@ class SdApiContractSourceEditor {
|
|
|
1621
1635
|
// string (`Bearer ${env.token}`) và các cặp type tương thích không bị giấu mất.
|
|
1622
1636
|
const compatible = all.filter(suggestion => isAssignable(suggestion.type, type));
|
|
1623
1637
|
return compatible.length > 0 ? compatible : all;
|
|
1624
|
-
},
|
|
1638
|
+
}, /* @ts-ignore */
|
|
1639
|
+
...(ngDevMode ? [{ debugName: "suggestionOptions" }] : /* istanbul ignore next */ []));
|
|
1625
1640
|
/**
|
|
1626
1641
|
* Options for the source dropdown.
|
|
1627
1642
|
*
|
|
@@ -1651,15 +1666,18 @@ class SdApiContractSourceEditor {
|
|
|
1651
1666
|
display: reference?.expression ?? current,
|
|
1652
1667
|
},
|
|
1653
1668
|
];
|
|
1654
|
-
},
|
|
1669
|
+
}, /* @ts-ignore */
|
|
1670
|
+
...(ngDevMode ? [{ debugName: "sourceOptions" }] : /* istanbul ignore next */ []));
|
|
1655
1671
|
staticText = computed(() => {
|
|
1656
1672
|
const value = this.node().value;
|
|
1657
1673
|
return value === undefined || value === null ? '' : String(value);
|
|
1658
|
-
},
|
|
1674
|
+
}, /* @ts-ignore */
|
|
1675
|
+
...(ngDevMode ? [{ debugName: "staticText" }] : /* istanbul ignore next */ []));
|
|
1659
1676
|
staticNumber = computed(() => {
|
|
1660
1677
|
const value = this.node().value;
|
|
1661
1678
|
return typeof value === 'number' ? value : null;
|
|
1662
|
-
},
|
|
1679
|
+
}, /* @ts-ignore */
|
|
1680
|
+
...(ngDevMode ? [{ debugName: "staticNumber" }] : /* istanbul ignore next */ []));
|
|
1663
1681
|
setMode(mode) {
|
|
1664
1682
|
const node = this.node();
|
|
1665
1683
|
// why: đặt mode TRƯỚC khi emit. Node quay lại từ cha sẽ kích `linkedSignal` tính lại, và nó đọc
|
|
@@ -1726,8 +1744,8 @@ class SdApiContractSourceEditor {
|
|
|
1726
1744
|
setStaticBoolean(value) {
|
|
1727
1745
|
this.nodeChange.emit({ ...withoutMapping(this.node()), value: value === 'true' || value === true });
|
|
1728
1746
|
}
|
|
1729
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1730
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1747
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractSourceEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1748
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdApiContractSourceEditor, isStandalone: true, selector: "sd-api-contract-source-editor", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, suggestions: { classPropertyName: "suggestions", publicName: "suggestions", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeChange: "nodeChange" }, ngImport: i0, template: `
|
|
1731
1749
|
@let _node = node();
|
|
1732
1750
|
@let _disabled = disabled();
|
|
1733
1751
|
@let _mode = mode();
|
|
@@ -1862,7 +1880,7 @@ class SdApiContractSourceEditor {
|
|
|
1862
1880
|
</div>
|
|
1863
1881
|
`, isInline: true, styles: [":host{display:block;width:100%}.sd-acb-source{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-start}.sd-acb-source__mode{flex:0 0 200px;min-width:180px}.sd-acb-source__expression,.sd-acb-source__static{flex:1 1 260px;min-width:220px}.sd-acb-source__static--json{flex:1 1 100%;min-width:0}\n"], dependencies: [{ kind: "component", type: SdCodeEditor, selector: "sd-code-editor", inputs: ["model", "language", "maxHeight", "viewed"], outputs: ["modelChange"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "hyperlink", "minWidthPanel", "hideInlineError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "items", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1864
1882
|
}
|
|
1865
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1883
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractSourceEditor, decorators: [{
|
|
1866
1884
|
type: Component,
|
|
1867
1885
|
args: [{ selector: 'sd-api-contract-source-editor', standalone: true, imports: [SdCodeEditor, SdDate, SdDatetime, SdInput, SdInputNumber, SdSelect, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
1868
1886
|
@let _node = node();
|
|
@@ -2061,27 +2079,38 @@ function isAssignable(sourceType, targetType) {
|
|
|
2061
2079
|
class SdApiContractNodeDrawer {
|
|
2062
2080
|
#i18n = inject(I18nService);
|
|
2063
2081
|
/** `mapping` shows the value editor; `schema` is a plain declaration with no mapping. */
|
|
2064
|
-
layer = input('mapping',
|
|
2082
|
+
layer = input('mapping', /* @ts-ignore */
|
|
2083
|
+
...(ngDevMode ? [{ debugName: "layer" }] : /* istanbul ignore next */ []));
|
|
2065
2084
|
allowTransform = input(false, { ...(ngDevMode ? { debugName: "allowTransform" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2066
|
-
suggestions = input([],
|
|
2067
|
-
|
|
2085
|
+
suggestions = input([], /* @ts-ignore */
|
|
2086
|
+
...(ngDevMode ? [{ debugName: "suggestions" }] : /* istanbul ignore next */ []));
|
|
2087
|
+
autoId = input(/* @ts-ignore */
|
|
2088
|
+
...(ngDevMode ? [undefined, { debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
2068
2089
|
nodeCommit = output();
|
|
2069
2090
|
// why không phải ES-private: Angular từ chối `viewChild` trên field `#` (diagnostic 1053).
|
|
2070
|
-
drawerRef = viewChild.required('drawer'
|
|
2091
|
+
drawerRef = viewChild.required('drawer', /* @ts-ignore */
|
|
2092
|
+
...(ngDevMode ? [{ debugName: "drawerRef" }] : /* istanbul ignore next */ []));
|
|
2071
2093
|
// why: seed là mốc so sánh để biết draft có bẩn hay chưa. Không có nó thì "Huỷ" phải đoán, và mọi
|
|
2072
2094
|
// lần mở drawer đều bị coi là đã sửa.
|
|
2073
2095
|
#seedName = '';
|
|
2074
2096
|
#seedJson = '';
|
|
2075
|
-
#draftName = signal('',
|
|
2076
|
-
|
|
2077
|
-
#
|
|
2078
|
-
|
|
2079
|
-
#
|
|
2097
|
+
#draftName = signal('', /* @ts-ignore */
|
|
2098
|
+
...(ngDevMode ? [{ debugName: "#draftName" }] : /* istanbul ignore next */ []));
|
|
2099
|
+
#draft = signal(null, /* @ts-ignore */
|
|
2100
|
+
...(ngDevMode ? [{ debugName: "#draft" }] : /* istanbul ignore next */ []));
|
|
2101
|
+
#rootSiblings = signal([], /* @ts-ignore */
|
|
2102
|
+
...(ngDevMode ? [{ debugName: "#rootSiblings" }] : /* istanbul ignore next */ []));
|
|
2103
|
+
#editingName = signal(null, /* @ts-ignore */
|
|
2104
|
+
...(ngDevMode ? [{ debugName: "#editingName" }] : /* istanbul ignore next */ []));
|
|
2105
|
+
#discardPrompt = signal(false, /* @ts-ignore */
|
|
2106
|
+
...(ngDevMode ? [{ debugName: "#discardPrompt" }] : /* istanbul ignore next */ []));
|
|
2080
2107
|
// why pointer chứ không phải "node hiện tại": draft luôn là GỐC của subtree, và một lần Lưu commit
|
|
2081
2108
|
// cả gốc. Giữ node con rời ra sẽ phải ghép lại lúc Save, và ghép sai là mất nhánh.
|
|
2082
|
-
#pointer = signal([],
|
|
2109
|
+
#pointer = signal([], /* @ts-ignore */
|
|
2110
|
+
...(ngDevMode ? [{ debugName: "#pointer" }] : /* istanbul ignore next */ []));
|
|
2083
2111
|
// why: tên đang gõ ở CẤP HIỆN TẠI, kể cả khi nó chưa áp được vào draft.
|
|
2084
|
-
#typedName = signal('',
|
|
2112
|
+
#typedName = signal('', /* @ts-ignore */
|
|
2113
|
+
...(ngDevMode ? [{ debugName: "#typedName" }] : /* istanbul ignore next */ []));
|
|
2085
2114
|
draftName = this.#draftName.asReadonly();
|
|
2086
2115
|
discardPrompt = this.#discardPrompt.asReadonly();
|
|
2087
2116
|
/** The node the author is looking at right now — the draft root, or a descendant of it. */
|
|
@@ -2090,13 +2119,15 @@ class SdApiContractNodeDrawer {
|
|
|
2090
2119
|
if (!draft)
|
|
2091
2120
|
return null;
|
|
2092
2121
|
return getSdApiContractNodeAt(draft, this.#pointer());
|
|
2093
|
-
},
|
|
2122
|
+
}, /* @ts-ignore */
|
|
2123
|
+
...(ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []));
|
|
2094
2124
|
/** Every key on the breadcrumb. The pointer alternates `properties`/key, so keys sit on odd slots. */
|
|
2095
2125
|
breadcrumb = computed(() => {
|
|
2096
2126
|
const pointer = this.#pointer();
|
|
2097
2127
|
const keys = pointer.filter((_, index) => index % 2 === 1);
|
|
2098
2128
|
return [this.#draftName() || this.#i18n.t('core.component.api-contract-builder.drawer.add-title'), ...keys];
|
|
2099
|
-
},
|
|
2129
|
+
}, /* @ts-ignore */
|
|
2130
|
+
...(ngDevMode ? [{ debugName: "breadcrumb" }] : /* istanbul ignore next */ []));
|
|
2100
2131
|
/**
|
|
2101
2132
|
* What the name field shows.
|
|
2102
2133
|
*
|
|
@@ -2111,7 +2142,8 @@ class SdApiContractNodeDrawer {
|
|
|
2111
2142
|
if (!properties)
|
|
2112
2143
|
return [];
|
|
2113
2144
|
return Object.keys(properties).map(key => ({ key, node: properties[key] }));
|
|
2114
|
-
},
|
|
2145
|
+
}, /* @ts-ignore */
|
|
2146
|
+
...(ngDevMode ? [{ debugName: "children" }] : /* istanbul ignore next */ []));
|
|
2115
2147
|
/** Siblings on the level the author is on — the root list, or the parent object's keys. */
|
|
2116
2148
|
siblingNames = computed(() => {
|
|
2117
2149
|
const pointer = this.#pointer();
|
|
@@ -2122,7 +2154,8 @@ class SdApiContractNodeDrawer {
|
|
|
2122
2154
|
return [];
|
|
2123
2155
|
const parent = getSdApiContractNodeAt(draft, pointer.slice(0, -2));
|
|
2124
2156
|
return parent?.properties ? Object.keys(parent.properties) : [];
|
|
2125
|
-
},
|
|
2157
|
+
}, /* @ts-ignore */
|
|
2158
|
+
...(ngDevMode ? [{ debugName: "siblingNames" }] : /* istanbul ignore next */ []));
|
|
2126
2159
|
typeOptions = SD_API_CONTRACT_DATA_TYPES.map(type => ({
|
|
2127
2160
|
value: type,
|
|
2128
2161
|
label: type,
|
|
@@ -2138,13 +2171,15 @@ class SdApiContractNodeDrawer {
|
|
|
2138
2171
|
];
|
|
2139
2172
|
title = computed(() => this.#editingName() === null
|
|
2140
2173
|
? this.#i18n.t('core.component.api-contract-builder.drawer.add-title')
|
|
2141
|
-
: this.#i18n.t('core.component.api-contract-builder.drawer.edit-title'),
|
|
2174
|
+
: this.#i18n.t('core.component.api-contract-builder.drawer.edit-title'), /* @ts-ignore */
|
|
2175
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
2142
2176
|
dirty = computed(() => {
|
|
2143
2177
|
const draft = this.#draft();
|
|
2144
2178
|
if (!draft)
|
|
2145
2179
|
return false;
|
|
2146
2180
|
return this.#draftName() !== this.#seedName || JSON.stringify(draft) !== this.#seedJson;
|
|
2147
|
-
},
|
|
2181
|
+
}, /* @ts-ignore */
|
|
2182
|
+
...(ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []));
|
|
2148
2183
|
nameError = computed(() => {
|
|
2149
2184
|
const name = this.currentName().trim();
|
|
2150
2185
|
if (name === '')
|
|
@@ -2156,7 +2191,8 @@ class SdApiContractNodeDrawer {
|
|
|
2156
2191
|
const self = pointer.length === 0 ? this.#editingName() : pointer[pointer.length - 1];
|
|
2157
2192
|
const taken = this.siblingNames().some(sibling => sibling === name && sibling !== self);
|
|
2158
2193
|
return taken ? this.#i18n.t('core.component.api-contract-builder.node.duplicate-key') : null;
|
|
2159
|
-
},
|
|
2194
|
+
}, /* @ts-ignore */
|
|
2195
|
+
...(ngDevMode ? [{ debugName: "nameError" }] : /* istanbul ignore next */ []));
|
|
2160
2196
|
// why chỉ xét lỗi ở GỐC: Lưu commit cả subtree, và tên đang gõ ở cấp sâu đã được `setName` áp vào
|
|
2161
2197
|
// draft ngay. Nếu chặn theo cấp hiện tại thì đứng ở cấp sâu sẽ không Lưu được gốc hợp lệ.
|
|
2162
2198
|
canSave = computed(() => {
|
|
@@ -2165,7 +2201,8 @@ class SdApiContractNodeDrawer {
|
|
|
2165
2201
|
if (this.#draftName().trim() === '')
|
|
2166
2202
|
return false;
|
|
2167
2203
|
return this.nameError() === null;
|
|
2168
|
-
},
|
|
2204
|
+
}, /* @ts-ignore */
|
|
2205
|
+
...(ngDevMode ? [{ debugName: "canSave" }] : /* istanbul ignore next */ []));
|
|
2169
2206
|
/**
|
|
2170
2207
|
* `beforeClose` guard for `<sd-side-drawer>`.
|
|
2171
2208
|
*
|
|
@@ -2364,8 +2401,8 @@ class SdApiContractNodeDrawer {
|
|
|
2364
2401
|
this.#seedName = this.#draftName();
|
|
2365
2402
|
this.#seedJson = draft ? JSON.stringify(draft) : '';
|
|
2366
2403
|
}
|
|
2367
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2368
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
2404
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractNodeDrawer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2405
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdApiContractNodeDrawer, isStandalone: true, selector: "sd-api-contract-node-drawer", inputs: { layer: { classPropertyName: "layer", publicName: "layer", isSignal: true, isRequired: false, transformFunction: null }, allowTransform: { classPropertyName: "allowTransform", publicName: "allowTransform", isSignal: true, isRequired: false, transformFunction: null }, suggestions: { classPropertyName: "suggestions", publicName: "suggestions", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeCommit: "nodeCommit" }, viewQueries: [{ propertyName: "drawerRef", first: true, predicate: ["drawer"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
2369
2406
|
@let _autoId = autoId();
|
|
2370
2407
|
@let _current = current();
|
|
2371
2408
|
@let _nameError = nameError();
|
|
@@ -2538,7 +2575,7 @@ class SdApiContractNodeDrawer {
|
|
|
2538
2575
|
</sd-side-drawer>
|
|
2539
2576
|
`, isInline: true, styles: [".sd-acb-drawer{display:flex;flex-direction:column;gap:12px;padding:16px}.sd-acb-drawer__crumbs{display:flex;flex-wrap:wrap;gap:4px;align-items:center;font-size:12px}.sd-acb-drawer__crumb{padding:2px 4px;border:0;border-radius:4px;background:transparent;color:var(--sd-primary, #005cbb);font:inherit;cursor:pointer}.sd-acb-drawer__crumb:hover{background:color-mix(in srgb,var(--sd-primary, #005cbb) 10%,transparent)}.sd-acb-drawer__crumb--current{color:var(--sd-text, #1a1b1f);font-weight:600;cursor:default}.sd-acb-drawer__crumb-sep{color:var(--sd-text-secondary, #6b6b6b)}.sd-acb-drawer__children{display:flex;flex-direction:column;gap:6px;padding-top:4px;border-top:1px solid var(--sd-border-color, #e6e6e6)}.sd-acb-drawer__children-title{margin:0;font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--sd-text-secondary, #6b6b6b)}.sd-acb-drawer__empty{margin:0;font-size:12px;font-style:italic;color:var(--sd-text-secondary, #6b6b6b)}.sd-acb-drawer__confirm{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:8px 10px;border:1px dashed var(--sd-border-color, #e6e6e6);border-radius:6px;background:var(--sd-surface-muted, #f3f5f8);font-size:12px}\n"], dependencies: [{ kind: "component", type: SdSideDrawer, selector: "sd-side-drawer", inputs: ["title", "width", "hideClose", "disableBackdropClose", "beforeClose", "drawerClass", "autoId"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "hyperlink", "minWidthPanel", "hideInlineError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "items", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdApiContractNodeSummary, selector: "sd-api-contract-node-summary", inputs: ["name", "node", "readonly", "autoId"], outputs: ["edit", "remove"] }, { kind: "component", type: SdApiContractSourceEditor, selector: "sd-api-contract-source-editor", inputs: ["node", "suggestions", "disabled", "autoId"], outputs: ["nodeChange"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2540
2577
|
}
|
|
2541
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2578
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractNodeDrawer, decorators: [{
|
|
2542
2579
|
type: Component,
|
|
2543
2580
|
args: [{ selector: 'sd-api-contract-node-drawer', standalone: true, imports: [SdSideDrawer, SdButton, SdInput, SdSelect, SdApiContractNodeSummary, SdApiContractSourceEditor, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
2544
2581
|
@let _autoId = autoId();
|
|
@@ -2737,11 +2774,14 @@ function uniqueChildKey(properties) {
|
|
|
2737
2774
|
*/
|
|
2738
2775
|
class SdApiContractNodeEditor {
|
|
2739
2776
|
/** The layer's root node. */
|
|
2740
|
-
node = input.required(
|
|
2777
|
+
node = input.required(/* @ts-ignore */
|
|
2778
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
2741
2779
|
/** Diagnostic path of the layer itself, e.g. `input.schema`. */
|
|
2742
|
-
basePath = input.required(
|
|
2780
|
+
basePath = input.required(/* @ts-ignore */
|
|
2781
|
+
...(ngDevMode ? [{ debugName: "basePath" }] : /* istanbul ignore next */ []));
|
|
2743
2782
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2744
|
-
autoId = input(
|
|
2783
|
+
autoId = input(/* @ts-ignore */
|
|
2784
|
+
...(ngDevMode ? [undefined, { debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
2745
2785
|
nodeChange = output();
|
|
2746
2786
|
editRequest = output();
|
|
2747
2787
|
/**
|
|
@@ -2754,19 +2794,23 @@ class SdApiContractNodeEditor {
|
|
|
2754
2794
|
#container = computed(() => {
|
|
2755
2795
|
const node = this.node();
|
|
2756
2796
|
return node.type === 'array' && node.items ? node.items : node;
|
|
2757
|
-
},
|
|
2797
|
+
}, /* @ts-ignore */
|
|
2798
|
+
...(ngDevMode ? [{ debugName: "#container" }] : /* istanbul ignore next */ []));
|
|
2758
2799
|
/** `['items']` for an array layer, `[]` otherwise — the prefix a commit has to be written under. */
|
|
2759
2800
|
#containerPointer = computed(() => {
|
|
2760
2801
|
const node = this.node();
|
|
2761
2802
|
return node.type === 'array' && node.items ? ['items'] : [];
|
|
2762
|
-
},
|
|
2803
|
+
}, /* @ts-ignore */
|
|
2804
|
+
...(ngDevMode ? [{ debugName: "#containerPointer" }] : /* istanbul ignore next */ []));
|
|
2763
2805
|
entries = computed(() => {
|
|
2764
2806
|
const properties = this.#container().properties;
|
|
2765
2807
|
if (!properties)
|
|
2766
2808
|
return [];
|
|
2767
2809
|
return Object.keys(properties).map(key => ({ key, node: properties[key] }));
|
|
2768
|
-
},
|
|
2769
|
-
|
|
2810
|
+
}, /* @ts-ignore */
|
|
2811
|
+
...(ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []));
|
|
2812
|
+
#keys = computed(() => this.entries().map(entry => entry.key), /* @ts-ignore */
|
|
2813
|
+
...(ngDevMode ? [{ debugName: "#keys" }] : /* istanbul ignore next */ []));
|
|
2770
2814
|
requestAdd() {
|
|
2771
2815
|
this.editRequest.emit({ name: null, node: null, siblingNames: this.#keys(), pointer: this.#containerPointer() });
|
|
2772
2816
|
}
|
|
@@ -2777,10 +2821,10 @@ class SdApiContractNodeEditor {
|
|
|
2777
2821
|
const stripped = removeSdApiContractProperty(this.#container(), key);
|
|
2778
2822
|
this.nodeChange.emit(setSdApiContractNodeAt(this.node(), this.#containerPointer(), stripped));
|
|
2779
2823
|
}
|
|
2780
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2781
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
2824
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractNodeEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2825
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdApiContractNodeEditor, isStandalone: true, selector: "sd-api-contract-node-editor", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, basePath: { classPropertyName: "basePath", publicName: "basePath", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeChange: "nodeChange", editRequest: "editRequest" }, ngImport: i0, template: "@let _entries = entries();\n@let _disabled = disabled();\n@let _autoId = autoId();\n\n<div class=\"sd-acb-list\">\n @if (!_entries.length) {\n <p class=\"sd-acb-list__empty\">{{ 'core.component.api-contract-builder.node.empty' | sdTranslate }}</p>\n }\n\n @for (entry of _entries; track entry.key) {\n <sd-api-contract-node-summary\n [name]=\"entry.key\"\n [node]=\"entry.node\"\n [readonly]=\"_disabled\"\n [autoId]=\"_autoId ? _autoId + '-' + entry.key : undefined\"\n (edit)=\"requestEdit(entry.key, entry.node)\"\n (remove)=\"removeProperty(entry.key)\"></sd-api-contract-node-summary>\n }\n\n @if (!_disabled) {\n <sd-button\n class=\"sd-acb-list__add\"\n type=\"light\"\n size=\"sm\"\n prefixIcon=\"add\"\n [autoId]=\"_autoId ? _autoId + '-add' : undefined\"\n [title]=\"'core.component.api-contract-builder.node.add-property' | sdTranslate\"\n (click)=\"requestAdd()\"></sd-button>\n }\n</div>\n", styles: [":host{display:block;width:100%}.sd-acb-list{display:flex;flex-direction:column;gap:6px}.sd-acb-list__empty{margin:0;font-size:12px;font-style:italic;color:var(--sd-text-secondary, #6b6b6b)}.sd-acb-list__add{align-self:flex-start}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdApiContractNodeSummary, selector: "sd-api-contract-node-summary", inputs: ["name", "node", "readonly", "autoId"], outputs: ["edit", "remove"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2782
2826
|
}
|
|
2783
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2827
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractNodeEditor, decorators: [{
|
|
2784
2828
|
type: Component,
|
|
2785
2829
|
args: [{ selector: 'sd-api-contract-node-editor', standalone: true, imports: [SdButton, SdTranslatePipe, SdApiContractNodeSummary], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let _entries = entries();\n@let _disabled = disabled();\n@let _autoId = autoId();\n\n<div class=\"sd-acb-list\">\n @if (!_entries.length) {\n <p class=\"sd-acb-list__empty\">{{ 'core.component.api-contract-builder.node.empty' | sdTranslate }}</p>\n }\n\n @for (entry of _entries; track entry.key) {\n <sd-api-contract-node-summary\n [name]=\"entry.key\"\n [node]=\"entry.node\"\n [readonly]=\"_disabled\"\n [autoId]=\"_autoId ? _autoId + '-' + entry.key : undefined\"\n (edit)=\"requestEdit(entry.key, entry.node)\"\n (remove)=\"removeProperty(entry.key)\"></sd-api-contract-node-summary>\n }\n\n @if (!_disabled) {\n <sd-button\n class=\"sd-acb-list__add\"\n type=\"light\"\n size=\"sm\"\n prefixIcon=\"add\"\n [autoId]=\"_autoId ? _autoId + '-add' : undefined\"\n [title]=\"'core.component.api-contract-builder.node.add-property' | sdTranslate\"\n (click)=\"requestAdd()\"></sd-button>\n }\n</div>\n", styles: [":host{display:block;width:100%}.sd-acb-list{display:flex;flex-direction:column;gap:6px}.sd-acb-list__empty{margin:0;font-size:12px;font-style:italic;color:var(--sd-text-secondary, #6b6b6b)}.sd-acb-list__add{align-self:flex-start}\n"] }]
|
|
2786
2830
|
}], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }], basePath: [{ type: i0.Input, args: [{ isSignal: true, alias: "basePath", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], nodeChange: [{ type: i0.Output, args: ["nodeChange"] }], editRequest: [{ type: i0.Output, args: ["editRequest"] }] } });
|
|
@@ -2795,12 +2839,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2795
2839
|
* contract just because someone clicked the add button and changed their mind.
|
|
2796
2840
|
*/
|
|
2797
2841
|
class SdApiContractRecordEditor {
|
|
2798
|
-
record = input(
|
|
2842
|
+
record = input(/* @ts-ignore */
|
|
2843
|
+
...(ngDevMode ? [undefined, { debugName: "record" }] : /* istanbul ignore next */ []));
|
|
2799
2844
|
/** Diagnostic path of the collection itself, e.g. `req.query`. */
|
|
2800
|
-
basePath = input.required(
|
|
2845
|
+
basePath = input.required(/* @ts-ignore */
|
|
2846
|
+
...(ngDevMode ? [{ debugName: "basePath" }] : /* istanbul ignore next */ []));
|
|
2801
2847
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2802
|
-
emptyLabel = input('',
|
|
2803
|
-
|
|
2848
|
+
emptyLabel = input('', /* @ts-ignore */
|
|
2849
|
+
...(ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []));
|
|
2850
|
+
autoId = input(/* @ts-ignore */
|
|
2851
|
+
...(ngDevMode ? [undefined, { debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
2804
2852
|
recordChange = output();
|
|
2805
2853
|
editRequest = output();
|
|
2806
2854
|
entries = computed(() => {
|
|
@@ -2809,8 +2857,10 @@ class SdApiContractRecordEditor {
|
|
|
2809
2857
|
return [];
|
|
2810
2858
|
const base = this.basePath();
|
|
2811
2859
|
return Object.keys(record).map(key => ({ key, node: record[key], path: `${base}.${key}` }));
|
|
2812
|
-
},
|
|
2813
|
-
|
|
2860
|
+
}, /* @ts-ignore */
|
|
2861
|
+
...(ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []));
|
|
2862
|
+
#keys = computed(() => this.entries().map(entry => entry.key), /* @ts-ignore */
|
|
2863
|
+
...(ngDevMode ? [{ debugName: "#keys" }] : /* istanbul ignore next */ []));
|
|
2814
2864
|
requestAdd() {
|
|
2815
2865
|
this.editRequest.emit({ name: null, node: null, siblingNames: this.#keys() });
|
|
2816
2866
|
}
|
|
@@ -2823,8 +2873,8 @@ class SdApiContractRecordEditor {
|
|
|
2823
2873
|
return;
|
|
2824
2874
|
this.recordChange.emit(sdApiContractRecordRemove(record, key));
|
|
2825
2875
|
}
|
|
2826
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2827
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
2876
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractRecordEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2877
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdApiContractRecordEditor, isStandalone: true, selector: "sd-api-contract-record-editor", inputs: { record: { classPropertyName: "record", publicName: "record", isSignal: true, isRequired: false, transformFunction: null }, basePath: { classPropertyName: "basePath", publicName: "basePath", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, emptyLabel: { classPropertyName: "emptyLabel", publicName: "emptyLabel", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { recordChange: "recordChange", editRequest: "editRequest" }, ngImport: i0, template: `
|
|
2828
2878
|
@let _entries = entries();
|
|
2829
2879
|
@let _disabled = disabled();
|
|
2830
2880
|
@let _autoId = autoId();
|
|
@@ -2857,7 +2907,7 @@ class SdApiContractRecordEditor {
|
|
|
2857
2907
|
</div>
|
|
2858
2908
|
`, isInline: true, styles: [":host{display:block;width:100%}.sd-acb-record{display:flex;flex-direction:column;gap:6px}.sd-acb-record__empty{margin:0;font-size:12px;font-style:italic;color:var(--sd-text-secondary, #6b6b6b)}.sd-acb-record__add{align-self:flex-start}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdApiContractNodeSummary, selector: "sd-api-contract-node-summary", inputs: ["name", "node", "readonly", "autoId"], outputs: ["edit", "remove"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2859
2909
|
}
|
|
2860
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2910
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractRecordEditor, decorators: [{
|
|
2861
2911
|
type: Component,
|
|
2862
2912
|
args: [{ selector: 'sd-api-contract-record-editor', standalone: true, imports: [SdButton, SdTranslatePipe, SdApiContractNodeSummary], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
2863
2913
|
@let _entries = entries();
|
|
@@ -2914,28 +2964,36 @@ const STEP_REVIEW = 5;
|
|
|
2914
2964
|
class SdApiContractBuilder {
|
|
2915
2965
|
#i18n = inject(I18nService);
|
|
2916
2966
|
#configuration = resolveSdApiContractConfiguration(inject(SD_API_CONTRACT_CONFIGURATION, { optional: true }));
|
|
2917
|
-
model = model(null,
|
|
2918
|
-
|
|
2967
|
+
model = model(null, /* @ts-ignore */
|
|
2968
|
+
...(ngDevMode ? [{ debugName: "model" }] : /* istanbul ignore next */ []));
|
|
2969
|
+
mode = input('edit', /* @ts-ignore */
|
|
2970
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
2919
2971
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2920
|
-
autoId = input(
|
|
2972
|
+
autoId = input(/* @ts-ignore */
|
|
2973
|
+
...(ngDevMode ? [undefined, { debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
2921
2974
|
/** Fires whenever the diagnostics change, including once for the initially seeded contract. */
|
|
2922
2975
|
diagnosticsChange = output();
|
|
2923
2976
|
/** Fires only when validity flips, so a consumer can gate a Save button without debouncing. */
|
|
2924
2977
|
validChange = output();
|
|
2925
2978
|
// why: bản nháp nội bộ là BẢN SAO SÂU của model cha. Component không bao giờ ghi vào object cha —
|
|
2926
2979
|
// mọi thao tác dựng contract mới rồi mới `model.set`.
|
|
2927
|
-
#draft = signal(null,
|
|
2980
|
+
#draft = signal(null, /* @ts-ignore */
|
|
2981
|
+
...(ngDevMode ? [{ debugName: "#draft" }] : /* istanbul ignore next */ []));
|
|
2928
2982
|
// why: mốc so sánh để phân biệt "cha đưa giá trị mới vào" với "chính ta vừa bắn ra" — thiếu nó,
|
|
2929
2983
|
// effect seed sẽ clone lại contract ta vừa emit và tạo vòng lặp phản hồi.
|
|
2930
2984
|
#lastEmitted = null;
|
|
2931
2985
|
#lastValid = null;
|
|
2932
|
-
activeStep = signal(STEP_GENERAL,
|
|
2986
|
+
activeStep = signal(STEP_GENERAL, /* @ts-ignore */
|
|
2987
|
+
...(ngDevMode ? [{ debugName: "activeStep" }] : /* istanbul ignore next */ []));
|
|
2933
2988
|
contractVersion = SD_API_CONTRACT_VERSION;
|
|
2934
|
-
responseFieldToken = signal(null,
|
|
2989
|
+
responseFieldToken = signal(null, /* @ts-ignore */
|
|
2990
|
+
...(ngDevMode ? [{ debugName: "responseFieldToken" }] : /* istanbul ignore next */ []));
|
|
2935
2991
|
urlPlaceholder = '${env.baseUrl}/products/{id}';
|
|
2936
2992
|
draft = this.#draft.asReadonly();
|
|
2937
|
-
readonly = computed(() => this.disabled() || this.mode() === 'view',
|
|
2938
|
-
|
|
2993
|
+
readonly = computed(() => this.disabled() || this.mode() === 'view', /* @ts-ignore */
|
|
2994
|
+
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2995
|
+
isView = computed(() => this.mode() === 'view', /* @ts-ignore */
|
|
2996
|
+
...(ngDevMode ? [{ debugName: "isView" }] : /* istanbul ignore next */ []));
|
|
2939
2997
|
steps = [
|
|
2940
2998
|
{ index: STEP_GENERAL, key: 'general', label: this.#i18n.t('core.component.api-contract-builder.step.general') },
|
|
2941
2999
|
{ index: STEP_INPUT, key: 'input', label: this.#i18n.t('core.component.api-contract-builder.step.input') },
|
|
@@ -2961,15 +3019,19 @@ class SdApiContractBuilder {
|
|
|
2961
3019
|
});
|
|
2962
3020
|
// why: builder sở hữu ĐÚNG MỘT drawer, nên phải tự nhớ danh sách nào vừa yêu cầu mở nó. Không có
|
|
2963
3021
|
// mốc này thì `applyNodeCommit` không biết ghi kết quả vào `req.query` hay `res.headers`.
|
|
2964
|
-
#drawerTarget = signal(null,
|
|
2965
|
-
|
|
2966
|
-
|
|
3022
|
+
#drawerTarget = signal(null, /* @ts-ignore */
|
|
3023
|
+
...(ngDevMode ? [{ debugName: "#drawerTarget" }] : /* istanbul ignore next */ []));
|
|
3024
|
+
nodeDrawer = viewChild('nodeDrawer', /* @ts-ignore */
|
|
3025
|
+
...(ngDevMode ? [{ debugName: "nodeDrawer" }] : /* istanbul ignore next */ []));
|
|
3026
|
+
drawerLayer = computed(() => this.#drawerTarget()?.section === 'input.schema' ? 'schema' : 'mapping', /* @ts-ignore */
|
|
3027
|
+
...(ngDevMode ? [{ debugName: "drawerLayer" }] : /* istanbul ignore next */ []));
|
|
2967
3028
|
// why chỉ input/output schema: `transform` là thuộc tính của schema frontend. `req`/`res` mô tả HTTP,
|
|
2968
3029
|
// ở đó một giá trị thời gian đã là chuỗi trên đường truyền rồi.
|
|
2969
3030
|
drawerAllowsTransform = computed(() => {
|
|
2970
3031
|
const section = this.#drawerTarget()?.section;
|
|
2971
3032
|
return section === 'input.schema' || section === 'output.schema';
|
|
2972
|
-
},
|
|
3033
|
+
}, /* @ts-ignore */
|
|
3034
|
+
...(ngDevMode ? [{ debugName: "drawerAllowsTransform" }] : /* istanbul ignore next */ []));
|
|
2973
3035
|
drawerSuggestions = computed(() => {
|
|
2974
3036
|
const section = this.#drawerTarget()?.section;
|
|
2975
3037
|
if (section === undefined)
|
|
@@ -2979,18 +3041,22 @@ class SdApiContractBuilder {
|
|
|
2979
3041
|
if (section === 'res.headers' || section === 'res.body')
|
|
2980
3042
|
return this.outputSuggestions();
|
|
2981
3043
|
return this.requestSuggestions();
|
|
2982
|
-
},
|
|
3044
|
+
}, /* @ts-ignore */
|
|
3045
|
+
...(ngDevMode ? [{ debugName: "drawerSuggestions" }] : /* istanbul ignore next */ []));
|
|
2983
3046
|
// why: JSON dán vào có thể chưa parse được (đang gõ dở, thiếu ngoặc). Lỗi đó KHÔNG đến từ
|
|
2984
3047
|
// `validateSdApiContract` — nó chưa bao giờ thấy contract — nên phải mang riêng rồi trộn vào
|
|
2985
3048
|
// danh sách chẩn đoán, để người dán thấy lý do thay vì thấy contract im lặng không đổi.
|
|
2986
|
-
#pasteError = signal(null,
|
|
3049
|
+
#pasteError = signal(null, /* @ts-ignore */
|
|
3050
|
+
...(ngDevMode ? [{ debugName: "#pasteError" }] : /* istanbul ignore next */ []));
|
|
2987
3051
|
diagnostics = computed(() => {
|
|
2988
3052
|
const draft = this.#draft();
|
|
2989
3053
|
const base = draft ? validateSdApiContract(draft, this.#configuration) : [];
|
|
2990
3054
|
const pasteError = this.#pasteError();
|
|
2991
3055
|
return pasteError ? [pasteError, ...base] : base;
|
|
2992
|
-
},
|
|
2993
|
-
|
|
3056
|
+
}, /* @ts-ignore */
|
|
3057
|
+
...(ngDevMode ? [{ debugName: "diagnostics" }] : /* istanbul ignore next */ []));
|
|
3058
|
+
json = computed(() => serializeSdApiContract(this.#draft()), /* @ts-ignore */
|
|
3059
|
+
...(ngDevMode ? [{ debugName: "json" }] : /* istanbul ignore next */ []));
|
|
2994
3060
|
// why: contract từ ngoài có thể thiếu hẳn một tầng. Mọi computed đọc draft phải chịu được điều đó —
|
|
2995
3061
|
// builder có nhiệm vụ HIỂN THỊ contract sai kèm chẩn đoán, không được nổ và cũng không được tự vá.
|
|
2996
3062
|
#inputSuggestions = computed(() => {
|
|
@@ -3004,7 +3070,8 @@ class SdApiContractBuilder {
|
|
|
3004
3070
|
type: field.type,
|
|
3005
3071
|
display: `input.${field.path} — ${field.type}${field.label ? ` (${field.label})` : ''}`,
|
|
3006
3072
|
}));
|
|
3007
|
-
},
|
|
3073
|
+
}, /* @ts-ignore */
|
|
3074
|
+
...(ngDevMode ? [{ debugName: "#inputSuggestions" }] : /* istanbul ignore next */ []));
|
|
3008
3075
|
#responseSuggestions = computed(() => {
|
|
3009
3076
|
const response = this.#draft()?.res;
|
|
3010
3077
|
if (!response)
|
|
@@ -3016,33 +3083,39 @@ class SdApiContractBuilder {
|
|
|
3016
3083
|
type: field.type,
|
|
3017
3084
|
display: `res.${field.path} — ${field.type}`,
|
|
3018
3085
|
}));
|
|
3019
|
-
},
|
|
3020
|
-
|
|
3086
|
+
}, /* @ts-ignore */
|
|
3087
|
+
...(ngDevMode ? [{ debugName: "#responseSuggestions" }] : /* istanbul ignore next */ []));
|
|
3088
|
+
requestSuggestions = computed(() => [...this.#inputSuggestions(), ...this.#envSuggestions], /* @ts-ignore */
|
|
3089
|
+
...(ngDevMode ? [{ debugName: "requestSuggestions" }] : /* istanbul ignore next */ []));
|
|
3021
3090
|
outputSuggestions = computed(() => [
|
|
3022
3091
|
...this.#responseSuggestions(),
|
|
3023
3092
|
...this.#inputSuggestions(),
|
|
3024
3093
|
...this.#envSuggestions,
|
|
3025
|
-
],
|
|
3094
|
+
], /* @ts-ignore */
|
|
3095
|
+
...(ngDevMode ? [{ debugName: "outputSuggestions" }] : /* istanbul ignore next */ []));
|
|
3026
3096
|
/** Response paths offered by the "use a response field as the output" action. */
|
|
3027
3097
|
responseFieldOptions = computed(() => {
|
|
3028
3098
|
const response = this.#draft()?.res;
|
|
3029
3099
|
if (!response)
|
|
3030
3100
|
return [];
|
|
3031
3101
|
return listSdApiContractResponseFields(response).map(field => ({ value: field.path, label: `${field.path} — ${field.type}` }));
|
|
3032
|
-
},
|
|
3102
|
+
}, /* @ts-ignore */
|
|
3103
|
+
...(ngDevMode ? [{ debugName: "responseFieldOptions" }] : /* istanbul ignore next */ []));
|
|
3033
3104
|
/** Leaf fields a dropdown / table consumer will see once this contract runs. */
|
|
3034
3105
|
outputFields = computed(() => {
|
|
3035
3106
|
const schema = this.#draft()?.output?.schema;
|
|
3036
3107
|
if (!schema)
|
|
3037
3108
|
return [];
|
|
3038
3109
|
return listSdApiContractSchemaFields(schema).filter(field => field.leaf);
|
|
3039
|
-
},
|
|
3110
|
+
}, /* @ts-ignore */
|
|
3111
|
+
...(ngDevMode ? [{ debugName: "outputFields" }] : /* istanbul ignore next */ []));
|
|
3040
3112
|
statusText = computed(() => {
|
|
3041
3113
|
const status = this.#draft()?.res?.status;
|
|
3042
3114
|
if (status === undefined)
|
|
3043
3115
|
return '';
|
|
3044
3116
|
return Array.isArray(status) ? status.join(', ') : String(status);
|
|
3045
|
-
},
|
|
3117
|
+
}, /* @ts-ignore */
|
|
3118
|
+
...(ngDevMode ? [{ debugName: "statusText" }] : /* istanbul ignore next */ []));
|
|
3046
3119
|
get autoIdAttr() {
|
|
3047
3120
|
return this.autoId() ?? null;
|
|
3048
3121
|
}
|
|
@@ -3319,10 +3392,10 @@ class SdApiContractBuilder {
|
|
|
3319
3392
|
this.#draft.set(next);
|
|
3320
3393
|
this.model.set(next);
|
|
3321
3394
|
}
|
|
3322
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3323
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SdApiContractBuilder, isStandalone: true, selector: "sd-api-contract-builder", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", diagnosticsChange: "diagnosticsChange", validChange: "validChange" }, host: { properties: { "attr.data-autoId": "this.autoIdAttr" } }, viewQueries: [{ propertyName: "nodeDrawer", first: true, predicate: ["nodeDrawer"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _draft = draft();\n@let _readonly = readonly();\n@let _autoId = autoId();\n@let _diagnostics = diagnostics();\n@let _activeStep = activeStep();\n@let _requestSuggestions = requestSuggestions();\n@let _responseFieldOptions = responseFieldOptions();\n\n<!-- why: contract t\u1EEB ngo\u00E0i c\u00F3 th\u1EC3 thi\u1EBFu h\u1EB3n m\u1ED9t t\u1EA7ng. M\u1ECDi nh\u00E1nh \u0111\u1ECDc `_draft.<section>` \u0111\u1EC1u ph\u1EA3i\n g\u00E1c \u2014 builder hi\u1EC3n th\u1ECB contract sai k\u00E8m ch\u1EA9n \u0111o\u00E1n ch\u1EE9 kh\u00F4ng t\u1EF1 v\u00E1, v\u00E0 c\u0169ng kh\u00F4ng \u0111\u01B0\u1EE3c n\u1ED5. -->\n@if (!_draft) {\n <div class=\"sd-acb__empty\">\n <sd-icon name=\"description\" size=\"lg\"></sd-icon>\n <p>{{ 'core.component.api-contract-builder.empty.contract' | sdTranslate }}</p>\n @if (!_readonly) {\n <sd-button\n type=\"fill\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"add\"\n [autoId]=\"_autoId ? _autoId + '-create' : undefined\"\n [title]=\"'core.component.api-contract-builder.create-contract' | sdTranslate\"\n (click)=\"createContract()\"></sd-button>\n }\n </div>\n} @else if (isView()) {\n <section class=\"sd-acb__view\">\n <dl class=\"sd-acb__summary\">\n <dt>{{ 'core.component.api-contract-builder.contract.code' | sdTranslate }}</dt>\n <dd data-field=\"code\">{{ _draft.code }}</dd>\n <dt>{{ 'core.component.api-contract-builder.contract.name' | sdTranslate }}</dt>\n <dd data-field=\"name\">{{ _draft.name }}</dd>\n <dt>{{ 'core.component.api-contract-builder.request.method' | sdTranslate }}</dt>\n <dd data-field=\"method\">{{ _draft.req?.method }}</dd>\n <dt>{{ 'core.component.api-contract-builder.request.url' | sdTranslate }}</dt>\n <dd data-field=\"url\">{{ _draft.req?.url }}</dd>\n </dl>\n\n <sd-api-contract-diagnostic-list\n [diagnostics]=\"_diagnostics\"\n [autoId]=\"_autoId ? _autoId + '-diagnostics' : undefined\"></sd-api-contract-diagnostic-list>\n\n <sd-code-editor language=\"json\" [viewed]=\"true\" maxHeight=\"420px\" [model]=\"json()\"></sd-code-editor>\n </section>\n} @else {\n <nav class=\"sd-acb__steps\" [attr.aria-label]=\"'core.component.api-contract-builder.steps' | sdTranslate\">\n @for (step of steps; track step.index) {\n <button\n type=\"button\"\n class=\"sd-acb__step\"\n [class.sd-acb__step--active]=\"_activeStep === step.index\"\n [attr.aria-current]=\"_activeStep === step.index ? 'step' : null\"\n [attr.data-autoId]=\"_autoId ? _autoId + '-step-' + step.key : null\"\n (click)=\"goToStep(step.index)\">\n <span class=\"sd-acb__step-index\">{{ step.index + 1 }}</span>\n <span class=\"sd-acb__step-label\">{{ step.label }}</span>\n </button>\n }\n </nav>\n\n <div class=\"sd-acb__body\">\n @switch (_activeStep) {\n @case (0) {\n <section class=\"sd-acb__section\" data-step=\"general\">\n <div class=\"sd-acb__grid\">\n <sd-input\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-code' : undefined\"\n [label]=\"'core.component.api-contract-builder.contract.code' | sdTranslate\"\n [model]=\"_draft.code\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setText('code', $event)\"></sd-input>\n <sd-input\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-name' : undefined\"\n [label]=\"'core.component.api-contract-builder.contract.name' | sdTranslate\"\n [model]=\"_draft.name\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setText('name', $event)\"></sd-input>\n <sd-input\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-description' : undefined\"\n [label]=\"'core.component.api-contract-builder.contract.description' | sdTranslate\"\n [model]=\"_draft.description ?? ''\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setText('description', $event)\"></sd-input>\n <sd-input\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-version' : undefined\"\n [label]=\"'core.component.api-contract-builder.contract.version' | sdTranslate\"\n [model]=\"contractVersion\"\n [readonly]=\"true\"\n [disabled]=\"true\"></sd-input>\n </div>\n </section>\n }\n\n @case (1) {\n <section class=\"sd-acb__section\" data-step=\"input\">\n @if (_draft.input?.schema; as _inputSchema) {\n <sd-api-contract-node-editor\n [node]=\"$any(_inputSchema)\"\n basePath=\"input.schema\"\n [disabled]=\"_readonly\"\n [autoId]=\"_autoId ? _autoId + '-input' : undefined\"\n (nodeChange)=\"setInputSchema($event)\"\n (editRequest)=\"openNodeDrawer('input.schema', $event)\"></sd-api-contract-node-editor>\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.section' | sdTranslate }}</p>\n }\n </section>\n }\n\n @case (2) {\n <section class=\"sd-acb__section\" data-step=\"request\">\n @if (_draft.req; as _req) {\n <div class=\"sd-acb__grid\">\n <sd-select\n size=\"sm\"\n hideInlineError\n [clearable]=\"false\"\n [autoId]=\"_autoId ? _autoId + '-method' : undefined\"\n [label]=\"'core.component.api-contract-builder.request.method' | sdTranslate\"\n [items]=\"methodOptions\"\n valueField=\"value\"\n displayField=\"label\"\n [model]=\"_req.method\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setMethod($event)\"></sd-select>\n <sd-input\n class=\"sd-acb__url\"\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-url' : undefined\"\n [label]=\"'core.component.api-contract-builder.request.url' | sdTranslate\"\n [placeholder]=\"urlPlaceholder\"\n [model]=\"_req.url\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setUrl($event)\"></sd-input>\n </div>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.request.path' | sdTranslate }}</h4>\n <sd-api-contract-record-editor\n [record]=\"$any(_req.path)\"\n basePath=\"req.path\"\n [disabled]=\"_readonly\"\n [emptyLabel]=\"'core.component.api-contract-builder.empty.path' | sdTranslate\"\n [autoId]=\"_autoId ? _autoId + '-path' : undefined\"\n (recordChange)=\"setRequestRecord('path', $event)\"\n (editRequest)=\"openNodeDrawer('req.path', $event)\"></sd-api-contract-record-editor>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.request.query' | sdTranslate }}</h4>\n <sd-api-contract-record-editor\n [record]=\"$any(_req.query)\"\n basePath=\"req.query\"\n [disabled]=\"_readonly\"\n [emptyLabel]=\"'core.component.api-contract-builder.empty.query' | sdTranslate\"\n [autoId]=\"_autoId ? _autoId + '-query' : undefined\"\n (recordChange)=\"setRequestRecord('query', $event)\"\n (editRequest)=\"openNodeDrawer('req.query', $event)\"></sd-api-contract-record-editor>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.request.headers' | sdTranslate }}</h4>\n <sd-api-contract-record-editor\n [record]=\"$any(_req.headers)\"\n basePath=\"req.headers\"\n [disabled]=\"_readonly\"\n [emptyLabel]=\"'core.component.api-contract-builder.empty.headers' | sdTranslate\"\n [autoId]=\"_autoId ? _autoId + '-headers' : undefined\"\n (recordChange)=\"setRequestRecord('headers', $event)\"\n (editRequest)=\"openNodeDrawer('req.headers', $event)\"></sd-api-contract-record-editor>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.request.body' | sdTranslate }}</h4>\n @if (_req.body) {\n <sd-api-contract-node-editor\n [node]=\"$any(_req.body)\"\n basePath=\"req.body\"\n [disabled]=\"_readonly\"\n [autoId]=\"_autoId ? _autoId + '-body' : undefined\"\n (nodeChange)=\"setRequestBody($event)\"\n (editRequest)=\"openNodeDrawer('req.body', $event)\"></sd-api-contract-node-editor>\n @if (!_readonly) {\n <sd-button\n type=\"text\"\n color=\"error\"\n size=\"sm\"\n prefixIcon=\"delete\"\n [autoId]=\"_autoId ? _autoId + '-remove-body' : undefined\"\n [title]=\"'core.component.api-contract-builder.request.remove-body' | sdTranslate\"\n (click)=\"removeRequestBody()\"></sd-button>\n }\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.body' | sdTranslate }}</p>\n @if (!_readonly) {\n <sd-button\n type=\"light\"\n size=\"sm\"\n prefixIcon=\"add\"\n [autoId]=\"_autoId ? _autoId + '-add-body' : undefined\"\n [title]=\"'core.component.api-contract-builder.request.add-body' | sdTranslate\"\n (click)=\"addRequestBody()\"></sd-button>\n }\n }\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.section' | sdTranslate }}</p>\n }\n </section>\n }\n\n @case (3) {\n <section class=\"sd-acb__section\" data-step=\"response\">\n @if (_draft.res; as _res) {\n <sd-input\n class=\"sd-acb__status\"\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-status' : undefined\"\n [label]=\"'core.component.api-contract-builder.response.status' | sdTranslate\"\n [helperText]=\"'core.component.api-contract-builder.response.status-hint' | sdTranslate\"\n [model]=\"statusText()\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setStatus($event)\"></sd-input>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.response.headers' | sdTranslate }}</h4>\n <sd-api-contract-record-editor\n [record]=\"$any(_res.headers)\"\n basePath=\"res.headers\"\n [disabled]=\"_readonly\"\n [emptyLabel]=\"'core.component.api-contract-builder.empty.headers' | sdTranslate\"\n [autoId]=\"_autoId ? _autoId + '-res-headers' : undefined\"\n (recordChange)=\"setResponseHeaders($event)\"\n (editRequest)=\"openNodeDrawer('res.headers', $event)\"></sd-api-contract-record-editor>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.response.body' | sdTranslate }}</h4>\n @if (_res.body) {\n <sd-api-contract-node-editor\n [node]=\"$any(_res.body)\"\n basePath=\"res.body\"\n [disabled]=\"_readonly\"\n [autoId]=\"_autoId ? _autoId + '-res-body' : undefined\"\n (nodeChange)=\"setResponseBody($event)\"\n (editRequest)=\"openNodeDrawer('res.body', $event)\"></sd-api-contract-node-editor>\n @if (!_readonly) {\n <sd-button\n type=\"text\"\n color=\"error\"\n size=\"sm\"\n prefixIcon=\"delete\"\n [autoId]=\"_autoId ? _autoId + '-remove-res-body' : undefined\"\n [title]=\"'core.component.api-contract-builder.response.remove-body' | sdTranslate\"\n (click)=\"removeResponseBody()\"></sd-button>\n }\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.body' | sdTranslate }}</p>\n @if (!_readonly) {\n <sd-button\n type=\"light\"\n size=\"sm\"\n prefixIcon=\"add\"\n [autoId]=\"_autoId ? _autoId + '-add-res-body' : undefined\"\n [title]=\"'core.component.api-contract-builder.response.add-body' | sdTranslate\"\n (click)=\"addResponseBody()\"></sd-button>\n }\n }\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.section' | sdTranslate }}</p>\n }\n </section>\n }\n\n @case (4) {\n <section class=\"sd-acb__section\" data-step=\"output\">\n @if (_draft.output?.schema; as _outputSchema) {\n @if (!_readonly && _responseFieldOptions.length) {\n <sd-select\n class=\"sd-acb__adopt\"\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-use-response' : undefined\"\n [label]=\"'core.component.api-contract-builder.output.use-response' | sdTranslate\"\n [items]=\"_responseFieldOptions\"\n valueField=\"value\"\n displayField=\"label\"\n [(model)]=\"responseFieldToken\"\n (sdChange)=\"useResponseFieldAsOutput($event)\"></sd-select>\n }\n\n <sd-api-contract-node-editor\n [node]=\"$any(_outputSchema)\"\n basePath=\"output.schema\"\n [disabled]=\"_readonly\"\n [autoId]=\"_autoId ? _autoId + '-output' : undefined\"\n (nodeChange)=\"setOutputSchema($event)\"\n (editRequest)=\"openNodeDrawer('output.schema', $event)\"></sd-api-contract-node-editor>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.output.fields' | sdTranslate }}</h4>\n @let _outputFields = outputFields();\n @if (_outputFields.length) {\n <ul class=\"sd-acb__fields\" [attr.data-autoId]=\"_autoId ? _autoId + '-output-fields' : null\">\n @for (field of _outputFields; track field.path) {\n <li class=\"sd-acb__field\">\n <code>{{ field.path }}</code>\n <span class=\"sd-acb__field-type\">{{ field.type }}</span>\n @if (field.required === true) {\n <span class=\"sd-acb__field-flag\">{{ 'core.component.api-contract-builder.field.required' | sdTranslate }}</span>\n }\n </li>\n }\n </ul>\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.output.no-fields' | sdTranslate }}</p>\n }\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.section' | sdTranslate }}</p>\n }\n </section>\n }\n\n @default {\n <section class=\"sd-acb__section\" data-step=\"review\">\n <sd-api-contract-diagnostic-list\n [diagnostics]=\"_diagnostics\"\n [autoId]=\"_autoId ? _autoId + '-diagnostics' : undefined\"\n (navigate)=\"goToDiagnostic($event)\"></sd-api-contract-diagnostic-list>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.review.json' | sdTranslate }}</h4>\n <sd-code-editor\n language=\"json\"\n maxHeight=\"480px\"\n [viewed]=\"disabled() || mode() === 'view'\"\n [model]=\"json()\"\n (modelChange)=\"applyPastedJson($event)\"></sd-code-editor>\n </section>\n }\n }\n </div>\n\n <!-- why M\u1ED8T instance duy nh\u1EA5t, \u0111\u1EB7t ngo\u00E0i @switch: m\u1ED7i layer m\u1ED9t drawer s\u1EBD l\u00E0 m\u1ED7i layer m\u1ED9t draft, v\u00E0\n \u0111\u1ED5i step gi\u1EEFa l\u00FAc \u0111ang s\u1EEDa s\u1EBD destroy drawer c\u00F9ng v\u1EDBi thay \u0111\u1ED5i ch\u01B0a l\u01B0u. -->\n <sd-api-contract-node-drawer\n #nodeDrawer\n [layer]=\"drawerLayer()\"\n [allowTransform]=\"drawerAllowsTransform()\"\n [suggestions]=\"drawerSuggestions()\"\n [autoId]=\"_autoId ? _autoId + '-node-drawer' : undefined\"\n (nodeCommit)=\"applyNodeCommit($event)\"></sd-api-contract-node-drawer>\n}\n", styles: [":host{display:block;width:100%}.sd-acb__empty{display:flex;flex-direction:column;align-items:center;gap:10px;padding:32px 16px;border:1px dashed var(--sd-border-color, #e6e6e6);border-radius:8px;color:var(--sd-text-secondary, #6b6b6b)}.sd-acb__empty p{margin:0;font-size:13px}.sd-acb__steps{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:16px;border-bottom:1px solid var(--sd-border-color, #e6e6e6);padding-bottom:8px}.sd-acb__step{display:inline-flex;align-items:center;gap:8px;padding:6px 12px;border:1px solid transparent;border-radius:999px;background:transparent;color:var(--sd-text-secondary, #6b6b6b);font:inherit;font-size:13px;cursor:pointer}.sd-acb__step:hover,.sd-acb__step:focus-visible{background:var(--sd-surface-muted, #f3f5f8)}.sd-acb__step--active{border-color:var(--sd-primary, #005cbb);background:var(--sd-primary-light, #e5efff);color:var(--sd-primary-dark, #00419e);font-weight:600}.sd-acb__step-index{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--sd-surface-muted, #f3f5f8);font-size:11px;font-weight:700}.sd-acb__step--active .sd-acb__step-index{background:var(--sd-primary, #005cbb);color:#fff}.sd-acb__body{display:block}.sd-acb__section{display:flex;flex-direction:column;gap:12px}.sd-acb__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;align-items:start}.sd-acb__url,.sd-acb__status{grid-column:span 2}.sd-acb__adopt{max-width:420px}.sd-acb__heading{margin:8px 0 0;font-size:13px;font-weight:600;color:var(--sd-text, #1f2937)}.sd-acb__empty-text{margin:0;font-size:12px;font-style:italic;color:var(--sd-text-secondary, #6b6b6b)}.sd-acb__fields{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:8px}.sd-acb__field{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border:1px solid var(--sd-border-color, #e6e6e6);border-radius:6px;background:var(--sd-surface-muted, #f3f5f8);font-size:12px}.sd-acb__field-type{color:var(--sd-primary, #005cbb);font-weight:600}.sd-acb__field-flag{color:var(--sd-text-secondary, #6b6b6b)}.sd-acb__view{display:flex;flex-direction:column;gap:16px}.sd-acb__summary{display:grid;grid-template-columns:minmax(120px,max-content) 1fr;gap:6px 16px;margin:0;font-size:13px}.sd-acb__summary dt{color:var(--sd-text-secondary, #6b6b6b)}.sd-acb__summary dd{margin:0;font-weight:600;overflow-wrap:anywhere}@media(max-width:768px){.sd-acb__url,.sd-acb__status{grid-column:span 1}.sd-acb__step-label{display:none}}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdCodeEditor, selector: "sd-code-editor", inputs: ["model", "language", "maxHeight", "viewed"], outputs: ["modelChange"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "hyperlink", "minWidthPanel", "hideInlineError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "items", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdApiContractDiagnosticList, selector: "sd-api-contract-diagnostic-list", inputs: ["diagnostics", "autoId"], outputs: ["navigate"] }, { kind: "component", type: SdApiContractNodeEditor, selector: "sd-api-contract-node-editor", inputs: ["node", "basePath", "disabled", "autoId"], outputs: ["nodeChange", "editRequest"] }, { kind: "component", type: SdApiContractNodeDrawer, selector: "sd-api-contract-node-drawer", inputs: ["layer", "allowTransform", "suggestions", "autoId"], outputs: ["nodeCommit"] }, { kind: "component", type: SdApiContractRecordEditor, selector: "sd-api-contract-record-editor", inputs: ["record", "basePath", "disabled", "emptyLabel", "autoId"], outputs: ["recordChange", "editRequest"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3395
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractBuilder, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3396
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdApiContractBuilder, isStandalone: true, selector: "sd-api-contract-builder", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", diagnosticsChange: "diagnosticsChange", validChange: "validChange" }, host: { properties: { "attr.data-autoId": "this.autoIdAttr" } }, viewQueries: [{ propertyName: "nodeDrawer", first: true, predicate: ["nodeDrawer"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _draft = draft();\n@let _readonly = readonly();\n@let _autoId = autoId();\n@let _diagnostics = diagnostics();\n@let _activeStep = activeStep();\n@let _requestSuggestions = requestSuggestions();\n@let _responseFieldOptions = responseFieldOptions();\n\n<!-- why: contract t\u1EEB ngo\u00E0i c\u00F3 th\u1EC3 thi\u1EBFu h\u1EB3n m\u1ED9t t\u1EA7ng. M\u1ECDi nh\u00E1nh \u0111\u1ECDc `_draft.<section>` \u0111\u1EC1u ph\u1EA3i\n g\u00E1c \u2014 builder hi\u1EC3n th\u1ECB contract sai k\u00E8m ch\u1EA9n \u0111o\u00E1n ch\u1EE9 kh\u00F4ng t\u1EF1 v\u00E1, v\u00E0 c\u0169ng kh\u00F4ng \u0111\u01B0\u1EE3c n\u1ED5. -->\n@if (!_draft) {\n <div class=\"sd-acb__empty\">\n <sd-icon name=\"description\" size=\"lg\"></sd-icon>\n <p>{{ 'core.component.api-contract-builder.empty.contract' | sdTranslate }}</p>\n @if (!_readonly) {\n <sd-button\n type=\"fill\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"add\"\n [autoId]=\"_autoId ? _autoId + '-create' : undefined\"\n [title]=\"'core.component.api-contract-builder.create-contract' | sdTranslate\"\n (click)=\"createContract()\"></sd-button>\n }\n </div>\n} @else if (isView()) {\n <section class=\"sd-acb__view\">\n <dl class=\"sd-acb__summary\">\n <dt>{{ 'core.component.api-contract-builder.contract.code' | sdTranslate }}</dt>\n <dd data-field=\"code\">{{ _draft.code }}</dd>\n <dt>{{ 'core.component.api-contract-builder.contract.name' | sdTranslate }}</dt>\n <dd data-field=\"name\">{{ _draft.name }}</dd>\n <dt>{{ 'core.component.api-contract-builder.request.method' | sdTranslate }}</dt>\n <dd data-field=\"method\">{{ _draft.req?.method }}</dd>\n <dt>{{ 'core.component.api-contract-builder.request.url' | sdTranslate }}</dt>\n <dd data-field=\"url\">{{ _draft.req?.url }}</dd>\n </dl>\n\n <sd-api-contract-diagnostic-list\n [diagnostics]=\"_diagnostics\"\n [autoId]=\"_autoId ? _autoId + '-diagnostics' : undefined\"></sd-api-contract-diagnostic-list>\n\n <sd-code-editor language=\"json\" [viewed]=\"true\" maxHeight=\"420px\" [model]=\"json()\"></sd-code-editor>\n </section>\n} @else {\n <nav class=\"sd-acb__steps\" [attr.aria-label]=\"'core.component.api-contract-builder.steps' | sdTranslate\">\n @for (step of steps; track step.index) {\n <button\n type=\"button\"\n class=\"sd-acb__step\"\n [class.sd-acb__step--active]=\"_activeStep === step.index\"\n [attr.aria-current]=\"_activeStep === step.index ? 'step' : null\"\n [attr.data-autoId]=\"_autoId ? _autoId + '-step-' + step.key : null\"\n (click)=\"goToStep(step.index)\">\n <span class=\"sd-acb__step-index\">{{ step.index + 1 }}</span>\n <span class=\"sd-acb__step-label\">{{ step.label }}</span>\n </button>\n }\n </nav>\n\n <div class=\"sd-acb__body\">\n @switch (_activeStep) {\n @case (0) {\n <section class=\"sd-acb__section\" data-step=\"general\">\n <div class=\"sd-acb__grid\">\n <sd-input\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-code' : undefined\"\n [label]=\"'core.component.api-contract-builder.contract.code' | sdTranslate\"\n [model]=\"_draft.code\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setText('code', $event)\"></sd-input>\n <sd-input\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-name' : undefined\"\n [label]=\"'core.component.api-contract-builder.contract.name' | sdTranslate\"\n [model]=\"_draft.name\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setText('name', $event)\"></sd-input>\n <sd-input\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-description' : undefined\"\n [label]=\"'core.component.api-contract-builder.contract.description' | sdTranslate\"\n [model]=\"_draft.description ?? ''\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setText('description', $event)\"></sd-input>\n <sd-input\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-version' : undefined\"\n [label]=\"'core.component.api-contract-builder.contract.version' | sdTranslate\"\n [model]=\"contractVersion\"\n [readonly]=\"true\"\n [disabled]=\"true\"></sd-input>\n </div>\n </section>\n }\n\n @case (1) {\n <section class=\"sd-acb__section\" data-step=\"input\">\n @if (_draft.input?.schema; as _inputSchema) {\n <sd-api-contract-node-editor\n [node]=\"$any(_inputSchema)\"\n basePath=\"input.schema\"\n [disabled]=\"_readonly\"\n [autoId]=\"_autoId ? _autoId + '-input' : undefined\"\n (nodeChange)=\"setInputSchema($event)\"\n (editRequest)=\"openNodeDrawer('input.schema', $event)\"></sd-api-contract-node-editor>\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.section' | sdTranslate }}</p>\n }\n </section>\n }\n\n @case (2) {\n <section class=\"sd-acb__section\" data-step=\"request\">\n @if (_draft.req; as _req) {\n <div class=\"sd-acb__grid\">\n <sd-select\n size=\"sm\"\n hideInlineError\n [clearable]=\"false\"\n [autoId]=\"_autoId ? _autoId + '-method' : undefined\"\n [label]=\"'core.component.api-contract-builder.request.method' | sdTranslate\"\n [items]=\"methodOptions\"\n valueField=\"value\"\n displayField=\"label\"\n [model]=\"_req.method\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setMethod($event)\"></sd-select>\n <sd-input\n class=\"sd-acb__url\"\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-url' : undefined\"\n [label]=\"'core.component.api-contract-builder.request.url' | sdTranslate\"\n [placeholder]=\"urlPlaceholder\"\n [model]=\"_req.url\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setUrl($event)\"></sd-input>\n </div>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.request.path' | sdTranslate }}</h4>\n <sd-api-contract-record-editor\n [record]=\"$any(_req.path)\"\n basePath=\"req.path\"\n [disabled]=\"_readonly\"\n [emptyLabel]=\"'core.component.api-contract-builder.empty.path' | sdTranslate\"\n [autoId]=\"_autoId ? _autoId + '-path' : undefined\"\n (recordChange)=\"setRequestRecord('path', $event)\"\n (editRequest)=\"openNodeDrawer('req.path', $event)\"></sd-api-contract-record-editor>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.request.query' | sdTranslate }}</h4>\n <sd-api-contract-record-editor\n [record]=\"$any(_req.query)\"\n basePath=\"req.query\"\n [disabled]=\"_readonly\"\n [emptyLabel]=\"'core.component.api-contract-builder.empty.query' | sdTranslate\"\n [autoId]=\"_autoId ? _autoId + '-query' : undefined\"\n (recordChange)=\"setRequestRecord('query', $event)\"\n (editRequest)=\"openNodeDrawer('req.query', $event)\"></sd-api-contract-record-editor>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.request.headers' | sdTranslate }}</h4>\n <sd-api-contract-record-editor\n [record]=\"$any(_req.headers)\"\n basePath=\"req.headers\"\n [disabled]=\"_readonly\"\n [emptyLabel]=\"'core.component.api-contract-builder.empty.headers' | sdTranslate\"\n [autoId]=\"_autoId ? _autoId + '-headers' : undefined\"\n (recordChange)=\"setRequestRecord('headers', $event)\"\n (editRequest)=\"openNodeDrawer('req.headers', $event)\"></sd-api-contract-record-editor>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.request.body' | sdTranslate }}</h4>\n @if (_req.body) {\n <sd-api-contract-node-editor\n [node]=\"$any(_req.body)\"\n basePath=\"req.body\"\n [disabled]=\"_readonly\"\n [autoId]=\"_autoId ? _autoId + '-body' : undefined\"\n (nodeChange)=\"setRequestBody($event)\"\n (editRequest)=\"openNodeDrawer('req.body', $event)\"></sd-api-contract-node-editor>\n @if (!_readonly) {\n <sd-button\n type=\"text\"\n color=\"error\"\n size=\"sm\"\n prefixIcon=\"delete\"\n [autoId]=\"_autoId ? _autoId + '-remove-body' : undefined\"\n [title]=\"'core.component.api-contract-builder.request.remove-body' | sdTranslate\"\n (click)=\"removeRequestBody()\"></sd-button>\n }\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.body' | sdTranslate }}</p>\n @if (!_readonly) {\n <sd-button\n type=\"light\"\n size=\"sm\"\n prefixIcon=\"add\"\n [autoId]=\"_autoId ? _autoId + '-add-body' : undefined\"\n [title]=\"'core.component.api-contract-builder.request.add-body' | sdTranslate\"\n (click)=\"addRequestBody()\"></sd-button>\n }\n }\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.section' | sdTranslate }}</p>\n }\n </section>\n }\n\n @case (3) {\n <section class=\"sd-acb__section\" data-step=\"response\">\n @if (_draft.res; as _res) {\n <sd-input\n class=\"sd-acb__status\"\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-status' : undefined\"\n [label]=\"'core.component.api-contract-builder.response.status' | sdTranslate\"\n [helperText]=\"'core.component.api-contract-builder.response.status-hint' | sdTranslate\"\n [model]=\"statusText()\"\n [disabled]=\"_readonly\"\n (sdChange)=\"setStatus($event)\"></sd-input>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.response.headers' | sdTranslate }}</h4>\n <sd-api-contract-record-editor\n [record]=\"$any(_res.headers)\"\n basePath=\"res.headers\"\n [disabled]=\"_readonly\"\n [emptyLabel]=\"'core.component.api-contract-builder.empty.headers' | sdTranslate\"\n [autoId]=\"_autoId ? _autoId + '-res-headers' : undefined\"\n (recordChange)=\"setResponseHeaders($event)\"\n (editRequest)=\"openNodeDrawer('res.headers', $event)\"></sd-api-contract-record-editor>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.response.body' | sdTranslate }}</h4>\n @if (_res.body) {\n <sd-api-contract-node-editor\n [node]=\"$any(_res.body)\"\n basePath=\"res.body\"\n [disabled]=\"_readonly\"\n [autoId]=\"_autoId ? _autoId + '-res-body' : undefined\"\n (nodeChange)=\"setResponseBody($event)\"\n (editRequest)=\"openNodeDrawer('res.body', $event)\"></sd-api-contract-node-editor>\n @if (!_readonly) {\n <sd-button\n type=\"text\"\n color=\"error\"\n size=\"sm\"\n prefixIcon=\"delete\"\n [autoId]=\"_autoId ? _autoId + '-remove-res-body' : undefined\"\n [title]=\"'core.component.api-contract-builder.response.remove-body' | sdTranslate\"\n (click)=\"removeResponseBody()\"></sd-button>\n }\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.body' | sdTranslate }}</p>\n @if (!_readonly) {\n <sd-button\n type=\"light\"\n size=\"sm\"\n prefixIcon=\"add\"\n [autoId]=\"_autoId ? _autoId + '-add-res-body' : undefined\"\n [title]=\"'core.component.api-contract-builder.response.add-body' | sdTranslate\"\n (click)=\"addResponseBody()\"></sd-button>\n }\n }\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.section' | sdTranslate }}</p>\n }\n </section>\n }\n\n @case (4) {\n <section class=\"sd-acb__section\" data-step=\"output\">\n @if (_draft.output?.schema; as _outputSchema) {\n @if (!_readonly && _responseFieldOptions.length) {\n <sd-select\n class=\"sd-acb__adopt\"\n size=\"sm\"\n hideInlineError\n [autoId]=\"_autoId ? _autoId + '-use-response' : undefined\"\n [label]=\"'core.component.api-contract-builder.output.use-response' | sdTranslate\"\n [items]=\"_responseFieldOptions\"\n valueField=\"value\"\n displayField=\"label\"\n [(model)]=\"responseFieldToken\"\n (sdChange)=\"useResponseFieldAsOutput($event)\"></sd-select>\n }\n\n <sd-api-contract-node-editor\n [node]=\"$any(_outputSchema)\"\n basePath=\"output.schema\"\n [disabled]=\"_readonly\"\n [autoId]=\"_autoId ? _autoId + '-output' : undefined\"\n (nodeChange)=\"setOutputSchema($event)\"\n (editRequest)=\"openNodeDrawer('output.schema', $event)\"></sd-api-contract-node-editor>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.output.fields' | sdTranslate }}</h4>\n @let _outputFields = outputFields();\n @if (_outputFields.length) {\n <ul class=\"sd-acb__fields\" [attr.data-autoId]=\"_autoId ? _autoId + '-output-fields' : null\">\n @for (field of _outputFields; track field.path) {\n <li class=\"sd-acb__field\">\n <code>{{ field.path }}</code>\n <span class=\"sd-acb__field-type\">{{ field.type }}</span>\n @if (field.required === true) {\n <span class=\"sd-acb__field-flag\">{{ 'core.component.api-contract-builder.field.required' | sdTranslate }}</span>\n }\n </li>\n }\n </ul>\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.output.no-fields' | sdTranslate }}</p>\n }\n } @else {\n <p class=\"sd-acb__empty-text\">{{ 'core.component.api-contract-builder.empty.section' | sdTranslate }}</p>\n }\n </section>\n }\n\n @default {\n <section class=\"sd-acb__section\" data-step=\"review\">\n <sd-api-contract-diagnostic-list\n [diagnostics]=\"_diagnostics\"\n [autoId]=\"_autoId ? _autoId + '-diagnostics' : undefined\"\n (navigate)=\"goToDiagnostic($event)\"></sd-api-contract-diagnostic-list>\n\n <h4 class=\"sd-acb__heading\">{{ 'core.component.api-contract-builder.review.json' | sdTranslate }}</h4>\n <sd-code-editor\n language=\"json\"\n maxHeight=\"480px\"\n [viewed]=\"disabled() || mode() === 'view'\"\n [model]=\"json()\"\n (modelChange)=\"applyPastedJson($event)\"></sd-code-editor>\n </section>\n }\n }\n </div>\n\n <!-- why M\u1ED8T instance duy nh\u1EA5t, \u0111\u1EB7t ngo\u00E0i @switch: m\u1ED7i layer m\u1ED9t drawer s\u1EBD l\u00E0 m\u1ED7i layer m\u1ED9t draft, v\u00E0\n \u0111\u1ED5i step gi\u1EEFa l\u00FAc \u0111ang s\u1EEDa s\u1EBD destroy drawer c\u00F9ng v\u1EDBi thay \u0111\u1ED5i ch\u01B0a l\u01B0u. -->\n <sd-api-contract-node-drawer\n #nodeDrawer\n [layer]=\"drawerLayer()\"\n [allowTransform]=\"drawerAllowsTransform()\"\n [suggestions]=\"drawerSuggestions()\"\n [autoId]=\"_autoId ? _autoId + '-node-drawer' : undefined\"\n (nodeCommit)=\"applyNodeCommit($event)\"></sd-api-contract-node-drawer>\n}\n", styles: [":host{display:block;width:100%}.sd-acb__empty{display:flex;flex-direction:column;align-items:center;gap:10px;padding:32px 16px;border:1px dashed var(--sd-border-color, #e6e6e6);border-radius:8px;color:var(--sd-text-secondary, #6b6b6b)}.sd-acb__empty p{margin:0;font-size:13px}.sd-acb__steps{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:16px;border-bottom:1px solid var(--sd-border-color, #e6e6e6);padding-bottom:8px}.sd-acb__step{display:inline-flex;align-items:center;gap:8px;padding:6px 12px;border:1px solid transparent;border-radius:999px;background:transparent;color:var(--sd-text-secondary, #6b6b6b);font:inherit;font-size:13px;cursor:pointer}.sd-acb__step:hover,.sd-acb__step:focus-visible{background:var(--sd-surface-muted, #f3f5f8)}.sd-acb__step--active{border-color:var(--sd-primary, #005cbb);background:var(--sd-primary-light, #e5efff);color:var(--sd-primary-dark, #00419e);font-weight:600}.sd-acb__step-index{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--sd-surface-muted, #f3f5f8);font-size:11px;font-weight:700}.sd-acb__step--active .sd-acb__step-index{background:var(--sd-primary, #005cbb);color:#fff}.sd-acb__body{display:block}.sd-acb__section{display:flex;flex-direction:column;gap:12px}.sd-acb__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;align-items:start}.sd-acb__url,.sd-acb__status{grid-column:span 2}.sd-acb__adopt{max-width:420px}.sd-acb__heading{margin:8px 0 0;font-size:13px;font-weight:600;color:var(--sd-text, #1f2937)}.sd-acb__empty-text{margin:0;font-size:12px;font-style:italic;color:var(--sd-text-secondary, #6b6b6b)}.sd-acb__fields{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:8px}.sd-acb__field{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border:1px solid var(--sd-border-color, #e6e6e6);border-radius:6px;background:var(--sd-surface-muted, #f3f5f8);font-size:12px}.sd-acb__field-type{color:var(--sd-primary, #005cbb);font-weight:600}.sd-acb__field-flag{color:var(--sd-text-secondary, #6b6b6b)}.sd-acb__view{display:flex;flex-direction:column;gap:16px}.sd-acb__summary{display:grid;grid-template-columns:minmax(120px,max-content) 1fr;gap:6px 16px;margin:0;font-size:13px}.sd-acb__summary dt{color:var(--sd-text-secondary, #6b6b6b)}.sd-acb__summary dd{margin:0;font-weight:600;overflow-wrap:anywhere}@media(max-width:768px){.sd-acb__url,.sd-acb__status{grid-column:span 1}.sd-acb__step-label{display:none}}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdCodeEditor, selector: "sd-code-editor", inputs: ["model", "language", "maxHeight", "viewed"], outputs: ["modelChange"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "hyperlink", "minWidthPanel", "hideInlineError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "items", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdApiContractDiagnosticList, selector: "sd-api-contract-diagnostic-list", inputs: ["diagnostics", "autoId"], outputs: ["navigate"] }, { kind: "component", type: SdApiContractNodeEditor, selector: "sd-api-contract-node-editor", inputs: ["node", "basePath", "disabled", "autoId"], outputs: ["nodeChange", "editRequest"] }, { kind: "component", type: SdApiContractNodeDrawer, selector: "sd-api-contract-node-drawer", inputs: ["layer", "allowTransform", "suggestions", "autoId"], outputs: ["nodeCommit"] }, { kind: "component", type: SdApiContractRecordEditor, selector: "sd-api-contract-record-editor", inputs: ["record", "basePath", "disabled", "emptyLabel", "autoId"], outputs: ["recordChange", "editRequest"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3324
3397
|
}
|
|
3325
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdApiContractBuilder, decorators: [{
|
|
3326
3399
|
type: Component,
|
|
3327
3400
|
args: [{ selector: 'sd-api-contract-builder', standalone: true, imports: [
|
|
3328
3401
|
SdButton,
|