@refinitiv-ui/elements 5.12.2 → 6.0.0-next.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/README.md +4 -4
- package/lib/accordion/index.d.ts +5 -0
- package/lib/accordion/index.js +2 -2
- package/lib/accordion/themes/halo/dark/index.js +1 -1
- package/lib/accordion/themes/halo/light/index.js +1 -1
- package/lib/accordion/themes/solar/charcoal/index.js +1 -1
- package/lib/accordion/themes/solar/pearl/index.js +1 -1
- package/lib/appstate-bar/index.d.ts +11 -0
- package/lib/appstate-bar/index.js +8 -3
- package/lib/appstate-bar/themes/halo/dark/index.js +1 -1
- package/lib/appstate-bar/themes/halo/light/index.js +1 -1
- package/lib/appstate-bar/themes/solar/charcoal/index.js +1 -1
- package/lib/appstate-bar/themes/solar/pearl/index.js +1 -1
- package/lib/autosuggest/index.d.ts +5 -0
- package/lib/autosuggest/index.js +22 -12
- package/lib/autosuggest/themes/halo/dark/index.js +3 -3
- package/lib/autosuggest/themes/halo/light/index.js +3 -3
- package/lib/autosuggest/themes/solar/charcoal/index.js +3 -3
- package/lib/autosuggest/themes/solar/pearl/index.js +3 -3
- package/lib/button/index.d.ts +7 -13
- package/lib/button/index.js +8 -43
- package/lib/button/themes/halo/dark/index.js +1 -1
- package/lib/button/themes/halo/light/index.js +1 -1
- package/lib/button/themes/solar/charcoal/index.js +1 -1
- package/lib/button/themes/solar/pearl/index.js +1 -1
- package/lib/button-bar/index.d.ts +5 -0
- package/lib/button-bar/index.js +4 -5
- package/lib/button-bar/themes/halo/dark/index.js +1 -1
- package/lib/button-bar/themes/halo/light/index.js +1 -1
- package/lib/button-bar/themes/solar/charcoal/index.js +1 -1
- package/lib/button-bar/themes/solar/pearl/index.js +1 -1
- package/lib/calendar/constants.js +1 -1
- package/lib/calendar/index.d.ts +6 -1
- package/lib/calendar/index.js +39 -15
- package/lib/calendar/locales.js +5 -5
- package/lib/calendar/themes/halo/dark/index.js +1 -1
- package/lib/calendar/themes/halo/light/index.js +1 -1
- package/lib/calendar/themes/solar/charcoal/index.js +1 -1
- package/lib/calendar/themes/solar/pearl/index.js +1 -1
- package/lib/calendar/types.d.ts +1 -1
- package/lib/calendar/utils.js +5 -5
- package/lib/canvas/index.d.ts +5 -0
- package/lib/canvas/index.js +3 -4
- package/lib/card/index.d.ts +21 -0
- package/lib/card/index.js +37 -15
- package/lib/card/themes/halo/dark/index.js +3 -3
- package/lib/card/themes/halo/light/index.js +3 -3
- package/lib/card/themes/solar/charcoal/index.js +3 -3
- package/lib/card/themes/solar/pearl/index.js +3 -3
- package/lib/chart/index.d.ts +5 -0
- package/lib/chart/index.js +18 -22
- package/lib/chart/plugins/doughnut-center-label.js +6 -11
- package/lib/chart/themes/halo/dark/index.js +2 -2
- package/lib/chart/themes/halo/light/index.js +2 -2
- package/lib/chart/themes/solar/charcoal/index.js +2 -2
- package/lib/chart/themes/solar/pearl/index.js +2 -2
- package/lib/checkbox/index.d.ts +5 -0
- package/lib/checkbox/index.js +3 -3
- package/lib/checkbox/themes/halo/dark/index.js +2 -2
- package/lib/checkbox/themes/halo/light/index.js +2 -2
- package/lib/checkbox/themes/solar/charcoal/index.js +2 -2
- package/lib/checkbox/themes/solar/pearl/index.js +2 -2
- package/lib/clock/index.d.ts +5 -0
- package/lib/clock/index.js +6 -6
- package/lib/clock/utils/TickManager.js +2 -2
- package/lib/collapse/index.d.ts +5 -0
- package/lib/collapse/index.js +7 -9
- package/lib/collapse/themes/halo/dark/index.js +3 -3
- package/lib/collapse/themes/halo/light/index.js +3 -3
- package/lib/collapse/themes/solar/charcoal/index.js +3 -3
- package/lib/collapse/themes/solar/pearl/index.js +3 -3
- package/lib/color-dialog/elements/color-palettes.d.ts +5 -0
- package/lib/color-dialog/elements/color-palettes.js +1 -1
- package/lib/color-dialog/elements/grayscale-palettes.d.ts +5 -0
- package/lib/color-dialog/elements/grayscale-palettes.js +2 -2
- package/lib/color-dialog/elements/palettes.js +4 -5
- package/lib/color-dialog/helpers/value-model.js +1 -1
- package/lib/color-dialog/index.d.ts +6 -1
- package/lib/color-dialog/index.js +17 -12
- package/lib/color-dialog/themes/halo/dark/index.js +5 -5
- package/lib/color-dialog/themes/halo/light/index.js +5 -5
- package/lib/color-dialog/themes/solar/charcoal/index.js +5 -5
- package/lib/color-dialog/themes/solar/pearl/index.js +5 -5
- package/lib/combo-box/helpers/filter.d.ts +1 -1
- package/lib/combo-box/helpers/types.d.ts +1 -1
- package/lib/combo-box/index.d.ts +9 -4
- package/lib/combo-box/index.js +31 -14
- package/lib/combo-box/themes/halo/dark/index.js +5 -5
- package/lib/combo-box/themes/halo/light/index.js +5 -5
- package/lib/combo-box/themes/solar/charcoal/index.js +5 -5
- package/lib/combo-box/themes/solar/pearl/index.js +5 -5
- package/lib/counter/index.d.ts +11 -6
- package/lib/counter/index.js +8 -8
- package/lib/counter/themes/halo/dark/index.js +1 -1
- package/lib/counter/themes/halo/light/index.js +1 -1
- package/lib/counter/themes/solar/charcoal/index.js +1 -1
- package/lib/counter/themes/solar/pearl/index.js +1 -1
- package/lib/datetime-field/constants.d.ts +4 -0
- package/lib/datetime-field/constants.js +5 -0
- package/lib/datetime-field/custom-elements.json +345 -0
- package/lib/datetime-field/custom-elements.md +61 -0
- package/lib/datetime-field/index.d.ts +322 -0
- package/lib/datetime-field/index.js +660 -0
- package/lib/datetime-field/themes/halo/dark/index.js +3 -0
- package/lib/datetime-field/themes/halo/light/index.js +3 -0
- package/lib/datetime-field/themes/solar/charcoal/index.js +3 -0
- package/lib/datetime-field/themes/solar/pearl/index.js +3 -0
- package/lib/datetime-field/types.d.ts +10 -0
- package/lib/datetime-field/types.js +1 -0
- package/lib/datetime-field/utils.d.ts +25 -0
- package/lib/datetime-field/utils.js +79 -0
- package/lib/datetime-picker/index.d.ts +5 -0
- package/lib/datetime-picker/index.js +6 -7
- package/lib/datetime-picker/themes/halo/dark/index.js +5 -5
- package/lib/datetime-picker/themes/halo/light/index.js +5 -5
- package/lib/datetime-picker/themes/solar/charcoal/index.js +5 -5
- package/lib/datetime-picker/themes/solar/pearl/index.js +5 -5
- package/lib/datetime-picker/utils.js +1 -1
- package/lib/dialog/draggable-element.js +1 -2
- package/lib/dialog/index.d.ts +6 -1
- package/lib/dialog/index.js +5 -5
- package/lib/dialog/themes/halo/dark/index.js +5 -5
- package/lib/dialog/themes/halo/light/index.js +5 -5
- package/lib/dialog/themes/solar/charcoal/index.js +5 -5
- package/lib/dialog/themes/solar/pearl/index.js +5 -5
- package/lib/email-field/index.d.ts +6 -1
- package/lib/email-field/index.js +8 -3
- package/lib/email-field/themes/halo/dark/index.js +1 -1
- package/lib/email-field/themes/halo/light/index.js +1 -1
- package/lib/email-field/themes/solar/charcoal/index.js +1 -1
- package/lib/email-field/themes/solar/pearl/index.js +1 -1
- package/lib/flag/index.d.ts +5 -0
- package/lib/flag/index.js +3 -3
- package/lib/flag/utils/FlagLoader.d.ts +1 -1
- package/lib/flag/utils/FlagLoader.js +1 -1
- package/lib/header/index.d.ts +5 -0
- package/lib/header/index.js +2 -2
- package/lib/heatmap/helpers/color.d.ts +1 -1
- package/lib/heatmap/helpers/color.js +3 -5
- package/lib/heatmap/helpers/text.d.ts +1 -7
- package/lib/heatmap/helpers/text.js +1 -18
- package/lib/heatmap/index.d.ts +5 -0
- package/lib/heatmap/index.js +22 -30
- package/lib/heatmap/themes/halo/dark/index.js +2 -2
- package/lib/heatmap/themes/halo/light/index.js +2 -2
- package/lib/heatmap/themes/solar/charcoal/index.js +2 -2
- package/lib/heatmap/themes/solar/pearl/index.js +2 -2
- package/lib/icon/index.d.ts +5 -0
- package/lib/icon/index.js +3 -3
- package/lib/icon/utils/IconLoader.d.ts +1 -1
- package/lib/icon/utils/IconLoader.js +1 -1
- package/lib/interactive-chart/helpers/types.d.ts +1 -1
- package/lib/interactive-chart/index.d.ts +5 -12
- package/lib/interactive-chart/index.js +20 -36
- package/lib/interactive-chart/themes/halo/dark/index.js +1 -1
- package/lib/interactive-chart/themes/halo/light/index.js +1 -1
- package/lib/interactive-chart/themes/solar/charcoal/index.js +1 -1
- package/lib/interactive-chart/themes/solar/pearl/index.js +1 -1
- package/lib/item/helpers/types.d.ts +1 -1
- package/lib/item/index.d.ts +24 -17
- package/lib/item/index.js +45 -48
- package/lib/item/themes/halo/dark/index.js +2 -2
- package/lib/item/themes/halo/light/index.js +2 -2
- package/lib/item/themes/solar/charcoal/index.js +2 -2
- package/lib/item/themes/solar/pearl/index.js +2 -2
- package/lib/label/index.d.ts +6 -1
- package/lib/label/index.js +6 -6
- package/lib/label/themes/halo/dark/index.js +1 -1
- package/lib/label/themes/halo/light/index.js +1 -1
- package/lib/label/themes/solar/charcoal/index.js +1 -1
- package/lib/label/themes/solar/pearl/index.js +1 -1
- package/lib/layout/index.d.ts +5 -0
- package/lib/layout/index.js +2 -2
- package/lib/led-gauge/index.d.ts +5 -0
- package/lib/led-gauge/index.js +2 -2
- package/lib/led-gauge/themes/halo/dark/index.js +1 -1
- package/lib/led-gauge/themes/halo/light/index.js +1 -1
- package/lib/led-gauge/themes/solar/charcoal/index.js +1 -1
- package/lib/led-gauge/themes/solar/pearl/index.js +1 -1
- package/lib/list/custom-elements.json +0 -13
- package/lib/list/custom-elements.md +9 -10
- package/lib/list/helpers/item-id.d.ts +8 -0
- package/lib/list/helpers/item-id.js +13 -0
- package/lib/list/helpers/{list-renderer.d.ts → renderer.d.ts} +4 -0
- package/lib/list/helpers/{list-renderer.js → renderer.js} +8 -0
- package/lib/list/helpers/types.d.ts +1 -1
- package/lib/list/index.d.ts +18 -12
- package/lib/list/index.js +30 -29
- package/lib/list/renderer.d.ts +1 -1
- package/lib/list/themes/halo/dark/index.js +2 -2
- package/lib/list/themes/halo/light/index.js +2 -2
- package/lib/list/themes/solar/charcoal/index.js +2 -2
- package/lib/list/themes/solar/pearl/index.js +2 -2
- package/lib/loader/index.d.ts +6 -0
- package/lib/loader/index.js +5 -1
- package/lib/multi-input/helpers/types.d.ts +1 -1
- package/lib/multi-input/index.d.ts +5 -0
- package/lib/multi-input/index.js +6 -7
- package/lib/multi-input/themes/halo/dark/index.js +2 -2
- package/lib/multi-input/themes/halo/light/index.js +2 -2
- package/lib/multi-input/themes/solar/charcoal/index.js +2 -2
- package/lib/multi-input/themes/solar/pearl/index.js +2 -2
- package/lib/notification/elements/notification-tray.d.ts +5 -0
- package/lib/notification/elements/notification-tray.js +4 -4
- package/lib/notification/elements/notification.d.ts +15 -0
- package/lib/notification/elements/notification.js +12 -3
- package/lib/notification/themes/halo/dark/index.js +1 -1
- package/lib/notification/themes/halo/light/index.js +1 -1
- package/lib/notification/themes/solar/charcoal/index.js +1 -1
- package/lib/notification/themes/solar/pearl/index.js +1 -1
- package/lib/number-field/index.d.ts +8 -3
- package/lib/number-field/index.js +14 -4
- package/lib/number-field/themes/halo/dark/index.js +1 -1
- package/lib/number-field/themes/halo/light/index.js +1 -1
- package/lib/number-field/themes/solar/charcoal/index.js +1 -1
- package/lib/number-field/themes/solar/pearl/index.js +1 -1
- package/lib/overlay/elements/overlay-backdrop.d.ts +5 -0
- package/lib/overlay/elements/overlay-backdrop.js +2 -2
- package/lib/overlay/elements/overlay-viewport.d.ts +5 -0
- package/lib/overlay/elements/overlay-viewport.js +1 -1
- package/lib/overlay/elements/overlay.d.ts +5 -0
- package/lib/overlay/elements/overlay.js +7 -5
- package/lib/overlay/managers/focus-manager.js +11 -6
- package/lib/overlay/managers/interaction-lock-manager.js +1 -1
- package/lib/overlay/managers/viewport-manager.js +4 -5
- package/lib/overlay/managers/zindex-manager.js +1 -1
- package/lib/overlay-menu/helpers/types.d.ts +7 -1
- package/lib/overlay-menu/helpers/types.js +7 -1
- package/lib/overlay-menu/index.d.ts +14 -4
- package/lib/overlay-menu/index.js +57 -29
- package/lib/overlay-menu/managers/menu-manager.js +2 -1
- package/lib/overlay-menu/themes/halo/dark/index.js +3 -3
- package/lib/overlay-menu/themes/halo/light/index.js +3 -3
- package/lib/overlay-menu/themes/solar/charcoal/index.js +3 -3
- package/lib/overlay-menu/themes/solar/pearl/index.js +3 -3
- package/lib/pagination/index.d.ts +79 -91
- package/lib/pagination/index.js +205 -239
- package/lib/pagination/themes/halo/dark/index.js +4 -5
- package/lib/pagination/themes/halo/light/index.js +4 -5
- package/lib/pagination/themes/solar/charcoal/index.js +4 -5
- package/lib/pagination/themes/solar/pearl/index.js +4 -5
- package/lib/panel/index.d.ts +5 -0
- package/lib/panel/index.js +2 -2
- package/lib/password-field/index.d.ts +7 -2
- package/lib/password-field/index.js +7 -4
- package/lib/password-field/themes/halo/dark/index.js +1 -1
- package/lib/password-field/themes/halo/light/index.js +1 -1
- package/lib/password-field/themes/solar/charcoal/index.js +1 -1
- package/lib/password-field/themes/solar/pearl/index.js +1 -1
- package/lib/pill/index.d.ts +21 -0
- package/lib/pill/index.js +36 -5
- package/lib/pill/themes/halo/dark/index.js +2 -2
- package/lib/pill/themes/halo/light/index.js +2 -2
- package/lib/pill/themes/solar/charcoal/index.js +2 -2
- package/lib/pill/themes/solar/pearl/index.js +2 -2
- package/lib/progress-bar/index.d.ts +5 -0
- package/lib/progress-bar/index.js +3 -3
- package/lib/radio-button/index.d.ts +5 -0
- package/lib/radio-button/index.js +3 -3
- package/lib/radio-button/radio-button-registry.d.ts +1 -1
- package/lib/radio-button/radio-button-registry.js +4 -2
- package/lib/radio-button/themes/halo/dark/index.js +1 -1
- package/lib/radio-button/themes/halo/light/index.js +1 -1
- package/lib/radio-button/themes/solar/charcoal/index.js +1 -1
- package/lib/radio-button/themes/solar/pearl/index.js +1 -1
- package/lib/rating/index.d.ts +5 -0
- package/lib/rating/index.js +4 -4
- package/lib/search-field/index.d.ts +7 -2
- package/lib/search-field/index.js +8 -4
- package/lib/search-field/themes/halo/dark/index.js +1 -1
- package/lib/search-field/themes/halo/light/index.js +1 -1
- package/lib/search-field/themes/solar/charcoal/index.js +1 -1
- package/lib/search-field/themes/solar/pearl/index.js +1 -1
- package/lib/select/index.d.ts +5 -0
- package/lib/select/index.js +11 -14
- package/lib/select/themes/halo/dark/index.js +3 -3
- package/lib/select/themes/halo/light/index.js +3 -3
- package/lib/select/themes/solar/charcoal/index.js +3 -3
- package/lib/select/themes/solar/pearl/index.js +3 -3
- package/lib/sidebar-layout/index.d.ts +5 -0
- package/lib/sidebar-layout/index.js +4 -4
- package/lib/sidebar-layout/themes/halo/dark/index.js +1 -1
- package/lib/sidebar-layout/themes/halo/light/index.js +1 -1
- package/lib/sidebar-layout/themes/solar/charcoal/index.js +1 -1
- package/lib/sidebar-layout/themes/solar/pearl/index.js +1 -1
- package/lib/slider/constants.d.ts +15 -0
- package/lib/slider/constants.js +18 -0
- package/lib/slider/index.d.ts +55 -80
- package/lib/slider/index.js +365 -460
- package/lib/slider/themes/halo/dark/index.js +1 -1
- package/lib/slider/themes/halo/light/index.js +1 -1
- package/lib/slider/themes/solar/charcoal/index.js +1 -1
- package/lib/slider/themes/solar/pearl/index.js +1 -1
- package/lib/slider/utils.d.ts +35 -0
- package/lib/slider/utils.js +54 -0
- package/lib/sparkline/index.d.ts +5 -0
- package/lib/sparkline/index.js +9 -10
- package/lib/swing-gauge/index.d.ts +5 -0
- package/lib/swing-gauge/index.js +14 -8
- package/lib/swing-gauge/themes/halo/dark/index.js +1 -1
- package/lib/swing-gauge/themes/halo/light/index.js +1 -1
- package/lib/swing-gauge/themes/solar/charcoal/index.js +1 -1
- package/lib/swing-gauge/themes/solar/pearl/index.js +1 -1
- package/lib/tab/index.d.ts +5 -0
- package/lib/tab/index.js +4 -4
- package/lib/tab/themes/halo/dark/index.js +2 -2
- package/lib/tab/themes/halo/light/index.js +2 -2
- package/lib/tab/themes/solar/charcoal/index.js +2 -2
- package/lib/tab/themes/solar/pearl/index.js +2 -2
- package/lib/tab-bar/index.d.ts +5 -0
- package/lib/tab-bar/index.js +6 -6
- package/lib/tab-bar/themes/halo/dark/index.js +2 -2
- package/lib/tab-bar/themes/halo/light/index.js +2 -2
- package/lib/tab-bar/themes/solar/charcoal/index.js +2 -2
- package/lib/tab-bar/themes/solar/pearl/index.js +2 -2
- package/lib/text-field/index.d.ts +19 -1
- package/lib/text-field/index.js +35 -11
- package/lib/text-field/themes/halo/dark/index.js +1 -1
- package/lib/text-field/themes/halo/light/index.js +1 -1
- package/lib/text-field/themes/solar/charcoal/index.js +1 -1
- package/lib/text-field/themes/solar/pearl/index.js +1 -1
- package/lib/time-picker/index.d.ts +6 -1
- package/lib/time-picker/index.js +11 -11
- package/lib/time-picker/themes/halo/dark/index.js +2 -2
- package/lib/time-picker/themes/halo/light/index.js +2 -2
- package/lib/time-picker/themes/solar/charcoal/index.js +2 -2
- package/lib/time-picker/themes/solar/pearl/index.js +2 -2
- package/lib/toggle/index.d.ts +5 -0
- package/lib/toggle/index.js +2 -2
- package/lib/tooltip/elements/tooltip-element.d.ts +1 -2
- package/lib/tooltip/index.d.ts +6 -0
- package/lib/tooltip/index.js +7 -8
- package/lib/tooltip/managers/tooltip-manager.js +2 -2
- package/lib/tooltip/themes/halo/dark/index.js +1 -1
- package/lib/tooltip/themes/halo/light/index.js +1 -1
- package/lib/tooltip/themes/solar/charcoal/index.js +1 -1
- package/lib/tooltip/themes/solar/pearl/index.js +1 -1
- package/lib/tornado-chart/elements/tornado-chart.d.ts +5 -0
- package/lib/tornado-chart/elements/tornado-chart.js +2 -2
- package/lib/tornado-chart/elements/tornado-item.d.ts +5 -0
- package/lib/tornado-chart/elements/tornado-item.js +3 -3
- package/lib/tornado-chart/themes/halo/dark/index.js +2 -2
- package/lib/tornado-chart/themes/halo/light/index.js +2 -2
- package/lib/tornado-chart/themes/solar/charcoal/index.js +2 -2
- package/lib/tornado-chart/themes/solar/pearl/index.js +2 -2
- package/lib/tree/elements/tree-item.d.ts +8 -3
- package/lib/tree/elements/tree-item.js +5 -6
- package/lib/tree/elements/tree.d.ts +7 -3
- package/lib/tree/elements/tree.js +6 -7
- package/lib/tree/helpers/renderer.d.ts +4 -0
- package/lib/tree/helpers/renderer.js +20 -13
- package/lib/tree/helpers/types.d.ts +1 -1
- package/lib/tree/managers/tree-manager.d.ts +1 -1
- package/lib/tree/themes/halo/dark/index.js +4 -4
- package/lib/tree/themes/halo/light/index.js +4 -4
- package/lib/tree/themes/solar/charcoal/index.js +4 -4
- package/lib/tree/themes/solar/pearl/index.js +4 -4
- package/lib/tree-select/index.d.ts +8 -7
- package/lib/tree-select/index.js +39 -38
- package/lib/tree-select/themes/halo/dark/index.js +9 -9
- package/lib/tree-select/themes/halo/light/index.js +9 -9
- package/lib/tree-select/themes/solar/charcoal/index.js +9 -9
- package/lib/tree-select/themes/solar/pearl/index.js +9 -9
- package/lib/version.js +1 -1
- package/package.json +35 -295
package/lib/slider/index.js
CHANGED
|
@@ -1,50 +1,13 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { html, css, ControlElement, WarningNotice } from '@refinitiv-ui/core';
|
|
3
|
-
import { customElement } from '@refinitiv-ui/core/
|
|
4
|
-
import { property } from '@refinitiv-ui/core/
|
|
5
|
-
import { query } from '@refinitiv-ui/core/
|
|
6
|
-
import {
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
|
+
import { createRef, ref } from '@refinitiv-ui/core/directives/ref.js';
|
|
7
|
+
import { styleMap } from '@refinitiv-ui/core/directives/style-map.js';
|
|
7
8
|
import { VERSION } from '../version.js';
|
|
8
9
|
import '../number-field/index.js';
|
|
9
|
-
|
|
10
|
-
(function (SliderNameType) {
|
|
11
|
-
SliderNameType["value"] = "value";
|
|
12
|
-
SliderNameType["from"] = "from";
|
|
13
|
-
SliderNameType["to"] = "to";
|
|
14
|
-
})(SliderNameType || (SliderNameType = {}));
|
|
15
|
-
var PreviousSliderNameType;
|
|
16
|
-
(function (PreviousSliderNameType) {
|
|
17
|
-
PreviousSliderNameType["value"] = "valuePrevious";
|
|
18
|
-
PreviousSliderNameType["from"] = "fromPrevious";
|
|
19
|
-
PreviousSliderNameType["to"] = "toPrevious";
|
|
20
|
-
})(PreviousSliderNameType || (PreviousSliderNameType = {}));
|
|
21
|
-
var NumberFieldNameType;
|
|
22
|
-
(function (NumberFieldNameType) {
|
|
23
|
-
NumberFieldNameType["fromInput"] = "fromInput";
|
|
24
|
-
NumberFieldNameType["toInput"] = "toInput";
|
|
25
|
-
})(NumberFieldNameType || (NumberFieldNameType = {}));
|
|
26
|
-
/**
|
|
27
|
-
* Set prevent default action and stop bubbles event
|
|
28
|
-
* @private
|
|
29
|
-
* @param event event mouse or touch
|
|
30
|
-
* @returns {void}
|
|
31
|
-
*/
|
|
32
|
-
const preventDefault = function (event) {
|
|
33
|
-
event.preventDefault();
|
|
34
|
-
event.stopPropagation();
|
|
35
|
-
return event;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Return value that never exceed the maximum boundary
|
|
39
|
-
* @private
|
|
40
|
-
* @param value value for check clamp
|
|
41
|
-
* @param min max value
|
|
42
|
-
* @param max min value
|
|
43
|
-
* @returns number between two numbers
|
|
44
|
-
*/
|
|
45
|
-
const clamp = function (value, min, max) {
|
|
46
|
-
return Math.max(min, Math.min(value, max)).toString();
|
|
47
|
-
};
|
|
10
|
+
import { clamp, preventDefault, validateNumber, isDecimalNumber, countDecimalPlace } from './utils.js';
|
|
48
11
|
/**
|
|
49
12
|
* Allows users to make selections from a range of values
|
|
50
13
|
*
|
|
@@ -63,12 +26,15 @@ const clamp = function (value, min, max) {
|
|
|
63
26
|
*/
|
|
64
27
|
let Slider = class Slider extends ControlElement {
|
|
65
28
|
constructor() {
|
|
66
|
-
super(
|
|
29
|
+
super();
|
|
30
|
+
/**
|
|
31
|
+
* An array of slider thumbs
|
|
32
|
+
*/
|
|
33
|
+
this.thumbs = [];
|
|
34
|
+
/**
|
|
35
|
+
* Whether if the thumb is being drag
|
|
36
|
+
*/
|
|
67
37
|
this.dragging = false;
|
|
68
|
-
this.stepUse = 1;
|
|
69
|
-
this.decimalPlaces = 0;
|
|
70
|
-
this.dragElements = [];
|
|
71
|
-
this.isEventReady = false;
|
|
72
38
|
this.valuePrevious = '';
|
|
73
39
|
this.fromPrevious = '';
|
|
74
40
|
this.toPrevious = '';
|
|
@@ -115,134 +81,25 @@ let Slider = class Slider extends ControlElement {
|
|
|
115
81
|
*/
|
|
116
82
|
this.minRange = '0';
|
|
117
83
|
/**
|
|
118
|
-
*
|
|
119
|
-
* @param event event blur input number field
|
|
120
|
-
* @returns {void}
|
|
84
|
+
* Slider element reference
|
|
121
85
|
*/
|
|
122
|
-
this.
|
|
123
|
-
if (this.readonly) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const { value, name } = event.target;
|
|
127
|
-
const currentData = name;
|
|
128
|
-
const perviousData = `${name}Previous`;
|
|
129
|
-
if (value && this[currentData] !== value) {
|
|
130
|
-
this.updateNotifyProperty(currentData, value);
|
|
131
|
-
this[perviousData] = value;
|
|
132
|
-
}
|
|
133
|
-
event.preventDefault();
|
|
134
|
-
};
|
|
86
|
+
this.sliderRef = createRef();
|
|
135
87
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @param event event keydown
|
|
138
|
-
* @returns {void}
|
|
88
|
+
* Slider's track reference
|
|
139
89
|
*/
|
|
140
|
-
this.
|
|
141
|
-
if (this.readonly || this.disabled) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
this.handleEnterKey(event);
|
|
145
|
-
};
|
|
90
|
+
this.trackRef = createRef();
|
|
146
91
|
/**
|
|
147
|
-
*
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
*/
|
|
151
|
-
this.onDragStart = (event) => {
|
|
152
|
-
this.dragging = true;
|
|
153
|
-
this.classList.add('grabbable');
|
|
154
|
-
if (this.range) {
|
|
155
|
-
const pct = this.getMousePosition(event);
|
|
156
|
-
const mousePos = ((this.maxNumber - this.minNumber) * pct) + this.minNumber;
|
|
157
|
-
const distFrom = Math.abs(mousePos - this.fromNumber);
|
|
158
|
-
const distTo = Math.abs(mousePos - this.toNumber);
|
|
159
|
-
if (distFrom < distTo) {
|
|
160
|
-
this.activeThumb = this.dragElements[0];
|
|
161
|
-
}
|
|
162
|
-
else if (distFrom > distTo) {
|
|
163
|
-
this.activeThumb = this.dragElements[1];
|
|
164
|
-
}
|
|
165
|
-
this.dragElements.forEach((el) => {
|
|
166
|
-
el.style.zIndex = '5';
|
|
167
|
-
});
|
|
168
|
-
this.activeThumb.style.zIndex = '10';
|
|
169
|
-
// Set focus to input when drag.
|
|
170
|
-
if (this.isShowInputField) {
|
|
171
|
-
this.toggleFocusField(this.activeThumb.getAttribute('name') || '', true);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
this.activeThumb = this.dragElements[0];
|
|
176
|
-
}
|
|
177
|
-
this.onDrag(event);
|
|
178
|
-
if (event.changedTouches) {
|
|
179
|
-
this.addEventListener('touchmove', this.onDrag);
|
|
180
|
-
this.addEventListener('touchend', this.onDragEnd);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
window.addEventListener('mousemove', this.onDrag);
|
|
184
|
-
window.addEventListener('mouseup', this.onDragEnd);
|
|
185
|
-
}
|
|
186
|
-
};
|
|
92
|
+
* @ignore
|
|
93
|
+
*/
|
|
94
|
+
this.onDrag = this.onDrag.bind(this);
|
|
187
95
|
/**
|
|
188
|
-
*
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
*/
|
|
192
|
-
this.onDrag = (event) => {
|
|
193
|
-
if (this.minNumber !== this.maxNumber) {
|
|
194
|
-
const thumbPos = this.getMousePosition(event);
|
|
195
|
-
const closestStep = this.calculateStep(thumbPos);
|
|
196
|
-
// Can be dragged slider when the value is valid
|
|
197
|
-
if (closestStep <= 1) {
|
|
198
|
-
const thumbLeft = this.stepUse !== 0 ? closestStep : thumbPos;
|
|
199
|
-
const calStepValue = this.calculateValue(thumbLeft);
|
|
200
|
-
const prettyVal = Number(this.displayValue(calStepValue));
|
|
201
|
-
if (this.range) {
|
|
202
|
-
if (this.activeThumb === this.dragElements[1]) {
|
|
203
|
-
this.to = this.validateTo(prettyVal).toString();
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
this.from = this.validateFrom(prettyVal).toString();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
this.value = prettyVal.toString();
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
};
|
|
96
|
+
* @ignore
|
|
97
|
+
*/
|
|
98
|
+
this.onDragStart = this.onDragStart.bind(this);
|
|
215
99
|
/**
|
|
216
|
-
*
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
*/
|
|
220
|
-
this.onDragEnd = (e) => {
|
|
221
|
-
if (this.dragging) {
|
|
222
|
-
this.dragging = false;
|
|
223
|
-
const event = e;
|
|
224
|
-
if (event.changedTouches) {
|
|
225
|
-
this.removeEventListener('touchmove', this.onDrag);
|
|
226
|
-
this.removeEventListener('touchend', this.onDragEnd);
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
window.removeEventListener('mousemove', this.onDrag);
|
|
230
|
-
window.removeEventListener('mouseup', this.onDragEnd);
|
|
231
|
-
}
|
|
232
|
-
this.classList.remove('grabbable');
|
|
233
|
-
if (this.classList.length === 0) {
|
|
234
|
-
this.removeAttribute('class');
|
|
235
|
-
}
|
|
236
|
-
if (!event.changedTouches) {
|
|
237
|
-
event.preventDefault();
|
|
238
|
-
}
|
|
239
|
-
this.dispatchDataChangedEvent();
|
|
240
|
-
// Reset tab index of input that's drag.
|
|
241
|
-
if (this.isShowInputField) {
|
|
242
|
-
this.toggleFocusField(this.activeThumb.getAttribute('name') || '', false);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
};
|
|
100
|
+
* @ignore
|
|
101
|
+
*/
|
|
102
|
+
this.onDragEnd = this.onDragEnd.bind(this);
|
|
246
103
|
}
|
|
247
104
|
/**
|
|
248
105
|
* Element version number
|
|
@@ -251,6 +108,79 @@ let Slider = class Slider extends ControlElement {
|
|
|
251
108
|
static get version() {
|
|
252
109
|
return VERSION;
|
|
253
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Define styles in a tagged template literal, using the css tag function.
|
|
113
|
+
* @returns CSS template
|
|
114
|
+
*/
|
|
115
|
+
static get styles() {
|
|
116
|
+
return css `
|
|
117
|
+
:host {
|
|
118
|
+
display: flex;
|
|
119
|
+
}
|
|
120
|
+
[part=slider-wrapper] {
|
|
121
|
+
position: relative;
|
|
122
|
+
width: 100%;
|
|
123
|
+
}
|
|
124
|
+
[part=slider] {
|
|
125
|
+
width: 100%;
|
|
126
|
+
height: 100%;
|
|
127
|
+
display: inline-block;
|
|
128
|
+
}
|
|
129
|
+
:host(:not([disabled]):focus){
|
|
130
|
+
outline:none;
|
|
131
|
+
}
|
|
132
|
+
:host([show-steps]) [part=track-wrapper]::after {
|
|
133
|
+
display:block;
|
|
134
|
+
position: absolute;
|
|
135
|
+
content: "";
|
|
136
|
+
right: 0;
|
|
137
|
+
}
|
|
138
|
+
[part=track-wrapper]{
|
|
139
|
+
content: "";
|
|
140
|
+
position: absolute;
|
|
141
|
+
width: 100%;
|
|
142
|
+
top: 50%;
|
|
143
|
+
left: 0;
|
|
144
|
+
pointer-events: none;
|
|
145
|
+
}
|
|
146
|
+
[part=thumb-container]{
|
|
147
|
+
position: absolute;
|
|
148
|
+
top: 0;
|
|
149
|
+
width: 100%;
|
|
150
|
+
z-index: 5;
|
|
151
|
+
}
|
|
152
|
+
[part=thumb]{
|
|
153
|
+
position: absolute;
|
|
154
|
+
margin: 0 auto;
|
|
155
|
+
}
|
|
156
|
+
[part=pin]{
|
|
157
|
+
display: flex;
|
|
158
|
+
position: absolute;
|
|
159
|
+
align-items: center;
|
|
160
|
+
justify-content: center;
|
|
161
|
+
z-index: 1;
|
|
162
|
+
}
|
|
163
|
+
:host([show-steps]) [part=step-container]{
|
|
164
|
+
position: absolute;
|
|
165
|
+
left: 0;
|
|
166
|
+
width: 100%;
|
|
167
|
+
}
|
|
168
|
+
:host([show-steps]) [part=step]{
|
|
169
|
+
width: 100%;
|
|
170
|
+
position: absolute;
|
|
171
|
+
left: 0;
|
|
172
|
+
}
|
|
173
|
+
[part=track-fill]{
|
|
174
|
+
z-index: 2;
|
|
175
|
+
content: "";
|
|
176
|
+
position: absolute;
|
|
177
|
+
left: 0;
|
|
178
|
+
}
|
|
179
|
+
:host([show-steps][step="0"]) [part=track-wrapper]::after{
|
|
180
|
+
width: 0;
|
|
181
|
+
}
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
254
184
|
/**
|
|
255
185
|
* Converts value from string to number for calculations
|
|
256
186
|
* @returns value of input as a number
|
|
@@ -295,6 +225,18 @@ let Slider = class Slider extends ControlElement {
|
|
|
295
225
|
}
|
|
296
226
|
return step;
|
|
297
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Compute and normalise step value for calculations
|
|
230
|
+
* @returns step value that should be inside the min / max boundary
|
|
231
|
+
*/
|
|
232
|
+
get stepRange() {
|
|
233
|
+
const step = Math.abs(this.stepNumber);
|
|
234
|
+
if (step > this.maxNumber - this.minNumber && !isDecimalNumber(step)) {
|
|
235
|
+
// new step shouldn't be larger than slider
|
|
236
|
+
return Math.abs(this.maxNumber - this.minNumber);
|
|
237
|
+
}
|
|
238
|
+
return step;
|
|
239
|
+
}
|
|
298
240
|
/**
|
|
299
241
|
* Converts from value from string to number for calculations
|
|
300
242
|
* @returns from value of slider as a number
|
|
@@ -328,6 +270,18 @@ let Slider = class Slider extends ControlElement {
|
|
|
328
270
|
}
|
|
329
271
|
return minRange;
|
|
330
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Number of decimal places used for displaying value
|
|
275
|
+
* Based on step or min decimal places
|
|
276
|
+
*/
|
|
277
|
+
get decimalPlace() {
|
|
278
|
+
if (isDecimalNumber(this.stepRange) || isDecimalNumber(this.minNumber)) {
|
|
279
|
+
const stepDecimal = countDecimalPlace(this.stepRange);
|
|
280
|
+
const minDecimal = countDecimalPlace(this.minNumber);
|
|
281
|
+
return stepDecimal > minDecimal ? stepDecimal : minDecimal;
|
|
282
|
+
}
|
|
283
|
+
return 0;
|
|
284
|
+
}
|
|
331
285
|
/**
|
|
332
286
|
* Return hide/show input field state
|
|
333
287
|
* @returns {boolean} true if showInputField value is exist
|
|
@@ -342,62 +296,61 @@ let Slider = class Slider extends ControlElement {
|
|
|
342
296
|
*/
|
|
343
297
|
firstUpdated(changedProperties) {
|
|
344
298
|
super.firstUpdated(changedProperties);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
this.initSlider();
|
|
349
|
-
this.updateEventListeners();
|
|
350
|
-
});
|
|
299
|
+
this.prepareValues();
|
|
300
|
+
this.prepareThumbs();
|
|
301
|
+
this.prepareSliderTrack();
|
|
351
302
|
}
|
|
352
303
|
/**
|
|
353
|
-
* On
|
|
304
|
+
* On willUpdate lifecycle
|
|
354
305
|
* @param changedProperties changed properties
|
|
355
306
|
* @returns {void}
|
|
356
307
|
*/
|
|
357
|
-
|
|
358
|
-
super.
|
|
359
|
-
if (changedProperties.has('disabled')
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
308
|
+
willUpdate(changedProperties) {
|
|
309
|
+
super.willUpdate(changedProperties);
|
|
310
|
+
if ((changedProperties.has('disabled') && changedProperties.get('disabled') !== undefined)
|
|
311
|
+
|| (changedProperties.has('readonly') && changedProperties.get('readonly') !== undefined)) {
|
|
312
|
+
this.prepareSliderTrack();
|
|
313
|
+
}
|
|
314
|
+
changedProperties.forEach((_, changedProperty) => {
|
|
315
|
+
if (['value', 'min', 'max', 'from', 'to', 'step', 'minRange'].includes(changedProperty)) {
|
|
316
|
+
this.showWarningInvalidProperty(changedProperty);
|
|
365
317
|
}
|
|
366
318
|
});
|
|
367
319
|
}
|
|
368
320
|
/**
|
|
321
|
+
* On updated lifecycle
|
|
369
322
|
* @param changedProperties changed properties
|
|
370
323
|
* @returns {void}
|
|
371
324
|
*/
|
|
372
325
|
updated(changedProperties) {
|
|
373
326
|
super.updated(changedProperties);
|
|
374
|
-
changedProperties.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
this.
|
|
386
|
-
}
|
|
387
|
-
else if (propName === 'to' && this.range) {
|
|
388
|
-
this.onValueChangeTo();
|
|
389
|
-
}
|
|
390
|
-
else if (propName === 'step') {
|
|
391
|
-
this.onStepChange();
|
|
392
|
-
}
|
|
393
|
-
else if (propName === 'minRange') {
|
|
394
|
-
this.onMinRangeChange();
|
|
327
|
+
if (changedProperties.has('value')) {
|
|
328
|
+
this.onValueChange();
|
|
329
|
+
}
|
|
330
|
+
if (changedProperties.has('min')) {
|
|
331
|
+
this.onMinChange(changedProperties.get('min'));
|
|
332
|
+
}
|
|
333
|
+
if (changedProperties.has('max')) {
|
|
334
|
+
this.onMaxChange(changedProperties.get('max'));
|
|
335
|
+
}
|
|
336
|
+
if (this.range) {
|
|
337
|
+
if (changedProperties.has('from')) {
|
|
338
|
+
this.onFromValueChange();
|
|
395
339
|
}
|
|
396
|
-
|
|
397
|
-
this.
|
|
398
|
-
this.initSlider();
|
|
340
|
+
if (changedProperties.has('to')) {
|
|
341
|
+
this.onToValueChange();
|
|
399
342
|
}
|
|
400
|
-
}
|
|
343
|
+
}
|
|
344
|
+
if (changedProperties.has('step')) {
|
|
345
|
+
this.onStepChange();
|
|
346
|
+
}
|
|
347
|
+
if (changedProperties.has('minRange')) {
|
|
348
|
+
this.onMinRangeChange();
|
|
349
|
+
}
|
|
350
|
+
if (changedProperties.has('range')) {
|
|
351
|
+
this.prepareValues();
|
|
352
|
+
this.prepareThumbs();
|
|
353
|
+
}
|
|
401
354
|
}
|
|
402
355
|
/**
|
|
403
356
|
* Show Warning a warning message invalid property
|
|
@@ -442,16 +395,13 @@ let Slider = class Slider extends ControlElement {
|
|
|
442
395
|
}
|
|
443
396
|
}
|
|
444
397
|
/**
|
|
445
|
-
*
|
|
398
|
+
* Initialises slider value properties
|
|
446
399
|
* @returns {void}
|
|
447
400
|
*/
|
|
448
|
-
|
|
449
|
-
this.stepUse = this.calculateStepRange(this.stepNumber);
|
|
401
|
+
prepareValues() {
|
|
450
402
|
if (this.minNumber !== this.maxNumber) {
|
|
451
|
-
// init decimal places
|
|
452
|
-
this.updateDecimalPlaces();
|
|
453
403
|
if (this.range) {
|
|
454
|
-
this.activeThumb = this.
|
|
404
|
+
this.activeThumb = this.thumbs[1];
|
|
455
405
|
if (this.minRangeNumber) {
|
|
456
406
|
const distanceFromTo = Math.abs(this.toNumber - this.fromNumber);
|
|
457
407
|
const clampValueFrom = this.toNumber - this.minRangeNumber;
|
|
@@ -480,122 +430,83 @@ let Slider = class Slider extends ControlElement {
|
|
|
480
430
|
else {
|
|
481
431
|
this.value = this.min;
|
|
482
432
|
}
|
|
483
|
-
// initial old value
|
|
484
433
|
this.valuePrevious = this.value;
|
|
485
434
|
this.toPrevious = this.to;
|
|
486
435
|
this.fromPrevious = this.from;
|
|
487
436
|
}
|
|
488
437
|
/**
|
|
489
|
-
*
|
|
438
|
+
* Query and assigned thumbs depending on slider mode and add event listeners to it
|
|
490
439
|
* @returns {void}
|
|
491
440
|
*/
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
this.
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
this.dragElements = [
|
|
502
|
-
this.thumbContainer
|
|
503
|
-
];
|
|
504
|
-
}
|
|
505
|
-
this.activeThumb = this.dragElements[0];
|
|
506
|
-
this.dragElements.concat(this).forEach((el) => {
|
|
507
|
-
el.addEventListener('drag', preventDefault);
|
|
508
|
-
el.addEventListener('dragstart', preventDefault);
|
|
509
|
-
el.addEventListener('dragend', preventDefault);
|
|
441
|
+
prepareThumbs() {
|
|
442
|
+
this.thumbs = [];
|
|
443
|
+
const thumbs = this.shadowRoot?.querySelectorAll('[part~=thumb-container]') || [];
|
|
444
|
+
this.thumbs = this.range ? Array.from(thumbs) : [thumbs[0]];
|
|
445
|
+
this.activeThumb = this.thumbs[0];
|
|
446
|
+
this.thumbs.forEach((thumb) => {
|
|
447
|
+
thumb.addEventListener('drag', preventDefault);
|
|
448
|
+
thumb.addEventListener('dragstart', preventDefault);
|
|
449
|
+
thumb.addEventListener('dragend', preventDefault);
|
|
510
450
|
});
|
|
511
|
-
this.isEventReady = true;
|
|
512
451
|
}
|
|
513
452
|
/**
|
|
514
|
-
*
|
|
515
|
-
* @param step value step for calculate
|
|
516
|
-
* @returns step value that should be inside the min / max boundary
|
|
517
|
-
*/
|
|
518
|
-
calculateStepRange(step) {
|
|
519
|
-
const newStep = Math.abs(step);
|
|
520
|
-
if (newStep > this.maxNumber - this.minNumber && !this.isDecimalNumber(newStep)) {
|
|
521
|
-
// new step shouldn't be larger than slider
|
|
522
|
-
return Math.abs(this.maxNumber - this.minNumber);
|
|
523
|
-
}
|
|
524
|
-
return newStep;
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* Check if step or min number is decimal
|
|
528
|
-
* If yes, set number of decimal places
|
|
453
|
+
* Add or remove event listener on slider track depending on slider disabled and readonly state
|
|
529
454
|
* @returns {void}
|
|
530
455
|
*/
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
const minDecimal = this.countDecimals(this.minNumber);
|
|
536
|
-
this.decimalPlaces = stepUseDecimal > minDecimal ? stepUseDecimal : minDecimal;
|
|
456
|
+
prepareSliderTrack() {
|
|
457
|
+
if (this.disabled || this.readonly) {
|
|
458
|
+
this.sliderRef.value?.removeEventListener('mousedown', this.onDragStart);
|
|
459
|
+
this.sliderRef.value?.removeEventListener('touchstart', this.onDragStart);
|
|
537
460
|
}
|
|
538
461
|
else {
|
|
539
|
-
this.
|
|
462
|
+
this.sliderRef.value?.addEventListener('mousedown', this.onDragStart, { passive: true });
|
|
463
|
+
this.sliderRef.value?.addEventListener('touchstart', this.onDragStart, { passive: true });
|
|
540
464
|
}
|
|
541
465
|
}
|
|
542
466
|
/**
|
|
543
|
-
*
|
|
544
|
-
* @param value value for checking
|
|
545
|
-
* @returns number of decimal points
|
|
546
|
-
*/
|
|
547
|
-
countDecimals(value) {
|
|
548
|
-
var _a;
|
|
549
|
-
return ((_a = Number(value).toString().split('.')[1]) === null || _a === void 0 ? void 0 : _a.length) | 0;
|
|
550
|
-
}
|
|
551
|
-
/**
|
|
552
|
-
* Check if decimal number e.g. 10.5, etc
|
|
553
|
-
* @param value value for checking
|
|
554
|
-
* @returns true if value is decimal
|
|
555
|
-
*/
|
|
556
|
-
isDecimalNumber(value) {
|
|
557
|
-
return value % 1 !== 0;
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Calculate percentage by value
|
|
467
|
+
* Calculate percentage from value, min and max
|
|
561
468
|
* @param value value to be calculated
|
|
562
469
|
* @returns percentage
|
|
563
470
|
*/
|
|
564
471
|
calculatePercentage(value) {
|
|
565
|
-
const
|
|
566
|
-
if (
|
|
472
|
+
const percentage = Math.abs((((value || 0) - this.minNumber) / (this.maxNumber - this.minNumber)) * 100);
|
|
473
|
+
if (percentage > 100) {
|
|
567
474
|
return 100;
|
|
568
475
|
}
|
|
569
|
-
else if (
|
|
476
|
+
else if (percentage < 0) {
|
|
570
477
|
return 0;
|
|
571
478
|
}
|
|
572
479
|
else {
|
|
573
|
-
return
|
|
480
|
+
return percentage;
|
|
574
481
|
}
|
|
575
482
|
}
|
|
576
483
|
/**
|
|
577
|
-
*
|
|
484
|
+
* Input number event blur and notify property
|
|
485
|
+
* @param event event blur input number field
|
|
578
486
|
* @returns {void}
|
|
579
487
|
*/
|
|
580
|
-
|
|
581
|
-
if (this.
|
|
582
|
-
|
|
583
|
-
this.slider.removeEventListener('mousedown', this.onDragStart);
|
|
584
|
-
this.slider.removeEventListener('touchstart', this.onDragStart);
|
|
585
|
-
}
|
|
586
|
-
else {
|
|
587
|
-
this.slider.addEventListener('mousedown', this.onDragStart, { passive: true });
|
|
588
|
-
this.slider.addEventListener('touchstart', this.onDragStart, { passive: true });
|
|
589
|
-
}
|
|
488
|
+
onBlur(event) {
|
|
489
|
+
if (this.readonly) {
|
|
490
|
+
return;
|
|
590
491
|
}
|
|
492
|
+
const { value, name } = event.target;
|
|
493
|
+
const currentData = name;
|
|
494
|
+
const previousData = `${name}Previous`;
|
|
495
|
+
if (value && this[currentData] !== value) {
|
|
496
|
+
this.updateNotifyProperty(currentData, value);
|
|
497
|
+
this[previousData] = value;
|
|
498
|
+
}
|
|
499
|
+
event.preventDefault();
|
|
591
500
|
}
|
|
592
501
|
/**
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
* @param event Event Object
|
|
502
|
+
* Input number event keydown y
|
|
503
|
+
* @param event event keydown
|
|
596
504
|
* @returns {void}
|
|
597
505
|
*/
|
|
598
|
-
|
|
506
|
+
onKeydown(event) {
|
|
507
|
+
if (this.readonly || this.disabled) {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
599
510
|
if (event.key === ' ' || event.key === 'Spacebar' || event.key === 'Enter') {
|
|
600
511
|
event.target.blur();
|
|
601
512
|
}
|
|
@@ -607,21 +518,21 @@ let Slider = class Slider extends ControlElement {
|
|
|
607
518
|
* @returns {void}
|
|
608
519
|
*/
|
|
609
520
|
updateNotifyProperty(name, value) {
|
|
610
|
-
let
|
|
611
|
-
const
|
|
521
|
+
let shouldUpdate = false;
|
|
522
|
+
const validatedValue = Number(validateNumber(Number(value), 0));
|
|
612
523
|
if (name === 'to') {
|
|
613
|
-
|
|
524
|
+
shouldUpdate = this.isValueInBoundary(validatedValue, 'to');
|
|
614
525
|
}
|
|
615
526
|
else {
|
|
616
|
-
|
|
527
|
+
shouldUpdate = this.isValueInBoundary(validatedValue, '');
|
|
617
528
|
}
|
|
618
|
-
if (
|
|
529
|
+
if (shouldUpdate) {
|
|
619
530
|
(this[name]) = value;
|
|
620
531
|
this.notifyPropertyChange(name, value);
|
|
621
532
|
}
|
|
622
533
|
else {
|
|
623
|
-
const
|
|
624
|
-
this[
|
|
534
|
+
const inputName = `${name}Input`;
|
|
535
|
+
this[inputName].value = this[name];
|
|
625
536
|
}
|
|
626
537
|
}
|
|
627
538
|
/**
|
|
@@ -640,8 +551,8 @@ let Slider = class Slider extends ControlElement {
|
|
|
640
551
|
}
|
|
641
552
|
/**
|
|
642
553
|
* Set focus to input from state
|
|
643
|
-
* @param
|
|
644
|
-
* @param
|
|
554
|
+
* @param name number field's name
|
|
555
|
+
* @param focusState state of focus
|
|
645
556
|
* @returns {void}
|
|
646
557
|
*/
|
|
647
558
|
toggleFocusField(name, focusState) {
|
|
@@ -649,12 +560,56 @@ let Slider = class Slider extends ControlElement {
|
|
|
649
560
|
this[`${name}Input`].setAttribute('tabindex', `${focusState ? 1 : 0}`);
|
|
650
561
|
}
|
|
651
562
|
}
|
|
563
|
+
/**
|
|
564
|
+
* Start dragging event on slider
|
|
565
|
+
* @param event event dragstart
|
|
566
|
+
* @returns {void}
|
|
567
|
+
*/
|
|
568
|
+
onDragStart(event) {
|
|
569
|
+
this.dragging = true;
|
|
570
|
+
this.classList.add('grabbable');
|
|
571
|
+
if (this.range) {
|
|
572
|
+
const percentage = this.getMousePosition(event);
|
|
573
|
+
const mousePosition = ((this.maxNumber - this.minNumber) * percentage) + this.minNumber;
|
|
574
|
+
const distanceFrom = Math.abs(mousePosition - this.fromNumber);
|
|
575
|
+
const distanceTo = Math.abs(mousePosition - this.toNumber);
|
|
576
|
+
if (distanceFrom < distanceTo) {
|
|
577
|
+
this.activeThumb = this.thumbs[0];
|
|
578
|
+
}
|
|
579
|
+
else if (distanceFrom > distanceTo) {
|
|
580
|
+
this.activeThumb = this.thumbs[1];
|
|
581
|
+
}
|
|
582
|
+
this.thumbs.forEach((el) => {
|
|
583
|
+
el.style.zIndex = '5';
|
|
584
|
+
});
|
|
585
|
+
this.activeThumb.style.zIndex = '10';
|
|
586
|
+
// Set focus to input when drag.
|
|
587
|
+
if (this.isShowInputField) {
|
|
588
|
+
this.toggleFocusField(this.activeThumb.getAttribute('name') || '', true);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
this.activeThumb = this.thumbs[0];
|
|
593
|
+
}
|
|
594
|
+
this.onDrag(event);
|
|
595
|
+
if (event.changedTouches) {
|
|
596
|
+
this.addEventListener('touchmove', this.onDrag);
|
|
597
|
+
this.addEventListener('touchend', this.onDragEnd);
|
|
598
|
+
}
|
|
599
|
+
else {
|
|
600
|
+
window.addEventListener('mousemove', this.onDrag);
|
|
601
|
+
window.addEventListener('mouseup', this.onDragEnd);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
652
604
|
/**
|
|
653
605
|
* @param event event mousemove and touchmove
|
|
654
606
|
* @returns mouse position by percentage
|
|
655
607
|
*/
|
|
656
608
|
getMousePosition(event) {
|
|
657
|
-
const sliderRect = this.
|
|
609
|
+
const sliderRect = this.trackRef.value?.getBoundingClientRect();
|
|
610
|
+
if (!sliderRect) {
|
|
611
|
+
return 1;
|
|
612
|
+
}
|
|
658
613
|
// check drag desktop or mobile
|
|
659
614
|
const pageX = event.changedTouches ? event.changedTouches[0].pageX : event.pageX;
|
|
660
615
|
const positionSize = pageX - sliderRect.left;
|
|
@@ -665,6 +620,35 @@ let Slider = class Slider extends ControlElement {
|
|
|
665
620
|
return 1;
|
|
666
621
|
}
|
|
667
622
|
}
|
|
623
|
+
/**
|
|
624
|
+
* Dragging after on dragging start event
|
|
625
|
+
* @param event event mousemove and touchmove
|
|
626
|
+
* @returns {void}
|
|
627
|
+
*/
|
|
628
|
+
onDrag(event) {
|
|
629
|
+
if (this.minNumber === this.maxNumber) {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
const thumbPosition = this.getMousePosition(event);
|
|
633
|
+
const nearestStep = this.calculateStep(thumbPosition);
|
|
634
|
+
if (nearestStep > 1) {
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
const thumbLeft = this.stepRange !== 0 ? nearestStep : thumbPosition;
|
|
638
|
+
const computedStepValue = this.calculateValue(thumbLeft);
|
|
639
|
+
const displayedValue = Number(this.displayValue(computedStepValue));
|
|
640
|
+
if (this.range) {
|
|
641
|
+
if (this.activeThumb === this.thumbs[1]) {
|
|
642
|
+
this.to = this.validateTo(displayedValue).toString();
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
this.from = this.validateFrom(displayedValue).toString();
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
this.value = displayedValue.toString();
|
|
650
|
+
}
|
|
651
|
+
}
|
|
668
652
|
/**
|
|
669
653
|
* Handle 'from' value on drag out of boundary.
|
|
670
654
|
* @param value value from change
|
|
@@ -694,12 +678,12 @@ let Slider = class Slider extends ControlElement {
|
|
|
694
678
|
}
|
|
695
679
|
}
|
|
696
680
|
/**
|
|
697
|
-
* Calculate the nearest interval
|
|
681
|
+
* Calculate the nearest step interval
|
|
698
682
|
* @param thumbPosition thumb position dragging on slider
|
|
699
683
|
* @returns position step on slider
|
|
700
684
|
*/
|
|
701
685
|
calculateStep(thumbPosition) {
|
|
702
|
-
const stepSize = this.calculatePercentage(this.minNumber + this.
|
|
686
|
+
const stepSize = this.calculatePercentage(this.minNumber + this.stepRange) / 100;
|
|
703
687
|
// calculate step to current point to next point
|
|
704
688
|
const posToFixStep = Math.round(thumbPosition / stepSize) * stepSize;
|
|
705
689
|
if (thumbPosition <= posToFixStep + (stepSize / 2)) {
|
|
@@ -738,11 +722,11 @@ let Slider = class Slider extends ControlElement {
|
|
|
738
722
|
* @returns formatted value
|
|
739
723
|
*/
|
|
740
724
|
displayValue(value) {
|
|
741
|
-
if (
|
|
742
|
-
const valueDecimalCount =
|
|
725
|
+
if (isDecimalNumber(value)) {
|
|
726
|
+
const valueDecimalCount = countDecimalPlace(value);
|
|
743
727
|
// return value decimal by a boundary of max decimal
|
|
744
|
-
if (valueDecimalCount > this.
|
|
745
|
-
return value.toFixed(this.
|
|
728
|
+
if (valueDecimalCount > this.decimalPlace) {
|
|
729
|
+
return value.toFixed(this.decimalPlace);
|
|
746
730
|
}
|
|
747
731
|
else {
|
|
748
732
|
return value.toString();
|
|
@@ -752,6 +736,37 @@ let Slider = class Slider extends ControlElement {
|
|
|
752
736
|
return value.toString();
|
|
753
737
|
}
|
|
754
738
|
}
|
|
739
|
+
/**
|
|
740
|
+
* End dragging event and remove dragging event
|
|
741
|
+
* @param event event mouseup and touchmove
|
|
742
|
+
* @returns {void}
|
|
743
|
+
*/
|
|
744
|
+
onDragEnd(event) {
|
|
745
|
+
if (this.dragging) {
|
|
746
|
+
this.dragging = false;
|
|
747
|
+
const touchEvent = event;
|
|
748
|
+
if (touchEvent.changedTouches) {
|
|
749
|
+
this.removeEventListener('touchmove', this.onDrag);
|
|
750
|
+
this.removeEventListener('touchend', this.onDragEnd);
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
window.removeEventListener('mousemove', this.onDrag);
|
|
754
|
+
window.removeEventListener('mouseup', this.onDragEnd);
|
|
755
|
+
}
|
|
756
|
+
this.classList.remove('grabbable');
|
|
757
|
+
if (this.classList.length === 0) {
|
|
758
|
+
this.removeAttribute('class');
|
|
759
|
+
}
|
|
760
|
+
if (!touchEvent.changedTouches) {
|
|
761
|
+
event.preventDefault();
|
|
762
|
+
}
|
|
763
|
+
this.dispatchDataChangedEvent();
|
|
764
|
+
// Reset tabIndex of input that's being drag.
|
|
765
|
+
if (this.isShowInputField) {
|
|
766
|
+
this.toggleFocusField(this.activeThumb.getAttribute('name') || '', false);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
755
770
|
/**
|
|
756
771
|
* Value observer
|
|
757
772
|
* @returns {void}
|
|
@@ -760,12 +775,12 @@ let Slider = class Slider extends ControlElement {
|
|
|
760
775
|
if (this.readonly) {
|
|
761
776
|
const valuePercent = this.calculatePercentage(Number(this.value)) / 100;
|
|
762
777
|
const closestStep = this.calculateStep(valuePercent);
|
|
763
|
-
const thumbLeft = this.
|
|
778
|
+
const thumbLeft = this.stepRange !== 0 ? closestStep : valuePercent;
|
|
764
779
|
const calStepValue = this.calculateValue(thumbLeft);
|
|
765
780
|
this.value = this.displayValue(calStepValue);
|
|
766
781
|
}
|
|
767
782
|
else {
|
|
768
|
-
const valueSanitize = Number(
|
|
783
|
+
const valueSanitize = Number(validateNumber(Number(this.value), 0));
|
|
769
784
|
if (this.isValueInBoundary(valueSanitize, '')) {
|
|
770
785
|
this.value = this.displayValue(valueSanitize);
|
|
771
786
|
}
|
|
@@ -788,8 +803,8 @@ let Slider = class Slider extends ControlElement {
|
|
|
788
803
|
* From value observer
|
|
789
804
|
* @returns {void}
|
|
790
805
|
*/
|
|
791
|
-
|
|
792
|
-
const valueFrom = Number(
|
|
806
|
+
onFromValueChange() {
|
|
807
|
+
const valueFrom = Number(validateNumber(this.fromNumber, 0));
|
|
793
808
|
if (this.isValueInBoundary(valueFrom, 'from')) {
|
|
794
809
|
this.from = this.displayValue(this.fromNumber);
|
|
795
810
|
}
|
|
@@ -813,30 +828,6 @@ let Slider = class Slider extends ControlElement {
|
|
|
813
828
|
this.fromPrevious = this.from;
|
|
814
829
|
}
|
|
815
830
|
}
|
|
816
|
-
/**
|
|
817
|
-
* Return fallback number of the value is invalid
|
|
818
|
-
* @param value value for checking
|
|
819
|
-
* @param fallbackValue fallback value when value is not number;
|
|
820
|
-
* @returns sanitized number
|
|
821
|
-
*/
|
|
822
|
-
sanitizeNumber(value, fallbackValue) {
|
|
823
|
-
let val;
|
|
824
|
-
if (this.isNumberValue(value) && typeof value === 'number') {
|
|
825
|
-
val = value.toString();
|
|
826
|
-
}
|
|
827
|
-
else {
|
|
828
|
-
val = fallbackValue;
|
|
829
|
-
}
|
|
830
|
-
return val.toString();
|
|
831
|
-
}
|
|
832
|
-
/**
|
|
833
|
-
* Check if value is number
|
|
834
|
-
* @param value value for checking
|
|
835
|
-
* @returns true if value is numeric
|
|
836
|
-
*/
|
|
837
|
-
isNumberValue(value) {
|
|
838
|
-
return !isNaN(value) && !isNaN(Number(value));
|
|
839
|
-
}
|
|
840
831
|
/**
|
|
841
832
|
* Check if value is inside min / max boundary
|
|
842
833
|
* @param value value is checking
|
|
@@ -860,7 +851,7 @@ let Slider = class Slider extends ControlElement {
|
|
|
860
851
|
return false;
|
|
861
852
|
}
|
|
862
853
|
// check step min and max in range
|
|
863
|
-
if (this.
|
|
854
|
+
if (this.stepRange < this.minNumber || this.stepRange > this.maxNumber) {
|
|
864
855
|
return true;
|
|
865
856
|
}
|
|
866
857
|
}
|
|
@@ -870,8 +861,8 @@ let Slider = class Slider extends ControlElement {
|
|
|
870
861
|
* To value observer
|
|
871
862
|
* @returns {void}
|
|
872
863
|
*/
|
|
873
|
-
|
|
874
|
-
const valueTo = Number(
|
|
864
|
+
onToValueChange() {
|
|
865
|
+
const valueTo = Number(validateNumber(this.toNumber, 0));
|
|
875
866
|
if (this.isValueInBoundary(valueTo, 'to')) {
|
|
876
867
|
this.to = this.displayValue(valueTo);
|
|
877
868
|
}
|
|
@@ -900,17 +891,14 @@ let Slider = class Slider extends ControlElement {
|
|
|
900
891
|
* @returns {void}
|
|
901
892
|
*/
|
|
902
893
|
onStepChange() {
|
|
903
|
-
this.step =
|
|
904
|
-
this.stepUse = this.calculateStepRange(this.stepNumber);
|
|
905
|
-
// Set decimal places value when step is decimal
|
|
906
|
-
this.updateDecimalPlaces();
|
|
894
|
+
this.step = validateNumber(this.stepNumber, 1);
|
|
907
895
|
}
|
|
908
896
|
/**
|
|
909
897
|
* Min range observer
|
|
910
898
|
* @returns {void}
|
|
911
899
|
*/
|
|
912
900
|
onMinRangeChange() {
|
|
913
|
-
const valueMinRange = Math.abs(Number(
|
|
901
|
+
const valueMinRange = Math.abs(Number(validateNumber(this.minRangeNumber, 0)));
|
|
914
902
|
const maximumRangeMinMax = Math.abs(this.maxNumber - this.minNumber);
|
|
915
903
|
const maximumRangeFromTo = Math.abs(this.toNumber - this.fromNumber);
|
|
916
904
|
if (valueMinRange && valueMinRange >= this.stepNumber) {
|
|
@@ -934,9 +922,7 @@ let Slider = class Slider extends ControlElement {
|
|
|
934
922
|
* @returns {void}
|
|
935
923
|
*/
|
|
936
924
|
onMinChange(oldValue) {
|
|
937
|
-
this.min =
|
|
938
|
-
// Set decimal places value when min is decimal
|
|
939
|
-
this.updateDecimalPlaces();
|
|
925
|
+
this.min = validateNumber(this.minNumber, 0);
|
|
940
926
|
if (this.minNumber > this.maxNumber) {
|
|
941
927
|
this.min = this.max;
|
|
942
928
|
}
|
|
@@ -958,7 +944,7 @@ let Slider = class Slider extends ControlElement {
|
|
|
958
944
|
* @returns {void}
|
|
959
945
|
*/
|
|
960
946
|
onMaxChange(oldValue) {
|
|
961
|
-
this.max =
|
|
947
|
+
this.max = validateNumber(this.maxNumber, 100);
|
|
962
948
|
if (this.maxNumber < this.minNumber) {
|
|
963
949
|
this.max = this.min;
|
|
964
950
|
}
|
|
@@ -979,7 +965,7 @@ let Slider = class Slider extends ControlElement {
|
|
|
979
965
|
* @param range show range slider
|
|
980
966
|
* @returns Track template
|
|
981
967
|
*/
|
|
982
|
-
|
|
968
|
+
renderTrack(range) {
|
|
983
969
|
const stepContainerSize = this.calculatePercentage(this.minNumber + this.stepNumber);
|
|
984
970
|
const translateX = (stepContainerSize / 2);
|
|
985
971
|
const stepsStyle = { transform: `translateX(${translateX}%)`, backgroundSize: `${stepContainerSize}% 100%` };
|
|
@@ -988,12 +974,12 @@ let Slider = class Slider extends ControlElement {
|
|
|
988
974
|
? { width: `${this.calculatePercentage(this.toNumber) - this.calculatePercentage(this.fromNumber)}%`, left: `${this.calculatePercentage(this.fromNumber)}%` }
|
|
989
975
|
: { width: `${this.calculatePercentage(Number(this.value))}%` };
|
|
990
976
|
return html `
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
977
|
+
<div part="track-wrapper" ${ref(this.trackRef)}>
|
|
978
|
+
<div part="track-fill" style=${styleMap(trackFillStyle)}></div>
|
|
979
|
+
<div part="step-container" style=${styleMap(stepContainerStyle)}>
|
|
980
|
+
<div part="step" style=${styleMap(stepsStyle)}></div>
|
|
981
|
+
</div>
|
|
995
982
|
</div>
|
|
996
|
-
</div>
|
|
997
983
|
`;
|
|
998
984
|
}
|
|
999
985
|
/**
|
|
@@ -1006,11 +992,12 @@ let Slider = class Slider extends ControlElement {
|
|
|
1006
992
|
renderThumb(value, percentageValue, name) {
|
|
1007
993
|
const thumbStyle = { left: `${percentageValue}%` };
|
|
1008
994
|
return html `
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
995
|
+
<div part="thumb-container" name=${name} style=${styleMap(thumbStyle)}>
|
|
996
|
+
<div part="pin">
|
|
997
|
+
<span part="pin-value-marker">${value}</span>
|
|
998
|
+
</div>
|
|
999
|
+
<div part="thumb" draggable="true"></div>
|
|
1000
|
+
</div>
|
|
1014
1001
|
`;
|
|
1015
1002
|
}
|
|
1016
1003
|
/**
|
|
@@ -1035,92 +1022,19 @@ let Slider = class Slider extends ControlElement {
|
|
|
1035
1022
|
*/
|
|
1036
1023
|
renderNumberField(value, name) {
|
|
1037
1024
|
return html `
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
`;
|
|
1052
|
-
}
|
|
1053
|
-
/**
|
|
1054
|
-
* Define styles in a tagged template literal, using the css tag function.
|
|
1055
|
-
* @returns CSS template
|
|
1056
|
-
*/
|
|
1057
|
-
static get styles() {
|
|
1058
|
-
return css `
|
|
1059
|
-
:host {
|
|
1060
|
-
display: flex;
|
|
1061
|
-
}
|
|
1062
|
-
[part=slider-wrapper] {
|
|
1063
|
-
position: relative;
|
|
1064
|
-
width: 100%;
|
|
1065
|
-
}
|
|
1066
|
-
[part=slider] {
|
|
1067
|
-
width: 100%;
|
|
1068
|
-
height: 100%;
|
|
1069
|
-
display: inline-block;
|
|
1070
|
-
}
|
|
1071
|
-
:host(:not([disabled]):focus){
|
|
1072
|
-
outline:none;
|
|
1073
|
-
}
|
|
1074
|
-
:host([show-steps]) [part=track-wrapper]::after {
|
|
1075
|
-
display:block;
|
|
1076
|
-
position: absolute;
|
|
1077
|
-
content: "";
|
|
1078
|
-
right: 0;
|
|
1079
|
-
}
|
|
1080
|
-
[part=track-wrapper]{
|
|
1081
|
-
content: "";
|
|
1082
|
-
position: absolute;
|
|
1083
|
-
width: 100%;
|
|
1084
|
-
top: 50%;
|
|
1085
|
-
left: 0;
|
|
1086
|
-
pointer-events: none;
|
|
1087
|
-
}
|
|
1088
|
-
[part=thumb-container]{
|
|
1089
|
-
position: absolute;
|
|
1090
|
-
top: 0;
|
|
1091
|
-
width: 100%;
|
|
1092
|
-
z-index: 5;
|
|
1093
|
-
}
|
|
1094
|
-
[part=thumb]{
|
|
1095
|
-
position: absolute;
|
|
1096
|
-
margin: 0 auto;
|
|
1097
|
-
}
|
|
1098
|
-
[part=pin]{
|
|
1099
|
-
display: flex;
|
|
1100
|
-
position: absolute;
|
|
1101
|
-
align-items: center;
|
|
1102
|
-
justify-content: center;
|
|
1103
|
-
z-index: 1;
|
|
1104
|
-
}
|
|
1105
|
-
:host([show-steps]) [part=step-container]{
|
|
1106
|
-
position: absolute;
|
|
1107
|
-
left: 0;
|
|
1108
|
-
width: 100%;
|
|
1109
|
-
}
|
|
1110
|
-
:host([show-steps]) [part=step]{
|
|
1111
|
-
width: 100%;
|
|
1112
|
-
position: absolute;
|
|
1113
|
-
left: 0;
|
|
1114
|
-
}
|
|
1115
|
-
[part=track-fill]{
|
|
1116
|
-
z-index: 2;
|
|
1117
|
-
content: "";
|
|
1118
|
-
position: absolute;
|
|
1119
|
-
left: 0;
|
|
1120
|
-
}
|
|
1121
|
-
:host([show-steps][step="0"]) [part=track-wrapper]::after{
|
|
1122
|
-
width: 0;
|
|
1123
|
-
}
|
|
1025
|
+
<ef-number-field
|
|
1026
|
+
@blur=${this.onBlur}
|
|
1027
|
+
@keydown=${this.onKeydown}
|
|
1028
|
+
part="input"
|
|
1029
|
+
name="${name}"
|
|
1030
|
+
no-spinner
|
|
1031
|
+
.value="${value}"
|
|
1032
|
+
min="${this.min}"
|
|
1033
|
+
max="${this.max}"
|
|
1034
|
+
step="${this.step}"
|
|
1035
|
+
?disabled="${this.disabled}"
|
|
1036
|
+
?readonly="${this.readonly || this.showInputField === 'readonly'}"
|
|
1037
|
+
></ef-number-field>
|
|
1124
1038
|
`;
|
|
1125
1039
|
}
|
|
1126
1040
|
/**
|
|
@@ -1131,8 +1045,8 @@ let Slider = class Slider extends ControlElement {
|
|
|
1131
1045
|
return html `
|
|
1132
1046
|
${this.range && this.isShowInputField ? this.renderNumberField(this.from, 'from') : null}
|
|
1133
1047
|
<div part="slider-wrapper">
|
|
1134
|
-
<div part="slider">
|
|
1135
|
-
${this.
|
|
1048
|
+
<div part="slider" ${ref(this.sliderRef)}>
|
|
1049
|
+
${this.renderTrack(this.range)}
|
|
1136
1050
|
${this.range ? this.renderThumbRange(this.fromNumber, this.toNumber) : this.renderThumb(this.valueNumber, this.calculatePercentage(Number(this.value)), 'value')}
|
|
1137
1051
|
</div>
|
|
1138
1052
|
</div>
|
|
@@ -1171,15 +1085,6 @@ __decorate([
|
|
|
1171
1085
|
__decorate([
|
|
1172
1086
|
property({ type: String, attribute: 'min-range' })
|
|
1173
1087
|
], Slider.prototype, "minRange", void 0);
|
|
1174
|
-
__decorate([
|
|
1175
|
-
query('[part="slider"]')
|
|
1176
|
-
], Slider.prototype, "slider", void 0);
|
|
1177
|
-
__decorate([
|
|
1178
|
-
query('#trackWrapper')
|
|
1179
|
-
], Slider.prototype, "trackWrapper", void 0);
|
|
1180
|
-
__decorate([
|
|
1181
|
-
query('#thumbContainer')
|
|
1182
|
-
], Slider.prototype, "thumbContainer", void 0);
|
|
1183
1088
|
__decorate([
|
|
1184
1089
|
query('ef-number-field[name=value]')
|
|
1185
1090
|
], Slider.prototype, "valueInput", void 0);
|