yuyeon 0.0.0 → 0.0.2
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/style.css +1 -0
- package/dist/yuyeon.mjs +3607 -0
- package/dist/yuyeon.umd.js +1 -0
- package/lib/components/app/YApp.mjs +30 -0
- package/lib/components/app/YApp.mjs.map +1 -0
- package/lib/components/app/YApp.scss +14 -0
- package/lib/components/app/index.mjs +2 -0
- package/lib/components/app/index.mjs.map +1 -0
- package/lib/components/bench/YBench.mjs +44 -0
- package/lib/components/bench/YBench.mjs.map +1 -0
- package/lib/components/bench/index.mjs +2 -0
- package/lib/components/bench/index.mjs.map +1 -0
- package/lib/components/button/YButton.mjs +138 -0
- package/lib/components/button/YButton.mjs.map +1 -0
- package/{src/components/button/y-btn.scss → lib/components/button/YButton.scss} +67 -29
- package/lib/components/button/index.mjs +2 -0
- package/lib/components/button/index.mjs.map +1 -0
- package/lib/components/card/YCard.mjs +18 -0
- package/lib/components/card/YCard.mjs.map +1 -0
- package/lib/components/card/YCardBody.mjs +10 -0
- package/lib/components/card/YCardBody.mjs.map +1 -0
- package/lib/components/card/YCardFooter.mjs +10 -0
- package/lib/components/card/YCardFooter.mjs.map +1 -0
- package/lib/components/card/YCardHeader.mjs +10 -0
- package/lib/components/card/YCardHeader.mjs.map +1 -0
- package/lib/components/card/index.mjs +6 -0
- package/lib/components/card/index.mjs.map +1 -0
- package/lib/components/checkbox/YCheckbox.mjs +154 -0
- package/lib/components/checkbox/YCheckbox.mjs.map +1 -0
- package/lib/components/checkbox/YInputCheckbox.mjs +113 -0
- package/lib/components/checkbox/YInputCheckbox.mjs.map +1 -0
- package/{src/components/checkbox/y-input-checkbox.scss → lib/components/checkbox/YInputCheckbox.scss} +19 -19
- package/lib/components/checkbox/index.mjs +5 -0
- package/lib/components/checkbox/index.mjs.map +1 -0
- package/{src/components/chip/y-chip.vue → lib/components/chip/YChip.mjs} +26 -27
- package/lib/components/chip/YChip.mjs.map +1 -0
- package/{src/components/chip/y-chip.scss → lib/components/chip/YChip.scss} +0 -4
- package/lib/components/chip/index.mjs +3 -0
- package/lib/components/chip/index.mjs.map +1 -0
- package/lib/components/dialog/YDialog.mjs +97 -0
- package/lib/components/dialog/YDialog.mjs.map +1 -0
- package/lib/components/dialog/index.mjs +2 -0
- package/lib/components/dialog/index.mjs.map +1 -0
- package/lib/components/field-input/YFieldInput.mjs +218 -0
- package/lib/components/field-input/YFieldInput.mjs.map +1 -0
- package/{src/components/field-input/y-field-input.scss → lib/components/field-input/YFieldInput.scss} +2 -4
- package/lib/components/field-input/index.mjs +2 -0
- package/lib/components/field-input/index.mjs.map +1 -0
- package/lib/components/form/YForm.mjs +79 -0
- package/lib/components/form/YForm.mjs.map +1 -0
- package/lib/components/form/index.mjs +4 -0
- package/lib/components/form/index.mjs.map +1 -0
- package/lib/components/icons/YIconCheckbox.mjs +21 -0
- package/lib/components/icons/YIconCheckbox.mjs.map +1 -0
- package/lib/components/icons/YIconClear.mjs +16 -0
- package/lib/components/icons/YIconClear.mjs.map +1 -0
- package/lib/components/icons/YIconExpand.mjs +20 -0
- package/lib/components/icons/YIconExpand.mjs.map +1 -0
- package/lib/components/icons/index.mjs +4 -0
- package/lib/components/icons/index.mjs.map +1 -0
- package/lib/components/index.mjs +24 -0
- package/lib/components/index.mjs.map +1 -0
- package/lib/components/input/YInput.mjs +346 -0
- package/lib/components/input/YInput.mjs.map +1 -0
- package/{src/components/input/y-input.scss → lib/components/input/YInput.scss} +12 -4
- package/lib/components/input/index.mjs +2 -0
- package/lib/components/input/index.mjs.map +1 -0
- package/lib/components/input/index.scss +2 -0
- package/lib/components/layer/YLayer.mjs +193 -0
- package/lib/components/layer/YLayer.mjs.map +1 -0
- package/lib/components/layer/index.mjs +2 -0
- package/lib/components/layer/index.mjs.map +1 -0
- package/lib/components/layer/scroll-strategies.mjs +132 -0
- package/lib/components/layer/scroll-strategies.mjs.map +1 -0
- package/lib/components/list/YList.mjs +16 -0
- package/lib/components/list/YList.mjs.map +1 -0
- package/lib/components/list/YList.scss +3 -0
- package/lib/components/list/YListItem.mjs +37 -0
- package/lib/components/list/YListItem.mjs.map +1 -0
- package/lib/components/list/YListItem.scss +59 -0
- package/lib/components/list/index.mjs +3 -0
- package/lib/components/list/index.mjs.map +1 -0
- package/lib/components/loading/YSpinnerRing.mjs +25 -0
- package/lib/components/loading/YSpinnerRing.mjs.map +1 -0
- package/{src/components/ring-spinner/y-ring-spinner.scss → lib/components/loading/YSpinnerRing.scss} +3 -3
- package/lib/components/loading/index.mjs +2 -0
- package/lib/components/loading/index.mjs.map +1 -0
- package/lib/components/menu/YMenu.mjs +239 -0
- package/lib/components/menu/YMenu.mjs.map +1 -0
- package/lib/components/menu/YMenu.scss +7 -0
- package/lib/components/menu/index.mjs +2 -0
- package/lib/components/menu/index.mjs.map +1 -0
- package/lib/components/navigation/YNavigation.mjs +17 -0
- package/lib/components/navigation/YNavigation.mjs.map +1 -0
- package/lib/components/navigation/index.mjs +2 -0
- package/lib/components/navigation/index.mjs.map +1 -0
- package/lib/components/pagination/YPagination.mjs +61 -0
- package/lib/components/pagination/YPagination.mjs.map +1 -0
- package/lib/components/pagination/YPagination.scss +5 -0
- package/lib/components/pagination/index.mjs +2 -0
- package/lib/components/pagination/index.mjs.map +1 -0
- package/lib/components/panel/YDividePanel.mjs +89 -0
- package/lib/components/panel/YDividePanel.mjs.map +1 -0
- package/lib/components/panel/YDividePanel.scss +43 -0
- package/lib/components/panel/index.mjs +2 -0
- package/lib/components/panel/index.mjs.map +1 -0
- package/lib/components/plate/YPlate.mjs +27 -0
- package/lib/components/plate/YPlate.mjs.map +1 -0
- package/lib/components/plate/YPlate.scss +9 -0
- package/lib/components/plate/index.mjs +2 -0
- package/lib/components/plate/index.mjs.map +1 -0
- package/lib/components/progress-bar/YProgressBar.mjs +110 -0
- package/lib/components/progress-bar/YProgressBar.mjs.map +1 -0
- package/lib/components/progress-bar/YProgressBar.scss +40 -0
- package/lib/components/progress-bar/index.mjs +2 -0
- package/lib/components/progress-bar/index.mjs.map +1 -0
- package/lib/components/snackbar/YSnackbar.mjs +187 -0
- package/lib/components/snackbar/YSnackbar.mjs.map +1 -0
- package/lib/components/snackbar/YSnackbar.scss +38 -0
- package/lib/components/snackbar/index.mjs +2 -0
- package/lib/components/snackbar/index.mjs.map +1 -0
- package/lib/components/switch/YSwitch.mjs +228 -0
- package/lib/components/switch/YSwitch.mjs.map +1 -0
- package/{src/components/switch/y-switch.scss → lib/components/switch/YSwitch.scss} +18 -26
- package/lib/components/switch/index.mjs +2 -0
- package/lib/components/switch/index.mjs.map +1 -0
- package/lib/components/table/YDataTable.mjs +46 -0
- package/lib/components/table/YDataTable.mjs.map +1 -0
- package/lib/components/table/YDataTableBody.mjs +12 -0
- package/lib/components/table/YDataTableBody.mjs.map +1 -0
- package/lib/components/table/YDataTableCell.mjs +55 -0
- package/lib/components/table/YDataTableCell.mjs.map +1 -0
- package/lib/components/table/YDataTableControl.mjs +37 -0
- package/lib/components/table/YDataTableControl.mjs.map +1 -0
- package/lib/components/table/YDataTableControl.scss +6 -0
- package/lib/components/table/YDataTableHead.mjs +12 -0
- package/lib/components/table/YDataTableHead.mjs.map +1 -0
- package/lib/components/table/YDataTableLayer.mjs +14 -0
- package/lib/components/table/YDataTableLayer.mjs.map +1 -0
- package/lib/components/table/YDataTableRow.mjs +12 -0
- package/lib/components/table/YDataTableRow.mjs.map +1 -0
- package/lib/components/table/YDataTableServer.mjs +54 -0
- package/lib/components/table/YDataTableServer.mjs.map +1 -0
- package/lib/components/table/YTable.mjs +53 -0
- package/lib/components/table/YTable.mjs.map +1 -0
- package/lib/components/table/YTable.scss +61 -0
- package/lib/components/table/index.mjs +4 -0
- package/lib/components/table/index.mjs.map +1 -0
- package/lib/components/table/pagination.mjs +21 -0
- package/lib/components/table/pagination.mjs.map +1 -0
- package/lib/components/text-highlighter/YTextHighlighter.mjs +94 -0
- package/lib/components/text-highlighter/YTextHighlighter.mjs.map +1 -0
- package/lib/components/text-highlighter/index.mjs +3 -0
- package/lib/components/text-highlighter/index.mjs.map +1 -0
- package/lib/components/tooltip/YTooltip.mjs +209 -0
- package/lib/components/tooltip/YTooltip.mjs.map +1 -0
- package/lib/components/tooltip/YTooltip.scss +19 -0
- package/lib/components/tooltip/index.mjs +2 -0
- package/lib/components/tooltip/index.mjs.map +1 -0
- package/lib/components/transitions/expand-transition.mjs +88 -0
- package/lib/components/transitions/expand-transition.mjs.map +1 -0
- package/lib/components/transitions/index.mjs +4 -0
- package/lib/components/transitions/index.mjs.map +1 -0
- package/lib/components/tree-view/YTreeView.mjs +92 -0
- package/lib/components/tree-view/YTreeView.mjs.map +1 -0
- package/lib/components/tree-view/YTreeView.scss +46 -0
- package/lib/components/tree-view/YTreeViewNode.mjs +122 -0
- package/lib/components/tree-view/YTreeViewNode.mjs.map +1 -0
- package/lib/components/tree-view/index.mjs +3 -0
- package/lib/components/tree-view/index.mjs.map +1 -0
- package/lib/composables/collections.mjs +2 -0
- package/lib/composables/collections.mjs.map +1 -0
- package/lib/composables/communication.mjs +46 -0
- package/lib/composables/communication.mjs.map +1 -0
- package/lib/composables/component.mjs +8 -0
- package/lib/composables/component.mjs.map +1 -0
- package/{src/composables/layer-group.ts → lib/composables/layer-group.mjs} +8 -10
- package/lib/composables/layer-group.mjs.map +1 -0
- package/lib/composables/layout.mjs +13 -0
- package/lib/composables/layout.mjs.map +1 -0
- package/lib/composables/levitation.mjs +135 -0
- package/lib/composables/levitation.mjs.map +1 -0
- package/{src/composables/progress.ts → lib/composables/progress.mjs} +6 -5
- package/lib/composables/progress.mjs.map +1 -0
- package/lib/composables/resize-observer.mjs +34 -0
- package/lib/composables/resize-observer.mjs.map +1 -0
- package/lib/composables/scope.mjs +27 -0
- package/lib/composables/scope.mjs.map +1 -0
- package/lib/composables/theme/index.mjs +49 -0
- package/lib/composables/theme/index.mjs.map +1 -0
- package/lib/composables/theme/setting.mjs +46 -0
- package/lib/composables/theme/setting.mjs.map +1 -0
- package/lib/composables/timing.mjs +77 -0
- package/lib/composables/timing.mjs.map +1 -0
- package/lib/composables/transition.mjs +50 -0
- package/lib/composables/transition.mjs.map +1 -0
- package/lib/directives/complement-click/index.mjs +78 -0
- package/lib/directives/complement-click/index.mjs.map +1 -0
- package/{src/directives/plate-wave/index.ts → lib/directives/plate-wave/index.mjs} +25 -42
- package/lib/directives/plate-wave/index.mjs.map +1 -0
- package/{src → lib}/directives/plate-wave/plate-wave.scss +1 -1
- package/lib/directives/theme-class.mjs +24 -0
- package/lib/directives/theme-class.mjs.map +1 -0
- package/lib/etc/index.mjs +6 -0
- package/lib/etc/index.mjs.map +1 -0
- package/lib/index.mjs +55 -0
- package/lib/index.mjs.map +1 -0
- package/{src/mixins/di.ts → lib/mixins/di.mjs} +7 -8
- package/lib/mixins/di.mjs.map +1 -0
- package/{src/mixins/rebind-attrs.ts → lib/mixins/rebind-attrs.mjs} +9 -8
- package/lib/mixins/rebind-attrs.mjs.map +1 -0
- package/{src/styles/palette.scss → lib/styles/_palette.scss} +0 -4
- package/lib/styles/base.scss +95 -0
- package/lib/styles/settings/_variables.scss +14 -0
- package/lib/styles/settings/provided.scss +35 -0
- package/lib/styles/theme/dark.scss +21 -0
- package/{src → lib}/styles/theme/index.scss +0 -3
- package/lib/styles/theme/light.scss +21 -0
- package/lib/util/FrameScheduler.mjs +29 -0
- package/lib/util/FrameScheduler.mjs.map +1 -0
- package/lib/util/Rect.mjs +27 -0
- package/lib/util/Rect.mjs.map +1 -0
- package/lib/util/common.mjs +66 -0
- package/lib/util/common.mjs.map +1 -0
- package/lib/util/dom.mjs +8 -0
- package/lib/util/dom.mjs.map +1 -0
- package/lib/util/scroll.mjs +28 -0
- package/lib/util/scroll.mjs.map +1 -0
- package/lib/util/string.mjs +33 -0
- package/lib/util/string.mjs.map +1 -0
- package/lib/util/ui.mjs +83 -0
- package/lib/util/ui.mjs.map +1 -0
- package/lib/util/validation.mjs +5 -0
- package/lib/util/validation.mjs.map +1 -0
- package/lib/util/vue-component.mjs +64 -0
- package/lib/util/vue-component.mjs.map +1 -0
- package/package.json +62 -22
- package/types/components/app/YApp.d.ts +7 -0
- package/types/components/app/index.d.ts +1 -0
- package/types/components/button/YButton.d.ts +122 -0
- package/types/components/button/index.d.ts +1 -0
- package/types/components/card/YCard.d.ts +11 -0
- package/types/components/card/YCardBody.d.ts +2 -0
- package/types/components/card/YCardFooter.d.ts +2 -0
- package/types/components/card/YCardHeader.d.ts +2 -0
- package/types/components/card/index.d.ts +5 -0
- package/types/components/checkbox/YCheckbox.d.ts +46 -0
- package/types/components/checkbox/YInputCheckbox.d.ts +42 -0
- package/types/components/checkbox/index.d.ts +4 -0
- package/types/components/chip/YChip.d.ts +34 -0
- package/types/components/chip/index.d.ts +2 -0
- package/types/components/dialog/YDialog.d.ts +120 -0
- package/types/components/dialog/index.d.ts +1 -0
- package/types/components/field-input/YFieldInput.d.ts +118 -0
- package/types/components/field-input/index.d.ts +1 -0
- package/types/components/form/YForm.d.ts +32 -0
- package/types/components/form/index.d.ts +3 -0
- package/types/components/icons/YIconCheckbox.d.ts +1 -0
- package/types/components/icons/YIconClear.d.ts +1 -0
- package/types/components/icons/YIconExpand.d.ts +1 -0
- package/types/components/icons/index.d.ts +3 -0
- package/types/components/index.d.ts +23 -0
- package/types/components/input/YInput.d.ts +166 -0
- package/types/components/input/index.d.ts +1 -0
- package/types/components/layer/YLayer.d.ts +99 -0
- package/types/components/layer/index.d.ts +1 -0
- package/types/components/list/YList.d.ts +2 -0
- package/types/components/list/YListItem.d.ts +28 -0
- package/types/components/list/index.d.ts +2 -0
- package/types/components/loading/YSpinnerRing.d.ts +1 -0
- package/types/components/loading/index.d.ts +1 -0
- package/types/components/menu/YMenu.d.ts +236 -0
- package/types/components/menu/index.d.ts +1 -0
- package/types/components/pagination/YPagination.d.ts +106 -0
- package/types/components/pagination/index.d.ts +1 -0
- package/types/components/panel/YDividePanel.d.ts +3 -0
- package/types/components/panel/index.d.ts +1 -0
- package/types/components/plate/YPlate.d.ts +10 -0
- package/types/components/plate/index.d.ts +1 -0
- package/types/components/progress-bar/YProgressBar.d.ts +59 -0
- package/types/components/progress-bar/index.d.ts +1 -0
- package/types/components/snackbar/YSnackbar.d.ts +77 -0
- package/types/components/snackbar/index.d.ts +1 -0
- package/types/components/switch/YSwitch.d.ts +106 -0
- package/types/components/switch/index.d.ts +1 -0
- package/types/components/table/YDataTable.d.ts +63 -0
- package/types/components/table/YDataTableBody.d.ts +2 -0
- package/types/components/table/YDataTableControl.d.ts +2 -0
- package/types/components/table/YDataTableHead.d.ts +2 -0
- package/types/components/table/YDataTableLayer.d.ts +2 -0
- package/types/components/table/YDataTableServer.d.ts +82 -0
- package/types/components/table/YTable.d.ts +32 -0
- package/types/components/table/index.d.ts +3 -0
- package/types/components/table/pagination.d.ts +38 -0
- package/types/components/tooltip/YTooltip.d.ts +188 -0
- package/types/components/tooltip/index.d.ts +1 -0
- package/types/components/transitions/expand-transition.d.ts +16 -0
- package/types/components/transitions/index.d.ts +32 -0
- package/types/components/tree-view/YTreeView.d.ts +37 -0
- package/types/components/tree-view/YTreeViewNode.d.ts +51 -0
- package/types/components/tree-view/index.d.ts +2 -0
- package/types/composables/communication.d.ts +1 -0
- package/types/composables/component.d.ts +2 -0
- package/types/composables/layer-group.d.ts +5 -0
- package/types/composables/progress.d.ts +3 -0
- package/types/composables/resize-observer.d.ts +14 -0
- package/types/composables/scope.d.ts +2 -0
- package/types/composables/theme/index.d.ts +15 -0
- package/types/composables/theme/setting.d.ts +12 -0
- package/types/composables/timing.d.ts +15 -0
- package/types/composables/transition.d.ts +21 -0
- package/types/directives/complement-click/index.d.ts +25 -0
- package/types/directives/plate-wave/index.d.ts +13 -0
- package/types/directives/theme-class.d.ts +3 -0
- package/types/etc/index.d.ts +1 -0
- package/types/globals.d.ts +11 -0
- package/types/index.d.ts +9 -0
- package/types/mixins/di.d.ts +2 -0
- package/types/mixins/rebind-attrs.d.ts +5 -0
- package/types/shims.d.ts +71 -0
- package/types/util/common.d.ts +8 -0
- package/types/util/dom.d.ts +1 -0
- package/types/util/string.d.ts +3 -0
- package/types/util/ui.d.ts +9 -0
- package/types/util/vue-component.d.ts +33 -0
- package/types/vite-env.d.ts +1 -0
- package/src/components/button/index.ts +0 -3
- package/src/components/button/y-btn.ts +0 -104
- package/src/components/card/index.ts +0 -6
- package/src/components/card/y-card-body.ts +0 -8
- package/src/components/card/y-card-footer.ts +0 -8
- package/src/components/card/y-card-header.ts +0 -8
- package/src/components/card/y-card.ts +0 -16
- package/src/components/checkbox/IconCheckbox.vue +0 -24
- package/src/components/checkbox/YCheckbox.vue +0 -113
- package/src/components/checkbox/YInputCheckbox.vue +0 -108
- package/src/components/checkbox/index.ts +0 -8
- package/src/components/chip/index.ts +0 -3
- package/src/components/dialog/index.ts +0 -3
- package/src/components/dialog/y-dialog.vue +0 -46
- package/src/components/field-input/index.scss +0 -5
- package/src/components/field-input/index.ts +0 -11
- package/src/components/field-input/y-field-input.ts +0 -214
- package/src/components/form/index.ts +0 -9
- package/src/components/form/y-form.ts +0 -93
- package/src/components/icons/icon-clearable.ts +0 -6
- package/src/components/index.ts +0 -17
- package/src/components/input/index.scss +0 -5
- package/src/components/input/index.ts +0 -9
- package/src/components/input/y-input.ts +0 -368
- package/src/components/layer/index.ts +0 -3
- package/src/components/layer/y-layer.vue +0 -146
- package/src/components/lottie-player.ts +0 -41
- package/src/components/progress-bar/index.ts +0 -3
- package/src/components/progress-bar/y-progress-bar.vue +0 -144
- package/src/components/ring-spinner/y-ring-spinner.vue +0 -31
- package/src/components/switch/YSwitch.vue +0 -217
- package/src/components/switch/index.scss +0 -5
- package/src/components/switch/index.ts +0 -11
- package/src/components/text-highlighter/index.scss +0 -5
- package/src/components/text-highlighter/index.ts +0 -3
- package/src/components/text-highlighter/y-text-highlighter.ts +0 -89
- package/src/composables/lazy.ts +0 -30
- package/src/composables/theme.ts +0 -25
- package/src/directives/complement-click/index.ts +0 -123
- package/src/directives/theme-class.ts +0 -14
- package/src/file-extension.d.ts +0 -14
- package/src/index.ts +0 -21
- package/src/styles/base.scss +0 -28
- package/src/styles/theme/dark.scss +0 -35
- package/src/styles/theme/light.scss +0 -32
- package/src/util/common.ts +0 -59
- package/src/util/date-time.ts +0 -41
- package/src/util/dom.ts +0 -6
- package/src/util/string.ts +0 -9
- package/src/util/ui.ts +0 -39
- package/src/util/validation.ts +0 -9
- package/src/util/vue-component.ts +0 -18
- /package/{src/components/card/y-card.scss → lib/components/card/YCard.scss} +0 -0
- /package/{src/components/checkbox/y-checkbox.scss → lib/components/checkbox/YCheckbox.scss} +0 -0
- /package/{src/components/dialog/y-dialog.scss → lib/components/dialog/YDialog.scss} +0 -0
- /package/{src/components/layer/y-layer.scss → lib/components/layer/YLayer.scss} +0 -0
- /package/{src/components/text-highlighter/y-text-highlighter.scss → lib/components/text-highlighter/YTextHighlighter.scss} +0 -0
- /package/{src/styles/variables.scss → lib/styles/_variables.scss} +0 -0
- /package/{src → lib}/styles/util/helper.scss +0 -0
- /package/{src → lib}/styles/util/theme.scss +0 -0
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Created by yeonyu 2022.
|
|
3
|
-
*/
|
|
4
|
-
import { getSlot } from '../../util/vue-component';
|
|
5
|
-
|
|
6
|
-
import './index.scss';
|
|
7
|
-
import {
|
|
8
|
-
defineComponent,
|
|
9
|
-
Directive,
|
|
10
|
-
h,
|
|
11
|
-
PropType,
|
|
12
|
-
resolveDirective,
|
|
13
|
-
VNode,
|
|
14
|
-
withDirectives,
|
|
15
|
-
} from 'vue';
|
|
16
|
-
import RebindAttrs from '../../mixins/rebind-attrs';
|
|
17
|
-
import DiMixin from '../../mixins/di';
|
|
18
|
-
|
|
19
|
-
const NAME = 'y-input';
|
|
20
|
-
let uidCounter = 0;
|
|
21
|
-
|
|
22
|
-
export default defineComponent({
|
|
23
|
-
name: NAME,
|
|
24
|
-
inheritAttrs: false,
|
|
25
|
-
mixins: [RebindAttrs, DiMixin],
|
|
26
|
-
props: {
|
|
27
|
-
name: String,
|
|
28
|
-
width: {
|
|
29
|
-
type: [String, Number] as PropType<string | number>,
|
|
30
|
-
},
|
|
31
|
-
height: [Number, String],
|
|
32
|
-
displayTag: {
|
|
33
|
-
type: String as PropType<string>,
|
|
34
|
-
default: 'div',
|
|
35
|
-
},
|
|
36
|
-
outlined: Boolean as PropType<boolean>,
|
|
37
|
-
filled: {
|
|
38
|
-
type: Boolean as PropType<boolean>,
|
|
39
|
-
},
|
|
40
|
-
ceramic: Boolean as PropType<boolean>,
|
|
41
|
-
label: String as PropType<string>,
|
|
42
|
-
modelValue: { type: [String, Number] as PropType<string | number> },
|
|
43
|
-
autoSelect: {
|
|
44
|
-
type: Boolean as PropType<boolean>,
|
|
45
|
-
default: true,
|
|
46
|
-
},
|
|
47
|
-
floated: { type: Boolean as PropType<boolean>, default: () => false },
|
|
48
|
-
placeholder: String as PropType<string>,
|
|
49
|
-
loading: Boolean as PropType<boolean>,
|
|
50
|
-
// validate
|
|
51
|
-
readonly: Boolean as PropType<boolean>,
|
|
52
|
-
disabled: Boolean as PropType<boolean>,
|
|
53
|
-
error: Boolean as PropType<boolean>,
|
|
54
|
-
validators: Array as PropType<((v: any) => boolean | string)[] | string[]>,
|
|
55
|
-
},
|
|
56
|
-
data() {
|
|
57
|
-
const iid = uidCounter.toString();
|
|
58
|
-
uidCounter += 1;
|
|
59
|
-
return {
|
|
60
|
-
isFocused: false,
|
|
61
|
-
iid,
|
|
62
|
-
lazyValue: undefined as string | undefined,
|
|
63
|
-
inValue: '' as string | number | undefined,
|
|
64
|
-
hasMouseDown: false,
|
|
65
|
-
errorResult: undefined as string | undefined,
|
|
66
|
-
inError: false,
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
computed: {
|
|
70
|
-
classes(): Record<string, boolean> {
|
|
71
|
-
return {
|
|
72
|
-
'y-input--outlined': !this.ceramic && !!this.outlined,
|
|
73
|
-
'y-input--filled': !!this.filled,
|
|
74
|
-
'y-input--focused': this.isFocused,
|
|
75
|
-
'y-input--ceramic': !!this.ceramic,
|
|
76
|
-
'y-input--readonly': !!this.readonly,
|
|
77
|
-
'y-input--has-value': !!this.inValue,
|
|
78
|
-
'y-input--disabled': !!this.disabled,
|
|
79
|
-
'y-input--error': this.isError,
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
displayStyles(): Record<string, any> {
|
|
83
|
-
let { width } = this;
|
|
84
|
-
if (!Number.isNaN(Number(width))) {
|
|
85
|
-
width = `${width}px`;
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
width,
|
|
89
|
-
height: this.getDisplayHeight(),
|
|
90
|
-
};
|
|
91
|
-
},
|
|
92
|
-
attrId(): string {
|
|
93
|
-
return (this.$attrs.id as string) ?? `y-input--${this.iid}`;
|
|
94
|
-
},
|
|
95
|
-
isFloatedLabel(): boolean {
|
|
96
|
-
return (
|
|
97
|
-
this.floated ||
|
|
98
|
-
!!this.placeholder ||
|
|
99
|
-
(!this.placeholder && this.isFocused) ||
|
|
100
|
-
!!this.inValue
|
|
101
|
-
);
|
|
102
|
-
},
|
|
103
|
-
formLoading(): boolean {
|
|
104
|
-
const form$ = (this as any).form$ as any;
|
|
105
|
-
if (form$) {
|
|
106
|
-
return form$.loading;
|
|
107
|
-
}
|
|
108
|
-
return false;
|
|
109
|
-
},
|
|
110
|
-
isError(): boolean {
|
|
111
|
-
return !!this.error || this.inError;
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
methods: {
|
|
115
|
-
createPrependOuter(): VNode | undefined {
|
|
116
|
-
const slot = getSlot(this, 'prepend-outer');
|
|
117
|
-
return slot
|
|
118
|
-
? h('div', { class: `${NAME}__prepend-outer` }, slot)
|
|
119
|
-
: undefined;
|
|
120
|
-
},
|
|
121
|
-
createAppendOuter(): VNode | undefined {
|
|
122
|
-
const slot = getSlot(this, 'append-outer');
|
|
123
|
-
return slot
|
|
124
|
-
? h('div', { class: `${NAME}__append-outer` }, slot)
|
|
125
|
-
: undefined;
|
|
126
|
-
},
|
|
127
|
-
createLabelSlot(): (VNode | string | VNode[])[] {
|
|
128
|
-
const slot: VNode[] | undefined = getSlot(this, 'label');
|
|
129
|
-
if (!slot) {
|
|
130
|
-
if (this.label) {
|
|
131
|
-
return [this.label];
|
|
132
|
-
}
|
|
133
|
-
if (this.placeholder && !this.inValue) {
|
|
134
|
-
return [this.placeholder];
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return slot ? [slot] : [];
|
|
139
|
-
},
|
|
140
|
-
createLabel(): VNode | undefined {
|
|
141
|
-
const show = !!this.label || !!getSlot(this, 'label');
|
|
142
|
-
if (!show) {
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
return h(
|
|
146
|
-
'label',
|
|
147
|
-
{
|
|
148
|
-
class: {
|
|
149
|
-
[`${NAME}__label`]: true,
|
|
150
|
-
'y-input__label--floated': this.isFloatedLabel,
|
|
151
|
-
},
|
|
152
|
-
'.for': this.attrId,
|
|
153
|
-
},
|
|
154
|
-
this.createLabelSlot(),
|
|
155
|
-
);
|
|
156
|
-
},
|
|
157
|
-
createDefaultSlot(): VNode[] | string | undefined {
|
|
158
|
-
const { modelValue } = this;
|
|
159
|
-
const slotContent = getSlot(this, 'default', { modelValue });
|
|
160
|
-
return slotContent ?? modelValue?.toString();
|
|
161
|
-
},
|
|
162
|
-
createDefaultChildren(): (VNode | undefined | VNode[] | string)[] {
|
|
163
|
-
return [this.createLabel(), this.createDefaultSlot()];
|
|
164
|
-
},
|
|
165
|
-
createDefault(): VNode {
|
|
166
|
-
return h(
|
|
167
|
-
'div',
|
|
168
|
-
{
|
|
169
|
-
[`.${NAME}__value`]: true,
|
|
170
|
-
'.data-id': this.attrId,
|
|
171
|
-
'.tabindex': 0,
|
|
172
|
-
onFocus: this.onFocus,
|
|
173
|
-
onBlur: this.onBlur,
|
|
174
|
-
},
|
|
175
|
-
this.createDefaultChildren(),
|
|
176
|
-
);
|
|
177
|
-
},
|
|
178
|
-
createPrepend(): VNode | undefined {
|
|
179
|
-
const slot = getSlot(this, 'prepend', { error: this.isError });
|
|
180
|
-
return slot
|
|
181
|
-
? h(
|
|
182
|
-
'div',
|
|
183
|
-
{
|
|
184
|
-
class: 'y-input__prepend',
|
|
185
|
-
onClick: this.onClickPrepend,
|
|
186
|
-
},
|
|
187
|
-
slot,
|
|
188
|
-
)
|
|
189
|
-
: undefined;
|
|
190
|
-
},
|
|
191
|
-
createAppend(): VNode | undefined {
|
|
192
|
-
const slot = getSlot(this, 'append');
|
|
193
|
-
return slot ? h('div', { class: 'y-input__append' }, slot) : undefined;
|
|
194
|
-
},
|
|
195
|
-
getDisplayHeight() {
|
|
196
|
-
const { height } = this;
|
|
197
|
-
if (!isNaN(Number(height))) {
|
|
198
|
-
return `${height}px`;
|
|
199
|
-
}
|
|
200
|
-
return height;
|
|
201
|
-
},
|
|
202
|
-
createDisplay(): VNode {
|
|
203
|
-
return h(
|
|
204
|
-
'div',
|
|
205
|
-
{
|
|
206
|
-
class: {
|
|
207
|
-
[`${NAME}__display`]: true,
|
|
208
|
-
},
|
|
209
|
-
onClick: this.onClick,
|
|
210
|
-
onMousedown: this.onMousedown,
|
|
211
|
-
onMouseup: this.onMouseup,
|
|
212
|
-
ref: 'display',
|
|
213
|
-
style: {
|
|
214
|
-
...this.displayStyles,
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
[
|
|
218
|
-
h('div', { class: `${NAME}__plate` }),
|
|
219
|
-
this.createPrepend(),
|
|
220
|
-
this.createDefault(),
|
|
221
|
-
this.createAppend(),
|
|
222
|
-
],
|
|
223
|
-
);
|
|
224
|
-
},
|
|
225
|
-
createHelperText(): VNode {
|
|
226
|
-
const helperTextSlot = getSlot(this, 'helper-text', {
|
|
227
|
-
error: !!this.error || this.inError,
|
|
228
|
-
errorResult: this.errorResult,
|
|
229
|
-
});
|
|
230
|
-
const children = [];
|
|
231
|
-
if (helperTextSlot) {
|
|
232
|
-
children.push(helperTextSlot);
|
|
233
|
-
} else {
|
|
234
|
-
children.push(this.errorResult);
|
|
235
|
-
}
|
|
236
|
-
return h('div', { class: `${NAME}__helper-text` }, children);
|
|
237
|
-
},
|
|
238
|
-
createStackChildren(): VNode[] {
|
|
239
|
-
return [this.createDisplay(), this.createHelperText()];
|
|
240
|
-
},
|
|
241
|
-
createStack(): VNode {
|
|
242
|
-
return h(
|
|
243
|
-
'div',
|
|
244
|
-
{
|
|
245
|
-
class: `${NAME}__stack`,
|
|
246
|
-
ref: 'stack',
|
|
247
|
-
},
|
|
248
|
-
this.createStackChildren(),
|
|
249
|
-
);
|
|
250
|
-
},
|
|
251
|
-
createContent(): (VNode | undefined)[] {
|
|
252
|
-
return [
|
|
253
|
-
this.createPrependOuter(),
|
|
254
|
-
this.createStack(),
|
|
255
|
-
this.createAppendOuter(),
|
|
256
|
-
];
|
|
257
|
-
},
|
|
258
|
-
//
|
|
259
|
-
onClick(event: MouseEvent) {
|
|
260
|
-
if (this.autoSelect) {
|
|
261
|
-
if (event.target) {
|
|
262
|
-
window.getSelection()?.selectAllChildren(event.target as HTMLElement);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
this.$emit('click', event);
|
|
266
|
-
},
|
|
267
|
-
onMousedown(e: Event) {
|
|
268
|
-
this.hasMouseDown = true;
|
|
269
|
-
this.$emit('mousedown', e);
|
|
270
|
-
},
|
|
271
|
-
onMouseup(e: Event) {
|
|
272
|
-
this.hasMouseDown = false;
|
|
273
|
-
this.$emit('mouseup', e);
|
|
274
|
-
},
|
|
275
|
-
onFocus(event: FocusEvent) {
|
|
276
|
-
this.isFocused = true;
|
|
277
|
-
this.$emit('focus', event);
|
|
278
|
-
},
|
|
279
|
-
onBlur(event: FocusEvent) {
|
|
280
|
-
this.isFocused = false;
|
|
281
|
-
this.invokeValidators();
|
|
282
|
-
this.$emit('blur', event);
|
|
283
|
-
},
|
|
284
|
-
onClickPrepend(event: MouseEvent) {
|
|
285
|
-
this.$emit('click:prepend', event);
|
|
286
|
-
},
|
|
287
|
-
onChange(event?: Event) {
|
|
288
|
-
this.invokeValidators();
|
|
289
|
-
},
|
|
290
|
-
//
|
|
291
|
-
invokeValidators(): boolean {
|
|
292
|
-
const { validators, inValue, $attrs } = this;
|
|
293
|
-
const { required } = $attrs;
|
|
294
|
-
this.resetError();
|
|
295
|
-
let flag = true;
|
|
296
|
-
if (Array.isArray(validators)) {
|
|
297
|
-
validators.some((validator: any) => {
|
|
298
|
-
const result = validator(inValue);
|
|
299
|
-
if (typeof result === 'string') {
|
|
300
|
-
this.inError = true;
|
|
301
|
-
this.errorResult = result;
|
|
302
|
-
flag = false;
|
|
303
|
-
return true;
|
|
304
|
-
}
|
|
305
|
-
if (result === false) {
|
|
306
|
-
this.inError = true;
|
|
307
|
-
this.errorResult = '';
|
|
308
|
-
flag = false;
|
|
309
|
-
return true;
|
|
310
|
-
}
|
|
311
|
-
return false;
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
if (flag && required && !inValue) {
|
|
315
|
-
this.inError = true;
|
|
316
|
-
return false;
|
|
317
|
-
}
|
|
318
|
-
return flag;
|
|
319
|
-
},
|
|
320
|
-
resetError() {
|
|
321
|
-
this.inError = false;
|
|
322
|
-
this.errorResult = undefined;
|
|
323
|
-
},
|
|
324
|
-
getClasses() {
|
|
325
|
-
return this.classes;
|
|
326
|
-
},
|
|
327
|
-
},
|
|
328
|
-
watch: {
|
|
329
|
-
modelValue(neo: string) {
|
|
330
|
-
if (!this.readonly) {
|
|
331
|
-
this.inValue = neo;
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
readonly(neo: boolean) {
|
|
335
|
-
if (!neo) {
|
|
336
|
-
this.inValue = this.modelValue;
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
inValue(neo: string) {
|
|
340
|
-
if (!this.readonly) {
|
|
341
|
-
this.$emit('update:modelValue', neo);
|
|
342
|
-
}
|
|
343
|
-
},
|
|
344
|
-
isError(neo: boolean) {
|
|
345
|
-
this.$emit('error', neo);
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
created() {
|
|
349
|
-
this.inValue = this.modelValue;
|
|
350
|
-
},
|
|
351
|
-
render(): VNode {
|
|
352
|
-
return withDirectives(
|
|
353
|
-
h(
|
|
354
|
-
'div',
|
|
355
|
-
{
|
|
356
|
-
class: { ...this.getClasses(), [`${NAME}`]: true },
|
|
357
|
-
},
|
|
358
|
-
this.createContent(),
|
|
359
|
-
),
|
|
360
|
-
[
|
|
361
|
-
// [
|
|
362
|
-
// resolveDirective('theme') as Directive,
|
|
363
|
-
// (this as any).theme.dark ? 'dark' : 'light',
|
|
364
|
-
// ],
|
|
365
|
-
],
|
|
366
|
-
);
|
|
367
|
-
},
|
|
368
|
-
});
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Teleport :to="layerGroup" :disabled="!layerGroup">
|
|
3
|
-
<template v-if="rendered">
|
|
4
|
-
<div class="y-layer" :class="computedClass" :style="computedStyle">
|
|
5
|
-
<Transition name="fade" appear>
|
|
6
|
-
<div
|
|
7
|
-
v-if="active && scrim"
|
|
8
|
-
class="y-layer__scrim"
|
|
9
|
-
@click="onClickScrim"
|
|
10
|
-
ref="scrimElement"
|
|
11
|
-
></div>
|
|
12
|
-
</Transition>
|
|
13
|
-
<Transition name="slide-fade" @after-leave="onAfterLeave" appear>
|
|
14
|
-
<div
|
|
15
|
-
v-show="active"
|
|
16
|
-
v-complement-click="complementClickOption"
|
|
17
|
-
class="y-layer__content"
|
|
18
|
-
>
|
|
19
|
-
<slot :active="active"></slot>
|
|
20
|
-
</div>
|
|
21
|
-
</Transition>
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
</Teleport>
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
|
-
<script lang="ts">
|
|
28
|
-
import {
|
|
29
|
-
computed,
|
|
30
|
-
defineComponent,
|
|
31
|
-
PropType,
|
|
32
|
-
inject,
|
|
33
|
-
reactive,
|
|
34
|
-
ref
|
|
35
|
-
} from "vue";
|
|
36
|
-
import { useLayerGroup } from '../../composables/layer-group';
|
|
37
|
-
|
|
38
|
-
import './y-layer.scss';
|
|
39
|
-
import { useLazy } from '../../composables/lazy';
|
|
40
|
-
import {
|
|
41
|
-
ComplementClick,
|
|
42
|
-
ComplementClickBindingOptions,
|
|
43
|
-
} from '../../directives/complement-click';
|
|
44
|
-
|
|
45
|
-
export default defineComponent({
|
|
46
|
-
name: 'YLayer',
|
|
47
|
-
inheritAttrs: false,
|
|
48
|
-
directives: {
|
|
49
|
-
ComplementClick,
|
|
50
|
-
},
|
|
51
|
-
props: {
|
|
52
|
-
modelValue: {
|
|
53
|
-
type: Boolean as PropType<boolean>,
|
|
54
|
-
},
|
|
55
|
-
scrim: {
|
|
56
|
-
type: Boolean as PropType<boolean>,
|
|
57
|
-
},
|
|
58
|
-
contentTagDialog: {
|
|
59
|
-
type: Boolean as PropType<boolean>,
|
|
60
|
-
},
|
|
61
|
-
eager: {
|
|
62
|
-
type: Boolean as PropType<boolean>,
|
|
63
|
-
},
|
|
64
|
-
class: {
|
|
65
|
-
type: [Array, String, Object] as PropType<
|
|
66
|
-
string[] | string | Record<string, boolean>
|
|
67
|
-
>,
|
|
68
|
-
},
|
|
69
|
-
closeClickScrim: {
|
|
70
|
-
type: Boolean as PropType<boolean>,
|
|
71
|
-
},
|
|
72
|
-
persistent: Boolean as PropType<boolean>,
|
|
73
|
-
},
|
|
74
|
-
emits: {
|
|
75
|
-
'update:modelValue': (value: boolean) => true,
|
|
76
|
-
'click:complement': (mouseEvent: MouseEvent) => true,
|
|
77
|
-
},
|
|
78
|
-
setup(props: any, { emit }) {
|
|
79
|
-
const { layerGroup } = useLayerGroup();
|
|
80
|
-
const active = computed({
|
|
81
|
-
get: () => {
|
|
82
|
-
return props.modelValue;
|
|
83
|
-
},
|
|
84
|
-
set: (v: boolean) => {
|
|
85
|
-
emit('update:modelValue', v);
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
const { lazyValue, onAfterUpdate } = useLazy(props.eager, active);
|
|
89
|
-
const rendered = computed(() => lazyValue.value || active.value);
|
|
90
|
-
const poly = inject('poly');
|
|
91
|
-
const scrimElement = ref<HTMLElement | null>(null);
|
|
92
|
-
function onClickComplementLayer(mouseEvent: MouseEvent) {
|
|
93
|
-
emit('click:complement', mouseEvent);
|
|
94
|
-
if (!props.persistent) {
|
|
95
|
-
if (scrimElement.value !== null && scrimElement.value === mouseEvent.target && props.closeClickScrim) {
|
|
96
|
-
active.value = false;
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
99
|
-
// TODO: shrug ani
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
function closeConditional(): boolean {
|
|
103
|
-
return active.value; // TODO: && groupTopLevel.value;
|
|
104
|
-
}
|
|
105
|
-
const complementClickOption = reactive<ComplementClickBindingOptions>({
|
|
106
|
-
handler: onClickComplementLayer,
|
|
107
|
-
determine: closeConditional,
|
|
108
|
-
include: () => [
|
|
109
|
-
// activatorEl.value
|
|
110
|
-
],
|
|
111
|
-
});
|
|
112
|
-
return {
|
|
113
|
-
complementClickOption,
|
|
114
|
-
layerGroup,
|
|
115
|
-
active,
|
|
116
|
-
rendered,
|
|
117
|
-
onAfterUpdate,
|
|
118
|
-
poly,
|
|
119
|
-
scrimElement,
|
|
120
|
-
};
|
|
121
|
-
},
|
|
122
|
-
methods: {
|
|
123
|
-
onAfterLeave() {
|
|
124
|
-
this.onAfterUpdate();
|
|
125
|
-
},
|
|
126
|
-
onClickScrim() {
|
|
127
|
-
if (this.closeClickScrim) {
|
|
128
|
-
this.active = false;
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
computed: {
|
|
133
|
-
computedStyle(): any {
|
|
134
|
-
return {
|
|
135
|
-
zIndex: '2000',
|
|
136
|
-
};
|
|
137
|
-
},
|
|
138
|
-
computedClass(): any {
|
|
139
|
-
return {
|
|
140
|
-
'y-layer--active': this.active,
|
|
141
|
-
'y-dialog': this.poly === 'y-dialog',
|
|
142
|
-
};
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
</script>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, PropType } from 'vue';
|
|
2
|
-
import lottie, {
|
|
3
|
-
AnimationConfigWithData,
|
|
4
|
-
AnimationConfigWithPath,
|
|
5
|
-
} from 'lottie-web';
|
|
6
|
-
|
|
7
|
-
export default defineComponent({
|
|
8
|
-
name: 'lottie-player',
|
|
9
|
-
props: {
|
|
10
|
-
src: {
|
|
11
|
-
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
12
|
-
},
|
|
13
|
-
loop: {
|
|
14
|
-
type: Boolean as PropType<boolean>,
|
|
15
|
-
default: false,
|
|
16
|
-
},
|
|
17
|
-
autoplay: {
|
|
18
|
-
type: Boolean as PropType<boolean>,
|
|
19
|
-
default: true,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
mounted() {
|
|
23
|
-
const params: AnimationConfigWithPath | AnimationConfigWithData = {
|
|
24
|
-
container: this.$el,
|
|
25
|
-
renderer: 'svg',
|
|
26
|
-
loop: this.loop,
|
|
27
|
-
autoplay: this.autoplay,
|
|
28
|
-
};
|
|
29
|
-
if (this.src) {
|
|
30
|
-
if (typeof this.src === 'string') {
|
|
31
|
-
(params as AnimationConfigWithPath).path = this.src;
|
|
32
|
-
} else {
|
|
33
|
-
(params as AnimationConfigWithData).animationData = this.src;
|
|
34
|
-
}
|
|
35
|
-
lottie.loadAnimation(params);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
render() {
|
|
39
|
-
return h('div', { class: 'lottie-player' });
|
|
40
|
-
},
|
|
41
|
-
});
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="y-progress y-progress-bar"
|
|
4
|
-
:class="classes"
|
|
5
|
-
role="progressbar"
|
|
6
|
-
aria-valuemin="0"
|
|
7
|
-
aria-valuemax="100"
|
|
8
|
-
:aria-valuenow="numValue"
|
|
9
|
-
:style="{
|
|
10
|
-
'--y-progress-bar__height':
|
|
11
|
-
height !== undefined ? `${height}px` : undefined,
|
|
12
|
-
'--y-progress-bar__outline-color':
|
|
13
|
-
outlineColor !== undefined ? outlineColor : undefined,
|
|
14
|
-
}"
|
|
15
|
-
>
|
|
16
|
-
<div class="y-progress__track"></div>
|
|
17
|
-
<div class="y-progress__tube">
|
|
18
|
-
<div class="y-progress__lead" :style="styles">
|
|
19
|
-
<slot name="lead-inner">
|
|
20
|
-
<div
|
|
21
|
-
v-if="innerText"
|
|
22
|
-
class="y-progress__lead-inner"
|
|
23
|
-
:class="{ 'y-progress__lead-inner--fixed': numValue < 3 }"
|
|
24
|
-
:style="{ color: textColor }"
|
|
25
|
-
>
|
|
26
|
-
<span>{{ numValue }} %</span>
|
|
27
|
-
</div>
|
|
28
|
-
</slot>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script lang="ts">
|
|
35
|
-
import { defineComponent, PropType, StyleValue } from 'vue';
|
|
36
|
-
import { useProgress } from '../../composables/progress';
|
|
37
|
-
|
|
38
|
-
export default defineComponent({
|
|
39
|
-
name: 'y-progress-bar',
|
|
40
|
-
props: {
|
|
41
|
-
value: {
|
|
42
|
-
type: Number as PropType<number>,
|
|
43
|
-
},
|
|
44
|
-
rounded: {
|
|
45
|
-
type: Boolean as PropType<boolean>,
|
|
46
|
-
},
|
|
47
|
-
height: {
|
|
48
|
-
type: Number as PropType<number>,
|
|
49
|
-
},
|
|
50
|
-
noRewindTransition: {
|
|
51
|
-
type: Boolean as PropType<boolean>,
|
|
52
|
-
},
|
|
53
|
-
outlined: {
|
|
54
|
-
type: Boolean as PropType<boolean>,
|
|
55
|
-
},
|
|
56
|
-
innerText: {
|
|
57
|
-
type: Boolean as PropType<boolean>,
|
|
58
|
-
},
|
|
59
|
-
textColor: {
|
|
60
|
-
type: String as PropType<string>,
|
|
61
|
-
},
|
|
62
|
-
outlineColor: {
|
|
63
|
-
type: String as PropType<string>,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
setup(props) {
|
|
67
|
-
const { numValue } = useProgress(props);
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
numValue,
|
|
71
|
-
};
|
|
72
|
-
},
|
|
73
|
-
data() {
|
|
74
|
-
return {
|
|
75
|
-
delta: 0,
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
computed: {
|
|
79
|
-
classes(): Record<string, boolean> {
|
|
80
|
-
let noTransition = false;
|
|
81
|
-
if (this.noRewindTransition && this.delta < 0) {
|
|
82
|
-
noTransition = true;
|
|
83
|
-
}
|
|
84
|
-
return {
|
|
85
|
-
'y-progress--no-trans': noTransition,
|
|
86
|
-
'y-progress--outlined': this.outlined,
|
|
87
|
-
'y-progress-bar--rounded': this.rounded,
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
styles(): StyleValue {
|
|
91
|
-
let minWidth;
|
|
92
|
-
if (this.innerText && this.numValue < 5 && this.numValue > 0) {
|
|
93
|
-
minWidth = '2rem';
|
|
94
|
-
}
|
|
95
|
-
return {
|
|
96
|
-
transform: `scaleX(${this.numValue / 100})`,
|
|
97
|
-
minWidth,
|
|
98
|
-
};
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
</script>
|
|
103
|
-
|
|
104
|
-
<style lang="scss">
|
|
105
|
-
.y-progress {
|
|
106
|
-
--y-progress-bar__height: 4px;
|
|
107
|
-
display: flex;
|
|
108
|
-
position: relative;
|
|
109
|
-
height: var(--y-progress-bar__height, 4px);
|
|
110
|
-
|
|
111
|
-
&-bar--rounded {
|
|
112
|
-
border-radius: calc(var(--y-progress-bar__height) / 2);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
&--outlined {
|
|
116
|
-
--y-progress-bar__outline-color: var(--y-palette--primary);
|
|
117
|
-
border: 1px solid var(--y-progress-bar__outline-color);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
&__tube {
|
|
121
|
-
border-radius: inherit;
|
|
122
|
-
overflow: clip;
|
|
123
|
-
min-width: 0;
|
|
124
|
-
flex: 1 1;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
&__track {
|
|
128
|
-
background-color: #f0f0f0;
|
|
129
|
-
position: absolute;
|
|
130
|
-
inset: 0;
|
|
131
|
-
border-radius: inherit;
|
|
132
|
-
overflow: clip;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
&__lead {
|
|
136
|
-
width: 100%;
|
|
137
|
-
height: 100%;
|
|
138
|
-
background-color: var(--y-palette--primary);
|
|
139
|
-
position: relative;
|
|
140
|
-
transform-origin: left;
|
|
141
|
-
transition: all 250ms cubic-bezier(0.42, 0.5, 0.51, 1.02);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
</style>
|