@budibase/bbui 3.39.25 → 3.39.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bbui.mjs +32 -21
- package/package.json +2 -2
- package/src/Form/Core/DatePicker/Calendar.svelte +50 -1
package/dist/bbui.mjs
CHANGED
|
@@ -47163,8 +47163,19 @@ function Calendar(l, u) {
|
|
|
47163
47163
|
max: 9999,
|
|
47164
47164
|
pad: 0,
|
|
47165
47165
|
fallback: E.year()
|
|
47166
|
-
})
|
|
47167
|
-
|
|
47166
|
+
}), z = 40, B = !1, V, H = 0, U = 0, W = (l) => {
|
|
47167
|
+
set(D, l ? get$2(D).add(1, "month") : get$2(D).subtract(1, "month"));
|
|
47168
|
+
}, K = (l) => {
|
|
47169
|
+
if (B) return;
|
|
47170
|
+
let u = l.deltaY || l.deltaX;
|
|
47171
|
+
u && (B = !0, V = setTimeout(() => B = !1, 120), W(u > 0));
|
|
47172
|
+
}, q = (l) => {
|
|
47173
|
+
H = l.changedTouches[0].clientX, U = l.changedTouches[0].clientY;
|
|
47174
|
+
}, J = (l) => {
|
|
47175
|
+
let u = l.changedTouches[0].clientX - H, f = l.changedTouches[0].clientY - U;
|
|
47176
|
+
Math.abs(u) > 40 && Math.abs(u) > Math.abs(f) && W(u < 0);
|
|
47177
|
+
};
|
|
47178
|
+
onDestroy(() => clearTimeout(V)), legacy_pre_effect(() => deep_read_state(v()), () => {
|
|
47168
47179
|
set(D, (0, import_dayjs_min.default)(v() || (0, import_dayjs_min.default)()).startOf("month"));
|
|
47169
47180
|
}), legacy_pre_effect(() => deep_read_state(y()), () => {
|
|
47170
47181
|
set(f, k(y()));
|
|
@@ -47176,12 +47187,12 @@ function Calendar(l, u) {
|
|
|
47176
47187
|
value: u
|
|
47177
47188
|
})));
|
|
47178
47189
|
}), legacy_pre_effect_reset();
|
|
47179
|
-
var
|
|
47190
|
+
var Y = { setDate: L };
|
|
47180
47191
|
init$1();
|
|
47181
|
-
var
|
|
47192
|
+
var X = root$73(), Z = child(X), Q = child(Z), ee = child(Q), ne = child(ee);
|
|
47182
47193
|
{
|
|
47183
47194
|
let l = /* @__PURE__ */ derived_safe_equal(() => (deep_read_state(b()), untrack(() => b()?.datePickerPlaceholder))), u = /* @__PURE__ */ derived_safe_equal(() => (get$2(D), untrack(() => get$2(D).month())));
|
|
47184
|
-
Select_1(
|
|
47195
|
+
Select_1(ne, {
|
|
47185
47196
|
autoWidth: !0,
|
|
47186
47197
|
get placeholder() {
|
|
47187
47198
|
return get$2(l);
|
|
@@ -47195,11 +47206,11 @@ function Calendar(l, u) {
|
|
|
47195
47206
|
$$events: { change: (l) => set(D, get$2(D).month(l.detail)) }
|
|
47196
47207
|
});
|
|
47197
47208
|
}
|
|
47198
|
-
reset(
|
|
47199
|
-
var
|
|
47209
|
+
reset(ee);
|
|
47210
|
+
var $ = sibling(ee, 2);
|
|
47200
47211
|
{
|
|
47201
47212
|
let l = /* @__PURE__ */ derived_safe_equal(() => (get$2(D), untrack(() => get$2(D).year())));
|
|
47202
|
-
NumberInput(
|
|
47213
|
+
NumberInput($, {
|
|
47203
47214
|
get value() {
|
|
47204
47215
|
return get$2(l);
|
|
47205
47216
|
},
|
|
@@ -47212,28 +47223,28 @@ function Calendar(l, u) {
|
|
|
47212
47223
|
}
|
|
47213
47224
|
});
|
|
47214
47225
|
}
|
|
47215
|
-
reset(
|
|
47216
|
-
var
|
|
47217
|
-
Icon(child(
|
|
47226
|
+
reset(Q);
|
|
47227
|
+
var re = sibling(Q, 2);
|
|
47228
|
+
Icon(child(re), {
|
|
47218
47229
|
name: "caret-left",
|
|
47219
47230
|
weight: "bold",
|
|
47220
47231
|
size: "S"
|
|
47221
|
-
}), reset(
|
|
47222
|
-
var
|
|
47223
|
-
Icon(child(
|
|
47232
|
+
}), reset(re);
|
|
47233
|
+
var ie = sibling(re, 2);
|
|
47234
|
+
Icon(child(ie), {
|
|
47224
47235
|
name: "caret-right",
|
|
47225
47236
|
weight: "bold",
|
|
47226
47237
|
size: "S"
|
|
47227
|
-
}), reset(
|
|
47228
|
-
var
|
|
47229
|
-
each$1(
|
|
47238
|
+
}), reset(ie), reset(Z);
|
|
47239
|
+
var ae = sibling(Z, 2), oe = child(ae), ce = child(oe), le = child(ce);
|
|
47240
|
+
each$1(le, 5, () => get$2(f), index, (l, u) => {
|
|
47230
47241
|
var f = root_1$38(), p = child(f), m = child(p, !0);
|
|
47231
47242
|
reset(p), reset(f), template_effect((l, u) => {
|
|
47232
47243
|
set_attribute(p, "title", l), set_text(m, u);
|
|
47233
47244
|
}, [() => (get$2(u), untrack(() => j(get$2(u)))), () => (get$2(u), untrack(() => j(get$2(u))[0]))]), append$1(l, f);
|
|
47234
|
-
}), reset(
|
|
47235
|
-
var
|
|
47236
|
-
return each$1(
|
|
47245
|
+
}), reset(le), reset(ce);
|
|
47246
|
+
var ue = sibling(ce);
|
|
47247
|
+
return each$1(ue, 5, () => get$2(p), index, (l, u) => {
|
|
47237
47248
|
var f = root_2$24();
|
|
47238
47249
|
each$1(f, 4, () => [
|
|
47239
47250
|
0,
|
|
@@ -47260,7 +47271,7 @@ function Calendar(l, u) {
|
|
|
47260
47271
|
() => (deep_read_state(get$2(p)), untrack(() => get$2(p).date()))
|
|
47261
47272
|
]), event("click", y, () => F(get$2(p))), append$1(l, y);
|
|
47262
47273
|
}), reset(f), append$1(l, f);
|
|
47263
|
-
}), reset(
|
|
47274
|
+
}), reset(ue), reset(oe), reset(ae), reset(X), event("click", re, () => set(D, get$2(D).subtract(1, "month"))), event("click", ie, () => set(D, get$2(D).add(1, "month"))), event("wheel", ae, preventDefault(K)), event("touchstart", ae, q), event("touchend", ae, J), append$1(l, X), bind_prop(u, "setDate", L), pop(Y);
|
|
47264
47275
|
}
|
|
47265
47276
|
//#endregion
|
|
47266
47277
|
//#region src/Tooltip/Tooltip.svelte
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/bbui",
|
|
3
3
|
"description": "A UI solution used in the different Budibase projects.",
|
|
4
|
-
"version": "3.39.
|
|
4
|
+
"version": "3.39.27",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"module": "dist/bbui.mjs",
|
|
7
7
|
"exports": {
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "e7d16cc7fdea9a4a9f4d53b392b6fe790051afb3"
|
|
109
109
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Select from "../../Select.svelte"
|
|
4
4
|
import dayjs from "dayjs"
|
|
5
5
|
import NumberInput from "./NumberInput.svelte"
|
|
6
|
-
import { createEventDispatcher } from "svelte"
|
|
6
|
+
import { createEventDispatcher, onDestroy } from "svelte"
|
|
7
7
|
import Icon from "../../../Icon/Icon.svelte"
|
|
8
8
|
import { resolveTranslationGroup } from "@budibase/shared-core"
|
|
9
9
|
|
|
@@ -116,6 +116,51 @@
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
const cleanYear = cleanInput({ max: 9999, pad: 0, fallback: now.year() })
|
|
119
|
+
|
|
120
|
+
// Scroll (desktop) or horizontal swipe (touch) over the calendar to move
|
|
121
|
+
// between months.
|
|
122
|
+
const SWIPE_THRESHOLD = 40
|
|
123
|
+
let wheelLock = false
|
|
124
|
+
let wheelTimer
|
|
125
|
+
let touchStartX = 0
|
|
126
|
+
let touchStartY = 0
|
|
127
|
+
|
|
128
|
+
const changeMonth = forward => {
|
|
129
|
+
calendarDate = forward
|
|
130
|
+
? calendarDate.add(1, "month")
|
|
131
|
+
: calendarDate.subtract(1, "month")
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// A short lock keeps a single trackpad gesture from skipping many months
|
|
135
|
+
const handleWheel = e => {
|
|
136
|
+
if (wheelLock) {
|
|
137
|
+
return
|
|
138
|
+
}
|
|
139
|
+
const delta = e.deltaY || e.deltaX
|
|
140
|
+
if (!delta) {
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
wheelLock = true
|
|
144
|
+
wheelTimer = setTimeout(() => (wheelLock = false), 120)
|
|
145
|
+
changeMonth(delta > 0)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const handleTouchStart = e => {
|
|
149
|
+
touchStartX = e.changedTouches[0].clientX
|
|
150
|
+
touchStartY = e.changedTouches[0].clientY
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Only a clear horizontal swipe changes month - vertical stays a normal
|
|
154
|
+
// scroll and small movements remain taps so date selection keeps working
|
|
155
|
+
const handleTouchEnd = e => {
|
|
156
|
+
const dx = e.changedTouches[0].clientX - touchStartX
|
|
157
|
+
const dy = e.changedTouches[0].clientY - touchStartY
|
|
158
|
+
if (Math.abs(dx) > SWIPE_THRESHOLD && Math.abs(dx) > Math.abs(dy)) {
|
|
159
|
+
changeMonth(dx < 0)
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
onDestroy(() => clearTimeout(wheelTimer))
|
|
119
164
|
</script>
|
|
120
165
|
|
|
121
166
|
<div class="spectrum-Calendar">
|
|
@@ -160,10 +205,14 @@
|
|
|
160
205
|
<Icon name="caret-right" weight="bold" size="S" />
|
|
161
206
|
</button>
|
|
162
207
|
</div>
|
|
208
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
163
209
|
<div
|
|
164
210
|
class="spectrum-Calendar-body"
|
|
165
211
|
aria-readonly="true"
|
|
166
212
|
aria-disabled="false"
|
|
213
|
+
on:wheel|preventDefault={handleWheel}
|
|
214
|
+
on:touchstart={handleTouchStart}
|
|
215
|
+
on:touchend={handleTouchEnd}
|
|
167
216
|
>
|
|
168
217
|
<table role="presentation" class="spectrum-Calendar-table">
|
|
169
218
|
<thead role="presentation">
|