@ozdao/martyrs 0.2.540 → 0.2.542
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/_virtual/index.cjs +4 -4
- package/dist/_virtual/index.js +4 -4
- package/dist/_virtual/index2.cjs +3 -6
- package/dist/_virtual/index2.cjs.map +1 -1
- package/dist/_virtual/index2.js +2 -5
- package/dist/_virtual/index2.js.map +1 -1
- package/dist/{globals.verifier-CJ1lr-NW.cjs → globals.verifier-Bi-XLEi9.cjs} +24 -23
- package/dist/{globals.verifier-BhqUrneb.js → globals.verifier-gPPX_jhf.js} +24 -23
- package/dist/inventory.server.cjs +1 -1
- package/dist/inventory.server.js +1 -1
- package/dist/{main-gOfhekZG.js → main-ByKkD9qa.js} +2857 -3276
- package/dist/main-Czyu-VcC.cjs +11 -0
- package/dist/martyrs/src/components/Button/{Button.vue2.cjs → Button.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Button/{Button.vue2.js.map → Button.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Button/{Button.vue2.js → Button.vue.js} +2 -2
- package/dist/martyrs/src/components/Button/Button.vue.js.map +1 -0
- package/dist/martyrs/src/components/FieldBig/FieldBig.vue.cjs +1 -1
- package/dist/martyrs/src/components/FieldBig/FieldBig.vue.js +1 -1
- package/dist/martyrs/src/components/FieldTags/BlockTags.vue.cjs +30 -21
- package/dist/martyrs/src/components/FieldTags/BlockTags.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/FieldTags/BlockTags.vue.js +32 -23
- package/dist/martyrs/src/components/FieldTags/BlockTags.vue.js.map +1 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue2.cjs +235 -0
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue2.js +235 -0
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue2.js.map +1 -0
- package/dist/martyrs/src/components/Marquee/Marquee.vue.cjs +17 -8
- package/dist/martyrs/src/components/Marquee/Marquee.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Marquee/Marquee.vue.js +17 -8
- package/dist/martyrs/src/components/Marquee/Marquee.vue.js.map +1 -1
- package/dist/martyrs/src/components/UploadImage/UploadImage.vue.cjs +161 -42
- package/dist/martyrs/src/components/UploadImage/UploadImage.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/UploadImage/UploadImage.vue.js +162 -43
- package/dist/martyrs/src/components/UploadImage/UploadImage.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +1 -1
- 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.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditAccount.vue.cjs +1 -1
- 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.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditProfile.vue.js +4 -4
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +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.cjs +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.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +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.cjs +1 -4
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -4
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js.map +1 -1
- package/dist/martyrs/src/modules/constructor/components/elements/Card.vue.js +2 -2
- package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.cjs +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.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +21 -21
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupAuth.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupAuth.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/store/globals.cjs +2 -2
- package/dist/martyrs/src/modules/globals/views/store/globals.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/store/globals.js +2 -2
- package/dist/martyrs/src/modules/globals/views/store/globals.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.js +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.cjs +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.js +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.js +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/cards/AlbumCard.vue.cjs +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.cjs +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.cjs +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.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.js +11 -11
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.js +12 -12
- package/dist/martyrs/src/modules/music/components/forms/PlaylistForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/PlaylistForm.vue.js +16 -16
- package/dist/martyrs/src/modules/music/components/forms/SearchForm.vue.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.js +16 -16
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Artist.vue.cjs +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.cjs +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.cjs +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.cjs +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.cjs +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.cjs +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.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormApplicationDetails.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormSelectCustomer.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormSelectCustomer.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +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.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/CustomerDetails.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +3 -4
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js +3 -4
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +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.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.js +20 -20
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs +3 -4
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js +3 -4
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +4 -5
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +4 -5
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +2 -3
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +2 -3
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +6 -6
- package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.cjs +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.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/CardProduct.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/CardProduct.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/elements/{THC.vue2.cjs → THC.vue.cjs} +2 -2
- package/dist/martyrs/src/modules/products/components/elements/THC.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/products/components/elements/{THC.vue2.js → THC.vue.js} +2 -2
- package/dist/martyrs/src/modules/products/components/elements/THC.vue.js.map +1 -0
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.cjs +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.cjs +63 -39
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +69 -45
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditAttributes.vue.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/ProductConfigurator.vue.cjs +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.cjs +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.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +2 -2
- package/dist/martyrs/src/modules/products/store/categories.cjs +4 -0
- package/dist/martyrs/src/modules/products/store/categories.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/store/categories.js +4 -0
- package/dist/martyrs/src/modules/products/store/categories.js.map +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.cjs +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.cjs +1 -1
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Map.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Map.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +11 -11
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.js +1 -1
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/music.server.cjs +1 -1
- package/dist/music.server.js +1 -1
- package/dist/node_modules/.pnpm/lodash.merge@4.6.2/node_modules/lodash.merge/index.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash.merge@4.6.2/node_modules/lodash.merge/index.js +1 -1
- package/dist/orders.server.cjs +1 -1
- package/dist/orders.server.js +1 -1
- package/dist/organizations.server.cjs +1 -1
- package/dist/organizations.server.js +1 -1
- package/dist/products.server.cjs +10 -2
- package/dist/products.server.js +10 -2
- package/dist/rents.server.cjs +1 -1
- package/dist/rents.server.js +1 -1
- package/dist/style.css +129 -129
- package/dist/{web-DxxU2bwy.js → web-BklgIiYr.js} +1 -1
- package/dist/{web-bMa0DMyG.cjs → web-CQBm7C6L.cjs} +1 -1
- package/package.json +1 -1
- package/src/components/FieldTags/BlockTags.vue +28 -16
- package/src/components/FieldTags/FieldTags.vue +327 -508
- package/src/components/Marquee/Marquee.vue +25 -14
- package/src/components/UploadImage/UploadImage.vue +192 -18
- package/src/modules/community/components/pages/CreateBlogPost.vue +0 -1
- package/src/modules/globals/controllers/classes/globals.validator.js +24 -23
- package/src/modules/globals/views/store/globals.js +2 -2
- package/src/modules/products/components/pages/CategoryEdit.vue +73 -39
- package/src/modules/products/middlewares/categories.verifier.js +9 -1
- package/src/modules/products/store/categories.js +5 -0
- package/dist/_virtual/index3.cjs +0 -5
- package/dist/_virtual/index3.cjs.map +0 -1
- package/dist/_virtual/index3.js +0 -5
- package/dist/_virtual/index3.js.map +0 -1
- package/dist/main-Zhs0EqRp.cjs +0 -11
- package/dist/martyrs/src/components/Button/Button.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.cjs +0 -480
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.cjs.map +0 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.js +0 -480
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.js.map +0 -1
- package/dist/martyrs/src/components/FieldTags/create-tags.cjs +0 -43
- package/dist/martyrs/src/components/FieldTags/create-tags.cjs.map +0 -1
- package/dist/martyrs/src/components/FieldTags/create-tags.js +0 -43
- package/dist/martyrs/src/components/FieldTags/create-tags.js.map +0 -1
- package/dist/martyrs/src/components/FieldTags/tag-input.vue2.cjs +0 -32
- package/dist/martyrs/src/components/FieldTags/tag-input.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/FieldTags/tag-input.vue2.js +0 -32
- package/dist/martyrs/src/components/FieldTags/tag-input.vue2.js.map +0 -1
- package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.cjs +0 -329
- package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.cjs.map +0 -1
- package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.js +0 -329
- package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.js.map +0 -1
- package/dist/martyrs/src/modules/products/components/elements/THC.vue2.cjs.map +0 -1
- package/dist/martyrs/src/modules/products/components/elements/THC.vue2.js.map +0 -1
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.cjs +0 -39
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +0 -39
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js.map +0 -1
- package/src/components/FieldTags/create-tags.js +0 -84
- package/src/components/FieldTags/tag-input.vue +0 -55
- package/src/components/FieldTags/vue-tags-input.props.js +0 -342
- package/src/components/FieldTags/vue-tags-input.scss +0 -149
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
import { ref, shallowRef, computed, watch, onMounted, onBeforeUnmount, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, renderSlot, createCommentVNode, Fragment, renderList, createBlock, toDisplayString, withDirectives, withModifiers, vShow, withKeys, unref, nextTick } from "vue";
|
|
2
|
-
import equal from "../../../../_virtual/index.js";
|
|
3
|
-
import { createTag, createClasses, createTags, clone } from "./create-tags.js";
|
|
4
|
-
import TagInput from "./tag-input.vue2.js";
|
|
5
|
-
import props from "./vue-tags-input.props.js";
|
|
6
|
-
/* empty css */
|
|
7
|
-
const _hoisted_1 = { class: "ti-input" };
|
|
8
|
-
const _hoisted_2 = {
|
|
9
|
-
key: 0,
|
|
10
|
-
class: "ti-tags"
|
|
11
|
-
};
|
|
12
|
-
const _hoisted_3 = ["onClick"];
|
|
13
|
-
const _hoisted_4 = { class: "ti-content" };
|
|
14
|
-
const _hoisted_5 = {
|
|
15
|
-
key: 0,
|
|
16
|
-
class: "ti-tag-left"
|
|
17
|
-
};
|
|
18
|
-
const _hoisted_6 = ["onClick"];
|
|
19
|
-
const _hoisted_7 = {
|
|
20
|
-
key: 1,
|
|
21
|
-
class: "ti-tag-right"
|
|
22
|
-
};
|
|
23
|
-
const _hoisted_8 = { class: "ti-actions" };
|
|
24
|
-
const _hoisted_9 = ["onClick"];
|
|
25
|
-
const _hoisted_10 = ["onClick"];
|
|
26
|
-
const _hoisted_11 = { class: "ti-new-tag-input-wrapper" };
|
|
27
|
-
const _hoisted_12 = ["placeholder", "value", "maxlength", "disabled"];
|
|
28
|
-
const _hoisted_13 = ["onMouseenter"];
|
|
29
|
-
const _hoisted_14 = ["onClick"];
|
|
30
|
-
const _sfc_main = {
|
|
31
|
-
__name: "FieldTags",
|
|
32
|
-
props,
|
|
33
|
-
emits: [
|
|
34
|
-
"adding-duplicate",
|
|
35
|
-
"before-adding-tag",
|
|
36
|
-
"before-deleting-tag",
|
|
37
|
-
"before-editing-tag",
|
|
38
|
-
"before-saving-tag",
|
|
39
|
-
"max-tags-reached",
|
|
40
|
-
"saving-duplicate",
|
|
41
|
-
"tags-changed",
|
|
42
|
-
"tag-clicked",
|
|
43
|
-
"update:modelValue",
|
|
44
|
-
"update:tags"
|
|
45
|
-
],
|
|
46
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
47
|
-
const propsObj = __props;
|
|
48
|
-
const emit = __emit;
|
|
49
|
-
const tagCenterRefs = ref(/* @__PURE__ */ new Map());
|
|
50
|
-
const newTag = ref(propsObj.modelValue || "");
|
|
51
|
-
const tagsCopy = shallowRef([]);
|
|
52
|
-
const tagsEditStatus = ref([]);
|
|
53
|
-
const deletionMark = ref(null);
|
|
54
|
-
const deletionMarkTimer = ref(null);
|
|
55
|
-
const selectedItem = ref(null);
|
|
56
|
-
const focused = ref(false);
|
|
57
|
-
const newTagInputRef = ref(null);
|
|
58
|
-
const autocompleteOpen = computed(() => {
|
|
59
|
-
if (propsObj.autocompleteAlwaysOpen) return true;
|
|
60
|
-
return newTag.value !== null && newTag.value.length >= propsObj.autocompleteMinLength && filteredAutocompleteItems.value.length > 0 && focused.value;
|
|
61
|
-
});
|
|
62
|
-
const filteredAutocompleteItems = computed(() => {
|
|
63
|
-
const items = propsObj.autocompleteItems.map(
|
|
64
|
-
(i) => createTag(i, propsObj.tags, propsObj.validation, propsObj.isDuplicate)
|
|
65
|
-
);
|
|
66
|
-
if (!propsObj.autocompleteFilterDuplicates) return items;
|
|
67
|
-
return items.filter(duplicateFilter);
|
|
68
|
-
});
|
|
69
|
-
const getSelectedIndex = (method) => {
|
|
70
|
-
const items = filteredAutocompleteItems.value;
|
|
71
|
-
const current = selectedItem.value;
|
|
72
|
-
const lastItem = items.length - 1;
|
|
73
|
-
if (items.length === 0) return;
|
|
74
|
-
if (current === null) return 0;
|
|
75
|
-
if (method === "before" && current === 0) return lastItem;
|
|
76
|
-
if (method === "after" && current === lastItem) return 0;
|
|
77
|
-
return method === "after" ? current + 1 : current - 1;
|
|
78
|
-
};
|
|
79
|
-
const selectDefaultItem = () => {
|
|
80
|
-
selectedItem.value = propsObj.addOnlyFromAutocomplete && filteredAutocompleteItems.value.length > 0 ? 0 : null;
|
|
81
|
-
};
|
|
82
|
-
const selectItem = (method) => {
|
|
83
|
-
selectedItem.value = getSelectedIndex(method);
|
|
84
|
-
};
|
|
85
|
-
const isSelected = (index) => selectedItem.value === index;
|
|
86
|
-
const isMarked = (index) => deletionMark.value === index;
|
|
87
|
-
const setTagCenter = (el, index) => {
|
|
88
|
-
if (el) {
|
|
89
|
-
tagCenterRefs.value.set(index, el);
|
|
90
|
-
} else {
|
|
91
|
-
tagCenterRefs.value.delete(index);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const invokeDelete = () => {
|
|
95
|
-
if (!propsObj.deleteOnBackspace || newTag.value.length > 0) return;
|
|
96
|
-
const lastIndex = tagsCopy.value.length - 1;
|
|
97
|
-
if (deletionMark.value === null) {
|
|
98
|
-
clearTimeout(deletionMarkTimer.value);
|
|
99
|
-
deletionMarkTimer.value = setTimeout(() => deletionMark.value = null, 1e3);
|
|
100
|
-
deletionMark.value = lastIndex;
|
|
101
|
-
} else {
|
|
102
|
-
performDeleteTag(lastIndex);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
const addTagsFromPaste = () => {
|
|
106
|
-
if (!propsObj.addFromPaste) return;
|
|
107
|
-
setTimeout(() => performAddTags(newTag.value), 10);
|
|
108
|
-
};
|
|
109
|
-
const performEditTag = (index) => {
|
|
110
|
-
if (!propsObj.allowEditTags) return;
|
|
111
|
-
if (!propsObj.onBeforeEditingTag) {
|
|
112
|
-
editTag(index);
|
|
113
|
-
} else {
|
|
114
|
-
emit("before-editing-tag", {
|
|
115
|
-
index,
|
|
116
|
-
tag: tagsCopy.value[index],
|
|
117
|
-
editTag: () => editTag(index)
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
const editTag = (index) => {
|
|
122
|
-
if (!propsObj.allowEditTags) return;
|
|
123
|
-
toggleEditMode(index);
|
|
124
|
-
focus(index);
|
|
125
|
-
};
|
|
126
|
-
const toggleEditMode = (index) => {
|
|
127
|
-
if (!propsObj.allowEditTags || propsObj.disabled) return;
|
|
128
|
-
tagsEditStatus.value[index] = !tagsEditStatus.value[index];
|
|
129
|
-
};
|
|
130
|
-
const createChangedTag = (index, event) => {
|
|
131
|
-
const tag = tagsCopy.value[index];
|
|
132
|
-
tag.text = event ? event.target.value : tagsCopy.value[index].text;
|
|
133
|
-
const newTags = [...tagsCopy.value];
|
|
134
|
-
newTags[index] = createTag(tag, tagsCopy.value, propsObj.validation, propsObj.isDuplicate);
|
|
135
|
-
tagsCopy.value = newTags;
|
|
136
|
-
};
|
|
137
|
-
const focus = (index) => {
|
|
138
|
-
nextTick(() => {
|
|
139
|
-
const el = tagCenterRefs.value.get(index)?.querySelector("input.ti-tag-input");
|
|
140
|
-
if (el) el.focus();
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
const quote = (regex) => regex.replace(/([()[{*+.$^\\|?])/g, "\\$1");
|
|
144
|
-
const cancelEdit = (index) => {
|
|
145
|
-
if (!propsObj.tags[index]) return;
|
|
146
|
-
const newTags = [...tagsCopy.value];
|
|
147
|
-
newTags[index] = clone(createTag(propsObj.tags[index], propsObj.tags, propsObj.validation, propsObj.isDuplicate));
|
|
148
|
-
tagsCopy.value = newTags;
|
|
149
|
-
tagsEditStatus.value[index] = false;
|
|
150
|
-
};
|
|
151
|
-
const hasForbiddingAddRule = (tiClasses) => {
|
|
152
|
-
return tiClasses.some((type) => {
|
|
153
|
-
const rule = propsObj.validation.find((rule2) => type === rule2.classes);
|
|
154
|
-
return rule ? rule.disableAdd : false;
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
const createTagTexts = (string) => {
|
|
158
|
-
const regex = new RegExp(propsObj.separators.map((s) => quote(s)).join("|"));
|
|
159
|
-
return string.split(regex).map((text) => ({ text }));
|
|
160
|
-
};
|
|
161
|
-
const performDeleteTag = (index) => {
|
|
162
|
-
if (!propsObj.onBeforeDeletingTag) {
|
|
163
|
-
deleteTag(index);
|
|
164
|
-
} else {
|
|
165
|
-
emit("before-deleting-tag", {
|
|
166
|
-
index,
|
|
167
|
-
tag: tagsCopy.value[index],
|
|
168
|
-
deleteTag: () => deleteTag(index)
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
const deleteTag = (index) => {
|
|
173
|
-
if (propsObj.disabled) return;
|
|
174
|
-
deletionMark.value = null;
|
|
175
|
-
clearTimeout(deletionMarkTimer.value);
|
|
176
|
-
const newTags = [...tagsCopy.value];
|
|
177
|
-
newTags.splice(index, 1);
|
|
178
|
-
tagsCopy.value = newTags;
|
|
179
|
-
tagsEditStatus.value.splice(index, 1);
|
|
180
|
-
emit("update:tags", tagsCopy.value);
|
|
181
|
-
emit("tags-changed", tagsCopy.value);
|
|
182
|
-
};
|
|
183
|
-
const noTriggerKey = (event, category) => {
|
|
184
|
-
const triggerKey = propsObj[category].indexOf(event.keyCode) !== -1 || propsObj[category].indexOf(event.key) !== -1;
|
|
185
|
-
if (triggerKey) event.preventDefault();
|
|
186
|
-
return !triggerKey;
|
|
187
|
-
};
|
|
188
|
-
const performAddTags = (tag, event, source) => {
|
|
189
|
-
if (propsObj.disabled || event && noTriggerKey(event, "addOnKey")) return;
|
|
190
|
-
let tags = [];
|
|
191
|
-
if (typeof tag === "object") tags = [tag];
|
|
192
|
-
if (typeof tag === "string") tags = createTagTexts(tag);
|
|
193
|
-
tags = tags.filter((tag2) => tag2.text.trim().length > 0);
|
|
194
|
-
tags.forEach((tag2) => {
|
|
195
|
-
tag2 = createTag(tag2, propsObj.tags, propsObj.validation, propsObj.isDuplicate);
|
|
196
|
-
if (!propsObj.onBeforeAddingTag) {
|
|
197
|
-
addTag(tag2, source);
|
|
198
|
-
} else {
|
|
199
|
-
emit("before-adding-tag", {
|
|
200
|
-
tag: tag2,
|
|
201
|
-
addTag: () => addTag(tag2, source)
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
const duplicateFilter = (tag) => {
|
|
207
|
-
return propsObj.isDuplicate ? !propsObj.isDuplicate(tagsCopy.value, tag) : !tagsCopy.value.find((t) => t.text === tag.text);
|
|
208
|
-
};
|
|
209
|
-
const addTag = (tag, source = "new-tag-input") => {
|
|
210
|
-
const options = filteredAutocompleteItems.value.map((i) => i.text);
|
|
211
|
-
if (propsObj.addOnlyFromAutocomplete && options.indexOf(tag.text) === -1) return;
|
|
212
|
-
nextTick(() => {
|
|
213
|
-
const maximumReached = propsObj.maxTags && propsObj.maxTags <= tagsCopy.value.length;
|
|
214
|
-
if (maximumReached) return emit("max-tags-reached", tag);
|
|
215
|
-
const dup = propsObj.avoidAddingDuplicates && !duplicateFilter(tag);
|
|
216
|
-
if (dup) return emit("adding-duplicate", tag);
|
|
217
|
-
if (hasForbiddingAddRule(tag.tiClasses)) return;
|
|
218
|
-
newTag.value = "";
|
|
219
|
-
tagsCopy.value = [...tagsCopy.value, tag];
|
|
220
|
-
tagsEditStatus.value.push(false);
|
|
221
|
-
emit("update:tags", tagsCopy.value);
|
|
222
|
-
if (source === "autocomplete") newTagInputRef.value?.focus();
|
|
223
|
-
emit("tags-changed", tagsCopy.value);
|
|
224
|
-
});
|
|
225
|
-
};
|
|
226
|
-
const performSaveTag = (index, event) => {
|
|
227
|
-
const tag = tagsCopy.value[index];
|
|
228
|
-
if (propsObj.disabled || event && noTriggerKey(event, "addOnKey")) return;
|
|
229
|
-
if (tag.text.trim().length === 0) return;
|
|
230
|
-
if (!propsObj["onBeforeSavingTag"]) {
|
|
231
|
-
saveTag(index, tag);
|
|
232
|
-
} else {
|
|
233
|
-
emit("before-saving-tag", {
|
|
234
|
-
index,
|
|
235
|
-
tag,
|
|
236
|
-
saveTag: () => saveTag(index, tag)
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
const saveTag = (index, tag) => {
|
|
241
|
-
if (propsObj.avoidAddingDuplicates) {
|
|
242
|
-
const tagsDiff = clone(tagsCopy.value);
|
|
243
|
-
const inputTag = tagsDiff.splice(index, 1)[0];
|
|
244
|
-
const dup = propsObj.isDuplicate ? propsObj.isDuplicate(tagsDiff, inputTag) : tagsDiff.map((t) => t.text).indexOf(inputTag.text) !== -1;
|
|
245
|
-
if (dup) return emit("saving-duplicate", tag);
|
|
246
|
-
}
|
|
247
|
-
if (hasForbiddingAddRule(tag.tiClasses)) return;
|
|
248
|
-
const newTags = [...tagsCopy.value];
|
|
249
|
-
newTags[index] = tag;
|
|
250
|
-
tagsCopy.value = newTags;
|
|
251
|
-
toggleEditMode(index);
|
|
252
|
-
emit("update:tags", tagsCopy.value);
|
|
253
|
-
emit("tags-changed", tagsCopy.value);
|
|
254
|
-
};
|
|
255
|
-
const tagsEqual = () => {
|
|
256
|
-
return !tagsCopy.value.some((t, i) => !equal(t, propsObj.tags[i]));
|
|
257
|
-
};
|
|
258
|
-
const updateNewTag = (event) => {
|
|
259
|
-
const value = event.target.value;
|
|
260
|
-
newTag.value = value;
|
|
261
|
-
emit("update:modelValue", value);
|
|
262
|
-
};
|
|
263
|
-
const initTags = () => {
|
|
264
|
-
tagsCopy.value = createTags(propsObj.tags, propsObj.validation, propsObj.isDuplicate);
|
|
265
|
-
tagsEditStatus.value = new Array(propsObj.tags.length).fill(false);
|
|
266
|
-
if (!tagsEqual()) {
|
|
267
|
-
emit("update:tags", tagsCopy.value);
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
const blurredOnClick = (e) => {
|
|
271
|
-
const el = e.currentTarget;
|
|
272
|
-
if (el?.contains(e.target) || el?.contains(document.activeElement)) return;
|
|
273
|
-
performBlur();
|
|
274
|
-
};
|
|
275
|
-
const performBlur = () => {
|
|
276
|
-
if (propsObj.addOnBlur && focused.value) performAddTags(newTag.value);
|
|
277
|
-
focused.value = false;
|
|
278
|
-
};
|
|
279
|
-
const handleKeyDown = (event) => {
|
|
280
|
-
const item = filteredAutocompleteItems.value[selectedItem.value] || newTag.value;
|
|
281
|
-
performAddTags(item, event);
|
|
282
|
-
};
|
|
283
|
-
watch(() => propsObj.modelValue, (newValue) => {
|
|
284
|
-
if (!propsObj.addOnlyFromAutocomplete) selectedItem.value = null;
|
|
285
|
-
newTag.value = newValue;
|
|
286
|
-
});
|
|
287
|
-
watch(() => propsObj.tags, () => {
|
|
288
|
-
initTags();
|
|
289
|
-
}, { deep: true });
|
|
290
|
-
watch(autocompleteOpen, selectDefaultItem);
|
|
291
|
-
initTags();
|
|
292
|
-
onMounted(() => {
|
|
293
|
-
selectDefaultItem();
|
|
294
|
-
document.addEventListener("click", blurredOnClick);
|
|
295
|
-
});
|
|
296
|
-
onBeforeUnmount(() => {
|
|
297
|
-
document.removeEventListener("click", blurredOnClick);
|
|
298
|
-
clearTimeout(deletionMarkTimer.value);
|
|
299
|
-
});
|
|
300
|
-
__expose({
|
|
301
|
-
createClasses
|
|
302
|
-
});
|
|
303
|
-
return (_ctx, _cache) => {
|
|
304
|
-
return openBlock(), createElementBlock("div", {
|
|
305
|
-
class: normalizeClass(["vue-tags-input pos-relative", [{ "ti-disabled": _ctx.disabled }, { "ti-focus": focused.value }, _ctx.$attrs.class]]),
|
|
306
|
-
style: normalizeStyle(_ctx.$attrs.style)
|
|
307
|
-
}, [
|
|
308
|
-
createElementVNode("div", _hoisted_1, [
|
|
309
|
-
tagsCopy.value.length || !_ctx.disabled ? (openBlock(), createElementBlock("ul", _hoisted_2, [
|
|
310
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(tagsCopy.value, (tag, index) => {
|
|
311
|
-
return openBlock(), createElementBlock("li", {
|
|
312
|
-
key: `tag-${index}-${tag.text}`,
|
|
313
|
-
style: normalizeStyle(tag.style),
|
|
314
|
-
class: normalizeClass([[
|
|
315
|
-
{ "ti-editing": tagsEditStatus.value[index] },
|
|
316
|
-
tag.tiClasses,
|
|
317
|
-
tag.classes,
|
|
318
|
-
{ "ti-deletion-mark": isMarked(index) }
|
|
319
|
-
], "ti-tag t-medium"]),
|
|
320
|
-
tabindex: "0",
|
|
321
|
-
onClick: ($event) => emit("tag-clicked", { tag, index })
|
|
322
|
-
}, [
|
|
323
|
-
createElementVNode("div", _hoisted_4, [
|
|
324
|
-
_ctx.$slots["tag-left"] ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
325
|
-
renderSlot(_ctx.$slots, "tag-left", {
|
|
326
|
-
tag,
|
|
327
|
-
index,
|
|
328
|
-
edit: tagsEditStatus.value[index],
|
|
329
|
-
performSaveEdit: performSaveTag,
|
|
330
|
-
performDelete: performDeleteTag,
|
|
331
|
-
performCancelEdit: cancelEdit,
|
|
332
|
-
performOpenEdit: performEditTag,
|
|
333
|
-
deletionMark: isMarked(index)
|
|
334
|
-
})
|
|
335
|
-
])) : createCommentVNode("", true),
|
|
336
|
-
createElementVNode("div", {
|
|
337
|
-
ref_for: true,
|
|
338
|
-
ref: (el) => setTagCenter(el, index),
|
|
339
|
-
class: "ti-tag-center"
|
|
340
|
-
}, [
|
|
341
|
-
!_ctx.$slots["tag-center"] ? (openBlock(), createElementBlock("span", {
|
|
342
|
-
key: 0,
|
|
343
|
-
class: normalizeClass({ "ti-hidden": tagsEditStatus.value[index] }),
|
|
344
|
-
onClick: ($event) => performEditTag(index)
|
|
345
|
-
}, toDisplayString(tag.text), 11, _hoisted_6)) : createCommentVNode("", true),
|
|
346
|
-
!_ctx.$slots["tag-center"] ? (openBlock(), createBlock(TagInput, {
|
|
347
|
-
key: 1,
|
|
348
|
-
scope: {
|
|
349
|
-
edit: tagsEditStatus.value[index],
|
|
350
|
-
maxlength: _ctx.maxlength,
|
|
351
|
-
tag,
|
|
352
|
-
index,
|
|
353
|
-
validateTag: createChangedTag,
|
|
354
|
-
performCancelEdit: cancelEdit,
|
|
355
|
-
performSaveEdit: performSaveTag
|
|
356
|
-
}
|
|
357
|
-
}, null, 8, ["scope"])) : createCommentVNode("", true),
|
|
358
|
-
renderSlot(_ctx.$slots, "tag-center", {
|
|
359
|
-
tag,
|
|
360
|
-
index,
|
|
361
|
-
maxlength: _ctx.maxlength,
|
|
362
|
-
edit: tagsEditStatus.value[index],
|
|
363
|
-
performSaveEdit: performSaveTag,
|
|
364
|
-
performDelete: performDeleteTag,
|
|
365
|
-
performCancelEdit: cancelEdit,
|
|
366
|
-
validateTag: createChangedTag,
|
|
367
|
-
performOpenEdit: performEditTag,
|
|
368
|
-
deletionMark: isMarked(index)
|
|
369
|
-
})
|
|
370
|
-
], 512),
|
|
371
|
-
_ctx.$slots["tag-right"] ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
372
|
-
renderSlot(_ctx.$slots, "tag-right", {
|
|
373
|
-
tag,
|
|
374
|
-
index,
|
|
375
|
-
edit: tagsEditStatus.value[index],
|
|
376
|
-
performSaveEdit: performSaveTag,
|
|
377
|
-
performDelete: performDeleteTag,
|
|
378
|
-
performCancelEdit: cancelEdit,
|
|
379
|
-
performOpenEdit: performEditTag,
|
|
380
|
-
deletionMark: isMarked(index)
|
|
381
|
-
})
|
|
382
|
-
])) : createCommentVNode("", true)
|
|
383
|
-
]),
|
|
384
|
-
createElementVNode("div", _hoisted_8, [
|
|
385
|
-
!_ctx.$slots["tag-actions"] ? withDirectives((openBlock(), createElementBlock("i", {
|
|
386
|
-
key: 0,
|
|
387
|
-
class: "ti-icon-undo",
|
|
388
|
-
onClick: withModifiers(($event) => cancelEdit(index), ["stop"])
|
|
389
|
-
}, null, 8, _hoisted_9)), [
|
|
390
|
-
[vShow, tagsEditStatus.value[index]]
|
|
391
|
-
]) : createCommentVNode("", true),
|
|
392
|
-
!_ctx.$slots["tag-actions"] ? withDirectives((openBlock(), createElementBlock("i", {
|
|
393
|
-
key: 1,
|
|
394
|
-
class: "ti-icon-close",
|
|
395
|
-
onClick: withModifiers(($event) => performDeleteTag(index), ["stop"])
|
|
396
|
-
}, null, 8, _hoisted_10)), [
|
|
397
|
-
[vShow, !tagsEditStatus.value[index]]
|
|
398
|
-
]) : createCommentVNode("", true),
|
|
399
|
-
_ctx.$slots["tag-actions"] ? renderSlot(_ctx.$slots, "tag-actions", {
|
|
400
|
-
key: 2,
|
|
401
|
-
tag,
|
|
402
|
-
index,
|
|
403
|
-
edit: tagsEditStatus.value[index],
|
|
404
|
-
performSaveEdit: performSaveTag,
|
|
405
|
-
performDelete: performDeleteTag,
|
|
406
|
-
performCancelEdit: cancelEdit,
|
|
407
|
-
performOpenEdit: performEditTag,
|
|
408
|
-
deletionMark: isMarked(index)
|
|
409
|
-
}) : createCommentVNode("", true)
|
|
410
|
-
])
|
|
411
|
-
], 14, _hoisted_3);
|
|
412
|
-
}), 128)),
|
|
413
|
-
createElementVNode("li", _hoisted_11, [
|
|
414
|
-
createElementVNode("input", {
|
|
415
|
-
ref_key: "newTagInputRef",
|
|
416
|
-
ref: newTagInputRef,
|
|
417
|
-
class: normalizeClass([[unref(createClasses)(newTag.value, _ctx.tags, _ctx.validation, _ctx.isDuplicate)], "ti-new-tag-input"]),
|
|
418
|
-
placeholder: _ctx.placeholder,
|
|
419
|
-
value: newTag.value,
|
|
420
|
-
maxlength: _ctx.maxlength,
|
|
421
|
-
disabled: _ctx.disabled,
|
|
422
|
-
type: "text",
|
|
423
|
-
size: "1",
|
|
424
|
-
onKeydown: [
|
|
425
|
-
handleKeyDown,
|
|
426
|
-
withKeys(invokeDelete, ["delete"]),
|
|
427
|
-
withKeys(performBlur, ["tab"]),
|
|
428
|
-
_cache[0] || (_cache[0] = withKeys(withModifiers(($event) => selectItem("before"), ["prevent"]), ["up"])),
|
|
429
|
-
_cache[1] || (_cache[1] = withKeys(withModifiers(($event) => selectItem("after"), ["prevent"]), ["down"]))
|
|
430
|
-
],
|
|
431
|
-
onPaste: addTagsFromPaste,
|
|
432
|
-
onInput: updateNewTag,
|
|
433
|
-
onFocus: _cache[2] || (_cache[2] = ($event) => focused.value = true),
|
|
434
|
-
onClick: _cache[3] || (_cache[3] = ($event) => !_ctx.addOnlyFromAutocomplete && (selectedItem.value = null))
|
|
435
|
-
}, null, 42, _hoisted_12)
|
|
436
|
-
])
|
|
437
|
-
])) : createCommentVNode("", true)
|
|
438
|
-
]),
|
|
439
|
-
renderSlot(_ctx.$slots, "between-elements"),
|
|
440
|
-
autocompleteOpen.value ? (openBlock(), createElementBlock("div", {
|
|
441
|
-
key: 0,
|
|
442
|
-
class: normalizeClass(["ti-autocomplete", _ctx.$attrs.class]),
|
|
443
|
-
onMouseleave: _cache[4] || (_cache[4] = ($event) => selectedItem.value = null)
|
|
444
|
-
}, [
|
|
445
|
-
renderSlot(_ctx.$slots, "autocomplete-header"),
|
|
446
|
-
createElementVNode("ul", null, [
|
|
447
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(filteredAutocompleteItems.value, (item, index) => {
|
|
448
|
-
return openBlock(), createElementBlock("li", {
|
|
449
|
-
key: `autocomplete-${index}-${item.text}`,
|
|
450
|
-
style: normalizeStyle(item.style),
|
|
451
|
-
class: normalizeClass([[
|
|
452
|
-
item.tiClasses,
|
|
453
|
-
item.classes,
|
|
454
|
-
{ "ti-selected-item": isSelected(index) }
|
|
455
|
-
], "ti-item"]),
|
|
456
|
-
onMouseenter: ($event) => !_ctx.disabled && (selectedItem.value = index)
|
|
457
|
-
}, [
|
|
458
|
-
!_ctx.$slots["autocomplete-item"] ? (openBlock(), createElementBlock("div", {
|
|
459
|
-
key: 0,
|
|
460
|
-
onClick: ($event) => performAddTags(item, void 0, "autocomplete")
|
|
461
|
-
}, toDisplayString(item.text), 9, _hoisted_14)) : renderSlot(_ctx.$slots, "autocomplete-item", {
|
|
462
|
-
key: 1,
|
|
463
|
-
item,
|
|
464
|
-
index,
|
|
465
|
-
performAdd: (item2) => performAddTags(item2, void 0, "autocomplete"),
|
|
466
|
-
selected: isSelected(index)
|
|
467
|
-
})
|
|
468
|
-
], 46, _hoisted_13);
|
|
469
|
-
}), 128))
|
|
470
|
-
]),
|
|
471
|
-
renderSlot(_ctx.$slots, "autocomplete-footer")
|
|
472
|
-
], 34)) : createCommentVNode("", true)
|
|
473
|
-
], 6);
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
};
|
|
477
|
-
export {
|
|
478
|
-
_sfc_main as default
|
|
479
|
-
};
|
|
480
|
-
//# sourceMappingURL=FieldTags.vue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FieldTags.vue.js","sources":["../../../../../src/components/FieldTags/FieldTags.vue"],"sourcesContent":["<template>\n <div\n class=\"vue-tags-input pos-relative\"\n :class=\"[{ 'ti-disabled': disabled }, { 'ti-focus': focused }, $attrs.class]\"\n :style=\"$attrs.style\"\n >\n <div class=\"ti-input\">\n <ul v-if=\"tagsCopy.length || !disabled\" class=\"ti-tags\">\n <li\n v-for=\"(tag, index) in tagsCopy\"\n :key=\"`tag-${index}-${tag.text}`\"\n :style=\"tag.style\"\n :class=\"[\n { 'ti-editing': tagsEditStatus[index] },\n tag.tiClasses,\n tag.classes,\n { 'ti-deletion-mark': isMarked(index) }\n ]\"\n tabindex=\"0\"\n class=\"ti-tag t-medium\"\n @click=\"emit('tag-clicked', { tag, index })\"\n >\n <div class=\"ti-content\">\n <div\n v-if=\"$slots['tag-left']\"\n class=\"ti-tag-left\"\n >\n <slot\n name=\"tag-left\"\n :tag=\"tag\"\n :index=\"index\"\n :edit=\"tagsEditStatus[index]\"\n :perform-save-edit=\"performSaveTag\"\n :perform-delete=\"performDeleteTag\"\n :perform-cancel-edit=\"cancelEdit\"\n :perform-open-edit=\"performEditTag\"\n :deletion-mark=\"isMarked(index)\"\n />\n </div>\n <div :ref=\"el => setTagCenter(el, index)\" class=\"ti-tag-center\">\n <span\n v-if=\"!$slots['tag-center']\"\n :class=\"{ 'ti-hidden': tagsEditStatus[index] }\"\n @click=\"performEditTag(index)\"\n >{{ tag.text }}</span>\n <tag-input\n v-if=\"!$slots['tag-center']\"\n :scope=\"{\n edit: tagsEditStatus[index],\n maxlength,\n tag,\n index,\n validateTag: createChangedTag,\n performCancelEdit: cancelEdit,\n performSaveEdit: performSaveTag,\n }\"\n />\n <slot\n name=\"tag-center\"\n :tag=\"tag\"\n :index=\"index\"\n :maxlength=\"maxlength\"\n :edit=\"tagsEditStatus[index]\"\n :perform-save-edit=\"performSaveTag\"\n :perform-delete=\"performDeleteTag\"\n :perform-cancel-edit=\"cancelEdit\"\n :validate-tag=\"createChangedTag\"\n :perform-open-edit=\"performEditTag\"\n :deletion-mark=\"isMarked(index)\"\n />\n </div>\n <div\n v-if=\"$slots['tag-right']\"\n class=\"ti-tag-right\"\n >\n <slot\n name=\"tag-right\"\n :tag=\"tag\"\n :index=\"index\"\n :edit=\"tagsEditStatus[index]\"\n :perform-save-edit=\"performSaveTag\"\n :perform-delete=\"performDeleteTag\"\n :perform-cancel-edit=\"cancelEdit\"\n :perform-open-edit=\"performEditTag\"\n :deletion-mark=\"isMarked(index)\"\n />\n </div>\n </div>\n <div class=\"ti-actions\">\n <i\n v-if=\"!$slots['tag-actions']\"\n v-show=\"tagsEditStatus[index]\"\n class=\"ti-icon-undo\"\n @click.stop=\"cancelEdit(index)\"\n />\n <i\n v-if=\"!$slots['tag-actions']\"\n v-show=\"!tagsEditStatus[index]\"\n class=\"ti-icon-close\"\n @click.stop=\"performDeleteTag(index)\"\n />\n <slot\n v-if=\"$slots['tag-actions']\"\n name=\"tag-actions\"\n :tag=\"tag\"\n :index=\"index\"\n :edit=\"tagsEditStatus[index]\"\n :perform-save-edit=\"performSaveTag\"\n :perform-delete=\"performDeleteTag\"\n :perform-cancel-edit=\"cancelEdit\"\n :perform-open-edit=\"performEditTag\"\n :deletion-mark=\"isMarked(index)\"\n />\n </div>\n </li>\n <li class=\"ti-new-tag-input-wrapper\">\n <input\n ref=\"newTagInputRef\"\n :class=\"[createClasses(newTag, tags, validation, isDuplicate)]\"\n :placeholder=\"placeholder\"\n :value=\"newTag\"\n :maxlength=\"maxlength\"\n :disabled=\"disabled\"\n type=\"text\"\n size=\"1\"\n class=\"ti-new-tag-input\"\n @keydown=\"handleKeyDown\"\n @paste=\"addTagsFromPaste\"\n @keydown.delete=\"invokeDelete\"\n @keydown.tab=\"performBlur\"\n @keydown.up.prevent=\"selectItem('before')\"\n @keydown.down.prevent=\"selectItem('after')\"\n @input=\"updateNewTag\"\n @focus=\"focused = true\"\n @click=\"!addOnlyFromAutocomplete && (selectedItem = null)\"\n >\n </li>\n </ul>\n </div>\n <slot name=\"between-elements\" />\n <div\n v-if=\"autocompleteOpen\"\n class=\"ti-autocomplete\"\n :class=\"$attrs.class\"\n @mouseleave=\"selectedItem = null\"\n >\n <slot name=\"autocomplete-header\" />\n <ul>\n <li\n v-for=\"(item, index) in filteredAutocompleteItems\"\n :key=\"`autocomplete-${index}-${item.text}`\"\n :style=\"item.style\"\n :class=\"[\n item.tiClasses,\n item.classes,\n { 'ti-selected-item': isSelected(index) }\n ]\"\n class=\"ti-item\"\n @mouseenter=\"!disabled && (selectedItem = index)\"\n >\n <div\n v-if=\"!$slots['autocomplete-item']\"\n @click=\"performAddTags(item, undefined, 'autocomplete')\"\n >\n {{ item.text }}\n </div>\n <slot\n v-else\n name=\"autocomplete-item\"\n :item=\"item\"\n :index=\"index\"\n :perform-add=\"item => performAddTags(item, undefined, 'autocomplete')\"\n :selected=\"isSelected(index)\"\n />\n </li>\n </ul>\n <slot name=\"autocomplete-footer\" />\n </div>\n </div>\n</template>\n\n<script setup>\nimport { ref, computed, watch, nextTick, onMounted, onBeforeUnmount, shallowRef, toRef } from 'vue';\nimport equal from 'fast-deep-equal';\nimport { clone, createClasses, createTag, createTags } from './create-tags.js';\nimport TagInput from './tag-input.vue';\nimport props from './vue-tags-input.props.js';\n\n// Props\nconst propsObj = defineProps(props);\n\n// Emits\nconst emit = defineEmits([\n 'adding-duplicate',\n 'before-adding-tag',\n 'before-deleting-tag',\n 'before-editing-tag',\n 'before-saving-tag',\n 'max-tags-reached',\n 'saving-duplicate',\n 'tags-changed',\n 'tag-clicked',\n 'update:modelValue',\n 'update:tags',\n]);\n\n// State\nconst tagCenterRefs = ref(new Map());\nconst newTag = ref(propsObj.modelValue || '');\nconst tagsCopy = shallowRef([]);\nconst tagsEditStatus = ref([]);\nconst deletionMark = ref(null);\nconst deletionMarkTimer = ref(null);\nconst selectedItem = ref(null);\nconst focused = ref(false);\nconst newTagInputRef = ref(null);\n\n// Computed\nconst autocompleteOpen = computed(() => {\n if (propsObj.autocompleteAlwaysOpen) return true;\n return newTag.value !== null && \n newTag.value.length >= propsObj.autocompleteMinLength && \n filteredAutocompleteItems.value.length > 0 && \n focused.value;\n});\n\nconst filteredAutocompleteItems = computed(() => {\n const items = propsObj.autocompleteItems.map(i => \n createTag(i, propsObj.tags, propsObj.validation, propsObj.isDuplicate)\n );\n\n if (!propsObj.autocompleteFilterDuplicates) return items;\n return items.filter(duplicateFilter);\n});\n\n// Methods\nconst getSelectedIndex = (method) => {\n const items = filteredAutocompleteItems.value;\n const current = selectedItem.value;\n const lastItem = items.length - 1;\n \n if (items.length === 0) return;\n if (current === null) return 0;\n if (method === 'before' && current === 0) return lastItem;\n if (method === 'after' && current === lastItem) return 0;\n return method === 'after' ? current + 1 : current - 1;\n};\n\nconst selectDefaultItem = () => {\n selectedItem.value = propsObj.addOnlyFromAutocomplete && filteredAutocompleteItems.value.length > 0 ? 0 : null;\n};\n\nconst selectItem = (method) => {\n selectedItem.value = getSelectedIndex(method);\n};\n\nconst isSelected = (index) => selectedItem.value === index;\nconst isMarked = (index) => deletionMark.value === index;\n\nconst setTagCenter = (el, index) => {\n if (el) {\n tagCenterRefs.value.set(index, el);\n } else {\n tagCenterRefs.value.delete(index);\n }\n};\n\nconst invokeDelete = () => {\n if (!propsObj.deleteOnBackspace || newTag.value.length > 0) return;\n \n const lastIndex = tagsCopy.value.length - 1;\n if (deletionMark.value === null) {\n clearTimeout(deletionMarkTimer.value);\n deletionMarkTimer.value = setTimeout(() => (deletionMark.value = null), 1000);\n deletionMark.value = lastIndex;\n } else {\n performDeleteTag(lastIndex);\n }\n};\n\nconst addTagsFromPaste = () => {\n if (!propsObj.addFromPaste) return;\n setTimeout(() => performAddTags(newTag.value), 10);\n};\n\nconst performEditTag = (index) => {\n if (!propsObj.allowEditTags) return;\n \n if (!propsObj.onBeforeEditingTag) {\n editTag(index);\n } else {\n emit('before-editing-tag', {\n index,\n tag: tagsCopy.value[index],\n editTag: () => editTag(index),\n });\n }\n};\n\nconst editTag = (index) => {\n if (!propsObj.allowEditTags) return;\n toggleEditMode(index);\n focus(index);\n};\n\nconst toggleEditMode = (index) => {\n if (!propsObj.allowEditTags || propsObj.disabled) return;\n tagsEditStatus.value[index] = !tagsEditStatus.value[index];\n};\n\nconst createChangedTag = (index, event) => {\n const tag = tagsCopy.value[index];\n tag.text = event ? event.target.value : tagsCopy.value[index].text;\n \n const newTags = [...tagsCopy.value];\n newTags[index] = createTag(tag, tagsCopy.value, propsObj.validation, propsObj.isDuplicate);\n tagsCopy.value = newTags;\n};\n\nconst focus = (index) => {\n nextTick(() => {\n const el = tagCenterRefs.value.get(index)?.querySelector('input.ti-tag-input');\n if (el) el.focus();\n });\n};\n\nconst quote = (regex) => regex.replace(/([()[{*+.$^\\\\|?])/g, '\\\\$1');\n\nconst cancelEdit = (index) => {\n if (!propsObj.tags[index]) return;\n \n const newTags = [...tagsCopy.value];\n newTags[index] = clone(createTag(propsObj.tags[index], propsObj.tags, propsObj.validation, propsObj.isDuplicate));\n tagsCopy.value = newTags;\n tagsEditStatus.value[index] = false;\n};\n\nconst hasForbiddingAddRule = (tiClasses) => {\n return tiClasses.some(type => {\n const rule = propsObj.validation.find(rule => type === rule.classes);\n return rule ? rule.disableAdd : false;\n });\n};\n\nconst createTagTexts = (string) => {\n const regex = new RegExp(propsObj.separators.map(s => quote(s)).join('|'));\n return string.split(regex).map(text => ({ text }));\n};\n\nconst performDeleteTag = (index) => {\n if (!propsObj.onBeforeDeletingTag) {\n deleteTag(index);\n } else {\n emit('before-deleting-tag', {\n index,\n tag: tagsCopy.value[index],\n deleteTag: () => deleteTag(index),\n });\n }\n};\n\nconst deleteTag = (index) => {\n if (propsObj.disabled) return;\n \n deletionMark.value = null;\n clearTimeout(deletionMarkTimer.value);\n \n const newTags = [...tagsCopy.value];\n newTags.splice(index, 1);\n tagsCopy.value = newTags;\n \n tagsEditStatus.value.splice(index, 1);\n \n emit('update:tags', tagsCopy.value);\n emit('tags-changed', tagsCopy.value);\n};\n\nconst noTriggerKey = (event, category) => {\n const triggerKey = propsObj[category].indexOf(event.keyCode) !== -1 || \n propsObj[category].indexOf(event.key) !== -1;\n if (triggerKey) event.preventDefault();\n return !triggerKey;\n};\n\nconst performAddTags = (tag, event, source) => {\n if (propsObj.disabled || (event && noTriggerKey(event, 'addOnKey'))) return;\n\n let tags = [];\n if (typeof tag === 'object') tags = [tag];\n if (typeof tag === 'string') tags = createTagTexts(tag);\n\n tags = tags.filter(tag => tag.text.trim().length > 0);\n\n tags.forEach(tag => {\n tag = createTag(tag, propsObj.tags, propsObj.validation, propsObj.isDuplicate);\n if (!propsObj.onBeforeAddingTag) {\n addTag(tag, source);\n } else {\n emit('before-adding-tag', {\n tag,\n addTag: () => addTag(tag, source),\n });\n }\n });\n};\n\nconst duplicateFilter = (tag) => {\n return propsObj.isDuplicate ? \n !propsObj.isDuplicate(tagsCopy.value, tag) : \n !tagsCopy.value.find(t => t.text === tag.text);\n};\n\nconst addTag = (tag, source = 'new-tag-input') => {\n const options = filteredAutocompleteItems.value.map(i => i.text);\n if (propsObj.addOnlyFromAutocomplete && options.indexOf(tag.text) === -1) return;\n\n nextTick(() => {\n const maximumReached = propsObj.maxTags && propsObj.maxTags <= tagsCopy.value.length;\n if (maximumReached) return emit('max-tags-reached', tag);\n\n const dup = propsObj.avoidAddingDuplicates && !duplicateFilter(tag);\n if (dup) return emit('adding-duplicate', tag);\n\n if (hasForbiddingAddRule(tag.tiClasses)) return;\n\n newTag.value = '';\n tagsCopy.value = [...tagsCopy.value, tag];\n tagsEditStatus.value.push(false);\n\n emit('update:tags', tagsCopy.value);\n\n if (source === 'autocomplete') newTagInputRef.value?.focus();\n\n emit('tags-changed', tagsCopy.value);\n });\n};\n\nconst performSaveTag = (index, event) => {\n const tag = tagsCopy.value[index];\n\n if (propsObj.disabled || (event && noTriggerKey(event, 'addOnKey'))) return;\n if (tag.text.trim().length === 0) return;\n\n if (!propsObj['onBeforeSavingTag']) {\n saveTag(index, tag);\n } else {\n emit('before-saving-tag', {\n index,\n tag,\n saveTag: () => saveTag(index, tag),\n });\n }\n};\n\nconst saveTag = (index, tag) => {\n if (propsObj.avoidAddingDuplicates) {\n const tagsDiff = clone(tagsCopy.value);\n const inputTag = tagsDiff.splice(index, 1)[0];\n const dup = propsObj.isDuplicate ? \n propsObj.isDuplicate(tagsDiff, inputTag) : \n tagsDiff.map(t => t.text).indexOf(inputTag.text) !== -1;\n\n if (dup) return emit('saving-duplicate', tag);\n }\n\n if (hasForbiddingAddRule(tag.tiClasses)) return;\n\n const newTags = [...tagsCopy.value];\n newTags[index] = tag;\n tagsCopy.value = newTags;\n toggleEditMode(index);\n\n emit('update:tags', tagsCopy.value);\n emit('tags-changed', tagsCopy.value);\n};\n\nconst tagsEqual = () => {\n return !tagsCopy.value.some((t, i) => !equal(t, propsObj.tags[i]));\n};\n\nconst updateNewTag = (event) => {\n const value = event.target.value;\n newTag.value = value;\n emit('update:modelValue', value);\n};\n\nconst initTags = () => {\n tagsCopy.value = createTags(propsObj.tags, propsObj.validation, propsObj.isDuplicate);\n tagsEditStatus.value = new Array(propsObj.tags.length).fill(false);\n\n if (!tagsEqual()) {\n emit('update:tags', tagsCopy.value);\n }\n};\n\nconst blurredOnClick = (e) => {\n const el = e.currentTarget;\n if (el?.contains(e.target) || el?.contains(document.activeElement)) return;\n performBlur();\n};\n\nconst performBlur = () => {\n if (propsObj.addOnBlur && focused.value) performAddTags(newTag.value);\n focused.value = false;\n};\n\nconst handleKeyDown = (event) => {\n const item = filteredAutocompleteItems.value[selectedItem.value] || newTag.value;\n performAddTags(item, event);\n};\n\n// Watchers\nwatch(() => propsObj.modelValue, (newValue) => {\n if (!propsObj.addOnlyFromAutocomplete) selectedItem.value = null;\n newTag.value = newValue;\n});\n\nwatch(() => propsObj.tags, () => {\n initTags();\n}, { deep: true });\n\nwatch(autocompleteOpen, selectDefaultItem);\n\n// Lifecycle\ninitTags();\n\nonMounted(() => {\n selectDefaultItem();\n document.addEventListener('click', blurredOnClick);\n});\n\nonBeforeUnmount(() => {\n document.removeEventListener('click', blurredOnClick);\n clearTimeout(deletionMarkTimer.value);\n});\n\n// Expose for template\ndefineExpose({\n createClasses\n});\n</script>\n\n<style lang=\"scss\" src=\"./vue-tags-input.scss\"></style>"],"names":["rule","tag"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6LA,UAAM,WAAW;AAGjB,UAAM,OAAO;AAeb,UAAM,gBAAgB,IAAI,oBAAI,KAAK;AACnC,UAAM,SAAS,IAAI,SAAS,cAAc,EAAE;AAC5C,UAAM,WAAW,WAAW,EAAE;AAC9B,UAAM,iBAAiB,IAAI,EAAE;AAC7B,UAAM,eAAe,IAAI,IAAI;AAC7B,UAAM,oBAAoB,IAAI,IAAI;AAClC,UAAM,eAAe,IAAI,IAAI;AAC7B,UAAM,UAAU,IAAI,KAAK;AACzB,UAAM,iBAAiB,IAAI,IAAI;AAG/B,UAAM,mBAAmB,SAAS,MAAM;AACtC,UAAI,SAAS,uBAAwB,QAAO;AAC5C,aAAO,OAAO,UAAU,QACjB,OAAO,MAAM,UAAU,SAAS,yBAChC,0BAA0B,MAAM,SAAS,KACzC,QAAQ;AAAA,IACjB,CAAC;AAED,UAAM,4BAA4B,SAAS,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MAAM,MAAM;AAEjB,UAAM,kBAAkB,iBAAiB;AAGzC,aAAQ;AAER,cAAU,MAAM;AACd,wBAAiB;AACjB,eAAS,iBAAiB,SAAS,cAAc;AAAA,IACnD,CAAC;AAED,oBAAgB,MAAM;AACpB,eAAS,oBAAoB,SAAS,cAAc;AACpD,mBAAa,kBAAkB,KAAK;AAAA,IACtC,CAAC;AAGD,aAAa;AAAA,MACX;AAAA,IACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const validateUserRules = (tag, validation) => {
|
|
4
|
-
return validation.filter((val) => {
|
|
5
|
-
const { text } = tag;
|
|
6
|
-
if (typeof val.rule === "string") return !new RegExp(val.rule).test(text);
|
|
7
|
-
if (val.rule instanceof RegExp) return !val.rule.test(text);
|
|
8
|
-
const isFunction = {}.toString.call(val.rule) === "[object Function]";
|
|
9
|
-
if (isFunction) return val.rule(tag);
|
|
10
|
-
}).map((val) => val.classes);
|
|
11
|
-
};
|
|
12
|
-
const clone = (node) => JSON.parse(JSON.stringify(node));
|
|
13
|
-
const findIndex = (arr, callback) => {
|
|
14
|
-
let index = 0;
|
|
15
|
-
while (index < arr.length) {
|
|
16
|
-
if (callback(arr[index], index, arr)) return index;
|
|
17
|
-
index++;
|
|
18
|
-
}
|
|
19
|
-
return -1;
|
|
20
|
-
};
|
|
21
|
-
const createClasses = (tag, tags, validation = [], customDuplicateFn) => {
|
|
22
|
-
if (tag.text === void 0) tag = { text: tag };
|
|
23
|
-
const classes = validateUserRules(tag, validation);
|
|
24
|
-
const index = findIndex(tags, (t) => t === tag);
|
|
25
|
-
const tagsDiff = clone(tags);
|
|
26
|
-
const inputTag = index !== -1 ? tagsDiff.splice(index, 1)[0] : clone(tag);
|
|
27
|
-
const duplicate = customDuplicateFn ? customDuplicateFn(tagsDiff, inputTag) : tagsDiff.map((t) => t.text).indexOf(inputTag.text) !== -1;
|
|
28
|
-
if (duplicate) classes.push("ti-duplicate");
|
|
29
|
-
classes.length === 0 ? classes.push("ti-valid") : classes.push("ti-invalid");
|
|
30
|
-
return classes;
|
|
31
|
-
};
|
|
32
|
-
const createTag = (tag, ...rest) => {
|
|
33
|
-
if (tag.text === void 0) tag = { text: tag };
|
|
34
|
-
const t = clone(tag);
|
|
35
|
-
t.tiClasses = createClasses(tag, ...rest);
|
|
36
|
-
return t;
|
|
37
|
-
};
|
|
38
|
-
const createTags = (tags, ...rest) => tags.map((t) => createTag(t, tags, ...rest));
|
|
39
|
-
exports.clone = clone;
|
|
40
|
-
exports.createClasses = createClasses;
|
|
41
|
-
exports.createTag = createTag;
|
|
42
|
-
exports.createTags = createTags;
|
|
43
|
-
//# sourceMappingURL=create-tags.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-tags.cjs","sources":["../../../../../src/components/FieldTags/create-tags.js"],"sourcesContent":["// helper functions\n\nconst validateUserRules = (tag, validation) => {\n return validation\n .filter(val => {\n const { text } = tag;\n // if the rule is a string, we convert it to RegExp\n if (typeof val.rule === 'string') return !new RegExp(val.rule).test(text);\n\n if (val.rule instanceof RegExp) return !val.rule.test(text);\n\n // if we deal with a function, invoke it\n const isFunction = {}.toString.call(val.rule) === '[object Function]';\n if (isFunction) return val.rule(tag);\n })\n .map(val => val.classes);\n};\n\nconst clone = node => JSON.parse(JSON.stringify(node));\n\nconst findIndex = (arr, callback) => {\n let index = 0;\n while (index < arr.length) {\n if (callback(arr[index], index, arr)) return index;\n index++;\n }\n return -1;\n};\n\nconst createClasses = (tag, tags, validation = [], customDuplicateFn) => {\n if (tag.text === undefined) tag = { text: tag };\n\n // create css classes from the user validation array\n const classes = validateUserRules(tag, validation);\n\n // if we find the tag, it's an exsting one which is edited.\n // in this case we must splice it out\n const index = findIndex(tags, t => t === tag);\n const tagsDiff = clone(tags);\n const inputTag = index !== -1 ? tagsDiff.splice(index, 1)[0] : clone(tag);\n\n // check whether the tag is a duplicate or not\n const duplicate = customDuplicateFn ? customDuplicateFn(tagsDiff, inputTag) : tagsDiff.map(t => t.text).indexOf(inputTag.text) !== -1;\n\n // if it's a duplicate, push the class duplicate to the array\n if (duplicate) classes.push('ti-duplicate');\n\n // if we find no classes, the tag is valid → push the class valid\n classes.length === 0 ? classes.push('ti-valid') : classes.push('ti-invalid');\n return classes;\n};\n\n/**\n * @description Create one tag out of a String or validate an existing one\n * @property {helpers}\n * @param {Object|String} tag A tag which should be validated | A String to create a tag\n * @param {Array} tagsarray The tags array\n * @param {Array} [validation=[]] The validation Array is optional (pass it if you use one)\n * @returns {Object} The created (validated) tag\n */\nconst createTag = (tag, ...rest) => {\n // if text is undefined, a string is passed. let's make a tag out of it\n if (tag.text === undefined) tag = { text: tag };\n\n // we better make a clone to not getting reference trouble\n const t = clone(tag);\n\n // create the validation classes\n t.tiClasses = createClasses(tag, ...rest);\n return t;\n};\n\n/**\n * @description Create multiple tags out of Strings or validate existing tags\n * @property {helpers}\n * @param {Array} tagsarray An Array containing tags or strings. See example below.\n * @param {Array} [validation=[]] The validation Array is optional (pass it if you use one)\n * @returns {Array} An array containing (validated) tags\n * @example /* Example to call the function */\n const validatedTags = createTags(['tag1Text', 'tag2Text'], [{ type: 'length', rule: /[0-9]/ }])\n */\nconst createTags = (tags, ...rest) => tags.map(t => createTag(t, tags, ...rest));\n\nexport { clone, createClasses, createTag, createTags };\n"],"names":[],"mappings":";;AAEA,MAAM,oBAAoB,CAAC,KAAK,eAAe;AAC7C,SAAO,WACJ,OAAO,SAAO;AACb,UAAM,EAAE,KAAI,IAAK;AAEjB,QAAI,OAAO,IAAI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AAGnB,IAAE,YAAY,cAAc,KAAK,GAAG,IAAI;AACxC,SAAO;AACT;AAWK,MAAC,aAAa,CAAC,SAAS,SAAS,KAAK,IAAI,OAAK,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;;;;;"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const validateUserRules = (tag, validation) => {
|
|
2
|
-
return validation.filter((val) => {
|
|
3
|
-
const { text } = tag;
|
|
4
|
-
if (typeof val.rule === "string") return !new RegExp(val.rule).test(text);
|
|
5
|
-
if (val.rule instanceof RegExp) return !val.rule.test(text);
|
|
6
|
-
const isFunction = {}.toString.call(val.rule) === "[object Function]";
|
|
7
|
-
if (isFunction) return val.rule(tag);
|
|
8
|
-
}).map((val) => val.classes);
|
|
9
|
-
};
|
|
10
|
-
const clone = (node) => JSON.parse(JSON.stringify(node));
|
|
11
|
-
const findIndex = (arr, callback) => {
|
|
12
|
-
let index = 0;
|
|
13
|
-
while (index < arr.length) {
|
|
14
|
-
if (callback(arr[index], index, arr)) return index;
|
|
15
|
-
index++;
|
|
16
|
-
}
|
|
17
|
-
return -1;
|
|
18
|
-
};
|
|
19
|
-
const createClasses = (tag, tags, validation = [], customDuplicateFn) => {
|
|
20
|
-
if (tag.text === void 0) tag = { text: tag };
|
|
21
|
-
const classes = validateUserRules(tag, validation);
|
|
22
|
-
const index = findIndex(tags, (t) => t === tag);
|
|
23
|
-
const tagsDiff = clone(tags);
|
|
24
|
-
const inputTag = index !== -1 ? tagsDiff.splice(index, 1)[0] : clone(tag);
|
|
25
|
-
const duplicate = customDuplicateFn ? customDuplicateFn(tagsDiff, inputTag) : tagsDiff.map((t) => t.text).indexOf(inputTag.text) !== -1;
|
|
26
|
-
if (duplicate) classes.push("ti-duplicate");
|
|
27
|
-
classes.length === 0 ? classes.push("ti-valid") : classes.push("ti-invalid");
|
|
28
|
-
return classes;
|
|
29
|
-
};
|
|
30
|
-
const createTag = (tag, ...rest) => {
|
|
31
|
-
if (tag.text === void 0) tag = { text: tag };
|
|
32
|
-
const t = clone(tag);
|
|
33
|
-
t.tiClasses = createClasses(tag, ...rest);
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
const createTags = (tags, ...rest) => tags.map((t) => createTag(t, tags, ...rest));
|
|
37
|
-
export {
|
|
38
|
-
clone,
|
|
39
|
-
createClasses,
|
|
40
|
-
createTag,
|
|
41
|
-
createTags
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=create-tags.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-tags.js","sources":["../../../../../src/components/FieldTags/create-tags.js"],"sourcesContent":["// helper functions\n\nconst validateUserRules = (tag, validation) => {\n return validation\n .filter(val => {\n const { text } = tag;\n // if the rule is a string, we convert it to RegExp\n if (typeof val.rule === 'string') return !new RegExp(val.rule).test(text);\n\n if (val.rule instanceof RegExp) return !val.rule.test(text);\n\n // if we deal with a function, invoke it\n const isFunction = {}.toString.call(val.rule) === '[object Function]';\n if (isFunction) return val.rule(tag);\n })\n .map(val => val.classes);\n};\n\nconst clone = node => JSON.parse(JSON.stringify(node));\n\nconst findIndex = (arr, callback) => {\n let index = 0;\n while (index < arr.length) {\n if (callback(arr[index], index, arr)) return index;\n index++;\n }\n return -1;\n};\n\nconst createClasses = (tag, tags, validation = [], customDuplicateFn) => {\n if (tag.text === undefined) tag = { text: tag };\n\n // create css classes from the user validation array\n const classes = validateUserRules(tag, validation);\n\n // if we find the tag, it's an exsting one which is edited.\n // in this case we must splice it out\n const index = findIndex(tags, t => t === tag);\n const tagsDiff = clone(tags);\n const inputTag = index !== -1 ? tagsDiff.splice(index, 1)[0] : clone(tag);\n\n // check whether the tag is a duplicate or not\n const duplicate = customDuplicateFn ? customDuplicateFn(tagsDiff, inputTag) : tagsDiff.map(t => t.text).indexOf(inputTag.text) !== -1;\n\n // if it's a duplicate, push the class duplicate to the array\n if (duplicate) classes.push('ti-duplicate');\n\n // if we find no classes, the tag is valid → push the class valid\n classes.length === 0 ? classes.push('ti-valid') : classes.push('ti-invalid');\n return classes;\n};\n\n/**\n * @description Create one tag out of a String or validate an existing one\n * @property {helpers}\n * @param {Object|String} tag A tag which should be validated | A String to create a tag\n * @param {Array} tagsarray The tags array\n * @param {Array} [validation=[]] The validation Array is optional (pass it if you use one)\n * @returns {Object} The created (validated) tag\n */\nconst createTag = (tag, ...rest) => {\n // if text is undefined, a string is passed. let's make a tag out of it\n if (tag.text === undefined) tag = { text: tag };\n\n // we better make a clone to not getting reference trouble\n const t = clone(tag);\n\n // create the validation classes\n t.tiClasses = createClasses(tag, ...rest);\n return t;\n};\n\n/**\n * @description Create multiple tags out of Strings or validate existing tags\n * @property {helpers}\n * @param {Array} tagsarray An Array containing tags or strings. See example below.\n * @param {Array} [validation=[]] The validation Array is optional (pass it if you use one)\n * @returns {Array} An array containing (validated) tags\n * @example /* Example to call the function */\n const validatedTags = createTags(['tag1Text', 'tag2Text'], [{ type: 'length', rule: /[0-9]/ }])\n */\nconst createTags = (tags, ...rest) => tags.map(t => createTag(t, tags, ...rest));\n\nexport { clone, createClasses, createTag, createTags };\n"],"names":[],"mappings":"AAEA,MAAM,oBAAoB,CAAC,KAAK,eAAe;AAC7C,SAAO,WACJ,OAAO,SAAO;AACb,UAAM,EAAE,KAAI,IAAK;AAEjB,QAAI,OAAO,IAAI,SAAS,SAAU,QAAO,CAAC,IAAI,OAAO,IAAI,IAAI,EAAE,KAAK,IAAI;AAExE,QAAI,IAAI,gBAAgB,OAAQ,QAAO,CAAC,IAAI,KAAK,KAAK,IAAI;AAG1D,UAAM,aAAa,CAAA,EAAG,SAAS,KAAK,IAAI,IAAI,MAAM;AAClD,QAAI,WAAY,QAAO,IAAI,KAAK,GAAG;AAAA,EACrC,CAAC,EACA,IAAI,SAAO,IAAI,OAAO;AAC3B;AAEK,MAAC,QAAQ,UAAQ,KAAK,MAAM,KAAK,UAAU,IAAI,CAAC;AAErD,MAAM,YAAY,CAAC,KAAK,aAAa;AACnC,MAAI,QAA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