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.cjs CHANGED
@@ -2076,13 +2076,16 @@ var helpers_exports = /* @__PURE__ */ require_chunk.__export({
2076
2076
  const flatMap = (array, flatMap$1) => {
2077
2077
  return [...array].flatMap(flatMap$1);
2078
2078
  };
2079
- const orderBy = (array, selectors = [], direction = []) => {
2079
+ const orderBy = (array, selectors = [], direction = [], locale, options) => {
2080
2080
  if (selectors.length === 0) selectors = [(t) => t];
2081
2081
  return [...array].sort((a, b) => {
2082
2082
  for (let i = 0; i < selectors.length; i++) {
2083
2083
  const _a = selectors[i]?.(a);
2084
2084
  const _b = selectors[i]?.(b);
2085
2085
  const _direction = direction[i] === "desc" ? -1 : 1;
2086
+ const _locale = locale?.[i];
2087
+ const _options = options?.[i];
2088
+ if (typeof _a === "string" && typeof _b === "string") return _a.localeCompare(_b, _locale, _options) * _direction;
2086
2089
  if (_a > _b) return _direction;
2087
2090
  if (_a < _b) return -_direction;
2088
2091
  }
@@ -2661,12 +2664,13 @@ function calcItems(state) {
2661
2664
  state$1.props.parentId,
2662
2665
  state$1.props.revealFiltered,
2663
2666
  state$1.props.externalSort,
2667
+ state$1.props.locale,
2664
2668
  state$1.sort,
2665
2669
  state$1.filters,
2666
2670
  state$1.filterValues,
2667
2671
  state$1.activeColumns,
2668
2672
  state$1.expanded
2669
- ], ([items = [], id, parentId, revealFiltered, externalSort, sort, filters, filterValues, activeColumns], draft) => {
2673
+ ], ([items = [], id, parentId, revealFiltered, externalSort, locale, sort, filters, filterValues, activeColumns], draft) => {
2670
2674
  const tableItems = items.map((item) => ({
2671
2675
  id: id(item),
2672
2676
  parentId: parentId?.(item),
@@ -2681,10 +2685,12 @@ function calcItems(state) {
2681
2685
  if (!column) return [];
2682
2686
  return column.sortBy.map((sortBy) => ({
2683
2687
  selector: (item) => sortBy(column.value(item), item),
2684
- direction: sort$1.direction
2688
+ direction: sort$1.direction,
2689
+ locale: sort$1.locale ?? locale,
2690
+ options: sort$1.options
2685
2691
  }));
2686
2692
  }).filter(Boolean);
2687
- sorted = orderBy(tableItems, selectors.map((x) => (item) => x.selector(item.value)), selectors.map((x) => x.direction));
2693
+ 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));
2688
2694
  }
2689
2695
  const lookup = /* @__PURE__ */ new Map();
2690
2696
  for (const item of sorted) lookup.set(item.id, item);