vueless 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_readme/README.md +5 -75
- package/_readme/UNotify.md +1 -1
- package/_readme/UTopLoader.md +2 -2
- package/_readme/customization.md +347 -0
- package/_readme/installation.md +139 -0
- package/_readme/storybook-pages/Customisation.mdx +6 -0
- package/_readme/storybook-pages/Installation.mdx +7 -0
- package/composable.ui/index.js +341 -30
- package/library.vue-tailwind-3/index.js +0 -5
- package/library.web-types-gen/lib/build.js +35 -9
- package/library.web-types-gen/lib/config.js +10 -4
- package/package.json +37 -4
- package/plugin.vite/index.js +59 -0
- package/plugin.vite/services/iconResolver.service.js +291 -0
- package/plugin.vite/services/svgLoader.service.js +76 -0
- package/plugin.vite/services/tailwindSafelist.service.js +197 -0
- package/plugin.vite/services/unpluginComponentsResolver.js +172 -0
- package/service.storybook/index.js +53 -80
- package/service.tailwind/index.js +112 -0
- package/service.ui/index.js +69 -50
- package/ui.button/Docs.mdx +16 -0
- package/ui.button/composables/attrs.composable.js +41 -0
- package/ui.button/configs/default.config.js +164 -0
- package/ui.button/constants/index.js +5 -0
- package/ui.button/index.stories.js +8 -7
- package/ui.button/index.vue +116 -981
- package/ui.button-link/Docs.mdx +16 -0
- package/ui.button-link/composables/attrs.composable.js +99 -0
- package/ui.button-link/configs/default.config.js +80 -0
- package/ui.button-link/constants/index.js +5 -0
- package/ui.button-link/index.stories.js +56 -19
- package/ui.button-link/index.vue +178 -493
- package/ui.button-toggle/Docs.mdx +16 -0
- package/ui.button-toggle/composables/attrs.composable.js +16 -0
- package/ui.button-toggle/configs/default.config.js +12 -0
- package/ui.button-toggle/constants/index.js +7 -0
- package/{ui.button-group → ui.button-toggle}/index.stories.js +79 -28
- package/ui.button-toggle/index.vue +128 -0
- package/ui.button-toggle-item/Docs.mdx +16 -0
- package/ui.button-toggle-item/composables/attrs.composable.js +53 -0
- package/ui.button-toggle-item/configs/default.config.js +58 -0
- package/ui.button-toggle-item/constants/index.js +5 -0
- package/{ui.button-group-item → ui.button-toggle-item}/index.stories.js +16 -13
- package/ui.button-toggle-item/index.vue +147 -0
- package/ui.container-accordion/composables/attrs.composable.js +45 -0
- package/ui.container-accordion/configs/default.config.js +32 -0
- package/ui.container-accordion/constants/index.js +5 -0
- package/ui.container-accordion/index.stories.js +3 -2
- package/ui.container-accordion/index.vue +71 -143
- package/ui.container-card/Docs.mdx +16 -0
- package/ui.container-card/composable/attrs.composable.js +56 -0
- package/ui.container-card/configs/default.config.js +31 -0
- package/ui.container-card/constants/index.js +5 -0
- package/ui.container-card/index.stories.js +51 -9
- package/ui.container-card/index.vue +108 -169
- package/ui.container-divider/Docs.mdx +16 -0
- package/ui.container-divider/composables/attrs.composable.js +65 -0
- package/ui.container-divider/configs/default.config.js +79 -0
- package/ui.container-divider/constants/index.js +5 -0
- package/ui.container-divider/index.stories.js +41 -8
- package/ui.container-divider/index.vue +126 -189
- package/ui.container-group/Docs.mdx +16 -0
- package/ui.container-group/composables/attrs.composable.js +44 -0
- package/ui.container-group/configs/default.config.js +29 -0
- package/ui.container-group/constants/index.js +5 -0
- package/ui.container-group/index.stories.js +7 -6
- package/ui.container-group/index.vue +76 -142
- package/ui.container-groups/Docs.mdx +16 -0
- package/ui.container-groups/composables/attrs.composable.js +12 -0
- package/ui.container-groups/configs/default.config.js +3 -0
- package/ui.container-groups/index.stories.js +4 -3
- package/ui.container-groups/index.vue +26 -11
- package/ui.container-modal/Docs.mdx +16 -0
- package/ui.container-modal/composables/attrs.composable.js +90 -0
- package/ui.container-modal/configs/default.config.js +69 -0
- package/ui.container-modal/constants/index.js +5 -0
- package/ui.container-modal/index.stories.js +8 -7
- package/ui.container-modal/index.vue +289 -370
- package/ui.container-modal-confirm/Docs.mdx +16 -0
- package/ui.container-modal-confirm/composable/attrs.composable.js +19 -0
- package/ui.container-modal-confirm/configs/default.config.js +12 -0
- package/ui.container-modal-confirm/constants/index.js +5 -0
- package/ui.container-modal-confirm/index.stories.js +66 -7
- package/ui.container-modal-confirm/index.vue +126 -116
- package/ui.container-page/Docs.mdx +16 -0
- package/ui.container-page/composables/attrs.composable.js +96 -0
- package/ui.container-page/configs/default.config.js +71 -0
- package/ui.container-page/constants/index.js +5 -0
- package/ui.container-page/index.stories.js +7 -34
- package/ui.container-page/index.vue +193 -408
- package/ui.container-row/Docs.mdx +16 -0
- package/ui.container-row/composables/attrs.composable.js +23 -0
- package/ui.container-row/configs/default.config.js +14 -0
- package/ui.container-row/constants/index.js +5 -0
- package/ui.container-row/index.stories.js +10 -0
- package/ui.container-row/index.vue +32 -39
- package/ui.data-list/composables/attrs.composable.js +45 -0
- package/ui.data-list/configs/default.config.js +32 -0
- package/ui.data-list/constants/index.js +5 -0
- package/ui.data-list/index.stories.js +1 -0
- package/ui.data-list/index.vue +156 -265
- package/ui.data-table/Docs.mdx +16 -0
- package/ui.data-table/composables/attrs.composable.js +188 -0
- package/ui.data-table/configs/default.config.js +82 -0
- package/ui.data-table/constants/index.js +5 -0
- package/ui.data-table/index.stories.js +73 -43
- package/ui.data-table/index.vue +600 -961
- package/ui.data-table/services/table.service.js +15 -0
- package/ui.data-table-cell/composables/attrs.composable.js +24 -0
- package/ui.data-table-cell/configs/default.config.js +19 -0
- package/ui.data-table-cell/constants/index.js +5 -0
- package/ui.data-table-cell/index.vue +44 -0
- package/ui.dropdown-badge/Docs.mdx +16 -0
- package/ui.dropdown-badge/composables/attrs.composable.js +63 -0
- package/ui.dropdown-badge/configs/default.config.js +34 -0
- package/ui.dropdown-badge/constants/index.js +5 -0
- package/{ui.dropdown-tag → ui.dropdown-badge}/index.stories.js +26 -25
- package/ui.dropdown-badge/index.vue +233 -0
- package/ui.dropdown-button/Docs.mdx +16 -0
- package/ui.dropdown-button/composables/attrs.composable.js +63 -0
- package/ui.dropdown-button/configs/default.config.js +37 -0
- package/ui.dropdown-button/constants/index.js +14 -0
- package/ui.dropdown-button/index.stories.js +12 -11
- package/ui.dropdown-button/index.vue +231 -291
- package/ui.dropdown-item/Docs.mdx +16 -0
- package/ui.dropdown-item/composables/attrs.composable.js +13 -0
- package/ui.dropdown-item/configs/default.config.js +16 -0
- package/ui.dropdown-item/index.stories.js +2 -1
- package/ui.dropdown-item/index.vue +38 -55
- package/ui.dropdown-link/Docs.mdx +16 -0
- package/ui.dropdown-link/composables/attrs.composable.js +65 -0
- package/ui.dropdown-link/configs/default.config.js +37 -0
- package/ui.dropdown-link/constants/index.js +5 -0
- package/ui.dropdown-link/index.stories.js +11 -11
- package/ui.dropdown-link/index.vue +217 -287
- package/ui.dropdown-list/Docs.mdx +16 -0
- package/ui.dropdown-list/composables/attrs.composable.js +91 -0
- package/ui.dropdown-list/composables/usePointer.js +77 -0
- package/ui.dropdown-list/configs/default.config.js +68 -0
- package/ui.dropdown-list/constants/index.js +5 -0
- package/ui.dropdown-list/index.stories.js +33 -3
- package/ui.dropdown-list/index.vue +271 -112
- package/ui.form-calendar/Docs.mdx +52 -0
- package/ui.form-calendar/components/DayView.vue +230 -0
- package/ui.form-calendar/components/MonthView.vue +114 -0
- package/ui.form-calendar/components/YearView.vue +118 -0
- package/ui.form-calendar/composables/attrs.composable.js +87 -0
- package/ui.form-calendar/configs/default.config.js +115 -0
- package/ui.form-calendar/constants/index.js +69 -0
- package/ui.form-calendar/index.stories.js +50 -0
- package/ui.form-calendar/index.vue +628 -0
- package/ui.form-calendar/services/calendar.service.js +201 -0
- package/ui.form-calendar/services/date.service.js +121 -0
- package/ui.form-calendar/services/formatting.service.js +180 -0
- package/ui.form-checkbox/Docs.mdx +16 -0
- package/ui.form-checkbox/composables/attrs.composable.js +57 -0
- package/ui.form-checkbox/configs/default.config.js +69 -0
- package/ui.form-checkbox/constants/index.js +5 -0
- package/ui.form-checkbox/index.stories.js +75 -26
- package/ui.form-checkbox/index.vue +201 -261
- package/ui.form-checkbox-group/Docs.mdx +16 -0
- package/ui.form-checkbox-group/composables/attrs.composable.js +17 -0
- package/ui.form-checkbox-group/configs/default.config.js +5 -0
- package/ui.form-checkbox-group/constants/index.js +5 -0
- package/ui.form-checkbox-group/index.stories.js +7 -1
- package/ui.form-checkbox-group/index.vue +104 -177
- package/ui.form-checkbox-multi-state/Docs.mdx +16 -0
- package/ui.form-checkbox-multi-state/composables/attrs.composable.js +24 -0
- package/ui.form-checkbox-multi-state/configs/default.config.js +9 -0
- package/ui.form-checkbox-multi-state/constants/index.js +5 -0
- package/ui.form-checkbox-multi-state/index.stories.js +8 -11
- package/ui.form-checkbox-multi-state/index.vue +109 -220
- package/ui.form-color-picker/composables/attrs.composable.js +44 -0
- package/ui.form-color-picker/configs/default.config.js +52 -0
- package/ui.form-color-picker/constants/index.js +5 -0
- package/ui.form-color-picker/index.stories.js +63 -0
- package/ui.form-color-picker/index.vue +147 -329
- package/ui.form-date-picker/Docs.mdx +52 -0
- package/ui.form-date-picker/composables/attrs.composable.js +22 -0
- package/ui.form-date-picker/configs/default.config.js +27 -0
- package/ui.form-date-picker/constants/index.js +5 -0
- package/ui.form-date-picker/index.stories.js +21 -8
- package/ui.form-date-picker/index.vue +205 -802
- package/ui.form-input/Docs.mdx +16 -0
- package/ui.form-input/composables/attrs.composable.js +66 -0
- package/ui.form-input/configs/default.config.js +72 -0
- package/{constant.component-names → ui.form-input/constants}/index.js +1 -2
- package/ui.form-input/index.stories.js +46 -12
- package/ui.form-input/index.vue +320 -459
- package/ui.form-input-file/composables/attrs.composable.js +82 -0
- package/ui.form-input-file/configs/default.config.js +51 -0
- package/ui.form-input-file/constants/index.js +5 -0
- package/ui.form-input-file/index.stories.js +3 -2
- package/ui.form-input-file/index.vue +332 -498
- package/ui.form-input-money/Docs.mdx +16 -0
- package/ui.form-input-money/composables/attrs.composable.js +13 -0
- package/ui.form-input-money/composables/useFormatCurrency.js +82 -0
- package/ui.form-input-money/configs/default.config.js +16 -0
- package/ui.form-input-money/constants/index.js +5 -0
- package/ui.form-input-money/index.stories.js +71 -43
- package/ui.form-input-money/index.vue +241 -237
- package/ui.form-input-money/services/format.service.js +72 -0
- package/ui.form-input-number/Docs.mdx +16 -0
- package/ui.form-input-number/composables/attrs.composable.js +47 -0
- package/ui.form-input-number/configs/default.config.js +33 -0
- package/ui.form-input-number/constants/index.js +5 -0
- package/ui.form-input-number/index.stories.js +73 -3
- package/ui.form-input-number/index.vue +138 -106
- package/ui.form-input-rating/composables/attrs.composable.js +34 -0
- package/ui.form-input-rating/configs/default.config.js +25 -0
- package/ui.form-input-rating/constants/index.js +5 -0
- package/ui.form-input-rating/index.stories.js +3 -2
- package/ui.form-input-rating/index.vue +152 -209
- package/ui.form-input-search/composables/attrs.composable.js +21 -0
- package/ui.form-input-search/configs/default.config.js +20 -0
- package/ui.form-input-search/constants/index.js +5 -0
- package/ui.form-input-search/index.stories.js +8 -4
- package/ui.form-input-search/index.vue +192 -189
- package/ui.form-label/Docs.mdx +16 -0
- package/ui.form-label/composables/attrs.composable.js +65 -0
- package/ui.form-label/configs/default.config.js +95 -0
- package/ui.form-label/constants/index.js +13 -0
- package/ui.form-label/index.stories.js +107 -0
- package/ui.form-label/index.vue +170 -0
- package/ui.form-radio/Docs.mdx +16 -0
- package/ui.form-radio/composables/attrs.composable.js +34 -0
- package/ui.form-radio/configs/default.config.js +47 -0
- package/ui.form-radio/constants/index.js +5 -0
- package/ui.form-radio/index.stories.js +12 -10
- package/ui.form-radio/index.vue +141 -148
- package/ui.form-radio-card/Docs.mdx +16 -0
- package/ui.form-radio-card/composables/attrs.composable.js +30 -0
- package/ui.form-radio-card/configs/default.config.js +25 -0
- package/ui.form-radio-card/constants/index.js +5 -0
- package/ui.form-radio-card/index.stories.js +19 -10
- package/ui.form-radio-card/index.vue +132 -146
- package/ui.form-radio-card/services/variant.service.js +15 -0
- package/ui.form-radio-group/Docs.mdx +16 -0
- package/ui.form-radio-group/composables/attrs.composable.js +27 -0
- package/ui.form-radio-group/configs/default.config.js +18 -0
- package/ui.form-radio-group/constants/index.js +5 -0
- package/ui.form-radio-group/index.stories.js +1 -0
- package/ui.form-radio-group/index.vue +114 -85
- package/ui.form-select/Docs.mdx +16 -0
- package/ui.form-select/composables/attrs.composable.js +172 -0
- package/ui.form-select/configs/default.config.js +131 -0
- package/ui.form-select/constants/index.js +19 -0
- package/ui.form-select/index.stories.js +194 -38
- package/ui.form-select/index.vue +638 -910
- package/ui.form-select/services/select.service.js +98 -0
- package/ui.form-switch/composables/attrs.composable.js +77 -0
- package/ui.form-switch/configs/default.config.js +72 -0
- package/ui.form-switch/constants/index.js +5 -0
- package/ui.form-switch/index.stories.js +9 -42
- package/ui.form-switch/index.vue +177 -632
- package/ui.form-switch/services/variant.service.js +31 -0
- package/ui.form-textarea/Docs.mdx +16 -0
- package/ui.form-textarea/composables/attrs.composable.js +52 -0
- package/ui.form-textarea/configs/default.config.js +68 -0
- package/ui.form-textarea/constants/index.js +5 -0
- package/ui.form-textarea/index.stories.js +47 -5
- package/ui.form-textarea/index.vue +238 -353
- package/ui.image-avatar/composables/attrs.composable.js +34 -0
- package/ui.image-avatar/configs/default.config.js +42 -0
- package/ui.image-avatar/constants/index.js +5 -0
- package/ui.image-avatar/index.stories.js +7 -6
- package/ui.image-avatar/index.vue +94 -226
- package/ui.image-icon/Docs.mdx +16 -0
- package/ui.image-icon/composables/attrs.composable.js +65 -0
- package/ui.image-icon/configs/default.config.js +90 -0
- package/ui.image-icon/constants/index.js +5 -0
- package/ui.image-icon/index.stories.js +16 -35
- package/ui.image-icon/index.vue +165 -453
- package/ui.image-logo/composables/attrs.composable.js +41 -0
- package/ui.image-logo/configs/default.config.js +38 -0
- package/ui.image-logo/constants/index.js +5 -0
- package/ui.image-logo/index.stories.js +8 -8
- package/ui.image-logo/index.vue +80 -166
- package/ui.navigation-pagination/composables/attrs.composable.js +41 -0
- package/ui.navigation-pagination/configs/default.config.js +24 -0
- package/ui.navigation-pagination/constants/index.js +8 -0
- package/ui.navigation-pagination/index.stories.js +23 -6
- package/ui.navigation-pagination/index.vue +262 -102
- package/ui.navigation-stepper/composables/attrs.composable.js +25 -0
- package/ui.navigation-stepper/configs/default.config.js +13 -0
- package/ui.navigation-stepper/constants/index.js +5 -0
- package/ui.navigation-stepper/index.stories.js +1 -0
- package/ui.navigation-stepper/index.vue +87 -88
- package/ui.navigation-tab/composables/attrs.composable.js +30 -0
- package/ui.navigation-tab/configs/default.config.js +22 -0
- package/ui.navigation-tab/constants/index.js +5 -0
- package/ui.navigation-tab/index.stories.js +7 -11
- package/ui.navigation-tab/index.vue +58 -85
- package/ui.navigation-tabs/composables/attrs.composable.js +24 -0
- package/ui.navigation-tabs/configs/default.config.js +14 -0
- package/ui.navigation-tabs/constants/index.js +5 -0
- package/ui.navigation-tabs/index.stories.js +7 -11
- package/ui.navigation-tabs/index.vue +68 -88
- package/ui.other-dot/composables/attrs.composable.js +32 -0
- package/ui.other-dot/configs/default.config.js +21 -0
- package/ui.other-dot/constants/index.js +5 -0
- package/ui.other-dot/index.stories.js +5 -5
- package/ui.other-dot/index.vue +41 -89
- package/ui.other-loader/composables/attrs.composable.js +51 -0
- package/ui.other-loader/configs/default.config.js +47 -0
- package/ui.other-loader/constants/index.js +5 -0
- package/ui.other-loader/index.stories.js +14 -13
- package/ui.other-loader/index.vue +58 -107
- package/ui.text-alert/composables/attrs.composable.js +48 -0
- package/ui.text-alert/configs/default.config.js +51 -0
- package/ui.text-alert/constatns/index.js +5 -0
- package/ui.text-alert/index.stories.js +39 -6
- package/ui.text-alert/index.vue +95 -210
- package/ui.text-badge/Docs.mdx +16 -0
- package/ui.text-badge/composables/attrs.composable.js +49 -0
- package/ui.text-badge/configs/default.config.js +51 -0
- package/ui.text-badge/constants/index.js +5 -0
- package/ui.text-badge/index.stories.js +190 -0
- package/ui.text-badge/index.vue +120 -0
- package/ui.text-block/composables/attrs.composable.js +31 -0
- package/ui.text-block/configs/default.config.js +35 -0
- package/ui.text-block/constatns/index.js +5 -0
- package/ui.text-block/index.stories.js +2 -1
- package/ui.text-block/index.vue +55 -116
- package/ui.text-empty/Docs.mdx +16 -0
- package/ui.text-empty/composables/attrs.composable.js +43 -0
- package/ui.text-empty/configs/default.config.js +4 -2
- package/ui.text-empty/constants/index.js +5 -0
- package/ui.text-empty/index.stories.js +3 -3
- package/ui.text-empty/index.vue +13 -14
- package/ui.text-file/composables/attrs.composable.js +37 -0
- package/ui.text-file/configs/default.config.js +15 -0
- package/ui.text-file/index.stories.js +2 -1
- package/ui.text-file/index.vue +63 -72
- package/ui.text-files/composables/attrs.composable.js +19 -0
- package/ui.text-files/configs/default.config.js +9 -0
- package/ui.text-files/constants/index.js +5 -0
- package/ui.text-files/index.stories.js +1 -0
- package/ui.text-files/index.vue +73 -50
- package/ui.text-header/Docs.mdx +16 -0
- package/ui.text-header/composables/attrs.composable.js +34 -0
- package/ui.text-header/configs/default.config.js +45 -0
- package/ui.text-header/constants/index.js +5 -0
- package/ui.text-header/index.stories.js +34 -38
- package/ui.text-header/index.vue +67 -221
- package/ui.text-money/Docs.mdx +16 -0
- package/ui.text-money/composables/attrs.composable.js +65 -0
- package/ui.text-money/configs/default.config.js +69 -0
- package/ui.text-money/constants/index.js +7 -0
- package/ui.text-money/index.stories.js +24 -22
- package/ui.text-money/index.vue +187 -506
- package/ui.text-money/services/money.services.js +24 -0
- package/_readme/layoutAdmin.md +0 -703
- package/_readme/layoutApp.md +0 -153
- package/_readme/layoutAuth.md +0 -190
- package/config.rollup-plugin-visualizer/index.js +0 -11
- package/config.unplugin-vue-i18n/index.js +0 -9
- package/config.vite-plugin-pwa/index.js +0 -132
- package/config.vite-svg-loader/index.js +0 -22
- package/index.js +0 -151
- package/layout-ui.loader/index.vue +0 -61
- package/layout-ui.loader/store/index.js +0 -17
- package/layout-ui.loader-top/components/TopProgress.vue +0 -277
- package/layout-ui.loader-top/index.vue +0 -218
- package/layout-ui.loader-top/store/index.js +0 -55
- package/layout-ui.notify/index.stories.js +0 -102
- package/layout-ui.notify/index.vue +0 -254
- package/layout-ui.viewport/index.vue +0 -78
- package/layout-ui.viewport/store/index.js +0 -47
- package/layout.admin/AsideBlock.vue +0 -534
- package/layout.admin/AsideInfoBlock.vue +0 -85
- package/layout.admin/BrandBlock.vue +0 -380
- package/layout.admin/ChangeThemeModal.vue +0 -179
- package/layout.admin/HelperBlock.vue +0 -132
- package/layout.admin/MainMenu.vue +0 -234
- package/layout.admin/MainSubMenu.vue +0 -196
- package/layout.admin/MobileMainMenu.vue +0 -197
- package/layout.admin/MobileSubBlock.vue +0 -171
- package/layout.admin/RightInfoBlock.vue +0 -166
- package/layout.admin/UserBlock.vue +0 -290
- package/layout.admin/images/abstract-01.jpg +0 -0
- package/layout.admin/images/abstract-01_preview.jpg +0 -0
- package/layout.admin/index.vue +0 -544
- package/layout.admin/mixins/index.js +0 -54
- package/layout.admin/store/index.js +0 -167
- package/layout.auth/FeaturesBlock.vue +0 -57
- package/layout.auth/FooterMenu.vue +0 -90
- package/layout.auth/LanguageSwitcher.vue +0 -90
- package/layout.auth/index.vue +0 -237
- package/library.vue-tailwind-3/t-input.js +0 -68
- package/library.vue-tailwind-3/t-modal.js +0 -409
- package/library.vue-tailwind-3/t-pagination.js +0 -309
- package/library.vue-tailwind-3/t-table.js +0 -362
- package/library.vue-tailwind-3/t-textarea.js +0 -84
- package/resolver.unplugin-vue-components/index.js +0 -94
- package/service.api/index.js +0 -275
- package/service.data/index.js +0 -75
- package/service.date/index.js +0 -222
- package/service.i18n/index.js +0 -145
- package/service.idb-keyval/index.js +0 -37
- package/service.jwt/index.js +0 -27
- package/service.money/index.js +0 -86
- package/service.notify/index.js +0 -87
- package/service.redirect/index.js +0 -20
- package/service.validation/index.js +0 -55
- package/service.worker/index.js +0 -26
- package/ui.button-expand/index.stories.js +0 -44
- package/ui.button-expand/index.vue +0 -22
- package/ui.button-expand-item/index.stories.js +0 -69
- package/ui.button-expand-item/index.vue +0 -154
- package/ui.button-group/index.vue +0 -165
- package/ui.button-group-item/index.vue +0 -283
- package/ui.container-modal/components/ArrowLink.vue +0 -87
- package/ui.container-page/components/ArrowLink.vue +0 -87
- package/ui.data-table/components/DateSeparator.vue +0 -99
- package/ui.data-table/components/EmptyTableMsg.vue +0 -46
- package/ui.data-table/components/TableCheckbox.vue +0 -109
- package/ui.dropdown-tag/index.vue +0 -285
- package/ui.form-date-picker-range/components/VariantButton.vue +0 -136
- package/ui.form-date-picker-range/components/VariantInput.vue +0 -101
- package/ui.form-date-picker-range/index.stories.js +0 -93
- package/ui.form-date-picker-range/index.vue +0 -1537
- package/ui.form-date-picker-range/services/dateRange.service.js +0 -178
- package/ui.form-input-money/_components/ConvertibleInput.vue +0 -773
- package/ui.form-input-money/_components/RangeInput.vue +0 -356
- package/ui.form-input-money/_components/SingleInput.vue +0 -378
- package/ui.form-select-multi/index.stories.js +0 -131
- package/ui.form-select-multi/index.vue +0 -882
- package/ui.image-icon/cli.mjs +0 -159
- package/ui.text-empty/services/variant.service.js +0 -22
- package/ui.text-field/index.stories.js +0 -60
- package/ui.text-field/index.vue +0 -109
- package/ui.text-tag/index.stories.js +0 -90
- package/ui.text-tag/index.vue +0 -178
- package/web-types.json +0 -6320
- /package/ui.form-input/{text-security-disc.woff → assets/fonts/text-security-disc.woff} +0 -0
package/ui.data-table/index.vue
CHANGED
|
@@ -1,1101 +1,740 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div :data-cy="dataCy" v-bind="wrapperAttrs">
|
|
3
3
|
<div
|
|
4
|
-
v-show="
|
|
5
|
-
ref="
|
|
6
|
-
class="mono-table-custom-header"
|
|
7
|
-
:class="[headerClasses.actionsHeader, headerClasses.fixedHeader, headerClasses.compact]"
|
|
4
|
+
v-show="isShownStickyOrActionsHeader"
|
|
5
|
+
ref="headerStickyRow"
|
|
8
6
|
:style="tableRowWidthStyle"
|
|
7
|
+
v-bind="customHeaderAttrs"
|
|
9
8
|
>
|
|
10
9
|
<UCheckbox
|
|
11
10
|
v-if="selectable"
|
|
12
11
|
v-model="selectAll"
|
|
13
|
-
:partial="!isSelectedAllRows"
|
|
14
|
-
class="mono-table-custom-header-item"
|
|
15
12
|
size="sm"
|
|
13
|
+
:partial="!isSelectedAllRows"
|
|
14
|
+
:data-cy="`${dataCy}-select-all`"
|
|
15
|
+
v-bind="selectAllCheckboxAttrs"
|
|
16
16
|
/>
|
|
17
17
|
|
|
18
|
-
<template v-if="
|
|
19
|
-
<div
|
|
20
|
-
{{ selectedRowsLength }}
|
|
21
|
-
</div>
|
|
18
|
+
<template v-if="selectedRows.length">
|
|
19
|
+
<div v-bind="selectedRowsCountAttrs" v-text="selectedRows.length" />
|
|
22
20
|
|
|
23
|
-
<!-- @slot Use it to add actions instead table head (it appears when you select
|
|
21
|
+
<!-- @slot Use it to add actions instead table head (it appears when you select rows in table). -->
|
|
24
22
|
<slot name="thead-actions" :selected-rows="selectedRows" />
|
|
25
23
|
</template>
|
|
26
24
|
|
|
27
25
|
<template v-else>
|
|
28
26
|
<div
|
|
29
|
-
v-for="(
|
|
27
|
+
v-for="(column, index) in columns"
|
|
30
28
|
:key="index"
|
|
31
|
-
|
|
32
|
-
:class="item.thClass"
|
|
29
|
+
v-bind="customHeaderItemAttrs(column.thClass)"
|
|
33
30
|
>
|
|
34
|
-
<template v-if="
|
|
35
|
-
<!-- @slot Use it to customise table
|
|
36
|
-
<slot :name="`thead-${
|
|
31
|
+
<template v-if="hasSlotContent($slots[`thead-${column.key}`])">
|
|
32
|
+
<!-- @slot Use it to customise table column. -->
|
|
33
|
+
<slot :name="`thead-${column.key}`" :label="column.label" />
|
|
37
34
|
</template>
|
|
38
35
|
|
|
39
36
|
<template v-else>
|
|
40
|
-
{{
|
|
37
|
+
{{ column.label }}
|
|
41
38
|
</template>
|
|
39
|
+
|
|
40
|
+
<!-- @slot Use it to add content after table column. -->
|
|
41
|
+
<slot :name="`thead-${column.key}-after`" />
|
|
42
42
|
</div>
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
:resource-names="
|
|
45
|
+
<!-- TODO: Change to loaders config after laoader refactoring -->
|
|
46
|
+
<ULoaderTop
|
|
47
|
+
v-if="resource && isHeaderSticky"
|
|
48
|
+
:resource-names="resource"
|
|
49
49
|
position="absolute"
|
|
50
|
+
v-bind="headerStickyLoaderAttrs"
|
|
50
51
|
/>
|
|
51
52
|
</div>
|
|
52
53
|
|
|
53
|
-
<div ref="tableWrapper"
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
<th v-if="selectable" class="table-checkbox">
|
|
59
|
-
<UCheckbox
|
|
60
|
-
v-model="selectAll"
|
|
61
|
-
size="sm"
|
|
62
|
-
:show-partial-icon="!isSelectedAllRows"
|
|
63
|
-
partial
|
|
64
|
-
:data-cy="`${dataCy}-select-all`"
|
|
65
|
-
/>
|
|
66
|
-
</th>
|
|
67
|
-
|
|
68
|
-
<th v-for="(item, index) in data" :key="index" :class="[thClass, item.thClass]">
|
|
69
|
-
<template v-if="isExistSlot(`thead-${item.value}`)">
|
|
70
|
-
<!-- @slot Use it to customise table header item. -->
|
|
71
|
-
<slot :name="`thead-${item.value}`" :text="item.text" />
|
|
72
|
-
</template>
|
|
73
|
-
|
|
74
|
-
<template v-else>
|
|
75
|
-
{{ item.text }}
|
|
76
|
-
</template>
|
|
77
|
-
</th>
|
|
78
|
-
</tr>
|
|
79
|
-
<UTopLoader
|
|
80
|
-
v-if="loaderResourceName"
|
|
81
|
-
class="table-loader"
|
|
82
|
-
:resource-names="loaderResourceName"
|
|
83
|
-
position="absolute"
|
|
84
|
-
/>
|
|
85
|
-
</thead>
|
|
86
|
-
</template>
|
|
87
|
-
|
|
88
|
-
<template #row="{ row, rowIndex }">
|
|
89
|
-
<tr
|
|
90
|
-
v-if="rowIndex === firstRow && isShownSlot.beforeFirstRow"
|
|
91
|
-
class="more-row"
|
|
92
|
-
:class="beforeFirstRowClass"
|
|
93
|
-
>
|
|
94
|
-
<td v-if="isShownSlot.beforeFirstRow" :colspan="colsCount" :class="firstRowClass">
|
|
95
|
-
<!-- @slot Use it to add something before first row. -->
|
|
96
|
-
<slot name="before-first-row" />
|
|
97
|
-
</td>
|
|
98
|
-
|
|
99
|
-
<td v-else class="first-row" />
|
|
54
|
+
<div ref="tableWrapper" v-bind="tableWrapperAttrs">
|
|
55
|
+
<table v-bind="tableAttrs">
|
|
56
|
+
<thead v-bind="headerAttrs" :style="tableRowWidthStyle">
|
|
57
|
+
<tr v-if="hasSlotContent($slots['before-header-row'])" v-bind="headerRowAttrs">
|
|
58
|
+
<slot name="before-header-row" />
|
|
100
59
|
</tr>
|
|
101
60
|
|
|
102
|
-
<
|
|
103
|
-
v-if="
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<tr
|
|
111
|
-
v-if="!isShownRow(row)"
|
|
112
|
-
class="table-row"
|
|
113
|
-
:class="rowClass(row)"
|
|
114
|
-
:data-cy="`${dataCy}-row`"
|
|
115
|
-
@click="onClickRow(row)"
|
|
116
|
-
>
|
|
117
|
-
<td v-if="selectable" class="col-checkbox">
|
|
118
|
-
<TableCheckbox
|
|
119
|
-
v-model:values="selectedRows"
|
|
120
|
-
:value="rowIndex"
|
|
121
|
-
:data-cy="`${dataCy}-table-body-checkbox`"
|
|
122
|
-
@click.stop="onClickSelectRow(rowIndex)"
|
|
61
|
+
<tr ref="headerRow" v-bind="headerRowCellAttrs">
|
|
62
|
+
<th v-if="selectable" v-bind="headerCellAttrs(config.headerCheckboxWrapper)">
|
|
63
|
+
<UCheckbox
|
|
64
|
+
v-model="selectAll"
|
|
65
|
+
size="sm"
|
|
66
|
+
:partial="!isSelectedAllRows"
|
|
67
|
+
:data-cy="`${dataCy}-select-all`"
|
|
68
|
+
v-bind="headerSelectAllCheckboxAttrs"
|
|
123
69
|
/>
|
|
124
|
-
</
|
|
70
|
+
</th>
|
|
125
71
|
|
|
126
|
-
<
|
|
127
|
-
v-for="(
|
|
72
|
+
<th
|
|
73
|
+
v-for="(column, index) in normalizedColumns"
|
|
128
74
|
:key="index"
|
|
129
|
-
|
|
75
|
+
v-bind="headerCellAttrs(column.thClass)"
|
|
130
76
|
>
|
|
131
|
-
<template v-if="
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
:style="setLeftMargin(row.nestedLevel)"
|
|
135
|
-
@click="onClickShowItem(row)"
|
|
136
|
-
>
|
|
137
|
-
<div v-if="isShownIcon({ index, row })" class="table-button">
|
|
138
|
-
<UIcon
|
|
139
|
-
v-if="row.isHidden"
|
|
140
|
-
name="add"
|
|
141
|
-
class="table-container-icon"
|
|
142
|
-
size="xs"
|
|
143
|
-
:color="isIconActive(row)"
|
|
144
|
-
variant="light"
|
|
145
|
-
interactive
|
|
146
|
-
/>
|
|
147
|
-
|
|
148
|
-
<UIcon
|
|
149
|
-
v-else
|
|
150
|
-
name="remove"
|
|
151
|
-
class="table-container-icon"
|
|
152
|
-
size="xs"
|
|
153
|
-
variant="light"
|
|
154
|
-
interactive
|
|
155
|
-
/>
|
|
156
|
-
</div>
|
|
157
|
-
<!-- @slot Use it to customise table cell item (in whole column). -->
|
|
158
|
-
<slot :name="`cell-${key}`" :value="value" />
|
|
159
|
-
</div>
|
|
77
|
+
<template v-if="hasSlotContent($slots[`thead-${column.key}`])">
|
|
78
|
+
<!-- @slot Use it to customise table column. -->
|
|
79
|
+
<slot :name="`thead-${column.key}`" :label="column.label" />
|
|
160
80
|
</template>
|
|
161
81
|
|
|
162
|
-
<template v-else
|
|
163
|
-
|
|
82
|
+
<template v-else>
|
|
83
|
+
{{ column.label }}
|
|
164
84
|
</template>
|
|
165
85
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
86
|
+
<!-- @slot Use it to add content after table column. -->
|
|
87
|
+
<slot :name="`thead-${column.key}-after`" />
|
|
88
|
+
</th>
|
|
89
|
+
</tr>
|
|
170
90
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
91
|
+
<!-- TODO: Change to loaders config after laoader refactoring -->
|
|
92
|
+
<ULoaderTop
|
|
93
|
+
v-if="resource"
|
|
94
|
+
:resource-names="resource"
|
|
95
|
+
position="absolute"
|
|
96
|
+
v-bind="tableLoaderAttrs"
|
|
97
|
+
/>
|
|
98
|
+
</thead>
|
|
99
|
+
|
|
100
|
+
<tbody v-if="tableRows.length" v-bind="bodyAttrs">
|
|
101
|
+
<template v-for="(row, rowIndex) in tableRows" :key="row.id">
|
|
102
|
+
<tr v-if="rowIndex === firstRow" v-bind="beforeFirstRowAttrs">
|
|
103
|
+
<UTableCell
|
|
104
|
+
v-if="hasSlotContent($slots['before-first-row'])"
|
|
105
|
+
:colspan="colsCount"
|
|
106
|
+
:compact="compact"
|
|
107
|
+
v-bind="beforeFirstRowCellAttrs"
|
|
108
|
+
>
|
|
109
|
+
<!-- @slot Use it to add something before first row. -->
|
|
110
|
+
<slot name="before-first-row" />
|
|
111
|
+
</UTableCell>
|
|
112
|
+
|
|
113
|
+
<td v-else :colspan="colsCount" v-bind="beforeFirstRowCellAttrs" />
|
|
114
|
+
</tr>
|
|
175
115
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
116
|
+
<tr v-if="isShownDateSeparator(rowIndex) && row.date" v-bind="dateSeparatorRowAttrs">
|
|
117
|
+
<td :colspan="colsCount">
|
|
118
|
+
<UDivider
|
|
119
|
+
size="xs"
|
|
120
|
+
:label="getDateSeparatorLabel(row.date.separatorDate)"
|
|
121
|
+
v-bind="dateSeparatorAttrs"
|
|
122
|
+
/>
|
|
123
|
+
</td>
|
|
124
|
+
</tr>
|
|
181
125
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
126
|
+
<tr
|
|
127
|
+
v-if="!isShownRow(row)"
|
|
128
|
+
v-bind="bodyRowAttrs(rowClass(row))"
|
|
129
|
+
:data-cy="`${dataCy}-row`"
|
|
130
|
+
@click="onClickRow(row)"
|
|
131
|
+
>
|
|
132
|
+
<td v-if="selectable" :data-id="row.id" v-bind="checkboxBodyWrapperCellAttrs">
|
|
133
|
+
<UCheckbox
|
|
134
|
+
v-model="selectedRows"
|
|
135
|
+
:value="row.id"
|
|
189
136
|
size="sm"
|
|
137
|
+
:data-cy="`${dataCy}-table-body-checkbox`"
|
|
138
|
+
v-bind="tableCheckboxAttrs"
|
|
139
|
+
@click.stop="onClickSelectRow(row.id)"
|
|
190
140
|
/>
|
|
141
|
+
</td>
|
|
142
|
+
|
|
143
|
+
<UTableCell
|
|
144
|
+
v-for="(value, key, index) in TableService.getFilteredRow(row, columns)"
|
|
145
|
+
:key="index"
|
|
146
|
+
:compact="compact"
|
|
147
|
+
v-bind="bodyCellAttrs(getTdClass(key))"
|
|
148
|
+
>
|
|
149
|
+
<template v-if="Boolean($slots[`cell-${key}`])">
|
|
150
|
+
<div
|
|
151
|
+
:style="setLeftMargin(row.nestedLevel)"
|
|
152
|
+
v-bind="toggleButtonWrapperAttrs(index)"
|
|
153
|
+
@click="onClickShowItem(row)"
|
|
154
|
+
>
|
|
155
|
+
<div v-if="isShownIcon({ index, row })" v-bind="toggleItemButtonAttrs">
|
|
156
|
+
<UIcon
|
|
157
|
+
v-if="row.isHidden"
|
|
158
|
+
:name="config.expandIconName"
|
|
159
|
+
interactive
|
|
160
|
+
size="xs"
|
|
161
|
+
:color="isIconActive(row)"
|
|
162
|
+
v-bind="expandIconAttrs"
|
|
163
|
+
/>
|
|
164
|
+
|
|
165
|
+
<UIcon
|
|
166
|
+
v-else
|
|
167
|
+
:name="config.collapseIconName"
|
|
168
|
+
interactive
|
|
169
|
+
size="xs"
|
|
170
|
+
v-bind="collapseIconAttrs"
|
|
171
|
+
/>
|
|
172
|
+
</div>
|
|
173
|
+
<!-- @slot Use it to customise table cell item (in whole column). -->
|
|
174
|
+
<slot :name="`cell-${key}`" :value="value" :row="row" />
|
|
175
|
+
</div>
|
|
176
|
+
</template>
|
|
191
177
|
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
</
|
|
195
|
-
</template>
|
|
196
|
-
|
|
197
|
-
<template v-else-if="key === 'money'">
|
|
198
|
-
<UMoney :sum="value.sum" :currency-symbol="value.currencySymbol" />
|
|
199
|
-
</template>
|
|
178
|
+
<template v-else-if="Boolean($slots['cell-other'])">
|
|
179
|
+
<slot name="cell-other" :value="value" :row="row" />
|
|
180
|
+
</template>
|
|
200
181
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
:key="item"
|
|
206
|
-
:text="item"
|
|
207
|
-
:color="value.variant"
|
|
208
|
-
/>
|
|
209
|
-
</div>
|
|
210
|
-
</template>
|
|
182
|
+
<template v-else-if="value.hasOwnProperty('secondaryRow')">
|
|
183
|
+
<div :data-cy="`${dataCy}-${key}-cell`">
|
|
184
|
+
{{ value.primaryRow || HYPHEN_SYMBOL }}
|
|
185
|
+
</div>
|
|
211
186
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
</
|
|
224
|
-
</
|
|
187
|
+
<div v-bind="secondaryRowAttrs">
|
|
188
|
+
<template v-if="Array.isArray(value.secondaryRow)">
|
|
189
|
+
<div v-for="(secondaryRow, idx) in value.secondaryRow" :key="idx">
|
|
190
|
+
<span v-bind="secondaryRowEmptyAttrs">
|
|
191
|
+
{{ secondaryRow }}
|
|
192
|
+
</span>
|
|
193
|
+
</div>
|
|
194
|
+
</template>
|
|
195
|
+
|
|
196
|
+
<template v-else>
|
|
197
|
+
{{ value.secondaryRow }}
|
|
198
|
+
</template>
|
|
199
|
+
</div>
|
|
200
|
+
</template>
|
|
225
201
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
202
|
+
<template v-else>
|
|
203
|
+
<div :data-cy="`${dataCy}-${key}-cell`">
|
|
204
|
+
{{ value || HYPHEN_SYMBOL }}
|
|
205
|
+
</div>
|
|
206
|
+
</template>
|
|
207
|
+
</UTableCell>
|
|
208
|
+
</tr>
|
|
231
209
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
210
|
+
<tr v-if="rowIndex === lastRow" v-bind="afterLastRowAttrs">
|
|
211
|
+
<UTableCell
|
|
212
|
+
v-if="hasSlotContent(slots['after-last-row'])"
|
|
213
|
+
:compact="compact"
|
|
214
|
+
:colspan="colsCount"
|
|
215
|
+
v-bind="afterLastRowCellAttrs"
|
|
216
|
+
>
|
|
217
|
+
<!-- @slot Use it to add something after last row. -->
|
|
218
|
+
<slot name="after-last-row" />
|
|
219
|
+
</UTableCell>
|
|
220
|
+
|
|
221
|
+
<td v-else :colspan="colsCount" v-bind="afterLastRowCellAttrs" />
|
|
222
|
+
</tr>
|
|
223
|
+
</template>
|
|
224
|
+
</tbody>
|
|
239
225
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
<slot name="
|
|
226
|
+
<tbody v-else>
|
|
227
|
+
<tr>
|
|
228
|
+
<td :colspan="colsCount">
|
|
229
|
+
<slot name="empty-table-msg">
|
|
230
|
+
<UEmpty
|
|
231
|
+
size="sm"
|
|
232
|
+
:description="emptyTableMsg"
|
|
233
|
+
:data-cy="`${dataCy}-empty`"
|
|
234
|
+
v-bind="emptyAttrs"
|
|
235
|
+
/>
|
|
236
|
+
</slot>
|
|
244
237
|
</td>
|
|
245
238
|
</tr>
|
|
246
|
-
</
|
|
239
|
+
</tbody>
|
|
247
240
|
|
|
248
|
-
<
|
|
249
|
-
<
|
|
250
|
-
<
|
|
251
|
-
<td v-if="selectable" />
|
|
241
|
+
<tfoot v-if="hasSlotContent($slots['tfoot'])" v-bind="footerClassesAttrs">
|
|
242
|
+
<tr ref="footerRow" v-bind="footerRowAttrs">
|
|
243
|
+
<UTableCell v-if="selectable" :compact="compact" v-bind="footerCellAttrs" />
|
|
252
244
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
245
|
+
<!-- @slot Use it to add something in table footer. -->
|
|
246
|
+
<slot name="tfoot" :cols-count="colsCount" />
|
|
247
|
+
</tr>
|
|
256
248
|
|
|
257
|
-
|
|
258
|
-
|
|
249
|
+
<tr ref="footerStickyRow" :style="tableRowWidthStyle" v-bind="footerStickyRowAttrs">
|
|
250
|
+
<UTableCell v-if="selectable" :compact="compact" v-bind="footerCellAttrs" />
|
|
259
251
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
<template v-if="!tableItems.length" #tbody>
|
|
267
|
-
<EmptyTableMsg :colspan="colsCount" :filters="filters" :i18n="i18n">
|
|
268
|
-
<slot name="empty-table-msg" />
|
|
269
|
-
</EmptyTableMsg>
|
|
270
|
-
</template>
|
|
271
|
-
</t-table>
|
|
252
|
+
<!-- @slot Use it to add something in table footer. -->
|
|
253
|
+
<slot name="tfoot" :cols-count="colsCount" />
|
|
254
|
+
</tr>
|
|
255
|
+
</tfoot>
|
|
256
|
+
</table>
|
|
272
257
|
</div>
|
|
273
258
|
</div>
|
|
274
259
|
</template>
|
|
275
260
|
|
|
276
|
-
<script>
|
|
277
|
-
import
|
|
261
|
+
<script setup>
|
|
262
|
+
import {
|
|
263
|
+
ref,
|
|
264
|
+
computed,
|
|
265
|
+
watch,
|
|
266
|
+
useSlots,
|
|
267
|
+
onMounted,
|
|
268
|
+
onUpdated,
|
|
269
|
+
nextTick,
|
|
270
|
+
onBeforeUnmount,
|
|
271
|
+
} from "vue";
|
|
278
272
|
|
|
279
|
-
import { isSameDay, isValid, secondsToMilliseconds } from "date-fns";
|
|
280
|
-
|
|
281
|
-
import UMoney from "vueless/ui.text-money";
|
|
282
|
-
import UTag from "vueless/ui.text-tag";
|
|
283
|
-
import ULink from "vueless/ui.button-link";
|
|
284
273
|
import UCheckbox from "vueless/ui.form-checkbox";
|
|
285
|
-
import
|
|
286
|
-
|
|
287
|
-
import
|
|
288
|
-
import
|
|
289
|
-
import
|
|
290
|
-
import
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
DateSeparator,
|
|
274
|
+
import ULoaderTop from "@vueless/layouts/ui.loader-top";
|
|
275
|
+
|
|
276
|
+
import I18nServiceDefault from "@vueless/services/i18n";
|
|
277
|
+
import UIService from "vueless/service.ui";
|
|
278
|
+
import defaultConfig from "./configs/default.config";
|
|
279
|
+
import TableService from "./services/table.service";
|
|
280
|
+
|
|
281
|
+
import { HYPHEN_SYMBOL, PX_IN_REM } from "vueless/service.ui";
|
|
282
|
+
import { UTable } from "./constants";
|
|
283
|
+
import { useAttrs } from "./composables/attrs.composable";
|
|
284
|
+
|
|
285
|
+
/* Should be a string for correct web-types gen */
|
|
286
|
+
defineOptions({ name: "UTable", inheritAttrs: false });
|
|
287
|
+
|
|
288
|
+
const props = defineProps({
|
|
289
|
+
/**
|
|
290
|
+
* Table columns.
|
|
291
|
+
*/
|
|
292
|
+
columns: {
|
|
293
|
+
type: Array,
|
|
294
|
+
required: true,
|
|
307
295
|
},
|
|
308
296
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
default: () => [],
|
|
316
|
-
required: true,
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Set headers for table.
|
|
321
|
-
*/
|
|
322
|
-
headers: {
|
|
323
|
-
type: Array,
|
|
324
|
-
default: () => [],
|
|
325
|
-
required: true,
|
|
326
|
-
},
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Set filters for table.
|
|
330
|
-
*/
|
|
331
|
-
filters: {
|
|
332
|
-
type: Object,
|
|
333
|
-
default: () => ({}),
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* It allows selecting table rows.
|
|
338
|
-
*/
|
|
339
|
-
selectable: {
|
|
340
|
-
type: Boolean,
|
|
341
|
-
default: false,
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Makes the table more narrow.
|
|
346
|
-
*/
|
|
347
|
-
compact: {
|
|
348
|
-
type: Boolean,
|
|
349
|
-
default: false,
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Make footer fixed.
|
|
354
|
-
*/
|
|
355
|
-
fixedFooter: {
|
|
356
|
-
type: Boolean,
|
|
357
|
-
default: false,
|
|
358
|
-
},
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Make header sticky.
|
|
362
|
-
*/
|
|
363
|
-
stickyHeader: {
|
|
364
|
-
type: Boolean,
|
|
365
|
-
default: false,
|
|
366
|
-
},
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Set loader resource name to activate table top loader exact for that request.
|
|
370
|
-
*/
|
|
371
|
-
loaderResourceName: {
|
|
372
|
-
type: String,
|
|
373
|
-
default: "",
|
|
374
|
-
},
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Enable or disable nesting.
|
|
378
|
-
*/
|
|
379
|
-
nesting: {
|
|
380
|
-
type: Boolean,
|
|
381
|
-
default: false,
|
|
382
|
-
},
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Sets the nesting level from which folding button need to be shown.
|
|
386
|
-
*/
|
|
387
|
-
nestingFromLevel: {
|
|
388
|
-
type: Number,
|
|
389
|
-
default: 0,
|
|
390
|
-
},
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Sets data-cy attribute for automated testing.
|
|
394
|
-
*/
|
|
395
|
-
dataCy: {
|
|
396
|
-
type: String,
|
|
397
|
-
default: "",
|
|
398
|
-
},
|
|
297
|
+
/**
|
|
298
|
+
* Table rows data.
|
|
299
|
+
*/
|
|
300
|
+
rows: {
|
|
301
|
+
type: Array,
|
|
302
|
+
required: true,
|
|
399
303
|
},
|
|
400
304
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
305
|
+
/**
|
|
306
|
+
* Show/hide date divider or set label for specific date.
|
|
307
|
+
*/
|
|
308
|
+
dateDivider: {
|
|
309
|
+
type: [Array, Boolean],
|
|
310
|
+
default: false,
|
|
311
|
+
},
|
|
405
312
|
|
|
406
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Enable selecting table rows.
|
|
315
|
+
*/
|
|
316
|
+
selectable: {
|
|
317
|
+
type: Boolean,
|
|
318
|
+
default: UIService.get(defaultConfig, UTable).default.selectable,
|
|
407
319
|
},
|
|
408
320
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
firstRow: 0,
|
|
416
|
-
emptyItem: "-",
|
|
417
|
-
tableWidth: 0,
|
|
418
|
-
tableHeight: 0,
|
|
419
|
-
pagePositionY: 0,
|
|
420
|
-
}),
|
|
421
|
-
|
|
422
|
-
computed: {
|
|
423
|
-
i18n() {
|
|
424
|
-
return {
|
|
425
|
-
noItems: this.getTranslation("noItems"),
|
|
426
|
-
noResultsForFilters: this.getTranslation("noResultsForFilters"),
|
|
427
|
-
yesterday: this.getTranslation("yesterday"),
|
|
428
|
-
today: this.getTranslation("today"),
|
|
429
|
-
tomorrow: this.getTranslation("tomorrow"),
|
|
430
|
-
};
|
|
431
|
-
},
|
|
432
|
-
|
|
433
|
-
tableWrapClass() {
|
|
434
|
-
const selected = this.selectedRowsLength ? "mono-table-inner-wrapper-selected" : "";
|
|
435
|
-
const compact = this.compact ? "mono-table-inner-wrapper-compact" : "";
|
|
436
|
-
|
|
437
|
-
return [selected, compact];
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
selectedRowsLength() {
|
|
441
|
-
return this.selectedRows.length;
|
|
442
|
-
},
|
|
443
|
-
|
|
444
|
-
isSelectedAllRows() {
|
|
445
|
-
return this.selectedRowsLength === this.tableItems.length;
|
|
446
|
-
},
|
|
447
|
-
|
|
448
|
-
colsCount() {
|
|
449
|
-
return this.headers.length + 1;
|
|
450
|
-
},
|
|
451
|
-
|
|
452
|
-
lastRow() {
|
|
453
|
-
return this.items.length - 1;
|
|
454
|
-
},
|
|
455
|
-
|
|
456
|
-
isShownSlot() {
|
|
457
|
-
return {
|
|
458
|
-
beforeFirstRow: !!this.$slots["before-first-row"],
|
|
459
|
-
afterLastRow: !!this.$slots["after-last-row"],
|
|
460
|
-
};
|
|
461
|
-
},
|
|
462
|
-
|
|
463
|
-
tableClasses() {
|
|
464
|
-
return {
|
|
465
|
-
"fixed-footer": this.isFixedFooter,
|
|
466
|
-
};
|
|
467
|
-
},
|
|
468
|
-
|
|
469
|
-
headerClasses() {
|
|
470
|
-
return {
|
|
471
|
-
compact: this.compact ? "compact-header" : "",
|
|
472
|
-
actionsHeader: this.selectedRowsLength ? "actions-header" : "",
|
|
473
|
-
fixedHeader: this.isFixedHeader && this.stickyHeader ? "mono-table-fixed-header" : "",
|
|
474
|
-
hideHeader: this.selectedRowsLength && !this.isFixedHeader ? "hide-header" : "",
|
|
475
|
-
};
|
|
476
|
-
},
|
|
477
|
-
|
|
478
|
-
isShownFixedOrActionsHeader() {
|
|
479
|
-
return this.isFixedHeader || this.selectedRowsLength;
|
|
480
|
-
},
|
|
481
|
-
|
|
482
|
-
isFixedFooter() {
|
|
483
|
-
const windowHeight = window.innerHeight;
|
|
484
|
-
|
|
485
|
-
return (
|
|
486
|
-
windowHeight < this.tableHeight &&
|
|
487
|
-
this.fixedFooter &&
|
|
488
|
-
!this.isShownFooterPosition &&
|
|
489
|
-
this.isCheckedMoreOneTableItems
|
|
490
|
-
);
|
|
491
|
-
},
|
|
492
|
-
|
|
493
|
-
isFixedHeader() {
|
|
494
|
-
return !this.isShownHeaderPosition;
|
|
495
|
-
},
|
|
496
|
-
|
|
497
|
-
isShownHeaderPosition() {
|
|
498
|
-
const positionForFixHeader =
|
|
499
|
-
this.$refs?.headerRow?.getBoundingClientRect().top + window.pageYOffset || 0;
|
|
500
|
-
|
|
501
|
-
return positionForFixHeader >= this.pagePositionY;
|
|
502
|
-
},
|
|
503
|
-
|
|
504
|
-
isShownFooterPosition() {
|
|
505
|
-
const windowHeight = window.innerHeight;
|
|
506
|
-
const pageBottom = this.pagePositionY + windowHeight;
|
|
507
|
-
const positionForFixFooter =
|
|
508
|
-
this.$refs?.footerRow?.getBoundingClientRect().bottom + window.pageYOffset;
|
|
509
|
-
|
|
510
|
-
return pageBottom >= positionForFixFooter;
|
|
511
|
-
},
|
|
512
|
-
|
|
513
|
-
isCheckedMoreOneTableItems() {
|
|
514
|
-
const checkedTableItems = this.tableItems.filter((item) => item.isChecked);
|
|
515
|
-
|
|
516
|
-
return checkedTableItems.length > 1;
|
|
517
|
-
},
|
|
518
|
-
|
|
519
|
-
tableRowWidthStyle() {
|
|
520
|
-
return `width: ${this.tableWidth / ONE_REM}rem`;
|
|
521
|
-
},
|
|
522
|
-
|
|
523
|
-
beforeFirstRowClass() {
|
|
524
|
-
return this.tableItems[0]?.isChecked ? "table-row-checked" : "";
|
|
525
|
-
},
|
|
526
|
-
|
|
527
|
-
firstRowClass() {
|
|
528
|
-
return this.hasContentBeforeFirstRowSlot ? "" : "first-row";
|
|
529
|
-
},
|
|
530
|
-
|
|
531
|
-
afterLastRowClass() {
|
|
532
|
-
return this.isSlotEmpty("after-last-row") ? "more-row-hide" : "more-row";
|
|
533
|
-
},
|
|
534
|
-
|
|
535
|
-
hasContentBeforeFirstRowSlot() {
|
|
536
|
-
return this.isShownSlot.beforeFirstRow
|
|
537
|
-
? this.$slots["before-first-row"]()?.some((item) => !!item.type?.render)
|
|
538
|
-
: false;
|
|
539
|
-
},
|
|
321
|
+
/**
|
|
322
|
+
* Makes the table compact (fewer spacings).
|
|
323
|
+
*/
|
|
324
|
+
compact: {
|
|
325
|
+
type: Boolean,
|
|
326
|
+
default: UIService.get(defaultConfig, UTable).default.compact,
|
|
540
327
|
},
|
|
541
328
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
handler: "onChangeSelectedRows",
|
|
549
|
-
deep: true,
|
|
550
|
-
},
|
|
551
|
-
tableItems: {
|
|
552
|
-
handler: "onChangeTableItems",
|
|
553
|
-
deep: true,
|
|
554
|
-
},
|
|
555
|
-
items: {
|
|
556
|
-
handler: "onChangeItems",
|
|
557
|
-
deep: true,
|
|
558
|
-
},
|
|
559
|
-
isFixedFooter: "onChangeFixedFooter",
|
|
560
|
-
isFixedHeader: "onChangeFixedHeader",
|
|
329
|
+
/**
|
|
330
|
+
* Set header sticky.
|
|
331
|
+
*/
|
|
332
|
+
stickyHeader: {
|
|
333
|
+
type: Boolean,
|
|
334
|
+
default: UIService.get(defaultConfig, UTable).default.stickyHeader,
|
|
561
335
|
},
|
|
562
336
|
|
|
563
|
-
|
|
564
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Set footer sticky.
|
|
339
|
+
*/
|
|
340
|
+
stickyFooter: {
|
|
341
|
+
type: Boolean,
|
|
342
|
+
default: UIService.get(defaultConfig, UTable).default.stickyFooter,
|
|
343
|
+
},
|
|
565
344
|
|
|
566
|
-
|
|
567
|
-
|
|
345
|
+
/**
|
|
346
|
+
* Enable nesting rows.
|
|
347
|
+
*/
|
|
348
|
+
nesting: {
|
|
349
|
+
type: Boolean,
|
|
350
|
+
default: UIService.get(defaultConfig, UTable).default.nesting,
|
|
568
351
|
},
|
|
569
352
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
353
|
+
/**
|
|
354
|
+
* Sets the nesting level from which folding button need to be shown.
|
|
355
|
+
*/
|
|
356
|
+
nestingFrom: {
|
|
357
|
+
type: Number,
|
|
358
|
+
default: UIService.get(defaultConfig, UTable).default.nestingFrom,
|
|
573
359
|
},
|
|
574
360
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Indicate if filters applied.
|
|
363
|
+
*/
|
|
364
|
+
filters: {
|
|
365
|
+
type: Boolean,
|
|
366
|
+
default: false,
|
|
578
367
|
},
|
|
579
368
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
return isFirstRow && (isChildren || row.isNestingRow) && this.nesting && isWithinNestingLevel;
|
|
588
|
-
},
|
|
589
|
-
|
|
590
|
-
isIconActive(row) {
|
|
591
|
-
return !row.childrenIds?.length ? "gray" : "";
|
|
592
|
-
},
|
|
593
|
-
|
|
594
|
-
isSlotEmpty(slotName) {
|
|
595
|
-
return Boolean(this.$slots[slotName]);
|
|
596
|
-
},
|
|
597
|
-
|
|
598
|
-
onClickShowItem(row) {
|
|
599
|
-
if (!this.nesting || !row.childrenIds.length) return;
|
|
600
|
-
const [firstElement] = row.childrenIds;
|
|
601
|
-
|
|
602
|
-
row.isHidden = !row.isHidden;
|
|
603
|
-
|
|
604
|
-
if (row.isHidden && row.childrenIds.length) {
|
|
605
|
-
this.hiddenIds.push(...row.childrenIds);
|
|
606
|
-
} else {
|
|
607
|
-
this.hiddenIds =
|
|
608
|
-
row.nestedLevel === this.nestingFromLevel
|
|
609
|
-
? row.childrenIds.filter((item) => !this.hiddenIds.includes(item))
|
|
610
|
-
: this.hiddenIds.filter((item) => item !== firstElement);
|
|
611
|
-
}
|
|
612
|
-
},
|
|
613
|
-
|
|
614
|
-
tableContainerClass(index) {
|
|
615
|
-
return index === 0 && this.nesting ? "table-container" : "";
|
|
616
|
-
},
|
|
617
|
-
|
|
618
|
-
setLeftMargin(nestedLevel) {
|
|
619
|
-
return `margin-left: ${nestedLevel * ONE_AND_HALF_REM}rem`;
|
|
620
|
-
},
|
|
621
|
-
|
|
622
|
-
isShownRow(row) {
|
|
623
|
-
if (this.hiddenIds.includes(row.id)) {
|
|
624
|
-
row.isHidden = true;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
return this.hiddenIds.includes(row.id);
|
|
628
|
-
},
|
|
629
|
-
|
|
630
|
-
onChangeFixedFooter() {
|
|
631
|
-
if (this.isFixedFooter) {
|
|
632
|
-
this.$nextTick(() => {
|
|
633
|
-
this.setFooterItemsWidth();
|
|
634
|
-
});
|
|
635
|
-
} else {
|
|
636
|
-
this.setFooterItemsWidth(true);
|
|
637
|
-
}
|
|
638
|
-
},
|
|
639
|
-
|
|
640
|
-
setFooterItemsWidth(setNullWidth) {
|
|
641
|
-
const ZERO_WIDTH = 0;
|
|
642
|
-
|
|
643
|
-
if (!this.fixedFooter) return;
|
|
644
|
-
|
|
645
|
-
const [...mainFooterItems] = this.$refs.footerRow.children;
|
|
646
|
-
const [...fixedFooterItems] = this.$refs.footerFixedRow.children;
|
|
647
|
-
|
|
648
|
-
fixedFooterItems.forEach((item, index) => {
|
|
649
|
-
item.style.width = setNullWidth
|
|
650
|
-
? `${ZERO_WIDTH}rem`
|
|
651
|
-
: `${mainFooterItems[index].offsetWidth / ONE_REM}rem`;
|
|
652
|
-
});
|
|
653
|
-
},
|
|
654
|
-
|
|
655
|
-
onChangeFixedHeader() {
|
|
656
|
-
this.setHeaderItemsWidth();
|
|
657
|
-
},
|
|
658
|
-
|
|
659
|
-
setHeaderItemsWidth() {
|
|
660
|
-
if (!this.selectedRowsLength) {
|
|
661
|
-
const [...mainHeaderItems] = this.$refs.headerRow.children;
|
|
662
|
-
const [...fixedHeaderItems] = this.$refs.headerFixedRow.children;
|
|
663
|
-
|
|
664
|
-
fixedHeaderItems.forEach((item, index) => {
|
|
665
|
-
item.style.width = `${mainHeaderItems[index]?.offsetWidth / ONE_REM}rem`;
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
},
|
|
669
|
-
|
|
670
|
-
onScrollGetPosition() {
|
|
671
|
-
this.pagePositionY = window.pageYOffset;
|
|
672
|
-
},
|
|
673
|
-
|
|
674
|
-
onChangeTableItems(tableItems) {
|
|
675
|
-
this.$emit("update:items", tableItems);
|
|
676
|
-
},
|
|
677
|
-
|
|
678
|
-
onKeyupClearCheckbox(event) {
|
|
679
|
-
const escKeyCode = 27;
|
|
680
|
-
|
|
681
|
-
if (event.keyCode === escKeyCode && this.selectable) {
|
|
682
|
-
this.selectedRows = [];
|
|
683
|
-
}
|
|
684
|
-
},
|
|
685
|
-
|
|
686
|
-
onChangeItems() {
|
|
687
|
-
if (!this.items.length || this.tableItems.length !== this.items.length) {
|
|
688
|
-
this.selectedRows = [];
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
const checkedTableItems = this.tableItems.filter((item) => item.isChecked);
|
|
692
|
-
|
|
693
|
-
this.tableItems = this.items;
|
|
694
|
-
|
|
695
|
-
this.tableItems.forEach((item) => {
|
|
696
|
-
checkedTableItems.forEach((checkedItem) => {
|
|
697
|
-
if (item.id === checkedItem.id) {
|
|
698
|
-
item.isChecked = true;
|
|
699
|
-
}
|
|
700
|
-
});
|
|
701
|
-
|
|
702
|
-
if (this.nesting && item.isHidden && item.childrenIds?.length) {
|
|
703
|
-
this.hiddenIds.push(...item.childrenIds);
|
|
704
|
-
}
|
|
705
|
-
});
|
|
706
|
-
},
|
|
707
|
-
|
|
708
|
-
isShownDateSeparator(rowIndex, date) {
|
|
709
|
-
const prevIndex = rowIndex ? rowIndex - 1 : rowIndex;
|
|
710
|
-
const prevItem = this.tableItems[prevIndex];
|
|
711
|
-
const prevDateInMilliseconds = secondsToMilliseconds(prevItem?.date?.primaryRow);
|
|
712
|
-
const dateInMilliseconds = secondsToMilliseconds(date?.primaryRow);
|
|
713
|
-
const isSameDate = isSameDay(dateInMilliseconds, prevDateInMilliseconds);
|
|
714
|
-
|
|
715
|
-
if (rowIndex === 0) {
|
|
716
|
-
return isValid(prevDateInMilliseconds) && this.hasContentBeforeFirstRowSlot;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
return isValid(prevDateInMilliseconds) && !isSameDate;
|
|
720
|
-
},
|
|
721
|
-
|
|
722
|
-
rowClass(row) {
|
|
723
|
-
return row.isChecked ? "table-row-checked" : "";
|
|
724
|
-
},
|
|
725
|
-
|
|
726
|
-
dateSeparatorRowClass(rowIndex) {
|
|
727
|
-
const isCheckedRowBefore = this.tableItems[rowIndex - 1]?.isChecked;
|
|
728
|
-
const isCheckedRowAfter = this.tableItems[rowIndex]?.isChecked;
|
|
729
|
-
|
|
730
|
-
return (isCheckedRowBefore && isCheckedRowAfter) || (rowIndex === 0 && isCheckedRowAfter)
|
|
731
|
-
? "table-row-checked"
|
|
732
|
-
: "";
|
|
733
|
-
},
|
|
734
|
-
|
|
735
|
-
onClickSelectRow(rowIndex) {
|
|
736
|
-
const isRowChecked = this.tableItems[rowIndex].isChecked;
|
|
737
|
-
|
|
738
|
-
this.tableItems[rowIndex].isChecked = !isRowChecked;
|
|
739
|
-
},
|
|
740
|
-
|
|
741
|
-
getFilteredRow(row) {
|
|
742
|
-
const filteredRow = Object.entries(row).filter((col) => {
|
|
743
|
-
const [key] = col;
|
|
744
|
-
const isShownCol = this.headers.some((header) => header.value === key);
|
|
745
|
-
|
|
746
|
-
if (isShownCol) return col;
|
|
747
|
-
});
|
|
748
|
-
|
|
749
|
-
return Object.fromEntries(filteredRow);
|
|
750
|
-
},
|
|
751
|
-
|
|
752
|
-
onClickRow(row) {
|
|
753
|
-
this.$emit("clickRow", row);
|
|
754
|
-
},
|
|
755
|
-
|
|
756
|
-
isExistSlot(slotName) {
|
|
757
|
-
return !!this.$slots[slotName];
|
|
758
|
-
},
|
|
759
|
-
|
|
760
|
-
getTdClass(key) {
|
|
761
|
-
return this.headers.find((item) => item.value === key)?.tdClass;
|
|
762
|
-
},
|
|
763
|
-
|
|
764
|
-
onChangeSelectAll(selectAll) {
|
|
765
|
-
if (selectAll && this.canSelectAll) {
|
|
766
|
-
this.selectedRows = this.tableItems.map((item, index) => index);
|
|
767
|
-
|
|
768
|
-
this.tableItems.forEach((item) => {
|
|
769
|
-
item.isChecked = true;
|
|
770
|
-
});
|
|
771
|
-
} else if (!selectAll) {
|
|
772
|
-
this.selectedRows = [];
|
|
773
|
-
|
|
774
|
-
this.tableItems.forEach((item) => {
|
|
775
|
-
item.isChecked = false;
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
this.canSelectAll = true;
|
|
780
|
-
},
|
|
781
|
-
|
|
782
|
-
onChangeSelectedRows(selectedRows) {
|
|
783
|
-
if (selectedRows.length) {
|
|
784
|
-
this.canSelectAll = false;
|
|
785
|
-
|
|
786
|
-
this.isCheckedMoreOneTableItems ? this.setFooterItemsWidth() : "";
|
|
787
|
-
} else {
|
|
788
|
-
this.$nextTick(() => {
|
|
789
|
-
this.setHeaderItemsWidth();
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
this.selectAll = !!selectedRows.length;
|
|
794
|
-
},
|
|
795
|
-
|
|
796
|
-
dateConverter(value, format) {
|
|
797
|
-
return new DateServiceDefault().dateConverter(value, format);
|
|
798
|
-
},
|
|
799
|
-
|
|
800
|
-
clearSelectedItems() {
|
|
801
|
-
this.selectedRows = [];
|
|
802
|
-
},
|
|
369
|
+
/**
|
|
370
|
+
* Set loader resource name to activate table top loader exact for that resource.
|
|
371
|
+
*/
|
|
372
|
+
resource: {
|
|
373
|
+
type: String,
|
|
374
|
+
default: "",
|
|
803
375
|
},
|
|
804
|
-
};
|
|
805
|
-
</script>
|
|
806
376
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
ru:
|
|
815
|
-
noItems: Пока что в таблице нет данных.
|
|
816
|
-
noResultsForFilters: По заданным фильтрам ничего не найдено.
|
|
817
|
-
yesterday: Вчера
|
|
818
|
-
today: Сегодня
|
|
819
|
-
tomorrow: Завтра
|
|
820
|
-
ua:
|
|
821
|
-
noItems: Поки що в таблиці немає даних.
|
|
822
|
-
noResultsForFilters: За даними фільтрами нічого не знайдено.
|
|
823
|
-
yesterday: Вчора
|
|
824
|
-
today: Сьогодні
|
|
825
|
-
tomorrow: Завтра
|
|
826
|
-
</i18n>
|
|
377
|
+
/**
|
|
378
|
+
* Component ui config object.
|
|
379
|
+
*/
|
|
380
|
+
config: {
|
|
381
|
+
type: Object,
|
|
382
|
+
default: () => ({}),
|
|
383
|
+
},
|
|
827
384
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
385
|
+
/**
|
|
386
|
+
* Data-cy attribute for automated testing.
|
|
387
|
+
*/
|
|
388
|
+
dataCy: {
|
|
389
|
+
type: String,
|
|
390
|
+
default: "",
|
|
391
|
+
},
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
const emit = defineEmits(["clickRow", "update:rows"]);
|
|
395
|
+
|
|
396
|
+
defineExpose({ clearSelectedItems });
|
|
397
|
+
|
|
398
|
+
const { getTranslation } = new I18nServiceDefault();
|
|
399
|
+
const slots = useSlots();
|
|
400
|
+
|
|
401
|
+
const selectAll = ref(false);
|
|
402
|
+
const canSelectAll = ref(true);
|
|
403
|
+
const selectedRows = ref([]);
|
|
404
|
+
const tableRows = ref([]);
|
|
405
|
+
const hiddenIds = ref([]);
|
|
406
|
+
const firstRow = ref(0);
|
|
407
|
+
const tableWidth = ref(0);
|
|
408
|
+
const tableHeight = ref(0);
|
|
409
|
+
const pagePositionY = ref(0);
|
|
410
|
+
|
|
411
|
+
const headerRow = ref(null);
|
|
412
|
+
const footerRow = ref(null);
|
|
413
|
+
const tableWrapper = ref(null);
|
|
414
|
+
const footerStickyRow = ref(null);
|
|
415
|
+
const headerStickyRow = ref(null);
|
|
416
|
+
|
|
417
|
+
const isHeaderSticky = computed(() => {
|
|
418
|
+
return !isShownHeaderPosition.value;
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
const isFooterSticky = computed(
|
|
422
|
+
() =>
|
|
423
|
+
window.innerHeight < tableHeight.value &&
|
|
424
|
+
props.stickyFooter &&
|
|
425
|
+
!isShownFooterPosition.value &&
|
|
426
|
+
isCheckedMoreOneTableItems.value,
|
|
427
|
+
);
|
|
428
|
+
|
|
429
|
+
const {
|
|
430
|
+
config,
|
|
431
|
+
wrapperAttrs,
|
|
432
|
+
customHeaderItemAttrs,
|
|
433
|
+
customHeaderAttrs,
|
|
434
|
+
tableWrapperAttrs,
|
|
435
|
+
headerRowCellAttrs,
|
|
436
|
+
afterLastRowAttrs,
|
|
437
|
+
afterLastRowCellAttrs,
|
|
438
|
+
beforeFirstRowAttrs,
|
|
439
|
+
beforeFirstRowCellAttrs,
|
|
440
|
+
bodyRowAttrs,
|
|
441
|
+
footerClassesAttrs,
|
|
442
|
+
dateSeparatorRowAttrs,
|
|
443
|
+
toggleButtonWrapperAttrs,
|
|
444
|
+
headerCellAttrs,
|
|
445
|
+
bodyCellAttrs,
|
|
446
|
+
checkboxBodyWrapperCellAttrs,
|
|
447
|
+
footerCellAttrs,
|
|
448
|
+
selectAllCheckboxAttrs,
|
|
449
|
+
headerSelectAllCheckboxAttrs,
|
|
450
|
+
tableCheckboxAttrs,
|
|
451
|
+
collapseIconAttrs,
|
|
452
|
+
expandIconAttrs,
|
|
453
|
+
emptyAttrs,
|
|
454
|
+
dateSeparatorAttrs,
|
|
455
|
+
selectedRowsCountAttrs,
|
|
456
|
+
headerStickyLoaderAttrs,
|
|
457
|
+
tableAttrs,
|
|
458
|
+
headerRowAttrs,
|
|
459
|
+
tableLoaderAttrs,
|
|
460
|
+
bodyAttrs,
|
|
461
|
+
toggleItemButtonAttrs,
|
|
462
|
+
secondaryRowAttrs,
|
|
463
|
+
secondaryRowEmptyAttrs,
|
|
464
|
+
footerRowAttrs,
|
|
465
|
+
footerStickyRowAttrs,
|
|
466
|
+
hasSlotContent,
|
|
467
|
+
headerAttrs,
|
|
468
|
+
} = useAttrs(props, { selectedRows, isHeaderSticky, tableRows, isFooterSticky });
|
|
469
|
+
|
|
470
|
+
const i18n = computed(() => ({
|
|
471
|
+
noItems: getTranslation("noItems"),
|
|
472
|
+
noResultsForFilters: getTranslation("noResultsForFilters"),
|
|
473
|
+
yesterday: getTranslation("yesterday"),
|
|
474
|
+
today: getTranslation("today"),
|
|
475
|
+
tomorrow: getTranslation("tomorrow"),
|
|
476
|
+
}));
|
|
477
|
+
|
|
478
|
+
const normalizedColumns = computed(() => TableService.normalizeColumns(props.columns));
|
|
479
|
+
|
|
480
|
+
const isSelectedAllRows = computed(() => {
|
|
481
|
+
return selectedRows.value.length === tableRows.value.length;
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
const colsCount = computed(() => {
|
|
485
|
+
return props.columns.length + 1;
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
const lastRow = computed(() => {
|
|
489
|
+
return props.rows.length - 1;
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
const isShownStickyOrActionsHeader = computed(() => {
|
|
493
|
+
return isHeaderSticky.value || selectedRows.value.length;
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
const isShownHeaderPosition = computed(() => {
|
|
497
|
+
const positionForFixHeader = headerRow.value?.getBoundingClientRect().top + window.scrollY || 0;
|
|
498
|
+
|
|
499
|
+
return positionForFixHeader >= pagePositionY.value;
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
const isShownFooterPosition = computed(() => {
|
|
503
|
+
const pageBottom = pagePositionY.value + window.innerHeight;
|
|
504
|
+
const positionForFixFooter = footerRow.value?.getBoundingClientRect().bottom + window.scrollY;
|
|
505
|
+
|
|
506
|
+
return pageBottom >= positionForFixFooter;
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
const isCheckedMoreOneTableItems = computed(() => {
|
|
510
|
+
return tableRows.value.filter((item) => item.isChecked).length > 1;
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
const tableRowWidthStyle = computed(() => ({ width: `${tableWidth.value / PX_IN_REM}rem` }));
|
|
514
|
+
|
|
515
|
+
const hasContentBeforeFirstRowSlot = computed(() => {
|
|
516
|
+
return hasSlotContent(slots["before-first-row"])
|
|
517
|
+
? slots["before-first-row"]()?.some((item) => !!item.type?.render)
|
|
518
|
+
: false;
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
const emptyTableMsg = computed(() => {
|
|
522
|
+
return props.filters ? i18n.value.noResultsForFilters : i18n.value.noItems;
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
watch(selectAll, onChangeSelectAll, { deep: true });
|
|
526
|
+
watch(selectedRows, onChangeSelectedRows, { deep: true });
|
|
527
|
+
watch(tableRows, () => emit("update:rows", tableRows), { deep: true });
|
|
528
|
+
watch(() => tableRows.value.length, updateSelectedRows);
|
|
529
|
+
watch(() => props.rows, synchronizeTableItemsWithProps, { deep: true });
|
|
530
|
+
watch(isHeaderSticky, setHeaderItemsWidth);
|
|
531
|
+
watch(isFooterSticky, (newValue) =>
|
|
532
|
+
newValue ? nextTick(setFooterItemsWidth) : setFooterItemsWidth(true),
|
|
533
|
+
);
|
|
534
|
+
|
|
535
|
+
tableRows.value = props.rows;
|
|
536
|
+
|
|
537
|
+
onMounted(() => {
|
|
538
|
+
document.addEventListener("keyup", onKeyupClearCheckbox);
|
|
539
|
+
document.addEventListener("scroll", onScrollGetPosition, { passive: true });
|
|
540
|
+
window.addEventListener("resize", onWindowResizeSetWidth);
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
onUpdated(() => {
|
|
544
|
+
tableHeight.value = tableWrapper.value?.offsetHeight;
|
|
545
|
+
tableWidth.value = tableWrapper.value?.offsetWidth;
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
onBeforeUnmount(() => {
|
|
549
|
+
document.removeEventListener("keyup", onKeyupClearCheckbox);
|
|
550
|
+
document.removeEventListener("scroll", onScrollGetPosition);
|
|
551
|
+
window.removeEventListener("resize", onWindowResizeSetWidth);
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
function onWindowResizeSetWidth() {
|
|
555
|
+
tableWidth.value = tableWrapper.value.offsetWidth;
|
|
556
|
+
|
|
557
|
+
setHeaderItemsWidth();
|
|
558
|
+
setFooterItemsWidth();
|
|
831
559
|
}
|
|
832
560
|
|
|
833
|
-
|
|
834
|
-
.
|
|
835
|
-
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
.last-row {
|
|
839
|
-
@apply py-1 !important;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
td {
|
|
843
|
-
@apply px-0 py-4 !important;
|
|
561
|
+
function isShownIcon({ index, row }) {
|
|
562
|
+
const isChildren = row.childrenIds?.length > 0;
|
|
563
|
+
const isWithinNestingLevel = row.nestedLevel >= props.nestingFrom;
|
|
844
564
|
|
|
845
|
-
|
|
846
|
-
@apply mx-auto;
|
|
847
|
-
}
|
|
848
|
-
}
|
|
565
|
+
const isFirstRow = index === 0;
|
|
849
566
|
|
|
850
|
-
|
|
851
|
-
td {
|
|
852
|
-
@apply !p-0;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
567
|
+
return isFirstRow && (isChildren || row.isNestingRow) && props.nesting && isWithinNestingLevel;
|
|
855
568
|
}
|
|
856
569
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
@apply bg-white;
|
|
860
|
-
|
|
861
|
-
&.actions-header {
|
|
862
|
-
@apply rounded-t-none;
|
|
863
|
-
}
|
|
570
|
+
function isIconActive(row) {
|
|
571
|
+
return !row.childrenIds?.length ? "grayscale" : "";
|
|
864
572
|
}
|
|
865
573
|
|
|
866
|
-
|
|
867
|
-
|
|
574
|
+
function onClickShowItem(row) {
|
|
575
|
+
if (!props.nesting || !row.childrenIds.length) return;
|
|
576
|
+
const [firstElement] = row.childrenIds;
|
|
868
577
|
|
|
869
|
-
.
|
|
870
|
-
|
|
871
|
-
|
|
578
|
+
row.isHidden = !row.isHidden;
|
|
579
|
+
|
|
580
|
+
if (row.isHidden && row.childrenIds.length) {
|
|
581
|
+
hiddenIds.value.push(...row.childrenIds);
|
|
582
|
+
} else {
|
|
583
|
+
hiddenIds.value =
|
|
584
|
+
row.nestedLevel === props.nestingFromLevel
|
|
585
|
+
? row.childrenIds.filter((item) => !hiddenIds.value.includes(item))
|
|
586
|
+
: hiddenIds.value.filter((item) => item !== firstElement);
|
|
872
587
|
}
|
|
873
588
|
}
|
|
874
589
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
@apply flex-none;
|
|
881
|
-
@apply text-sm font-normal text-gray-500;
|
|
882
|
-
@apply px-[1.125rem] py-5;
|
|
883
|
-
|
|
884
|
-
&:first-child {
|
|
885
|
-
@apply p-5;
|
|
886
|
-
}
|
|
590
|
+
function getDateSeparatorLabel(separatorDate) {
|
|
591
|
+
return Array.isArray(props.dateDivider)
|
|
592
|
+
? props.dateDivider.find((dateItem) => dateItem.date === separatorDate)?.label || separatorDate
|
|
593
|
+
: separatorDate;
|
|
594
|
+
}
|
|
887
595
|
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
596
|
+
function setLeftMargin(nestedLevel) {
|
|
597
|
+
return { marginLeft: `${nestedLevel * 1.5}rem` };
|
|
598
|
+
}
|
|
891
599
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
600
|
+
function isShownRow(row) {
|
|
601
|
+
if (hiddenIds.value.includes(row.id)) {
|
|
602
|
+
row.isHidden = true;
|
|
895
603
|
}
|
|
896
604
|
|
|
897
|
-
|
|
898
|
-
.fixed-header-table-loader {
|
|
899
|
-
@apply !top-[3.25rem];
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
.mono-table-custom-header-item {
|
|
903
|
-
@apply p-4;
|
|
904
|
-
|
|
905
|
-
&:nth-child(2) {
|
|
906
|
-
@apply pl-0;
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
605
|
+
return hiddenIds.value.includes(row.id);
|
|
910
606
|
}
|
|
911
607
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
@apply border border-gray-200;
|
|
915
|
-
|
|
916
|
-
&-selected {
|
|
917
|
-
@apply !rounded-t-none border-t-0;
|
|
918
|
-
}
|
|
608
|
+
function setFooterItemsWidth(setNullWidth) {
|
|
609
|
+
const ZERO_WIDTH = 0;
|
|
919
610
|
|
|
920
|
-
.
|
|
921
|
-
@apply min-w-full border-none bg-white text-sm;
|
|
922
|
-
@apply w-full;
|
|
611
|
+
if (!props.stickyFooter) return;
|
|
923
612
|
|
|
924
|
-
|
|
925
|
-
|
|
613
|
+
const mainFooterItems = [...footerRow.value.children];
|
|
614
|
+
const stickyFooterItems = [...footerStickyRow.value.children];
|
|
926
615
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
616
|
+
stickyFooterItems.forEach((item, index) => {
|
|
617
|
+
item.style.width = setNullWidth
|
|
618
|
+
? `${ZERO_WIDTH}rem`
|
|
619
|
+
: `${mainFooterItems[index].offsetWidth / PX_IN_REM}rem`;
|
|
620
|
+
});
|
|
621
|
+
}
|
|
931
622
|
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
@apply p-5;
|
|
935
|
-
}
|
|
623
|
+
function setHeaderItemsWidth() {
|
|
624
|
+
if (selectedRows.value.length) return;
|
|
936
625
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
}
|
|
626
|
+
const mainHeaderItems = [...(headerRow.value?.children || [])];
|
|
627
|
+
const stickyHeaderItems = [...(headerStickyRow.value?.children || [])];
|
|
943
628
|
|
|
944
|
-
|
|
945
|
-
|
|
629
|
+
stickyHeaderItems.forEach((item, index) => {
|
|
630
|
+
item.style.width = `${mainHeaderItems[index]?.offsetWidth / PX_IN_REM}rem`;
|
|
631
|
+
});
|
|
632
|
+
}
|
|
946
633
|
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
@apply align-top;
|
|
634
|
+
function onScrollGetPosition() {
|
|
635
|
+
pagePositionY.value = window.scrollY;
|
|
636
|
+
}
|
|
951
637
|
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
@apply p-5;
|
|
955
|
-
}
|
|
638
|
+
function onKeyupClearCheckbox(event) {
|
|
639
|
+
const escKeyCode = 27;
|
|
956
640
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
641
|
+
if (event.keyCode === escKeyCode && props.selectable) {
|
|
642
|
+
selectedRows.value = [];
|
|
643
|
+
}
|
|
644
|
+
}
|
|
960
645
|
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
}
|
|
966
|
-
}
|
|
646
|
+
function synchronizeTableItemsWithProps() {
|
|
647
|
+
if (!props.rows.length || props.rows.length !== tableRows.value.length) {
|
|
648
|
+
selectedRows.value = [];
|
|
649
|
+
}
|
|
967
650
|
|
|
968
|
-
|
|
969
|
-
@apply border-t border-solid border-gray-200;
|
|
651
|
+
tableRows.value = props.rows;
|
|
970
652
|
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
653
|
+
tableRows.value.forEach((item) => {
|
|
654
|
+
if (props.nesting && item.isHidden && item.childrenIds?.length) {
|
|
655
|
+
hiddenIds.value.push(...item.childrenIds);
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
}
|
|
974
659
|
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
660
|
+
function updateSelectedRows() {
|
|
661
|
+
selectedRows.value = tableRows.value.filter((row) => row.isChecked).map((row) => row.id);
|
|
662
|
+
}
|
|
978
663
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
664
|
+
function isShownDateSeparator(rowIndex) {
|
|
665
|
+
const prevIndex = rowIndex ? rowIndex - 1 : rowIndex;
|
|
666
|
+
const nextIndex = rowIndex ? rowIndex + 1 : rowIndex;
|
|
667
|
+
const prevItem = tableRows.value[prevIndex];
|
|
668
|
+
const nextItem = tableRows.value[nextIndex];
|
|
669
|
+
const currentItem = tableRows.value[rowIndex];
|
|
985
670
|
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
}
|
|
671
|
+
if (rowIndex === 0) {
|
|
672
|
+
return hasContentBeforeFirstRowSlot.value;
|
|
989
673
|
}
|
|
990
674
|
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
th {
|
|
996
|
-
@apply bg-white p-4;
|
|
997
|
-
|
|
998
|
-
&:first-child,
|
|
999
|
-
&:last-child {
|
|
1000
|
-
@apply p-4;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
:deep(tbody) {
|
|
1007
|
-
tr {
|
|
1008
|
-
td {
|
|
1009
|
-
@apply px-4 py-3;
|
|
1010
|
-
|
|
1011
|
-
&:first-child,
|
|
1012
|
-
&:last-child {
|
|
1013
|
-
@apply px-4 py-3;
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
:deep(tfoot) {
|
|
1020
|
-
tr {
|
|
1021
|
-
td {
|
|
1022
|
-
@apply p-4;
|
|
1023
|
-
|
|
1024
|
-
&:first-child {
|
|
1025
|
-
@apply p-4;
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
675
|
+
const isPrevSameDate = prevItem?.date?.primaryRow === currentItem?.date?.primaryRow;
|
|
676
|
+
const isNextSameDate = nextItem?.date?.primaryRow === currentItem?.date?.primaryRow;
|
|
677
|
+
|
|
678
|
+
return isPrevSameDate && !isNextSameDate && props.dateDivider;
|
|
1032
679
|
}
|
|
1033
680
|
|
|
1034
|
-
|
|
1035
|
-
|
|
681
|
+
function rowClass(row) {
|
|
682
|
+
return selectedRows.value.includes(row.id) ? config.value.checkedRow : "";
|
|
1036
683
|
}
|
|
1037
684
|
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
@apply hover:bg-gray-50;
|
|
685
|
+
function onClickSelectRow(rowId) {
|
|
686
|
+
const targetRowIndex = tableRows.value.findIndex((row) => row.id === rowId);
|
|
1041
687
|
|
|
1042
|
-
|
|
1043
|
-
@apply transition duration-100;
|
|
1044
|
-
@apply bg-gray-100;
|
|
1045
|
-
}
|
|
688
|
+
tableRows.value[targetRowIndex].isChecked = !tableRows.value[targetRowIndex].isChecked;
|
|
1046
689
|
}
|
|
1047
690
|
|
|
1048
|
-
|
|
1049
|
-
|
|
691
|
+
function onClickRow(row) {
|
|
692
|
+
emit("clickRow", row);
|
|
1050
693
|
}
|
|
1051
694
|
|
|
1052
|
-
|
|
1053
|
-
|
|
695
|
+
function getTdClass(key) {
|
|
696
|
+
return props.columns.find((column) => column.key === key)?.tdClass;
|
|
1054
697
|
}
|
|
1055
698
|
|
|
1056
|
-
|
|
1057
|
-
.
|
|
1058
|
-
|
|
1059
|
-
@apply relative;
|
|
699
|
+
function onChangeSelectAll(selectAll) {
|
|
700
|
+
if (selectAll && canSelectAll.value) {
|
|
701
|
+
selectedRows.value = tableRows.value.map((item) => item.id);
|
|
1060
702
|
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
703
|
+
tableRows.value.forEach((item) => (item.isChecked = true));
|
|
704
|
+
} else if (!selectAll) {
|
|
705
|
+
selectedRows.value = [];
|
|
706
|
+
|
|
707
|
+
tableRows.value.forEach((item) => (item.isChecked = false));
|
|
1065
708
|
}
|
|
1066
|
-
}
|
|
1067
709
|
|
|
1068
|
-
.
|
|
1069
|
-
@apply relative -top-[3.75rem];
|
|
1070
|
-
visibility: collapse;
|
|
710
|
+
canSelectAll.value = true;
|
|
1071
711
|
}
|
|
1072
712
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
visibility: collapse;
|
|
1077
|
-
}
|
|
713
|
+
function onChangeSelectedRows(selectedRows) {
|
|
714
|
+
if (selectedRows.length) {
|
|
715
|
+
canSelectAll.value = false;
|
|
1078
716
|
|
|
1079
|
-
.
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
.table-fixed-loader {
|
|
1084
|
-
@apply !top-[3.25rem];
|
|
1085
|
-
}
|
|
717
|
+
isCheckedMoreOneTableItems.value ? setFooterItemsWidth() : "";
|
|
718
|
+
} else {
|
|
719
|
+
nextTick(setHeaderItemsWidth);
|
|
720
|
+
}
|
|
1086
721
|
|
|
1087
|
-
.
|
|
1088
|
-
@apply !top-[3.75rem];
|
|
722
|
+
selectAll.value = !!selectedRows.length;
|
|
1089
723
|
}
|
|
1090
724
|
|
|
1091
|
-
|
|
1092
|
-
|
|
725
|
+
function clearSelectedItems() {
|
|
726
|
+
selectedRows.value = [];
|
|
1093
727
|
}
|
|
1094
|
-
|
|
1095
|
-
@apply flex items-center;
|
|
728
|
+
</script>
|
|
1096
729
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
730
|
+
<i18n>
|
|
731
|
+
en:
|
|
732
|
+
noItems: There is no data in the table yet.
|
|
733
|
+
noResultsForFilters: No results were found for the specified filters.
|
|
734
|
+
ru:
|
|
735
|
+
noItems: Пока что в таблице нет данных.
|
|
736
|
+
noResultsForFilters: По заданным фильтрам ничего не найдено.
|
|
737
|
+
ua:
|
|
738
|
+
noItems: Поки що в таблиці немає даних.
|
|
739
|
+
noResultsForFilters: За даними фільтрами нічого не знайдено.
|
|
740
|
+
</i18n>
|