@sdcorejs/angular 19.3.0 → 19.3.1
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 +2 -2
- package/components/file-explorer/index.d.ts +1 -0
- package/components/file-explorer/src/components/actions.component.d.ts +40 -0
- package/components/file-explorer/src/components/command-sheet.component.d.ts +49 -0
- package/components/file-explorer/src/components/folder-tree.component.d.ts +41 -11
- package/components/file-explorer/src/components/item-list.component.d.ts +68 -13
- package/components/file-explorer/src/components/menu-trigger.component.d.ts +27 -0
- package/components/file-explorer/src/components/preview-panel.component.d.ts +6 -4
- package/components/file-explorer/src/file-explorer-actions.d.ts +80 -0
- package/components/file-explorer/src/file-explorer-column.directive.d.ts +20 -0
- package/components/file-explorer/src/file-explorer-move.d.ts +12 -0
- package/components/file-explorer/src/file-explorer-normalize.d.ts +72 -0
- package/components/file-explorer/src/file-explorer.component.d.ts +106 -23
- package/components/file-explorer/src/file-explorer.model.d.ts +210 -29
- package/components/file-explorer/src/file-explorer.utils.d.ts +1 -1
- package/components/file-explorer/src/file-explorer.view-model.d.ts +75 -5
- package/components/form-generic/src/components/form-builder/form-builder.component.d.ts +5 -0
- package/components/form-generic/src/components/form-builder/inspector/inspector.component.d.ts +75 -67
- package/components/form-generic/src/components/form-builder/state/builder-commands.d.ts +3 -1
- package/components/form-generic/src/components/form-builder/state/builder-document.d.ts +6 -2
- package/components/form-generic/src/components/form-builder/state/builder-store.d.ts +18 -1
- package/components/form-generic/src/components/form-render/components/item/components/datetime/datetime.component.d.ts +7 -6
- package/components/form-generic/src/components/form-render/components/item/item.component.d.ts +3 -1
- package/components/form-generic/src/components/form-render/form-render.component.d.ts +31 -4
- package/components/form-generic/src/models/form-generic-schema.model.d.ts +2 -1
- package/components/index.d.ts +1 -0
- package/components/kanban/index.d.ts +3 -0
- package/components/kanban/src/kanban.component.d.ts +83 -0
- package/components/kanban/src/kanban.model.d.ts +65 -0
- package/components/kanban/src/kanban.templates.d.ts +30 -0
- package/components/kanban/src/kanban.utils.d.ts +5 -0
- package/components/section/src/section-item/section-item.component.d.ts +2 -1
- package/components/tab/src/tab-group.component.d.ts +3 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +2158 -86
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +637 -34
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +441 -0
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-section.mjs +4 -3
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs +5 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +11 -3
- package/fesm2022/sdcorejs-angular-components-tab.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-forms-segmented.mjs +244 -0
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-forms.mjs +8 -0
- package/fesm2022/sdcorejs-angular-forms.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +300 -0
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +2 -2
- package/forms/index.d.ts +1 -0
- package/forms/segmented/index.d.ts +2 -0
- package/forms/segmented/src/segmented.component.d.ts +57 -0
- package/forms/segmented/src/segmented.model.d.ts +28 -0
- package/forms/src/forms.module.d.ts +7 -6
- package/i18n/src/en.d.ts +59 -0
- package/package.json +13 -5
|
@@ -12,7 +12,7 @@ import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
|
12
12
|
import { SdConfirmService } from '@sdcorejs/angular/services/confirm';
|
|
13
13
|
import { SdNotifyService } from '@sdcorejs/angular/services/notify';
|
|
14
14
|
import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
|
|
15
|
-
import { Subject, firstValueFrom,
|
|
15
|
+
import { Subject, firstValueFrom, timer, race } from 'rxjs';
|
|
16
16
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
17
17
|
import { FormGroup } from '@angular/forms';
|
|
18
18
|
import * as i1$1 from '@angular/material/menu';
|
|
@@ -28,6 +28,9 @@ import { SdTextarea } from '@sdcorejs/angular/forms/textarea';
|
|
|
28
28
|
import { moveItemInArray, CdkDropList, CdkDrag, CdkDragHandle, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
|
|
29
29
|
import { SdSwitch } from '@sdcorejs/angular/forms/switch';
|
|
30
30
|
import { SdSection } from '@sdcorejs/angular/components/section';
|
|
31
|
+
import { SdTabGroup, SdTab } from '@sdcorejs/angular/components/tab';
|
|
32
|
+
import { SdStepper, SdStep } from '@sdcorejs/angular/components/stepper';
|
|
33
|
+
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
31
34
|
import { SdView } from '@sdcorejs/angular/components/view';
|
|
32
35
|
import { sdIsExternalHttpUrl } from '@sdcorejs/angular/utilities';
|
|
33
36
|
import { SdSuffixDefDirective } from '@sdcorejs/angular/forms/directives';
|
|
@@ -766,23 +769,27 @@ const createId = () => Utilities.randomId('id');
|
|
|
766
769
|
* Nạp schema từ consumer. Chuẩn hoá (clone, cấp `id` còn thiếu) — KHÔNG mutate input, không bỏ
|
|
767
770
|
* thuộc tính nào, phần tử type lạ được giữ nguyên.
|
|
768
771
|
*/
|
|
769
|
-
const documentFromSchema = (schema) => {
|
|
772
|
+
const documentFromSchema = (schema, activePageId) => {
|
|
770
773
|
const normalized = sdNormalizeSchema((schema ?? {}));
|
|
771
774
|
const { pages, variables, validations, ...rest } = normalized;
|
|
772
|
-
const
|
|
775
|
+
const pagePosition = Math.max(0, pages.findIndex(page => page.id === activePageId));
|
|
776
|
+
const first = pages[pagePosition];
|
|
777
|
+
const otherPages = pages.filter((_, index) => index !== pagePosition);
|
|
773
778
|
const { elements, ...page } = first;
|
|
774
779
|
return {
|
|
775
780
|
elements: elements ?? [],
|
|
776
781
|
variables: variables ?? [],
|
|
777
782
|
validations: validations ?? [],
|
|
778
|
-
base: { page, otherPages, rest },
|
|
783
|
+
base: { page, otherPages, rest, ...(pagePosition ? { pagePosition } : {}) },
|
|
779
784
|
};
|
|
780
785
|
};
|
|
781
786
|
/** Snapshot công khai: bản clone độc lập. Mảng rỗng của biến/validation không được ghi. */
|
|
782
787
|
const documentToSchema = (doc) => {
|
|
788
|
+
const pages = cloneJson([...doc.base.otherPages]);
|
|
789
|
+
pages.splice(doc.base.pagePosition ?? 0, 0, { ...cloneJson(doc.base.page), elements: cloneJson([...doc.elements]) });
|
|
783
790
|
const schema = {
|
|
784
791
|
...cloneJson(doc.base.rest),
|
|
785
|
-
pages
|
|
792
|
+
pages,
|
|
786
793
|
};
|
|
787
794
|
if (doc.variables.length)
|
|
788
795
|
schema.variables = cloneJson([...doc.variables]);
|
|
@@ -1230,6 +1237,28 @@ const LAYOUT_LEVELS = ['desktop', 'tablet', 'mobile'];
|
|
|
1230
1237
|
*/
|
|
1231
1238
|
/** Ý định chèn "hàng mới ở cuối vùng chứa". */
|
|
1232
1239
|
const endOf = (parentId) => ({ kind: 'row', parentId, beforeRowKey: null });
|
|
1240
|
+
/** Clone a whole supported page, rewriting structured references only inside its ownership boundary. */
|
|
1241
|
+
const clonePage = (doc, source) => {
|
|
1242
|
+
if (!source.elements.every(canDuplicate))
|
|
1243
|
+
return null;
|
|
1244
|
+
const copy = cloneJson(source);
|
|
1245
|
+
copy.id = createId();
|
|
1246
|
+
const takenKeys = collectKeys(doc);
|
|
1247
|
+
const renames = [];
|
|
1248
|
+
const members = copy.elements.flatMap(item => (isGroup(item) ? [item, ...(item.elements ?? [])] : [item]));
|
|
1249
|
+
for (const member of members) {
|
|
1250
|
+
member.id = createId();
|
|
1251
|
+
if (isGroup(member) || !('key' in member) || !member.key)
|
|
1252
|
+
continue;
|
|
1253
|
+
const nextKey = uniqueKey(member.key.replace(/_\d+$/, '') || 'field', takenKeys);
|
|
1254
|
+
takenKeys.add(nextKey);
|
|
1255
|
+
renames.push([member.key, nextKey]);
|
|
1256
|
+
}
|
|
1257
|
+
let scratch = { pages: [copy] };
|
|
1258
|
+
for (const [from, to] of renames)
|
|
1259
|
+
scratch = sdRenameKey(scratch, from, to);
|
|
1260
|
+
return scratch.pages[0];
|
|
1261
|
+
};
|
|
1233
1262
|
/** Ý định chèn "hàng mới ngay sau hàng chứa `id`". */
|
|
1234
1263
|
const rowAfter = (doc, id, mode) => {
|
|
1235
1264
|
const location = indexDocument(doc).get(id);
|
|
@@ -1472,6 +1501,12 @@ class FormBuilderStore {
|
|
|
1472
1501
|
#history = new BuilderHistory();
|
|
1473
1502
|
#historyTick = signal(0);
|
|
1474
1503
|
doc = signal(EMPTY_BUILDER_DOCUMENT);
|
|
1504
|
+
pages = computed(() => documentToSchema(this.doc()).pages);
|
|
1505
|
+
activePage = computed(() => this.doc().base.page);
|
|
1506
|
+
allElements = computed(() => this.pages().flatMap(page => page.elements));
|
|
1507
|
+
navigation = computed(() => this.doc().base.rest['navigation']);
|
|
1508
|
+
canDuplicatePage = computed(() => this.doc().elements.every(canDuplicate));
|
|
1509
|
+
#pageSelections = new Map();
|
|
1475
1510
|
selectedId = signal(null);
|
|
1476
1511
|
mode = signal('design');
|
|
1477
1512
|
viewport = signal('desktop');
|
|
@@ -1523,6 +1558,7 @@ class FormBuilderStore {
|
|
|
1523
1558
|
this.drag.set(null);
|
|
1524
1559
|
this.resize.set(null);
|
|
1525
1560
|
this.collapsed.set(new Set());
|
|
1561
|
+
this.#pageSelections.clear();
|
|
1526
1562
|
}
|
|
1527
1563
|
/** Áp tài liệu mới do người dùng thao tác — một bước undo (hoặc gộp theo `coalesceKey`). */
|
|
1528
1564
|
commit(next, options = {}) {
|
|
@@ -1544,11 +1580,12 @@ class FormBuilderStore {
|
|
|
1544
1580
|
const previous = this.#history.undo(this.doc());
|
|
1545
1581
|
if (!previous)
|
|
1546
1582
|
return false;
|
|
1547
|
-
this.doc
|
|
1583
|
+
const activeId = this.doc().base.page.id;
|
|
1584
|
+
this.doc.set(documentFromSchema(documentToSchema(previous), activeId));
|
|
1548
1585
|
this.#historyTick.update(value => value + 1);
|
|
1549
1586
|
this.#keepSelectionValid();
|
|
1550
1587
|
this.announce(this.t('core.component.form-builder.announce.undo'));
|
|
1551
|
-
this.changes.next(
|
|
1588
|
+
this.changes.next(this.doc());
|
|
1552
1589
|
return true;
|
|
1553
1590
|
}
|
|
1554
1591
|
redo() {
|
|
@@ -1557,11 +1594,12 @@ class FormBuilderStore {
|
|
|
1557
1594
|
const next = this.#history.redo(this.doc());
|
|
1558
1595
|
if (!next)
|
|
1559
1596
|
return false;
|
|
1560
|
-
this.doc
|
|
1597
|
+
const activeId = this.doc().base.page.id;
|
|
1598
|
+
this.doc.set(documentFromSchema(documentToSchema(next), activeId));
|
|
1561
1599
|
this.#historyTick.update(value => value + 1);
|
|
1562
1600
|
this.#keepSelectionValid();
|
|
1563
1601
|
this.announce(this.t('core.component.form-builder.announce.redo'));
|
|
1564
|
-
this.changes.next(
|
|
1602
|
+
this.changes.next(this.doc());
|
|
1565
1603
|
return true;
|
|
1566
1604
|
}
|
|
1567
1605
|
/** Kết thúc phiên gộp history (rời ô nhập). */
|
|
@@ -1583,6 +1621,95 @@ class FormBuilderStore {
|
|
|
1583
1621
|
this.#history.seal();
|
|
1584
1622
|
this.selectedId.set(id);
|
|
1585
1623
|
}
|
|
1624
|
+
/** Editor page selection is transient: preserve schema order, values and undo history. */
|
|
1625
|
+
selectPage(id) {
|
|
1626
|
+
if (this.activePage().id === id || !this.pages().some(page => page.id === id))
|
|
1627
|
+
return;
|
|
1628
|
+
this.#pageSelections.set(this.activePage().id, this.selectedId());
|
|
1629
|
+
this.#history.seal();
|
|
1630
|
+
this.doc.set(documentFromSchema(documentToSchema(this.doc()), id));
|
|
1631
|
+
this.selectedId.set(this.#pageSelections.get(id) ?? null);
|
|
1632
|
+
this.#keepSelectionValid();
|
|
1633
|
+
this.drag.set(null);
|
|
1634
|
+
this.resize.set(null);
|
|
1635
|
+
}
|
|
1636
|
+
addPage() {
|
|
1637
|
+
const schema = documentToSchema(this.doc());
|
|
1638
|
+
const page = { id: createId(), elements: [] };
|
|
1639
|
+
schema.pages.push(page);
|
|
1640
|
+
this.commit(documentFromSchema(schema, this.activePage().id));
|
|
1641
|
+
this.selectPage(page.id);
|
|
1642
|
+
}
|
|
1643
|
+
duplicatePage() {
|
|
1644
|
+
const schema = documentToSchema(this.doc());
|
|
1645
|
+
const index = schema.pages.findIndex(page => page.id === this.activePage().id);
|
|
1646
|
+
const copy = clonePage(this.doc(), schema.pages[index]);
|
|
1647
|
+
if (!copy)
|
|
1648
|
+
return null;
|
|
1649
|
+
schema.pages.splice(index + 1, 0, copy);
|
|
1650
|
+
this.commit(documentFromSchema(schema, this.activePage().id));
|
|
1651
|
+
this.selectPage(copy.id);
|
|
1652
|
+
return copy.id;
|
|
1653
|
+
}
|
|
1654
|
+
removePage(id) {
|
|
1655
|
+
const schema = documentToSchema(this.doc());
|
|
1656
|
+
const index = schema.pages.findIndex(page => page.id === id);
|
|
1657
|
+
if (schema.pages.length <= 1 || index < 0)
|
|
1658
|
+
return false;
|
|
1659
|
+
const active = this.activePage().id === id ? (schema.pages[index + 1] ?? schema.pages[index - 1]).id : this.activePage().id;
|
|
1660
|
+
schema.pages.splice(index, 1);
|
|
1661
|
+
return this.commit(documentFromSchema(schema, active));
|
|
1662
|
+
}
|
|
1663
|
+
movePage(id, delta) {
|
|
1664
|
+
const schema = documentToSchema(this.doc());
|
|
1665
|
+
const index = schema.pages.findIndex(page => page.id === id);
|
|
1666
|
+
const next = index + delta;
|
|
1667
|
+
if (index < 0 || next < 0 || next >= schema.pages.length)
|
|
1668
|
+
return false;
|
|
1669
|
+
[schema.pages[index], schema.pages[next]] = [schema.pages[next], schema.pages[index]];
|
|
1670
|
+
return this.commit(documentFromSchema(schema, this.activePage().id));
|
|
1671
|
+
}
|
|
1672
|
+
setPageMetadata(patch, coalesceKey) {
|
|
1673
|
+
const current = this.doc();
|
|
1674
|
+
const next = { ...current, base: { ...current.base, page: { ...current.base.page, ...patch } } };
|
|
1675
|
+
return sameDocumentContent(current, next) ? false : this.commit(next, { coalesceKey });
|
|
1676
|
+
}
|
|
1677
|
+
setPageRule(key, filter) {
|
|
1678
|
+
const rules = { ...this.activePage().rules };
|
|
1679
|
+
if (filter)
|
|
1680
|
+
rules[key] = filter;
|
|
1681
|
+
else
|
|
1682
|
+
delete rules[key];
|
|
1683
|
+
return this.setPageMetadata({ rules: Object.keys(rules).length ? rules : undefined });
|
|
1684
|
+
}
|
|
1685
|
+
setNavigation(mode) {
|
|
1686
|
+
const current = this.doc();
|
|
1687
|
+
const rest = { ...current.base.rest };
|
|
1688
|
+
if (mode === 'single')
|
|
1689
|
+
delete rest['navigation'];
|
|
1690
|
+
else
|
|
1691
|
+
rest['navigation'] = this.navigation()?.type === mode ? this.navigation() : { type: mode };
|
|
1692
|
+
const next = { ...current, base: { ...current.base, rest } };
|
|
1693
|
+
return sameDocumentContent(current, next) ? false : this.commit(next);
|
|
1694
|
+
}
|
|
1695
|
+
setLinear(linear) {
|
|
1696
|
+
const navigation = this.navigation();
|
|
1697
|
+
if (navigation?.type !== 'steps' || !!navigation.linear === linear)
|
|
1698
|
+
return false;
|
|
1699
|
+
return this.commit({
|
|
1700
|
+
...this.doc(),
|
|
1701
|
+
base: { ...this.doc().base, rest: { ...this.doc().base.rest, navigation: { ...navigation, linear } } },
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
pageDependentsOf(id) {
|
|
1705
|
+
const schema = documentToSchema(this.doc());
|
|
1706
|
+
const page = schema.pages.find(page => page.id === id);
|
|
1707
|
+
if (!page)
|
|
1708
|
+
return [];
|
|
1709
|
+
const members = page.elements.flatMap(item => (isGroup(item) ? [item, ...(item.elements ?? [])] : [item]));
|
|
1710
|
+
const owned = new Set([id, ...members.map(item => item.id)]);
|
|
1711
|
+
return members.flatMap(item => isField(item) && item.key ? sdFindKeyReferences(schema, item.key).filter(reference => !owned.has(reference.elementId ?? '')) : []);
|
|
1712
|
+
}
|
|
1586
1713
|
setMode(mode) {
|
|
1587
1714
|
this.drag.set(null);
|
|
1588
1715
|
this.resize.set(null);
|
|
@@ -1712,7 +1839,7 @@ class FormBuilderStore {
|
|
|
1712
1839
|
return -1;
|
|
1713
1840
|
}
|
|
1714
1841
|
const updated = sdFindKeyReferences(schema, key).filter(reference => reference.kind === 'structured').length;
|
|
1715
|
-
this.commit(documentFromSchema(renamed));
|
|
1842
|
+
this.commit(documentFromSchema(renamed, this.activePage().id));
|
|
1716
1843
|
return updated;
|
|
1717
1844
|
}
|
|
1718
1845
|
/**
|
|
@@ -1725,7 +1852,7 @@ class FormBuilderStore {
|
|
|
1725
1852
|
const key = item && isField(item) ? item.key : undefined;
|
|
1726
1853
|
if (nextKey && key && key !== nextKey) {
|
|
1727
1854
|
try {
|
|
1728
|
-
next = documentFromSchema(sdRenameKey(documentToSchema(next), key, nextKey));
|
|
1855
|
+
next = documentFromSchema(sdRenameKey(documentToSchema(next), key, nextKey), this.activePage().id);
|
|
1729
1856
|
}
|
|
1730
1857
|
catch {
|
|
1731
1858
|
return false;
|
|
@@ -1735,7 +1862,7 @@ class FormBuilderStore {
|
|
|
1735
1862
|
}
|
|
1736
1863
|
/** Lưu dialog Biến: đổi key biến kéo theo tham chiếu (một bước undo); không đổi gì thì không commit. */
|
|
1737
1864
|
saveVariables(edits) {
|
|
1738
|
-
const next = applyVariables(this.doc(), edits);
|
|
1865
|
+
const next = documentFromSchema(documentToSchema(applyVariables(this.doc(), edits)), this.activePage().id);
|
|
1739
1866
|
if (sameDocumentContent(next, this.doc()))
|
|
1740
1867
|
return false;
|
|
1741
1868
|
return this.commit(next);
|
|
@@ -4026,7 +4153,17 @@ class InspectorComponent {
|
|
|
4026
4153
|
typeLabelKey = computed(() => (this.item() ? itemTypeLabelKey(this.item()) : ''));
|
|
4027
4154
|
validation = computed(() => (this.field()?.validation ?? {}));
|
|
4028
4155
|
rules = computed(() => (this.item()?.rules ?? {}));
|
|
4029
|
-
elements =
|
|
4156
|
+
elements = this.store.allElements;
|
|
4157
|
+
navigationMode = computed(() => this.store.navigation()?.type ?? 'single');
|
|
4158
|
+
linear = computed(() => {
|
|
4159
|
+
const navigation = this.store.navigation();
|
|
4160
|
+
return navigation?.type === 'steps' && !!navigation.linear;
|
|
4161
|
+
});
|
|
4162
|
+
navigationChoices = computed(() => ['single', 'tabs', 'steps'].map(value => ({ value, display: this.store.t(`core.component.form-builder.page.${value}`) })));
|
|
4163
|
+
setNavigation(value) {
|
|
4164
|
+
if (value === 'single' || value === 'tabs' || value === 'steps')
|
|
4165
|
+
this.store.setNavigation(value);
|
|
4166
|
+
}
|
|
4030
4167
|
variables = computed(() => this.store.doc().variables);
|
|
4031
4168
|
/** Tab khả dụng theo loại phần tử. */
|
|
4032
4169
|
tabs = computed(() => {
|
|
@@ -4059,7 +4196,7 @@ class InspectorComponent {
|
|
|
4059
4196
|
/** Hyperlink ở chế độ xem: renderer chỉ dùng cho select/radio. */
|
|
4060
4197
|
supportsHyperlink = computed(() => this.type() === 'select' || this.type() === 'radio');
|
|
4061
4198
|
textSubtype = computed(() => (this.type() === 'textfield' ? sdTextSubtype(this.field()) : null));
|
|
4062
|
-
numberSubtype = computed(() =>
|
|
4199
|
+
numberSubtype = computed(() => this.type() === 'number' ? (sdNumberSubtype(this.field()) ?? 'number') : null);
|
|
4063
4200
|
numberPrecision = computed(() => (this.type() === 'number' ? sdNumberPrecision(this.field()) : undefined));
|
|
4064
4201
|
passwordHasDefault = computed(() => this.textSubtype() === 'password' && this.field()?.['defaultValue'] != null);
|
|
4065
4202
|
/** Regex không biên dịch được — renderer sẽ bỏ qua nó, nên báo ngay ở ô nhập. */
|
|
@@ -4675,7 +4812,7 @@ class InspectorComponent {
|
|
|
4675
4812
|
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
4676
4813
|
}
|
|
4677
4814
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InspectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4678
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: InspectorComponent, isStandalone: true, selector: "fb-inspector", outputs: { requestRemove: "requestRemove", openVariables: "openVariables", openValidations: "openValidations", openShortcuts: "openShortcuts" }, ngImport: i0, template: "@let _item = item();\n@let _field = field();\n@let _group = group();\n@let _type = type();\n@let _tab = activeTab();\n@let _validation = validation();\n@let _rules = rules();\n\n<!-- why: m\u1ECDi control c\u1EE7a inspector d\u00F9ng hideInlineError \u2014 panel h\u1EB9p, x\u1EBFp d\u00E0y; l\u1ED7i (n\u1EBFu c\u00F3) hi\u1EC7n\n b\u1EB1ng vi\u1EC1n \u0111\u1ECF + icon k\u00E8m tooltip thay v\u00EC d\u00F2ng ch\u1EEF chi\u1EBFm ch\u1ED7 d\u01B0\u1EDBi t\u1EEBng \u00F4. -->\n@if (!_item) {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Kh\u00F4ng ch\u1ECDn g\u00EC: c\u1EA5u h\u00ECnh c\u1EA5p form \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <div class=\"ins-empty\">\n <div class=\"ins-head\">\n <span class=\"ins-head__icon\" aria-hidden=\"true\"><sd-icon name=\"dynamic_form\" size=\"20px\"></sd-icon></span>\n <div class=\"ins-head__text\">\n <div class=\"ins-head__title\">{{ 'core.component.form-builder.form-settings' | sdTranslate }}</div>\n <div class=\"ins-head__sub\">{{ 'core.component.form-builder.select-field-hint' | sdTranslate }}</div>\n </div>\n </div>\n <div class=\"ins-body\">\n <div class=\"ins-card\">\n <div class=\"ins-card__row\">\n <span>{{ 'core.component.form-builder.variables' | sdTranslate }}</span>\n <span class=\"ins-count\">{{ store.doc().variables.length }}</span>\n </div>\n <p class=\"ins-note\">{{ 'core.component.form-builder.variables-hint' | sdTranslate }}</p>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"data_array\"\n [title]=\"'core.component.form-builder.manage' | sdTranslate\"\n (click)=\"openVariables.emit()\"></sd-button>\n </div>\n <div class=\"ins-card\">\n <div class=\"ins-card__row\">\n <span>{{ 'core.component.form-builder.form-validations' | sdTranslate }}</span>\n <span class=\"ins-count\">{{ store.doc().validations.length }}</span>\n </div>\n <p class=\"ins-note\">{{ 'core.component.form-builder.form-validations-hint' | sdTranslate }}</p>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"rule\"\n [title]=\"'core.component.form-builder.manage' | sdTranslate\"\n (click)=\"openValidations.emit()\"></sd-button>\n </div>\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"keyboard\"\n [title]=\"'core.component.form-builder.shortcuts' | sdTranslate\"\n (click)=\"openShortcuts.emit()\"></sd-button>\n </div>\n </div>\n} @else {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Header \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <div class=\"ins-head\">\n <span class=\"ins-head__icon\" aria-hidden=\"true\"><sd-icon [name]=\"icon()\" size=\"20px\"></sd-icon></span>\n <div class=\"ins-head__text\">\n <div class=\"ins-head__title\">{{ store.labelOf(_item) }}</div>\n <div class=\"ins-head__sub\">\n {{ typeLabelKey() | sdTranslate }}\n @if (_field?.key) {\n \u00B7 <span class=\"ins-mono\">{{ _field?.key }}</span>\n }\n </div>\n </div>\n <span class=\"ins-badge ins-mono\">{{ unsupported() ? _type : presetId() }}</span>\n </div>\n\n @if (unsupported()) {\n <div class=\"ins-body\">\n <p class=\"ins-note\"><sd-icon name=\"help\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.unsupported-note' | sdTranslate }}</p>\n </div>\n } @else {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Tabs \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <!-- why: ph\u00EDm m\u0169i t\u00EAn n\u1ED5i b\u1ECDt t\u1EEB tab \u0111ang focus (roving tabindex, m\u1EABu tablist c\u1EE7a APG). -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"ins-tabs\"\n role=\"tablist\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\"\n (keydown)=\"onTabKeydown($event)\">\n @for (tab of tabs(); track tab) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"ins-tabs__tab\"\n [id]=\"tabId(tab)\"\n [attr.aria-controls]=\"panelId\"\n [attr.data-tab]=\"tab\"\n [class.is-active]=\"_tab === tab\"\n [attr.aria-selected]=\"_tab === tab\"\n [attr.tabindex]=\"_tab === tab ? 0 : -1\"\n (click)=\"selectTab(tab)\">\n {{ 'core.component.form-builder.tab.' + tab | sdTranslate }}\n </button>\n }\n </div>\n\n <div class=\"ins-body\" role=\"tabpanel\" [id]=\"panelId\" [attr.aria-labelledby]=\"tabId(_tab)\">\n @switch (_tab) {\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 CHUNG \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('general') {\n @if (_group) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"_group.label\"\n (modelChange)=\"setLabel($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <div class=\"ins-field\">\n <div class=\"ins-field__label\">{{ 'core.component.form-builder.group-icon' | sdTranslate }}</div>\n <div class=\"ins-icons\" role=\"group\" [attr.aria-label]=\"'core.component.form-builder.group-icon' | sdTranslate\">\n @for (icon of iconPresets; track icon) {\n <button\n type=\"button\"\n class=\"ins-icons__btn\"\n [class.is-active]=\"_group.icon === icon\"\n [attr.aria-pressed]=\"_group.icon === icon\"\n [attr.aria-label]=\"icon\"\n (click)=\"pickIcon(icon)\">\n <sd-icon [name]=\"icon\" size=\"18px\"></sd-icon>\n </button>\n }\n </div>\n </div>\n <div class=\"ins-field\">\n <div class=\"ins-field__label\">{{ 'core.component.form-builder.group-accent-color' | sdTranslate }}</div>\n <div class=\"ins-colors\" role=\"group\" [attr.aria-label]=\"'core.component.form-builder.group-accent-color' | sdTranslate\">\n @for (color of colorPresets; track color) {\n <button\n type=\"button\"\n class=\"ins-colors__swatch\"\n [attr.data-color]=\"color\"\n [class.is-active]=\"(_group.color || 'primary') === color\"\n [attr.aria-pressed]=\"(_group.color || 'primary') === color\"\n [attr.aria-label]=\"color\"\n (click)=\"pickColor(color)\"></button>\n }\n </div>\n </div>\n } @else if (_field) {\n @if (_type === 'html') {\n @if (!_field['definition']) {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"8\"\n [label]=\"'core.component.form-builder.content' | sdTranslate\"\n [model]=\"_field['content']\"\n (modelChange)=\"set('content', $event ?? '', true)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n <p class=\"ins-note\">{{ 'core.component.form-builder.html-info' | sdTranslate }}</p>\n } @else {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"_field['label']\"\n (modelChange)=\"setLabel($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n @if (supportsHelper()) {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"2\"\n [label]=\"'core.component.form-builder.helper-text' | sdTranslate\"\n [model]=\"_field['helperText']\"\n (modelChange)=\"set('helperText', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n @if (supportsPlaceholder()) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.placeholder' | sdTranslate\"\n [model]=\"_field['placeholder']\"\n (modelChange)=\"set('placeholder', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n @if (_type === 'textfield') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.input-kind' | sdTranslate\"\n [items]=\"textKinds()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"textSubtype()\"\n (modelChange)=\"setTextSubtype($event)\"></sd-select>\n } @else if (_type === 'number') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.number-kind' | sdTranslate\"\n [items]=\"numberKinds()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"numberSubtype()\"\n (modelChange)=\"setNumberSubtype($event)\"></sd-select>\n } @else if (_type === 'datetime') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.format' | sdTranslate\"\n [items]=\"datetimeFormats\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['subtype'] || 'date'\"\n (modelChange)=\"set('subtype', $event)\"></sd-select>\n }\n @if (supportsRequired()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.required' | sdTranslate\"\n [model]=\"!!_validation.required\"\n (modelChange)=\"setRequired($event)\"></fb-toggle-row>\n }\n @if (textSubtype() === 'password') {\n <p class=\"ins-note\">\n <sd-icon name=\"lock\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.password-note' | sdTranslate }}\n </p>\n }\n @if (passwordHasDefault()) {\n <div class=\"ins-warning\" role=\"alert\">\n <span>{{ 'core.component.form-builder.password-default-warning' | sdTranslate }}</span>\n <sd-button\n type=\"text\"\n color=\"error\"\n size=\"sm\"\n [title]=\"'core.component.form-builder.remove-default' | sdTranslate\"\n (click)=\"set('defaultValue', undefined)\"></sd-button>\n </div>\n }\n }\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 D\u1EEE LI\u1EC6U \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('data') {\n @if (_field) {\n @if (templateChoices().length) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.template-data' | sdTranslate\"\n [items]=\"templateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"currentTemplate()\"\n (modelChange)=\"applyTemplate($event)\"></sd-select>\n }\n\n @if (supportsDefault()) {\n @switch (_type) {\n @case ('number') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [precision]=\"numberPrecision() ?? 3\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultNumber($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n @case ('checkbox') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"booleanDefaults()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"defaultBooleanValue()\"\n (modelChange)=\"setDefaultBoolean($event)\"></sd-select>\n }\n @case ('select') {\n @if (!catalogId()) {\n <!-- why: a live sd-select cannot switch `multiple` (MatSelect throws when the value and the\n mode disagree for one tick) \u2014 a new select is created when the flag changes. -->\n @for (multiple of [!!_field['multiple']]; track multiple) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [multiple]=\"multiple\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"optionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"set('defaultValue', $event)\"></sd-select>\n }\n }\n }\n @case ('radio') {\n @if (!catalogId()) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"optionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"set('defaultValue', $event)\"></sd-select>\n }\n }\n @case ('textarea') {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"2\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultText($event)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n @default {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultText($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n }\n }\n\n @if (_type === 'select') {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.multiple' | sdTranslate\"\n [model]=\"!!_field['multiple']\"\n (modelChange)=\"setMultiple($event)\"></fb-toggle-row>\n }\n\n @if (_type === 'select' || _type === 'radio') {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.options' | sdTranslate }}</h3>\n @if (sourceChoices().length > 1) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.options.source' | sdTranslate\"\n [items]=\"sourceChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"optionSource()\"\n (modelChange)=\"setOptionSource($event)\"></sd-select>\n }\n @if (!catalogId()) {\n <fb-options-editor\n [options]=\"staticItems()\"\n (optionsChange)=\"setStaticItems($event.options, $event.coalesceKey)\"></fb-options-editor>\n } @else {\n @if (!catalog()) {\n <p class=\"ins-note\">\n <sd-icon name=\"warning\" size=\"14px\"></sd-icon\n >{{ 'core.component.form-builder.catalog.missing' | sdTranslate: { catalog: catalogId() ?? '' } }}\n </p>\n }\n <build-queries\n [label]=\"'core.component.form-builder.catalog.params' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [definitions]=\"catalog()?.params\"\n [model]=\"catalogParams()\"\n (modelChange)=\"setCatalogParams($event)\"></build-queries>\n <build-variables\n [label]=\"'core.component.form-builder.catalog.fill' | sdTranslate\"\n [elements]=\"elements()\"\n [fields]=\"catalog()?.fields\"\n [exclude]=\"_field.key\"\n [model]=\"catalogFill()\"\n (modelChange)=\"setCatalogFill($event)\"></build-variables>\n }\n </section>\n }\n\n @if (_type === 'upload') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.type' | sdTranslate\"\n [items]=\"uploadTypes()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['accept'] || 'file'\"\n (modelChange)=\"set('accept', $event)\"></sd-select>\n @if (_field['accept'] === 'image') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.source-mobile' | sdTranslate\"\n [items]=\"uploadSources()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['source'] || 'ALL'\"\n (modelChange)=\"set('source', $event)\"></sd-select>\n }\n <attribute-parameter\n [label]=\"'core.component.form-builder.assign-parameter' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_field['params']\"\n (modelChange)=\"setUploadParams($event)\"></attribute-parameter>\n }\n\n @if (_type === 'html') {\n @if (htmlDefinitionChoices().length) {\n <!-- why: choices also hold the field's current definition when the portal lacks it, so it can be cleared. -->\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [label]=\"'core.component.form-builder.template-data' | sdTranslate\"\n [items]=\"htmlDefinitionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['definition']\"\n (modelChange)=\"applyHtmlDefinition($event)\"></sd-select>\n }\n @for (variable of htmlVariables(); track variable.key) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"variable.label\"\n [model]=\"variable.value\"\n (modelChange)=\"setHtmlVariable(variable.key, $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n <build-queries-html\n [label]=\"'core.component.form-builder.query-condition' | sdTranslate\"\n [definition]=\"htmlDefinition()\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_field['query']\"\n (modelChange)=\"setHtmlQuery($event)\"></build-queries-html>\n }\n\n @if (supportsHyperlink()) {\n <div class=\"ins-field\">\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.hyperlink' | sdTranslate\"\n [model]=\"_field['hyperlink']\"\n (modelChange)=\"set('hyperlink', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <p class=\"ins-note\">{{ 'core.component.form-builder.hyperlink-hint' | sdTranslate }}</p>\n </div>\n }\n\n <!-- N\u00E2ng cao: m\u00E3 tr\u01B0\u1EDDng (key). \u0110\u1ED5i nh\u00E3n KH\u00D4NG \u0111\u1ED5i key; \u0111\u1ED5i key lu\u00F4n qua x\u00E1c nh\u1EADn. -->\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.advanced' | sdTranslate }}</h3>\n @if (_field.key || _type !== 'html') {\n <div class=\"ins-key\">\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.key.label' | sdTranslate\"\n [inlineError]=\"keyError() || undefined\"\n [model]=\"keyDraft()\"\n (modelChange)=\"keyDraft.set($event ?? '')\"\n (keyupEnter)=\"applyKey()\"></sd-input>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n [disabled]=\"!!keyError() || keyDraft().trim() === _field.key\"\n [title]=\"'core.component.form-builder.key.apply' | sdTranslate\"\n (click)=\"applyKey()\"></sd-button>\n </div>\n }\n @if (!_field.key && _type !== 'html') {\n <div class=\"ins-warning\">\n <span>{{ 'core.component.form-builder.key.missing' | sdTranslate }}</span>\n <sd-button\n type=\"text\"\n color=\"primary\"\n size=\"sm\"\n [title]=\"'core.component.form-builder.key.generate' | sdTranslate\"\n (click)=\"generateKey()\"></sd-button>\n </div>\n }\n @if (keyMessage(); as message) {\n <sd-inform type=\"tip\" success closable [description]=\"message\" (sdClosed)=\"keyMessage.set('')\"></sd-inform>\n }\n </section>\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 QUY T\u1EAEC \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('rules') {\n @if (_field) {\n @switch (textSubtype()) {\n @case ('email') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.email' | sdTranslate }}\n </p>\n }\n @case ('url') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.url' | sdTranslate }}\n </p>\n }\n @case ('phone') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.phone' | sdTranslate }}\n </p>\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.phone-country' | sdTranslate\"\n [items]=\"phoneCountries()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_validation.phoneCountry || NONE\"\n (modelChange)=\"setValidationChoice('phoneCountry', $event)\"></sd-select>\n }\n }\n\n @if (_type === 'number') {\n <div class=\"ins-grid\">\n <!-- why: coalesce + seal on blur \u2014 typing \"1000\" is one undo step, not four. -->\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.min' | sdTranslate\"\n [model]=\"_validation.min\"\n (modelChange)=\"setValidation('min', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.max' | sdTranslate\"\n [model]=\"_validation.max\"\n (modelChange)=\"setValidation('max', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n @if (numberSubtype() === 'decimal' || numberSubtype() === 'currency' || numberSubtype() === 'percent') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [min]=\"0\"\n [max]=\"10\"\n [label]=\"'core.component.form-builder.precision' | sdTranslate\"\n [model]=\"numberPrecision()\"\n (modelChange)=\"set('precision', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n @if (numberSubtype() === 'currency') {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.currency' | sdTranslate\"\n [model]=\"_field['currency'] || 'VND'\"\n (modelChange)=\"set('currency', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n @if (numberSubtype() === 'percent') {\n <p class=\"ins-note\">{{ 'core.component.form-builder.rule.percent' | sdTranslate }}</p>\n }\n @if (numberSubtype() === 'integer') {\n <p class=\"ins-note\">{{ 'core.component.form-builder.rule.integer' | sdTranslate }}</p>\n }\n }\n\n @if (_type === 'datetime') {\n <div class=\"ins-grid\">\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.min' | sdTranslate\"\n required\n class=\"ins-fixed-select\"\n [items]=\"minDateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"dateLimitValue(_validation.min)\"\n (modelChange)=\"setValidationChoice('min', $event)\"></sd-select>\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.max' | sdTranslate\"\n required\n class=\"ins-fixed-select\"\n [items]=\"maxDateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"dateLimitValue(_validation.max)\"\n (modelChange)=\"setValidationChoice('max', $event)\"></sd-select>\n </div>\n }\n\n @if (supportsLength()) {\n <div class=\"ins-grid\">\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.minlength' | sdTranslate\"\n [model]=\"_validation.minLength\"\n (modelChange)=\"setValidation('minLength', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.maxlength' | sdTranslate\"\n [model]=\"_validation.maxLength\"\n (modelChange)=\"setValidation('maxLength', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n }\n\n @if (_type === 'chip-string' || _type === 'chip-calendar') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.max-items' | sdTranslate\"\n [model]=\"_validation.maxItems\"\n (modelChange)=\"setValidation('maxItems', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n\n @if (_type === 'upload') {\n <div class=\"ins-grid\">\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.max-files' | sdTranslate\"\n [model]=\"_field['maxFiles']\"\n (modelChange)=\"set('maxFiles', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [label]=\"'core.component.form-builder.size-mb' | sdTranslate\"\n [model]=\"_field['maxSizeMb']\"\n (modelChange)=\"set('maxSizeMb', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n @if (_field['accept'] !== 'image') {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.format-example' | sdTranslate\"\n [model]=\"extensionsText()\"\n (modelChange)=\"setExtensions($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n }\n\n @if (_type === 'textfield' && textSubtype() !== 'password') {\n <details class=\"ins-details\" [open]=\"!!_validation.pattern\">\n <summary>{{ 'core.component.form-builder.rule.advanced-pattern' | sdTranslate }}</summary>\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.pattern' | sdTranslate\"\n [inlineError]=\"patternError()\"\n [model]=\"_validation.pattern?.value\"\n (modelChange)=\"setPattern('value', $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.pattern-message' | sdTranslate\"\n [model]=\"_validation.pattern?.message\"\n (modelChange)=\"setPattern('message', $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n </details>\n }\n\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.state' | sdTranslate }}</h3>\n @if (supportsDisabled()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.disabled' | sdTranslate\"\n [model]=\"!!_field['disabled']\"\n (modelChange)=\"setFlag('disabled', $event)\"></fb-toggle-row>\n }\n @if (supportsViewed()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.read-only-mode' | sdTranslate\"\n [hint]=\"'core.component.form-builder.read-only-mode.hint' | sdTranslate\"\n [model]=\"!!_field['viewed']\"\n (modelChange)=\"setFlag('viewed', $event)\"></fb-toggle-row>\n }\n <fb-toggle-row\n [label]=\"'core.component.form-builder.hide' | sdTranslate\"\n [model]=\"!!_field['hidden']\"\n (modelChange)=\"setFlag('hidden', $event)\"></fb-toggle-row>\n @if (_field['hidden']) {\n <p class=\"ins-note\">{{ 'core.component.form-builder.hidden-note' | sdTranslate }}</p>\n }\n </section>\n\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.conditions' | sdTranslate }}</h3>\n <attribute-expression\n [label]=\"'core.component.form-builder.visible-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.visible\"\n (sdChange)=\"setRule('visible', $event)\"></attribute-expression>\n <attribute-expression\n [label]=\"'core.component.form-builder.hidden-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.hidden\"\n (sdChange)=\"setRule('hidden', $event)\"></attribute-expression>\n @if (supportsDisabled() && !_field['disabled']) {\n <attribute-expression\n [label]=\"'core.component.form-builder.disabled-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.disabled\"\n (sdChange)=\"setRule('disabled', $event)\"></attribute-expression>\n }\n @if (supportsRequired() && !_validation.required) {\n <attribute-expression\n [label]=\"'core.component.form-builder.required-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.required\"\n (sdChange)=\"setRule('required', $event)\"></attribute-expression>\n }\n </section>\n } @else if (_group) {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.state' | sdTranslate }}</h3>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.hide' | sdTranslate\"\n [model]=\"!!_group.hidden\"\n (modelChange)=\"setFlag('hidden', $event)\"></fb-toggle-row>\n <p class=\"ins-note\">{{ 'core.component.form-builder.group-rules-note' | sdTranslate }}</p>\n </section>\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.conditions' | sdTranslate }}</h3>\n <attribute-expression\n [label]=\"'core.component.form-builder.visible-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.visible\"\n (sdChange)=\"setRule('visible', $event)\"></attribute-expression>\n <attribute-expression\n [label]=\"'core.component.form-builder.hidden-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.hidden\"\n (sdChange)=\"setRule('hidden', $event)\"></attribute-expression>\n </section>\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 B\u1ED0 C\u1EE4C \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('layout') {\n @let _location = location();\n @let _siblings = store.childrenOf(_location?.parentId ?? null).length;\n @if (_field) {\n @let _viewport = viewport();\n @let _viewportLabel = 'core.component.form-builder.viewport.' + _viewport | sdTranslate;\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.layout.size' | sdTranslate }}</h3>\n <!-- why: span s\u1EEDa theo M\u1EE8C \u0110ANG XEM (thanh c\u00F4ng c\u1EE5 Desktop | Tablet | Mobile). M\u1EE9c ch\u01B0a t\u1EF1\n khai b\u00E1o hi\u1EC7n nh\u00E3n k\u1EBF th\u1EEBa; \"V\u1EC1 k\u1EBF th\u1EEBa\" xo\u00E1 span c\u1EE7a ri\u00EAng m\u1EE9c \u0111\u00F3. -->\n <div class=\"ins-key\">\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.span.at' | sdTranslate: { viewport: _viewportLabel }\"\n [items]=\"columnChoices\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"span()\"\n (modelChange)=\"setSpan($event)\"></sd-select>\n <sd-button\n type=\"outline\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"restart_alt\"\n [disabled]=\"spanSource() !== 'own'\"\n [title]=\"'core.component.form-builder.span.clear' | sdTranslate\"\n (click)=\"clearSpan()\"></sd-button>\n </div>\n <p class=\"ins-note ins-note--span\">\n @if (inheritedLabel(); as _inherited) {\n <span class=\"ins-badge\">{{ _inherited }}</span>\n }\n <span>{{ spanSummary() }}</span>\n </p>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.new-row' | sdTranslate\"\n [hint]=\"'core.component.form-builder.new-row.hint' | sdTranslate\"\n [model]=\"newRow()\"\n (modelChange)=\"setNewRow($event)\"></fb-toggle-row>\n @if (_type === 'radio') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.direction' | sdTranslate\"\n [items]=\"directions()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['direction'] || 'row'\"\n (modelChange)=\"set('direction', $event)\"></sd-select>\n }\n </section>\n } @else if (_group) {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.layout.display' | sdTranslate }}</h3>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.collapsible' | sdTranslate\"\n [model]=\"!!_group.collapsible\"\n (modelChange)=\"setCollapsible($event)\"></fb-toggle-row>\n <p class=\"ins-note\">{{ 'core.component.form-builder.group-full-width' | sdTranslate }}</p>\n </section>\n }\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.position' | sdTranslate }}</h3>\n <div class=\"ins-row\">\n <span class=\"ins-row__label\" [id]=\"orderLabelId\">{{ 'core.component.form-builder.order' | sdTranslate }}</span>\n <div class=\"ins-stepper\" role=\"group\" [attr.aria-labelledby]=\"orderLabelId\">\n <button\n type=\"button\"\n class=\"ins-stepper__btn\"\n [disabled]=\"(_location?.index ?? 0) === 0\"\n [attr.aria-label]=\"'core.component.form-builder.move-up' | sdTranslate\"\n [matTooltip]=\"'core.component.form-builder.move-up' | sdTranslate\"\n (click)=\"store.moveBy(_item.id, -1)\">\n <sd-icon name=\"arrow_upward\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n class=\"ins-stepper__btn\"\n [disabled]=\"(_location?.index ?? 0) >= _siblings - 1\"\n [attr.aria-label]=\"'core.component.form-builder.move-down' | sdTranslate\"\n [matTooltip]=\"'core.component.form-builder.move-down' | sdTranslate\"\n (click)=\"store.moveBy(_item.id, 1)\">\n <sd-icon name=\"arrow_downward\" size=\"18px\"></sd-icon>\n </button>\n </div>\n </div>\n @if (_field) {\n @if (containerChoices().length > 1) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.container' | sdTranslate\"\n [items]=\"containerChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_location?.parentId || NONE\"\n (modelChange)=\"moveToContainer($event)\"></sd-select>\n }\n } @else if (_group) {\n <sd-button\n type=\"outline\"\n color=\"secondary\"\n size=\"sm\"\n block\n prefixIcon=\"call_split\"\n [disabled]=\"!_group.elements?.length\"\n [title]=\"'core.component.form-builder.ungroup' | sdTranslate\"\n (click)=\"store.ungroup(_group.id)\"></sd-button>\n }\n </section>\n }\n }\n </div>\n }\n\n <div class=\"ins-foot\">\n <sd-button\n type=\"light\"\n color=\"error\"\n size=\"sm\"\n block\n prefixIcon=\"delete\"\n [title]=\"'core.component.form-builder.delete' | sdTranslate\"\n (click)=\"remove()\"></sd-button>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column;min-height:0;height:100%}.ins-empty{display:flex;flex-direction:column;min-height:0;flex:1}.ins-head{display:flex;align-items:center;gap:10px;flex:0 0 auto;padding:14px 16px 10px}.ins-head__icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:32px;height:32px;border-radius:var(--sd-radius-8, 8px);background:color-mix(in srgb,var(--sd-primary) 10%,var(--sd-surface));color:var(--sd-primary)}.ins-head__text{flex:1;min-width:0}.ins-head__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text);font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.ins-head__sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px)}.ins-empty .ins-head__sub{white-space:normal}.ins-mono{font-family:Roboto Mono,ui-monospace,monospace}.ins-badge{flex:0 0 auto;padding:2px 8px;border-radius:var(--sd-radius-999, 999px);background:color-mix(in srgb,var(--sd-primary) 8%,var(--sd-surface));color:var(--sd-primary);font-size:var(--sd-font-size-11, 11px)}.ins-tabs{display:flex;flex:0 0 auto;gap:2px;padding:0 12px;border-bottom:1px solid var(--sd-border);overflow-x:auto}.ins-tabs__tab{position:relative;flex:0 0 auto;padding:10px 10px 9px;border:0;background:transparent;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer}.ins-tabs__tab.is-active{color:var(--sd-primary)}.ins-tabs__tab.is-active:after{content:\"\";position:absolute;left:6px;right:6px;bottom:-1px;height:2px;border-radius:2px;background:var(--sd-primary)}.ins-tabs__tab:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:-2px}.ins-body{display:flex;flex-direction:column;gap:12px;flex:1;min-height:0;overflow-x:hidden;overflow-y:auto;padding:14px 16px 16px}.ins-body>*{min-width:0}.ins-body ::ng-deep .mat-mdc-form-field{width:100%;min-width:0}.ins-body ::ng-deep .mat-mdc-form-field-infix{width:auto;min-width:0}.ins-foot{flex:0 0 auto;padding:6px 8px;border-top:1px solid var(--sd-border)}.ins-section{display:flex;flex-direction:column;gap:12px;margin-top:6px}.ins-section>*{min-width:0}.ins-section__title{display:flex;align-items:center;gap:8px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-semibold, 600);letter-spacing:.06em;line-height:var(--sd-line-height-16, 16px);text-transform:uppercase}.ins-section__title:after{content:\"\";flex:1 1 auto;height:1px;background:var(--sd-border)}.ins-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.ins-field{display:flex;flex-direction:column;gap:6px}.ins-field__label{color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.ins-note{display:flex;gap:6px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.ins-note sd-icon{flex:0 0 auto;color:var(--sd-success)}.ins-note--success{color:var(--sd-success)}.ins-warning{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-radius:var(--sd-radius-6, 6px);background:var(--sd-status-warning-bg, var(--sd-warning-light));color:var(--sd-status-warning-fg, var(--sd-warning-dark));font-size:var(--sd-font-size-12, 12px)}.ins-key{display:flex;align-items:flex-end;gap:8px}.ins-key sd-input,.ins-key sd-select{flex:1;min-width:0}.ins-note--span{align-items:center;flex-wrap:wrap}.ins-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:32px}.ins-row__label{color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.ins-stepper{display:inline-flex;border:1px solid var(--sd-border);border-radius:var(--sd-radius-6, 6px);overflow:hidden}.ins-stepper__btn{display:inline-flex;align-items:center;justify-content:center;width:36px;height:30px;padding:0;border:0;background:var(--sd-surface);color:var(--sd-text);cursor:pointer}.ins-stepper__btn+.ins-stepper__btn{border-left:1px solid var(--sd-border)}.ins-stepper__btn:hover:not(:disabled){background:var(--sd-surface-muted)}.ins-stepper__btn:disabled{opacity:.4;cursor:default}.ins-stepper__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:-2px}.ins-card{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:12px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px)}.ins-card__row{display:flex;align-items:center;justify-content:space-between;width:100%;color:var(--sd-text);font-weight:var(--sd-font-weight-medium, 500)}.ins-count{min-width:24px;padding:0 6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-surface-muted);color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);text-align:center}.ins-details{display:flex;flex-direction:column;gap:10px}.ins-details>summary{color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer}.ins-details>summary:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}.ins-details[open]>summary{margin-bottom:10px}.ins-details>sd-input+sd-input{margin-top:10px}.ins-icons{display:flex;flex-wrap:wrap;gap:6px}.ins-icons__btn{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-6, 6px);background:var(--sd-surface);color:var(--sd-text-secondary);cursor:pointer}.ins-icons__btn.is-active{border-color:var(--sd-primary);background:color-mix(in srgb,var(--sd-primary) 8%,var(--sd-surface));color:var(--sd-primary)}.ins-icons__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}.ins-colors{display:flex;gap:8px}.ins-colors__swatch{width:26px;height:26px;border:2px solid var(--sd-surface);border-radius:50%;box-shadow:0 0 0 1px var(--sd-border);cursor:pointer}.ins-colors__swatch[data-color=primary]{background:var(--sd-primary)}.ins-colors__swatch[data-color=secondary]{background:var(--sd-secondary)}.ins-colors__swatch[data-color=info]{background:var(--sd-info)}.ins-colors__swatch[data-color=success]{background:var(--sd-success)}.ins-colors__swatch[data-color=warning]{background:var(--sd-warning)}.ins-colors__swatch[data-color=error]{background:var(--sd-error)}.ins-colors__swatch.is-active{box-shadow:0 0 0 2px var(--sd-text)}.ins-colors__swatch:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:var(--sd-focus-ring-offset, 2px)}.ins-fixed-select ::ng-deep .sd-label__required{display:none}\n"], dependencies: [{ kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdInform, selector: "sd-inform", inputs: ["type", "color", "primary", "secondary", "info", "success", "warning", "error", "title", "description", "icon", "hideIcon", "iconShape", "fontSet", "closable", "actionLabel", "lineClamp", "autoId"], outputs: ["sdClosed", "sdAction"] }, { kind: "component", type: SdInput$1, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "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", "labelPlacement", "inputmode", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect$1, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdTextarea, selector: "sd-textarea", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "rows", "hideInlineError", "required", "disabled", "viewed", "autoHeight", "maxlength", "minlength", "pattern", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }, { kind: "component", type: AttributeExpression, selector: "attribute-expression", inputs: ["elements", "variables", "readonly", "label", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: AttributeParameter, selector: "attribute-parameter", inputs: ["label", "elements", "variables", "model", "readonly"], outputs: ["modelChange"] }, { kind: "component", type: BuildQueries, selector: "build-queries", inputs: ["label", "title", "elements", "variables", "definitions", "model", "readonly"], outputs: ["modelChange"] }, { kind: "component", type: BuildVariables, selector: "build-variables", inputs: ["label", "elements", "fields", "exclude", "model", "readonly"], outputs: ["modelChange"] }, { kind: "component", type: HtmlBuildQueries, selector: "build-queries-html", inputs: ["label", "elements", "variables", "definition", "model", "readonly"], outputs: ["modelChange"] }, { kind: "component", type: OptionsEditorComponent, selector: "fb-options-editor", inputs: ["options"], outputs: ["optionsChange"] }, { kind: "component", type: ToggleRowComponent, selector: "fb-toggle-row", inputs: ["label", "hint", "model", "disabled"], outputs: ["modelChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4815
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: InspectorComponent, isStandalone: true, selector: "fb-inspector", outputs: { requestRemove: "requestRemove", openVariables: "openVariables", openValidations: "openValidations", openShortcuts: "openShortcuts" }, ngImport: i0, template: "@let _item = item();\n@let _field = field();\n@let _group = group();\n@let _type = type();\n@let _tab = activeTab();\n@let _validation = validation();\n@let _rules = rules();\n\n<!-- why: m\u1ECDi control c\u1EE7a inspector d\u00F9ng hideInlineError \u2014 panel h\u1EB9p, x\u1EBFp d\u00E0y; l\u1ED7i (n\u1EBFu c\u00F3) hi\u1EC7n\n b\u1EB1ng vi\u1EC1n \u0111\u1ECF + icon k\u00E8m tooltip thay v\u00EC d\u00F2ng ch\u1EEF chi\u1EBFm ch\u1ED7 d\u01B0\u1EDBi t\u1EEBng \u00F4. -->\n@if (!_item) {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Kh\u00F4ng ch\u1ECDn g\u00EC: c\u1EA5u h\u00ECnh c\u1EA5p form \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <div class=\"ins-empty\">\n <div class=\"ins-head\">\n <span class=\"ins-head__icon\" aria-hidden=\"true\"><sd-icon name=\"dynamic_form\" size=\"20px\"></sd-icon></span>\n <div class=\"ins-head__text\">\n <div class=\"ins-head__title\">{{ 'core.component.form-builder.form-settings' | sdTranslate }}</div>\n <div class=\"ins-head__sub\">{{ 'core.component.form-builder.select-field-hint' | sdTranslate }}</div>\n </div>\n </div>\n <div class=\"ins-body\">\n <section class=\"ins-card\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.page.settings' | sdTranslate }}</h3>\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n [label]=\"'core.component.form-builder.page.navigation' | sdTranslate\"\n [items]=\"navigationChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"navigationMode()\"\n (modelChange)=\"setNavigation($event)\"></sd-select>\n @if (navigationMode() === 'steps') {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.page.linear' | sdTranslate\"\n [model]=\"linear()\"\n (modelChange)=\"store.setLinear($event)\"></fb-toggle-row>\n }\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"store.activePage().label\"\n (modelChange)=\"store.setPageMetadata({ label: $event || undefined }, 'page-label:' + store.activePage().id)\"\n (sdBlur)=\"store.sealHistory()\"></sd-input>\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.page.icon' | sdTranslate\"\n [model]=\"store.activePage().icon\"\n (modelChange)=\"store.setPageMetadata({ icon: $event || undefined }, 'page-icon:' + store.activePage().id)\"\n (sdBlur)=\"store.sealHistory()\"></sd-input>\n <attribute-expression\n [label]=\"'core.component.form-builder.visible-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"store.activePage().rules?.visible\"\n (sdChange)=\"store.setPageRule('visible', $event)\"></attribute-expression>\n <attribute-expression\n [label]=\"'core.component.form-builder.hidden-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"store.activePage().rules?.hidden\"\n (sdChange)=\"store.setPageRule('hidden', $event)\"></attribute-expression>\n </section>\n <div class=\"ins-card\">\n <div class=\"ins-card__row\">\n <span>{{ 'core.component.form-builder.variables' | sdTranslate }}</span>\n <span class=\"ins-count\">{{ store.doc().variables.length }}</span>\n </div>\n <p class=\"ins-note\">{{ 'core.component.form-builder.variables-hint' | sdTranslate }}</p>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"data_array\"\n [title]=\"'core.component.form-builder.manage' | sdTranslate\"\n (click)=\"openVariables.emit()\"></sd-button>\n </div>\n <div class=\"ins-card\">\n <div class=\"ins-card__row\">\n <span>{{ 'core.component.form-builder.form-validations' | sdTranslate }}</span>\n <span class=\"ins-count\">{{ store.doc().validations.length }}</span>\n </div>\n <p class=\"ins-note\">{{ 'core.component.form-builder.form-validations-hint' | sdTranslate }}</p>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"rule\"\n [title]=\"'core.component.form-builder.manage' | sdTranslate\"\n (click)=\"openValidations.emit()\"></sd-button>\n </div>\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"keyboard\"\n [title]=\"'core.component.form-builder.shortcuts' | sdTranslate\"\n (click)=\"openShortcuts.emit()\"></sd-button>\n </div>\n </div>\n} @else {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Header \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <div class=\"ins-head\">\n <span class=\"ins-head__icon\" aria-hidden=\"true\"><sd-icon [name]=\"icon()\" size=\"20px\"></sd-icon></span>\n <div class=\"ins-head__text\">\n <div class=\"ins-head__title\">{{ store.labelOf(_item) }}</div>\n <div class=\"ins-head__sub\">\n {{ typeLabelKey() | sdTranslate }}\n @if (_field?.key) {\n \u00B7 <span class=\"ins-mono\">{{ _field?.key }}</span>\n }\n </div>\n </div>\n <span class=\"ins-badge ins-mono\">{{ unsupported() ? _type : presetId() }}</span>\n </div>\n\n @if (unsupported()) {\n <div class=\"ins-body\">\n <p class=\"ins-note\"><sd-icon name=\"help\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.unsupported-note' | sdTranslate }}</p>\n </div>\n } @else {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Tabs \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <!-- why: ph\u00EDm m\u0169i t\u00EAn n\u1ED5i b\u1ECDt t\u1EEB tab \u0111ang focus (roving tabindex, m\u1EABu tablist c\u1EE7a APG). -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"ins-tabs\"\n role=\"tablist\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\"\n (keydown)=\"onTabKeydown($event)\">\n @for (tab of tabs(); track tab) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"ins-tabs__tab\"\n [id]=\"tabId(tab)\"\n [attr.aria-controls]=\"panelId\"\n [attr.data-tab]=\"tab\"\n [class.is-active]=\"_tab === tab\"\n [attr.aria-selected]=\"_tab === tab\"\n [attr.tabindex]=\"_tab === tab ? 0 : -1\"\n (click)=\"selectTab(tab)\">\n {{ 'core.component.form-builder.tab.' + tab | sdTranslate }}\n </button>\n }\n </div>\n\n <div class=\"ins-body\" role=\"tabpanel\" [id]=\"panelId\" [attr.aria-labelledby]=\"tabId(_tab)\">\n @switch (_tab) {\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 CHUNG \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('general') {\n @if (_group) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"_group.label\"\n (modelChange)=\"setLabel($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <div class=\"ins-field\">\n <div class=\"ins-field__label\">{{ 'core.component.form-builder.group-icon' | sdTranslate }}</div>\n <div class=\"ins-icons\" role=\"group\" [attr.aria-label]=\"'core.component.form-builder.group-icon' | sdTranslate\">\n @for (icon of iconPresets; track icon) {\n <button\n type=\"button\"\n class=\"ins-icons__btn\"\n [class.is-active]=\"_group.icon === icon\"\n [attr.aria-pressed]=\"_group.icon === icon\"\n [attr.aria-label]=\"icon\"\n (click)=\"pickIcon(icon)\">\n <sd-icon [name]=\"icon\" size=\"18px\"></sd-icon>\n </button>\n }\n </div>\n </div>\n <div class=\"ins-field\">\n <div class=\"ins-field__label\">{{ 'core.component.form-builder.group-accent-color' | sdTranslate }}</div>\n <div class=\"ins-colors\" role=\"group\" [attr.aria-label]=\"'core.component.form-builder.group-accent-color' | sdTranslate\">\n @for (color of colorPresets; track color) {\n <button\n type=\"button\"\n class=\"ins-colors__swatch\"\n [attr.data-color]=\"color\"\n [class.is-active]=\"(_group.color || 'primary') === color\"\n [attr.aria-pressed]=\"(_group.color || 'primary') === color\"\n [attr.aria-label]=\"color\"\n (click)=\"pickColor(color)\"></button>\n }\n </div>\n </div>\n } @else if (_field) {\n @if (_type === 'html') {\n @if (!_field['definition']) {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"8\"\n [label]=\"'core.component.form-builder.content' | sdTranslate\"\n [model]=\"_field['content']\"\n (modelChange)=\"set('content', $event ?? '', true)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n <p class=\"ins-note\">{{ 'core.component.form-builder.html-info' | sdTranslate }}</p>\n } @else {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"_field['label']\"\n (modelChange)=\"setLabel($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n @if (supportsHelper()) {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"2\"\n [label]=\"'core.component.form-builder.helper-text' | sdTranslate\"\n [model]=\"_field['helperText']\"\n (modelChange)=\"set('helperText', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n @if (supportsPlaceholder()) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.placeholder' | sdTranslate\"\n [model]=\"_field['placeholder']\"\n (modelChange)=\"set('placeholder', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n @if (_type === 'textfield') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.input-kind' | sdTranslate\"\n [items]=\"textKinds()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"textSubtype()\"\n (modelChange)=\"setTextSubtype($event)\"></sd-select>\n } @else if (_type === 'number') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.number-kind' | sdTranslate\"\n [items]=\"numberKinds()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"numberSubtype()\"\n (modelChange)=\"setNumberSubtype($event)\"></sd-select>\n } @else if (_type === 'datetime') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.format' | sdTranslate\"\n [items]=\"datetimeFormats\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['subtype'] || 'date'\"\n (modelChange)=\"set('subtype', $event)\"></sd-select>\n }\n @if (supportsRequired()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.required' | sdTranslate\"\n [model]=\"!!_validation.required\"\n (modelChange)=\"setRequired($event)\"></fb-toggle-row>\n }\n @if (textSubtype() === 'password') {\n <p class=\"ins-note\">\n <sd-icon name=\"lock\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.password-note' | sdTranslate }}\n </p>\n }\n @if (passwordHasDefault()) {\n <div class=\"ins-warning\" role=\"alert\">\n <span>{{ 'core.component.form-builder.password-default-warning' | sdTranslate }}</span>\n <sd-button\n type=\"text\"\n color=\"error\"\n size=\"sm\"\n [title]=\"'core.component.form-builder.remove-default' | sdTranslate\"\n (click)=\"set('defaultValue', undefined)\"></sd-button>\n </div>\n }\n }\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 D\u1EEE LI\u1EC6U \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('data') {\n @if (_field) {\n @if (templateChoices().length) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.template-data' | sdTranslate\"\n [items]=\"templateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"currentTemplate()\"\n (modelChange)=\"applyTemplate($event)\"></sd-select>\n }\n\n @if (supportsDefault()) {\n @switch (_type) {\n @case ('number') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [precision]=\"numberPrecision() ?? 3\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultNumber($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n @case ('checkbox') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"booleanDefaults()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"defaultBooleanValue()\"\n (modelChange)=\"setDefaultBoolean($event)\"></sd-select>\n }\n @case ('select') {\n @if (!catalogId()) {\n <!-- why: a live sd-select cannot switch `multiple` (MatSelect throws when the value and the\n mode disagree for one tick) \u2014 a new select is created when the flag changes. -->\n @for (multiple of [!!_field['multiple']]; track multiple) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [multiple]=\"multiple\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"optionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"set('defaultValue', $event)\"></sd-select>\n }\n }\n }\n @case ('radio') {\n @if (!catalogId()) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"optionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"set('defaultValue', $event)\"></sd-select>\n }\n }\n @case ('textarea') {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"2\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultText($event)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n @default {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultText($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n }\n }\n\n @if (_type === 'select') {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.multiple' | sdTranslate\"\n [model]=\"!!_field['multiple']\"\n (modelChange)=\"setMultiple($event)\"></fb-toggle-row>\n }\n\n @if (_type === 'select' || _type === 'radio') {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.options' | sdTranslate }}</h3>\n @if (sourceChoices().length > 1) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.options.source' | sdTranslate\"\n [items]=\"sourceChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"optionSource()\"\n (modelChange)=\"setOptionSource($event)\"></sd-select>\n }\n @if (!catalogId()) {\n <fb-options-editor\n [options]=\"staticItems()\"\n (optionsChange)=\"setStaticItems($event.options, $event.coalesceKey)\"></fb-options-editor>\n } @else {\n @if (!catalog()) {\n <p class=\"ins-note\">\n <sd-icon name=\"warning\" size=\"14px\"></sd-icon\n >{{ 'core.component.form-builder.catalog.missing' | sdTranslate: { catalog: catalogId() ?? '' } }}\n </p>\n }\n <build-queries\n [label]=\"'core.component.form-builder.catalog.params' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [definitions]=\"catalog()?.params\"\n [model]=\"catalogParams()\"\n (modelChange)=\"setCatalogParams($event)\"></build-queries>\n <build-variables\n [label]=\"'core.component.form-builder.catalog.fill' | sdTranslate\"\n [elements]=\"elements()\"\n [fields]=\"catalog()?.fields\"\n [exclude]=\"_field.key\"\n [model]=\"catalogFill()\"\n (modelChange)=\"setCatalogFill($event)\"></build-variables>\n }\n </section>\n }\n\n @if (_type === 'upload') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.type' | sdTranslate\"\n [items]=\"uploadTypes()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['accept'] || 'file'\"\n (modelChange)=\"set('accept', $event)\"></sd-select>\n @if (_field['accept'] === 'image') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.source-mobile' | sdTranslate\"\n [items]=\"uploadSources()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['source'] || 'ALL'\"\n (modelChange)=\"set('source', $event)\"></sd-select>\n }\n <attribute-parameter\n [label]=\"'core.component.form-builder.assign-parameter' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_field['params']\"\n (modelChange)=\"setUploadParams($event)\"></attribute-parameter>\n }\n\n @if (_type === 'html') {\n @if (htmlDefinitionChoices().length) {\n <!-- why: choices also hold the field's current definition when the portal lacks it, so it can be cleared. -->\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [label]=\"'core.component.form-builder.template-data' | sdTranslate\"\n [items]=\"htmlDefinitionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['definition']\"\n (modelChange)=\"applyHtmlDefinition($event)\"></sd-select>\n }\n @for (variable of htmlVariables(); track variable.key) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"variable.label\"\n [model]=\"variable.value\"\n (modelChange)=\"setHtmlVariable(variable.key, $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n <build-queries-html\n [label]=\"'core.component.form-builder.query-condition' | sdTranslate\"\n [definition]=\"htmlDefinition()\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_field['query']\"\n (modelChange)=\"setHtmlQuery($event)\"></build-queries-html>\n }\n\n @if (supportsHyperlink()) {\n <div class=\"ins-field\">\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.hyperlink' | sdTranslate\"\n [model]=\"_field['hyperlink']\"\n (modelChange)=\"set('hyperlink', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <p class=\"ins-note\">{{ 'core.component.form-builder.hyperlink-hint' | sdTranslate }}</p>\n </div>\n }\n\n <!-- N\u00E2ng cao: m\u00E3 tr\u01B0\u1EDDng (key). \u0110\u1ED5i nh\u00E3n KH\u00D4NG \u0111\u1ED5i key; \u0111\u1ED5i key lu\u00F4n qua x\u00E1c nh\u1EADn. -->\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.advanced' | sdTranslate }}</h3>\n @if (_field.key || _type !== 'html') {\n <div class=\"ins-key\">\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.key.label' | sdTranslate\"\n [inlineError]=\"keyError() || undefined\"\n [model]=\"keyDraft()\"\n (modelChange)=\"keyDraft.set($event ?? '')\"\n (keyupEnter)=\"applyKey()\"></sd-input>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n [disabled]=\"!!keyError() || keyDraft().trim() === _field.key\"\n [title]=\"'core.component.form-builder.key.apply' | sdTranslate\"\n (click)=\"applyKey()\"></sd-button>\n </div>\n }\n @if (!_field.key && _type !== 'html') {\n <div class=\"ins-warning\">\n <span>{{ 'core.component.form-builder.key.missing' | sdTranslate }}</span>\n <sd-button\n type=\"text\"\n color=\"primary\"\n size=\"sm\"\n [title]=\"'core.component.form-builder.key.generate' | sdTranslate\"\n (click)=\"generateKey()\"></sd-button>\n </div>\n }\n @if (keyMessage(); as message) {\n <sd-inform type=\"tip\" success closable [description]=\"message\" (sdClosed)=\"keyMessage.set('')\"></sd-inform>\n }\n </section>\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 QUY T\u1EAEC \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('rules') {\n @if (_field) {\n @switch (textSubtype()) {\n @case ('email') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.email' | sdTranslate }}\n </p>\n }\n @case ('url') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.url' | sdTranslate }}\n </p>\n }\n @case ('phone') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.phone' | sdTranslate }}\n </p>\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.phone-country' | sdTranslate\"\n [items]=\"phoneCountries()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_validation.phoneCountry || NONE\"\n (modelChange)=\"setValidationChoice('phoneCountry', $event)\"></sd-select>\n }\n }\n\n @if (_type === 'number') {\n <div class=\"ins-grid\">\n <!-- why: coalesce + seal on blur \u2014 typing \"1000\" is one undo step, not four. -->\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.min' | sdTranslate\"\n [model]=\"_validation.min\"\n (modelChange)=\"setValidation('min', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.max' | sdTranslate\"\n [model]=\"_validation.max\"\n (modelChange)=\"setValidation('max', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n @if (numberSubtype() === 'decimal' || numberSubtype() === 'currency' || numberSubtype() === 'percent') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [min]=\"0\"\n [max]=\"10\"\n [label]=\"'core.component.form-builder.precision' | sdTranslate\"\n [model]=\"numberPrecision()\"\n (modelChange)=\"set('precision', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n @if (numberSubtype() === 'currency') {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.currency' | sdTranslate\"\n [model]=\"_field['currency'] || 'VND'\"\n (modelChange)=\"set('currency', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n @if (numberSubtype() === 'percent') {\n <p class=\"ins-note\">{{ 'core.component.form-builder.rule.percent' | sdTranslate }}</p>\n }\n @if (numberSubtype() === 'integer') {\n <p class=\"ins-note\">{{ 'core.component.form-builder.rule.integer' | sdTranslate }}</p>\n }\n }\n\n @if (_type === 'datetime') {\n <div class=\"ins-grid\">\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.min' | sdTranslate\"\n required\n class=\"ins-fixed-select\"\n [items]=\"minDateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"dateLimitValue(_validation.min)\"\n (modelChange)=\"setValidationChoice('min', $event)\"></sd-select>\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.max' | sdTranslate\"\n required\n class=\"ins-fixed-select\"\n [items]=\"maxDateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"dateLimitValue(_validation.max)\"\n (modelChange)=\"setValidationChoice('max', $event)\"></sd-select>\n </div>\n }\n\n @if (supportsLength()) {\n <div class=\"ins-grid\">\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.minlength' | sdTranslate\"\n [model]=\"_validation.minLength\"\n (modelChange)=\"setValidation('minLength', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.maxlength' | sdTranslate\"\n [model]=\"_validation.maxLength\"\n (modelChange)=\"setValidation('maxLength', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n }\n\n @if (_type === 'chip-string' || _type === 'chip-calendar') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.max-items' | sdTranslate\"\n [model]=\"_validation.maxItems\"\n (modelChange)=\"setValidation('maxItems', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n\n @if (_type === 'upload') {\n <div class=\"ins-grid\">\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.max-files' | sdTranslate\"\n [model]=\"_field['maxFiles']\"\n (modelChange)=\"set('maxFiles', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [label]=\"'core.component.form-builder.size-mb' | sdTranslate\"\n [model]=\"_field['maxSizeMb']\"\n (modelChange)=\"set('maxSizeMb', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n @if (_field['accept'] !== 'image') {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.format-example' | sdTranslate\"\n [model]=\"extensionsText()\"\n (modelChange)=\"setExtensions($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n }\n\n @if (_type === 'textfield' && textSubtype() !== 'password') {\n <details class=\"ins-details\" [open]=\"!!_validation.pattern\">\n <summary>{{ 'core.component.form-builder.rule.advanced-pattern' | sdTranslate }}</summary>\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.pattern' | sdTranslate\"\n [inlineError]=\"patternError()\"\n [model]=\"_validation.pattern?.value\"\n (modelChange)=\"setPattern('value', $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.pattern-message' | sdTranslate\"\n [model]=\"_validation.pattern?.message\"\n (modelChange)=\"setPattern('message', $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n </details>\n }\n\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.state' | sdTranslate }}</h3>\n @if (supportsDisabled()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.disabled' | sdTranslate\"\n [model]=\"!!_field['disabled']\"\n (modelChange)=\"setFlag('disabled', $event)\"></fb-toggle-row>\n }\n @if (supportsViewed()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.read-only-mode' | sdTranslate\"\n [hint]=\"'core.component.form-builder.read-only-mode.hint' | sdTranslate\"\n [model]=\"!!_field['viewed']\"\n (modelChange)=\"setFlag('viewed', $event)\"></fb-toggle-row>\n }\n <fb-toggle-row\n [label]=\"'core.component.form-builder.hide' | sdTranslate\"\n [model]=\"!!_field['hidden']\"\n (modelChange)=\"setFlag('hidden', $event)\"></fb-toggle-row>\n @if (_field['hidden']) {\n <p class=\"ins-note\">{{ 'core.component.form-builder.hidden-note' | sdTranslate }}</p>\n }\n </section>\n\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.conditions' | sdTranslate }}</h3>\n <attribute-expression\n [label]=\"'core.component.form-builder.visible-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.visible\"\n (sdChange)=\"setRule('visible', $event)\"></attribute-expression>\n <attribute-expression\n [label]=\"'core.component.form-builder.hidden-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.hidden\"\n (sdChange)=\"setRule('hidden', $event)\"></attribute-expression>\n @if (supportsDisabled() && !_field['disabled']) {\n <attribute-expression\n [label]=\"'core.component.form-builder.disabled-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.disabled\"\n (sdChange)=\"setRule('disabled', $event)\"></attribute-expression>\n }\n @if (supportsRequired() && !_validation.required) {\n <attribute-expression\n [label]=\"'core.component.form-builder.required-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.required\"\n (sdChange)=\"setRule('required', $event)\"></attribute-expression>\n }\n </section>\n } @else if (_group) {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.state' | sdTranslate }}</h3>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.hide' | sdTranslate\"\n [model]=\"!!_group.hidden\"\n (modelChange)=\"setFlag('hidden', $event)\"></fb-toggle-row>\n <p class=\"ins-note\">{{ 'core.component.form-builder.group-rules-note' | sdTranslate }}</p>\n </section>\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.conditions' | sdTranslate }}</h3>\n <attribute-expression\n [label]=\"'core.component.form-builder.visible-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.visible\"\n (sdChange)=\"setRule('visible', $event)\"></attribute-expression>\n <attribute-expression\n [label]=\"'core.component.form-builder.hidden-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.hidden\"\n (sdChange)=\"setRule('hidden', $event)\"></attribute-expression>\n </section>\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 B\u1ED0 C\u1EE4C \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('layout') {\n @let _location = location();\n @let _siblings = store.childrenOf(_location?.parentId ?? null).length;\n @if (_field) {\n @let _viewport = viewport();\n @let _viewportLabel = 'core.component.form-builder.viewport.' + _viewport | sdTranslate;\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.layout.size' | sdTranslate }}</h3>\n <!-- why: span s\u1EEDa theo M\u1EE8C \u0110ANG XEM (thanh c\u00F4ng c\u1EE5 Desktop | Tablet | Mobile). M\u1EE9c ch\u01B0a t\u1EF1\n khai b\u00E1o hi\u1EC7n nh\u00E3n k\u1EBF th\u1EEBa; \"V\u1EC1 k\u1EBF th\u1EEBa\" xo\u00E1 span c\u1EE7a ri\u00EAng m\u1EE9c \u0111\u00F3. -->\n <div class=\"ins-key\">\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.span.at' | sdTranslate: { viewport: _viewportLabel }\"\n [items]=\"columnChoices\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"span()\"\n (modelChange)=\"setSpan($event)\"></sd-select>\n <sd-button\n type=\"outline\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"restart_alt\"\n [disabled]=\"spanSource() !== 'own'\"\n [title]=\"'core.component.form-builder.span.clear' | sdTranslate\"\n (click)=\"clearSpan()\"></sd-button>\n </div>\n <p class=\"ins-note ins-note--span\">\n @if (inheritedLabel(); as _inherited) {\n <span class=\"ins-badge\">{{ _inherited }}</span>\n }\n <span>{{ spanSummary() }}</span>\n </p>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.new-row' | sdTranslate\"\n [hint]=\"'core.component.form-builder.new-row.hint' | sdTranslate\"\n [model]=\"newRow()\"\n (modelChange)=\"setNewRow($event)\"></fb-toggle-row>\n @if (_type === 'radio') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.direction' | sdTranslate\"\n [items]=\"directions()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['direction'] || 'row'\"\n (modelChange)=\"set('direction', $event)\"></sd-select>\n }\n </section>\n } @else if (_group) {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.layout.display' | sdTranslate }}</h3>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.collapsible' | sdTranslate\"\n [model]=\"!!_group.collapsible\"\n (modelChange)=\"setCollapsible($event)\"></fb-toggle-row>\n <p class=\"ins-note\">{{ 'core.component.form-builder.group-full-width' | sdTranslate }}</p>\n </section>\n }\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.position' | sdTranslate }}</h3>\n <div class=\"ins-row\">\n <span class=\"ins-row__label\" [id]=\"orderLabelId\">{{ 'core.component.form-builder.order' | sdTranslate }}</span>\n <div class=\"ins-stepper\" role=\"group\" [attr.aria-labelledby]=\"orderLabelId\">\n <button\n type=\"button\"\n class=\"ins-stepper__btn\"\n [disabled]=\"(_location?.index ?? 0) === 0\"\n [attr.aria-label]=\"'core.component.form-builder.move-up' | sdTranslate\"\n [matTooltip]=\"'core.component.form-builder.move-up' | sdTranslate\"\n (click)=\"store.moveBy(_item.id, -1)\">\n <sd-icon name=\"arrow_upward\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n class=\"ins-stepper__btn\"\n [disabled]=\"(_location?.index ?? 0) >= _siblings - 1\"\n [attr.aria-label]=\"'core.component.form-builder.move-down' | sdTranslate\"\n [matTooltip]=\"'core.component.form-builder.move-down' | sdTranslate\"\n (click)=\"store.moveBy(_item.id, 1)\">\n <sd-icon name=\"arrow_downward\" size=\"18px\"></sd-icon>\n </button>\n </div>\n </div>\n @if (_field) {\n @if (containerChoices().length > 1) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.container' | sdTranslate\"\n [items]=\"containerChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_location?.parentId || NONE\"\n (modelChange)=\"moveToContainer($event)\"></sd-select>\n }\n } @else if (_group) {\n <sd-button\n type=\"outline\"\n color=\"secondary\"\n size=\"sm\"\n block\n prefixIcon=\"call_split\"\n [disabled]=\"!_group.elements?.length\"\n [title]=\"'core.component.form-builder.ungroup' | sdTranslate\"\n (click)=\"store.ungroup(_group.id)\"></sd-button>\n }\n </section>\n }\n }\n </div>\n }\n\n <div class=\"ins-foot\">\n <sd-button\n type=\"light\"\n color=\"error\"\n size=\"sm\"\n block\n prefixIcon=\"delete\"\n [title]=\"'core.component.form-builder.delete' | sdTranslate\"\n (click)=\"remove()\"></sd-button>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column;min-height:0;height:100%}.ins-empty{display:flex;flex-direction:column;min-height:0;flex:1}.ins-head{display:flex;align-items:center;gap:10px;flex:0 0 auto;padding:14px 16px 10px}.ins-head__icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:32px;height:32px;border-radius:var(--sd-radius-8, 8px);background:color-mix(in srgb,var(--sd-primary) 10%,var(--sd-surface));color:var(--sd-primary)}.ins-head__text{flex:1;min-width:0}.ins-head__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text);font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.ins-head__sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px)}.ins-empty .ins-head__sub{white-space:normal}.ins-mono{font-family:Roboto Mono,ui-monospace,monospace}.ins-badge{flex:0 0 auto;padding:2px 8px;border-radius:var(--sd-radius-999, 999px);background:color-mix(in srgb,var(--sd-primary) 8%,var(--sd-surface));color:var(--sd-primary);font-size:var(--sd-font-size-11, 11px)}.ins-tabs{display:flex;flex:0 0 auto;gap:2px;padding:0 12px;border-bottom:1px solid var(--sd-border);overflow-x:auto}.ins-tabs__tab{position:relative;flex:0 0 auto;padding:10px 10px 9px;border:0;background:transparent;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer}.ins-tabs__tab.is-active{color:var(--sd-primary)}.ins-tabs__tab.is-active:after{content:\"\";position:absolute;left:6px;right:6px;bottom:-1px;height:2px;border-radius:2px;background:var(--sd-primary)}.ins-tabs__tab:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:-2px}.ins-body{display:flex;flex-direction:column;gap:12px;flex:1;min-height:0;overflow-x:hidden;overflow-y:auto;padding:14px 16px 16px}.ins-body>*{min-width:0}.ins-body ::ng-deep .mat-mdc-form-field{width:100%;min-width:0}.ins-body ::ng-deep .mat-mdc-form-field-infix{width:auto;min-width:0}.ins-foot{flex:0 0 auto;padding:6px 8px;border-top:1px solid var(--sd-border)}.ins-section{display:flex;flex-direction:column;gap:12px;margin-top:6px}.ins-section>*{min-width:0}.ins-section__title{display:flex;align-items:center;gap:8px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-semibold, 600);letter-spacing:.06em;line-height:var(--sd-line-height-16, 16px);text-transform:uppercase}.ins-section__title:after{content:\"\";flex:1 1 auto;height:1px;background:var(--sd-border)}.ins-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.ins-field{display:flex;flex-direction:column;gap:6px}.ins-field__label{color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.ins-note{display:flex;gap:6px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.ins-note sd-icon{flex:0 0 auto;color:var(--sd-success)}.ins-note--success{color:var(--sd-success)}.ins-warning{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-radius:var(--sd-radius-6, 6px);background:var(--sd-status-warning-bg, var(--sd-warning-light));color:var(--sd-status-warning-fg, var(--sd-warning-dark));font-size:var(--sd-font-size-12, 12px)}.ins-key{display:flex;align-items:flex-end;gap:8px}.ins-key sd-input,.ins-key sd-select{flex:1;min-width:0}.ins-note--span{align-items:center;flex-wrap:wrap}.ins-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:32px}.ins-row__label{color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.ins-stepper{display:inline-flex;border:1px solid var(--sd-border);border-radius:var(--sd-radius-6, 6px);overflow:hidden}.ins-stepper__btn{display:inline-flex;align-items:center;justify-content:center;width:36px;height:30px;padding:0;border:0;background:var(--sd-surface);color:var(--sd-text);cursor:pointer}.ins-stepper__btn+.ins-stepper__btn{border-left:1px solid var(--sd-border)}.ins-stepper__btn:hover:not(:disabled){background:var(--sd-surface-muted)}.ins-stepper__btn:disabled{opacity:.4;cursor:default}.ins-stepper__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:-2px}.ins-card{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:12px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px)}.ins-card__row{display:flex;align-items:center;justify-content:space-between;width:100%;color:var(--sd-text);font-weight:var(--sd-font-weight-medium, 500)}.ins-count{min-width:24px;padding:0 6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-surface-muted);color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);text-align:center}.ins-details{display:flex;flex-direction:column;gap:10px}.ins-details>summary{color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer}.ins-details>summary:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}.ins-details[open]>summary{margin-bottom:10px}.ins-details>sd-input+sd-input{margin-top:10px}.ins-icons{display:flex;flex-wrap:wrap;gap:6px}.ins-icons__btn{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-6, 6px);background:var(--sd-surface);color:var(--sd-text-secondary);cursor:pointer}.ins-icons__btn.is-active{border-color:var(--sd-primary);background:color-mix(in srgb,var(--sd-primary) 8%,var(--sd-surface));color:var(--sd-primary)}.ins-icons__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}.ins-colors{display:flex;gap:8px}.ins-colors__swatch{width:26px;height:26px;border:2px solid var(--sd-surface);border-radius:50%;box-shadow:0 0 0 1px var(--sd-border);cursor:pointer}.ins-colors__swatch[data-color=primary]{background:var(--sd-primary)}.ins-colors__swatch[data-color=secondary]{background:var(--sd-secondary)}.ins-colors__swatch[data-color=info]{background:var(--sd-info)}.ins-colors__swatch[data-color=success]{background:var(--sd-success)}.ins-colors__swatch[data-color=warning]{background:var(--sd-warning)}.ins-colors__swatch[data-color=error]{background:var(--sd-error)}.ins-colors__swatch.is-active{box-shadow:0 0 0 2px var(--sd-text)}.ins-colors__swatch:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:var(--sd-focus-ring-offset, 2px)}.ins-fixed-select ::ng-deep .sd-label__required{display:none}\n"], dependencies: [{ kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdInform, selector: "sd-inform", inputs: ["type", "color", "primary", "secondary", "info", "success", "warning", "error", "title", "description", "icon", "hideIcon", "iconShape", "fontSet", "closable", "actionLabel", "lineClamp", "autoId"], outputs: ["sdClosed", "sdAction"] }, { kind: "component", type: SdInput$1, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "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", "labelPlacement", "inputmode", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect$1, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdTextarea, selector: "sd-textarea", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "rows", "hideInlineError", "required", "disabled", "viewed", "autoHeight", "maxlength", "minlength", "pattern", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }, { kind: "component", type: AttributeExpression, selector: "attribute-expression", inputs: ["elements", "variables", "readonly", "label", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: AttributeParameter, selector: "attribute-parameter", inputs: ["label", "elements", "variables", "model", "readonly"], outputs: ["modelChange"] }, { kind: "component", type: BuildQueries, selector: "build-queries", inputs: ["label", "title", "elements", "variables", "definitions", "model", "readonly"], outputs: ["modelChange"] }, { kind: "component", type: BuildVariables, selector: "build-variables", inputs: ["label", "elements", "fields", "exclude", "model", "readonly"], outputs: ["modelChange"] }, { kind: "component", type: HtmlBuildQueries, selector: "build-queries-html", inputs: ["label", "elements", "variables", "definition", "model", "readonly"], outputs: ["modelChange"] }, { kind: "component", type: OptionsEditorComponent, selector: "fb-options-editor", inputs: ["options"], outputs: ["optionsChange"] }, { kind: "component", type: ToggleRowComponent, selector: "fb-toggle-row", inputs: ["label", "hint", "model", "disabled"], outputs: ["modelChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4679
4816
|
}
|
|
4680
4817
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InspectorComponent, decorators: [{
|
|
4681
4818
|
type: Component,
|
|
@@ -4696,7 +4833,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
4696
4833
|
HtmlBuildQueries,
|
|
4697
4834
|
OptionsEditorComponent,
|
|
4698
4835
|
ToggleRowComponent,
|
|
4699
|
-
], template: "@let _item = item();\n@let _field = field();\n@let _group = group();\n@let _type = type();\n@let _tab = activeTab();\n@let _validation = validation();\n@let _rules = rules();\n\n<!-- why: m\u1ECDi control c\u1EE7a inspector d\u00F9ng hideInlineError \u2014 panel h\u1EB9p, x\u1EBFp d\u00E0y; l\u1ED7i (n\u1EBFu c\u00F3) hi\u1EC7n\n b\u1EB1ng vi\u1EC1n \u0111\u1ECF + icon k\u00E8m tooltip thay v\u00EC d\u00F2ng ch\u1EEF chi\u1EBFm ch\u1ED7 d\u01B0\u1EDBi t\u1EEBng \u00F4. -->\n@if (!_item) {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Kh\u00F4ng ch\u1ECDn g\u00EC: c\u1EA5u h\u00ECnh c\u1EA5p form \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <div class=\"ins-empty\">\n <div class=\"ins-head\">\n <span class=\"ins-head__icon\" aria-hidden=\"true\"><sd-icon name=\"dynamic_form\" size=\"20px\"></sd-icon></span>\n <div class=\"ins-head__text\">\n <div class=\"ins-head__title\">{{ 'core.component.form-builder.form-settings' | sdTranslate }}</div>\n <div class=\"ins-head__sub\">{{ 'core.component.form-builder.select-field-hint' | sdTranslate }}</div>\n </div>\n </div>\n <div class=\"ins-body\">\n <div class=\"ins-card\">\n <div class=\"ins-card__row\">\n <span>{{ 'core.component.form-builder.variables' | sdTranslate }}</span>\n <span class=\"ins-count\">{{ store.doc().variables.length }}</span>\n </div>\n <p class=\"ins-note\">{{ 'core.component.form-builder.variables-hint' | sdTranslate }}</p>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"data_array\"\n [title]=\"'core.component.form-builder.manage' | sdTranslate\"\n (click)=\"openVariables.emit()\"></sd-button>\n </div>\n <div class=\"ins-card\">\n <div class=\"ins-card__row\">\n <span>{{ 'core.component.form-builder.form-validations' | sdTranslate }}</span>\n <span class=\"ins-count\">{{ store.doc().validations.length }}</span>\n </div>\n <p class=\"ins-note\">{{ 'core.component.form-builder.form-validations-hint' | sdTranslate }}</p>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"rule\"\n [title]=\"'core.component.form-builder.manage' | sdTranslate\"\n (click)=\"openValidations.emit()\"></sd-button>\n </div>\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"keyboard\"\n [title]=\"'core.component.form-builder.shortcuts' | sdTranslate\"\n (click)=\"openShortcuts.emit()\"></sd-button>\n </div>\n </div>\n} @else {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Header \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <div class=\"ins-head\">\n <span class=\"ins-head__icon\" aria-hidden=\"true\"><sd-icon [name]=\"icon()\" size=\"20px\"></sd-icon></span>\n <div class=\"ins-head__text\">\n <div class=\"ins-head__title\">{{ store.labelOf(_item) }}</div>\n <div class=\"ins-head__sub\">\n {{ typeLabelKey() | sdTranslate }}\n @if (_field?.key) {\n \u00B7 <span class=\"ins-mono\">{{ _field?.key }}</span>\n }\n </div>\n </div>\n <span class=\"ins-badge ins-mono\">{{ unsupported() ? _type : presetId() }}</span>\n </div>\n\n @if (unsupported()) {\n <div class=\"ins-body\">\n <p class=\"ins-note\"><sd-icon name=\"help\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.unsupported-note' | sdTranslate }}</p>\n </div>\n } @else {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Tabs \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <!-- why: ph\u00EDm m\u0169i t\u00EAn n\u1ED5i b\u1ECDt t\u1EEB tab \u0111ang focus (roving tabindex, m\u1EABu tablist c\u1EE7a APG). -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"ins-tabs\"\n role=\"tablist\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\"\n (keydown)=\"onTabKeydown($event)\">\n @for (tab of tabs(); track tab) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"ins-tabs__tab\"\n [id]=\"tabId(tab)\"\n [attr.aria-controls]=\"panelId\"\n [attr.data-tab]=\"tab\"\n [class.is-active]=\"_tab === tab\"\n [attr.aria-selected]=\"_tab === tab\"\n [attr.tabindex]=\"_tab === tab ? 0 : -1\"\n (click)=\"selectTab(tab)\">\n {{ 'core.component.form-builder.tab.' + tab | sdTranslate }}\n </button>\n }\n </div>\n\n <div class=\"ins-body\" role=\"tabpanel\" [id]=\"panelId\" [attr.aria-labelledby]=\"tabId(_tab)\">\n @switch (_tab) {\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 CHUNG \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('general') {\n @if (_group) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"_group.label\"\n (modelChange)=\"setLabel($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <div class=\"ins-field\">\n <div class=\"ins-field__label\">{{ 'core.component.form-builder.group-icon' | sdTranslate }}</div>\n <div class=\"ins-icons\" role=\"group\" [attr.aria-label]=\"'core.component.form-builder.group-icon' | sdTranslate\">\n @for (icon of iconPresets; track icon) {\n <button\n type=\"button\"\n class=\"ins-icons__btn\"\n [class.is-active]=\"_group.icon === icon\"\n [attr.aria-pressed]=\"_group.icon === icon\"\n [attr.aria-label]=\"icon\"\n (click)=\"pickIcon(icon)\">\n <sd-icon [name]=\"icon\" size=\"18px\"></sd-icon>\n </button>\n }\n </div>\n </div>\n <div class=\"ins-field\">\n <div class=\"ins-field__label\">{{ 'core.component.form-builder.group-accent-color' | sdTranslate }}</div>\n <div class=\"ins-colors\" role=\"group\" [attr.aria-label]=\"'core.component.form-builder.group-accent-color' | sdTranslate\">\n @for (color of colorPresets; track color) {\n <button\n type=\"button\"\n class=\"ins-colors__swatch\"\n [attr.data-color]=\"color\"\n [class.is-active]=\"(_group.color || 'primary') === color\"\n [attr.aria-pressed]=\"(_group.color || 'primary') === color\"\n [attr.aria-label]=\"color\"\n (click)=\"pickColor(color)\"></button>\n }\n </div>\n </div>\n } @else if (_field) {\n @if (_type === 'html') {\n @if (!_field['definition']) {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"8\"\n [label]=\"'core.component.form-builder.content' | sdTranslate\"\n [model]=\"_field['content']\"\n (modelChange)=\"set('content', $event ?? '', true)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n <p class=\"ins-note\">{{ 'core.component.form-builder.html-info' | sdTranslate }}</p>\n } @else {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"_field['label']\"\n (modelChange)=\"setLabel($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n @if (supportsHelper()) {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"2\"\n [label]=\"'core.component.form-builder.helper-text' | sdTranslate\"\n [model]=\"_field['helperText']\"\n (modelChange)=\"set('helperText', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n @if (supportsPlaceholder()) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.placeholder' | sdTranslate\"\n [model]=\"_field['placeholder']\"\n (modelChange)=\"set('placeholder', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n @if (_type === 'textfield') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.input-kind' | sdTranslate\"\n [items]=\"textKinds()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"textSubtype()\"\n (modelChange)=\"setTextSubtype($event)\"></sd-select>\n } @else if (_type === 'number') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.number-kind' | sdTranslate\"\n [items]=\"numberKinds()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"numberSubtype()\"\n (modelChange)=\"setNumberSubtype($event)\"></sd-select>\n } @else if (_type === 'datetime') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.format' | sdTranslate\"\n [items]=\"datetimeFormats\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['subtype'] || 'date'\"\n (modelChange)=\"set('subtype', $event)\"></sd-select>\n }\n @if (supportsRequired()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.required' | sdTranslate\"\n [model]=\"!!_validation.required\"\n (modelChange)=\"setRequired($event)\"></fb-toggle-row>\n }\n @if (textSubtype() === 'password') {\n <p class=\"ins-note\">\n <sd-icon name=\"lock\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.password-note' | sdTranslate }}\n </p>\n }\n @if (passwordHasDefault()) {\n <div class=\"ins-warning\" role=\"alert\">\n <span>{{ 'core.component.form-builder.password-default-warning' | sdTranslate }}</span>\n <sd-button\n type=\"text\"\n color=\"error\"\n size=\"sm\"\n [title]=\"'core.component.form-builder.remove-default' | sdTranslate\"\n (click)=\"set('defaultValue', undefined)\"></sd-button>\n </div>\n }\n }\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 D\u1EEE LI\u1EC6U \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('data') {\n @if (_field) {\n @if (templateChoices().length) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.template-data' | sdTranslate\"\n [items]=\"templateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"currentTemplate()\"\n (modelChange)=\"applyTemplate($event)\"></sd-select>\n }\n\n @if (supportsDefault()) {\n @switch (_type) {\n @case ('number') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [precision]=\"numberPrecision() ?? 3\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultNumber($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n @case ('checkbox') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"booleanDefaults()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"defaultBooleanValue()\"\n (modelChange)=\"setDefaultBoolean($event)\"></sd-select>\n }\n @case ('select') {\n @if (!catalogId()) {\n <!-- why: a live sd-select cannot switch `multiple` (MatSelect throws when the value and the\n mode disagree for one tick) \u2014 a new select is created when the flag changes. -->\n @for (multiple of [!!_field['multiple']]; track multiple) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [multiple]=\"multiple\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"optionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"set('defaultValue', $event)\"></sd-select>\n }\n }\n }\n @case ('radio') {\n @if (!catalogId()) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"optionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"set('defaultValue', $event)\"></sd-select>\n }\n }\n @case ('textarea') {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"2\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultText($event)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n @default {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultText($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n }\n }\n\n @if (_type === 'select') {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.multiple' | sdTranslate\"\n [model]=\"!!_field['multiple']\"\n (modelChange)=\"setMultiple($event)\"></fb-toggle-row>\n }\n\n @if (_type === 'select' || _type === 'radio') {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.options' | sdTranslate }}</h3>\n @if (sourceChoices().length > 1) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.options.source' | sdTranslate\"\n [items]=\"sourceChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"optionSource()\"\n (modelChange)=\"setOptionSource($event)\"></sd-select>\n }\n @if (!catalogId()) {\n <fb-options-editor\n [options]=\"staticItems()\"\n (optionsChange)=\"setStaticItems($event.options, $event.coalesceKey)\"></fb-options-editor>\n } @else {\n @if (!catalog()) {\n <p class=\"ins-note\">\n <sd-icon name=\"warning\" size=\"14px\"></sd-icon\n >{{ 'core.component.form-builder.catalog.missing' | sdTranslate: { catalog: catalogId() ?? '' } }}\n </p>\n }\n <build-queries\n [label]=\"'core.component.form-builder.catalog.params' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [definitions]=\"catalog()?.params\"\n [model]=\"catalogParams()\"\n (modelChange)=\"setCatalogParams($event)\"></build-queries>\n <build-variables\n [label]=\"'core.component.form-builder.catalog.fill' | sdTranslate\"\n [elements]=\"elements()\"\n [fields]=\"catalog()?.fields\"\n [exclude]=\"_field.key\"\n [model]=\"catalogFill()\"\n (modelChange)=\"setCatalogFill($event)\"></build-variables>\n }\n </section>\n }\n\n @if (_type === 'upload') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.type' | sdTranslate\"\n [items]=\"uploadTypes()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['accept'] || 'file'\"\n (modelChange)=\"set('accept', $event)\"></sd-select>\n @if (_field['accept'] === 'image') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.source-mobile' | sdTranslate\"\n [items]=\"uploadSources()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['source'] || 'ALL'\"\n (modelChange)=\"set('source', $event)\"></sd-select>\n }\n <attribute-parameter\n [label]=\"'core.component.form-builder.assign-parameter' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_field['params']\"\n (modelChange)=\"setUploadParams($event)\"></attribute-parameter>\n }\n\n @if (_type === 'html') {\n @if (htmlDefinitionChoices().length) {\n <!-- why: choices also hold the field's current definition when the portal lacks it, so it can be cleared. -->\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [label]=\"'core.component.form-builder.template-data' | sdTranslate\"\n [items]=\"htmlDefinitionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['definition']\"\n (modelChange)=\"applyHtmlDefinition($event)\"></sd-select>\n }\n @for (variable of htmlVariables(); track variable.key) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"variable.label\"\n [model]=\"variable.value\"\n (modelChange)=\"setHtmlVariable(variable.key, $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n <build-queries-html\n [label]=\"'core.component.form-builder.query-condition' | sdTranslate\"\n [definition]=\"htmlDefinition()\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_field['query']\"\n (modelChange)=\"setHtmlQuery($event)\"></build-queries-html>\n }\n\n @if (supportsHyperlink()) {\n <div class=\"ins-field\">\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.hyperlink' | sdTranslate\"\n [model]=\"_field['hyperlink']\"\n (modelChange)=\"set('hyperlink', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <p class=\"ins-note\">{{ 'core.component.form-builder.hyperlink-hint' | sdTranslate }}</p>\n </div>\n }\n\n <!-- N\u00E2ng cao: m\u00E3 tr\u01B0\u1EDDng (key). \u0110\u1ED5i nh\u00E3n KH\u00D4NG \u0111\u1ED5i key; \u0111\u1ED5i key lu\u00F4n qua x\u00E1c nh\u1EADn. -->\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.advanced' | sdTranslate }}</h3>\n @if (_field.key || _type !== 'html') {\n <div class=\"ins-key\">\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.key.label' | sdTranslate\"\n [inlineError]=\"keyError() || undefined\"\n [model]=\"keyDraft()\"\n (modelChange)=\"keyDraft.set($event ?? '')\"\n (keyupEnter)=\"applyKey()\"></sd-input>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n [disabled]=\"!!keyError() || keyDraft().trim() === _field.key\"\n [title]=\"'core.component.form-builder.key.apply' | sdTranslate\"\n (click)=\"applyKey()\"></sd-button>\n </div>\n }\n @if (!_field.key && _type !== 'html') {\n <div class=\"ins-warning\">\n <span>{{ 'core.component.form-builder.key.missing' | sdTranslate }}</span>\n <sd-button\n type=\"text\"\n color=\"primary\"\n size=\"sm\"\n [title]=\"'core.component.form-builder.key.generate' | sdTranslate\"\n (click)=\"generateKey()\"></sd-button>\n </div>\n }\n @if (keyMessage(); as message) {\n <sd-inform type=\"tip\" success closable [description]=\"message\" (sdClosed)=\"keyMessage.set('')\"></sd-inform>\n }\n </section>\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 QUY T\u1EAEC \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('rules') {\n @if (_field) {\n @switch (textSubtype()) {\n @case ('email') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.email' | sdTranslate }}\n </p>\n }\n @case ('url') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.url' | sdTranslate }}\n </p>\n }\n @case ('phone') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.phone' | sdTranslate }}\n </p>\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.phone-country' | sdTranslate\"\n [items]=\"phoneCountries()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_validation.phoneCountry || NONE\"\n (modelChange)=\"setValidationChoice('phoneCountry', $event)\"></sd-select>\n }\n }\n\n @if (_type === 'number') {\n <div class=\"ins-grid\">\n <!-- why: coalesce + seal on blur \u2014 typing \"1000\" is one undo step, not four. -->\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.min' | sdTranslate\"\n [model]=\"_validation.min\"\n (modelChange)=\"setValidation('min', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.max' | sdTranslate\"\n [model]=\"_validation.max\"\n (modelChange)=\"setValidation('max', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n @if (numberSubtype() === 'decimal' || numberSubtype() === 'currency' || numberSubtype() === 'percent') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [min]=\"0\"\n [max]=\"10\"\n [label]=\"'core.component.form-builder.precision' | sdTranslate\"\n [model]=\"numberPrecision()\"\n (modelChange)=\"set('precision', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n @if (numberSubtype() === 'currency') {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.currency' | sdTranslate\"\n [model]=\"_field['currency'] || 'VND'\"\n (modelChange)=\"set('currency', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n @if (numberSubtype() === 'percent') {\n <p class=\"ins-note\">{{ 'core.component.form-builder.rule.percent' | sdTranslate }}</p>\n }\n @if (numberSubtype() === 'integer') {\n <p class=\"ins-note\">{{ 'core.component.form-builder.rule.integer' | sdTranslate }}</p>\n }\n }\n\n @if (_type === 'datetime') {\n <div class=\"ins-grid\">\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.min' | sdTranslate\"\n required\n class=\"ins-fixed-select\"\n [items]=\"minDateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"dateLimitValue(_validation.min)\"\n (modelChange)=\"setValidationChoice('min', $event)\"></sd-select>\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.max' | sdTranslate\"\n required\n class=\"ins-fixed-select\"\n [items]=\"maxDateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"dateLimitValue(_validation.max)\"\n (modelChange)=\"setValidationChoice('max', $event)\"></sd-select>\n </div>\n }\n\n @if (supportsLength()) {\n <div class=\"ins-grid\">\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.minlength' | sdTranslate\"\n [model]=\"_validation.minLength\"\n (modelChange)=\"setValidation('minLength', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.maxlength' | sdTranslate\"\n [model]=\"_validation.maxLength\"\n (modelChange)=\"setValidation('maxLength', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n }\n\n @if (_type === 'chip-string' || _type === 'chip-calendar') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.max-items' | sdTranslate\"\n [model]=\"_validation.maxItems\"\n (modelChange)=\"setValidation('maxItems', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n\n @if (_type === 'upload') {\n <div class=\"ins-grid\">\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.max-files' | sdTranslate\"\n [model]=\"_field['maxFiles']\"\n (modelChange)=\"set('maxFiles', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [label]=\"'core.component.form-builder.size-mb' | sdTranslate\"\n [model]=\"_field['maxSizeMb']\"\n (modelChange)=\"set('maxSizeMb', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n @if (_field['accept'] !== 'image') {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.format-example' | sdTranslate\"\n [model]=\"extensionsText()\"\n (modelChange)=\"setExtensions($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n }\n\n @if (_type === 'textfield' && textSubtype() !== 'password') {\n <details class=\"ins-details\" [open]=\"!!_validation.pattern\">\n <summary>{{ 'core.component.form-builder.rule.advanced-pattern' | sdTranslate }}</summary>\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.pattern' | sdTranslate\"\n [inlineError]=\"patternError()\"\n [model]=\"_validation.pattern?.value\"\n (modelChange)=\"setPattern('value', $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.pattern-message' | sdTranslate\"\n [model]=\"_validation.pattern?.message\"\n (modelChange)=\"setPattern('message', $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n </details>\n }\n\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.state' | sdTranslate }}</h3>\n @if (supportsDisabled()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.disabled' | sdTranslate\"\n [model]=\"!!_field['disabled']\"\n (modelChange)=\"setFlag('disabled', $event)\"></fb-toggle-row>\n }\n @if (supportsViewed()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.read-only-mode' | sdTranslate\"\n [hint]=\"'core.component.form-builder.read-only-mode.hint' | sdTranslate\"\n [model]=\"!!_field['viewed']\"\n (modelChange)=\"setFlag('viewed', $event)\"></fb-toggle-row>\n }\n <fb-toggle-row\n [label]=\"'core.component.form-builder.hide' | sdTranslate\"\n [model]=\"!!_field['hidden']\"\n (modelChange)=\"setFlag('hidden', $event)\"></fb-toggle-row>\n @if (_field['hidden']) {\n <p class=\"ins-note\">{{ 'core.component.form-builder.hidden-note' | sdTranslate }}</p>\n }\n </section>\n\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.conditions' | sdTranslate }}</h3>\n <attribute-expression\n [label]=\"'core.component.form-builder.visible-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.visible\"\n (sdChange)=\"setRule('visible', $event)\"></attribute-expression>\n <attribute-expression\n [label]=\"'core.component.form-builder.hidden-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.hidden\"\n (sdChange)=\"setRule('hidden', $event)\"></attribute-expression>\n @if (supportsDisabled() && !_field['disabled']) {\n <attribute-expression\n [label]=\"'core.component.form-builder.disabled-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.disabled\"\n (sdChange)=\"setRule('disabled', $event)\"></attribute-expression>\n }\n @if (supportsRequired() && !_validation.required) {\n <attribute-expression\n [label]=\"'core.component.form-builder.required-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.required\"\n (sdChange)=\"setRule('required', $event)\"></attribute-expression>\n }\n </section>\n } @else if (_group) {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.state' | sdTranslate }}</h3>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.hide' | sdTranslate\"\n [model]=\"!!_group.hidden\"\n (modelChange)=\"setFlag('hidden', $event)\"></fb-toggle-row>\n <p class=\"ins-note\">{{ 'core.component.form-builder.group-rules-note' | sdTranslate }}</p>\n </section>\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.conditions' | sdTranslate }}</h3>\n <attribute-expression\n [label]=\"'core.component.form-builder.visible-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.visible\"\n (sdChange)=\"setRule('visible', $event)\"></attribute-expression>\n <attribute-expression\n [label]=\"'core.component.form-builder.hidden-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.hidden\"\n (sdChange)=\"setRule('hidden', $event)\"></attribute-expression>\n </section>\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 B\u1ED0 C\u1EE4C \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('layout') {\n @let _location = location();\n @let _siblings = store.childrenOf(_location?.parentId ?? null).length;\n @if (_field) {\n @let _viewport = viewport();\n @let _viewportLabel = 'core.component.form-builder.viewport.' + _viewport | sdTranslate;\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.layout.size' | sdTranslate }}</h3>\n <!-- why: span s\u1EEDa theo M\u1EE8C \u0110ANG XEM (thanh c\u00F4ng c\u1EE5 Desktop | Tablet | Mobile). M\u1EE9c ch\u01B0a t\u1EF1\n khai b\u00E1o hi\u1EC7n nh\u00E3n k\u1EBF th\u1EEBa; \"V\u1EC1 k\u1EBF th\u1EEBa\" xo\u00E1 span c\u1EE7a ri\u00EAng m\u1EE9c \u0111\u00F3. -->\n <div class=\"ins-key\">\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.span.at' | sdTranslate: { viewport: _viewportLabel }\"\n [items]=\"columnChoices\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"span()\"\n (modelChange)=\"setSpan($event)\"></sd-select>\n <sd-button\n type=\"outline\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"restart_alt\"\n [disabled]=\"spanSource() !== 'own'\"\n [title]=\"'core.component.form-builder.span.clear' | sdTranslate\"\n (click)=\"clearSpan()\"></sd-button>\n </div>\n <p class=\"ins-note ins-note--span\">\n @if (inheritedLabel(); as _inherited) {\n <span class=\"ins-badge\">{{ _inherited }}</span>\n }\n <span>{{ spanSummary() }}</span>\n </p>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.new-row' | sdTranslate\"\n [hint]=\"'core.component.form-builder.new-row.hint' | sdTranslate\"\n [model]=\"newRow()\"\n (modelChange)=\"setNewRow($event)\"></fb-toggle-row>\n @if (_type === 'radio') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.direction' | sdTranslate\"\n [items]=\"directions()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['direction'] || 'row'\"\n (modelChange)=\"set('direction', $event)\"></sd-select>\n }\n </section>\n } @else if (_group) {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.layout.display' | sdTranslate }}</h3>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.collapsible' | sdTranslate\"\n [model]=\"!!_group.collapsible\"\n (modelChange)=\"setCollapsible($event)\"></fb-toggle-row>\n <p class=\"ins-note\">{{ 'core.component.form-builder.group-full-width' | sdTranslate }}</p>\n </section>\n }\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.position' | sdTranslate }}</h3>\n <div class=\"ins-row\">\n <span class=\"ins-row__label\" [id]=\"orderLabelId\">{{ 'core.component.form-builder.order' | sdTranslate }}</span>\n <div class=\"ins-stepper\" role=\"group\" [attr.aria-labelledby]=\"orderLabelId\">\n <button\n type=\"button\"\n class=\"ins-stepper__btn\"\n [disabled]=\"(_location?.index ?? 0) === 0\"\n [attr.aria-label]=\"'core.component.form-builder.move-up' | sdTranslate\"\n [matTooltip]=\"'core.component.form-builder.move-up' | sdTranslate\"\n (click)=\"store.moveBy(_item.id, -1)\">\n <sd-icon name=\"arrow_upward\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n class=\"ins-stepper__btn\"\n [disabled]=\"(_location?.index ?? 0) >= _siblings - 1\"\n [attr.aria-label]=\"'core.component.form-builder.move-down' | sdTranslate\"\n [matTooltip]=\"'core.component.form-builder.move-down' | sdTranslate\"\n (click)=\"store.moveBy(_item.id, 1)\">\n <sd-icon name=\"arrow_downward\" size=\"18px\"></sd-icon>\n </button>\n </div>\n </div>\n @if (_field) {\n @if (containerChoices().length > 1) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.container' | sdTranslate\"\n [items]=\"containerChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_location?.parentId || NONE\"\n (modelChange)=\"moveToContainer($event)\"></sd-select>\n }\n } @else if (_group) {\n <sd-button\n type=\"outline\"\n color=\"secondary\"\n size=\"sm\"\n block\n prefixIcon=\"call_split\"\n [disabled]=\"!_group.elements?.length\"\n [title]=\"'core.component.form-builder.ungroup' | sdTranslate\"\n (click)=\"store.ungroup(_group.id)\"></sd-button>\n }\n </section>\n }\n }\n </div>\n }\n\n <div class=\"ins-foot\">\n <sd-button\n type=\"light\"\n color=\"error\"\n size=\"sm\"\n block\n prefixIcon=\"delete\"\n [title]=\"'core.component.form-builder.delete' | sdTranslate\"\n (click)=\"remove()\"></sd-button>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column;min-height:0;height:100%}.ins-empty{display:flex;flex-direction:column;min-height:0;flex:1}.ins-head{display:flex;align-items:center;gap:10px;flex:0 0 auto;padding:14px 16px 10px}.ins-head__icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:32px;height:32px;border-radius:var(--sd-radius-8, 8px);background:color-mix(in srgb,var(--sd-primary) 10%,var(--sd-surface));color:var(--sd-primary)}.ins-head__text{flex:1;min-width:0}.ins-head__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text);font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.ins-head__sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px)}.ins-empty .ins-head__sub{white-space:normal}.ins-mono{font-family:Roboto Mono,ui-monospace,monospace}.ins-badge{flex:0 0 auto;padding:2px 8px;border-radius:var(--sd-radius-999, 999px);background:color-mix(in srgb,var(--sd-primary) 8%,var(--sd-surface));color:var(--sd-primary);font-size:var(--sd-font-size-11, 11px)}.ins-tabs{display:flex;flex:0 0 auto;gap:2px;padding:0 12px;border-bottom:1px solid var(--sd-border);overflow-x:auto}.ins-tabs__tab{position:relative;flex:0 0 auto;padding:10px 10px 9px;border:0;background:transparent;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer}.ins-tabs__tab.is-active{color:var(--sd-primary)}.ins-tabs__tab.is-active:after{content:\"\";position:absolute;left:6px;right:6px;bottom:-1px;height:2px;border-radius:2px;background:var(--sd-primary)}.ins-tabs__tab:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:-2px}.ins-body{display:flex;flex-direction:column;gap:12px;flex:1;min-height:0;overflow-x:hidden;overflow-y:auto;padding:14px 16px 16px}.ins-body>*{min-width:0}.ins-body ::ng-deep .mat-mdc-form-field{width:100%;min-width:0}.ins-body ::ng-deep .mat-mdc-form-field-infix{width:auto;min-width:0}.ins-foot{flex:0 0 auto;padding:6px 8px;border-top:1px solid var(--sd-border)}.ins-section{display:flex;flex-direction:column;gap:12px;margin-top:6px}.ins-section>*{min-width:0}.ins-section__title{display:flex;align-items:center;gap:8px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-semibold, 600);letter-spacing:.06em;line-height:var(--sd-line-height-16, 16px);text-transform:uppercase}.ins-section__title:after{content:\"\";flex:1 1 auto;height:1px;background:var(--sd-border)}.ins-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.ins-field{display:flex;flex-direction:column;gap:6px}.ins-field__label{color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.ins-note{display:flex;gap:6px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.ins-note sd-icon{flex:0 0 auto;color:var(--sd-success)}.ins-note--success{color:var(--sd-success)}.ins-warning{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-radius:var(--sd-radius-6, 6px);background:var(--sd-status-warning-bg, var(--sd-warning-light));color:var(--sd-status-warning-fg, var(--sd-warning-dark));font-size:var(--sd-font-size-12, 12px)}.ins-key{display:flex;align-items:flex-end;gap:8px}.ins-key sd-input,.ins-key sd-select{flex:1;min-width:0}.ins-note--span{align-items:center;flex-wrap:wrap}.ins-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:32px}.ins-row__label{color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.ins-stepper{display:inline-flex;border:1px solid var(--sd-border);border-radius:var(--sd-radius-6, 6px);overflow:hidden}.ins-stepper__btn{display:inline-flex;align-items:center;justify-content:center;width:36px;height:30px;padding:0;border:0;background:var(--sd-surface);color:var(--sd-text);cursor:pointer}.ins-stepper__btn+.ins-stepper__btn{border-left:1px solid var(--sd-border)}.ins-stepper__btn:hover:not(:disabled){background:var(--sd-surface-muted)}.ins-stepper__btn:disabled{opacity:.4;cursor:default}.ins-stepper__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:-2px}.ins-card{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:12px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px)}.ins-card__row{display:flex;align-items:center;justify-content:space-between;width:100%;color:var(--sd-text);font-weight:var(--sd-font-weight-medium, 500)}.ins-count{min-width:24px;padding:0 6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-surface-muted);color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);text-align:center}.ins-details{display:flex;flex-direction:column;gap:10px}.ins-details>summary{color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer}.ins-details>summary:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}.ins-details[open]>summary{margin-bottom:10px}.ins-details>sd-input+sd-input{margin-top:10px}.ins-icons{display:flex;flex-wrap:wrap;gap:6px}.ins-icons__btn{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-6, 6px);background:var(--sd-surface);color:var(--sd-text-secondary);cursor:pointer}.ins-icons__btn.is-active{border-color:var(--sd-primary);background:color-mix(in srgb,var(--sd-primary) 8%,var(--sd-surface));color:var(--sd-primary)}.ins-icons__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}.ins-colors{display:flex;gap:8px}.ins-colors__swatch{width:26px;height:26px;border:2px solid var(--sd-surface);border-radius:50%;box-shadow:0 0 0 1px var(--sd-border);cursor:pointer}.ins-colors__swatch[data-color=primary]{background:var(--sd-primary)}.ins-colors__swatch[data-color=secondary]{background:var(--sd-secondary)}.ins-colors__swatch[data-color=info]{background:var(--sd-info)}.ins-colors__swatch[data-color=success]{background:var(--sd-success)}.ins-colors__swatch[data-color=warning]{background:var(--sd-warning)}.ins-colors__swatch[data-color=error]{background:var(--sd-error)}.ins-colors__swatch.is-active{box-shadow:0 0 0 2px var(--sd-text)}.ins-colors__swatch:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:var(--sd-focus-ring-offset, 2px)}.ins-fixed-select ::ng-deep .sd-label__required{display:none}\n"] }]
|
|
4836
|
+
], template: "@let _item = item();\n@let _field = field();\n@let _group = group();\n@let _type = type();\n@let _tab = activeTab();\n@let _validation = validation();\n@let _rules = rules();\n\n<!-- why: m\u1ECDi control c\u1EE7a inspector d\u00F9ng hideInlineError \u2014 panel h\u1EB9p, x\u1EBFp d\u00E0y; l\u1ED7i (n\u1EBFu c\u00F3) hi\u1EC7n\n b\u1EB1ng vi\u1EC1n \u0111\u1ECF + icon k\u00E8m tooltip thay v\u00EC d\u00F2ng ch\u1EEF chi\u1EBFm ch\u1ED7 d\u01B0\u1EDBi t\u1EEBng \u00F4. -->\n@if (!_item) {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Kh\u00F4ng ch\u1ECDn g\u00EC: c\u1EA5u h\u00ECnh c\u1EA5p form \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <div class=\"ins-empty\">\n <div class=\"ins-head\">\n <span class=\"ins-head__icon\" aria-hidden=\"true\"><sd-icon name=\"dynamic_form\" size=\"20px\"></sd-icon></span>\n <div class=\"ins-head__text\">\n <div class=\"ins-head__title\">{{ 'core.component.form-builder.form-settings' | sdTranslate }}</div>\n <div class=\"ins-head__sub\">{{ 'core.component.form-builder.select-field-hint' | sdTranslate }}</div>\n </div>\n </div>\n <div class=\"ins-body\">\n <section class=\"ins-card\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.page.settings' | sdTranslate }}</h3>\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n [label]=\"'core.component.form-builder.page.navigation' | sdTranslate\"\n [items]=\"navigationChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"navigationMode()\"\n (modelChange)=\"setNavigation($event)\"></sd-select>\n @if (navigationMode() === 'steps') {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.page.linear' | sdTranslate\"\n [model]=\"linear()\"\n (modelChange)=\"store.setLinear($event)\"></fb-toggle-row>\n }\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"store.activePage().label\"\n (modelChange)=\"store.setPageMetadata({ label: $event || undefined }, 'page-label:' + store.activePage().id)\"\n (sdBlur)=\"store.sealHistory()\"></sd-input>\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.page.icon' | sdTranslate\"\n [model]=\"store.activePage().icon\"\n (modelChange)=\"store.setPageMetadata({ icon: $event || undefined }, 'page-icon:' + store.activePage().id)\"\n (sdBlur)=\"store.sealHistory()\"></sd-input>\n <attribute-expression\n [label]=\"'core.component.form-builder.visible-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"store.activePage().rules?.visible\"\n (sdChange)=\"store.setPageRule('visible', $event)\"></attribute-expression>\n <attribute-expression\n [label]=\"'core.component.form-builder.hidden-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"store.activePage().rules?.hidden\"\n (sdChange)=\"store.setPageRule('hidden', $event)\"></attribute-expression>\n </section>\n <div class=\"ins-card\">\n <div class=\"ins-card__row\">\n <span>{{ 'core.component.form-builder.variables' | sdTranslate }}</span>\n <span class=\"ins-count\">{{ store.doc().variables.length }}</span>\n </div>\n <p class=\"ins-note\">{{ 'core.component.form-builder.variables-hint' | sdTranslate }}</p>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"data_array\"\n [title]=\"'core.component.form-builder.manage' | sdTranslate\"\n (click)=\"openVariables.emit()\"></sd-button>\n </div>\n <div class=\"ins-card\">\n <div class=\"ins-card__row\">\n <span>{{ 'core.component.form-builder.form-validations' | sdTranslate }}</span>\n <span class=\"ins-count\">{{ store.doc().validations.length }}</span>\n </div>\n <p class=\"ins-note\">{{ 'core.component.form-builder.form-validations-hint' | sdTranslate }}</p>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"rule\"\n [title]=\"'core.component.form-builder.manage' | sdTranslate\"\n (click)=\"openValidations.emit()\"></sd-button>\n </div>\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"keyboard\"\n [title]=\"'core.component.form-builder.shortcuts' | sdTranslate\"\n (click)=\"openShortcuts.emit()\"></sd-button>\n </div>\n </div>\n} @else {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Header \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <div class=\"ins-head\">\n <span class=\"ins-head__icon\" aria-hidden=\"true\"><sd-icon [name]=\"icon()\" size=\"20px\"></sd-icon></span>\n <div class=\"ins-head__text\">\n <div class=\"ins-head__title\">{{ store.labelOf(_item) }}</div>\n <div class=\"ins-head__sub\">\n {{ typeLabelKey() | sdTranslate }}\n @if (_field?.key) {\n \u00B7 <span class=\"ins-mono\">{{ _field?.key }}</span>\n }\n </div>\n </div>\n <span class=\"ins-badge ins-mono\">{{ unsupported() ? _type : presetId() }}</span>\n </div>\n\n @if (unsupported()) {\n <div class=\"ins-body\">\n <p class=\"ins-note\"><sd-icon name=\"help\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.unsupported-note' | sdTranslate }}</p>\n </div>\n } @else {\n <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Tabs \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n <!-- why: ph\u00EDm m\u0169i t\u00EAn n\u1ED5i b\u1ECDt t\u1EEB tab \u0111ang focus (roving tabindex, m\u1EABu tablist c\u1EE7a APG). -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"ins-tabs\"\n role=\"tablist\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\"\n (keydown)=\"onTabKeydown($event)\">\n @for (tab of tabs(); track tab) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"ins-tabs__tab\"\n [id]=\"tabId(tab)\"\n [attr.aria-controls]=\"panelId\"\n [attr.data-tab]=\"tab\"\n [class.is-active]=\"_tab === tab\"\n [attr.aria-selected]=\"_tab === tab\"\n [attr.tabindex]=\"_tab === tab ? 0 : -1\"\n (click)=\"selectTab(tab)\">\n {{ 'core.component.form-builder.tab.' + tab | sdTranslate }}\n </button>\n }\n </div>\n\n <div class=\"ins-body\" role=\"tabpanel\" [id]=\"panelId\" [attr.aria-labelledby]=\"tabId(_tab)\">\n @switch (_tab) {\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 CHUNG \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('general') {\n @if (_group) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"_group.label\"\n (modelChange)=\"setLabel($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <div class=\"ins-field\">\n <div class=\"ins-field__label\">{{ 'core.component.form-builder.group-icon' | sdTranslate }}</div>\n <div class=\"ins-icons\" role=\"group\" [attr.aria-label]=\"'core.component.form-builder.group-icon' | sdTranslate\">\n @for (icon of iconPresets; track icon) {\n <button\n type=\"button\"\n class=\"ins-icons__btn\"\n [class.is-active]=\"_group.icon === icon\"\n [attr.aria-pressed]=\"_group.icon === icon\"\n [attr.aria-label]=\"icon\"\n (click)=\"pickIcon(icon)\">\n <sd-icon [name]=\"icon\" size=\"18px\"></sd-icon>\n </button>\n }\n </div>\n </div>\n <div class=\"ins-field\">\n <div class=\"ins-field__label\">{{ 'core.component.form-builder.group-accent-color' | sdTranslate }}</div>\n <div class=\"ins-colors\" role=\"group\" [attr.aria-label]=\"'core.component.form-builder.group-accent-color' | sdTranslate\">\n @for (color of colorPresets; track color) {\n <button\n type=\"button\"\n class=\"ins-colors__swatch\"\n [attr.data-color]=\"color\"\n [class.is-active]=\"(_group.color || 'primary') === color\"\n [attr.aria-pressed]=\"(_group.color || 'primary') === color\"\n [attr.aria-label]=\"color\"\n (click)=\"pickColor(color)\"></button>\n }\n </div>\n </div>\n } @else if (_field) {\n @if (_type === 'html') {\n @if (!_field['definition']) {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"8\"\n [label]=\"'core.component.form-builder.content' | sdTranslate\"\n [model]=\"_field['content']\"\n (modelChange)=\"set('content', $event ?? '', true)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n <p class=\"ins-note\">{{ 'core.component.form-builder.html-info' | sdTranslate }}</p>\n } @else {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"_field['label']\"\n (modelChange)=\"setLabel($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n @if (supportsHelper()) {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"2\"\n [label]=\"'core.component.form-builder.helper-text' | sdTranslate\"\n [model]=\"_field['helperText']\"\n (modelChange)=\"set('helperText', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n @if (supportsPlaceholder()) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.placeholder' | sdTranslate\"\n [model]=\"_field['placeholder']\"\n (modelChange)=\"set('placeholder', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n @if (_type === 'textfield') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.input-kind' | sdTranslate\"\n [items]=\"textKinds()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"textSubtype()\"\n (modelChange)=\"setTextSubtype($event)\"></sd-select>\n } @else if (_type === 'number') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.number-kind' | sdTranslate\"\n [items]=\"numberKinds()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"numberSubtype()\"\n (modelChange)=\"setNumberSubtype($event)\"></sd-select>\n } @else if (_type === 'datetime') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.format' | sdTranslate\"\n [items]=\"datetimeFormats\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['subtype'] || 'date'\"\n (modelChange)=\"set('subtype', $event)\"></sd-select>\n }\n @if (supportsRequired()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.required' | sdTranslate\"\n [model]=\"!!_validation.required\"\n (modelChange)=\"setRequired($event)\"></fb-toggle-row>\n }\n @if (textSubtype() === 'password') {\n <p class=\"ins-note\">\n <sd-icon name=\"lock\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.password-note' | sdTranslate }}\n </p>\n }\n @if (passwordHasDefault()) {\n <div class=\"ins-warning\" role=\"alert\">\n <span>{{ 'core.component.form-builder.password-default-warning' | sdTranslate }}</span>\n <sd-button\n type=\"text\"\n color=\"error\"\n size=\"sm\"\n [title]=\"'core.component.form-builder.remove-default' | sdTranslate\"\n (click)=\"set('defaultValue', undefined)\"></sd-button>\n </div>\n }\n }\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 D\u1EEE LI\u1EC6U \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('data') {\n @if (_field) {\n @if (templateChoices().length) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.template-data' | sdTranslate\"\n [items]=\"templateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"currentTemplate()\"\n (modelChange)=\"applyTemplate($event)\"></sd-select>\n }\n\n @if (supportsDefault()) {\n @switch (_type) {\n @case ('number') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [precision]=\"numberPrecision() ?? 3\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultNumber($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n @case ('checkbox') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"booleanDefaults()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"defaultBooleanValue()\"\n (modelChange)=\"setDefaultBoolean($event)\"></sd-select>\n }\n @case ('select') {\n @if (!catalogId()) {\n <!-- why: a live sd-select cannot switch `multiple` (MatSelect throws when the value and the\n mode disagree for one tick) \u2014 a new select is created when the flag changes. -->\n @for (multiple of [!!_field['multiple']]; track multiple) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [multiple]=\"multiple\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"optionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"set('defaultValue', $event)\"></sd-select>\n }\n }\n }\n @case ('radio') {\n @if (!catalogId()) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [items]=\"optionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"set('defaultValue', $event)\"></sd-select>\n }\n }\n @case ('textarea') {\n <sd-textarea\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [rows]=\"2\"\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultText($event)\"\n (sdBlur)=\"sealHistory()\"></sd-textarea>\n }\n @default {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.default-value' | sdTranslate\"\n [model]=\"_field['defaultValue']\"\n (modelChange)=\"setDefaultText($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n }\n }\n\n @if (_type === 'select') {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.multiple' | sdTranslate\"\n [model]=\"!!_field['multiple']\"\n (modelChange)=\"setMultiple($event)\"></fb-toggle-row>\n }\n\n @if (_type === 'select' || _type === 'radio') {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.options' | sdTranslate }}</h3>\n @if (sourceChoices().length > 1) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.options.source' | sdTranslate\"\n [items]=\"sourceChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"optionSource()\"\n (modelChange)=\"setOptionSource($event)\"></sd-select>\n }\n @if (!catalogId()) {\n <fb-options-editor\n [options]=\"staticItems()\"\n (optionsChange)=\"setStaticItems($event.options, $event.coalesceKey)\"></fb-options-editor>\n } @else {\n @if (!catalog()) {\n <p class=\"ins-note\">\n <sd-icon name=\"warning\" size=\"14px\"></sd-icon\n >{{ 'core.component.form-builder.catalog.missing' | sdTranslate: { catalog: catalogId() ?? '' } }}\n </p>\n }\n <build-queries\n [label]=\"'core.component.form-builder.catalog.params' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [definitions]=\"catalog()?.params\"\n [model]=\"catalogParams()\"\n (modelChange)=\"setCatalogParams($event)\"></build-queries>\n <build-variables\n [label]=\"'core.component.form-builder.catalog.fill' | sdTranslate\"\n [elements]=\"elements()\"\n [fields]=\"catalog()?.fields\"\n [exclude]=\"_field.key\"\n [model]=\"catalogFill()\"\n (modelChange)=\"setCatalogFill($event)\"></build-variables>\n }\n </section>\n }\n\n @if (_type === 'upload') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.type' | sdTranslate\"\n [items]=\"uploadTypes()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['accept'] || 'file'\"\n (modelChange)=\"set('accept', $event)\"></sd-select>\n @if (_field['accept'] === 'image') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.source-mobile' | sdTranslate\"\n [items]=\"uploadSources()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['source'] || 'ALL'\"\n (modelChange)=\"set('source', $event)\"></sd-select>\n }\n <attribute-parameter\n [label]=\"'core.component.form-builder.assign-parameter' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_field['params']\"\n (modelChange)=\"setUploadParams($event)\"></attribute-parameter>\n }\n\n @if (_type === 'html') {\n @if (htmlDefinitionChoices().length) {\n <!-- why: choices also hold the field's current definition when the portal lacks it, so it can be cleared. -->\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n clearable\n [label]=\"'core.component.form-builder.template-data' | sdTranslate\"\n [items]=\"htmlDefinitionChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['definition']\"\n (modelChange)=\"applyHtmlDefinition($event)\"></sd-select>\n }\n @for (variable of htmlVariables(); track variable.key) {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"variable.label\"\n [model]=\"variable.value\"\n (modelChange)=\"setHtmlVariable(variable.key, $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n <build-queries-html\n [label]=\"'core.component.form-builder.query-condition' | sdTranslate\"\n [definition]=\"htmlDefinition()\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_field['query']\"\n (modelChange)=\"setHtmlQuery($event)\"></build-queries-html>\n }\n\n @if (supportsHyperlink()) {\n <div class=\"ins-field\">\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.hyperlink' | sdTranslate\"\n [model]=\"_field['hyperlink']\"\n (modelChange)=\"set('hyperlink', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <p class=\"ins-note\">{{ 'core.component.form-builder.hyperlink-hint' | sdTranslate }}</p>\n </div>\n }\n\n <!-- N\u00E2ng cao: m\u00E3 tr\u01B0\u1EDDng (key). \u0110\u1ED5i nh\u00E3n KH\u00D4NG \u0111\u1ED5i key; \u0111\u1ED5i key lu\u00F4n qua x\u00E1c nh\u1EADn. -->\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.advanced' | sdTranslate }}</h3>\n @if (_field.key || _type !== 'html') {\n <div class=\"ins-key\">\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.key.label' | sdTranslate\"\n [inlineError]=\"keyError() || undefined\"\n [model]=\"keyDraft()\"\n (modelChange)=\"keyDraft.set($event ?? '')\"\n (keyupEnter)=\"applyKey()\"></sd-input>\n <sd-button\n type=\"outline\"\n color=\"primary\"\n size=\"sm\"\n [disabled]=\"!!keyError() || keyDraft().trim() === _field.key\"\n [title]=\"'core.component.form-builder.key.apply' | sdTranslate\"\n (click)=\"applyKey()\"></sd-button>\n </div>\n }\n @if (!_field.key && _type !== 'html') {\n <div class=\"ins-warning\">\n <span>{{ 'core.component.form-builder.key.missing' | sdTranslate }}</span>\n <sd-button\n type=\"text\"\n color=\"primary\"\n size=\"sm\"\n [title]=\"'core.component.form-builder.key.generate' | sdTranslate\"\n (click)=\"generateKey()\"></sd-button>\n </div>\n }\n @if (keyMessage(); as message) {\n <sd-inform type=\"tip\" success closable [description]=\"message\" (sdClosed)=\"keyMessage.set('')\"></sd-inform>\n }\n </section>\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 QUY T\u1EAEC \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('rules') {\n @if (_field) {\n @switch (textSubtype()) {\n @case ('email') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.email' | sdTranslate }}\n </p>\n }\n @case ('url') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.url' | sdTranslate }}\n </p>\n }\n @case ('phone') {\n <p class=\"ins-note\">\n <sd-icon name=\"verified\" size=\"14px\"></sd-icon>{{ 'core.component.form-builder.rule.phone' | sdTranslate }}\n </p>\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.phone-country' | sdTranslate\"\n [items]=\"phoneCountries()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_validation.phoneCountry || NONE\"\n (modelChange)=\"setValidationChoice('phoneCountry', $event)\"></sd-select>\n }\n }\n\n @if (_type === 'number') {\n <div class=\"ins-grid\">\n <!-- why: coalesce + seal on blur \u2014 typing \"1000\" is one undo step, not four. -->\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.min' | sdTranslate\"\n [model]=\"_validation.min\"\n (modelChange)=\"setValidation('min', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.max' | sdTranslate\"\n [model]=\"_validation.max\"\n (modelChange)=\"setValidation('max', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n @if (numberSubtype() === 'decimal' || numberSubtype() === 'currency' || numberSubtype() === 'percent') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [min]=\"0\"\n [max]=\"10\"\n [label]=\"'core.component.form-builder.precision' | sdTranslate\"\n [model]=\"numberPrecision()\"\n (modelChange)=\"set('precision', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n @if (numberSubtype() === 'currency') {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.currency' | sdTranslate\"\n [model]=\"_field['currency'] || 'VND'\"\n (modelChange)=\"set('currency', $event, true)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n @if (numberSubtype() === 'percent') {\n <p class=\"ins-note\">{{ 'core.component.form-builder.rule.percent' | sdTranslate }}</p>\n }\n @if (numberSubtype() === 'integer') {\n <p class=\"ins-note\">{{ 'core.component.form-builder.rule.integer' | sdTranslate }}</p>\n }\n }\n\n @if (_type === 'datetime') {\n <div class=\"ins-grid\">\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.min' | sdTranslate\"\n required\n class=\"ins-fixed-select\"\n [items]=\"minDateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"dateLimitValue(_validation.min)\"\n (modelChange)=\"setValidationChoice('min', $event)\"></sd-select>\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.max' | sdTranslate\"\n required\n class=\"ins-fixed-select\"\n [items]=\"maxDateChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"dateLimitValue(_validation.max)\"\n (modelChange)=\"setValidationChoice('max', $event)\"></sd-select>\n </div>\n }\n\n @if (supportsLength()) {\n <div class=\"ins-grid\">\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.minlength' | sdTranslate\"\n [model]=\"_validation.minLength\"\n (modelChange)=\"setValidation('minLength', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.maxlength' | sdTranslate\"\n [model]=\"_validation.maxLength\"\n (modelChange)=\"setValidation('maxLength', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n }\n\n @if (_type === 'chip-string' || _type === 'chip-calendar') {\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.max-items' | sdTranslate\"\n [model]=\"_validation.maxItems\"\n (modelChange)=\"setValidation('maxItems', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n }\n\n @if (_type === 'upload') {\n <div class=\"ins-grid\">\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [precision]=\"0\"\n [label]=\"'core.component.form-builder.max-files' | sdTranslate\"\n [model]=\"_field['maxFiles']\"\n (modelChange)=\"set('maxFiles', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n <sd-input-number\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n type=\"positive\"\n [label]=\"'core.component.form-builder.size-mb' | sdTranslate\"\n [model]=\"_field['maxSizeMb']\"\n (modelChange)=\"set('maxSizeMb', numberOrNull($event), true)\"\n (sdBlur)=\"sealHistory()\"></sd-input-number>\n </div>\n @if (_field['accept'] !== 'image') {\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.format-example' | sdTranslate\"\n [model]=\"extensionsText()\"\n (modelChange)=\"setExtensions($event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n }\n }\n\n @if (_type === 'textfield' && textSubtype() !== 'password') {\n <details class=\"ins-details\" [open]=\"!!_validation.pattern\">\n <summary>{{ 'core.component.form-builder.rule.advanced-pattern' | sdTranslate }}</summary>\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.pattern' | sdTranslate\"\n [inlineError]=\"patternError()\"\n [model]=\"_validation.pattern?.value\"\n (modelChange)=\"setPattern('value', $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n <sd-input\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n [label]=\"'core.component.form-builder.pattern-message' | sdTranslate\"\n [model]=\"_validation.pattern?.message\"\n (modelChange)=\"setPattern('message', $event)\"\n (sdBlur)=\"sealHistory()\"></sd-input>\n </details>\n }\n\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.state' | sdTranslate }}</h3>\n @if (supportsDisabled()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.disabled' | sdTranslate\"\n [model]=\"!!_field['disabled']\"\n (modelChange)=\"setFlag('disabled', $event)\"></fb-toggle-row>\n }\n @if (supportsViewed()) {\n <fb-toggle-row\n [label]=\"'core.component.form-builder.read-only-mode' | sdTranslate\"\n [hint]=\"'core.component.form-builder.read-only-mode.hint' | sdTranslate\"\n [model]=\"!!_field['viewed']\"\n (modelChange)=\"setFlag('viewed', $event)\"></fb-toggle-row>\n }\n <fb-toggle-row\n [label]=\"'core.component.form-builder.hide' | sdTranslate\"\n [model]=\"!!_field['hidden']\"\n (modelChange)=\"setFlag('hidden', $event)\"></fb-toggle-row>\n @if (_field['hidden']) {\n <p class=\"ins-note\">{{ 'core.component.form-builder.hidden-note' | sdTranslate }}</p>\n }\n </section>\n\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.conditions' | sdTranslate }}</h3>\n <attribute-expression\n [label]=\"'core.component.form-builder.visible-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.visible\"\n (sdChange)=\"setRule('visible', $event)\"></attribute-expression>\n <attribute-expression\n [label]=\"'core.component.form-builder.hidden-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.hidden\"\n (sdChange)=\"setRule('hidden', $event)\"></attribute-expression>\n @if (supportsDisabled() && !_field['disabled']) {\n <attribute-expression\n [label]=\"'core.component.form-builder.disabled-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.disabled\"\n (sdChange)=\"setRule('disabled', $event)\"></attribute-expression>\n }\n @if (supportsRequired() && !_validation.required) {\n <attribute-expression\n [label]=\"'core.component.form-builder.required-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.required\"\n (sdChange)=\"setRule('required', $event)\"></attribute-expression>\n }\n </section>\n } @else if (_group) {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.state' | sdTranslate }}</h3>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.hide' | sdTranslate\"\n [model]=\"!!_group.hidden\"\n (modelChange)=\"setFlag('hidden', $event)\"></fb-toggle-row>\n <p class=\"ins-note\">{{ 'core.component.form-builder.group-rules-note' | sdTranslate }}</p>\n </section>\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.conditions' | sdTranslate }}</h3>\n <attribute-expression\n [label]=\"'core.component.form-builder.visible-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.visible\"\n (sdChange)=\"setRule('visible', $event)\"></attribute-expression>\n <attribute-expression\n [label]=\"'core.component.form-builder.hidden-when' | sdTranslate\"\n [elements]=\"elements()\"\n [variables]=\"variables()\"\n [model]=\"_rules.hidden\"\n (sdChange)=\"setRule('hidden', $event)\"></attribute-expression>\n </section>\n }\n }\n\n <!-- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 B\u1ED0 C\u1EE4C \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n @case ('layout') {\n @let _location = location();\n @let _siblings = store.childrenOf(_location?.parentId ?? null).length;\n @if (_field) {\n @let _viewport = viewport();\n @let _viewportLabel = 'core.component.form-builder.viewport.' + _viewport | sdTranslate;\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.layout.size' | sdTranslate }}</h3>\n <!-- why: span s\u1EEDa theo M\u1EE8C \u0110ANG XEM (thanh c\u00F4ng c\u1EE5 Desktop | Tablet | Mobile). M\u1EE9c ch\u01B0a t\u1EF1\n khai b\u00E1o hi\u1EC7n nh\u00E3n k\u1EBF th\u1EEBa; \"V\u1EC1 k\u1EBF th\u1EEBa\" xo\u00E1 span c\u1EE7a ri\u00EAng m\u1EE9c \u0111\u00F3. -->\n <div class=\"ins-key\">\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.span.at' | sdTranslate: { viewport: _viewportLabel }\"\n [items]=\"columnChoices\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"span()\"\n (modelChange)=\"setSpan($event)\"></sd-select>\n <sd-button\n type=\"outline\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"restart_alt\"\n [disabled]=\"spanSource() !== 'own'\"\n [title]=\"'core.component.form-builder.span.clear' | sdTranslate\"\n (click)=\"clearSpan()\"></sd-button>\n </div>\n <p class=\"ins-note ins-note--span\">\n @if (inheritedLabel(); as _inherited) {\n <span class=\"ins-badge\">{{ _inherited }}</span>\n }\n <span>{{ spanSummary() }}</span>\n </p>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.new-row' | sdTranslate\"\n [hint]=\"'core.component.form-builder.new-row.hint' | sdTranslate\"\n [model]=\"newRow()\"\n (modelChange)=\"setNewRow($event)\"></fb-toggle-row>\n @if (_type === 'radio') {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.direction' | sdTranslate\"\n [items]=\"directions()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_field['direction'] || 'row'\"\n (modelChange)=\"set('direction', $event)\"></sd-select>\n }\n </section>\n } @else if (_group) {\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.layout.display' | sdTranslate }}</h3>\n <fb-toggle-row\n [label]=\"'core.component.form-builder.collapsible' | sdTranslate\"\n [model]=\"!!_group.collapsible\"\n (modelChange)=\"setCollapsible($event)\"></fb-toggle-row>\n <p class=\"ins-note\">{{ 'core.component.form-builder.group-full-width' | sdTranslate }}</p>\n </section>\n }\n <section class=\"ins-section\">\n <h3 class=\"ins-section__title\">{{ 'core.component.form-builder.position' | sdTranslate }}</h3>\n <div class=\"ins-row\">\n <span class=\"ins-row__label\" [id]=\"orderLabelId\">{{ 'core.component.form-builder.order' | sdTranslate }}</span>\n <div class=\"ins-stepper\" role=\"group\" [attr.aria-labelledby]=\"orderLabelId\">\n <button\n type=\"button\"\n class=\"ins-stepper__btn\"\n [disabled]=\"(_location?.index ?? 0) === 0\"\n [attr.aria-label]=\"'core.component.form-builder.move-up' | sdTranslate\"\n [matTooltip]=\"'core.component.form-builder.move-up' | sdTranslate\"\n (click)=\"store.moveBy(_item.id, -1)\">\n <sd-icon name=\"arrow_upward\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n class=\"ins-stepper__btn\"\n [disabled]=\"(_location?.index ?? 0) >= _siblings - 1\"\n [attr.aria-label]=\"'core.component.form-builder.move-down' | sdTranslate\"\n [matTooltip]=\"'core.component.form-builder.move-down' | sdTranslate\"\n (click)=\"store.moveBy(_item.id, 1)\">\n <sd-icon name=\"arrow_downward\" size=\"18px\"></sd-icon>\n </button>\n </div>\n </div>\n @if (_field) {\n @if (containerChoices().length > 1) {\n <sd-select\n size=\"sm\"\n labelPlacement=\"top\"\n hideInlineError\n required\n class=\"ins-fixed-select\"\n [label]=\"'core.component.form-builder.container' | sdTranslate\"\n [items]=\"containerChoices()\"\n valueField=\"value\"\n displayField=\"display\"\n [model]=\"_location?.parentId || NONE\"\n (modelChange)=\"moveToContainer($event)\"></sd-select>\n }\n } @else if (_group) {\n <sd-button\n type=\"outline\"\n color=\"secondary\"\n size=\"sm\"\n block\n prefixIcon=\"call_split\"\n [disabled]=\"!_group.elements?.length\"\n [title]=\"'core.component.form-builder.ungroup' | sdTranslate\"\n (click)=\"store.ungroup(_group.id)\"></sd-button>\n }\n </section>\n }\n }\n </div>\n }\n\n <div class=\"ins-foot\">\n <sd-button\n type=\"light\"\n color=\"error\"\n size=\"sm\"\n block\n prefixIcon=\"delete\"\n [title]=\"'core.component.form-builder.delete' | sdTranslate\"\n (click)=\"remove()\"></sd-button>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column;min-height:0;height:100%}.ins-empty{display:flex;flex-direction:column;min-height:0;flex:1}.ins-head{display:flex;align-items:center;gap:10px;flex:0 0 auto;padding:14px 16px 10px}.ins-head__icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:32px;height:32px;border-radius:var(--sd-radius-8, 8px);background:color-mix(in srgb,var(--sd-primary) 10%,var(--sd-surface));color:var(--sd-primary)}.ins-head__text{flex:1;min-width:0}.ins-head__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text);font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.ins-head__sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px)}.ins-empty .ins-head__sub{white-space:normal}.ins-mono{font-family:Roboto Mono,ui-monospace,monospace}.ins-badge{flex:0 0 auto;padding:2px 8px;border-radius:var(--sd-radius-999, 999px);background:color-mix(in srgb,var(--sd-primary) 8%,var(--sd-surface));color:var(--sd-primary);font-size:var(--sd-font-size-11, 11px)}.ins-tabs{display:flex;flex:0 0 auto;gap:2px;padding:0 12px;border-bottom:1px solid var(--sd-border);overflow-x:auto}.ins-tabs__tab{position:relative;flex:0 0 auto;padding:10px 10px 9px;border:0;background:transparent;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer}.ins-tabs__tab.is-active{color:var(--sd-primary)}.ins-tabs__tab.is-active:after{content:\"\";position:absolute;left:6px;right:6px;bottom:-1px;height:2px;border-radius:2px;background:var(--sd-primary)}.ins-tabs__tab:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:-2px}.ins-body{display:flex;flex-direction:column;gap:12px;flex:1;min-height:0;overflow-x:hidden;overflow-y:auto;padding:14px 16px 16px}.ins-body>*{min-width:0}.ins-body ::ng-deep .mat-mdc-form-field{width:100%;min-width:0}.ins-body ::ng-deep .mat-mdc-form-field-infix{width:auto;min-width:0}.ins-foot{flex:0 0 auto;padding:6px 8px;border-top:1px solid var(--sd-border)}.ins-section{display:flex;flex-direction:column;gap:12px;margin-top:6px}.ins-section>*{min-width:0}.ins-section__title{display:flex;align-items:center;gap:8px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-semibold, 600);letter-spacing:.06em;line-height:var(--sd-line-height-16, 16px);text-transform:uppercase}.ins-section__title:after{content:\"\";flex:1 1 auto;height:1px;background:var(--sd-border)}.ins-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.ins-field{display:flex;flex-direction:column;gap:6px}.ins-field__label{color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.ins-note{display:flex;gap:6px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.ins-note sd-icon{flex:0 0 auto;color:var(--sd-success)}.ins-note--success{color:var(--sd-success)}.ins-warning{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-radius:var(--sd-radius-6, 6px);background:var(--sd-status-warning-bg, var(--sd-warning-light));color:var(--sd-status-warning-fg, var(--sd-warning-dark));font-size:var(--sd-font-size-12, 12px)}.ins-key{display:flex;align-items:flex-end;gap:8px}.ins-key sd-input,.ins-key sd-select{flex:1;min-width:0}.ins-note--span{align-items:center;flex-wrap:wrap}.ins-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:32px}.ins-row__label{color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-medium, 500)}.ins-stepper{display:inline-flex;border:1px solid var(--sd-border);border-radius:var(--sd-radius-6, 6px);overflow:hidden}.ins-stepper__btn{display:inline-flex;align-items:center;justify-content:center;width:36px;height:30px;padding:0;border:0;background:var(--sd-surface);color:var(--sd-text);cursor:pointer}.ins-stepper__btn+.ins-stepper__btn{border-left:1px solid var(--sd-border)}.ins-stepper__btn:hover:not(:disabled){background:var(--sd-surface-muted)}.ins-stepper__btn:disabled{opacity:.4;cursor:default}.ins-stepper__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:-2px}.ins-card{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:12px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px)}.ins-card__row{display:flex;align-items:center;justify-content:space-between;width:100%;color:var(--sd-text);font-weight:var(--sd-font-weight-medium, 500)}.ins-count{min-width:24px;padding:0 6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-surface-muted);color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);text-align:center}.ins-details{display:flex;flex-direction:column;gap:10px}.ins-details>summary{color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer}.ins-details>summary:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}.ins-details[open]>summary{margin-bottom:10px}.ins-details>sd-input+sd-input{margin-top:10px}.ins-icons{display:flex;flex-wrap:wrap;gap:6px}.ins-icons__btn{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-6, 6px);background:var(--sd-surface);color:var(--sd-text-secondary);cursor:pointer}.ins-icons__btn.is-active{border-color:var(--sd-primary);background:color-mix(in srgb,var(--sd-primary) 8%,var(--sd-surface));color:var(--sd-primary)}.ins-icons__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}.ins-colors{display:flex;gap:8px}.ins-colors__swatch{width:26px;height:26px;border:2px solid var(--sd-surface);border-radius:50%;box-shadow:0 0 0 1px var(--sd-border);cursor:pointer}.ins-colors__swatch[data-color=primary]{background:var(--sd-primary)}.ins-colors__swatch[data-color=secondary]{background:var(--sd-secondary)}.ins-colors__swatch[data-color=info]{background:var(--sd-info)}.ins-colors__swatch[data-color=success]{background:var(--sd-success)}.ins-colors__swatch[data-color=warning]{background:var(--sd-warning)}.ins-colors__swatch[data-color=error]{background:var(--sd-error)}.ins-colors__swatch.is-active{box-shadow:0 0 0 2px var(--sd-text)}.ins-colors__swatch:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:var(--sd-focus-ring-offset, 2px)}.ins-fixed-select ::ng-deep .sd-label__required{display:none}\n"] }]
|
|
4700
4837
|
}], ctorParameters: () => [] });
|
|
4701
4838
|
|
|
4702
4839
|
/**
|
|
@@ -5363,11 +5500,11 @@ class RadioComponent {
|
|
|
5363
5500
|
this.#context.patch(patch);
|
|
5364
5501
|
}
|
|
5365
5502
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: RadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5366
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: RadioComponent, isStandalone: true, selector: "lib-radio", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let item = field();\n<sd-radio\n [form]=\"form()\"\n [label]=\"item.label || item.key\"\n [name]=\"item.key\"\n [autoId]=\"item.key\"\n [model]=\"value()\"\n (modelChange)=\"select($event)\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n [items]=\"items()\"\n valueField=\"value\"\n displayField=\"label\"\n [display]=\"item.direction || 'row'\"\n [viewed]=\"viewed()\"\n [hyperlink]=\"item.hyperlink | hyperlink: scope()\"></sd-radio>\n", styles: [":host{display:contents;width:100%}\n"], dependencies: [{ kind: "component", type: SdRadio, selector: "sd-radio", inputs: ["autoId", "name", "form", "label", "placeholder", "display", "items", "valueField", "displayField", "required", "inlineError", "disabled", "viewed", "color", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "pipe", type: HyperlinkPipe, name: "hyperlink" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5503
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: RadioComponent, isStandalone: true, selector: "lib-radio", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let item = field();\n<sd-radio\n [form]=\"form()\"\n [label]=\"item.label || item.key\"\n [name]=\"item.key\"\n [autoId]=\"item.key\"\n [model]=\"value()\"\n (modelChange)=\"select($event)\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n [items]=\"items()\"\n valueField=\"value\"\n displayField=\"label\"\n [display]=\"item.direction || 'row'\"\n [viewed]=\"viewed()\"\n [hyperlink]=\"item.hyperlink | hyperlink: scope()\"></sd-radio>\n", styles: [":host{display:contents;width:100%}:host ::ng-deep .c-radio-group-row{flex-wrap:wrap;row-gap:4px}:host ::ng-deep .mat-mdc-radio-button{min-width:0;max-width:100%}:host ::ng-deep .mdc-form-field{max-width:100%}:host ::ng-deep .mdc-label{white-space:normal;overflow-wrap:anywhere}\n"], dependencies: [{ kind: "component", type: SdRadio, selector: "sd-radio", inputs: ["autoId", "name", "form", "label", "placeholder", "display", "items", "valueField", "displayField", "required", "inlineError", "disabled", "viewed", "color", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "pipe", type: HyperlinkPipe, name: "hyperlink" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5367
5504
|
}
|
|
5368
5505
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: RadioComponent, decorators: [{
|
|
5369
5506
|
type: Component,
|
|
5370
|
-
args: [{ selector: 'lib-radio', changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdRadio, HyperlinkPipe], template: "@let item = field();\n<sd-radio\n [form]=\"form()\"\n [label]=\"item.label || item.key\"\n [name]=\"item.key\"\n [autoId]=\"item.key\"\n [model]=\"value()\"\n (modelChange)=\"select($event)\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n [items]=\"items()\"\n valueField=\"value\"\n displayField=\"label\"\n [display]=\"item.direction || 'row'\"\n [viewed]=\"viewed()\"\n [hyperlink]=\"item.hyperlink | hyperlink: scope()\"></sd-radio>\n", styles: [":host{display:contents;width:100%}\n"] }]
|
|
5507
|
+
args: [{ selector: 'lib-radio', changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdRadio, HyperlinkPipe], template: "@let item = field();\n<sd-radio\n [form]=\"form()\"\n [label]=\"item.label || item.key\"\n [name]=\"item.key\"\n [autoId]=\"item.key\"\n [model]=\"value()\"\n (modelChange)=\"select($event)\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n [items]=\"items()\"\n valueField=\"value\"\n displayField=\"label\"\n [display]=\"item.direction || 'row'\"\n [viewed]=\"viewed()\"\n [hyperlink]=\"item.hyperlink | hyperlink: scope()\"></sd-radio>\n", styles: [":host{display:contents;width:100%}:host ::ng-deep .c-radio-group-row{flex-wrap:wrap;row-gap:4px}:host ::ng-deep .mat-mdc-radio-button{min-width:0;max-width:100%}:host ::ng-deep .mdc-form-field{max-width:100%}:host ::ng-deep .mdc-label{white-space:normal;overflow-wrap:anywhere}\n"] }]
|
|
5371
5508
|
}], ctorParameters: () => [] });
|
|
5372
5509
|
|
|
5373
5510
|
class CheckboxComponent {
|
|
@@ -5481,6 +5618,59 @@ class LibItemComponent {
|
|
|
5481
5618
|
field = input.required();
|
|
5482
5619
|
state = input.required();
|
|
5483
5620
|
form = input.required();
|
|
5621
|
+
#registrations = new WeakMap();
|
|
5622
|
+
registrationForm = computed(() => this.#registration(this.form()).form);
|
|
5623
|
+
registeredControl() {
|
|
5624
|
+
const group = this.form();
|
|
5625
|
+
const name = this.field().key;
|
|
5626
|
+
const entry = name ? this.#registration(group).controls.get(name) : undefined;
|
|
5627
|
+
return name && entry && Object.hasOwn(group.controls, name) && group.controls[name] === entry.control ? entry.control : null;
|
|
5628
|
+
}
|
|
5629
|
+
#registration(group) {
|
|
5630
|
+
const known = this.#registrations.get(group);
|
|
5631
|
+
if (known)
|
|
5632
|
+
return known;
|
|
5633
|
+
const controls = new Map();
|
|
5634
|
+
const methods = new Map();
|
|
5635
|
+
const form = new Proxy(group, {
|
|
5636
|
+
get: (target, property) => {
|
|
5637
|
+
const value = Reflect.get(target, property, target);
|
|
5638
|
+
if (typeof value !== 'function' || property === 'constructor')
|
|
5639
|
+
return value;
|
|
5640
|
+
const cached = methods.get(property);
|
|
5641
|
+
if (cached && cached.original === value)
|
|
5642
|
+
return cached.bound;
|
|
5643
|
+
const bound = (...args) => {
|
|
5644
|
+
const mutation = property === 'addControl' || property === 'registerControl' || property === 'setControl' || property === 'removeControl';
|
|
5645
|
+
const name = mutation && typeof args[0] === 'string' ? args[0] : undefined;
|
|
5646
|
+
const hadBefore = !!name && Object.hasOwn(target.controls, name);
|
|
5647
|
+
const before = name ? target.controls[name] : undefined;
|
|
5648
|
+
const entry = name ? controls.get(name) : undefined;
|
|
5649
|
+
const result = Reflect.apply(value, target, args);
|
|
5650
|
+
if (!name)
|
|
5651
|
+
return result;
|
|
5652
|
+
const hasAfter = Object.hasOwn(target.controls, name);
|
|
5653
|
+
const after = target.controls[name];
|
|
5654
|
+
if (!hasAfter)
|
|
5655
|
+
controls.delete(name);
|
|
5656
|
+
else if (entry && before === entry.control && entry.hadOriginal && after === entry.original)
|
|
5657
|
+
controls.delete(name);
|
|
5658
|
+
else if (property !== 'removeControl' && after === args[1] && after !== before) {
|
|
5659
|
+
controls.set(name, entry && before === entry.control
|
|
5660
|
+
? { ...entry, control: after }
|
|
5661
|
+
: { control: after, hadOriginal: hadBefore, original: before });
|
|
5662
|
+
}
|
|
5663
|
+
return result;
|
|
5664
|
+
};
|
|
5665
|
+
methods.set(property, { original: value, bound });
|
|
5666
|
+
return bound;
|
|
5667
|
+
},
|
|
5668
|
+
set: (target, property, value) => Reflect.set(target, property, value, target),
|
|
5669
|
+
});
|
|
5670
|
+
const registration = { form, controls };
|
|
5671
|
+
this.#registrations.set(group, registration);
|
|
5672
|
+
return registration;
|
|
5673
|
+
}
|
|
5484
5674
|
#context = inject(FormRenderContext);
|
|
5485
5675
|
/**
|
|
5486
5676
|
* Bắt buộc có hiệu lực. why: field chỉ xem không được validate — người dùng không sửa được nó, và
|
|
@@ -5494,11 +5684,31 @@ class LibItemComponent {
|
|
|
5494
5684
|
await this.uploader()?.upload();
|
|
5495
5685
|
}
|
|
5496
5686
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LibItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5497
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: LibItemComponent, isStandalone: true, selector: "lib-item", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null } },
|
|
5687
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: LibItemComponent, isStandalone: true, selector: "lib-item", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
|
|
5688
|
+
{
|
|
5689
|
+
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
|
|
5690
|
+
// Wrapped helper/error text contributes its real height to the renderer grid. Keep the
|
|
5691
|
+
// consumer's other Material defaults and leave controls outside this private item unchanged.
|
|
5692
|
+
useFactory: () => ({
|
|
5693
|
+
...inject(MAT_FORM_FIELD_DEFAULT_OPTIONS, { skipSelf: true, optional: true }),
|
|
5694
|
+
subscriptSizing: 'dynamic',
|
|
5695
|
+
}),
|
|
5696
|
+
},
|
|
5697
|
+
], viewQueries: [{ propertyName: "uploader", first: true, predicate: UploadComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@let item = field();\n@switch (item.type) {\n @case ('textfield') {\n <lib-textfield [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-textfield>\n }\n @case ('textarea') {\n <lib-textarea [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-textarea>\n }\n @case ('number') {\n <lib-number [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-number>\n }\n @case ('select') {\n <lib-select [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-select>\n }\n @case ('radio') {\n <lib-radio [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-radio>\n }\n @case ('checkbox') {\n <lib-checkbox [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-checkbox>\n }\n @case ('datetime') {\n <lib-datetime [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-datetime>\n }\n @case ('chip-string') {\n <lib-chip-string [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-chip-string>\n }\n @case ('chip-calendar') {\n <lib-chip-calendar [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-chip-calendar>\n }\n @case ('upload') {\n <lib-upload [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-upload>\n }\n @case ('html') {\n <lib-html [field]=\"item\"></lib-html>\n }\n}\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: TextfieldComponent, selector: "lib-textfield", inputs: ["field", "form", "disabled", "required"] }, { kind: "component", type: TextareaComponent, selector: "lib-textarea", inputs: ["field", "form", "disabled", "required"] }, { kind: "component", type: ChipStringComponent, selector: "lib-chip-string", inputs: ["field", "form", "disabled", "required"] }, { kind: "component", type: ChipCalendarComponent, selector: "lib-chip-calendar", inputs: ["field", "form", "disabled", "required"] }, { kind: "component", type: NumberComponent, selector: "lib-number", inputs: ["field", "form", "disabled", "required"] }, { kind: "component", type: DatetimeComponent, selector: "lib-datetime", inputs: ["field", "form", "disabled", "required"] }, { kind: "component", type: SelectComponent, selector: "lib-select", inputs: ["field", "form", "disabled", "required"] }, { kind: "component", type: RadioComponent, selector: "lib-radio", inputs: ["field", "form", "disabled", "required"] }, { kind: "component", type: CheckboxComponent, selector: "lib-checkbox", inputs: ["field", "form", "disabled", "required"] }, { kind: "component", type: UploadComponent, selector: "lib-upload", inputs: ["field", "form", "disabled", "required"] }, { kind: "component", type: HtmlComponent, selector: "lib-html", inputs: ["field"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5498
5698
|
}
|
|
5499
5699
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LibItemComponent, decorators: [{
|
|
5500
5700
|
type: Component,
|
|
5501
|
-
args: [{ selector: 'lib-item', changeDetection: ChangeDetectionStrategy.OnPush,
|
|
5701
|
+
args: [{ selector: 'lib-item', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
5702
|
+
{
|
|
5703
|
+
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
|
|
5704
|
+
// Wrapped helper/error text contributes its real height to the renderer grid. Keep the
|
|
5705
|
+
// consumer's other Material defaults and leave controls outside this private item unchanged.
|
|
5706
|
+
useFactory: () => ({
|
|
5707
|
+
...inject(MAT_FORM_FIELD_DEFAULT_OPTIONS, { skipSelf: true, optional: true }),
|
|
5708
|
+
subscriptSizing: 'dynamic',
|
|
5709
|
+
}),
|
|
5710
|
+
},
|
|
5711
|
+
], imports: [
|
|
5502
5712
|
TextfieldComponent,
|
|
5503
5713
|
TextareaComponent,
|
|
5504
5714
|
ChipStringComponent,
|
|
@@ -5510,11 +5720,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
5510
5720
|
CheckboxComponent,
|
|
5511
5721
|
UploadComponent,
|
|
5512
5722
|
HtmlComponent,
|
|
5513
|
-
], template: "@let item = field();\n@switch (item.type) {\n @case ('textfield') {\n <lib-textfield [field]=\"item\" [form]=\"
|
|
5723
|
+
], template: "@let item = field();\n@switch (item.type) {\n @case ('textfield') {\n <lib-textfield [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-textfield>\n }\n @case ('textarea') {\n <lib-textarea [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-textarea>\n }\n @case ('number') {\n <lib-number [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-number>\n }\n @case ('select') {\n <lib-select [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-select>\n }\n @case ('radio') {\n <lib-radio [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-radio>\n }\n @case ('checkbox') {\n <lib-checkbox [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-checkbox>\n }\n @case ('datetime') {\n <lib-datetime [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-datetime>\n }\n @case ('chip-string') {\n <lib-chip-string [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-chip-string>\n }\n @case ('chip-calendar') {\n <lib-chip-calendar [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-chip-calendar>\n }\n @case ('upload') {\n <lib-upload [field]=\"item\" [form]=\"registrationForm()\" [required]=\"required()\" [disabled]=\"state().disabled\"></lib-upload>\n }\n @case ('html') {\n <lib-html [field]=\"item\"></lib-html>\n }\n}\n", styles: [":host{display:block}\n"] }]
|
|
5514
5724
|
}] });
|
|
5515
5725
|
|
|
5516
5726
|
/** Chu kỳ (ms) kiểm tra lại `pending` khi chờ validator bất đồng bộ trong `validate()`. */
|
|
5517
5727
|
const PENDING_POLL_MS = 20;
|
|
5728
|
+
let nextRenderId = 0;
|
|
5518
5729
|
/**
|
|
5519
5730
|
* Đặt từng phần tử của hàng vào lưới: hàng `i` → `grid-row: i + 1`, cột bắt đầu sau các ô đứng trước.
|
|
5520
5731
|
*
|
|
@@ -5554,6 +5765,22 @@ class SdFormRender {
|
|
|
5554
5765
|
labelPlacement = input('top');
|
|
5555
5766
|
/** Chỉ render field có key trong danh sách; `null` = mọi field. */
|
|
5556
5767
|
keys = input(null);
|
|
5768
|
+
/** Active visible page. Consumer forward writes use the same linear gate as Next/header clicks. */
|
|
5769
|
+
activePageId = model(null);
|
|
5770
|
+
/** A forward transition is waiting for predecessor validators; backward navigation remains available. */
|
|
5771
|
+
navigationPending = signal(false);
|
|
5772
|
+
navigationTip = signal(false);
|
|
5773
|
+
#pendingNavigationSnapshot = null;
|
|
5774
|
+
effectivePageId = signal(null);
|
|
5775
|
+
focusedPageId = signal(null);
|
|
5776
|
+
#host = inject(ElementRef);
|
|
5777
|
+
#renderId = `sd-form-pages-${++nextRenderId}`;
|
|
5778
|
+
#revision = 0;
|
|
5779
|
+
#pageRevision = 0;
|
|
5780
|
+
#validationAttempt = 0;
|
|
5781
|
+
#alive = true;
|
|
5782
|
+
#initialized = false;
|
|
5783
|
+
#pageOrder = [];
|
|
5557
5784
|
#config = inject(SD_FORM_GENERIC_CONFIG);
|
|
5558
5785
|
#i18n = inject(I18nService);
|
|
5559
5786
|
#ownForm = new FormGroup({});
|
|
@@ -5563,6 +5790,8 @@ class SdFormRender {
|
|
|
5563
5790
|
// why: signal queries cannot live on ES `#private` members (NG1053).
|
|
5564
5791
|
grid = viewChild('grid');
|
|
5565
5792
|
items = viewChildren(LibItemComponent);
|
|
5793
|
+
pageTabs = viewChild(SdTabGroup);
|
|
5794
|
+
pageStepper = viewChild(SdStepper);
|
|
5566
5795
|
formGroup = computed(() => this.form() ?? this.#ownForm);
|
|
5567
5796
|
normalized = computed(() => sdNormalizeSchema(this.schema()));
|
|
5568
5797
|
#fieldTypes = computed(() => sdFilterFieldTypes(this.normalized()));
|
|
@@ -5575,13 +5804,31 @@ class SdFormRender {
|
|
|
5575
5804
|
const keys = this.keys();
|
|
5576
5805
|
return keys ? new Set(keys) : null;
|
|
5577
5806
|
});
|
|
5578
|
-
|
|
5807
|
+
navigation = computed(() => this.normalized().navigation);
|
|
5808
|
+
visiblePages = computed(() => {
|
|
5809
|
+
const schema = this.normalized();
|
|
5810
|
+
return schema.navigation
|
|
5811
|
+
? schema.pages.filter(page => sdElementState(page, this.scope(), this.#fieldTypes()).visible)
|
|
5812
|
+
: schema.pages.slice(0, 1);
|
|
5813
|
+
});
|
|
5814
|
+
activeIndex = computed(() => this.visiblePages().findIndex(page => page.id === this.effectivePageId()));
|
|
5815
|
+
/** Eager page regions retain visible controls even before a page is visited. */
|
|
5816
|
+
pageRegions = computed(() => this.visiblePages().map(page => ({ page, cells: this.#cellsFor(page.elements) })));
|
|
5817
|
+
/** Legacy first-page layout; navigation regions each pack their own page. */
|
|
5579
5818
|
rows = computed(() => this.#pack(this.normalized().pages[0]?.elements ?? []));
|
|
5580
5819
|
/** Ô của lưới theo thứ tự tài liệu (DOM phẳng, vị trí từ `rows`). */
|
|
5581
|
-
cells = computed(() =>
|
|
5582
|
-
|
|
5583
|
-
|
|
5820
|
+
cells = computed(() => this.#cellsFor(this.normalized().pages[0]?.elements ?? []));
|
|
5821
|
+
#cellsFor(elements) {
|
|
5822
|
+
return placeCells(this.#pack(elements)).map(({ node, row, column }) => node.kind === 'group'
|
|
5823
|
+
? { kind: 'group', id: node.id, row, column, group: node.group, children: placeCells(node.rows).map(fieldCell) }
|
|
5824
|
+
: fieldCell({ node, row, column }));
|
|
5825
|
+
}
|
|
5584
5826
|
constructor() {
|
|
5827
|
+
inject(DestroyRef).onDestroy(() => {
|
|
5828
|
+
this.#alive = false;
|
|
5829
|
+
this.#revision++;
|
|
5830
|
+
this.#validationAttempt++;
|
|
5831
|
+
});
|
|
5585
5832
|
const context = inject(FormRenderContext);
|
|
5586
5833
|
context.labelPlacement = this.labelPlacement;
|
|
5587
5834
|
context.viewed = this.viewed;
|
|
@@ -5590,6 +5837,31 @@ class SdFormRender {
|
|
|
5590
5837
|
context.scope = this.scope;
|
|
5591
5838
|
context.level = this.level;
|
|
5592
5839
|
context.patch = patch => this.value.set({ ...this.#value(), ...patch });
|
|
5840
|
+
effect(() => {
|
|
5841
|
+
// Invalidate async attempts whenever their schema, value or registration scope changes.
|
|
5842
|
+
this.normalized();
|
|
5843
|
+
this.#value();
|
|
5844
|
+
this.#variables();
|
|
5845
|
+
this.keys();
|
|
5846
|
+
this.viewed();
|
|
5847
|
+
this.formGroup();
|
|
5848
|
+
untracked(() => {
|
|
5849
|
+
this.navigationTip.set(false);
|
|
5850
|
+
// A native input can start navigation before its value effect runs. The request already
|
|
5851
|
+
// owns that value snapshot; only a later, different dependency snapshot invalidates it.
|
|
5852
|
+
if (this.navigationPending() && this.#pendingNavigationSnapshot && this.#matches(this.#pendingNavigationSnapshot))
|
|
5853
|
+
return;
|
|
5854
|
+
this.#revision++;
|
|
5855
|
+
this.#validationAttempt++;
|
|
5856
|
+
this.navigationPending.set(false);
|
|
5857
|
+
this.#pendingNavigationSnapshot = null;
|
|
5858
|
+
});
|
|
5859
|
+
});
|
|
5860
|
+
effect(() => {
|
|
5861
|
+
const pages = this.visiblePages();
|
|
5862
|
+
const request = this.activePageId();
|
|
5863
|
+
untracked(() => this.#reconcile(pages, request));
|
|
5864
|
+
});
|
|
5593
5865
|
// why: defaults fill keys that are still undefined whenever schema, value or view mode change;
|
|
5594
5866
|
// when nothing is missing the effect writes nothing, so it cannot loop.
|
|
5595
5867
|
effect(() => {
|
|
@@ -5616,13 +5888,20 @@ class SdFormRender {
|
|
|
5616
5888
|
* Luôn trả `{ valid, messages: { error, warning } }`; chỉ lỗi làm `valid = false`.
|
|
5617
5889
|
*/
|
|
5618
5890
|
async validate() {
|
|
5891
|
+
const pageRevision = this.#pageRevision;
|
|
5892
|
+
// Consumer model writes may reveal a page in this turn, before descendants register.
|
|
5893
|
+
// Let the scheduled render/registration finish before touching and reading the FormGroup.
|
|
5894
|
+
await firstValueFrom(timer(0));
|
|
5895
|
+
const attempt = ++this.#validationAttempt;
|
|
5896
|
+
const revision = this.#revision;
|
|
5897
|
+
const snapshot = this.#snapshot();
|
|
5619
5898
|
const form = this.formGroup();
|
|
5620
5899
|
form.markAllAsTouched();
|
|
5621
5900
|
// why: an async validator started with `emitEvent: false` (control connector, model sync of sd-input)
|
|
5622
5901
|
// finishes WITHOUT emitting statusChanges — also re-check `pending` on a short timer so this cannot hang.
|
|
5623
|
-
while (form.pending)
|
|
5902
|
+
while (form.pending && this.#alive && revision === this.#revision && this.#matches(snapshot) && attempt === this.#validationAttempt)
|
|
5624
5903
|
await firstValueFrom(race(form.statusChanges, timer(PENDING_POLL_MS)));
|
|
5625
|
-
const fieldsValid = form.status
|
|
5904
|
+
const fieldsValid = this.#itemsReadyFor(this.visiblePages()) && (form.status === 'VALID' || form.status === 'DISABLED');
|
|
5626
5905
|
const result = await sdRunFormValidations(this.normalized().validations, {
|
|
5627
5906
|
value: this.#value(),
|
|
5628
5907
|
variables: this.#variables(),
|
|
@@ -5631,8 +5910,252 @@ class SdFormRender {
|
|
|
5631
5910
|
unregisteredMessage: id => this.#i18n.t('core.component.form-generic.validation.unregistered', { id }),
|
|
5632
5911
|
failedMessage: id => this.#i18n.t('core.component.form-generic.validation.failed', { id }),
|
|
5633
5912
|
});
|
|
5913
|
+
if (!fieldsValid &&
|
|
5914
|
+
this.#alive &&
|
|
5915
|
+
pageRevision === this.#pageRevision &&
|
|
5916
|
+
revision === this.#revision &&
|
|
5917
|
+
this.#matches(snapshot) &&
|
|
5918
|
+
attempt === this.#validationAttempt)
|
|
5919
|
+
this.#revealInvalid(this.visiblePages());
|
|
5634
5920
|
return { valid: fieldsValid && result.valid, messages: result.messages };
|
|
5635
5921
|
}
|
|
5922
|
+
t = (key, params) => this.#i18n.t(key, params);
|
|
5923
|
+
pageLabel(page) {
|
|
5924
|
+
return (page.label || this.t('core.component.form-generic.page', { number: this.normalized().pages.findIndex(p => p.id === page.id) + 1 }));
|
|
5925
|
+
}
|
|
5926
|
+
pageDomId(pageId, part) {
|
|
5927
|
+
return `${this.#renderId}-${part}-${encodeURIComponent(pageId)}`;
|
|
5928
|
+
}
|
|
5929
|
+
onCorePageChange(index) {
|
|
5930
|
+
const page = this.visiblePages()[index];
|
|
5931
|
+
if (!page || index === this.activeIndex())
|
|
5932
|
+
return;
|
|
5933
|
+
// Core headers propose a page; keep the accepted index until the shared async gate finishes.
|
|
5934
|
+
this.pageTabs()?.selectTab(this.activeIndex());
|
|
5935
|
+
this.pageStepper()?.goTo(this.activeIndex());
|
|
5936
|
+
void this.requestPage(page.id);
|
|
5937
|
+
}
|
|
5938
|
+
onCorePageFocus(event) {
|
|
5939
|
+
const header = event.target instanceof Element ? event.target.closest('.mat-mdc-tab,mat-step-header') : null;
|
|
5940
|
+
if (!header)
|
|
5941
|
+
return;
|
|
5942
|
+
const index = this.#pageHeaders().indexOf(header);
|
|
5943
|
+
const page = this.visiblePages()[index];
|
|
5944
|
+
if (page) {
|
|
5945
|
+
header.dataset['pageButton'] = page.id;
|
|
5946
|
+
this.focusedPageId.set(page.id);
|
|
5947
|
+
}
|
|
5948
|
+
}
|
|
5949
|
+
#pageHeaders() {
|
|
5950
|
+
return Array.from(this.#host.nativeElement.querySelectorAll('.sd-fg-navigation .mat-mdc-tab,.sd-fg-navigation mat-step-header'));
|
|
5951
|
+
}
|
|
5952
|
+
/** Shared navigation gate for consumer model writes, page headers and Next. */
|
|
5953
|
+
async requestPage(pageId) {
|
|
5954
|
+
const pages = this.visiblePages();
|
|
5955
|
+
const target = pages.findIndex(page => page.id === pageId);
|
|
5956
|
+
const current = this.activeIndex();
|
|
5957
|
+
if (target < 0)
|
|
5958
|
+
return;
|
|
5959
|
+
if (target === current) {
|
|
5960
|
+
this.activePageId.set(this.effectivePageId());
|
|
5961
|
+
return;
|
|
5962
|
+
}
|
|
5963
|
+
this.#pageRevision++;
|
|
5964
|
+
const navigation = this.navigation();
|
|
5965
|
+
if (target < current || navigation?.type !== 'steps' || !navigation.linear) {
|
|
5966
|
+
this.#revision++;
|
|
5967
|
+
this.navigationPending.set(false);
|
|
5968
|
+
this.#accept(pageId);
|
|
5969
|
+
return;
|
|
5970
|
+
}
|
|
5971
|
+
if (this.navigationPending()) {
|
|
5972
|
+
this.activePageId.set(this.effectivePageId());
|
|
5973
|
+
return;
|
|
5974
|
+
}
|
|
5975
|
+
const revision = ++this.#revision;
|
|
5976
|
+
const snapshot = this.#snapshot();
|
|
5977
|
+
const predecessors = pages.slice(0, target);
|
|
5978
|
+
this.#pendingNavigationSnapshot = snapshot;
|
|
5979
|
+
this.navigationPending.set(true);
|
|
5980
|
+
// Keep the model at the accepted page while a consumer request is pending or rejected.
|
|
5981
|
+
this.activePageId.set(this.effectivePageId());
|
|
5982
|
+
const currentAttempt = () => this.#alive && revision === this.#revision && this.#matches(snapshot);
|
|
5983
|
+
// Schema/model reconciliation can run before the current page descendants register.
|
|
5984
|
+
if (!this.#itemsReadyFor(predecessors)) {
|
|
5985
|
+
await firstValueFrom(timer(0));
|
|
5986
|
+
if (!currentAttempt())
|
|
5987
|
+
return;
|
|
5988
|
+
if (!this.#itemsReadyFor(predecessors)) {
|
|
5989
|
+
this.navigationPending.set(false);
|
|
5990
|
+
return;
|
|
5991
|
+
}
|
|
5992
|
+
}
|
|
5993
|
+
let controls = predecessors.flatMap(page => this.#controlsFor(page));
|
|
5994
|
+
controls.forEach(control => control.markAsTouched());
|
|
5995
|
+
while (controls.some(control => control.pending) && currentAttempt()) {
|
|
5996
|
+
await firstValueFrom(timer(PENDING_POLL_MS));
|
|
5997
|
+
if (!currentAttempt())
|
|
5998
|
+
return;
|
|
5999
|
+
// A consumer can replace/remove a control without changing the FormGroup or model reference.
|
|
6000
|
+
// Reacquire exact owned registrations so detached PENDING/INVALID controls cannot gate this request.
|
|
6001
|
+
controls = predecessors.flatMap(page => this.#controlsFor(page));
|
|
6002
|
+
controls.forEach(control => control.markAsTouched());
|
|
6003
|
+
}
|
|
6004
|
+
if (!currentAttempt())
|
|
6005
|
+
return;
|
|
6006
|
+
this.navigationPending.set(false);
|
|
6007
|
+
if (controls.some(control => control.invalid)) {
|
|
6008
|
+
this.#revealInvalid(predecessors);
|
|
6009
|
+
this.navigationTip.set(true);
|
|
6010
|
+
}
|
|
6011
|
+
else
|
|
6012
|
+
this.#accept(pageId);
|
|
6013
|
+
}
|
|
6014
|
+
previous() {
|
|
6015
|
+
const page = this.visiblePages()[this.activeIndex() - 1];
|
|
6016
|
+
if (page)
|
|
6017
|
+
void this.requestPage(page.id);
|
|
6018
|
+
}
|
|
6019
|
+
next() {
|
|
6020
|
+
const page = this.visiblePages()[this.activeIndex() + 1];
|
|
6021
|
+
if (page)
|
|
6022
|
+
void this.requestPage(page.id);
|
|
6023
|
+
}
|
|
6024
|
+
onPageKeydown(event, pageId) {
|
|
6025
|
+
const pages = this.visiblePages();
|
|
6026
|
+
const index = pages.findIndex(page => page.id === pageId);
|
|
6027
|
+
let target = index;
|
|
6028
|
+
switch (event.key) {
|
|
6029
|
+
case 'ArrowRight':
|
|
6030
|
+
target = (index + 1) % pages.length;
|
|
6031
|
+
break;
|
|
6032
|
+
case 'ArrowLeft':
|
|
6033
|
+
target = (index + pages.length - 1) % pages.length;
|
|
6034
|
+
break;
|
|
6035
|
+
case 'Home':
|
|
6036
|
+
target = 0;
|
|
6037
|
+
break;
|
|
6038
|
+
case 'End':
|
|
6039
|
+
target = pages.length - 1;
|
|
6040
|
+
break;
|
|
6041
|
+
case 'Enter':
|
|
6042
|
+
case ' ':
|
|
6043
|
+
event.preventDefault();
|
|
6044
|
+
void this.requestPage(pageId);
|
|
6045
|
+
return;
|
|
6046
|
+
default:
|
|
6047
|
+
return;
|
|
6048
|
+
}
|
|
6049
|
+
event.preventDefault();
|
|
6050
|
+
const page = pages[target];
|
|
6051
|
+
if (!page)
|
|
6052
|
+
return;
|
|
6053
|
+
this.focusedPageId.set(page.id);
|
|
6054
|
+
const button = Array.from(this.#host.nativeElement.querySelectorAll('[data-page-button]')).find(element => element.dataset['pageButton'] === page.id);
|
|
6055
|
+
button?.focus();
|
|
6056
|
+
button?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });
|
|
6057
|
+
}
|
|
6058
|
+
#snapshot() {
|
|
6059
|
+
return [this.schema(), this.value(), this.variables(), this.keys(), this.viewed(), this.formGroup()];
|
|
6060
|
+
}
|
|
6061
|
+
#matches(snapshot) {
|
|
6062
|
+
return snapshot.every((value, index) => value === this.#snapshot()[index]);
|
|
6063
|
+
}
|
|
6064
|
+
#accept(pageId) {
|
|
6065
|
+
this.#pendingNavigationSnapshot = null;
|
|
6066
|
+
this.navigationTip.set(false);
|
|
6067
|
+
this.effectivePageId.set(pageId);
|
|
6068
|
+
this.activePageId.set(pageId);
|
|
6069
|
+
this.focusedPageId.set(pageId);
|
|
6070
|
+
}
|
|
6071
|
+
#reconcile(pages, request) {
|
|
6072
|
+
const current = this.effectivePageId();
|
|
6073
|
+
const document = this.#host.nativeElement.ownerDocument;
|
|
6074
|
+
const previousFocus = document.activeElement;
|
|
6075
|
+
const restoreHeaderFocus = !!this.focusedPageId() &&
|
|
6076
|
+
!!previousFocus &&
|
|
6077
|
+
this.#host.nativeElement.contains(previousFocus) &&
|
|
6078
|
+
previousFocus.getAttribute('data-page-button') === this.focusedPageId() &&
|
|
6079
|
+
!pages.some(page => page.id === this.focusedPageId());
|
|
6080
|
+
const nextOrder = this.normalized().pages.map(page => page.id);
|
|
6081
|
+
if (!this.#initialized) {
|
|
6082
|
+
this.#initialized = true;
|
|
6083
|
+
this.#accept(pages.some(page => page.id === request) ? request : (pages[0]?.id ?? null));
|
|
6084
|
+
}
|
|
6085
|
+
else if (!pages.some(page => page.id === current)) {
|
|
6086
|
+
const oldIndex = this.#pageOrder.indexOf(current ?? '');
|
|
6087
|
+
const successor = this.#pageOrder.slice(oldIndex + 1).find(id => pages.some(page => page.id === id));
|
|
6088
|
+
const predecessor = this.#pageOrder
|
|
6089
|
+
.slice(0, Math.max(0, oldIndex))
|
|
6090
|
+
.reverse()
|
|
6091
|
+
.find(id => pages.some(page => page.id === id));
|
|
6092
|
+
this.#revision++;
|
|
6093
|
+
this.navigationPending.set(false);
|
|
6094
|
+
this.#accept(successor ?? predecessor ?? pages[0]?.id ?? null);
|
|
6095
|
+
}
|
|
6096
|
+
else if (request !== current) {
|
|
6097
|
+
if (request && pages.some(page => page.id === request))
|
|
6098
|
+
void this.requestPage(request);
|
|
6099
|
+
else if (pages[0])
|
|
6100
|
+
void this.requestPage(pages[0].id);
|
|
6101
|
+
}
|
|
6102
|
+
if (!pages.some(page => page.id === this.focusedPageId()))
|
|
6103
|
+
this.focusedPageId.set(this.effectivePageId() ?? pages[0]?.id ?? null);
|
|
6104
|
+
const fallback = this.focusedPageId();
|
|
6105
|
+
if (restoreHeaderFocus && fallback && typeof requestAnimationFrame !== 'undefined') {
|
|
6106
|
+
const revision = this.#revision;
|
|
6107
|
+
requestAnimationFrame(() => {
|
|
6108
|
+
if (!this.#alive || revision !== this.#revision || this.focusedPageId() !== fallback)
|
|
6109
|
+
return;
|
|
6110
|
+
if (document.activeElement !== previousFocus && document.activeElement !== document.body)
|
|
6111
|
+
return;
|
|
6112
|
+
Array.from(this.#host.nativeElement.querySelectorAll('[data-page-button]'))
|
|
6113
|
+
.find(button => button.dataset['pageButton'] === fallback)
|
|
6114
|
+
?.focus();
|
|
6115
|
+
});
|
|
6116
|
+
}
|
|
6117
|
+
this.#pageOrder = nextOrder;
|
|
6118
|
+
}
|
|
6119
|
+
#controlsFor(page) {
|
|
6120
|
+
const region = this.pageRegions().find(region => region.page.id === page.id);
|
|
6121
|
+
const fields = region?.cells.flatMap(cell => (cell.kind === 'field' ? [cell] : cell.children)) ?? [];
|
|
6122
|
+
return fields.flatMap(cell => {
|
|
6123
|
+
const control = this.#controlFor(cell.field);
|
|
6124
|
+
return control ? [control] : [];
|
|
6125
|
+
});
|
|
6126
|
+
}
|
|
6127
|
+
#controlFor(field) {
|
|
6128
|
+
const item = this.items().find(item => item.field() === field && item.form() === this.formGroup());
|
|
6129
|
+
return item?.registeredControl() ?? null;
|
|
6130
|
+
}
|
|
6131
|
+
#itemsReadyFor(pages) {
|
|
6132
|
+
const ids = new Set(pages.map(page => page.id));
|
|
6133
|
+
return this.pageRegions()
|
|
6134
|
+
.filter(region => ids.has(region.page.id))
|
|
6135
|
+
.every(region => region.cells
|
|
6136
|
+
.flatMap(cell => (cell.kind === 'field' ? [cell] : cell.children))
|
|
6137
|
+
.every(cell => this.items().some(item => item.field() === cell.field && item.form() === this.formGroup())));
|
|
6138
|
+
}
|
|
6139
|
+
#revealInvalid(pages) {
|
|
6140
|
+
const page = pages.find(page => this.#controlsFor(page).some(control => control.invalid));
|
|
6141
|
+
if (!page)
|
|
6142
|
+
return; // External/global-only errors have no invented page destination.
|
|
6143
|
+
this.#accept(page.id);
|
|
6144
|
+
const revision = this.#revision;
|
|
6145
|
+
if (typeof requestAnimationFrame === 'undefined')
|
|
6146
|
+
return;
|
|
6147
|
+
requestAnimationFrame(() => {
|
|
6148
|
+
if (!this.#alive || revision !== this.#revision || this.effectivePageId() !== page.id)
|
|
6149
|
+
return;
|
|
6150
|
+
const panel = Array.from(this.#host.nativeElement.querySelectorAll('[data-page-id]')).find(element => element.dataset['pageId'] === page.id);
|
|
6151
|
+
const cell = this.pageRegions()
|
|
6152
|
+
.find(region => region.page.id === page.id)
|
|
6153
|
+
?.cells.flatMap(cell => (cell.kind === 'field' ? [cell] : cell.children))
|
|
6154
|
+
.find(cell => this.#controlFor(cell.field)?.invalid);
|
|
6155
|
+
const element = Array.from(panel?.querySelectorAll('[data-element-id]') ?? []).find(element => element.dataset['elementId'] === cell?.id);
|
|
6156
|
+
element?.querySelector('input,textarea,select,button,[tabindex="0"]')?.focus();
|
|
6157
|
+
});
|
|
6158
|
+
}
|
|
5636
6159
|
/** Tải lên các tệp đang chờ của mọi field upload; kết quả được ghi vào value. Gọi trước khi lưu. */
|
|
5637
6160
|
async upload() {
|
|
5638
6161
|
for (const item of this.items())
|
|
@@ -5687,11 +6210,11 @@ class SdFormRender {
|
|
|
5687
6210
|
return sdPackRows(nodes, level);
|
|
5688
6211
|
}
|
|
5689
6212
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFormRender, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5690
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdFormRender, isStandalone: true, selector: "sd-form-render", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, variables: { classPropertyName: "variables", publicName: "variables", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, breakpoint: { classPropertyName: "breakpoint", publicName: "breakpoint", isSignal: true, isRequired: false, transformFunction: null }, labelPlacement: { classPropertyName: "labelPlacement", publicName: "labelPlacement", isSignal: true, isRequired: false, transformFunction: null }, keys: { classPropertyName: "keys", publicName: "keys", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [FormRenderContext, FormRenderCatalog], viewQueries: [{ propertyName: "grid", first: true, predicate: ["grid"], descendants: true, isSignal: true }, { propertyName: "items", predicate: LibItemComponent, descendants: true, isSignal: true }], ngImport: i0, template: "
|
|
6213
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdFormRender, isStandalone: true, selector: "sd-form-render", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, variables: { classPropertyName: "variables", publicName: "variables", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, breakpoint: { classPropertyName: "breakpoint", publicName: "breakpoint", isSignal: true, isRequired: false, transformFunction: null }, labelPlacement: { classPropertyName: "labelPlacement", publicName: "labelPlacement", isSignal: true, isRequired: false, transformFunction: null }, keys: { classPropertyName: "keys", publicName: "keys", isSignal: true, isRequired: false, transformFunction: null }, activePageId: { classPropertyName: "activePageId", publicName: "activePageId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", activePageId: "activePageIdChange" }, providers: [FormRenderContext, FormRenderCatalog], viewQueries: [{ propertyName: "grid", first: true, predicate: ["grid"], descendants: true, isSignal: true }, { propertyName: "items", predicate: LibItemComponent, descendants: true, isSignal: true }, { propertyName: "pageTabs", first: true, predicate: SdTabGroup, descendants: true, isSignal: true }, { propertyName: "pageStepper", first: true, predicate: SdStepper, descendants: true, isSignal: true }], ngImport: i0, template: "<div #grid>\n @if (navigationTip()) {\n <sd-inform\n class=\"sd-fg-navigation-tip\"\n type=\"tip\"\n color=\"secondary\"\n [hideIcon]=\"true\"\n [title]=\"t('core.component.form-generic.linear-tip')\" />\n }\n @if (navigation() && visiblePages().length) {\n <div\n class=\"sd-fg-navigation\"\n role=\"group\"\n [attr.aria-label]=\"t('core.component.form-generic.pages')\"\n [attr.aria-busy]=\"navigationPending()\"\n (focusin)=\"onCorePageFocus($event)\">\n @if (navigation()?.type === 'tabs') {\n <sd-tab-group [selectedIndex]=\"activeIndex()\" [preserveContent]=\"true\" (selectedIndexChange)=\"onCorePageChange($event)\">\n @for (region of pageRegions(); track region.page.id; let index = $index) {\n <sd-tab [label]=\"pageLabel(region.page)\" [icon]=\"region.page.icon\">\n <ng-container [ngTemplateOutlet]=\"pageBody\" [ngTemplateOutletContext]=\"{ $implicit: region }\" />\n </sd-tab>\n }\n </sd-tab-group>\n } @else {\n <sd-stepper\n [selectedIndex]=\"activeIndex()\"\n [linear]=\"false\"\n [orientation]=\"level() === 'mobile' ? 'vertical' : 'horizontal'\"\n (selectedIndexChange)=\"onCorePageChange($event)\">\n @for (region of pageRegions(); track region.page.id) {\n <sd-step [label]=\"pageLabel(region.page)\" [icon]=\"region.page.icon\" [stepControl]=\"formGroup()\">\n <ng-container [ngTemplateOutlet]=\"pageBody\" [ngTemplateOutletContext]=\"{ $implicit: region }\" />\n </sd-step>\n }\n </sd-stepper>\n }\n </div>\n } @else {\n @for (region of pageRegions(); track region.page.id) {\n <ng-container [ngTemplateOutlet]=\"pageBody\" [ngTemplateOutletContext]=\"{ $implicit: region }\" />\n }\n }\n @if (navigation()?.type === 'steps' && visiblePages().length) {\n <div class=\"sd-fg-step-actions\">\n <sd-button\n type=\"text\"\n color=\"secondary\"\n [size]=\"level() === 'mobile' ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"t('core.component.form-generic.previous')\"\n [disabled]=\"activeIndex() <= 0\"\n (click)=\"previous()\" />\n <span role=\"status\" aria-live=\"polite\">{{\n t('core.component.form-generic.progress', { number: activeIndex() + 1, count: visiblePages().length })\n }}</span>\n <sd-button\n type=\"fill\"\n color=\"primary\"\n [size]=\"level() === 'mobile' ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"t('core.component.form-generic.next')\"\n [disabled]=\"navigationPending() || activeIndex() >= visiblePages().length - 1\"\n (click)=\"next()\" />\n </div>\n }\n</div>\n\n<ng-template #pageBody let-region>\n <div\n class=\"sd-fg-grid\"\n [attr.data-level]=\"level()\"\n [attr.data-page-id]=\"region.page.id\"\n [id]=\"pageDomId(region.page.id, 'panel')\"\n [attr.role]=\"navigation() ? 'group' : null\"\n [attr.aria-label]=\"navigation() ? pageLabel(region.page) : null\"\n [hidden]=\"!!navigation() && effectivePageId() !== region.page.id\"\n [attr.inert]=\"navigation() && effectivePageId() !== region.page.id ? '' : null\">\n @for (cell of region.cells; track cell.id) {\n @if (cell.kind === 'group') {\n <div\n class=\"sd-fg-cell mt-16\"\n [style.grid-row]=\"cell.row\"\n [style.grid-column]=\"cell.column\"\n [attr.data-row]=\"cell.row\"\n [attr.data-element-id]=\"cell.id\">\n <sd-section\n [title]=\"cell.group.label\"\n [icon]=\"cell.group.icon\"\n [iconColor]=\"cell.group.color || 'primary'\"\n [collapsible]=\"cell.group.collapsible ?? false\">\n <!-- why: `.sd-section-body` has no padding (each content decides), the group body keeps its own gutter.\n The section title is not a heading, so the body names the group for assistive tech. -->\n <div class=\"c-group-body\" role=\"group\" [attr.aria-label]=\"cell.group.label || null\">\n @for (child of cell.children; track child.id) {\n <div\n class=\"sd-fg-cell px-8 py-8\"\n [style.grid-row]=\"child.row\"\n [style.grid-column]=\"child.column\"\n [attr.data-row]=\"child.row\"\n [attr.data-element-id]=\"child.id\">\n <lib-item [field]=\"child.field\" [state]=\"child.state\" [form]=\"formGroup()\"></lib-item>\n </div>\n }\n </div>\n </sd-section>\n </div>\n } @else {\n <div\n class=\"sd-fg-cell px-8 py-8\"\n [style.grid-row]=\"cell.row\"\n [style.grid-column]=\"cell.column\"\n [attr.data-row]=\"cell.row\"\n [attr.data-element-id]=\"cell.id\">\n <lib-item [field]=\"cell.field\" [state]=\"cell.state\" [form]=\"formGroup()\"></lib-item>\n </div>\n }\n }\n </div>\n</ng-template>\n", styles: [":host{display:block}.sd-fg-grid,.c-group-body{display:grid;grid-template-columns:repeat(12,minmax(0,1fr))}.sd-fg-cell{min-width:0}.sd-fg-grid[hidden]{display:none}.sd-fg-navigation{min-width:0}.sd-fg-step-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin-top:12px}.c-group-body{padding:8px 8px 12px}\n"], dependencies: [{ kind: "component", type: SdSection, selector: "sd-section", inputs: ["title", "subTitle", "icon", "iconColor", "iconShape", "collapsed", "collapsible", "hideHeader"], outputs: ["collapsedChange"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdInform, selector: "sd-inform", inputs: ["type", "color", "primary", "secondary", "info", "success", "warning", "error", "title", "description", "icon", "hideIcon", "iconShape", "fontSet", "closable", "actionLabel", "lineClamp", "autoId"], outputs: ["sdClosed", "sdAction"] }, { kind: "component", type: SdTab, selector: "sd-tab", inputs: ["label", "icon", "badge", "disabled", "closable", "beforeClose"], outputs: ["close", "closeError"] }, { kind: "component", type: SdTabGroup, selector: "sd-tab-group", inputs: ["preserveContent", "selectedIndex", "variant", "color", "headerPosition", "headerClass", "headerStyle", "bodyClass", "bodyStyle", "alignTabs", "stretchTabs", "animationDuration", "disableRipple", "dynamicHeight", "autoId"], outputs: ["selectedIndexChange", "tabClosed"] }, { kind: "component", type: SdStep, selector: "sd-step", inputs: ["label", "icon", "optional", "editable", "stepControl", "state", "errorMessage"], outputs: ["selectChange"] }, { kind: "component", type: SdStepper, selector: "sd-stepper", inputs: ["selectedIndex", "linear", "orientation", "labelPosition", "headerPosition", "animationDuration", "disableRipple", "color", "autoId"], outputs: ["selectedIndexChange", "selectionChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LibItemComponent, selector: "lib-item", inputs: ["field", "state", "form"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5691
6214
|
}
|
|
5692
6215
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFormRender, decorators: [{
|
|
5693
6216
|
type: Component,
|
|
5694
|
-
args: [{ selector: 'sd-form-render', changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdSection, LibItemComponent], providers: [FormRenderContext, FormRenderCatalog], template: "
|
|
6217
|
+
args: [{ selector: 'sd-form-render', changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdSection, SdButton, SdInform, SdTab, SdTabGroup, SdStep, SdStepper, NgTemplateOutlet, LibItemComponent], providers: [FormRenderContext, FormRenderCatalog], template: "<div #grid>\n @if (navigationTip()) {\n <sd-inform\n class=\"sd-fg-navigation-tip\"\n type=\"tip\"\n color=\"secondary\"\n [hideIcon]=\"true\"\n [title]=\"t('core.component.form-generic.linear-tip')\" />\n }\n @if (navigation() && visiblePages().length) {\n <div\n class=\"sd-fg-navigation\"\n role=\"group\"\n [attr.aria-label]=\"t('core.component.form-generic.pages')\"\n [attr.aria-busy]=\"navigationPending()\"\n (focusin)=\"onCorePageFocus($event)\">\n @if (navigation()?.type === 'tabs') {\n <sd-tab-group [selectedIndex]=\"activeIndex()\" [preserveContent]=\"true\" (selectedIndexChange)=\"onCorePageChange($event)\">\n @for (region of pageRegions(); track region.page.id; let index = $index) {\n <sd-tab [label]=\"pageLabel(region.page)\" [icon]=\"region.page.icon\">\n <ng-container [ngTemplateOutlet]=\"pageBody\" [ngTemplateOutletContext]=\"{ $implicit: region }\" />\n </sd-tab>\n }\n </sd-tab-group>\n } @else {\n <sd-stepper\n [selectedIndex]=\"activeIndex()\"\n [linear]=\"false\"\n [orientation]=\"level() === 'mobile' ? 'vertical' : 'horizontal'\"\n (selectedIndexChange)=\"onCorePageChange($event)\">\n @for (region of pageRegions(); track region.page.id) {\n <sd-step [label]=\"pageLabel(region.page)\" [icon]=\"region.page.icon\" [stepControl]=\"formGroup()\">\n <ng-container [ngTemplateOutlet]=\"pageBody\" [ngTemplateOutletContext]=\"{ $implicit: region }\" />\n </sd-step>\n }\n </sd-stepper>\n }\n </div>\n } @else {\n @for (region of pageRegions(); track region.page.id) {\n <ng-container [ngTemplateOutlet]=\"pageBody\" [ngTemplateOutletContext]=\"{ $implicit: region }\" />\n }\n }\n @if (navigation()?.type === 'steps' && visiblePages().length) {\n <div class=\"sd-fg-step-actions\">\n <sd-button\n type=\"text\"\n color=\"secondary\"\n [size]=\"level() === 'mobile' ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"t('core.component.form-generic.previous')\"\n [disabled]=\"activeIndex() <= 0\"\n (click)=\"previous()\" />\n <span role=\"status\" aria-live=\"polite\">{{\n t('core.component.form-generic.progress', { number: activeIndex() + 1, count: visiblePages().length })\n }}</span>\n <sd-button\n type=\"fill\"\n color=\"primary\"\n [size]=\"level() === 'mobile' ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"t('core.component.form-generic.next')\"\n [disabled]=\"navigationPending() || activeIndex() >= visiblePages().length - 1\"\n (click)=\"next()\" />\n </div>\n }\n</div>\n\n<ng-template #pageBody let-region>\n <div\n class=\"sd-fg-grid\"\n [attr.data-level]=\"level()\"\n [attr.data-page-id]=\"region.page.id\"\n [id]=\"pageDomId(region.page.id, 'panel')\"\n [attr.role]=\"navigation() ? 'group' : null\"\n [attr.aria-label]=\"navigation() ? pageLabel(region.page) : null\"\n [hidden]=\"!!navigation() && effectivePageId() !== region.page.id\"\n [attr.inert]=\"navigation() && effectivePageId() !== region.page.id ? '' : null\">\n @for (cell of region.cells; track cell.id) {\n @if (cell.kind === 'group') {\n <div\n class=\"sd-fg-cell mt-16\"\n [style.grid-row]=\"cell.row\"\n [style.grid-column]=\"cell.column\"\n [attr.data-row]=\"cell.row\"\n [attr.data-element-id]=\"cell.id\">\n <sd-section\n [title]=\"cell.group.label\"\n [icon]=\"cell.group.icon\"\n [iconColor]=\"cell.group.color || 'primary'\"\n [collapsible]=\"cell.group.collapsible ?? false\">\n <!-- why: `.sd-section-body` has no padding (each content decides), the group body keeps its own gutter.\n The section title is not a heading, so the body names the group for assistive tech. -->\n <div class=\"c-group-body\" role=\"group\" [attr.aria-label]=\"cell.group.label || null\">\n @for (child of cell.children; track child.id) {\n <div\n class=\"sd-fg-cell px-8 py-8\"\n [style.grid-row]=\"child.row\"\n [style.grid-column]=\"child.column\"\n [attr.data-row]=\"child.row\"\n [attr.data-element-id]=\"child.id\">\n <lib-item [field]=\"child.field\" [state]=\"child.state\" [form]=\"formGroup()\"></lib-item>\n </div>\n }\n </div>\n </sd-section>\n </div>\n } @else {\n <div\n class=\"sd-fg-cell px-8 py-8\"\n [style.grid-row]=\"cell.row\"\n [style.grid-column]=\"cell.column\"\n [attr.data-row]=\"cell.row\"\n [attr.data-element-id]=\"cell.id\">\n <lib-item [field]=\"cell.field\" [state]=\"cell.state\" [form]=\"formGroup()\"></lib-item>\n </div>\n }\n }\n </div>\n</ng-template>\n", styles: [":host{display:block}.sd-fg-grid,.c-group-body{display:grid;grid-template-columns:repeat(12,minmax(0,1fr))}.sd-fg-cell{min-width:0}.sd-fg-grid[hidden]{display:none}.sd-fg-navigation{min-width:0}.sd-fg-step-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin-top:12px}.c-group-body{padding:8px 8px 12px}\n"] }]
|
|
5695
6218
|
}], ctorParameters: () => [] });
|
|
5696
6219
|
|
|
5697
6220
|
/**
|
|
@@ -5714,7 +6237,7 @@ class PreviewComponent {
|
|
|
5714
6237
|
value = signal({});
|
|
5715
6238
|
/** Bản clone độc lập: renderer không thể chạm vào tài liệu của builder. */
|
|
5716
6239
|
schema = computed(() => documentToSchema(this.store.doc()));
|
|
5717
|
-
isEmpty = computed(() => !this.
|
|
6240
|
+
isEmpty = computed(() => !this.schema().navigation && !this.schema().pages[0]?.elements.length);
|
|
5718
6241
|
/** Lần "Kiểm tra" mới nhất — kết quả của lần cũ hơn (đã đặt lại/đổi dữ liệu giữa chừng) bị bỏ. */
|
|
5719
6242
|
#request = 0;
|
|
5720
6243
|
constructor() {
|
|
@@ -5750,7 +6273,7 @@ class PreviewComponent {
|
|
|
5750
6273
|
this.result.set(null);
|
|
5751
6274
|
}
|
|
5752
6275
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: PreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5753
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: PreviewComponent, isStandalone: true, selector: "fb-preview", viewQueries: [{ propertyName: "render", first: true, predicate: SdFormRender, descendants: true, isSignal: true }], ngImport: i0, template: "@let _viewport = store.viewport();\n@let _result = result();\n<div class=\"pv\">\n <div class=\"pv__bar\">\n <span class=\"pv__note\">\n <sd-icon name=\"science\" size=\"16px\"></sd-icon>\n {{ 'core.component.form-builder.preview.note' | sdTranslate }}\n </span>\n <span class=\"pv__actions\">\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n [prefixIcon]=\"viewed() ? 'edit' : 'visibility'\"\n [title]=\"\n (viewed() ? 'core.component.form-builder.preview.edit-mode' : 'core.component.form-builder.preview.view-mode') | sdTranslate\n \"\n (click)=\"toggleViewed()\"></sd-button>\n <sd-button\n type=\"outline\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"restart_alt\"\n [title]=\"'core.component.form-builder.preview.reset' | sdTranslate\"\n (click)=\"reset()\"></sd-button>\n <sd-button\n type=\"fill\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"task_alt\"\n [disabled]=\"viewed() || isEmpty()\"\n [title]=\"'core.component.form-builder.preview.validate' | sdTranslate\"\n (click)=\"validate()\"></sd-button>\n </span>\n </div>\n\n <div class=\"pv__stage\">\n <div\n class=\"pv__frame\"\n [attr.data-viewport]=\"_viewport\"\n [class.pv__frame--tablet]=\"_viewport === 'tablet'\"\n [class.pv__frame--mobile]=\"_viewport === 'mobile'\">\n @if (isEmpty()) {\n <p class=\"pv__empty\">{{ 'core.component.form-builder.preview.empty' | sdTranslate }}</p>\n } @else {\n @for (key of [session()]; track key) {\n <sd-form-render [schema]=\"schema()\" [(value)]=\"value\" [viewed]=\"viewed()\" [breakpoint]=\"_viewport\"></sd-form-render>\n }\n }\n </div>\n\n <!-- why: the live region stays in the DOM and only its content changes, so the first result is announced too. -->\n <div class=\"pv__result\" [attr.data-viewport]=\"_viewport\" role=\"status\" aria-live=\"polite\">\n @if (_result) {\n @if (_result.invalidFields) {\n <div class=\"pv__msg pv__msg--error\">\n <sd-icon name=\"error\" size=\"18px\"></sd-icon>{{ 'core.component.form-builder.preview.invalid-fields' | sdTranslate }}\n </div>\n } @else if (!_result.errors.length && !_result.warnings.length) {\n <div class=\"pv__msg pv__msg--success\">\n <sd-icon name=\"check_circle\" size=\"18px\"></sd-icon>{{ 'core.component.form-builder.preview.valid' | sdTranslate }}\n </div>\n }\n @for (message of _result.errors; track $index) {\n <!-- why: message c\u1EE7a validation c\u1EA5p form c\u00F3 th\u1EC3 l\u00E0 HTML (validator c\u1EE7a portal) \u2014 Angular\n sanitize [innerHTML]. -->\n <div class=\"pv__msg pv__msg--error\"><sd-icon name=\"error\" size=\"18px\"></sd-icon><span [innerHTML]=\"message\"></span></div>\n }\n @for (message of _result.warnings; track $index) {\n <div class=\"pv__msg pv__msg--warning\">\n <sd-icon name=\"warning_amber\" size=\"18px\"></sd-icon><span [innerHTML]=\"message\"></span>\n </div>\n }\n }\n </div>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column;min-height:0;height:100%}.pv{display:flex;flex-direction:column;flex:1;min-height:0}.pv__bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto;padding:8px 16px;border-bottom:1px solid var(--sd-border);background:var(--sd-surface)}.pv__note{display:inline-flex;align-items:center;gap:6px;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px)}.pv__actions{display:inline-flex;flex-wrap:wrap;gap:6px}.pv__stage{flex:1;min-height:0;overflow:auto;padding:20px 24px 32px;background:var(--sd-surface-muted)}.pv__frame{box-sizing:border-box;max-width:1040px;margin:0 auto;padding:16px 8px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-surface)}.pv__frame--tablet{width:768px;max-width:100%;border-radius:var(--sd-radius-16, 16px);border-color:var(--sd-border-strong)}.pv__frame--mobile{width:390px;max-width:100%;border-radius:var(--sd-radius-24, 24px);border-color:var(--sd-border-strong);padding:16px 4px}.pv__empty{margin:24px 16px;color:var(--sd-text-secondary);text-align:center}.pv__result{display:flex;flex-direction:column;gap:6px;max-width:1040px;margin:12px auto 0}.pv__result:empty{margin:0}.pv__result[data-viewport=tablet]{max-width:768px}.pv__result[data-viewport=mobile]{max-width:390px}.pv__msg{display:flex;align-items:flex-start;gap:8px;padding:8px 12px;border-radius:var(--sd-radius-8, 8px);font-size:var(--sd-font-size-13, 13px)}.pv__msg sd-icon{flex:0 0 auto}.pv__msg--success{background:var(--sd-status-success-bg, var(--sd-success-light));color:var(--sd-status-success-fg, var(--sd-success-dark))}.pv__msg--error{background:var(--sd-status-error-bg, var(--sd-error-light));color:var(--sd-status-error-fg, var(--sd-error-dark))}.pv__msg--warning{background:var(--sd-status-warning-bg, var(--sd-warning-light));color:var(--sd-status-warning-fg, var(--sd-warning-dark))}\n"], dependencies: [{ kind: "component", type: SdFormRender, selector: "sd-form-render", inputs: ["schema", "value", "form", "variables", "viewed", "breakpoint", "labelPlacement", "keys"], outputs: ["valueChange"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { 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 });
|
|
6276
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: PreviewComponent, isStandalone: true, selector: "fb-preview", viewQueries: [{ propertyName: "render", first: true, predicate: SdFormRender, descendants: true, isSignal: true }], ngImport: i0, template: "@let _viewport = store.viewport();\n@let _result = result();\n<div class=\"pv\">\n <div class=\"pv__bar\">\n <span class=\"pv__note\">\n <sd-icon name=\"science\" size=\"16px\"></sd-icon>\n {{ 'core.component.form-builder.preview.note' | sdTranslate }}\n </span>\n <span class=\"pv__actions\">\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n [prefixIcon]=\"viewed() ? 'edit' : 'visibility'\"\n [title]=\"\n (viewed() ? 'core.component.form-builder.preview.edit-mode' : 'core.component.form-builder.preview.view-mode') | sdTranslate\n \"\n (click)=\"toggleViewed()\"></sd-button>\n <sd-button\n type=\"outline\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"restart_alt\"\n [title]=\"'core.component.form-builder.preview.reset' | sdTranslate\"\n (click)=\"reset()\"></sd-button>\n <sd-button\n type=\"fill\"\n color=\"primary\"\n size=\"sm\"\n prefixIcon=\"task_alt\"\n [disabled]=\"viewed() || isEmpty()\"\n [title]=\"'core.component.form-builder.preview.validate' | sdTranslate\"\n (click)=\"validate()\"></sd-button>\n </span>\n </div>\n\n <div class=\"pv__stage\">\n <div\n class=\"pv__frame\"\n [attr.data-viewport]=\"_viewport\"\n [class.pv__frame--tablet]=\"_viewport === 'tablet'\"\n [class.pv__frame--mobile]=\"_viewport === 'mobile'\">\n @if (isEmpty()) {\n <p class=\"pv__empty\">{{ 'core.component.form-builder.preview.empty' | sdTranslate }}</p>\n } @else {\n @for (key of [session()]; track key) {\n <sd-form-render [schema]=\"schema()\" [(value)]=\"value\" [viewed]=\"viewed()\" [breakpoint]=\"_viewport\"></sd-form-render>\n }\n }\n </div>\n\n <!-- why: the live region stays in the DOM and only its content changes, so the first result is announced too. -->\n <div class=\"pv__result\" [attr.data-viewport]=\"_viewport\" role=\"status\" aria-live=\"polite\">\n @if (_result) {\n @if (_result.invalidFields) {\n <div class=\"pv__msg pv__msg--error\">\n <sd-icon name=\"error\" size=\"18px\"></sd-icon>{{ 'core.component.form-builder.preview.invalid-fields' | sdTranslate }}\n </div>\n } @else if (!_result.errors.length && !_result.warnings.length) {\n <div class=\"pv__msg pv__msg--success\">\n <sd-icon name=\"check_circle\" size=\"18px\"></sd-icon>{{ 'core.component.form-builder.preview.valid' | sdTranslate }}\n </div>\n }\n @for (message of _result.errors; track $index) {\n <!-- why: message c\u1EE7a validation c\u1EA5p form c\u00F3 th\u1EC3 l\u00E0 HTML (validator c\u1EE7a portal) \u2014 Angular\n sanitize [innerHTML]. -->\n <div class=\"pv__msg pv__msg--error\"><sd-icon name=\"error\" size=\"18px\"></sd-icon><span [innerHTML]=\"message\"></span></div>\n }\n @for (message of _result.warnings; track $index) {\n <div class=\"pv__msg pv__msg--warning\">\n <sd-icon name=\"warning_amber\" size=\"18px\"></sd-icon><span [innerHTML]=\"message\"></span>\n </div>\n }\n }\n </div>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column;min-height:0;height:100%}.pv{display:flex;flex-direction:column;flex:1;min-height:0}.pv__bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto;padding:8px 16px;border-bottom:1px solid var(--sd-border);background:var(--sd-surface)}.pv__note{display:inline-flex;align-items:center;gap:6px;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px)}.pv__actions{display:inline-flex;flex-wrap:wrap;gap:6px}.pv__stage{flex:1;min-height:0;overflow:auto;padding:20px 24px 32px;background:var(--sd-surface-muted)}.pv__frame{box-sizing:border-box;max-width:1040px;margin:0 auto;padding:16px 8px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-surface)}.pv__frame--tablet{width:768px;max-width:100%;border-radius:var(--sd-radius-16, 16px);border-color:var(--sd-border-strong)}.pv__frame--mobile{width:390px;max-width:100%;border-radius:var(--sd-radius-24, 24px);border-color:var(--sd-border-strong);padding:16px 4px}.pv__empty{margin:24px 16px;color:var(--sd-text-secondary);text-align:center}.pv__result{display:flex;flex-direction:column;gap:6px;max-width:1040px;margin:12px auto 0}.pv__result:empty{margin:0}.pv__result[data-viewport=tablet]{max-width:768px}.pv__result[data-viewport=mobile]{max-width:390px}.pv__msg{display:flex;align-items:flex-start;gap:8px;padding:8px 12px;border-radius:var(--sd-radius-8, 8px);font-size:var(--sd-font-size-13, 13px)}.pv__msg sd-icon{flex:0 0 auto}.pv__msg--success{background:var(--sd-status-success-bg, var(--sd-success-light));color:var(--sd-status-success-fg, var(--sd-success-dark))}.pv__msg--error{background:var(--sd-status-error-bg, var(--sd-error-light));color:var(--sd-status-error-fg, var(--sd-error-dark))}.pv__msg--warning{background:var(--sd-status-warning-bg, var(--sd-warning-light));color:var(--sd-status-warning-fg, var(--sd-warning-dark))}\n"], dependencies: [{ kind: "component", type: SdFormRender, selector: "sd-form-render", inputs: ["schema", "value", "form", "variables", "viewed", "breakpoint", "labelPlacement", "keys", "activePageId"], outputs: ["valueChange", "activePageIdChange"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { 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 });
|
|
5754
6277
|
}
|
|
5755
6278
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: PreviewComponent, decorators: [{
|
|
5756
6279
|
type: Component,
|
|
@@ -5786,10 +6309,39 @@ class SdFormBuilder {
|
|
|
5786
6309
|
store = inject(FormBuilderStore);
|
|
5787
6310
|
#drag = inject(BuilderDragService);
|
|
5788
6311
|
#confirm = inject(SdConfirmService);
|
|
6312
|
+
pageIndex = computed(() => this.store.pages().findIndex(page => page.id === this.store.activePage().id));
|
|
6313
|
+
/** Confirm destructive page removal with existing reference ownership warnings. */
|
|
6314
|
+
async removePage() {
|
|
6315
|
+
const doc = this.store.doc();
|
|
6316
|
+
const id = doc.base.page.id;
|
|
6317
|
+
if (this.store.pages().length <= 1)
|
|
6318
|
+
return;
|
|
6319
|
+
const references = this.store.pageDependentsOf(id);
|
|
6320
|
+
if (doc.elements.length || references.length) {
|
|
6321
|
+
try {
|
|
6322
|
+
await this.#confirm.confirm(this.store.t('core.component.form-builder.page.delete-confirm', {
|
|
6323
|
+
label: escapeHtml(doc.base.page.label || this.store.t('core.component.form-generic.page', { number: this.pageIndex() + 1 })),
|
|
6324
|
+
count: references.length,
|
|
6325
|
+
}), {
|
|
6326
|
+
title: this.store.t('core.component.form-builder.confirm.delete-title'),
|
|
6327
|
+
yesTitle: this.store.t('core.component.form-builder.delete'),
|
|
6328
|
+
noTitle: this.store.t('core.component.form-builder.cancel'),
|
|
6329
|
+
yesButtonColor: 'error',
|
|
6330
|
+
});
|
|
6331
|
+
}
|
|
6332
|
+
catch {
|
|
6333
|
+
return;
|
|
6334
|
+
}
|
|
6335
|
+
if (!sameDocumentContent(doc, this.store.doc()) || this.store.activePage().id !== id)
|
|
6336
|
+
return;
|
|
6337
|
+
}
|
|
6338
|
+
this.store.removePage(id);
|
|
6339
|
+
}
|
|
5789
6340
|
#notify = inject(SdNotifyService);
|
|
5790
6341
|
#zone = inject(NgZone);
|
|
5791
6342
|
#host = inject(ElementRef);
|
|
5792
6343
|
#injector = inject(Injector);
|
|
6344
|
+
#headerRevealFrame = null;
|
|
5793
6345
|
/**
|
|
5794
6346
|
* Schema của builder — `[(schema)]`. Mỗi tham chiếu MỚI có nội dung khác schema hiện tại = nạp form
|
|
5795
6347
|
* khác: reset lịch sử undo và selection. Nhận lại đúng schema vừa phát, hoặc tham chiếu mới nhưng
|
|
@@ -5857,6 +6409,15 @@ class SdFormBuilder {
|
|
|
5857
6409
|
this.#lastEmitted = snapshot;
|
|
5858
6410
|
this.schema.set(snapshot);
|
|
5859
6411
|
});
|
|
6412
|
+
// Page selection/load recreates the document without emitting a schema edit through `changes`.
|
|
6413
|
+
// A toast must disappear when its exact deletion is no longer the current undoable document.
|
|
6414
|
+
effect(() => {
|
|
6415
|
+
const doc = this.store.doc();
|
|
6416
|
+
untracked(() => {
|
|
6417
|
+
if (this.#undoRemove && this.#undoRemove.doc !== doc)
|
|
6418
|
+
this.#undoRemove.release();
|
|
6419
|
+
});
|
|
6420
|
+
});
|
|
5860
6421
|
// why: after a delete or ungroup focus goes back to the canvas. In compact mode the overlay panel the
|
|
5861
6422
|
// action came from is closed first, so the focused card is not hidden under the panel or the scrim.
|
|
5862
6423
|
effect(() => {
|
|
@@ -5876,6 +6437,8 @@ class SdFormBuilder {
|
|
|
5876
6437
|
destroyRef.onDestroy(() => {
|
|
5877
6438
|
subscription.unsubscribe();
|
|
5878
6439
|
this.#undoRemove?.release();
|
|
6440
|
+
if (this.#headerRevealFrame !== null)
|
|
6441
|
+
cancelAnimationFrame(this.#headerRevealFrame);
|
|
5879
6442
|
});
|
|
5880
6443
|
afterNextRender(() => {
|
|
5881
6444
|
const observer = new ResizeObserver(entries => {
|
|
@@ -5891,6 +6454,45 @@ class SdFormBuilder {
|
|
|
5891
6454
|
// ── API công khai ───────────────────────────────────────────────────────────
|
|
5892
6455
|
/** Snapshot schema hiện tại (bản clone độc lập, sửa thoải mái không ảnh hưởng builder). */
|
|
5893
6456
|
getSchema = () => documentToSchema(this.store.doc());
|
|
6457
|
+
/** Keep native focus visible without moving the page or any surrounding scroll container. */
|
|
6458
|
+
revealPageHeader(event) {
|
|
6459
|
+
const header = event.currentTarget;
|
|
6460
|
+
const strip = header?.parentElement;
|
|
6461
|
+
if (!header || !strip?.classList.contains('fb-pages__strip') || !this.#host.nativeElement.contains(strip))
|
|
6462
|
+
return;
|
|
6463
|
+
const reveal = () => {
|
|
6464
|
+
if (!header.isConnected || header.parentElement !== strip || header.ownerDocument.activeElement !== header)
|
|
6465
|
+
return;
|
|
6466
|
+
const viewport = strip.getBoundingClientRect();
|
|
6467
|
+
const left = viewport.left + strip.clientLeft;
|
|
6468
|
+
const right = left + strip.clientWidth;
|
|
6469
|
+
const bounds = header.getBoundingClientRect();
|
|
6470
|
+
const style = getComputedStyle(header);
|
|
6471
|
+
const gutter = style.outlineStyle === 'none'
|
|
6472
|
+
? 0
|
|
6473
|
+
: Math.max(0, parseFloat(style.outlineWidth) || 0) + Math.max(0, parseFloat(style.outlineOffset) || 0);
|
|
6474
|
+
let delta = 0;
|
|
6475
|
+
if (bounds.width + 2 * gutter <= strip.clientWidth) {
|
|
6476
|
+
if (bounds.left - gutter < left)
|
|
6477
|
+
delta = bounds.left - gutter - left;
|
|
6478
|
+
else if (bounds.right + gutter > right)
|
|
6479
|
+
delta = bounds.right + gutter - right;
|
|
6480
|
+
}
|
|
6481
|
+
else if (bounds.right <= left || bounds.left >= right) {
|
|
6482
|
+
delta = bounds.left - left - gutter;
|
|
6483
|
+
}
|
|
6484
|
+
// Physical bounds keep this mutation local. RTL behavior remains a separate validation scope.
|
|
6485
|
+
if (delta)
|
|
6486
|
+
strip.scrollLeft += delta;
|
|
6487
|
+
};
|
|
6488
|
+
reveal();
|
|
6489
|
+
if (this.#headerRevealFrame !== null)
|
|
6490
|
+
cancelAnimationFrame(this.#headerRevealFrame);
|
|
6491
|
+
this.#headerRevealFrame = requestAnimationFrame(() => {
|
|
6492
|
+
this.#headerRevealFrame = null;
|
|
6493
|
+
reveal();
|
|
6494
|
+
});
|
|
6495
|
+
}
|
|
5894
6496
|
// ── Toolbar ─────────────────────────────────────────────────────────────────
|
|
5895
6497
|
setMode(mode) {
|
|
5896
6498
|
this.#drag.cancel();
|
|
@@ -6062,6 +6664,7 @@ class SdFormBuilder {
|
|
|
6062
6664
|
const toastId = toast?.onAction === undo ? toast.id : undefined;
|
|
6063
6665
|
const cleanup = {};
|
|
6064
6666
|
const state = {
|
|
6667
|
+
doc: removedDoc,
|
|
6065
6668
|
toastId,
|
|
6066
6669
|
release: () => {
|
|
6067
6670
|
cleanup.subscription?.unsubscribe();
|
|
@@ -6142,7 +6745,7 @@ class SdFormBuilder {
|
|
|
6142
6745
|
#savingVariables = false;
|
|
6143
6746
|
openValidations() {
|
|
6144
6747
|
const doc = this.store.doc();
|
|
6145
|
-
this.validationDialog()?.open(
|
|
6748
|
+
this.validationDialog()?.open(this.store.allElements(), doc.variables, doc.validations);
|
|
6146
6749
|
}
|
|
6147
6750
|
onValidationsAccepted(validations) {
|
|
6148
6751
|
this.store.setValidations(cloneJson(validations ?? []));
|
|
@@ -6164,7 +6767,7 @@ class SdFormBuilder {
|
|
|
6164
6767
|
this.store.load(doc);
|
|
6165
6768
|
}
|
|
6166
6769
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFormBuilder, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6167
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdFormBuilder, isStandalone: true, selector: "sd-form-builder", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { schema: "schemaChange" }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "class.sd-form-builder--compact": "compact()" }, classAttribute: "sd-form-builder" }, providers: [FormBuilderStore, BuilderDragService], viewQueries: [{ propertyName: "canvas", first: true, predicate: CanvasComponent, descendants: true, isSignal: true }, { propertyName: "palette", first: true, predicate: PaletteComponent, descendants: true, isSignal: true }, { propertyName: "validationDialog", first: true, predicate: ConfigureValidationComponent, descendants: true, isSignal: true }, { propertyName: "variablesModal", first: true, predicate: ["variablesModal"], descendants: true, isSignal: true }, { propertyName: "shortcutsModal", first: true, predicate: ["shortcutsModal"], descendants: true, isSignal: true }, { propertyName: "leftToggle", first: true, predicate: ["leftToggle"], descendants: true, isSignal: true }, { propertyName: "rightToggle", first: true, predicate: ["rightToggle"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _mode = store.mode();\n@let _design = _mode === 'design';\n@let _compact = compact();\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Toolbar n\u1ED9i b\u1ED9 c\u1EE7a component (kh\u00F4ng ph\u1EA3i header \u1EE9ng d\u1EE5ng) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div class=\"fb-toolbar\" role=\"toolbar\" [attr.aria-label]=\"'core.component.form-builder.toolbar' | sdTranslate\">\n @if (_compact && _design) {\n <!-- why: native button \u2014 the panel toggle must expose aria-expanded / aria-controls, which sd-button\n only sets for its own action menu. -->\n <span class=\"fb-toolbar__group\">\n <button\n #leftToggle\n type=\"button\"\n class=\"fb-panel-toggle\"\n [attr.aria-expanded]=\"leftOpen()\"\n [attr.aria-controls]=\"leftPanelId\"\n [attr.aria-label]=\"'core.component.form-builder.tab.components' | sdTranslate\"\n [title]=\"'core.component.form-builder.tab.components' | sdTranslate\"\n (click)=\"togglePanel('left')\">\n <sd-icon name=\"widgets\" size=\"20px\"></sd-icon>\n </button>\n </span>\n }\n\n <!-- why: ph\u00EDm m\u0169i t\u00EAn n\u1ED5i b\u1ECDt t\u1EEB n\u00FAt radio \u0111ang focus (m\u1EABu radiogroup c\u1EE7a APG); b\u1EA3n th\u00E2n nh\u00F3m kh\u00F4ng ph\u1EA3i \u0111i\u1EC3m focus. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"fb-seg\"\n role=\"radiogroup\"\n [attr.aria-label]=\"'core.component.form-builder.mode' | sdTranslate\"\n (keydown)=\"onSegmentKeydown($event, modes, _mode, applyMode)\">\n @for (mode of modes; track mode) {\n <button\n type=\"button\"\n role=\"radio\"\n class=\"fb-seg__btn\"\n [attr.data-value]=\"mode\"\n [class.is-active]=\"_mode === mode\"\n [attr.aria-checked]=\"_mode === mode\"\n [attr.tabindex]=\"_mode === mode ? 0 : -1\"\n [title]=\"'core.component.form-builder.mode.' + mode | sdTranslate\"\n (click)=\"setMode(mode)\">\n <sd-icon [name]=\"modeIcons[mode]\" size=\"18px\"></sd-icon>\n <span class=\"fb-seg__label\">{{ 'core.component.form-builder.mode.' + mode | sdTranslate }}</span>\n </button>\n }\n </div>\n\n <!-- why: Desktop/Tablet/Mobile ch\u1ECDn m\u1EE9c b\u1ED1 c\u1EE5c \u0111ang thi\u1EBFt k\u1EBF v\u00E0 m\u1EE9c Xem tr\u01B0\u1EDBc \u00E9p cho renderer \u2014\n \u1EA9n \u1EDF Schema. -->\n @if (_mode !== 'schema') {\n @let _viewport = store.viewport();\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"fb-seg\"\n role=\"radiogroup\"\n [attr.aria-label]=\"'core.component.form-builder.viewport' | sdTranslate\"\n (keydown)=\"onSegmentKeydown($event, viewports, _viewport, applyViewport)\">\n @for (viewport of viewports; track viewport) {\n <button\n type=\"button\"\n role=\"radio\"\n class=\"fb-seg__btn\"\n [attr.data-value]=\"viewport\"\n [class.is-active]=\"_viewport === viewport\"\n [attr.aria-checked]=\"_viewport === viewport\"\n [attr.tabindex]=\"_viewport === viewport ? 0 : -1\"\n [title]=\"'core.component.form-builder.viewport.' + viewport | sdTranslate\"\n (click)=\"setViewport(viewport)\">\n <sd-icon [name]=\"viewportIcons[viewport]\" size=\"18px\"></sd-icon>\n <span class=\"fb-seg__label\">{{ 'core.component.form-builder.viewport.' + viewport | sdTranslate }}</span>\n </button>\n }\n </div>\n }\n\n <span class=\"fb-toolbar__spacer\"></span>\n\n <span class=\"fb-toolbar__group\">\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"undo\"\n [disabled]=\"!store.canUndo()\"\n [tooltip]=\"(_design ? 'core.component.form-builder.undo-hint' : 'core.component.form-builder.design-only') | sdTranslate\"\n (click)=\"undo()\"></sd-button>\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"redo\"\n [disabled]=\"!store.canRedo()\"\n [tooltip]=\"(_design ? 'core.component.form-builder.redo-hint' : 'core.component.form-builder.design-only') | sdTranslate\"\n (click)=\"redo()\"></sd-button>\n <!-- C\u00F4ng c\u1EE5: CH\u1EC8 c\u00E1c thao t\u00E1c thi\u1EBFt k\u1EBF c\u00F3 th\u1EADt (action popover c\u1EE7a Core). -->\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"more_vert\"\n [disabled]=\"!_design\"\n [tooltip]=\"(_design ? 'core.component.form-builder.tools' : 'core.component.form-builder.design-only') | sdTranslate\">\n <sd-button-item prefixIcon=\"data_array\" (click)=\"openVariables()\">\n {{ 'core.component.form-builder.tools.variables' | sdTranslate: { count: store.doc().variables.length } }}\n </sd-button-item>\n <sd-button-item prefixIcon=\"rule\" (click)=\"openValidations()\">\n {{ 'core.component.form-builder.tools.validations' | sdTranslate: { count: store.doc().validations.length } }}\n </sd-button-item>\n <sd-button-item-divider></sd-button-item-divider>\n <sd-button-item prefixIcon=\"keyboard\" (click)=\"openShortcuts()\">{{\n 'core.component.form-builder.shortcuts' | sdTranslate\n }}</sd-button-item>\n </sd-button>\n </span>\n\n @if (_compact && _design) {\n <span class=\"fb-toolbar__group\">\n <button\n #rightToggle\n type=\"button\"\n class=\"fb-panel-toggle\"\n [attr.aria-expanded]=\"rightOpen()\"\n [attr.aria-controls]=\"rightPanelId\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\"\n [title]=\"'core.component.form-builder.attribute' | sdTranslate\"\n (click)=\"togglePanel('right')\">\n <sd-icon name=\"tune\" size=\"20px\"></sd-icon>\n </button>\n </span>\n }\n</div>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Th\u00E2n: palette \u00B7 canvas \u00B7 inspector \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div class=\"fb-body\" [class.fb-body--full]=\"!_design\">\n @if (_design) {\n <section\n class=\"fb-side fb-side--left\"\n [id]=\"leftPanelId\"\n [class.is-open]=\"leftOpen()\"\n [attr.aria-label]=\"'core.component.form-builder.left-panel' | sdTranslate\">\n <fb-palette (itemAdded)=\"onItemAdded($event)\" (itemFocused)=\"onItemFocused($event)\"></fb-palette>\n </section>\n }\n\n <!-- why: kh\u00F4ng d\u00F9ng <main>/<aside> \u2014 builder l\u00E0 widget nh\u00FAng, landmark main/complementary c\u1EE7a n\u00F3\n s\u1EBD tr\u00F9ng v\u1EDBi landmark c\u1EE7a trang ch\u1EE7 (v\u00E0 nh\u00E2n \u0111\u00F4i khi c\u00F3 hai builder). Panel l\u00E0 v\u00F9ng c\u00F3 t\u00EAn. -->\n <div class=\"fb-main\">\n @switch (_mode) {\n @case ('design') {\n <fb-canvas (requestAdd)=\"focusPalette()\" (requestRemove)=\"remove($event)\"></fb-canvas>\n }\n @case ('preview') {\n <fb-preview></fb-preview>\n }\n @case ('schema') {\n <div class=\"fb-schema\">\n <p class=\"fb-schema__note\">\n <sd-icon name=\"lock\" size=\"16px\"></sd-icon>{{ 'core.component.form-builder.schema.readonly' | sdTranslate }}\n </p>\n <sd-code-editor language=\"json\" viewed maxHeight=\"none\" [model]=\"schemaText()\"></sd-code-editor>\n </div>\n }\n }\n </div>\n\n @if (_design) {\n <section\n class=\"fb-side fb-side--right\"\n [id]=\"rightPanelId\"\n [class.is-open]=\"rightOpen()\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\">\n <fb-inspector\n (requestRemove)=\"remove($event)\"\n (openVariables)=\"openVariables()\"\n (openValidations)=\"openValidations()\"\n (openShortcuts)=\"openShortcuts()\"></fb-inspector>\n </section>\n }\n\n @if (_compact && (leftOpen() || rightOpen())) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div class=\"fb-scrim\" (click)=\"leftOpen.set(false); rightOpen.set(false)\"></div>\n }\n</div>\n\n<div class=\"fb-live\" aria-live=\"polite\" aria-atomic=\"true\">{{ store.announcement() }}</div>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: bi\u1EBFn \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<sd-modal\n #variablesModal\n [title]=\"'core.component.form-builder.config-variable' | sdTranslate\"\n view=\"dialog\"\n width=\"720px\"\n modalClass=\"sd-form-builder-dialog\">\n <div class=\"fb-variables\">\n <p class=\"fb-variables__hint\">{{ 'core.component.form-builder.variables-hint' | sdTranslate }}</p>\n @if (variableDrafts().length) {\n <table class=\"fb-variables__table\">\n <thead>\n <tr>\n <th scope=\"col\">{{ 'core.component.form-builder.field-key' | sdTranslate }}</th>\n <th scope=\"col\">{{ 'core.component.form-builder.display-label' | sdTranslate }}</th>\n <th scope=\"col\" class=\"fb-variables__actions-col\" [attr.aria-label]=\"'core.component.form-builder.delete' | sdTranslate\"></th>\n </tr>\n </thead>\n <tbody>\n @for (draft of variableDrafts(); track draft.id; let index = $index) {\n <tr>\n <td>\n <sd-input\n size=\"sm\"\n [placeholder]=\"'core.component.form-builder.field-key' | sdTranslate\"\n [model]=\"draft.key\"\n (modelChange)=\"updateVariable(index, 'key', $event)\"\n [inlineError]=\"variableErrors()[index] || undefined\"></sd-input>\n </td>\n <td>\n <sd-input\n size=\"sm\"\n [placeholder]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"draft.label\"\n (modelChange)=\"updateVariable(index, 'label', $event)\"></sd-input>\n </td>\n <td class=\"fb-variables__actions-col\">\n <sd-button\n prefixIcon=\"delete\"\n type=\"text\"\n color=\"error\"\n [tooltip]=\"'core.component.form-builder.delete' | sdTranslate\"\n (click)=\"removeVariable(index)\"></sd-button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n } @else {\n <p class=\"fb-variables__empty\">{{ 'core.component.form-builder.no-variable' | sdTranslate }}</p>\n }\n <sd-button\n class=\"fb-variables__add\"\n type=\"text\"\n color=\"primary\"\n prefixIcon=\"add\"\n [title]=\"'core.component.form-builder.add-variable' | sdTranslate\"\n (click)=\"addVariable()\"></sd-button>\n </div>\n <ng-container sdFooterRight>\n <sd-button\n type=\"fill\"\n color=\"primary\"\n prefixIcon=\"check\"\n [disabled]=\"variablesInvalid()\"\n [title]=\"'core.component.form-builder.confirm' | sdTranslate\"\n (click)=\"saveVariables()\"></sd-button>\n </ng-container>\n</sd-modal>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: x\u00E1c th\u1EF1c c\u1EA5p form (component c\u00F3 s\u1EB5n) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<configure-validation (accept)=\"onValidationsAccepted($event)\"></configure-validation>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: ph\u00EDm t\u1EAFt \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<sd-modal\n #shortcutsModal\n [title]=\"'core.component.form-builder.shortcuts' | sdTranslate\"\n view=\"dialog\"\n width=\"560px\"\n modalClass=\"sd-form-builder-dialog\">\n <table class=\"fb-shortcuts\">\n <tbody>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>Z</kbd></td>\n <td>{{ 'core.component.form-builder.undo' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>Y</kbd> / <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Z</kbd></td>\n <td>{{ 'core.component.form-builder.redo' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Enter</kbd> / <kbd>Space</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.select' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Alt</kbd> + <kbd>\u2191</kbd> / <kbd>\u2193</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.move' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>D</kbd></td>\n <td>{{ 'core.component.form-builder.duplicate' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Delete</kbd></td>\n <td>{{ 'core.component.form-builder.delete' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Esc</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.escape' | sdTranslate }}</td>\n </tr>\n </tbody>\n </table>\n</sd-modal>\n", styles: [":host{--md-sys-color-primary: var(--sd-primary);--md-sys-color-on-primary: var(--sd-primary-contrast);--md-sys-color-primary-container: color-mix(in srgb, var(--sd-primary) 12%, var(--sd-surface));--md-sys-color-surface: var(--sd-surface);--md-sys-color-surface-container-lowest: var(--sd-surface);--md-sys-color-surface-container-low: var(--sd-surface-muted);--md-sys-color-surface-container: var(--sd-surface-muted);--md-sys-color-surface-container-high: var(--sd-surface-muted);--md-sys-color-surface-container-highest: var(--sd-surface-muted);--md-sys-color-on-surface: var(--sd-text);--md-sys-color-on-surface-variant: var(--sd-text-secondary);--md-sys-color-outline: var(--sd-border-strong);--md-sys-color-outline-variant: var(--sd-border);--md-sys-color-error: var(--sd-error);--md-sys-color-error-container: var(--sd-error-light);--md-sys-color-success: var(--sd-success);--r-xs: var(--sd-radius-4, 4px);--r-sm: var(--sd-radius-8, 8px);position:relative;display:flex;flex-direction:column;box-sizing:border-box;width:100%;height:var(--sd-form-builder-height, 100%);min-height:var(--sd-form-builder-min-height, 520px);overflow:hidden;border:1px solid var(--sd-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-surface);color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);container:sd-form-builder/inline-size}.fb-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;flex:0 0 auto;min-height:52px;padding:8px 12px;border-bottom:1px solid var(--sd-border);background:var(--sd-surface)}.fb-toolbar__spacer{flex:1}.fb-toolbar__group{display:inline-flex;align-items:center;gap:2px}.fb-seg{display:inline-flex;padding:2px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface-muted)}.fb-seg__btn{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer;white-space:nowrap}.fb-seg__btn:hover{color:var(--sd-text)}.fb-seg__btn.is-active{background:var(--sd-primary);color:var(--sd-primary-contrast)}.fb-seg__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:1px}.fb-panel-toggle{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);cursor:pointer}.fb-panel-toggle:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.fb-panel-toggle[aria-expanded=true]{background:color-mix(in srgb,var(--sd-primary) 12%,var(--sd-surface));color:var(--sd-primary)}.fb-panel-toggle:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:1px}@container sd-form-builder (max-width: 720px){.fb-seg__label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fb-seg__btn{padding:0 10px}}.fb-body{position:relative;display:grid;grid-template-columns:248px minmax(0,1fr) 320px;flex:1;min-height:0}.fb-body--full{grid-template-columns:minmax(0,1fr)}@container sd-form-builder (max-width: 1180px){.fb-body:not(.fb-body--full){grid-template-columns:216px minmax(0,1fr) 288px}}@container sd-form-builder (max-width: 1000px){.fb-body:not(.fb-body--full){grid-template-columns:196px minmax(0,1fr) 264px}}.fb-side{display:flex;flex-direction:column;min-height:0;min-width:0;background:var(--sd-surface)}.fb-side--left{border-right:1px solid var(--sd-border)}.fb-side--right{border-left:1px solid var(--sd-border)}.fb-main{display:flex;flex-direction:column;min-width:0;min-height:0}:host(.sd-form-builder--compact) .fb-body:not(.fb-body--full){grid-template-columns:minmax(0,1fr)}:host(.sd-form-builder--compact) .fb-side{position:absolute;top:0;bottom:0;z-index:20;width:min(320px,88%);box-shadow:var(--sd-shadow-lg, 0 8px 24px rgba(0, 0, 0, .16));visibility:hidden;transition:transform var(--sd-duration-base, .2s) ease,visibility 0s linear var(--sd-duration-base, .2s)}:host(.sd-form-builder--compact) .fb-side--left{left:0;transform:translate(-100%)}:host(.sd-form-builder--compact) .fb-side--right{right:0;transform:translate(100%)}:host(.sd-form-builder--compact) .fb-side.is-open{visibility:visible;transform:none;transition:transform var(--sd-duration-base, .2s) ease}.fb-scrim{position:absolute;inset:0;z-index:15;background:var(--sd-overlay-backdrop, rgba(0, 0, 0, .32))}.fb-schema{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;overflow:auto;padding:16px 20px 24px;background:var(--sd-surface-muted)}.fb-schema__note{display:inline-flex;align-items:center;gap:6px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px)}.fb-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}:host ::ng-deep .msi{font-family:Material Icons Outlined;font-weight:400;font-style:normal;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;direction:ltr;font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}:host ::ng-deep .mono{font-family:Roboto Mono,ui-monospace,monospace}:host ::ng-deep .fb-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);cursor:pointer}:host ::ng-deep .fb-icon-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}:host ::ng-deep .fb-icon-btn.danger:hover{color:var(--sd-error)}:host ::ng-deep .fb-icon-btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}:host ::ng-deep .fb-icon-btn .msi{font-size:var(--sd-font-size-18, 18px)}:host ::ng-deep details.fb-section{margin:0;padding:0;border-bottom:1px solid var(--sd-border)}:host ::ng-deep details.fb-section>summary{list-style:none}:host ::ng-deep details.fb-section>summary::-webkit-details-marker{display:none}:host ::ng-deep .fb-section__head{display:flex;align-items:center;gap:8px;min-height:32px;cursor:pointer;color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-semibold, 600);-webkit-user-select:none;user-select:none}:host ::ng-deep .fb-section__head .msi{font-size:var(--sd-font-size-16, 16px);color:var(--sd-text-secondary)}:host ::ng-deep .fb-section__head .fb-section__title{flex:1;min-width:0}:host ::ng-deep .fb-section__head .chev{margin-left:auto;transition:transform var(--sd-duration-fast, .12s) ease}:host ::ng-deep details.fb-section[open] .fb-section__head .chev{transform:rotate(90deg)}:host ::ng-deep .fb-section__body{display:flex;flex-direction:column;gap:8px;padding:4px 0 12px}:host ::ng-deep .fb-columns-list{display:flex;flex-direction:column;gap:4px}:host ::ng-deep .fb-column-row{display:flex;align-items:center;gap:8px;min-height:40px;padding:6px 8px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface);font-size:var(--sd-font-size-12, 12px)}:host ::ng-deep .fb-column-row.is-active{border-color:var(--sd-primary)}:host ::ng-deep .fb-column-row__type-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 28px;height:28px;border-radius:var(--sd-radius-6, 6px);background:color-mix(in srgb,var(--sd-primary) 10%,var(--sd-surface));color:var(--sd-primary)}:host ::ng-deep .fb-column-row__type-icon .msi{font-size:var(--sd-font-size-16, 16px)}:host ::ng-deep .fb-column-row__meta{display:flex;flex-direction:column;flex:1;min-width:0}:host ::ng-deep .fb-column-row__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500)}:host ::ng-deep .fb-column-row__req{color:var(--sd-error)}:host ::ng-deep .fb-column-row__sub{color:var(--sd-text-secondary);font-family:Roboto Mono,ui-monospace,monospace;font-size:var(--sd-font-size-11, 11px)}:host ::ng-deep .fb-add-link{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;padding:4px 6px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-primary);font-size:var(--sd-font-size-13, 13px);cursor:pointer}:host ::ng-deep .fb-add-link:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}::ng-deep .sd-form-builder-dialog .sd-modal-body{padding:16px;overscroll-behavior:contain}::ng-deep .sd-form-builder-dialog .fb-variables{display:flex;flex-direction:column;gap:10px}::ng-deep .sd-form-builder-dialog .fb-variables__hint{margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px)}::ng-deep .sd-form-builder-dialog .fb-variables__table{width:100%;border-collapse:separate;border-spacing:0;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);overflow:hidden}::ng-deep .sd-form-builder-dialog .fb-variables__table th{padding:8px 12px;border-bottom:1px solid var(--sd-border);background:var(--sd-surface-muted);color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500);text-align:left}::ng-deep .sd-form-builder-dialog .fb-variables__table td{padding:8px 12px;border-bottom:1px solid var(--sd-border);vertical-align:top}::ng-deep .sd-form-builder-dialog .fb-variables__table tbody tr:last-child td{border-bottom:0}::ng-deep .sd-form-builder-dialog .fb-variables__actions-col{width:1px;white-space:nowrap}::ng-deep .sd-form-builder-dialog .fb-variables__empty{margin:0;padding:16px;border:1px dashed var(--sd-border);border-radius:var(--sd-radius-8, 8px);color:var(--sd-text-secondary);text-align:center}::ng-deep .sd-form-builder-dialog .fb-variables__add{align-self:flex-start}::ng-deep .sd-form-builder-dialog .fb-shortcuts{width:100%;border-collapse:collapse}::ng-deep .sd-form-builder-dialog .fb-shortcuts td{padding:8px 4px;border-bottom:1px solid var(--sd-border);color:var(--sd-text);font-size:var(--sd-font-size-13, 13px)}::ng-deep .sd-form-builder-dialog .fb-shortcuts td:first-child{width:55%;white-space:nowrap}::ng-deep .sd-form-builder-dialog .fb-shortcuts kbd{display:inline-block;min-width:20px;padding:1px 6px;border:1px solid var(--sd-border-strong);border-bottom-width:2px;border-radius:var(--sd-radius-4, 4px);background:var(--sd-surface-muted);font-family:Roboto Mono,ui-monospace,monospace;font-size:var(--sd-font-size-12, 12px);text-align:center}\n"], dependencies: [{ kind: "component", type: PaletteComponent, selector: "fb-palette", outputs: ["itemAdded", "itemFocused"] }, { kind: "component", type: CanvasComponent, selector: "fb-canvas", outputs: ["requestAdd", "requestRemove"] }, { kind: "component", type: InspectorComponent, selector: "fb-inspector", outputs: ["requestRemove", "openVariables", "openValidations", "openShortcuts"] }, { kind: "component", type: PreviewComponent, selector: "fb-preview" }, { kind: "component", type: ConfigureValidationComponent, selector: "configure-validation", outputs: ["accept"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdButtonItem, selector: "sd-button-item", inputs: ["color", "prefixIcon", "suffixIcon", "fontSet", "disabled", "tooltip", "autoId"], outputs: ["click"] }, { kind: "component", type: SdButtonItemDivider, selector: "sd-button-item-divider", inputs: ["title"] }, { 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$1, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "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: SdModal, selector: "sd-modal", inputs: ["autoId", "title", "color", "width", "height", "view", "modalClass", "lazyLoadContent", "hideClose", "disableBackdropClose", "beforeClose"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6770
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdFormBuilder, isStandalone: true, selector: "sd-form-builder", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { schema: "schemaChange" }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "class.sd-form-builder--compact": "compact()" }, classAttribute: "sd-form-builder" }, providers: [FormBuilderStore, BuilderDragService], viewQueries: [{ propertyName: "canvas", first: true, predicate: CanvasComponent, descendants: true, isSignal: true }, { propertyName: "palette", first: true, predicate: PaletteComponent, descendants: true, isSignal: true }, { propertyName: "validationDialog", first: true, predicate: ConfigureValidationComponent, descendants: true, isSignal: true }, { propertyName: "variablesModal", first: true, predicate: ["variablesModal"], descendants: true, isSignal: true }, { propertyName: "shortcutsModal", first: true, predicate: ["shortcutsModal"], descendants: true, isSignal: true }, { propertyName: "leftToggle", first: true, predicate: ["leftToggle"], descendants: true, isSignal: true }, { propertyName: "rightToggle", first: true, predicate: ["rightToggle"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _mode = store.mode();\n@let _design = _mode === 'design';\n@let _compact = compact();\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Toolbar n\u1ED9i b\u1ED9 c\u1EE7a component (kh\u00F4ng ph\u1EA3i header \u1EE9ng d\u1EE5ng) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div class=\"fb-toolbar\" role=\"toolbar\" [attr.aria-label]=\"'core.component.form-builder.toolbar' | sdTranslate\">\n @if (_compact && _design) {\n <!-- why: native button \u2014 the panel toggle must expose aria-expanded / aria-controls, which sd-button\n only sets for its own action menu. -->\n <span class=\"fb-toolbar__group\">\n <button\n #leftToggle\n type=\"button\"\n class=\"fb-panel-toggle\"\n [attr.aria-expanded]=\"leftOpen()\"\n [attr.aria-controls]=\"leftPanelId\"\n [attr.aria-label]=\"'core.component.form-builder.tab.components' | sdTranslate\"\n [title]=\"'core.component.form-builder.tab.components' | sdTranslate\"\n (click)=\"togglePanel('left')\">\n <sd-icon name=\"widgets\" size=\"20px\"></sd-icon>\n </button>\n </span>\n }\n\n <!-- why: ph\u00EDm m\u0169i t\u00EAn n\u1ED5i b\u1ECDt t\u1EEB n\u00FAt radio \u0111ang focus (m\u1EABu radiogroup c\u1EE7a APG); b\u1EA3n th\u00E2n nh\u00F3m kh\u00F4ng ph\u1EA3i \u0111i\u1EC3m focus. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"fb-seg\"\n role=\"radiogroup\"\n [attr.aria-label]=\"'core.component.form-builder.mode' | sdTranslate\"\n (keydown)=\"onSegmentKeydown($event, modes, _mode, applyMode)\">\n @for (mode of modes; track mode) {\n <button\n type=\"button\"\n role=\"radio\"\n class=\"fb-seg__btn\"\n [attr.data-value]=\"mode\"\n [class.is-active]=\"_mode === mode\"\n [attr.aria-checked]=\"_mode === mode\"\n [attr.tabindex]=\"_mode === mode ? 0 : -1\"\n [title]=\"'core.component.form-builder.mode.' + mode | sdTranslate\"\n (click)=\"setMode(mode)\">\n <sd-icon [name]=\"modeIcons[mode]\" size=\"18px\"></sd-icon>\n <span class=\"fb-seg__label\">{{ 'core.component.form-builder.mode.' + mode | sdTranslate }}</span>\n </button>\n }\n </div>\n\n <!-- why: Desktop/Tablet/Mobile ch\u1ECDn m\u1EE9c b\u1ED1 c\u1EE5c \u0111ang thi\u1EBFt k\u1EBF v\u00E0 m\u1EE9c Xem tr\u01B0\u1EDBc \u00E9p cho renderer \u2014\n \u1EA9n \u1EDF Schema. -->\n @if (_mode !== 'schema') {\n @let _viewport = store.viewport();\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"fb-seg\"\n role=\"radiogroup\"\n [attr.aria-label]=\"'core.component.form-builder.viewport' | sdTranslate\"\n (keydown)=\"onSegmentKeydown($event, viewports, _viewport, applyViewport)\">\n @for (viewport of viewports; track viewport) {\n <button\n type=\"button\"\n role=\"radio\"\n class=\"fb-seg__btn\"\n [attr.data-value]=\"viewport\"\n [class.is-active]=\"_viewport === viewport\"\n [attr.aria-checked]=\"_viewport === viewport\"\n [attr.tabindex]=\"_viewport === viewport ? 0 : -1\"\n [title]=\"'core.component.form-builder.viewport.' + viewport | sdTranslate\"\n (click)=\"setViewport(viewport)\">\n <sd-icon [name]=\"viewportIcons[viewport]\" size=\"18px\"></sd-icon>\n <span class=\"fb-seg__label\">{{ 'core.component.form-builder.viewport.' + viewport | sdTranslate }}</span>\n </button>\n }\n </div>\n }\n\n <span class=\"fb-toolbar__spacer\"></span>\n\n <span class=\"fb-toolbar__group\">\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"undo\"\n [disabled]=\"!store.canUndo()\"\n [tooltip]=\"(_design ? 'core.component.form-builder.undo-hint' : 'core.component.form-builder.design-only') | sdTranslate\"\n (click)=\"undo()\"></sd-button>\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"redo\"\n [disabled]=\"!store.canRedo()\"\n [tooltip]=\"(_design ? 'core.component.form-builder.redo-hint' : 'core.component.form-builder.design-only') | sdTranslate\"\n (click)=\"redo()\"></sd-button>\n <!-- C\u00F4ng c\u1EE5: CH\u1EC8 c\u00E1c thao t\u00E1c thi\u1EBFt k\u1EBF c\u00F3 th\u1EADt (action popover c\u1EE7a Core). -->\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"more_vert\"\n [disabled]=\"!_design\"\n [tooltip]=\"(_design ? 'core.component.form-builder.tools' : 'core.component.form-builder.design-only') | sdTranslate\">\n <sd-button-item prefixIcon=\"data_array\" (click)=\"openVariables()\">\n {{ 'core.component.form-builder.tools.variables' | sdTranslate: { count: store.doc().variables.length } }}\n </sd-button-item>\n <sd-button-item prefixIcon=\"rule\" (click)=\"openValidations()\">\n {{ 'core.component.form-builder.tools.validations' | sdTranslate: { count: store.doc().validations.length } }}\n </sd-button-item>\n <sd-button-item-divider></sd-button-item-divider>\n <sd-button-item prefixIcon=\"keyboard\" (click)=\"openShortcuts()\">{{\n 'core.component.form-builder.shortcuts' | sdTranslate\n }}</sd-button-item>\n </sd-button>\n </span>\n\n @if (_compact && _design) {\n <span class=\"fb-toolbar__group\">\n <button\n #rightToggle\n type=\"button\"\n class=\"fb-panel-toggle\"\n [attr.aria-expanded]=\"rightOpen()\"\n [attr.aria-controls]=\"rightPanelId\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\"\n [title]=\"'core.component.form-builder.attribute' | sdTranslate\"\n (click)=\"togglePanel('right')\">\n <sd-icon name=\"tune\" size=\"20px\"></sd-icon>\n </button>\n </span>\n }\n</div>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Th\u00E2n: palette \u00B7 canvas \u00B7 inspector \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div class=\"fb-body\" [class.fb-body--full]=\"!_design\">\n @if (_design) {\n <section\n class=\"fb-side fb-side--left\"\n [id]=\"leftPanelId\"\n [class.is-open]=\"leftOpen()\"\n [attr.aria-label]=\"'core.component.form-builder.left-panel' | sdTranslate\">\n <fb-palette (itemAdded)=\"onItemAdded($event)\" (itemFocused)=\"onItemFocused($event)\"></fb-palette>\n </section>\n }\n\n <!-- why: kh\u00F4ng d\u00F9ng <main>/<aside> \u2014 builder l\u00E0 widget nh\u00FAng, landmark main/complementary c\u1EE7a n\u00F3\n s\u1EBD tr\u00F9ng v\u1EDBi landmark c\u1EE7a trang ch\u1EE7 (v\u00E0 nh\u00E2n \u0111\u00F4i khi c\u00F3 hai builder). Panel l\u00E0 v\u00F9ng c\u00F3 t\u00EAn. -->\n <div class=\"fb-main\">\n @switch (_mode) {\n @case ('design') {\n <div class=\"fb-page-editor\">\n <div class=\"fb-pages\" role=\"group\" [attr.aria-label]=\"'core.component.form-generic.pages' | sdTranslate\">\n <div class=\"fb-pages__strip\">\n @for (page of store.pages(); track page.id; let index = $index) {\n <button\n type=\"button\"\n class=\"fb-page-tab\"\n [attr.data-builder-page]=\"page.id\"\n [attr.aria-pressed]=\"store.activePage().id === page.id\"\n [class.is-active]=\"store.activePage().id === page.id\"\n [class.has-rules]=\"!!page.rules?.visible || !!page.rules?.hidden\"\n (focus)=\"revealPageHeader($event)\"\n (click)=\"store.selectPage(page.id); store.select(null); revealPageHeader($event)\">\n @if (page.icon) {\n <sd-icon [name]=\"page.icon\" size=\"16px\"></sd-icon>\n }\n {{ page.label || ('core.component.form-generic.page' | sdTranslate: { number: index + 1 }) }}\n @if (page.rules?.visible || page.rules?.hidden) {\n <sd-icon name=\"visibility\" size=\"16px\" [title]=\"'core.component.form-builder.page.rules-hint' | sdTranslate\"></sd-icon>\n }\n </button>\n }\n </div>\n <div class=\"fb-pages__actions\">\n <button\n type=\"button\"\n data-page-action=\"add\"\n [title]=\"'core.component.form-builder.page.add' | sdTranslate\"\n [attr.aria-label]=\"'core.component.form-builder.page.add' | sdTranslate\"\n (click)=\"store.addPage()\">\n <sd-icon name=\"add\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n data-page-action=\"duplicate\"\n [disabled]=\"!store.canDuplicatePage()\"\n [title]=\"\n (store.canDuplicatePage() ? 'core.component.form-builder.duplicate' : 'core.component.form-builder.page.unsupported')\n | sdTranslate\n \"\n [attr.aria-label]=\"'core.component.form-builder.duplicate' | sdTranslate\"\n [attr.aria-describedby]=\"!store.canDuplicatePage() ? leftPanelId + '-page-duplicate-reason' : null\"\n (click)=\"store.duplicatePage()\">\n <sd-icon name=\"content_copy\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n data-page-action=\"up\"\n [disabled]=\"pageIndex() <= 0\"\n [title]=\"'core.component.form-builder.move-up' | sdTranslate\"\n [attr.aria-label]=\"'core.component.form-builder.move-up' | sdTranslate\"\n (click)=\"store.movePage(store.activePage().id, -1)\">\n <sd-icon name=\"arrow_back\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n data-page-action=\"down\"\n [disabled]=\"pageIndex() >= store.pages().length - 1\"\n [title]=\"'core.component.form-builder.move-down' | sdTranslate\"\n [attr.aria-label]=\"'core.component.form-builder.move-down' | sdTranslate\"\n (click)=\"store.movePage(store.activePage().id, 1)\">\n <sd-icon name=\"arrow_forward\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n data-page-action=\"delete\"\n [disabled]=\"store.pages().length <= 1\"\n [title]=\"'core.component.form-builder.delete' | sdTranslate\"\n [attr.aria-label]=\"'core.component.form-builder.delete' | sdTranslate\"\n (click)=\"removePage()\">\n <sd-icon name=\"delete\" size=\"18px\"></sd-icon>\n </button>\n </div>\n </div>\n @if (!store.canDuplicatePage()) {\n <p class=\"fb-page-note\" [id]=\"leftPanelId + '-page-duplicate-reason'\">\n {{ 'core.component.form-builder.page.unsupported' | sdTranslate }}\n </p>\n }\n <fb-canvas (requestAdd)=\"focusPalette()\" (requestRemove)=\"remove($event)\"></fb-canvas>\n </div>\n }\n @case ('preview') {\n <fb-preview></fb-preview>\n }\n @case ('schema') {\n <div class=\"fb-schema\">\n <p class=\"fb-schema__note\">\n <sd-icon name=\"lock\" size=\"16px\"></sd-icon>{{ 'core.component.form-builder.schema.readonly' | sdTranslate }}\n </p>\n <sd-code-editor language=\"json\" viewed maxHeight=\"none\" [model]=\"schemaText()\"></sd-code-editor>\n </div>\n }\n }\n </div>\n\n @if (_design) {\n <section\n class=\"fb-side fb-side--right\"\n [id]=\"rightPanelId\"\n [class.is-open]=\"rightOpen()\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\">\n <fb-inspector\n (requestRemove)=\"remove($event)\"\n (openVariables)=\"openVariables()\"\n (openValidations)=\"openValidations()\"\n (openShortcuts)=\"openShortcuts()\"></fb-inspector>\n </section>\n }\n\n @if (_compact && (leftOpen() || rightOpen())) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div class=\"fb-scrim\" (click)=\"leftOpen.set(false); rightOpen.set(false)\"></div>\n }\n</div>\n\n<div class=\"fb-live\" aria-live=\"polite\" aria-atomic=\"true\">{{ store.announcement() }}</div>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: bi\u1EBFn \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<sd-modal\n #variablesModal\n [title]=\"'core.component.form-builder.config-variable' | sdTranslate\"\n view=\"dialog\"\n width=\"720px\"\n modalClass=\"sd-form-builder-dialog\">\n <div class=\"fb-variables\">\n <p class=\"fb-variables__hint\">{{ 'core.component.form-builder.variables-hint' | sdTranslate }}</p>\n @if (variableDrafts().length) {\n <table class=\"fb-variables__table\">\n <thead>\n <tr>\n <th scope=\"col\">{{ 'core.component.form-builder.field-key' | sdTranslate }}</th>\n <th scope=\"col\">{{ 'core.component.form-builder.display-label' | sdTranslate }}</th>\n <th scope=\"col\" class=\"fb-variables__actions-col\" [attr.aria-label]=\"'core.component.form-builder.delete' | sdTranslate\"></th>\n </tr>\n </thead>\n <tbody>\n @for (draft of variableDrafts(); track draft.id; let index = $index) {\n <tr>\n <td>\n <sd-input\n size=\"sm\"\n [placeholder]=\"'core.component.form-builder.field-key' | sdTranslate\"\n [model]=\"draft.key\"\n (modelChange)=\"updateVariable(index, 'key', $event)\"\n [inlineError]=\"variableErrors()[index] || undefined\"></sd-input>\n </td>\n <td>\n <sd-input\n size=\"sm\"\n [placeholder]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"draft.label\"\n (modelChange)=\"updateVariable(index, 'label', $event)\"></sd-input>\n </td>\n <td class=\"fb-variables__actions-col\">\n <sd-button\n prefixIcon=\"delete\"\n type=\"text\"\n color=\"error\"\n [tooltip]=\"'core.component.form-builder.delete' | sdTranslate\"\n (click)=\"removeVariable(index)\"></sd-button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n } @else {\n <p class=\"fb-variables__empty\">{{ 'core.component.form-builder.no-variable' | sdTranslate }}</p>\n }\n <sd-button\n class=\"fb-variables__add\"\n type=\"text\"\n color=\"primary\"\n prefixIcon=\"add\"\n [title]=\"'core.component.form-builder.add-variable' | sdTranslate\"\n (click)=\"addVariable()\"></sd-button>\n </div>\n <ng-container sdFooterRight>\n <sd-button\n type=\"fill\"\n color=\"primary\"\n prefixIcon=\"check\"\n [disabled]=\"variablesInvalid()\"\n [title]=\"'core.component.form-builder.confirm' | sdTranslate\"\n (click)=\"saveVariables()\"></sd-button>\n </ng-container>\n</sd-modal>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: x\u00E1c th\u1EF1c c\u1EA5p form (component c\u00F3 s\u1EB5n) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<configure-validation (accept)=\"onValidationsAccepted($event)\"></configure-validation>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: ph\u00EDm t\u1EAFt \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<sd-modal\n #shortcutsModal\n [title]=\"'core.component.form-builder.shortcuts' | sdTranslate\"\n view=\"dialog\"\n width=\"560px\"\n modalClass=\"sd-form-builder-dialog\">\n <table class=\"fb-shortcuts\">\n <tbody>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>Z</kbd></td>\n <td>{{ 'core.component.form-builder.undo' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>Y</kbd> / <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Z</kbd></td>\n <td>{{ 'core.component.form-builder.redo' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Enter</kbd> / <kbd>Space</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.select' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Alt</kbd> + <kbd>\u2191</kbd> / <kbd>\u2193</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.move' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>D</kbd></td>\n <td>{{ 'core.component.form-builder.duplicate' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Delete</kbd></td>\n <td>{{ 'core.component.form-builder.delete' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Esc</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.escape' | sdTranslate }}</td>\n </tr>\n </tbody>\n </table>\n</sd-modal>\n", styles: [":host{--md-sys-color-primary: var(--sd-primary);--md-sys-color-on-primary: var(--sd-primary-contrast);--md-sys-color-primary-container: color-mix(in srgb, var(--sd-primary) 12%, var(--sd-surface));--md-sys-color-surface: var(--sd-surface);--md-sys-color-surface-container-lowest: var(--sd-surface);--md-sys-color-surface-container-low: var(--sd-surface-muted);--md-sys-color-surface-container: var(--sd-surface-muted);--md-sys-color-surface-container-high: var(--sd-surface-muted);--md-sys-color-surface-container-highest: var(--sd-surface-muted);--md-sys-color-on-surface: var(--sd-text);--md-sys-color-on-surface-variant: var(--sd-text-secondary);--md-sys-color-outline: var(--sd-border-strong);--md-sys-color-outline-variant: var(--sd-border);--md-sys-color-error: var(--sd-error);--md-sys-color-error-container: var(--sd-error-light);--md-sys-color-success: var(--sd-success);--r-xs: var(--sd-radius-4, 4px);--r-sm: var(--sd-radius-8, 8px);position:relative;display:flex;flex-direction:column;box-sizing:border-box;width:100%;height:var(--sd-form-builder-height, 100%);min-height:var(--sd-form-builder-min-height, 520px);overflow:hidden;border:1px solid var(--sd-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-surface);color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);container:sd-form-builder/inline-size}.fb-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;flex:0 0 auto;min-height:52px;padding:8px 12px;border-bottom:1px solid var(--sd-border);background:var(--sd-surface)}.fb-page-editor{display:flex;flex-direction:column;height:100%;min-width:0;min-height:0}.fb-page-editor fb-canvas{flex:1;min-height:0}.fb-page-note{margin:0;padding:4px 8px;font-size:12px;color:var(--sd-text-secondary)}.fb-pages{display:flex;flex-wrap:wrap;gap:4px;padding:6px;border-bottom:1px solid var(--sd-border)}.fb-pages__strip{display:flex;flex:1 1 180px;padding:3px;min-width:0;overflow-x:auto;gap:4px}.fb-pages__actions{display:flex;flex:0 0 auto}.fb-page-tab,.fb-pages__actions button{display:inline-flex;align-items:center;justify-content:center;gap:4px;flex:0 0 auto;min-height:36px;min-width:36px;padding:6px 8px;border:1px solid transparent;border-radius:var(--sd-radius-4, 4px);background:var(--sd-surface);color:var(--sd-text);font:inherit;cursor:pointer;white-space:nowrap}.fb-page-tab:focus-visible,.fb-pages__actions button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:1px}.fb-page-tab:disabled,.fb-pages__actions button:disabled{opacity:.5;cursor:default}.fb-page-tab.is-active,.fb-pages__actions button.is-active{border-color:var(--sd-primary);color:var(--sd-primary);background:var(--sd-primary-light)}.fb-page-tab.has-rules,.fb-pages__actions button.has-rules{border-style:dashed}.fb-toolbar__spacer{flex:1}.fb-toolbar__group{display:inline-flex;align-items:center;gap:2px}.fb-seg{display:inline-flex;padding:2px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface-muted)}.fb-seg__btn{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer;white-space:nowrap}.fb-seg__btn:hover{color:var(--sd-text)}.fb-seg__btn.is-active{background:var(--sd-primary);color:var(--sd-primary-contrast)}.fb-seg__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:1px}.fb-panel-toggle{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);cursor:pointer}.fb-panel-toggle:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.fb-panel-toggle[aria-expanded=true]{background:color-mix(in srgb,var(--sd-primary) 12%,var(--sd-surface));color:var(--sd-primary)}.fb-panel-toggle:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:1px}@container sd-form-builder (max-width: 720px){.fb-seg__label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fb-seg__btn{padding:0 10px}}.fb-body{position:relative;display:grid;grid-template-columns:248px minmax(0,1fr) 320px;flex:1;min-height:0}.fb-body--full{grid-template-columns:minmax(0,1fr)}@container sd-form-builder (max-width: 1180px){.fb-body:not(.fb-body--full){grid-template-columns:216px minmax(0,1fr) 288px}}@container sd-form-builder (max-width: 1000px){.fb-body:not(.fb-body--full){grid-template-columns:196px minmax(0,1fr) 264px}}.fb-side{display:flex;flex-direction:column;min-height:0;min-width:0;background:var(--sd-surface)}.fb-side--left{border-right:1px solid var(--sd-border)}.fb-side--right{border-left:1px solid var(--sd-border)}.fb-main{display:flex;flex-direction:column;min-width:0;min-height:0}:host(.sd-form-builder--compact) .fb-body:not(.fb-body--full){grid-template-columns:minmax(0,1fr)}:host(.sd-form-builder--compact) .fb-side{position:absolute;top:0;bottom:0;z-index:20;width:min(320px,88%);box-shadow:var(--sd-shadow-lg, 0 8px 24px rgba(0, 0, 0, .16));visibility:hidden;transition:transform var(--sd-duration-base, .2s) ease,visibility 0s linear var(--sd-duration-base, .2s)}:host(.sd-form-builder--compact) .fb-side--left{left:0;transform:translate(-100%)}:host(.sd-form-builder--compact) .fb-side--right{right:0;transform:translate(100%)}:host(.sd-form-builder--compact) .fb-side.is-open{visibility:visible;transform:none;transition:transform var(--sd-duration-base, .2s) ease}.fb-scrim{position:absolute;inset:0;z-index:15;background:var(--sd-overlay-backdrop, rgba(0, 0, 0, .32))}.fb-schema{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;overflow:auto;padding:16px 20px 24px;background:var(--sd-surface-muted)}.fb-schema__note{display:inline-flex;align-items:center;gap:6px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px)}.fb-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}:host ::ng-deep .msi{font-family:Material Icons Outlined;font-weight:400;font-style:normal;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;direction:ltr;font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}:host ::ng-deep .mono{font-family:Roboto Mono,ui-monospace,monospace}:host ::ng-deep .fb-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);cursor:pointer}:host ::ng-deep .fb-icon-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}:host ::ng-deep .fb-icon-btn.danger:hover{color:var(--sd-error)}:host ::ng-deep .fb-icon-btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}:host ::ng-deep .fb-icon-btn .msi{font-size:var(--sd-font-size-18, 18px)}:host ::ng-deep details.fb-section{margin:0;padding:0;border-bottom:1px solid var(--sd-border)}:host ::ng-deep details.fb-section>summary{list-style:none}:host ::ng-deep details.fb-section>summary::-webkit-details-marker{display:none}:host ::ng-deep .fb-section__head{display:flex;align-items:center;gap:8px;min-height:32px;cursor:pointer;color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-semibold, 600);-webkit-user-select:none;user-select:none}:host ::ng-deep .fb-section__head .msi{font-size:var(--sd-font-size-16, 16px);color:var(--sd-text-secondary)}:host ::ng-deep .fb-section__head .fb-section__title{flex:1;min-width:0}:host ::ng-deep .fb-section__head .chev{margin-left:auto;transition:transform var(--sd-duration-fast, .12s) ease}:host ::ng-deep details.fb-section[open] .fb-section__head .chev{transform:rotate(90deg)}:host ::ng-deep .fb-section__body{display:flex;flex-direction:column;gap:8px;padding:4px 0 12px}:host ::ng-deep .fb-columns-list{display:flex;flex-direction:column;gap:4px}:host ::ng-deep .fb-column-row{display:flex;align-items:center;gap:8px;min-height:40px;padding:6px 8px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface);font-size:var(--sd-font-size-12, 12px)}:host ::ng-deep .fb-column-row.is-active{border-color:var(--sd-primary)}:host ::ng-deep .fb-column-row__type-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 28px;height:28px;border-radius:var(--sd-radius-6, 6px);background:color-mix(in srgb,var(--sd-primary) 10%,var(--sd-surface));color:var(--sd-primary)}:host ::ng-deep .fb-column-row__type-icon .msi{font-size:var(--sd-font-size-16, 16px)}:host ::ng-deep .fb-column-row__meta{display:flex;flex-direction:column;flex:1;min-width:0}:host ::ng-deep .fb-column-row__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500)}:host ::ng-deep .fb-column-row__req{color:var(--sd-error)}:host ::ng-deep .fb-column-row__sub{color:var(--sd-text-secondary);font-family:Roboto Mono,ui-monospace,monospace;font-size:var(--sd-font-size-11, 11px)}:host ::ng-deep .fb-add-link{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;padding:4px 6px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-primary);font-size:var(--sd-font-size-13, 13px);cursor:pointer}:host ::ng-deep .fb-add-link:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}::ng-deep .sd-form-builder-dialog .sd-modal-body{padding:16px;overscroll-behavior:contain}::ng-deep .sd-form-builder-dialog .fb-variables{display:flex;flex-direction:column;gap:10px}::ng-deep .sd-form-builder-dialog .fb-variables__hint{margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px)}::ng-deep .sd-form-builder-dialog .fb-variables__table{width:100%;border-collapse:separate;border-spacing:0;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);overflow:hidden}::ng-deep .sd-form-builder-dialog .fb-variables__table th{padding:8px 12px;border-bottom:1px solid var(--sd-border);background:var(--sd-surface-muted);color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500);text-align:left}::ng-deep .sd-form-builder-dialog .fb-variables__table td{padding:8px 12px;border-bottom:1px solid var(--sd-border);vertical-align:top}::ng-deep .sd-form-builder-dialog .fb-variables__table tbody tr:last-child td{border-bottom:0}::ng-deep .sd-form-builder-dialog .fb-variables__actions-col{width:1px;white-space:nowrap}::ng-deep .sd-form-builder-dialog .fb-variables__empty{margin:0;padding:16px;border:1px dashed var(--sd-border);border-radius:var(--sd-radius-8, 8px);color:var(--sd-text-secondary);text-align:center}::ng-deep .sd-form-builder-dialog .fb-variables__add{align-self:flex-start}::ng-deep .sd-form-builder-dialog .fb-shortcuts{width:100%;border-collapse:collapse}::ng-deep .sd-form-builder-dialog .fb-shortcuts td{padding:8px 4px;border-bottom:1px solid var(--sd-border);color:var(--sd-text);font-size:var(--sd-font-size-13, 13px)}::ng-deep .sd-form-builder-dialog .fb-shortcuts td:first-child{width:55%;white-space:nowrap}::ng-deep .sd-form-builder-dialog .fb-shortcuts kbd{display:inline-block;min-width:20px;padding:1px 6px;border:1px solid var(--sd-border-strong);border-bottom-width:2px;border-radius:var(--sd-radius-4, 4px);background:var(--sd-surface-muted);font-family:Roboto Mono,ui-monospace,monospace;font-size:var(--sd-font-size-12, 12px);text-align:center}\n"], dependencies: [{ kind: "component", type: PaletteComponent, selector: "fb-palette", outputs: ["itemAdded", "itemFocused"] }, { kind: "component", type: CanvasComponent, selector: "fb-canvas", outputs: ["requestAdd", "requestRemove"] }, { kind: "component", type: InspectorComponent, selector: "fb-inspector", outputs: ["requestRemove", "openVariables", "openValidations", "openShortcuts"] }, { kind: "component", type: PreviewComponent, selector: "fb-preview" }, { kind: "component", type: ConfigureValidationComponent, selector: "configure-validation", outputs: ["accept"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdButtonItem, selector: "sd-button-item", inputs: ["color", "prefixIcon", "suffixIcon", "fontSet", "disabled", "tooltip", "autoId"], outputs: ["click"] }, { kind: "component", type: SdButtonItemDivider, selector: "sd-button-item-divider", inputs: ["title"] }, { 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$1, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "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: SdModal, selector: "sd-modal", inputs: ["autoId", "title", "color", "width", "height", "view", "modalClass", "lazyLoadContent", "hideClose", "disableBackdropClose", "beforeClose"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6168
6771
|
}
|
|
6169
6772
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFormBuilder, decorators: [{
|
|
6170
6773
|
type: Component,
|
|
@@ -6186,7 +6789,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
6186
6789
|
SdInput$1,
|
|
6187
6790
|
SdModal,
|
|
6188
6791
|
SdTranslatePipe,
|
|
6189
|
-
], template: "@let _mode = store.mode();\n@let _design = _mode === 'design';\n@let _compact = compact();\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Toolbar n\u1ED9i b\u1ED9 c\u1EE7a component (kh\u00F4ng ph\u1EA3i header \u1EE9ng d\u1EE5ng) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div class=\"fb-toolbar\" role=\"toolbar\" [attr.aria-label]=\"'core.component.form-builder.toolbar' | sdTranslate\">\n @if (_compact && _design) {\n <!-- why: native button \u2014 the panel toggle must expose aria-expanded / aria-controls, which sd-button\n only sets for its own action menu. -->\n <span class=\"fb-toolbar__group\">\n <button\n #leftToggle\n type=\"button\"\n class=\"fb-panel-toggle\"\n [attr.aria-expanded]=\"leftOpen()\"\n [attr.aria-controls]=\"leftPanelId\"\n [attr.aria-label]=\"'core.component.form-builder.tab.components' | sdTranslate\"\n [title]=\"'core.component.form-builder.tab.components' | sdTranslate\"\n (click)=\"togglePanel('left')\">\n <sd-icon name=\"widgets\" size=\"20px\"></sd-icon>\n </button>\n </span>\n }\n\n <!-- why: ph\u00EDm m\u0169i t\u00EAn n\u1ED5i b\u1ECDt t\u1EEB n\u00FAt radio \u0111ang focus (m\u1EABu radiogroup c\u1EE7a APG); b\u1EA3n th\u00E2n nh\u00F3m kh\u00F4ng ph\u1EA3i \u0111i\u1EC3m focus. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"fb-seg\"\n role=\"radiogroup\"\n [attr.aria-label]=\"'core.component.form-builder.mode' | sdTranslate\"\n (keydown)=\"onSegmentKeydown($event, modes, _mode, applyMode)\">\n @for (mode of modes; track mode) {\n <button\n type=\"button\"\n role=\"radio\"\n class=\"fb-seg__btn\"\n [attr.data-value]=\"mode\"\n [class.is-active]=\"_mode === mode\"\n [attr.aria-checked]=\"_mode === mode\"\n [attr.tabindex]=\"_mode === mode ? 0 : -1\"\n [title]=\"'core.component.form-builder.mode.' + mode | sdTranslate\"\n (click)=\"setMode(mode)\">\n <sd-icon [name]=\"modeIcons[mode]\" size=\"18px\"></sd-icon>\n <span class=\"fb-seg__label\">{{ 'core.component.form-builder.mode.' + mode | sdTranslate }}</span>\n </button>\n }\n </div>\n\n <!-- why: Desktop/Tablet/Mobile ch\u1ECDn m\u1EE9c b\u1ED1 c\u1EE5c \u0111ang thi\u1EBFt k\u1EBF v\u00E0 m\u1EE9c Xem tr\u01B0\u1EDBc \u00E9p cho renderer \u2014\n \u1EA9n \u1EDF Schema. -->\n @if (_mode !== 'schema') {\n @let _viewport = store.viewport();\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"fb-seg\"\n role=\"radiogroup\"\n [attr.aria-label]=\"'core.component.form-builder.viewport' | sdTranslate\"\n (keydown)=\"onSegmentKeydown($event, viewports, _viewport, applyViewport)\">\n @for (viewport of viewports; track viewport) {\n <button\n type=\"button\"\n role=\"radio\"\n class=\"fb-seg__btn\"\n [attr.data-value]=\"viewport\"\n [class.is-active]=\"_viewport === viewport\"\n [attr.aria-checked]=\"_viewport === viewport\"\n [attr.tabindex]=\"_viewport === viewport ? 0 : -1\"\n [title]=\"'core.component.form-builder.viewport.' + viewport | sdTranslate\"\n (click)=\"setViewport(viewport)\">\n <sd-icon [name]=\"viewportIcons[viewport]\" size=\"18px\"></sd-icon>\n <span class=\"fb-seg__label\">{{ 'core.component.form-builder.viewport.' + viewport | sdTranslate }}</span>\n </button>\n }\n </div>\n }\n\n <span class=\"fb-toolbar__spacer\"></span>\n\n <span class=\"fb-toolbar__group\">\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"undo\"\n [disabled]=\"!store.canUndo()\"\n [tooltip]=\"(_design ? 'core.component.form-builder.undo-hint' : 'core.component.form-builder.design-only') | sdTranslate\"\n (click)=\"undo()\"></sd-button>\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"redo\"\n [disabled]=\"!store.canRedo()\"\n [tooltip]=\"(_design ? 'core.component.form-builder.redo-hint' : 'core.component.form-builder.design-only') | sdTranslate\"\n (click)=\"redo()\"></sd-button>\n <!-- C\u00F4ng c\u1EE5: CH\u1EC8 c\u00E1c thao t\u00E1c thi\u1EBFt k\u1EBF c\u00F3 th\u1EADt (action popover c\u1EE7a Core). -->\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"more_vert\"\n [disabled]=\"!_design\"\n [tooltip]=\"(_design ? 'core.component.form-builder.tools' : 'core.component.form-builder.design-only') | sdTranslate\">\n <sd-button-item prefixIcon=\"data_array\" (click)=\"openVariables()\">\n {{ 'core.component.form-builder.tools.variables' | sdTranslate: { count: store.doc().variables.length } }}\n </sd-button-item>\n <sd-button-item prefixIcon=\"rule\" (click)=\"openValidations()\">\n {{ 'core.component.form-builder.tools.validations' | sdTranslate: { count: store.doc().validations.length } }}\n </sd-button-item>\n <sd-button-item-divider></sd-button-item-divider>\n <sd-button-item prefixIcon=\"keyboard\" (click)=\"openShortcuts()\">{{\n 'core.component.form-builder.shortcuts' | sdTranslate\n }}</sd-button-item>\n </sd-button>\n </span>\n\n @if (_compact && _design) {\n <span class=\"fb-toolbar__group\">\n <button\n #rightToggle\n type=\"button\"\n class=\"fb-panel-toggle\"\n [attr.aria-expanded]=\"rightOpen()\"\n [attr.aria-controls]=\"rightPanelId\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\"\n [title]=\"'core.component.form-builder.attribute' | sdTranslate\"\n (click)=\"togglePanel('right')\">\n <sd-icon name=\"tune\" size=\"20px\"></sd-icon>\n </button>\n </span>\n }\n</div>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Th\u00E2n: palette \u00B7 canvas \u00B7 inspector \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div class=\"fb-body\" [class.fb-body--full]=\"!_design\">\n @if (_design) {\n <section\n class=\"fb-side fb-side--left\"\n [id]=\"leftPanelId\"\n [class.is-open]=\"leftOpen()\"\n [attr.aria-label]=\"'core.component.form-builder.left-panel' | sdTranslate\">\n <fb-palette (itemAdded)=\"onItemAdded($event)\" (itemFocused)=\"onItemFocused($event)\"></fb-palette>\n </section>\n }\n\n <!-- why: kh\u00F4ng d\u00F9ng <main>/<aside> \u2014 builder l\u00E0 widget nh\u00FAng, landmark main/complementary c\u1EE7a n\u00F3\n s\u1EBD tr\u00F9ng v\u1EDBi landmark c\u1EE7a trang ch\u1EE7 (v\u00E0 nh\u00E2n \u0111\u00F4i khi c\u00F3 hai builder). Panel l\u00E0 v\u00F9ng c\u00F3 t\u00EAn. -->\n <div class=\"fb-main\">\n @switch (_mode) {\n @case ('design') {\n <fb-canvas (requestAdd)=\"focusPalette()\" (requestRemove)=\"remove($event)\"></fb-canvas>\n }\n @case ('preview') {\n <fb-preview></fb-preview>\n }\n @case ('schema') {\n <div class=\"fb-schema\">\n <p class=\"fb-schema__note\">\n <sd-icon name=\"lock\" size=\"16px\"></sd-icon>{{ 'core.component.form-builder.schema.readonly' | sdTranslate }}\n </p>\n <sd-code-editor language=\"json\" viewed maxHeight=\"none\" [model]=\"schemaText()\"></sd-code-editor>\n </div>\n }\n }\n </div>\n\n @if (_design) {\n <section\n class=\"fb-side fb-side--right\"\n [id]=\"rightPanelId\"\n [class.is-open]=\"rightOpen()\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\">\n <fb-inspector\n (requestRemove)=\"remove($event)\"\n (openVariables)=\"openVariables()\"\n (openValidations)=\"openValidations()\"\n (openShortcuts)=\"openShortcuts()\"></fb-inspector>\n </section>\n }\n\n @if (_compact && (leftOpen() || rightOpen())) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div class=\"fb-scrim\" (click)=\"leftOpen.set(false); rightOpen.set(false)\"></div>\n }\n</div>\n\n<div class=\"fb-live\" aria-live=\"polite\" aria-atomic=\"true\">{{ store.announcement() }}</div>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: bi\u1EBFn \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<sd-modal\n #variablesModal\n [title]=\"'core.component.form-builder.config-variable' | sdTranslate\"\n view=\"dialog\"\n width=\"720px\"\n modalClass=\"sd-form-builder-dialog\">\n <div class=\"fb-variables\">\n <p class=\"fb-variables__hint\">{{ 'core.component.form-builder.variables-hint' | sdTranslate }}</p>\n @if (variableDrafts().length) {\n <table class=\"fb-variables__table\">\n <thead>\n <tr>\n <th scope=\"col\">{{ 'core.component.form-builder.field-key' | sdTranslate }}</th>\n <th scope=\"col\">{{ 'core.component.form-builder.display-label' | sdTranslate }}</th>\n <th scope=\"col\" class=\"fb-variables__actions-col\" [attr.aria-label]=\"'core.component.form-builder.delete' | sdTranslate\"></th>\n </tr>\n </thead>\n <tbody>\n @for (draft of variableDrafts(); track draft.id; let index = $index) {\n <tr>\n <td>\n <sd-input\n size=\"sm\"\n [placeholder]=\"'core.component.form-builder.field-key' | sdTranslate\"\n [model]=\"draft.key\"\n (modelChange)=\"updateVariable(index, 'key', $event)\"\n [inlineError]=\"variableErrors()[index] || undefined\"></sd-input>\n </td>\n <td>\n <sd-input\n size=\"sm\"\n [placeholder]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"draft.label\"\n (modelChange)=\"updateVariable(index, 'label', $event)\"></sd-input>\n </td>\n <td class=\"fb-variables__actions-col\">\n <sd-button\n prefixIcon=\"delete\"\n type=\"text\"\n color=\"error\"\n [tooltip]=\"'core.component.form-builder.delete' | sdTranslate\"\n (click)=\"removeVariable(index)\"></sd-button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n } @else {\n <p class=\"fb-variables__empty\">{{ 'core.component.form-builder.no-variable' | sdTranslate }}</p>\n }\n <sd-button\n class=\"fb-variables__add\"\n type=\"text\"\n color=\"primary\"\n prefixIcon=\"add\"\n [title]=\"'core.component.form-builder.add-variable' | sdTranslate\"\n (click)=\"addVariable()\"></sd-button>\n </div>\n <ng-container sdFooterRight>\n <sd-button\n type=\"fill\"\n color=\"primary\"\n prefixIcon=\"check\"\n [disabled]=\"variablesInvalid()\"\n [title]=\"'core.component.form-builder.confirm' | sdTranslate\"\n (click)=\"saveVariables()\"></sd-button>\n </ng-container>\n</sd-modal>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: x\u00E1c th\u1EF1c c\u1EA5p form (component c\u00F3 s\u1EB5n) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<configure-validation (accept)=\"onValidationsAccepted($event)\"></configure-validation>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: ph\u00EDm t\u1EAFt \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<sd-modal\n #shortcutsModal\n [title]=\"'core.component.form-builder.shortcuts' | sdTranslate\"\n view=\"dialog\"\n width=\"560px\"\n modalClass=\"sd-form-builder-dialog\">\n <table class=\"fb-shortcuts\">\n <tbody>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>Z</kbd></td>\n <td>{{ 'core.component.form-builder.undo' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>Y</kbd> / <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Z</kbd></td>\n <td>{{ 'core.component.form-builder.redo' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Enter</kbd> / <kbd>Space</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.select' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Alt</kbd> + <kbd>\u2191</kbd> / <kbd>\u2193</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.move' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>D</kbd></td>\n <td>{{ 'core.component.form-builder.duplicate' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Delete</kbd></td>\n <td>{{ 'core.component.form-builder.delete' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Esc</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.escape' | sdTranslate }}</td>\n </tr>\n </tbody>\n </table>\n</sd-modal>\n", styles: [":host{--md-sys-color-primary: var(--sd-primary);--md-sys-color-on-primary: var(--sd-primary-contrast);--md-sys-color-primary-container: color-mix(in srgb, var(--sd-primary) 12%, var(--sd-surface));--md-sys-color-surface: var(--sd-surface);--md-sys-color-surface-container-lowest: var(--sd-surface);--md-sys-color-surface-container-low: var(--sd-surface-muted);--md-sys-color-surface-container: var(--sd-surface-muted);--md-sys-color-surface-container-high: var(--sd-surface-muted);--md-sys-color-surface-container-highest: var(--sd-surface-muted);--md-sys-color-on-surface: var(--sd-text);--md-sys-color-on-surface-variant: var(--sd-text-secondary);--md-sys-color-outline: var(--sd-border-strong);--md-sys-color-outline-variant: var(--sd-border);--md-sys-color-error: var(--sd-error);--md-sys-color-error-container: var(--sd-error-light);--md-sys-color-success: var(--sd-success);--r-xs: var(--sd-radius-4, 4px);--r-sm: var(--sd-radius-8, 8px);position:relative;display:flex;flex-direction:column;box-sizing:border-box;width:100%;height:var(--sd-form-builder-height, 100%);min-height:var(--sd-form-builder-min-height, 520px);overflow:hidden;border:1px solid var(--sd-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-surface);color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);container:sd-form-builder/inline-size}.fb-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;flex:0 0 auto;min-height:52px;padding:8px 12px;border-bottom:1px solid var(--sd-border);background:var(--sd-surface)}.fb-toolbar__spacer{flex:1}.fb-toolbar__group{display:inline-flex;align-items:center;gap:2px}.fb-seg{display:inline-flex;padding:2px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface-muted)}.fb-seg__btn{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer;white-space:nowrap}.fb-seg__btn:hover{color:var(--sd-text)}.fb-seg__btn.is-active{background:var(--sd-primary);color:var(--sd-primary-contrast)}.fb-seg__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:1px}.fb-panel-toggle{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);cursor:pointer}.fb-panel-toggle:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.fb-panel-toggle[aria-expanded=true]{background:color-mix(in srgb,var(--sd-primary) 12%,var(--sd-surface));color:var(--sd-primary)}.fb-panel-toggle:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:1px}@container sd-form-builder (max-width: 720px){.fb-seg__label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fb-seg__btn{padding:0 10px}}.fb-body{position:relative;display:grid;grid-template-columns:248px minmax(0,1fr) 320px;flex:1;min-height:0}.fb-body--full{grid-template-columns:minmax(0,1fr)}@container sd-form-builder (max-width: 1180px){.fb-body:not(.fb-body--full){grid-template-columns:216px minmax(0,1fr) 288px}}@container sd-form-builder (max-width: 1000px){.fb-body:not(.fb-body--full){grid-template-columns:196px minmax(0,1fr) 264px}}.fb-side{display:flex;flex-direction:column;min-height:0;min-width:0;background:var(--sd-surface)}.fb-side--left{border-right:1px solid var(--sd-border)}.fb-side--right{border-left:1px solid var(--sd-border)}.fb-main{display:flex;flex-direction:column;min-width:0;min-height:0}:host(.sd-form-builder--compact) .fb-body:not(.fb-body--full){grid-template-columns:minmax(0,1fr)}:host(.sd-form-builder--compact) .fb-side{position:absolute;top:0;bottom:0;z-index:20;width:min(320px,88%);box-shadow:var(--sd-shadow-lg, 0 8px 24px rgba(0, 0, 0, .16));visibility:hidden;transition:transform var(--sd-duration-base, .2s) ease,visibility 0s linear var(--sd-duration-base, .2s)}:host(.sd-form-builder--compact) .fb-side--left{left:0;transform:translate(-100%)}:host(.sd-form-builder--compact) .fb-side--right{right:0;transform:translate(100%)}:host(.sd-form-builder--compact) .fb-side.is-open{visibility:visible;transform:none;transition:transform var(--sd-duration-base, .2s) ease}.fb-scrim{position:absolute;inset:0;z-index:15;background:var(--sd-overlay-backdrop, rgba(0, 0, 0, .32))}.fb-schema{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;overflow:auto;padding:16px 20px 24px;background:var(--sd-surface-muted)}.fb-schema__note{display:inline-flex;align-items:center;gap:6px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px)}.fb-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}:host ::ng-deep .msi{font-family:Material Icons Outlined;font-weight:400;font-style:normal;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;direction:ltr;font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}:host ::ng-deep .mono{font-family:Roboto Mono,ui-monospace,monospace}:host ::ng-deep .fb-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);cursor:pointer}:host ::ng-deep .fb-icon-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}:host ::ng-deep .fb-icon-btn.danger:hover{color:var(--sd-error)}:host ::ng-deep .fb-icon-btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}:host ::ng-deep .fb-icon-btn .msi{font-size:var(--sd-font-size-18, 18px)}:host ::ng-deep details.fb-section{margin:0;padding:0;border-bottom:1px solid var(--sd-border)}:host ::ng-deep details.fb-section>summary{list-style:none}:host ::ng-deep details.fb-section>summary::-webkit-details-marker{display:none}:host ::ng-deep .fb-section__head{display:flex;align-items:center;gap:8px;min-height:32px;cursor:pointer;color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-semibold, 600);-webkit-user-select:none;user-select:none}:host ::ng-deep .fb-section__head .msi{font-size:var(--sd-font-size-16, 16px);color:var(--sd-text-secondary)}:host ::ng-deep .fb-section__head .fb-section__title{flex:1;min-width:0}:host ::ng-deep .fb-section__head .chev{margin-left:auto;transition:transform var(--sd-duration-fast, .12s) ease}:host ::ng-deep details.fb-section[open] .fb-section__head .chev{transform:rotate(90deg)}:host ::ng-deep .fb-section__body{display:flex;flex-direction:column;gap:8px;padding:4px 0 12px}:host ::ng-deep .fb-columns-list{display:flex;flex-direction:column;gap:4px}:host ::ng-deep .fb-column-row{display:flex;align-items:center;gap:8px;min-height:40px;padding:6px 8px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface);font-size:var(--sd-font-size-12, 12px)}:host ::ng-deep .fb-column-row.is-active{border-color:var(--sd-primary)}:host ::ng-deep .fb-column-row__type-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 28px;height:28px;border-radius:var(--sd-radius-6, 6px);background:color-mix(in srgb,var(--sd-primary) 10%,var(--sd-surface));color:var(--sd-primary)}:host ::ng-deep .fb-column-row__type-icon .msi{font-size:var(--sd-font-size-16, 16px)}:host ::ng-deep .fb-column-row__meta{display:flex;flex-direction:column;flex:1;min-width:0}:host ::ng-deep .fb-column-row__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500)}:host ::ng-deep .fb-column-row__req{color:var(--sd-error)}:host ::ng-deep .fb-column-row__sub{color:var(--sd-text-secondary);font-family:Roboto Mono,ui-monospace,monospace;font-size:var(--sd-font-size-11, 11px)}:host ::ng-deep .fb-add-link{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;padding:4px 6px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-primary);font-size:var(--sd-font-size-13, 13px);cursor:pointer}:host ::ng-deep .fb-add-link:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}::ng-deep .sd-form-builder-dialog .sd-modal-body{padding:16px;overscroll-behavior:contain}::ng-deep .sd-form-builder-dialog .fb-variables{display:flex;flex-direction:column;gap:10px}::ng-deep .sd-form-builder-dialog .fb-variables__hint{margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px)}::ng-deep .sd-form-builder-dialog .fb-variables__table{width:100%;border-collapse:separate;border-spacing:0;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);overflow:hidden}::ng-deep .sd-form-builder-dialog .fb-variables__table th{padding:8px 12px;border-bottom:1px solid var(--sd-border);background:var(--sd-surface-muted);color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500);text-align:left}::ng-deep .sd-form-builder-dialog .fb-variables__table td{padding:8px 12px;border-bottom:1px solid var(--sd-border);vertical-align:top}::ng-deep .sd-form-builder-dialog .fb-variables__table tbody tr:last-child td{border-bottom:0}::ng-deep .sd-form-builder-dialog .fb-variables__actions-col{width:1px;white-space:nowrap}::ng-deep .sd-form-builder-dialog .fb-variables__empty{margin:0;padding:16px;border:1px dashed var(--sd-border);border-radius:var(--sd-radius-8, 8px);color:var(--sd-text-secondary);text-align:center}::ng-deep .sd-form-builder-dialog .fb-variables__add{align-self:flex-start}::ng-deep .sd-form-builder-dialog .fb-shortcuts{width:100%;border-collapse:collapse}::ng-deep .sd-form-builder-dialog .fb-shortcuts td{padding:8px 4px;border-bottom:1px solid var(--sd-border);color:var(--sd-text);font-size:var(--sd-font-size-13, 13px)}::ng-deep .sd-form-builder-dialog .fb-shortcuts td:first-child{width:55%;white-space:nowrap}::ng-deep .sd-form-builder-dialog .fb-shortcuts kbd{display:inline-block;min-width:20px;padding:1px 6px;border:1px solid var(--sd-border-strong);border-bottom-width:2px;border-radius:var(--sd-radius-4, 4px);background:var(--sd-surface-muted);font-family:Roboto Mono,ui-monospace,monospace;font-size:var(--sd-font-size-12, 12px);text-align:center}\n"] }]
|
|
6792
|
+
], template: "@let _mode = store.mode();\n@let _design = _mode === 'design';\n@let _compact = compact();\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Toolbar n\u1ED9i b\u1ED9 c\u1EE7a component (kh\u00F4ng ph\u1EA3i header \u1EE9ng d\u1EE5ng) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div class=\"fb-toolbar\" role=\"toolbar\" [attr.aria-label]=\"'core.component.form-builder.toolbar' | sdTranslate\">\n @if (_compact && _design) {\n <!-- why: native button \u2014 the panel toggle must expose aria-expanded / aria-controls, which sd-button\n only sets for its own action menu. -->\n <span class=\"fb-toolbar__group\">\n <button\n #leftToggle\n type=\"button\"\n class=\"fb-panel-toggle\"\n [attr.aria-expanded]=\"leftOpen()\"\n [attr.aria-controls]=\"leftPanelId\"\n [attr.aria-label]=\"'core.component.form-builder.tab.components' | sdTranslate\"\n [title]=\"'core.component.form-builder.tab.components' | sdTranslate\"\n (click)=\"togglePanel('left')\">\n <sd-icon name=\"widgets\" size=\"20px\"></sd-icon>\n </button>\n </span>\n }\n\n <!-- why: ph\u00EDm m\u0169i t\u00EAn n\u1ED5i b\u1ECDt t\u1EEB n\u00FAt radio \u0111ang focus (m\u1EABu radiogroup c\u1EE7a APG); b\u1EA3n th\u00E2n nh\u00F3m kh\u00F4ng ph\u1EA3i \u0111i\u1EC3m focus. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"fb-seg\"\n role=\"radiogroup\"\n [attr.aria-label]=\"'core.component.form-builder.mode' | sdTranslate\"\n (keydown)=\"onSegmentKeydown($event, modes, _mode, applyMode)\">\n @for (mode of modes; track mode) {\n <button\n type=\"button\"\n role=\"radio\"\n class=\"fb-seg__btn\"\n [attr.data-value]=\"mode\"\n [class.is-active]=\"_mode === mode\"\n [attr.aria-checked]=\"_mode === mode\"\n [attr.tabindex]=\"_mode === mode ? 0 : -1\"\n [title]=\"'core.component.form-builder.mode.' + mode | sdTranslate\"\n (click)=\"setMode(mode)\">\n <sd-icon [name]=\"modeIcons[mode]\" size=\"18px\"></sd-icon>\n <span class=\"fb-seg__label\">{{ 'core.component.form-builder.mode.' + mode | sdTranslate }}</span>\n </button>\n }\n </div>\n\n <!-- why: Desktop/Tablet/Mobile ch\u1ECDn m\u1EE9c b\u1ED1 c\u1EE5c \u0111ang thi\u1EBFt k\u1EBF v\u00E0 m\u1EE9c Xem tr\u01B0\u1EDBc \u00E9p cho renderer \u2014\n \u1EA9n \u1EDF Schema. -->\n @if (_mode !== 'schema') {\n @let _viewport = store.viewport();\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"fb-seg\"\n role=\"radiogroup\"\n [attr.aria-label]=\"'core.component.form-builder.viewport' | sdTranslate\"\n (keydown)=\"onSegmentKeydown($event, viewports, _viewport, applyViewport)\">\n @for (viewport of viewports; track viewport) {\n <button\n type=\"button\"\n role=\"radio\"\n class=\"fb-seg__btn\"\n [attr.data-value]=\"viewport\"\n [class.is-active]=\"_viewport === viewport\"\n [attr.aria-checked]=\"_viewport === viewport\"\n [attr.tabindex]=\"_viewport === viewport ? 0 : -1\"\n [title]=\"'core.component.form-builder.viewport.' + viewport | sdTranslate\"\n (click)=\"setViewport(viewport)\">\n <sd-icon [name]=\"viewportIcons[viewport]\" size=\"18px\"></sd-icon>\n <span class=\"fb-seg__label\">{{ 'core.component.form-builder.viewport.' + viewport | sdTranslate }}</span>\n </button>\n }\n </div>\n }\n\n <span class=\"fb-toolbar__spacer\"></span>\n\n <span class=\"fb-toolbar__group\">\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"undo\"\n [disabled]=\"!store.canUndo()\"\n [tooltip]=\"(_design ? 'core.component.form-builder.undo-hint' : 'core.component.form-builder.design-only') | sdTranslate\"\n (click)=\"undo()\"></sd-button>\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"redo\"\n [disabled]=\"!store.canRedo()\"\n [tooltip]=\"(_design ? 'core.component.form-builder.redo-hint' : 'core.component.form-builder.design-only') | sdTranslate\"\n (click)=\"redo()\"></sd-button>\n <!-- C\u00F4ng c\u1EE5: CH\u1EC8 c\u00E1c thao t\u00E1c thi\u1EBFt k\u1EBF c\u00F3 th\u1EADt (action popover c\u1EE7a Core). -->\n <sd-button\n type=\"text\"\n color=\"secondary\"\n size=\"sm\"\n prefixIcon=\"more_vert\"\n [disabled]=\"!_design\"\n [tooltip]=\"(_design ? 'core.component.form-builder.tools' : 'core.component.form-builder.design-only') | sdTranslate\">\n <sd-button-item prefixIcon=\"data_array\" (click)=\"openVariables()\">\n {{ 'core.component.form-builder.tools.variables' | sdTranslate: { count: store.doc().variables.length } }}\n </sd-button-item>\n <sd-button-item prefixIcon=\"rule\" (click)=\"openValidations()\">\n {{ 'core.component.form-builder.tools.validations' | sdTranslate: { count: store.doc().validations.length } }}\n </sd-button-item>\n <sd-button-item-divider></sd-button-item-divider>\n <sd-button-item prefixIcon=\"keyboard\" (click)=\"openShortcuts()\">{{\n 'core.component.form-builder.shortcuts' | sdTranslate\n }}</sd-button-item>\n </sd-button>\n </span>\n\n @if (_compact && _design) {\n <span class=\"fb-toolbar__group\">\n <button\n #rightToggle\n type=\"button\"\n class=\"fb-panel-toggle\"\n [attr.aria-expanded]=\"rightOpen()\"\n [attr.aria-controls]=\"rightPanelId\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\"\n [title]=\"'core.component.form-builder.attribute' | sdTranslate\"\n (click)=\"togglePanel('right')\">\n <sd-icon name=\"tune\" size=\"20px\"></sd-icon>\n </button>\n </span>\n }\n</div>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Th\u00E2n: palette \u00B7 canvas \u00B7 inspector \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div class=\"fb-body\" [class.fb-body--full]=\"!_design\">\n @if (_design) {\n <section\n class=\"fb-side fb-side--left\"\n [id]=\"leftPanelId\"\n [class.is-open]=\"leftOpen()\"\n [attr.aria-label]=\"'core.component.form-builder.left-panel' | sdTranslate\">\n <fb-palette (itemAdded)=\"onItemAdded($event)\" (itemFocused)=\"onItemFocused($event)\"></fb-palette>\n </section>\n }\n\n <!-- why: kh\u00F4ng d\u00F9ng <main>/<aside> \u2014 builder l\u00E0 widget nh\u00FAng, landmark main/complementary c\u1EE7a n\u00F3\n s\u1EBD tr\u00F9ng v\u1EDBi landmark c\u1EE7a trang ch\u1EE7 (v\u00E0 nh\u00E2n \u0111\u00F4i khi c\u00F3 hai builder). Panel l\u00E0 v\u00F9ng c\u00F3 t\u00EAn. -->\n <div class=\"fb-main\">\n @switch (_mode) {\n @case ('design') {\n <div class=\"fb-page-editor\">\n <div class=\"fb-pages\" role=\"group\" [attr.aria-label]=\"'core.component.form-generic.pages' | sdTranslate\">\n <div class=\"fb-pages__strip\">\n @for (page of store.pages(); track page.id; let index = $index) {\n <button\n type=\"button\"\n class=\"fb-page-tab\"\n [attr.data-builder-page]=\"page.id\"\n [attr.aria-pressed]=\"store.activePage().id === page.id\"\n [class.is-active]=\"store.activePage().id === page.id\"\n [class.has-rules]=\"!!page.rules?.visible || !!page.rules?.hidden\"\n (focus)=\"revealPageHeader($event)\"\n (click)=\"store.selectPage(page.id); store.select(null); revealPageHeader($event)\">\n @if (page.icon) {\n <sd-icon [name]=\"page.icon\" size=\"16px\"></sd-icon>\n }\n {{ page.label || ('core.component.form-generic.page' | sdTranslate: { number: index + 1 }) }}\n @if (page.rules?.visible || page.rules?.hidden) {\n <sd-icon name=\"visibility\" size=\"16px\" [title]=\"'core.component.form-builder.page.rules-hint' | sdTranslate\"></sd-icon>\n }\n </button>\n }\n </div>\n <div class=\"fb-pages__actions\">\n <button\n type=\"button\"\n data-page-action=\"add\"\n [title]=\"'core.component.form-builder.page.add' | sdTranslate\"\n [attr.aria-label]=\"'core.component.form-builder.page.add' | sdTranslate\"\n (click)=\"store.addPage()\">\n <sd-icon name=\"add\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n data-page-action=\"duplicate\"\n [disabled]=\"!store.canDuplicatePage()\"\n [title]=\"\n (store.canDuplicatePage() ? 'core.component.form-builder.duplicate' : 'core.component.form-builder.page.unsupported')\n | sdTranslate\n \"\n [attr.aria-label]=\"'core.component.form-builder.duplicate' | sdTranslate\"\n [attr.aria-describedby]=\"!store.canDuplicatePage() ? leftPanelId + '-page-duplicate-reason' : null\"\n (click)=\"store.duplicatePage()\">\n <sd-icon name=\"content_copy\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n data-page-action=\"up\"\n [disabled]=\"pageIndex() <= 0\"\n [title]=\"'core.component.form-builder.move-up' | sdTranslate\"\n [attr.aria-label]=\"'core.component.form-builder.move-up' | sdTranslate\"\n (click)=\"store.movePage(store.activePage().id, -1)\">\n <sd-icon name=\"arrow_back\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n data-page-action=\"down\"\n [disabled]=\"pageIndex() >= store.pages().length - 1\"\n [title]=\"'core.component.form-builder.move-down' | sdTranslate\"\n [attr.aria-label]=\"'core.component.form-builder.move-down' | sdTranslate\"\n (click)=\"store.movePage(store.activePage().id, 1)\">\n <sd-icon name=\"arrow_forward\" size=\"18px\"></sd-icon>\n </button>\n <button\n type=\"button\"\n data-page-action=\"delete\"\n [disabled]=\"store.pages().length <= 1\"\n [title]=\"'core.component.form-builder.delete' | sdTranslate\"\n [attr.aria-label]=\"'core.component.form-builder.delete' | sdTranslate\"\n (click)=\"removePage()\">\n <sd-icon name=\"delete\" size=\"18px\"></sd-icon>\n </button>\n </div>\n </div>\n @if (!store.canDuplicatePage()) {\n <p class=\"fb-page-note\" [id]=\"leftPanelId + '-page-duplicate-reason'\">\n {{ 'core.component.form-builder.page.unsupported' | sdTranslate }}\n </p>\n }\n <fb-canvas (requestAdd)=\"focusPalette()\" (requestRemove)=\"remove($event)\"></fb-canvas>\n </div>\n }\n @case ('preview') {\n <fb-preview></fb-preview>\n }\n @case ('schema') {\n <div class=\"fb-schema\">\n <p class=\"fb-schema__note\">\n <sd-icon name=\"lock\" size=\"16px\"></sd-icon>{{ 'core.component.form-builder.schema.readonly' | sdTranslate }}\n </p>\n <sd-code-editor language=\"json\" viewed maxHeight=\"none\" [model]=\"schemaText()\"></sd-code-editor>\n </div>\n }\n }\n </div>\n\n @if (_design) {\n <section\n class=\"fb-side fb-side--right\"\n [id]=\"rightPanelId\"\n [class.is-open]=\"rightOpen()\"\n [attr.aria-label]=\"'core.component.form-builder.attribute' | sdTranslate\">\n <fb-inspector\n (requestRemove)=\"remove($event)\"\n (openVariables)=\"openVariables()\"\n (openValidations)=\"openValidations()\"\n (openShortcuts)=\"openShortcuts()\"></fb-inspector>\n </section>\n }\n\n @if (_compact && (leftOpen() || rightOpen())) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div class=\"fb-scrim\" (click)=\"leftOpen.set(false); rightOpen.set(false)\"></div>\n }\n</div>\n\n<div class=\"fb-live\" aria-live=\"polite\" aria-atomic=\"true\">{{ store.announcement() }}</div>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: bi\u1EBFn \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<sd-modal\n #variablesModal\n [title]=\"'core.component.form-builder.config-variable' | sdTranslate\"\n view=\"dialog\"\n width=\"720px\"\n modalClass=\"sd-form-builder-dialog\">\n <div class=\"fb-variables\">\n <p class=\"fb-variables__hint\">{{ 'core.component.form-builder.variables-hint' | sdTranslate }}</p>\n @if (variableDrafts().length) {\n <table class=\"fb-variables__table\">\n <thead>\n <tr>\n <th scope=\"col\">{{ 'core.component.form-builder.field-key' | sdTranslate }}</th>\n <th scope=\"col\">{{ 'core.component.form-builder.display-label' | sdTranslate }}</th>\n <th scope=\"col\" class=\"fb-variables__actions-col\" [attr.aria-label]=\"'core.component.form-builder.delete' | sdTranslate\"></th>\n </tr>\n </thead>\n <tbody>\n @for (draft of variableDrafts(); track draft.id; let index = $index) {\n <tr>\n <td>\n <sd-input\n size=\"sm\"\n [placeholder]=\"'core.component.form-builder.field-key' | sdTranslate\"\n [model]=\"draft.key\"\n (modelChange)=\"updateVariable(index, 'key', $event)\"\n [inlineError]=\"variableErrors()[index] || undefined\"></sd-input>\n </td>\n <td>\n <sd-input\n size=\"sm\"\n [placeholder]=\"'core.component.form-builder.display-label' | sdTranslate\"\n [model]=\"draft.label\"\n (modelChange)=\"updateVariable(index, 'label', $event)\"></sd-input>\n </td>\n <td class=\"fb-variables__actions-col\">\n <sd-button\n prefixIcon=\"delete\"\n type=\"text\"\n color=\"error\"\n [tooltip]=\"'core.component.form-builder.delete' | sdTranslate\"\n (click)=\"removeVariable(index)\"></sd-button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n } @else {\n <p class=\"fb-variables__empty\">{{ 'core.component.form-builder.no-variable' | sdTranslate }}</p>\n }\n <sd-button\n class=\"fb-variables__add\"\n type=\"text\"\n color=\"primary\"\n prefixIcon=\"add\"\n [title]=\"'core.component.form-builder.add-variable' | sdTranslate\"\n (click)=\"addVariable()\"></sd-button>\n </div>\n <ng-container sdFooterRight>\n <sd-button\n type=\"fill\"\n color=\"primary\"\n prefixIcon=\"check\"\n [disabled]=\"variablesInvalid()\"\n [title]=\"'core.component.form-builder.confirm' | sdTranslate\"\n (click)=\"saveVariables()\"></sd-button>\n </ng-container>\n</sd-modal>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: x\u00E1c th\u1EF1c c\u1EA5p form (component c\u00F3 s\u1EB5n) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<configure-validation (accept)=\"onValidationsAccepted($event)\"></configure-validation>\n\n<!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Dialog: ph\u00EDm t\u1EAFt \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<sd-modal\n #shortcutsModal\n [title]=\"'core.component.form-builder.shortcuts' | sdTranslate\"\n view=\"dialog\"\n width=\"560px\"\n modalClass=\"sd-form-builder-dialog\">\n <table class=\"fb-shortcuts\">\n <tbody>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>Z</kbd></td>\n <td>{{ 'core.component.form-builder.undo' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>Y</kbd> / <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Z</kbd></td>\n <td>{{ 'core.component.form-builder.redo' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Enter</kbd> / <kbd>Space</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.select' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Alt</kbd> + <kbd>\u2191</kbd> / <kbd>\u2193</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.move' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Ctrl</kbd> + <kbd>D</kbd></td>\n <td>{{ 'core.component.form-builder.duplicate' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Delete</kbd></td>\n <td>{{ 'core.component.form-builder.delete' | sdTranslate }}</td>\n </tr>\n <tr>\n <td><kbd>Esc</kbd></td>\n <td>{{ 'core.component.form-builder.shortcut.escape' | sdTranslate }}</td>\n </tr>\n </tbody>\n </table>\n</sd-modal>\n", styles: [":host{--md-sys-color-primary: var(--sd-primary);--md-sys-color-on-primary: var(--sd-primary-contrast);--md-sys-color-primary-container: color-mix(in srgb, var(--sd-primary) 12%, var(--sd-surface));--md-sys-color-surface: var(--sd-surface);--md-sys-color-surface-container-lowest: var(--sd-surface);--md-sys-color-surface-container-low: var(--sd-surface-muted);--md-sys-color-surface-container: var(--sd-surface-muted);--md-sys-color-surface-container-high: var(--sd-surface-muted);--md-sys-color-surface-container-highest: var(--sd-surface-muted);--md-sys-color-on-surface: var(--sd-text);--md-sys-color-on-surface-variant: var(--sd-text-secondary);--md-sys-color-outline: var(--sd-border-strong);--md-sys-color-outline-variant: var(--sd-border);--md-sys-color-error: var(--sd-error);--md-sys-color-error-container: var(--sd-error-light);--md-sys-color-success: var(--sd-success);--r-xs: var(--sd-radius-4, 4px);--r-sm: var(--sd-radius-8, 8px);position:relative;display:flex;flex-direction:column;box-sizing:border-box;width:100%;height:var(--sd-form-builder-height, 100%);min-height:var(--sd-form-builder-min-height, 520px);overflow:hidden;border:1px solid var(--sd-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-surface);color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);container:sd-form-builder/inline-size}.fb-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;flex:0 0 auto;min-height:52px;padding:8px 12px;border-bottom:1px solid var(--sd-border);background:var(--sd-surface)}.fb-page-editor{display:flex;flex-direction:column;height:100%;min-width:0;min-height:0}.fb-page-editor fb-canvas{flex:1;min-height:0}.fb-page-note{margin:0;padding:4px 8px;font-size:12px;color:var(--sd-text-secondary)}.fb-pages{display:flex;flex-wrap:wrap;gap:4px;padding:6px;border-bottom:1px solid var(--sd-border)}.fb-pages__strip{display:flex;flex:1 1 180px;padding:3px;min-width:0;overflow-x:auto;gap:4px}.fb-pages__actions{display:flex;flex:0 0 auto}.fb-page-tab,.fb-pages__actions button{display:inline-flex;align-items:center;justify-content:center;gap:4px;flex:0 0 auto;min-height:36px;min-width:36px;padding:6px 8px;border:1px solid transparent;border-radius:var(--sd-radius-4, 4px);background:var(--sd-surface);color:var(--sd-text);font:inherit;cursor:pointer;white-space:nowrap}.fb-page-tab:focus-visible,.fb-pages__actions button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:1px}.fb-page-tab:disabled,.fb-pages__actions button:disabled{opacity:.5;cursor:default}.fb-page-tab.is-active,.fb-pages__actions button.is-active{border-color:var(--sd-primary);color:var(--sd-primary);background:var(--sd-primary-light)}.fb-page-tab.has-rules,.fb-pages__actions button.has-rules{border-style:dashed}.fb-toolbar__spacer{flex:1}.fb-toolbar__group{display:inline-flex;align-items:center;gap:2px}.fb-seg{display:inline-flex;padding:2px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface-muted)}.fb-seg__btn{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);cursor:pointer;white-space:nowrap}.fb-seg__btn:hover{color:var(--sd-text)}.fb-seg__btn.is-active{background:var(--sd-primary);color:var(--sd-primary-contrast)}.fb-seg__btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:1px}.fb-panel-toggle{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);cursor:pointer}.fb-panel-toggle:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.fb-panel-toggle[aria-expanded=true]{background:color-mix(in srgb,var(--sd-primary) 12%,var(--sd-surface));color:var(--sd-primary)}.fb-panel-toggle:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:1px}@container sd-form-builder (max-width: 720px){.fb-seg__label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fb-seg__btn{padding:0 10px}}.fb-body{position:relative;display:grid;grid-template-columns:248px minmax(0,1fr) 320px;flex:1;min-height:0}.fb-body--full{grid-template-columns:minmax(0,1fr)}@container sd-form-builder (max-width: 1180px){.fb-body:not(.fb-body--full){grid-template-columns:216px minmax(0,1fr) 288px}}@container sd-form-builder (max-width: 1000px){.fb-body:not(.fb-body--full){grid-template-columns:196px minmax(0,1fr) 264px}}.fb-side{display:flex;flex-direction:column;min-height:0;min-width:0;background:var(--sd-surface)}.fb-side--left{border-right:1px solid var(--sd-border)}.fb-side--right{border-left:1px solid var(--sd-border)}.fb-main{display:flex;flex-direction:column;min-width:0;min-height:0}:host(.sd-form-builder--compact) .fb-body:not(.fb-body--full){grid-template-columns:minmax(0,1fr)}:host(.sd-form-builder--compact) .fb-side{position:absolute;top:0;bottom:0;z-index:20;width:min(320px,88%);box-shadow:var(--sd-shadow-lg, 0 8px 24px rgba(0, 0, 0, .16));visibility:hidden;transition:transform var(--sd-duration-base, .2s) ease,visibility 0s linear var(--sd-duration-base, .2s)}:host(.sd-form-builder--compact) .fb-side--left{left:0;transform:translate(-100%)}:host(.sd-form-builder--compact) .fb-side--right{right:0;transform:translate(100%)}:host(.sd-form-builder--compact) .fb-side.is-open{visibility:visible;transform:none;transition:transform var(--sd-duration-base, .2s) ease}.fb-scrim{position:absolute;inset:0;z-index:15;background:var(--sd-overlay-backdrop, rgba(0, 0, 0, .32))}.fb-schema{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;overflow:auto;padding:16px 20px 24px;background:var(--sd-surface-muted)}.fb-schema__note{display:inline-flex;align-items:center;gap:6px;margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px)}.fb-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}:host ::ng-deep .msi{font-family:Material Icons Outlined;font-weight:400;font-style:normal;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;direction:ltr;font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}:host ::ng-deep .mono{font-family:Roboto Mono,ui-monospace,monospace}:host ::ng-deep .fb-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-text-secondary);cursor:pointer}:host ::ng-deep .fb-icon-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}:host ::ng-deep .fb-icon-btn.danger:hover{color:var(--sd-error)}:host ::ng-deep .fb-icon-btn:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}:host ::ng-deep .fb-icon-btn .msi{font-size:var(--sd-font-size-18, 18px)}:host ::ng-deep details.fb-section{margin:0;padding:0;border-bottom:1px solid var(--sd-border)}:host ::ng-deep details.fb-section>summary{list-style:none}:host ::ng-deep details.fb-section>summary::-webkit-details-marker{display:none}:host ::ng-deep .fb-section__head{display:flex;align-items:center;gap:8px;min-height:32px;cursor:pointer;color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-semibold, 600);-webkit-user-select:none;user-select:none}:host ::ng-deep .fb-section__head .msi{font-size:var(--sd-font-size-16, 16px);color:var(--sd-text-secondary)}:host ::ng-deep .fb-section__head .fb-section__title{flex:1;min-width:0}:host ::ng-deep .fb-section__head .chev{margin-left:auto;transition:transform var(--sd-duration-fast, .12s) ease}:host ::ng-deep details.fb-section[open] .fb-section__head .chev{transform:rotate(90deg)}:host ::ng-deep .fb-section__body{display:flex;flex-direction:column;gap:8px;padding:4px 0 12px}:host ::ng-deep .fb-columns-list{display:flex;flex-direction:column;gap:4px}:host ::ng-deep .fb-column-row{display:flex;align-items:center;gap:8px;min-height:40px;padding:6px 8px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface);font-size:var(--sd-font-size-12, 12px)}:host ::ng-deep .fb-column-row.is-active{border-color:var(--sd-primary)}:host ::ng-deep .fb-column-row__type-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 28px;height:28px;border-radius:var(--sd-radius-6, 6px);background:color-mix(in srgb,var(--sd-primary) 10%,var(--sd-surface));color:var(--sd-primary)}:host ::ng-deep .fb-column-row__type-icon .msi{font-size:var(--sd-font-size-16, 16px)}:host ::ng-deep .fb-column-row__meta{display:flex;flex-direction:column;flex:1;min-width:0}:host ::ng-deep .fb-column-row__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500)}:host ::ng-deep .fb-column-row__req{color:var(--sd-error)}:host ::ng-deep .fb-column-row__sub{color:var(--sd-text-secondary);font-family:Roboto Mono,ui-monospace,monospace;font-size:var(--sd-font-size-11, 11px)}:host ::ng-deep .fb-add-link{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;padding:4px 6px;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-primary);font-size:var(--sd-font-size-13, 13px);cursor:pointer}:host ::ng-deep .fb-add-link:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color)}::ng-deep .sd-form-builder-dialog .sd-modal-body{padding:16px;overscroll-behavior:contain}::ng-deep .sd-form-builder-dialog .fb-variables{display:flex;flex-direction:column;gap:10px}::ng-deep .sd-form-builder-dialog .fb-variables__hint{margin:0;color:var(--sd-text-secondary);font-size:var(--sd-font-size-13, 13px)}::ng-deep .sd-form-builder-dialog .fb-variables__table{width:100%;border-collapse:separate;border-spacing:0;border:1px solid var(--sd-border);border-radius:var(--sd-radius-8, 8px);overflow:hidden}::ng-deep .sd-form-builder-dialog .fb-variables__table th{padding:8px 12px;border-bottom:1px solid var(--sd-border);background:var(--sd-surface-muted);color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500);text-align:left}::ng-deep .sd-form-builder-dialog .fb-variables__table td{padding:8px 12px;border-bottom:1px solid var(--sd-border);vertical-align:top}::ng-deep .sd-form-builder-dialog .fb-variables__table tbody tr:last-child td{border-bottom:0}::ng-deep .sd-form-builder-dialog .fb-variables__actions-col{width:1px;white-space:nowrap}::ng-deep .sd-form-builder-dialog .fb-variables__empty{margin:0;padding:16px;border:1px dashed var(--sd-border);border-radius:var(--sd-radius-8, 8px);color:var(--sd-text-secondary);text-align:center}::ng-deep .sd-form-builder-dialog .fb-variables__add{align-self:flex-start}::ng-deep .sd-form-builder-dialog .fb-shortcuts{width:100%;border-collapse:collapse}::ng-deep .sd-form-builder-dialog .fb-shortcuts td{padding:8px 4px;border-bottom:1px solid var(--sd-border);color:var(--sd-text);font-size:var(--sd-font-size-13, 13px)}::ng-deep .sd-form-builder-dialog .fb-shortcuts td:first-child{width:55%;white-space:nowrap}::ng-deep .sd-form-builder-dialog .fb-shortcuts kbd{display:inline-block;min-width:20px;padding:1px 6px;border:1px solid var(--sd-border-strong);border-bottom-width:2px;border-radius:var(--sd-radius-4, 4px);background:var(--sd-surface-muted);font-family:Roboto Mono,ui-monospace,monospace;font-size:var(--sd-font-size-12, 12px);text-align:center}\n"] }]
|
|
6190
6793
|
}], ctorParameters: () => [] });
|
|
6191
6794
|
|
|
6192
6795
|
// Public API of `@sdcorejs/angular/components/form-generic`.
|