sprintify-ui 0.11.32 → 0.11.33

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.
@@ -122,7 +122,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
122
122
  toggle: boolean;
123
123
  toggleDefault: boolean;
124
124
  width: number;
125
- class?: string | string[] | undefined;
125
+ class?: (import("@/types").BaseTableColumnClassValue | ((row: Row) => import("@/types").BaseTableColumnClassValue)) | undefined;
126
126
  headerClass?: string | string[] | undefined;
127
127
  to?: ((row: Row) => RouteLocationRaw) | undefined;
128
128
  href?: ((row: Row) => string) | undefined;
@@ -1,5 +1,5 @@
1
1
  import { PropType } from 'vue';
2
- import { BaseTableColumnData, CollectionItem } from '..';
2
+ import { BaseTableColumnClassValue, BaseTableColumnData, CollectionItem } from '..';
3
3
  import { RouteLocationRaw } from 'vue-router';
4
4
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
5
  label: {
@@ -16,7 +16,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
16
16
  };
17
17
  class: {
18
18
  default: string;
19
- type: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
19
+ type: PropType<BaseTableColumnClassValue | ((row: CollectionItem) => BaseTableColumnClassValue)>;
20
20
  };
21
21
  headerClass: {
22
22
  default: string;
@@ -118,7 +118,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
118
118
  };
119
119
  class: {
120
120
  default: string;
121
- type: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
121
+ type: PropType<BaseTableColumnClassValue | ((row: CollectionItem) => BaseTableColumnClassValue)>;
122
122
  };
123
123
  headerClass: {
124
124
  default: string;
@@ -195,7 +195,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
195
195
  }>> & Readonly<{}>, {
196
196
  label: string;
197
197
  toggle: boolean;
198
- class: string | Record<string, any> | unknown[];
198
+ class: BaseTableColumnClassValue | ((row: CollectionItem) => BaseTableColumnClassValue);
199
199
  onClick: (row: CollectionItem, index: number, column: BaseTableColumnData, colIndex: number, event: MouseEvent) => void;
200
200
  href: (row: CollectionItem) => string;
201
201
  target: "_blank" | "_self" | "_parent" | "_top";
@@ -74,6 +74,7 @@ export interface ActionItem {
74
74
  actions?: ActionItem[];
75
75
  }
76
76
  export type Row = Record<string, any>;
77
+ export type BaseTableColumnClassValue = string | string[] | Record<string, any>;
77
78
  export interface BaseTableColumnData {
78
79
  id: string;
79
80
  label: string;
@@ -89,7 +90,7 @@ export interface BaseTableColumnData {
89
90
  toggle: boolean;
90
91
  toggleDefault: boolean;
91
92
  width: number;
92
- class?: string | string[];
93
+ class?: BaseTableColumnClassValue | ((row: Row) => BaseTableColumnClassValue);
93
94
  headerClass?: string | string[];
94
95
  to?: (row: Row) => RouteLocationRaw;
95
96
  href?: (row: Row) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.11.32",
3
+ "version": "0.11.33",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "generate-llm-txt": "node scripts/generate-llm-txt.js",
@@ -117,7 +117,7 @@
117
117
  <BaseTableCell
118
118
  v-for="(column, columnIndex) in visibleColumnsInternal"
119
119
  :key="column.newKey + index + ':' + columnIndex"
120
- :class="[column.class, column.numeric ? 'tabular-nums' : '']"
120
+ :class="[getColumnClass(row, column), column.numeric ? 'tabular-nums' : '']"
121
121
  :align="column.align"
122
122
  :style="column.style"
123
123
  :to="column.to ? column.to(row) : undefined"
@@ -729,6 +729,14 @@ function rowBindings(row: CollectionItem, index: number) {
729
729
  }
730
730
  }
731
731
 
732
+ function getColumnClass(row: CollectionItem, column: BaseTableColumnData): any {
733
+ if (typeof column.class === 'function') {
734
+ return column.class(row);
735
+ }
736
+
737
+ return column.class;
738
+ }
739
+
732
740
  function onCellClick(row: CollectionItem, index: number, column: BaseTableColumnData, columnIndex: number) {
733
741
  if (!column.onClick) {
734
742
  return undefined;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { defineComponent, h, PropType } from 'vue';
3
- import { BaseTableColumnData, CollectionItem } from '..';
3
+ import { BaseTableColumnClassValue, BaseTableColumnData, CollectionItem } from '..';
4
4
  import { RouteLocationRaw } from 'vue-router';
5
5
 
6
6
  export default defineComponent({
@@ -21,7 +21,7 @@ export default defineComponent({
21
21
  },
22
22
  class: {
23
23
  default: '',
24
- type: [String, Array, Object],
24
+ type: [String, Array, Object, Function] as PropType<BaseTableColumnClassValue | ((row: CollectionItem) => BaseTableColumnClassValue)>,
25
25
  },
26
26
  headerClass: {
27
27
  default: '',
@@ -99,6 +99,7 @@ export interface ActionItem {
99
99
 
100
100
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
101
101
  export type Row = Record<string, any>;
102
+ export type BaseTableColumnClassValue = string | string[] | Record<string, any>;
102
103
 
103
104
  export interface BaseTableColumnData {
104
105
  id: string;
@@ -116,7 +117,7 @@ export interface BaseTableColumnData {
116
117
  toggle: boolean;
117
118
  toggleDefault: boolean;
118
119
  width: number;
119
- class?: string | string[];
120
+ class?: BaseTableColumnClassValue | ((row: Row) => BaseTableColumnClassValue);
120
121
  headerClass?: string | string[];
121
122
  to?: (row: Row) => RouteLocationRaw;
122
123
  href?: (row: Row) => string;
@@ -305,4 +306,4 @@ export interface InputConfigProps {
305
306
 
306
307
  export type { GanttItem, GanttRow };
307
308
 
308
- export type { ToolbarOption };
309
+ export type { ToolbarOption };