vgapp 1.3.8 → 1.3.9

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 (89) hide show
  1. package/app/langs/en/buttons.json +17 -17
  2. package/app/langs/en/messages.json +36 -36
  3. package/app/langs/ru/buttons.json +17 -17
  4. package/app/langs/ru/messages.json +36 -36
  5. package/app/modules/base-module.js +111 -111
  6. package/app/modules/vgalert/js/vgalert.js +37 -37
  7. package/app/modules/vgalert/readme.md +105 -105
  8. package/app/modules/vgdynamictable/index.js +4 -5
  9. package/app/modules/vgdynamictable/js/editable.js +19 -19
  10. package/app/modules/vgdynamictable/js/filters.js +21 -21
  11. package/app/modules/vgdynamictable/js/fixed.js +179 -179
  12. package/app/modules/vgdynamictable/js/pagination.js +1 -1
  13. package/app/modules/vgdynamictable/js/search.js +12 -12
  14. package/app/modules/vgdynamictable/js/sortable.js +71 -71
  15. package/app/modules/vgdynamictable/js/summary-footer.js +28 -28
  16. package/app/modules/vgdynamictable/js/table-remote.js +79 -79
  17. package/app/modules/vgdynamictable/js/table-url-state.js +31 -31
  18. package/app/modules/vgdynamictable/js/utils/common.js +48 -48
  19. package/app/modules/vgdynamictable/js/vgdynamictable.js +274 -274
  20. package/app/modules/vgdynamictable/readme.md +250 -250
  21. package/app/modules/vgdynamictable/scss/_skeleton.scss +6 -6
  22. package/app/modules/vgdynamictable/scss/_sortable.scss +24 -24
  23. package/app/modules/vgdynamictable/scss/_table.scss +4 -4
  24. package/app/modules/vgdynamictable/scss/_variables.scss +79 -79
  25. package/app/modules/vgdynamictable/scss/vgdynamictable.scss +27 -27
  26. package/app/modules/vgfilepreview/js/i18n.js +56 -56
  27. package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
  28. package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
  29. package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
  30. package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
  31. package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
  32. package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
  33. package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
  34. package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
  35. package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
  36. package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
  37. package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
  38. package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
  39. package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
  40. package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
  41. package/app/modules/vgfilepreview/js/vgfilepreview.js +7 -7
  42. package/app/modules/vgfilepreview/readme.md +68 -68
  43. package/app/modules/vgfilepreview/scss/_variables.scss +113 -113
  44. package/app/modules/vgfilepreview/scss/vgfilepreview.scss +464 -464
  45. package/app/modules/vgfiles/js/base.js +26 -26
  46. package/app/modules/vgfiles/js/droppable.js +260 -260
  47. package/app/modules/vgfiles/js/render.js +153 -153
  48. package/app/modules/vgfiles/js/vgfiles.js +104 -104
  49. package/app/modules/vgfiles/readme.md +123 -123
  50. package/app/modules/vgfiles/scss/_variables.scss +18 -18
  51. package/app/modules/vgfiles/scss/vgfiles.scss +148 -148
  52. package/app/modules/vgformsender/js/hideshowpass.js +16 -16
  53. package/app/modules/vgformsender/readme.md +41 -41
  54. package/app/modules/vgformsender/scss/vgformsender.scss +34 -34
  55. package/app/modules/vgmodal/js/vgmodal.drag.js +332 -332
  56. package/app/modules/vgmodal/js/vgmodal.js +188 -188
  57. package/app/modules/vgmodal/js/vgmodal.resize.js +27 -27
  58. package/app/modules/vgmodal/scss/vgmodal.scss +14 -14
  59. package/app/modules/vgnav/js/vgnav.js +135 -135
  60. package/app/modules/vgnav/readme.md +67 -67
  61. package/app/modules/vgnestable/README.md +307 -307
  62. package/app/modules/vgnestable/scss/_variables.scss +60 -60
  63. package/app/modules/vgnestable/scss/vgnestable.scss +163 -163
  64. package/app/modules/vgrangeslider/js/skins.js +222 -222
  65. package/app/modules/vgrangeslider/js/vgrangeslider.js +704 -704
  66. package/app/modules/vgrangeslider/readme.md +523 -523
  67. package/app/modules/vgrangeslider/scss/_variables.scss +53 -53
  68. package/app/modules/vgrangeslider/scss/vgrangeslider.scss +240 -240
  69. package/app/modules/vgselect/js/vgselect.js +39 -39
  70. package/app/modules/vgselect/scss/vgselect.scss +22 -22
  71. package/app/modules/vgspy/readme.md +28 -28
  72. package/app/modules/vgtoast/readme.md +18 -18
  73. package/app/modules/vgtoast/scss/vgtoast.scss +48 -48
  74. package/app/modules/vgtooltip/js/vgtooltip.js +89 -89
  75. package/app/modules/vgtooltip/readme.md +181 -181
  76. package/app/utils/js/components/ajax.js +117 -117
  77. package/app/utils/js/components/audio-metadata.js +240 -240
  78. package/app/utils/js/components/backdrop.js +17 -17
  79. package/app/utils/js/components/file-icon.js +109 -109
  80. package/app/utils/js/components/file-preview.js +304 -304
  81. package/app/utils/js/components/sanitize.js +150 -150
  82. package/app/utils/js/components/video-metadata.js +140 -140
  83. package/app/vgapp.js +295 -130
  84. package/build/vgapp.css +1 -1
  85. package/build/vgapp.css.map +1 -1
  86. package/build/vgapp.js +1 -1
  87. package/build/vgapp.js.map +1 -1
  88. package/index.js +14 -14
  89. package/package.json +1 -1
