@ai-matrx/design-system 0.26.0 → 0.27.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/CHANGELOG.md +18 -0
- package/dist/data-table/copy-helpers.cjs.map +1 -1
- package/dist/data-table/copy-helpers.d.cts +2 -1
- package/dist/data-table/copy-helpers.d.ts +2 -1
- package/dist/data-table/copy-helpers.js.map +1 -1
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/date-filter.cjs +145 -0
- package/dist/data-table/date-filter.cjs.map +1 -0
- package/dist/data-table/date-filter.d.cts +31 -0
- package/dist/data-table/date-filter.d.ts +31 -0
- package/dist/data-table/date-filter.js +125 -0
- package/dist/data-table/date-filter.js.map +1 -0
- package/dist/data-table/filter-engine.cjs +88 -0
- package/dist/data-table/filter-engine.cjs.map +1 -1
- package/dist/data-table/filter-engine.d.cts +2 -1
- package/dist/data-table/filter-engine.d.ts +2 -1
- package/dist/data-table/filter-engine.js +88 -0
- package/dist/data-table/filter-engine.js.map +1 -1
- package/dist/data-table/host.d.cts +2 -1
- package/dist/data-table/host.d.ts +2 -1
- package/dist/data-table/index.cjs +238 -7
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +3 -2
- package/dist/data-table/index.d.ts +3 -2
- package/dist/data-table/index.js +238 -7
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.cjs +2 -0
- package/dist/data-table/infer-filter.cjs.map +1 -1
- package/dist/data-table/infer-filter.d.cts +3 -2
- package/dist/data-table/infer-filter.d.ts +3 -2
- package/dist/data-table/infer-filter.js +2 -0
- package/dist/data-table/infer-filter.js.map +1 -1
- package/dist/data-table/layered-filters.d.cts +2 -1
- package/dist/data-table/layered-filters.d.ts +2 -1
- package/dist/data-table/query-control.cjs.map +1 -1
- package/dist/data-table/query-control.d.cts +2 -1
- package/dist/data-table/query-control.d.ts +2 -1
- package/dist/data-table/query-control.js.map +1 -1
- package/dist/data-table/types.cjs.map +1 -1
- package/dist/data-table/types.d.cts +2 -1
- package/dist/data-table/types.d.ts +2 -1
- package/dist/data-table/url-state.d.cts +2 -1
- package/dist/data-table/url-state.d.ts +2 -1
- package/dist/data-table/xlsx.cjs.map +1 -1
- package/dist/data-table/xlsx.d.cts +2 -1
- package/dist/data-table/xlsx.d.ts +2 -1
- package/dist/data-table/xlsx.js.map +1 -1
- package/dist/field-formats/index.cjs +15 -0
- package/dist/field-formats/index.cjs.map +1 -1
- package/dist/field-formats/index.js +15 -0
- package/dist/field-formats/index.js.map +1 -1
- package/dist/{types-Cu5_eUG1.d.ts → types-D9JBR6ZU.d.ts} +3 -2
- package/dist/{types-DrJXAAoD.d.cts → types-jQddSUnj.d.cts} +3 -2
- package/package.json +11 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { h as MatrxDataTableProps, i as TableViewSnapshot, d as MatrxDataTableRecordControls, j as ColumnMarker, M as MatrxColumnDef } from '../types-
|
|
4
|
-
export { A as AnyOfColumnSearch, B as BOOLEAN_TRUE_COLOR, k as CELL_TINT_CLASS, l as COLOR_RULE_OPS, m as COLOR_RULE_OP_LABELS, n as CellEditType, o as CellEditsMap, p as ChoiceColorLookup, q as ColorBy, r as ColorRule, s as ColorRuleOp, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, E as EMPTY_TABLE_STYLE, t as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, u as MatrxDataTableCoverageConfig, c as MatrxDataTableDensity, v as MatrxDataTableDetailConfig, w as MatrxDataTableEditConfig, x as MatrxDataTableEmptyState, y as MatrxDataTableExpandedDetailConfig, z as MatrxDataTableFacetsConfig, D as MatrxDataTableFilterUi, F as MatrxDataTableGroupingConfig, G as MatrxDataTableHierarchyConfig, H as MatrxDataTableHierarchyMove, I as MatrxDataTableMobileCardControls, J as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, K as MatrxDataTableSelectionConfig, N as MatrxDataTableSourceProcessing, O as MatrxDataTableSpreadsheetConfig, P as MatrxDataTableStyleConfig, Q as MatrxDataTableToolbar, R as MatrxDataTableUrlStateConfig, U as MatrxDataTableVirtualizeConfig, V as MatrxDataTableWindowConfig, W as MatrxTablePagination, X as OPS_WITH_VALUE, Y as ROW_TINT_CLASS, Z as STYLE_COLORS, _ as STYLE_COLOR_LABELS, $ as SWATCH_CLASS, a0 as SortDirection, S as SortState, a1 as StyleColor, a2 as StylePath, a3 as StyleTarget, a4 as TABLE_STYLE_METADATA_KEY, a5 as TABLE_STYLE_VERSION, a6 as TableRankedSearchOptions, b as TableSavedViewsProps, T as TableSearchMatchMode, a7 as TableSearchRole, a8 as TableSearchScope, a9 as TableStyle, aa as TableViewQuery, ab as TextFilterMode, ac as ToolbarFacet, ad as applyStylePath, ae as colorForChoice, af as evaluateRule, ag as inferTableSearchRole, ah as isStyleColor, ai as parseTableStyle, aj as rankTableSearchRows, ak as resolveCellColor, al as resolveRowColor, am as resolveTableSearchScopes, an as stylePath, ao as tableStyleFromMetadata, ap as tableStyleIsEmpty } from '../types-
|
|
3
|
+
import { h as MatrxDataTableProps, i as TableViewSnapshot, d as MatrxDataTableRecordControls, j as ColumnMarker, M as MatrxColumnDef } from '../types-jQddSUnj.cjs';
|
|
4
|
+
export { A as AnyOfColumnSearch, B as BOOLEAN_TRUE_COLOR, k as CELL_TINT_CLASS, l as COLOR_RULE_OPS, m as COLOR_RULE_OP_LABELS, n as CellEditType, o as CellEditsMap, p as ChoiceColorLookup, q as ColorBy, r as ColorRule, s as ColorRuleOp, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, E as EMPTY_TABLE_STYLE, t as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, u as MatrxDataTableCoverageConfig, c as MatrxDataTableDensity, v as MatrxDataTableDetailConfig, w as MatrxDataTableEditConfig, x as MatrxDataTableEmptyState, y as MatrxDataTableExpandedDetailConfig, z as MatrxDataTableFacetsConfig, D as MatrxDataTableFilterUi, F as MatrxDataTableGroupingConfig, G as MatrxDataTableHierarchyConfig, H as MatrxDataTableHierarchyMove, I as MatrxDataTableMobileCardControls, J as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, K as MatrxDataTableSelectionConfig, N as MatrxDataTableSourceProcessing, O as MatrxDataTableSpreadsheetConfig, P as MatrxDataTableStyleConfig, Q as MatrxDataTableToolbar, R as MatrxDataTableUrlStateConfig, U as MatrxDataTableVirtualizeConfig, V as MatrxDataTableWindowConfig, W as MatrxTablePagination, X as OPS_WITH_VALUE, Y as ROW_TINT_CLASS, Z as STYLE_COLORS, _ as STYLE_COLOR_LABELS, $ as SWATCH_CLASS, a0 as SortDirection, S as SortState, a1 as StyleColor, a2 as StylePath, a3 as StyleTarget, a4 as TABLE_STYLE_METADATA_KEY, a5 as TABLE_STYLE_VERSION, a6 as TableRankedSearchOptions, b as TableSavedViewsProps, T as TableSearchMatchMode, a7 as TableSearchRole, a8 as TableSearchScope, a9 as TableStyle, aa as TableViewQuery, ab as TextFilterMode, ac as ToolbarFacet, ad as applyStylePath, ae as colorForChoice, af as evaluateRule, ag as inferTableSearchRole, ah as isStyleColor, ai as parseTableStyle, aj as rankTableSearchRows, ak as resolveCellColor, al as resolveRowColor, am as resolveTableSearchScopes, an as stylePath, ao as tableStyleFromMetadata, ap as tableStyleIsEmpty } from '../types-jQddSUnj.cjs';
|
|
5
5
|
export { MatrxDataTableHost, MatrxDataTableProvider, MatrxTableRowAlchemy, TableDoors, TableEntityRefProps, TableLinkProps, TablePeekProps, TableSidePanelProps, TableToolbarActionProps, TableWindowPanelProps, useMatrxDataTableHost, useMatrxTableRowAlchemy } from './host.cjs';
|
|
6
6
|
import { CopyControlProps } from './copy-types.cjs';
|
|
7
7
|
export { AgentPayloadInput } from './copy-types.cjs';
|
|
@@ -12,6 +12,7 @@ export { default as GenericTablePagination, GenericTablePaginationProps } from '
|
|
|
12
12
|
export { buildRowAgentInput, buildViewAgentInput, buildViewHuman, rowsToCsvFromColumns, rowsToMarkdownTable, rowsToRecordsFromColumns } from './copy-helpers.cjs';
|
|
13
13
|
export { downloadTableAsXlsx } from './xlsx.cjs';
|
|
14
14
|
export { ResolvedFilterKind, collectSelectOptions, filterKindLabel, resolveFilterKind } from './infer-filter.cjs';
|
|
15
|
+
export { DateColumnFilterValue, DateFilterBounds, TIME_RANGE_PRESETS, TIME_RANGE_PRESET_VALUES, TimeRangePreset, TimeRangePresetOption, dateFilterBounds } from './date-filter.cjs';
|
|
15
16
|
export { ScrollPaginationContainer, UseScrollPaginationOptions, UseScrollPaginationResult, useScrollPagination } from './scroll-pagination.cjs';
|
|
16
17
|
export { tableUrlParamPrefix, useTableUrlState } from './url-state.cjs';
|
|
17
18
|
import { c as FormatResult } from '../types-CJWU1Gae.cjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { h as MatrxDataTableProps, i as TableViewSnapshot, d as MatrxDataTableRecordControls, j as ColumnMarker, M as MatrxColumnDef } from '../types-
|
|
4
|
-
export { A as AnyOfColumnSearch, B as BOOLEAN_TRUE_COLOR, k as CELL_TINT_CLASS, l as COLOR_RULE_OPS, m as COLOR_RULE_OP_LABELS, n as CellEditType, o as CellEditsMap, p as ChoiceColorLookup, q as ColorBy, r as ColorRule, s as ColorRuleOp, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, E as EMPTY_TABLE_STYLE, t as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, u as MatrxDataTableCoverageConfig, c as MatrxDataTableDensity, v as MatrxDataTableDetailConfig, w as MatrxDataTableEditConfig, x as MatrxDataTableEmptyState, y as MatrxDataTableExpandedDetailConfig, z as MatrxDataTableFacetsConfig, D as MatrxDataTableFilterUi, F as MatrxDataTableGroupingConfig, G as MatrxDataTableHierarchyConfig, H as MatrxDataTableHierarchyMove, I as MatrxDataTableMobileCardControls, J as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, K as MatrxDataTableSelectionConfig, N as MatrxDataTableSourceProcessing, O as MatrxDataTableSpreadsheetConfig, P as MatrxDataTableStyleConfig, Q as MatrxDataTableToolbar, R as MatrxDataTableUrlStateConfig, U as MatrxDataTableVirtualizeConfig, V as MatrxDataTableWindowConfig, W as MatrxTablePagination, X as OPS_WITH_VALUE, Y as ROW_TINT_CLASS, Z as STYLE_COLORS, _ as STYLE_COLOR_LABELS, $ as SWATCH_CLASS, a0 as SortDirection, S as SortState, a1 as StyleColor, a2 as StylePath, a3 as StyleTarget, a4 as TABLE_STYLE_METADATA_KEY, a5 as TABLE_STYLE_VERSION, a6 as TableRankedSearchOptions, b as TableSavedViewsProps, T as TableSearchMatchMode, a7 as TableSearchRole, a8 as TableSearchScope, a9 as TableStyle, aa as TableViewQuery, ab as TextFilterMode, ac as ToolbarFacet, ad as applyStylePath, ae as colorForChoice, af as evaluateRule, ag as inferTableSearchRole, ah as isStyleColor, ai as parseTableStyle, aj as rankTableSearchRows, ak as resolveCellColor, al as resolveRowColor, am as resolveTableSearchScopes, an as stylePath, ao as tableStyleFromMetadata, ap as tableStyleIsEmpty } from '../types-
|
|
3
|
+
import { h as MatrxDataTableProps, i as TableViewSnapshot, d as MatrxDataTableRecordControls, j as ColumnMarker, M as MatrxColumnDef } from '../types-D9JBR6ZU.js';
|
|
4
|
+
export { A as AnyOfColumnSearch, B as BOOLEAN_TRUE_COLOR, k as CELL_TINT_CLASS, l as COLOR_RULE_OPS, m as COLOR_RULE_OP_LABELS, n as CellEditType, o as CellEditsMap, p as ChoiceColorLookup, q as ColorBy, r as ColorRule, s as ColorRuleOp, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, E as EMPTY_TABLE_STYLE, t as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, u as MatrxDataTableCoverageConfig, c as MatrxDataTableDensity, v as MatrxDataTableDetailConfig, w as MatrxDataTableEditConfig, x as MatrxDataTableEmptyState, y as MatrxDataTableExpandedDetailConfig, z as MatrxDataTableFacetsConfig, D as MatrxDataTableFilterUi, F as MatrxDataTableGroupingConfig, G as MatrxDataTableHierarchyConfig, H as MatrxDataTableHierarchyMove, I as MatrxDataTableMobileCardControls, J as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, K as MatrxDataTableSelectionConfig, N as MatrxDataTableSourceProcessing, O as MatrxDataTableSpreadsheetConfig, P as MatrxDataTableStyleConfig, Q as MatrxDataTableToolbar, R as MatrxDataTableUrlStateConfig, U as MatrxDataTableVirtualizeConfig, V as MatrxDataTableWindowConfig, W as MatrxTablePagination, X as OPS_WITH_VALUE, Y as ROW_TINT_CLASS, Z as STYLE_COLORS, _ as STYLE_COLOR_LABELS, $ as SWATCH_CLASS, a0 as SortDirection, S as SortState, a1 as StyleColor, a2 as StylePath, a3 as StyleTarget, a4 as TABLE_STYLE_METADATA_KEY, a5 as TABLE_STYLE_VERSION, a6 as TableRankedSearchOptions, b as TableSavedViewsProps, T as TableSearchMatchMode, a7 as TableSearchRole, a8 as TableSearchScope, a9 as TableStyle, aa as TableViewQuery, ab as TextFilterMode, ac as ToolbarFacet, ad as applyStylePath, ae as colorForChoice, af as evaluateRule, ag as inferTableSearchRole, ah as isStyleColor, ai as parseTableStyle, aj as rankTableSearchRows, ak as resolveCellColor, al as resolveRowColor, am as resolveTableSearchScopes, an as stylePath, ao as tableStyleFromMetadata, ap as tableStyleIsEmpty } from '../types-D9JBR6ZU.js';
|
|
5
5
|
export { MatrxDataTableHost, MatrxDataTableProvider, MatrxTableRowAlchemy, TableDoors, TableEntityRefProps, TableLinkProps, TablePeekProps, TableSidePanelProps, TableToolbarActionProps, TableWindowPanelProps, useMatrxDataTableHost, useMatrxTableRowAlchemy } from './host.js';
|
|
6
6
|
import { CopyControlProps } from './copy-types.js';
|
|
7
7
|
export { AgentPayloadInput } from './copy-types.js';
|
|
@@ -12,6 +12,7 @@ export { default as GenericTablePagination, GenericTablePaginationProps } from '
|
|
|
12
12
|
export { buildRowAgentInput, buildViewAgentInput, buildViewHuman, rowsToCsvFromColumns, rowsToMarkdownTable, rowsToRecordsFromColumns } from './copy-helpers.js';
|
|
13
13
|
export { downloadTableAsXlsx } from './xlsx.js';
|
|
14
14
|
export { ResolvedFilterKind, collectSelectOptions, filterKindLabel, resolveFilterKind } from './infer-filter.js';
|
|
15
|
+
export { DateColumnFilterValue, DateFilterBounds, TIME_RANGE_PRESETS, TIME_RANGE_PRESET_VALUES, TimeRangePreset, TimeRangePresetOption, dateFilterBounds } from './date-filter.js';
|
|
15
16
|
export { ScrollPaginationContainer, UseScrollPaginationOptions, UseScrollPaginationResult, useScrollPagination } from './scroll-pagination.js';
|
|
16
17
|
export { tableUrlParamPrefix, useTableUrlState } from './url-state.js';
|
|
17
18
|
import { c as FormatResult } from '../types-CJWU1Gae.js';
|
package/dist/data-table/index.js
CHANGED
|
@@ -5043,6 +5043,124 @@ function layeredFilterRuleSummary(rule, fields) {
|
|
|
5043
5043
|
return rule.operator === "between" ? `${fieldLabel} ${operator} ${value} and ${rule.valueTo ?? ""}` : `${fieldLabel} ${operator} ${value}`;
|
|
5044
5044
|
}
|
|
5045
5045
|
|
|
5046
|
+
// src/data-table/date-filter.ts
|
|
5047
|
+
var TIME_RANGE_PRESET_VALUES = [
|
|
5048
|
+
"all",
|
|
5049
|
+
"1m",
|
|
5050
|
+
"15m",
|
|
5051
|
+
"30m",
|
|
5052
|
+
"1h",
|
|
5053
|
+
"2h",
|
|
5054
|
+
"6h",
|
|
5055
|
+
"12h",
|
|
5056
|
+
"today",
|
|
5057
|
+
"yesterday",
|
|
5058
|
+
"this_week",
|
|
5059
|
+
"this_month",
|
|
5060
|
+
"this_year",
|
|
5061
|
+
"older_1m",
|
|
5062
|
+
"older_15m",
|
|
5063
|
+
"older_30m",
|
|
5064
|
+
"older_1h",
|
|
5065
|
+
"older_2h",
|
|
5066
|
+
"older_6h",
|
|
5067
|
+
"older_12h",
|
|
5068
|
+
"older_today",
|
|
5069
|
+
"older_this_week",
|
|
5070
|
+
"older_this_month",
|
|
5071
|
+
"older_this_year"
|
|
5072
|
+
];
|
|
5073
|
+
var TIME_RANGE_PRESETS = [
|
|
5074
|
+
{ value: "all", label: "All time", group: "all" },
|
|
5075
|
+
{ value: "1m", label: "Last minute", group: "recent" },
|
|
5076
|
+
{ value: "15m", label: "Last 15 minutes", group: "recent" },
|
|
5077
|
+
{ value: "30m", label: "Last 30 minutes", group: "recent" },
|
|
5078
|
+
{ value: "1h", label: "Last hour", group: "recent" },
|
|
5079
|
+
{ value: "2h", label: "Last 2 hours", group: "recent" },
|
|
5080
|
+
{ value: "6h", label: "Last 6 hours", group: "recent" },
|
|
5081
|
+
{ value: "12h", label: "Last 12 hours", group: "recent" },
|
|
5082
|
+
{ value: "today", label: "Today", group: "calendar" },
|
|
5083
|
+
{ value: "yesterday", label: "Yesterday", group: "calendar" },
|
|
5084
|
+
{ value: "this_week", label: "This week", group: "calendar" },
|
|
5085
|
+
{ value: "this_month", label: "This month", group: "calendar" },
|
|
5086
|
+
{ value: "this_year", label: "This year", group: "calendar" },
|
|
5087
|
+
{ value: "older_1m", label: "Older than 1 minute", group: "older" },
|
|
5088
|
+
{ value: "older_15m", label: "Older than 15 minutes", group: "older" },
|
|
5089
|
+
{ value: "older_30m", label: "Older than 30 minutes", group: "older" },
|
|
5090
|
+
{ value: "older_1h", label: "Older than 1 hour", group: "older" },
|
|
5091
|
+
{ value: "older_2h", label: "Older than 2 hours", group: "older" },
|
|
5092
|
+
{ value: "older_6h", label: "Older than 6 hours", group: "older" },
|
|
5093
|
+
{ value: "older_12h", label: "Older than 12 hours", group: "older" },
|
|
5094
|
+
{ value: "older_today", label: "Before today", group: "older" },
|
|
5095
|
+
{ value: "older_this_week", label: "Before this week", group: "older" },
|
|
5096
|
+
{ value: "older_this_month", label: "Before this month", group: "older" },
|
|
5097
|
+
{ value: "older_this_year", label: "Before this year", group: "older" }
|
|
5098
|
+
];
|
|
5099
|
+
function startOfDay(date) {
|
|
5100
|
+
const next = new Date(date);
|
|
5101
|
+
next.setHours(0, 0, 0, 0);
|
|
5102
|
+
return next;
|
|
5103
|
+
}
|
|
5104
|
+
function startOfWeek(date) {
|
|
5105
|
+
const next = startOfDay(date);
|
|
5106
|
+
next.setDate(next.getDate() - (next.getDay() === 0 ? 6 : next.getDay() - 1));
|
|
5107
|
+
return next;
|
|
5108
|
+
}
|
|
5109
|
+
function startOfMonth(date) {
|
|
5110
|
+
return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
5111
|
+
}
|
|
5112
|
+
function startOfYear(date) {
|
|
5113
|
+
return new Date(date.getFullYear(), 0, 1);
|
|
5114
|
+
}
|
|
5115
|
+
function validDate(value) {
|
|
5116
|
+
if (value === void 0) return void 0;
|
|
5117
|
+
const date = value instanceof Date ? new Date(value) : new Date(value);
|
|
5118
|
+
return Number.isNaN(date.valueOf()) ? void 0 : date;
|
|
5119
|
+
}
|
|
5120
|
+
function dateFilterBounds(filter, now = /* @__PURE__ */ new Date()) {
|
|
5121
|
+
if (!filter.preset) {
|
|
5122
|
+
return {
|
|
5123
|
+
...filter.since === void 0 ? {} : { since: filter.since },
|
|
5124
|
+
...filter.until === void 0 ? {} : { until: filter.until }
|
|
5125
|
+
};
|
|
5126
|
+
}
|
|
5127
|
+
if (filter.preset === "all") return {};
|
|
5128
|
+
const anchor = validDate(filter.anchor) ?? validDate(now) ?? /* @__PURE__ */ new Date();
|
|
5129
|
+
const ago = (milliseconds) => new Date(anchor.valueOf() - milliseconds).toISOString();
|
|
5130
|
+
const recent = {
|
|
5131
|
+
"1m": 6e4,
|
|
5132
|
+
"15m": 15 * 6e4,
|
|
5133
|
+
"30m": 30 * 6e4,
|
|
5134
|
+
"1h": 60 * 6e4,
|
|
5135
|
+
"2h": 2 * 60 * 6e4,
|
|
5136
|
+
"6h": 6 * 60 * 6e4,
|
|
5137
|
+
"12h": 12 * 60 * 6e4
|
|
5138
|
+
};
|
|
5139
|
+
const duration = recent[filter.preset.replace("older_", "")];
|
|
5140
|
+
if (duration !== void 0) {
|
|
5141
|
+
return filter.preset.startsWith("older_") ? { until: ago(duration) } : { since: ago(duration) };
|
|
5142
|
+
}
|
|
5143
|
+
const starts = {
|
|
5144
|
+
today: startOfDay(anchor),
|
|
5145
|
+
this_week: startOfWeek(anchor),
|
|
5146
|
+
this_month: startOfMonth(anchor),
|
|
5147
|
+
this_year: startOfYear(anchor),
|
|
5148
|
+
older_today: startOfDay(anchor),
|
|
5149
|
+
older_this_week: startOfWeek(anchor),
|
|
5150
|
+
older_this_month: startOfMonth(anchor),
|
|
5151
|
+
older_this_year: startOfYear(anchor)
|
|
5152
|
+
};
|
|
5153
|
+
if (filter.preset === "yesterday") {
|
|
5154
|
+
const until = startOfDay(anchor);
|
|
5155
|
+
const since = new Date(until);
|
|
5156
|
+
since.setDate(since.getDate() - 1);
|
|
5157
|
+
return { since: since.toISOString(), until: until.toISOString() };
|
|
5158
|
+
}
|
|
5159
|
+
const start = starts[filter.preset];
|
|
5160
|
+
if (!start) return {};
|
|
5161
|
+
return filter.preset.startsWith("older_") ? { until: start.toISOString() } : { since: start.toISOString() };
|
|
5162
|
+
}
|
|
5163
|
+
|
|
5046
5164
|
// src/data-table/filter-engine.ts
|
|
5047
5165
|
var SELECT_EMPTY_VALUE = "__empty__";
|
|
5048
5166
|
var SELECT_NOT_EMPTY_VALUE = "__not_empty__";
|
|
@@ -5145,6 +5263,21 @@ function passesColumnFilter(value, filter) {
|
|
|
5145
5263
|
if (filter.max !== void 0 && n2 > filter.max) return false;
|
|
5146
5264
|
return true;
|
|
5147
5265
|
}
|
|
5266
|
+
case "date": {
|
|
5267
|
+
const raw = value instanceof Date ? value : new Date(stringifyCellValue(value));
|
|
5268
|
+
if (Number.isNaN(raw.valueOf())) return false;
|
|
5269
|
+
const { since, until } = dateFilterBounds(filter);
|
|
5270
|
+
const timestamp = raw.valueOf();
|
|
5271
|
+
if (since !== void 0) {
|
|
5272
|
+
const sinceTimestamp = new Date(since).valueOf();
|
|
5273
|
+
if (Number.isNaN(sinceTimestamp) || timestamp < sinceTimestamp) return false;
|
|
5274
|
+
}
|
|
5275
|
+
if (until !== void 0) {
|
|
5276
|
+
const untilTimestamp = new Date(until).valueOf();
|
|
5277
|
+
if (Number.isNaN(untilTimestamp) || timestamp >= untilTimestamp) return false;
|
|
5278
|
+
}
|
|
5279
|
+
return true;
|
|
5280
|
+
}
|
|
5148
5281
|
}
|
|
5149
5282
|
})();
|
|
5150
5283
|
return filter.negated ? !matches : matches;
|
|
@@ -5222,6 +5355,9 @@ function countActiveColumnFilters(filters) {
|
|
|
5222
5355
|
case "number":
|
|
5223
5356
|
if (f.min !== void 0 || f.max !== void 0) n2 += 1;
|
|
5224
5357
|
break;
|
|
5358
|
+
case "date":
|
|
5359
|
+
if (isColumnFilterActive(f)) n2 += 1;
|
|
5360
|
+
break;
|
|
5225
5361
|
}
|
|
5226
5362
|
}
|
|
5227
5363
|
return n2;
|
|
@@ -5237,6 +5373,10 @@ function isColumnFilterActive(filter) {
|
|
|
5237
5373
|
return true;
|
|
5238
5374
|
case "number":
|
|
5239
5375
|
return filter.min !== void 0 || filter.max !== void 0;
|
|
5376
|
+
case "date": {
|
|
5377
|
+
const bounds = dateFilterBounds(filter);
|
|
5378
|
+
return bounds.since !== void 0 || bounds.until !== void 0;
|
|
5379
|
+
}
|
|
5240
5380
|
}
|
|
5241
5381
|
}
|
|
5242
5382
|
function applyRowEdits(row, edits) {
|
|
@@ -6066,7 +6206,7 @@ function ColumnHeaderCell({
|
|
|
6066
6206
|
const visibleFilter = deferredFilter ? draftFilter : filterValue;
|
|
6067
6207
|
const setNegated = (negated) => {
|
|
6068
6208
|
setPendingNegation(negated);
|
|
6069
|
-
if (!visibleFilter) return;
|
|
6209
|
+
if (!visibleFilter || visibleFilter.kind === "date") return;
|
|
6070
6210
|
const next = { ...visibleFilter, ...negated ? { negated: true } : {} };
|
|
6071
6211
|
if (!negated) delete next.negated;
|
|
6072
6212
|
if (deferredFilter) setDraftFilter(next);
|
|
@@ -6074,7 +6214,7 @@ function ColumnHeaderCell({
|
|
|
6074
6214
|
};
|
|
6075
6215
|
const markerLabels = marker ? markerCopy(marker) : void 0;
|
|
6076
6216
|
const accessibleLabel = markerLabels?.label ?? labelText;
|
|
6077
|
-
const menuLabel = accessibleLabel ? `Sort or filter ${accessibleLabel}` : "Sort or filter column";
|
|
6217
|
+
const menuLabel = filterKind ? accessibleLabel ? `Sort or filter ${accessibleLabel}` : "Sort or filter column" : accessibleLabel ? `Sort ${accessibleLabel}` : "Sort column";
|
|
6078
6218
|
const menuContent = /* @__PURE__ */ jsxs22(
|
|
6079
6219
|
PopoverContent,
|
|
6080
6220
|
{
|
|
@@ -6142,7 +6282,7 @@ function ColumnHeaderCell({
|
|
|
6142
6282
|
kind: filterKind,
|
|
6143
6283
|
value: visibleFilter,
|
|
6144
6284
|
onChange: (next) => {
|
|
6145
|
-
const preservingNegation = next && (visibleFilter?.negated ?? pendingNegation) ? { ...next, negated: true } : next;
|
|
6285
|
+
const preservingNegation = next && next.kind !== "date" && (visibleFilter?.negated ?? pendingNegation) ? { ...next, negated: true } : next;
|
|
6146
6286
|
if (deferredFilter) setDraftFilter(preservingNegation);
|
|
6147
6287
|
else onFilterChange(preservingNegation);
|
|
6148
6288
|
},
|
|
@@ -6162,7 +6302,7 @@ function ColumnHeaderCell({
|
|
|
6162
6302
|
allowNullModes
|
|
6163
6303
|
}
|
|
6164
6304
|
) : null,
|
|
6165
|
-
filterKind && allowNegation ? /* @__PURE__ */ jsxs22("div", { className: "mt-2 border-t border-border pt-2", children: [
|
|
6305
|
+
filterKind && filterKind !== "date" && allowNegation ? /* @__PURE__ */ jsxs22("div", { className: "mt-2 border-t border-border pt-2", children: [
|
|
6166
6306
|
/* @__PURE__ */ jsx31("p", { className: "mb-1 text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Match mode" }),
|
|
6167
6307
|
/* @__PURE__ */ jsxs22("div", { className: "grid grid-cols-2 gap-1 rounded-md border p-0.5", children: [
|
|
6168
6308
|
/* @__PURE__ */ jsx31(
|
|
@@ -6521,6 +6661,9 @@ function FilterBody({
|
|
|
6521
6661
|
)
|
|
6522
6662
|
] });
|
|
6523
6663
|
}
|
|
6664
|
+
if (kind === "date") {
|
|
6665
|
+
return /* @__PURE__ */ jsx31(DateFilterBody, { value, onChange });
|
|
6666
|
+
}
|
|
6524
6667
|
return /* @__PURE__ */ jsx31(NumberFilterBody, { value, onChange });
|
|
6525
6668
|
}
|
|
6526
6669
|
function FacetChecklist({
|
|
@@ -6629,6 +6772,72 @@ function FacetChecklist({
|
|
|
6629
6772
|
) : null
|
|
6630
6773
|
] });
|
|
6631
6774
|
}
|
|
6775
|
+
function DateFilterBody({
|
|
6776
|
+
value,
|
|
6777
|
+
onChange
|
|
6778
|
+
}) {
|
|
6779
|
+
const dateValue = value?.kind === "date" ? value : void 0;
|
|
6780
|
+
const isCustom = dateValue !== void 0 && dateValue.preset === void 0;
|
|
6781
|
+
const selected = dateValue?.preset ?? (isCustom ? "__custom__" : "all");
|
|
6782
|
+
const setBound = (bound, raw) => {
|
|
6783
|
+
const next = raw ? new Date(raw) : void 0;
|
|
6784
|
+
const iso = next && !Number.isNaN(next.valueOf()) ? next.toISOString() : void 0;
|
|
6785
|
+
const current = dateValue && dateValue.preset === void 0 ? dateValue : { kind: "date" };
|
|
6786
|
+
const updated = { ...current, [bound]: iso };
|
|
6787
|
+
if (updated.since === void 0 && updated.until === void 0) onChange(void 0);
|
|
6788
|
+
else onChange(updated);
|
|
6789
|
+
};
|
|
6790
|
+
return /* @__PURE__ */ jsxs22("div", { className: "space-y-2 px-1", children: [
|
|
6791
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
|
|
6792
|
+
/* @__PURE__ */ jsx31("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Date range" }),
|
|
6793
|
+
dateValue ? /* @__PURE__ */ jsx31("button", { type: "button", className: "text-[11px] text-muted-foreground hover:text-foreground", onClick: () => onChange(void 0), children: "clear" }) : null
|
|
6794
|
+
] }),
|
|
6795
|
+
/* @__PURE__ */ jsxs22(
|
|
6796
|
+
Select,
|
|
6797
|
+
{
|
|
6798
|
+
value: selected,
|
|
6799
|
+
onValueChange: (next) => {
|
|
6800
|
+
if (next === "all") {
|
|
6801
|
+
onChange(void 0);
|
|
6802
|
+
return;
|
|
6803
|
+
}
|
|
6804
|
+
if (next === "__custom__") {
|
|
6805
|
+
onChange({ kind: "date" });
|
|
6806
|
+
return;
|
|
6807
|
+
}
|
|
6808
|
+
onChange({ kind: "date", preset: next, anchor: (/* @__PURE__ */ new Date()).toISOString() });
|
|
6809
|
+
},
|
|
6810
|
+
children: [
|
|
6811
|
+
/* @__PURE__ */ jsx31(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx31(SelectValue, {}) }),
|
|
6812
|
+
/* @__PURE__ */ jsxs22(SelectContent, { children: [
|
|
6813
|
+
["all", "recent", "calendar", "older"].map((group) => /* @__PURE__ */ jsxs22("div", { children: [
|
|
6814
|
+
group !== "all" ? /* @__PURE__ */ jsx31("p", { className: "px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground", children: group }) : null,
|
|
6815
|
+
TIME_RANGE_PRESETS.filter((option) => option.group === group).map((option) => /* @__PURE__ */ jsx31(SelectItem, { value: option.value, children: option.label }, option.value))
|
|
6816
|
+
] }, group)),
|
|
6817
|
+
/* @__PURE__ */ jsx31(SelectItem, { value: "__custom__", children: "Custom range" })
|
|
6818
|
+
] })
|
|
6819
|
+
]
|
|
6820
|
+
}
|
|
6821
|
+
),
|
|
6822
|
+
isCustom ? /* @__PURE__ */ jsxs22("div", { className: "grid gap-1.5", children: [
|
|
6823
|
+
/* @__PURE__ */ jsxs22("label", { className: "grid gap-0.5 text-[11px] text-muted-foreground", children: [
|
|
6824
|
+
"On or after",
|
|
6825
|
+
/* @__PURE__ */ jsx31(Input, { type: "datetime-local", value: dateTimeLocal(dateValue?.since), onChange: (event) => setBound("since", event.target.value), className: "h-8 text-xs" })
|
|
6826
|
+
] }),
|
|
6827
|
+
/* @__PURE__ */ jsxs22("label", { className: "grid gap-0.5 text-[11px] text-muted-foreground", children: [
|
|
6828
|
+
"Before",
|
|
6829
|
+
/* @__PURE__ */ jsx31(Input, { type: "datetime-local", value: dateTimeLocal(dateValue?.until), onChange: (event) => setBound("until", event.target.value), className: "h-8 text-xs" })
|
|
6830
|
+
] })
|
|
6831
|
+
] }) : null
|
|
6832
|
+
] });
|
|
6833
|
+
}
|
|
6834
|
+
function dateTimeLocal(value) {
|
|
6835
|
+
if (!value) return "";
|
|
6836
|
+
const date = new Date(value);
|
|
6837
|
+
if (Number.isNaN(date.valueOf())) return "";
|
|
6838
|
+
const offset = date.getTimezoneOffset() * 6e4;
|
|
6839
|
+
return new Date(date.valueOf() - offset).toISOString().slice(0, 16);
|
|
6840
|
+
}
|
|
6632
6841
|
function SearchableSelectFilter({
|
|
6633
6842
|
selected,
|
|
6634
6843
|
options,
|
|
@@ -9216,7 +9425,8 @@ var filterSchema = z2.union([
|
|
|
9216
9425
|
z2.object({ kind: z2.literal("text"), value: z2.string(), mode: z2.enum(["contains", "empty", "not_empty", "null", "not_null"]).optional(), negated: z2.boolean().optional() }),
|
|
9217
9426
|
z2.object({ kind: z2.literal("select"), value: z2.string(), values: z2.array(z2.string()).optional(), negated: z2.boolean().optional() }),
|
|
9218
9427
|
z2.object({ kind: z2.literal("boolean"), value: z2.boolean(), negated: z2.boolean().optional() }),
|
|
9219
|
-
z2.object({ kind: z2.literal("number"), min: z2.number().optional(), max: z2.number().optional(), negated: z2.boolean().optional() })
|
|
9428
|
+
z2.object({ kind: z2.literal("number"), min: z2.number().optional(), max: z2.number().optional(), negated: z2.boolean().optional() }),
|
|
9429
|
+
z2.object({ kind: z2.literal("date"), preset: z2.enum(TIME_RANGE_PRESET_VALUES).optional(), since: z2.string().datetime({ offset: true }).optional(), until: z2.string().datetime({ offset: true }).optional(), anchor: z2.string().datetime({ offset: true }).optional() })
|
|
9220
9430
|
]);
|
|
9221
9431
|
var layeredRuleSchema = z2.object({ id: z2.string().min(1), field: z2.string().min(1), operator: z2.enum(LAYERED_FILTER_OPERATORS), value: z2.string(), valueTo: z2.string().optional() });
|
|
9222
9432
|
var snapshotSchema = z2.object({
|
|
@@ -9244,7 +9454,8 @@ function normalizeFilters(raw) {
|
|
|
9244
9454
|
if (value.kind === "text") filters[id] = { kind: "text", value: value.value, ...value.mode === void 0 ? {} : { mode: value.mode }, ...value.negated === void 0 ? {} : { negated: value.negated } };
|
|
9245
9455
|
else if (value.kind === "select") filters[id] = { kind: "select", value: value.value, ...value.values === void 0 ? {} : { values: value.values }, ...value.negated === void 0 ? {} : { negated: value.negated } };
|
|
9246
9456
|
else if (value.kind === "boolean") filters[id] = { kind: "boolean", value: value.value, ...value.negated === void 0 ? {} : { negated: value.negated } };
|
|
9247
|
-
else filters[id] = { kind: "number", ...value.min === void 0 ? {} : { min: value.min }, ...value.max === void 0 ? {} : { max: value.max }, ...value.negated === void 0 ? {} : { negated: value.negated } };
|
|
9457
|
+
else if (value.kind === "number") filters[id] = { kind: "number", ...value.min === void 0 ? {} : { min: value.min }, ...value.max === void 0 ? {} : { max: value.max }, ...value.negated === void 0 ? {} : { negated: value.negated } };
|
|
9458
|
+
else filters[id] = { kind: "date", ...value.preset === void 0 ? {} : { preset: value.preset }, ...value.since === void 0 ? {} : { since: value.since }, ...value.until === void 0 ? {} : { until: value.until }, ...value.anchor === void 0 ? {} : { anchor: value.anchor } };
|
|
9248
9459
|
}
|
|
9249
9460
|
return filters;
|
|
9250
9461
|
}
|
|
@@ -9802,6 +10013,7 @@ function toText(value) {
|
|
|
9802
10013
|
return String(value);
|
|
9803
10014
|
return null;
|
|
9804
10015
|
}
|
|
10016
|
+
var BARE_CALENDAR_DATE = /^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00(?::00(?:\.0+)?)?)?$/;
|
|
9805
10017
|
function toDate(value) {
|
|
9806
10018
|
if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value;
|
|
9807
10019
|
if (typeof value === "number") {
|
|
@@ -9809,6 +10021,20 @@ function toDate(value) {
|
|
|
9809
10021
|
return Number.isNaN(d.getTime()) ? null : d;
|
|
9810
10022
|
}
|
|
9811
10023
|
if (typeof value === "string" && value.trim()) {
|
|
10024
|
+
const bare = BARE_CALENDAR_DATE.exec(value.trim());
|
|
10025
|
+
if (bare) {
|
|
10026
|
+
const [year, month, day] = [
|
|
10027
|
+
Number(bare[1]),
|
|
10028
|
+
Number(bare[2]),
|
|
10029
|
+
Number(bare[3])
|
|
10030
|
+
];
|
|
10031
|
+
const d2 = new Date(year, month - 1, day);
|
|
10032
|
+
d2.setFullYear(year);
|
|
10033
|
+
if (d2.getFullYear() !== year || d2.getMonth() !== month - 1 || d2.getDate() !== day) {
|
|
10034
|
+
return null;
|
|
10035
|
+
}
|
|
10036
|
+
return d2;
|
|
10037
|
+
}
|
|
9812
10038
|
const d = new Date(value);
|
|
9813
10039
|
return Number.isNaN(d.getTime()) ? null : d;
|
|
9814
10040
|
}
|
|
@@ -11531,6 +11757,8 @@ function filterKindLabel(kind) {
|
|
|
11531
11757
|
return "Boolean";
|
|
11532
11758
|
case "number":
|
|
11533
11759
|
return "Number";
|
|
11760
|
+
case "date":
|
|
11761
|
+
return "Date";
|
|
11534
11762
|
case "auto":
|
|
11535
11763
|
return "Auto";
|
|
11536
11764
|
case false:
|
|
@@ -14706,7 +14934,7 @@ function MatrxDataTableCore({
|
|
|
14706
14934
|
"div",
|
|
14707
14935
|
{
|
|
14708
14936
|
"data-matrx-cell-content": true,
|
|
14709
|
-
className: "min-w-0 max-w-full flex-1 whitespace-normal break-words [overflow-wrap:anywhere] sm:[&_*]:min-w-0 sm:[&_*]:whitespace-normal sm:[&_*]:[overflow-wrap:anywhere] sm:[&_.truncate]:whitespace-nowrap sm:[&_[data-slot=badge]]:whitespace-nowrap sm:[&_[data-slot=badge]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]]:w-max sm:[&_[data-matrx-cell-control]]:min-w-max sm:[&_[data-matrx-cell-control]]:max-w-none sm:[&_[data-matrx-cell-control]]:whitespace-nowrap sm:[&_[data-matrx-cell-control]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]_*]:whitespace-nowrap sm:[&_[data-matrx-cell-control]_*]:[overflow-wrap:normal]",
|
|
14937
|
+
className: "min-w-0 max-w-full flex-1 whitespace-normal break-words [overflow-wrap:anywhere] sm:[&_*]:min-w-0 sm:[&_*]:whitespace-normal sm:[&_*]:[overflow-wrap:anywhere] sm:[&_.truncate]:whitespace-nowrap sm:[&_[data-slot=badge]]:whitespace-nowrap sm:[&_[data-slot=badge]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]]:w-max sm:[&_[data-matrx-cell-control]]:min-w-max sm:[&_[data-matrx-cell-control]]:max-w-none sm:[&_[data-matrx-cell-control]]:whitespace-nowrap sm:[&_[data-matrx-cell-control]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]_*]:whitespace-nowrap sm:[&_[data-matrx-cell-control]_*]:[overflow-wrap:normal] [&_[data-matrx-cell-fill]]:!w-full [&_[data-matrx-cell-fill]]:!min-w-0 [&_[data-matrx-cell-fill]]:!max-w-full sm:[&_[data-matrx-cell-fill]]:!w-full sm:[&_[data-matrx-cell-fill]]:!min-w-0 sm:[&_[data-matrx-cell-fill]]:!max-w-full",
|
|
14710
14938
|
children: renderRecordCell(row, col, index)
|
|
14711
14939
|
}
|
|
14712
14940
|
)
|
|
@@ -16014,6 +16242,8 @@ export {
|
|
|
16014
16242
|
SavedViewsControl,
|
|
16015
16243
|
TABLE_STYLE_METADATA_KEY,
|
|
16016
16244
|
TABLE_STYLE_VERSION,
|
|
16245
|
+
TIME_RANGE_PRESETS,
|
|
16246
|
+
TIME_RANGE_PRESET_VALUES,
|
|
16017
16247
|
TableTitleRow,
|
|
16018
16248
|
TableViewTabs,
|
|
16019
16249
|
UNKNOWN_TOTAL_BADGE,
|
|
@@ -16037,6 +16267,7 @@ export {
|
|
|
16037
16267
|
computeVariableWindow,
|
|
16038
16268
|
computeWindow,
|
|
16039
16269
|
createUndoStack,
|
|
16270
|
+
dateFilterBounds,
|
|
16040
16271
|
describeCoverage,
|
|
16041
16272
|
detectSeries,
|
|
16042
16273
|
directClickKinds,
|