sprintify-ui 0.11.32 → 0.11.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sprintify-ui.es.js +3617 -3614
- package/dist/types/components/BaseDataTableTemplate.vue.d.ts +1 -1
- package/dist/types/components/BaseGantt.vue.d.ts +15 -0
- package/dist/types/components/BaseTableColumn.vue.d.ts +4 -4
- package/dist/types/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/BaseDataTableTemplate.vue +9 -1
- package/src/components/BaseGantt.stories.js +1 -2
- package/src/components/BaseGantt.vue +39 -23
- package/src/components/BaseTableColumn.vue +2 -2
- package/src/services/gantt/format.ts +13 -2
- package/src/types/index.ts +3 -2
|
@@ -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?:
|
|
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;
|
|
@@ -25,6 +25,18 @@ interface Props {
|
|
|
25
25
|
* Flatten the Gantt chart by removing the hierarchy of rows and displaying all items in a single list. This is useful when there's only one level of rows and you want to maximize the vertical space.
|
|
26
26
|
*/
|
|
27
27
|
flatten?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Start with every row collapsed (items hidden) by default.
|
|
30
|
+
*/
|
|
31
|
+
rowsCollapsedByDefault?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Show row bar labels rendered outside the bar.
|
|
34
|
+
*/
|
|
35
|
+
showRowBarLabels?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Show item bar labels rendered outside the bar.
|
|
38
|
+
*/
|
|
39
|
+
showItemBarLabels?: boolean;
|
|
28
40
|
/**
|
|
29
41
|
* Relationships between items, drawn as arrows from one item to another.
|
|
30
42
|
*/
|
|
@@ -55,6 +67,9 @@ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {},
|
|
|
55
67
|
sidebarWidth: number;
|
|
56
68
|
rowHeight: number;
|
|
57
69
|
includeToday: boolean;
|
|
70
|
+
rowsCollapsedByDefault: boolean;
|
|
71
|
+
showRowBarLabels: boolean;
|
|
72
|
+
showItemBarLabels: boolean;
|
|
58
73
|
relationships: GanttRelationship[];
|
|
59
74
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
60
75
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -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:
|
|
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:
|
|
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:
|
|
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?:
|
|
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
|
@@ -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
|
|
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;
|
|
@@ -46,7 +46,6 @@ for (let i = 0; i < 10; i++) {
|
|
|
46
46
|
id: i + 1,
|
|
47
47
|
name: `Project sdf sdfg sdf gsdf gsdf gsdf g sdf sdf sdfg dsfg dsfg ${i + 1}`,
|
|
48
48
|
items: items,
|
|
49
|
-
height: 30,
|
|
50
49
|
});
|
|
51
50
|
}
|
|
52
51
|
|
|
@@ -55,7 +54,7 @@ export default {
|
|
|
55
54
|
component: BaseGantt,
|
|
56
55
|
args: {
|
|
57
56
|
rows,
|
|
58
|
-
maxHeight:
|
|
57
|
+
maxHeight: 400,
|
|
59
58
|
},
|
|
60
59
|
};
|
|
61
60
|
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
:row="row"
|
|
63
63
|
>
|
|
64
64
|
<div class="px-1 py-1 h-full flex items-center">
|
|
65
|
-
<p class="font-
|
|
65
|
+
<p class="font-medium leading-tight truncate text-[13px]">
|
|
66
66
|
{{ row.name }}
|
|
67
67
|
</p>
|
|
68
68
|
</div>
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
:item="item"
|
|
87
87
|
>
|
|
88
88
|
<div class="pr-1 pl-4 py-1 h-full flex items-center">
|
|
89
|
-
<p class="leading-tight truncate text-slate-600 text-
|
|
89
|
+
<p class="leading-tight truncate text-slate-600 text-[13px]">
|
|
90
90
|
{{ item.name }}
|
|
91
91
|
</p>
|
|
92
92
|
</div>
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
>
|
|
205
205
|
<button
|
|
206
206
|
type="button"
|
|
207
|
-
class="absolute flex"
|
|
207
|
+
class="absolute flex overflow-visible"
|
|
208
208
|
:style="{
|
|
209
209
|
transform: `translate(${row.x}px, ${row.y}px)`,
|
|
210
210
|
height: row.barHeight + 'px',
|
|
@@ -218,19 +218,19 @@
|
|
|
218
218
|
:row="row"
|
|
219
219
|
>
|
|
220
220
|
<div
|
|
221
|
-
|
|
222
|
-
backgroundColor: 'gray',
|
|
223
|
-
}"
|
|
224
|
-
class="flex w-full h-full items-center rounded hover:opacity-80 duration-200"
|
|
221
|
+
class="relative w-full h-full hover:opacity-80 duration-200 text-slate-500"
|
|
225
222
|
>
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
>
|
|
230
|
-
{{ row.name }}
|
|
231
|
-
</p>
|
|
223
|
+
<div class="absolute left-0 right-0 top-1/2 -translate-y-1/2 border-t-2 border-current" />
|
|
224
|
+
<div class="absolute left-0 top-1/2 -translate-y-1/2 h-3 border-l-2 border-current" />
|
|
225
|
+
<div class="absolute right-0 top-1/2 -translate-y-1/2 h-3 border-r-2 border-current" />
|
|
232
226
|
</div>
|
|
233
227
|
</slot>
|
|
228
|
+
<p
|
|
229
|
+
v-if="props.showRowBarLabels"
|
|
230
|
+
class="absolute left-full ml-2 top-1/2 -translate-y-1/2 text-[13px] leading-tight font-semibold text-slate-900 whitespace-nowrap max-w-[320px] truncate"
|
|
231
|
+
>
|
|
232
|
+
{{ row.name }}
|
|
233
|
+
</p>
|
|
234
234
|
</button>
|
|
235
235
|
</div>
|
|
236
236
|
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
>
|
|
246
246
|
<button
|
|
247
247
|
type="button"
|
|
248
|
-
class="absolute flex"
|
|
248
|
+
class="absolute flex overflow-visible"
|
|
249
249
|
:style="{
|
|
250
250
|
transform: `translate(${item.x}px, ${item.y}px)`,
|
|
251
251
|
height: item.barHeight + 'px',
|
|
@@ -263,15 +263,14 @@
|
|
|
263
263
|
backgroundColor: item.color,
|
|
264
264
|
}"
|
|
265
265
|
class="flex w-full h-full items-center rounded hover:opacity-80 duration-200"
|
|
266
|
-
|
|
267
|
-
<p
|
|
268
|
-
class="text-white text-xs px-2 py-1 truncate"
|
|
269
|
-
style="text-shadow: 0.5px 0.5px rgba(0,0,0,0.1);"
|
|
270
|
-
>
|
|
271
|
-
{{ item.name }}
|
|
272
|
-
</p>
|
|
273
|
-
</div>
|
|
266
|
+
/>
|
|
274
267
|
</slot>
|
|
268
|
+
<p
|
|
269
|
+
v-if="props.showItemBarLabels"
|
|
270
|
+
class="absolute left-full ml-2 top-1/2 -translate-y-1/2 text-[13px] leading-tight text-slate-700 whitespace-nowrap max-w-[320px] truncate"
|
|
271
|
+
>
|
|
272
|
+
{{ item.name }}
|
|
273
|
+
</p>
|
|
275
274
|
</button>
|
|
276
275
|
</div>
|
|
277
276
|
</div>
|
|
@@ -427,6 +426,18 @@ interface Props {
|
|
|
427
426
|
* Flatten the Gantt chart by removing the hierarchy of rows and displaying all items in a single list. This is useful when there's only one level of rows and you want to maximize the vertical space.
|
|
428
427
|
*/
|
|
429
428
|
flatten?: boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Start with every row collapsed (items hidden) by default.
|
|
431
|
+
*/
|
|
432
|
+
rowsCollapsedByDefault?: boolean;
|
|
433
|
+
/**
|
|
434
|
+
* Show row bar labels rendered outside the bar.
|
|
435
|
+
*/
|
|
436
|
+
showRowBarLabels?: boolean;
|
|
437
|
+
/**
|
|
438
|
+
* Show item bar labels rendered outside the bar.
|
|
439
|
+
*/
|
|
440
|
+
showItemBarLabels?: boolean;
|
|
430
441
|
/**
|
|
431
442
|
* Relationships between items, drawn as arrows from one item to another.
|
|
432
443
|
*/
|
|
@@ -438,6 +449,9 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
438
449
|
rowHeight: 40,
|
|
439
450
|
maxHeight: undefined,
|
|
440
451
|
includeToday: true,
|
|
452
|
+
rowsCollapsedByDefault: false,
|
|
453
|
+
showRowBarLabels: true,
|
|
454
|
+
showItemBarLabels: true,
|
|
441
455
|
relationships: () => [],
|
|
442
456
|
});
|
|
443
457
|
|
|
@@ -494,7 +508,9 @@ function init() {
|
|
|
494
508
|
|
|
495
509
|
nowLine.value = format.nowLine;
|
|
496
510
|
|
|
497
|
-
expandedRows.value =
|
|
511
|
+
expandedRows.value = props.rowsCollapsedByDefault
|
|
512
|
+
? new Set<string | number>()
|
|
513
|
+
: new Set(props.rows.map((r) => r.id));
|
|
498
514
|
|
|
499
515
|
// Scroll to now line
|
|
500
516
|
|
|
@@ -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: '',
|
|
@@ -4,6 +4,7 @@ import { Timescale } from "./timescale";
|
|
|
4
4
|
import { sum } from "lodash";
|
|
5
5
|
|
|
6
6
|
const PADDING_Y_ROW = 4;
|
|
7
|
+
const ITEM_LABEL_TIMELINE_PADDING_X = 800;
|
|
7
8
|
|
|
8
9
|
export class Format {
|
|
9
10
|
|
|
@@ -23,8 +24,18 @@ export class Format {
|
|
|
23
24
|
// Get min and max
|
|
24
25
|
let { min, max } = this.getMinMax(rowsFormatted);
|
|
25
26
|
|
|
26
|
-
// Get timescale
|
|
27
|
-
const
|
|
27
|
+
// Get baseline timescale before expanding the visible range for outside item labels.
|
|
28
|
+
const baselineTimescale = (new Timescale(this.config.minWidth, min, max)).handle();
|
|
29
|
+
|
|
30
|
+
const timelinePaddingMilliseconds = baselineTimescale.millisecondToPixel > 0
|
|
31
|
+
? ITEM_LABEL_TIMELINE_PADDING_X / baselineTimescale.millisecondToPixel
|
|
32
|
+
: 0;
|
|
33
|
+
|
|
34
|
+
const paddedMin = baselineTimescale.min.minus({ milliseconds: timelinePaddingMilliseconds });
|
|
35
|
+
const paddedMax = baselineTimescale.max.plus({ milliseconds: timelinePaddingMilliseconds });
|
|
36
|
+
|
|
37
|
+
// Rebuild timescale with left/right timeline padding so labels can render outside bars by default.
|
|
38
|
+
const timescale = (new Timescale(this.config.minWidth, paddedMin, paddedMax)).handle();
|
|
28
39
|
|
|
29
40
|
// Padded min and max
|
|
30
41
|
min = timescale.min;
|
package/src/types/index.ts
CHANGED
|
@@ -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?:
|
|
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 };
|