@uzum-tech/ui 2.4.3 → 2.4.4

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.
Files changed (52) hide show
  1. package/dist/index.js +160 -44
  2. package/dist/index.mjs +160 -44
  3. package/dist/index.prod.js +2 -2
  4. package/dist/index.prod.mjs +3 -3
  5. package/es/components.d.ts +21 -0
  6. package/es/data-table/src/ColumnSettings/ColumnSettingsDrawer.d.ts +2 -2
  7. package/es/data-table/src/ColumnSettings/ColumnSettingsDrawer.mjs +1 -1
  8. package/es/data-table/src/DataTable.mjs +16 -13
  9. package/es/data-table/src/interface.d.ts +153 -151
  10. package/es/data-table/src/interface.mjs +7 -7
  11. package/es/data-table/src/use-column-settings.mjs +4 -1
  12. package/es/data-table/src/use-resizable.d.ts +2 -0
  13. package/es/data-table/src/use-resizable.mjs +9 -1
  14. package/es/locales/common/ruRU.mjs +1 -1
  15. package/es/upload/src/Upload.d.ts +21 -0
  16. package/es/upload/src/Upload.mjs +7 -1
  17. package/es/upload/src/UploadFile.d.ts +6 -0
  18. package/es/upload/src/UploadFile.mjs +12 -8
  19. package/es/upload/src/UploadFileList.mjs +3 -2
  20. package/es/upload/src/UploadProgress.d.ts +6 -0
  21. package/es/upload/src/interface.d.ts +10 -1
  22. package/es/upload/src/styles/index.cssr.mjs +84 -1
  23. package/es/upload/src/useUploadActionsRender.mjs +10 -5
  24. package/es/upload/styles/light.d.ts +6 -0
  25. package/es/upload/styles/light.mjs +4 -0
  26. package/es/version.d.ts +1 -1
  27. package/es/version.mjs +1 -1
  28. package/lib/components.d.ts +21 -0
  29. package/lib/data-table/src/ColumnSettings/ColumnSettingsDrawer.d.ts +2 -2
  30. package/lib/data-table/src/ColumnSettings/ColumnSettingsDrawer.js +1 -1
  31. package/lib/data-table/src/DataTable.js +14 -13
  32. package/lib/data-table/src/interface.d.ts +153 -151
  33. package/lib/data-table/src/interface.js +7 -7
  34. package/lib/data-table/src/use-column-settings.js +6 -1
  35. package/lib/data-table/src/use-resizable.d.ts +2 -0
  36. package/lib/data-table/src/use-resizable.js +9 -1
  37. package/lib/locales/common/ruRU.js +1 -1
  38. package/lib/upload/src/Upload.d.ts +21 -0
  39. package/lib/upload/src/Upload.js +5 -2
  40. package/lib/upload/src/UploadFile.d.ts +6 -0
  41. package/lib/upload/src/UploadFile.js +19 -11
  42. package/lib/upload/src/UploadFileList.js +5 -1
  43. package/lib/upload/src/UploadProgress.d.ts +6 -0
  44. package/lib/upload/src/interface.d.ts +10 -1
  45. package/lib/upload/src/styles/index.cssr.js +84 -1
  46. package/lib/upload/src/useUploadActionsRender.js +17 -7
  47. package/lib/upload/styles/light.d.ts +6 -0
  48. package/lib/upload/styles/light.js +4 -1
  49. package/lib/version.d.ts +1 -1
  50. package/lib/version.js +1 -1
  51. package/package.json +1 -1
  52. package/web-types.json +13 -10
@@ -180141,6 +180141,9 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
180141
180141
  widthSmall: string;
180142
180142
  widthMedium: string;
180143
180143
  widthLarge: string;
180144
+ previewCardWidth: string;
180145
+ previewCardHeight: string;
180146
+ previewCardBorderRadius: string;
180144
180147
  containerSecondary: string;
180145
180148
  brandPrimary300: string;
180146
180149
  elementsQuaternary: string;
@@ -180414,6 +180417,9 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
180414
180417
  widthSmall: string;
180415
180418
  widthMedium: string;
180416
180419
  widthLarge: string;
180420
+ previewCardWidth: string;
180421
+ previewCardHeight: string;
180422
+ previewCardBorderRadius: string;
180417
180423
  containerSecondary: string;
180418
180424
  brandPrimary300: string;
180419
180425
  elementsQuaternary: string;
@@ -180687,6 +180693,9 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
180687
180693
  widthSmall: string;
180688
180694
  widthMedium: string;
180689
180695
  widthLarge: string;
180696
+ previewCardWidth: string;
180697
+ previewCardHeight: string;
180698
+ previewCardBorderRadius: string;
180690
180699
  containerSecondary: string;
180691
180700
  brandPrimary300: string;
180692
180701
  elementsQuaternary: string;
@@ -180981,6 +180990,9 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
180981
180990
  widthSmall: string;
180982
180991
  widthMedium: string;
