@contributte/datagrid 0.0.0-20250531-d4580b9

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 (39) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +84 -0
  3. package/assets/ajax/index.ts +1 -0
  4. package/assets/ajax/naja.ts +154 -0
  5. package/assets/css/datagrid-all.css +6 -0
  6. package/assets/css/datagrid-full.css +7 -0
  7. package/assets/css/datagrid.css +651 -0
  8. package/assets/css/happy.css +463 -0
  9. package/assets/datagrid-all.ts +1 -0
  10. package/assets/datagrid-full.ts +53 -0
  11. package/assets/datagrid.ts +228 -0
  12. package/assets/index.ts +4 -0
  13. package/assets/integrations/happy.ts +217 -0
  14. package/assets/integrations/index.ts +4 -0
  15. package/assets/integrations/sortable-js.ts +58 -0
  16. package/assets/integrations/tom-select.ts +30 -0
  17. package/assets/integrations/vanilla-datepicker.ts +25 -0
  18. package/assets/plugins/features/autosubmit.ts +87 -0
  19. package/assets/plugins/features/checkboxes.ts +92 -0
  20. package/assets/plugins/features/confirm.ts +28 -0
  21. package/assets/plugins/features/editable.ts +118 -0
  22. package/assets/plugins/features/inline.ts +89 -0
  23. package/assets/plugins/features/item-detail.ts +48 -0
  24. package/assets/plugins/features/treeView.ts +44 -0
  25. package/assets/plugins/index.ts +13 -0
  26. package/assets/plugins/integrations/datepicker.ts +25 -0
  27. package/assets/plugins/integrations/happy.ts +19 -0
  28. package/assets/plugins/integrations/nette-forms.ts +18 -0
  29. package/assets/plugins/integrations/selectpicker.ts +25 -0
  30. package/assets/plugins/integrations/sortable.ts +61 -0
  31. package/assets/types/ajax.d.ts +143 -0
  32. package/assets/types/datagrid.d.ts +31 -0
  33. package/assets/types/index.d.ts +41 -0
  34. package/assets/types/integrations.d.ts +15 -0
  35. package/assets/utils.ts +179 -0
  36. package/dist/datagrid-full.css +1 -0
  37. package/dist/datagrid-full.js +20 -0
  38. package/dist/datagrid-full.js.map +1 -0
  39. package/package.json +55 -0
