@economic/taco 2.28.1 → 2.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/dist/components/Icon/components/Phone.d.ts +3 -0
  2. package/dist/components/Icon/components/index.d.ts +1 -1
  3. package/dist/components/Input/Input.d.ts +1 -1
  4. package/dist/components/List/components/Item.d.ts +1 -1
  5. package/dist/components/Menu/components/Item.d.ts +1 -1
  6. package/dist/components/Menu/components/Link.d.ts +1 -1
  7. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  8. package/dist/components/Select2/components/Option.d.ts +2 -2
  9. package/dist/components/Select2/components/Search.d.ts +1 -1
  10. package/dist/components/Tag/Tag.d.ts +1 -1
  11. package/dist/esm/index.css +10 -6
  12. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +45 -43
  13. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +1 -1
  15. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Icon/components/Phone.js +17 -0
  17. package/dist/esm/packages/taco/src/components/Icon/components/Phone.js.map +1 -0
  18. package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
  19. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +1 -1
  21. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js +9 -2
  23. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +4 -1
  25. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  26. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js +3 -7
  27. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js.map +1 -1
  28. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +1 -1
  29. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  30. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +11 -9
  31. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  32. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +3 -3
  33. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  34. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js +4 -2
  35. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js.map +1 -1
  36. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js +9 -8
  37. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
  38. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +7 -1
  39. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
  40. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +15 -11
  41. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  42. package/dist/esm/packages/taco/src/utils/date.js +3 -3
  43. package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
  44. package/dist/index.css +10 -6
  45. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +1 -3
  46. package/dist/primitives/Table/useTableManager/util/columns.d.ts +1 -1
  47. package/dist/taco.cjs.development.js +128 -91
  48. package/dist/taco.cjs.development.js.map +1 -1
  49. package/dist/taco.cjs.production.min.js +1 -1
  50. package/dist/taco.cjs.production.min.js.map +1 -1
  51. package/dist/utils/date.d.ts +1 -1
  52. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"columns.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/columns.ts"],"sourcesContent":["import { ColumnDef as ReactTableColumnDef, GroupColumnDef as ReactTableGroupColumnDef } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { FontSize, FontSizes } from '../../../../types';\nimport { format, parseFromISOString } from '../../../../utils/date';\nimport { TableColumnDataType } from '../../types';\n\nexport function isInternalColumn(id: string | undefined) {\n return id?.startsWith('__');\n}\n\n// column widths\nexport const getCellMinWidth = (fontSize: FontSize = 'medium') => {\n switch (fontSize) {\n case FontSizes.small:\n return 57;\n\n case FontSizes.large:\n return 83;\n\n default:\n case FontSizes.medium:\n return 72;\n }\n};\n\n// highlighting\nexport function isCellHighlighted(query: string, value: unknown, dataType?: TableColumnDataType) {\n if (value === undefined || value === null) {\n return false;\n }\n\n return String(getCellValueAsString(value, dataType)).toLocaleLowerCase().includes(query.toLocaleLowerCase());\n}\n\nexport function getCellValueAsString(value: unknown, dataType?: TableColumnDataType): string {\n if (value === undefined || value === null) {\n return '';\n } else if (isDate(value)) {\n return format(value as Date) ?? '';\n } else if (dataType === 'datetime' && typeof value === 'string') {\n return format(parseFromISOString(value as string)) ?? '';\n }\n\n return String(value);\n}\n\nfunction orderColumn<TType = unknown>(\n column: ReactTableColumnDef<TType>,\n { orderingDisabled, orderingEnabled }: { orderingDisabled: string[]; orderingEnabled: string[] }\n) {\n const groupedColumn = column as ReactTableGroupColumnDef<TType>;\n\n if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {\n groupedColumn.columns.forEach((subcolumn: ReactTableColumnDef<TType>) =>\n orderColumn(subcolumn, { orderingDisabled, orderingEnabled })\n );\n } else {\n if (column.meta?.enableOrdering) {\n orderingEnabled.push(column.id as string);\n } else {\n orderingDisabled.push(column.id as string);\n }\n }\n}\n\n// ordering\nexport function ensureOrdering<TType = unknown>(\n columns: ReactTableColumnDef<TType>[],\n settingsOrder: string[] | undefined,\n internalColumnsPinnedToTheRight: string[] = ['__actions']\n): string[] {\n // internal columns come with a defined order\n const internalColumns = columns\n .filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id)))\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n let orderingEnabled: string[] = [];\n\n let orderedColumns = columns;\n\n // if settings is defined, make sure the columns that are actual children are sorted by it\n if (Array.isArray(settingsOrder)) {\n orderedColumns = columns.slice().sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (settingsOrder.indexOf(a.id as string) >>> 0) - (settingsOrder.indexOf(b.id as string) >>> 0)\n );\n }\n\n orderedColumns.forEach(column => {\n if (isInternalColumn(column.id)) {\n return;\n }\n\n orderColumn(column, { orderingDisabled, orderingEnabled });\n });\n\n if (settingsOrder && settingsOrder.length > 0) {\n const columnsAbsentInSettingsOrder: string[] = [];\n\n orderingEnabled = orderingEnabled\n .reduce((acc, column) => {\n const index = settingsOrder.indexOf(column);\n if (index > -1) {\n acc[index] = column;\n } else {\n columnsAbsentInSettingsOrder.push(column);\n }\n\n return acc;\n }, [] as string[])\n .filter(column => !!column)\n // Append absent columns at the end\n .concat(columnsAbsentInSettingsOrder);\n }\n\n const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];\n\n // actions should always be last, enforce that\n internalColumnsPinnedToTheRight.forEach(id => {\n if (columns.findIndex(column => column.id === id) > -1) {\n order.push(id);\n }\n });\n\n return order;\n}\n\n// freezing - we use the react-table pinning state, but that requires some mapping between them\nexport function unfreezeAllExternalColumns(leftPinnedState?: string[]): string[] {\n return leftPinnedState?.filter(id => isInternalColumn(id) && id !== '__actions') ?? [];\n}\n\nexport function freezeUptoExternalColumn(index: number, columns: string[]): string[] {\n return columns.slice(0, index + 1);\n}\n"],"names":["isInternalColumn","id","startsWith","getCellMinWidth","fontSize","FontSizes","small","large","medium","isCellHighlighted","query","value","dataType","undefined","String","getCellValueAsString","toLocaleLowerCase","includes","isDate","_format","format","_format2","parseFromISOString","orderColumn","column","orderingDisabled","orderingEnabled","groupedColumn","Array","isArray","columns","length","forEach","subcolumn","_column$meta","meta","enableOrdering","push","ensureOrdering","settingsOrder","internalColumnsPinnedToTheRight","internalColumns","filter","map","orderedColumns","slice","sort","a","b","indexOf","columnsAbsentInSettingsOrder","reduce","acc","index","concat","order","findIndex","unfreezeAllExternalColumns","leftPinnedState","_leftPinnedState$filt","freezeUptoExternalColumn"],"mappings":";;;;SAMgBA,gBAAgBA,CAACC,EAAsB;EACnD,OAAOA,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CAAEC,UAAU,CAAC,IAAI,CAAC;AAC/B;AAEA;MACaC,eAAe,GAAGA,CAACC,WAAqB,QAAQ;EACzD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,EAAE;IAEb,KAAKD,SAAS,CAACE,KAAK;MAChB,OAAO,EAAE;IAEb;IACA,KAAKF,SAAS,CAACG,MAAM;MACjB,OAAO,EAAE;;AAErB;AAEA;SACgBC,iBAAiBA,CAACC,KAAa,EAAEC,KAAc,EAAEC,QAA8B;EAC3F,IAAID,KAAK,KAAKE,SAAS,IAAIF,KAAK,KAAK,IAAI,EAAE;IACvC,OAAO,KAAK;;EAGhB,OAAOG,MAAM,CAACC,oBAAoB,CAACJ,KAAK,EAAEC,QAAQ,CAAC,CAAC,CAACI,iBAAiB,EAAE,CAACC,QAAQ,CAACP,KAAK,CAACM,iBAAiB,EAAE,CAAC;AAChH;SAEgBD,oBAAoBA,CAACJ,KAAc,EAAEC,QAA8B;EAC/E,IAAID,KAAK,KAAKE,SAAS,IAAIF,KAAK,KAAK,IAAI,EAAE;IACvC,OAAO,EAAE;GACZ,MAAM,IAAIO,MAAM,CAACP,KAAK,CAAC,EAAE;IAAA,IAAAQ,OAAA;IACtB,QAAAA,OAAA,GAAOC,MAAM,CAACT,KAAa,CAAC,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e,CAAC;;EAG3Ec,+BAA+B,CAACR,OAAO,CAAC/B,EAAE;IACtC,IAAI6B,OAAO,CAAC0B,SAAS,CAAChC,MAAM,IAAIA,MAAM,CAACvB,EAAE,KAAKA,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE;MACpDsD,KAAK,CAAClB,IAAI,CAACpC,EAAE,CAAC;;GAErB,CAAC;EAEF,OAAOsD,KAAK;AAChB;AAEA;SACgBE,0BAA0BA,CAACC,eAA0B;;EACjE,QAAAC,qBAAA,GAAOD,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAEhB,MAAM,CAACzC,EAAE,IAAID,gBAAgB,CAACC,EAAE,CAAC,IAAIA,EAAE,KAAK,WAAW,CAAC,cAAA0D,qBAAA,cAAAA,qBAAA,GAAI,EAAE;AAC1F;SAEgBC,wBAAwBA,CAACP,KAAa,EAAEvB,OAAiB;EACrE,OAAOA,OAAO,CAACe,KAAK,CAAC,CAAC,EAAEQ,KAAK,GAAG,CAAC,CAAC;AACtC;;;;"}
