@dloizides/ui-tables 3.4.0 → 3.6.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 CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  ### Added
6
6
 
7
+ - `Filters`: optional `wrapperTestID` on every field puts an id on the field's outer wrapper only; control ids (`-input`, `-from`, `-to`) keep deriving from `testID`. Default unchanged.
7
8
  - `WorkQueue`: a StatusLedger of waiting work, oldest first, in three variants (`WorkQueueVariant.Bands` default, `Table` with a toned age label, `Bar` with an age bar against `limitMs`); age band headings with counts, `buildAgeColumn` takes the cell component (`AgeLabelCell` / `AgeBarCell`).
8
9
  - `fetchAllPages(fetchPage, { pageSize, maxPages, concurrency = 2 })`: reads every page from page 1 in batches of `concurrency`, stops at `maxPages`, returns `{ rows, truncated }`.
9
10
  - `useReportFilterQuery({ params, setParams, keys })`: router-agnostic URL state for `ReportFilters`, plus `reportFiltersToParams` (every key, `undefined` clears).
package/dist/index.d.mts CHANGED
@@ -591,6 +591,8 @@ interface FilterFieldBase {
591
591
  label: string;
592
592
  /** Override the derived testID (`${barTestID}-field-${key}` by default). */
593
593
  testID?: string;
594
+ /** testID of the field's outer wrapper only; defaults to the field testID. Control ids keep deriving from `testID`. */
595
+ wrapperTestID?: string;
594
596
  /** Let the field grow to fill spare width (search boxes usually do). Default false. */
595
597
  grow?: boolean;
596
598
  /** Minimum width (px) before the field wraps to the next line. Sensible per-kind default. */
@@ -611,6 +613,8 @@ interface SelectFilterField extends FilterFieldBase {
611
613
  interface TextFilterField extends FilterFieldBase {
612
614
  kind: 'text';
613
615
  placeholder?: string;
616
+ /** testID of the input itself; defaults to `<field testID>-input`. */
617
+ inputTestID?: string;
614
618
  }
615
619
  /** A numeric text input (`keyboardType="numeric"`). Value stays a string (''=unset). */
616
620
  interface NumberFilterField extends FilterFieldBase {
package/dist/index.d.ts CHANGED
@@ -591,6 +591,8 @@ interface FilterFieldBase {
591
591
  label: string;
592
592
  /** Override the derived testID (`${barTestID}-field-${key}` by default). */
593
593
  testID?: string;
594
+ /** testID of the field's outer wrapper only; defaults to the field testID. Control ids keep deriving from `testID`. */
595
+ wrapperTestID?: string;
594
596
  /** Let the field grow to fill spare width (search boxes usually do). Default false. */
595
597
  grow?: boolean;
596
598
  /** Minimum width (px) before the field wraps to the next line. Sensible per-kind default. */
@@ -611,6 +613,8 @@ interface SelectFilterField extends FilterFieldBase {
611
613
  interface TextFilterField extends FilterFieldBase {
612
614
  kind: 'text';
613
615
  placeholder?: string;
616
+ /** testID of the input itself; defaults to `<field testID>-input`. */
617
+ inputTestID?: string;
614
618
  }
615
619
  /** A numeric text input (`keyboardType="numeric"`). Value stays a string (''=unset). */
616
620
  interface NumberFilterField extends FilterFieldBase {
package/dist/index.js CHANGED
@@ -1621,7 +1621,7 @@ function BooleanField({ field, barTestID, value, onChange }) {
1621
1621
  const { theme } = uiFeedback.useUi();
1622
1622
  const { colors, palette } = theme;
1623
1623
  const testID = field.testID ?? fieldTestID(barTestID, field.key);
1624
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: filterStyles.switchRow, testID, children: [
1624
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: filterStyles.switchRow, testID: field.wrapperTestID ?? testID, children: [
1625
1625
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [uiForms.controlStyles.subLabel, { color: colors.text }], children: field.label }),
1626
1626
  /* @__PURE__ */ jsxRuntime.jsx(
1627
1627
  reactNative.Pressable,
@@ -1693,6 +1693,10 @@ function SelectField({ field, barTestID, value, onChange, placeholder, dropdownH
1693
1693
  }
1694
1694
  );
1695
1695
  }
1696
+ function inputTestID(field, barTestID) {
1697
+ const custom = field.kind === "text" ? field.inputTestID : void 0;
1698
+ return custom ?? `${field.testID ?? fieldTestID(barTestID, field.key)}-input`;
1699
+ }
1696
1700
  function TextField({ field, barTestID, value, onChange, onSubmit }) {
1697
1701
  const { theme } = uiFeedback.useUi();
1698
1702
  const { colors } = theme;
@@ -1700,7 +1704,7 @@ function TextField({ field, barTestID, value, onChange, onSubmit }) {
1700
1704
  const { a11yProps, hintNode } = a11y.useA11y({
1701
1705
  label: field.label,
1702
1706
  hint: field.accessibilityHint,
1703
- testID: `${field.testID ?? fieldTestID(barTestID, field.key)}-input`
1707
+ testID: inputTestID(field, barTestID)
1704
1708
  });
1705
1709
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1706
1710
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1865,7 +1869,7 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
1865
1869
  error: field.kind === "dateRange" ? field.error : void 0,
1866
1870
  label: field.label,
1867
1871
  labelVariant: "control",
1868
- testID,
1872
+ testID: field.wrapperTestID ?? testID,
1869
1873
  children: body
1870
1874
  }
1871
1875
  );