180983
180992
  widthLarge: string;
180993
+ previewCardWidth: string;
180994
+ previewCardHeight: string;
180995
+ previewCardBorderRadius: string;
180984
180996
  containerSecondary: string;
180985
180997
  brandPrimary300: string;
180986
180998
  elementsQuaternary: string;
@@ -181384,6 +181396,9 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
181384
181396
  widthSmall: string;
181385
181397
  widthMedium: string;
181386
181398
  widthLarge: string;
181399
+ previewCardWidth: string;
181400
+ previewCardHeight: string;
181401
+ previewCardBorderRadius: string;
181387
181402
  containerSecondary: string;
181388
181403
  brandPrimary300: string;
181389
181404
  elementsQuaternary: string;
@@ -181657,6 +181672,9 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
181657
181672
  widthSmall: string;
181658
181673
  widthMedium: string;
181659
181674
  widthLarge: string;
181675
+ previewCardWidth: string;
181676
+ previewCardHeight: string;
181677
+ previewCardBorderRadius: string;
181660
181678
  containerSecondary: string;
181661
181679
  brandPrimary300: string;
181662
181680
  elementsQuaternary: string;
@@ -181930,6 +181948,9 @@ export declare const UUpload: import("vue").DefineComponent<import("vue").Extrac
181930
181948
  widthSmall: string;
181931
181949
  widthMedium: string;
181932
181950
  widthLarge: string;
181951
+ previewCardWidth: string;
181952
+ previewCardHeight: string;
181953
+ previewCardBorderRadius: string;
181933
181954
  containerSecondary: string;
181934
181955
  brandPrimary300: string;
181935
181956
  elementsQuaternary: string;
@@ -81,13 +81,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
81
81
  mergedClsPrefix: import("vue").Ref<string, string>;
82
82
  localItems: import("vue").Ref<{
83
83
  key: string;
84
- title: string;
84
+ title: import("../interface").DataTableColumnTitle;
85
85
  visible: boolean;
86
86
  required: boolean;
87
87
  sortOrder: number;
88
88
  }[], DataTableColumnSettingsItem[] | {
89
89
  key: string;
90
- title: string;
90
+ title: import("../interface").DataTableColumnTitle;
91
91
  visible: boolean;
92
92
  required: boolean;
93
93
  sortOrder: number;
@@ -83,7 +83,7 @@ export default defineComponent({
83
83
  }
84
84
  }), h(UText, {
85
85
  class: `${mergedClsPrefixRef.value}-data-table-column-settings__item-title`
86
- }, () => row.title)]);
86
+ }, () => typeof row.title === 'function' ? row.title() : row.title)]);
87
87
  }
