schummar-table 0.49.2 → 0.50.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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ExporterEntry } from "./exporter-ztSF5GbY.cjs";
2
- import { Column, CommonFilterProps, FilterImplementation, FunctionWithDeps, Id, InternalColumn, InternalTableState, MemoizedTableTheme, PartialTableTheme, Sort, SortDirection, TableItem, TableProps, TableRef, TableStateStorage, TableTheme } from "./types-B8qZrq0C.cjs";
2
+ import { Column, CommonFilterProps, FilterImplementation, FunctionWithDeps, Id, InternalColumn, InternalTableState, MemoizedTableTheme, PartialTableTheme, Sort, SortDirection, TableItem, TableProps, TableRef, TableStateStorage, TableTheme } from "./types-BAknIm9h.cjs";
3
3
  import * as _emotion_react_jsx_runtime1 from "@emotion/react/jsx-runtime";
4
4
  import * as react0 from "react";
5
5
  import { ComponentType, ForwardedRef, HTMLProps, ReactNode } from "react";
@@ -218,7 +218,7 @@ declare namespace helpers_d_exports {
218
218
  export { asNumber, asNumberOrArray, asString, asStringOrArray, castArray, cx, defaultEquals, flatMap, getAncestors, getDescendants, identity, intersect, isTruthy, orderBy, subStringMatch, uniq };
219
219
  }
220
220
  declare const flatMap: <T, S>(array: Iterable<T>, flatMap: (t: T) => S[]) => S[];
221
- declare const orderBy: <T>(array: T[], selectors?: ((t: T) => any)[], direction?: ("desc" | "asc")[]) => T[];
221
+ declare const orderBy: <T>(array: T[], selectors?: ((t: T) => any)[], direction?: ("desc" | "asc")[], locale?: (string | undefined)[], options?: (Intl.CollatorOptions | undefined)[]) => T[];
222
222
  declare const uniq: <T>(array: T[]) => T[];
223
223
  declare const intersect: <T>(a: Iterable<T>, b: {
224
224
  has(t: T): boolean;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ExporterEntry } from "./exporter-BxgFAyWA.js";
2
- import { Column, CommonFilterProps, FilterImplementation, FunctionWithDeps, Id, InternalColumn, InternalTableState, MemoizedTableTheme, PartialTableTheme, Sort, SortDirection, TableItem, TableProps, TableRef, TableStateStorage, TableTheme } from "./types-yIYBwMnZ.js";
2
+ import { Column, CommonFilterProps, FilterImplementation, FunctionWithDeps, Id, InternalColumn, InternalTableState, MemoizedTableTheme, PartialTableTheme, Sort, SortDirection, TableItem, TableProps, TableRef, TableStateStorage, TableTheme } from "./types-Bm2QIKdr.js";
3
3
  import * as react0 from "react";
4
4
  import { ComponentType, ForwardedRef, HTMLProps, ReactNode } from "react";
5
5
  import * as _emotion_react_jsx_runtime1 from "@emotion/react/jsx-runtime";
@@ -216,7 +216,7 @@ declare namespace helpers_d_exports {
216
216
  export { asNumber, asNumberOrArray, asString, asStringOrArray, castArray, cx, defaultEquals, flatMap, getAncestors, getDescendants, identity, intersect, isTruthy, orderBy, subStringMatch, uniq };
217
217
  }
218
218
  declare const flatMap: <T, S>(array: Iterable<T>, flatMap: (t: T) => S[]) => S[];
219
- declare const orderBy: <T>(array: T[], selectors?: ((t: T) => any)[], direction?: ("desc" | "asc")[]) => T[];
219
+ declare const orderBy: <T>(array: T[], selectors?: ((t: T) => any)[], direction?: ("desc" | "asc")[], locale?: (string | undefined)[], options?: (Intl.CollatorOptions | undefined)[]) => T[];
220
220
  declare const uniq: <T>(array: T[]) => T[];
221
221
  declare const intersect: <T>(a: Iterable<T>, b: {
222
222
  has(t: T): boolean;
package/dist/index.js CHANGED
@@ -2070,13 +2070,16 @@ var helpers_exports = /* @__PURE__ */ __export({
2070
2070
  const flatMap = (array, flatMap$1) => {
2071
2071
  return [...array].flatMap(flatMap$1);
2072
2072
  };
2073
- const orderBy = (array, selectors = [], direction = []) => {
2073
+ const orderBy = (array, selectors = [], direction = [], locale, options) => {
2074
2074
  if (selectors.length === 0) selectors = [(t) => t];
2075
2075
  return [...array].sort((a, b) => {
2076
2076
  for (let i = 0; i < selectors.length; i++) {
2077
2077
  const _a = selectors[i]?.(a);
2078
2078
  const _b = selectors[i]?.(b);
2079
2079
  const _direction = direction[i] === "desc" ? -1 : 1;
2080
+ const _locale = locale?.[i];
2081
+ const _options = options?.[i];
2082
+ if (typeof _a === "string" && typeof _b === "string") return _a.localeCompare(_b, _locale, _options) * _direction;
2080
2083
  if (_a > _b) return _direction;
2081
2084
  if (_a < _b) return -_direction;
2082
2085
  }
@@ -2655,12 +2658,13 @@ function calcItems(state) {
2655
2658
  state$1.props.parentId,
2656
2659
  state$1.props.revealFiltered,
2657
2660
  state$1.props.externalSort,
2661
+ state$1.props.locale,
2658
2662
  state$1.sort,
2659
2663
  state$1.filters,
2660
2664
  state$1.filterValues,
2661
2665
  state$1.activeColumns,
2662
2666
  state$1.expanded
2663
- ], ([items = [], id, parentId, revealFiltered, externalSort, sort, filters, filterValues, activeColumns], draft) => {
2667
+ ], ([items = [], id, parentId, revealFiltered, externalSort, locale, sort, filters, filterValues, activeColumns], draft) => {
2664
2668
  const tableItems = items.map((item) => ({
2665
2669
  id: id(item),
2666
2670
  parentId: parentId?.(item),
@@ -2675,10 +2679,12 @@ function calcItems(state) {
2675
2679
  if (!column) return [];
2676
2680
  return column.sortBy.map((sortBy) => ({
2677
2681
  selector: (item) => sortBy(column.value(item), item),
2678
- direction: sort$1.direction
2682
+ direction: sort$1.direction,
2683
+ locale: sort$1.locale ?? locale,
2684
+ options: sort$1.options
2679
2685
  }));
2680
2686
  }).filter(Boolean);
2681
- sorted = orderBy(tableItems, selectors.map((x) => (item) => x.selector(item.value)), selectors.map((x) => x.direction));
2687
+ sorted = orderBy(tableItems, selectors.map((x) => (item) => x.selector(item.value)), selectors.map((x) => x.direction), selectors.map((x) => x.locale), selectors.map((x) => x.options));
2682
2688
  }
2683
2689
  const lookup = /* @__PURE__ */ new Map();
2684
2690
  for (const item of sorted) lookup.set(item.id, item);