@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
@@ -67,11 +67,12 @@ exports.default = (0, vue_1.defineComponent)({
67
67
  const themeRef = (0, _mixins_1.useTheme)('DataTable', '-data-table', index_cssr_1.default, styles_1.dataTableLight, props, mergedClsPrefixRef);
68
68
  const bodyWidthRef = (0, vue_1.ref)(null);
69
69
  const mainTableInstRef = (0, vue_1.ref)(null);
70
- const { getResizableWidth, clearResizableWidth, doUpdateResizableWidth, setResizableWidths, resizableWidthsRef } = (0, use_resizable_1.useResizable)();
70
+ const { getResizableWidth, clearResizableWidth, doUpdateResizableWidth, setResizableWidths, setPreferredWidths, resizableWidthsRef, preferredWidthsRef } = (0, use_resizable_1.useResizable)();
71
71
  if (props.localStorageKey && props.resizableStorage !== false) {
72
72
  const storedWidths = (_a = (0, use_table_storage_1.loadTableState)(props.localStorageKey)) === null || _a === void 0 ? void 0 : _a.columnWidths;
73
73
  if (storedWidths && Object.keys(storedWidths).length > 0) {
74
- resizableWidthsRef.value = Object.assign(Object.assign({}, resizableWidthsRef.value), storedWidths);
74
+ setPreferredWidths(Object.assign({}, storedWidths));
75
+ setResizableWidths(Object.assign({}, storedWidths));
75
76
  }
76
77
  }
77
78
  const { enabledRef: columnSettingsEnabledRef, resolvedColumnsRef, scrollXRef: columnSettingsScrollXRef, columnsConfigRef, drawerOpenRef, drawerItemsRef, defaultDrawerItemsRef, openDrawer: openColumnSettings, resetConfig: resetColumnSettings, applyConfig: applyColumnSettings, applyConfigFromKeys: applyColumnSettingsFromKeys } = (0, use_column_settings_1.useColumnSettings)(props, getResizableWidth);
@@ -145,7 +146,7 @@ exports.default = (0, vue_1.defineComponent)({
145
146
  return props.localStorageKey
146
147
  ? {
147
148
  key: props.localStorageKey,
148
- columnWidths: resizableWidthsRef.value,
149
+ columnWidths: preferredWidthsRef.value,
149
150
  columnsConfig: columnsConfigRef.value,
150
151
  page: (_a = mergedPaginationRef.value) === null || _a === void 0 ? void 0 : _a.page,
151
152
  pageSize: (_b = mergedPaginationRef.value) === null || _b === void 0 ? void 0 : _b.pageSize,
@@ -235,23 +236,23 @@ exports.default = (0, vue_1.defineComponent)({
235
236
  systemMaxWidth: props.resizableMaxWidth
236
237
  };
237
238
  });
238
- function buildNonFixedModeWidthMap(currentWidths, resizableColumns) {
239
+ function buildNonFixedModeWidthMap(preferredWidths, resizableColumns) {
239
240
  const { systemMinWidth, systemMaxWidth } = widthConstraintSignalRef.value;
240
241
  return {
241
242
  keys: resizableColumns.map(column => column.key),
242
243
  widthMap: (0, utils_1.sanitizeColumnWidthMap)(resizableColumns, {
243
244
  systemMinWidth,
244
245
  systemMaxWidth,
245
- source: currentWidths
246
+ source: preferredWidths
246
247
  })
247
248
  };
248
249
  }
249
- function buildFixedModeWidthMap(visibleLeafColumns, currentWidths) {
250
+ function buildFixedModeWidthMap(visibleLeafColumns, sourceWidths) {
250
251
  const { systemMinWidth, systemMaxWidth } = widthConstraintSignalRef.value;
251
252
  const preferredWidths = (0, utils_1.sanitizeColumnWidthMap)(visibleLeafColumns, {
252
253
  systemMinWidth,
253
254
  systemMaxWidth,
254
- source: currentWidths
255
+ source: sourceWidths
255
256
  });
256
257
  const containerWidth = containerWidthSignalRef.value;
257
258
  if (containerWidth === undefined) {
@@ -276,20 +277,20 @@ exports.default = (0, vue_1.defineComponent)({
276
277
  }
277
278
  function reconcileResizableWidths(_reason) {
278
279
  const visibleLeafColumns = visibleLeafColumnsSignalRef.value;
279
- const currentWidths = resizableWidthsRef.value;
280
+ const preferredWidths = preferredWidthsRef.value;
280
281
  if (!visibleLeafColumns.length || !resizableColumnPresentRef.value) {
281
- if (Object.keys(currentWidths).length) {
282
- clearResizableWidth();
282
+ if (Object.keys(resizableWidthsRef.value).length) {
283
+ setResizableWidths({});
283
284
  }
284
285
  return;
285
286
  }
286
287
  if (modeSignalRef.value !== 'fixed') {
287
- const { widthMap, keys } = buildNonFixedModeWidthMap(currentWidths, resizableColumnsSignalRef.value);
288
+ const { widthMap, keys } = buildNonFixedModeWidthMap(preferredWidths, resizableColumnsSignalRef.value);
288
289
  syncResizableWidths(widthMap, keys);
289
290
  return;
290
291
  }
291
292
  const visibleLeafKeys = visibleLeafColumns.map(column => column.key);
292
- const nextWidths = buildFixedModeWidthMap(visibleLeafColumns, currentWidths);
293
+ const nextWidths = buildFixedModeWidthMap(visibleLeafColumns, preferredWidths);
293
294
  syncResizableWidths(nextWidths, visibleLeafKeys);
294
295
  }
295
296
  function registerResizableWidthReconcileWatches() {
@@ -311,7 +312,7 @@ exports.default = (0, vue_1.defineComponent)({
311
312
  ], () => {
312
313
  reconcileResizableWidths('environment');
313
314
  });
314
- (0, vue_1.watch)(() => resizableWidthsRef.value, () => {
315
+ (0, vue_1.watch)(() => preferredWidthsRef.value, () => {
315
316
  reconcileResizableWidths('width-state');
316
317
  }, { deep: true });
317
318
  }
@@ -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,14 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dataTableInjectionKey = exports.dataTableProps = exports.TableColumnType = void 0;
3
+ exports.TableColumnType = exports.dataTableInjectionKey = exports.dataTableProps = void 0;
4
4
  const _mixins_1 = require("../../_mixins");
5
5
  const _utils_1 = require("../../_utils");
6
- var TableColumnType;
7
- (function (TableColumnType) {
8
- TableColumnType["SELECTION"] = "selection";
9
- TableColumnType["EXPAND"] = "expand";
10
- TableColumnType["DRAGGABLE"] = "draggable";
11
- })(TableColumnType || (exports.TableColumnType = TableColumnType = {}));
12
6
  exports.dataTableProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { onUnstableColumnResize: Function, pagination: {
13
7
  type: [Object, Boolean],
14
8
  default: false
@@ -78,3 +72,9 @@ exports.dataTableProps = Object.assign(Object.assign({}, _mixins_1.useTheme.prop
78
72
  // deprecated
79
73
  onPageChange: [Function, Array], onPageSizeChange: [Function, Array], onSorterChange: [Function, Array], onFiltersChange: [Function, Array], onCheckedRowKeysChange: [Function, Array] });
80
74
  exports.dataTableInjectionKey = (0, _utils_1.createInjectionKey)('u-data-table');
75
+ var TableColumnType;
76
+ (function (TableColumnType) {
77
+ TableColumnType["SELECTION"] = "selection";
78
+ TableColumnType["EXPAND"] = "expand";
79
+ TableColumnType["DRAGGABLE"] = "draggable";
80
+ })(TableColumnType || (exports.TableColumnType = TableColumnType = {}));
@@ -16,7 +16,12 @@ function isConfigurableColumn(column) {
16
16
  return column.visible !== false;
17
17
  }
18
18
  function toColumnTitle(column) {
19
- return typeof column.title === 'string' ? column.title : String(column.key);
19
+ if (column.settingsTitle !== undefined)
20
+ return column.settingsTitle;
21
+ const title = column.title;
22
+ if (typeof title === 'function')
23
+ return () => title(column);
24
+ return title !== null && title !== void 0 ? title : String(column.key);
20
25
  }
21
26
  function calcColumnsScrollX(columns, getResizableWidth) {
22
27
  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
  };
@@ -4,25 +4,33 @@ exports.useResizable = useResizable;
4
4
  const vue_1 = require("vue");
5
5
  function useResizable() {
6
6
  const resizableWidthsRef = (0, vue_1.ref)({});
7
+ const preferredWidthsRef = (0, vue_1.ref)({});
7
8
  function getResizableWidth(key) {
8
9
  return resizableWidthsRef.value[key];
9
10
  }
10
11
  function doUpdateResizableWidth(column, width) {
11
12
  if ('key' in column) {
13
+ preferredWidthsRef.value[column.key] = width;
12
14
  resizableWidthsRef.value[column.key] = width;
13
15
  }
14
16
  }
15
17
  function setResizableWidths(widths) {
16
18
  resizableWidthsRef.value = widths;
17
19
  }
20
+ function setPreferredWidths(widths) {
21
+ preferredWidthsRef.value = widths;
22
+ }
18
23
  function clearResizableWidth() {
24
+ preferredWidthsRef.value = {};
19
25
  resizableWidthsRef.value = {};
20
26
  }
21
27
  return {
22
28
  getResizableWidth,
23
29
  doUpdateResizableWidth,
24
30
  setResizableWidths,
31
+ setPreferredWidths,
25
32
  clearResizableWidth,
26
- resizableWidthsRef
33
+ resizableWidthsRef,
34
+ preferredWidthsRef
27
35
  };
28
36
  }
@@ -57,7 +57,7 @@ const ruRu = {
57
57
  uncheckTableAll: 'Отменить все в таблице',
58
58
  confirm: 'Подтвердить',
59
59
  clear: 'Очистить',
60
- columnSettingsTitle: 'Настройки таблицы',
60
+ columnSettingsTitle: 'Настройка таблицы',
61
61
  columnSettingsButton: 'Настройка таблицы',
62
62
  columnSettingsSubtitle: 'Выберите колонки и измените их порядок',
63
63
  columnSettingsSelectAll: 'Выбрать все',
@@ -135,6 +135,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
135
135
  widthSmall: string;
136
136
  widthMedium: string;
137
137
  widthLarge: string;
138
+ previewCardWidth: string;
139
+ previewCardHeight: string;
140
+ previewCardBorderRadius: string;
138
141
  containerSecondary: string;
139
142
  brandPrimary300: string;
140
143
  elementsQuaternary: string;
@@ -408,6 +411,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
408
411
  widthSmall: string;
409
412
  widthMedium: string;
410
413
  widthLarge: string;
414
+ previewCardWidth: string;
415
+ previewCardHeight: string;
416
+ previewCardBorderRadius: string;
411
417
  containerSecondary: string;
412
418
  brandPrimary300: string;
413
419
  elementsQuaternary: string;
@@ -681,6 +687,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
681
687
  widthSmall: string;
682
688
  widthMedium: string;
683
689
  widthLarge: string;
690
+ previewCardWidth: string;
691
+ previewCardHeight: string;
692
+ previewCardBorderRadius: string;
684
693
  containerSecondary: string;
685
694
  brandPrimary300: string;
686
695
  elementsQuaternary: string;
@@ -975,6 +984,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
975
984
  widthSmall: string;
976
985
  widthMedium: string;
977
986
  widthLarge: string;
987
+ previewCardWidth: string;
988
+ previewCardHeight: string;
989
+ previewCardBorderRadius: string;
978
990
  containerSecondary: string;
979
991
  brandPrimary300: string;
980
992
  elementsQuaternary: string;
@@ -1378,6 +1390,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1378
1390
  widthSmall: string;
1379
1391
  widthMedium: string;
1380
1392
  widthLarge: string;
1393
+ previewCardWidth: string;
1394
+ previewCardHeight: string;
1395
+ previewCardBorderRadius: string;
1381
1396
  containerSecondary: string;
1382
1397
  brandPrimary300: string;
1383
1398
  elementsQuaternary: string;
@@ -1651,6 +1666,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1651
1666
  widthSmall: string;
1652
1667
  widthMedium: string;
1653
1668
  widthLarge: string;
1669
+ previewCardWidth: string;
1670
+ previewCardHeight: string;
1671
+ previewCardBorderRadius: string;
1654
1672
  containerSecondary: string;
1655
1673
  brandPrimary300: string;
1656
1674
  elementsQuaternary: string;
@@ -1924,6 +1942,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1924
1942
  widthSmall: string;
1925
1943
  widthMedium: string;
1926
1944
  widthLarge: string;
1945
+ previewCardWidth: string;
1946
+ previewCardHeight: string;
1947
+ previewCardBorderRadius: string;
1927
1948
  containerSecondary: string;
1928
1949
  brandPrimary300: string;
1929
1950
  elementsQuaternary: string;