@design-factory/angular 21.1.0-next.0 → 21.1.0
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/fesm2022/design-factory-angular-drawer.mjs +22 -29
- package/fesm2022/design-factory-angular-drawer.mjs.map +1 -1
- package/fesm2022/design-factory-angular-internals.mjs +5 -5
- package/fesm2022/design-factory-angular-internals.mjs.map +1 -1
- package/fesm2022/design-factory-angular-sidenav.mjs +139 -62
- package/fesm2022/design-factory-angular-sidenav.mjs.map +1 -1
- package/fesm2022/design-factory-angular-theme.mjs +1 -1
- package/fesm2022/design-factory-angular-theme.mjs.map +1 -1
- package/fesm2022/design-factory-angular-topnav.mjs +152 -75
- package/fesm2022/design-factory-angular-topnav.mjs.map +1 -1
- package/package.json +3 -6
- package/types/design-factory-angular-drawer.d.ts +13 -14
- package/types/design-factory-angular-internals.d.ts +3 -3
- package/types/design-factory-angular-sidenav.d.ts +19 -6
- package/types/design-factory-angular-topnav.d.ts +13 -6
- package/node_modules/@agnos-ui/core/README.md +0 -5
- package/node_modules/@agnos-ui/core/accordion-BC_9xn23.cjs +0 -314
- package/node_modules/@agnos-ui/core/accordion-Ca_0T8Bc.js +0 -315
- package/node_modules/@agnos-ui/core/alert-AhaliJ17.cjs +0 -9
- package/node_modules/@agnos-ui/core/alert-Cb9FhbFQ.js +0 -10
- package/node_modules/@agnos-ui/core/collapse-COriZO7o.cjs +0 -94
- package/node_modules/@agnos-ui/core/collapse-CP79atna.js +0 -95
- package/node_modules/@agnos-ui/core/common-B5jS-Ih_.cjs +0 -73
- package/node_modules/@agnos-ui/core/common-DFyZvkII.js +0 -74
- package/node_modules/@agnos-ui/core/components/accordion/accordion.d.ts +0 -333
- package/node_modules/@agnos-ui/core/components/accordion/index.cjs +0 -7
- package/node_modules/@agnos-ui/core/components/accordion/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/accordion/index.js +0 -7
- package/node_modules/@agnos-ui/core/components/alert/alert.d.ts +0 -37
- package/node_modules/@agnos-ui/core/components/alert/common.d.ts +0 -138
- package/node_modules/@agnos-ui/core/components/alert/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/alert/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/alert/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/carousel/carousel.d.ts +0 -247
- package/node_modules/@agnos-ui/core/components/carousel/index.cjs +0 -292
- package/node_modules/@agnos-ui/core/components/carousel/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/carousel/index.js +0 -292
- package/node_modules/@agnos-ui/core/components/collapse/collapse.d.ts +0 -135
- package/node_modules/@agnos-ui/core/components/collapse/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/collapse/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/collapse/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/commonProps.d.ts +0 -11
- package/node_modules/@agnos-ui/core/components/drawer/drawer.d.ts +0 -279
- package/node_modules/@agnos-ui/core/components/drawer/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/drawer/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/drawer/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/modal/index.cjs +0 -8
- package/node_modules/@agnos-ui/core/components/modal/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/modal/index.js +0 -8
- package/node_modules/@agnos-ui/core/components/modal/modal.d.ts +0 -245
- package/node_modules/@agnos-ui/core/components/pagination/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/pagination/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/pagination/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/pagination/pagination.d.ts +0 -313
- package/node_modules/@agnos-ui/core/components/progressbar/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/progressbar/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/progressbar/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/progressbar/progressbar.d.ts +0 -91
- package/node_modules/@agnos-ui/core/components/rating/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/rating/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/rating/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/rating/rating.d.ts +0 -191
- package/node_modules/@agnos-ui/core/components/slider/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/slider/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/slider/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/slider/slider-utils.d.ts +0 -25
- package/node_modules/@agnos-ui/core/components/slider/slider.d.ts +0 -383
- package/node_modules/@agnos-ui/core/components/toast/index.cjs +0 -7
- package/node_modules/@agnos-ui/core/components/toast/index.d.ts +0 -2
- package/node_modules/@agnos-ui/core/components/toast/index.js +0 -7
- package/node_modules/@agnos-ui/core/components/toast/toast.d.ts +0 -66
- package/node_modules/@agnos-ui/core/components/toast/toaster.d.ts +0 -128
- package/node_modules/@agnos-ui/core/components/tree/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/tree/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/tree/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/tree/tree.d.ts +0 -143
- package/node_modules/@agnos-ui/core/config.cjs +0 -36
- package/node_modules/@agnos-ui/core/config.d.ts +0 -117
- package/node_modules/@agnos-ui/core/config.js +0 -36
- package/node_modules/@agnos-ui/core/directive-Bsreu2z1.js +0 -523
- package/node_modules/@agnos-ui/core/directive-DCaXmRe_.cjs +0 -522
- package/node_modules/@agnos-ui/core/drawer-BbFAHV07.cjs +0 -328
- package/node_modules/@agnos-ui/core/drawer-C6Qa0xEu.js +0 -329
- package/node_modules/@agnos-ui/core/index.cjs +0 -134
- package/node_modules/@agnos-ui/core/index.d.ts +0 -29
- package/node_modules/@agnos-ui/core/index.js +0 -134
- package/node_modules/@agnos-ui/core/isFocusable-Ckwus82R.js +0 -32
- package/node_modules/@agnos-ui/core/isFocusable-DfzDLeAN.cjs +0 -31
- package/node_modules/@agnos-ui/core/modal-BsNuHhT7.cjs +0 -252
- package/node_modules/@agnos-ui/core/modal-CgzY8ezz.js +0 -253
- package/node_modules/@agnos-ui/core/package.json +0 -57
- package/node_modules/@agnos-ui/core/pagination-ZxGaNWZz.js +0 -255
- package/node_modules/@agnos-ui/core/pagination-xbcOHnhd.cjs +0 -254
- package/node_modules/@agnos-ui/core/progressbar-CRbMKp4b.cjs +0 -86
- package/node_modules/@agnos-ui/core/progressbar-CSEIFnlD.js +0 -87
- package/node_modules/@agnos-ui/core/promise-CxCD3NYv.cjs +0 -118
- package/node_modules/@agnos-ui/core/promise-D-RZVPuv.js +0 -119
- package/node_modules/@agnos-ui/core/rating-BIdiiPUo.js +0 -184
- package/node_modules/@agnos-ui/core/rating-qx1xaBmz.cjs +0 -183
- package/node_modules/@agnos-ui/core/scrollbars-CT87iv_6.cjs +0 -30
- package/node_modules/@agnos-ui/core/scrollbars-CcxSrnCx.js +0 -31
- package/node_modules/@agnos-ui/core/services/extendWidget.cjs +0 -41
- package/node_modules/@agnos-ui/core/services/extendWidget.d.ts +0 -31
- package/node_modules/@agnos-ui/core/services/extendWidget.js +0 -41
- package/node_modules/@agnos-ui/core/services/floatingUI.cjs +0 -111
- package/node_modules/@agnos-ui/core/services/floatingUI.d.ts +0 -76
- package/node_modules/@agnos-ui/core/services/floatingUI.js +0 -111
- package/node_modules/@agnos-ui/core/services/focusElement.cjs +0 -46
- package/node_modules/@agnos-ui/core/services/focusElement.d.ts +0 -9
- package/node_modules/@agnos-ui/core/services/focusElement.js +0 -46
- package/node_modules/@agnos-ui/core/services/focustrack.cjs +0 -47
- package/node_modules/@agnos-ui/core/services/focustrack.d.ts +0 -40
- package/node_modules/@agnos-ui/core/services/focustrack.js +0 -47
- package/node_modules/@agnos-ui/core/services/hash.cjs +0 -15
- package/node_modules/@agnos-ui/core/services/hash.d.ts +0 -3
- package/node_modules/@agnos-ui/core/services/hash.js +0 -15
- package/node_modules/@agnos-ui/core/services/intersection.cjs +0 -53
- package/node_modules/@agnos-ui/core/services/intersection.d.ts +0 -30
- package/node_modules/@agnos-ui/core/services/intersection.js +0 -53
- package/node_modules/@agnos-ui/core/services/matchMedia.cjs +0 -14
- package/node_modules/@agnos-ui/core/services/matchMedia.d.ts +0 -8
- package/node_modules/@agnos-ui/core/services/matchMedia.js +0 -14
- package/node_modules/@agnos-ui/core/services/navManager.cjs +0 -166
- package/node_modules/@agnos-ui/core/services/navManager.d.ts +0 -144
- package/node_modules/@agnos-ui/core/services/navManager.js +0 -166
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.cjs +0 -60
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.d.ts +0 -42
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.js +0 -60
- package/node_modules/@agnos-ui/core/services/portal.cjs +0 -42
- package/node_modules/@agnos-ui/core/services/portal.d.ts +0 -16
- package/node_modules/@agnos-ui/core/services/portal.js +0 -42
- package/node_modules/@agnos-ui/core/services/resizeObserver.cjs +0 -54
- package/node_modules/@agnos-ui/core/services/resizeObserver.d.ts +0 -18
- package/node_modules/@agnos-ui/core/services/resizeObserver.js +0 -54
- package/node_modules/@agnos-ui/core/services/siblingsInert.cjs +0 -44
- package/node_modules/@agnos-ui/core/services/siblingsInert.d.ts +0 -16
- package/node_modules/@agnos-ui/core/services/siblingsInert.js +0 -44
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.cjs +0 -186
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.d.ts +0 -166
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.js +0 -186
- package/node_modules/@agnos-ui/core/services/transitions/collapse.cjs +0 -40
- package/node_modules/@agnos-ui/core/services/transitions/collapse.d.ts +0 -49
- package/node_modules/@agnos-ui/core/services/transitions/collapse.js +0 -40
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.cjs +0 -32
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.d.ts +0 -25
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.js +0 -32
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.cjs +0 -37
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.d.ts +0 -47
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.js +0 -37
- package/node_modules/@agnos-ui/core/slider-B93hE0ag.cjs +0 -807
- package/node_modules/@agnos-ui/core/slider-Cjiq9FgI.js +0 -808
- package/node_modules/@agnos-ui/core/textDirection-cNgt24LJ.js +0 -4
- package/node_modules/@agnos-ui/core/textDirection-zqcZ5-eK.cjs +0 -3
- package/node_modules/@agnos-ui/core/toaster-BQWqxYv-.cjs +0 -190
- package/node_modules/@agnos-ui/core/toaster-BzEkshT2.js +0 -191
- package/node_modules/@agnos-ui/core/tree-DY04XPPg.cjs +0 -228
- package/node_modules/@agnos-ui/core/tree-HwcvZ0_p.js +0 -229
- package/node_modules/@agnos-ui/core/types.cjs +0 -6
- package/node_modules/@agnos-ui/core/types.d.ts +0 -246
- package/node_modules/@agnos-ui/core/types.js +0 -6
- package/node_modules/@agnos-ui/core/utils/directive.cjs +0 -28
- package/node_modules/@agnos-ui/core/utils/directive.d.ts +0 -352
- package/node_modules/@agnos-ui/core/utils/directive.js +0 -28
- package/node_modules/@agnos-ui/core/utils/func.cjs +0 -7
- package/node_modules/@agnos-ui/core/utils/func.d.ts +0 -11
- package/node_modules/@agnos-ui/core/utils/func.js +0 -7
- package/node_modules/@agnos-ui/core/utils/id.cjs +0 -5
- package/node_modules/@agnos-ui/core/utils/id.d.ts +0 -6
- package/node_modules/@agnos-ui/core/utils/id.js +0 -5
- package/node_modules/@agnos-ui/core/utils/internal/assign.d.ts +0 -10
- package/node_modules/@agnos-ui/core/utils/internal/checks.d.ts +0 -57
- package/node_modules/@agnos-ui/core/utils/internal/dom.d.ts +0 -75
- package/node_modules/@agnos-ui/core/utils/internal/isFocusable.d.ts +0 -9
- package/node_modules/@agnos-ui/core/utils/internal/math.d.ts +0 -5
- package/node_modules/@agnos-ui/core/utils/internal/promise.d.ts +0 -98
- package/node_modules/@agnos-ui/core/utils/internal/scrollbars.d.ts +0 -8
- package/node_modules/@agnos-ui/core/utils/internal/sort.d.ts +0 -16
- package/node_modules/@agnos-ui/core/utils/internal/ssrHTMLElement.d.ts +0 -17
- package/node_modules/@agnos-ui/core/utils/internal/textDirection.d.ts +0 -7
- package/node_modules/@agnos-ui/core/utils/internal/traversal.d.ts +0 -54
- package/node_modules/@agnos-ui/core/utils/stores.cjs +0 -172
- package/node_modules/@agnos-ui/core/utils/stores.d.ts +0 -224
- package/node_modules/@agnos-ui/core/utils/stores.js +0 -172
- package/node_modules/@agnos-ui/core/utils/widget.cjs +0 -8
- package/node_modules/@agnos-ui/core/utils/widget.d.ts +0 -11
- package/node_modules/@agnos-ui/core/utils/widget.js +0 -8
- package/node_modules/@agnos-ui/core/utils/writables.cjs +0 -16
- package/node_modules/@agnos-ui/core/utils/writables.d.ts +0 -95
- package/node_modules/@agnos-ui/core/utils/writables.js +0 -16
- package/node_modules/@agnos-ui/core/writables-DYGjj5T3.js +0 -103
- package/node_modules/@agnos-ui/core/writables-Dt68gADJ.cjs +0 -102
|
@@ -1,807 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const tansu = require("@amadeus-it-group/tansu");
|
|
3
|
-
const utils_directive = require("./directive-DCaXmRe_.cjs");
|
|
4
|
-
const utils_func = require("./utils/func.cjs");
|
|
5
|
-
const utils_stores = require("./utils/stores.cjs");
|
|
6
|
-
const utils_writables = require("./writables-Dt68gADJ.cjs");
|
|
7
|
-
const services_resizeObserver = require("./services/resizeObserver.cjs");
|
|
8
|
-
const services_pointerdownPosition = require("./services/pointerdownPosition.cjs");
|
|
9
|
-
const utils_widget = require("./utils/widget.cjs");
|
|
10
|
-
const decimalRegExp = /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/;
|
|
11
|
-
function getDecimalPrecision(number) {
|
|
12
|
-
const matches = ("" + number).match(decimalRegExp);
|
|
13
|
-
return Math.max(
|
|
14
|
-
0,
|
|
15
|
-
// Number of digits right of decimal point.
|
|
16
|
-
(matches[1]?.length ?? 0) - // Adjust for exponential notation.
|
|
17
|
-
(+matches[2] || 0)
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
const pushHandle = (values, index, currentValue, direction, minRange, min, max, pushRange) => {
|
|
21
|
-
let nextValue = values[index + direction];
|
|
22
|
-
if (nextValue == null || Math.abs(nextValue - currentValue) >= minRange) {
|
|
23
|
-
return currentValue;
|
|
24
|
-
}
|
|
25
|
-
if (pushRange) {
|
|
26
|
-
const targetValue = currentValue + minRange * direction;
|
|
27
|
-
nextValue = pushHandle(values, index + direction, targetValue, direction, minRange, min, max, pushRange);
|
|
28
|
-
nextValue = Math.max(Math.min(nextValue, max), min);
|
|
29
|
-
values[index + direction] = nextValue;
|
|
30
|
-
}
|
|
31
|
-
if (Math.abs(nextValue - currentValue) < minRange) {
|
|
32
|
-
currentValue = nextValue - minRange * direction;
|
|
33
|
-
values[index] = currentValue;
|
|
34
|
-
}
|
|
35
|
-
return currentValue;
|
|
36
|
-
};
|
|
37
|
-
const pullHandle = (values, index, currentValue, direction, maxRange, min, max, pushRange) => {
|
|
38
|
-
let nextValue = values[index + direction];
|
|
39
|
-
if (nextValue == null || Math.abs(nextValue - currentValue) <= maxRange) {
|
|
40
|
-
return currentValue;
|
|
41
|
-
}
|
|
42
|
-
if (pushRange) {
|
|
43
|
-
const targetValue = currentValue + maxRange * direction;
|
|
44
|
-
nextValue = pullHandle(values, index + direction, targetValue, direction, maxRange, min, max, pushRange);
|
|
45
|
-
nextValue = Math.max(Math.min(nextValue, max), min);
|
|
46
|
-
values[index + direction] = nextValue;
|
|
47
|
-
}
|
|
48
|
-
if (Math.abs(nextValue - currentValue) > maxRange) {
|
|
49
|
-
currentValue = nextValue - maxRange * direction;
|
|
50
|
-
values[index] = currentValue;
|
|
51
|
-
}
|
|
52
|
-
return currentValue;
|
|
53
|
-
};
|
|
54
|
-
const manageMinMaxRange = (values, index, minRange, maxRange, min, max, pushRange) => {
|
|
55
|
-
let current = values[index];
|
|
56
|
-
const previous = values[index - 1];
|
|
57
|
-
const next = values[index + 1];
|
|
58
|
-
if (previous != null && current < previous) {
|
|
59
|
-
current = values[index] = previous;
|
|
60
|
-
} else if (next != null && current > next) {
|
|
61
|
-
current = values[index] = next;
|
|
62
|
-
}
|
|
63
|
-
if (minRange) {
|
|
64
|
-
current = pushHandle(values, index, current, 1, minRange, min, max, pushRange);
|
|
65
|
-
current = pushHandle(values, index, current, -1, minRange, min, max, pushRange);
|
|
66
|
-
}
|
|
67
|
-
if (maxRange) {
|
|
68
|
-
current = pullHandle(values, index, current, 1, maxRange, min, max, pushRange);
|
|
69
|
-
pullHandle(values, index, current, -1, maxRange, min, max, pushRange);
|
|
70
|
-
}
|
|
71
|
-
return values;
|
|
72
|
-
};
|
|
73
|
-
const defaultSliderConfig = {
|
|
74
|
-
min: 0,
|
|
75
|
-
max: 100,
|
|
76
|
-
stepSize: 1,
|
|
77
|
-
readonly: false,
|
|
78
|
-
disabled: false,
|
|
79
|
-
vertical: false,
|
|
80
|
-
className: "",
|
|
81
|
-
ariaLabel: () => "Value",
|
|
82
|
-
ariaLabelledBy: () => "",
|
|
83
|
-
ariaValueText: () => "",
|
|
84
|
-
onValuesChange: utils_func.noop,
|
|
85
|
-
values: [0],
|
|
86
|
-
showValueLabels: true,
|
|
87
|
-
showMinMaxLabels: true,
|
|
88
|
-
showTicks: false,
|
|
89
|
-
showTickValues: true,
|
|
90
|
-
tickInterval: 0,
|
|
91
|
-
minRange: 0,
|
|
92
|
-
maxRange: 0,
|
|
93
|
-
pushRange: false,
|
|
94
|
-
rtl: false
|
|
95
|
-
};
|
|
96
|
-
function getSliderDefaultConfig() {
|
|
97
|
-
return { ...defaultSliderConfig };
|
|
98
|
-
}
|
|
99
|
-
const configValidator = {
|
|
100
|
-
min: utils_writables.typeNumber,
|
|
101
|
-
max: utils_writables.typeNumber,
|
|
102
|
-
stepSize: utils_writables.typeNumberInRangeFactory(0, Infinity, { strict: true }),
|
|
103
|
-
readonly: utils_writables.typeBoolean,
|
|
104
|
-
disabled: utils_writables.typeBoolean,
|
|
105
|
-
vertical: utils_writables.typeBoolean,
|
|
106
|
-
ariaLabel: utils_writables.typeFunction,
|
|
107
|
-
ariaLabelledBy: utils_writables.typeFunction,
|
|
108
|
-
ariaValueText: utils_writables.typeFunction,
|
|
109
|
-
onValuesChange: utils_writables.typeFunction,
|
|
110
|
-
values: utils_writables.typeArray,
|
|
111
|
-
showValueLabels: utils_writables.typeBoolean,
|
|
112
|
-
showMinMaxLabels: utils_writables.typeBoolean,
|
|
113
|
-
showTicks: utils_writables.typeBoolean,
|
|
114
|
-
showTickValues: utils_writables.typeBoolean,
|
|
115
|
-
tickInterval: utils_writables.typeNumberInRangeFactory(0, Infinity, { strict: true }),
|
|
116
|
-
rtl: utils_writables.typeBoolean,
|
|
117
|
-
className: utils_writables.typeString,
|
|
118
|
-
minRange: utils_writables.typeNumberInRangeFactory(0, Infinity),
|
|
119
|
-
maxRange: utils_writables.typeNumberInRangeFactory(0, Infinity),
|
|
120
|
-
pushRange: utils_writables.typeBoolean
|
|
121
|
-
};
|
|
122
|
-
const computeCleanValue = (value, min, max, intStepSize, decimalPrecision) => {
|
|
123
|
-
const magnitude = Math.pow(10, decimalPrecision);
|
|
124
|
-
if (value >= max) {
|
|
125
|
-
return max;
|
|
126
|
-
} else if (value <= min) {
|
|
127
|
-
return min;
|
|
128
|
-
}
|
|
129
|
-
const indexMin = Math.floor((value - min) * magnitude / intStepSize);
|
|
130
|
-
return +(((value - min) * magnitude % intStepSize < intStepSize / 2 ? indexMin : indexMin + 1) * intStepSize / magnitude + min).toFixed(decimalPrecision);
|
|
131
|
-
};
|
|
132
|
-
const updateValue = (handleIndex, values$, stepSize, updateDirection) => {
|
|
133
|
-
values$.update((value) => {
|
|
134
|
-
value = [...value];
|
|
135
|
-
value[handleIndex] = value[handleIndex] + stepSize * updateDirection;
|
|
136
|
-
return value;
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
const getUpdateDirection = (vertical, rtl, keysVertical) => {
|
|
140
|
-
if (vertical && rtl) {
|
|
141
|
-
return keysVertical ? 1 : -1;
|
|
142
|
-
} else if (vertical && !rtl) {
|
|
143
|
-
return -1;
|
|
144
|
-
} else if (!vertical && rtl) {
|
|
145
|
-
return keysVertical ? -1 : 1;
|
|
146
|
-
} else if (!vertical && !rtl) {
|
|
147
|
-
return -1;
|
|
148
|
-
}
|
|
149
|
-
return 1;
|
|
150
|
-
};
|
|
151
|
-
const percent = (value) => value != null ? `${value}%` : "";
|
|
152
|
-
const createSlider = utils_widget.createWidgetFactory(
|
|
153
|
-
"slider",
|
|
154
|
-
(config) => {
|
|
155
|
-
const [
|
|
156
|
-
{
|
|
157
|
-
// dirty inputs that need adjustment:
|
|
158
|
-
min$: _dirtyMinimum$,
|
|
159
|
-
max$: _dirtyMaximum$,
|
|
160
|
-
minRange$: _dirtyMinimumRange$,
|
|
161
|
-
maxRange$: _dirtyMaximumRange$,
|
|
162
|
-
pushRange$,
|
|
163
|
-
stepSize$,
|
|
164
|
-
rtl$,
|
|
165
|
-
values$: _dirtyValues$,
|
|
166
|
-
ariaLabel$,
|
|
167
|
-
ariaLabelledBy$,
|
|
168
|
-
ariaValueText$,
|
|
169
|
-
onValuesChange$,
|
|
170
|
-
showValueLabels$,
|
|
171
|
-
showMinMaxLabels$,
|
|
172
|
-
showTicks$,
|
|
173
|
-
showTickValues$,
|
|
174
|
-
tickInterval$,
|
|
175
|
-
...stateProps
|
|
176
|
-
},
|
|
177
|
-
patch
|
|
178
|
-
] = utils_stores.writablesForProps(defaultSliderConfig, config, configValidator);
|
|
179
|
-
const { vertical$, disabled$, readonly$ } = stateProps;
|
|
180
|
-
const _handleElements = /* @__PURE__ */ new Map();
|
|
181
|
-
const min$ = tansu.computed(() => {
|
|
182
|
-
const _dirtyMinimum = _dirtyMinimum$(), _dirtyMaximum = _dirtyMaximum$();
|
|
183
|
-
if (_dirtyMinimum === _dirtyMaximum) {
|
|
184
|
-
return defaultSliderConfig.min;
|
|
185
|
-
}
|
|
186
|
-
return Math.min(_dirtyMinimum, _dirtyMaximum);
|
|
187
|
-
});
|
|
188
|
-
const max$ = tansu.computed(() => {
|
|
189
|
-
const _dirtyMinimum = _dirtyMinimum$(), _dirtyMaximum = _dirtyMaximum$();
|
|
190
|
-
if (_dirtyMinimum === _dirtyMaximum) {
|
|
191
|
-
return defaultSliderConfig.max;
|
|
192
|
-
}
|
|
193
|
-
return Math.max(_dirtyMinimum, _dirtyMaximum);
|
|
194
|
-
});
|
|
195
|
-
const minRange$ = tansu.computed(() => {
|
|
196
|
-
const _dirtyMinimumRange = _dirtyMinimumRange$();
|
|
197
|
-
if (_dirtyMinimumRange <= 0) {
|
|
198
|
-
return 0;
|
|
199
|
-
}
|
|
200
|
-
const _dirtyMaximumRange = _dirtyMaximumRange$();
|
|
201
|
-
return _dirtyMaximumRange === 0 ? _dirtyMinimumRange : Math.min(_dirtyMinimumRange, _dirtyMaximumRange);
|
|
202
|
-
});
|
|
203
|
-
const maxRange$ = tansu.computed(() => {
|
|
204
|
-
const _dirtyMaximumRange = _dirtyMaximumRange$();
|
|
205
|
-
if (_dirtyMaximumRange <= 0) {
|
|
206
|
-
return 0;
|
|
207
|
-
}
|
|
208
|
-
const _dirtyMinimumRange = _dirtyMinimumRange$();
|
|
209
|
-
return _dirtyMinimumRange === 0 ? _dirtyMaximumRange : Math.max(_dirtyMinimumRange, _dirtyMaximumRange);
|
|
210
|
-
});
|
|
211
|
-
const _decimalPrecision$ = tansu.computed(
|
|
212
|
-
() => Math.max(getDecimalPrecision(stepSize$()), getDecimalPrecision(min$()), getDecimalPrecision(max$()))
|
|
213
|
-
);
|
|
214
|
-
const _intStepSize$ = tansu.computed(() => stepSize$() * Math.pow(10, _decimalPrecision$()));
|
|
215
|
-
let previousValues = _dirtyValues$();
|
|
216
|
-
const values$ = utils_stores.bindableProp(
|
|
217
|
-
_dirtyValues$,
|
|
218
|
-
onValuesChange$,
|
|
219
|
-
(dirtyValues) => {
|
|
220
|
-
const min = min$();
|
|
221
|
-
const max = max$();
|
|
222
|
-
const intStepSize = _intStepSize$();
|
|
223
|
-
const decimalPrecision = _decimalPrecision$();
|
|
224
|
-
const newValues = dirtyValues.map((dv) => computeCleanValue(dv, min, max, intStepSize, decimalPrecision));
|
|
225
|
-
if (dirtyValues.length > 1) {
|
|
226
|
-
const minRange = minRange$();
|
|
227
|
-
const maxRange = maxRange$();
|
|
228
|
-
if (minRange || maxRange) {
|
|
229
|
-
const pushRange = pushRange$();
|
|
230
|
-
const changedIndex = newValues.findIndex((dv, index) => dv !== previousValues[index]);
|
|
231
|
-
if (changedIndex !== -1) {
|
|
232
|
-
manageMinMaxRange(newValues, changedIndex, minRange, maxRange, min, max, pushRange);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
previousValues = newValues;
|
|
237
|
-
return newValues;
|
|
238
|
-
},
|
|
239
|
-
utils_writables.typeArray.equal
|
|
240
|
-
);
|
|
241
|
-
const { directive: sliderDirective, element$: sliderDom$ } = utils_directive.createBrowserStoreDirective();
|
|
242
|
-
const { directive: minLabelDomDirective, element$: minLabelDom$ } = utils_directive.createBrowserStoreDirective();
|
|
243
|
-
const { directive: maxLabelDomDirective, element$: maxLabelDom$ } = utils_directive.createBrowserStoreDirective();
|
|
244
|
-
const { directive: handleLabelDirective, elements$: currentLabelDoms$ } = utils_directive.createBrowserStoreArrayDirective();
|
|
245
|
-
const { directive: resizeDirective, dimensions$ } = services_resizeObserver.createResizeObserver();
|
|
246
|
-
const { directive: resizeLabelsDirective, dimensionsMap$: handleDimensions$ } = services_resizeObserver.createResizeObserverMap();
|
|
247
|
-
const { directive: resizeCombineLabelDirective, dimensions$: combinedDimensions$ } = services_resizeObserver.createResizeObserver();
|
|
248
|
-
const updateSliderSize$ = tansu.writable({});
|
|
249
|
-
const sliderDomRect$ = tansu.computed(
|
|
250
|
-
() => {
|
|
251
|
-
dimensions$();
|
|
252
|
-
updateSliderSize$();
|
|
253
|
-
return sliderDom$()?.getBoundingClientRect() ?? {};
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
equal: Object.is
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
-
const minLabelDomRect$ = tansu.computed(
|
|
260
|
-
() => {
|
|
261
|
-
dimensions$();
|
|
262
|
-
updateSliderSize$();
|
|
263
|
-
return minLabelDom$()?.getBoundingClientRect() ?? {};
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
equal: (a, b) => Object.is(a, b)
|
|
267
|
-
}
|
|
268
|
-
);
|
|
269
|
-
const maxLabelDomRect$ = tansu.computed(
|
|
270
|
-
() => {
|
|
271
|
-
dimensions$();
|
|
272
|
-
updateSliderSize$();
|
|
273
|
-
return maxLabelDom$()?.getBoundingClientRect() ?? {};
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
equal: (a, b) => Object.is(a, b)
|
|
277
|
-
}
|
|
278
|
-
);
|
|
279
|
-
const sliderDomRectOffset$ = tansu.computed(() => sliderDomRect$()[vertical$() ? "top" : "left"]);
|
|
280
|
-
const sliderDomRectSize$ = tansu.computed(() => sliderDomRect$()[vertical$() ? "height" : "width"]);
|
|
281
|
-
const sortedValues$ = tansu.computed(() => [...values$()].sort((a, b) => a - b));
|
|
282
|
-
const _sortedHandlesValues$ = tansu.computed(() => {
|
|
283
|
-
return values$().map((val, index) => {
|
|
284
|
-
return { id: index, value: val };
|
|
285
|
-
}).sort((a, b) => a.value - b.value);
|
|
286
|
-
});
|
|
287
|
-
const sortedHandles$ = tansu.computed(() => {
|
|
288
|
-
const ariaLabelHandle = ariaLabel$(), ariaValueText = ariaValueText$(), ariaLabelledBy = ariaLabelledBy$();
|
|
289
|
-
return _sortedHandlesValues$().map((sortedValue, index) => {
|
|
290
|
-
return {
|
|
291
|
-
...sortedValue,
|
|
292
|
-
ariaLabel: ariaLabelledBy(index) ? void 0 : ariaLabelHandle(index),
|
|
293
|
-
ariaLabelledBy: ariaLabelledBy(index) || void 0,
|
|
294
|
-
ariaValueText: ariaValueText(sortedValue.value, index) || void 0
|
|
295
|
-
};
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
const valuesPercent$ = tansu.computed(() => values$().map((val) => percentCompute(val)));
|
|
299
|
-
const sortedValuesPercent$ = tansu.computed(() => [...valuesPercent$()].sort((a, b) => a - b));
|
|
300
|
-
const activeDimension$ = tansu.computed(() => vertical$() ? "height" : "width");
|
|
301
|
-
const activePosition$ = tansu.computed(() => vertical$() ? "top" : "left");
|
|
302
|
-
const minLabelSize$ = tansu.computed(() => pixelToPercent(minLabelDomRect$()[activeDimension$()]));
|
|
303
|
-
const maxLabelSize$ = tansu.computed(() => pixelToPercent(maxLabelDomRect$()[activeDimension$()]));
|
|
304
|
-
const adjustedShowValueLabels$ = tansu.computed(() => showValueLabels$() && (!showTicks$() || !showTickValues$()));
|
|
305
|
-
const pixelToPercent = (pixels) => pixels ? pixels / sliderDomRectSize$() * 100 : 0;
|
|
306
|
-
const combinedLabelSize$ = tansu.computed(() => pixelToPercent(combinedDimensions$()?.contentRect[activeDimension$()]));
|
|
307
|
-
const combinedLabelPosition$ = tansu.computed(
|
|
308
|
-
() => vertical$() ? combinedLabelPositionTop$() : combinedLabelPositionLeft$()
|
|
309
|
-
);
|
|
310
|
-
const currentLabelSizeByIndex = (index) => pixelToPercent(handleDimensions$().get(currentLabelDoms$()[index])?.contentRect[activeDimension$()]);
|
|
311
|
-
const minValueLabelDisplay$ = tansu.computed(() => {
|
|
312
|
-
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
313
|
-
return false;
|
|
314
|
-
} else if (!showValueLabels$()) {
|
|
315
|
-
return true;
|
|
316
|
-
}
|
|
317
|
-
const minLabelSize = minLabelSize$();
|
|
318
|
-
const vertical = vertical$();
|
|
319
|
-
const rtl = rtl$();
|
|
320
|
-
if (combinedLabelDisplay$()) {
|
|
321
|
-
const combinedLabelSize = combinedLabelSize$();
|
|
322
|
-
const combinedLabelPosition = combinedLabelPosition$();
|
|
323
|
-
return rtl && !vertical || vertical && !rtl ? combinedLabelPosition + combinedLabelSize / 2 < 100 - minLabelSize - 1 : combinedLabelPosition - combinedLabelSize / 2 > minLabelSize + 1;
|
|
324
|
-
}
|
|
325
|
-
const sortedValuesPercent = sortedValuesPercent$();
|
|
326
|
-
return rtl ? sortedValuesPercent[0] - currentLabelSizeByIndex(sortedValuesPercent.length - 1) / 2 > minLabelSize + 1 : sortedValuesPercent[0] - currentLabelSizeByIndex(0) / 2 > minLabelSize + 1;
|
|
327
|
-
});
|
|
328
|
-
const maxValueLabelDisplay$ = tansu.computed(() => {
|
|
329
|
-
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
330
|
-
return false;
|
|
331
|
-
} else if (!showValueLabels$()) {
|
|
332
|
-
return true;
|
|
333
|
-
}
|
|
334
|
-
const maxLabelSize = maxLabelSize$();
|
|
335
|
-
const vertical = vertical$();
|
|
336
|
-
const rtl = rtl$();
|
|
337
|
-
if (combinedLabelDisplay$()) {
|
|
338
|
-
const combinedLabelSize = combinedLabelSize$();
|
|
339
|
-
const combinedLabelPosition = combinedLabelPosition$();
|
|
340
|
-
return rtl && !vertical || vertical && !rtl ? combinedLabelPosition - combinedLabelSize / 2 > maxLabelSize + 1 : combinedLabelPosition + combinedLabelSize / 2 < 100 - maxLabelSize - 1;
|
|
341
|
-
}
|
|
342
|
-
const sortedValuesPercent = sortedValuesPercent$();
|
|
343
|
-
return rtl ? 100 - sortedValuesPercent[sortedValuesPercent.length - 1] - currentLabelSizeByIndex(0) / 2 > maxLabelSize + 1 : sortedValuesPercent[sortedValuesPercent.length - 1] + currentLabelSizeByIndex(sortedValuesPercent.length - 1) / 2 < 100 - maxLabelSize - 1;
|
|
344
|
-
});
|
|
345
|
-
const combinedLabelDisplay$ = tansu.computed(() => {
|
|
346
|
-
if (currentLabelDoms$().length == 2) {
|
|
347
|
-
return doLabelsIntersect();
|
|
348
|
-
}
|
|
349
|
-
return false;
|
|
350
|
-
});
|
|
351
|
-
function doLabelsIntersect() {
|
|
352
|
-
const handleOptions = handleDisplayOptions$();
|
|
353
|
-
const activePosition = activePosition$();
|
|
354
|
-
const labelPosition1 = labelPosition(handleOptions[0][activePosition], currentLabelSizeByIndex(0));
|
|
355
|
-
const labelPosition2 = labelPosition(handleOptions[1][activePosition], currentLabelSizeByIndex(1));
|
|
356
|
-
const labelSize1 = currentLabelSizeByIndex(0);
|
|
357
|
-
const labelSize2 = currentLabelSizeByIndex(1);
|
|
358
|
-
if (labelSize1 === 100 || labelSize2 === 100) {
|
|
359
|
-
return false;
|
|
360
|
-
}
|
|
361
|
-
const labelStart1 = labelPosition1 - labelSize1;
|
|
362
|
-
const labelEnd1 = labelPosition1 + labelSize1;
|
|
363
|
-
const labelStart2 = labelPosition2 - labelSize2;
|
|
364
|
-
const labelEnd2 = labelPosition2 + labelSize2;
|
|
365
|
-
return !(labelEnd1 < labelStart2 || labelStart1 > labelEnd2);
|
|
366
|
-
}
|
|
367
|
-
const interactive$ = tansu.computed(() => !disabled$() && !readonly$());
|
|
368
|
-
const combinedLabelPositionLeft$ = tansu.computed(() => {
|
|
369
|
-
const sortedValuesPercent = sortedValuesPercent$();
|
|
370
|
-
const combinedLabelSize = combinedLabelSize$();
|
|
371
|
-
let combinedPosition = (sortedValuesPercent[0] + sortedValuesPercent[1]) / 2;
|
|
372
|
-
combinedPosition = labelPosition(combinedPosition, combinedLabelSize);
|
|
373
|
-
return vertical$() || sortedValuesPercent.length != 2 ? 0 : rtl$() ? 100 - combinedPosition : combinedPosition;
|
|
374
|
-
});
|
|
375
|
-
const combinedLabelPositionTop$ = tansu.computed(() => {
|
|
376
|
-
const sortedValuesPercent = sortedValuesPercent$();
|
|
377
|
-
const combinedPosition = 100 - (sortedValuesPercent[0] + sortedValuesPercent[1]) / 2;
|
|
378
|
-
return vertical$() && sortedValuesPercent.length == 2 ? rtl$() ? 100 - combinedPosition : combinedPosition : 0;
|
|
379
|
-
});
|
|
380
|
-
const handleDisplayOptions$ = tansu.computed(() => {
|
|
381
|
-
const vertical = vertical$(), rtl = rtl$();
|
|
382
|
-
return valuesPercent$().map((vp) => {
|
|
383
|
-
return {
|
|
384
|
-
left: rtl ? vertical ? null : 100 - vp : vertical ? null : vp,
|
|
385
|
-
top: rtl ? vertical ? vp : null : vertical ? 100 - vp : null
|
|
386
|
-
};
|
|
387
|
-
});
|
|
388
|
-
});
|
|
389
|
-
const labelPosition = (initialPosition, labelSize) => utils_writables.clamp(initialPosition, 100 - labelSize / 2, labelSize / 2);
|
|
390
|
-
const progressDisplayOptions$ = tansu.computed(() => {
|
|
391
|
-
const vertical = vertical$(), sortedValuesPercent = sortedValuesPercent$(), rtl = rtl$();
|
|
392
|
-
if (sortedValuesPercent.length === 1) {
|
|
393
|
-
return [
|
|
394
|
-
{
|
|
395
|
-
left: vertical ? null : rtl ? null : 0,
|
|
396
|
-
right: vertical ? null : rtl ? 0 : null,
|
|
397
|
-
bottom: vertical ? rtl ? null : 0 : null,
|
|
398
|
-
top: vertical ? rtl ? 0 : null : null,
|
|
399
|
-
width: vertical ? 100 : sortedValuesPercent[0],
|
|
400
|
-
height: vertical ? sortedValuesPercent[0] : 100,
|
|
401
|
-
id: 0
|
|
402
|
-
}
|
|
403
|
-
];
|
|
404
|
-
} else {
|
|
405
|
-
return sortedValuesPercent.map((svp, index, array) => {
|
|
406
|
-
return {
|
|
407
|
-
left: vertical ? null : rtl ? null : svp,
|
|
408
|
-
right: vertical ? null : rtl ? array[index] : null,
|
|
409
|
-
bottom: vertical ? rtl ? null : svp : null,
|
|
410
|
-
top: vertical ? rtl ? array[index] : null : null,
|
|
411
|
-
width: vertical ? 100 : index === array.length - 1 ? svp : array[index + 1] - svp,
|
|
412
|
-
height: vertical ? index === array.length - 1 ? svp : array[index + 1] - svp : 100,
|
|
413
|
-
id: index
|
|
414
|
-
};
|
|
415
|
-
}).slice(0, sortedValuesPercent.length - 1);
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
const computeTicks$ = tansu.computed(() => {
|
|
419
|
-
if (!showTicks$()) {
|
|
420
|
-
return [];
|
|
421
|
-
}
|
|
422
|
-
const vertical = vertical$();
|
|
423
|
-
const min = min$();
|
|
424
|
-
const max = max$();
|
|
425
|
-
const rtl = rtl$();
|
|
426
|
-
const showTickValues = showTickValues$();
|
|
427
|
-
const tickInterval = tickInterval$() || stepSize$();
|
|
428
|
-
const tickArray = [];
|
|
429
|
-
const intStepSize = _intStepSize$();
|
|
430
|
-
const decimalPrecision = _decimalPrecision$();
|
|
431
|
-
const positionCompute = (position) => {
|
|
432
|
-
return !!rtl !== !!vertical ? 100 - position : position;
|
|
433
|
-
};
|
|
434
|
-
for (let step = min; step < max; step += tickInterval) {
|
|
435
|
-
const cleanValue = computeCleanValue(step, min, max, intStepSize, decimalPrecision);
|
|
436
|
-
const stepPercent = percentCompute(cleanValue);
|
|
437
|
-
tickArray.push({
|
|
438
|
-
position: positionCompute(stepPercent),
|
|
439
|
-
selected: false,
|
|
440
|
-
value: cleanValue,
|
|
441
|
-
displayLabel: showTickValues
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
tickArray.push({ position: positionCompute(100), selected: false, value: max, displayLabel: showTickValues });
|
|
445
|
-
return tickArray;
|
|
446
|
-
});
|
|
447
|
-
const ticks$ = tansu.computed(() => {
|
|
448
|
-
const sortedValues = sortedValues$();
|
|
449
|
-
const isTickSelected = (value) => {
|
|
450
|
-
const isMultiHandle = sortedValues.length > 1;
|
|
451
|
-
const currentMax = isMultiHandle ? sortedValues[sortedValues.length - 1] : sortedValues[0];
|
|
452
|
-
const currentMin = isMultiHandle ? sortedValues[0] : 0;
|
|
453
|
-
return value <= currentMax && value >= currentMin;
|
|
454
|
-
};
|
|
455
|
-
return computeTicks$().map((tick) => {
|
|
456
|
-
return {
|
|
457
|
-
...tick,
|
|
458
|
-
selected: isTickSelected(tick.value)
|
|
459
|
-
};
|
|
460
|
-
});
|
|
461
|
-
});
|
|
462
|
-
const percentCompute = (value) => {
|
|
463
|
-
const min = min$(), max = max$();
|
|
464
|
-
return (value - min) * 100 / (max - min);
|
|
465
|
-
};
|
|
466
|
-
const getClosestSliderHandle = (clickedPercent) => {
|
|
467
|
-
const values = values$();
|
|
468
|
-
if (values.length === 1) {
|
|
469
|
-
return 0;
|
|
470
|
-
}
|
|
471
|
-
const sortedValues = sortedValues$();
|
|
472
|
-
const closestBigger = sortedValues.find((sv) => percentCompute(sv) > clickedPercent * 100);
|
|
473
|
-
const closestBiggerIndex = closestBigger ? sortedValues.indexOf(closestBigger) : sortedValues.length - 1;
|
|
474
|
-
const midPoint = percentCompute(
|
|
475
|
-
sortedValues[closestBiggerIndex - 1] + (sortedValues[closestBiggerIndex] - sortedValues[closestBiggerIndex - 1]) / 2
|
|
476
|
-
);
|
|
477
|
-
const closestValue = sortedValues[clickedPercent * 100 <= midPoint ? closestBiggerIndex - 1 : closestBiggerIndex];
|
|
478
|
-
return values.indexOf(closestValue);
|
|
479
|
-
};
|
|
480
|
-
const getClickedPercent = (clickedCoordinate) => {
|
|
481
|
-
const sliderDomRectSize = sliderDomRectSize$(), sliderDomRectOffset = sliderDomRectOffset$();
|
|
482
|
-
let clickedPercent = vertical$() ? (sliderDomRectSize - clickedCoordinate + sliderDomRectOffset) / sliderDomRectSize : (clickedCoordinate - sliderDomRectOffset) / sliderDomRectSize;
|
|
483
|
-
clickedPercent = rtl$() ? 1 - clickedPercent : clickedPercent;
|
|
484
|
-
return clickedPercent;
|
|
485
|
-
};
|
|
486
|
-
const adjustCoordinate = (clickedCoordinate, handleNumber) => {
|
|
487
|
-
if (interactive$()) {
|
|
488
|
-
const clickedPercent = getClickedPercent(clickedCoordinate);
|
|
489
|
-
const derivedHandleIndex = handleNumber ?? getClosestSliderHandle(clickedPercent);
|
|
490
|
-
const newValue = clickedPercent * (max$() - min$()) + min$();
|
|
491
|
-
values$.update((dh) => {
|
|
492
|
-
dh = [...dh];
|
|
493
|
-
dh[derivedHandleIndex] = newValue;
|
|
494
|
-
return dh;
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
const horizontal$ = tansu.computed(() => !vertical$());
|
|
499
|
-
const containerDirective = utils_directive.createAttributesDirective(() => ({
|
|
500
|
-
classNames: {
|
|
501
|
-
"au-slider": utils_stores.true$,
|
|
502
|
-
"au-slider-vertical": vertical$,
|
|
503
|
-
"au-slider-horizontal": horizontal$
|
|
504
|
-
},
|
|
505
|
-
attributes: {
|
|
506
|
-
class: stateProps.className$
|
|
507
|
-
}
|
|
508
|
-
}));
|
|
509
|
-
const contentDirective = utils_directive.createAttributesDirective(() => ({
|
|
510
|
-
attributes: {
|
|
511
|
-
"aria-disabled": tansu.computed(() => disabled$() ? "true" : void 0),
|
|
512
|
-
class: stateProps.className$
|
|
513
|
-
},
|
|
514
|
-
classNames: {
|
|
515
|
-
"au-slider-content": utils_stores.true$,
|
|
516
|
-
"au-slider-vertical": vertical$,
|
|
517
|
-
"au-slider-horizontal": horizontal$,
|
|
518
|
-
"au-slider-with-labels": tansu.computed(
|
|
519
|
-
() => showValueLabels$() || showMinMaxLabels$() || showTickValues$() && showTicks$()
|
|
520
|
-
),
|
|
521
|
-
disabled: disabled$
|
|
522
|
-
}
|
|
523
|
-
}));
|
|
524
|
-
const minLabelDirective = utils_directive.createAttributesDirective(() => ({
|
|
525
|
-
classNames: {
|
|
526
|
-
"au-slider-label-vertical": vertical$,
|
|
527
|
-
"au-slider-label-vertical-min": vertical$,
|
|
528
|
-
"au-slider-label": horizontal$,
|
|
529
|
-
"au-slider-label-min": horizontal$,
|
|
530
|
-
"au-slider-rtl": rtl$,
|
|
531
|
-
invisible: tansu.computed(() => !minValueLabelDisplay$())
|
|
532
|
-
},
|
|
533
|
-
attributes: {
|
|
534
|
-
"aria-hidden": tansu.readable("true")
|
|
535
|
-
}
|
|
536
|
-
}));
|
|
537
|
-
const maxLabelDirective = utils_directive.createAttributesDirective(() => ({
|
|
538
|
-
classNames: {
|
|
539
|
-
"au-slider-label-vertical": vertical$,
|
|
540
|
-
"au-slider-label-vertical-max": vertical$,
|
|
541
|
-
"au-slider-label": horizontal$,
|
|
542
|
-
"au-slider-label-max": horizontal$,
|
|
543
|
-
"au-slider-rtl": rtl$,
|
|
544
|
-
invisible: tansu.computed(() => !maxValueLabelDisplay$())
|
|
545
|
-
},
|
|
546
|
-
attributes: {
|
|
547
|
-
"aria-hidden": tansu.readable("true")
|
|
548
|
-
}
|
|
549
|
-
}));
|
|
550
|
-
const handleElementDirective = utils_directive.browserDirective(
|
|
551
|
-
(handleItem, args) => {
|
|
552
|
-
const destroy = () => {
|
|
553
|
-
_handleElements.delete(args.item.id);
|
|
554
|
-
};
|
|
555
|
-
const update = (args2) => {
|
|
556
|
-
_handleElements.set(args2.item.id, handleItem);
|
|
557
|
-
};
|
|
558
|
-
update(args);
|
|
559
|
-
return {
|
|
560
|
-
update,
|
|
561
|
-
destroy
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
);
|
|
565
|
-
const pointerMoveStart = (event, handleId) => {
|
|
566
|
-
const currentTarget = handleId !== void 0 ? _handleElements.get(handleId) : event.target;
|
|
567
|
-
if (interactive$()) {
|
|
568
|
-
const vertical = vertical$();
|
|
569
|
-
const clientXorY = vertical ? "clientY" : "clientX";
|
|
570
|
-
let _prevCoordinate = event[clientXorY];
|
|
571
|
-
updateSliderSize$.set({});
|
|
572
|
-
currentTarget?.focus();
|
|
573
|
-
return {
|
|
574
|
-
onMove: (event2) => {
|
|
575
|
-
currentTarget?.focus();
|
|
576
|
-
const newCoord = event2[clientXorY];
|
|
577
|
-
if (_prevCoordinate !== newCoord) {
|
|
578
|
-
_prevCoordinate = newCoord;
|
|
579
|
-
adjustCoordinate(newCoord, handleId);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
return void 0;
|
|
585
|
-
};
|
|
586
|
-
const handleEventsDirective = utils_directive.mergeDirectives(
|
|
587
|
-
utils_directive.createAttributesDirective((handleContext$) => ({
|
|
588
|
-
events: {
|
|
589
|
-
keydown: (event) => {
|
|
590
|
-
const handleIndex = handleContext$().item.id;
|
|
591
|
-
const { key } = event;
|
|
592
|
-
const rtl = rtl$(), stepSize = stepSize$(), min = min$(), max = max$(), vertical = vertical$();
|
|
593
|
-
if (interactive$()) {
|
|
594
|
-
switch (key) {
|
|
595
|
-
case "ArrowDown":
|
|
596
|
-
updateValue(handleIndex, values$, stepSize, getUpdateDirection(vertical, rtl, true));
|
|
597
|
-
break;
|
|
598
|
-
case "ArrowLeft":
|
|
599
|
-
updateValue(handleIndex, values$, stepSize, getUpdateDirection(vertical, rtl, false));
|
|
600
|
-
break;
|
|
601
|
-
case "ArrowUp":
|
|
602
|
-
updateValue(handleIndex, values$, stepSize, -1 * getUpdateDirection(vertical, rtl, true));
|
|
603
|
-
break;
|
|
604
|
-
case "ArrowRight":
|
|
605
|
-
updateValue(handleIndex, values$, stepSize, -1 * getUpdateDirection(vertical, rtl, false));
|
|
606
|
-
break;
|
|
607
|
-
case "Home":
|
|
608
|
-
values$.update((value) => {
|
|
609
|
-
value = [...value];
|
|
610
|
-
value[handleIndex] = min;
|
|
611
|
-
return value;
|
|
612
|
-
});
|
|
613
|
-
break;
|
|
614
|
-
case "End":
|
|
615
|
-
values$.update((value) => {
|
|
616
|
-
value = [...value];
|
|
617
|
-
value[handleIndex] = max;
|
|
618
|
-
return value;
|
|
619
|
-
});
|
|
620
|
-
break;
|
|
621
|
-
case "PageUp":
|
|
622
|
-
break;
|
|
623
|
-
case "PageDown":
|
|
624
|
-
break;
|
|
625
|
-
default:
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
event.preventDefault();
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
})),
|
|
633
|
-
services_pointerdownPosition.createPointerdownPositionDirective(
|
|
634
|
-
(position, { item: { id } }) => pointerMoveStart(position, id)
|
|
635
|
-
)
|
|
636
|
-
);
|
|
637
|
-
const widget = {
|
|
638
|
-
...utils_stores.stateStores({
|
|
639
|
-
min$,
|
|
640
|
-
max$,
|
|
641
|
-
stepSize$,
|
|
642
|
-
values$,
|
|
643
|
-
sortedValues$,
|
|
644
|
-
sortedHandles$,
|
|
645
|
-
minValueLabelDisplay$,
|
|
646
|
-
maxValueLabelDisplay$,
|
|
647
|
-
combinedLabelDisplay$,
|
|
648
|
-
interactive$,
|
|
649
|
-
combinedLabelPositionLeft$,
|
|
650
|
-
combinedLabelPositionTop$,
|
|
651
|
-
progressDisplayOptions$,
|
|
652
|
-
handleDisplayOptions$,
|
|
653
|
-
showValueLabels$: adjustedShowValueLabels$,
|
|
654
|
-
showMinMaxLabels$,
|
|
655
|
-
showTicks$,
|
|
656
|
-
rtl$,
|
|
657
|
-
ticks$,
|
|
658
|
-
...stateProps
|
|
659
|
-
}),
|
|
660
|
-
patch,
|
|
661
|
-
api: {},
|
|
662
|
-
directives: {
|
|
663
|
-
sliderDirective: utils_directive.mergeDirectives(sliderDirective, resizeDirective, contentDirective),
|
|
664
|
-
containerDirective,
|
|
665
|
-
progressDisplayDirective: utils_directive.createAttributesDirective(
|
|
666
|
-
(progressContext$) => ({
|
|
667
|
-
styles: {
|
|
668
|
-
left: tansu.computed(() => percent(progressContext$().option.left)),
|
|
669
|
-
right: tansu.computed(() => percent(progressContext$().option.right)),
|
|
670
|
-
top: tansu.computed(() => percent(progressContext$().option.top)),
|
|
671
|
-
bottom: tansu.computed(() => percent(progressContext$().option.bottom)),
|
|
672
|
-
width: tansu.computed(() => percent(progressContext$().option.width)),
|
|
673
|
-
height: tansu.computed(() => percent(progressContext$().option.height))
|
|
674
|
-
},
|
|
675
|
-
classNames: {
|
|
676
|
-
"au-slider-progress": utils_stores.true$
|
|
677
|
-
}
|
|
678
|
-
})
|
|
679
|
-
),
|
|
680
|
-
clickableAreaDirective: utils_directive.mergeDirectives(
|
|
681
|
-
utils_directive.createAttributesDirective(() => ({
|
|
682
|
-
classNames: {
|
|
683
|
-
"au-slider-clickable-area": horizontal$,
|
|
684
|
-
"au-slider-clickable-area-vertical": vertical$,
|
|
685
|
-
"au-slider-clickable-area-with-ticks": tansu.computed(() => showTicks$() && tickInterval$() === 0)
|
|
686
|
-
}
|
|
687
|
-
})),
|
|
688
|
-
services_pointerdownPosition.createPointerdownPositionDirective((position) => {
|
|
689
|
-
const clickedCoordinate = vertical$() ? position.clientY : position.clientX;
|
|
690
|
-
const closestHandle = getClosestSliderHandle(getClickedPercent(clickedCoordinate));
|
|
691
|
-
adjustCoordinate(clickedCoordinate, closestHandle);
|
|
692
|
-
return pointerMoveStart(position, closestHandle);
|
|
693
|
-
})
|
|
694
|
-
),
|
|
695
|
-
handleEventsDirective,
|
|
696
|
-
handleDirective: utils_directive.mergeDirectives(
|
|
697
|
-
handleElementDirective,
|
|
698
|
-
handleEventsDirective,
|
|
699
|
-
utils_directive.createAttributesDirective((handleContext$) => ({
|
|
700
|
-
attributes: {
|
|
701
|
-
role: tansu.readable("slider"),
|
|
702
|
-
"aria-valuemin": min$,
|
|
703
|
-
"aria-valuemax": max$,
|
|
704
|
-
"aria-valuenow": tansu.computed(() => handleContext$().item.value),
|
|
705
|
-
"aria-valuetext": tansu.computed(() => handleContext$().item.ariaValueText),
|
|
706
|
-
"aria-label": tansu.computed(() => handleContext$().item.ariaLabel),
|
|
707
|
-
"aria-labelledBy": tansu.computed(() => handleContext$().item.ariaLabelledBy),
|
|
708
|
-
"aria-orientation": tansu.computed(() => vertical$() ? "vertical" : void 0),
|
|
709
|
-
"aria-disabled": tansu.computed(() => disabled$() ? "true" : void 0),
|
|
710
|
-
disabled: disabled$,
|
|
711
|
-
"aria-readonly": tansu.computed(() => readonly$() ? "true" : void 0)
|
|
712
|
-
},
|
|
713
|
-
styles: {
|
|
714
|
-
left: tansu.computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].left)),
|
|
715
|
-
top: tansu.computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].top))
|
|
716
|
-
},
|
|
717
|
-
classNames: {
|
|
718
|
-
"au-slider-handle": utils_stores.true$,
|
|
719
|
-
"au-slider-handle-vertical": vertical$,
|
|
720
|
-
"au-slider-handle-horizontal": horizontal$
|
|
721
|
-
}
|
|
722
|
-
}))
|
|
723
|
-
),
|
|
724
|
-
minLabelDirective: utils_directive.mergeDirectives(minLabelDomDirective, minLabelDirective),
|
|
725
|
-
maxLabelDirective: utils_directive.mergeDirectives(maxLabelDomDirective, maxLabelDirective),
|
|
726
|
-
combinedHandleLabelDisplayDirective: utils_directive.mergeDirectives(
|
|
727
|
-
resizeCombineLabelDirective,
|
|
728
|
-
utils_directive.createAttributesDirective(() => ({
|
|
729
|
-
classNames: {
|
|
730
|
-
"au-slider-label-vertical": vertical$,
|
|
731
|
-
"au-slider-label-vertical-now": vertical$,
|
|
732
|
-
"au-slider-label": horizontal$,
|
|
733
|
-
"au-slider-label-now": horizontal$
|
|
734
|
-
},
|
|
735
|
-
styles: {
|
|
736
|
-
left: tansu.computed(() => percent(combinedLabelPositionLeft$())),
|
|
737
|
-
top: tansu.computed(() => percent(combinedLabelPositionTop$()))
|
|
738
|
-
},
|
|
739
|
-
attributes: {
|
|
740
|
-
"aria-hidden": tansu.readable("true")
|
|
741
|
-
}
|
|
742
|
-
}))
|
|
743
|
-
),
|
|
744
|
-
handleLabelDisplayDirective: utils_directive.mergeDirectives(
|
|
745
|
-
handleLabelDirective,
|
|
746
|
-
resizeLabelsDirective,
|
|
747
|
-
utils_directive.createAttributesDirective((labelDisplayContext$) => ({
|
|
748
|
-
classNames: {
|
|
749
|
-
"au-slider-label-vertical": vertical$,
|
|
750
|
-
"au-slider-label-vertical-now": vertical$,
|
|
751
|
-
"au-slider-label": horizontal$,
|
|
752
|
-
"au-slider-label-now": horizontal$
|
|
753
|
-
},
|
|
754
|
-
styles: {
|
|
755
|
-
left: tansu.computed(() => {
|
|
756
|
-
const handleIndex = labelDisplayContext$().index;
|
|
757
|
-
const leftPosition = handleDisplayOptions$()[handleIndex].left;
|
|
758
|
-
return leftPosition === null ? "" : percent(labelPosition(leftPosition, currentLabelSizeByIndex(handleIndex)));
|
|
759
|
-
}),
|
|
760
|
-
top: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].top)),
|
|
761
|
-
opacity: tansu.computed(() => combinedLabelDisplay$() ? "0" : "1")
|
|
762
|
-
},
|
|
763
|
-
attributes: {
|
|
764
|
-
"aria-hidden": tansu.readable("true")
|
|
765
|
-
}
|
|
766
|
-
}))
|
|
767
|
-
),
|
|
768
|
-
tickDirective: utils_directive.createAttributesDirective((tickContext$) => ({
|
|
769
|
-
classNames: {
|
|
770
|
-
"au-slider-tick": utils_stores.true$,
|
|
771
|
-
"au-slider-tick-horizontal": horizontal$,
|
|
772
|
-
"au-slider-tick-vertical": vertical$
|
|
773
|
-
},
|
|
774
|
-
styles: {
|
|
775
|
-
left: tansu.computed(() => vertical$() ? null : percent(tickContext$().tick.position)),
|
|
776
|
-
top: tansu.computed(() => vertical$() ? percent(tickContext$().tick.position) : null)
|
|
777
|
-
},
|
|
778
|
-
events: {
|
|
779
|
-
click: (event) => {
|
|
780
|
-
adjustCoordinate(vertical$() ? event.clientY : event.clientX);
|
|
781
|
-
}
|
|
782
|
-
},
|
|
783
|
-
attributes: {
|
|
784
|
-
"aria-hidden": tansu.readable("true")
|
|
785
|
-
}
|
|
786
|
-
})),
|
|
787
|
-
tickLabelDirective: utils_directive.createAttributesDirective((tickContext$) => ({
|
|
788
|
-
classNames: {
|
|
789
|
-
"au-slider-tick-label": utils_stores.true$,
|
|
790
|
-
"au-slider-tick-label-vertical": vertical$,
|
|
791
|
-
"au-slider-tick-label-now": tansu.computed(() => sortedValues$().some((sv) => sv === tickContext$().tick.value))
|
|
792
|
-
},
|
|
793
|
-
styles: {
|
|
794
|
-
left: tansu.computed(() => vertical$() ? null : percent(tickContext$().tick.position)),
|
|
795
|
-
top: tansu.computed(() => vertical$() ? percent(tickContext$().tick.position) : null)
|
|
796
|
-
},
|
|
797
|
-
attributes: {
|
|
798
|
-
"aria-hidden": tansu.readable("true")
|
|
799
|
-
}
|
|
800
|
-
}))
|
|
801
|
-
}
|
|
802
|
-
};
|
|
803
|
-
return widget;
|
|
804
|
-
}
|
|
805
|
-
);
|
|
806
|
-
exports.createSlider = createSlider;
|
|
807
|
-
exports.getSliderDefaultConfig = getSliderDefaultConfig;
|