@leaflink/stash 51.9.3 → 51.11.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/assets/icons/cloud-share.svg +1 -0
- package/assets/spritesheet.svg +1 -1
- package/dist/Accordion.js.map +1 -1
- package/dist/Accordion.vue.d.ts +7 -38
- package/dist/ActionsDropdown.js +2 -2
- package/dist/ActionsDropdown.js.map +1 -1
- package/dist/ActionsDropdown.vue.d.ts +0 -74
- package/dist/AddressSelect.js +56 -60
- package/dist/AddressSelect.js.map +1 -1
- package/dist/AddressSelect.vue.d.ts +8 -65
- package/dist/Alert.js.map +1 -1
- package/dist/Alert.vue.d.ts +4 -41
- package/dist/AppNavigationItem.js.map +1 -1
- package/dist/AppNavigationItem.vue.d.ts +5 -32
- package/dist/AppSidebar.js.map +1 -1
- package/dist/AppSidebar.vue.d.ts +8 -35
- package/dist/AppTopbar.js +1 -1
- package/dist/AppTopbar.js.map +1 -1
- package/dist/AppTopbar.vue.d.ts +4 -33
- package/dist/Avatar.js.map +1 -1
- package/dist/Avatar.vue.d.ts +5 -44
- 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 +6 -55
- package/dist/Box.vue.d.ts +3 -36
- 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 +5 -50
- package/dist/ButtonGroup.js +33 -37
- package/dist/ButtonGroup.js.map +1 -1
- package/dist/ButtonGroup.vue.d.ts +6 -39
- package/dist/Card.js.map +1 -1
- package/dist/Card.vue.d.ts +5 -32
- 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 +2 -15
- package/dist/CardMedia.js.map +1 -1
- package/dist/CardMedia.vue.d.ts +2 -15
- package/dist/Carousel.js +66 -72
- 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 +8 -53
- package/dist/ChevronToggle.vue.d.ts +7 -34
- 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 +10 -52
- package/dist/ConfirmationCodeInput.js +40 -44
- package/dist/ConfirmationCodeInput.js.map +1 -1
- package/dist/ConfirmationCodeInput.vue.d.ts +8 -43
- package/dist/ContextSwitcher.js.map +1 -1
- package/dist/ContextSwitcher.vue.d.ts +6 -41
- package/dist/Copy.js.map +1 -1
- package/dist/Copy.vue.d.ts +3 -34
- package/dist/CurrencyInput.js +20 -21
- package/dist/CurrencyInput.js.map +1 -1
- package/dist/CurrencyInput.vue.d.ts +125 -46
- package/dist/CustomRender.js.map +1 -1
- package/dist/DataView.js +94 -96
- package/dist/DataView.js.map +1 -1
- package/dist/DataView.keys-aSOnA4AD.js.map +1 -1
- package/dist/DataView.vue.d.ts +15 -57
- package/dist/DataViewFilters.js +127 -139
- package/dist/DataViewFilters.js.map +1 -1
- package/dist/DataViewFilters.keys-BLu07FiP.js.map +1 -1
- package/dist/DataViewFilters.vue.d.ts +9 -54
- package/dist/DataViewSortButton.js +2 -2
- package/dist/DataViewSortButton.js.map +1 -1
- package/dist/DataViewSortButton.vue.d.ts +3 -30
- package/dist/DataViewToolbar.js +146 -71
- package/dist/DataViewToolbar.js.map +1 -1
- package/dist/DataViewToolbar.vue.d.ts +106 -40
- package/dist/DatePicker.js +4524 -4636
- package/dist/DatePicker.js.map +1 -1
- package/dist/DatePicker.vue.d.ts +32 -81
- package/dist/DescriptionList.js.map +1 -1
- package/dist/DescriptionList.vue.d.ts +3 -32
- 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 +10 -53
- package/dist/Divider.js.map +1 -1
- package/dist/Dropdown.js +89 -95
- package/dist/Dropdown.js.map +1 -1
- package/dist/Dropdown.vue.d.ts +12 -48
- package/dist/EmptyState.js +1 -1
- package/dist/EmptyState.js.map +1 -1
- package/dist/EmptyState.vue.d.ts +5 -62
- package/dist/Expand.vue.d.ts +10 -40
- package/dist/Expand.vue_vue_type_script_setup_true_lang-CiONJfAp.js.map +1 -1
- package/dist/Field.vue.d.ts +4 -53
- package/dist/Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js.map +1 -1
- package/dist/FileUpload.js +72 -74
- package/dist/FileUpload.js.map +1 -1
- package/dist/FileUpload.vue.d.ts +10 -44
- package/dist/FilterChip.js.map +1 -1
- package/dist/FilterChip.vue.d.ts +6 -41
- package/dist/FilterDrawerItem.js +21 -21
- package/dist/FilterDrawerItem.js.map +1 -1
- package/dist/FilterDrawerItem.vue.d.ts +6 -23
- package/dist/FilterDropdown.js +63 -69
- package/dist/FilterDropdown.js.map +1 -1
- package/dist/FilterDropdown.vue.d.ts +122 -35
- package/dist/FilterSelect.js.map +1 -1
- package/dist/FilterSelect.vue.d.ts +4 -31
- package/dist/Filters.js +157 -164
- package/dist/Filters.js.map +1 -1
- package/dist/Filters.vue.d.ts +0 -2190
- package/dist/HttpError.js +7 -7
- package/dist/HttpError.js.map +1 -1
- package/dist/HttpError.vue.d.ts +4 -41
- package/dist/Icon.js +16 -15
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.vue.d.ts +4 -37
- package/dist/IconLabel.js.map +1 -1
- package/dist/IconLabel.vue.d.ts +6 -41
- package/dist/Illustration.js +2 -2
- package/dist/Illustration.vue.d.ts +3 -42
- package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js → Illustration.vue_vue_type_script_setup_true_lang-BVzzNsRt.js} +11 -11
- package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js.map → Illustration.vue_vue_type_script_setup_true_lang-BVzzNsRt.js.map} +1 -1
- package/dist/Image.js +2 -2
- package/dist/Image.vue.d.ts +5 -40
- package/dist/{Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js → Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js} +37 -41
- package/dist/{Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js.map → Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js.map} +1 -1
- package/dist/InlineEdit.js.map +1 -1
- package/dist/InlineEdit.vue.d.ts +126 -47
- package/dist/Input.js.map +1 -1
- package/dist/Input.vue.d.ts +12 -45
- package/dist/InputOptions.js +66 -69
- package/dist/InputOptions.js.map +1 -1
- package/dist/InputOptions.vue.d.ts +10 -55
- package/dist/IntegrationIcon.js +7 -7
- package/dist/IntegrationIcon.js.map +1 -1
- package/dist/IntegrationIcon.vue.d.ts +3 -36
- package/dist/Label.vue.d.ts +3 -42
- 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 +3 -30
- package/dist/ListItem.js.map +1 -1
- package/dist/ListItem.vue.d.ts +0 -294
- package/dist/ListItemCell.js.map +1 -1
- package/dist/ListItemCell.vue.d.ts +0 -21
- package/dist/ListView.js +4 -7
- package/dist/ListView.js.map +1 -1
- package/dist/ListView.types.d.ts +0 -29
- package/dist/ListView.vue.d.ts +0 -5496
- 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 +6 -41
- package/dist/{Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js → Logo.vue_vue_type_script_setup_true_lang-Y3iE9utm.js} +17 -17
- package/dist/Logo.vue_vue_type_script_setup_true_lang-Y3iE9utm.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-B4jpNe7x.js +12 -0
- package/dist/{MenusPlugin-Bk6UW6o9.js.map → MenusPlugin-B4jpNe7x.js.map} +1 -1
- package/dist/Metric.js.map +1 -1
- package/dist/Metric.vue.d.ts +3 -34
- package/dist/Modal.js +62 -64
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.vue.d.ts +13 -60
- package/dist/Modals.js +17 -18
- 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.keys-CEsrW2f0.js.map +1 -1
- package/dist/Module.types-B1FfGGac.js.map +1 -1
- package/dist/Module.vue.d.ts +2 -29
- 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 +5 -39
- package/dist/MoreActions.js +489 -0
- package/dist/MoreActions.js.map +1 -0
- package/dist/MoreActions.vue.d.ts +203 -0
- package/dist/ObfuscateText.js.map +1 -1
- package/dist/ObfuscateText.vue.d.ts +3 -40
- package/dist/PageContent.js.map +1 -1
- package/dist/PageContent.vue.d.ts +3 -30
- package/dist/PageHeader.js.map +1 -1
- package/dist/PageHeader.vue.d.ts +6 -35
- package/dist/PageNavigation.js +50 -50
- package/dist/PageNavigation.js.map +1 -1
- package/dist/PageNavigation.vue.d.ts +7 -36
- package/dist/Paginate.js.map +1 -1
- package/dist/Paginate.vue.d.ts +5 -40
- package/dist/PlaidLink.js.map +1 -1
- package/dist/PlaidLink.vue.d.ts +12 -49
- package/dist/QuickAction.js.map +1 -1
- package/dist/QuickAction.vue.d.ts +3 -16
- package/dist/Radio.js.map +1 -1
- package/dist/Radio.vue.d.ts +0 -93
- package/dist/RadioGroup.js +94 -101
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.vue.d.ts +116 -42
- package/dist/RadioNew.js +96 -99
- package/dist/RadioNew.js.map +1 -1
- package/dist/RadioNew.vue.d.ts +7 -48
- package/dist/RangeInput.js.map +1 -1
- package/dist/RangeInput.vue.d.ts +1 -1
- package/dist/SearchBar.js +38 -39
- package/dist/SearchBar.js.map +1 -1
- package/dist/SearchBar.vue.d.ts +127 -44
- package/dist/SectionHeader.js.map +1 -1
- package/dist/SectionHeader.vue.d.ts +6 -37
- package/dist/Select.js +171 -183
- package/dist/Select.js.map +1 -1
- package/dist/Select.vue.d.ts +23 -102
- package/dist/SelectStatus.js +38 -38
- package/dist/SelectStatus.js.map +1 -1
- package/dist/SelectStatus.vue.d.ts +227 -47
- package/dist/Skeleton.js.map +1 -1
- package/dist/Skeleton.vue.d.ts +3 -34
- package/dist/Step.js +44 -44
- package/dist/Step.js.map +1 -1
- package/dist/Step.vue.d.ts +4 -43
- package/dist/Stepper.js.map +1 -1
- package/dist/Stepper.vue.d.ts +9 -44
- package/dist/Switch.js.map +1 -1
- package/dist/Switch.vue.d.ts +8 -47
- package/dist/Tab.js +9 -9
- package/dist/Tab.js.map +1 -1
- package/dist/Tab.vue.d.ts +2 -15
- package/dist/TabPanel.js.map +1 -1
- package/dist/TabPanel.vue.d.ts +3 -30
- package/dist/Table.js +53 -59
- package/dist/Table.js.map +1 -1
- package/dist/Table.keys-LHQf6FEH.js.map +1 -1
- package/dist/Table.vue.d.ts +3 -50
- package/dist/TableCell.js +1 -1
- package/dist/TableCell.js.map +1 -1
- package/dist/TableCell.vue.d.ts +3 -32
- package/dist/TableHeaderCell.js +1 -1
- package/dist/TableHeaderCell.js.map +1 -1
- package/dist/TableHeaderCell.vue.d.ts +3 -30
- package/dist/TableHeaderRow.js +47 -45
- package/dist/TableHeaderRow.js.map +1 -1
- package/dist/TableHeaderRow.vue.d.ts +5 -34
- package/dist/TableRow.js +60 -61
- package/dist/TableRow.js.map +1 -1
- package/dist/TableRow.vue.d.ts +7 -48
- package/dist/Tabs.js +2 -2
- package/dist/Tabs.vue.d.ts +4 -31
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-BlJVDr7o.js +78 -0
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-BlJVDr7o.js.map +1 -0
- package/dist/TextEditor.js +2414 -2420
- package/dist/TextEditor.js.map +1 -1
- package/dist/TextEditor.vue.d.ts +9 -40
- package/dist/Textarea.js +69 -69
- package/dist/Textarea.js.map +1 -1
- package/dist/Textarea.vue.d.ts +9 -44
- 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.keys-EJ4qFNhx.js.map +1 -1
- package/dist/ThumbnailGroup.vue.d.ts +26 -22
- package/dist/Timeline.js.map +1 -1
- package/dist/Timeline.vue.d.ts +3 -32
- 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 +3 -30
- package/dist/Toasts.js.map +1 -1
- package/dist/ToastsPlugin.js +11 -11
- package/dist/ToastsPlugin.js.map +1 -1
- package/dist/Tooltip.js +29 -30
- package/dist/Tooltip.js.map +1 -1
- package/dist/Tooltip.vue.d.ts +11 -43
- package/dist/colors-DDDVvqfQ.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/directives/autofocus.js.map +1 -1
- package/dist/directives/clickoutside.js.map +1 -1
- package/dist/directives/observe.js.map +1 -1
- package/dist/directives/sticky.js.map +1 -1
- package/dist/directives/tooltip.js +3 -3
- package/dist/directives/tooltip.js.map +1 -1
- package/dist/directives/viewable.js +39 -44
- package/dist/directives/viewable.js.map +1 -1
- package/dist/{floating-ui.vue-pzUuloyX.js → floating-ui.vue-CL01Y9ER.js} +2 -2
- package/dist/{floating-ui.vue-pzUuloyX.js.map → floating-ui.vue-CL01Y9ER.js.map} +1 -1
- package/dist/formatDateTime-DG7kBc2T.js +1414 -0
- package/dist/{formatDateTime-Dz8bXV0R.js.map → formatDateTime-DG7kBc2T.js.map} +1 -1
- package/dist/index-D6bxWkZ1.js.map +1 -1
- package/dist/index-XZqpB2_R.js +294 -0
- package/dist/{index-ConQ3o31.js.map → index-XZqpB2_R.js.map} +1 -1
- package/dist/index.js +99 -104
- package/dist/index.js.map +1 -1
- package/dist/isDefined-DzVx0B6k.js.map +1 -1
- package/dist/keys-BEdEsanp.js.map +1 -1
- package/dist/keys-C8Zfr_By.js.map +1 -1
- package/dist/locale.js.map +1 -1
- package/dist/misc-CHQs-G03.js.map +1 -1
- package/dist/obfuscateText.d.ts +1 -1
- package/dist/parseISO-wlfIB_QJ.js.map +1 -1
- package/dist/searchFuzzy-DBDE6jkd.js +408 -0
- package/dist/{searchFuzzy-DRasJ33G.js.map → searchFuzzy-DBDE6jkd.js.map} +1 -1
- package/dist/statusLevels-D8EgtE_L.js.map +1 -1
- package/dist/storage.js.map +1 -1
- package/dist/tailwind-base.d.ts +18 -0
- package/dist/tailwind-base.js +19 -9
- package/dist/tailwind-base.js.map +1 -1
- package/dist/toTimeZone-Coq1oPTt.js.map +1 -1
- package/dist/useConfirmBeforeClosing.js.map +1 -1
- package/dist/useDialog.d.ts +2 -2
- package/dist/useDialog.js +21 -25
- package/dist/useDialog.js.map +1 -1
- package/dist/useGoogleMaps.js +108 -110
- package/dist/useGoogleMaps.js.map +1 -1
- package/dist/useMediaQuery.d.ts +0 -6
- package/dist/useMediaQuery.js +11 -15
- package/dist/useMediaQuery.js.map +1 -1
- package/dist/useModals.d.ts +1 -1
- package/dist/useModals.js.map +1 -1
- package/dist/usePaginationStats-d_q39naC.js.map +1 -1
- package/dist/usePlaidLink.js +20 -27
- package/dist/usePlaidLink.js.map +1 -1
- package/dist/useScriptTag.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 +54 -63
- package/dist/useSortable.js.map +1 -1
- package/dist/useStepper.d.ts +2 -2
- package/dist/useStepper.js +36 -40
- package/dist/useStepper.js.map +1 -1
- package/dist/useToasts.js +23 -23
- package/dist/useToasts.js.map +1 -1
- package/dist/useValidation.js +96 -100
- 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/colorScheme.js +2 -2
- package/dist/utils/colorScheme.js.map +1 -1
- package/dist/utils/createQueryString.js.map +1 -1
- package/dist/utils/createValidDate.js.map +1 -1
- package/dist/utils/formatDateTime.js +1 -1
- package/dist/utils/getContrastingTextColor.js.map +1 -1
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/normalizeDate.js.map +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 +12 -13
- package/tailwind-base.ts +12 -1
- package/types/vite.d.ts +7 -0
- package/types/vitest.d.ts +7 -0
- package/dist/Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js.map +0 -1
- package/dist/MenusPlugin-Bk6UW6o9.js +0 -12
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-CmnBP4i1.js +0 -159
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-CmnBP4i1.js.map +0 -1
- package/dist/formatDateTime-Dz8bXV0R.js +0 -1418
- package/dist/index-ConQ3o31.js +0 -128
- package/dist/searchFuzzy-DRasJ33G.js +0 -409
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 a, watch as b, provide as W, createElementBlock as G, openBlock as k, 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 V } 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 y(e) {
|
|
8
|
+
const o = e[0] === "-" ? "desc" : "asc";
|
|
9
|
+
return { id: o === "asc" ? e : e.slice(1), order: o };
|
|
10
10
|
}
|
|
11
|
-
function et({ id:
|
|
12
|
-
return `${o === "desc" ? "-" : ""}${
|
|
11
|
+
function et({ id: e, order: o }) {
|
|
12
|
+
return `${o === "desc" ? "-" : ""}${e}`;
|
|
13
13
|
}
|
|
14
|
-
function at({ newId:
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
17
|
-
return et({ id:
|
|
14
|
+
function at({ newId: e, newOrder: o, oldId: d, oldOrder: t }) {
|
|
15
|
+
if (e) {
|
|
16
|
+
if (e !== d)
|
|
17
|
+
return et({ id: e, order: o || "asc" });
|
|
18
18
|
if (!o && !t)
|
|
19
|
-
return
|
|
19
|
+
return e;
|
|
20
20
|
if (!(!o && t === "desc")) {
|
|
21
21
|
if (!o && t === "asc")
|
|
22
|
-
return `-${
|
|
22
|
+
return `-${e}`;
|
|
23
23
|
if (o === "asc" && !t)
|
|
24
|
-
return
|
|
24
|
+
return e;
|
|
25
25
|
if (!(o === "asc" && t === "asc")) {
|
|
26
26
|
if (o === "asc" && t === "desc")
|
|
27
|
-
return
|
|
27
|
+
return e;
|
|
28
28
|
if (o === "desc" && !t)
|
|
29
|
-
return `-${
|
|
29
|
+
return `-${e}`;
|
|
30
30
|
if (!(o === "desc" && t === "desc") && o === "desc" && t === "asc")
|
|
31
|
-
return `-${
|
|
31
|
+
return `-${e}`;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
var nt = /* @__PURE__ */ ((
|
|
36
|
+
var nt = /* @__PURE__ */ ((e) => (e.Table = "table", e))(nt || {});
|
|
37
37
|
const ot = /* @__PURE__ */ R({
|
|
38
38
|
__name: "DataView",
|
|
39
39
|
props: {
|
|
@@ -51,136 +51,134 @@ 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 =
|
|
56
|
-
var e;
|
|
54
|
+
setup(e, { expose: o, emit: d }) {
|
|
55
|
+
const t = e, c = d, I = U(), S = l(null), z = J(V.key, V.defaults), $ = a(() => {
|
|
57
56
|
if (t.variant)
|
|
58
57
|
return t.variant;
|
|
59
|
-
if (
|
|
58
|
+
if (z.variant?.value === "table")
|
|
60
59
|
return "table";
|
|
61
|
-
}),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}, C = function({ shouldEmit: e } = {}) {
|
|
60
|
+
}), _ = a(() => z.variant !== void 0), u = l(1), E = a(() => !t.disablePagination && t.totalDataCount > 0), N = a(() => t.totalDataCount === 1 / 0 && !t.hasNextPage), f = a(() => Math.ceil(t.totalDataCount / t.pageSize)), i = function(n, { shouldEmit: r } = {}) {
|
|
61
|
+
u.value = n, r && (m(), c("update:currentPage", n, t.pageSize)), Number(S.value?.getBoundingClientRect().top) < 0 && S.value?.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
62
|
+
}, h = function({ shouldEmit: n } = {}) {
|
|
65
63
|
const r = Math.max(u.value - 1, 1);
|
|
66
|
-
i(r, { shouldEmit:
|
|
67
|
-
},
|
|
68
|
-
const r = Math.min(u.value + 1,
|
|
69
|
-
i(r, { shouldEmit:
|
|
64
|
+
i(r, { shouldEmit: n });
|
|
65
|
+
}, P = function({ shouldEmit: n } = {}) {
|
|
66
|
+
const r = Math.min(u.value + 1, f.value);
|
|
67
|
+
i(r, { shouldEmit: n });
|
|
70
68
|
};
|
|
71
|
-
|
|
69
|
+
b(
|
|
72
70
|
() => t.currentPage,
|
|
73
71
|
() => {
|
|
74
72
|
i(t.currentPage);
|
|
75
73
|
},
|
|
76
74
|
{ immediate: !0 }
|
|
77
75
|
);
|
|
78
|
-
const s = l(void 0),
|
|
79
|
-
() => s.value ?
|
|
80
|
-
),
|
|
81
|
-
() => s.value ?
|
|
82
|
-
),
|
|
83
|
-
const { id:
|
|
84
|
-
s.value =
|
|
76
|
+
const s = l(void 0), x = a(
|
|
77
|
+
() => s.value ? y(s.value).id : void 0
|
|
78
|
+
), B = a(
|
|
79
|
+
() => s.value ? y(s.value).order : void 0
|
|
80
|
+
), p = function(n, { sortOrder: r, shouldEmit: D } = {}) {
|
|
81
|
+
const { id: A, order: F } = y(s.value || ""), M = at({ newId: n, newOrder: r, oldId: A, oldOrder: F });
|
|
82
|
+
s.value = M, i(1), D && (m(), c("update:currentSort", M));
|
|
85
83
|
};
|
|
86
|
-
|
|
84
|
+
b(
|
|
87
85
|
() => t.currentSort,
|
|
88
86
|
() => {
|
|
89
|
-
|
|
87
|
+
p(t.currentSort);
|
|
90
88
|
},
|
|
91
89
|
{ immediate: !0 }
|
|
92
90
|
);
|
|
93
|
-
const
|
|
94
|
-
|
|
91
|
+
const v = l(""), L = l(!1), T = l(!1), g = function(n, { shouldEmit: r } = {}) {
|
|
92
|
+
v.value = n || "", i(1), r && (m(), c("update:currentSearch", n));
|
|
95
93
|
};
|
|
96
|
-
|
|
94
|
+
b(
|
|
97
95
|
() => t.currentSearch,
|
|
98
96
|
() => {
|
|
99
|
-
|
|
97
|
+
g(t.currentSearch);
|
|
100
98
|
},
|
|
101
99
|
{ immediate: !0 }
|
|
102
100
|
);
|
|
103
|
-
const
|
|
104
|
-
|
|
101
|
+
const C = l({}), j = function(n, { shouldEmit: r } = {}) {
|
|
102
|
+
C.value = n, i(1), r && (m(), c("update:currentFilters", n));
|
|
105
103
|
};
|
|
106
|
-
function
|
|
107
|
-
|
|
104
|
+
function m() {
|
|
105
|
+
c("update", {
|
|
108
106
|
page: u.value,
|
|
109
107
|
pageSize: t.pageSize,
|
|
110
108
|
ordering: s.value,
|
|
111
|
-
search:
|
|
112
|
-
filters: X(
|
|
109
|
+
search: v.value,
|
|
110
|
+
filters: X(C.value)
|
|
113
111
|
});
|
|
114
112
|
}
|
|
115
113
|
return W(
|
|
116
114
|
O.key,
|
|
117
115
|
Object.freeze({
|
|
118
116
|
// Pagination
|
|
119
|
-
currentPage:
|
|
120
|
-
isPaginationEnabled:
|
|
121
|
-
isPaginateNextDisabled:
|
|
122
|
-
pageCount:
|
|
123
|
-
pageSize:
|
|
124
|
-
totalDataCount:
|
|
117
|
+
currentPage: a(() => u.value),
|
|
118
|
+
isPaginationEnabled: E,
|
|
119
|
+
isPaginateNextDisabled: N,
|
|
120
|
+
pageCount: f,
|
|
121
|
+
pageSize: a(() => t.pageSize),
|
|
122
|
+
totalDataCount: a(() => t.totalDataCount),
|
|
125
123
|
setPage: i,
|
|
126
|
-
goPrevPage:
|
|
127
|
-
goNextPage:
|
|
124
|
+
goPrevPage: h,
|
|
125
|
+
goNextPage: P,
|
|
128
126
|
// Sorting
|
|
129
|
-
currentSortId:
|
|
130
|
-
currentSortOrder:
|
|
131
|
-
updateCurrentSort:
|
|
127
|
+
currentSortId: x,
|
|
128
|
+
currentSortOrder: B,
|
|
129
|
+
updateCurrentSort: p,
|
|
132
130
|
// Search
|
|
133
|
-
currentSearch:
|
|
134
|
-
updateCurrentSearch:
|
|
131
|
+
currentSearch: a(() => v.value),
|
|
132
|
+
updateCurrentSearch: g,
|
|
135
133
|
// Miscellaneous
|
|
136
|
-
density:
|
|
137
|
-
hasToolbar:
|
|
138
|
-
isEmpty:
|
|
139
|
-
isSelectable:
|
|
140
|
-
isLoading:
|
|
141
|
-
isWithinModule:
|
|
142
|
-
variant:
|
|
134
|
+
density: a(() => t.density),
|
|
135
|
+
hasToolbar: L,
|
|
136
|
+
isEmpty: a(() => t.data.length === 0),
|
|
137
|
+
isSelectable: T,
|
|
138
|
+
isLoading: a(() => t.isLoading),
|
|
139
|
+
isWithinModule: _,
|
|
140
|
+
variant: $
|
|
143
141
|
})
|
|
144
142
|
), o({
|
|
145
|
-
page:
|
|
146
|
-
pageSize:
|
|
143
|
+
page: a(() => u.value),
|
|
144
|
+
pageSize: a(() => t.pageSize),
|
|
147
145
|
setPage: i,
|
|
148
|
-
goPrevPage:
|
|
149
|
-
goNextPage:
|
|
150
|
-
ordering:
|
|
151
|
-
updateCurrentSort:
|
|
152
|
-
search:
|
|
153
|
-
updateCurrentSearch:
|
|
154
|
-
filters:
|
|
155
|
-
updateCurrentFilters:
|
|
156
|
-
}), (
|
|
146
|
+
goPrevPage: h,
|
|
147
|
+
goNextPage: P,
|
|
148
|
+
ordering: a(() => s.value),
|
|
149
|
+
updateCurrentSort: p,
|
|
150
|
+
search: a(() => v.value),
|
|
151
|
+
updateCurrentSearch: g,
|
|
152
|
+
filters: a(() => C.value),
|
|
153
|
+
updateCurrentFilters: j
|
|
154
|
+
}), (n, r) => (k(), G("div", {
|
|
157
155
|
ref_key: "rootRef",
|
|
158
|
-
ref:
|
|
156
|
+
ref: S,
|
|
159
157
|
class: "stash-data-view tw-relative",
|
|
160
158
|
"data-test": "stash-data-view"
|
|
161
159
|
}, [
|
|
162
|
-
Z(
|
|
160
|
+
Z(n.$slots, "default", {
|
|
163
161
|
currentPage: u.value,
|
|
164
|
-
currentSortId:
|
|
165
|
-
currentSortOrder:
|
|
166
|
-
data:
|
|
167
|
-
goPrevPage:
|
|
168
|
-
goNextPage:
|
|
169
|
-
pageCount:
|
|
162
|
+
currentSortId: x.value,
|
|
163
|
+
currentSortOrder: B.value,
|
|
164
|
+
data: n.data,
|
|
165
|
+
goPrevPage: h,
|
|
166
|
+
goNextPage: P,
|
|
167
|
+
pageCount: f.value,
|
|
170
168
|
setPage: i,
|
|
171
169
|
totalDataCount: t.totalDataCount,
|
|
172
|
-
updateCurrentSort:
|
|
173
|
-
updateCurrentSearch:
|
|
170
|
+
updateCurrentSort: p,
|
|
171
|
+
updateCurrentSearch: g
|
|
174
172
|
}),
|
|
175
|
-
|
|
173
|
+
E.value && !_.value && f.value > 1 && !t.hideBottomPagination ? (k(), q(Y, {
|
|
176
174
|
key: 0,
|
|
177
|
-
class: K(["tw-mt-6", Q(
|
|
175
|
+
class: K(["tw-mt-6", Q(I).paginate]),
|
|
178
176
|
"current-page": u.value,
|
|
179
|
-
"is-next-disabled":
|
|
177
|
+
"is-next-disabled": n.isLoading || N.value,
|
|
180
178
|
"list-length": t.totalDataCount,
|
|
181
179
|
"page-size": t.pageSize,
|
|
182
180
|
variant: t.totalDataCount === 1 / 0 ? "stats" : "standard",
|
|
183
|
-
onSetPage: r[0] || (r[0] = (
|
|
181
|
+
onSetPage: r[0] || (r[0] = (D) => i(D, { shouldEmit: !0 }))
|
|
184
182
|
}, null, 8, ["class", "current-page", "is-next-disabled", "list-length", "page-size", "variant"])) : H("", !0)
|
|
185
183
|
], 512));
|
|
186
184
|
}
|
|
@@ -194,7 +192,7 @@ export {
|
|
|
194
192
|
w as DEFAULT_PAGE_SIZE,
|
|
195
193
|
nt as DataViewVariant,
|
|
196
194
|
vt as default,
|
|
197
|
-
|
|
195
|
+
y as deserializeSortValue,
|
|
198
196
|
at as getNextSort,
|
|
199
197
|
et as serializeSortValue
|
|
200
198
|
};
|
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 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;AAGlC,SAAA,EAAE,IAFEC,MAAU,QAAQD,IAAOA,EAAK,MAAM,CAAC,GAEnC,OAAAC,EAAM;AACrB;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;AAS/D,QAAA,CAACA,KAAY,CAACE;AACT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AMZ,EAAM,QAAQ;AAAA,QACvC,gBAAgBY,EAAS,MAAMZ,EAAM,cAAc;AAAA,QACnD,SAAAmB;AAAA,QACA,YAAAK;AAAA,QACA,YAAAC;AAAA;AAAA,QAGA,eAAeG;AAAA,QACf,kBAAkBC;AAAA,QAClB,mBAAAC;AAAA;AAAA,QAGA,eAAelB,EAAS,MAAMsB,EAAe,KAAK;AAAA,QAClD,qBAAAG;AAAA;AAAA,QAGA,SAASzB,EAAS,MAAMZ,EAAM,OAAO;AAAA,QACrC,YAAAmC;AAAA,QACA,SAASvB,EAAS,MAAMZ,EAAM,KAAK,WAAW,CAAC;AAAA,QAC/C,cAAAoC;AAAA,QACA,WAAWxB,EAAS,MAAMZ,EAAM,SAAS;AAAA,QACzC,gBAAAc;AAAA,QACA,SAASH;AAAA,MACV,CAAA;AAAA,IACH,GAEakC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
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,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;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AAM;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataView.keys-aSOnA4AD.js","sources":["../src/components/DataView/DataView.constants.ts","../src/components/DataView/DataView.keys.ts"],"sourcesContent":["export const DEFAULT_PAGE_SIZE = 12;\n","import { computed, ref } from 'vue';\n\nimport { InjectionWithDefaults } from '../../../types/utils';\nimport { DEFAULT_PAGE_SIZE } from './DataView.constants';\nimport { DataViewInjection } from './DataView.types';\n\n// See: https://vuejs.org/guide/typescript/composition-api.html#typing-provide-inject\n\n/**\n * Miscellaneous data that is not related to pagination, sorting, or searching.\n * TODO: merge all DataView injections into one. https://leaflink.atlassian.net/browse/STASH-507\n */\nexport const DATA_VIEW_INJECTION: InjectionWithDefaults<DataViewInjection> = Object.freeze({\n key: Symbol('DATA_VIEW_INJECTION_KEY'),\n defaults: Object.freeze({\n // Pagination\n currentPage: computed(() => 1),\n isPaginateNextDisabled: computed(() => false),\n isPaginationEnabled: computed(() => false),\n pageCount: computed(() => 1),\n pageSize: computed(() => DEFAULT_PAGE_SIZE),\n totalDataCount: computed(() => 0),\n setPage() {},\n goPrevPage() {},\n goNextPage() {},\n\n // Sorting\n currentSortId: computed(() => undefined),\n currentSortOrder: computed(() => undefined),\n updateCurrentSort() {},\n\n // Search\n currentSearch: computed(() => ''),\n updateCurrentSearch() {},\n\n // Miscellanous\n density: computed(() => undefined),\n isEmpty: computed(() => false),\n isLoading: computed(() => false),\n isSelectable: ref(false),\n isWithinModule: computed(() => false),\n variant: computed(() => undefined),\n }),\n});\n"],"names":["DEFAULT_PAGE_SIZE","DATA_VIEW_INJECTION","computed","ref"],"mappings":";AAAO,MAAMA,IAAoB,ICYpBC,IAAgE,OAAO,OAAO;AAAA,EACzF,KAAK,OAAO,yBAAyB;AAAA,EACrC,UAAU,OAAO,OAAO;AAAA;AAAA,IAEtB,aAAaC,EAAS,MAAM,CAAC;AAAA,IAC7B,wBAAwBA,EAAS,MAAM,EAAK;AAAA,IAC5C,qBAAqBA,EAAS,MAAM,EAAK;AAAA,IACzC,WAAWA,EAAS,MAAM,CAAC;AAAA,IAC3B,UAAUA,EAAS,MAAMF,CAAiB;AAAA,IAC1C,gBAAgBE,EAAS,MAAM,CAAC;AAAA,IAChC,UAAU;AAAA,IAAC;AAAA,IACX,aAAa;AAAA,IAAC;AAAA,IACd,aAAa;AAAA,IAAC;AAAA;AAAA,IAGd,eAAeA,EAAS,MAAA;AAAA,KAAe;AAAA,IACvC,kBAAkBA,EAAS,MAAA;AAAA,KAAe;AAAA,IAC1C,oBAAoB;AAAA,IAAC;AAAA;AAAA,IAGrB,eAAeA,EAAS,MAAM,EAAE;AAAA,IAChC,sBAAsB;AAAA,IAAC;AAAA;AAAA,IAGvB,SAASA,EAAS,MAAA;AAAA,KAAe;AAAA,IACjC,SAASA,EAAS,MAAM,EAAK;AAAA,IAC7B,WAAWA,EAAS,MAAM,EAAK;AAAA,IAC/B,cAAcC,EAAI,EAAK;AAAA,IACvB,gBAAgBD,EAAS,MAAM,EAAK;AAAA,IACpC,SAASA,EAAS;KAAe;AAAA,
|
|
1
|
+
{"version":3,"file":"DataView.keys-aSOnA4AD.js","sources":["../src/components/DataView/DataView.constants.ts","../src/components/DataView/DataView.keys.ts"],"sourcesContent":["export const DEFAULT_PAGE_SIZE = 12;\n","import { computed, ref } from 'vue';\n\nimport { InjectionWithDefaults } from '../../../types/utils';\nimport { DEFAULT_PAGE_SIZE } from './DataView.constants';\nimport { DataViewInjection } from './DataView.types';\n\n// See: https://vuejs.org/guide/typescript/composition-api.html#typing-provide-inject\n\n/**\n * Miscellaneous data that is not related to pagination, sorting, or searching.\n * TODO: merge all DataView injections into one. https://leaflink.atlassian.net/browse/STASH-507\n */\nexport const DATA_VIEW_INJECTION: InjectionWithDefaults<DataViewInjection> = Object.freeze({\n key: Symbol('DATA_VIEW_INJECTION_KEY'),\n defaults: Object.freeze({\n // Pagination\n currentPage: computed(() => 1),\n isPaginateNextDisabled: computed(() => false),\n isPaginationEnabled: computed(() => false),\n pageCount: computed(() => 1),\n pageSize: computed(() => DEFAULT_PAGE_SIZE),\n totalDataCount: computed(() => 0),\n setPage() {},\n goPrevPage() {},\n goNextPage() {},\n\n // Sorting\n currentSortId: computed(() => undefined),\n currentSortOrder: computed(() => undefined),\n updateCurrentSort() {},\n\n // Search\n currentSearch: computed(() => ''),\n updateCurrentSearch() {},\n\n // Miscellanous\n density: computed(() => undefined),\n isEmpty: computed(() => false),\n isLoading: computed(() => false),\n isSelectable: ref(false),\n isWithinModule: computed(() => false),\n variant: computed(() => undefined),\n }),\n});\n"],"names":["DEFAULT_PAGE_SIZE","DATA_VIEW_INJECTION","computed","ref"],"mappings":";AAAO,MAAMA,IAAoB,ICYpBC,IAAgE,OAAO,OAAO;AAAA,EACzF,KAAK,OAAO,yBAAyB;AAAA,EACrC,UAAU,OAAO,OAAO;AAAA;AAAA,IAEtB,aAAaC,EAAS,MAAM,CAAC;AAAA,IAC7B,wBAAwBA,EAAS,MAAM,EAAK;AAAA,IAC5C,qBAAqBA,EAAS,MAAM,EAAK;AAAA,IACzC,WAAWA,EAAS,MAAM,CAAC;AAAA,IAC3B,UAAUA,EAAS,MAAMF,CAAiB;AAAA,IAC1C,gBAAgBE,EAAS,MAAM,CAAC;AAAA,IAChC,UAAU;AAAA,IAAC;AAAA,IACX,aAAa;AAAA,IAAC;AAAA,IACd,aAAa;AAAA,IAAC;AAAA;AAAA,IAGd,eAAeA,EAAS,MAAA;AAAA,KAAe;AAAA,IACvC,kBAAkBA,EAAS,MAAA;AAAA,KAAe;AAAA,IAC1C,oBAAoB;AAAA,IAAC;AAAA;AAAA,IAGrB,eAAeA,EAAS,MAAM,EAAE;AAAA,IAChC,sBAAsB;AAAA,IAAC;AAAA;AAAA,IAGvB,SAASA,EAAS,MAAA;AAAA,KAAe;AAAA,IACjC,SAASA,EAAS,MAAM,EAAK;AAAA,IAC7B,WAAWA,EAAS,MAAM,EAAK;AAAA,IAC/B,cAAcC,EAAI,EAAK;AAAA,IACvB,gBAAgBD,EAAS,MAAM,EAAK;AAAA,IACpC,SAASA,EAAS;KAAe;AAAA,EAAA,CAClC;AACH,CAAC;"}
|
package/dist/DataView.vue.d.ts
CHANGED
|
@@ -2,33 +2,10 @@ 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';
|
|
6
5
|
import { InjectionKey } from 'vue';
|
|
7
|
-
import { PropType } from 'vue';
|
|
8
6
|
import { PublicProps } from 'vue';
|
|
9
7
|
import { Ref } from 'vue';
|
|
10
8
|
|
|
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
|
-
|
|
32
9
|
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
33
10
|
new (): {
|
|
34
11
|
$slots: S;
|
|
@@ -120,6 +97,9 @@ export declare interface DataViewProps {
|
|
|
120
97
|
* Controls the DataView's padding; the default value is "comfortable". On small screens, "compact" density is applied regardless of this prop's value.
|
|
121
98
|
*/
|
|
122
99
|
density?: SpacingDensities;
|
|
100
|
+
/**
|
|
101
|
+
* The number of records to display per page.
|
|
102
|
+
*/
|
|
123
103
|
pageSize?: number;
|
|
124
104
|
/**
|
|
125
105
|
* Opt-out of displaying pagination. Hides the pagination buttons and page stats.
|
|
@@ -156,19 +136,7 @@ export declare enum DataViewVariant {
|
|
|
156
136
|
|
|
157
137
|
export declare type DataViewVariants = `${DataViewVariant}`;
|
|
158
138
|
|
|
159
|
-
declare const _default: __VLS_WithTemplateSlots<DefineComponent<
|
|
160
|
-
currentPage: number;
|
|
161
|
-
currentSearch: undefined;
|
|
162
|
-
currentSort: undefined;
|
|
163
|
-
data: () => never[];
|
|
164
|
-
density: string;
|
|
165
|
-
pageSize: number;
|
|
166
|
-
disablePagination: boolean;
|
|
167
|
-
totalDataCount: number;
|
|
168
|
-
hasNextPage: undefined;
|
|
169
|
-
hideBottomPagination: boolean;
|
|
170
|
-
variant: undefined;
|
|
171
|
-
}>>, {
|
|
139
|
+
declare const _default: __VLS_WithTemplateSlots<DefineComponent<DataViewProps, {
|
|
172
140
|
page: ComputedRef<number>;
|
|
173
141
|
pageSize: ComputedRef<number>;
|
|
174
142
|
setPage: SetPage;
|
|
@@ -180,30 +148,18 @@ search: ComputedRef<string>;
|
|
|
180
148
|
updateCurrentSearch: UpdateCurrentSearch;
|
|
181
149
|
filters: ComputedRef<object>;
|
|
182
150
|
updateCurrentFilters: UpdateCurrentFilters;
|
|
183
|
-
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
184
|
-
update: (state: UpdateEvent<object>) =>
|
|
185
|
-
"update:currentFilters": (newFilters: object) =>
|
|
186
|
-
"update:
|
|
187
|
-
"update:
|
|
188
|
-
"update:
|
|
189
|
-
}, string, PublicProps, Readonly<
|
|
190
|
-
currentPage: number;
|
|
191
|
-
currentSearch: undefined;
|
|
192
|
-
currentSort: undefined;
|
|
193
|
-
data: () => never[];
|
|
194
|
-
density: string;
|
|
195
|
-
pageSize: number;
|
|
196
|
-
disablePagination: boolean;
|
|
197
|
-
totalDataCount: number;
|
|
198
|
-
hasNextPage: undefined;
|
|
199
|
-
hideBottomPagination: boolean;
|
|
200
|
-
variant: undefined;
|
|
201
|
-
}>>> & Readonly<{
|
|
151
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
152
|
+
update: (state: UpdateEvent<object>) => any;
|
|
153
|
+
"update:currentFilters": (newFilters: object) => any;
|
|
154
|
+
"update:currentSearch": (searchTerm?: string | undefined) => any;
|
|
155
|
+
"update:currentSort": (payload?: string | undefined) => any;
|
|
156
|
+
"update:currentPage": (page: number, pageSize: number) => any;
|
|
157
|
+
}, string, PublicProps, Readonly<DataViewProps> & Readonly<{
|
|
202
158
|
onUpdate?: ((state: UpdateEvent<object>) => any) | undefined;
|
|
203
159
|
"onUpdate:currentFilters"?: ((newFilters: object) => any) | undefined;
|
|
204
|
-
"onUpdate:currentPage"?: ((page: number, pageSize: number) => any) | undefined;
|
|
205
160
|
"onUpdate:currentSearch"?: ((searchTerm?: string | undefined) => any) | undefined;
|
|
206
161
|
"onUpdate:currentSort"?: ((payload?: string | undefined) => any) | undefined;
|
|
162
|
+
"onUpdate:currentPage"?: ((page: number, pageSize: number) => any) | undefined;
|
|
207
163
|
}>, {
|
|
208
164
|
data: object[];
|
|
209
165
|
variant: "table";
|
|
@@ -216,7 +172,9 @@ currentSort: string;
|
|
|
216
172
|
disablePagination: boolean;
|
|
217
173
|
hideBottomPagination: boolean;
|
|
218
174
|
hasNextPage: boolean;
|
|
219
|
-
}, {}, {}, {}, string, ComponentProvideOptions,
|
|
175
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
176
|
+
rootRef: HTMLDivElement;
|
|
177
|
+
}, HTMLDivElement>, {
|
|
220
178
|
default?(_: {
|
|
221
179
|
currentPage: number;
|
|
222
180
|
currentSortId: string | undefined;
|