88
88
  }, {
89
89
  type: 'draggable',
@@ -74,12 +74,15 @@ export default defineComponent({
74
74
  clearResizableWidth,
75
75
  doUpdateResizableWidth,
76
76
  setResizableWidths,
77
- resizableWidthsRef
77
+ setPreferredWidths,
78
+ resizableWidthsRef,
79
+ preferredWidthsRef
78
80
  } = useResizable();
79
81
  if (props.localStorageKey && props.resizableStorage !== false) {
80
82
  const storedWidths = (_a = loadTableState(props.localStorageKey)) === null || _a === void 0 ? void 0 : _a.columnWidths;
81
83
  if (storedWidths && Object.keys(storedWidths).length > 0) {
82
- resizableWidthsRef.value = Object.assign(Object.assign({}, resizableWidthsRef.value), storedWidths);
84
+ setPreferredWidths(Object.assign({}, storedWidths));
85
+ setResizableWidths(Object.assign({}, storedWidths));
83
86
  }
84
87
  }
85
88
  const {
@@ -237,7 +240,7 @@ export default defineComponent({
237
240
  var _a, _b;
238
241
  return props.localStorageKey ? {
239
242
  key: props.localStorageKey,
240
- columnWidths: resizableWidthsRef.value,
243
+ columnWidths: preferredWidthsRef.value,
241
244
  columnsConfig: columnsConfigRef.value,
242
245
  page: (_a = mergedPaginationRef.value) === null || _a === void 0 ? void 0 : _a.page,
243
246
  pageSize: (_b = mergedPaginationRef.value) === null || _b === void 0 ? void 0 : _b.pageSize,
@@ -311,7 +314,7 @@ export default defineComponent({
311
314
  systemMaxWidth: props.resizableMaxWidth
312
315
  };
313
316
  });
314
- function buildNonFixedModeWidthMap(currentWidths, resizableColumns) {
317
+ function buildNonFixedModeWidthMap(preferredWidths, resizableColumns) {
315
318
  const {
316
319
  systemMinWidth,
317
320
  systemMaxWidth
@@ -321,11 +324,11 @@ export default defineComponent({
321
324
  widthMap: sanitizeColumnWidthMap(resizableColumns, {
322
325
  systemMinWidth,
323
326
  systemMaxWidth,
324
- source: currentWidths
327
+ source: preferredWidths
325
328
  })
326
329
  };
327
330
  }
328
- function buildFixedModeWidthMap(visibleLeafColumns, currentWidths) {
331
+ function buildFixedModeWidthMap(visibleLeafColumns, sourceWidths) {
329
332
  const {
330
333
  systemMinWidth,
331
334
  systemMaxWidth
@@ -333,7 +336,7 @@ export default defineComponent({
333
336
  const preferredWidths = sanitizeColumnWidthMap(visibleLeafColumns, {
334
337
  systemMinWidth,
335
338
  systemMaxWidth,
336
- source: currentWidths
339
+ source: sourceWidths
337
340
  });
338
341
  const containerWidth = containerWidthSignalRef.value;
339
342
  if (containerWidth === undefined) {
@@ -357,10 +360,10 @@ export default defineComponent({
357
360
  }
358
361
  function reconcileResizableWidths(_reason) {
359
362
  const visibleLeafColumns = visibleLeafColumnsSignalRef.value;
360
- const currentWidths = resizableWidthsRef.value;
363
+ const preferredWidths = preferredWidthsRef.value;
361
364
  if (!visibleLeafColumns.length || !resizableColumnPresentRef.value) {
362
- if (Object.keys(currentWidths).length) {
363
- clearResizableWidth();
365
+ if (Object.keys(resizableWidthsRef.value).length) {
366
+ setResizableWidths({});
364
367
  }
365
368
  return;
366
369
  }
@@ -368,12 +371,12 @@ export default defineComponent({
368
371
  const {
369
372
  widthMap,
370
373
  keys
371
- } = buildNonFixedModeWidthMap(currentWidths, resizableColumnsSignalRef.value);
374
+ } = buildNonFixedModeWidthMap(preferredWidths, resizableColumnsSignalRef.value);
372
375
  syncResizableWidths(widthMap, keys);
373
376
  return;
374
377
  }
375
378
  const visibleLeafKeys = visibleLeafColumns.map(column => column.key);
376
- const nextWidths = buildFixedModeWidthMap(visibleLeafColumns, currentWidths);
379
+ const nextWidths = buildFixedModeWidthMap(visibleLeafColumns, preferredWidths);
377
380
  syncResizableWidths(nextWidths, visibleLeafKeys);
378
381
  }
379
382
  function registerResizableWidthReconcileWatches() {
@@ -388,7 +391,7 @@ export default defineComponent({
388
391
  watch(() => [containerWidthSignalRef.value, widthConstraintSignalRef.value.systemMinWidth, widthConstraintSignalRef.value.systemMaxWidth], () => {
389
392
  reconcileResizableWidths('environment');
390
393
  });
391
- watch(() => resizableWidthsRef.value, () => {
394
+ watch(() => preferredWidthsRef.value, () => {
392
395
  reconcileResizableWidths('width-state');
393
396
  }, {
394
397
  deep: true
@@ -12,11 +12,6 @@ import type { ScrollbarProps, ScrollTo } from '../../scrollbar/src/Scrollbar';
12
12
  import type { DataTableTheme } from '../styles';
13
13
  import type { DataTableGetCsvCell, DataTableGetCsvHeader, DataTableSize } from './public-types';
14
14
  import type { ColItem, RowItem } from './use-group-header';
15
- export declare enum TableColumnType {
16
- SELECTION = "selection",
17
- EXPAND = "expand",
18
- DRAGGABLE = "draggable"
19
- }
20
15
  export declare const dataTableProps: {
21
16
  readonly onUnstableColumnResize: PropType<(resizedWidth: number, limitedWidth: number, column: TableBaseColumn, getColumnWidth: (key: ColumnKey) => number | undefined) => void>;
22
17
  readonly pagination: {
@@ -3775,16 +3770,18 @@ export declare const dataTableProps: {
3775
3770
  }>;
3776
3771
  }>>>;
3777
3772
  };
3778
- export type FilterOptionValue = string | number;
3779
- export type ColumnKey = string | number;
3780
- export type RowKey = string | number;
3773
+ export declare const dataTableInjectionKey: import("vue").InjectionKey<DataTableInjection>;
3774
+ export declare enum TableColumnType {
3775
+ SELECTION = "selection",
3776
+ EXPAND = "expand",
3777
+ DRAGGABLE = "draggable"
3778
+ }
3781
3779
  export interface ColumnWidthComputationItem {
3782
3780
  key: ColumnKey;
3783
3781
  width?: number | string;
3784
3782
  minWidth?: number | string;
3785
3783
  maxWidth?: number | string;
3786
3784
  }
3787
- export type SortOrderFlag = 1 | -1 | 0;
3788
3785
  export interface DataTableSlots {
3789
3786
  default?: () => VNode[];
3790
3787
  empty?: () => VNode[];
@@ -3793,28 +3790,14 @@ export interface DataTableSlots {
3793
3790
  filters?: () => VNode[];
3794
3791
  'column-settings-trigger'?: () => VNode[];
3795
3792
  }
3796
- export type RowData = Record<string, any>;
3797
- export type InternalRowData = Record<string, unknown>;
3798
- export type CreateRowKey<T = InternalRowData> = (row: T) => RowKey;
3799
- export type CreateRowClassName<T = InternalRowData> = (row: T, index: number) => string;
3800
- export type CreateRowProps<T = InternalRowData> = (row: T, index: number) => HTMLAttributes;
3801
- export type CreateCellProps<T = InternalRowData> = (row: T, index: number) => HTMLAttributes;
3802
- export type CompareFn<T = InternalRowData> = (row1: T, row2: T) => number;
3803
- export type Sorter<T = InternalRowData> = CompareFn<T> | SorterMultiple<T>;
3804
3793
  export interface SorterMultiple<T = InternalRowData> {
3805
3794
  multiple: number;
3806
3795
  compare?: CompareFn<T> | 'default';
3807
3796
  }
3808
- export type Filter<T = InternalRowData> = (filterOptionValue: FilterOptionValue, row: T) => boolean;
3809
3797
  export interface FilterOption {
3810
3798
  label: string;
3811
3799
  value: FilterOptionValue;
3812
3800
  }
3813
- export type TmNode = TreeNode<InternalRowData>;
3814
- export type SortOrder = 'ascend' | 'descend' | false;
3815
- export type Ellipsis = boolean | (EllipsisProps & {
3816
- style?: CSSProperties;
3817
- });
3818
3801
  export interface CommonColumnInfo<T = InternalRowData> {
3819
3802
  fixed?: 'left' | 'right';
3820
3803
  width?: number | string;
@@ -3828,82 +3811,11 @@ export interface CommonColumnInfo<T = InternalRowData> {
3828
3811
  allowExport?: boolean;
3829
3812
  visible?: boolean;
3830
3813
  required?: boolean;
3814
+ settingsTitle?: string;
3831
3815
  }
3832
3816
  export interface TableColumnMaskObject {
3833
3817
  postProcess: (value: string) => string;
3834
3818
  }
3835
- export type TableColumnMask = string | ((value: string) => string) | TableColumnMaskObject;
3836
- export type TableColumnTitle = string | ((column: TableBaseColumn) => VNodeChild);
3837
- export type TableExpandColumnTitle = string | ((column: TableExpandColumn) => VNodeChild);
3838
- export type TableColumnGroupTitle = string | ((column: TableColumnGroup) => VNodeChild);
3839
- export type TableColumnGroup<T = InternalRowData> = {
3840
- title?: TableColumnGroupTitle;
3841
- subtitle?: string;
3842
- type?: never;
3843
- key: ColumnKey;
3844
- children: Array<TableBaseColumn<T>>;
3845
- resizable?: boolean;
3846
- filterOptions?: never;
3847
- } & CommonColumnInfo<T>;
3848
- export type TableBaseColumn<T = InternalRowData> = {
3849
- title?: TableColumnTitle;
3850
- subtitle?: string;
3851
- titleColSpan?: number;
3852
- type?: never;
3853
- key: ColumnKey;
3854
- editable?: boolean | ((rowData: T) => boolean);
3855
- mask?: TableColumnMask;
3856
- numeric?: boolean;
3857
- placeholder?: string;
3858
- totalRow?: {
3859
- type: 'sum' | 'default' | 'diff' | 'multiply' | 'divide' | 'percentage' | 'function';
3860
- value?: string;
3861
- fields?: string[];
3862
- function?: (values: number[]) => number;
3863
- };
3864
- tree?: boolean;
3865
- sorter?: boolean | Sorter<T> | 'default';
3866
- defaultSortOrder?: SortOrder;
3867
- sortOrder?: SortOrder;
3868
- resizable?: boolean;
3869
- minWidth?: string | number;
3870
- maxWidth?: string | number;
3871
- filter?: 'default' | boolean | Filter<T>;
3872
- filterOptions?: FilterOption[];
3873
- filterOptionValues?: FilterOptionValue[] | null;
3874
- filterOptionValue?: FilterOptionValue | null;
3875
- filterMode?: 'or' | 'and';
3876
- defaultFilterOptionValues?: FilterOptionValue[] | null;
3877
- defaultFilterOptionValue?: FilterOptionValue | null;
3878
- filterMultiple?: boolean;
3879
- render?: (rowData: T, rowIndex: number) => VNodeChild;
3880
- renderFilter?: RenderFilter;
3881
- renderFilterIcon?: RenderFilterIcon;
3882
- renderSorter?: RenderSorter;
3883
- renderSorterIcon?: RenderSorterIcon;
3884
- renderFilterMenu?: RenderFilterMenu;
3885
- colSpan?: (rowData: T, rowIndex: number) => number;
3886
- rowSpan?: (rowData: T, rowIndex: number) => number;
3887
- } & CommonColumnInfo<T>;
3888
- export type TableSelectionColumn<T = InternalRowData> = {
3889
- type: 'selection';
3890
- multiple?: boolean;
3891
- disabled?: (row: T) => boolean;
3892
- options?: DataTableSelectionOptions<T>;
3893
- sorter?: never;
3894
- resizable?: boolean;
3895
- filter?: never;
3896
- filterOptions?: never;
3897
- filterOptionValues?: never;
3898
- filterOptionValue?: never;
3899
- colSpan?: never;
3900
- rowSpan?: never;
3901
- } & CommonColumnInfo<T>;
3902
- export type RenderExpand<T = InternalRowData> = (row: T, index: number) => VNodeChild;
3903
- export type RenderExpandIcon = ({ expanded }: {
3904
- expanded: boolean;
3905
- }) => VNodeChild;
3906
- export type Expandable<T = InternalRowData> = (row: T) => boolean;
3907
3819
  export interface TableExpandColumn<T = InternalRowData> extends Omit<TableSelectionColumn<T>, 'type'> {
3908
3820
  type: 'expand';
3909
3821
  title?: TableExpandColumnTitle;
@@ -4009,30 +3921,6 @@ export interface FixedShadowStyleProps {
4009
3921
  rightActiveFixedChildrenColKeys: ColumnKey[];
4010
3922
  componentId: string;
4011
3923
  }
4012
- export type RowDropPosition = 'before' | 'after';
4013
- export type TableDraggableColumn<T = InternalRowData> = {
4014
- type: 'draggable';
4015
- key: ColumnKey;
4016
- draggable?: (row: T) => boolean;
4017
- onDragEnd?: (row: T, options: RowDragEndOptions) => void;
4018
- sortByKey?: boolean;
4019
- sorter?: never;
4020
- filter?: never;
4021
- filterOptions?: never;
4022
- filterOptionValues?: never;
4023
- filterOptionValue?: never;
4024
- resizable?: never;
4025
- colSpan?: never;
4026
- rowSpan?: never;
4027
- } & CommonColumnInfo<T>;
4028
- export type TableColumn<T = InternalRowData> = TableColumnGroup<T> | TableBaseColumn<T> | TableSelectionColumn<T> | TableExpandColumn<T> | TableDraggableColumn<T>;
4029
- export type TableColumns<T = InternalRowData> = Array<TableColumn<T>>;
4030
- export type DataRelatedColumn<T = InternalRowData> = TableSelectionColumn<T> | TableBaseColumn<T> | TableExpandColumn<T> | TableDraggableColumn<T>;
4031
- export type DataTableSelectionOptions<T = InternalRowData> = Array<DataTableSelectionOption | {
4032
- label: string;
4033
- key: string | number;
4034
- onSelect: (pageData: T[]) => void;
4035
- }>;
4036
3924
  export interface DataTableInjection {
4037
3925
  props: DataTableSetupProps;
4038
3926
  slots: Slots;
@@ -4128,7 +4016,6 @@ export interface DataTableInjection {
4128
4016
  handleRowDragEnd: UseRowDragReturn['handleRowDragEnd'];
4129
4017
  handleRowDrop: UseRowDragReturn['handleRowDrop'];
4130
4018
  }
4131
- export declare const dataTableInjectionKey: import("vue").InjectionKey<DataTableInjection>;
4132
4019
  export interface MainTableInjection {
4133
4020
  leftActiveFixedColKey: ColumnKey | null;
4134
4021
  rightActiveFixedColKey: ColumnKey | null;
@@ -4140,14 +4027,11 @@ export interface DataTableColumnConfigState {
4140
4027
  }
4141
4028
  export interface DataTableColumnSettingsItem {
4142
4029
  key: string;
4143
- title: string;
4030
+ title: DataTableColumnTitle;
4144
4031
  visible: boolean;
4145
4032
  required: boolean;
4146
4033
  sortOrder: number;
4147
4034
  }
4148
- export type DataTableConfigurableColumn = TableBaseColumn & {
4149
- key: string | number;
4150
- };
4151
4035
  export interface UseColumnSettingsReturn {
4152
4036
  enabledRef: ComputedRef<boolean>;
4153
4037
  resolvedColumnsRef: ComputedRef<TableColumns>;
@@ -4174,32 +4058,11 @@ export interface DataTableStorageState {
4174
4058
  checkedRowKeys?: RowKey[];
4175
4059
  expandedRowKeys?: RowKey[];
4176
4060
  }
4177
- export type RenderFilter = (props: {
4178
- active: boolean;
4179
- show: boolean;
4180
- }) => VNodeChild;
4181
- export type RenderFilterIcon = RenderFilter;
4182
- export type RenderSorter = (props: {
4183
- order: SortOrder;
4184
- }) => VNodeChild;
4185
- export type RenderSorterIcon = RenderSorter;
4186
- export type RenderFilterMenu = (actions: {
4187
- hide: () => void;
4188
- }) => VNodeChild;
4189
- export type OnUpdateExpandedRowKeys = (keys: RowKey[]) => void;
4190
- export type OnUpdateCheckedRowKeys = (keys: RowKey[], rows: InternalRowData[], meta: {
4191
- row: InternalRowData | undefined;
4192
- action: 'check' | 'uncheck' | 'checkAll' | 'uncheckAll';
4193
- }) => void;
4194
- export type OnUpdateSorter = (sortState: SortState & SortState[] & null) => void;
4195
- export type OnUpdateSorterImpl = (sortState: SortState | SortState[] | null) => void;
4196
- export type OnUpdateFilters = (filterState: FilterState, sourceColumn: TableBaseColumn) => void;
4197
4061
  export interface SortState {
4198
4062
  columnKey: ColumnKey;
4199
4063
  order: SortOrder;
4200
4064
  sorter: Sorter | boolean | 'default';
4201
4065
  }
4202
- export type FilterState = Record<string, FilterOptionValue[] | FilterOptionValue | null | undefined>;
4203
4066
  export interface MainTableRef {
4204
4067
  getHeaderElement: () => HTMLElement | null;
4205
4068
  getBodyElement: () => HTMLElement | null;
@@ -4212,8 +4075,6 @@ export interface MainTableBodyRef {
4212
4075
  export interface MainTableHeaderRef {
4213
4076
  $el: HTMLElement | null;
4214
4077
  }
4215
- export type OnFilterMenuChange = <T extends FilterOptionValue[] & (FilterOptionValue | null)>(value: T) => void;
4216
- export type OnFilterMenuChangeImpl = (value: FilterOptionValue[] | FilterOptionValue | null) => void;
4217
4078
  export interface DataTableInst {
4218
4079
  filter: (filters: FilterState | null) => void;
4219
4080
  filters: (filters: FilterState | null) => void;
@@ -4234,15 +4095,11 @@ export interface DataTableInst {
4234
4095
  /** @deprecated it but just leave it here, it does no harm */
4235
4096
  clearFilter: () => void;
4236
4097
  }
4237
- export type CreateSummary<T = InternalRowData> = (pageData: T[]) => SummaryRowData | SummaryRowData[];
4238
4098
  export interface SummaryCell {
4239
4099
  value?: VNodeChild;
4240
4100
  colSpan?: number;
4241
4101
  rowSpan?: number;
4242
4102
  }
4243
- export type SummaryRowData = Record<string, SummaryCell>;
4244
- export type DataTableOnLoad = (node: RowData) => Promise<void>;
4245
- export type DataTableSelectionOption = 'all' | 'none';
4246
4103
  export interface CsvOptionsType {
4247
4104
  fileName?: string;
4248
4105
  keepOriginalData?: boolean;
@@ -4257,6 +4114,151 @@ export interface WidthConstraintSignal {
4257
4114
  systemMinWidth: number | string;
4258
4115
  systemMaxWidth?: number | string;
4259
4116
  }
4117
+ export type FilterOptionValue = string | number;
4118
+ export type ColumnKey = string | number;
4119
+ export type RowKey = string | number;
4120
+ export type SortOrderFlag = 1 | -1 | 0;
4121
+ export type RowData = Record<string, any>;
4122
+ export type InternalRowData = Record<string, unknown>;
4123
+ export type CreateRowKey<T = InternalRowData> = (row: T) => RowKey;
4124
+ export type CreateRowClassName<T = InternalRowData> = (row: T, index: number) => string;
4125
+ export type CreateRowProps<T = InternalRowData> = (row: T, index: number) => HTMLAttributes;
4126
+ export type CreateCellProps<T = InternalRowData> = (row: T, index: number) => HTMLAttributes;
4127
+ export type CompareFn<T = InternalRowData> = (row1: T, row2: T) => number;
4128
+ export type Sorter<T = InternalRowData> = CompareFn<T> | SorterMultiple<T>;
4129
+ export type Filter<T = InternalRowData> = (filterOptionValue: FilterOptionValue, row: T) => boolean;
4130
+ export type TmNode = TreeNode<InternalRowData>;
4131
+ export type SortOrder = 'ascend' | 'descend' | false;
4132
+ export type Ellipsis = boolean | (EllipsisProps & {
4133
+ style?: CSSProperties;
4134
+ });
4135
+ export type TableColumnMask = string | ((value: string) => string) | TableColumnMaskObject;
4136
+ export type TableColumnTitle = string | ((column: TableBaseColumn) => VNodeChild);
4137
+ export type TableExpandColumnTitle = string | ((column: TableExpandColumn) => VNodeChild);
4138
+ export type TableColumnGroupTitle = string | ((column: TableColumnGroup) => VNodeChild);
4139
+ export type DataTableColumnTitle = string | (() => VNodeChild);
4140
+ export type TableColumnGroup<T = InternalRowData> = {
4141
+ title?: TableColumnGroupTitle;
4142
+ subtitle?: string;
4143
+ type?: never;
4144
+ key: ColumnKey;
4145
+ children: Array<TableBaseColumn<T>>;
4146
+ resizable?: boolean;
4147
+ filterOptions?: never;
4148
+ } & CommonColumnInfo<T>;
4149
+ export type TableBaseColumn<T = InternalRowData> = {
4150
+ title?: TableColumnTitle;
4151
+ subtitle?: string;
4152
+ titleColSpan?: number;
4153
+ type?: never;
4154
+ key: ColumnKey;
4155
+ editable?: boolean | ((rowData: T) => boolean);
4156
+ mask?: TableColumnMask;
4157
+ numeric?: boolean;
4158
+ placeholder?: string;
4159
+ totalRow?: {
4160
+ type: 'sum' | 'default' | 'diff' | 'multiply' | 'divide' | 'percentage' | 'function';
4161
+ value?: string;
4162
+ fields?: string[];
4163
+ function?: (values: number[]) => number;
4164
+ };
4165
+ tree?: boolean;
4166
+ sorter?: boolean | Sorter<T> | 'default';
4167
+ defaultSortOrder?: SortOrder;
4168
+ sortOrder?: SortOrder;
4169
+ resizable?: boolean;
4170
+ minWidth?: string | number;
4171
+ maxWidth?: string | number;
4172
+ filter?: 'default' | boolean | Filter<T>;
4173
+ filterOptions?: FilterOption[];
4174
+ filterOptionValues?: FilterOptionValue[] | null;
4175
+ filterOptionValue?: FilterOptionValue | null;
4176
+ filterMode?: 'or' | 'and';
4177
+ defaultFilterOptionValues?: FilterOptionValue[] | null;
4178
+ defaultFilterOptionValue?: FilterOptionValue | null;
4179
+ filterMultiple?: boolean;
4180
+ render?: (rowData: T, rowIndex: number) => VNodeChild;
4181
+ renderFilter?: RenderFilter;
4182
+ renderFilterIcon?: RenderFilterIcon;
4183
+ renderSorter?: RenderSorter;
4184
+ renderSorterIcon?: RenderSorterIcon;
4185
+ renderFilterMenu?: RenderFilterMenu;
4186
+ colSpan?: (rowData: T, rowIndex: number) => number;
4187
+ rowSpan?: (rowData: T, rowIndex: number) => number;
4188
+ } & CommonColumnInfo<T>;
4189
+ export type TableSelectionColumn<T = InternalRowData> = {
4190
+ type: 'selection';
4191
+ multiple?: boolean;
4192
+ disabled?: (row: T) => boolean;
4193
+ options?: DataTableSelectionOptions<T>;
4194
+ sorter?: never;
4195
+ resizable?: boolean;
4196
+ filter?: never;
4197
+ filterOptions?: never;
4198
+ filterOptionValues?: never;
4199
+ filterOptionValue?: never;
4200
+ colSpan?: never;
4201
+ rowSpan?: never;
4202
+ } & CommonColumnInfo<T>;
4203
+ export type RenderExpand<T = InternalRowData> = (row: T, index: number) => VNodeChild;
4204
+ export type RenderExpandIcon = ({ expanded }: {
4205
+ expanded: boolean;
4206
+ }) => VNodeChild;
4207
+ export type Expandable<T = InternalRowData> = (row: T) => boolean;
4208
+ export type RowDropPosition = 'before' | 'after';
4209
+ export type TableDraggableColumn<T = InternalRowData> = {
4210
+ type: 'draggable';
4211
+ key: ColumnKey;
4212
+ draggable?: (row: T) => boolean;
4213
+ onDragEnd?: (row: T, options: RowDragEndOptions) => void;
4214
+ sortByKey?: boolean;
4215
+ sorter?: never;
4216
+ filter?: never;
4217
+ filterOptions?: never;
4218
+ filterOptionValues?: never;
4219
+ filterOptionValue?: never;
4220
+ resizable?: never;
4221
+ colSpan?: never;
4222
+ rowSpan?: never;
4223
+ } & CommonColumnInfo<T>;
4224
+ export type TableColumn<T = InternalRowData> = TableColumnGroup<T> | TableBaseColumn<T> | TableSelectionColumn<T> | TableExpandColumn<T> | TableDraggableColumn<T>;
4225
+ export type TableColumns<T = InternalRowData> = Array<TableColumn<T>>;
4226
+ export type DataRelatedColumn<T = InternalRowData> = TableSelectionColumn<T> | TableBaseColumn<T> | TableExpandColumn<T> | TableDraggableColumn<T>;
4227
+ export type DataTableSelectionOptions<T = InternalRowData> = Array<DataTableSelectionOption | {
4228
+ label: string;
4229
+ key: string | number;
4230
+ onSelect: (pageData: T[]) => void;
4231
+ }>;
4232
+ export type DataTableConfigurableColumn = TableBaseColumn & {
4233
+ key: string | number;
4234
+ };
4235
+ export type RenderFilter = (props: {
4236
+ active: boolean;
4237
+ show: boolean;
4238
+ }) => VNodeChild;
4239
+ export type RenderFilterIcon = RenderFilter;
4240
+ export type RenderSorter = (props: {
4241
+ order: SortOrder;
4242
+ }) => VNodeChild;
4243
+ export type RenderSorterIcon = RenderSorter;
4244
+ export type RenderFilterMenu = (actions: {
4245
+ hide: () => void;
4246
+ }) => VNodeChild;
4247
+ export type OnUpdateExpandedRowKeys = (keys: RowKey[]) => void;
4248
+ export type OnUpdateCheckedRowKeys = (keys: RowKey[], rows: InternalRowData[], meta: {
4249
+ row: InternalRowData | undefined;
4250
+ action: 'check' | 'uncheck' | 'checkAll' | 'uncheckAll';
4251
+ }) => void;
4252
+ export type OnUpdateSorter = (sortState: SortState & SortState[] & null) => void;
4253
+ export type OnUpdateSorterImpl = (sortState: SortState | SortState[] | null) => void;
4254
+ export type OnUpdateFilters = (filterState: FilterState, sourceColumn: TableBaseColumn) => void;
4255
+ export type FilterState = Record<string, FilterOptionValue[] | FilterOptionValue | null | undefined>;
4256
+ export type OnFilterMenuChange = <T extends FilterOptionValue[] & (FilterOptionValue | null)>(value: T) => void;
4257
+ export type OnFilterMenuChangeImpl = (value: FilterOptionValue[] | FilterOptionValue | null) => void;
4258
+ export type CreateSummary<T = InternalRowData> = (pageData: T[]) => SummaryRowData | SummaryRowData[];
4259
+ export type SummaryRowData = Record<string, SummaryCell>;
4260
+ export type DataTableOnLoad = (node: RowData) => Promise<void>;
4261
+ export type DataTableSelectionOption = 'all' | 'none';
4260
4262
  export type RowRenderInfo = {
4261
4263
  isSummaryRow: true;
4262
4264
  key: RowKey;
@@ -1,11 +1,5 @@
1
1
  import { useTheme } from "../../_mixins/index.mjs";
2
2
  import { createInjectionKey } from "../../_utils/index.mjs";
3
- export var TableColumnType;
4
- (function (TableColumnType) {
5
- TableColumnType["SELECTION"] = "selection";
6
- TableColumnType["EXPAND"] = "expand";
7
- TableColumnType["DRAGGABLE"] = "draggable";
8
- })(TableColumnType || (TableColumnType = {}));
9
3
  export const dataTableProps = Object.assign(Object.assign({}, useTheme.props), {
10
4
  onUnstableColumnResize: Function,
11
5
  pagination: {
@@ -145,4 +139,10 @@ export const dataTableProps = Object.assign(Object.assign({}, useTheme.props), {
145
139
  onFiltersChange: [Function, Array],
146
140
  onCheckedRowKeysChange: [Function, Array]
147
141
  });
148
- export const dataTableInjectionKey = createInjectionKey('u-data-table');
142
+ export const dataTableInjectionKey = createInjectionKey('u-data-table');
143
+ export var TableColumnType;
144
+ (function (TableColumnType) {
145
+ TableColumnType["SELECTION"] = "selection";
146
+ TableColumnType["EXPAND"] = "expand";
147
+ TableColumnType["DRAGGABLE"] = "draggable";
148
+ })(TableColumnType || (TableColumnType = {}));
@@ -10,7 +10,10 @@ function isConfigurableColumn(column) {
10
10
  return column.visible !== false;
11
11
  }
12
12
  function toColumnTitle(column) {
13
- return typeof column.title === 'string' ? column.title : String(column.key);
13
+ if (column.settingsTitle !== undefined) return column.settingsTitle;
14
+ const title = column.title;
15
+ if (typeof title === 'function') return () => title(column);
16
+ return title !== null && title !== void 0 ? title : String(column.key);
14
17
  }
15
18
  function calcColumnsScrollX(columns, getResizableWidth) {
16
19
  let total = 0;
@@ -3,6 +3,8 @@ export declare function useResizable(): {
3
3
  getResizableWidth: (key: ColumnKey) => number | undefined;
4
4
  doUpdateResizableWidth: (column: TableColumn, width: number) => void;
5
5
  setResizableWidths: (widths: Record<ColumnKey, number>) => void;
6
+ setPreferredWidths: (widths: Record<ColumnKey, number>) => void;
6
7
  clearResizableWidth: () => void;
7
8
  resizableWidthsRef: import("vue").Ref<Record<ColumnKey, number>, Record<ColumnKey, number>>;
9
+ preferredWidthsRef: import("vue").Ref<Record<ColumnKey, number>, Record<ColumnKey, number>>;
8
10
  };