1
+ {"version":3,"file":"columns.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/columns.ts"],"sourcesContent":["import { ColumnDef as ReactTableColumnDef, GroupColumnDef as ReactTableGroupColumnDef } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { FontSize, FontSizes } from '../../../../types';\nimport { format, parseFromISOString } from '../../../../utils/date';\nimport { TableColumnDataType } from '../../types';\n\nexport function isInternalColumn(id: string | undefined) {\n return id?.startsWith('__');\n}\n\n// column widths\nexport const getCellMinWidth = (fontSize: FontSize = 'medium') => {\n switch (fontSize) {\n case FontSizes.small:\n return 57;\n\n case FontSizes.large:\n return 83;\n\n default:\n case FontSizes.medium:\n return 72;\n }\n};\n\n// highlighting\nexport function isCellHighlighted(query: string, value: unknown, dataType?: TableColumnDataType) {\n if (value === undefined || value === null) {\n return false;\n }\n\n return String(getCellValueAsString(value, dataType)).toLocaleLowerCase().includes(query.toLocaleLowerCase());\n}\n\nexport function getCellValueAsString(value: unknown, dataType?: TableColumnDataType): string {\n if (value === undefined || value === null) {\n return '';\n } else if (isDate(value)) {\n return format(value as Date) ?? '';\n } else if (dataType === 'datetime' && typeof value === 'string') {\n return format(parseFromISOString(value as string)) ?? '';\n }\n\n return String(value);\n}\n\nfunction orderColumn<TType = unknown>(\n column: ReactTableColumnDef<TType>,\n { orderingDisabled, orderingEnabled }: { orderingDisabled: string[]; orderingEnabled: string[] }\n) {\n const groupedColumn = column as ReactTableGroupColumnDef<TType>;\n\n if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {\n groupedColumn.columns.forEach((subcolumn: ReactTableColumnDef<TType>) =>\n orderColumn(subcolumn, { orderingDisabled, orderingEnabled })\n );\n } else {\n if (column.meta?.enableOrdering) {\n orderingEnabled.push(column.id as string);\n } else {\n orderingDisabled.push(column.id as string);\n }\n }\n}\n\n// ordering\nexport function ensureOrdering<TType = unknown>(\n columns: ReactTableColumnDef<TType>[],\n settingsOrder: string[] | undefined,\n pinnedOrder: string[] | undefined = [],\n internalColumnsPinnedToTheRight: string[] = ['__actions']\n): string[] {\n // internal columns come with a defined order\n const internalColumns = columns\n .filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id)))\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n let orderingEnabled: string[] = [];\n\n let orderedColumns = columns;\n\n // if settings is defined, make sure the columns that are actual children are sorted by it\n if (Array.isArray(settingsOrder)) {\n orderedColumns = columns.slice().sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (settingsOrder.indexOf(a.id as string) >>> 0) - (settingsOrder.indexOf(b.id as string) >>> 0)\n );\n }\n\n orderedColumns.forEach(column => {\n if (isInternalColumn(column.id)) {\n return;\n }\n\n orderColumn(column, { orderingDisabled, orderingEnabled });\n });\n\n if (settingsOrder && settingsOrder.length > 0) {\n const columnsAbsentInSettingsOrder: string[] = [];\n\n orderingEnabled = orderingEnabled\n .reduce((acc, column) => {\n const index = settingsOrder.indexOf(column);\n if (index > -1) {\n acc[index] = column;\n } else {\n columnsAbsentInSettingsOrder.push(column);\n }\n\n return acc;\n }, [] as string[])\n .filter(column => !!column)\n // Append absent columns at the end\n .concat(columnsAbsentInSettingsOrder);\n }\n\n // if pinned columns are defined, make sure they are sorted first, this ensures state matches the freezing \"upto\" behaviour\n if (Array.isArray(pinnedOrder)) {\n orderingEnabled.sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (pinnedOrder.indexOf(a as string) >>> 0) - (pinnedOrder.indexOf(b as string) >>> 0)\n );\n }\n\n const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];\n\n // actions should always be last, enforce that\n internalColumnsPinnedToTheRight.forEach(id => {\n if (columns.findIndex(column => column.id === id) > -1) {\n order.push(id);\n }\n });\n\n return order;\n}\n\n// freezing - we use the react-table pinning state, but that requires some mapping between them\nexport function unfreezeAllExternalColumns(leftPinnedState?: string[]): string[] {\n return leftPinnedState?.filter(id => isInternalColumn(id) && id !== '__actions') ?? [];\n}\n\nexport function freezeUptoExternalColumn(index: number, columns: string[]): string[] {\n return columns.slice(0, index + 1);\n}\n"],"names":["isInternalColumn","id","startsWith","getCellMinWidth","fontSize","FontSizes","small","large","medium","isCellHighlighted","query","value","dataType","undefined","String","getCellValueAsString","toLocaleLowerCase","includes","isDate","_format","format","_format2","parseFromISOString","orderColumn","column","orderingDisabled","orderingEnabled","groupedColumn","Array","isArray","columns","length","forEach","subcolumn","_column$meta","meta","enableOrdering","push","ensureOrdering","settingsOrder","pinnedOrder","internalColumnsPinnedToTheRight","internalColumns","filter","map","orderedColumns","slice","sort","a","b","indexOf","columnsAbsentInSettingsOrder","reduce","acc","index","concat","order","findIndex","unfreezeAllExternalColumns","leftPinnedState","_leftPinnedState$filt","freezeUptoExternalColumn"],"mappings":";;;;SAMgBA,gBAAgBA,CAACC,EAAsB;EACnD,OA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AM,CAACvB,EAAE,KAAKA,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE;MACpDuD,KAAK,CAACnB,IAAI,CAACpC,EAAE,CAAC;;GAErB,CAAC;EAEF,OAAOuD,KAAK;AAChB;AAEA;SACgBE,0BAA0BA,CAACC,eAA0B;;EACjE,QAAAC,qBAAA,GAAOD,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAEhB,MAAM,CAAC1C,EAAE,IAAID,gBAAgB,CAACC,EAAE,CAAC,IAAIA,EAAE,KAAK,WAAW,CAAC,cAAA2D,qBAAA,cAAAA,qBAAA,GAAI,EAAE;AAC1F;SAEgBC,wBAAwBA,CAACP,KAAa,EAAExB,OAAiB;EACrE,OAAOA,OAAO,CAACgB,KAAK,CAAC,CAAC,EAAEQ,KAAK,GAAG,CAAC,CAAC;AACtC;;;;"}
@@ -54,16 +54,18 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
54
54
  if (defaultWidth) {
55
55
  defaultSizing[id] = defaultWidth;
56
56
  }
57
- if (child.props.sort !== undefined) {
57
+ const isGrouped = defaultRowGroupColumnId === id;
58
+ if (child.props.sort !== undefined || isGrouped) {
58
59
  defaultSorting.push({
59
60
  id,
60
61
  desc: sort === 'desc'
61
62
  });
62
63
  }
63
- const isGrouped = defaultRowGroupColumnId === id;
64
64
  const column = {
65
65
  id,
66
66
  accessorKey,
67
+ // To avoid errors caused by undefined row data values, we pass accessorFn as a preventive measure
68
+ accessorFn: row => row === null || row === void 0 ? void 0 : row[accessorKey],
67
69
  header: header,
68
70
  // features
69
71
  enableColumnFilter,
@@ -163,14 +165,14 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns) {
163
165
  const column = createInternalColumn('__select', internalColumns.rowSelection, defaultSizing);
164
166
  columns.unshift(column);
165
167
  }
166
- if (options.enableRowActions && (_props$rowActions = props.rowActions) !== null && _props$rowActions !== void 0 && _props$rowActions.length && internalColumns.rowActions) {
167
- const column = createInternalColumn('__actions', internalColumns.rowActions, defaultSizing);
168
- columns.push(column);
169
- }
170
168
  if (options.enableRowDrag && props.onRowDrag && internalColumns.rowDrag) {
171
169
  const column = createInternalColumn('__drag', internalColumns.rowDrag, defaultSizing);
172
170
  columns.unshift(column);
173
171
  }
172
+ if (options.enableRowActions && (_props$rowActions = props.rowActions) !== null && _props$rowActions !== void 0 && _props$rowActions.length && internalColumns.rowActions) {
173
+ const column = createInternalColumn('__actions', internalColumns.rowActions, defaultSizing);
174
+ columns.push(column);
175
+ }
174
176
  }
