@vuu-ui/vuu-utils 3.5.0-beta.3 → 3.5.0-beta.4

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.5.0-beta.3",
2
+ "version": "3.5.0-beta.4",
3
3
  "author": "heswell",
4
4
  "main": "./src/index.js",
5
5
  "license": "Apache-2.0",
@@ -15,14 +15,14 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@dnd-kit/react": "^0.1.21",
18
- "@vuu-ui/vuu-data-types": "3.5.0-beta.3",
19
- "@vuu-ui/vuu-table-types": "3.5.0-beta.3",
20
- "@vuu-ui/vuu-filter-types": "3.5.0-beta.3",
21
- "@vuu-ui/vuu-protocol-types": "3.5.0-beta.3"
18
+ "@vuu-ui/vuu-data-types": "3.5.0-beta.4",
19
+ "@vuu-ui/vuu-table-types": "3.5.0-beta.4",
20
+ "@vuu-ui/vuu-filter-types": "3.5.0-beta.4",
21
+ "@vuu-ui/vuu-protocol-types": "3.5.0-beta.4"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@internationalized/date": "^3.0.0",
25
- "@vuu-ui/vuu-filter-parser": "3.5.0-beta.3",
25
+ "@vuu-ui/vuu-filter-parser": "3.5.0-beta.4",
26
26
  "clsx": "^2.0.0",
27
27
  "react": "^19.2.3",
28
28
  "react-dom": "^19.2.3"
@@ -5,14 +5,14 @@ import { getTemporalInfo } from "../date/temporal.js";
5
5
  import { startOfDay } from "../date/time-zone.js";
6
6
  import { getFractionalSecondDigits, temporalFormatter } from "../formatting-utils.js";
7
7
  const pad2 = (n)=>`${n}`.padStart(2, "0");
8
- const getTemporalCellFilter = (column, value, dateOnly = false)=>{
8
+ const getTemporalCellFilter = (column, value, columnFilter = false)=>{
9
9
  const temporalInfo = getTemporalInfo(column);
10
10
  if (void 0 === temporalInfo) return;
11
11
  const { encoding, kind, timeZone } = temporalInfo;
12
12
  const ts = EpochTimestamp.fromWire(value, encoding);
13
13
  if (void 0 === ts) return;
14
14
  const pattern = dateTimePattern(column.type, kind);
15
- if ("date" === kind || dateOnly && "datetime" === kind || void 0 === pattern.time) {
15
+ if ("date" === kind || columnFilter && "datetime" === kind || void 0 === pattern.time) {
16
16
  const { date = defaultPatternsByType.date } = pattern;
17
17
  const start = EpochTimestamp.fromMillis(startOfDay(ts.epochMillis, timeZone));
18
18
  return {
@@ -25,12 +25,15 @@ const getTemporalCellFilter = (column, value, dateOnly = false)=>{
25
25
  value: `${start.toWire(encoding)}`
26
26
  };
27
27
  }
28
- const digits = Math.max(0, Math.min(9, getFractionalSecondDigits(column, temporalInfo)));
28
+ const digits = columnFilter ? "hh:mm:ss.ms" === pattern.time ? 3 : 0 : Math.max(0, Math.min(9, getFractionalSecondDigits(column, temporalInfo)));
29
29
  const unit = "epochNanos" === encoding ? 1n : 1000000n;
30
30
  const period = 10n ** BigInt(9 - digits);
31
31
  const startNanos = ts.epochNanos - ts.epochNanos % period;
32
32
  const start = EpochTimestamp.fromNanos(startNanos);
33
- const label = temporalFormatter(column, temporalInfo)(start.toWire(encoding));
33
+ const label = columnFilter ? formatTimestamp(pattern, {
34
+ fractionalSecondDigits: digits,
35
+ timeZone
36
+ })(start) : temporalFormatter(column, temporalInfo)(start.toWire(encoding));
34
37
  if ("time" === kind) {
35
38
  const { hour, minute, second } = ts.getFields(timeZone);
36
39
  const fraction = ts.fractionalSecond(digits);
@@ -9,7 +9,7 @@ export interface TemporalCellFilter {
9
9
  * Describes a filter that matches a temporal value at the precision with which
10
10
  * it is displayed by the given column descriptor, e.g. where the descriptor
11
11
  * displays milliseconds, the filter matches the whole millisecond.
12
- * - date (or dateOnly) => the whole day, as a start of day value
12
+ * - date => the whole day, as a start of day value
13
13
  * - time => a time of day (TimeString), truncated to the displayed precision
14
14
  * - datetime => a range, unless the displayed precision is that of the encoding
15
15
  * The filter is suitable for FilterAggregator.add (with the same descriptor) and
@@ -17,8 +17,11 @@ export interface TemporalCellFilter {
17
17
  *
18
18
  * @param column the descriptor of the filter (or table cell) displaying the value
19
19
  * @param value a value as received from the server
20
- * @param dateOnly a 'datetime' value is displayed as a date (e.g. by a
21
- * DatePicker). Ignored for 'time' descriptors.
20
+ * @param columnFilter the value is displayed by a ColumnFilter, rather than a
21
+ * table cell. A ColumnFilter displays a 'datetime' value as a date (DatePicker,
22
+ * so the filter is the whole day) and a 'time' value to the second, or to the
23
+ * millisecond with the 'hh:mm:ss.ms' pattern (TimeInput supports no finer
24
+ * precision, whereas a table cell displays nanos by default).
22
25
  * @returns undefined if value is empty or column is not temporal
23
26
  */
24
- export declare const getTemporalCellFilter: (column: DataValueDescriptor, value: unknown, dateOnly?: boolean) => TemporalCellFilter | undefined;
27
+ export declare const getTemporalCellFilter: (column: DataValueDescriptor, value: unknown, columnFilter?: boolean) => TemporalCellFilter | undefined;