@ac-design/design-system 1.0.2 → 2.0.0
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 +27 -18
- package/dist/lib/charts/ChartFrame.js +5 -0
- package/dist/lib/charts/ChartFrame.vue.d.ts +69 -0
- package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/lib/charts/index.d.ts +7 -0
- package/dist/lib/charts/index.js +5 -0
- package/dist/lib/charts/shared.d.ts +60 -0
- package/dist/lib/charts/shared.js +114 -0
- package/dist/lib/charts/xy.d.ts +65 -0
- package/dist/lib/charts/xy.js +92 -0
- package/dist/lib/compat.css +1707 -1042
- package/dist/lib/components/AcAccordion.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcAccordionItem.vue.d.ts +1 -1
- package/dist/lib/components/AcAccordionItem.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/lib/components/AcAlert.vue.d.ts +1 -1
- package/dist/lib/components/AcAlert.vue_vue_type_script_setup_true_lang.js +19 -25
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +19 -19
- package/dist/lib/components/AcAreaChart.js +5 -0
- package/dist/lib/components/AcAreaChart.vue.d.ts +44 -0
- package/dist/lib/components/AcAreaChart.vue_vue_type_script_setup_true_lang.js +215 -0
- package/dist/lib/components/AcAvatar.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcBadge.vue.d.ts +16 -7
- package/dist/lib/components/AcBadge.vue_vue_type_script_setup_true_lang.js +59 -43
- package/dist/lib/components/AcBanner.vue.d.ts +1 -1
- package/dist/lib/components/AcBanner.vue_vue_type_script_setup_true_lang.js +30 -30
- package/dist/lib/components/AcBarChart.js +5 -0
- package/dist/lib/components/AcBarChart.vue.d.ts +43 -0
- package/dist/lib/components/AcBarChart.vue_vue_type_script_setup_true_lang.js +217 -0
- package/dist/lib/components/AcBreadcrumb.vue_vue_type_script_setup_true_lang.js +27 -26
- package/dist/lib/components/AcBulkActionBar.js +5 -0
- package/dist/lib/components/AcBulkActionBar.vue.d.ts +43 -0
- package/dist/lib/components/AcBulkActionBar.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/lib/components/AcButton.vue.d.ts +3 -3
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +42 -34
- package/dist/lib/components/AcButtons.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcCard.vue.d.ts +10 -2
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +37 -11
- package/dist/lib/components/AcCellValue.vue.d.ts +4 -1
- package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +214 -179
- package/dist/lib/components/AcCheckBox.vue.d.ts +17 -3
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +126 -29
- package/dist/lib/components/AcCheckRadio.vue.d.ts +1 -1
- package/dist/lib/components/AcCheckRadio.vue_vue_type_script_setup_true_lang.js +33 -21
- package/dist/lib/components/AcCircularProgress.js +5 -0
- package/dist/lib/components/AcCircularProgress.vue.d.ts +44 -0
- package/dist/lib/components/AcCircularProgress.vue_vue_type_script_setup_true_lang.js +111 -0
- package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +142 -167
- package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/lib/components/AcColorInput.js +5 -0
- package/dist/lib/components/AcColorInput.vue.d.ts +54 -0
- package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/lib/components/AcConfirmModal.js +5 -0
- package/dist/lib/components/AcConfirmModal.vue.d.ts +56 -0
- package/dist/lib/components/AcConfirmModal.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/lib/components/AcContentHeader.vue.d.ts +1 -1
- package/dist/lib/components/AcContentHeader.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/lib/components/AcContentLayout.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcCopyButton.js +5 -0
- package/dist/lib/components/AcCopyButton.vue.d.ts +43 -0
- package/dist/lib/components/AcCopyButton.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/lib/components/AcDatePicker.vue.d.ts +5 -5
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +204 -213
- package/dist/lib/components/AcDeleteModal.vue.d.ts +4 -4
- package/dist/lib/components/AcDeleteModal.vue_vue_type_script_setup_true_lang.js +37 -46
- package/dist/lib/components/AcDonutChart.js +5 -0
- package/dist/lib/components/AcDonutChart.vue.d.ts +73 -0
- package/dist/lib/components/AcDonutChart.vue_vue_type_script_setup_true_lang.js +210 -0
- package/dist/lib/components/AcDropdown.vue.d.ts +1 -1
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/lib/components/AcDropdownDivider.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcDropdownItem.vue.d.ts +1 -1
- package/dist/lib/components/AcDropdownItem.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/lib/components/AcEmptyState.vue.d.ts +4 -1
- package/dist/lib/components/AcEmptyState.vue_vue_type_script_setup_true_lang.js +50 -39
- package/dist/lib/components/AcFeatureCard.vue_vue_type_script_setup_true_lang.js +14 -13
- package/dist/lib/components/AcFileEditor.vue_vue_type_script_setup_true_lang.js +16 -16
- package/dist/lib/components/AcFileUpload.vue.d.ts +2 -2
- package/dist/lib/components/AcFileUpload.vue_vue_type_script_setup_true_lang.js +55 -53
- package/dist/lib/components/AcFontScale.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcFooter.js +5 -0
- package/dist/lib/components/AcFooter.vue.d.ts +37 -0
- package/dist/lib/components/AcFooter.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/lib/components/AcForm.vue.d.ts +3 -0
- package/dist/lib/components/AcForm.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/lib/components/AcFormArray.vue.d.ts +2 -2
- package/dist/lib/components/AcFormArray.vue_vue_type_script_setup_true_lang.js +149 -147
- package/dist/lib/components/AcFormFooter.vue.d.ts +2 -2
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcFormSection.vue.d.ts +7 -0
- package/dist/lib/components/AcFormSection.vue_vue_type_script_setup_true_lang.js +31 -21
- package/dist/lib/components/AcHeader.vue.d.ts +3 -3
- package/dist/lib/components/AcHeader.vue_vue_type_script_setup_true_lang.js +22 -22
- package/dist/lib/components/AcInfoTable.vue_vue_type_script_setup_true_lang.js +17 -13
- package/dist/lib/components/AcInput.vue.d.ts +3 -3
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +98 -87
- package/dist/lib/components/AcKbd.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcKeyValueInput.js +5 -0
- package/dist/lib/components/AcKeyValueInput.vue.d.ts +114 -0
- package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +320 -0
- package/dist/lib/components/AcLineChart.js +5 -0
- package/dist/lib/components/AcLineChart.vue.d.ts +38 -0
- package/dist/lib/components/AcLineChart.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/lib/components/AcLocaleSwitcher.js +5 -0
- package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +46 -0
- package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/lib/components/AcNavbarItem.vue.d.ts +1 -1
- package/dist/lib/components/AcNavbarItem.vue_vue_type_script_setup_true_lang.js +22 -22
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +26 -26
- package/dist/lib/components/AcNumberInput.js +5 -0
- package/dist/lib/components/AcNumberInput.vue.d.ts +79 -0
- package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/lib/components/AcPage.vue.d.ts +2 -2
- package/dist/lib/components/AcPage.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcPagination.vue.d.ts +20 -3
- package/dist/lib/components/AcPagination.vue_vue_type_script_setup_true_lang.js +81 -53
- package/dist/lib/components/AcPreloader.vue.d.ts +1 -1
- package/dist/lib/components/AcPreloader.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/lib/components/AcProgress.vue.d.ts +2 -2
- package/dist/lib/components/AcProgress.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/lib/components/AcResourceCard.vue.d.ts +2 -2
- package/dist/lib/components/AcResourceCard.vue_vue_type_script_setup_true_lang.js +13 -13
- package/dist/lib/components/AcSearchBar.vue.d.ts +1 -1
- package/dist/lib/components/AcSearchBar.vue_vue_type_script_setup_true_lang.js +9 -8
- package/dist/lib/components/AcSectionContent.vue.d.ts +2 -2
- package/dist/lib/components/AcSectionContent.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcSegmentedControl.vue.d.ts +1 -1
- package/dist/lib/components/AcSegmentedControl.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/lib/components/AcSelect.vue.d.ts +4 -4
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +230 -227
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +31 -31
- package/dist/lib/components/AcSideTabs.vue.d.ts +1 -1
- package/dist/lib/components/AcSideTabs.vue_vue_type_script_setup_true_lang.js +37 -37
- package/dist/lib/components/AcSidebar.vue.d.ts +3 -3
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +75 -75
- package/dist/lib/components/AcSidebarItem.vue_vue_type_script_setup_true_lang.js +33 -32
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/lib/components/AcSkeleton.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcSlider.vue.d.ts +1 -1
- package/dist/lib/components/AcSlider.vue_vue_type_script_setup_true_lang.js +174 -172
- package/dist/lib/components/AcStatCard.vue.d.ts +3 -3
- package/dist/lib/components/AcStatCard.vue_vue_type_script_setup_true_lang.js +90 -85
- package/dist/lib/components/AcStatusBar.vue.d.ts +1 -1
- package/dist/lib/components/AcStatusBar.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/lib/components/AcSteps.vue_vue_type_script_setup_true_lang.js +28 -28
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +39 -34
- package/dist/lib/components/AcSwitchCard.js +5 -0
- package/dist/lib/components/AcSwitchCard.vue.d.ts +59 -0
- package/dist/lib/components/AcSwitchCard.vue_vue_type_script_setup_true_lang.js +119 -0
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +87 -87
- package/dist/lib/components/AcTabs.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/lib/components/AcTag.vue.d.ts +1 -1
- package/dist/lib/components/AcTag.vue_vue_type_script_setup_true_lang.js +22 -22
- package/dist/lib/components/AcTagInput.js +5 -0
- package/dist/lib/components/AcTagInput.vue.d.ts +74 -0
- package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +291 -0
- package/dist/lib/components/AcTextarea.vue.d.ts +3 -3
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +89 -64
- package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/lib/components/AcTimePicker.js +5 -0
- package/dist/lib/components/AcTimePicker.vue.d.ts +65 -0
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +463 -0
- package/dist/lib/components/AcToaster.vue_vue_type_script_setup_true_lang.js +65 -71
- package/dist/lib/components/AcTooltip.vue.d.ts +1 -1
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +77 -67
- package/dist/lib/components/AcUsageCard.vue_vue_type_script_setup_true_lang.js +27 -27
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +111 -103
- package/dist/lib/components/index.d.ts +14 -2
- package/dist/lib/components/status.d.ts +26 -0
- package/dist/lib/components/status.js +110 -0
- package/dist/lib/composables/copyText.d.ts +2 -1
- package/dist/lib/composables/copyText.js +2 -2
- package/dist/lib/composables/useApiPagination.d.ts +55 -0
- package/dist/lib/composables/useApiPagination.js +58 -0
- package/dist/lib/composables/useBulkSelection.d.ts +44 -0
- package/dist/lib/composables/useBulkSelection.js +41 -0
- package/dist/lib/composables/useFormValidation.d.ts +65 -0
- package/dist/lib/composables/useFormValidation.js +148 -0
- package/dist/lib/composables/useTablePagination.d.ts +49 -0
- package/dist/lib/composables/useTablePagination.js +41 -0
- package/dist/lib/editor/theme.js +65 -62
- package/dist/lib/index.d.ts +14 -0
- package/dist/lib/index.js +95 -78
- package/dist/lib/theme.css +391 -272
- package/package.json +11 -4
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export interface Props {
|
|
2
|
+
/** Label above the field. Without one, pass `aria-label` so the field still has a name. */
|
|
3
|
+
label?: string;
|
|
4
|
+
/** Native `name` attribute. */
|
|
5
|
+
name?: string;
|
|
6
|
+
/** Lowest allowed value. ↓, − and Home stop here, and typed values are clamped to it on blur. No limit by default. */
|
|
7
|
+
min?: number;
|
|
8
|
+
/** Highest allowed value. ↑, + and End stop here, and typed values are clamped to it on blur. No limit by default. */
|
|
9
|
+
max?: number;
|
|
10
|
+
/** Amount one − / + press or one ↑ / ↓ adds. Page Up / Page Down move 10 steps. Its decimals set the precision, e.g. `0.1` keeps one decimal. */
|
|
11
|
+
step?: number;
|
|
12
|
+
/** Decimal places to keep. Defaults to the decimals in `step`; values are rounded to it on blur. */
|
|
13
|
+
precision?: number;
|
|
14
|
+
/** Unit shown after the value, e.g. `GiB`, `vCPU` or `%`. Also read out with the value. */
|
|
15
|
+
unit?: string;
|
|
16
|
+
/** Shows the − and + buttons inside the field. Cloud `is-show-inc-dec`. */
|
|
17
|
+
stepButtons?: boolean;
|
|
18
|
+
/** Milliseconds a − / + press is held before it starts repeating. */
|
|
19
|
+
holdDelay?: number;
|
|
20
|
+
/** Milliseconds between repeats while − / + is held. */
|
|
21
|
+
holdIntervalDelay?: number;
|
|
22
|
+
/** Marks the field required and adds a red asterisk. */
|
|
23
|
+
required?: boolean;
|
|
24
|
+
/** Disables the field and its buttons. */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Read-only field: a muted fill, "(read only)" after the label, and no stepping. */
|
|
27
|
+
readonly?: boolean;
|
|
28
|
+
/** Error text under the field. Turns the border red and sets `aria-invalid`. */
|
|
29
|
+
errorMsg?: string;
|
|
30
|
+
/** Help text between the label and the field. */
|
|
31
|
+
hint?: string;
|
|
32
|
+
/** `small` 36px or `normal` 40px tall. */
|
|
33
|
+
size?: "small" | "normal";
|
|
34
|
+
}
|
|
35
|
+
type __VLS_Props = Props;
|
|
36
|
+
type __VLS_Slots = {
|
|
37
|
+
/** Content inside the field after the value, before the buttons: an icon or richer unit text. */
|
|
38
|
+
suffix?: () => unknown;
|
|
39
|
+
};
|
|
40
|
+
type __VLS_ModelProps = {
|
|
41
|
+
/** The number, or `null` while the field is empty. */
|
|
42
|
+
modelValue?: number | null;
|
|
43
|
+
};
|
|
44
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
45
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
46
|
+
/** Moves focus to the input. */
|
|
47
|
+
focus: () => void | undefined;
|
|
48
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
49
|
+
"update:modelValue": (value: number | null) => any;
|
|
50
|
+
change: (value: number | null) => any;
|
|
51
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
52
|
+
"onUpdate:modelValue"?: ((value: number | null) => any) | undefined;
|
|
53
|
+
onChange?: ((value: number | null) => any) | undefined;
|
|
54
|
+
}>, {
|
|
55
|
+
required: boolean;
|
|
56
|
+
label: string;
|
|
57
|
+
disabled: boolean;
|
|
58
|
+
max: number;
|
|
59
|
+
min: number;
|
|
60
|
+
name: string;
|
|
61
|
+
size: "small" | "normal";
|
|
62
|
+
step: number;
|
|
63
|
+
readonly: boolean;
|
|
64
|
+
hint: string;
|
|
65
|
+
errorMsg: string;
|
|
66
|
+
unit: string;
|
|
67
|
+
precision: number;
|
|
68
|
+
stepButtons: boolean;
|
|
69
|
+
holdDelay: number;
|
|
70
|
+
holdIntervalDelay: number;
|
|
71
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
72
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
73
|
+
declare const _default: typeof __VLS_export;
|
|
74
|
+
export default _default;
|
|
75
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
76
|
+
new (): {
|
|
77
|
+
$slots: S;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as ee, createVNode as o, defineComponent as s, mergeModels as c, mergeProps as l, normalizeClass as u, onBeforeUnmount as d, openBlock as f, ref as p, renderList as te, renderSlot as ne, resolveDynamicComponent as re, toDisplayString as m, unref as h, useAttrs as g, useId as ie, useModel as ae, watch as oe, withModifiers as se } from "vue";
|
|
2
|
+
import { CircleAlert as _, Minus as v, Plus as y } from "@lucide/vue";
|
|
3
|
+
//#region src/lib/components/AcNumberInput.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var b = ["for"], x = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "font-normal text-muted"
|
|
7
|
+
}, S = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "text-danger",
|
|
10
|
+
"aria-hidden": "true"
|
|
11
|
+
}, C = ["id"], w = [
|
|
12
|
+
"id",
|
|
13
|
+
"inputmode",
|
|
14
|
+
"value",
|
|
15
|
+
"name",
|
|
16
|
+
"disabled",
|
|
17
|
+
"readonly",
|
|
18
|
+
"required",
|
|
19
|
+
"aria-valuenow",
|
|
20
|
+
"aria-valuemin",
|
|
21
|
+
"aria-valuemax",
|
|
22
|
+
"aria-valuetext",
|
|
23
|
+
"aria-invalid",
|
|
24
|
+
"aria-describedby"
|
|
25
|
+
], T = { key: 0 }, E = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "mr-1 flex shrink-0 items-center gap-1"
|
|
28
|
+
}, ce = [
|
|
29
|
+
"disabled",
|
|
30
|
+
"aria-label",
|
|
31
|
+
"aria-controls",
|
|
32
|
+
"data-testid",
|
|
33
|
+
"onPointerdown",
|
|
34
|
+
"onClick"
|
|
35
|
+
], le = ["id"], D = /*@__PURE__*/ s({
|
|
36
|
+
inheritAttrs: !1,
|
|
37
|
+
__name: "AcNumberInput",
|
|
38
|
+
props: /*@__PURE__*/ c({
|
|
39
|
+
label: { default: "" },
|
|
40
|
+
name: { default: "" },
|
|
41
|
+
min: { default: void 0 },
|
|
42
|
+
max: { default: void 0 },
|
|
43
|
+
step: { default: 1 },
|
|
44
|
+
precision: { default: void 0 },
|
|
45
|
+
unit: { default: "" },
|
|
46
|
+
stepButtons: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !0
|
|
49
|
+
},
|
|
50
|
+
holdDelay: { default: 300 },
|
|
51
|
+
holdIntervalDelay: { default: 100 },
|
|
52
|
+
required: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: !1
|
|
55
|
+
},
|
|
56
|
+
disabled: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: !1
|
|
59
|
+
},
|
|
60
|
+
readonly: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: !1
|
|
63
|
+
},
|
|
64
|
+
errorMsg: { default: "" },
|
|
65
|
+
hint: { default: "" },
|
|
66
|
+
size: { default: "normal" }
|
|
67
|
+
}, {
|
|
68
|
+
modelValue: { default: null },
|
|
69
|
+
modelModifiers: {}
|
|
70
|
+
}),
|
|
71
|
+
emits: /*@__PURE__*/ c(["change"], ["update:modelValue"]),
|
|
72
|
+
setup(s, { expose: c, emit: D }) {
|
|
73
|
+
let O = s, k = ae(s, "modelValue"), A = D, j = ie(), M = g(), N = t(() => ({
|
|
74
|
+
class: M.class,
|
|
75
|
+
style: M.style
|
|
76
|
+
})), P = t(() => {
|
|
77
|
+
let { class: e, style: t, ...n } = M;
|
|
78
|
+
return n;
|
|
79
|
+
}), F = p(null), I = p(K(k.value)), L = p(!1), R, z, B = t(() => O.precision ?? pe(O.step)), V = t(() => O.min === void 0 || O.min < 0), H = t(() => O.disabled || O.readonly), U = t(() => O.min !== void 0 && k.value !== null && k.value <= O.min), W = t(() => O.max !== void 0 && k.value !== null && k.value >= O.max), ue = t(() => {
|
|
80
|
+
let e = k.value;
|
|
81
|
+
if (!L.value || e === null) return "";
|
|
82
|
+
let { min: t, max: n } = O;
|
|
83
|
+
return (t === void 0 || e >= t) && (n === void 0 || e <= n) ? "" : t !== void 0 && n !== void 0 ? `Enter a value from ${t} to ${n}` : t === void 0 ? `Enter ${n} or less` : `Enter ${t} or more`;
|
|
84
|
+
}), G = t(() => O.errorMsg || ue.value), de = t(() => [O.hint && `${j}-hint`, G.value && `${j}-msg`].filter(Boolean).join(" ") || void 0), fe = t(() => k.value === null ? void 0 : [I.value, O.unit].filter(Boolean).join(" "));
|
|
85
|
+
function pe(e) {
|
|
86
|
+
let t = String(e);
|
|
87
|
+
return t.includes("e-") ? Number(t.split("e-")[1]) : t.split(".")[1]?.length ?? 0;
|
|
88
|
+
}
|
|
89
|
+
function K(e) {
|
|
90
|
+
return e === null ? "" : String(e);
|
|
91
|
+
}
|
|
92
|
+
function q(e) {
|
|
93
|
+
return Number(e.toFixed(B.value));
|
|
94
|
+
}
|
|
95
|
+
function J(e) {
|
|
96
|
+
return O.min !== void 0 && e < O.min ? O.min : O.max !== void 0 && e > O.max ? O.max : e;
|
|
97
|
+
}
|
|
98
|
+
function Y(e) {
|
|
99
|
+
if (e === "" || e === "-" || e === "." || e === "-.") return null;
|
|
100
|
+
let t = Number(e);
|
|
101
|
+
return Number.isNaN(t) ? null : t;
|
|
102
|
+
}
|
|
103
|
+
function X(e) {
|
|
104
|
+
let t = e !== k.value;
|
|
105
|
+
k.value = e, I.value = K(e), t && A("change", e);
|
|
106
|
+
}
|
|
107
|
+
function Z(e, t = 1) {
|
|
108
|
+
H.value || X(J(q((k.value ?? 0) + e * O.step * t)));
|
|
109
|
+
}
|
|
110
|
+
function me(e) {
|
|
111
|
+
let t = e.target;
|
|
112
|
+
if (!RegExp(`^${V.value ? "-?" : ""}\\d*${B.value > 0 ? "(\\.\\d*)?" : ""}$`).test(t.value)) {
|
|
113
|
+
t.value = I.value;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
I.value = t.value;
|
|
117
|
+
let n = Y(t.value);
|
|
118
|
+
(n !== null || t.value === "") && (k.value = n);
|
|
119
|
+
}
|
|
120
|
+
function Q() {
|
|
121
|
+
let e = Y(I.value);
|
|
122
|
+
X(e === null ? null : J(q(e)));
|
|
123
|
+
}
|
|
124
|
+
function he() {
|
|
125
|
+
L.value = !1, Q();
|
|
126
|
+
}
|
|
127
|
+
function ge(e) {
|
|
128
|
+
let t = {
|
|
129
|
+
ArrowUp: () => Z(1),
|
|
130
|
+
ArrowDown: () => Z(-1),
|
|
131
|
+
PageUp: () => Z(1, 10),
|
|
132
|
+
PageDown: () => Z(-1, 10)
|
|
133
|
+
};
|
|
134
|
+
if (O.min !== void 0 && (t.Home = () => !H.value && X(O.min)), O.max !== void 0 && (t.End = () => !H.value && X(O.max)), e.key === "Enter") return Q();
|
|
135
|
+
let n = t[e.key];
|
|
136
|
+
n && (e.preventDefault(), n());
|
|
137
|
+
}
|
|
138
|
+
function $() {
|
|
139
|
+
clearTimeout(R), clearInterval(z);
|
|
140
|
+
}
|
|
141
|
+
function _e(e, t) {
|
|
142
|
+
e.button !== 0 || H.value || ($(), Z(t), R = setTimeout(() => {
|
|
143
|
+
z = setInterval(() => {
|
|
144
|
+
Z(t), (t > 0 && W.value || t < 0 && U.value) && $();
|
|
145
|
+
}, O.holdIntervalDelay);
|
|
146
|
+
}, O.holdDelay));
|
|
147
|
+
}
|
|
148
|
+
function ve(e, t) {
|
|
149
|
+
e.detail === 0 && Z(t);
|
|
150
|
+
}
|
|
151
|
+
return oe(k, (e) => {
|
|
152
|
+
Y(I.value) !== e && (I.value = K(e));
|
|
153
|
+
}), d($), c({ focus: () => F.value?.focus() }), (t, c) => (f(), i("div", l(N.value, {
|
|
154
|
+
class: ["w-full", s.disabled && "opacity-50"],
|
|
155
|
+
"data-ac-ds": "",
|
|
156
|
+
"data-testid": "ac-number-input"
|
|
157
|
+
}), [
|
|
158
|
+
s.label ? (f(), i("label", {
|
|
159
|
+
key: 0,
|
|
160
|
+
for: h(j),
|
|
161
|
+
class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
|
|
162
|
+
}, [
|
|
163
|
+
a("span", null, m(s.label), 1),
|
|
164
|
+
s.readonly ? (f(), i("span", x, "(read only)")) : r("", !0),
|
|
165
|
+
s.required ? (f(), i("span", S, "*")) : r("", !0)
|
|
166
|
+
], 8, b)) : r("", !0),
|
|
167
|
+
s.hint ? (f(), i("p", {
|
|
168
|
+
key: 1,
|
|
169
|
+
id: `${h(j)}-hint`,
|
|
170
|
+
class: "mb-2 text-base text-muted"
|
|
171
|
+
}, m(s.hint), 9, C)) : r("", !0),
|
|
172
|
+
a("div", { class: u(["relative flex min-w-0 items-center rounded-10 border transition-[border-color,box-shadow,background-color] duration-200", [
|
|
173
|
+
s.size === "small" ? "h-9" : "h-10",
|
|
174
|
+
s.readonly ? "bg-surface-muted" : "bg-background",
|
|
175
|
+
G.value ? "border-danger/60 focus-within:border-danger focus-within:shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]" : ["border-border focus-within:focus-ring", !s.disabled && "hover:border-accent-active"]
|
|
176
|
+
]]) }, [
|
|
177
|
+
a("input", l({
|
|
178
|
+
id: h(j),
|
|
179
|
+
ref_key: "input",
|
|
180
|
+
ref: F
|
|
181
|
+
}, P.value, {
|
|
182
|
+
type: "text",
|
|
183
|
+
role: "spinbutton",
|
|
184
|
+
autocomplete: "off",
|
|
185
|
+
inputmode: B.value > 0 || V.value ? "decimal" : "numeric",
|
|
186
|
+
value: I.value,
|
|
187
|
+
name: s.name,
|
|
188
|
+
disabled: s.disabled,
|
|
189
|
+
readonly: s.readonly,
|
|
190
|
+
required: s.required,
|
|
191
|
+
"aria-valuenow": k.value ?? void 0,
|
|
192
|
+
"aria-valuemin": s.min,
|
|
193
|
+
"aria-valuemax": s.max,
|
|
194
|
+
"aria-valuetext": fe.value,
|
|
195
|
+
"aria-invalid": !!G.value || void 0,
|
|
196
|
+
"aria-describedby": de.value,
|
|
197
|
+
class: ["block h-full w-full min-w-0 flex-1 rounded-10 bg-transparent text-base font-normal text-heading tabular-nums outline-none placeholder:text-muted/80 disabled:cursor-not-allowed", [s.size === "small" ? "pl-3" : "pl-4", s.unit || t.$slots.suffix || s.stepButtons ? "pr-2" : s.size === "small" ? "pr-3" : "pr-4"]],
|
|
198
|
+
onInput: me,
|
|
199
|
+
onKeydown: ge,
|
|
200
|
+
onFocus: c[0] ||= (e) => L.value = !0,
|
|
201
|
+
onBlur: he
|
|
202
|
+
}), null, 16, w),
|
|
203
|
+
s.unit || t.$slots.suffix ? (f(), i("span", {
|
|
204
|
+
key: 0,
|
|
205
|
+
class: u(["flex h-full shrink-0 items-center gap-1.5 text-base whitespace-nowrap text-muted select-none [&_svg]:size-4", s.stepButtons ? "pr-2" : "pr-3.5"]),
|
|
206
|
+
"aria-hidden": "true"
|
|
207
|
+
}, [ne(t.$slots, "suffix"), s.unit ? (f(), i("span", T, m(s.unit), 1)) : r("", !0)], 2)) : r("", !0),
|
|
208
|
+
s.stepButtons ? (f(), i("span", E, [(f(!0), i(e, null, te([{
|
|
209
|
+
dir: -1,
|
|
210
|
+
icon: h(v),
|
|
211
|
+
name: "Decrease",
|
|
212
|
+
off: U.value
|
|
213
|
+
}, {
|
|
214
|
+
dir: 1,
|
|
215
|
+
icon: h(y),
|
|
216
|
+
name: "Increase",
|
|
217
|
+
off: W.value
|
|
218
|
+
}], (e) => (f(), i("button", {
|
|
219
|
+
key: e.dir,
|
|
220
|
+
type: "button",
|
|
221
|
+
tabindex: "-1",
|
|
222
|
+
class: u(["inline-flex shrink-0 cursor-pointer items-center justify-center rounded-8 bg-accent text-heading transition-colors duration-200 select-none hover:bg-accent-hover active:bg-accent-active disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-accent", s.size === "small" ? "size-7" : "size-8"]),
|
|
223
|
+
disabled: H.value || e.off,
|
|
224
|
+
"aria-label": e.name,
|
|
225
|
+
"aria-controls": h(j),
|
|
226
|
+
"data-testid": `ac-number-input-${e.name.toLowerCase()}`,
|
|
227
|
+
onMousedown: c[1] ||= se(() => {}, ["prevent"]),
|
|
228
|
+
onPointerdown: (t) => _e(t, e.dir),
|
|
229
|
+
onPointerup: $,
|
|
230
|
+
onPointerleave: $,
|
|
231
|
+
onPointercancel: $,
|
|
232
|
+
onClick: (t) => ve(t, e.dir)
|
|
233
|
+
}, [(f(), n(re(e.icon), {
|
|
234
|
+
class: "size-4",
|
|
235
|
+
"aria-hidden": "true"
|
|
236
|
+
}))], 42, ce))), 128))])) : r("", !0)
|
|
237
|
+
], 2),
|
|
238
|
+
G.value ? (f(), i("p", {
|
|
239
|
+
key: 2,
|
|
240
|
+
id: `${h(j)}-msg`,
|
|
241
|
+
class: "mt-1.5 flex items-center gap-1.5 text-base text-danger-strong",
|
|
242
|
+
role: "alert"
|
|
243
|
+
}, [o(h(_), {
|
|
244
|
+
class: "size-4 shrink-0",
|
|
245
|
+
"aria-hidden": "true"
|
|
246
|
+
}), ee(" " + m(G.value), 1)], 8, le)) : r("", !0)
|
|
247
|
+
], 16));
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
//#endregion
|
|
251
|
+
export { D as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export interface Props {
|
|
2
|
-
/** Pads the page on
|
|
2
|
+
/** Pads the page like cloud-ui's page container: 16px on the sides, 28px top and bottom (32px from 768px). Turn off when a parent already pads it. */
|
|
3
3
|
padded?: boolean;
|
|
4
4
|
/** Space between the page's direct children: `small` 12px, `normal` 20px, `large` 32px. */
|
|
5
5
|
gap?: "small" | "normal" | "large";
|
|
6
|
-
/** Caps the content width and centres it: `narrow` 768px, `normal` 1024px, `wide`
|
|
6
|
+
/** Caps the content width and centres it: `narrow` 768px, `normal` 1024px, `wide` 1200px (cloud-ui's page width), `full` fills the area. */
|
|
7
7
|
width?: "full" | "wide" | "normal" | "narrow";
|
|
8
8
|
}
|
|
9
9
|
type __VLS_Slots = {
|
|
@@ -17,7 +17,7 @@ var a = /*@__PURE__*/ t({
|
|
|
17
17
|
large: "gap-8"
|
|
18
18
|
}, o = {
|
|
19
19
|
full: "",
|
|
20
|
-
wide: "mx-auto max-w-
|
|
20
|
+
wide: "mx-auto max-w-page",
|
|
21
21
|
normal: "mx-auto max-w-5xl",
|
|
22
22
|
narrow: "mx-auto max-w-3xl"
|
|
23
23
|
};
|
|
@@ -25,7 +25,7 @@ var a = /*@__PURE__*/ t({
|
|
|
25
25
|
class: n(["flex w-full min-w-0 flex-col", [
|
|
26
26
|
a[t.gap],
|
|
27
27
|
o[t.width],
|
|
28
|
-
t.padded && "
|
|
28
|
+
t.padded && "px-4 py-7 md:py-8"
|
|
29
29
|
]]),
|
|
30
30
|
"data-ac-ds": "",
|
|
31
31
|
"data-testid": "ac-page"
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
export interface Props {
|
|
2
|
-
/** Total number of items across all pages. */
|
|
3
|
-
total
|
|
2
|
+
/** Total number of items across all pages. Leave it out when the API returns only a next-page token: the summary becomes "Page 3" (or "Showing 41–60" with `items-on-page`) and Next follows `has-next`. */
|
|
3
|
+
total?: number;
|
|
4
|
+
/** Whether a page after the current one exists, e.g. the response had a next-page token. Overrides the count worked out from `total`. */
|
|
5
|
+
hasNext?: boolean;
|
|
6
|
+
/** Whether a page before the current one exists. Defaults to any page after 1. */
|
|
7
|
+
hasPrev?: boolean;
|
|
8
|
+
/** Pages the viewer can jump to, e.g. those whose tokens you've cached. Other page numbers are disabled, and a page-size change goes back to page 1. Leave it out when every page is reachable. */
|
|
9
|
+
knownPages?: number[];
|
|
10
|
+
/** Rows on the current page, for "Showing 41–60" when `total` is unknown. Cloud-ui's `pagination.count`. */
|
|
11
|
+
itemsOnPage?: number;
|
|
4
12
|
/** Choices in the page-size select. */
|
|
5
13
|
pageSizes?: number[];
|
|
6
14
|
/** Hides the "Rows per page" select. */
|
|
@@ -13,7 +21,7 @@ export interface Props {
|
|
|
13
21
|
itemLabel?: string;
|
|
14
22
|
/** Disables every control, e.g. while a page loads. */
|
|
15
23
|
disabled?: boolean;
|
|
16
|
-
/** `small` makes the
|
|
24
|
+
/** `small` makes the buttons 28px high (default `normal` is 32px). Use it inside cards and dense tables. */
|
|
17
25
|
size?: "normal" | "small";
|
|
18
26
|
}
|
|
19
27
|
type __VLS_Props = Props;
|
|
@@ -25,23 +33,32 @@ type __VLS_ModelProps = {
|
|
|
25
33
|
};
|
|
26
34
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
27
35
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
next: (page: number) => any;
|
|
28
37
|
range: (range: {
|
|
29
38
|
start: number;
|
|
30
39
|
end: number;
|
|
31
40
|
}) => any;
|
|
41
|
+
prev: (page: number) => any;
|
|
32
42
|
"update:page": (value: number) => any;
|
|
33
43
|
"update:pageSize": (value: number) => any;
|
|
34
44
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
45
|
+
onNext?: ((page: number) => any) | undefined;
|
|
35
46
|
onRange?: ((range: {
|
|
36
47
|
start: number;
|
|
37
48
|
end: number;
|
|
38
49
|
}) => any) | undefined;
|
|
50
|
+
onPrev?: ((page: number) => any) | undefined;
|
|
39
51
|
"onUpdate:page"?: ((value: number) => any) | undefined;
|
|
40
52
|
"onUpdate:pageSize"?: ((value: number) => any) | undefined;
|
|
41
53
|
}>, {
|
|
42
54
|
disabled: boolean;
|
|
43
55
|
size: "normal" | "small";
|
|
44
56
|
compact: boolean;
|
|
57
|
+
total: number;
|
|
58
|
+
hasNext: boolean;
|
|
59
|
+
hasPrev: boolean;
|
|
60
|
+
knownPages: number[];
|
|
61
|
+
itemsOnPage: number;
|
|
45
62
|
pageSizes: number[];
|
|
46
63
|
hidePageSize: boolean;
|
|
47
64
|
siblings: number;
|
|
@@ -3,27 +3,37 @@ import { Fragment as t, computed as n, createCommentVNode as r, createElementBlo
|
|
|
3
3
|
import { ChevronLeft as _, ChevronRight as v } from "@lucide/vue";
|
|
4
4
|
//#region src/lib/components/AcPagination.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var y = {
|
|
6
|
-
class: "flex flex-wrap items-center justify-between gap-x-6 gap-y-3 text-base",
|
|
6
|
+
class: "flex flex-wrap items-center justify-between gap-x-6 gap-y-3 text-base text-muted",
|
|
7
7
|
"data-ac-ds": "",
|
|
8
8
|
"data-testid": "ac-pagination"
|
|
9
|
-
}, b = { class: "flex min-w-0 flex-wrap items-center gap-x-
|
|
9
|
+
}, b = { class: "flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2" }, x = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "flex items-center gap-2"
|
|
12
12
|
}, S = { class: "w-18" }, C = {
|
|
13
|
-
class: "
|
|
13
|
+
class: "whitespace-nowrap tabular-nums",
|
|
14
14
|
"aria-live": "polite"
|
|
15
15
|
}, w = {
|
|
16
16
|
"aria-label": "Pagination",
|
|
17
17
|
class: "ml-auto"
|
|
18
|
-
}, T = { class: "flex items-center gap-1" }, E = ["disabled"], D = { class: "px-2
|
|
18
|
+
}, T = { class: "flex items-center gap-1.5" }, E = ["disabled"], D = { class: "px-2 whitespace-nowrap tabular-nums" }, O = { class: "font-medium text-heading" }, k = { class: "font-medium text-heading" }, A = [
|
|
19
19
|
"aria-label",
|
|
20
20
|
"aria-current",
|
|
21
21
|
"disabled",
|
|
22
22
|
"onClick"
|
|
23
|
-
],
|
|
23
|
+
], j = ["disabled"], M = /*@__PURE__*/ c({
|
|
24
24
|
__name: "AcPagination",
|
|
25
25
|
props: /*@__PURE__*/ l({
|
|
26
|
-
total: {},
|
|
26
|
+
total: { default: void 0 },
|
|
27
|
+
hasNext: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: void 0
|
|
30
|
+
},
|
|
31
|
+
hasPrev: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: void 0
|
|
34
|
+
},
|
|
35
|
+
knownPages: { default: void 0 },
|
|
36
|
+
itemsOnPage: { default: void 0 },
|
|
27
37
|
pageSizes: { default: () => [
|
|
28
38
|
10,
|
|
29
39
|
20,
|
|
@@ -51,19 +61,29 @@ var y = {
|
|
|
51
61
|
pageSize: { default: 10 },
|
|
52
62
|
pageSizeModifiers: {}
|
|
53
63
|
}),
|
|
54
|
-
emits: /*@__PURE__*/ l([
|
|
64
|
+
emits: /*@__PURE__*/ l([
|
|
65
|
+
"range",
|
|
66
|
+
"next",
|
|
67
|
+
"prev"
|
|
68
|
+
], ["update:page", "update:pageSize"]),
|
|
55
69
|
setup(c, { emit: l }) {
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
let M = c, N = h(c, "page"), P = h(c, "pageSize"), F = l, I = n(() => [M.size === "small" ? "h-7 min-w-7 px-1.5 text-xs" : "h-8 min-w-8 px-2 text-base", !M.compact && (M.size === "small" ? "sm:px-2" : "sm:px-2.5")]), L = n(() => M.size === "small" ? "h-7 min-w-7 text-xs" : "h-8 min-w-8 text-base"), R = n(() => typeof M.total == "number"), z = n(() => Math.max(0, M.total ?? 0)), B = n(() => Math.max(1, P.value)), V = n(() => !R.value || M.knownPages !== void 0), H = n(() => R.value ? Math.max(1, Math.ceil(z.value / B.value)) : Math.max(1, N.value, ...M.knownPages ?? [])), U = n(() => Math.min(Math.max(1, N.value), H.value)), W = n(() => M.hasPrev ?? U.value > 1), G = n(() => M.hasNext ?? U.value < H.value), K = n(() => {
|
|
71
|
+
let e = (U.value - 1) * B.value;
|
|
72
|
+
return R.value ? {
|
|
73
|
+
start: Math.min(e, z.value),
|
|
74
|
+
end: Math.min(U.value * B.value, z.value)
|
|
75
|
+
} : {
|
|
76
|
+
start: e,
|
|
77
|
+
end: e + Math.max(0, M.itemsOnPage ?? B.value)
|
|
78
|
+
};
|
|
79
|
+
}), q = n(() => {
|
|
80
|
+
let e = M.itemLabel ? ` ${M.itemLabel}` : "";
|
|
81
|
+
return R.value ? z.value ? `Showing ${K.value.start + 1}–${K.value.end} of ${z.value}${e}` : `0${e || " items"}` : M.itemsOnPage === void 0 ? `Page ${U.value}` : M.itemsOnPage ? `Showing ${K.value.start + 1}–${K.value.end}${e}` : U.value === 1 ? `0${e || " items"}` : `Page ${U.value}`;
|
|
82
|
+
}), J = n(() => (M.pageSizes.includes(P.value) ? M.pageSizes : [...M.pageSizes, P.value].sort((e, t) => e - t)).map((e) => ({
|
|
63
83
|
value: e,
|
|
64
84
|
label: String(e)
|
|
65
|
-
}))),
|
|
66
|
-
let e =
|
|
85
|
+
}))), Y = n(() => {
|
|
86
|
+
let e = H.value, t = U.value, n = Math.max(0, M.siblings);
|
|
67
87
|
if (e <= 5 + 2 * n) return Array.from({ length: e }, (e, t) => t + 1);
|
|
68
88
|
let r = Math.max(t - n, 1), i = Math.min(t + n, e), a = r > 3, o = i < e - 2, s = (e, t) => Array.from({ length: t - e + 1 }, (t, n) => e + n);
|
|
69
89
|
return a ? o ? [
|
|
@@ -82,79 +102,87 @@ var y = {
|
|
|
82
102
|
e
|
|
83
103
|
];
|
|
84
104
|
});
|
|
85
|
-
function
|
|
86
|
-
|
|
105
|
+
function X(e) {
|
|
106
|
+
return e === U.value || !M.knownPages || M.knownPages.includes(e);
|
|
107
|
+
}
|
|
108
|
+
function Z(e) {
|
|
109
|
+
if (M.disabled) return;
|
|
110
|
+
let t = R.value ? H.value : Infinity;
|
|
111
|
+
N.value = Math.min(Math.max(1, e), t);
|
|
112
|
+
}
|
|
113
|
+
function Q(e) {
|
|
114
|
+
!M.disabled && (e > 0 ? G.value : W.value) && (Z(U.value + e), F(e > 0 ? "next" : "prev", N.value));
|
|
87
115
|
}
|
|
88
|
-
function
|
|
116
|
+
function $(e) {
|
|
89
117
|
let t = Number(e);
|
|
90
|
-
if (!t || t ===
|
|
91
|
-
let n =
|
|
92
|
-
|
|
118
|
+
if (!t || t === P.value) return;
|
|
119
|
+
let n = K.value.start;
|
|
120
|
+
P.value = t, N.value = V.value ? 1 : Math.floor(n / t) + 1;
|
|
93
121
|
}
|
|
94
|
-
return g(
|
|
95
|
-
|
|
96
|
-
}), g(
|
|
97
|
-
class: "
|
|
122
|
+
return g(H, (e) => {
|
|
123
|
+
R.value && N.value > e && (N.value = e);
|
|
124
|
+
}), g(K, (e) => F("range", { ...e }), { immediate: !0 }), (n, l) => (d(), i("div", y, [a("div", b, [c.hidePageSize ? r("", !0) : (d(), i("div", x, [l[2] ||= a("span", {
|
|
125
|
+
class: "whitespace-nowrap",
|
|
98
126
|
"aria-hidden": "true"
|
|
99
127
|
}, "Rows per page", -1), a("div", S, [s(e, {
|
|
100
|
-
"model-value":
|
|
101
|
-
options:
|
|
128
|
+
"model-value": P.value,
|
|
129
|
+
options: J.value,
|
|
102
130
|
size: "compact",
|
|
103
131
|
placeholder: "Rows per page",
|
|
104
132
|
disabled: c.disabled,
|
|
105
|
-
"onUpdate:modelValue":
|
|
133
|
+
"onUpdate:modelValue": $
|
|
106
134
|
}, null, 8, [
|
|
107
135
|
"model-value",
|
|
108
136
|
"options",
|
|
109
137
|
"disabled"
|
|
110
|
-
])])])), a("p", C, p(
|
|
138
|
+
])])])), a("p", C, p(q.value), 1)]), a("nav", w, [a("ul", T, [
|
|
111
139
|
a("li", null, [a("button", {
|
|
112
140
|
type: "button",
|
|
113
|
-
class: u(["inline-flex cursor-pointer items-center justify-center rounded-
|
|
141
|
+
class: u(["inline-flex cursor-pointer items-center justify-center gap-1 rounded-10 border border-border bg-background font-medium text-heading transition-colors duration-200 hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-background", I.value]),
|
|
114
142
|
"aria-label": "Previous page",
|
|
115
|
-
disabled: c.disabled ||
|
|
143
|
+
disabled: c.disabled || !W.value,
|
|
116
144
|
"data-ac-ds": "",
|
|
117
145
|
"data-testid": "ac-pagination-prev",
|
|
118
|
-
onClick: l[0] ||= (e) =>
|
|
146
|
+
onClick: l[0] ||= (e) => Q(-1)
|
|
119
147
|
}, [s(m(_), {
|
|
120
|
-
class: "size-4",
|
|
148
|
+
class: "size-4 shrink-0",
|
|
121
149
|
"aria-hidden": "true"
|
|
122
|
-
})], 10, E)]),
|
|
123
|
-
a("li", { class: u(c.compact ? "flex" : "flex sm:hidden") }, [a("span", D, [
|
|
150
|
+
}), a("span", { class: u(c.compact ? "hidden" : "hidden sm:inline") }, "Previous", 2)], 10, E)]),
|
|
151
|
+
a("li", { class: u(c.compact ? "flex" : "flex sm:hidden") }, [a("span", D, [R.value ? (d(), i(t, { key: 0 }, [
|
|
124
152
|
l[3] ||= a("span", { class: "sr-only" }, "Page ", -1),
|
|
125
|
-
a("span", O, p(
|
|
126
|
-
o(" / " + p(
|
|
127
|
-
])], 2),
|
|
128
|
-
c.compact ? r("", !0) : (d(!0), i(t, { key: 0 }, f(
|
|
153
|
+
a("span", O, p(U.value), 1),
|
|
154
|
+
o(" / " + p(H.value), 1)
|
|
155
|
+
], 64)) : (d(), i(t, { key: 1 }, [l[4] ||= o("Page ", -1), a("span", k, p(U.value), 1)], 64))])], 2),
|
|
156
|
+
c.compact ? r("", !0) : (d(!0), i(t, { key: 0 }, f(Y.value, (e) => (d(), i("li", {
|
|
129
157
|
key: e,
|
|
130
158
|
class: "hidden sm:flex"
|
|
131
159
|
}, [typeof e == "string" ? (d(), i("span", {
|
|
132
160
|
key: 0,
|
|
133
|
-
class: u(["inline-flex w-
|
|
161
|
+
class: u(["inline-flex w-5 items-center justify-center text-muted", c.size === "small" ? "h-7" : "h-8"]),
|
|
134
162
|
"aria-hidden": "true"
|
|
135
163
|
}, "…", 2)) : (d(), i("button", {
|
|
136
164
|
key: 1,
|
|
137
165
|
type: "button",
|
|
138
|
-
class: u(["inline-flex cursor-pointer items-center justify-center rounded-
|
|
166
|
+
class: u(["inline-flex cursor-pointer items-center justify-center rounded-10 border px-2 font-medium tabular-nums transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40", [L.value, e === U.value ? "border-primary bg-primary text-white" : "border-border bg-background text-heading hover:bg-accent-hover disabled:hover:bg-background"]]),
|
|
139
167
|
"aria-label": `Page ${e}`,
|
|
140
|
-
"aria-current": e ===
|
|
141
|
-
disabled: c.disabled,
|
|
142
|
-
onClick: (t) =>
|
|
143
|
-
}, p(e), 11,
|
|
168
|
+
"aria-current": e === U.value ? "page" : void 0,
|
|
169
|
+
disabled: c.disabled || !X(e),
|
|
170
|
+
onClick: (t) => Z(e)
|
|
171
|
+
}, p(e), 11, A))]))), 128)),
|
|
144
172
|
a("li", null, [a("button", {
|
|
145
173
|
type: "button",
|
|
146
|
-
class: u(["inline-flex cursor-pointer items-center justify-center rounded-
|
|
174
|
+
class: u(["inline-flex cursor-pointer items-center justify-center gap-1 rounded-10 border border-border bg-background font-medium text-heading transition-colors duration-200 hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-background", I.value]),
|
|
147
175
|
"aria-label": "Next page",
|
|
148
|
-
disabled: c.disabled ||
|
|
176
|
+
disabled: c.disabled || !G.value,
|
|
149
177
|
"data-ac-ds": "",
|
|
150
178
|
"data-testid": "ac-pagination-next",
|
|
151
|
-
onClick: l[1] ||= (e) =>
|
|
152
|
-
}, [s(m(v), {
|
|
153
|
-
class: "size-4",
|
|
179
|
+
onClick: l[1] ||= (e) => Q(1)
|
|
180
|
+
}, [a("span", { class: u(c.compact ? "hidden" : "hidden sm:inline") }, "Next", 2), s(m(v), {
|
|
181
|
+
class: "size-4 shrink-0",
|
|
154
182
|
"aria-hidden": "true"
|
|
155
|
-
})], 10,
|
|
183
|
+
})], 10, j)])
|
|
156
184
|
])])]));
|
|
157
185
|
}
|
|
158
186
|
});
|
|
159
187
|
//#endregion
|
|
160
|
-
export {
|
|
188
|
+
export { M as default };
|
|
@@ -3,7 +3,7 @@ export interface Props {
|
|
|
3
3
|
message?: string;
|
|
4
4
|
/** Shows the spinner. Turn off to show the message alone. */
|
|
5
5
|
showSpinner?: boolean;
|
|
6
|
-
/** Covers the whole viewport on a
|
|
6
|
+
/** Covers the whole viewport on the page background with a 32px spinner, for app start-up and sign-in checks. */
|
|
7
7
|
fullPage?: boolean;
|
|
8
8
|
/** CSS minimum height when not `fullPage`. The preloader also grows to fill its container. */
|
|
9
9
|
minHeight?: string;
|