@leaflink/stash 51.11.0 → 51.12.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 +41 -12
- package/dist/Accordion.js.map +1 -1
- package/dist/Accordion.vue.d.ts +37 -6
- package/dist/ActionsDropdown.js +2 -2
- package/dist/ActionsDropdown.js.map +1 -1
- package/dist/ActionsDropdown.vue.d.ts +74 -0
- package/dist/AddressSelect.js +60 -56
- package/dist/AddressSelect.js.map +1 -1
- package/dist/AddressSelect.vue.d.ts +65 -8
- package/dist/Alert.js.map +1 -1
- package/dist/Alert.vue.d.ts +41 -4
- package/dist/AppNavigationItem.js.map +1 -1
- package/dist/AppNavigationItem.vue.d.ts +31 -4
- package/dist/AppSidebar.js.map +1 -1
- package/dist/AppSidebar.vue.d.ts +35 -8
- package/dist/AppTopbar.js +1 -1
- package/dist/AppTopbar.js.map +1 -1
- package/dist/AppTopbar.vue.d.ts +33 -4
- package/dist/Avatar.js.map +1 -1
- package/dist/Avatar.vue.d.ts +44 -5
- package/dist/Backdrop.js.map +1 -1
- package/dist/Backdrop.vue.d.ts +1 -1
- package/dist/Badge.js.map +1 -1
- package/dist/Badge.vue.d.ts +55 -6
- package/dist/Box.vue.d.ts +36 -3
- package/dist/Box.vue_vue_type_script_setup_true_lang-rFnvwLVY.js.map +1 -1
- package/dist/Button.js.map +1 -1
- package/dist/Button.vue.d.ts +50 -5
- package/dist/ButtonGroup.js +37 -33
- package/dist/ButtonGroup.js.map +1 -1
- package/dist/ButtonGroup.vue.d.ts +39 -6
- package/dist/Card.js.map +1 -1
- package/dist/Card.vue.d.ts +32 -5
- package/dist/CardContent.js.map +1 -1
- package/dist/CardContent.vue.d.ts +1 -1
- package/dist/CardFooter.js.map +1 -1
- package/dist/CardFooter.vue.d.ts +1 -1
- package/dist/CardHeader.js.map +1 -1
- package/dist/CardHeader.vue.d.ts +15 -2
- package/dist/CardMedia.js.map +1 -1
- package/dist/CardMedia.vue.d.ts +15 -2
- package/dist/Carousel.js +72 -66
- package/dist/Carousel.js.map +1 -1
- package/dist/Carousel.vue.d.ts +10 -10
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.vue.d.ts +53 -8
- package/dist/ChevronToggle.vue.d.ts +34 -7
- package/dist/ChevronToggle.vue_vue_type_script_setup_true_lang-Ce_qOXfR.js.map +1 -1
- package/dist/Chip.js.map +1 -1
- package/dist/Chip.vue.d.ts +52 -10
- package/dist/ConfirmationCodeInput.js +44 -40
- package/dist/ConfirmationCodeInput.js.map +1 -1
- package/dist/ConfirmationCodeInput.vue.d.ts +43 -8
- package/dist/ContextSwitcher.js.map +1 -1
- package/dist/ContextSwitcher.vue.d.ts +41 -6
- package/dist/Copy.js.map +1 -1
- package/dist/Copy.vue.d.ts +34 -3
- package/dist/CurrencyInput.js +21 -20
- package/dist/CurrencyInput.js.map +1 -1
- package/dist/CurrencyInput.vue.d.ts +46 -125
- package/dist/DataView.js +96 -94
- package/dist/DataView.js.map +1 -1
- package/dist/DataView.vue.d.ts +57 -12
- package/dist/DataViewFilters.js +139 -127
- package/dist/DataViewFilters.js.map +1 -1
- package/dist/DataViewFilters.vue.d.ts +54 -9
- package/dist/DataViewSortButton.js +2 -2
- package/dist/DataViewSortButton.js.map +1 -1
- package/dist/DataViewSortButton.vue.d.ts +30 -3
- package/dist/DataViewToolbar.js +81 -148
- package/dist/DataViewToolbar.js.map +1 -1
- package/dist/DataViewToolbar.vue.d.ts +40 -106
- package/dist/DatePicker.js +4640 -4528
- package/dist/DatePicker.js.map +1 -1
- package/dist/DatePicker.vue.d.ts +79 -30
- package/dist/DescriptionList.js.map +1 -1
- package/dist/DescriptionList.vue.d.ts +32 -3
- package/dist/DescriptionListDetail.js.map +1 -1
- package/dist/DescriptionListDetail.vue.d.ts +1 -1
- package/dist/DescriptionListGroup.js.map +1 -1
- package/dist/DescriptionListGroup.vue.d.ts +1 -1
- package/dist/DescriptionListTerm.js.map +1 -1
- package/dist/DescriptionListTerm.vue.d.ts +1 -1
- package/dist/Dialog.js.map +1 -1
- package/dist/Dialog.vue.d.ts +53 -10
- package/dist/Divider.js.map +1 -1
- package/dist/Dropdown.js +95 -89
- package/dist/Dropdown.js.map +1 -1
- package/dist/Dropdown.vue.d.ts +48 -12
- package/dist/EmptyState.js +1 -1
- package/dist/EmptyState.js.map +1 -1
- package/dist/EmptyState.vue.d.ts +62 -5
- package/dist/Expand.vue.d.ts +40 -10
- package/dist/Expand.vue_vue_type_script_setup_true_lang-CiONJfAp.js.map +1 -1
- package/dist/Field.vue.d.ts +53 -4
- package/dist/Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js.map +1 -1
- package/dist/FileUpload.js +74 -72
- package/dist/FileUpload.js.map +1 -1
- package/dist/FileUpload.vue.d.ts +44 -10
- package/dist/FilterChip.js.map +1 -1
- package/dist/FilterChip.vue.d.ts +41 -6
- package/dist/FilterDrawerItem.js +21 -21
- package/dist/FilterDrawerItem.js.map +1 -1
- package/dist/FilterDrawerItem.vue.d.ts +23 -6
- package/dist/FilterDropdown.js +69 -63
- package/dist/FilterDropdown.js.map +1 -1
- package/dist/FilterDropdown.vue.d.ts +35 -122
- package/dist/FilterSelect.js.map +1 -1
- package/dist/FilterSelect.vue.d.ts +31 -4
- package/dist/Filters.js +164 -157
- package/dist/Filters.js.map +1 -1
- package/dist/Filters.vue.d.ts +2190 -0
- package/dist/HttpError.js +7 -7
- package/dist/HttpError.js.map +1 -1
- package/dist/HttpError.vue.d.ts +41 -4
- package/dist/Icon.js +17 -17
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.vue.d.ts +36 -3
- package/dist/IconLabel.js.map +1 -1
- package/dist/IconLabel.vue.d.ts +40 -5
- package/dist/Illustration.js +2 -2
- package/dist/Illustration.vue.d.ts +42 -3
- package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BVzzNsRt.js → Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js} +11 -11
- package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BVzzNsRt.js.map → Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js.map} +1 -1
- package/dist/Image.js +2 -2
- package/dist/Image.vue.d.ts +40 -5
- package/dist/{Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js → Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js} +41 -37
- package/dist/{Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js.map → Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js.map} +1 -1
- package/dist/InlineEdit.js.map +1 -1
- package/dist/InlineEdit.vue.d.ts +47 -126
- package/dist/Input.js.map +1 -1
- package/dist/Input.vue.d.ts +45 -12
- package/dist/InputOptions.js +69 -66
- package/dist/InputOptions.js.map +1 -1
- package/dist/InputOptions.vue.d.ts +55 -10
- package/dist/IntegrationIcon.js +7 -7
- package/dist/IntegrationIcon.js.map +1 -1
- package/dist/IntegrationIcon.vue.d.ts +36 -3
- package/dist/Label.vue.d.ts +42 -3
- package/dist/Label.vue_vue_type_script_setup_true_lang-CNquF3AP.js.map +1 -1
- package/dist/LicenseChip.js.map +1 -1
- package/dist/LicenseChip.vue.d.ts +30 -3
- package/dist/ListItem.js.map +1 -1
- package/dist/ListItem.vue.d.ts +294 -0
- package/dist/ListItemCell.js.map +1 -1
- package/dist/ListItemCell.vue.d.ts +21 -0
- package/dist/ListView.js +7 -4
- package/dist/ListView.js.map +1 -1
- package/dist/ListView.types.d.ts +29 -0
- package/dist/ListView.vue.d.ts +5496 -0
- package/dist/Loading.js +2 -2
- package/dist/Loading.js.map +1 -1
- package/dist/Loading.vue.d.ts +1 -1
- package/dist/Logo.js +1 -1
- package/dist/Logo.vue.d.ts +41 -6
- package/dist/{Logo.vue_vue_type_script_setup_true_lang-Y3iE9utm.js → Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js} +17 -17
- package/dist/Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js.map +1 -0
- package/dist/Menu.js.map +1 -1
- package/dist/Menu.vue.d.ts +1 -1
- package/dist/MenuItem.js.map +1 -1
- package/dist/MenuItem.vue.d.ts +1 -1
- package/dist/MenusPlugin-Bk6UW6o9.js +12 -0
- package/dist/{MenusPlugin-B4jpNe7x.js.map → MenusPlugin-Bk6UW6o9.js.map} +1 -1
- package/dist/Metric.js.map +1 -1
- package/dist/Metric.vue.d.ts +34 -3
- package/dist/Modal.js +64 -62
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.vue.d.ts +60 -13
- package/dist/Modals.js +18 -17
- package/dist/Modals.js.map +1 -1
- package/dist/ModalsPlugin.js +11 -11
- package/dist/ModalsPlugin.js.map +1 -1
- package/dist/Module.js.map +1 -1
- package/dist/Module.vue.d.ts +29 -2
- package/dist/ModuleContent.js.map +1 -1
- package/dist/ModuleContent.vue.d.ts +3 -3
- package/dist/ModuleFooter.js.map +1 -1
- package/dist/ModuleFooter.vue.d.ts +1 -1
- package/dist/ModuleHeader.js.map +1 -1
- package/dist/ModuleHeader.vue.d.ts +39 -5
- package/dist/MoreActions.js +125 -123
- package/dist/MoreActions.js.map +1 -1
- package/dist/MoreActions.vue.d.ts +46 -123
- package/dist/ObfuscateText.js.map +1 -1
- package/dist/ObfuscateText.vue.d.ts +40 -3
- package/dist/PageContent.js.map +1 -1
- package/dist/PageContent.vue.d.ts +30 -3
- package/dist/PageHeader.js.map +1 -1
- package/dist/PageHeader.vue.d.ts +35 -6
- package/dist/PageNavigation.js +50 -50
- package/dist/PageNavigation.js.map +1 -1
- package/dist/PageNavigation.vue.d.ts +36 -7
- package/dist/Paginate.js.map +1 -1
- package/dist/Paginate.vue.d.ts +40 -5
- package/dist/PlaidLink.js.map +1 -1
- package/dist/PlaidLink.vue.d.ts +49 -12
- package/dist/QuickAction.js.map +1 -1
- package/dist/QuickAction.vue.d.ts +15 -2
- package/dist/Radio.js.map +1 -1
- package/dist/Radio.vue.d.ts +93 -0
- package/dist/RadioGroup.js +101 -94
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.vue.d.ts +42 -116
- package/dist/RadioNew.js +99 -96
- package/dist/RadioNew.js.map +1 -1
- package/dist/RadioNew.vue.d.ts +48 -7
- package/dist/RangeInput.js.map +1 -1
- package/dist/RangeInput.vue.d.ts +1 -1
- package/dist/SearchBar.js +39 -38
- package/dist/SearchBar.js.map +1 -1
- package/dist/SearchBar.vue.d.ts +44 -127
- package/dist/SectionHeader.js.map +1 -1
- package/dist/SectionHeader.vue.d.ts +36 -5
- package/dist/Select.js +183 -171
- package/dist/Select.js.map +1 -1
- package/dist/Select.vue.d.ts +102 -23
- package/dist/SelectStatus.js +38 -38
- package/dist/SelectStatus.js.map +1 -1
- package/dist/SelectStatus.vue.d.ts +46 -226
- package/dist/Skeleton.js.map +1 -1
- package/dist/Skeleton.vue.d.ts +34 -3
- package/dist/Step.js +44 -44
- package/dist/Step.js.map +1 -1
- package/dist/Step.vue.d.ts +43 -4
- package/dist/Stepper.js.map +1 -1
- package/dist/Stepper.vue.d.ts +44 -9
- package/dist/Switch.js.map +1 -1
- package/dist/Switch.vue.d.ts +47 -8
- package/dist/Tab.js +9 -9
- package/dist/Tab.js.map +1 -1
- package/dist/Tab.vue.d.ts +15 -2
- package/dist/TabPanel.js.map +1 -1
- package/dist/TabPanel.vue.d.ts +30 -3
- package/dist/Table.js +59 -53
- package/dist/Table.js.map +1 -1
- package/dist/Table.vue.d.ts +50 -3
- package/dist/TableCell.js +1 -1
- package/dist/TableCell.js.map +1 -1
- package/dist/TableCell.vue.d.ts +32 -3
- package/dist/TableHeaderCell.js +1 -1
- package/dist/TableHeaderCell.js.map +1 -1
- package/dist/TableHeaderCell.vue.d.ts +30 -3
- package/dist/TableHeaderRow.js +1 -1
- package/dist/TableHeaderRow.js.map +1 -1
- package/dist/TableHeaderRow.vue.d.ts +34 -5
- package/dist/TableRow.js +44 -43
- package/dist/TableRow.js.map +1 -1
- package/dist/TableRow.vue.d.ts +48 -7
- package/dist/Tabs.js +2 -2
- package/dist/Tabs.vue.d.ts +31 -4
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-CmnBP4i1.js +159 -0
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-CmnBP4i1.js.map +1 -0
- package/dist/TextEditor.js +2422 -2416
- package/dist/TextEditor.js.map +1 -1
- package/dist/TextEditor.vue.d.ts +39 -8
- package/dist/Textarea.js +32 -29
- package/dist/Textarea.js.map +1 -1
- package/dist/Textarea.vue.d.ts +44 -9
- package/dist/Thumbnail.js +1 -1
- package/dist/Thumbnail.js.map +1 -1
- package/dist/Thumbnail.vue.d.ts +4 -4
- package/dist/ThumbnailEmpty.js.map +1 -1
- package/dist/ThumbnailEmpty.vue.d.ts +1 -1
- package/dist/ThumbnailGroup.js.map +1 -1
- package/dist/ThumbnailGroup.vue.d.ts +22 -26
- package/dist/Timeline.js.map +1 -1
- package/dist/Timeline.vue.d.ts +32 -3
- package/dist/TimelineItem.js.map +1 -1
- package/dist/TimelineItem.vue.d.ts +1 -1
- package/dist/Toast.js.map +1 -1
- package/dist/Toast.vue.d.ts +30 -3
- package/dist/Toasts.js.map +1 -1
- package/dist/ToastsPlugin.js +11 -11
- package/dist/ToastsPlugin.js.map +1 -1
- package/dist/Tooltip.js +30 -29
- package/dist/Tooltip.js.map +1 -1
- package/dist/Tooltip.vue.d.ts +43 -11
- package/dist/components.css +1 -1
- package/dist/directives/observe.js +8 -8
- package/dist/directives/observe.js.map +1 -1
- package/dist/directives/tooltip.js +3 -3
- package/dist/directives/tooltip.js.map +1 -1
- package/dist/directives/viewable.js +44 -39
- package/dist/directives/viewable.js.map +1 -1
- package/dist/floating-ui.vue-DLFiymOf.js +1093 -0
- package/dist/floating-ui.vue-DLFiymOf.js.map +1 -0
- package/dist/formatDateTime-Dz8bXV0R.js +1418 -0
- package/dist/formatDateTime-Dz8bXV0R.js.map +1 -0
- package/dist/index-D6bxWkZ1.js.map +1 -1
- package/dist/{index-XZqpB2_R.js → index-DA_ft08e.js} +9 -9
- package/dist/index-DA_ft08e.js.map +1 -0
- package/dist/index.js +106 -101
- package/dist/index.js.map +1 -1
- package/dist/isValid-DN-HkCoi.js.map +1 -1
- package/dist/obfuscateText.d.ts +1 -1
- package/dist/parseISO-wlfIB_QJ.js.map +1 -1
- package/dist/searchFuzzy-B3TsUO-V.js +409 -0
- package/dist/searchFuzzy-B3TsUO-V.js.map +1 -0
- package/dist/toTimeZone-Coq1oPTt.js.map +1 -1
- package/dist/useDialog.d.ts +2 -2
- package/dist/useDialog.js +25 -21
- package/dist/useDialog.js.map +1 -1
- package/dist/useGoogleMaps.js +110 -108
- package/dist/useGoogleMaps.js.map +1 -1
- package/dist/useMediaQuery.d.ts +6 -0
- package/dist/useMediaQuery.js +15 -11
- package/dist/useMediaQuery.js.map +1 -1
- package/dist/useModals.d.ts +1 -1
- package/dist/usePlaidLink.js +27 -20
- package/dist/usePlaidLink.js.map +1 -1
- package/dist/useSearch.js +13 -13
- package/dist/useSearch.js.map +1 -1
- package/dist/useSelection.js +56 -56
- package/dist/useSelection.js.map +1 -1
- package/dist/useSortable.js +63 -54
- package/dist/useSortable.js.map +1 -1
- package/dist/useStepper.d.ts +2 -2
- package/dist/useStepper.js +40 -36
- package/dist/useStepper.js.map +1 -1
- package/dist/useToasts.js +23 -23
- package/dist/useToasts.js.map +1 -1
- package/dist/useValidation.js +100 -96
- package/dist/useValidation.js.map +1 -1
- package/dist/utils/calculateElementOverflow.js +4 -4
- package/dist/utils/calculateElementOverflow.js.map +1 -1
- package/dist/utils/formatDateTime.js +1 -1
- package/dist/utils/obfuscateText.js +6 -6
- package/dist/utils/obfuscateText.js.map +1 -1
- package/dist/utils/searchFuzzy.js +1 -1
- package/dist/utils/storage.js +23 -23
- package/dist/utils/storage.js.map +1 -1
- package/package.json +32 -19
- package/dist/Logo.vue_vue_type_script_setup_true_lang-Y3iE9utm.js.map +0 -1
- package/dist/MenusPlugin-B4jpNe7x.js +0 -12
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-BlJVDr7o.js +0 -78
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-BlJVDr7o.js.map +0 -1
- package/dist/floating-ui.vue-CL01Y9ER.js +0 -1075
- package/dist/floating-ui.vue-CL01Y9ER.js.map +0 -1
- package/dist/formatDateTime-DG7kBc2T.js +0 -1414
- package/dist/formatDateTime-DG7kBc2T.js.map +0 -1
- package/dist/index-XZqpB2_R.js.map +0 -1
- package/dist/searchFuzzy-DBDE6jkd.js +0 -408
- package/dist/searchFuzzy-DBDE6jkd.js.map +0 -1
package/dist/DataView.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { defineComponent as R, useCssModule as U, ref as l, inject as J, computed as
|
|
1
|
+
import { defineComponent as R, useCssModule as U, ref as l, inject as J, computed as n, watch as y, provide as W, createElementBlock as G, openBlock as V, renderSlot as Z, createBlock as q, createCommentVNode as H, normalizeClass as K, unref as Q } from "vue";
|
|
2
2
|
import X from "lodash-es/cloneDeep";
|
|
3
|
-
import { M as
|
|
3
|
+
import { M as I } from "./Module.keys-CEsrW2f0.js";
|
|
4
4
|
import Y from "./Paginate.js";
|
|
5
5
|
import { a as w, D as O } from "./DataView.keys-aSOnA4AD.js";
|
|
6
6
|
import { _ as tt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
|
-
function
|
|
8
|
-
const o =
|
|
9
|
-
return { id: o === "asc" ?
|
|
7
|
+
function z(a) {
|
|
8
|
+
const o = a[0] === "-" ? "desc" : "asc";
|
|
9
|
+
return { id: o === "asc" ? a : a.slice(1), order: o };
|
|
10
10
|
}
|
|
11
|
-
function et({ id:
|
|
12
|
-
return `${o === "desc" ? "-" : ""}${
|
|
11
|
+
function et({ id: a, order: o }) {
|
|
12
|
+
return `${o === "desc" ? "-" : ""}${a}`;
|
|
13
13
|
}
|
|
14
|
-
function at({ newId:
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
17
|
-
return et({ id:
|
|
14
|
+
function at({ newId: a, newOrder: o, oldId: f, oldOrder: t }) {
|
|
15
|
+
if (a) {
|
|
16
|
+
if (a !== f)
|
|
17
|
+
return et({ id: a, order: o || "asc" });
|
|
18
18
|
if (!o && !t)
|
|
19
|
-
return
|
|
19
|
+
return a;
|
|
20
20
|
if (!(!o && t === "desc")) {
|
|
21
21
|
if (!o && t === "asc")
|
|
22
|
-
return `-${
|
|
22
|
+
return `-${a}`;
|
|
23
23
|
if (o === "asc" && !t)
|
|
24
|
-
return
|
|
24
|
+
return a;
|
|
25
25
|
if (!(o === "asc" && t === "asc")) {
|
|
26
26
|
if (o === "asc" && t === "desc")
|
|
27
|
-
return
|
|
27
|
+
return a;
|
|
28
28
|
if (o === "desc" && !t)
|
|
29
|
-
return `-${
|
|
29
|
+
return `-${a}`;
|
|
30
30
|
if (!(o === "desc" && t === "desc") && o === "desc" && t === "asc")
|
|
31
|
-
return `-${
|
|
31
|
+
return `-${a}`;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
var nt = /* @__PURE__ */ ((
|
|
36
|
+
var nt = /* @__PURE__ */ ((a) => (a.Table = "table", a))(nt || {});
|
|
37
37
|
const ot = /* @__PURE__ */ R({
|
|
38
38
|
__name: "DataView",
|
|
39
39
|
props: {
|
|
@@ -51,134 +51,136 @@ const ot = /* @__PURE__ */ R({
|
|
|
51
51
|
isLoading: { type: Boolean }
|
|
52
52
|
},
|
|
53
53
|
emits: ["update", "update:currentFilters", "update:currentPage", "update:currentSearch", "update:currentSort"],
|
|
54
|
-
setup(
|
|
55
|
-
const t =
|
|
54
|
+
setup(a, { expose: o, emit: f }) {
|
|
55
|
+
const t = a, d = f, $ = U(), P = l(null), _ = J(I.key, I.defaults), L = n(() => {
|
|
56
|
+
var e;
|
|
56
57
|
if (t.variant)
|
|
57
58
|
return t.variant;
|
|
58
|
-
if (
|
|
59
|
+
if (((e = _.variant) == null ? void 0 : e.value) === "table")
|
|
59
60
|
return "table";
|
|
60
|
-
}),
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
}), E = n(() => _.variant !== void 0), u = l(1), N = n(() => !t.disablePagination && t.totalDataCount > 0), x = n(() => t.totalDataCount === 1 / 0 && !t.hasNextPage), p = n(() => Math.ceil(t.totalDataCount / t.pageSize)), i = function(e, { shouldEmit: r } = {}) {
|
|
62
|
+
var c, h;
|
|
63
|
+
u.value = e, r && (S(), d("update:currentPage", e, t.pageSize)), Number((c = P.value) == null ? void 0 : c.getBoundingClientRect().top) < 0 && ((h = P.value) == null || h.scrollIntoView({ behavior: "smooth", block: "start" }));
|
|
64
|
+
}, C = function({ shouldEmit: e } = {}) {
|
|
63
65
|
const r = Math.max(u.value - 1, 1);
|
|
64
|
-
i(r, { shouldEmit:
|
|
65
|
-
},
|
|
66
|
-
const r = Math.min(u.value + 1,
|
|
67
|
-
i(r, { shouldEmit:
|
|
66
|
+
i(r, { shouldEmit: e });
|
|
67
|
+
}, D = function({ shouldEmit: e } = {}) {
|
|
68
|
+
const r = Math.min(u.value + 1, p.value);
|
|
69
|
+
i(r, { shouldEmit: e });
|
|
68
70
|
};
|
|
69
|
-
|
|
71
|
+
y(
|
|
70
72
|
() => t.currentPage,
|
|
71
73
|
() => {
|
|
72
74
|
i(t.currentPage);
|
|
73
75
|
},
|
|
74
76
|
{ immediate: !0 }
|
|
75
77
|
);
|
|
76
|
-
const s = l(void 0),
|
|
77
|
-
() => s.value ?
|
|
78
|
-
),
|
|
79
|
-
() => s.value ?
|
|
80
|
-
),
|
|
81
|
-
const { id:
|
|
82
|
-
s.value =
|
|
78
|
+
const s = l(void 0), B = n(
|
|
79
|
+
() => s.value ? z(s.value).id : void 0
|
|
80
|
+
), M = n(
|
|
81
|
+
() => s.value ? z(s.value).order : void 0
|
|
82
|
+
), v = function(e, { sortOrder: r, shouldEmit: c } = {}) {
|
|
83
|
+
const { id: h, order: F } = z(s.value || ""), k = at({ newId: e, newOrder: r, oldId: h, oldOrder: F });
|
|
84
|
+
s.value = k, i(1), c && (S(), d("update:currentSort", k));
|
|
83
85
|
};
|
|
84
|
-
|
|
86
|
+
y(
|
|
85
87
|
() => t.currentSort,
|
|
86
88
|
() => {
|
|
87
|
-
|
|
89
|
+
v(t.currentSort);
|
|
88
90
|
},
|
|
89
91
|
{ immediate: !0 }
|
|
90
92
|
);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
+
const g = l(""), T = l(!1), j = l(!1), m = function(e, { shouldEmit: r } = {}) {
|
|
94
|
+
g.value = e || "", i(1), r && (S(), d("update:currentSearch", e));
|
|
93
95
|
};
|
|
94
|
-
|
|
96
|
+
y(
|
|
95
97
|
() => t.currentSearch,
|
|
96
98
|
() => {
|
|
97
|
-
|
|
99
|
+
m(t.currentSearch);
|
|
98
100
|
},
|
|
99
101
|
{ immediate: !0 }
|
|
100
102
|
);
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
+
const b = l({}), A = function(e, { shouldEmit: r } = {}) {
|
|
104
|
+
b.value = e, i(1), r && (S(), d("update:currentFilters", e));
|
|
103
105
|
};
|
|
104
|
-
function
|
|
105
|
-
|
|
106
|
+
function S() {
|
|
107
|
+
d("update", {
|
|
106
108
|
page: u.value,
|
|
107
109
|
pageSize: t.pageSize,
|
|
108
110
|
ordering: s.value,
|
|
109
|
-
search:
|
|
110
|
-
filters: X(
|
|
111
|
+
search: g.value,
|
|
112
|
+
filters: X(b.value)
|
|
111
113
|
});
|
|
112
114
|
}
|
|
113
115
|
return W(
|
|
114
116
|
O.key,
|
|
115
117
|
Object.freeze({
|
|
116
118
|
// Pagination
|
|
117
|
-
currentPage:
|
|
118
|
-
isPaginationEnabled:
|
|
119
|
-
isPaginateNextDisabled:
|
|
120
|
-
pageCount:
|
|
121
|
-
pageSize:
|
|
122
|
-
totalDataCount:
|
|
119
|
+
currentPage: n(() => u.value),
|
|
120
|
+
isPaginationEnabled: N,
|
|
121
|
+
isPaginateNextDisabled: x,
|
|
122
|
+
pageCount: p,
|
|
123
|
+
pageSize: n(() => t.pageSize),
|
|
124
|
+
totalDataCount: n(() => t.totalDataCount),
|
|
123
125
|
setPage: i,
|
|
124
|
-
goPrevPage:
|
|
125
|
-
goNextPage:
|
|
126
|
+
goPrevPage: C,
|
|
127
|
+
goNextPage: D,
|
|
126
128
|
// Sorting
|
|
127
|
-
currentSortId:
|
|
128
|
-
currentSortOrder:
|
|
129
|
-
updateCurrentSort:
|
|
129
|
+
currentSortId: B,
|
|
130
|
+
currentSortOrder: M,
|
|
131
|
+
updateCurrentSort: v,
|
|
130
132
|
// Search
|
|
131
|
-
currentSearch:
|
|
132
|
-
updateCurrentSearch:
|
|
133
|
+
currentSearch: n(() => g.value),
|
|
134
|
+
updateCurrentSearch: m,
|
|
133
135
|
// Miscellaneous
|
|
134
|
-
density:
|
|
135
|
-
hasToolbar:
|
|
136
|
-
isEmpty:
|
|
137
|
-
isSelectable:
|
|
138
|
-
isLoading:
|
|
139
|
-
isWithinModule:
|
|
140
|
-
variant:
|
|
136
|
+
density: n(() => t.density),
|
|
137
|
+
hasToolbar: T,
|
|
138
|
+
isEmpty: n(() => t.data.length === 0),
|
|
139
|
+
isSelectable: j,
|
|
140
|
+
isLoading: n(() => t.isLoading),
|
|
141
|
+
isWithinModule: E,
|
|
142
|
+
variant: L
|
|
141
143
|
})
|
|
142
144
|
), o({
|
|
143
|
-
page:
|
|
144
|
-
pageSize:
|
|
145
|
+
page: n(() => u.value),
|
|
146
|
+
pageSize: n(() => t.pageSize),
|
|
145
147
|
setPage: i,
|
|
146
|
-
goPrevPage:
|
|
147
|
-
goNextPage:
|
|
148
|
-
ordering:
|
|
149
|
-
updateCurrentSort:
|
|
150
|
-
search:
|
|
151
|
-
updateCurrentSearch:
|
|
152
|
-
filters:
|
|
153
|
-
updateCurrentFilters:
|
|
154
|
-
}), (
|
|
148
|
+
goPrevPage: C,
|
|
149
|
+
goNextPage: D,
|
|
150
|
+
ordering: n(() => s.value),
|
|
151
|
+
updateCurrentSort: v,
|
|
152
|
+
search: n(() => g.value),
|
|
153
|
+
updateCurrentSearch: m,
|
|
154
|
+
filters: n(() => b.value),
|
|
155
|
+
updateCurrentFilters: A
|
|
156
|
+
}), (e, r) => (V(), G("div", {
|
|
155
157
|
ref_key: "rootRef",
|
|
156
|
-
ref:
|
|
158
|
+
ref: P,
|
|
157
159
|
class: "stash-data-view tw-relative",
|
|
158
160
|
"data-test": "stash-data-view"
|
|
159
161
|
}, [
|
|
160
|
-
Z(
|
|
162
|
+
Z(e.$slots, "default", {
|
|
161
163
|
currentPage: u.value,
|
|
162
|
-
currentSortId:
|
|
163
|
-
currentSortOrder:
|
|
164
|
-
data:
|
|
165
|
-
goPrevPage:
|
|
166
|
-
goNextPage:
|
|
167
|
-
pageCount:
|
|
164
|
+
currentSortId: B.value,
|
|
165
|
+
currentSortOrder: M.value,
|
|
166
|
+
data: e.data,
|
|
167
|
+
goPrevPage: C,
|
|
168
|
+
goNextPage: D,
|
|
169
|
+
pageCount: p.value,
|
|
168
170
|
setPage: i,
|
|
169
171
|
totalDataCount: t.totalDataCount,
|
|
170
|
-
updateCurrentSort:
|
|
171
|
-
updateCurrentSearch:
|
|
172
|
+
updateCurrentSort: v,
|
|
173
|
+
updateCurrentSearch: m
|
|
172
174
|
}),
|
|
173
|
-
|
|
175
|
+
N.value && !E.value && p.value > 1 && !t.hideBottomPagination ? (V(), q(Y, {
|
|
174
176
|
key: 0,
|
|
175
|
-
class: K(["tw-mt-6", Q(
|
|
177
|
+
class: K(["tw-mt-6", Q($).paginate]),
|
|
176
178
|
"current-page": u.value,
|
|
177
|
-
"is-next-disabled":
|
|
179
|
+
"is-next-disabled": e.isLoading || x.value,
|
|
178
180
|
"list-length": t.totalDataCount,
|
|
179
181
|
"page-size": t.pageSize,
|
|
180
182
|
variant: t.totalDataCount === 1 / 0 ? "stats" : "standard",
|
|
181
|
-
onSetPage: r[0] || (r[0] = (
|
|
183
|
+
onSetPage: r[0] || (r[0] = (c) => i(c, { shouldEmit: !0 }))
|
|
182
184
|
}, null, 8, ["class", "current-page", "is-next-disabled", "list-length", "page-size", "variant"])) : H("", !0)
|
|
183
185
|
], 512));
|
|
184
186
|
}
|
|
@@ -192,7 +194,7 @@ export {
|
|
|
192
194
|
w as DEFAULT_PAGE_SIZE,
|
|
193
195
|
nt as DataViewVariant,
|
|
194
196
|
vt as default,
|
|
195
|
-
|
|
197
|
+
z as deserializeSortValue,
|
|
196
198
|
at as getNextSort,
|
|
197
199
|
et as serializeSortValue
|
|
198
200
|
};
|
package/dist/DataView.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataView.js","sources":["../src/components/DataView/DataView.utils.ts","../src/components/DataView/DataView.types.ts","../src/components/DataView/DataView.vue"],"sourcesContent":["import { SortId, SortOrder, SortValue, SortValueDeserialized } from './DataView.types';\n\n/**\n * Receives a SortValue (ex: `'-product_name'`) and returns an object with a `id` and an `order`.\n */\nexport function deserializeSortValue(sort: SortValue): SortValueDeserialized {\n const order = sort[0] === '-' ? 'desc' : 'asc';\n const id = order === 'asc' ? sort : sort.slice(1);\n\n return { id, order };\n}\n\n/**\n * Receives an object with a `id` and an `order` and returns a SortValue (ex: `'-product_name'`).\n */\nexport function serializeSortValue({ id, order }: SortValueDeserialized): SortValue {\n return `${order === 'desc' ? '-' : ''}${id}`;\n}\n\ninterface GetNextSortArgs {\n newId: SortId | undefined;\n newOrder?: SortOrder;\n oldId?: SortId;\n oldOrder?: SortOrder;\n}\n\n/**\n * Given new and old sorting data, it returns the next sorting value using the following sorting cycle:\n *\n * \"unsorted --> ascending --> descending --> unsorted\"\n */\nexport function getNextSort({ newId, newOrder, oldId, oldOrder }: GetNextSortArgs): SortValue | undefined {\n if (!newId) {\n return undefined;\n }\n\n if (newId !== oldId) {\n // if sorting by a new field, sort ascending\n return serializeSortValue({ id: newId, order: newOrder || 'asc' });\n }\n\n /**\n * `newOrder` and `oldOrder` can each have 3 different values: undefined, 'asc', or 'desc'.\n * Therefore, there are 9 possible combinations (3 times 3). See below:\n */\n\n // #region newOrder: undefined\n if (!newOrder && !oldOrder) {\n return newId; // ascending\n }\n\n if (!newOrder && oldOrder === 'desc') {\n return undefined; // unsorted\n }\n\n if (!newOrder && oldOrder === 'asc') {\n return `-${newId}`; // descending\n }\n // #endregion\n\n // #region newOrder: asc\n if (newOrder === 'asc' && !oldOrder) {\n return newId;\n }\n\n if (newOrder === 'asc' && oldOrder === 'asc') {\n return undefined;\n }\n\n if (newOrder === 'asc' && oldOrder === 'desc') {\n return newId;\n }\n // #endregion\n\n // #region newOrder: desc\n if (newOrder === 'desc' && !oldOrder) {\n return `-${newId}`;\n }\n\n if (newOrder === 'desc' && oldOrder === 'desc') {\n return undefined;\n }\n\n if (newOrder === 'desc' && oldOrder === 'asc') {\n return `-${newId}`;\n }\n // #endregion\n}\n","import { ComputedRef, Ref } from 'vue';\n\nimport { SpacingDensities } from '../../../types/misc';\n\nexport enum DataViewVariant {\n Table = 'table',\n}\n\nexport type DataViewVariants = `${DataViewVariant}`;\n\n/**\n * A unique id for a sorting strategy. If the order is descending, it must begin with \"-\" (a hyphen/dash).\n *\n * Ex: `'product_name'` if ascending or `'-product_name'` if descending\n */\nexport type SortValue = string;\n\n/**\n * The SortValue with its leading hyphen/dash removed\n */\nexport type SortId = string;\n\n/**\n * Determined by whether or not there is a leading hyphen/dash in the SortValue\n */\nexport type SortOrder = 'asc' | 'desc';\n\n/**\n * A deserialized instance of a `SortValue`.\n */\nexport type SortValueDeserialized = {\n id: SortId;\n order: SortOrder;\n};\n\n/** Updates the DataView internal state with the given sortId */\nexport type UpdateCurrentSort = (\n sortId: SortId | undefined,\n options?: {\n sortOrder?: SortOrder;\n /** If true, emits the `update:currentSort` and `update` events from DataView */\n shouldEmit?: boolean;\n },\n) => void;\n\n/** Updates the DataView internal state with the given page */\nexport type SetPage = (\n page: number,\n options?: {\n /** If true, emits the `update:currentPage` and `update` events from DataView */\n shouldEmit?: boolean;\n },\n) => void;\n\n/** Updates the DataView internal state with the previous page */\nexport type GoPrevPage = (options?: {\n /** If true, emits the `update:currentPage` and `update` events from DataView */\n shouldEmit?: boolean;\n}) => void;\n\n/** Updates the DataView internal state with the next page */\nexport type GoNextPage = (options?: {\n /** If true, emits the `update:currentPage` and `update` events from DataView */\n shouldEmit?: boolean;\n}) => void;\n\n/** Updates the DataView internal state with the given searchTerm */\nexport type UpdateCurrentSearch = (\n searchTerm?: string,\n options?: {\n /** If true, emits the `update:currentSearch` and `update` events from DataView */\n shouldEmit?: boolean;\n },\n) => void;\n\n/** Updates the DataView internal state with the given filter values */\nexport type UpdateCurrentFilters<FilterValues = object> = (\n newFilters: FilterValues,\n options?: {\n /** If true, emits the `update:currentSearch` and `update` events from DataView */\n shouldEmit?: boolean;\n },\n) => void;\n\nexport interface UpdateEvent<FilterValues = object> {\n page?: number;\n pageSize?: number;\n ordering?: string;\n search?: string;\n filters?: FilterValues;\n}\n\nexport interface DataViewInjection {\n currentPage: ComputedRef<number>;\n\n /** Optional override for the next button disabled state */\n isPaginateNextDisabled: ComputedRef<boolean>;\n\n isPaginationEnabled: ComputedRef<boolean>;\n\n pageCount: ComputedRef<number>;\n\n pageSize: ComputedRef<number>;\n\n totalDataCount: ComputedRef<number>;\n\n /** Updates the DataView internal state with the given page */\n setPage: SetPage;\n\n /** Updates the DataView internal state with the previous page */\n goPrevPage: GoPrevPage;\n\n /** Updates the DataView internal state with the next page */\n goNextPage: GoNextPage;\n\n currentSortId: ComputedRef<SortId | undefined>;\n\n currentSortOrder: ComputedRef<SortOrder | undefined>;\n\n /** Updates the DataView internal state with the given sortId */\n updateCurrentSort: UpdateCurrentSort;\n\n currentSearch: ComputedRef<string>;\n\n /** Updates the DataView internal state with the given searchTerm */\n updateCurrentSearch: UpdateCurrentSearch;\n\n /**\n * The DataView's padding; the default value is \"comfortable\". On small screens, the density will always be \"compact\".\n */\n density: ComputedRef<SpacingDensities | undefined>;\n\n /**\n * Defines if a DataView has a Toolbar rendered. This prop is updated when DataViewToolbar exists and is mounted.\n */\n hasToolbar?: Ref<boolean>;\n\n /**\n * Enables certain loading indicators to be displayed within the DataView.\n */\n isLoading?: ComputedRef<boolean>;\n\n /**\n * Enables certain empty states to be displayed within the DataView.\n */\n isEmpty?: ComputedRef<boolean>;\n\n /**\n * Allows Table to control whether or not a DataViewToolbar should show a checkmark\n */\n isSelectable?: Ref<boolean>;\n\n /**\n * Whether or not the DataView is rendered within a Module; the value is inferred based on being\n * able to inject details from Module.\n *\n * Note: This is sent to DataView child components so they only need to worry about interfacing\n * with the DataViewInjection API.\n */\n isWithinModule: ComputedRef<boolean>;\n\n /**\n * The DataView's variant; the default value is undefined.\n */\n variant: ComputedRef<DataViewVariants | undefined>;\n}\n","<script lang=\"ts\">\n export * from './DataView.constants';\n export * from './DataView.keys';\n export * from './DataView.types';\n export * from './DataView.utils';\n</script>\n\n<script setup lang=\"ts\">\n import cloneDeep from 'lodash-es/cloneDeep';\n import { computed, inject, provide, ref, useCssModule, watch } from 'vue';\n\n import { SpacingDensities } from '../../../types/misc';\n import { MODULE_INJECTION } from '../Module/Module.keys';\n import Paginate from '../Paginate/Paginate.vue';\n import { DEFAULT_PAGE_SIZE } from './DataView.constants';\n import { DATA_VIEW_INJECTION } from './DataView.keys';\n import {\n DataViewVariants,\n GoNextPage,\n GoPrevPage,\n SetPage,\n SortId,\n SortOrder,\n SortValue,\n UpdateCurrentFilters,\n UpdateCurrentSearch,\n UpdateCurrentSort,\n UpdateEvent,\n } from './DataView.types';\n import { deserializeSortValue, getNextSort } from './DataView.utils';\n\n export interface DataViewProps {\n /**\n * Can be used to provide the initial page.\n * Also, it can be used to control the active page with `v-model:current-page=\"myPage\"`.\n */\n currentPage?: number;\n\n /**\n * Can be used to set the initial search term.\n * Also, it can be used to control the active search term with `v-model:current-search=\"mySearchTerm\"`.\n */\n currentSearch?: string;\n\n /**\n * Can be used to provide the initial sort order.\n * Also, it can be used to control the active sort order with `v-model:current-sort=\"mySortOrder\"`.\n */\n currentSort?: SortValue;\n\n /**\n * A list of records. If pagination is enabled, `data` must be only the current page of records.\n */\n data?: object[];\n\n /**\n * Controls the DataView's padding; the default value is \"comfortable\". On small screens, \"compact\" density is applied regardless of this prop's value.\n */\n density?: SpacingDensities;\n\n /**\n * The number of records to display per page.\n */\n pageSize?: number;\n\n /**\n * Opt-out of displaying pagination. Hides the pagination buttons and page stats.\n */\n disablePagination?: boolean;\n\n /**\n * Hides the bottom pagination without disabling the pagination from the toolbar\n */\n hideBottomPagination?: boolean;\n\n /**\n * The total number of records available.\n * Used to auto-enable pagination when results exist.\n * Use `Infinity` for activating 'n of many' pagination\n * DataView does not paginate data for you; instead, `props.data` should always show\n * the current page of results.\n */\n totalDataCount?: number;\n\n /**\n * Whether there is a next page of data or not as informed by the server.\n * This only applies when`totalDataCount=\"Infinity\"` to determine if the \"Next\" pagination button should be disabled.\n */\n hasNextPage?: boolean;\n\n /**\n * DataView variant. The default value is `undefined`. Will default to `table` when used within\n * a `<Module variant=\"table\">`.\n */\n variant?: DataViewVariants;\n\n isLoading?: boolean;\n }\n\n const props = withDefaults(defineProps<DataViewProps>(), {\n currentPage: 1,\n currentSearch: undefined,\n currentSort: undefined,\n data: () => [],\n density: 'comfortable',\n pageSize: DEFAULT_PAGE_SIZE,\n disablePagination: false,\n totalDataCount: 0,\n hasNextPage: undefined,\n hideBottomPagination: false,\n variant: undefined,\n });\n\n const emit = defineEmits<{\n (e: 'update', state: UpdateEvent): void;\n (e: 'update:currentFilters', newFilters: object): void;\n (e: 'update:currentPage', page: number, pageSize: number): void;\n (e: 'update:currentSearch', searchTerm?: string): void;\n (e: 'update:currentSort', payload?: SortValue): void;\n }>();\n\n const classes = useCssModule();\n const rootRef = ref<HTMLElement | null>(null);\n const moduleInjection = inject(MODULE_INJECTION.key, MODULE_INJECTION.defaults);\n const computedVariant = computed<DataViewVariants | undefined>(() => {\n if (props.variant) {\n return props.variant;\n }\n\n if (moduleInjection.variant?.value === 'table') {\n return 'table';\n }\n\n return undefined;\n });\n const isWithinModule = computed(() => moduleInjection.variant !== undefined);\n\n // #region pagination\n const internalPage = ref(1);\n const isPaginationEnabled = computed(() => !props.disablePagination && props.totalDataCount > 0);\n const isPaginateNextDisabled = computed(() => props.totalDataCount === Infinity && !props.hasNextPage);\n const pageCount = computed(() => Math.ceil(props.totalDataCount / props.pageSize));\n\n const setPage: SetPage = function (page: number, { shouldEmit } = {}) {\n internalPage.value = page;\n\n if (shouldEmit) {\n emitUpdate();\n emit('update:currentPage', page, props.pageSize);\n }\n\n if (Number(rootRef.value?.getBoundingClientRect().top) < 0) {\n rootRef.value?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n }\n };\n\n const goPrevPage: GoPrevPage = function ({ shouldEmit } = {}) {\n const page = Math.max(internalPage.value - 1, 1);\n\n setPage(page, { shouldEmit });\n };\n\n /** Updates the DataView internal state with the previous page */\n const goNextPage: GoNextPage = function ({ shouldEmit } = {}) {\n const page = Math.min(internalPage.value + 1, pageCount.value);\n\n setPage(page, { shouldEmit });\n };\n\n watch(\n () => props.currentPage,\n () => {\n setPage(props.currentPage);\n },\n { immediate: true },\n );\n // #endregion pagination\n\n // #region sorting\n const internalSort = ref<SortValue | undefined>(undefined);\n\n const internalSortId = computed<SortId | undefined>(() =>\n internalSort.value ? deserializeSortValue(internalSort.value).id : undefined,\n );\n const internalSortOrder = computed<SortOrder | undefined>(() =>\n internalSort.value ? deserializeSortValue(internalSort.value).order : undefined,\n );\n\n const updateCurrentSort: UpdateCurrentSort = function (sortId, { sortOrder, shouldEmit } = {}) {\n const { id: oldId, order: oldOrder } = deserializeSortValue(internalSort.value || '');\n const nextSort = getNextSort({ newId: sortId, newOrder: sortOrder, oldId, oldOrder });\n\n internalSort.value = nextSort;\n setPage(1);\n\n if (shouldEmit) {\n emitUpdate();\n emit('update:currentSort', nextSort);\n }\n };\n\n watch(\n () => props.currentSort,\n () => {\n updateCurrentSort(props.currentSort);\n },\n { immediate: true },\n );\n // #endregion sorting\n\n // #region search\n const internalSearch = ref('');\n\n const hasToolbar = ref(false);\n const isSelectable = ref(false);\n\n const updateCurrentSearch: UpdateCurrentSearch = function (searchTerm, { shouldEmit } = {}) {\n internalSearch.value = searchTerm || '';\n setPage(1);\n\n if (shouldEmit) {\n emitUpdate();\n emit('update:currentSearch', searchTerm);\n }\n };\n\n watch(\n () => props.currentSearch,\n () => {\n updateCurrentSearch(props.currentSearch);\n },\n { immediate: true },\n );\n // #endregion search\n\n // #region filters\n const internalFilters = ref<object>({});\n\n const updateCurrentFilters: UpdateCurrentFilters = function (newFilters: object, { shouldEmit } = {}) {\n internalFilters.value = newFilters;\n setPage(1);\n\n if (shouldEmit) {\n emitUpdate();\n emit('update:currentFilters', newFilters);\n }\n };\n // #endregion filters\n\n function emitUpdate() {\n emit('update', {\n page: internalPage.value,\n pageSize: props.pageSize,\n ordering: internalSort.value,\n search: internalSearch.value,\n filters: cloneDeep(internalFilters.value),\n });\n }\n\n provide(\n DATA_VIEW_INJECTION.key,\n Object.freeze({\n // Pagination\n currentPage: computed(() => internalPage.value),\n isPaginationEnabled,\n isPaginateNextDisabled,\n pageCount,\n pageSize: computed(() => props.pageSize),\n totalDataCount: computed(() => props.totalDataCount),\n setPage,\n goPrevPage,\n goNextPage,\n\n // Sorting\n currentSortId: internalSortId,\n currentSortOrder: internalSortOrder,\n updateCurrentSort,\n\n // Search\n currentSearch: computed(() => internalSearch.value),\n updateCurrentSearch,\n\n // Miscellaneous\n density: computed(() => props.density),\n hasToolbar,\n isEmpty: computed(() => props.data.length === 0),\n isSelectable,\n isLoading: computed(() => props.isLoading),\n isWithinModule,\n variant: computedVariant,\n }),\n );\n\n defineExpose({\n page: computed(() => internalPage.value),\n pageSize: computed(() => props.pageSize),\n setPage,\n goPrevPage,\n goNextPage,\n ordering: computed(() => internalSort.value),\n updateCurrentSort,\n search: computed(() => internalSearch.value),\n updateCurrentSearch,\n filters: computed(() => internalFilters.value),\n updateCurrentFilters,\n });\n</script>\n\n<template>\n <div ref=\"rootRef\" class=\"stash-data-view tw-relative\" data-test=\"stash-data-view\">\n <!-- @slot default -->\n <slot\n :current-page=\"internalPage\"\n :current-sort-id=\"internalSortId\"\n :current-sort-order=\"internalSortOrder\"\n :data=\"data\"\n :go-prev-page=\"goPrevPage\"\n :go-next-page=\"goNextPage\"\n :page-count=\"pageCount\"\n :set-page=\"setPage\"\n :total-data-count=\"props.totalDataCount\"\n :update-current-sort=\"updateCurrentSort\"\n :update-current-search=\"updateCurrentSearch\"\n ></slot>\n\n <Paginate\n v-if=\"isPaginationEnabled && !isWithinModule && pageCount > 1 && !props.hideBottomPagination\"\n class=\"tw-mt-6\"\n :class=\"classes.paginate\"\n :current-page=\"internalPage\"\n :is-next-disabled=\"isLoading || isPaginateNextDisabled\"\n :list-length=\"props.totalDataCount\"\n :page-size=\"props.pageSize\"\n :variant=\"props.totalDataCount === Infinity ? 'stats' : 'standard'\"\n @set-page=\"(page: number) => setPage(page, { shouldEmit: true })\"\n />\n </div>\n</template>\n\n<style module>\n .paginate ul {\n margin: 0;\n }\n</style>\n"],"names":["deserializeSortValue","sort","order","serializeSortValue","id","getNextSort","newId","newOrder","oldId","oldOrder","DataViewVariant","props","__props","emit","__emit","classes","useCssModule","rootRef","ref","moduleInjection","inject","MODULE_INJECTION","computedVariant","computed","isWithinModule","internalPage","isPaginationEnabled","isPaginateNextDisabled","pageCount","setPage","page","shouldEmit","emitUpdate","goPrevPage","goNextPage","watch","internalSort","internalSortId","internalSortOrder","updateCurrentSort","sortId","sortOrder","nextSort","internalSearch","hasToolbar","isSelectable","updateCurrentSearch","searchTerm","internalFilters","updateCurrentFilters","newFilters","cloneDeep","provide","DATA_VIEW_INJECTION","__expose","_createElementBlock","_renderSlot","_ctx","data","_createBlock","Paginate","_normalizeClass","_unref","isLoading","_cache"],"mappings":";;;;;;AAKO,SAASA,EAAqBC,GAAwC;AAC3E,QAAMC,IAAQD,EAAK,CAAC,MAAM,MAAM,SAAS;AAGzC,SAAO,EAAE,IAFEC,MAAU,QAAQD,IAAOA,EAAK,MAAM,CAAC,GAEnC,OAAAC,EAAA;AACf;AAKO,SAASC,GAAmB,EAAE,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MAA8B,aAAU;AAAA,IAAA;MAE/DuC,EAYQC,EAAA,QAAA,WAAA;AAAA,QAXL,aAAchC,EAAA;AAAA,QACd,eAAiBY,EAAA;AAAA,QACjB,kBAAoBC,EAAA;AAAA,QACpB,MAAMoB,EAAAA;AAAAA,QACN,YAAAzB;AAAA,QACA,YAAAC;AAAA,QACA,WAAYN,EAAA;AAAA,QACZ,SAAAC;AAAA,QACA,gBAAkBlB,EAAM;AAAA,QACxB,mBAAA4B;AAAA,QACA,qBAAAO;AAAA,MAAA;MAIKpB,EAAA,UAAwBF,EAAA,SAAkBI,UAAS,KAAA,CAASjB,EAAM,6BAD1EgD,EAUEC,GAAA;AAAA;QARA,OAAKC,EAAA,CAAC,WACEC,EAAA/C,CAAA,EAAQ,QAAQ,CAAA;AAAA,QACvB,gBAAcU,EAAA;AAAA,QACd,oBAAkBsC,EAAAA,aAAapC,EAAA;AAAA,QAC/B,eAAahB,EAAM;AAAA,QACnB,aAAWA,EAAM;AAAA,QACjB,SAASA,EAAM,mBAAmB,QAAQ,UAAA;AAAA,QAC1C,WAAQqD,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAGlC,MAAiBD,EAAQC,GAAI,EAAA,YAAA,IAAA;AAAA,MAAA;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"DataView.js","sources":["../src/components/DataView/DataView.utils.ts","../src/components/DataView/DataView.types.ts","../src/components/DataView/DataView.vue"],"sourcesContent":["import { SortId, SortOrder, SortValue, SortValueDeserialized } from './DataView.types';\n\n/**\n * Receives a SortValue (ex: `'-product_name'`) and returns an object with a `id` and an `order`.\n */\nexport function deserializeSortValue(sort: SortValue): SortValueDeserialized {\n const order = sort[0] === '-' ? 'desc' : 'asc';\n const id = order === 'asc' ? sort : sort.slice(1);\n\n return { id, order };\n}\n\n/**\n * Receives an object with a `id` and an `order` and returns a SortValue (ex: `'-product_name'`).\n */\nexport function serializeSortValue({ id, order }: SortValueDeserialized): SortValue {\n return `${order === 'desc' ? '-' : ''}${id}`;\n}\n\ninterface GetNextSortArgs {\n newId: SortId | undefined;\n newOrder?: SortOrder;\n oldId?: SortId;\n oldOrder?: SortOrder;\n}\n\n/**\n * Given new and old sorting data, it returns the next sorting value using the following sorting cycle:\n *\n * \"unsorted --> ascending --> descending --> unsorted\"\n */\nexport function getNextSort({ newId, newOrder, oldId, oldOrder }: GetNextSortArgs): SortValue | undefined {\n if (!newId) {\n return undefined;\n }\n\n if (newId !== oldId) {\n // if sorting by a new field, sort ascending\n return serializeSortValue({ id: newId, order: newOrder || 'asc' });\n }\n\n /**\n * `newOrder` and `oldOrder` can each have 3 different values: undefined, 'asc', or 'desc'.\n * Therefore, there are 9 possible combinations (3 times 3). See below:\n */\n\n // #region newOrder: undefined\n if (!newOrder && !oldOrder) {\n return newId; // ascending\n }\n\n if (!newOrder && oldOrder === 'desc') {\n return undefined; // unsorted\n }\n\n if (!newOrder && oldOrder === 'asc') {\n return `-${newId}`; // descending\n }\n // #endregion\n\n // #region newOrder: asc\n if (newOrder === 'asc' && !oldOrder) {\n return newId;\n }\n\n if (newOrder === 'asc' && oldOrder === 'asc') {\n return undefined;\n }\n\n if (newOrder === 'asc' && oldOrder === 'desc') {\n return newId;\n }\n // #endregion\n\n // #region newOrder: desc\n if (newOrder === 'desc' && !oldOrder) {\n return `-${newId}`;\n }\n\n if (newOrder === 'desc' && oldOrder === 'desc') {\n return undefined;\n }\n\n if (newOrder === 'desc' && oldOrder === 'asc') {\n return `-${newId}`;\n }\n // #endregion\n}\n","import { ComputedRef, Ref } from 'vue';\n\nimport { SpacingDensities } from '../../../types/misc';\n\nexport enum DataViewVariant {\n Table = 'table',\n}\n\nexport type DataViewVariants = `${DataViewVariant}`;\n\n/**\n * A unique id for a sorting strategy. If the order is descending, it must begin with \"-\" (a hyphen/dash).\n *\n * Ex: `'product_name'` if ascending or `'-product_name'` if descending\n */\nexport type SortValue = string;\n\n/**\n * The SortValue with its leading hyphen/dash removed\n */\nexport type SortId = string;\n\n/**\n * Determined by whether or not there is a leading hyphen/dash in the SortValue\n */\nexport type SortOrder = 'asc' | 'desc';\n\n/**\n * A deserialized instance of a `SortValue`.\n */\nexport type SortValueDeserialized = {\n id: SortId;\n order: SortOrder;\n};\n\n/** Updates the DataView internal state with the given sortId */\nexport type UpdateCurrentSort = (\n sortId: SortId | undefined,\n options?: {\n sortOrder?: SortOrder;\n /** If true, emits the `update:currentSort` and `update` events from DataView */\n shouldEmit?: boolean;\n },\n) => void;\n\n/** Updates the DataView internal state with the given page */\nexport type SetPage = (\n page: number,\n options?: {\n /** If true, emits the `update:currentPage` and `update` events from DataView */\n shouldEmit?: boolean;\n },\n) => void;\n\n/** Updates the DataView internal state with the previous page */\nexport type GoPrevPage = (options?: {\n /** If true, emits the `update:currentPage` and `update` events from DataView */\n shouldEmit?: boolean;\n}) => void;\n\n/** Updates the DataView internal state with the next page */\nexport type GoNextPage = (options?: {\n /** If true, emits the `update:currentPage` and `update` events from DataView */\n shouldEmit?: boolean;\n}) => void;\n\n/** Updates the DataView internal state with the given searchTerm */\nexport type UpdateCurrentSearch = (\n searchTerm?: string,\n options?: {\n /** If true, emits the `update:currentSearch` and `update` events from DataView */\n shouldEmit?: boolean;\n },\n) => void;\n\n/** Updates the DataView internal state with the given filter values */\nexport type UpdateCurrentFilters<FilterValues = object> = (\n newFilters: FilterValues,\n options?: {\n /** If true, emits the `update:currentSearch` and `update` events from DataView */\n shouldEmit?: boolean;\n },\n) => void;\n\nexport interface UpdateEvent<FilterValues = object> {\n page?: number;\n pageSize?: number;\n ordering?: string;\n search?: string;\n filters?: FilterValues;\n}\n\nexport interface DataViewInjection {\n currentPage: ComputedRef<number>;\n\n /** Optional override for the next button disabled state */\n isPaginateNextDisabled: ComputedRef<boolean>;\n\n isPaginationEnabled: ComputedRef<boolean>;\n\n pageCount: ComputedRef<number>;\n\n pageSize: ComputedRef<number>;\n\n totalDataCount: ComputedRef<number>;\n\n /** Updates the DataView internal state with the given page */\n setPage: SetPage;\n\n /** Updates the DataView internal state with the previous page */\n goPrevPage: GoPrevPage;\n\n /** Updates the DataView internal state with the next page */\n goNextPage: GoNextPage;\n\n currentSortId: ComputedRef<SortId | undefined>;\n\n currentSortOrder: ComputedRef<SortOrder | undefined>;\n\n /** Updates the DataView internal state with the given sortId */\n updateCurrentSort: UpdateCurrentSort;\n\n currentSearch: ComputedRef<string>;\n\n /** Updates the DataView internal state with the given searchTerm */\n updateCurrentSearch: UpdateCurrentSearch;\n\n /**\n * The DataView's padding; the default value is \"comfortable\". On small screens, the density will always be \"compact\".\n */\n density: ComputedRef<SpacingDensities | undefined>;\n\n /**\n * Defines if a DataView has a Toolbar rendered. This prop is updated when DataViewToolbar exists and is mounted.\n */\n hasToolbar?: Ref<boolean>;\n\n /**\n * Enables certain loading indicators to be displayed within the DataView.\n */\n isLoading?: ComputedRef<boolean>;\n\n /**\n * Enables certain empty states to be displayed within the DataView.\n */\n isEmpty?: ComputedRef<boolean>;\n\n /**\n * Allows Table to control whether or not a DataViewToolbar should show a checkmark\n */\n isSelectable?: Ref<boolean>;\n\n /**\n * Whether or not the DataView is rendered within a Module; the value is inferred based on being\n * able to inject details from Module.\n *\n * Note: This is sent to DataView child components so they only need to worry about interfacing\n * with the DataViewInjection API.\n */\n isWithinModule: ComputedRef<boolean>;\n\n /**\n * The DataView's variant; the default value is undefined.\n */\n variant: ComputedRef<DataViewVariants | undefined>;\n}\n","<script lang=\"ts\">\n export * from './DataView.constants';\n export * from './DataView.keys';\n export * from './DataView.types';\n export * from './DataView.utils';\n</script>\n\n<script setup lang=\"ts\">\n import cloneDeep from 'lodash-es/cloneDeep';\n import { computed, inject, provide, ref, useCssModule, watch } from 'vue';\n\n import { SpacingDensities } from '../../../types/misc';\n import { MODULE_INJECTION } from '../Module/Module.keys';\n import Paginate from '../Paginate/Paginate.vue';\n import { DEFAULT_PAGE_SIZE } from './DataView.constants';\n import { DATA_VIEW_INJECTION } from './DataView.keys';\n import {\n DataViewVariants,\n GoNextPage,\n GoPrevPage,\n SetPage,\n SortId,\n SortOrder,\n SortValue,\n UpdateCurrentFilters,\n UpdateCurrentSearch,\n UpdateCurrentSort,\n UpdateEvent,\n } from './DataView.types';\n import { deserializeSortValue, getNextSort } from './DataView.utils';\n\n export interface DataViewProps {\n /**\n * Can be used to provide the initial page.\n * Also, it can be used to control the active page with `v-model:current-page=\"myPage\"`.\n */\n currentPage?: number;\n\n /**\n * Can be used to set the initial search term.\n * Also, it can be used to control the active search term with `v-model:current-search=\"mySearchTerm\"`.\n */\n currentSearch?: string;\n\n /**\n * Can be used to provide the initial sort order.\n * Also, it can be used to control the active sort order with `v-model:current-sort=\"mySortOrder\"`.\n */\n currentSort?: SortValue;\n\n /**\n * A list of records. If pagination is enabled, `data` must be only the current page of records.\n */\n data?: object[];\n\n /**\n * Controls the DataView's padding; the default value is \"comfortable\". On small screens, \"compact\" density is applied regardless of this prop's value.\n */\n density?: SpacingDensities;\n\n /**\n * The number of records to display per page.\n */\n pageSize?: number;\n\n /**\n * Opt-out of displaying pagination. Hides the pagination buttons and page stats.\n */\n disablePagination?: boolean;\n\n /**\n * Hides the bottom pagination without disabling the pagination from the toolbar\n */\n hideBottomPagination?: boolean;\n\n /**\n * The total number of records available.\n * Used to auto-enable pagination when results exist.\n * Use `Infinity` for activating 'n of many' pagination\n * DataView does not paginate data for you; instead, `props.data` should always show\n * the current page of results.\n */\n totalDataCount?: number;\n\n /**\n * Whether there is a next page of data or not as informed by the server.\n * This only applies when`totalDataCount=\"Infinity\"` to determine if the \"Next\" pagination button should be disabled.\n */\n hasNextPage?: boolean;\n\n /**\n * DataView variant. The default value is `undefined`. Will default to `table` when used within\n * a `<Module variant=\"table\">`.\n */\n variant?: DataViewVariants;\n\n isLoading?: boolean;\n }\n\n const props = withDefaults(defineProps<DataViewProps>(), {\n currentPage: 1,\n currentSearch: undefined,\n currentSort: undefined,\n data: () => [],\n density: 'comfortable',\n pageSize: DEFAULT_PAGE_SIZE,\n disablePagination: false,\n totalDataCount: 0,\n hasNextPage: undefined,\n hideBottomPagination: false,\n variant: undefined,\n });\n\n const emit = defineEmits<{\n (e: 'update', state: UpdateEvent): void;\n (e: 'update:currentFilters', newFilters: object): void;\n (e: 'update:currentPage', page: number, pageSize: number): void;\n (e: 'update:currentSearch', searchTerm?: string): void;\n (e: 'update:currentSort', payload?: SortValue): void;\n }>();\n\n const classes = useCssModule();\n const rootRef = ref<HTMLElement | null>(null);\n const moduleInjection = inject(MODULE_INJECTION.key, MODULE_INJECTION.defaults);\n const computedVariant = computed<DataViewVariants | undefined>(() => {\n if (props.variant) {\n return props.variant;\n }\n\n if (moduleInjection.variant?.value === 'table') {\n return 'table';\n }\n\n return undefined;\n });\n const isWithinModule = computed(() => moduleInjection.variant !== undefined);\n\n // #region pagination\n const internalPage = ref(1);\n const isPaginationEnabled = computed(() => !props.disablePagination && props.totalDataCount > 0);\n const isPaginateNextDisabled = computed(() => props.totalDataCount === Infinity && !props.hasNextPage);\n const pageCount = computed(() => Math.ceil(props.totalDataCount / props.pageSize));\n\n const setPage: SetPage = function (page: number, { shouldEmit } = {}) {\n internalPage.value = page;\n\n if (shouldEmit) {\n emitUpdate();\n emit('update:currentPage', page, props.pageSize);\n }\n\n if (Number(rootRef.value?.getBoundingClientRect().top) < 0) {\n rootRef.value?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n }\n };\n\n const goPrevPage: GoPrevPage = function ({ shouldEmit } = {}) {\n const page = Math.max(internalPage.value - 1, 1);\n\n setPage(page, { shouldEmit });\n };\n\n /** Updates the DataView internal state with the previous page */\n const goNextPage: GoNextPage = function ({ shouldEmit } = {}) {\n const page = Math.min(internalPage.value + 1, pageCount.value);\n\n setPage(page, { shouldEmit });\n };\n\n watch(\n () => props.currentPage,\n () => {\n setPage(props.currentPage);\n },\n { immediate: true },\n );\n // #endregion pagination\n\n // #region sorting\n const internalSort = ref<SortValue | undefined>(undefined);\n\n const internalSortId = computed<SortId | undefined>(() =>\n internalSort.value ? deserializeSortValue(internalSort.value).id : undefined,\n );\n const internalSortOrder = computed<SortOrder | undefined>(() =>\n internalSort.value ? deserializeSortValue(internalSort.value).order : undefined,\n );\n\n const updateCurrentSort: UpdateCurrentSort = function (sortId, { sortOrder, shouldEmit } = {}) {\n const { id: oldId, order: oldOrder } = deserializeSortValue(internalSort.value || '');\n const nextSort = getNextSort({ newId: sortId, newOrder: sortOrder, oldId, oldOrder });\n\n internalSort.value = nextSort;\n setPage(1);\n\n if (shouldEmit) {\n emitUpdate();\n emit('update:currentSort', nextSort);\n }\n };\n\n watch(\n () => props.currentSort,\n () => {\n updateCurrentSort(props.currentSort);\n },\n { immediate: true },\n );\n // #endregion sorting\n\n // #region search\n const internalSearch = ref('');\n\n const hasToolbar = ref(false);\n const isSelectable = ref(false);\n\n const updateCurrentSearch: UpdateCurrentSearch = function (searchTerm, { shouldEmit } = {}) {\n internalSearch.value = searchTerm || '';\n setPage(1);\n\n if (shouldEmit) {\n emitUpdate();\n emit('update:currentSearch', searchTerm);\n }\n };\n\n watch(\n () => props.currentSearch,\n () => {\n updateCurrentSearch(props.currentSearch);\n },\n { immediate: true },\n );\n // #endregion search\n\n // #region filters\n const internalFilters = ref<object>({});\n\n const updateCurrentFilters: UpdateCurrentFilters = function (newFilters: object, { shouldEmit } = {}) {\n internalFilters.value = newFilters;\n setPage(1);\n\n if (shouldEmit) {\n emitUpdate();\n emit('update:currentFilters', newFilters);\n }\n };\n // #endregion filters\n\n function emitUpdate() {\n emit('update', {\n page: internalPage.value,\n pageSize: props.pageSize,\n ordering: internalSort.value,\n search: internalSearch.value,\n filters: cloneDeep(internalFilters.value),\n });\n }\n\n provide(\n DATA_VIEW_INJECTION.key,\n Object.freeze({\n // Pagination\n currentPage: computed(() => internalPage.value),\n isPaginationEnabled,\n isPaginateNextDisabled,\n pageCount,\n pageSize: computed(() => props.pageSize),\n totalDataCount: computed(() => props.totalDataCount),\n setPage,\n goPrevPage,\n goNextPage,\n\n // Sorting\n currentSortId: internalSortId,\n currentSortOrder: internalSortOrder,\n updateCurrentSort,\n\n // Search\n currentSearch: computed(() => internalSearch.value),\n updateCurrentSearch,\n\n // Miscellaneous\n density: computed(() => props.density),\n hasToolbar,\n isEmpty: computed(() => props.data.length === 0),\n isSelectable,\n isLoading: computed(() => props.isLoading),\n isWithinModule,\n variant: computedVariant,\n }),\n );\n\n defineExpose({\n page: computed(() => internalPage.value),\n pageSize: computed(() => props.pageSize),\n setPage,\n goPrevPage,\n goNextPage,\n ordering: computed(() => internalSort.value),\n updateCurrentSort,\n search: computed(() => internalSearch.value),\n updateCurrentSearch,\n filters: computed(() => internalFilters.value),\n updateCurrentFilters,\n });\n</script>\n\n<template>\n <div ref=\"rootRef\" class=\"stash-data-view tw-relative\" data-test=\"stash-data-view\">\n <!-- @slot default -->\n <slot\n :current-page=\"internalPage\"\n :current-sort-id=\"internalSortId\"\n :current-sort-order=\"internalSortOrder\"\n :data=\"data\"\n :go-prev-page=\"goPrevPage\"\n :go-next-page=\"goNextPage\"\n :page-count=\"pageCount\"\n :set-page=\"setPage\"\n :total-data-count=\"props.totalDataCount\"\n :update-current-sort=\"updateCurrentSort\"\n :update-current-search=\"updateCurrentSearch\"\n ></slot>\n\n <Paginate\n v-if=\"isPaginationEnabled && !isWithinModule && pageCount > 1 && !props.hideBottomPagination\"\n class=\"tw-mt-6\"\n :class=\"classes.paginate\"\n :current-page=\"internalPage\"\n :is-next-disabled=\"isLoading || isPaginateNextDisabled\"\n :list-length=\"props.totalDataCount\"\n :page-size=\"props.pageSize\"\n :variant=\"props.totalDataCount === Infinity ? 'stats' : 'standard'\"\n @set-page=\"(page: number) => setPage(page, { shouldEmit: true })\"\n />\n </div>\n</template>\n\n<style module>\n .paginate ul {\n margin: 0;\n }\n</style>\n"],"names":["deserializeSortValue","sort","order","serializeSortValue","id","getNextSort","newId","newOrder","oldId","oldOrder","DataViewVariant","props","__props","emit","__emit","classes","useCssModule","rootRef","ref","moduleInjection","inject","MODULE_INJECTION","computedVariant","computed","_a","isWithinModule","internalPage","isPaginationEnabled","isPaginateNextDisabled","pageCount","setPage","page","shouldEmit","emitUpdate","_b","goPrevPage","goNextPage","watch","internalSort","internalSortId","internalSortOrder","updateCurrentSort","sortId","sortOrder","nextSort","internalSearch","hasToolbar","isSelectable","updateCurrentSearch","searchTerm","internalFilters","updateCurrentFilters","newFilters","cloneDeep","provide","DATA_VIEW_INJECTION","__expose"],"mappings":";;;;;;AAKO,SAASA,EAAqBC,GAAwC;AAC3E,QAAMC,IAAQD,EAAK,CAAC,MAAM,MAAM,SAAS;AAGzC,SAAO,EAAE,IAFEC,MAAU,QAAQD,IAAOA,EAAK,MAAM,CAAC,GAEnC,OAAAC,EAAA;AACf;AAKO,SAASC,GAAmB,EAAE,IAAAC,GAAI,OAAAF,KAA2C;AAClF,SAAO,GAAGA,MAAU,SAAS,MAAM,EAAE,GAAGE,CAAE;AAC5C;AAcO,SAASC,GAAY,EAAE,OAAAC,GAAO,UAAAC,GAAU,OAAAC,GAAO,UAAAC,KAAoD;AACxG,MAAKH,GAIL;AAAA,QAAIA,MAAUE;AAEZ,aAAOL,GAAmB,EAAE,IAAIG,GAAO,OAAOC,KAAY,OAAO;AASnE,QAAI,CAACA,KAAY,CAACE;AAChB,aAAOH;AAGT,QAAI,GAACC,KAAYE,MAAa,SAI9B;AAAA,UAAI,CAACF,KAAYE,MAAa;AAC5B,eAAO,IAAIH,CAAK;AAKlB,UAAIC,MAAa,SAAS,CAACE;AACzB,eAAOH;AAGT,UAAI,EAAAC,MAAa,SAASE,MAAa,QAIvC;AAAA,YAAIF,MAAa,SAASE,MAAa;AACrC,iBAAOH;AAKT,YAAIC,MAAa,UAAU,CAACE;AAC1B,iBAAO,IAAIH,CAAK;AAGlB,YAAI,EAAAC,MAAa,UAAUE,MAAa,WAIpCF,MAAa,UAAUE,MAAa;AACtC,iBAAO,IAAIH,CAAK;AAAA;AAAA;AAAA;AAGpB;ACnFO,IAAKI,uBAAAA,OACVA,EAAA,QAAQ,SADEA,IAAAA,MAAA,CAAA,CAAA;;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H;AAAA,MAAA,CACV;AAAA,IAAA,GAGHkC,EAAa;AAAA,MACX,MAAMjC,EAAS,MAAMG,EAAa,KAAK;AAAA,MACvC,UAAUH,EAAS,MAAMZ,EAAM,QAAQ;AAAA,MACvC,SAAAmB;AAAA,MACA,YAAAK;AAAA,MACA,YAAAC;AAAA,MACA,UAAUb,EAAS,MAAMe,EAAa,KAAK;AAAA,MAC3C,mBAAAG;AAAA,MACA,QAAQlB,EAAS,MAAMsB,EAAe,KAAK;AAAA,MAC3C,qBAAAG;AAAA,MACA,SAASzB,EAAS,MAAM2B,EAAgB,KAAK;AAAA,MAC7C,sBAAAC;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/DataView.vue.d.ts
CHANGED
|
@@ -2,10 +2,33 @@ import { ComponentOptionsMixin } from 'vue';
|
|
|
2
2
|
import { ComponentProvideOptions } from 'vue';
|
|
3
3
|
import { ComputedRef } from 'vue';
|
|
4
4
|
import { DefineComponent } from 'vue';
|
|
5
|
+
import { ExtractPropTypes } from 'vue';
|
|
5
6
|
import { InjectionKey } from 'vue';
|
|
7
|
+
import { PropType } from 'vue';
|
|
6
8
|
import { PublicProps } from 'vue';
|
|
7
9
|
import { Ref } from 'vue';
|
|
8
10
|
|
|
11
|
+
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
12
|
+
|
|
13
|
+
declare type __VLS_Prettify<T> = {
|
|
14
|
+
[K in keyof T]: T[K];
|
|
15
|
+
} & {};
|
|
16
|
+
|
|
17
|
+
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
18
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
19
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
20
|
+
} : {
|
|
21
|
+
type: PropType<T[K]>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
declare type __VLS_WithDefaults<P, D> = {
|
|
27
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
28
|
+
default: D[K];
|
|
29
|
+
}> : P[K];
|
|
30
|
+
};
|
|
31
|
+
|
|
9
32
|
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
10
33
|
new (): {
|
|
11
34
|
$slots: S;
|
|
@@ -136,7 +159,19 @@ export declare enum DataViewVariant {
|
|
|
136
159
|
|
|
137
160
|
export declare type DataViewVariants = `${DataViewVariant}`;
|
|
138
161
|
|
|
139
|
-
declare const _default: __VLS_WithTemplateSlots<DefineComponent<DataViewProps
|
|
162
|
+
declare const _default: __VLS_WithTemplateSlots<DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<DataViewProps>, {
|
|
163
|
+
currentPage: number;
|
|
164
|
+
currentSearch: undefined;
|
|
165
|
+
currentSort: undefined;
|
|
166
|
+
data: () => never[];
|
|
167
|
+
density: string;
|
|
168
|
+
pageSize: number;
|
|
169
|
+
disablePagination: boolean;
|
|
170
|
+
totalDataCount: number;
|
|
171
|
+
hasNextPage: undefined;
|
|
172
|
+
hideBottomPagination: boolean;
|
|
173
|
+
variant: undefined;
|
|
174
|
+
}>>, {
|
|
140
175
|
page: ComputedRef<number>;
|
|
141
176
|
pageSize: ComputedRef<number>;
|
|
142
177
|
setPage: SetPage;
|
|
@@ -148,18 +183,30 @@ search: ComputedRef<string>;
|
|
|
148
183
|
updateCurrentSearch: UpdateCurrentSearch;
|
|
149
184
|
filters: ComputedRef<object>;
|
|
150
185
|
updateCurrentFilters: UpdateCurrentFilters;
|
|
151
|
-
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
152
|
-
update: (state: UpdateEvent<object>) =>
|
|
153
|
-
"update:currentFilters": (newFilters: object) =>
|
|
154
|
-
"update:
|
|
155
|
-
"update:
|
|
156
|
-
"update:
|
|
157
|
-
}, string, PublicProps, Readonly<DataViewProps
|
|
186
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
187
|
+
update: (state: UpdateEvent<object>) => void;
|
|
188
|
+
"update:currentFilters": (newFilters: object) => void;
|
|
189
|
+
"update:currentPage": (page: number, pageSize: number) => void;
|
|
190
|
+
"update:currentSearch": (searchTerm?: string | undefined) => void;
|
|
191
|
+
"update:currentSort": (payload?: string | undefined) => void;
|
|
192
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<DataViewProps>, {
|
|
193
|
+
currentPage: number;
|
|
194
|
+
currentSearch: undefined;
|
|
195
|
+
currentSort: undefined;
|
|
196
|
+
data: () => never[];
|
|
197
|
+
density: string;
|
|
198
|
+
pageSize: number;
|
|
199
|
+
disablePagination: boolean;
|
|
200
|
+
totalDataCount: number;
|
|
201
|
+
hasNextPage: undefined;
|
|
202
|
+
hideBottomPagination: boolean;
|
|
203
|
+
variant: undefined;
|
|
204
|
+
}>>> & Readonly<{
|
|
158
205
|
onUpdate?: ((state: UpdateEvent<object>) => any) | undefined;
|
|
159
206
|
"onUpdate:currentFilters"?: ((newFilters: object) => any) | undefined;
|
|
207
|
+
"onUpdate:currentPage"?: ((page: number, pageSize: number) => any) | undefined;
|
|
160
208
|
"onUpdate:currentSearch"?: ((searchTerm?: string | undefined) => any) | undefined;
|
|
161
209
|
"onUpdate:currentSort"?: ((payload?: string | undefined) => any) | undefined;
|
|
162
|
-
"onUpdate:currentPage"?: ((page: number, pageSize: number) => any) | undefined;
|
|
163
210
|
}>, {
|
|
164
211
|
data: object[];
|
|
165
212
|
variant: "table";
|
|
@@ -172,9 +219,7 @@ currentSort: string;
|
|
|
172
219
|
disablePagination: boolean;
|
|
173
220
|
hideBottomPagination: boolean;
|
|
174
221
|
hasNextPage: boolean;
|
|
175
|
-
}, {}, {}, {}, string, ComponentProvideOptions,
|
|
176
|
-
rootRef: HTMLDivElement;
|
|
177
|
-
}, HTMLDivElement>, {
|
|
222
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
|
|
178
223
|
default?(_: {
|
|
179
224
|
currentPage: number;
|
|
180
225
|
currentSortId: string | undefined;
|