175
177
  return {
176
178
  columns,
@@ -244,12 +246,14 @@ function configureReactTableOptions(options, props) {
244
246
  }
245
247
  function useReactTableInitialState(props, columns, persistedSettings, defaults) {
246
248
  return React__default.useMemo(() => {
247
- var _persistedSettings$co, _props$defaultSetting, _ref, _persistedSettings$co2, _props$defaultSetting2, _columnPinning$left, _ref2, _persistedSettings$co3, _props$defaultSetting3, _ref3, _ref4, _persistedSettings$co4, _props$defaultSetting4, _ref5, _ref6, _persistedSettings$co5, _props$defaultSetting5, _persistedSettings$se, _props$defaultSetting6, _props$defaultSetting7, _props$defaultSetting8;
249
+ var _ref, _persistedSettings$co, _props$defaultSetting, _persistedSettings$co2, _props$defaultSetting2, _columnPinning$left, _ref2, _persistedSettings$co3, _props$defaultSetting3, _ref3, _ref4, _persistedSettings$co4, _props$defaultSetting4, _ref5, _ref6, _persistedSettings$co5, _props$defaultSetting5, _persistedSettings$se, _props$defaultSetting6, _props$defaultSetting7, _props$defaultSetting8;
248
250
  const ignoreNotDefinedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);
249
- const columnOrder = ensureOrdering(columns, (_persistedSettings$co = persistedSettings.columnOrder) !== null && _persistedSettings$co !== void 0 ? _persistedSettings$co : (_props$defaultSetting = props.defaultSettings) === null || _props$defaultSetting === void 0 ? void 0 : _props$defaultSetting.columnOrder);
250
- const columnPinning = (_ref = (_persistedSettings$co2 = persistedSettings.columnPinning) !== null && _persistedSettings$co2 !== void 0 ? _persistedSettings$co2 : (_props$defaultSetting2 = props.defaultSettings) === null || _props$defaultSetting2 === void 0 ? void 0 : _props$defaultSetting2.columnPinning) !== null && _ref !== void 0 ? _ref : {};
251
- // ensure internal columns are pinned
252
- if (!(columnPinning !== null && columnPinning !== void 0 && (_columnPinning$left = columnPinning.left) !== null && _columnPinning$left !== void 0 && _columnPinning$left.length)) {
251
+ const columnPinning = (_ref = (_persistedSettings$co = persistedSettings.columnPinning) !== null && _persistedSettings$co !== void 0 ? _persistedSettings$co : (_props$defaultSetting = props.defaultSettings) === null || _props$defaultSetting === void 0 ? void 0 : _props$defaultSetting.columnPinning) !== null && _ref !== void 0 ? _ref : {};
252
+ const columnOrder = ensureOrdering(columns, (_persistedSettings$co2 = persistedSettings.columnOrder) !== null && _persistedSettings$co2 !== void 0 ? _persistedSettings$co2 : (_props$defaultSetting2 = props.defaultSettings) === null || _props$defaultSetting2 === void 0 ? void 0 : _props$defaultSetting2.columnOrder, columnPinning.left);
253
+ // ensure internal columns are pinned, and are pinned in the correct order
254
+ if (columnPinning !== null && columnPinning !== void 0 && (_columnPinning$left = columnPinning.left) !== null && _columnPinning$left !== void 0 && _columnPinning$left.length) {
255
+ columnPinning.left = freezeUptoExternalColumn(columnOrder.indexOf(columnPinning.left[columnPinning.left.length - 1]), columnOrder);
256
+ } else {
253
257
  if (props.defaultColumnFreezingIndex) {
254
258
  columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);
255
259
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"setup.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/setup.ts"],"sourcesContent":["import React from 'react';\nimport {\n createColumnHelper,\n getExpandedRowModel,\n getFilteredRowModel,\n getGroupedRowModel,\n getSortedRowModel,\n TableOptions as ReactTableOptions,\n Row as ReactTableRow,\n Column as ReactTableColumn,\n ColumnDef as ReactTableColumnDef,\n ColumnPinningState as ReactTableColumnPinningState,\n ColumnSizingState as ReactTableColumnSizingState,\n ColumnSort as ReactTableColumnSort,\n TableState as ReactTableState,\n VisibilityState as ReactTableVisibilityState,\n} from '@tanstack/react-table';\nimport { useTableManagerInternalColumns, useTableManagerInternalColumn } from '../types';\nimport { TableColumnProps, TableFeatureProps, TableGroupProps, TableProps, TableSettings } from '../../types';\nimport { getSortingFn } from './sorting';\nimport { ensureOrdering, freezeUptoExternalColumn, getCellMinWidth, unfreezeAllExternalColumns } from './columns';\nimport { columnFilterFn, globalFilterFn } from './filtering';\nimport { ignoreInternalColumns } from './settings';\n\n// mapping children to react-table columns\nfunction processChildren<TType>(\n child: React.ReactChild | React.ReactFragment | React.ReactPortal,\n columns: ReactTableColumnDef<TType>[],\n defaultSizing: ReactTableColumnSizingState,\n defaultSorting: ReactTableColumnSort[],\n defaultVisibility: ReactTableVisibilityState,\n settings: TableSettings,\n defaultRowGroupColumnId?: keyof TType\n): ReactTableColumnDef<TType>[] {\n const columnHelper = createColumnHelper<TType>();\n\n if (React.isValidElement<TableGroupProps>(child) && child.props.children) {\n const { children, id, header } = child.props;\n\n columns.push(\n columnHelper.group({\n id,\n header,\n columns: React.Children.toArray(children).reduce(\n (columns: ReactTableColumnDef<TType>[], child) =>\n processChildren<TType>(\n child,\n columns,\n defaultSizing,\n defaultSorting,\n defaultVisibility,\n settings,\n defaultRowGroupColumnId\n ),\n []\n ),\n // we don't want to let column groups be grouped/aggregrated\n enableGrouping: false,\n })\n );\n } else if (React.isValidElement<TableColumnProps<TType>>(child) && (child.props.accessor || child.props.id)) {\n const {\n id,\n accessor: accessorKey = id,\n // renderers\n renderer,\n aggregate,\n footer,\n header,\n // options\n aggregationFn,\n defaultHidden,\n defaultWidth,\n enableFiltering: enableColumnFilter = true,\n enableGrouping = false,\n enableHiding = true,\n enableOrdering = true,\n enablePrinting = true,\n enableResizing = true,\n enableSearch: enableGlobalFilter = true,\n enableSorting = true,\n enableTruncate = false,\n minWidth: minSize = getCellMinWidth(settings.fontSize),\n sort,\n sortFn,\n ...meta\n } = child.props;\n\n if (defaultHidden && enableHiding) {\n defaultVisibility[id] = false;\n }\n\n if (defaultWidth) {\n defaultSizing[id] = defaultWidth as any;\n }\n\n if (child.props.sort !== undefined) {\n defaultSorting.push({\n id,\n desc: sort === 'desc',\n });\n }\n\n const isGrouped = defaultRowGroupColumnId === id;\n\n const column: ReactTableColumnDef<TType, any> = {\n id,\n accessorKey,\n header: header,\n // features\n enableColumnFilter,\n enableGlobalFilter,\n enableGrouping,\n enableHiding: isGrouped ? false : enableHiding,\n enableResizing,\n enableSorting,\n // config - sizing\n minSize,\n // meta\n meta: {\n ...(meta as any),\n defaultWidth,\n enableOrdering: isGrouped ? false : enableOrdering,\n enablePrinting,\n enableTruncate,\n header,\n renderer,\n },\n };\n\n // renderers\n if (typeof renderer === 'function') {\n column.cell = info => renderer(info.getValue(), info.row.original);\n }\n\n if (typeof footer === 'function') {\n column.footer = info =>\n footer(\n info.table.getRowModel().rows.flatMap(row => (row.original?.[id] !== undefined ? [row.original[id]] : []))\n );\n }\n\n // config - filtering\n if (enableColumnFilter) {\n column.filterFn = 'tacoFilter' as any;\n }\n\n // config - grouping/aggregation\n if (enableGrouping) {\n column.aggregationFn = aggregationFn;\n\n if (typeof aggregate === 'function') {\n column.aggregatedCell = info => aggregate(info.getValue(), info.row.original);\n }\n }\n\n // config - sorting\n if (enableSorting) {\n column.sortingFn = getSortingFn<TType>(child.props.dataType, sortFn);\n column.sortDescFirst = false;\n column.sortUndefined = 1;\n }\n\n columns.push(column);\n }\n\n return columns;\n}\n\nfunction createInternalColumn<TType = unknown>(\n id: string,\n column: useTableManagerInternalColumn<TType>,\n defaultSizing: ReactTableColumnSizingState\n) {\n if (column.size) {\n defaultSizing[id] = column.size;\n }\n\n return {\n id,\n accessorKey: id,\n header: column.header,\n cell: column.renderer,\n // features\n enableColumnFilter: false,\n enableGlobalFilter: false,\n enableGrouping: false,\n enableHiding: false,\n enableResizing: false,\n enableSorting: false,\n // config - sizing\n size: column.size,\n minSize: column.size,\n // meta\n meta: {\n ...(column.meta as any),\n enableOrdering: false,\n enablePrinting: false,\n enableTruncate: false,\n },\n } as ReactTableColumnDef<TType, any>;\n}\n\nexport function mapTableChildrenToColumns<TType = unknown>(\n props: TableProps<TType>,\n settings: TableSettings,\n options: TableFeatureProps,\n internalColumns?: useTableManagerInternalColumns<TType>\n) {\n const { children, defaultRowGroupColumnId } = props;\n const defaultSizing: ReactTableColumnSizingState = {};\n const defaultSorting: ReactTableColumnSort[] = [];\n const defaultVisibility: ReactTableVisibilityState = {};\n\n const columns = React.Children.toArray(children).reduce(\n (columns: ReactTableColumnDef<TType>[], child) =>\n processChildren<TType>(\n child,\n columns,\n defaultSizing,\n defaultSorting,\n defaultVisibility,\n settings,\n defaultRowGroupColumnId\n ),\n\n []\n );\n\n if (internalColumns) {\n if (options.enableRowExpansion && props.rowExpansionRenderer && internalColumns.rowExpansion) {\n const column = createInternalColumn<TType>('__expansion', internalColumns.rowExpansion, defaultSizing);\n columns.unshift(column);\n }\n\n if ((options.enableRowSelection || options.enableRowSelectionSingle) && internalColumns.rowSelection) {\n const column = createInternalColumn<TType>('__select', internalColumns.rowSelection, defaultSizing);\n columns.unshift(column);\n }\n\n if (options.enableRowActions && props.rowActions?.length && internalColumns.rowActions) {\n const column = createInternalColumn<TType>('__actions', internalColumns.rowActions, defaultSizing);\n columns.push(column);\n }\n\n if (options.enableRowDrag && props.onRowDrag && internalColumns.rowDrag) {\n const column = createInternalColumn<TType>('__drag', internalColumns.rowDrag, defaultSizing);\n columns.unshift(column);\n }\n }\n\n return { columns, defaultSizing, defaultSorting, defaultVisibility };\n}\n\nexport function configureReactTableOptions<TType = unknown>(options: TableFeatureProps, props: TableProps<TType>) {\n const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;\n const tableOptions: Partial<ReactTableOptions<TType>> = {\n defaultColumn: {\n enableColumnFilter: options.enableFiltering || true,\n enableGrouping: false,\n enableHiding: options.enableColumnHiding || true,\n enableResizing: options.enableColumnResizing || true,\n enableGlobalFilter: options.enableSearch || true,\n enableSorting: options.enableSorting || true,\n minSize: 1,\n // the default is 150, which is a bit random\n size: 1,\n },\n enableColumnFilters: options.enableFiltering ?? false,\n enableColumnResizing: options.enableColumnResizing ?? false,\n enableExpanding: options.enableRowExpansion ?? false,\n enableGrouping: true, // users can't customise row grouping, so it can just be always enabled and left to the defaultRowGroupColumnId prop\n enableHiding: options.enableColumnHiding ?? false,\n enablePinning: options.enableColumnFreezing ?? false,\n enableRowSelection: enableRowSelection ?? false,\n enableMultiRowSelection: options.enableRowSelectionSingle === true ? false : enableRowSelection,\n enableSorting: options.enableSorting ?? false,\n // models for default features\n getExpandedRowModel: getExpandedRowModel<TType>(),\n getGroupedRowModel: getGroupedRowModel<TType>(),\n groupedColumnMode: false,\n };\n\n if (tableOptions.enableColumnResizing) {\n tableOptions.columnResizeMode = 'onChange';\n }\n\n if (tableOptions.enableColumnFilters) {\n // enter controlled filter mode (controlled could be local state, but usually the server)\n if (props.onChangeFilter) {\n // tableOptions.manualFiltering = true;\n // we don't set it because it breaks global filtering (used for search, which is fully client side)\n //\n // tableOptions.onColumnFiltersChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onFilter\n } else {\n tableOptions.getFilteredRowModel = getFilteredRowModel<TType>();\n tableOptions.filterFns = {\n tacoFilter: (row: ReactTableRow<TType>, columnId: string, filter: any) =>\n columnFilterFn(row.getValue(columnId), filter),\n };\n }\n }\n\n if (options.enableSearch) {\n // always set these because enableGlobalFilter can be toggled on and off by the user\n tableOptions.getFilteredRowModel = getFilteredRowModel<TType>();\n tableOptions.globalFilterFn = globalFilterFn;\n tableOptions.getColumnCanGlobalFilter = (column: ReactTableColumn<TType>) => column.columnDef.meta?.enableSearch ?? true;\n\n // enter controlled search mode (controlled could be local state, but usually the server)\n if (props.onChangeSearch) {\n // tableOptions.manualFiltering = true;\n // we don't set this because controlled search is not currently supported, search is always client side\n //\n // tableOptions.onGlobalFilterChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onSearch.\n //\n // we also don't always filter when searching, we have the highlight functionality as the default\n // and filtering can be toggled by the user\n }\n }\n\n if (tableOptions.enableSorting) {\n // enter controlled sort mode (controlled could be local state, but usually the server)\n if (props.onChangeSort) {\n tableOptions.manualSorting = true;\n\n // tableOptions.onSortingChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onSort\n } else {\n tableOptions.getSortedRowModel = getSortedRowModel();\n }\n }\n\n return tableOptions;\n}\n\nexport function useReactTableInitialState<TType = unknown>(\n props: TableProps<TType>,\n columns: ReactTableColumnDef<TType>[],\n persistedSettings: TableSettings,\n defaults: {\n defaultSizing: ReactTableColumnSizingState;\n defaultSorting: ReactTableColumnSort[];\n defaultVisibility: ReactTableVisibilityState;\n }\n): Partial<ReactTableState> {\n return React.useMemo(() => {\n const ignoreNotDefinedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);\n\n const columnOrder = ensureOrdering<TType>(columns, persistedSettings.columnOrder ?? props.defaultSettings?.columnOrder);\n\n const columnPinning: ReactTableColumnPinningState =\n persistedSettings.columnPinning ?? props.defaultSettings?.columnPinning ?? {};\n\n // ensure internal columns are pinned\n if (!columnPinning?.left?.length) {\n if (props.defaultColumnFreezingIndex) {\n columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);\n } else {\n columnPinning.left = unfreezeAllExternalColumns(columnOrder);\n }\n }\n\n const state: Partial<ReactTableState> = {\n columnFilters: persistedSettings.columnFilters ?? props.defaultSettings?.columnFilters ?? [],\n columnOrder,\n columnPinning,\n columnSizing: ignoreInternalColumns(\n persistedSettings.columnSizing ?? props.defaultSettings?.columnSizing ?? defaults.defaultSizing ?? {}\n ),\n columnVisibility:\n persistedSettings.columnVisibility ?? props.defaultSettings?.columnVisibility ?? defaults.defaultVisibility ?? {},\n globalFilter: persistedSettings.searchQuery ?? props.defaultSettings?.searchQuery,\n sorting: persistedSettings.sorting\n ? persistedSettings.sorting.filter(ignoreNotDefinedColumns)\n : props.defaultSettings?.sorting ?? defaults.defaultSorting,\n };\n\n if (props.defaultRowGroupColumnId) {\n state.grouping = [props.defaultRowGroupColumnId as string];\n // row groups should (all) always be expanded by default\n state.expanded = true;\n }\n\n return state;\n }, []);\n}\n"],"names":["processChildren","child","columns","defaultSizing","defaultSorting","defaultVisibility","settings","defaultRowGroupColumnId","columnHelper","createColumnHelper","React","isValidElement","props","children","id","header","push","group","Children","toArray","reduce","enableGrouping","accessor","accessorKey","renderer","aggregate","footer","aggregationFn","defaultHidden","defaultWidth","enableFiltering","enableColumnFilter","enableHiding","enableOrdering","enablePrinting","enableResizing","enableSearch","enableGlobalFilter","enableSorting","enableTruncate","minWidth","minSize","getCellMinWidth","fontSize","sort","sortFn","meta","undefined","desc","isGrouped","column","cell","info","getValue","row","original","table","getRowModel","rows","flatMap","_row$original","filterFn","aggregatedCell","sortingFn","getSortingFn","dataType","sortDescFirst","sortUndefined","createInternalColumn","size","mapTableChildrenToColumns","options","internalColumns","_props$rowActions","enableRowExpansion","rowExpansionRenderer","rowExpansion","unshift","enableRowSelection","enableRowSelectionSingle","rowSelection","enableRowActions","rowActions","length","enableRowDrag","onRowDrag","rowDrag","configureReactTableOptions","tableOptions","defaultColumn","enableColumnHiding","enableColumnResizing","enableColumnFilters","_options$enableFilter","_options$enableColumn","enableExpanding","_options$enableRowExp","_options$enableColumn2","enablePinning","_options$enableColumn3","enableColumnFreezing","enableMultiRowSelection","_options$enableSortin","getExpandedRowModel","getGroupedRowModel","groupedColumnMode","columnResizeMode","onChangeFilter","getFilteredRowModel","filterFns","tacoFilter","columnId","filter","columnFilterFn","globalFilterFn","getColumnCanGlobalFilter","_column$columnDef$met","_column$columnDef$met2","columnDef","onChangeSort","manualSorting","getSortedRowModel","useReactTableInitialState","persistedSettings","defaults","useMemo","ignoreNotDefinedColumns","find","definedColumn","columnOrder","ensureOrdering","_persistedSettings$co","_props$defaultSetting","defaultSettings","columnPinning","_ref","_persistedSettings$co2","_props$defaultSetting2","_columnPinning$left","left","defaultColumnFreezingIndex","freezeUptoExternalColumn","unfreezeAllExternalColumns","state","columnFilters","_ref2","_persistedSettings$co3","_props$defaultSetting3","columnSizing","ignoreInternalColumns","_ref3","_ref4","_persistedSettings$co4","_props$defaultSetting4","columnVisibility","_ref5","_ref6","_persistedSettings$co5","_props$defaultSetting5","globalFilter","_persistedSettings$se","searchQuery","_props$defaultSetting6","sorting","_props$defaultSetting7","_props$defaultSetting8","grouping","expanded"],"mappings":";;;;;;;AAwBA;AACA,SAASA,eAAeA,CACpBC,KAAiE,EACjEC,OAAqC,EACrCC,aAA0C,EAC1CC,cAAsC,EACtCC,iBAA4C,EAC5CC,QAAuB,EACvBC,uBAAqC;EAErC,MAAMC,YAAY,GAAGC,kBAAkB,EAAS;EAEhD,kBAAIC,cAAK,CAACC,cAAc,CAAkBV,KAAK,CAAC,IAAIA,KAAK,CAACW,KAAK,CAACC,QAAQ,EAAE;IACtE,MAAM;MAAEA,QAAQ;MAAEC,EAAE;MAAEC;KAAQ,GAAGd,KAAK,CAACW,KAAK;IAE5CV,OAAO,CAACc,IAAI,CACRR,YAAY,CAACS,KAAK,CAAC;MACfH,EAAE;MACFC,MAAM;MACNb,OAAO,EAAEQ,cAAK,CAACQ,QAAQ,CAACC,OAAO,CAACN,QAAQ,CAAC,CAACO,MAAM,CAC5C,CAAClB,OAAqC,EAAED,KAAK,KACzCD,eAAe,CACXC,KAAK,EACLC,OAAO,EACPC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,QAAQ,EACRC,uBAAuB,CAC1B,EACL,EAAE,CACL;;MAEDc,cAAc,EAAE;KACnB,CAAC,CACL;GACJ,MAAM,kBAAIX,cAAK,CAACC,cAAc,CAA0BV,KAAK,CAAC,KAAKA,KAAK,CAACW,KAAK,CAACU,QAAQ,IAAIrB,KAAK,CAACW,KAAK,CAACE,EAAE,CAAC,EAAE;IACzG,MAAM;MACFA,EAA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1
+ {"version":3,"file":"setup.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/util/setup.ts"],"sourcesContent":["import React from 'react';\nimport {\n createColumnHelper,\n getExpandedRowModel,\n getFilteredRowModel,\n getGroupedRowModel,\n getSortedRowModel,\n TableOptions as ReactTableOptions,\n Row as ReactTableRow,\n Column as ReactTableColumn,\n ColumnDef as ReactTableColumnDef,\n ColumnPinningState as ReactTableColumnPinningState,\n ColumnSizingState as ReactTableColumnSizingState,\n ColumnSort as ReactTableColumnSort,\n TableState as ReactTableState,\n VisibilityState as ReactTableVisibilityState,\n} from '@tanstack/react-table';\nimport { useTableManagerInternalColumns, useTableManagerInternalColumn } from '../types';\nimport { TableColumnProps, TableFeatureProps, TableGroupProps, TableProps, TableSettings } from '../../types';\nimport { getSortingFn } from './sorting';\nimport { ensureOrdering, freezeUptoExternalColumn, getCellMinWidth, unfreezeAllExternalColumns } from './columns';\nimport { columnFilterFn, globalFilterFn } from './filtering';\nimport { ignoreInternalColumns } from './settings';\n\n// mapping children to react-table columns\nfunction processChildren<TType>(\n child: React.ReactChild | React.ReactFragment | React.ReactPortal,\n columns: ReactTableColumnDef<TType>[],\n defaultSizing: ReactTableColumnSizingState,\n defaultSorting: ReactTableColumnSort[],\n defaultVisibility: ReactTableVisibilityState,\n settings: TableSettings,\n defaultRowGroupColumnId?: keyof TType\n): ReactTableColumnDef<TType>[] {\n const columnHelper = createColumnHelper<TType>();\n\n if (React.isValidElement<TableGroupProps>(child) && child.props.children) {\n const { children, id, header } = child.props;\n\n columns.push(\n columnHelper.group({\n id,\n header,\n columns: React.Children.toArray(children).reduce(\n (columns: ReactTableColumnDef<TType>[], child) =>\n processChildren<TType>(\n child,\n columns,\n defaultSizing,\n defaultSorting,\n defaultVisibility,\n settings,\n defaultRowGroupColumnId\n ),\n []\n ),\n // we don't want to let column groups be grouped/aggregrated\n enableGrouping: false,\n })\n );\n } else if (React.isValidElement<TableColumnProps<TType>>(child) && (child.props.accessor || child.props.id)) {\n const {\n id,\n accessor: accessorKey = id,\n // renderers\n renderer,\n aggregate,\n footer,\n header,\n // options\n aggregationFn,\n defaultHidden,\n defaultWidth,\n enableFiltering: enableColumnFilter = true,\n enableGrouping = false,\n enableHiding = true,\n enableOrdering = true,\n enablePrinting = true,\n enableResizing = true,\n enableSearch: enableGlobalFilter = true,\n enableSorting = true,\n enableTruncate = false,\n minWidth: minSize = getCellMinWidth(settings.fontSize),\n sort,\n sortFn,\n ...meta\n } = child.props;\n\n if (defaultHidden && enableHiding) {\n defaultVisibility[id] = false;\n }\n\n if (defaultWidth) {\n defaultSizing[id] = defaultWidth as any;\n }\n\n const isGrouped = defaultRowGroupColumnId === id;\n\n if (child.props.sort !== undefined || isGrouped) {\n defaultSorting.push({\n id,\n desc: sort === 'desc',\n });\n }\n\n const column: ReactTableColumnDef<TType, any> = {\n id,\n accessorKey,\n // To avoid errors caused by undefined row data values, we pass accessorFn as a preventive measure\n accessorFn: row => row?.[accessorKey as string],\n header: header,\n // features\n enableColumnFilter,\n enableGlobalFilter,\n enableGrouping,\n enableHiding: isGrouped ? false : enableHiding,\n enableResizing,\n enableSorting,\n // config - sizing\n minSize,\n // meta\n meta: {\n ...(meta as any),\n defaultWidth,\n enableOrdering: isGrouped ? false : enableOrdering,\n enablePrinting,\n enableTruncate,\n header,\n renderer,\n },\n };\n\n // renderers\n if (typeof renderer === 'function') {\n column.cell = info => renderer(info.getValue(), info.row.original);\n }\n\n if (typeof footer === 'function') {\n column.footer = info =>\n footer(\n info.table.getRowModel().rows.flatMap(row => (row.original?.[id] !== undefined ? [row.original[id]] : []))\n );\n }\n\n // config - filtering\n if (enableColumnFilter) {\n column.filterFn = 'tacoFilter' as any;\n }\n\n // config - grouping/aggregation\n if (enableGrouping) {\n column.aggregationFn = aggregationFn;\n\n if (typeof aggregate === 'function') {\n column.aggregatedCell = info => aggregate(info.getValue(), info.row.original);\n }\n }\n\n // config - sorting\n if (enableSorting) {\n column.sortingFn = getSortingFn<TType>(child.props.dataType, sortFn);\n column.sortDescFirst = false;\n column.sortUndefined = 1;\n }\n\n columns.push(column);\n }\n\n return columns;\n}\n\nfunction createInternalColumn<TType = unknown>(\n id: string,\n column: useTableManagerInternalColumn<TType>,\n defaultSizing: ReactTableColumnSizingState\n) {\n if (column.size) {\n defaultSizing[id] = column.size;\n }\n\n return {\n id,\n accessorKey: id,\n header: column.header,\n cell: column.renderer,\n // features\n enableColumnFilter: false,\n enableGlobalFilter: false,\n enableGrouping: false,\n enableHiding: false,\n enableResizing: false,\n enableSorting: false,\n // config - sizing\n size: column.size,\n minSize: column.size,\n // meta\n meta: {\n ...(column.meta as any),\n enableOrdering: false,\n enablePrinting: false,\n enableTruncate: false,\n },\n } as ReactTableColumnDef<TType, any>;\n}\n\nexport function mapTableChildrenToColumns<TType = unknown>(\n props: TableProps<TType>,\n settings: TableSettings,\n options: TableFeatureProps,\n internalColumns?: useTableManagerInternalColumns<TType>\n) {\n const { children, defaultRowGroupColumnId } = props;\n const defaultSizing: ReactTableColumnSizingState = {};\n const defaultSorting: ReactTableColumnSort[] = [];\n const defaultVisibility: ReactTableVisibilityState = {};\n\n const columns = React.Children.toArray(children).reduce(\n (columns: ReactTableColumnDef<TType>[], child) =>\n processChildren<TType>(\n child,\n columns,\n defaultSizing,\n defaultSorting,\n defaultVisibility,\n settings,\n defaultRowGroupColumnId\n ),\n\n []\n );\n\n if (internalColumns) {\n if (options.enableRowExpansion && props.rowExpansionRenderer && internalColumns.rowExpansion) {\n const column = createInternalColumn<TType>('__expansion', internalColumns.rowExpansion, defaultSizing);\n columns.unshift(column);\n }\n\n if ((options.enableRowSelection || options.enableRowSelectionSingle) && internalColumns.rowSelection) {\n const column = createInternalColumn<TType>('__select', internalColumns.rowSelection, defaultSizing);\n columns.unshift(column);\n }\n\n if (options.enableRowDrag && props.onRowDrag && internalColumns.rowDrag) {\n const column = createInternalColumn<TType>('__drag', internalColumns.rowDrag, defaultSizing);\n columns.unshift(column);\n }\n\n if (options.enableRowActions && props.rowActions?.length && internalColumns.rowActions) {\n const column = createInternalColumn<TType>('__actions', internalColumns.rowActions, defaultSizing);\n columns.push(column);\n }\n }\n\n return { columns, defaultSizing, defaultSorting, defaultVisibility };\n}\n\nexport function configureReactTableOptions<TType = unknown>(options: TableFeatureProps, props: TableProps<TType>) {\n const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;\n const tableOptions: Partial<ReactTableOptions<TType>> = {\n defaultColumn: {\n enableColumnFilter: options.enableFiltering || true,\n enableGrouping: false,\n enableHiding: options.enableColumnHiding || true,\n enableResizing: options.enableColumnResizing || true,\n enableGlobalFilter: options.enableSearch || true,\n enableSorting: options.enableSorting || true,\n minSize: 1,\n // the default is 150, which is a bit random\n size: 1,\n },\n enableColumnFilters: options.enableFiltering ?? false,\n enableColumnResizing: options.enableColumnResizing ?? false,\n enableExpanding: options.enableRowExpansion ?? false,\n enableGrouping: true, // users can't customise row grouping, so it can just be always enabled and left to the defaultRowGroupColumnId prop\n enableHiding: options.enableColumnHiding ?? false,\n enablePinning: options.enableColumnFreezing ?? false,\n enableRowSelection: enableRowSelection ?? false,\n enableMultiRowSelection: options.enableRowSelectionSingle === true ? false : enableRowSelection,\n enableSorting: options.enableSorting ?? false,\n // models for default features\n getExpandedRowModel: getExpandedRowModel<TType>(),\n getGroupedRowModel: getGroupedRowModel<TType>(),\n groupedColumnMode: false,\n };\n\n if (tableOptions.enableColumnResizing) {\n tableOptions.columnResizeMode = 'onChange';\n }\n\n if (tableOptions.enableColumnFilters) {\n // enter controlled filter mode (controlled could be local state, but usually the server)\n if (props.onChangeFilter) {\n // tableOptions.manualFiltering = true;\n // we don't set it because it breaks global filtering (used for search, which is fully client side)\n //\n // tableOptions.onColumnFiltersChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onFilter\n } else {\n tableOptions.getFilteredRowModel = getFilteredRowModel<TType>();\n tableOptions.filterFns = {\n tacoFilter: (row: ReactTableRow<TType>, columnId: string, filter: any) =>\n columnFilterFn(row.getValue(columnId), filter),\n };\n }\n }\n\n if (options.enableSearch) {\n // always set these because enableGlobalFilter can be toggled on and off by the user\n tableOptions.getFilteredRowModel = getFilteredRowModel<TType>();\n tableOptions.globalFilterFn = globalFilterFn;\n tableOptions.getColumnCanGlobalFilter = (column: ReactTableColumn<TType>) => column.columnDef.meta?.enableSearch ?? true;\n\n // enter controlled search mode (controlled could be local state, but usually the server)\n if (props.onChangeSearch) {\n // tableOptions.manualFiltering = true;\n // we don't set this because controlled search is not currently supported, search is always client side\n //\n // tableOptions.onGlobalFilterChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onSearch.\n //\n // we also don't always filter when searching, we have the highlight functionality as the default\n // and filtering can be toggled by the user\n }\n }\n\n if (tableOptions.enableSorting) {\n // enter controlled sort mode (controlled could be local state, but usually the server)\n if (props.onChangeSort) {\n tableOptions.manualSorting = true;\n\n // tableOptions.onSortingChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onSort\n } else {\n tableOptions.getSortedRowModel = getSortedRowModel();\n }\n }\n\n return tableOptions;\n}\n\nexport function useReactTableInitialState<TType = unknown>(\n props: TableProps<TType>,\n columns: ReactTableColumnDef<TType>[],\n persistedSettings: TableSettings,\n defaults: {\n defaultSizing: ReactTableColumnSizingState;\n defaultSorting: ReactTableColumnSort[];\n defaultVisibility: ReactTableVisibilityState;\n }\n): Partial<ReactTableState> {\n return React.useMemo(() => {\n const ignoreNotDefinedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);\n\n const columnPinning: ReactTableColumnPinningState =\n persistedSettings.columnPinning ?? props.defaultSettings?.columnPinning ?? {};\n\n const columnOrder = ensureOrdering<TType>(\n columns,\n persistedSettings.columnOrder ?? props.defaultSettings?.columnOrder,\n columnPinning.left\n );\n\n // ensure internal columns are pinned, and are pinned in the correct order\n if (columnPinning?.left?.length) {\n columnPinning.left = freezeUptoExternalColumn(\n columnOrder.indexOf(columnPinning.left[columnPinning.left.length - 1]),\n columnOrder\n );\n } else {\n if (props.defaultColumnFreezingIndex) {\n columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);\n } else {\n columnPinning.left = unfreezeAllExternalColumns(columnOrder);\n }\n }\n\n const state: Partial<ReactTableState> = {\n columnFilters: persistedSettings.columnFilters ?? props.defaultSettings?.columnFilters ?? [],\n columnOrder,\n columnPinning,\n columnSizing: ignoreInternalColumns(\n persistedSettings.columnSizing ?? props.defaultSettings?.columnSizing ?? defaults.defaultSizing ?? {}\n ),\n columnVisibility:\n persistedSettings.columnVisibility ?? props.defaultSettings?.columnVisibility ?? defaults.defaultVisibility ?? {},\n globalFilter: persistedSettings.searchQuery ?? props.defaultSettings?.searchQuery,\n sorting: persistedSettings.sorting\n ? persistedSettings.sorting.filter(ignoreNotDefinedColumns)\n : props.defaultSettings?.sorting ?? defaults.defaultSorting,\n };\n\n if (props.defaultRowGroupColumnId) {\n state.grouping = [props.defaultRowGroupColumnId as string];\n // row groups should (all) always be expanded by default\n state.expanded = true;\n }\n\n return state;\n }, []);\n}\n"],"names":["processChildren","child","columns","defaultSizing","defaultSorting","defaultVisibility","settings","defaultRowGroupColumnId","columnHelper","createColumnHelper","React","isValidElement","props","children","id","header","push","group","Children","toArray","reduce","enableGrouping","accessor","accessorKey","renderer","aggregate","footer","aggregationFn","defaultHidden","defaultWidth","enableFiltering","enableColumnFilter","enableHiding","enableOrdering","enablePrinting","enableResizing","enableSearch","enableGlobalFilter","enableSorting","enableTruncate","minWidth","minSize","getCellMinWidth","fontSize","sort","sortFn","meta","isGrouped","undefined","desc","column","accessorFn","row","cell","info","getValue","original","table","getRowModel","rows","flatMap","_row$original","filterFn","aggregatedCell","sortingFn","getSortingFn","dataType","sortDescFirst","sortUndefined","createInternalColumn","size","mapTableChildrenToColumns","options","internalColumns","_props$rowActions","enableRowExpansion","rowExpansionRenderer","rowExpansion","unshift","enableRowSelection","enableRowSelectionSingle","rowSelection","enableRowDrag","onRowDrag","rowDrag","enableRowActions","rowActions","length","configureReactTableOptions","tableOptions","defaultColumn","enableColumnHiding","enableColumnResizing","enableColumnFilters","_options$enableFilter","_options$enableColumn","enableExpanding","_options$enableRowExp","_options$enableColumn2","enablePinning","_options$enableColumn3","enableColumnFreezing","enableMultiRowSelection","_options$enableSortin","getExpandedRowModel","getGroupedRowModel","groupedColumnMode","columnResizeMode","onChangeFilter","getFilteredRowModel","filterFns","tacoFilter","columnId","filter","columnFilterFn","globalFilterFn","getColumnCanGlobalFilter","_column$columnDef$met","_column$columnDef$met2","columnDef","onChangeSort","manualSorting","getSortedRowModel","useReactTableInitialState","persistedSettings","defaults","useMemo","ignoreNotDefinedColumns","find","definedColumn","columnPinning","_ref","_persistedSettings$co","_props$defaultSetting","defaultSettings","columnOrder","ensureOrdering","_persistedSettings$co2","_props$defaultSetting2","left","_columnPinning$left","freezeUptoExternalColumn","indexOf","defaultColumnFreezingIndex","unfreezeAllExternalColumns","state","columnFilters","_ref2","_persistedSettings$co3","_props$defaultSetting3","columnSizing","ignoreInternalColumns","_ref3","_ref4","_persistedSettings$co4","_props$defaultSetting4","columnVisibility","_ref5","_ref6","_persistedSettings$co5","_props$defaultSetting5","globalFilter","_persistedSettings$se","searchQuery","_props$defaultSetting6","sorting","_props$defaultSetting7","_props$defaultSetting8","grouping","expanded"],"mappings":";;;;;;;AAwBA;AACA,SAASA,eAAeA,CACpBC,KAAiE,EACjEC,OAAqC,EACrCC,aAA0C,EAC1CC,cAAsC,EACtCC,iBAA4C,EAC5CC,QAAuB,EACvBC,uBAAqC;EAErC,MAAMC,YAAY,GAAGC,kBAAkB,EAAS;EAEhD,kBAAIC,cAAK,CAACC,cAAc,CAAkBV,KAAK,CAAC,IAAIA,KAAK,CAACW,KAAK,CAACC,QAAQ,EAAE;IACtE,MAAM;MAAEA,QAAQ;MAAEC,EAAE;MAAEC;KAAQ,GAAGd,KAAK,CAACW,KAAK;IAE5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AA,GAAIpJ,KAAK,CAAC0H,eAAe,cAAA0B,sBAAA,uBAArBA,sBAAA,CAAuBJ,gBAAgB,cAAAE,KAAA,cAAAA,KAAA,GAAIjC,QAAQ,CAACxH,iBAAiB,cAAAwJ,KAAA,cAAAA,KAAA,GAAI,EAAE;MACrHI,YAAY,GAAAC,qBAAA,GAAEtC,iBAAiB,CAACuC,WAAW,cAAAD,qBAAA,cAAAA,qBAAA,IAAAE,sBAAA,GAAIxJ,KAAK,CAAC0H,eAAe,cAAA8B,sBAAA,uBAArBA,sBAAA,CAAuBD,WAAW;MACjFE,OAAO,EAAEzC,iBAAiB,CAACyC,OAAO,GAC5BzC,iBAAiB,CAACyC,OAAO,CAACpD,MAAM,CAACc,uBAAuB,CAAC,IAAAuC,sBAAA,IAAAC,sBAAA,GACzD3J,KAAK,CAAC0H,eAAe,cAAAiC,sBAAA,uBAArBA,sBAAA,CAAuBF,OAAO,cAAAC,sBAAA,cAAAA,sBAAA,GAAIzC,QAAQ,CAACzH;KACpD;IAED,IAAIQ,KAAK,CAACL,uBAAuB,EAAE;MAC/B0I,KAAK,CAACuB,QAAQ,GAAG,CAAC5J,KAAK,CAACL,uBAAiC,CAAC;;MAE1D0I,KAAK,CAACwB,QAAQ,GAAG,IAAI;;IAGzB,OAAOxB,KAAK;GACf,EAAE,EAAE,CAAC;AACV;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { isDate, toDate, isValid } from 'date-fns';
2
2
 
3
3
  const isWeakEqual = (leftDate, rightDate) => {
4
- return leftDate.getFullYear() === rightDate.getFullYear() && leftDate.getMonth() === rightDate.getMonth() && leftDate.getDay() === rightDate.getDay();
4
+ return leftDate.getFullYear() === rightDate.getFullYear() && leftDate.getMonth() === rightDate.getMonth() && leftDate.getDate() === rightDate.getDate();
5
5
  };
6
6
  const format = (date, mask = 'dd.mm.yy') => {
7
7
  if (!date) {
@@ -14,7 +14,7 @@ const format = (date, mask = 'dd.mm.yy') => {
14
14
  const pad = v => String(v).length === 1 ? `0${v}` : v.toString();
15
15
  return mask.replace('dd', pad(value.getDate())).replace('mm', pad(value.getMonth() + 1)).replace('yy', String(value.getFullYear()).slice(2));
16
16
  };
17
- const parseFromCustomString = (date = '', mask = 'dd.mm.yy', defaultYear = undefined) => {
17
+ const parseFromCustomString = (date = '', mask = 'dd.mm.yy', defaultMonth = undefined, defaultYear = undefined) => {
18
18
  if (!date || !date.length) {
19
19
  return undefined;
20
20
  }
@@ -48,7 +48,7 @@ const parseFromCustomString = (date = '', mask = 'dd.mm.yy', defaultYear = undef
48
48
  month = Number.parseInt(month, 10);
49
49
  year = Number.parseInt(year, 10);
50
50
  const currentDate = new Date();
51
- return new Date( /* year */Object.is(year, NaN) ? defaultYear !== null && defaultYear !== void 0 ? defaultYear : currentDate.getFullYear() : year, /* month */Object.is(month, NaN) ? currentDate.getMonth() : month - 1,
51
+ return new Date( /* year */Object.is(year, NaN) ? defaultYear !== null && defaultYear !== void 0 ? defaultYear : currentDate.getFullYear() : year, /* month */Object.is(month, NaN) ? defaultMonth !== null && defaultMonth !== void 0 ? defaultMonth : currentDate.getMonth() : month - 1,
52
52
  // months are zero based in javascript, so subtract a day
53
53
  /* day */
54
54
  Object.is(day, NaN) ? currentDate.getDate() : day, /* hours */12, /* minutes */0 // set to midday to avoid UTC offset causing dates to be mismatched server side
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sources":["../../../../../../src/utils/date.ts"],"sourcesContent":["import { isDate, toDate, isValid } from 'date-fns';\n\nexport const isWeakEqual = (leftDate: Date, rightDate: Date) => {\n return (\n leftDate.getFullYear() === rightDate.getFullYear() &&\n leftDate.getMonth() === rightDate.getMonth() &&\n leftDate.getDay() === rightDate.getDay()\n );\n};\n\nexport const format = (date: Date | undefined, mask = 'dd.mm.yy'): string | undefined => {\n if (!date) {\n return undefined;\n }\n\n const value = isDate(date) ? date : toDate(date);\n\n if (!isValid(value)) {\n return undefined;\n }\n\n const pad = (v: number): string => (String(v).length === 1 ? `0${v}` : v.toString());\n\n return mask\n .replace('dd', pad(value.getDate()))\n .replace('mm', pad(value.getMonth() + 1))\n .replace('yy', String(value.getFullYear()).slice(2));\n};\n\nexport const parseFromCustomString = (\n date = '',\n mask = 'dd.mm.yy',\n defaultYear: number | undefined = undefined\n): Date | undefined => {\n if (!date || !date.length) {\n return undefined;\n }\n\n const sanitizedMask = mask.split(/[^dmy]/);\n const dd = sanitizedMask.findIndex(x => x === 'dd');\n const mm = sanitizedMask.findIndex(x => x === 'mm');\n const yy = sanitizedMask.findIndex(x => x === 'yy' || x === 'yyyy');\n\n let day;\n let month;\n let year;\n\n const getFullYear = (y: string): string => {\n if (y && y.length === 2) {\n const z = Number.parseInt(y, 10);\n\n return z > 50 ? `19${y}` : `20${y}`;\n }\n\n return y;\n };\n\n const inputParts = date.split(/\\D/);\n\n if (inputParts.length === 1) {\n const fullDate = inputParts[0];\n const unseparatedMask = mask.replace(/[^dmy]/g, '');\n\n day = fullDate.slice(unseparatedMask.indexOf('d'), unseparatedMask.lastIndexOf('d') + 1);\n month = fullDate.slice(unseparatedMask.indexOf('m'), unseparatedMask.lastIndexOf('m') + 1);\n year = getFullYear(fullDate.slice(unseparatedMask.indexOf('y'), unseparatedMask.lastIndexOf('y') + 3)); // account for full years\n } else {\n day = inputParts[dd];\n month = inputParts[mm];\n year = getFullYear(inputParts[yy]);\n }\n\n day = Number.parseInt(day, 10);\n month = Number.parseInt(month, 10);\n year = Number.parseInt(year, 10);\n\n const currentDate = new Date();\n\n return new Date(\n /* year */ Object.is(year, NaN) ? defaultYear ?? currentDate.getFullYear() : year,\n /* month */ Object.is(month, NaN) ? currentDate.getMonth() : month - 1, // months are zero based in javascript, so subtract a day\n /* day */ Object.is(day, NaN) ? currentDate.getDate() : day,\n /* hours */ 12,\n /* minutes */ 0 // set to midday to avoid UTC offset causing dates to be mismatched server side\n );\n};\n\nexport const parseFromISOString = (date: string): Date | undefined => {\n const tempDate = new Date(date);\n return isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;\n};\n"],"names":["isWeakEqual","leftDate","rightDate","getFullYear","getMonth","getDay","format","date","mask","undefined","value","isDate","toDate","isValid","pad","v","String","length","toString","replace","getDate","slice","parseFromCustomString","defaultYear","sanitizedMask","split","dd","findIndex","x","mm","yy","day","month","year","y","z","Number","parseInt","inputParts","fullDate","unseparatedMask","indexOf","lastIndexOf","currentDate","Date","Object","is","NaN","parseFromISOString","tempDate"],"mappings":";;MAEaA,WAAW,GAAGA,CAACC,QAAc,EAAEC,SAAe;EACvD,OACID,QAAQ,CAACE,WAAW,EAAE,KAAKD,SAAS,CAACC,WAAW,EAAE,IAClDF,QAAQ,CAACG,QAAQ,EAAE,KAAKF,SAAS,CAACE,QAAQ,EAAE,IAC5CH,QAAQ,CAACI,MAAM,EAAE,KAAKH,SAAS,CAACG,MAAM,EAAE;AAEhD;MAEaC,MAAM,GAAGA,CAACC,IAAsB,EAAEC,IAAI,GAAG,UAAU;EAC5D,IAAI,CAACD,IAAI,EAAE;IACP,OAAOE,SAAS;;EAGpB,MAAMC,KAAK,GAAGC,MAAM,CAACJ,IAAI,CAAC,GAAGA,IAAI,GAAGK,MAAM,CAACL,IAAI,CAAC;EAEhD,IAAI,CAACM,OAAO,CAACH,KAAK,CAAC,EAAE;IACjB,OAAOD,SAAS;;EAGpB,MAAMK,GAAG,GAAIC,CAAS,IAAcC,MAAM,CAACD,CAAC,CAAC,CAACE,MAAM,KAAK,CAAC,OAAOF,GAAG,GAAGA,CAAC,CAACG,QAAQ,EAAG;EAEpF,OAAOV,IAAI,CACNW,OAAO,CAAC,IAAI,EAAEL,GAAG,CAACJ,KAAK,CAACU,OAAO,EAAE,CAAC,CAAC,CACnCD,OAAO,CAAC,IAAI,EAAEL,GAAG,CAACJ,KAAK,CAACN,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CACxCe,OAAO,CAAC,IAAI,EAAEH,MAAM,CAACN,KAAK,CAACP,WAAW,EAAE,CAAC,CAACkB,KAAK,CAAC,CAAC,CAAC,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3C,MAAM0C,QAAQ,GAAG,IAAIL,IAAI,CAACrC,IAAI,CAAC;EAC/B,OAAOM,OAAO,CAACoC,QAAQ,CAAC,GAAG3B,qBAAqB,CAAChB,MAAM,CAAC,IAAIsC,IAAI,CAACrC,IAAI,CAAC,CAAC,CAAC,GAAGE,SAAS;AACxF;;;;"}
1
+ {"version":3,"file":"date.js","sources":["../../../../../../src/utils/date.ts"],"sourcesContent":["import { isDate, toDate, isValid } from 'date-fns';\n\nexport const isWeakEqual = (leftDate: Date, rightDate: Date) => {\n return (\n leftDate.getFullYear() === rightDate.getFullYear() &&\n leftDate.getMonth() === rightDate.getMonth() &&\n leftDate.getDate() === rightDate.getDate()\n );\n};\n\nexport const format = (date: Date | undefined, mask = 'dd.mm.yy'): string | undefined => {\n if (!date) {\n return undefined;\n }\n\n const value = isDate(date) ? date : toDate(date);\n\n if (!isValid(value)) {\n return undefined;\n }\n\n const pad = (v: number): string => (String(v).length === 1 ? `0${v}` : v.toString());\n\n return mask\n .replace('dd', pad(value.getDate()))\n .replace('mm', pad(value.getMonth() + 1))\n .replace('yy', String(value.getFullYear()).slice(2));\n};\n\nexport const parseFromCustomString = (\n date = '',\n mask = 'dd.mm.yy',\n defaultMonth: number | undefined = undefined,\n defaultYear: number | undefined = undefined\n): Date | undefined => {\n if (!date || !date.length) {\n return undefined;\n }\n\n const sanitizedMask = mask.split(/[^dmy]/);\n const dd = sanitizedMask.findIndex(x => x === 'dd');\n const mm = sanitizedMask.findIndex(x => x === 'mm');\n const yy = sanitizedMask.findIndex(x => x === 'yy' || x === 'yyyy');\n\n let day;\n let month;\n let year;\n\n const getFullYear = (y: string): string => {\n if (y && y.length === 2) {\n const z = Number.parseInt(y, 10);\n\n return z > 50 ? `19${y}` : `20${y}`;\n }\n\n return y;\n };\n\n const inputParts = date.split(/\\D/);\n\n if (inputParts.length === 1) {\n const fullDate = inputParts[0];\n const unseparatedMask = mask.replace(/[^dmy]/g, '');\n\n day = fullDate.slice(unseparatedMask.indexOf('d'), unseparatedMask.lastIndexOf('d') + 1);\n month = fullDate.slice(unseparatedMask.indexOf('m'), unseparatedMask.lastIndexOf('m') + 1);\n year = getFullYear(fullDate.slice(unseparatedMask.indexOf('y'), unseparatedMask.lastIndexOf('y') + 3)); // account for full years\n } else {\n day = inputParts[dd];\n month = inputParts[mm];\n year = getFullYear(inputParts[yy]);\n }\n\n day = Number.parseInt(day, 10);\n month = Number.parseInt(month, 10);\n year = Number.parseInt(year, 10);\n\n const currentDate = new Date();\n\n return new Date(\n /* year */ Object.is(year, NaN) ? defaultYear ?? currentDate.getFullYear() : year,\n /* month */ Object.is(month, NaN) ? defaultMonth ?? currentDate.getMonth() : month - 1, // months are zero based in javascript, so subtract a day\n /* day */ Object.is(day, NaN) ? currentDate.getDate() : day,\n /* hours */ 12,\n /* minutes */ 0 // set to midday to avoid UTC offset causing dates to be mismatched server side\n );\n};\n\nexport const parseFromISOString = (date: string): Date | undefined => {\n const tempDate = new Date(date);\n return isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;\n};\n"],"names":["isWeakEqual","leftDate","rightDate","getFullYear","getMonth","getDate","format","date","mask","undefined","value","isDate","toDate","isValid","pad","v","String","length","toString","replace","slice","parseFromCustomString","defaultMonth","defaultYear","sanitizedMask","split","dd","findIndex","x","mm","yy","day","month","year","y","z","Number","parseInt","inputParts","fullDate","unseparatedMask","indexOf","lastIndexOf","currentDate","Date","Object","is","NaN","parseFromISOString","tempDate"],"mappings":";;MAEaA,WAAW,GAAGA,CAACC,QAAc,EAAEC,SAAe;EACvD,OACID,QAAQ,CAACE,WAAW,EAAE,KAAKD,SAAS,CAACC,WAAW,EAAE,IAClDF,QAAQ,CAACG,QAAQ,EAAE,KAAKF,SAAS,CAACE,QAAQ,EAAE,IAC5CH,QAAQ,CAACI,OAAO,EAAE,KAAKH,SAAS,CAACG,OAAO,EAAE;AAElD;MAEaC,MAAM,GAAGA,CAACC,IAAsB,EAAEC,IAAI,GAAG,UAAU;EAC5D,IA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E,EAAE,CAAC;EAC9BC,KAAK,GAAGI,MAAM,CAACC,QAAQ,CAACL,KAAK,EAAE,EAAE,CAAC;EAClCC,IAAI,GAAGG,MAAM,CAACC,QAAQ,CAACJ,IAAI,EAAE,EAAE,CAAC;EAEhC,MAAMU,WAAW,GAAG,IAAIC,IAAI,EAAE;EAE9B,OAAO,IAAIA,IAAI,YACAC,MAAM,CAACC,EAAE,CAACb,IAAI,EAAEc,GAAG,CAAC,GAAGxB,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAIoB,WAAW,CAACxC,WAAW,EAAE,GAAG8B,IAAI,aACrEY,MAAM,CAACC,EAAE,CAACd,KAAK,EAAEe,GAAG,CAAC,GAAGzB,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAIqB,WAAW,CAACvC,QAAQ,EAAE,GAAG4B,KAAK,GAAG,CAAC;;;EAC5Ea,MAAM,CAACC,EAAE,CAACf,GAAG,EAAEgB,GAAG,CAAC,GAAGJ,WAAW,CAACtC,OAAO,EAAE,GAAG0B,GAAG,aAC/C,EAAE,eACA,CAAC;GAClB;AACL;MAEaiB,kBAAkB,GAAIzC,IAAY;EAC3C,MAAM0C,QAAQ,GAAG,IAAIL,IAAI,CAACrC,IAAI,CAAC;EAC/B,OAAOM,OAAO,CAACoC,QAAQ,CAAC,GAAG5B,qBAAqB,CAACf,MAAM,CAAC,IAAIsC,IAAI,CAACrC,IAAI,CAAC,CAAC,CAAC,GAAGE,SAAS;AACxF;;;;"}
package/dist/index.css CHANGED
@@ -550,6 +550,8 @@ table[data-taco^='table'] {
550
550
  @apply grid;
551
551
  /* print */
552
552
  @apply print:float-left print:h-max print:w-full print:overflow-visible print:border-0;
553
+ /* resolves a virtualisation resizing issue */
554
+ overflow-anchor: none;
553
555
  }
554
556
 
555
557
  table[data-taco^='table'] thead {
@@ -639,6 +641,10 @@ table[data-taco^='table'] tr:first-child td {
639
641
  @apply !border-t-0;
640
642
  }
641
643
 
644
+ table[data-taco^='table'] tr:last-child td {
645
+ @apply !border-b-0;
646
+ }
647
+
642
648
  table[data-taco^='table'] tr[aria-grabbed='true'] td {
643
649
  @apply !wcag-blue-500;
644
650
  }
@@ -715,12 +721,15 @@ table[data-taco^='table'] td:not([data-cell-truncate='true']) {
715
721
 
716
722
  /* FOOTER */
717
723
  table[data-taco^='table'] tfoot td {
718
- /*
724
+ /*
719
725
  * Since footer has sticky position, the top and bottom padding ensures that the inner content doesn't come over
720
726
  * the border of the footer row.
721
727
  */
722
728
  @apply border-b-0 !py-1 font-bold;
723
729
  }
730
+ table[data-taco^='table'] tfoot td:first-child {
731
+ @apply z-30 !pb-0 !pt-[2px];
732
+ }
724
733
 
725
734
  table[data-taco^='table'] tfoot td:before {
726
735
  @apply bg-grey-300 absolute left-0 right-0 top-0 h-[2px] content-[''];
@@ -1085,11 +1094,6 @@ table[data-taco^='table'] tbody tr[data-row-meta-layout='item']:not([data-row-gr
1085
1094
  @apply !border-b-0;
1086
1095
  }
1087
1096
 
1088
- /* printing */
1089
- table[data-taco^='table'] [data-cell-id^='__'] {
1090
- @apply print:hidden;
1091
- }
1092
-
1093
1097
  /* rows */
1094
1098
  .yt-table__row {
1095
1099
  @apply border-grey-300 flex border-b;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { Table as ReactTable, Row as ReactTableRow } from '@tanstack/react-table';
3
3
  export declare type RowProps<TType = unknown> = {
4
4
  index: number;
@@ -6,5 +6,3 @@ export declare type RowProps<TType = unknown> = {
6
6
  table: ReactTable<TType>;
7
7
  };
8
8
  export declare function SkeletonRow<TType = unknown>(props: RowProps<TType>): JSX.Element;
9
- export declare function RowWithServerLoading<TType = unknown>(props: RowProps<TType>): JSX.Element;
10
- export declare const Skeleton: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<HTMLTableRowElement>>;
@@ -5,6 +5,6 @@ export declare function isInternalColumn(id: string | undefined): boolean | unde
5
5
  export declare const getCellMinWidth: (fontSize?: FontSize) => 57 | 83 | 72;
6
6
  export declare function isCellHighlighted(query: string, value: unknown, dataType?: TableColumnDataType): boolean;
7
7
  export declare function getCellValueAsString(value: unknown, dataType?: TableColumnDataType): string;
8
- export declare function ensureOrdering<TType = unknown>(columns: ReactTableColumnDef<TType>[], settingsOrder: string[] | undefined, internalColumnsPinnedToTheRight?: string[]): string[];
8
+ export declare function ensureOrdering<TType = unknown>(columns: ReactTableColumnDef<TType>[], settingsOrder: string[] | undefined, pinnedOrder?: string[] | undefined, internalColumnsPinnedToTheRight?: string[]): string[];
9
9
  export declare function unfreezeAllExternalColumns(leftPinnedState?: string[]): string[];
10
10
  export declare function freezeUptoExternalColumn(index: number, columns: string[]): string[];