@emuanalytics/flow-rdf-ui 4.1.28 → 4.2.1

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { FlowCoreMap } from '@emuanalytics/flow-rdf-core';
2
2
  import * as lit_html from 'lit-html';
3
3
  import * as lit from 'lit';
4
- import { LitElement, CSSResultGroup, ReactiveController, ReactiveControllerHost, TemplateResult, PropertyValueMap } from 'lit';
4
+ import { LitElement, CSSResultGroup, ReactiveController, ReactiveControllerHost, TemplateResult, PropertyValues, PropertyValueMap } from 'lit';
5
5
  import * as chartjs_chart_matrix from 'chartjs-chart-matrix';
6
6
  import * as chart_js from 'chart.js';
7
7
  import { ChartComponentLike, Chart, ChartTypeRegistry, ChartOptions, ChartData, Plugin } from 'chart.js';
@@ -852,6 +852,9 @@ interface Translation extends Translation$1 {
852
852
  close: string;
853
853
  copy: string;
854
854
  currentValue: string;
855
+ dateAfterMax: (max: string) => string;
856
+ dateBeforeMin: (min: string) => string;
857
+ dateRangeTooLong: (maxRange: string) => string;
855
858
  goToSlide: (slide: number, count: number) => string;
856
859
  hidePassword: string;
857
860
  loading: string;
@@ -859,6 +862,8 @@ interface Translation extends Translation$1 {
859
862
  numOptionsSelected: (num: number) => string;
860
863
  previousSlide: string;
861
864
  progress: string;
865
+ rangeEndTime: string;
866
+ rangeStartTime: string;
862
867
  remove: string;
863
868
  resize: string;
864
869
  scrollToEnd: string;
@@ -1336,6 +1341,8 @@ interface FlowQueryBuilderRuleSet {
1336
1341
  * - `!like`: `<field>` does not matched a wildcard pattern `<value>`. (string fields only)
1337
1342
  * - `regex`: `<field>` matches a regular expression pattern `<value>`. (string fields only)
1338
1343
  * - `!regex`: `<field>` does not match a regular expression pattern `<value>`. (string fields only)
1344
+ * - `between`: `<field>` is greater than or equal to `<value>[0]` and less than `<value>[1]`. `<value>` is an array of
1345
+ * two ISO8601 date/time strings. (date, time and datetime fields only)
1339
1346
  *
1340
1347
  * Wildcard patterns use `*` to match any sequence of characters and `?` to match any single character.
1341
1348
  *
@@ -1375,9 +1382,10 @@ interface FlowQueryBuilderFieldMap {
1375
1382
  *
1376
1383
  * - `string`: A text field, displayed as an input box. Supports string-matching operators.
1377
1384
  * - `number`: A numeric field, displayed as an numeric input box with stepper controls. Supports numeric comparison operators.
1378
- * - `date`: A date field, displayed as a date picker. Supports numeric comparison operators.
1379
- * - `time`: A time field, displayed as a time picker. Supports numeric comparison operators.
1380
- * - `datetime`: A date-time field, displayed as a date-time picker. Supports numeric comparison operators.
1385
+ * - `date`: A date field, displayed as a date picker. Supports numeric comparison operators and `between`.
1386
+ * - `time`: A time field, displayed as a time picker. Supports numeric comparison operators and `between`.
1387
+ * - `datetime`: A date-time field, displayed as a date-time picker. Supports numeric comparison operators and
1388
+ * `between`.
1381
1389
  * - `select`: A select field, displayed as a dropdown list. Supports `in` and `!in` operators.
1382
1390
  *
1383
1391
  * In addition, all field types support equality operators (`=`, `!=`).
@@ -1399,7 +1407,10 @@ interface FlowQueryBuilderFieldBase<ValueType = any> {
1399
1407
  defaultValue?: ValueType | (() => ValueType);
1400
1408
  /** Default operator for the field. */
1401
1409
  defaultOperator?: string;
1402
- /** Optional function to convert the user-entered value before applying a rule set converter. */
1410
+ /**
1411
+ * Optional function to convert the user-entered value before applying a rule set converter. For the `between`
1412
+ * operator, the function is called separately for each end of the range.
1413
+ */
1403
1414
  convertValue?: (value: ValueType) => any;
1404
1415
  /** Optional validator function to validate the user-entered value. */
1405
1416
  validator?: (rule: FlowQueryBuilderRule<ValueType>) => string;
@@ -1606,6 +1617,16 @@ declare const isRuleSet: (r: unknown) => r is FlowQueryBuilderRuleSet;
1606
1617
  * Helper function to determine if the supplied argument is a {@link FlowQueryBuilderRule} or {@link FlowQueryBuilderRuleSet}
1607
1618
  */
1608
1619
  declare const isRuleOrRuleset: (r: unknown) => r is FlowQueryBuilderRule | FlowQueryBuilderRuleSet;
1620
+ /**
1621
+ * The start and end of a `between` rule's `[start, end]` value, each converted with the field's `convertValue`
1622
+ * function, if any. Gives `undefined` if the value isn't an array of two values.
1623
+ *
1624
+ * For a time field, a range that ends at 24:00 (the start of the day after its start) has no upper bound, because
1625
+ * every time of day is before it. The end is then `undefined`.
1626
+ *
1627
+ * @internal
1628
+ */
1629
+ declare function betweenRuleValues(rule: FlowQueryBuilderRule, field: FlowQueryBuilderField): [any, any | undefined] | undefined;
1609
1630
 
1610
1631
  declare const converter$2: FlowQueryBuilderConverter;
1611
1632
 
@@ -1981,9 +2002,12 @@ declare class FlowUiAutocomplete extends FlowRdfFormControl {
1981
2002
  private readonly localize;
1982
2003
  /** @internal Last time when the mousedown event was fired */
1983
2004
  private mouseDownAt;
2005
+ /** @internal Emits `flow-ui-input` once typing pauses for {@link debounceDelay} */
1984
2006
  private debouncedInput;
1985
2007
  private pendingChangeEvent;
1986
2008
  private pendingInputEvent;
2009
+ /** @internal When true, the next value change leaves the input text as the user typed it */
2010
+ private pendingKeepInputText;
1987
2011
  private hasOptions;
1988
2012
  /** @internal True while the user is typing to filter (input text has diverged from the committed value). */
1989
2013
  private inputChanged;
@@ -2117,6 +2141,7 @@ declare class FlowUiAutocomplete extends FlowRdfFormControl {
2117
2141
  *
2118
2142
  * @param value - The value to set.
2119
2143
  * @param emitChangeEvent - A change event will be emitted if true.
2144
+ * @param keepInputText - The input text is not re-synced from {@link displayWith} if true.
2120
2145
  */
2121
2146
  private setValue;
2122
2147
  /** @internal Updates the debounced input emitter if `{@link debounceDelay} is changed. */
@@ -2134,6 +2159,13 @@ declare class FlowUiAutocomplete extends FlowRdfFormControl {
2134
2159
  handleClearMouseDown(event: MouseEvent): Promise<void>;
2135
2160
  /** @internal Handle option selection when an option is clicked on */
2136
2161
  private handleListboxClick;
2162
+ /**
2163
+ * @internal
2164
+ * Commits an option picked by the user and closes the control. Re-picking the already selected
2165
+ * option (e.g. after the input text was edited away) commits no new value, so no change event
2166
+ * fires; the input text is re-synced from {@link displayWith} instead.
2167
+ */
2168
+ private commitOption;
2137
2169
  /** @internal Handle mouse and keyboard events in the document, outside the control. */
2138
2170
  private handleDocumentEvent;
2139
2171
  /** @internal */
@@ -2669,8 +2701,22 @@ declare global {
2669
2701
  }
2670
2702
 
2671
2703
  /**
2704
+ * The calendar component is used to select a date, a time or both. It is also used in the popups of the
2705
+ * [date time picker](./flow-ui-date-time-picker) and [timer](./flow-ui-timer) components.
2706
+ *
2707
+ * Set `range` to select a range instead of a single value. The type of range depends on `display-mode`:
2708
+ *
2709
+ * - `date` - A range of days.
2710
+ * - `datetime` - A range of days with a start time and an end time.
2711
+ * - `time` - A range of times within a single day.
2712
+ *
2713
+ * In range mode, the value is not updated and no events are emitted until both ends of the range have been selected.
2714
+ *
2715
+ * Use `min`, `max` and `max-range` to restrict the dates that can be selected. Note that the calendar does not change
2716
+ * a value that is outside these limits.
2717
+ *
2672
2718
  * @tagname flow-ui-calendar
2673
- * @summary A calendar component for selecting dates and times.
2719
+ * @summary Calendars allow users to select a date, time or date range.
2674
2720
  *
2675
2721
  * @dependency flow-ui-icon-button
2676
2722
  * @dependency flow-ui-input
@@ -2682,7 +2728,8 @@ declare global {
2682
2728
  *
2683
2729
  * @csspart base - The component's base wrapper.
2684
2730
  *
2685
- * @cssproperty --width - The width of the calendar in CSS units. Set automatically if `size` is set.
2731
+ * @cssproperty --width - The width of the calendar in CSS units, or of each month when `months` is `2`. Set
2732
+ * automatically if `size` is set.
2686
2733
  * @cssproperty --font-size - The font size of the calendar. Set automatically if `size` is set.
2687
2734
  * @cssproperty --day-font-size - The font size of the day labels. Set automatically if `size` is set.
2688
2735
  *
@@ -2693,35 +2740,166 @@ declare class FlowUiCalendar extends FlowRdfElement {
2693
2740
  private _yearSelect;
2694
2741
  private _displayDate;
2695
2742
  private _selectedDate?;
2696
- /** The value of the control. (ISO8601 date/time string) */
2743
+ /** The selected date range in range mode (half-open, in whole days). */
2744
+ private _selectedRange?;
2745
+ /** The first day the user clicked in a range that isn't complete yet. It may become the range start or the last day. */
2746
+ private _pendingDay?;
2747
+ /** The day that the pointer or focus is on while a range is pending, used for the hover preview. */
2748
+ private _hoverDate?;
2749
+ /** The start time of a datetime range, on the range start. */
2750
+ private _startTime;
2751
+ /** The end time of a datetime range, on the last day. 24:00:00 is the end of the last day. */
2752
+ private _endTime;
2753
+ private readonly localize;
2754
+ /**
2755
+ * The value of the control. (ISO8601 date/time string) In range mode, the value is an ISO8601 interval string
2756
+ * (`<start>/<end>`) and the end is exclusive. For example, the date range October 1 to October 2 has the value
2757
+ * `2026-10-01T00:00:00.000+01:00/2026-10-03T00:00:00.000+01:00`.
2758
+ */
2697
2759
  value: string;
2698
- /** Select whether to show date only, time only or both date and time. */
2760
+ /** The display mode: date only, time only, or both date and time. */
2699
2761
  displayMode: 'date' | 'time' | 'datetime';
2762
+ /** Set to `true` to select a date, datetime or time range instead of a single value, depending on `display-mode`. */
2763
+ range: boolean;
2700
2764
  /** Set the timezone for display. If not set the default timezone will be used. (TZ name e.g. `'Europe/London'`) */
2701
2765
  timezone?: string;
2702
2766
  /** Set the locale for display. If not set the default locale will be used. (e.g `'en-GB'`) */
2703
2767
  locale?: string;
2704
2768
  /** Set the size of the calendar. */
2705
2769
  size: 'small' | 'medium' | 'large';
2770
+ /** The number of months to show side by side. */
2771
+ months: 1 | 2;
2772
+ /**
2773
+ * The earliest date that can be selected. (ISO8601 date or date/time string) Note that `min` is ignored when
2774
+ * `display-mode` is `time`.
2775
+ */
2776
+ min?: string;
2777
+ /**
2778
+ * The latest date that can be selected. (ISO8601 date or date/time string) Note that `max` is ignored when
2779
+ * `display-mode` is `time`.
2780
+ */
2781
+ max?: string;
2782
+ /**
2783
+ * The maximum length of a range. (Duration string, e.g. `'7 days'` or `'1 month'`) Supported units are milliseconds,
2784
+ * seconds, minutes, hours, days, weeks and months.
2785
+ */
2786
+ maxRange?: string;
2706
2787
  connectedCallback(): void;
2707
2788
  disconnectedCallback(): void;
2789
+ /** The number of months shown. Anything other than `2` shows one month. */
2790
+ private get monthCount();
2791
+ /** Whether the calendar selects a range: a date range, a datetime range or a time range. */
2792
+ private get isRangeMode();
2793
+ /** Whether the calendar selects a datetime range, with start and end times. */
2794
+ private get isDateTimeRangeMode();
2795
+ /** Whether the calendar selects a time range: start and end times, with no days. */
2796
+ private get isTimeRangeMode();
2797
+ /** The parsed `min`, `max` and `max-range`, in the calendar's timezone. There are no limits in time display mode. */
2798
+ private get limits();
2799
+ /**
2800
+ * Whether the user can't select `day` (the start of a day): it is outside `min` or `max`, or, while a range is
2801
+ * pending, it would make the range longer than `max-range`.
2802
+ */
2803
+ private isDayDisabled;
2804
+ /** Clamp a date and time to `min` and `max`, so that the time inputs can't select a time outside the limits. */
2805
+ private clampToLimits;
2806
+ /** The first and last months the user can navigate to, as the start of each month, if `min` or `max` is set. */
2807
+ private get monthLimits();
2808
+ /** Clamp a month to the months the user can navigate to. */
2809
+ private clampMonth;
2708
2810
  /** @internal */
2709
2811
  handleValueChange(): void;
2812
+ private handleRangeValueChange;
2813
+ /**
2814
+ * Show the month of `date` as the first month. In the two-month view, a date in the second month is already shown,
2815
+ * so the display doesn't move.
2816
+ */
2817
+ private showMonthOf;
2710
2818
  /** @internal */
2711
2819
  handleTimezoneChange(): void;
2820
+ /** @internal */
2821
+ handleRangeChange(): void;
2822
+ /** @internal */
2823
+ handleDisplayModeChange(): void;
2712
2824
  private dateClicked;
2825
+ /**
2826
+ * Handle a day click in range mode. The first click sets the pending day. The second click completes the range,
2827
+ * whichever order the two days were clicked in, so the user can click the last day first and then go back to the
2828
+ * range start.
2829
+ */
2830
+ private rangeDateClicked;
2831
+ /** Whether `max-range` only allows ranges of one day starting on `day`, so that a range is a single day. */
2832
+ private isSingleDayOnly;
2833
+ /** Complete a range from `first` to `last` (both the start of a day) and update the value. */
2834
+ private completeRange;
2835
+ /**
2836
+ * The datetime range from the start time on `first` to the end time on `last` (both the start of a day), clamped to
2837
+ * `min` and `max`. If the times would make the range empty, for example an end time before the start time on a
2838
+ * single day, the end time is reset to 24:00:00. If the range would be longer than `max-range`, the end is moved
2839
+ * back.
2840
+ */
2841
+ private makeDateTimeRange;
2842
+ private dayHovered;
2843
+ /**
2844
+ * Discard a pending range, so that the user can click a new range start. The value is unchanged. Returns `true` if a
2845
+ * range was pending.
2846
+ *
2847
+ * @internal
2848
+ */
2849
+ cancelPendingRange(): boolean;
2850
+ private handleKeyDown;
2851
+ private clearPendingRange;
2713
2852
  private stepDisplayDate;
2714
2853
  /**
2715
- * Generate a list of years for the year select dropdown
2854
+ * Generate a list of years for the year select dropdown, newest first. With no limits, the years are from next year
2855
+ * to six years ago. With `min` or `max`, the list starts or ends at their years, and always includes the year shown.
2716
2856
  */
2717
- private yearOptionsForDate;
2857
+ private yearOptions;
2718
2858
  private makeDate;
2859
+ /**
2860
+ * Parse an ISO8601 interval string. In date mode, the interval is widened to whole days in the calendar's timezone:
2861
+ * the start is rounded down to the start of its day and the end is rounded up to the start of the next day. An
2862
+ * invalid or empty interval gives `undefined`.
2863
+ */
2864
+ private makeRange;
2865
+ /**
2866
+ * The days to highlight in range mode: the hover preview while a range is pending, otherwise the selected range.
2867
+ */
2868
+ private highlightedDays;
2719
2869
  private updateValue;
2720
2870
  private handleHeaderSelectChange;
2721
2871
  private handleTimeChange;
2872
+ /**
2873
+ * Handle a change in the Start or End row of a datetime range or a time range. In a datetime range, the start time
2874
+ * applies to the range start and the end time to the last day. The edited time can't pass the other one, so the range
2875
+ * is never empty.
2876
+ */
2877
+ private handleRangeTimeChange;
2878
+ /**
2879
+ * The header for the month at `index`. The first month has the month and year selects and the second month has a
2880
+ * static label. The previous button is on the first month and the next button on the last. In the two-month view, a
2881
+ * hidden button takes the place of each missing button, so the month label stays centered.
2882
+ */
2722
2883
  private calendarHeaderTemplate;
2884
+ private headerSelectsTemplate;
2885
+ /** Whether a month of the year shown is outside the months the user can navigate to. */
2886
+ private isMonthDisabled;
2723
2887
  private dayOfWeekGridTemplate;
2888
+ /**
2889
+ * The days shown in the grid for a month, including the filler days from the adjacent months that complete the
2890
+ * first and last weeks. In the two-month view, the filler days between the two months are hidden, because the other
2891
+ * month shows them.
2892
+ */
2893
+ private daysForMonth;
2724
2894
  private dayGridTemplate;
2895
+ private monthTemplate;
2896
+ private handleGridMouseLeave;
2897
+ /** The hour, minute and second inputs for `time`. */
2898
+ private timeInputsTemplate;
2899
+ /**
2900
+ * The time inputs: one row in single mode, or the Start and End rows of a datetime range or a time range. The Start
2901
+ * and End rows are stacked, except in a datetime range in the two-month view.
2902
+ */
2725
2903
  private timeTemplate;
2726
2904
  render(): lit_html.TemplateResult<1>;
2727
2905
  }
@@ -3951,8 +4129,16 @@ declare global {
3951
4129
  }
3952
4130
 
3953
4131
  /**
4132
+ * The date time picker component displays its value in a text field and opens a [calendar](./flow-ui-calendar) in a
4133
+ * popup to change it.
4134
+ *
4135
+ * Set `range` to select a date, datetime or time range instead of a single value, depending on `display-mode`.
4136
+ *
4137
+ * Use `min`, `max` and `max-range` to restrict the dates that can be selected. Note that a value outside these limits
4138
+ * is not changed, but fails validation.
4139
+ *
3954
4140
  * @tagname flow-ui-date-time-picker
3955
- * @summary Date time pickers allow users to select a date and time from a calendar and clock interface.
4141
+ * @summary Date time pickers allow users to select a date and time, or a date range, from a calendar.
3956
4142
  *
3957
4143
  * @dependency flow-ui-icon
3958
4144
  * @dependency flow-ui-popup
@@ -3997,12 +4183,25 @@ declare class FlowUiDateTimePicker extends FlowRdfFormControl {
3997
4183
  private displayLabel;
3998
4184
  /** The name of the date/time picker, submitted as a name/value pair with form data. */
3999
4185
  name: string;
4000
- /** The current value of the date/time picker. (ISO8601 date/time string) */
4186
+ /**
4187
+ * The current value of the date/time picker. (ISO8601 date/time string) In range mode, the value is an ISO8601
4188
+ * interval string (`<start>/<end>`) and the end is exclusive. For example, the date range October 1 to October 2 has
4189
+ * the value `2026-10-01T00:00:00.000+01:00/2026-10-03T00:00:00.000+01:00`.
4190
+ */
4001
4191
  value: string;
4002
- /** Select whether to show date only, time only or both date and time. */
4192
+ /** The display mode: date only, time only, or both date and time. */
4003
4193
  displayMode: 'date' | 'time' | 'datetime';
4004
- /** Specify the display format using a [Luxon format string](https://moment.github.io/luxon/#/formatting?id=table-of-tokens). */
4005
- format: string;
4194
+ /** Set to `true` to select a date, datetime or time range instead of a single value, depending on `display-mode`. */
4195
+ range: boolean;
4196
+ /** The format set by the user, if any. The default format depends on `display-mode`, so it is not stored here. */
4197
+ private _format?;
4198
+ /**
4199
+ * The format to use for display as a
4200
+ * [Luxon format string](https://moment.github.io/luxon/#/formatting?id=table-of-tokens). If not set, the format
4201
+ * depends on `display-mode` (`'DD'` for `date`, `'HH:mm'` for `time` and `'FFF'` for `datetime`).
4202
+ */
4203
+ get format(): string;
4204
+ set format(format: string);
4006
4205
  /** Set the timezone for display. If not set the default timezone will be used. (TZ name e.g. `'Europe/London'`) */
4007
4206
  timezone?: string;
4008
4207
  /** Set the locale for display. If not set the default locale will be used. (e.g `'en-GB'`) */
@@ -4011,6 +4210,23 @@ declare class FlowUiDateTimePicker extends FlowRdfFormControl {
4011
4210
  defaultValue: string;
4012
4211
  /** The date/time picker's size. */
4013
4212
  size: 'small' | 'medium' | 'large';
4213
+ /** The number of months to show side by side in the calendar. */
4214
+ months: 1 | 2;
4215
+ /**
4216
+ * The earliest date that can be selected. (ISO8601 date or date/time string) Note that `min` is ignored when
4217
+ * `display-mode` is `time`.
4218
+ */
4219
+ min?: string;
4220
+ /**
4221
+ * The latest date that can be selected. (ISO8601 date or date/time string) Note that `max` is ignored when
4222
+ * `display-mode` is `time`.
4223
+ */
4224
+ max?: string;
4225
+ /**
4226
+ * The maximum length of a range. (Duration string, e.g. `'7 days'` or `'1 month'`) Supported units are milliseconds,
4227
+ * seconds, minutes, hours, days, weeks and months.
4228
+ */
4229
+ maxRange?: string;
4014
4230
  /** Placeholder text to show as a hint when the date/time picker is empty. */
4015
4231
  placeholder: string;
4016
4232
  /** Disables the date/time picker control. */
@@ -4054,6 +4270,8 @@ declare class FlowUiDateTimePicker extends FlowRdfFormControl {
4054
4270
  inline: boolean;
4055
4271
  /** Indicates that the control should display a divider */
4056
4272
  divider: boolean;
4273
+ /** The message set with `setCustomValidity()`. It takes precedence over the limits messages. */
4274
+ private customValidityMessage;
4057
4275
  /** Gets the validity state object */
4058
4276
  get validity(): ValidityState;
4059
4277
  /** Gets the validation message */
@@ -4061,8 +4279,17 @@ declare class FlowUiDateTimePicker extends FlowRdfFormControl {
4061
4279
  connectedCallback(): void;
4062
4280
  private addOpenListeners;
4063
4281
  private removeOpenListeners;
4282
+ /** Whether the picker selects a range: a date range, a datetime range or a time range. */
4283
+ private get isRangeMode();
4064
4284
  /** @internal */
4065
4285
  updateDisplayLabel(): void;
4286
+ /**
4287
+ * The label for a range. For a date range, it shows the range start and the last day, both included, and a range of
4288
+ * one day shows that day once. For a datetime range, it shows the start and end instants. For a time range, it shows
4289
+ * the start and end times, with an end at the end of the day shown as 24:00. An invalid range shows an empty label,
4290
+ * as the calendar shows no selection.
4291
+ */
4292
+ private rangeLabel;
4066
4293
  private handleFocus;
4067
4294
  private handleBlur;
4068
4295
  private handleDocumentFocusIn;
@@ -4073,6 +4300,7 @@ declare class FlowUiDateTimePicker extends FlowRdfFormControl {
4073
4300
  private handleComboboxKeyDown;
4074
4301
  private handleClearClick;
4075
4302
  private handleClearMouseDown;
4303
+ private handleCalendarInput;
4076
4304
  private handleCalendarChange;
4077
4305
  private handleInvalid;
4078
4306
  /** @internal */
@@ -4093,6 +4321,11 @@ declare class FlowUiDateTimePicker extends FlowRdfFormControl {
4093
4321
  reportValidity(): boolean;
4094
4322
  /** Sets a custom validation message. Pass an empty string to restore validity. */
4095
4323
  setCustomValidity(message: string): void;
4324
+ protected updated(changedProperties: PropertyValues<this>): void;
4325
+ /** Set the value input's custom validity: the message from `setCustomValidity()`, or a limits message. */
4326
+ private updateCustomValidity;
4327
+ /** The validation message for a value outside `min`, `max` or `max-range`, or an empty string. */
4328
+ private limitsValidityMessage;
4096
4329
  /** Sets focus on the control. */
4097
4330
  focus(options?: FocusOptions): void;
4098
4331
  /** Removes focus from the control. */
@@ -5431,6 +5664,7 @@ declare class FlowUiRange extends FlowRdfFormControl {
5431
5664
  get validationMessage(): string;
5432
5665
  connectedCallback(): void;
5433
5666
  disconnectedCallback(): void;
5667
+ protected willUpdate(changedProperties: PropertyValueMap<FlowUiRange> | Map<PropertyKey, unknown>): void;
5434
5668
  private handleRangeChange;
5435
5669
  private handleRangeInput;
5436
5670
  private handleNumberChange;
@@ -6762,4 +6996,4 @@ declare global {
6762
6996
  }
6763
6997
  }
6764
6998
 
6765
- export { type BaseColorMapperField, type BaseColorStopOptions, type ColorMapperField, type ColorMapperOptions, type ColorMapperValue, type ColorStopOptions, type ColorStopValue, type FlowQueryBuilderConfig, type FlowQueryBuilderConverter, type FlowQueryBuilderConverterOptions, type FlowQueryBuilderDateField, type FlowQueryBuilderDateTimeField, type FlowQueryBuilderDateTimeFieldBase, type FlowQueryBuilderField, type FlowQueryBuilderFieldBase, type FlowQueryBuilderFieldDefinition, type FlowQueryBuilderFieldMap, type FlowQueryBuilderFieldType, type FlowQueryBuilderFieldTypeMap, type FlowQueryBuilderNumberField, type FlowQueryBuilderOption, type FlowQueryBuilderRule, type FlowQueryBuilderRuleSet, type FlowQueryBuilderSelectField, type FlowQueryBuilderStringField, type FlowQueryBuilderTemplateFn, type FlowQueryBuilderTimeField, type FlowAfterCollapseEvent as FlowUiAfterCollapseEvent, type FlowAfterExpandEvent as FlowUiAfterExpandEvent, type FlowAfterHideEvent as FlowUiAfterHideEvent, type FlowAfterShowEvent as FlowUiAfterShowEvent, FlowUiAlert, FlowUiAnimation, type FlowApplyEvent as FlowUiApplyEvent, FlowUiAutocomplete, FlowUiAvatar, FlowUiBadge, FlowUiBaseControl, type FlowBlurEvent as FlowUiBlurEvent, FlowUiBreadcrumb, FlowUiBreadcrumbItem, FlowUiBusyOverlay, FlowUiButton, FlowUiButtonGroup, FlowUiCalendar, type FlowCancelEvent as FlowUiCancelEvent, FlowUiCard, FlowUiCarousel, FlowUiCarouselItem, type FlowChangeEvent as FlowUiChangeEvent, FlowUiChart, FlowUiCheckbox, FlowUiCheckboxGroup, type FlowClearEvent as FlowUiClearEvent, type FlowCloseEvent as FlowUiCloseEvent, type FlowCollapseEvent as FlowUiCollapseEvent, type FlowCollapseTreeEvent as FlowUiCollapseSplitViewEvent, FlowUiColorMapper, FlowUiColorPicker, FlowUiColorStop, FlowUiDateTimePicker, FlowUiDetails, FlowUiDialog, FlowUiDivider, type FlowDragDropEvent as FlowUiDragDrop, type FlowDragEndEvent as FlowUiDragEndEvent, type FlowDragEvent as FlowUiDragEvent, type FlowDragOverEvent as FlowUiDragOverEvent, type FlowDragStartEvent as FlowUiDragStartEvent, FlowUiDrawer, FlowUiDropdown, type FlowErrorEvent as FlowUiErrorEvent, type FlowExpandEvent as FlowUiExpandEvent, type FlowExpandTreeEvent as FlowUiExpandSplitViewEvent, type FlowFinishEvent as FlowUiFinishEvent, type FlowFocusEvent as FlowUiFocusEvent, FlowUiFormGroup, FlowUiGauge, type FlowHideEvent as FlowUiHideEvent, type FlowHoverEvent as FlowUiHoverEvent, FlowUiIcon, FlowUiIconButton, type FlowInitialFocusEvent as FlowUiInitialFocusEvent, FlowUiInput, type FlowInputEvent as FlowUiInputEvent, type FlowInvalidEvent as FlowUiInvalidEvent, type FlowLazyChangeEvent as FlowUiLazyChangeEvent, type FlowLazyLoadEvent as FlowUiLazyLoadEvent, FlowUiList, FlowUiListItem, type FlowLoadEvent as FlowUiLoadEvent, FlowUiMap, type FlowMapLoadEvent as FlowUiMapLoadEvent, FlowUiMenu, FlowUiMenuItem, FlowUiMenuLabel, type FlowMutationEvent as FlowUiMutationEvent, FlowUiMutationObserver, FlowUiOption, FlowUiPanel, FlowUiPanelHeader, type FlowPanelToggleEvent as FlowUiPanelToggleEvent, FlowUiPopup, FlowUiProgressBar, FlowUiProgressRing, FlowUiQueryBuilder, FlowUiRadio, FlowUiRadioGroup, FlowUiRange, type FlowRemoveEvent as FlowUiRemoveEvent, type FlowRepositionEvent as FlowUiRepositionEvent, type FlowRequestCloseEvent as FlowUiRequestCloseEvent, type FlowResizeEvent as FlowUiResizeEvent, FlowUiResizeObserver, FlowUiScrollView, FlowUiSelect, type FlowSelectEvent as FlowUiSelectEvent, type FlowShowEvent as FlowUiShowEvent, type FlowSlideChange as FlowUiSlideChange, FlowUiSplitView, FlowUiSplitViewDivider, FlowUiSplitViewPane, FlowUiSplitViewToggleButton, type FlowStartEvent as FlowUiStartEvent, FlowUiStepper, FlowUiStepperPanel, FlowUiSwitch, FlowUiTab, FlowUiTabGroup, type FlowTabHideEvent as FlowUiTabHideEvent, FlowUiTabPanel, type FlowTabShowEvent as FlowUiTabShowEvent, FlowUiTag, FlowUiTextarea, FlowUiTimer, FlowUiToolButton, FlowUiToolButtonGroup, FlowUiTooltip, FlowUiTree, FlowUiTreeItem, FlowUiVisuallyHidden, JavaScriptFilterError, type JavaScriptFilterFn, LocalizeController, type NumberColorMapperField, type NumberColorStopOptions, type SelectColorMapperField, type SelectColorStopOptions, type StringColorMapperField, type StringColorStopOptions, type Translation, addIcons, colorMapperValueToMaplibreExpression, countRuleSet, escapeMaplibreString, filterRuleSet, converter$2 as flowQueryConverter, getAnimationNames, getEasingNames, initialize, initializeChartJs, isRule, isRuleOrRuleset, isRuleSet, converter$1 as javascriptFilterConverter, converter as mapLayerFilterConverter, registerChartComponent, registerComponents, registerIconLibrary, registerTranslation, renameRuleSetFields, setDefaultLocale, setDefaultTimeZone, transformRuleSet, unregisterIconLibrary };
6999
+ export { type BaseColorMapperField, type BaseColorStopOptions, type ColorMapperField, type ColorMapperOptions, type ColorMapperValue, type ColorStopOptions, type ColorStopValue, type FlowQueryBuilderConfig, type FlowQueryBuilderConverter, type FlowQueryBuilderConverterOptions, type FlowQueryBuilderDateField, type FlowQueryBuilderDateTimeField, type FlowQueryBuilderDateTimeFieldBase, type FlowQueryBuilderField, type FlowQueryBuilderFieldBase, type FlowQueryBuilderFieldDefinition, type FlowQueryBuilderFieldMap, type FlowQueryBuilderFieldType, type FlowQueryBuilderFieldTypeMap, type FlowQueryBuilderNumberField, type FlowQueryBuilderOption, type FlowQueryBuilderRule, type FlowQueryBuilderRuleSet, type FlowQueryBuilderSelectField, type FlowQueryBuilderStringField, type FlowQueryBuilderTemplateFn, type FlowQueryBuilderTimeField, type FlowAfterCollapseEvent as FlowUiAfterCollapseEvent, type FlowAfterExpandEvent as FlowUiAfterExpandEvent, type FlowAfterHideEvent as FlowUiAfterHideEvent, type FlowAfterShowEvent as FlowUiAfterShowEvent, FlowUiAlert, FlowUiAnimation, type FlowApplyEvent as FlowUiApplyEvent, FlowUiAutocomplete, FlowUiAvatar, FlowUiBadge, FlowUiBaseControl, type FlowBlurEvent as FlowUiBlurEvent, FlowUiBreadcrumb, FlowUiBreadcrumbItem, FlowUiBusyOverlay, FlowUiButton, FlowUiButtonGroup, FlowUiCalendar, type FlowCancelEvent as FlowUiCancelEvent, FlowUiCard, FlowUiCarousel, FlowUiCarouselItem, type FlowChangeEvent as FlowUiChangeEvent, FlowUiChart, FlowUiCheckbox, FlowUiCheckboxGroup, type FlowClearEvent as FlowUiClearEvent, type FlowCloseEvent as FlowUiCloseEvent, type FlowCollapseEvent as FlowUiCollapseEvent, type FlowCollapseTreeEvent as FlowUiCollapseSplitViewEvent, FlowUiColorMapper, FlowUiColorPicker, FlowUiColorStop, FlowUiDateTimePicker, FlowUiDetails, FlowUiDialog, FlowUiDivider, type FlowDragDropEvent as FlowUiDragDrop, type FlowDragEndEvent as FlowUiDragEndEvent, type FlowDragEvent as FlowUiDragEvent, type FlowDragOverEvent as FlowUiDragOverEvent, type FlowDragStartEvent as FlowUiDragStartEvent, FlowUiDrawer, FlowUiDropdown, type FlowErrorEvent as FlowUiErrorEvent, type FlowExpandEvent as FlowUiExpandEvent, type FlowExpandTreeEvent as FlowUiExpandSplitViewEvent, type FlowFinishEvent as FlowUiFinishEvent, type FlowFocusEvent as FlowUiFocusEvent, FlowUiFormGroup, FlowUiGauge, type FlowHideEvent as FlowUiHideEvent, type FlowHoverEvent as FlowUiHoverEvent, FlowUiIcon, FlowUiIconButton, type FlowInitialFocusEvent as FlowUiInitialFocusEvent, FlowUiInput, type FlowInputEvent as FlowUiInputEvent, type FlowInvalidEvent as FlowUiInvalidEvent, type FlowLazyChangeEvent as FlowUiLazyChangeEvent, type FlowLazyLoadEvent as FlowUiLazyLoadEvent, FlowUiList, FlowUiListItem, type FlowLoadEvent as FlowUiLoadEvent, FlowUiMap, type FlowMapLoadEvent as FlowUiMapLoadEvent, FlowUiMenu, FlowUiMenuItem, FlowUiMenuLabel, type FlowMutationEvent as FlowUiMutationEvent, FlowUiMutationObserver, FlowUiOption, FlowUiPanel, FlowUiPanelHeader, type FlowPanelToggleEvent as FlowUiPanelToggleEvent, FlowUiPopup, FlowUiProgressBar, FlowUiProgressRing, FlowUiQueryBuilder, FlowUiRadio, FlowUiRadioGroup, FlowUiRange, type FlowRemoveEvent as FlowUiRemoveEvent, type FlowRepositionEvent as FlowUiRepositionEvent, type FlowRequestCloseEvent as FlowUiRequestCloseEvent, type FlowResizeEvent as FlowUiResizeEvent, FlowUiResizeObserver, FlowUiScrollView, FlowUiSelect, type FlowSelectEvent as FlowUiSelectEvent, type FlowShowEvent as FlowUiShowEvent, type FlowSlideChange as FlowUiSlideChange, FlowUiSplitView, FlowUiSplitViewDivider, FlowUiSplitViewPane, FlowUiSplitViewToggleButton, type FlowStartEvent as FlowUiStartEvent, FlowUiStepper, FlowUiStepperPanel, FlowUiSwitch, FlowUiTab, FlowUiTabGroup, type FlowTabHideEvent as FlowUiTabHideEvent, FlowUiTabPanel, type FlowTabShowEvent as FlowUiTabShowEvent, FlowUiTag, FlowUiTextarea, FlowUiTimer, FlowUiToolButton, FlowUiToolButtonGroup, FlowUiTooltip, FlowUiTree, FlowUiTreeItem, FlowUiVisuallyHidden, JavaScriptFilterError, type JavaScriptFilterFn, LocalizeController, type NumberColorMapperField, type NumberColorStopOptions, type SelectColorMapperField, type SelectColorStopOptions, type StringColorMapperField, type StringColorStopOptions, type Translation, addIcons, betweenRuleValues, colorMapperValueToMaplibreExpression, countRuleSet, escapeMaplibreString, filterRuleSet, converter$2 as flowQueryConverter, getAnimationNames, getEasingNames, initialize, initializeChartJs, isRule, isRuleOrRuleset, isRuleSet, converter$1 as javascriptFilterConverter, converter as mapLayerFilterConverter, registerChartComponent, registerComponents, registerIconLibrary, registerTranslation, renameRuleSetFields, setDefaultLocale, setDefaultTimeZone, transformRuleSet, unregisterIconLibrary };
package/dist/index.mjs CHANGED
@@ -79,7 +79,7 @@ export { registerIconLibrary, unregisterIconLibrary } from './components/icon/li
79
79
  export { setDefaultLocale, setDefaultTimeZone } from './utilities/locale.mjs';
80
80
  export { registerTranslation } from './internal/localize.mjs';
81
81
  export { LocalizeController } from './utilities/localize.mjs';
82
- export { countRuleSet, filterRuleSet, isRule, isRuleOrRuleset, isRuleSet, renameRuleSetFields, transformRuleSet } from './components/query-builder/helpers.mjs';
82
+ export { betweenRuleValues, countRuleSet, filterRuleSet, isRule, isRuleOrRuleset, isRuleSet, renameRuleSetFields, transformRuleSet } from './components/query-builder/helpers.mjs';
83
83
  export { default as flowQueryConverter } from './components/query-builder/converters/flow-query-converters.mjs';
84
84
  export { default as javascriptFilterConverter } from './components/query-builder/converters/javascript-filter-converter.mjs';
85
85
  export { default as mapLayerFilterConverter } from './components/query-builder/converters/map-layer-filter-converter.mjs';
@@ -0,0 +1,107 @@
1
+ import { Interval, Duration, DateTime } from 'luxon';
2
+ import { parseDuration } from './datetime.mjs';
3
+ import { isStringFull } from './type-checks.mjs';
4
+
5
+ function parseDateRange(value, options = {}) {
6
+ if (!isStringFull(value)) {
7
+ return void 0;
8
+ }
9
+ const zone = isStringFull(options.zone) ? options.zone : void 0;
10
+ const locale = isStringFull(options.locale) ? options.locale : void 0;
11
+ const interval = Interval.fromISO(value, { zone, locale });
12
+ if (!interval.isValid) {
13
+ return void 0;
14
+ }
15
+ let range = interval;
16
+ if (options.wholeDays) {
17
+ const start = interval.start.startOf("day");
18
+ const endDay = interval.end.startOf("day");
19
+ const end = +endDay === +interval.end ? endDay : endDay.plus({ days: 1 }).startOf("day");
20
+ range = Interval.fromDateTimes(start, end);
21
+ }
22
+ return range.isValid && !range.isEmpty() ? range : void 0;
23
+ }
24
+ function lastDayOfRange(range) {
25
+ return range.end.minus({ milliseconds: 1 }).startOf("day");
26
+ }
27
+ function endTimeOfRange(range) {
28
+ const lastDay = lastDayOfRange(range);
29
+ if (+range.end === +lastDay.plus({ days: 1 }).startOf("day")) {
30
+ return { hour: 24, minute: 0, second: 0 };
31
+ }
32
+ return { hour: range.end.hour, minute: range.end.minute, second: range.end.second };
33
+ }
34
+ function atTimeOfDay(day, time) {
35
+ if (time.hour >= 24) {
36
+ return day.plus({ days: 1 }).startOf("day");
37
+ }
38
+ return day.set({ hour: time.hour, minute: time.minute, second: time.second, millisecond: 0 });
39
+ }
40
+ function parseDateLimits(min, max, maxRange, options = {}) {
41
+ const zone = isStringFull(options.zone) ? options.zone : void 0;
42
+ const locale = isStringFull(options.locale) ? options.locale : void 0;
43
+ const parseDate = (value) => {
44
+ const date = isStringFull(value) ? DateTime.fromISO(value, { zone, locale }) : void 0;
45
+ return date?.isValid ? date : void 0;
46
+ };
47
+ const durationObject = isStringFull(maxRange) ? parseDuration(maxRange) : void 0;
48
+ const duration = durationObject ? Duration.fromObject(durationObject, { locale }) : void 0;
49
+ return {
50
+ min: parseDate(min),
51
+ max: parseDate(max),
52
+ maxRange: duration?.isValid && +duration > 0 ? duration : void 0
53
+ };
54
+ }
55
+ function checkDateLimits(value, limits, options = {}) {
56
+ const { min, max, maxRange } = limits;
57
+ const zone = isStringFull(options.zone) ? options.zone : void 0;
58
+ const locale = isStringFull(options.locale) ? options.locale : void 0;
59
+ const day = (date) => options.wholeDays ? date.startOf("day") : date;
60
+ let first;
61
+ let last;
62
+ let range;
63
+ if (options.range) {
64
+ range = parseDateRange(value, { zone, locale, wholeDays: options.wholeDays });
65
+ if (!range) {
66
+ return void 0;
67
+ }
68
+ first = range.start;
69
+ last = options.wholeDays ? lastDayOfRange(range) : range.end;
70
+ } else {
71
+ const date = isStringFull(value) ? DateTime.fromISO(value, { zone, locale }) : void 0;
72
+ if (!date?.isValid) {
73
+ return void 0;
74
+ }
75
+ first = last = day(date);
76
+ }
77
+ if (min && first < day(min)) {
78
+ return "min";
79
+ }
80
+ if (max && last > day(max)) {
81
+ return "max";
82
+ }
83
+ if (range && maxRange && range.start.plus(maxRange) < range.end) {
84
+ return "maxRange";
85
+ }
86
+ return void 0;
87
+ }
88
+ function formatEndOfDay(day, format) {
89
+ let endOfDayFormat = "";
90
+ let quoted = false;
91
+ for (let i = 0; i < format.length; i++) {
92
+ const char = format[i];
93
+ if (char === "'") {
94
+ quoted = !quoted;
95
+ } else if (char === "H" && !quoted) {
96
+ while (format[i + 1] === "H") {
97
+ i++;
98
+ }
99
+ endOfDayFormat += "'24'";
100
+ continue;
101
+ }
102
+ endOfDayFormat += char;
103
+ }
104
+ return day.startOf("day").toFormat(endOfDayFormat);
105
+ }
106
+
107
+ export { atTimeOfDay, checkDateLimits, endTimeOfRange, formatEndOfDay, lastDayOfRange, parseDateLimits, parseDateRange };
@@ -36,18 +36,7 @@ function _roundDateTime(direction, dateTime, unit, precision) {
36
36
  const ceilDateTime = (dateTime, unit, precision) => _roundDateTime("ceil", dateTime, unit, precision);
37
37
  const floorDateTime = (dateTime, unit, precision) => _roundDateTime("floor", dateTime, unit, precision);
38
38
  const durationRegex = /(-?\d*\.?\d+(?:e[-+]?\d+)?)\s*([a-zμ]*)/i;
39
- const UNIT_MULTIPLIERS = {
40
- milliseconds: 1,
41
- millisecond: 1,
42
- second: 1e3,
43
- seconds: 1e3,
44
- minute: 60 * 1e3,
45
- minutes: 60 * 1e3,
46
- hour: 60 * 60 * 1e3,
47
- hours: 60 * 60 * 1e3,
48
- day: 24 * 60 * 60 * 1e3,
49
- days: 24 * 60 * 60 * 1e3
50
- };
39
+ const DURATION_UNITS = /* @__PURE__ */ new Set(["millisecond", "second", "minute", "hour", "day", "week", "month"]);
51
40
  function parseDuration(str) {
52
41
  const match = durationRegex.exec(str);
53
42
  if (!match) {
@@ -55,7 +44,7 @@ function parseDuration(str) {
55
44
  }
56
45
  const value = parseFloat(match[1]);
57
46
  const unit = match[2].toLowerCase().replace(/s$/, "");
58
- if (unit in UNIT_MULTIPLIERS) {
47
+ if (DURATION_UNITS.has(unit)) {
59
48
  return {
60
49
  [unit]: value
61
50
  };
@@ -1,3 +1,3 @@
1
- const version = "4.1.28";
1
+ const version = "4.2.1";
2
2
 
3
3
  export { version };
@@ -7,6 +7,9 @@ const translation = {
7
7
  close: "Close",
8
8
  copy: "Copy",
9
9
  currentValue: "Current value",
10
+ dateAfterMax: (max) => `Select a date on or before ${max}.`,
11
+ dateBeforeMin: (min) => `Select a date on or after ${min}.`,
12
+ dateRangeTooLong: (maxRange) => `Select a range of ${maxRange} or less.`,
10
13
  goToSlide: (slide, count) => `Go to slide ${slide} of ${count}`,
11
14
  hidePassword: "Hide password",
12
15
  loading: "Loading",
@@ -20,6 +23,8 @@ const translation = {
20
23
  },
21
24
  previousSlide: "Previous slide",
22
25
  progress: "Progress",
26
+ rangeEndTime: "End",
27
+ rangeStartTime: "Start",
23
28
  remove: "Remove",
24
29
  resize: "Resize",
25
30
  scrollToEnd: "Scroll to end",