@@ -0,0 +1,463 @@
1
+ /**
2
+ * From happy-inputs by paveljanda:
3
+ * https://github.com/paveljanda/happy/blob/94357b7146b5f3029cc565859a588c5832dd374a/src/happy.css
4
+ */
5
+
6
+ .happy-color,
7
+ .happy-checkbox,
8
+ .happy-radio {
9
+ color: #333333;
10
+ }
11
+
12
+ .happy-color>b,
13
+ .happy-checkbox>b,
14
+ .happy-radio>b {
15
+ background-color: #333333;
16
+ }
17
+
18
+ .happy-color.active,
19
+ .active.happy-checkbox,
20
+ .active.happy-radio {
21
+ color: #333333;
22
+ }
23
+
24
+ .happy-color.active>b,
25
+ .active.happy-checkbox>b,
26
+ .active.happy-radio>b {
27
+ background-color: #333333;
28
+ }
29
+
30
+ .happy-color.primary,
31
+ .primary.happy-checkbox,
32
+ .primary.happy-radio {
33
+ color: #333333;
34
+ }
35
+
36
+ .happy-color.primary>b,
37
+ .primary.happy-checkbox>b,
38
+ .primary.happy-radio>b {
39
+ background-color: #333333;
40
+ }
41
+
42
+ .happy-color.primary.active,
43
+ .primary.active.happy-checkbox,
44
+ .primary.active.happy-radio {
45
+ color: #4c86bb;
46
+ }
47
+
48
+ .happy-color.primary.active>b,
49
+ .primary.active.happy-checkbox>b,
50
+ .primary.active.happy-radio>b {
51
+ background-color: #4c86bb;
52
+ }
53
+
54
+ .happy-color.success,
55
+ .success.happy-checkbox,
56
+ .success.happy-radio {
57
+ color: #333333;
58
+ }
59
+
60
+ .happy-color.success>b,
61
+ .success.happy-checkbox>b,
62
+ .success.happy-radio>b {
63
+ background-color: #333333;
64
+ }
65
+
66
+ .happy-color.success.active,
67
+ .success.active.happy-checkbox,
68
+ .success.active.happy-radio {
69
+ color: #72b889;
70
+ }
71
+
72
+ .happy-color.success.active>b,
73
+ .success.active.happy-checkbox>b,
74
+ .success.active.happy-radio>b {
75
+ background-color: #72b889;
76
+ }
77
+
78
+ .happy-color.info,
79
+ .info.happy-checkbox,
80
+ .info.happy-radio {
81
+ color: #333333;
82
+ }
83
+
84
+ .happy-color.info>b,
85
+ .info.happy-checkbox>b,
86
+ .info.happy-radio>b {
87
+ background-color: #333333;
88
+ }
89
+
90
+ .happy-color.info.active,
91
+ .info.active.happy-checkbox,
92
+ .info.active.happy-radio {
93
+ color: #5bc0de;
94
+ }
95
+
96
+ .happy-color.info.active>b,
97
+ .info.active.happy-checkbox>b,
98
+ .info.active.happy-radio>b {
99
+ background-color: #5bc0de;
100
+ }
101
+
102
+ .happy-color.warning,
103
+ .warning.happy-checkbox,
104
+ .warning.happy-radio {
105
+ color: #333333;
106
+ }
107
+
108
+ .happy-color.warning>b,
109
+ .warning.happy-checkbox>b,
110
+ .warning.happy-radio>b {
111
+ background-color: #333333;
112
+ }
113
+
114
+ .happy-color.warning.active,
115
+ .warning.active.happy-checkbox,
116
+ .warning.active.happy-radio {
117
+ color: #f0bb65;
118
+ }
119
+
120
+ .happy-color.warning.active>b,
121
+ .warning.active.happy-checkbox>b,
122
+ .warning.active.happy-radio>b {
123
+ background-color: #f0bb65;
124
+ }
125
+
126
+ .happy-color.danger,
127
+ .danger.happy-checkbox,
128
+ .danger.happy-radio {
129
+ color: #333333;
130
+ }
131
+
132
+ .happy-color.danger>b,
133
+ .danger.happy-checkbox>b,
134
+ .danger.happy-radio>b {
135
+ background-color: #333333;
136
+ }
137
+
138
+ .happy-color.danger.active,
139
+ .danger.active.happy-checkbox,
140
+ .danger.active.happy-radio {
141
+ color: #ed6b6b;
142
+ }
143
+
144
+ .happy-color.danger.active>b,
145
+ .danger.active.happy-checkbox>b,
146
+ .danger.active.happy-radio>b {
147
+ background-color: #ed6b6b;
148
+ }
149
+
150
+ .happy-color.white,
151
+ .white.happy-checkbox,
152
+ .white.happy-radio {
153
+ color: #333333;
154
+ }
155
+
156
+ .happy-color.white>b,
157
+ .white.happy-checkbox>b,
158
+ .white.happy-radio>b {
159
+ background-color: #333333;
160
+ }
161
+
162
+ .happy-color.white.active,
163
+ .white.active.happy-checkbox,
164
+ .white.active.happy-radio {
165
+ color: #ffffff;
166
+ }
167
+
168
+ .happy-color.white.active>b,
169
+ .white.active.happy-checkbox>b,
170
+ .white.active.happy-radio>b {
171
+ background-color: #ffffff;
172
+ }
173
+
174
+ .happy-border-color,
175
+ .happy-radio {
176
+ border-color: rgba(51, 51, 51, 0.8);
177
+ }
178
+
179
+ .happy-border-color.active,
180
+ .active.happy-radio {
181
+ border-color: #333333;
182
+ }
183
+
184
+ .happy-border-color.primary,
185
+ .primary.happy-radio {
186
+ border-color: rgba(51, 51, 51, 0.8);
187
+ }
188
+
189
+ .happy-border-color.primary.active,
190
+ .primary.active.happy-radio {
191
+ border-color: #4c86bb;
192
+ }
193
+
194
+ .happy-border-color.success,
195
+ .success.happy-radio {
196
+ border-color: rgba(51, 51, 51, 0.8);
197
+ }
198
+
199
+ .happy-border-color.success.active,
200
+ .success.active.happy-radio {
201
+ border-color: #72b889;
202
+ }
203
+
204
+ .happy-border-color.info,
205
+ .info.happy-radio {
206
+ border-color: rgba(51, 51, 51, 0.8);
207
+ }
208
+
209
+ .happy-border-color.info.active,
210
+ .info.active.happy-radio {
211
+ border-color: #5bc0de;
212
+ }
213
+
214
+ .happy-border-color.warning,
215
+ .warning.happy-radio {
216
+ border-color: rgba(51, 51, 51, 0.8);
217
+ }
218
+
219
+ .happy-border-color.warning.active,
220
+ .warning.active.happy-radio {
221
+ border-color: #f0bb65;
222
+ }
223
+
224
+ .happy-border-color.danger,
225
+ .danger.happy-radio {
226
+ border-color: rgba(51, 51, 51, 0.8);
227
+ }
228
+
229
+ .happy-border-color.danger.active,
230
+ .danger.active.happy-radio {
231
+ border-color: #ed6b6b;
232
+ }
233
+
234
+ .happy-border-color.white,
235
+ .white.happy-radio {
236
+ border-color: rgba(51, 51, 51, 0.8);
237
+ }
238
+
239
+ .happy-border-color.white.active,
240
+ .white.active.happy-radio {
241
+ border-color: #ffffff;
242
+ }
243
+
244
+ /**
245
+ * Common
246
+ */
247
+
248
+ input[type="radio"].happy,
249
+ input[type="checkbox"].happy {
250
+ position: absolute;
251
+ top: -50%;
252
+ left: -50%;
253
+ opacity: 0;
254
+ }
255
+
256
+ label:not(.selectable),
257
+ .noselect {
258
+ -webkit-touch-callout: none;
259
+ -webkit-user-select: none;
260
+ -khtml-user-select: none;
261
+ -moz-user-select: none;
262
+ -ms-user-select: none;
263
+ user-select: none;
264
+ }
265
+
266
+ label {
267
+ cursor: pointer;
268
+ position: relative;
269
+ }
270
+
271
+ /**
272
+ * Checkbox
273
+ */
274
+
275
+ .happy-checkbox {
276
+ border-color: #333333;
277
+ margin-right: 0.2em;
278
+ position: relative;
279
+ display: inline-block;
280
+ line-height: 20px;
281
+ vertical-align: middle;
282
+ width: 16px;
283
+ height: 16px;
284
+ border-width: 2px;
285
+ border-style: solid;
286
+ cursor: pointer;
287
+ box-sizing: border-box;
288
+ top: -2px;
289
+ -webkit-border-radius: 2.66667px;
290
+ -moz-border-radius: 2.66667px;
291
+ border-radius: 2.66667px;
292
+ }
293
+
294
+ .happy-checkbox svg {
295
+ position: absolute;
296
+ display: block;
297
+ top: -2px;
298
+ left: -2px;
299
+ height: 16px;
300
+ width: 16px;
301
+ opacity: 0;
302
+ -webkit-border-radius: 2.66667px;
303
+ -moz-border-radius: 2.66667px;
304
+ border-radius: 2.66667px;
305
+ background-color: #333333;
306
+ -ms-transform: scale(0.4);
307
+ -webkit-transform: scale(0.4);
308
+ transform: scale(0.4);
309
+ -ms-transition: all 180ms;
310
+ -webkit-transition: all 180ms;
311
+ transition: all 180ms;
312
+ }
313
+
314
+ .happy-checkbox svg rect {
315
+ fill: white;
316
+ }
317
+
318
+ .happy-checkbox svg rect:first-child {
319
+ -ms-transform: rotate(45deg);
320
+ -webkit-transform: rotate(45deg);
321
+ transform: rotate(45deg);
322
+ }
323
+
324
+ .happy-checkbox svg rect:nth-child(2) {
325
+ -ms-transform: rotate(-45deg);
326
+ -webkit-transform: rotate(-45deg);
327
+ transform: rotate(-45deg);
328
+ /* fill: yellow; */
329
+ }
330
+
331
+ .happy-checkbox.thin {
332
+ border-width: 1px;
333
+ }
334
+
335
+ .happy-checkbox.thin svg {
336
+ top: -1px;
337
+ left: -1px;
338
+ }
339
+
340
+ .happy-checkbox.white {
341
+ border-color: #ffffff;
342
+ }
343
+
344
+ .happy-checkbox.gray-border {
345
+ border-color: #858585;
346
+ }
347
+
348
+ .happy-checkbox.primary-border {
349
+ border-color: #4c86bb;
350
+ }
351
+
352
+ .happy-checkbox.success-border {
353
+ border-color: #72b889;
354
+ }
355
+
356
+ .happy-checkbox.info-border {
357
+ border-color: #5bc0de;
358
+ }
359
+
360
+ .happy-checkbox.warning-border {
361
+ border-color: #f0bb65;
362
+ }
363
+
364
+ .happy-checkbox.danger-border {
365
+ border-color: #ed6b6b;
366
+ }
367
+
368
+ .happy-checkbox.primary svg {
369
+ background-color: #4c86bb;
370
+ }
371
+
372
+ .happy-checkbox.success svg {
373
+ background-color: #72b889;
374
+ }
375
+
376
+ .happy-checkbox.info svg {
377
+ background-color: #5bc0de;
378
+ }
379
+
380
+ .happy-checkbox.warning svg {
381
+ background-color: #f0bb65;
382
+ }
383
+
384
+ .happy-checkbox.danger svg {
385
+ background-color: #ed6b6b;
386
+ }
387
+
388
+ .happy-checkbox.white svg {
389
+ background-color: #ffffff;
390
+ }
391
+
392
+ .happy-checkbox.white svg rect {
393
+ fill: #333333;
394
+ }
395
+
396
+ .happy-checkbox.active {
397
+ border-color: transparent;
398
+ }
399
+
400
+ .happy-checkbox.active svg {
401
+ opacity: 1;
402
+ -ms-transform: scale(1);
403
+ -webkit-transform: scale(1);
404
+ transform: scale(1);
405
+ }
406
+
407
+ /**
408
+ * Radio
409
+ */
410
+
411
+ .happy-radio {
412
+ position: relative;
413
+ display: inline-block;
414
+ line-height: 20px;
415
+ vertical-align: middle;
416
+ width: 16px;
417
+ height: 16px;
418
+ border-width: 2px;
419
+ border-style: solid;
420
+ cursor: pointer;
421
+ box-sizing: border-box;
422
+ top: -2px;
423
+ -webkit-border-radius: 16px;
424
+ -moz-border-radius: 16px;
425
+ border-radius: 16px;
426
+ }
427
+
428
+ .happy-radio.thin {
429
+ border-width: 1.66667px;
430
+ }
431
+
432
+ .happy-radio b {
433
+ position: absolute;
434
+ display: block;
435
+ top: 2px;
436
+ left: 2px;
437
+ bottom: 2px;
438
+ right: 2px;
439
+ opacity: 0;
440
+ -webkit-border-radius: 10.66667px;
441
+ -moz-border-radius: 10.66667px;
442
+ border-radius: 10.66667px;
443
+ -ms-transform: scale(0.4);
444
+ -webkit-transform: scale(0.4);
445
+ transform: scale(0.4);
446
+ -ms-transition: all 180ms;
447
+ -webkit-transition: all 180ms;
448
+ transition: all 180ms;
449
+ }
450
+
451
+ .happy-radio.active b {
452
+ opacity: 1;
453
+ -ms-transform: scale(1);
454
+ -webkit-transform: scale(1);
455
+ transform: scale(1);
456
+ }
457
+
458
+ .happy-radio.focus {
459
+ outline: none;
460
+ -webkit-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.75);
461
+ -moz-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.75);
462
+ box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.75);
463
+ }
@@ -0,0 +1 @@
1
+ export * from "./datagrid-full";
@@ -0,0 +1,53 @@
1
+ import naja from "naja";
2
+ import { default as netteForms } from "nette-forms";
3
+ import {
4
+ AutosubmitPlugin,
5
+ CheckboxPlugin,
6
+ ConfirmPlugin,
7
+ createDatagrids,
8
+ DatepickerPlugin,
9
+ Happy,
10
+ HappyPlugin,
11
+ InlinePlugin,
12
+ ItemDetailPlugin,
13
+ NetteFormsPlugin,
14
+ SelectpickerPlugin,
15
+ SortableJS,
16
+ SortablePlugin,
17
+ TomSelect,
18
+ TreeViewPlugin,
19
+ VanillaDatepicker,
20
+ } from "."
21
+ import { NajaAjax } from "./ajax";
22
+ import Select from "tom-select";
23
+ import { Dropdown } from "bootstrap";
24
+
25
+ // Datagrid + UI
26
+ document.addEventListener("DOMContentLoaded", () => {
27
+ // Initialize dropdowns
28
+ Array.from(document.querySelectorAll('.dropdown'))
29
+ .forEach(el => new Dropdown(el))
30
+
31
+ // Initialize Naja (nette ajax)
32
+ naja.formsHandler.netteForms = netteForms;
33
+ naja.initialize();
34
+
35
+ // Initialize datagrids
36
+ createDatagrids(new NajaAjax(naja), {
37
+ datagrid: {
38
+ plugins: [
39
+ new AutosubmitPlugin(),
40
+ new CheckboxPlugin(),
41
+ new ConfirmPlugin(),
42
+ new InlinePlugin(),
43
+ new ItemDetailPlugin(),
44
+ new NetteFormsPlugin(netteForms),
45
+ new HappyPlugin(new Happy()),
46
+ new SortablePlugin(new SortableJS()),
47
+ new DatepickerPlugin(new VanillaDatepicker({ buttonClass: 'btn' })),
48
+ new SelectpickerPlugin(new TomSelect(Select)),
49
+ new TreeViewPlugin(),
50
+ ],
51
+ },
52
+ });
53
+ });