@upbound/monarch-blocks 0.2.0 → 0.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/cel-filter-bar.d.ts +3 -1
- package/dist/cel-filter-bar.js +14 -0
- package/dist/cel-filter-bar.js.map +1 -1
- package/dist/code-block.d.ts +8 -2
- package/dist/code-block.js +85 -21
- package/dist/code-block.js.map +1 -1
- package/dist/data-table.d.ts +17 -10
- package/dist/data-table.js +11 -11
- package/dist/data-table.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +141 -63
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cel-filter-bar.d.ts
CHANGED
|
@@ -124,6 +124,8 @@ declare function getDefaultOperator(filterType: CelFilterType): CelOperator;
|
|
|
124
124
|
declare function applyOperatorChange(condition: CelFilterCondition, newOperator: CelOperator, shape: CelFilterShape | undefined): CelFilterCondition;
|
|
125
125
|
/** Maps parsed CEL aliases back to schema column ids when building the filter tree. */
|
|
126
126
|
declare function denormalizeColumnIdWithReservedNames(columnId: string): string;
|
|
127
|
+
/** Rewrites CEL aliases back to schema column names for API requests and external consumers. */
|
|
128
|
+
declare function denormalizeColumnsWithReservedNames(expression: string): string;
|
|
127
129
|
|
|
128
130
|
/**
|
|
129
131
|
* Escapes a user-provided string literal for safe embedding inside a CEL
|
|
@@ -184,4 +186,4 @@ declare function isRelativeDurationPreset(value: string): value is RelativeDurat
|
|
|
184
186
|
|
|
185
187
|
declare function CelFilterBar({ tree, onChange, schema, onCompileResultChange, onRestrictedOptionSelect, showClearButton, className, }: CelFilterBarProps): react_jsx_runtime.JSX.Element;
|
|
186
188
|
|
|
187
|
-
export { CelColumnDefinition, CelFilterBar, CelFilterBarProps, CelFilterCondition, CelFilterSchema, CelFilterTree, CelOperator, CompileResult, DateCelValue, MapKeyCelValue, MultiTextCelValue, PillActiveSurface, RELATIVE_DURATION_PRESET_VALUES, RelativeDurationPreset, ValidationIssue, allowsMultipleConditions, appendCondition, applyDisplayRules, applyOperatorChange, calendarDayStartInstant, celStringLiteral, compileCelFilterTree, computeIsEmitReady, createCelNodeId, createDefaultCondition, createEmptyCelFilterTree, dateBoundaryForOperator, denormalizeColumnIdWithReservedNames, escapeCelString, formatCalendarDateUtc, formatInstantLabel, getAllowedOperators, getColumnEmitOn, getDefaultOperator, getOperatorLabel, getQuantifierLabel, isDateRangeOperator, isDateRelativeOperator, isDateWindowOperator, isMultiTextColumn, isRealCalendarDay, isRelativeDateCelValue, isRelativeDurationPreset, mergeContextualIntoCelTree, parseCalendarDate, readDateCelValue, readMapKeyCelValue, readMultiTextCelValue, readTimeOfDay, removeConditionById, replaceCondition, resolveColumnDefinition, resolveFilterShape, validateCondition, withTimeOfDay };
|
|
189
|
+
export { CelColumnDefinition, CelFilterBar, CelFilterBarProps, CelFilterCondition, CelFilterSchema, CelFilterTree, CelOperator, CompileResult, DateCelValue, MapKeyCelValue, MultiTextCelValue, PillActiveSurface, RELATIVE_DURATION_PRESET_VALUES, RelativeDurationPreset, ValidationIssue, allowsMultipleConditions, appendCondition, applyDisplayRules, applyOperatorChange, calendarDayStartInstant, celStringLiteral, compileCelFilterTree, computeIsEmitReady, createCelNodeId, createDefaultCondition, createEmptyCelFilterTree, dateBoundaryForOperator, denormalizeColumnIdWithReservedNames, denormalizeColumnsWithReservedNames, escapeCelString, formatCalendarDateUtc, formatInstantLabel, getAllowedOperators, getColumnEmitOn, getDefaultOperator, getOperatorLabel, getQuantifierLabel, isDateRangeOperator, isDateRelativeOperator, isDateWindowOperator, isMultiTextColumn, isRealCalendarDay, isRelativeDateCelValue, isRelativeDurationPreset, mergeContextualIntoCelTree, parseCalendarDate, readDateCelValue, readMapKeyCelValue, readMultiTextCelValue, readTimeOfDay, removeConditionById, replaceCondition, resolveColumnDefinition, resolveFilterShape, validateCondition, withTimeOfDay };
|
package/dist/cel-filter-bar.js
CHANGED
|
@@ -422,6 +422,10 @@ var RESERVED_COLUMN_CEL_IDENTIFIERS = {
|
|
|
422
422
|
var CEL_IDENTIFIER_TO_COLUMN_ID = Object.fromEntries(
|
|
423
423
|
Object.entries(RESERVED_COLUMN_CEL_IDENTIFIERS).map(([columnId, celIdentifier]) => [celIdentifier, columnId])
|
|
424
424
|
);
|
|
425
|
+
var RESERVED_FIELD_OPERATOR_PATTERN = "(?=\\s*(?:in\\b|==|!=|<=|>=|<|>|\\.))";
|
|
426
|
+
function escapeRegExp(value) {
|
|
427
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
428
|
+
}
|
|
425
429
|
var ENUM_OPERATORS = ["is", "is_not"];
|
|
426
430
|
var TEXT_OPERATORS = [
|
|
427
431
|
"is",
|
|
@@ -716,6 +720,15 @@ function denormalizeColumnIdWithReservedNames(columnId) {
|
|
|
716
720
|
var _a;
|
|
717
721
|
return (_a = CEL_IDENTIFIER_TO_COLUMN_ID[columnId]) != null ? _a : columnId;
|
|
718
722
|
}
|
|
723
|
+
function denormalizeColumnsWithReservedNames(expression) {
|
|
724
|
+
return Object.entries(RESERVED_COLUMN_CEL_IDENTIFIERS).reduce(
|
|
725
|
+
(denormalized, [columnId, celIdentifier]) => denormalized.replace(
|
|
726
|
+
new RegExp(`\\b${escapeRegExp(celIdentifier)}\\b${RESERVED_FIELD_OPERATOR_PATTERN}`, "g"),
|
|
727
|
+
columnId
|
|
728
|
+
),
|
|
729
|
+
expression
|
|
730
|
+
);
|
|
731
|
+
}
|
|
719
732
|
|
|
720
733
|
// src/lib/cel-filter/compile/validate-condition.ts
|
|
721
734
|
function statusFromIssues(issues) {
|
|
@@ -1813,6 +1826,7 @@ export {
|
|
|
1813
1826
|
createEmptyCelFilterTree,
|
|
1814
1827
|
dateBoundaryForOperator,
|
|
1815
1828
|
denormalizeColumnIdWithReservedNames,
|
|
1829
|
+
denormalizeColumnsWithReservedNames,
|
|
1816
1830
|
escapeCelString,
|
|
1817
1831
|
formatCalendarDateUtc,
|
|
1818
1832
|
formatInstantLabel,
|