@parallelworks/ui 0.81.0 → 0.82.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/ai/components/ChatInput.js +1 -1
- package/dist/ai/components/ChatMessage.js +2 -2
- package/dist/ai/components/agent/AgentMessageParts.js +1 -1
- package/dist/components/Avatar.d.ts +5 -3
- package/dist/components/Avatar.js +6 -2
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CopyButton.d.ts +11 -4
- package/dist/components/CopyButton.js +86 -11
- package/dist/components/CreateModal.js +16 -3
- package/dist/components/Listbox.d.ts +12 -3
- package/dist/components/Listbox.js +38 -15
- package/dist/components/PageHeader.d.ts +3 -1
- package/dist/components/PageHeader.js +6 -3
- package/dist/components/SettingsCard.d.ts +7 -2
- package/dist/components/SettingsCard.js +42 -7
- package/dist/components/Tooltip.js +35 -2
- package/dist/list/ListFilterBar.js +6 -5
- package/dist/list/filterModel.d.ts +4 -0
- package/dist/list/filterModel.js +7 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import { Input } from "../components/Input.js";
|
|
|
9
9
|
import { Combobox } from "../components/Combobox.js";
|
|
10
10
|
import { Calendar } from "../components/DatePicker.js";
|
|
11
11
|
import { Drawer } from "../components/Drawer.js";
|
|
12
|
-
import { DATE_PRESETS, fieldOperators, isDatePreset, isMultiple, parseDay, toDay } from "./filterModel.js";
|
|
12
|
+
import { DATE_PRESETS, fieldOperators, isDatePreset, isMultiple, operatorCount, parseDay, toDay } from "./filterModel.js";
|
|
13
13
|
import { Menu } from "@base-ui/react/menu";
|
|
14
14
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
15
15
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -81,7 +81,7 @@ function FilterChip({ filters, filter, field, stretch = false, answers, onRemove
|
|
|
81
81
|
const shown = all.slice(0, 2);
|
|
82
82
|
const hidden = all.length - shown.length;
|
|
83
83
|
const valueText = unset ? showsAny ? t.any : t.pending : t.list(shown);
|
|
84
|
-
const operatorText = t.operator(filter.op, filter
|
|
84
|
+
const operatorText = t.operator(filter.op, operatorCount(field, filter));
|
|
85
85
|
const noValuePart = filter.op === "isSet" || filter.op === "isNotSet" || field.kind === "boolean" && filter.values[0] !== "false";
|
|
86
86
|
const noOperatorPart = showsAny || field.kind === "boolean" && filter.values[0] !== "false";
|
|
87
87
|
const readAll = unset ? valueText : t.list(all);
|
|
@@ -121,6 +121,7 @@ function FilterChip({ filters, filter, field, stretch = false, answers, onRemove
|
|
|
121
121
|
}),
|
|
122
122
|
!noOperatorPart && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Divider, {}), operators.length > 1 ? /* @__PURE__ */ jsx(OperatorMenu, {
|
|
123
123
|
filters,
|
|
124
|
+
field,
|
|
124
125
|
filter,
|
|
125
126
|
operators,
|
|
126
127
|
open: open === "operator",
|
|
@@ -218,9 +219,9 @@ function FieldMenu({ filters, field, open, onOpenChange }) {
|
|
|
218
219
|
})]
|
|
219
220
|
});
|
|
220
221
|
}
|
|
221
|
-
function OperatorMenu({ filters, filter, operators, open, onOpenChange }) {
|
|
222
|
+
function OperatorMenu({ filters, field, filter, operators, open, onOpenChange }) {
|
|
222
223
|
const t = useStrings().filters;
|
|
223
|
-
const count = filter
|
|
224
|
+
const count = operatorCount(field, filter);
|
|
224
225
|
const text = t.operator(filter.op, count);
|
|
225
226
|
return /* @__PURE__ */ jsxs(Menu.Root, {
|
|
226
227
|
open,
|
|
@@ -246,7 +247,7 @@ function OperatorMenu({ filters, filter, operators, open, onOpenChange }) {
|
|
|
246
247
|
},
|
|
247
248
|
children: operators.map((op) => /* @__PURE__ */ jsx(MenuRadioItem, {
|
|
248
249
|
value: op,
|
|
249
|
-
children: t.operator(op,
|
|
250
|
+
children: t.operator(op, count)
|
|
250
251
|
}, op))
|
|
251
252
|
}) })]
|
|
252
253
|
});
|
|
@@ -79,6 +79,10 @@ export type DatePreset = (typeof DATE_PRESETS)[number];
|
|
|
79
79
|
type AnyField = FilterField<any>;
|
|
80
80
|
export declare function fieldOperators(field: AnyField): readonly FilterOperator[];
|
|
81
81
|
export declare function isMultiple(field: AnyField): boolean;
|
|
82
|
+
/** How many values a condition's words are for: the values chosen, and one while none is, so a
|
|
83
|
+
* chip just added reads "is" rather than "is any of"; never more than one where only one can be
|
|
84
|
+
* chosen. Hosts that word the condition by count, as a plural rule does, get the right form. */
|
|
85
|
+
export declare function operatorCount(field: AnyField, filter: ActiveFilter): number;
|
|
82
86
|
/** Whether a filter narrows anything yet: a value chosen, or a condition that needs none. */
|
|
83
87
|
export declare function isComplete(filter: ActiveFilter): boolean;
|
|
84
88
|
/** Whether two sets of filters say the same, ignoring order, as Save or Update buttons ask. */
|
package/dist/list/filterModel.js
CHANGED
|
@@ -25,6 +25,12 @@ function fieldOperators(field) {
|
|
|
25
25
|
function isMultiple(field) {
|
|
26
26
|
return (field.kind === "enum" || field.kind === "people") && field.multiple !== false;
|
|
27
27
|
}
|
|
28
|
+
/** How many values a condition's words are for: the values chosen, and one while none is, so a
|
|
29
|
+
* chip just added reads "is" rather than "is any of"; never more than one where only one can be
|
|
30
|
+
* chosen. Hosts that word the condition by count, as a plural rule does, get the right form. */
|
|
31
|
+
function operatorCount(field, filter) {
|
|
32
|
+
return isMultiple(field) ? Math.max(filter.values.length, 1) : 1;
|
|
33
|
+
}
|
|
28
34
|
/** Whether a filter narrows anything yet: a value chosen, or a condition that needs none. */
|
|
29
35
|
function isComplete(filter) {
|
|
30
36
|
if (filter.op === "isSet" || filter.op === "isNotSet") return true;
|
|
@@ -305,4 +311,4 @@ function applyFilterList(rows, filters, fields, now = /* @__PURE__ */ new Date()
|
|
|
305
311
|
return rows.filter((row) => checks.every(({ field, filter }) => matchFilter(field, filter, row, now)));
|
|
306
312
|
}
|
|
307
313
|
//#endregion
|
|
308
|
-
export { DATE_PRESETS, applyFilterList, dateFilterRange, decodeFilters, encodeFilters, fieldOperators, filterParamKeys, fromStored, isComplete, isDatePreset, isMultiple, matchFilter, parseDay, sameFilters, toDay, toStored, withFilterParams };
|
|
314
|
+
export { DATE_PRESETS, applyFilterList, dateFilterRange, decodeFilters, encodeFilters, fieldOperators, filterParamKeys, fromStored, isComplete, isDatePreset, isMultiple, matchFilter, operatorCount, parseDay, sameFilters, toDay, toStored, withFilterParams };
|