@operato/gantt 2.0.0-beta.0 → 2.0.0-beta.1
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/CHANGELOG.md +10 -0
- package/dist/src/locale.d.ts +1 -0
- package/dist/src/locale.js +49 -0
- package/dist/src/locale.js.map +1 -0
- package/dist/src/ox-gantt-chart.d.ts +39 -0
- package/dist/src/ox-gantt-chart.js +707 -0
- package/dist/src/ox-gantt-chart.js.map +1 -0
- package/dist/src/ox-gantt-resize-splitter.d.ts +13 -0
- package/dist/src/ox-gantt-resize-splitter.js +117 -0
- package/dist/src/ox-gantt-resize-splitter.js.map +1 -0
- package/dist/src/ox-gantt.d.ts +24 -0
- package/dist/src/ox-gantt.js +186 -0
- package/dist/src/ox-gantt.js.map +1 -0
- package/dist/src/types.d.ts +10 -5
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils.d.ts +3 -0
- package/dist/src/utils.js +10 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/stories/ox-gantt-chart.stories.d.ts +41 -0
- package/dist/stories/{ox-lite-gantt.stories.js → ox-gantt-chart.stories.js} +53 -21
- package/dist/stories/ox-gantt-chart.stories.js.map +1 -0
- package/dist/stories/ox-gantt.stories.d.ts +6 -1
- package/dist/stories/ox-gantt.stories.js +286 -15
- package/dist/stories/ox-gantt.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -4
- package/src/locale.ts +51 -0
- package/src/ox-gantt-chart.ts +773 -0
- package/src/ox-gantt-resize-splitter.ts +137 -0
- package/src/ox-gantt.ts +177 -0
- package/src/types.ts +12 -6
- package/src/utils.ts +13 -0
- package/stories/{ox-lite-gantt.stories.ts → ox-gantt-chart.stories.ts} +65 -22
- package/stories/ox-gantt.stories.ts +289 -16
- package/themes/dark-hc.css +151 -0
- package/themes/dark-mc.css +151 -0
- package/themes/dark.css +151 -0
- package/themes/grist-theme.css +169 -0
- package/themes/light-hc.css +151 -0
- package/themes/light-mc.css +151 -0
- package/themes/light.css +151 -0
- package/themes/md-typescale-styles.css +100 -0
- package/themes/spacing.css +43 -0
- package/themes/state-color.css +6 -0
- package/dist/src/gantt.d.ts +0 -28
- package/dist/src/gantt.js +0 -178
- package/dist/src/gantt.js.map +0 -1
- package/dist/src/lite-gantt.d.ts +0 -27
- package/dist/src/lite-gantt.js +0 -146
- package/dist/src/lite-gantt.js.map +0 -1
- package/dist/stories/ox-lite-gantt.stories.d.ts +0 -22
- package/dist/stories/ox-lite-gantt.stories.js.map +0 -1
- package/src/gantt.ts +0 -191
- package/src/lite-gantt.ts +0 -152
- package/src/renderer.txt +0 -775
package/themes/light.css
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
.light {
|
|
2
|
+
--md-sys-color-primary: rgb(73 93 146);
|
|
3
|
+
--md-sys-color-surface-tint: rgb(73 93 146);
|
|
4
|
+
--md-sys-color-on-primary: rgb(255 255 255);
|
|
5
|
+
--md-sys-color-primary-container: #e4eaf9;
|
|
6
|
+
--md-sys-color-on-primary-container: rgb(0 24 72);
|
|
7
|
+
--md-sys-color-secondary: rgb(27 101 133);
|
|
8
|
+
--md-sys-color-on-secondary: rgb(255 255 255);
|
|
9
|
+
--md-sys-color-secondary-container: rgb(195 232 255);
|
|
10
|
+
--md-sys-color-on-secondary-container: rgb(0 30 44);
|
|
11
|
+
--md-sys-color-tertiary: rgb(37 106 75);
|
|
12
|
+
--md-sys-color-on-tertiary: rgb(255 255 255);
|
|
13
|
+
--md-sys-color-tertiary-container: rgb(171 242 201);
|
|
14
|
+
--md-sys-color-on-tertiary-container: rgb(0 33 19);
|
|
15
|
+
--md-sys-color-error: #fe594e;
|
|
16
|
+
--md-sys-color-on-error: rgb(255 255 255);
|
|
17
|
+
--md-sys-color-error-container: rgb(255 218 215);
|
|
18
|
+
--md-sys-color-on-error-container: #fe594e;
|
|
19
|
+
--md-sys-color-background: rgb(250 248 255);
|
|
20
|
+
--md-sys-color-on-background: rgb(26 27 33);
|
|
21
|
+
--md-sys-color-surface: rgb(250 248 255);
|
|
22
|
+
--md-sys-color-on-surface: rgb(26 27 33);
|
|
23
|
+
--md-sys-color-surface-variant: rgb(225 226 236);
|
|
24
|
+
--md-sys-color-on-surface-variant: rgb(69 70 79);
|
|
25
|
+
--md-sys-color-outline: rgba(0,0,0,.25);
|
|
26
|
+
--md-sys-color-outline-variant: rgb(197 198 208);
|
|
27
|
+
--md-sys-color-shadow: rgb(0 0 0);
|
|
28
|
+
--md-sys-color-scrim: rgb(0 0 0);
|
|
29
|
+
--md-sys-color-inverse-surface: rgb(47 48 54);
|
|
30
|
+
--md-sys-color-inverse-on-surface: rgb(241 240 247);
|
|
31
|
+
--md-sys-color-inverse-primary: #c9d4f4;
|
|
32
|
+
--md-sys-color-primary-fixed: rgb(218 226 255);
|
|
33
|
+
--md-sys-color-on-primary-fixed: rgb(0 24 72);
|
|
34
|
+
--md-sys-color-primary-fixed-dim: #c9d4f4;
|
|
35
|
+
--md-sys-color-on-primary-fixed-variant: rgb(49 69 120);
|
|
36
|
+
--md-sys-color-secondary-fixed: rgb(195 232 255);
|
|
37
|
+
--md-sys-color-on-secondary-fixed: rgb(0 30 44);
|
|
38
|
+
--md-sys-color-secondary-fixed-dim: rgb(143 207 243);
|
|
39
|
+
--md-sys-color-on-secondary-fixed-variant: rgb(0 76 104);
|
|
40
|
+
--md-sys-color-tertiary-fixed: #9ee4bd;
|
|
41
|
+
--md-sys-color-on-tertiary-fixed: #005234;
|
|
42
|
+
--md-sys-color-tertiary-fixed-dim: #9ee4bd;
|
|
43
|
+
--md-sys-color-on-tertiary-fixed-variant: #005234;
|
|
44
|
+
--md-sys-color-surface-dim: rgb(218 217 224);
|
|
45
|
+
--md-sys-color-surface-bright: rgb(250 248 255);
|
|
46
|
+
--md-sys-color-surface-container-lowest: rgb(255 255 255);
|
|
47
|
+
--md-sys-color-surface-container-low: rgb(244 243 250);
|
|
48
|
+
--md-sys-color-surface-container: rgb(238 237 244);
|
|
49
|
+
--md-sys-color-surface-container-high: rgb(232 231 239);
|
|
50
|
+
--md-sys-color-surface-container-highest: rgb(227 226 233);
|
|
51
|
+
|
|
52
|
+
/* primary palette */
|
|
53
|
+
--md-ref-palette-primary0:#000000;
|
|
54
|
+
--md-ref-palette-primary5:#000E32;
|
|
55
|
+
--md-ref-palette-primary10:#001848;
|
|
56
|
+
--md-ref-palette-primary15:#00215E;
|
|
57
|
+
--md-ref-palette-primary20:#002B74;
|
|
58
|
+
--md-ref-palette-primary25:#002B74;
|
|
59
|
+
--md-ref-palette-primary30:#0040A2;
|
|
60
|
+
--md-ref-palette-primary35:#002B74;
|
|
61
|
+
--md-ref-palette-primary40:#1957CA;
|
|
62
|
+
--md-ref-palette-primary50:#3E71E5;
|
|
63
|
+
--md-ref-palette-primary60:#5C8BFF;
|
|
64
|
+
--md-ref-palette-primary70:#89A9FF;
|
|
65
|
+
--md-ref-palette-primary80:#B2C5FF;
|
|
66
|
+
--md-ref-palette-primary90:#DAE2FF;
|
|
67
|
+
--md-ref-palette-primary95:#EEF0FF;
|
|
68
|
+
--md-ref-palette-primary98:#FAF8FF;
|
|
69
|
+
--md-ref-palette-primary99:#FEFBFF;
|
|
70
|
+
--md-ref-palette-primary100:#FFFFFF;
|
|
71
|
+
|
|
72
|
+
/* secondary palette */
|
|
73
|
+
--md-ref-palette-secondary0:#000000;
|
|
74
|
+
--md-ref-palette-secondary5:#00131D;
|
|
75
|
+
--md-ref-palette-secondary10:#001E2C;
|
|
76
|
+
--md-ref-palette-secondary15:#00293A;
|
|
77
|
+
--md-ref-palette-secondary20:#003549;
|
|
78
|
+
--md-ref-palette-secondary25:#004058;
|
|
79
|
+
--md-ref-palette-secondary30:#004C68;
|
|
80
|
+
--md-ref-palette-secondary35:#005978;
|
|
81
|
+
--md-ref-palette-secondary40:#006689;
|
|
82
|
+
--md-ref-palette-secondary50:#0080AC;
|
|
83
|
+
--md-ref-palette-secondary60:#009BCF;
|
|
84
|
+
--md-ref-palette-secondary70:#00B8F4;
|
|
85
|
+
--md-ref-palette-secondary80:#79D1FF;
|
|
86
|
+
--md-ref-palette-secondary90:#C3E8FF;
|
|
87
|
+
--md-ref-palette-secondary95:#E3F3FF;
|
|
88
|
+
--md-ref-palette-secondary98:#F5FAFF;
|
|
89
|
+
--md-ref-palette-secondary99:#FBFCFF;
|
|
90
|
+
--md-ref-palette-secondary100:#FFFFFF;
|
|
91
|
+
|
|
92
|
+
/* tertiary palette */
|
|
93
|
+
--md-ref-palette-tertiary0:#000000;
|
|
94
|
+
--md-ref-palette-tertiary5:#00150A;
|
|
95
|
+
--md-ref-palette-tertiary10:#002113;
|
|
96
|
+
--md-ref-palette-tertiary15:#002C1B;
|
|
97
|
+
--md-ref-palette-tertiary20:#003823;
|
|
98
|
+
--md-ref-palette-tertiary25:#00452B;
|
|
99
|
+
--md-ref-palette-tertiary30:#005234;
|
|
100
|
+
--md-ref-palette-tertiary35:#005F3E;
|
|
101
|
+
--md-ref-palette-tertiary40:#006C47;
|
|
102
|
+
--md-ref-palette-tertiary50:#00885A;
|
|
103
|
+
--md-ref-palette-tertiary60:#31A372;
|
|
104
|
+
--md-ref-palette-tertiary70:#51BF8B;
|
|
105
|
+
--md-ref-palette-tertiary80:#6EDBA5;
|
|
106
|
+
--md-ref-palette-tertiary90:#A2F4C7;
|
|
107
|
+
--md-ref-palette-tertiary95:#BFFFD9;
|
|
108
|
+
--md-ref-palette-tertiary98:#E8FFEF;
|
|
109
|
+
--md-ref-palette-tertiary99:#F4FFF5;
|
|
110
|
+
--md-ref-palette-tertiary100:#FFFFFF;
|
|
111
|
+
|
|
112
|
+
/* error palette */
|
|
113
|
+
--md-ref-palette-error0:#000000;
|
|
114
|
+
--md-ref-palette-error5:#2d0102;
|
|
115
|
+
--md-ref-palette-error10:#410304;
|
|
116
|
+
--md-ref-palette-error15:#540507;
|
|
117
|
+
--md-ref-palette-error20:#68070a;
|
|
118
|
+
--md-ref-palette-error25:#7d0b0e;
|
|
119
|
+
--md-ref-palette-error30:#930f14;
|
|
120
|
+
--md-ref-palette-error35:#a91319;
|
|
121
|
+
--md-ref-palette-error40:#bc1620;
|
|
122
|
+
--md-ref-palette-error50:#e03236;
|
|
123
|
+
--md-ref-palette-error60:#ff5450;
|
|
124
|
+
--md-ref-palette-error70:#ff8982;
|
|
125
|
+
--md-ref-palette-error80:#ffb3ad;
|
|
126
|
+
--md-ref-palette-error90:#ffdad7;
|
|
127
|
+
--md-ref-palette-error95:#ffedeb;
|
|
128
|
+
--md-ref-palette-error98:#fff8f7;
|
|
129
|
+
--md-ref-palette-error99:#fffbff;
|
|
130
|
+
--md-ref-palette-error100:#FFFFFF;
|
|
131
|
+
|
|
132
|
+
/* neutral palette */
|
|
133
|
+
--md-ref-palette-neutral0:#000000;
|
|
134
|
+
--md-ref-palette-neutral5:#111111;
|
|
135
|
+
--md-ref-palette-neutral10:#1C1C1C;
|
|
136
|
+
--md-ref-palette-neutral15:#262626;
|
|
137
|
+
--md-ref-palette-neutral20:#313131;
|
|
138
|
+
--md-ref-palette-neutral25:#3C3C3C;
|
|
139
|
+
--md-ref-palette-neutral30:#474747;
|
|
140
|
+
--md-ref-palette-neutral35:#535353;
|
|
141
|
+
--md-ref-palette-neutral40:#5F5F5F;
|
|
142
|
+
--md-ref-palette-neutral50:#787878;
|
|
143
|
+
--md-ref-palette-neutral60:#929292;
|
|
144
|
+
--md-ref-palette-neutral70:#ACACAC;
|
|
145
|
+
--md-ref-palette-neutral80:#C8C8C8;
|
|
146
|
+
--md-ref-palette-neutral90:#E4E4E4;
|
|
147
|
+
--md-ref-palette-neutral95:#F0F0F0;
|
|
148
|
+
--md-ref-palette-neutral98:#F9F9F9;
|
|
149
|
+
--md-ref-palette-neutral99:#FEFEFE;
|
|
150
|
+
--md-ref-palette-neutral100:#FFFFFF;
|
|
151
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
@layer {
|
|
2
|
+
.md-typescale-display-small,
|
|
3
|
+
.md-typescale-display-small-prominent {
|
|
4
|
+
font: var(--md-sys-typescale-display-small-weight, var(--md-ref-typeface-weight-regular, 400))
|
|
5
|
+
var(--md-sys-typescale-display-small-size, 2.25rem) / var(--md-sys-typescale-display-small-line-height, 2.75rem)
|
|
6
|
+
var(--md-sys-typescale-display-small-font, var(--md-ref-typeface-brand, 'Roboto'));
|
|
7
|
+
}
|
|
8
|
+
.md-typescale-display-medium,
|
|
9
|
+
.md-typescale-display-medium-prominent {
|
|
10
|
+
font: var(--md-sys-typescale-display-medium-weight, var(--md-ref-typeface-weight-regular, 400))
|
|
11
|
+
var(--md-sys-typescale-display-medium-size, 2.8125rem) /
|
|
12
|
+
var(--md-sys-typescale-display-medium-line-height, 3.25rem)
|
|
13
|
+
var(--md-sys-typescale-display-medium-font, var(--md-ref-typeface-brand, 'Roboto'));
|
|
14
|
+
}
|
|
15
|
+
.md-typescale-display-large,
|
|
16
|
+
.md-typescale-display-large-prominent {
|
|
17
|
+
font: var(--md-sys-typescale-display-large-weight, var(--md-ref-typeface-weight-regular, 400))
|
|
18
|
+
var(--md-sys-typescale-display-large-size, 3.5625rem) / var(--md-sys-typescale-display-large-line-height, 4rem)
|
|
19
|
+
var(--md-sys-typescale-display-large-font, var(--md-ref-typeface-brand, 'Roboto'));
|
|
20
|
+
}
|
|
21
|
+
.md-typescale-headline-small,
|
|
22
|
+
.md-typescale-headline-small-prominent {
|
|
23
|
+
font: var(--md-sys-typescale-headline-small-weight, var(--md-ref-typeface-weight-regular, 400))
|
|
24
|
+
var(--md-sys-typescale-headline-small-size, 1.5rem) / var(--md-sys-typescale-headline-small-line-height, 2rem)
|
|
25
|
+
var(--md-sys-typescale-headline-small-font, var(--md-ref-typeface-brand, 'Roboto'));
|
|
26
|
+
}
|
|
27
|
+
.md-typescale-headline-medium,
|
|
28
|
+
.md-typescale-headline-medium-prominent {
|
|
29
|
+
font: var(--md-sys-typescale-headline-medium-weight, var(--md-ref-typeface-weight-regular, 400))
|
|
30
|
+
var(--md-sys-typescale-headline-medium-size, 1.75rem) /
|
|
31
|
+
var(--md-sys-typescale-headline-medium-line-height, 2.25rem)
|
|
32
|
+
var(--md-sys-typescale-headline-medium-font, var(--md-ref-typeface-brand, 'Roboto'));
|
|
33
|
+
}
|
|
34
|
+
.md-typescale-headline-large,
|
|
35
|
+
.md-typescale-headline-large-prominent {
|
|
36
|
+
font: var(--md-sys-typescale-headline-large-weight, var(--md-ref-typeface-weight-regular, 400))
|
|
37
|
+
var(--md-sys-typescale-headline-large-size, 2rem) / var(--md-sys-typescale-headline-large-line-height, 2.5rem)
|
|
38
|
+
var(--md-sys-typescale-headline-large-font, var(--md-ref-typeface-brand, 'Roboto'));
|
|
39
|
+
}
|
|
40
|
+
.md-typescale-title-small,
|
|
41
|
+
.md-typescale-title-small-prominent {
|
|
42
|
+
font: var(--md-sys-typescale-title-small-weight, var(--md-ref-typeface-weight-medium, 500))
|
|
43
|
+
var(--md-sys-typescale-title-small-size, 0.875rem) / var(--md-sys-typescale-title-small-line-height, 1.25rem)
|
|
44
|
+
var(--md-sys-typescale-title-small-font, var(--md-ref-typeface-plain, 'Roboto'));
|
|
45
|
+
}
|
|
46
|
+
.md-typescale-title-medium,
|
|
47
|
+
.md-typescale-title-medium-prominent {
|
|
48
|
+
font: var(--md-sys-typescale-title-medium-weight, var(--md-ref-typeface-weight-medium, 500))
|
|
49
|
+
var(--md-sys-typescale-title-medium-size, 1rem) / var(--md-sys-typescale-title-medium-line-height, 1.5rem)
|
|
50
|
+
var(--md-sys-typescale-title-medium-font, var(--md-ref-typeface-plain, 'Roboto'));
|
|
51
|
+
}
|
|
52
|
+
.md-typescale-title-large,
|
|
53
|
+
.md-typescale-title-large-prominent {
|
|
54
|
+
font: var(--md-sys-typescale-title-large-weight, var(--md-ref-typeface-weight-regular, 400))
|
|
55
|
+
var(--md-sys-typescale-title-large-size, 1.375rem) / var(--md-sys-typescale-title-large-line-height, 1.75rem)
|
|
56
|
+
var(--md-sys-typescale-title-large-font, var(--md-ref-typeface-brand, 'Roboto'));
|
|
57
|
+
}
|
|
58
|
+
.md-typescale-body-small,
|
|
59
|
+
.md-typescale-body-small-prominent {
|
|
60
|
+
font: var(--md-sys-typescale-body-small-weight, var(--md-ref-typeface-weight-regular, 400))
|
|
61
|
+
var(--md-sys-typescale-body-small-size, 0.75rem) / var(--md-sys-typescale-body-small-line-height, 1rem)
|
|
62
|
+
var(--md-sys-typescale-body-small-font, var(--md-ref-typeface-plain, 'Roboto'));
|
|
63
|
+
}
|
|
64
|
+
.md-typescale-body-medium,
|
|
65
|
+
.md-typescale-body-medium-prominent {
|
|
66
|
+
font: var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400))
|
|
67
|
+
var(--md-sys-typescale-body-medium-size, 0.875rem) / var(--md-sys-typescale-body-medium-line-height, 1.25rem)
|
|
68
|
+
var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, 'Roboto'));
|
|
69
|
+
}
|
|
70
|
+
.md-typescale-body-large,
|
|
71
|
+
.md-typescale-body-large-prominent {
|
|
72
|
+
font: var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400))
|
|
73
|
+
var(--md-sys-typescale-body-large-size, 1rem) / var(--md-sys-typescale-body-large-line-height, 1.5rem)
|
|
74
|
+
var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, 'Roboto'));
|
|
75
|
+
}
|
|
76
|
+
.md-typescale-label-small,
|
|
77
|
+
.md-typescale-label-small-prominent {
|
|
78
|
+
font: var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500))
|
|
79
|
+
var(--md-sys-typescale-label-small-size, 0.6875rem) / var(--md-sys-typescale-label-small-line-height, 1rem)
|
|
80
|
+
var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, 'Roboto'));
|
|
81
|
+
}
|
|
82
|
+
.md-typescale-label-medium,
|
|
83
|
+
.md-typescale-label-medium-prominent {
|
|
84
|
+
font: var(--md-sys-typescale-label-medium-weight, var(--md-ref-typeface-weight-medium, 500))
|
|
85
|
+
var(--md-sys-typescale-label-medium-size, 0.75rem) / var(--md-sys-typescale-label-medium-line-height, 1rem)
|
|
86
|
+
var(--md-sys-typescale-label-medium-font, var(--md-ref-typeface-plain, 'Roboto'));
|
|
87
|
+
}
|
|
88
|
+
.md-typescale-label-medium-prominent {
|
|
89
|
+
font-weight: var(--md-sys-typescale-label-medium-weight-prominent, var(--md-ref-typeface-weight-bold, 700));
|
|
90
|
+
}
|
|
91
|
+
.md-typescale-label-large,
|
|
92
|
+
.md-typescale-label-large-prominent {
|
|
93
|
+
font: var(--md-sys-typescale-label-large-weight, var(--md-ref-typeface-weight-medium, 500))
|
|
94
|
+
var(--md-sys-typescale-label-large-size, 0.875rem) / var(--md-sys-typescale-label-large-line-height, 1.25rem)
|
|
95
|
+
var(--md-sys-typescale-label-large-font, var(--md-ref-typeface-plain, 'Roboto'));
|
|
96
|
+
}
|
|
97
|
+
.md-typescale-label-large-prominent {
|
|
98
|
+
font-weight: var(--md-sys-typescale-label-large-weight-prominent, var(--md-ref-typeface-weight-bold, 700));
|
|
99
|
+
}
|
|
100
|
+
} /*# sourceMappingURL=md-typescale-styles.css.map */
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--spacing-none: 0px;
|
|
3
|
+
--spacing-tiny: 2px;
|
|
4
|
+
--spacing-small: 4px;
|
|
5
|
+
--spacing-medium: 8px;
|
|
6
|
+
--spacing-large: 12px;
|
|
7
|
+
--spacing-huge: 24px;
|
|
8
|
+
|
|
9
|
+
--icon-size-tiny: 14px;
|
|
10
|
+
--icon-size-small: 18px;
|
|
11
|
+
--icon-size-medium: 24px;
|
|
12
|
+
--icon-size-large: 32px;
|
|
13
|
+
--icon-size-huge: 48px;
|
|
14
|
+
|
|
15
|
+
/* form element height */
|
|
16
|
+
--form-element-height-tiny:18px;
|
|
17
|
+
--form-element-height-small:24px;
|
|
18
|
+
--form-element-height-medium:30px;
|
|
19
|
+
--form-element-height-large:40px;
|
|
20
|
+
--form-element-height-huge:55px;
|
|
21
|
+
|
|
22
|
+
/* shape corner */
|
|
23
|
+
--md-sys-shape-corner-none:0px;
|
|
24
|
+
--md-sys-shape-corner-small:5px;
|
|
25
|
+
--md-sys-shape-corner-medium:10px;
|
|
26
|
+
--md-sys-shape-corner-large:30px;
|
|
27
|
+
--md-sys-shape-corner-full:999px;
|
|
28
|
+
|
|
29
|
+
/* typescale corner */
|
|
30
|
+
--md-sys-typescale-label-tiny-size:11px;
|
|
31
|
+
--md-sys-typescale-label-small-size:13px;
|
|
32
|
+
--md-sys-typescale-label-medium-size:14px;
|
|
33
|
+
--md-sys-typescale-label-large-size:18px;
|
|
34
|
+
--md-sys-typescale-label-huge-size:24px;
|
|
35
|
+
|
|
36
|
+
--md-sys-typescale-label-medium-line-height:1;
|
|
37
|
+
|
|
38
|
+
--md-sys-typescale-label-tiny-weight:200;
|
|
39
|
+
--md-sys-typescale-label-small-weight:300;
|
|
40
|
+
--md-sys-typescale-label-medium-weight:500;
|
|
41
|
+
--md-sys-typescale-label-large-weight:700;
|
|
42
|
+
--md-sys-typescale-label-full-weight:900;
|
|
43
|
+
}
|
package/dist/src/gantt.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import * as d3 from 'd3';
|
|
3
|
-
export declare class OxGanttChart extends LitElement {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
plots: Array<any>;
|
|
7
|
-
precision?: number;
|
|
8
|
-
tooltip: HTMLDivElement;
|
|
9
|
-
chart: SVGSVGElement;
|
|
10
|
-
protected svg?: d3.Selection<SVGGElement, unknown, null, undefined>;
|
|
11
|
-
private resizeObserver?;
|
|
12
|
-
static styles: import("lit").CSSResult[];
|
|
13
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
-
connectedCallback(): void;
|
|
15
|
-
disconnectedCallback(): void;
|
|
16
|
-
protected initializeResizeObserver(): void;
|
|
17
|
-
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
18
|
-
protected initializeChart(): void;
|
|
19
|
-
protected drawChart(): void;
|
|
20
|
-
private addMouseHandlers;
|
|
21
|
-
protected onMouseOver(event: MouseEvent): void;
|
|
22
|
-
protected onMouseMove(event: MouseEvent): void;
|
|
23
|
-
protected onMouseOut(event: MouseEvent): void;
|
|
24
|
-
protected tooltipContent(data: any): string;
|
|
25
|
-
protected showTooltip(content: string, x: number, y: number): void;
|
|
26
|
-
protected hideTooltip(): void;
|
|
27
|
-
protected plotData(): void;
|
|
28
|
-
}
|
package/dist/src/gantt.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { LitElement, css, html } from 'lit';
|
|
3
|
-
import { customElement, property, query } from 'lit/decorators.js';
|
|
4
|
-
import * as d3 from 'd3';
|
|
5
|
-
let OxGanttChart = class OxGanttChart extends LitElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.width = 0;
|
|
9
|
-
this.height = 0;
|
|
10
|
-
this.plots = [];
|
|
11
|
-
this.precision = 2;
|
|
12
|
-
}
|
|
13
|
-
static { this.styles = [
|
|
14
|
-
css `
|
|
15
|
-
:host {
|
|
16
|
-
display: flex;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
svg {
|
|
20
|
-
flex: 1;
|
|
21
|
-
margin: 0;
|
|
22
|
-
padding: 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
#tooltip {
|
|
26
|
-
position: absolute;
|
|
27
|
-
opacity: 0;
|
|
28
|
-
background-color: var(--gantt-chart-tooltip-background-color, white);
|
|
29
|
-
padding: var(--gantt-chart-tooltip-padding, 5px);
|
|
30
|
-
border: var(--gantt-chart-tooltip-border, 1px solid black);
|
|
31
|
-
border-radius: var(--gantt-chart-tooltip-border-radius, 5px);
|
|
32
|
-
box-shadow: var(--gantt-chart-tooltip-box-shadow, 2px 2px 5px rgba(0, 0, 0, 0.3));
|
|
33
|
-
pointer-events: var(--gantt-chart-tooltip-pointer-events, none);
|
|
34
|
-
font-size: var(--gantt-chart-tooltip-font-size, 12px);
|
|
35
|
-
font-family: var(--gantt-chart-tooltip-font-family, Arial, sans-serif);
|
|
36
|
-
transition: opacity 0.3s ease-in-out;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.data-point {
|
|
40
|
-
stroke: var(--gantt-chart-plot-stroke, black);
|
|
41
|
-
stroke-width: var(--gantt-chart-plot-stroke-width, 1px);
|
|
42
|
-
r: var(--gantt-chart-plot-r, 4);
|
|
43
|
-
}
|
|
44
|
-
`
|
|
45
|
-
]; }
|
|
46
|
-
render() {
|
|
47
|
-
return html `
|
|
48
|
-
<svg id="chart"></svg>
|
|
49
|
-
<div id="tooltip"></div>
|
|
50
|
-
`;
|
|
51
|
-
}
|
|
52
|
-
connectedCallback() {
|
|
53
|
-
super.connectedCallback();
|
|
54
|
-
this.initializeResizeObserver();
|
|
55
|
-
}
|
|
56
|
-
disconnectedCallback() {
|
|
57
|
-
if (this.resizeObserver) {
|
|
58
|
-
this.resizeObserver.disconnect();
|
|
59
|
-
}
|
|
60
|
-
super.disconnectedCallback();
|
|
61
|
-
}
|
|
62
|
-
initializeResizeObserver() {
|
|
63
|
-
this.resizeObserver = new ResizeObserver(entries => {
|
|
64
|
-
for (const entry of entries) {
|
|
65
|
-
this.initializeChart();
|
|
66
|
-
this.drawChart();
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
this.resizeObserver.observe(this);
|
|
70
|
-
}
|
|
71
|
-
updated(changedProperties) {
|
|
72
|
-
super.updated(changedProperties);
|
|
73
|
-
if (changedProperties.has('plots') && this.plots.length > 0) {
|
|
74
|
-
this.initializeChart();
|
|
75
|
-
this.drawChart();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
initializeChart() {
|
|
79
|
-
const chart = this.chart;
|
|
80
|
-
d3.select(chart).selectAll('g').remove();
|
|
81
|
-
this.svg = d3.select(chart).append('g');
|
|
82
|
-
this.addMouseHandlers();
|
|
83
|
-
}
|
|
84
|
-
drawChart() {
|
|
85
|
-
const tasks = [
|
|
86
|
-
{ task: 'Task 1', startDate: new Date('2024-02-01'), endDate: new Date('2024-02-07') },
|
|
87
|
-
{ task: 'Task 2', startDate: new Date('2024-02-05'), endDate: new Date('2024-02-15') },
|
|
88
|
-
{ task: 'Task 3', startDate: new Date('2024-02-10'), endDate: new Date('2024-02-20') }
|
|
89
|
-
];
|
|
90
|
-
const g = this.svg;
|
|
91
|
-
const x = d3
|
|
92
|
-
.scaleTime()
|
|
93
|
-
.domain([d3.min(tasks, d => d.startDate), d3.max(tasks, d => d.endDate)])
|
|
94
|
-
.range([0, this.width]);
|
|
95
|
-
const y = d3
|
|
96
|
-
.scaleBand()
|
|
97
|
-
.domain(tasks.map(d => d.task))
|
|
98
|
-
.range([0, this.height])
|
|
99
|
-
.padding(0.1);
|
|
100
|
-
g.selectAll('.task')
|
|
101
|
-
.data(tasks)
|
|
102
|
-
.enter()
|
|
103
|
-
.append('rect')
|
|
104
|
-
.attr('class', 'task')
|
|
105
|
-
.attr('x', d => x(d.startDate))
|
|
106
|
-
.attr('y', d => y(d.task))
|
|
107
|
-
.attr('width', d => x(d.endDate) - x(d.startDate))
|
|
108
|
-
.attr('height', y.bandwidth());
|
|
109
|
-
g.append('g')
|
|
110
|
-
.attr('transform', 'translate(0,' + this.height + ')')
|
|
111
|
-
.call(d3.axisBottom(x));
|
|
112
|
-
g.append('g').call(d3.axisLeft(y));
|
|
113
|
-
}
|
|
114
|
-
addMouseHandlers() {
|
|
115
|
-
d3.select(this.chart)
|
|
116
|
-
.on('mouseover', this.onMouseOver.bind(this))
|
|
117
|
-
.on('mousemove', this.onMouseMove.bind(this))
|
|
118
|
-
.on('mouseout', this.onMouseOut.bind(this));
|
|
119
|
-
}
|
|
120
|
-
onMouseOver(event) {
|
|
121
|
-
const target = d3.select(event.target);
|
|
122
|
-
if (target.classed('tooltip')) {
|
|
123
|
-
const data = target.datum();
|
|
124
|
-
this.showTooltip(this.tooltipContent(data), event.clientX, event.clientY);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
onMouseMove(event) {
|
|
128
|
-
const target = d3.select(event.target);
|
|
129
|
-
if (target.classed('tooltip')) {
|
|
130
|
-
const data = target.datum();
|
|
131
|
-
this.showTooltip(this.tooltipContent(data), event.clientX, event.clientY);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
onMouseOut(event) {
|
|
135
|
-
const target = d3.select(event.target);
|
|
136
|
-
if (target.classed('tooltip')) {
|
|
137
|
-
this.hideTooltip();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
tooltipContent(data) {
|
|
141
|
-
return `Data: ${data}`;
|
|
142
|
-
}
|
|
143
|
-
showTooltip(content, x, y) {
|
|
144
|
-
this.tooltip.style.opacity = '1';
|
|
145
|
-
this.tooltip.style.left = `${x}px`;
|
|
146
|
-
this.tooltip.style.top = `${y}px`;
|
|
147
|
-
this.tooltip.innerHTML = content;
|
|
148
|
-
}
|
|
149
|
-
hideTooltip() {
|
|
150
|
-
this.tooltip.style.opacity = '0';
|
|
151
|
-
}
|
|
152
|
-
plotData() {
|
|
153
|
-
this.svg.selectAll('.plot').data(this.plots).enter().append('circle').attr('class', 'plot tooltip');
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
__decorate([
|
|
157
|
-
property({ type: Number })
|
|
158
|
-
], OxGanttChart.prototype, "width", void 0);
|
|
159
|
-
__decorate([
|
|
160
|
-
property({ type: Number })
|
|
161
|
-
], OxGanttChart.prototype, "height", void 0);
|
|
162
|
-
__decorate([
|
|
163
|
-
property({ type: Array })
|
|
164
|
-
], OxGanttChart.prototype, "plots", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
property({ type: Number })
|
|
167
|
-
], OxGanttChart.prototype, "precision", void 0);
|
|
168
|
-
__decorate([
|
|
169
|
-
query('#tooltip')
|
|
170
|
-
], OxGanttChart.prototype, "tooltip", void 0);
|
|
171
|
-
__decorate([
|
|
172
|
-
query('#chart')
|
|
173
|
-
], OxGanttChart.prototype, "chart", void 0);
|
|
174
|
-
OxGanttChart = __decorate([
|
|
175
|
-
customElement('ox-gantt-chart')
|
|
176
|
-
], OxGanttChart);
|
|
177
|
-
export { OxGanttChart };
|
|
178
|
-
//# sourceMappingURL=gantt.js.map
|
package/dist/src/gantt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gantt.js","sourceRoot":"","sources":["../../src/gantt.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAGjB,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QACuB,UAAK,GAAW,CAAC,CAAA;QACjB,WAAM,GAAW,CAAC,CAAA;QACnB,UAAK,GAAe,EAAE,CAAA;QAErB,cAAS,GAAY,CAAC,CAAA;IAoLpD,CAAC;aA3KQ,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BF;KACF,AAhCY,CAgCZ;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;KAGV,CAAA;IACH,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QACzB,IAAI,CAAC,wBAAwB,EAAE,CAAA;IACjC,CAAC;IAED,oBAAoB;QAClB,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAA;QAClC,CAAC;QACD,KAAK,CAAC,oBAAoB,EAAE,CAAA;IAC9B,CAAC;IAES,wBAAwB;QAChC,IAAI,CAAC,cAAc,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C,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAmB;AACnB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;2CAAuB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAuB;AAE/B;IAAlB,KAAK,CAAC,UAAU,CAAC;6CAAyB;AAC1B;IAAhB,KAAK,CAAC,QAAQ,CAAC;2CAAsB;AAR3B,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAyLxB","sourcesContent":["import { LitElement, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport * as d3 from 'd3'\n\n@customElement('ox-gantt-chart')\nexport class OxGanttChart extends LitElement {\n @property({ type: Number }) width: number = 0\n @property({ type: Number }) height: number = 0\n @property({ type: Array }) plots: Array<any> = []\n\n @property({ type: Number }) precision?: number = 2\n\n @query('#tooltip') tooltip!: HTMLDivElement\n @query('#chart') chart!: SVGSVGElement\n\n protected svg?: d3.Selection<SVGGElement, unknown, null, undefined>\n\n private resizeObserver?: ResizeObserver\n\n static styles = [\n css`\n :host {\n display: flex;\n }\n\n svg {\n flex: 1;\n margin: 0;\n padding: 0;\n }\n\n #tooltip {\n position: absolute;\n opacity: 0;\n background-color: var(--gantt-chart-tooltip-background-color, white);\n padding: var(--gantt-chart-tooltip-padding, 5px);\n border: var(--gantt-chart-tooltip-border, 1px solid black);\n border-radius: var(--gantt-chart-tooltip-border-radius, 5px);\n box-shadow: var(--gantt-chart-tooltip-box-shadow, 2px 2px 5px rgba(0, 0, 0, 0.3));\n pointer-events: var(--gantt-chart-tooltip-pointer-events, none);\n font-size: var(--gantt-chart-tooltip-font-size, 12px);\n font-family: var(--gantt-chart-tooltip-font-family, Arial, sans-serif);\n transition: opacity 0.3s ease-in-out;\n }\n\n .data-point {\n stroke: var(--gantt-chart-plot-stroke, black);\n stroke-width: var(--gantt-chart-plot-stroke-width, 1px);\n r: var(--gantt-chart-plot-r, 4);\n }\n `\n ]\n\n render() {\n return html`\n <svg id=\"chart\"></svg>\n <div id=\"tooltip\"></div>\n `\n }\n\n connectedCallback(): void {\n super.connectedCallback()\n this.initializeResizeObserver()\n }\n\n disconnectedCallback(): void {\n if (this.resizeObserver) {\n this.resizeObserver.disconnect()\n }\n super.disconnectedCallback()\n }\n\n protected initializeResizeObserver(): void {\n this.resizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n this.initializeChart()\n this.drawChart()\n }\n })\n\n this.resizeObserver.observe(this)\n }\n\n updated(changedProperties: Map<string | number | symbol, unknown>) {\n super.updated(changedProperties)\n\n if (changedProperties.has('plots') && this.plots.length > 0) {\n this.initializeChart()\n this.drawChart()\n }\n }\n\n protected initializeChart(): void {\n const chart = this.chart\n\n d3.select(chart).selectAll('g').remove()\n\n this.svg = d3.select(chart).append('g')\n\n this.addMouseHandlers()\n }\n\n protected drawChart(): void {\n const tasks = [\n { task: 'Task 1', startDate: new Date('2024-02-01'), endDate: new Date('2024-02-07') },\n { task: 'Task 2', startDate: new Date('2024-02-05'), endDate: new Date('2024-02-15') },\n { task: 'Task 3', startDate: new Date('2024-02-10'), endDate: new Date('2024-02-20') }\n ]\n\n const g = this.svg!\n\n const x = d3\n .scaleTime()\n .domain([d3.min(tasks, d => d.startDate)!, d3.max(tasks, d => d.endDate)!])\n .range([0, this.width])\n\n const y = d3\n .scaleBand()\n .domain(tasks.map(d => d.task))\n .range([0, this.height])\n .padding(0.1)\n\n g.selectAll('.task')\n .data(tasks)\n .enter()\n .append('rect')\n .attr('class', 'task')\n .attr('x', d => x(d.startDate))\n .attr('y', d => y(d.task)!)\n .attr('width', d => x(d.endDate) - x(d.startDate))\n .attr('height', y.bandwidth())\n\n g.append('g')\n .attr('transform', 'translate(0,' + this.height + ')')\n .call(d3.axisBottom(x))\n\n g.append('g').call(d3.axisLeft(y))\n }\n\n private addMouseHandlers(): void {\n d3.select(this.chart)\n .on('mouseover', this.onMouseOver.bind(this))\n .on('mousemove', this.onMouseMove.bind(this))\n .on('mouseout', this.onMouseOut.bind(this))\n }\n\n protected onMouseOver(event: MouseEvent): void {\n const target = d3.select(event.target as HTMLElement)\n\n if (target.classed('tooltip')) {\n const data = target.datum()\n this.showTooltip(this.tooltipContent(data), event.clientX, event.clientY)\n }\n }\n\n protected onMouseMove(event: MouseEvent): void {\n const target = d3.select(event.target as HTMLElement)\n\n if (target.classed('tooltip')) {\n const data = target.datum()\n this.showTooltip(this.tooltipContent(data), event.clientX, event.clientY)\n }\n }\n\n protected onMouseOut(event: MouseEvent): void {\n const target = d3.select(event.target as HTMLElement)\n\n if (target.classed('tooltip')) {\n this.hideTooltip()\n }\n }\n\n protected tooltipContent(data: any): string {\n return `Data: ${data}`\n }\n\n protected showTooltip(content: string, x: number, y: number): void {\n this.tooltip.style.opacity = '1'\n this.tooltip.style.left = `${x}px`\n this.tooltip.style.top = `${y}px`\n this.tooltip.innerHTML = content\n }\n\n protected hideTooltip(): void {\n this.tooltip.style.opacity = '0'\n }\n\n protected plotData(): void {\n this.svg!.selectAll('.plot').data(this.plots).enter().append('circle').attr('class', 'plot tooltip')\n }\n}\n"]}
|
package/dist/src/lite-gantt.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import * as d3 from 'd3';
|
|
3
|
-
export declare class OxLiteGanttChart extends LitElement {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
plots: Array<any>;
|
|
7
|
-
precision?: number;
|
|
8
|
-
tooltip: HTMLDivElement;
|
|
9
|
-
chart: SVGSVGElement;
|
|
10
|
-
protected svg?: d3.Selection<SVGGElement, unknown, null, undefined>;
|
|
11
|
-
private resizeObserver?;
|
|
12
|
-
static styles: import("lit").CSSResult[];
|
|
13
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
-
connectedCallback(): void;
|
|
15
|
-
disconnectedCallback(): void;
|
|
16
|
-
protected initializeResizeObserver(): void;
|
|
17
|
-
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
18
|
-
protected initializeChart(): void;
|
|
19
|
-
protected drawChart(): void;
|
|
20
|
-
private addMouseHandlers;
|
|
21
|
-
protected onMouseOver(event: MouseEvent): void;
|
|
22
|
-
protected onMouseMove(event: MouseEvent): void;
|
|
23
|
-
protected onMouseOut(event: MouseEvent): void;
|
|
24
|
-
protected tooltipContent(data: any): string;
|
|
25
|
-
protected showTooltip(content: string, x: number, y: number): void;
|
|
26
|
-
protected hideTooltip(): void;
|
|
27
|
-
}
|