@ozdao/martyrs 0.2.561 → 0.2.563
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/dist/{abac-DC2x92Pa.js → abac-DYoheWuc.js} +2 -1
- package/dist/{core.logger-VRHh-WUW.js → core.cache-DALYFDdy.js} +10 -59
- package/dist/core.logger-C3q8A9dl.js +51 -0
- package/dist/core.server.js +1 -1
- package/dist/{crud-DFFgLl09.js → crud-C7FSTUes.js} +2 -1
- package/dist/inventory.server.js +4 -3
- package/dist/{main-DQtUY5ma.js → main-CmjWiDVF.js} +2837 -2548
- package/dist/marketplace.server.js +389 -0
- package/dist/martyrs/src/components/Button/{Button.vue.js → Button.vue2.js} +3 -3
- package/dist/martyrs/src/components/Button/Button.vue2.js.map +1 -0
- package/dist/martyrs/src/components/Checkbox/Checkbox.vue.js +1 -1
- package/dist/martyrs/src/components/Checkbox/Checkbox.vue.js.map +1 -1
- package/dist/martyrs/src/components/FieldBig/FieldBig.vue.js +1 -1
- package/dist/martyrs/src/components/Menu/{Menu.vue2.js → Menu.vue.js} +2 -2
- package/dist/martyrs/src/components/Menu/Menu.vue.js.map +1 -0
- package/dist/martyrs/src/components/Select/{Select.vue2.js → Select.vue.js} +2 -2
- package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -0
- package/dist/martyrs/src/components/Spoiler/{Spoiler.vue.js → Spoiler.vue2.js} +2 -2
- package/dist/martyrs/src/components/Spoiler/Spoiler.vue2.js.map +1 -0
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditAccount.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditProfile.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
- package/dist/martyrs/src/modules/core/views/components/blocks/CardHeader.vue.js +1 -1
- package/dist/martyrs/src/modules/core/views/components/blocks/PopupAuth.vue.js +1 -1
- package/dist/martyrs/src/modules/core/views/components/blocks/PopupDateSelector.vue.js +1 -1
- package/dist/martyrs/src/modules/core/views/components/layouts/Client.vue.js +3 -6
- package/dist/martyrs/src/modules/core/views/components/layouts/Client.vue.js.map +1 -1
- package/dist/martyrs/src/modules/core/views/components/partials/Header.vue.js +3 -3
- package/dist/martyrs/src/modules/core/views/components/partials/Header.vue.js.map +1 -1
- package/dist/martyrs/src/modules/core/views/components/partials/Navigation.vue.js +1 -1
- package/dist/martyrs/src/modules/core/views/components/partials/NavigationBar.vue.js +1 -1
- package/dist/martyrs/src/modules/core/views/components/sections/Filters.vue.js +59 -171
- package/dist/martyrs/src/modules/core/views/components/sections/Filters.vue.js.map +1 -1
- package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterCheckbox.vue2.js +64 -0
- package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterCheckbox.vue2.js.map +1 -0
- package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterDateRange.vue2.js +160 -0
- package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterDateRange.vue2.js.map +1 -0
- package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterOptions.vue.js +46 -0
- package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterOptions.vue.js.map +1 -0
- package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterRange.vue.js +105 -0
- package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterRange.vue.js.map +1 -0
- package/dist/martyrs/src/modules/core/views/components/sections/filters/FiltersGroup.vue.js +166 -0
- package/dist/martyrs/src/modules/core/views/components/sections/filters/FiltersGroup.vue.js.map +1 -0
- package/dist/martyrs/src/modules/core/views/utils/vue-app-renderer.js +4 -0
- package/dist/martyrs/src/modules/core/views/utils/vue-app-renderer.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +2 -0
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/sections/EditTickets.vue.js +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.js +2 -2
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.js +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.js +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.js +2 -2
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/landing/components/sections/SectionFeatures.vue.js +1 -1
- package/dist/martyrs/src/modules/landing/components/sections/SectionFeatures.vue.js.map +1 -1
- package/dist/martyrs/src/modules/landing/components/sections/SectionGuide.vue.js +1 -1
- package/dist/martyrs/src/modules/marketplace/marketplace.client.js +5 -9
- package/dist/martyrs/src/modules/marketplace/marketplace.client.js.map +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/pages/Marketplace.vue.js +242 -0
- package/dist/martyrs/src/modules/marketplace/views/components/pages/Marketplace.vue.js.map +1 -0
- package/dist/martyrs/src/modules/marketplace/views/router/marketplace.router.js +39 -0
- package/dist/martyrs/src/modules/marketplace/views/router/marketplace.router.js.map +1 -0
- package/dist/martyrs/src/modules/marketplace/views/store/marketplace.js +65 -2
- package/dist/martyrs/src/modules/marketplace/views/store/marketplace.js.map +1 -1
- package/dist/martyrs/src/modules/music/components/cards/AlbumCard.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/cards/ArtistCardSmall.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/cards/PlaylistCard.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/cards/TrackListCard.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.js +2 -2
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.js +2 -2
- package/dist/martyrs/src/modules/music/components/forms/PlaylistForm.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/forms/SearchForm.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.js +2 -2
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Artist.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/MusicLibrary.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/SearchResults.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/TrackCreate.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/player/MusicPlayer.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormApplicationDetails.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/forms/FormSelectCustomer.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/ApplicationDetails.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/CustomerDetails.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +2 -0
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +4 -4
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +4 -2
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditAttributes.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/ProductConfigurator.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/ProductsRecommended.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.js +1 -1
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js +2 -2
- package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Map.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Spot.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.js +2 -2
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/music.server.js +4 -3
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js +1 -1
- package/dist/orders.server.js +2 -2
- package/dist/organizations.server.js +10 -215
- package/dist/products.server.js +4 -3
- package/dist/queryProcessorOrganizations-BB11WFpc.js +221 -0
- package/dist/rents.server.js +2 -1
- package/dist/style.css +10 -1
- package/dist/{web-Cyc6i_pv.js → web-cNKIl_cL.js} +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.vue +1 -1
- package/src/components/Checkbox/Checkbox.vue +1 -1
- package/src/modules/core/views/components/layouts/Client.vue +7 -11
- package/src/modules/core/views/components/partials/Header.vue +1 -1
- package/src/modules/core/views/components/sections/Filters.vue +47 -161
- package/src/modules/core/views/components/sections/filters/FilterCheckbox.vue +12 -31
- package/src/modules/core/views/components/sections/filters/FilterDateRange.vue +15 -15
- package/src/modules/core/views/components/sections/filters/FilterOptions.vue +12 -43
- package/src/modules/core/views/components/sections/filters/FilterRange.vue +59 -36
- package/src/modules/core/views/components/sections/filters/FiltersGroup.vue +177 -0
- package/src/modules/core/views/utils/vue-app-renderer.js +12 -0
- package/src/modules/landing/components/sections/SectionFeatures.vue +1 -1
- package/src/modules/marketplace/controllers/marketplace.controller.js +123 -0
- package/src/modules/marketplace/controllers/utils/lookupConfigs.js +130 -0
- package/src/modules/marketplace/controllers/utils/queryProcessorMarketplace.js +211 -0
- package/src/modules/marketplace/marketplace.client.js +3 -10
- package/src/modules/marketplace/marketplace.server.js +22 -0
- package/src/modules/marketplace/routes/marketplace.routes.js +34 -0
- package/src/modules/marketplace/views/components/pages/Marketplace.vue +273 -0
- package/src/modules/marketplace/views/router/marketplace.router.js +37 -30
- package/src/modules/marketplace/views/store/marketplace.js +74 -3
- package/src/modules/organizations/components/blocks/CardOrganization.vue +8 -8
- package/src/modules/organizations/controllers/organizations.controller.js +1 -1
- package/src/modules/organizations/controllers/utils/queryProcessorOrganizations.js +8 -1
- package/dist/martyrs/src/components/Button/Button.vue.js.map +0 -1
- package/dist/martyrs/src/components/Menu/Menu.vue2.js.map +0 -1
- package/dist/martyrs/src/components/Select/Select.vue2.js.map +0 -1
- package/dist/martyrs/src/components/Spoiler/Spoiler.vue.js.map +0 -1
- package/dist/martyrs/src/modules/marketplace/marketplace.router.js +0 -63
- package/dist/martyrs/src/modules/marketplace/marketplace.router.js.map +0 -1
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.js +0 -326
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.js.map +0 -1
- package/dist/martyrs/src/modules/marketplace/views/components/pages/Catalog.vue.js +0 -74
- package/dist/martyrs/src/modules/marketplace/views/components/pages/Catalog.vue.js.map +0 -1
- package/src/modules/core/views/components/sections/filters/FilterPrice.vue +0 -81
- package/src/modules/marketplace/marketplace.router.js +0 -66
- package/src/modules/marketplace/views/components/layouts/Marketplace.vue +0 -363
- package/src/modules/marketplace/views/components/pages/Catalog.vue +0 -73
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Filters.vue.js","sources":["../../../../../../../../src/modules/core/views/components/sections/Filters.vue"],"sourcesContent":["<template>\n <div class=\"flex t-nowrap gap-thin\">\n <!-- All Filters Button -->\n <button\n @click=\"showAllFilters = true\"\n class=\"pd-small radius-medium bg-light flex-v-center flex gap-micro cursor-pointer\"\n :class=\"{ 'bg-main': activeFiltersCount > 0 }\"\n >\n <IconFilter class=\"i-medium\" />\n <span class=\"h-1r\"></span>\n <span v-if=\"activeFiltersCount\">{{ activeFiltersCount }}</span>\n </button>\n\n <!-- Individual Filter Buttons -->\n <button\n v-for=\"filter in filters\"\n :key=\"filter.value\"\n @click=\"openFilter(filter.value)\"\n class=\"pd-small radius-medium bg-light cursor-pointer flex-v-center flex gap-micro\"\n :class=\"{ 'selected bg-main': isFilterActive(filter) }\"\n >\n <IconCalendar v-if=\"filter.type === 'date'\" class=\"mn-r-micro i-medium\" />\n <span class=\"t-nowrap\">{{ filter.type === 'date' && getFilterValue(filter) ? formatFilterValue(filter) : filter.title }}</span>\n <span v-if=\"getFilterValue(filter) && filter.type !== 'date'\" class=\"mn-l-micro\">\n {{ formatFilterValue(filter) }}\n </span>\n </button>\n\n <!-- All Filters Popup -->\n <Popup\n :isPopupOpen=\"showAllFilters\"\n @close-popup=\"showAllFilters = false\"\n :align=\"isPhone() ? 'bottom center' : 'center center'\"\n class=\"w-min-20r bg-white radius-medium mobile:radius-zero mobile:radius-tr-medium mobile:radius-tl-medium mobile:w-100 pd-medium\"\n >\n <div class=\"flex-v-center flex-nowrap flex mn-b-medium\">\n <h3 class=\"flex-child-full\">Filters</h3>\n </div>\n\n <div class=\"filters-content\">\n <div \n v-for=\"filter in filters\" \n :key=\"filter.value\"\n class=\"mn-b-medium\"\n >\n <h4 class=\"mn-b-small\">{{ filter.title }}</h4>\n \n <!-- Checkbox Filter -->\n <div v-if=\"filter.type === 'checkbox'\">\n <Checkbox\n v-for=\"option in filter.options\"\n :key=\"option.value\"\n :label=\"option.label\"\n :value=\"option.value\"\n v-model:radio=\"tempSelected[filter.value]\"\n mode=\"checkbox\"\n class=\"mn-b-micro\"\n />\n </div>\n\n <!-- Radio Filter -->\n <div v-else-if=\"filter.type === 'radio'\">\n <div\n v-for=\"option in filter.options\"\n :key=\"option.value\"\n @click=\"tempSelected[filter.value] = option.value\"\n class=\"pd-small radius-small cursor-pointer mn-b-micro\"\n :class=\"{ \n 'bg-main': tempSelected[filter.value] === option.value,\n 'bg-light': tempSelected[filter.value] !== option.value\n }\"\n >\n {{ option.label }}\n </div>\n </div>\n\n <!-- Range Filter -->\n <div v-else-if=\"filter.type === 'range'\" class=\"flex gap-thin\">\n <Field\n v-model:field=\"tempSelected[filter.value].min\"\n :placeholder=\"filter.minPlaceholder || 'Min'\"\n type=\"number\"\n :label=\"returnCurrency()\"\n class=\"w-50 bg-light pd-small radius-small\"\n />\n <Field\n v-model:field=\"tempSelected[filter.value].max\"\n :placeholder=\"filter.maxPlaceholder || 'Max'\"\n type=\"number\"\n :label=\"returnCurrency()\"\n class=\"w-50 bg-light pd-small radius-small\"\n />\n </div>\n\n <!-- Date Filter -->\n <div v-else-if=\"filter.type === 'date'\">\n <Calendar\n v-model:date=\"tempSelected[filter.value]\"\n :allowRange=\"true\"\n :disablePastDates=\"true\"\n class=\"bg-light radius-small\"\n />\n </div>\n </div>\n </div>\n\n <div class=\"flex gap-thin mn-t-medium\">\n <button \n @click=\"applyAllFilters\" \n class=\"button bg-main flex-child-full\"\n >\n Apply\n </button>\n <button \n @click=\"resetFilters\" \n class=\"button bg-light\"\n >\n Reset Filters\n </button>\n </div>\n </Popup>\n\n <!-- Individual Filter Popups -->\n <Popup\n v-for=\"filter in filters\"\n :key=\"`popup-${filter.value}`\"\n :isPopupOpen=\"individualPopups[filter.value]\"\n @close-popup=\"individualPopups[filter.value] = false\"\n :align=\"isPhone() ? 'bottom center' : 'center center'\"\n class=\"bg-white radius-medium mobile:radius-zero mobile:radius-tr-medium mobile:radius-tl-medium mobile:w-100 pd-medium\"\n >\n <h4 class=\"mn-b-medium\">{{ filter.title }}</h4>\n \n <!-- Checkbox Filter -->\n <div v-if=\"filter.type === 'checkbox'\">\n <Checkbox\n v-for=\"option in filter.options\"\n :key=\"option.value\"\n :label=\"option.label\"\n :value=\"option.value\"\n v-model:radio=\"tempSelected[filter.value]\"\n mode=\"checkbox\"\n class=\"mn-b-micro\"\n />\n </div>\n\n <!-- Radio Filter -->\n <div v-else-if=\"filter.type === 'radio'\">\n <div\n v-for=\"option in filter.options\"\n :key=\"option.value\"\n @click=\"tempSelected[filter.value] = option.value\"\n class=\"pd-small radius-small cursor-pointer mn-b-micro\"\n :class=\"{ \n 'bg-main': tempSelected[filter.value] === option.value,\n 'bg-light': tempSelected[filter.value] !== option.value\n }\"\n >\n {{ option.label }}\n </div>\n </div>\n\n <!-- Range Filter -->\n <div v-else-if=\"filter.type === 'range'\" class=\"flex gap-thin\">\n <Field\n v-model:field=\"tempSelected[filter.value].min\"\n :placeholder=\"filter.minPlaceholder || 'Min'\"\n type=\"number\"\n :label=\"returnCurrency()\"\n class=\"w-50 bg-light pd-small radius-small\"\n />\n <Field\n v-model:field=\"tempSelected[filter.value].max\"\n :placeholder=\"filter.maxPlaceholder || 'Max'\"\n type=\"number\"\n :label=\"returnCurrency()\"\n class=\"w-50 bg-light pd-small radius-small\"\n />\n </div>\n\n <!-- Date Filter -->\n <div v-else-if=\"filter.type === 'date'\">\n <div class=\"mn-t-small\">\n <Calendar\n v-model:date=\"tempSelected[filter.value]\"\n :allowRange=\"true\"\n :disablePastDates=\"true\"\n class=\"bg-light radius-small\"\n />\n </div>\n </div>\n\n <div class=\"flex gap-thin mn-t-medium\">\n <button \n @click=\"cancelFilter(filter.value)\" \n class=\"bg-light button flex-child-full\"\n >\n Cancel\n </button>\n <button \n @click=\"applyFilter(filter.value)\" \n class=\"bg-main w-100 button flex-child-full\"\n >\n Apply\n </button>\n \n \n </div>\n </Popup>\n </div>\n</template>\n\n<script setup>\nimport { ref, computed, reactive, watch } from 'vue'\nimport { useGlobalMixins } from '@martyrs/src/modules/core/views/mixins/mixins.js'\nimport Popup from '@martyrs/src/components/Popup/Popup.vue'\nimport Checkbox from '@martyrs/src/components/Checkbox/Checkbox.vue'\nimport Field from '@martyrs/src/components/Field/Field.vue'\nimport Calendar from '@martyrs/src/components/Calendar/Calendar.vue'\nimport IconFilter from '@martyrs/src/modules/icons/navigation/IconFilter.vue'\nimport IconCross from '@martyrs/src/modules/icons/navigation/IconCross.vue'\nimport IconCalendar from '@martyrs/src/modules/icons/entities/IconCalendar.vue'\n\nconst filters = defineModel('filters', {\n type: Array,\n required: true\n})\n\nconst selected = defineModel('selected', {\n type: Object,\n default: () => ({})\n})\n\nconst emit = defineEmits(['select'])\n\nconst { formatDate, returnCurrency } = useGlobalMixins()\n\n// State\nconst showAllFilters = ref(false)\nconst individualPopups = reactive({})\nconst tempSelected = reactive({})\nconst tempDateRange = ref(null)\n\n// Initialize popups and temp values\nwatch(filters, (newFilters) => {\n newFilters.forEach(filter => {\n individualPopups[filter.value] = false\n \n if (!tempSelected[filter.value]) {\n if (filter.type === 'checkbox') {\n tempSelected[filter.value] = [...(selected.value[filter.value] || [])]\n } else if (filter.type === 'range') {\n tempSelected[filter.value] = { ...(selected.value[filter.value] || { min: '', max: '' }) }\n } else if (filter.type === 'date') {\n tempSelected[filter.value] = selected.value[filter.value] || null\n } else {\n tempSelected[filter.value] = selected.value[filter.value] || null\n }\n }\n })\n}, { immediate: true, deep: true })\n\n// Sync selected to tempSelected\nwatch(selected, (newSelected) => {\n Object.keys(newSelected).forEach(key => {\n const filter = filters.value.find(f => f.value === key)\n if (filter) {\n if (filter.type === 'checkbox') {\n tempSelected[key] = [...(newSelected[key] || [])]\n } else if (filter.type === 'range') {\n tempSelected[key] = { ...(newSelected[key] || { min: '', max: '' }) }\n } else {\n tempSelected[key] = newSelected[key]\n }\n }\n })\n}, { deep: true })\n\n// Computed\nconst activeFiltersCount = computed(() => {\n return Object.entries(selected.value).filter(([key, value]) => {\n if (Array.isArray(value)) return value.length > 0\n if (typeof value === 'object' && value !== null) {\n return value.min || value.max\n }\n return value !== null && value !== undefined\n }).length\n})\n\n// Methods\nconst openFilter = (filterValue) => {\n individualPopups[filterValue] = true\n}\n\nconst isFilterActive = (filter) => {\n const value = selected.value[filter.value]\n if (!value) return false\n if (Array.isArray(value)) return value.length > 0\n if (filter.type === 'range') return value.min || value.max\n return true\n}\n\nconst getFilterValue = (filter) => {\n const value = selected.value[filter.value]\n if (!value) return false\n \n if (filter.type === 'range') {\n return value.min || value.max\n }\n \n if (filter.type === 'date') {\n return value && value.start && value.end\n }\n \n if (Array.isArray(value)) {\n return value.length > 0\n }\n \n return value\n}\n\nconst formatFilterValue = (filter) => {\n const value = selected.value[filter.value]\n if (!value) return ''\n \n if (Array.isArray(value)) {\n return `(${value.length})`\n }\n \n if (filter.type === 'range') {\n if (!value.min && !value.max) return ''\n return `${value.min || '0'}-${value.max || '∞'}`\n }\n \n if (filter.type === 'date') {\n if (!value || !value.start || !value.end) return ''\n return `${formatDate(value.start, { dayMonth: true, language: 'en' })} - ${formatDate(value.end, { dayMonth: true, language: 'en' })}`\n }\n \n if (filter.type === 'radio') {\n const option = filter.options.find(o => o.value === value)\n return option ? `(${option.label})` : ''\n }\n \n return ''\n}\n\nconst applyFilter = (filterValue) => {\n selected.value[filterValue] = tempSelected[filterValue]\n individualPopups[filterValue] = false\n emit('select', { filter: filterValue, value: tempSelected[filterValue] })\n}\n\nconst cancelFilter = (filterValue) => {\n const filter = filters.value.find(f => f.value === filterValue)\n if (filter) {\n if (filter.type === 'checkbox') {\n tempSelected[filterValue] = [...(selected.value[filterValue] || [])]\n } else if (filter.type === 'range') {\n tempSelected[filterValue] = { ...(selected.value[filterValue] || { min: '', max: '' }) }\n } else if (filter.type === 'date') {\n tempSelected[filterValue] = selected.value[filterValue] || null\n } else {\n tempSelected[filterValue] = selected.value[filterValue] || null\n }\n }\n individualPopups[filterValue] = false\n}\n\nconst applyAllFilters = () => {\n Object.entries(tempSelected).forEach(([key, value]) => {\n if (selected.value[key] !== value) {\n selected.value[key] = value\n emit('select', { filter: key, value })\n }\n })\n showAllFilters.value = false\n}\n\nconst resetFilters = () => {\n filters.value.forEach(filter => {\n if (filter.type === 'checkbox') {\n tempSelected[filter.value] = []\n selected.value[filter.value] = []\n } else if (filter.type === 'range') {\n tempSelected[filter.value] = { min: '', max: '' }\n selected.value[filter.value] = { min: '', max: '' }\n } else if (filter.type === 'date') {\n tempSelected[filter.value] = null\n selected.value[filter.value] = null\n } else {\n tempSelected[filter.value] = null\n selected.value[filter.value] = null\n }\n emit('select', { filter: filter.value, value: null })\n })\n}\n</script>\n\n<style scoped>\n.filters-content {\n max-height: 60vh;\n overflow-y: auto;\n}\n</style>"],"names":["_useModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+NA,UAAM,UAAUA,SAAW,SAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Filters.vue.js","sources":["../../../../../../../../src/modules/core/views/components/sections/Filters.vue"],"sourcesContent":["<template>\n <div class=\"flex o-x-scroll scroll-hide t-nowrap gap-thin\">\n <!-- All Filters Button -->\n <button\n @click=\"showAllFilters = true\"\n class=\"pd-small radius-medium bg-light flex-v-center flex gap-micro cursor-pointer\"\n :class=\"{ 'bg-main': activeFiltersCount > 0 }\"\n >\n <IconFilter class=\"i-regular\" />\n <span class=\"h-1r\"></span>\n <span v-if=\"activeFiltersCount\">{{ activeFiltersCount }}</span>\n </button>\n\n <!-- Individual Filter Buttons -->\n <button\n v-for=\"filter in filters\"\n :key=\"filter.value\"\n @click=\"openFilter(filter.value)\"\n class=\"pd-small radius-medium bg-light cursor-pointer flex-v-center flex gap-micro\"\n :class=\"{ 'selected bg-main': isFilterActive(filter) }\"\n >\n <IconCalendar v-if=\"filter.type === 'date'\" class=\"mn-r-micro i-regular\" />\n <span class=\"t-nowrap\">{{ filter.type === 'date' && getFilterValue(filter) ? formatFilterValue(filter) : filter.title }}</span>\n <span v-if=\"getFilterValue(filter) && filter.type !== 'date'\" class=\"mn-l-micro\">\n {{ formatFilterValue(filter) }}\n </span>\n </button>\n\n <!-- All Filters Popup -->\n <Popup\n :isPopupOpen=\"showAllFilters\"\n @close-popup=\"closeAllFilters\"\n :align=\"isPhone() ? 'bottom center' : 'center center'\"\n class=\"w-min-20r bg-white radius-medium mobile:radius-zero mobile:radius-tr-medium mobile:radius-tl-medium mobile:w-100 pd-medium\"\n >\n <FiltersGroup\n :filters=\"filters\"\n v-model:selected=\"tempSelected\"\n :immediate=\"false\"\n :showHeader=\"true\"\n :showApplyButton=\"true\"\n :showResetButton=\"true\"\n @update:selected=\"applyAllFilters\"\n />\n </Popup>\n\n <!-- Individual Filter Popups -->\n <Popup\n v-for=\"filter in filters\"\n :key=\"`popup-${filter.value}`\"\n :isPopupOpen=\"individualPopups[filter.value]\"\n @close-popup=\"cancelFilter(filter.value)\"\n :align=\"isPhone() ? 'bottom center' : 'center center'\"\n class=\"bg-white radius-medium mobile:radius-zero mobile:radius-tr-medium mobile:radius-tl-medium mobile:w-100 pd-medium\"\n >\n <h4 class=\"mn-b-medium\">{{ filter.title }}</h4>\n\n <!-- Checkbox Filter -->\n <FilterCheckbox\n v-if=\"filter.type === 'checkbox'\"\n v-model=\"tempSelected[filter.value]\"\n :options=\"filter.options\"\n />\n\n <!-- Range Filter -->\n <FilterRange\n v-else-if=\"filter.type === 'range'\"\n v-model=\"tempSelected[filter.value]\"\n :minPlaceholder=\"filter.minPlaceholder || 'Min'\"\n :maxPlaceholder=\"filter.maxPlaceholder || 'Max'\"\n :label=\"filter.label\"\n />\n\n <!-- Date Filter -->\n <div v-else-if=\"filter.type === 'date'\">\n <div class=\"mn-t-small\">\n <Calendar\n v-model:date=\"tempSelected[filter.value]\"\n :allowRange=\"true\"\n :disablePastDates=\"true\"\n class=\"bg-light radius-small\"\n />\n </div>\n </div>\n\n <!-- Radio/Options Filter -->\n <FilterOptions\n v-else-if=\"filter.type === 'radio'\"\n v-model=\"tempSelected[filter.value]\"\n :options=\"filter.options\"\n />\n\n <div class=\"flex gap-thin mn-t-medium\">\n <button\n @click=\"cancelFilter(filter.value)\"\n class=\"bg-light button flex-child-full\"\n >\n Cancel\n </button>\n <button\n @click=\"applyFilter(filter.value)\"\n class=\"bg-main w-100 button flex-child-full\"\n >\n Apply\n </button>\n </div>\n </Popup>\n </div>\n</template>\n\n<script setup>\nimport { ref, computed, reactive, watch } from 'vue'\nimport { useGlobalMixins } from '@martyrs/src/modules/core/views/mixins/mixins.js'\nimport Popup from '@martyrs/src/components/Popup/Popup.vue'\nimport Calendar from '@martyrs/src/components/Calendar/Calendar.vue'\nimport FiltersGroup from './filters/FiltersGroup.vue'\nimport FilterCheckbox from './filters/FilterCheckbox.vue'\nimport FilterRange from './filters/FilterRange.vue'\nimport FilterDateRange from './filters/FilterDateRange.vue'\nimport FilterOptions from './filters/FilterOptions.vue'\nimport IconFilter from '@martyrs/src/modules/icons/navigation/IconFilter.vue'\nimport IconCross from '@martyrs/src/modules/icons/navigation/IconCross.vue'\nimport IconCalendar from '@martyrs/src/modules/icons/entities/IconCalendar.vue'\n\nconst filters = defineModel('filters', {\n type: Array,\n required: true\n})\n\nconst selected = defineModel('selected', {\n type: Object,\n default: () => ({})\n})\n\nconst emit = defineEmits(['select'])\n\nconst { formatDate, returnCurrency } = useGlobalMixins()\n\n// State\nconst showAllFilters = ref(false)\nconst individualPopups = reactive({})\nconst tempSelected = reactive({})\nconst tempDateRange = ref(null)\n\n// Initialize popups and temp values\nwatch(filters, (newFilters) => {\n newFilters.forEach(filter => {\n individualPopups[filter.value] = false\n \n if (!tempSelected[filter.value]) {\n if (filter.type === 'checkbox') {\n tempSelected[filter.value] = [...(selected.value[filter.value] || [])]\n } else if (filter.type === 'range') {\n tempSelected[filter.value] = { ...(selected.value[filter.value] || { min: '', max: '' }) }\n } else if (filter.type === 'date') {\n tempSelected[filter.value] = selected.value[filter.value] || null\n } else {\n tempSelected[filter.value] = selected.value[filter.value] || null\n }\n }\n })\n}, { immediate: true, deep: true })\n\n// Sync selected to tempSelected\nwatch(selected, (newSelected) => {\n Object.keys(newSelected).forEach(key => {\n const filter = filters.value.find(f => f.value === key)\n if (filter) {\n if (filter.type === 'checkbox') {\n tempSelected[key] = [...(newSelected[key] || [])]\n } else if (filter.type === 'range') {\n tempSelected[key] = { ...(newSelected[key] || { min: '', max: '' }) }\n } else {\n tempSelected[key] = newSelected[key]\n }\n }\n })\n}, { deep: true })\n\n// Computed\nconst activeFiltersCount = computed(() => {\n return Object.entries(selected.value).filter(([key, value]) => {\n if (Array.isArray(value)) return value.length > 0\n if (typeof value === 'object' && value !== null) {\n return value.min || value.max\n }\n return value !== null && value !== undefined\n }).length\n})\n\n// Methods\nconst openFilter = (filterValue) => {\n individualPopups[filterValue] = true\n}\n\nconst isFilterActive = (filter) => {\n const value = selected.value[filter.value]\n if (!value) return false\n if (Array.isArray(value)) return value.length > 0\n if (filter.type === 'range') return value.min || value.max\n return true\n}\n\nconst getFilterValue = (filter) => {\n const value = selected.value[filter.value]\n if (!value) return false\n \n if (filter.type === 'range') {\n return value.min || value.max\n }\n \n if (filter.type === 'date') {\n return value && value.start && value.end\n }\n \n if (Array.isArray(value)) {\n return value.length > 0\n }\n \n return value\n}\n\nconst formatFilterValue = (filter) => {\n const value = selected.value[filter.value]\n if (!value) return ''\n \n if (Array.isArray(value)) {\n return `(${value.length})`\n }\n \n if (filter.type === 'range') {\n if (!value.min && !value.max) return ''\n return `${value.min || '0'}-${value.max || '∞'}`\n }\n \n if (filter.type === 'date') {\n if (!value || !value.start || !value.end) return ''\n return `${formatDate(value.start, { dayMonth: true, language: 'en' })} - ${formatDate(value.end, { dayMonth: true, language: 'en' })}`\n }\n \n if (filter.type === 'radio') {\n const option = filter.options.find(o => o.value === value)\n return option ? `(${option.label})` : ''\n }\n \n return ''\n}\n\nconst applyFilter = (filterValue) => {\n selected.value[filterValue] = tempSelected[filterValue]\n individualPopups[filterValue] = false\n emit('select', { filter: filterValue, value: tempSelected[filterValue] })\n}\n\nconst cancelFilter = (filterValue) => {\n const filter = filters.value.find(f => f.value === filterValue)\n if (filter) {\n if (filter.type === 'checkbox') {\n tempSelected[filterValue] = [...(selected.value[filterValue] || [])]\n } else if (filter.type === 'range') {\n tempSelected[filterValue] = { ...(selected.value[filterValue] || { min: '', max: '' }) }\n } else if (filter.type === 'date') {\n tempSelected[filterValue] = selected.value[filterValue] || null\n } else {\n tempSelected[filterValue] = selected.value[filterValue] || null\n }\n }\n individualPopups[filterValue] = false\n}\n\nconst applyAllFilters = (newValues) => {\n Object.entries(newValues).forEach(([key, value]) => {\n if (selected.value[key] !== value) {\n selected.value[key] = value\n emit('select', { filter: key, value })\n }\n })\n showAllFilters.value = false\n}\n\nconst closeAllFilters = () => {\n showAllFilters.value = false\n}\n</script>\n\n<style scoped>\n.filters-content {\n max-height: 60vh;\n overflow-y: auto;\n}\n</style>"],"names":["_useModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HA,UAAM,UAAUA,SAAW,SAAC,SAG3B;AAED,UAAM,WAAWA,SAAW,SAAC,UAG5B;AAED,UAAM,OAAO;AAEb,UAAM,EAAE,YAAY,eAAc,IAAK,gBAAe;AAGtD,UAAM,iBAAiB,IAAI,KAAK;AAChC,UAAM,mBAAmB,SAAS,CAAA,CAAE;AACpC,UAAM,eAAe,SAAS,CAAA,CAAE;AACV,QAAI,IAAI;AAG9B,UAAM,SAAS,CAAC,eAAe;AAC7B,iBAAW,QAAQ,YAAU;AAC3B,yBAAiB,OAAO,KAAK,IAAI;AAEjC,YAAI,CAAC,aAAa,OAAO,KAAK,GAAG;AAC/B,cAAI,OAAO,SAAS,YAAY;AAC9B,yBAAa,OAAO,KAAK,IAAI,CAAC,GAAI,SAAS,MAAM,OAAO,KAAK,KAAK,EAAG;AAAA,UACvE,WAAW,OAAO,SAAS,SAAS;AAClC,yBAAa,OAAO,KAAK,IAAI,EAAE,GAAI,SAAS,MAAM,OAAO,KAAK,KAAK,EAAE,KAAK,IAAI,KAAK,GAAE,EAAG;AAAA,UAC1F,WAAW,OAAO,SAAS,QAAQ;AACjC,yBAAa,OAAO,KAAK,IAAI,SAAS,MAAM,OAAO,KAAK,KAAK;AAAA,UAC/D,OAAO;AACL,yBAAa,OAAO,KAAK,IAAI,SAAS,MAAM,OAAO,KAAK,KAAK;AAAA,UAC/D;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,GAAG,EAAE,WAAW,MAAM,MAAM,KAAI,CAAE;AAGlC,UAAM,UAAU,CAAC,gBAAgB;AAC/B,aAAO,KAAK,WAAW,EAAE,QAAQ,SAAO;AACtC,cAAM,SAAS,QAAQ,MAAM,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AACV,YAAI,OAAO,SAAS,YAAY;AAC9B,uBAAa,WAAW,IAAI,CAAC,GAAI,SAAS,MAAM,WAAW,KAAK,EAAG;AAAA,QACrE,WAAW,OAAO,SAAS,SAAS;AAClC,uBAAa,WAAW,IAAI,EAAE,GAAI,SAAS,MAAM,WAAW,KAAK,EAAE,KAAK,IAAI,KAAK,GAAE,EAAG;AAAA,QACxF,WAAW,OAAO,SAAS,QAAQ;AACjC,uBAAa,WAAW,IAAI,SAAS,MAAM,WAAW,KAAK;AAAA,QAC7D,OAAO;AACL,uBAAa,WAAW,IAAI,SAAS,MAAM,WAAW,KAAK;AAAA,QAC7D;AAAA,MACF;AACA,uBAAiB,WAAW,IAAI;AAAA,IAClC;AAEA,UAAM,kBAAkB,CAAC,cAAc;AACrC,aAAO,QAAQ,SAAS,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAClD,YAAI,SAAS,MAAM,GAAG,MAAM,OAAO;AACjC,mBAAS,MAAM,GAAG,IAAI;AACtB,eAAK,UAAU,EAAE,QAAQ,KAAK,MAAK,CAAE;AAAA,QACvC;AAAA,MACF,CAAC;AACD,qBAAe,QAAQ;AAAA,IACzB;AAEA,UAAM,kBAAkB,MAAM;AAC5B,qBAAe,QAAQ;AAAA,IACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterCheckbox.vue2.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { mergeModels, useModel, computed, createElementBlock, openBlock, Fragment, renderList, createBlock } from "vue";
|
|
2
|
+
import _sfc_main$1 from "../../../../../../components/Checkbox/Checkbox.vue.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import _export_sfc from "../../../../../../../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
+
const _hoisted_1 = { class: "filter-checkbox" };
|
|
6
|
+
const _sfc_main = {
|
|
7
|
+
__name: "FilterCheckbox",
|
|
8
|
+
props: /* @__PURE__ */ mergeModels({
|
|
9
|
+
options: {
|
|
10
|
+
type: Array,
|
|
11
|
+
required: true
|
|
12
|
+
}
|
|
13
|
+
}, {
|
|
14
|
+
"modelValue": {
|
|
15
|
+
type: Array,
|
|
16
|
+
default: () => []
|
|
17
|
+
},
|
|
18
|
+
"modelModifiers": {}
|
|
19
|
+
}),
|
|
20
|
+
emits: /* @__PURE__ */ mergeModels(["apply"], ["update:modelValue"]),
|
|
21
|
+
setup(__props, { emit: __emit }) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const model = useModel(__props, "modelValue");
|
|
24
|
+
const emit = __emit;
|
|
25
|
+
const normalizedOptions = computed(() => {
|
|
26
|
+
if (!props.options || !Array.isArray(props.options)) return [];
|
|
27
|
+
return props.options.map((option, index) => {
|
|
28
|
+
if (typeof option === "string") {
|
|
29
|
+
return { label: option, value: option };
|
|
30
|
+
}
|
|
31
|
+
if (typeof option === "object" && option !== null) {
|
|
32
|
+
return {
|
|
33
|
+
label: option.label || option.text || option.name || String(option.value || option),
|
|
34
|
+
value: option.value || option.text || option.label || option._id || option.id || `option-${index}`
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return { label: String(option), value: `option-${index}` };
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
return (_ctx, _cache) => {
|
|
41
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
42
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(normalizedOptions.value, (option, index) => {
|
|
43
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
44
|
+
key: option.value,
|
|
45
|
+
radio: model.value,
|
|
46
|
+
"onUpdate:radio": [
|
|
47
|
+
_cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
48
|
+
_cache[1] || (_cache[1] = ($event) => emit("apply"))
|
|
49
|
+
],
|
|
50
|
+
label: option.label,
|
|
51
|
+
value: option.value,
|
|
52
|
+
mode: "checkbox",
|
|
53
|
+
class: "br-solid br-1px br-light pd-small radius-small mn-b-micro"
|
|
54
|
+
}, null, 8, ["radio", "label", "value"]);
|
|
55
|
+
}), 128))
|
|
56
|
+
]);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const FilterCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d3175613"]]);
|
|
61
|
+
export {
|
|
62
|
+
FilterCheckbox as default
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=FilterCheckbox.vue2.js.map
|
package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterCheckbox.vue2.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterCheckbox.vue2.js","sources":["../../../../../../../../../src/modules/core/views/components/sections/filters/FilterCheckbox.vue"],"sourcesContent":["<!-- FilterCheckbox.vue -->\n<template>\n <div class=\"filter-checkbox\">\n <Checkbox\n v-for=\"(option, index) in normalizedOptions\"\n :key=\"option.value\"\n v-model:radio=\"model\"\n :label=\"option.label\"\n :value=\"option.value\"\n mode=\"checkbox\"\n class=\"br-solid br-1px br-light pd-small radius-small mn-b-micro\"\n @update:radio=\"emit('apply')\"\n />\n </div>\n</template>\n\n<script setup>\nimport { computed } from 'vue'\nimport Checkbox from '@martyrs/src/components/Checkbox/Checkbox.vue'\n\nconst props = defineProps({\n options: {\n type: Array,\n required: true\n }\n})\n\nconst model = defineModel({\n type: Array,\n default: () => []\n})\n\nconst emit = defineEmits(['apply'])\n\n// Normalize options to always have label and value\nconst normalizedOptions = computed(() => {\n if (!props.options || !Array.isArray(props.options)) return []\n\n return props.options.map((option, index) => {\n if (typeof option === 'string') {\n return { label: option, value: option }\n }\n if (typeof option === 'object' && option !== null) {\n return {\n label: option.label || option.text || option.name || String(option.value || option),\n value: option.value || option.text || option.label || option._id || option.id || `option-${index}`\n }\n }\n return { label: String(option), value: `option-${index}` }\n })\n})\n</script>\n\n<style scoped>\n.filter-checkbox {\n max-height: 300px;\n overflow-y: auto;\n}\n</style>"],"names":["_useModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,UAAM,QAAQ;AAOd,UAAM,QAAQA,SAAW,SAAA,YAGxB;AAED,UAAM,OAAO;AAGb,UAAM,oBAAoB,SAAS,MAAM;AACvC,UAAI,CAAC,MAAM,WAAW,CAAC,MAAM,QAAQ,MAAM,OAAO,EAAG,QAAO,CAAA;AAE5D,aAAO,MAAM,QAAQ,IAAI,CAAC,QAAQ,UAAU;AAC1C,YAAI,OAAO,WAAW,UAAU;AAC9B,iBAAO,EAAE,OAAO,QAAQ,OAAO,OAAM;AAAA,QACvC;AACA,YAAI,OAAO,WAAW,YAAY,WAAW,MAAM;AACjD,iBAAO;AAAA,YACL,OAAO,OAAO,SAAS,OAAO,QAAQ,OAAO,QAAQ,OAAO,OAAO,SAAS,MAAM;AAAA,YAClF,OAAO,OAAO,SAAS,OAAO,QAAQ,OAAO,SAAS,OAAO,OAAO,OAAO,MAAM,UAAU,KAAK;AAAA,UACxG;AAAA,QACI;AACA,eAAO,EAAE,OAAO,OAAO,MAAM,GAAG,OAAO,UAAU,KAAK,GAAE;AAAA,MAC1D,CAAC;AAAA,IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterDateRange.vue2.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { mergeModels, useModel, ref, computed, watch, createElementBlock, openBlock, createCommentVNode, createElementVNode, createVNode, Fragment, renderList, normalizeClass, toDisplayString, withCtx } from "vue";
|
|
2
|
+
import Calendar from "../../../../../../components/Calendar/Calendar.vue2.js";
|
|
3
|
+
import _sfc_main$2 from "../../../../../../components/Popup/Popup.vue.js";
|
|
4
|
+
import _sfc_main$1 from "../../../../../icons/entities/IconCalendar.vue.js";
|
|
5
|
+
import { useGlobalMixins } from "../../../mixins/mixins.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import _export_sfc from "../../../../../../../../_virtual/_plugin-vue_export-helper.js";
|
|
8
|
+
const _hoisted_1 = { class: "filter-date-range" };
|
|
9
|
+
const _hoisted_2 = ["onClick"];
|
|
10
|
+
const _hoisted_3 = { class: "flex gap-small" };
|
|
11
|
+
const _sfc_main = {
|
|
12
|
+
__name: "FilterDateRange",
|
|
13
|
+
props: /* @__PURE__ */ mergeModels({
|
|
14
|
+
dateOptions: {
|
|
15
|
+
type: Array,
|
|
16
|
+
default: () => []
|
|
17
|
+
}
|
|
18
|
+
}, {
|
|
19
|
+
"modelValue": {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => null
|
|
22
|
+
},
|
|
23
|
+
"modelModifiers": {}
|
|
24
|
+
}),
|
|
25
|
+
emits: /* @__PURE__ */ mergeModels(["update:modelValue", "apply"], ["update:modelValue"]),
|
|
26
|
+
setup(__props, { emit: __emit }) {
|
|
27
|
+
const { formatDate } = useGlobalMixins();
|
|
28
|
+
const model = useModel(__props, "modelValue");
|
|
29
|
+
const emit = __emit;
|
|
30
|
+
const showCalendar = ref(false);
|
|
31
|
+
const selectedOption = ref(null);
|
|
32
|
+
const tempDates = ref(null);
|
|
33
|
+
const dateRangeLabel = computed(() => {
|
|
34
|
+
if (!model.value || !model.value.start || !model.value.end) {
|
|
35
|
+
return "Select dates";
|
|
36
|
+
}
|
|
37
|
+
const start = formatDate(model.value.start, { dayMonth: true, language: "en" });
|
|
38
|
+
const end = formatDate(model.value.end, { dayMonth: true, language: "en" });
|
|
39
|
+
return `${start} - ${end}`;
|
|
40
|
+
});
|
|
41
|
+
const selectOption = (value) => {
|
|
42
|
+
selectedOption.value = value;
|
|
43
|
+
const today = /* @__PURE__ */ new Date();
|
|
44
|
+
today.setHours(0, 0, 0, 0);
|
|
45
|
+
let dateRange = null;
|
|
46
|
+
switch (value) {
|
|
47
|
+
case "today":
|
|
48
|
+
dateRange = {
|
|
49
|
+
start: today,
|
|
50
|
+
end: today
|
|
51
|
+
};
|
|
52
|
+
break;
|
|
53
|
+
case "week":
|
|
54
|
+
const weekEnd = new Date(today);
|
|
55
|
+
weekEnd.setDate(today.getDate() + 7);
|
|
56
|
+
dateRange = {
|
|
57
|
+
start: today,
|
|
58
|
+
end: weekEnd
|
|
59
|
+
};
|
|
60
|
+
break;
|
|
61
|
+
case "month":
|
|
62
|
+
const monthEnd = new Date(today);
|
|
63
|
+
monthEnd.setMonth(today.getMonth() + 1);
|
|
64
|
+
dateRange = {
|
|
65
|
+
start: today,
|
|
66
|
+
end: monthEnd
|
|
67
|
+
};
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
if (dateRange) {
|
|
71
|
+
model.value = dateRange;
|
|
72
|
+
emit("apply");
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const applyDates = () => {
|
|
76
|
+
if (tempDates.value) {
|
|
77
|
+
model.value = tempDates.value;
|
|
78
|
+
selectedOption.value = "custom";
|
|
79
|
+
emit("apply");
|
|
80
|
+
}
|
|
81
|
+
showCalendar.value = false;
|
|
82
|
+
};
|
|
83
|
+
watch(() => model.value, (newVal) => {
|
|
84
|
+
if (newVal && newVal.start && newVal.end) {
|
|
85
|
+
tempDates.value = { ...newVal };
|
|
86
|
+
const today = /* @__PURE__ */ new Date();
|
|
87
|
+
today.setHours(0, 0, 0, 0);
|
|
88
|
+
const start = new Date(newVal.start);
|
|
89
|
+
start.setHours(0, 0, 0, 0);
|
|
90
|
+
const end = new Date(newVal.end);
|
|
91
|
+
end.setHours(0, 0, 0, 0);
|
|
92
|
+
const diffDays = Math.round((end - start) / (1e3 * 60 * 60 * 24));
|
|
93
|
+
if (start.getTime() === today.getTime() && end.getTime() === today.getTime()) {
|
|
94
|
+
selectedOption.value = "today";
|
|
95
|
+
} else if (start.getTime() === today.getTime() && diffDays === 7) {
|
|
96
|
+
selectedOption.value = "week";
|
|
97
|
+
} else if (start.getTime() === today.getTime() && diffDays >= 28 && diffDays <= 31) {
|
|
98
|
+
selectedOption.value = "month";
|
|
99
|
+
} else {
|
|
100
|
+
selectedOption.value = "custom";
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
selectedOption.value = null;
|
|
104
|
+
}
|
|
105
|
+
}, { immediate: true, deep: true });
|
|
106
|
+
return (_ctx, _cache) => {
|
|
107
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
108
|
+
__props.dateOptions.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.dateOptions, (option) => {
|
|
109
|
+
return openBlock(), createElementBlock("div", {
|
|
110
|
+
key: option.value,
|
|
111
|
+
onClick: ($event) => selectOption(option.value),
|
|
112
|
+
class: normalizeClass([{ "bg-light": selectedOption.value === option.value }, "pd-small radius-small cursor-pointer hover-bg-light transition-all mn-b-micro"])
|
|
113
|
+
}, toDisplayString(option.label), 11, _hoisted_2);
|
|
114
|
+
}), 128)) : createCommentVNode("", true),
|
|
115
|
+
createElementVNode("div", {
|
|
116
|
+
onClick: _cache[0] || (_cache[0] = () => {
|
|
117
|
+
showCalendar.value = true;
|
|
118
|
+
}),
|
|
119
|
+
class: normalizeClass([{ "bg-light": model.value }, "pd-small field-wrapper radius-small bg-light cursor-pointer hover-bg-light transition-all flex-v-center flex gap-thin"])
|
|
120
|
+
}, [
|
|
121
|
+
createVNode(_sfc_main$1, { class: "i-medium" }),
|
|
122
|
+
createElementVNode("span", null, toDisplayString(dateRangeLabel.value), 1)
|
|
123
|
+
], 2),
|
|
124
|
+
createVNode(_sfc_main$2, {
|
|
125
|
+
isPopupOpen: showCalendar.value,
|
|
126
|
+
onClosePopup: _cache[3] || (_cache[3] = ($event) => showCalendar.value = false),
|
|
127
|
+
class: "pd-medium bg-white radius-medium",
|
|
128
|
+
style: { "min-width": "350px" }
|
|
129
|
+
}, {
|
|
130
|
+
default: withCtx(() => [
|
|
131
|
+
_cache[4] || (_cache[4] = createElementVNode("h3", { class: "mn-b-medium" }, "Select Date Range", -1)),
|
|
132
|
+
createVNode(Calendar, {
|
|
133
|
+
date: tempDates.value,
|
|
134
|
+
"onUpdate:date": _cache[1] || (_cache[1] = ($event) => tempDates.value = $event),
|
|
135
|
+
allowRange: true,
|
|
136
|
+
disablePastDates: true,
|
|
137
|
+
class: "mn-b-medium"
|
|
138
|
+
}, null, 8, ["date"]),
|
|
139
|
+
createElementVNode("div", _hoisted_3, [
|
|
140
|
+
createElementVNode("button", {
|
|
141
|
+
onClick: applyDates,
|
|
142
|
+
class: "button bg-main t-white flex-child-full pd-small radius-small"
|
|
143
|
+
}, " Apply "),
|
|
144
|
+
createElementVNode("button", {
|
|
145
|
+
onClick: _cache[2] || (_cache[2] = ($event) => showCalendar.value = false),
|
|
146
|
+
class: "button bg-light flex-child-full pd-small radius-small"
|
|
147
|
+
}, " Cancel ")
|
|
148
|
+
])
|
|
149
|
+
]),
|
|
150
|
+
_: 1
|
|
151
|
+
}, 8, ["isPopupOpen"])
|
|
152
|
+
]);
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const FilterDateRange = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-dbe77cee"]]);
|
|
157
|
+
export {
|
|
158
|
+
FilterDateRange as default
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=FilterDateRange.vue2.js.map
|
package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterDateRange.vue2.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterDateRange.vue2.js","sources":["../../../../../../../../../src/modules/core/views/components/sections/filters/FilterDateRange.vue"],"sourcesContent":["<!-- FilterDateRange.vue -->\n<template>\n <div class=\"filter-date-range\">\n <!-- Quick options (only if provided) -->\n <div\n v-if=\"dateOptions.length > 0\"\n v-for=\"option in dateOptions\"\n :key=\"option.value\"\n @click=\"selectOption(option.value)\"\n :class=\"{ 'bg-light': selectedOption === option.value }\"\n class=\"pd-small radius-small cursor-pointer hover-bg-light transition-all mn-b-micro\"\n >\n {{ option.label }}\n </div>\n\n <!-- Custom dates with icon (like in Products) -->\n <div\n @click=\"() => { showCalendar = true }\"\n :class=\"{ 'bg-light': model }\"\n class=\"pd-small field-wrapper radius-small bg-light cursor-pointer hover-bg-light transition-all flex-v-center flex gap-thin\"\n >\n <IconCalendar class=\"i-medium\" />\n <span>{{ dateRangeLabel }}</span>\n </div>\n\n <!-- Calendar Popup -->\n <Popup\n :isPopupOpen=\"showCalendar\"\n @close-popup=\"showCalendar = false\"\n class=\"pd-medium bg-white radius-medium\"\n style=\"min-width: 350px;\"\n >\n <h3 class=\"mn-b-medium\">Select Date Range</h3>\n \n <Calendar\n v-model:date=\"tempDates\"\n :allowRange=\"true\"\n :disablePastDates=\"true\"\n class=\"mn-b-medium\"\n />\n \n <div class=\"flex gap-small\">\n <button \n @click=\"applyDates\"\n class=\"button bg-main t-white flex-child-full pd-small radius-small\"\n >\n Apply\n </button>\n <button \n @click=\"showCalendar = false\"\n class=\"button bg-light flex-child-full pd-small radius-small\"\n >\n Cancel\n </button>\n </div>\n </Popup>\n </div>\n</template>\n\n<script setup>\nimport { ref, computed, watch } from 'vue'\nimport Calendar from '@martyrs/src/components/Calendar/Calendar.vue'\nimport Popup from '@martyrs/src/components/Popup/Popup.vue'\nimport IconCalendar from '@martyrs/src/modules/icons/entities/IconCalendar.vue'\nimport { useGlobalMixins } from '@martyrs/src/modules/core/views/mixins/mixins.js'\n\nconst { formatDate } = useGlobalMixins()\n\nconst props = defineProps({\n dateOptions: {\n type: Array,\n default: () => []\n }\n})\n\nconst model = defineModel({\n type: Object,\n default: () => null\n})\n\nconst emit = defineEmits(['update:modelValue', 'apply'])\n\nconst showCalendar = ref(false)\nconst selectedOption = ref(null)\nconst tempDates = ref(null)\n\nconst dateRangeLabel = computed(() => {\n if (!model.value || !model.value.start || !model.value.end) {\n return 'Select dates'\n }\n const start = formatDate(model.value.start, { dayMonth: true, language: 'en' })\n const end = formatDate(model.value.end, { dayMonth: true, language: 'en' })\n return `${start} - ${end}`\n})\n\nconst selectOption = (value) => {\n selectedOption.value = value\n const today = new Date()\n today.setHours(0, 0, 0, 0)\n \n let dateRange = null\n \n switch(value) {\n case 'today':\n dateRange = {\n start: today,\n end: today\n }\n break\n case 'week':\n const weekEnd = new Date(today)\n weekEnd.setDate(today.getDate() + 7)\n dateRange = {\n start: today,\n end: weekEnd\n }\n break\n case 'month':\n const monthEnd = new Date(today)\n monthEnd.setMonth(today.getMonth() + 1)\n dateRange = {\n start: today,\n end: monthEnd\n }\n break\n }\n \n if (dateRange) {\n model.value = dateRange\n emit('apply')\n }\n}\n\nconst applyDates = () => {\n if (tempDates.value) {\n model.value = tempDates.value\n selectedOption.value = 'custom'\n emit('apply')\n }\n showCalendar.value = false\n}\n\n// Watch for model changes to update selected option\nwatch(() => model.value, (newVal) => {\n if (newVal && newVal.start && newVal.end) {\n tempDates.value = { ...newVal }\n \n // Determine which option is selected based on dates\n const today = new Date()\n today.setHours(0, 0, 0, 0)\n const start = new Date(newVal.start)\n start.setHours(0, 0, 0, 0)\n const end = new Date(newVal.end)\n end.setHours(0, 0, 0, 0)\n \n const diffDays = Math.round((end - start) / (1000 * 60 * 60 * 24))\n \n if (start.getTime() === today.getTime() && end.getTime() === today.getTime()) {\n selectedOption.value = 'today'\n } else if (start.getTime() === today.getTime() && diffDays === 7) {\n selectedOption.value = 'week'\n } else if (start.getTime() === today.getTime() && diffDays >= 28 && diffDays <= 31) {\n selectedOption.value = 'month'\n } else {\n selectedOption.value = 'custom'\n }\n } else {\n selectedOption.value = null\n }\n}, { immediate: true, deep: true })\n</script>\n\n<style scoped>\n.filter-date-range {\n width: 100%;\n}\n</style>"],"names":["_useModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,UAAM,EAAE,WAAU,IAAK,gBAAe;AAStC,UAAM,QAAQA,SAAW,SAAA,YAGxB;AAED,UAAM,OAAO;AAEb,UAAM,eAAe,IAAI,KAAK;AAC9B,UA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M,OAAO,CAAC,WAAW;AACnC,UAAI,UAAU,OAAO,SAAS,OAAO,KAAK;AACxC,kBAAU,QAAQ,EAAE,GAAG,OAAM;AAG7B,cAAM,QAAQ,oBAAI,KAAI;AACtB,cAAM,SAAS,GAAG,GAAG,GAAG,CAAC;AACzB,cAAM,QAAQ,IAAI,KAAK,OAAO,KAAK;AACnC,cAAM,SAAS,GAAG,GAAG,GAAG,CAAC;AACzB,cAAM,MAAM,IAAI,KAAK,OAAO,GAAG;AAC/B,YAAI,SAAS,GAAG,GAAG,GAAG,CAAC;AAEvB,cAAM,WAAW,KAAK,OAAO,MAAM,UAAU,MAAO,KAAK,KAAK,GAAG;AAEjE,YAAI,MAAM,cAAc,MAAM,QAAO,KAAM,IAAI,QAAO,MAAO,MAAM,WAAW;AAC5E,yBAAe,QAAQ;AAAA,QACzB,WAAW,MAAM,QAAO,MAAO,MAAM,QAAO,KAAM,aAAa,GAAG;AAChE,yBAAe,QAAQ;AAAA,QACzB,WAAW,MAAM,QAAO,MAAO,MAAM,QAAO,KAAM,YAAY,MAAM,YAAY,IAAI;AAClF,yBAAe,QAAQ;AAAA,QACzB,OAAO;AACL,yBAAe,QAAQ;AAAA,QACzB;AAAA,MACF,OAAO;AACL,uBAAe,QAAQ;AAAA,MACzB;AAAA,IACF,GAAG,EAAE,WAAW,MAAM,MAAM,KAAI,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { mergeModels, useModel, createElementBlock, openBlock, Fragment, renderList, createBlock } from "vue";
|
|
2
|
+
import _sfc_main$1 from "../../../../../../components/Checkbox/Checkbox.vue.js";
|
|
3
|
+
const _hoisted_1 = { class: "filter-options" };
|
|
4
|
+
const _sfc_main = {
|
|
5
|
+
__name: "FilterOptions",
|
|
6
|
+
props: /* @__PURE__ */ mergeModels({
|
|
7
|
+
options: {
|
|
8
|
+
type: Array,
|
|
9
|
+
required: true,
|
|
10
|
+
default: () => []
|
|
11
|
+
}
|
|
12
|
+
}, {
|
|
13
|
+
"modelValue": {
|
|
14
|
+
type: String,
|
|
15
|
+
default: null
|
|
16
|
+
},
|
|
17
|
+
"modelModifiers": {}
|
|
18
|
+
}),
|
|
19
|
+
emits: /* @__PURE__ */ mergeModels(["apply"], ["update:modelValue"]),
|
|
20
|
+
setup(__props, { emit: __emit }) {
|
|
21
|
+
const model = useModel(__props, "modelValue");
|
|
22
|
+
const emit = __emit;
|
|
23
|
+
return (_ctx, _cache) => {
|
|
24
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
25
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
|
|
26
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
27
|
+
key: option.value,
|
|
28
|
+
radio: model.value,
|
|
29
|
+
"onUpdate:radio": [
|
|
30
|
+
_cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
31
|
+
_cache[1] || (_cache[1] = ($event) => emit("apply"))
|
|
32
|
+
],
|
|
33
|
+
label: option.label,
|
|
34
|
+
value: option.value,
|
|
35
|
+
mode: "radio",
|
|
36
|
+
class: "mn-b-micro"
|
|
37
|
+
}, null, 8, ["radio", "label", "value"]);
|
|
38
|
+
}), 128))
|
|
39
|
+
]);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
_sfc_main as default
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=FilterOptions.vue.js.map
|
package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterOptions.vue.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterOptions.vue.js","sources":["../../../../../../../../../src/modules/core/views/components/sections/filters/FilterOptions.vue"],"sourcesContent":["<!-- filters/FilterOptions.vue -->\n<template>\n <div class=\"filter-options\">\n <Checkbox\n v-for=\"option in options\"\n :key=\"option.value\"\n v-model:radio=\"model\"\n :label=\"option.label\"\n :value=\"option.value\"\n mode=\"radio\"\n class=\"mn-b-micro\"\n @update:radio=\"emit('apply')\"\n />\n </div>\n</template>\n\n<script setup>\nimport Checkbox from '@martyrs/src/components/Checkbox/Checkbox.vue'\n\nconst props = defineProps({\n options: {\n type: Array,\n required: true,\n default: () => []\n }\n})\n\nconst model = defineModel({\n type: String,\n default: null\n})\n\nconst emit = defineEmits(['apply'])\n</script>"],"names":["_useModel"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,UAAM,QAAQA,SAAW,SAAA,YAGxB;AAED,UAAM,OAAO;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { mergeModels, useModel, ref, watch, createElementBlock, openBlock, createElementVNode, createCommentVNode, createVNode, Fragment, renderList, normalizeClass, toDisplayString } from "vue";
|
|
2
|
+
import Field from "../../../../../../components/Field/Field.vue.js";
|
|
3
|
+
const _hoisted_1 = { class: "filter-price" };
|
|
4
|
+
const _hoisted_2 = { class: "flex flex-v-center gap-thin" };
|
|
5
|
+
const _hoisted_3 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "mt-thin"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_4 = ["onClick"];
|
|
10
|
+
const _sfc_main = {
|
|
11
|
+
__name: "FilterRange",
|
|
12
|
+
props: /* @__PURE__ */ mergeModels({
|
|
13
|
+
config: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: () => ({})
|
|
16
|
+
},
|
|
17
|
+
minPlaceholder: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: "Min"
|
|
20
|
+
},
|
|
21
|
+
maxPlaceholder: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "Max"
|
|
24
|
+
},
|
|
25
|
+
label: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: void 0
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
"modelValue": {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: () => ({ min: null, max: null })
|
|
33
|
+
},
|
|
34
|
+
"modelModifiers": {}
|
|
35
|
+
}),
|
|
36
|
+
emits: /* @__PURE__ */ mergeModels(["update:modelValue", "apply"], ["update:modelValue"]),
|
|
37
|
+
setup(__props, { emit: __emit }) {
|
|
38
|
+
const model = useModel(__props, "modelValue");
|
|
39
|
+
const emit = __emit;
|
|
40
|
+
const localValue = ref({
|
|
41
|
+
min: model.value?.min || null,
|
|
42
|
+
max: model.value?.max || null
|
|
43
|
+
});
|
|
44
|
+
watch(model, (val) => {
|
|
45
|
+
if (val) {
|
|
46
|
+
localValue.value = {
|
|
47
|
+
min: val.min || null,
|
|
48
|
+
max: val.max || null
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}, { deep: true });
|
|
52
|
+
const updateValue = () => {
|
|
53
|
+
model.value = { ...localValue.value };
|
|
54
|
+
emit("apply");
|
|
55
|
+
};
|
|
56
|
+
const applyPreset = (preset) => {
|
|
57
|
+
localValue.value = {
|
|
58
|
+
min: preset.min || null,
|
|
59
|
+
max: preset.max || null
|
|
60
|
+
};
|
|
61
|
+
updateValue();
|
|
62
|
+
};
|
|
63
|
+
const isPresetActive = (preset) => {
|
|
64
|
+
return localValue.value.min === preset.min && localValue.value.max === preset.max;
|
|
65
|
+
};
|
|
66
|
+
return (_ctx, _cache) => {
|
|
67
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
68
|
+
createElementVNode("div", _hoisted_2, [
|
|
69
|
+
createVNode(Field, {
|
|
70
|
+
type: "number",
|
|
71
|
+
field: localValue.value.min,
|
|
72
|
+
"onUpdate:field": _cache[0] || (_cache[0] = ($event) => localValue.value.min = $event),
|
|
73
|
+
placeholder: __props.minPlaceholder,
|
|
74
|
+
label: __props.label,
|
|
75
|
+
class: "flex-1 bg-light pd-regular radius-small",
|
|
76
|
+
onBlur: updateValue
|
|
77
|
+
}, null, 8, ["field", "placeholder", "label"]),
|
|
78
|
+
_cache[2] || (_cache[2] = createElementVNode("span", { class: "t-small" }, "—", -1)),
|
|
79
|
+
createVNode(Field, {
|
|
80
|
+
type: "number",
|
|
81
|
+
field: localValue.value.max,
|
|
82
|
+
"onUpdate:field": _cache[1] || (_cache[1] = ($event) => localValue.value.max = $event),
|
|
83
|
+
placeholder: __props.maxPlaceholder,
|
|
84
|
+
label: __props.label,
|
|
85
|
+
class: "flex-1 bg-light pd-regular radius-small",
|
|
86
|
+
onBlur: updateValue
|
|
87
|
+
}, null, 8, ["field", "placeholder", "label"])
|
|
88
|
+
]),
|
|
89
|
+
__props.config?.presets ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
90
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.config.presets, (preset) => {
|
|
91
|
+
return openBlock(), createElementBlock("button", {
|
|
92
|
+
key: preset.label,
|
|
93
|
+
onClick: ($event) => applyPreset(preset),
|
|
94
|
+
class: normalizeClass(["btn btn-small mr-thin mb-thin", isPresetActive(preset) ? "btn-primary" : "btn-secondary"])
|
|
95
|
+
}, toDisplayString(preset.label), 11, _hoisted_4);
|
|
96
|
+
}), 128))
|
|
97
|
+
])) : createCommentVNode("", true)
|
|
98
|
+
]);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
_sfc_main as default
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=FilterRange.vue.js.map
|
package/dist/martyrs/src/modules/core/views/components/sections/filters/FilterRange.vue.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterRange.vue.js","sources":["../../../../../../../../../src/modules/core/views/components/sections/filters/FilterRange.vue"],"sourcesContent":["<!-- filters/FilterPrice.vue -->\n<template>\n <div class=\"filter-price\">\n <div class=\"flex flex-v-center gap-thin\">\n <Field\n type=\"number\"\n v-model:field=\"localValue.min\"\n :placeholder=\"minPlaceholder\"\n :label=\"label\"\n class=\"flex-1 bg-light pd-regular radius-small\"\n @blur=\"updateValue\"\n />\n <span class=\"t-small\">—</span>\n <Field\n type=\"number\"\n v-model:field=\"localValue.max\"\n :placeholder=\"maxPlaceholder\"\n :label=\"label\"\n class=\"flex-1 bg-light pd-regular radius-small\"\n @blur=\"updateValue\"\n />\n </div>\n \n <div v-if=\"config?.presets\" class=\"mt-thin\">\n <button\n v-for=\"preset in config.presets\"\n :key=\"preset.label\"\n @click=\"applyPreset(preset)\"\n class=\"btn btn-small mr-thin mb-thin\"\n :class=\"isPresetActive(preset) ? 'btn-primary' : 'btn-secondary'\"\n >\n {{ preset.label }}\n </button>\n </div>\n </div>\n</template>\n\n<script setup>\nimport { ref, watch } from 'vue'\nimport Field from '@martyrs/src/components/Field/Field.vue';\n\nconst props = defineProps({\n config: {\n type: Object,\n default: () => ({})\n },\n minPlaceholder: {\n type: String,\n default: 'Min'\n },\n maxPlaceholder: {\n type: String,\n default: 'Max'\n },\n label: {\n type: String,\n default: undefined\n }\n})\n\nconst model = defineModel({\n type: Object,\n default: () => ({ min: null, max: null })\n})\n\nconst emit = defineEmits(['update:modelValue', 'apply'])\n\nconst localValue = ref({ \n min: model.value?.min || null, \n max: model.value?.max || null \n})\n\nwatch(model, (val) => {\n if (val) {\n localValue.value = { \n min: val.min || null, \n max: val.max || null \n }\n }\n}, { deep: true })\n\nconst updateValue = () => {\n model.value = { ...localValue.value }\n emit('apply')\n}\n\nconst applyPreset = (preset) => {\n localValue.value = { \n min: preset.min || null, \n max: preset.max || null \n }\n updateValue()\n}\n\nconst isPresetActive = (preset) => {\n return localValue.value.min === preset.min && localValue.value.max === preset.max\n}\n</script>"],"names":["_useModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,UAAM,QAAQA,SAAW,SAAA,YAGxB;AAED,UAAM,OAAO;AAEb,UAAM,aAAa,IAAI;AAAA,MACrB,KAAK,MAAM,OAAO,OAAO;AAAA,MACzB,KAAK,MAAM,OAAO,OAAO;AAAA,IAC3B,CAAC;AAED,UAAM,OAAO,CAAC,QAAQ;AACpB,UAAI,KAAK;AACP,mBAAW,QAAQ;AAAA,UACjB,KAAK,IAAI,OAAO;AAAA,UAChB,KAAK,IAAI,OAAO;AAAA,QACtB;AAAA,MACE;AAAA,IACF,GAAG,EAAE,MAAM,KAAI,CAAE;AAEjB,UAAM,cAAc,MAAM;AACxB,YAAM,QAAQ,EAAE,GAAG,WAAW,MAAK;AACnC,WAAK,OAAO;AAAA,IACd;AAEA,UAAM,cAAc,CAAC,WAAW;AAC9B,iBAAW,QAAQ;AAAA,QACjB,KAAK,OAAO,OAAO;AAAA,QACnB,KAAK,OAAO,OAAO;AAAA,MACvB;AACE,kBAAW;AAAA,IACb;AAEA,UAAM,iBAAiB,CAAC,WAAW;AACjC,aAAO,WAAW,MAAM,QAAQ,OAAO,OAAO,WAAW,MAAM,QAAQ,OAAO;AAAA,IAChF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|