@ac-design/design-system 0.0.0-stage → 1.0.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 +160 -2
- package/dist/lib/compat.css +4441 -0
- package/dist/lib/components/AcAccordion.js +5 -0
- package/dist/lib/components/AcAccordion.vue.d.ts +35 -0
- package/dist/lib/components/AcAccordion.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/lib/components/AcAccordionItem.js +5 -0
- package/dist/lib/components/AcAccordionItem.vue.d.ts +49 -0
- package/dist/lib/components/AcAccordionItem.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/lib/components/AcAlert.js +5 -0
- package/dist/lib/components/AcAlert.vue.d.ts +52 -0
- package/dist/lib/components/AcAlert.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/lib/components/AcAppSwitcher.js +5 -0
- package/dist/lib/components/AcAppSwitcher.vue.d.ts +83 -0
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +303 -0
- package/dist/lib/components/AcAvatar.js +5 -0
- package/dist/lib/components/AcAvatar.vue.d.ts +27 -0
- package/dist/lib/components/AcAvatar.vue_vue_type_script_setup_true_lang.js +116 -0
- package/dist/lib/components/AcBadge.js +5 -0
- package/dist/lib/components/AcBadge.vue.d.ts +32 -0
- package/dist/lib/components/AcBadge.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/lib/components/AcBanner.js +5 -0
- package/dist/lib/components/AcBanner.vue.d.ts +57 -0
- package/dist/lib/components/AcBanner.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/lib/components/AcBreadcrumb.js +5 -0
- package/dist/lib/components/AcBreadcrumb.vue.d.ts +25 -0
- package/dist/lib/components/AcBreadcrumb.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/lib/components/AcButton.js +5 -0
- package/dist/lib/components/AcButton.vue.d.ts +49 -0
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/lib/components/AcButtons.js +5 -0
- package/dist/lib/components/AcButtons.vue.d.ts +31 -0
- package/dist/lib/components/AcButtons.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/lib/components/AcCard.js +5 -0
- package/dist/lib/components/AcCard.vue.d.ts +27 -0
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/lib/components/AcCellValue.js +5 -0
- package/dist/lib/components/AcCellValue.vue.d.ts +139 -0
- package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +386 -0
- package/dist/lib/components/AcCheckBox.js +5 -0
- package/dist/lib/components/AcCheckBox.vue.d.ts +31 -0
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/lib/components/AcCheckRadio.js +5 -0
- package/dist/lib/components/AcCheckRadio.vue.d.ts +35 -0
- package/dist/lib/components/AcCheckRadio.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/lib/components/AcClusterSwitcher.js +5 -0
- package/dist/lib/components/AcClusterSwitcher.vue.d.ts +95 -0
- package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +416 -0
- package/dist/lib/components/AcCodeEditor.js +5 -0
- package/dist/lib/components/AcCodeEditor.vue.d.ts +88 -0
- package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +381 -0
- package/dist/lib/components/AcContentHeader.js +5 -0
- package/dist/lib/components/AcContentHeader.vue.d.ts +29 -0
- package/dist/lib/components/AcContentHeader.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/lib/components/AcContentLayout.js +5 -0
- package/dist/lib/components/AcContentLayout.vue.d.ts +21 -0
- package/dist/lib/components/AcContentLayout.vue_vue_type_script_setup_true_lang.js +18 -0
- package/dist/lib/components/AcContentTable.js +5 -0
- package/dist/lib/components/AcContentTable.vue.d.ts +54 -0
- package/dist/lib/components/AcContentTable.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/lib/components/AcDatePicker.js +5 -0
- package/dist/lib/components/AcDatePicker.vue.d.ts +88 -0
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +794 -0
- package/dist/lib/components/AcDeleteModal.js +5 -0
- package/dist/lib/components/AcDeleteModal.vue.d.ts +51 -0
- package/dist/lib/components/AcDeleteModal.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/lib/components/AcDivider.js +5 -0
- package/dist/lib/components/AcDivider.vue.d.ts +25 -0
- package/dist/lib/components/AcDivider.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/lib/components/AcDropdown.js +5 -0
- package/dist/lib/components/AcDropdown.vue.d.ts +45 -0
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +152 -0
- package/dist/lib/components/AcDropdownDivider.js +5 -0
- package/dist/lib/components/AcDropdownDivider.vue.d.ts +9 -0
- package/dist/lib/components/AcDropdownDivider.vue_vue_type_script_setup_true_lang.js +20 -0
- package/dist/lib/components/AcDropdownItem.js +5 -0
- package/dist/lib/components/AcDropdownItem.vue.d.ts +50 -0
- package/dist/lib/components/AcDropdownItem.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/lib/components/AcEmptyState.js +5 -0
- package/dist/lib/components/AcEmptyState.vue.d.ts +42 -0
- package/dist/lib/components/AcEmptyState.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/lib/components/AcFeatureCard.js +5 -0
- package/dist/lib/components/AcFeatureCard.vue.d.ts +84 -0
- package/dist/lib/components/AcFeatureCard.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/lib/components/AcFileEditor.js +5 -0
- package/dist/lib/components/AcFileEditor.vue.d.ts +95 -0
- package/dist/lib/components/AcFileEditor.vue_vue_type_script_setup_true_lang.js +556 -0
- package/dist/lib/components/AcFileUpload.js +5 -0
- package/dist/lib/components/AcFileUpload.vue.d.ts +67 -0
- package/dist/lib/components/AcFileUpload.vue_vue_type_script_setup_true_lang.js +274 -0
- package/dist/lib/components/AcFontScale.js +5 -0
- package/dist/lib/components/AcFontScale.vue.d.ts +17 -0
- package/dist/lib/components/AcFontScale.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/lib/components/AcForm.js +5 -0
- package/dist/lib/components/AcForm.vue.d.ts +31 -0
- package/dist/lib/components/AcForm.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/lib/components/AcFormArray.js +5 -0
- package/dist/lib/components/AcFormArray.vue.d.ts +124 -0
- package/dist/lib/components/AcFormArray.vue_vue_type_script_setup_true_lang.js +485 -0
- package/dist/lib/components/AcFormFooter.js +5 -0
- package/dist/lib/components/AcFormFooter.vue.d.ts +48 -0
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/lib/components/AcFormSection.js +5 -0
- package/dist/lib/components/AcFormSection.vue.d.ts +32 -0
- package/dist/lib/components/AcFormSection.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/lib/components/AcHeader.js +5 -0
- package/dist/lib/components/AcHeader.vue.d.ts +46 -0
- package/dist/lib/components/AcHeader.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/lib/components/AcHeaderItem.js +5 -0
- package/dist/lib/components/AcHeaderItem.vue.d.ts +13 -0
- package/dist/lib/components/AcHeaderItem.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/lib/components/AcHeaderItems.js +5 -0
- package/dist/lib/components/AcHeaderItems.vue.d.ts +13 -0
- package/dist/lib/components/AcHeaderItems.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/lib/components/AcInfoTable.js +5 -0
- package/dist/lib/components/AcInfoTable.vue.d.ts +59 -0
- package/dist/lib/components/AcInfoTable.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/lib/components/AcInput.js +5 -0
- package/dist/lib/components/AcInput.vue.d.ts +68 -0
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +143 -0
- package/dist/lib/components/AcKbd.js +5 -0
- package/dist/lib/components/AcKbd.vue.d.ts +25 -0
- package/dist/lib/components/AcKbd.vue_vue_type_script_setup_true_lang.js +134 -0
- package/dist/lib/components/AcLogo.js +5 -0
- package/dist/lib/components/AcLogo.vue.d.ts +18 -0
- package/dist/lib/components/AcLogo.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/lib/components/AcModal.js +5 -0
- package/dist/lib/components/AcModal.vue.d.ts +54 -0
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/lib/components/AcNavbar.js +5 -0
- package/dist/lib/components/AcNavbar.vue.d.ts +41 -0
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/lib/components/AcNavbarItem.js +5 -0
- package/dist/lib/components/AcNavbarItem.vue.d.ts +44 -0
- package/dist/lib/components/AcNavbarItem.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/lib/components/AcNotificationMenu.js +5 -0
- package/dist/lib/components/AcNotificationMenu.vue.d.ts +90 -0
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +345 -0
- package/dist/lib/components/AcPage.js +5 -0
- package/dist/lib/components/AcPage.vue.d.ts +25 -0
- package/dist/lib/components/AcPage.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/lib/components/AcPagination.js +5 -0
- package/dist/lib/components/AcPagination.vue.d.ts +51 -0
- package/dist/lib/components/AcPagination.vue_vue_type_script_setup_true_lang.js +160 -0
- package/dist/lib/components/AcPreloader.js +5 -0
- package/dist/lib/components/AcPreloader.vue.d.ts +28 -0
- package/dist/lib/components/AcPreloader.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/lib/components/AcProgress.js +5 -0
- package/dist/lib/components/AcProgress.vue.d.ts +31 -0
- package/dist/lib/components/AcProgress.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/lib/components/AcResourceCard.js +5 -0
- package/dist/lib/components/AcResourceCard.vue.d.ts +106 -0
- package/dist/lib/components/AcResourceCard.vue_vue_type_script_setup_true_lang.js +203 -0
- package/dist/lib/components/AcSearchBar.js +5 -0
- package/dist/lib/components/AcSearchBar.vue.d.ts +41 -0
- package/dist/lib/components/AcSearchBar.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/lib/components/AcSectionContent.js +5 -0
- package/dist/lib/components/AcSectionContent.vue.d.ts +55 -0
- package/dist/lib/components/AcSectionContent.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/lib/components/AcSegmentedControl.js +5 -0
- package/dist/lib/components/AcSegmentedControl.vue.d.ts +46 -0
- package/dist/lib/components/AcSegmentedControl.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/lib/components/AcSelect.js +5 -0
- package/dist/lib/components/AcSelect.vue.d.ts +78 -0
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +441 -0
- package/dist/lib/components/AcSidePanel.js +5 -0
- package/dist/lib/components/AcSidePanel.vue.d.ts +57 -0
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/lib/components/AcSideTabs.js +5 -0
- package/dist/lib/components/AcSideTabs.vue.d.ts +93 -0
- package/dist/lib/components/AcSideTabs.vue_vue_type_script_setup_true_lang.js +373 -0
- package/dist/lib/components/AcSidebar.js +5 -0
- package/dist/lib/components/AcSidebar.vue.d.ts +63 -0
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +221 -0
- package/dist/lib/components/AcSidebarItem.js +5 -0
- package/dist/lib/components/AcSidebarItem.vue.d.ts +55 -0
- package/dist/lib/components/AcSidebarItem.vue_vue_type_script_setup_true_lang.js +155 -0
- package/dist/lib/components/AcSidebarSection.js +5 -0
- package/dist/lib/components/AcSidebarSection.vue.d.ts +32 -0
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/lib/components/AcSkeleton.js +5 -0
- package/dist/lib/components/AcSkeleton.vue.d.ts +27 -0
- package/dist/lib/components/AcSkeleton.vue_vue_type_script_setup_true_lang.js +142 -0
- package/dist/lib/components/AcSlider.js +5 -0
- package/dist/lib/components/AcSlider.vue.d.ts +72 -0
- package/dist/lib/components/AcSlider.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/lib/components/AcSpinner.js +5 -0
- package/dist/lib/components/AcSpinner.vue.d.ts +12 -0
- package/dist/lib/components/AcSpinner.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/lib/components/AcStatCard.js +5 -0
- package/dist/lib/components/AcStatCard.vue.d.ts +84 -0
- package/dist/lib/components/AcStatCard.vue_vue_type_script_setup_true_lang.js +225 -0
- package/dist/lib/components/AcStatusBar.js +5 -0
- package/dist/lib/components/AcStatusBar.vue.d.ts +66 -0
- package/dist/lib/components/AcStatusBar.vue_vue_type_script_setup_true_lang.js +145 -0
- package/dist/lib/components/AcSteps.js +5 -0
- package/dist/lib/components/AcSteps.vue.d.ts +28 -0
- package/dist/lib/components/AcSteps.vue_vue_type_script_setup_true_lang.js +91 -0
- package/dist/lib/components/AcSwitch.js +5 -0
- package/dist/lib/components/AcSwitch.vue.d.ts +44 -0
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/lib/components/AcTable.js +5 -0
- package/dist/lib/components/AcTable.vue.d.ts +98 -0
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +272 -0
- package/dist/lib/components/AcTabs.js +5 -0
- package/dist/lib/components/AcTabs.vue.d.ts +40 -0
- package/dist/lib/components/AcTabs.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/lib/components/AcTag.js +5 -0
- package/dist/lib/components/AcTag.vue.d.ts +41 -0
- package/dist/lib/components/AcTag.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/lib/components/AcTextarea.js +5 -0
- package/dist/lib/components/AcTextarea.vue.d.ts +53 -0
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/lib/components/AcThemeMode.js +5 -0
- package/dist/lib/components/AcThemeMode.vue.d.ts +17 -0
- package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/lib/components/AcToaster.js +5 -0
- package/dist/lib/components/AcToaster.vue.d.ts +15 -0
- package/dist/lib/components/AcToaster.vue_vue_type_script_setup_true_lang.js +166 -0
- package/dist/lib/components/AcTooltip.js +5 -0
- package/dist/lib/components/AcTooltip.vue.d.ts +30 -0
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +117 -0
- package/dist/lib/components/AcUsageCard.js +5 -0
- package/dist/lib/components/AcUsageCard.vue.d.ts +85 -0
- package/dist/lib/components/AcUsageCard.vue_vue_type_script_setup_true_lang.js +230 -0
- package/dist/lib/components/AcUserMenu.js +5 -0
- package/dist/lib/components/AcUserMenu.vue.d.ts +77 -0
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +258 -0
- package/dist/lib/components/index.d.ts +76 -0
- package/dist/lib/components/types.d.ts +16 -0
- package/dist/lib/composables/copyText.d.ts +6 -0
- package/dist/lib/composables/copyText.js +16 -0
- package/dist/lib/composables/useBrandColor.d.ts +53 -0
- package/dist/lib/composables/useBrandColor.js +148 -0
- package/dist/lib/composables/useColorMode.d.ts +12 -0
- package/dist/lib/composables/useColorMode.js +40 -0
- package/dist/lib/composables/useFontScale.d.ts +16 -0
- package/dist/lib/composables/useFontScale.js +43 -0
- package/dist/lib/composables/useToast.d.ts +68 -0
- package/dist/lib/composables/useToast.js +36 -0
- package/dist/lib/editor/index.d.ts +4 -0
- package/dist/lib/editor/index.js +3 -0
- package/dist/lib/editor/theme.d.ts +3 -0
- package/dist/lib/editor/theme.js +309 -0
- package/dist/lib/editor/validate.d.ts +19 -0
- package/dist/lib/editor/validate.js +127 -0
- package/dist/lib/index.d.ts +29 -0
- package/dist/lib/index.js +78 -0
- package/dist/lib/theme.css +556 -0
- package/package.json +82 -4
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import e from "./AcSpinner.js";
|
|
2
|
+
import t from "./AcButton.js";
|
|
3
|
+
import n from "./AcBadge.js";
|
|
4
|
+
import r from "./AcCellValue.js";
|
|
5
|
+
import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, mergeModels as p, nextTick as m, normalizeClass as h, normalizeStyle as ee, openBlock as g, ref as _, renderList as v, renderSlot as y, resolveDynamicComponent as te, toDisplayString as b, toRaw as ne, unref as x, useId as re, useModel as ie, useSlots as ae, vShow as oe, withCtx as se, withDirectives as ce } from "vue";
|
|
6
|
+
import { Check as le, ChevronDown as ue, ChevronRight as de, CircleAlert as fe, Pencil as pe, Plus as me, Trash2 as he, X as ge } from "@lucide/vue";
|
|
7
|
+
//#region src/lib/components/AcFormArray.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var _e = ["aria-describedby"], ve = { class: "flex min-h-8 items-center justify-between gap-3" }, ye = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "text-danger",
|
|
11
|
+
"aria-hidden": "true"
|
|
12
|
+
}, be = {
|
|
13
|
+
key: 2,
|
|
14
|
+
class: "sr-only"
|
|
15
|
+
}, xe = { class: "ac-scrollbar" }, Se = { class: "w-full border-separate border-spacing-0 text-base" }, Ce = { class: "sr-only" }, we = {
|
|
16
|
+
key: 0,
|
|
17
|
+
scope: "col",
|
|
18
|
+
class: "h-8 w-px border-b border-border bg-surface-muted px-3 text-right"
|
|
19
|
+
}, Te = ["data-row"], Ee = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "h-10 border-b border-border-light px-2 text-right whitespace-nowrap [tr:last-child_&]:border-b-0"
|
|
22
|
+
}, De = { class: "inline-flex items-center gap-0.5" }, Oe = [
|
|
23
|
+
"aria-expanded",
|
|
24
|
+
"aria-label",
|
|
25
|
+
"onClick"
|
|
26
|
+
], ke = [
|
|
27
|
+
"aria-label",
|
|
28
|
+
"disabled",
|
|
29
|
+
"onClick"
|
|
30
|
+
], Ae = [
|
|
31
|
+
"aria-label",
|
|
32
|
+
"disabled",
|
|
33
|
+
"onClick"
|
|
34
|
+
], je = ["aria-label"], Me = { class: "inline-flex h-9 items-center px-1 text-body" }, Ne = { class: "border-b border-border-light px-2 py-2 text-right align-top whitespace-nowrap [tr:last-child_&]:border-b-0" }, Pe = { class: "inline-flex h-9 items-center gap-0.5" }, Fe = ["aria-label", "disabled"], Ie = ["disabled"], Le = {
|
|
35
|
+
key: 0,
|
|
36
|
+
role: "alert",
|
|
37
|
+
class: "mt-1 max-w-48 text-left text-xs whitespace-normal text-red-30"
|
|
38
|
+
}, Re = { key: 2 }, ze = ["colspan"], Be = ["aria-labelledby"], Ve = ["id"], He = {
|
|
39
|
+
"data-editor-fields": "",
|
|
40
|
+
class: "space-y-4"
|
|
41
|
+
}, Ue = {
|
|
42
|
+
key: 0,
|
|
43
|
+
role: "alert",
|
|
44
|
+
class: "mt-3 flex items-center gap-1 text-xs text-red-30"
|
|
45
|
+
}, We = { class: "mt-4 flex justify-end gap-2" }, Ge = { key: 3 }, Ke = ["colspan"], qe = {
|
|
46
|
+
class: "sr-only",
|
|
47
|
+
"aria-live": "polite"
|
|
48
|
+
}, S = -1, C = "input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [role=\"combobox\"]:not([aria-disabled=\"true\"]), button:not([disabled])", w = /*@__PURE__*/ f({
|
|
49
|
+
__name: "AcFormArray",
|
|
50
|
+
props: /*@__PURE__*/ p({
|
|
51
|
+
label: {},
|
|
52
|
+
columns: {},
|
|
53
|
+
itemName: { default: "item" },
|
|
54
|
+
newItem: {
|
|
55
|
+
type: Function,
|
|
56
|
+
default: () => ({})
|
|
57
|
+
},
|
|
58
|
+
mode: { default: "form" },
|
|
59
|
+
validate: {
|
|
60
|
+
type: Function,
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
63
|
+
beforeSave: {
|
|
64
|
+
type: Function,
|
|
65
|
+
default: void 0
|
|
66
|
+
},
|
|
67
|
+
beforeRemove: {
|
|
68
|
+
type: Function,
|
|
69
|
+
default: void 0
|
|
70
|
+
},
|
|
71
|
+
required: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: !1
|
|
74
|
+
},
|
|
75
|
+
disabled: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: !1
|
|
78
|
+
},
|
|
79
|
+
readonly: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: !1
|
|
82
|
+
},
|
|
83
|
+
editable: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: !0
|
|
86
|
+
},
|
|
87
|
+
addDisabled: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: !1
|
|
90
|
+
},
|
|
91
|
+
max: { default: void 0 },
|
|
92
|
+
loading: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: !1
|
|
95
|
+
},
|
|
96
|
+
collapsible: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: !1
|
|
99
|
+
},
|
|
100
|
+
defaultCollapsed: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
default: !1
|
|
103
|
+
},
|
|
104
|
+
errorMsg: { default: "" },
|
|
105
|
+
hint: { default: "" },
|
|
106
|
+
addLabel: { default: "" },
|
|
107
|
+
formTitle: { default: "" },
|
|
108
|
+
emptyText: { default: "Nothing added yet." }
|
|
109
|
+
}, {
|
|
110
|
+
modelValue: { default: () => [] },
|
|
111
|
+
modelModifiers: {}
|
|
112
|
+
}),
|
|
113
|
+
emits: /*@__PURE__*/ p([
|
|
114
|
+
"add",
|
|
115
|
+
"update",
|
|
116
|
+
"remove"
|
|
117
|
+
], ["update:modelValue"]),
|
|
118
|
+
setup(f, { expose: p, emit: w }) {
|
|
119
|
+
let T = f, E = ie(f, "modelValue"), D = w, Je = ae(), O = re(), Ye = `${O}-label`, Xe = `${O}-body`, k = `${O}-msg`, A = _(null), j = _(T.collapsible && T.defaultCollapsed), M = _(null), N = _({}), P = _({}), F = _(""), I = _(!1), L = _(/* @__PURE__ */ new Set()), R = _(""), z = a(() => E.value ?? []), B = a(() => I.value || T.loading), Ze = a(() => M.value !== null), V = a(() => Array.isArray(T.errorMsg) ? T.errorMsg : T.errorMsg ? [T.errorMsg] : []), Qe = a(() => T.max !== void 0 && z.value.length >= T.max), $e = a(() => !T.disabled && !T.addDisabled && !Qe.value && !Ze.value && !B.value), H = a(() => T.disabled || Ze.value || B.value), U = a(() => !T.readonly || !!Je.details || !!Je["row-actions"]), et = a(() => z.value.length > 0 || M.value === S), tt = a(() => T.columns.length + +!!U.value), nt = a(() => T.addLabel || `Add ${T.itemName}`), rt = a(() => T.formTitle || `${M.value === S ? "New" : "Edit"} ${T.itemName}`), it = a(() => {
|
|
120
|
+
let e = [];
|
|
121
|
+
return z.value.forEach((t, n) => {
|
|
122
|
+
let r = M.value === n;
|
|
123
|
+
e.push({
|
|
124
|
+
kind: r && T.mode === "inline" ? "inline" : "item",
|
|
125
|
+
index: n
|
|
126
|
+
}), r && T.mode === "form" ? e.push({
|
|
127
|
+
kind: "form",
|
|
128
|
+
index: n
|
|
129
|
+
}) : !r && L.value.has(n) && e.push({
|
|
130
|
+
kind: "details",
|
|
131
|
+
index: n
|
|
132
|
+
});
|
|
133
|
+
}), M.value === S && e.push({
|
|
134
|
+
kind: T.mode === "inline" ? "inline" : "form",
|
|
135
|
+
index: S
|
|
136
|
+
}), e;
|
|
137
|
+
});
|
|
138
|
+
function W(e) {
|
|
139
|
+
return e === S ? N.value : z.value[e];
|
|
140
|
+
}
|
|
141
|
+
function G(e) {
|
|
142
|
+
let t = T.columns[0], n = t ? z.value[e]?.[t.key] : void 0;
|
|
143
|
+
return n == null || typeof n == "object" || n === "" ? `${T.itemName} ${e + 1}` : `${T.itemName} ${String(n)}`;
|
|
144
|
+
}
|
|
145
|
+
function at(e, t) {
|
|
146
|
+
let n = W(t);
|
|
147
|
+
return e.format ? e.format(n[e.key], n) : null;
|
|
148
|
+
}
|
|
149
|
+
function ot(e) {
|
|
150
|
+
try {
|
|
151
|
+
return structuredClone(ne(e));
|
|
152
|
+
} catch {
|
|
153
|
+
return JSON.parse(JSON.stringify(e));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function K(e, t) {
|
|
157
|
+
m(() => {
|
|
158
|
+
(A.value?.querySelector(e) ?? t?.())?.focus();
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function st() {
|
|
162
|
+
m(() => {
|
|
163
|
+
let e = A.value?.querySelector("[data-editor]");
|
|
164
|
+
(e?.querySelector(`[data-editor-fields] :is(${C})`) ?? e?.querySelector(C))?.focus();
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function q(e) {
|
|
168
|
+
e >= 0 && e < z.value.length ? K(`[data-row="${e}"] [data-action="edit"], [data-row="${e}"] [data-action="remove"]`, ct) : K("[data-action='add']");
|
|
169
|
+
}
|
|
170
|
+
function ct() {
|
|
171
|
+
return A.value?.querySelector("[data-action='add']");
|
|
172
|
+
}
|
|
173
|
+
function J() {
|
|
174
|
+
P.value = {}, F.value = "";
|
|
175
|
+
}
|
|
176
|
+
function Y() {
|
|
177
|
+
$e.value && (j.value = !1, J(), N.value = T.newItem(), M.value = S, st());
|
|
178
|
+
}
|
|
179
|
+
function lt(e) {
|
|
180
|
+
!H.value && T.editable && (J(), N.value = ot(z.value[e]), M.value = e, st());
|
|
181
|
+
}
|
|
182
|
+
function X() {
|
|
183
|
+
let e = M.value;
|
|
184
|
+
e === null || I.value || (M.value = null, J(), q(e));
|
|
185
|
+
}
|
|
186
|
+
async function Z() {
|
|
187
|
+
let e = M.value;
|
|
188
|
+
if (e === null || B.value) return;
|
|
189
|
+
let t = N.value, n = T.validate?.(t, e);
|
|
190
|
+
if (P.value = n && typeof n == "object" ? n : {}, F.value = typeof n == "string" ? n : "", F.value || Object.keys(P.value).length) {
|
|
191
|
+
K("[data-editor] [aria-invalid='true'], [data-editor] [aria-invalid='true'] input");
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
I.value = !0;
|
|
195
|
+
try {
|
|
196
|
+
if (await T.beforeSave?.(t, e) === !1) return;
|
|
197
|
+
} catch (e) {
|
|
198
|
+
F.value = e instanceof Error ? e.message : String(e);
|
|
199
|
+
return;
|
|
200
|
+
} finally {
|
|
201
|
+
I.value = !1;
|
|
202
|
+
}
|
|
203
|
+
let r = [...z.value];
|
|
204
|
+
e === S ? r.push(t) : r[e] = t, E.value = r, M.value = null, J(), e === S ? (D("add", t), R.value = `${$(T.itemName)} added.`) : (D("update", t, e), R.value = `${$(T.itemName)} updated.`), q(e === S ? r.length - 1 : e);
|
|
205
|
+
}
|
|
206
|
+
async function ut(e) {
|
|
207
|
+
if (H.value) return;
|
|
208
|
+
let t = z.value[e];
|
|
209
|
+
if (T.beforeRemove) {
|
|
210
|
+
I.value = !0;
|
|
211
|
+
try {
|
|
212
|
+
if (await T.beforeRemove(t, e) === !1) return;
|
|
213
|
+
} finally {
|
|
214
|
+
I.value = !1;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
E.value = z.value.filter((t, n) => n !== e), L.value = /* @__PURE__ */ new Set(), D("remove", t, e), R.value = `${$(T.itemName)} removed.`, q(Math.min(e, z.value.length - 1));
|
|
218
|
+
}
|
|
219
|
+
function dt(e) {
|
|
220
|
+
let t = new Set(L.value);
|
|
221
|
+
t.delete(e) || t.add(e), L.value = t;
|
|
222
|
+
}
|
|
223
|
+
function Q(e) {
|
|
224
|
+
if (e.defaultPrevented) return;
|
|
225
|
+
let t = e.target;
|
|
226
|
+
e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), X()) : e.key === "Enter" && t.tagName === "INPUT" && ![
|
|
227
|
+
"checkbox",
|
|
228
|
+
"radio",
|
|
229
|
+
"file"
|
|
230
|
+
].includes(t.type) && (e.preventDefault(), Z());
|
|
231
|
+
}
|
|
232
|
+
function $(e) {
|
|
233
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
234
|
+
}
|
|
235
|
+
return p({
|
|
236
|
+
add: Y,
|
|
237
|
+
edit: lt,
|
|
238
|
+
cancel: X
|
|
239
|
+
}), (a, p) => (g(), c("div", {
|
|
240
|
+
ref_key: "root",
|
|
241
|
+
ref: A,
|
|
242
|
+
role: "group",
|
|
243
|
+
"aria-labelledby": Ye,
|
|
244
|
+
"aria-describedby": V.value.length || f.hint ? k : void 0,
|
|
245
|
+
"data-ac-ds": "",
|
|
246
|
+
"data-testid": "ac-form-array"
|
|
247
|
+
}, [
|
|
248
|
+
l("div", ve, [(g(), o(te(f.collapsible ? "button" : "div"), {
|
|
249
|
+
type: f.collapsible ? "button" : void 0,
|
|
250
|
+
class: h(["-ml-1 flex min-w-0 items-center gap-1.5 rounded-6 px-1 py-0.5 text-left", f.collapsible && "cursor-pointer transition hover:bg-surface-sunken focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring"]),
|
|
251
|
+
"aria-expanded": f.collapsible ? !j.value : void 0,
|
|
252
|
+
"aria-controls": f.collapsible ? Xe : void 0,
|
|
253
|
+
onClick: p[0] ||= (e) => f.collapsible && (j.value = !j.value)
|
|
254
|
+
}, {
|
|
255
|
+
default: se(() => [
|
|
256
|
+
f.collapsible ? (g(), o(x(de), {
|
|
257
|
+
key: 0,
|
|
258
|
+
class: h(["size-4 shrink-0 text-muted transition-transform duration-150 motion-reduce:transition-none", !j.value && "rotate-90"]),
|
|
259
|
+
"aria-hidden": "true"
|
|
260
|
+
}, null, 8, ["class"])) : s("", !0),
|
|
261
|
+
l("span", {
|
|
262
|
+
id: Ye,
|
|
263
|
+
class: "truncate text-lg font-medium text-heading"
|
|
264
|
+
}, [u(b(f.label), 1), f.required ? (g(), c("span", ye, " *")) : s("", !0)]),
|
|
265
|
+
z.value.length ? (g(), o(n, {
|
|
266
|
+
key: 1,
|
|
267
|
+
label: String(z.value.length),
|
|
268
|
+
rounded: "",
|
|
269
|
+
class: "shrink-0"
|
|
270
|
+
}, null, 8, ["label"])) : s("", !0),
|
|
271
|
+
f.required ? (g(), c("span", be, "(required)")) : s("", !0)
|
|
272
|
+
]),
|
|
273
|
+
_: 1
|
|
274
|
+
}, 8, [
|
|
275
|
+
"type",
|
|
276
|
+
"class",
|
|
277
|
+
"aria-expanded",
|
|
278
|
+
"aria-controls"
|
|
279
|
+
])), f.readonly ? s("", !0) : (g(), o(t, {
|
|
280
|
+
key: 0,
|
|
281
|
+
"data-action": "add",
|
|
282
|
+
title: nt.value,
|
|
283
|
+
size: "small",
|
|
284
|
+
color: "white",
|
|
285
|
+
disabled: !$e.value,
|
|
286
|
+
onClick: Y
|
|
287
|
+
}, {
|
|
288
|
+
icon: se(() => [d(x(me), { "aria-hidden": "true" })]),
|
|
289
|
+
_: 1
|
|
290
|
+
}, 8, ["title", "disabled"]))]),
|
|
291
|
+
V.value.length ? (g(), c("div", {
|
|
292
|
+
key: 0,
|
|
293
|
+
id: k,
|
|
294
|
+
class: "mt-1 space-y-0.5"
|
|
295
|
+
}, [(g(!0), c(i, null, v(V.value, (e) => (g(), c("p", {
|
|
296
|
+
key: e,
|
|
297
|
+
class: "flex items-center gap-1 text-xs text-red-30"
|
|
298
|
+
}, [d(x(fe), {
|
|
299
|
+
class: "size-3.5 shrink-0",
|
|
300
|
+
"aria-hidden": "true"
|
|
301
|
+
}), u(" " + b(e), 1)]))), 128))])) : f.hint ? (g(), c("p", {
|
|
302
|
+
key: 1,
|
|
303
|
+
id: k,
|
|
304
|
+
class: "mt-0.5 text-xs text-muted"
|
|
305
|
+
}, b(f.hint), 1)) : s("", !0),
|
|
306
|
+
ce(l("div", {
|
|
307
|
+
id: Xe,
|
|
308
|
+
class: "mt-2"
|
|
309
|
+
}, [et.value ? (g(), c("div", {
|
|
310
|
+
key: 0,
|
|
311
|
+
class: h(["overflow-hidden rounded-10 border bg-surface shadow-xs", V.value.length ? "border-red-60" : "border-border"])
|
|
312
|
+
}, [l("div", xe, [l("table", Se, [
|
|
313
|
+
l("caption", Ce, b(f.label), 1),
|
|
314
|
+
l("thead", null, [l("tr", null, [(g(!0), c(i, null, v(f.columns, (e) => (g(), c("th", {
|
|
315
|
+
key: e.key,
|
|
316
|
+
scope: "col",
|
|
317
|
+
class: "h-8 border-b border-border bg-surface-muted px-3 text-left text-xs font-medium whitespace-nowrap text-label",
|
|
318
|
+
style: ee(e.width ? { width: e.width } : void 0)
|
|
319
|
+
}, b(e.label), 5))), 128)), U.value ? (g(), c("th", we, [...p[1] ||= [l("span", { class: "sr-only" }, "Actions", -1)]])) : s("", !0)])]),
|
|
320
|
+
l("tbody", null, [(g(!0), c(i, null, v(it.value, (n) => (g(), c(i, { key: `${n.kind}-${n.index}` }, [n.kind === "item" ? (g(), c("tr", {
|
|
321
|
+
key: 0,
|
|
322
|
+
"data-row": n.index,
|
|
323
|
+
class: "group/row"
|
|
324
|
+
}, [(g(!0), c(i, null, v(f.columns, (e) => (g(), c("td", {
|
|
325
|
+
key: e.key,
|
|
326
|
+
class: "h-10 border-b border-border-light px-3 whitespace-nowrap text-body [tr:last-child_&]:border-b-0"
|
|
327
|
+
}, [y(a.$slots, `cell-${e.key}`, {
|
|
328
|
+
item: W(n.index),
|
|
329
|
+
index: n.index,
|
|
330
|
+
value: W(n.index)[e.key]
|
|
331
|
+
}, () => [e.format ? (g(), c(i, { key: 0 }, [u(b(at(e, n.index)), 1)], 64)) : (g(), o(r, {
|
|
332
|
+
key: 1,
|
|
333
|
+
value: W(n.index)[e.key],
|
|
334
|
+
type: e.type ?? "auto",
|
|
335
|
+
title: e.label,
|
|
336
|
+
"max-width": "220px"
|
|
337
|
+
}, null, 8, [
|
|
338
|
+
"value",
|
|
339
|
+
"type",
|
|
340
|
+
"title"
|
|
341
|
+
]))])]))), 128)), U.value ? (g(), c("td", Ee, [l("span", De, [
|
|
342
|
+
y(a.$slots, "row-actions", {
|
|
343
|
+
item: W(n.index),
|
|
344
|
+
index: n.index
|
|
345
|
+
}),
|
|
346
|
+
a.$slots.details ? (g(), c("button", {
|
|
347
|
+
key: 0,
|
|
348
|
+
type: "button",
|
|
349
|
+
class: "inline-flex size-7 cursor-pointer items-center justify-center rounded-6 text-muted transition hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring",
|
|
350
|
+
"aria-expanded": L.value.has(n.index),
|
|
351
|
+
"aria-label": `Details of ${G(n.index)}`,
|
|
352
|
+
onClick: (e) => dt(n.index)
|
|
353
|
+
}, [d(x(ue), {
|
|
354
|
+
class: h(["size-4 transition-transform motion-reduce:transition-none", L.value.has(n.index) && "rotate-180"]),
|
|
355
|
+
"aria-hidden": "true"
|
|
356
|
+
}, null, 8, ["class"])], 8, Oe)) : s("", !0),
|
|
357
|
+
f.editable && !f.readonly ? (g(), c("button", {
|
|
358
|
+
key: 1,
|
|
359
|
+
type: "button",
|
|
360
|
+
"data-action": "edit",
|
|
361
|
+
class: "inline-flex size-7 cursor-pointer items-center justify-center rounded-6 text-muted transition hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent",
|
|
362
|
+
"aria-label": `Edit ${G(n.index)}`,
|
|
363
|
+
disabled: H.value,
|
|
364
|
+
onClick: (e) => lt(n.index)
|
|
365
|
+
}, [d(x(pe), {
|
|
366
|
+
class: "size-3.5",
|
|
367
|
+
"aria-hidden": "true"
|
|
368
|
+
})], 8, ke)) : s("", !0),
|
|
369
|
+
f.readonly ? s("", !0) : (g(), c("button", {
|
|
370
|
+
key: 2,
|
|
371
|
+
type: "button",
|
|
372
|
+
"data-action": "remove",
|
|
373
|
+
class: "inline-flex size-7 cursor-pointer items-center justify-center rounded-6 text-muted transition hover:bg-red-95 hover:text-red-30 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted",
|
|
374
|
+
"aria-label": `Remove ${G(n.index)}`,
|
|
375
|
+
disabled: H.value,
|
|
376
|
+
onClick: (e) => ut(n.index)
|
|
377
|
+
}, [d(x(he), {
|
|
378
|
+
class: "size-3.5",
|
|
379
|
+
"aria-hidden": "true"
|
|
380
|
+
})], 8, Ae))
|
|
381
|
+
])])) : s("", !0)], 8, Te)) : n.kind === "inline" ? (g(), c("tr", {
|
|
382
|
+
key: 1,
|
|
383
|
+
"data-editor": "",
|
|
384
|
+
"aria-label": rt.value,
|
|
385
|
+
class: "bg-surface-muted",
|
|
386
|
+
onKeydown: Q
|
|
387
|
+
}, [(g(!0), c(i, null, v(f.columns, (e) => (g(), c("td", {
|
|
388
|
+
key: e.key,
|
|
389
|
+
"data-editor-fields": "",
|
|
390
|
+
class: "border-b border-border-light px-2 py-2 align-top [tr:last-child_&]:border-b-0"
|
|
391
|
+
}, [y(a.$slots, `field-${e.key}`, {
|
|
392
|
+
item: N.value,
|
|
393
|
+
index: n.index,
|
|
394
|
+
error: P.value[e.key] ?? "",
|
|
395
|
+
errors: P.value
|
|
396
|
+
}, () => [l("span", Me, [d(r, {
|
|
397
|
+
value: N.value[e.key],
|
|
398
|
+
type: e.type ?? "auto",
|
|
399
|
+
title: e.label,
|
|
400
|
+
"max-width": "220px"
|
|
401
|
+
}, null, 8, [
|
|
402
|
+
"value",
|
|
403
|
+
"type",
|
|
404
|
+
"title"
|
|
405
|
+
])])])]))), 128)), l("td", Ne, [l("span", Pe, [l("button", {
|
|
406
|
+
type: "button",
|
|
407
|
+
class: "inline-flex size-7 cursor-pointer items-center justify-center rounded-6 text-primary-20 transition hover:bg-primary-95 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40",
|
|
408
|
+
"aria-label": n.index === S ? `Add ${f.itemName}` : `Save ${f.itemName}`,
|
|
409
|
+
disabled: B.value || f.disabled,
|
|
410
|
+
onClick: Z
|
|
411
|
+
}, [B.value ? (g(), o(e, {
|
|
412
|
+
key: 0,
|
|
413
|
+
class: "text-primary",
|
|
414
|
+
label: ""
|
|
415
|
+
})) : (g(), o(x(le), {
|
|
416
|
+
key: 1,
|
|
417
|
+
class: "size-4",
|
|
418
|
+
"aria-hidden": "true"
|
|
419
|
+
}))], 8, Fe), l("button", {
|
|
420
|
+
type: "button",
|
|
421
|
+
class: "inline-flex size-7 cursor-pointer items-center justify-center rounded-6 text-muted transition hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40",
|
|
422
|
+
"aria-label": "Cancel",
|
|
423
|
+
disabled: I.value,
|
|
424
|
+
onClick: X
|
|
425
|
+
}, [d(x(ge), {
|
|
426
|
+
class: "size-4",
|
|
427
|
+
"aria-hidden": "true"
|
|
428
|
+
})], 8, Ie)]), F.value ? (g(), c("p", Le, b(F.value), 1)) : s("", !0)])], 40, je)) : n.kind === "form" ? (g(), c("tr", Re, [l("td", {
|
|
429
|
+
colspan: tt.value,
|
|
430
|
+
class: "border-b border-border-light bg-surface-muted p-0 [tr:last-child_&]:border-b-0"
|
|
431
|
+
}, [l("div", {
|
|
432
|
+
"data-editor": "",
|
|
433
|
+
role: "group",
|
|
434
|
+
"aria-labelledby": `${x(O)}-form-title`,
|
|
435
|
+
class: "px-4 py-4",
|
|
436
|
+
onKeydown: Q
|
|
437
|
+
}, [
|
|
438
|
+
l("p", {
|
|
439
|
+
id: `${x(O)}-form-title`,
|
|
440
|
+
class: "mb-3 text-base font-medium text-heading"
|
|
441
|
+
}, b(rt.value), 9, Ve),
|
|
442
|
+
l("div", He, [y(a.$slots, "form", {
|
|
443
|
+
item: N.value,
|
|
444
|
+
index: n.index,
|
|
445
|
+
errors: P.value,
|
|
446
|
+
isNew: n.index === S
|
|
447
|
+
})]),
|
|
448
|
+
F.value ? (g(), c("p", Ue, [d(x(fe), {
|
|
449
|
+
class: "size-3.5 shrink-0",
|
|
450
|
+
"aria-hidden": "true"
|
|
451
|
+
}), u(" " + b(F.value), 1)])) : s("", !0),
|
|
452
|
+
l("div", We, [d(t, {
|
|
453
|
+
title: "Cancel",
|
|
454
|
+
size: "small",
|
|
455
|
+
color: "white",
|
|
456
|
+
disabled: I.value,
|
|
457
|
+
onClick: X
|
|
458
|
+
}, null, 8, ["disabled"]), d(t, {
|
|
459
|
+
title: n.index === S ? `Add ${f.itemName}` : "Save",
|
|
460
|
+
size: "small",
|
|
461
|
+
loading: B.value,
|
|
462
|
+
disabled: f.disabled,
|
|
463
|
+
onClick: Z
|
|
464
|
+
}, null, 8, [
|
|
465
|
+
"title",
|
|
466
|
+
"loading",
|
|
467
|
+
"disabled"
|
|
468
|
+
])])
|
|
469
|
+
], 40, Be)], 8, ze)])) : n.kind === "details" ? (g(), c("tr", Ge, [l("td", {
|
|
470
|
+
colspan: tt.value,
|
|
471
|
+
class: "border-b border-border-light bg-surface-muted px-4 py-3 text-base text-body [tr:last-child_&]:border-b-0"
|
|
472
|
+
}, [y(a.$slots, "details", {
|
|
473
|
+
item: W(n.index),
|
|
474
|
+
index: n.index
|
|
475
|
+
})], 8, Ke)])) : s("", !0)], 64))), 128))])
|
|
476
|
+
])])], 2)) : (g(), c("div", {
|
|
477
|
+
key: 1,
|
|
478
|
+
class: h(["rounded-10 border border-dashed px-4 py-5 text-center text-base text-muted", V.value.length ? "border-red-60" : "border-border-dark"])
|
|
479
|
+
}, [y(a.$slots, "empty", {}, () => [u(b(f.emptyText), 1)])], 2))], 512), [[oe, !j.value]]),
|
|
480
|
+
l("p", qe, b(R.value), 1)
|
|
481
|
+
], 8, _e));
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
//#endregion
|
|
485
|
+
export { w as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface Props {
|
|
2
|
+
/** Text of the primary button. It's a `type="submit"` button, so it submits the surrounding form. */
|
|
3
|
+
submitLabel?: string;
|
|
4
|
+
/** Text of the secondary button. */
|
|
5
|
+
cancelLabel?: string;
|
|
6
|
+
/** Hides the Cancel button. */
|
|
7
|
+
hideCancel?: boolean;
|
|
8
|
+
/** Shows a spinner on the primary button and disables both buttons while a request runs. */
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
/** Disables the primary button, e.g. until the form is valid. */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* `container` sticks to the bottom of the nearest scrolling area (the page, a side panel, a modal body) while the form is in view.
|
|
14
|
+
* `viewport` is always pinned to the bottom of the window, lined up with the form's column. `none` sits after the fields.
|
|
15
|
+
*/
|
|
16
|
+
sticky?: "container" | "viewport" | "none";
|
|
17
|
+
/** `id` of a `<form>` to submit when the footer is rendered outside it. */
|
|
18
|
+
form?: string;
|
|
19
|
+
}
|
|
20
|
+
type __VLS_Slots = {
|
|
21
|
+
/** Left side: a status line ("Unsaved changes"), a Reset or Delete button. */
|
|
22
|
+
left?: () => unknown;
|
|
23
|
+
/** Right side. Replaces the default Cancel and Save buttons. */
|
|
24
|
+
right?: () => unknown;
|
|
25
|
+
};
|
|
26
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
|
+
cancel: () => any;
|
|
28
|
+
save: () => any;
|
|
29
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
30
|
+
onCancel?: (() => any) | undefined;
|
|
31
|
+
onSave?: (() => any) | undefined;
|
|
32
|
+
}>, {
|
|
33
|
+
form: string;
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
submitLabel: string;
|
|
37
|
+
cancelLabel: string;
|
|
38
|
+
hideCancel: boolean;
|
|
39
|
+
sticky: "container" | "viewport" | "none";
|
|
40
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
42
|
+
declare const _default: typeof __VLS_export;
|
|
43
|
+
export default _default;
|
|
44
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import e from "./AcButton.js";
|
|
2
|
+
import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, inject as c, normalizeClass as l, normalizeStyle as u, onBeforeUnmount as d, onMounted as f, openBlock as p, ref as m, renderSlot as h, watch as g } from "vue";
|
|
3
|
+
//#region src/lib/components/AcFormFooter.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var _ = { class: "flex min-w-0 items-center gap-2 text-base text-muted" }, v = { class: "ml-auto flex items-center gap-2" }, y = /*@__PURE__*/ s({
|
|
5
|
+
__name: "AcFormFooter",
|
|
6
|
+
props: {
|
|
7
|
+
submitLabel: { default: "Save" },
|
|
8
|
+
cancelLabel: { default: "Cancel" },
|
|
9
|
+
hideCancel: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
},
|
|
13
|
+
loading: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: !1
|
|
16
|
+
},
|
|
17
|
+
disabled: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: !1
|
|
20
|
+
},
|
|
21
|
+
sticky: { default: "container" },
|
|
22
|
+
form: { default: "" }
|
|
23
|
+
},
|
|
24
|
+
emits: ["cancel", "save"],
|
|
25
|
+
setup(s, { emit: y }) {
|
|
26
|
+
let b = s, x = y, S = c("ac-form", null), C = m(null), w = m(null), T = m({
|
|
27
|
+
left: 0,
|
|
28
|
+
width: 0,
|
|
29
|
+
height: 0
|
|
30
|
+
}), E, D = t(() => S?.widthClass.value ?? "");
|
|
31
|
+
function O(e) {
|
|
32
|
+
e.currentTarget?.form || x("save");
|
|
33
|
+
}
|
|
34
|
+
function k() {
|
|
35
|
+
if (!C.value || !w.value) return;
|
|
36
|
+
let e = C.value.getBoundingClientRect();
|
|
37
|
+
T.value = {
|
|
38
|
+
left: e.left,
|
|
39
|
+
width: e.width,
|
|
40
|
+
height: w.value.offsetHeight
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function A() {
|
|
44
|
+
j(), b.sticky === "viewport" && C.value && w.value && (k(), E = new ResizeObserver(k), E.observe(C.value), E.observe(w.value), window.addEventListener("resize", k));
|
|
45
|
+
}
|
|
46
|
+
function j() {
|
|
47
|
+
E?.disconnect(), E = void 0, window.removeEventListener("resize", k);
|
|
48
|
+
}
|
|
49
|
+
return g(() => b.sticky, A, { flush: "post" }), f(A), d(j), (t, c) => (p(), i("div", {
|
|
50
|
+
ref_key: "root",
|
|
51
|
+
ref: C,
|
|
52
|
+
class: l(["mt-4 w-full", [s.sticky === "container" && "sticky bottom-0 z-10", s.sticky !== "viewport" && D.value]]),
|
|
53
|
+
style: u(s.sticky === "viewport" ? { height: `${T.value.height}px` } : void 0),
|
|
54
|
+
"data-ac-ds": "",
|
|
55
|
+
"data-testid": "ac-form-footer"
|
|
56
|
+
}, [a("div", {
|
|
57
|
+
ref_key: "bar",
|
|
58
|
+
ref: w,
|
|
59
|
+
class: l(["border-t border-border bg-surface py-3", s.sticky === "viewport" && "fixed bottom-0 z-40 px-4"]),
|
|
60
|
+
style: u(s.sticky === "viewport" ? {
|
|
61
|
+
left: `${T.value.left}px`,
|
|
62
|
+
width: `${T.value.width}px`
|
|
63
|
+
} : void 0)
|
|
64
|
+
}, [a("div", { class: l(["flex w-full flex-wrap items-center justify-between gap-x-4 gap-y-2", D.value]) }, [a("div", _, [h(t.$slots, "left")]), a("div", v, [h(t.$slots, "right", {}, () => [s.hideCancel ? r("", !0) : (p(), n(e, {
|
|
65
|
+
key: 0,
|
|
66
|
+
title: s.cancelLabel,
|
|
67
|
+
color: "white",
|
|
68
|
+
disabled: s.loading,
|
|
69
|
+
onClick: c[0] ||= (e) => x("cancel")
|
|
70
|
+
}, null, 8, ["title", "disabled"])), o(e, {
|
|
71
|
+
title: s.submitLabel,
|
|
72
|
+
type: "submit",
|
|
73
|
+
form: s.form || void 0,
|
|
74
|
+
loading: s.loading,
|
|
75
|
+
disabled: s.disabled,
|
|
76
|
+
onClick: O
|
|
77
|
+
}, null, 8, [
|
|
78
|
+
"title",
|
|
79
|
+
"form",
|
|
80
|
+
"loading",
|
|
81
|
+
"disabled"
|
|
82
|
+
])])])], 2)], 6)], 6));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
//#endregion
|
|
86
|
+
export { y as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface Props {
|
|
2
|
+
/** Heading of the group, e.g. "Schedule" or "Retention". */
|
|
3
|
+
title?: string;
|
|
4
|
+
/** A line or two under the title explaining the group. */
|
|
5
|
+
description?: string;
|
|
6
|
+
/** `stacked` puts the title above the fields; `aside` puts it in a left column from 768px up. Defaults to the AcForm's `layout`. */
|
|
7
|
+
layout?: "stacked" | "aside";
|
|
8
|
+
/** Lays the fields out in two columns from 640px up. Use `class="sm:col-span-2"` on a field to span both. */
|
|
9
|
+
columns?: 1 | 2;
|
|
10
|
+
}
|
|
11
|
+
type __VLS_Slots = {
|
|
12
|
+
/** The fields. They're spaced 20px apart. */
|
|
13
|
+
default?: () => unknown;
|
|
14
|
+
/** Replaces the description, e.g. to add a docs link. */
|
|
15
|
+
description?: () => unknown;
|
|
16
|
+
/** Content at the right of the title, e.g. a "Reset to defaults" button. Only in the `stacked` layout. */
|
|
17
|
+
actions?: () => unknown;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
layout: "stacked" | "aside";
|
|
23
|
+
columns: 1 | 2;
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|