@@ -1,222 +1,222 @@
1
- const SKIN_CLASS_DEFAULT = 'is-skin-default';
2
- const SKIN_CLASS_RULER = 'is-skin-ruler';
3
- const SKIN_CLASS_STATUS = 'is-skin-status';
4
- const SKIN_CLASS_RULER_DIM = 'is-ruler-dim-inactive';
5
- const STATUS_CLASS_SUCCESS = 'is-status-success';
6
- const STATUS_CLASS_WARNING = 'is-status-warning';
7
- const STATUS_CLASS_DANGER = 'is-status-danger';
8
-
9
- const STATUS_CLASSES = [
10
- STATUS_CLASS_SUCCESS,
11
- STATUS_CLASS_WARNING,
12
- STATUS_CLASS_DANGER,
13
- ];
14
-
15
- const resolveStatusToneByValue = (value, params, state) => {
16
- const span = state.max - state.min;
17
- const percent = span > 0 ? ((value - state.min) / span) * 100 : 0;
18
- const warningBelow = Number(params?.status?.warningBelow);
19
- const dangerBelow = Number(params?.status?.dangerBelow);
20
- const warningThreshold = Number.isFinite(warningBelow) ? warningBelow : 60;
21
- const dangerThreshold = Number.isFinite(dangerBelow) ? dangerBelow : 30;
22
-
23
- if (percent < dangerThreshold) {
24
- return 'danger';
25
- }
26
-
27
- if (percent < warningThreshold) {
28
- return 'warning';
29
- }
30
-
31
- return 'success';
32
- };
33
-
34
- const resolveStatusSourceValue = (params, state, helpers) => {
35
- if (!helpers.isRange) {
36
- return state.from;
37
- }
38
-
39
- const by = typeof params?.status?.by === 'string'
40
- ? params.status.by.toLowerCase()
41
- : 'to';
42
-
43
- if (by === 'from') {
44
- return state.from;
45
- }
46
-
47
- if (by === 'avg') {
48
- return (state.from + state.to) / 2;
49
- }
50
-
51
- return state.to;
52
- };
53
-
54
- const buildRulerValues = (params, state) => {
55
- if (Array.isArray(params?.ruler?.values) && params.ruler.values.length > 0) {
56
- return params.ruler.values
57
- .map(value => Number(value))
58
- .filter(value => Number.isFinite(value))
59
- .sort((a, b) => a - b);
60
- }
61
-
62
- const count = Math.max(2, Number(params?.ruler?.count) || 6);
63
- const span = state.max - state.min;
64
- const step = span / (count - 1);
65
- const values = [];
66
-
67
- for (let index = 0; index < count; index++) {
68
- const value = index === count - 1 ? state.max : state.min + (step * index);
69
- values.push(Number(value.toFixed(5)));
70
- }
71
-
72
- return values;
73
- };
74
-
75
- const createRulerSkin = (root, params, state, formatValue, toPositionPx) => {
76
- const values = buildRulerValues(params, state);
77
- const ruler = document.createElement('div');
78
- ruler.className = 'vg-range-slider__ruler';
79
-
80
- if (params?.ruler?.dimInactive === true) {
81
- root.classList.add(SKIN_CLASS_RULER_DIM);
82
- }
83
-
84
- const ticks = values.map((value) => {
85
- const item = document.createElement('span');
86
- item.className = 'vg-range-slider__ruler-item';
87
- item.style.left = `${toPositionPx(value)}px`;
88
- item.dataset.value = String(value);
89
-
90
- const mark = document.createElement('span');
91
- mark.className = 'vg-range-slider__ruler-mark';
92
- item.appendChild(mark);
93
-
94
- if (params?.ruler?.labels !== false) {
95
- const label = document.createElement('span');
96
- label.className = 'vg-range-slider__ruler-label';
97
- label.textContent = formatValue(value);
98
- item.appendChild(label);
99
- }
100
-
101
- ruler.appendChild(item);
102
- return item;
103
- });
104
-
105
- root.appendChild(ruler);
106
-
107
- return {
108
- type: 'ruler',
109
- root: ruler,
110
- ticks,
111
- values,
112
- };
113
- };
114
-
115
- const resolveStatusTone = (params, state, helpers) => {
116
- const value = resolveStatusSourceValue(params, state, helpers);
117
- return resolveStatusToneByValue(value, params, state);
118
- };
119
-
120
- const syncStatusClasses = (root, tone) => {
121
- root.classList.remove(...STATUS_CLASSES);
122
-
123
- if (tone === 'danger') {
124
- root.classList.add(STATUS_CLASS_DANGER);
125
- return;
126
- }
127
-
128
- if (tone === 'warning') {
129
- root.classList.add(STATUS_CLASS_WARNING);
130
- return;
131
- }
132
-
133
- root.classList.add(STATUS_CLASS_SUCCESS);
134
- };
135
-
136
- const resolveStatusLabel = (params, tone) => {
137
- if (!Array.isArray(params?.labelWords) || params.labelWords.length < 3) {
138
- return null;
139
- }
140
-
141
- if (tone === 'danger') {
142
- return params.labelWords[0] || null;
143
- }
144
-
145
- if (tone === 'warning') {
146
- return params.labelWords[1] || null;
147
- }
148
-
149
- return params.labelWords[2] || null;
150
- };
151
-
152
- const syncStatusLabels = (params, state, helpers) => {
153
- const labelFrom = helpers?.dom?.labelFrom;
154
- const labelTo = helpers?.dom?.labelTo;
155
- const fromLabel = resolveStatusLabel(params, resolveStatusToneByValue(state.from, params, state));
156
- const toLabel = resolveStatusLabel(params, resolveStatusToneByValue(state.to, params, state));
157
-
158
- if (labelFrom && fromLabel) {
159
- labelFrom.textContent = fromLabel;
160
- }
161
-
162
- if (labelTo && toLabel) {
163
- labelTo.textContent = toLabel;
164
- }
165
- };
166
-
167
- const applyRangeSliderSkin = (root, params, state, helpers) => {
168
- root.classList.add(SKIN_CLASS_DEFAULT);
169
-
170
- if (params.skin === 'ruler') {
171
- root.classList.add(SKIN_CLASS_RULER);
172
- return createRulerSkin(root, params, state, helpers.formatValue, helpers.toPositionPx);
173
- }
174
-
175
- if (params.skin === 'status') {
176
- root.classList.add(SKIN_CLASS_STATUS);
177
- syncStatusClasses(root, resolveStatusTone(params, state, helpers));
178
-
179
- return {
180
- type: 'status',
181
- root,
182
- };
183
- }
184
-
185
- if (params.skin !== 'default') {
186
- return null;
187
- }
188
-
189
- return null;
190
- };
191
-
192
- const syncRangeSliderSkin = (skin, state, helpers) => {
193
- if (!skin) {
194
- return;
195
- }
196
-
197
- if (skin.type === 'status') {
198
- syncStatusClasses(skin.root, resolveStatusTone(helpers.params, state, helpers));
199
- syncStatusLabels(helpers.params, state, helpers);
200
- return;
201
- }
202
-
203
- if (skin.type !== 'ruler') {
204
- return;
205
- }
206
-
207
- const isRange = state.from !== state.to || helpers.isRange;
208
-
209
- skin.ticks.forEach((tick, index) => {
210
- const value = skin.values[index];
211
- const isActive = isRange
212
- ? value >= state.from && value <= state.to
213
- : value <= state.from;
214
-
215
- tick.classList.toggle('is-active', isActive);
216
- });
217
- };
218
-
219
- export {
220
- applyRangeSliderSkin,
221
- syncRangeSliderSkin,
222
- };
1
+ const SKIN_CLASS_DEFAULT = 'is-skin-default';
2
+ const SKIN_CLASS_RULER = 'is-skin-ruler';
3
+ const SKIN_CLASS_STATUS = 'is-skin-status';
4
+ const SKIN_CLASS_RULER_DIM = 'is-ruler-dim-inactive';
5
+ const STATUS_CLASS_SUCCESS = 'is-status-success';
6
+ const STATUS_CLASS_WARNING = 'is-status-warning';
7
+ const STATUS_CLASS_DANGER = 'is-status-danger';
8
+
9
+ const STATUS_CLASSES = [
10
+ STATUS_CLASS_SUCCESS,
11
+ STATUS_CLASS_WARNING,
12
+ STATUS_CLASS_DANGER,
13
+ ];
14
+
15
+ const resolveStatusToneByValue = (value, params, state) => {
16
+ const span = state.max - state.min;
17
+ const percent = span > 0 ? ((value - state.min) / span) * 100 : 0;
18
+ const warningBelow = Number(params?.status?.warningBelow);
19
+ const dangerBelow = Number(params?.status?.dangerBelow);
20
+ const warningThreshold = Number.isFinite(warningBelow) ? warningBelow : 60;
21
+ const dangerThreshold = Number.isFinite(dangerBelow) ? dangerBelow : 30;
22
+
23
+ if (percent < dangerThreshold) {
24
+ return 'danger';
25
+ }
26
+
27
+ if (percent < warningThreshold) {
28
+ return 'warning';
29
+ }
30
+
31
+ return 'success';
32
+ };
33
+
34
+ const resolveStatusSourceValue = (params, state, helpers) => {
35
+ if (!helpers.isRange) {
36
+ return state.from;
37
+ }
38
+
39
+ const by = typeof params?.status?.by === 'string'
40
+ ? params.status.by.toLowerCase()
41
+ : 'to';
42
+
43
+ if (by === 'from') {
44
+ return state.from;
45
+ }
46
+
47
+ if (by === 'avg') {
48
+ return (state.from + state.to) / 2;
49
+ }
50
+
51
+ return state.to;
52
+ };
53
+
54
+ const buildRulerValues = (params, state) => {
55
+ if (Array.isArray(params?.ruler?.values) && params.ruler.values.length > 0) {
56
+ return params.ruler.values
57
+ .map(value => Number(value))
58
+ .filter(value => Number.isFinite(value))
59
+ .sort((a, b) => a - b);
60
+ }
61
+
62
+ const count = Math.max(2, Number(params?.ruler?.count) || 6);
63
+ const span = state.max - state.min;
64
+ const step = span / (count - 1);
65
+ const values = [];
66
+
67
+ for (let index = 0; index < count; index++) {
68
+ const value = index === count - 1 ? state.max : state.min + (step * index);
69
+ values.push(Number(value.toFixed(5)));
70
+ }
71
+
72
+ return values;
73
+ };
74
+
75
+ const createRulerSkin = (root, params, state, formatValue, toPositionPx) => {
76
+ const values = buildRulerValues(params, state);
77
+ const ruler = document.createElement('div');
78
+ ruler.className = 'vg-range-slider__ruler';
79
+
80
+ if (params?.ruler?.dimInactive === true) {
81
+ root.classList.add(SKIN_CLASS_RULER_DIM);
82
+ }
83
+
84
+ const ticks = values.map((value) => {
85
+ const item = document.createElement('span');
86
+ item.className = 'vg-range-slider__ruler-item';
87
+ item.style.left = `${toPositionPx(value)}px`;
88
+ item.dataset.value = String(value);
89
+
90
+ const mark = document.createElement('span');
91
+ mark.className = 'vg-range-slider__ruler-mark';
92
+ item.appendChild(mark);
93
+
94
+ if (params?.ruler?.labels !== false) {
95
+ const label = document.createElement('span');
96
+ label.className = 'vg-range-slider__ruler-label';
97
+ label.textContent = formatValue(value);
98
+ item.appendChild(label);
99
+ }
100
+
101
+ ruler.appendChild(item);
102
+ return item;
103
+ });
104
+
105
+ root.appendChild(ruler);
106
+
107
+ return {
108
+ type: 'ruler',
109
+ root: ruler,
110
+ ticks,
111
+ values,
112
+ };
113
+ };
114
+
115
+ const resolveStatusTone = (params, state, helpers) => {
116
+ const value = resolveStatusSourceValue(params, state, helpers);
117
+ return resolveStatusToneByValue(value, params, state);
118
+ };
119
+
120
+ const syncStatusClasses = (root, tone) => {
121
+ root.classList.remove(...STATUS_CLASSES);
122
+
123
+ if (tone === 'danger') {
124
+ root.classList.add(STATUS_CLASS_DANGER);
125
+ return;
126
+ }
127
+
128
+ if (tone === 'warning') {
129
+ root.classList.add(STATUS_CLASS_WARNING);
130
+ return;
131
+ }
132
+
133
+ root.classList.add(STATUS_CLASS_SUCCESS);
134
+ };
135
+
136
+ const resolveStatusLabel = (params, tone) => {
137
+ if (!Array.isArray(params?.labelWords) || params.labelWords.length < 3) {
138
+ return null;
139
+ }
140
+
141
+ if (tone === 'danger') {
142
+ return params.labelWords[0] || null;
143
+ }
144
+
145
+ if (tone === 'warning') {
146
+ return params.labelWords[1] || null;
147
+ }
148
+
149
+ return params.labelWords[2] || null;
150
+ };
151
+
152
+ const syncStatusLabels = (params, state, helpers) => {
153
+ const labelFrom = helpers?.dom?.labelFrom;
154
+ const labelTo = helpers?.dom?.labelTo;
155
+ const fromLabel = resolveStatusLabel(params, resolveStatusToneByValue(state.from, params, state));
156
+ const toLabel = resolveStatusLabel(params, resolveStatusToneByValue(state.to, params, state));
157
+
158
+ if (labelFrom && fromLabel) {
159
+ labelFrom.textContent = fromLabel;
160
+ }
161
+
162
+ if (labelTo && toLabel) {
163
+ labelTo.textContent = toLabel;
164
+ }
165
+ };
166
+
167
+ const applyRangeSliderSkin = (root, params, state, helpers) => {
168
+ root.classList.add(SKIN_CLASS_DEFAULT);
169
+
170
+ if (params.skin === 'ruler') {
171
+ root.classList.add(SKIN_CLASS_RULER);
172
+ return createRulerSkin(root, params, state, helpers.formatValue, helpers.toPositionPx);
173
+ }
174
+
175
+ if (params.skin === 'status') {
176
+ root.classList.add(SKIN_CLASS_STATUS);
177
+ syncStatusClasses(root, resolveStatusTone(params, state, helpers));
178
+
179
+ return {
180
+ type: 'status',
181
+ root,
182
+ };
183
+ }
184
+
185
+ if (params.skin !== 'default') {
186
+ return null;
187
+ }
188
+
189
+ return null;
190
+ };
191
+
192
+ const syncRangeSliderSkin = (skin, state, helpers) => {
193
+ if (!skin) {
194
+ return;
195
+ }
196
+
197
+ if (skin.type === 'status') {
198
+ syncStatusClasses(skin.root, resolveStatusTone(helpers.params, state, helpers));
199
+ syncStatusLabels(helpers.params, state, helpers);
200
+ return;
201
+ }
202
+
203
+ if (skin.type !== 'ruler') {
204
+ return;
205
+ }
206
+
207
+ const isRange = state.from !== state.to || helpers.isRange;
208
+
209
+ skin.ticks.forEach((tick, index) => {
210
+ const value = skin.values[index];
211
+ const isActive = isRange
212
+ ? value >= state.from && value <= state.to
213
+ : value <= state.from;
214
+
215
+ tick.classList.toggle('is-active', isActive);
216
+ });
217
+ };
218
+
219
+ export {
220
+ applyRangeSliderSkin,
221
+ syncRangeSliderSkin,
222
+ };