@sme.up/ketchup 6.2.0 → 6.4.0
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/cjs/{f-button-5b69d882.js → f-button-826a470e.js} +4 -4
- package/dist/cjs/{f-cell-3a740c48.js → f-cell-2d5bcf0c.js} +13 -15
- package/dist/cjs/{f-checkbox-57443ca3.js → f-checkbox-cd977193.js} +1 -1
- package/dist/cjs/{f-chip-02e83f82.js → f-chip-2fd3363e.js} +3 -3
- package/dist/cjs/{f-image-2a61ece2.js → f-image-0f17d599.js} +2 -2
- package/dist/cjs/{f-paginator-utils-09126bdd.js → f-paginator-utils-946b579d.js} +80 -403
- package/dist/cjs/{f-text-field-9ee20a67.js → f-text-field-d243e4d8.js} +13 -3
- package/dist/cjs/{index-06b131ea.js → index-31125378.js} +9 -4
- package/dist/cjs/ketchup.cjs.js +3 -3
- package/dist/cjs/kup-accordion.cjs.entry.js +5 -6
- package/dist/cjs/kup-autocomplete_25.cjs.entry.js +129 -115
- package/dist/cjs/kup-box.cjs.entry.js +20 -20
- package/dist/cjs/kup-calendar.cjs.entry.js +9 -11
- package/dist/cjs/kup-cell.cjs.entry.js +9 -11
- package/dist/cjs/kup-dash-list.cjs.entry.js +5 -7
- package/dist/cjs/kup-dash_2.cjs.entry.js +4 -5
- package/dist/cjs/kup-dashboard.cjs.entry.js +76 -17
- package/dist/cjs/kup-drawer.cjs.entry.js +4 -5
- package/dist/cjs/kup-echart.cjs.entry.js +42 -34
- package/dist/cjs/kup-family-tree.cjs.entry.js +140 -64
- package/dist/cjs/kup-form.cjs.entry.js +21 -15
- package/dist/cjs/kup-iframe.cjs.entry.js +4 -5
- package/dist/cjs/kup-image-list.cjs.entry.js +10 -12
- package/dist/cjs/kup-lazy.cjs.entry.js +5 -6
- package/dist/cjs/kup-magic-box.cjs.entry.js +5 -6
- package/dist/cjs/{kup-manager-02acbb37.js → kup-manager-a8eecc60.js} +1419 -375
- package/dist/cjs/kup-nav-bar.cjs.entry.js +4 -5
- package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
- package/dist/cjs/kup-photo-frame.cjs.entry.js +4 -5
- package/dist/cjs/kup-probe.cjs.entry.js +2 -2
- package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
- package/dist/cjs/kup-snackbar.cjs.entry.js +6 -7
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/collection/assets/dashboard.js +48 -0
- package/dist/collection/assets/family-tree.js +236 -19
- package/dist/collection/assets/form.js +41 -0
- package/dist/collection/assets/index.js +4 -0
- package/dist/collection/assets/kupinteract.js +68 -0
- package/dist/collection/collection-manifest.json +5 -5
- package/dist/collection/components/kup-box/kup-box.js +5 -3
- package/dist/collection/components/kup-button/kup-button-declarations.js +1 -0
- package/dist/collection/components/kup-button/kup-button.js +27 -0
- package/dist/collection/components/kup-dashboard/kup-dashboard.css +7 -0
- package/dist/collection/components/kup-dashboard/kup-dashboard.js +67 -7
- package/dist/collection/components/kup-data-table/kup-data-table-helper.js +42 -30
- package/dist/collection/components/kup-data-table/kup-data-table.js +3 -1
- package/dist/collection/components/kup-echart/kup-echart.js +34 -24
- package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +3 -1
- package/dist/collection/components/kup-family-tree/kup-family-tree.css +79 -9
- package/dist/collection/components/kup-family-tree/kup-family-tree.js +253 -65
- package/dist/collection/components/kup-form/kup-form-declarations.js +1 -0
- package/dist/collection/components/kup-form/kup-form.css +8 -0
- package/dist/collection/components/kup-form/kup-form.js +31 -2
- package/dist/collection/components/kup-image/assets/svg/azure.svg +1 -0
- package/dist/collection/components/kup-lazy/kup-lazy.css +8 -2
- package/dist/collection/components/kup-progress-bar/kup-progress-bar.css +1 -0
- package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +1 -0
- package/dist/collection/components/kup-text-field/kup-text-field.js +27 -0
- package/dist/collection/f-components/f-button/f-button.js +2 -2
- package/dist/collection/f-components/f-cell/f-cell.js +1 -1
- package/dist/collection/f-components/f-text-field/f-text-field.js +11 -1
- package/dist/collection/managers/kup-data/kup-data-cell-helper.js +49 -15
- package/dist/collection/managers/kup-data/kup-data.js +9 -11
- package/dist/collection/managers/kup-dates/kup-dates.js +14 -0
- package/dist/collection/managers/kup-interact/kup-interact.js +3 -5
- package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.js +2 -0
- package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover.js +131 -45
- package/dist/collection/utils/filters/filters-rows.js +4 -23
- package/dist/collection/utils/filters/filters-tree-items.js +4 -3
- package/dist/esm/{f-button-fd44ef70.js → f-button-2d0a5f21.js} +4 -4
- package/dist/esm/{f-cell-7b159a22.js → f-cell-ee7d7b5c.js} +7 -9
- package/dist/esm/{f-checkbox-c51c4a75.js → f-checkbox-e06cf07b.js} +1 -1
- package/dist/esm/{f-chip-c2e4c522.js → f-chip-0d29f91f.js} +3 -3
- package/dist/esm/{f-image-2ab4b9aa.js → f-image-ab131d59.js} +2 -2
- package/dist/esm/{f-paginator-utils-ef537d82.js → f-paginator-utils-aa52af0f.js} +44 -366
- package/dist/esm/{f-text-field-41c575eb.js → f-text-field-0729b19f.js} +13 -3
- package/dist/esm/{index-ad6ab214.js → index-e41330a5.js} +9 -4
- package/dist/esm/ketchup.js +3 -3
- package/dist/esm/kup-accordion.entry.js +3 -4
- package/dist/esm/kup-autocomplete_25.entry.js +30 -16
- package/dist/esm/kup-box.entry.js +14 -14
- package/dist/esm/kup-calendar.entry.js +5 -7
- package/dist/esm/kup-cell.entry.js +7 -9
- package/dist/esm/kup-dash-list.entry.js +2 -4
- package/dist/esm/kup-dash_2.entry.js +2 -3
- package/dist/esm/kup-dashboard.entry.js +74 -15
- package/dist/esm/kup-drawer.entry.js +2 -3
- package/dist/esm/kup-echart.entry.js +36 -28
- package/dist/esm/kup-family-tree.entry.js +138 -62
- package/dist/esm/kup-form.entry.js +18 -12
- package/dist/esm/kup-iframe.entry.js +2 -3
- package/dist/esm/kup-image-list.entry.js +8 -10
- package/dist/esm/kup-lazy.entry.js +3 -4
- package/dist/esm/kup-magic-box.entry.js +3 -4
- package/dist/esm/{kup-manager-22a475e6.js → kup-manager-13b4f989.js} +1398 -376
- package/dist/esm/kup-nav-bar.entry.js +2 -3
- package/dist/esm/kup-numeric-picker.entry.js +3 -3
- package/dist/esm/kup-photo-frame.entry.js +2 -3
- package/dist/esm/kup-probe.entry.js +2 -2
- package/dist/esm/kup-qlik.entry.js +2 -2
- package/dist/esm/kup-snackbar.entry.js +4 -5
- package/dist/esm/loader.js +3 -3
- package/dist/ketchup/assets/svg/azure.svg +1 -0
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/p-0986ad5d.js +1 -0
- package/dist/ketchup/{p-38d7584e.js → p-0cf10db0.js} +1 -1
- package/dist/ketchup/p-13666119.entry.js +27 -0
- package/dist/ketchup/p-18b68e86.entry.js +1 -0
- package/dist/ketchup/{p-1959f835.entry.js → p-28d514d0.entry.js} +1 -1
- package/dist/ketchup/p-2ffdbee1.entry.js +1 -0
- package/dist/ketchup/p-3dcfffbe.entry.js +1 -0
- package/dist/ketchup/p-3fe35411.entry.js +1 -0
- package/dist/ketchup/{p-cd5cfa7c.js → p-5552f156.js} +1 -1
- package/dist/ketchup/p-5f51009b.entry.js +1 -0
- package/dist/ketchup/{p-264b1b19.entry.js → p-816f0938.entry.js} +1 -1
- package/dist/ketchup/p-83c214d7.entry.js +1 -0
- package/dist/ketchup/p-84957bbf.entry.js +1 -0
- package/dist/ketchup/p-86795579.entry.js +1 -0
- package/dist/ketchup/p-8f85b8bb.entry.js +9 -0
- package/dist/ketchup/p-982d3e3a.entry.js +1 -0
- package/dist/ketchup/{p-e9366aaf.entry.js → p-adcfcd4f.entry.js} +4 -4
- package/dist/ketchup/p-b0b3989b.js +2 -0
- package/dist/ketchup/{p-dc62a30f.js → p-b705be3b.js} +1 -1
- package/dist/ketchup/{p-fc2b1229.js → p-b8c921ee.js} +3 -3
- package/dist/ketchup/{p-edae3076.js → p-bfe88b03.js} +1 -1
- package/dist/ketchup/p-d7091875.entry.js +1 -0
- package/dist/ketchup/p-d8656956.entry.js +1 -0
- package/dist/ketchup/p-dc69549c.entry.js +1 -0
- package/dist/ketchup/p-e01fa411.entry.js +1 -0
- package/dist/ketchup/p-e0f659c9.entry.js +1 -0
- package/dist/ketchup/p-e1d82570.entry.js +1 -0
- package/dist/ketchup/p-e21c744a.js +1 -0
- package/dist/ketchup/p-e5a9d60a.entry.js +1 -0
- package/dist/ketchup/p-f50cbed9.js +1 -0
- package/dist/ketchup/{p-42080355.entry.js → p-fa9f161a.entry.js} +1 -1
- package/dist/types/components/kup-box/kup-box-declarations.d.ts +1 -0
- package/dist/types/components/kup-button/kup-button-declarations.d.ts +1 -0
- package/dist/types/components/kup-button/kup-button.d.ts +5 -0
- package/dist/types/components/kup-dashboard/kup-dashboard.d.ts +6 -1
- package/dist/types/components/kup-family-tree/kup-family-tree-declarations.d.ts +7 -3
- package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +26 -5
- package/dist/types/components/kup-form/kup-form-declarations.d.ts +1 -0
- package/dist/types/components/kup-form/kup-form.d.ts +5 -0
- package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +1 -0
- package/dist/types/components/kup-text-field/kup-text-field.d.ts +5 -0
- package/dist/types/components.d.ts +69 -7
- package/dist/types/f-components/f-button/f-button-declarations.d.ts +1 -0
- package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +1 -0
- package/dist/types/managers/kup-data/kup-data-cell-helper.d.ts +13 -6
- package/dist/types/managers/kup-data/kup-data.d.ts +3 -1
- package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.d.ts +9 -1
- package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover.d.ts +7 -5
- package/dist/types/utils/filters/filters-rows.d.ts +0 -2
- package/dist/types/utils/filters/filters-tree-items.d.ts +1 -1
- package/package.json +2 -2
- package/dist/cjs/cell-utils-fe64a28c.js +0 -168
- package/dist/cjs/utils-4b208b48.js +0 -447
- package/dist/esm/cell-utils-cb5d4149.js +0 -160
- package/dist/esm/utils-2c1f4122.js +0 -428
- package/dist/ketchup/p-06c6cc68.js +0 -1
- package/dist/ketchup/p-0dacd4bc.entry.js +0 -1
- package/dist/ketchup/p-1c44dc62.entry.js +0 -1
- package/dist/ketchup/p-4bc9f98b.entry.js +0 -1
- package/dist/ketchup/p-578583db.entry.js +0 -1
- package/dist/ketchup/p-5866d507.entry.js +0 -1
- package/dist/ketchup/p-61059e9d.entry.js +0 -9
- package/dist/ketchup/p-664be494.entry.js +0 -1
- package/dist/ketchup/p-67cd575d.entry.js +0 -1
- package/dist/ketchup/p-682a367a.js +0 -1
- package/dist/ketchup/p-6ccf7eb2.entry.js +0 -1
- package/dist/ketchup/p-7230ab97.entry.js +0 -1
- package/dist/ketchup/p-752b4cef.entry.js +0 -1
- package/dist/ketchup/p-7de3e7ac.entry.js +0 -1
- package/dist/ketchup/p-928c5c36.js +0 -1
- package/dist/ketchup/p-9b36497d.entry.js +0 -1
- package/dist/ketchup/p-b982d137.entry.js +0 -1
- package/dist/ketchup/p-c0219e5e.js +0 -1
- package/dist/ketchup/p-c55fd0a7.entry.js +0 -1
- package/dist/ketchup/p-d154b3a0.entry.js +0 -1
- package/dist/ketchup/p-d2affb6f.entry.js +0 -27
- package/dist/ketchup/p-d3b542b3.js +0 -2
- package/dist/ketchup/p-d6c12c6c.js +0 -1
- package/dist/ketchup/p-da0eab60.entry.js +0 -1
|
@@ -1,428 +0,0 @@
|
|
|
1
|
-
import { r as KupDatesNormalize, d as KupDatesFormats } from './kup-manager-22a475e6.js';
|
|
2
|
-
|
|
3
|
-
const dom = document.documentElement;
|
|
4
|
-
var DateTimeFormatOptionsMonth;
|
|
5
|
-
(function (DateTimeFormatOptionsMonth) {
|
|
6
|
-
DateTimeFormatOptionsMonth["NUMERIC"] = "numeric";
|
|
7
|
-
DateTimeFormatOptionsMonth["DIGIT2"] = "2-digit";
|
|
8
|
-
DateTimeFormatOptionsMonth["LONG"] = "long";
|
|
9
|
-
DateTimeFormatOptionsMonth["SHORT"] = "short";
|
|
10
|
-
DateTimeFormatOptionsMonth["NARROW"] = "narrow";
|
|
11
|
-
})(DateTimeFormatOptionsMonth || (DateTimeFormatOptionsMonth = {}));
|
|
12
|
-
function identify(array) {
|
|
13
|
-
if (array) {
|
|
14
|
-
for (let i = 0; i < array.length; i++) {
|
|
15
|
-
array[i].id = i.toString();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function getSeparator(locale, separatorType) {
|
|
20
|
-
const numberWithGroupAndDecimalSeparator = 1000.1;
|
|
21
|
-
return Intl.NumberFormat(locale)
|
|
22
|
-
.formatToParts(numberWithGroupAndDecimalSeparator)
|
|
23
|
-
.find((part) => part.type === separatorType).value;
|
|
24
|
-
}
|
|
25
|
-
function getCurrentTimeFormatFromBrowserLocale(manageSeconds) {
|
|
26
|
-
const options = {
|
|
27
|
-
hour: '2-digit',
|
|
28
|
-
minute: '2-digit',
|
|
29
|
-
hour12: false,
|
|
30
|
-
};
|
|
31
|
-
if (manageSeconds == true) {
|
|
32
|
-
options.second = '2-digit';
|
|
33
|
-
}
|
|
34
|
-
const formatObj = new Intl.DateTimeFormat(dom.ketchup.dates.getLocale() + '-u-hc-h23', options).formatToParts(new Date());
|
|
35
|
-
let timeFormat = formatObj
|
|
36
|
-
.map((obj) => {
|
|
37
|
-
switch (obj.type) {
|
|
38
|
-
case 'hour':
|
|
39
|
-
return 'HH';
|
|
40
|
-
case 'minute':
|
|
41
|
-
return 'mm';
|
|
42
|
-
case 'second':
|
|
43
|
-
return 'ss';
|
|
44
|
-
default:
|
|
45
|
-
return obj.value;
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
.join('');
|
|
49
|
-
return timeFormat;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* @param value number as string, formatted by actual browser locale
|
|
53
|
-
* @param type - type of number for calculate suffix
|
|
54
|
-
* @returns true if number string in input is a valid number
|
|
55
|
-
*/
|
|
56
|
-
function isValidFormattedStringNumber(value, type) {
|
|
57
|
-
if (value == null || value.trim() == '') {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
let tmpStr = formattedStringToUnformattedStringNumber(value, type);
|
|
61
|
-
if (isNumber(tmpStr)) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
function isNumber(value) {
|
|
67
|
-
//return typeof value === 'number';
|
|
68
|
-
return !isNaN(value);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers)
|
|
72
|
-
* @returns number
|
|
73
|
-
**/
|
|
74
|
-
function stringToNumber(input) {
|
|
75
|
-
if (!input || input == null || input.trim() == '') {
|
|
76
|
-
input = '0';
|
|
77
|
-
}
|
|
78
|
-
return dom.ketchup.math.numberify(input);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @param input number
|
|
82
|
-
* @param decimals number of significant decimal digits for output
|
|
83
|
-
* @returns number as string, formatted by actual browser locale
|
|
84
|
-
**/
|
|
85
|
-
function numberToString(input, decimals) {
|
|
86
|
-
if (input == null) {
|
|
87
|
-
return '';
|
|
88
|
-
}
|
|
89
|
-
return _numberToString(input, decimals, dom.ketchup.dates.getLocale(), true);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* @param type - type of number for calculate suffix
|
|
93
|
-
* @returns suffix for number, by type
|
|
94
|
-
**/
|
|
95
|
-
function getNumericValueSuffixByType(type) {
|
|
96
|
-
type = type.toUpperCase();
|
|
97
|
-
let nstr = '';
|
|
98
|
-
if (type == 'P') {
|
|
99
|
-
nstr = ' %';
|
|
100
|
-
}
|
|
101
|
-
else if (type == 'VE') {
|
|
102
|
-
nstr = ' €';
|
|
103
|
-
}
|
|
104
|
-
else if (type == 'VL') {
|
|
105
|
-
nstr = ' £';
|
|
106
|
-
}
|
|
107
|
-
else if (type == 'VV') {
|
|
108
|
-
nstr = ' $';
|
|
109
|
-
}
|
|
110
|
-
return nstr;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* @param input number
|
|
114
|
-
* @param decimals number of significant decimal digits for output
|
|
115
|
-
* @param type - type of number for calculate suffix
|
|
116
|
-
* @returns number as string, formatted by actual browser locale, with suffix by type
|
|
117
|
-
**/
|
|
118
|
-
function numberToFormattedStringNumber(input, decimals, type) {
|
|
119
|
-
if (input == null || isNaN(input)) {
|
|
120
|
-
return '';
|
|
121
|
-
}
|
|
122
|
-
let nstr = numberToString(input, decimals);
|
|
123
|
-
nstr = nstr + getNumericValueSuffixByType(type);
|
|
124
|
-
return nstr;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers)
|
|
128
|
-
* @param decimals number of significant decimal digits for output
|
|
129
|
-
* @param type - type of number for calculate suffix
|
|
130
|
-
* @returns number as string, formatted by actual browser locale, with suffix by type
|
|
131
|
-
**/
|
|
132
|
-
function unformattedStringToFormattedStringNumber(input, decimals, type) {
|
|
133
|
-
return numberToFormattedStringNumber(stringToNumber(input), decimals, type);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* @param input number as string, formatted by actual browser locale
|
|
137
|
-
* @param type - type of number for calculate suffix
|
|
138
|
-
* @returns number as string, formatted by locale US, decimal separator . (like java decimal numbers), without group separator
|
|
139
|
-
**/
|
|
140
|
-
function formattedStringToUnformattedStringNumber(input, type) {
|
|
141
|
-
return numberStringToNumberString(input, type, getDecimalSeparator(dom.ketchup.dates.getLocale()));
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers), with group separator
|
|
145
|
-
* @param type - type of number for calculate suffix
|
|
146
|
-
* @returns number as string, formatted by locale US, decimal separator . (like java decimal numbers), without group separator
|
|
147
|
-
**/
|
|
148
|
-
function unformattedStringNumberToNumber(input, type) {
|
|
149
|
-
return numberStringToNumberString(input, type, '.');
|
|
150
|
-
}
|
|
151
|
-
function numberStringToNumberString(input, type, decFmt) {
|
|
152
|
-
if (input == null || input.trim() == '') {
|
|
153
|
-
return '';
|
|
154
|
-
}
|
|
155
|
-
let originalInputValue = input;
|
|
156
|
-
let suffix = getNumericValueSuffixByType(type);
|
|
157
|
-
if (suffix != '') {
|
|
158
|
-
input = input.replace(suffix, '');
|
|
159
|
-
}
|
|
160
|
-
let regExpr = null;
|
|
161
|
-
if (decFmt == '.') {
|
|
162
|
-
regExpr = /,/g;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
regExpr = /\./g;
|
|
166
|
-
}
|
|
167
|
-
input = input.replace(regExpr, '');
|
|
168
|
-
if (decFmt != '.') {
|
|
169
|
-
input = input.replace(/,/g, '.');
|
|
170
|
-
}
|
|
171
|
-
if (dom.ketchup.math.numberify(input) == null ||
|
|
172
|
-
isNaN(dom.ketchup.math.numberify(input))) {
|
|
173
|
-
return originalInputValue;
|
|
174
|
-
}
|
|
175
|
-
let unf = stringToNumber(input);
|
|
176
|
-
return _numberToString(unf, -1, 'en-US', false);
|
|
177
|
-
}
|
|
178
|
-
function getDecimalSeparator(locale) {
|
|
179
|
-
return getSeparator(locale, 'decimal');
|
|
180
|
-
}
|
|
181
|
-
function countDecimals(value) {
|
|
182
|
-
if (Math.floor(value) === value)
|
|
183
|
-
return 0;
|
|
184
|
-
let stringValue = value.toString().split('.')[1];
|
|
185
|
-
if (stringValue) {
|
|
186
|
-
return stringValue.length ? stringValue.length : 0;
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
return 0;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function _numberToString(input, decimals, locale, useGrouping) {
|
|
193
|
-
if (input == null) {
|
|
194
|
-
input = 0;
|
|
195
|
-
}
|
|
196
|
-
if (decimals == null || decimals == -1) {
|
|
197
|
-
decimals = countDecimals(input);
|
|
198
|
-
}
|
|
199
|
-
let n = Number(input);
|
|
200
|
-
let f = decimals > -1
|
|
201
|
-
? {
|
|
202
|
-
minimumFractionDigits: decimals,
|
|
203
|
-
maximumFractionDigits: decimals,
|
|
204
|
-
useGrouping: useGrouping,
|
|
205
|
-
}
|
|
206
|
-
: { useGrouping: useGrouping };
|
|
207
|
-
return n.toLocaleString(locale, f);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* @param time time as Date object
|
|
211
|
-
* @param manageSeconds flag to set seconds managing
|
|
212
|
-
* @return time as string, formatted
|
|
213
|
-
**/
|
|
214
|
-
function formatTime(time, manageSeconds) {
|
|
215
|
-
const options = {
|
|
216
|
-
hour: '2-digit',
|
|
217
|
-
minute: '2-digit',
|
|
218
|
-
hour12: false,
|
|
219
|
-
};
|
|
220
|
-
if (manageSeconds == true) {
|
|
221
|
-
options.second = '2-digit';
|
|
222
|
-
}
|
|
223
|
-
return time.toLocaleTimeString(dom.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* @param value time string, formatted by actual browser locale
|
|
227
|
-
* @returns true if time string in input is a valid time
|
|
228
|
-
*/
|
|
229
|
-
function isValidFormattedStringTime(value, manageSeconds) {
|
|
230
|
-
let format = getCurrentTimeFormatFromBrowserLocale(manageSeconds);
|
|
231
|
-
return dom.ketchup.dates.isValid(value, format, true);
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* @param value date/time as string, formatted by actual browser locale
|
|
235
|
-
* @returns date/time as string, formatted ISO
|
|
236
|
-
**/
|
|
237
|
-
function formattedStringToDefaultUnformattedStringTimestamp(value) {
|
|
238
|
-
return formattedStringToCustomUnformattedStringTime(value, KupDatesFormats.ISO_DATE_TIME, true);
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* @param value time as string, formatted by actual browser locale
|
|
242
|
-
* @param outputFormat time format to return
|
|
243
|
-
* @param manageSeconds flag to set seconds managing
|
|
244
|
-
* @returns time as string, formatted
|
|
245
|
-
**/
|
|
246
|
-
function formattedStringToCustomUnformattedStringTime(value, outputFormat, manageSeconds) {
|
|
247
|
-
let inputFormat = getCurrentTimeFormatFromBrowserLocale(manageSeconds);
|
|
248
|
-
if (dom.ketchup.dates.isValid(value, inputFormat)) {
|
|
249
|
-
return dom.ketchup.dates.format(dom.ketchup.dates.normalize(value, KupDatesNormalize.TIME), outputFormat);
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
return '';
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* @param value time as string, formatted ISO
|
|
257
|
-
* @param manageSeconds flag to set seconds managing
|
|
258
|
-
* @param valueTimeFormat time format (default ISO)
|
|
259
|
-
* @param customedFormat time format from smeupObject
|
|
260
|
-
* @returns time as string, formatted by actual browser locale
|
|
261
|
-
**/
|
|
262
|
-
function unformattedStringToFormattedStringTime(value, manageSeconds, customedFormat) {
|
|
263
|
-
const options = {
|
|
264
|
-
hour: '2-digit',
|
|
265
|
-
minute: '2-digit',
|
|
266
|
-
hour12: false,
|
|
267
|
-
};
|
|
268
|
-
if (manageSeconds == true) {
|
|
269
|
-
options.second = '2-digit';
|
|
270
|
-
}
|
|
271
|
-
let date = dom.ketchup.dates.toDate(dom.ketchup.dates.normalize(value, KupDatesNormalize.TIME));
|
|
272
|
-
return formatByCustomedOutputTimeFormat(value, date, options, customedFormat);
|
|
273
|
-
}
|
|
274
|
-
function formatByCustomedOutputTimeFormat(valueStr, date, options, customedFormat) {
|
|
275
|
-
if (customedFormat == null) {
|
|
276
|
-
return date.toLocaleTimeString(dom.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
277
|
-
}
|
|
278
|
-
switch (customedFormat) {
|
|
279
|
-
case 'I13': {
|
|
280
|
-
//hh:mm
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
case 'I12': {
|
|
284
|
-
//hh:mm:ss
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
case 'I11': {
|
|
288
|
-
//???
|
|
289
|
-
//hh:dddd
|
|
290
|
-
//return moment(date).format('HH:DDDD');
|
|
291
|
-
return valueStr;
|
|
292
|
-
}
|
|
293
|
-
case 'I14': {
|
|
294
|
-
//???
|
|
295
|
-
//sssss
|
|
296
|
-
//return moment(date).format('SSSSS');
|
|
297
|
-
return valueStr;
|
|
298
|
-
}
|
|
299
|
-
case 'I1H': {
|
|
300
|
-
//???
|
|
301
|
-
//Ora,Cen/Min HH,xx
|
|
302
|
-
return valueStr;
|
|
303
|
-
}
|
|
304
|
-
case 'I1M': {
|
|
305
|
-
//???
|
|
306
|
-
//Min,Cen/Sec MMMM,xx
|
|
307
|
-
return valueStr;
|
|
308
|
-
}
|
|
309
|
-
case 'I21': {
|
|
310
|
-
//???
|
|
311
|
-
//Giorni,(4 decim)
|
|
312
|
-
return valueStr;
|
|
313
|
-
}
|
|
314
|
-
case 'I22': {
|
|
315
|
-
//???
|
|
316
|
-
//Ore,(4 decim)
|
|
317
|
-
return valueStr;
|
|
318
|
-
}
|
|
319
|
-
case 'I23': {
|
|
320
|
-
//???
|
|
321
|
-
//Minuti,(4 decim)
|
|
322
|
-
return valueStr;
|
|
323
|
-
}
|
|
324
|
-
case 'I24': {
|
|
325
|
-
//???
|
|
326
|
-
//Secondi
|
|
327
|
-
return valueStr;
|
|
328
|
-
}
|
|
329
|
-
case 'I2H': {
|
|
330
|
-
//???
|
|
331
|
-
//Ora,Cen/Min HHHH,xx
|
|
332
|
-
return valueStr;
|
|
333
|
-
}
|
|
334
|
-
case 'I2D': {
|
|
335
|
-
//???
|
|
336
|
-
//Ore Minuti Secondi HHMMS
|
|
337
|
-
return valueStr;
|
|
338
|
-
}
|
|
339
|
-
case 'I2M': {
|
|
340
|
-
//???
|
|
341
|
-
//Min,Cen/Sec MMMM,xx
|
|
342
|
-
return valueStr;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
return date.toLocaleTimeString(dom.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* @param value date/time as string, formatted ISO
|
|
349
|
-
* @param valueDateFormat date/time format (default ISO)
|
|
350
|
-
* @returns date/time as string, formatted by actual browser locale
|
|
351
|
-
**/
|
|
352
|
-
function unformattedStringToFormattedStringTimestamp(value) {
|
|
353
|
-
const options = {
|
|
354
|
-
day: '2-digit',
|
|
355
|
-
month: '2-digit',
|
|
356
|
-
year: 'numeric',
|
|
357
|
-
hour: '2-digit',
|
|
358
|
-
minute: '2-digit',
|
|
359
|
-
second: '2-digit',
|
|
360
|
-
hour12: false,
|
|
361
|
-
};
|
|
362
|
-
let date = dom.ketchup.dates.toDate(dom.ketchup.dates.normalize(value, KupDatesNormalize.TIMESTAMP));
|
|
363
|
-
return date.toLocaleString(dom.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
364
|
-
}
|
|
365
|
-
function getMonthAsStringByLocale(month, format) {
|
|
366
|
-
if (month == null) {
|
|
367
|
-
return '';
|
|
368
|
-
}
|
|
369
|
-
const dateTmp = new Date();
|
|
370
|
-
dateTmp.setDate(1);
|
|
371
|
-
dateTmp.setMonth(month - 1);
|
|
372
|
-
const options = {
|
|
373
|
-
month: format,
|
|
374
|
-
};
|
|
375
|
-
const dateTimeFormat = new Intl.DateTimeFormat(dom.ketchup.dates.getLocale(), options);
|
|
376
|
-
return dateTimeFormat.format(dateTmp);
|
|
377
|
-
}
|
|
378
|
-
function getMonthsAsStringByLocale(format) {
|
|
379
|
-
if (format == null || format.trim() == '') {
|
|
380
|
-
format = DateTimeFormatOptionsMonth.LONG;
|
|
381
|
-
}
|
|
382
|
-
var months = [];
|
|
383
|
-
for (var i = 0; i < 12; i++) {
|
|
384
|
-
months[i] = getMonthAsStringByLocale(i + 1, format);
|
|
385
|
-
}
|
|
386
|
-
return months;
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Used to retrieve component's props values.
|
|
390
|
-
* @param {any} comp - Component calling this function.
|
|
391
|
-
* @param {GenericObject} list - Prop list, specific for each component.
|
|
392
|
-
* @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
|
|
393
|
-
* @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
|
|
394
|
-
*/
|
|
395
|
-
function getProps(comp, list, descriptions) {
|
|
396
|
-
let props = {};
|
|
397
|
-
if (descriptions) {
|
|
398
|
-
props = list;
|
|
399
|
-
}
|
|
400
|
-
else {
|
|
401
|
-
for (const key in list) {
|
|
402
|
-
if (Object.prototype.hasOwnProperty.call(list, key)) {
|
|
403
|
-
props[key] = comp[key];
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
return props;
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Sets the props to the component.
|
|
411
|
-
* @param {any} comp - Component calling this function.
|
|
412
|
-
* @param {GenericObject} list - Prop list, specific for each component.
|
|
413
|
-
* @param {GenericObject} props - Prop to be set.
|
|
414
|
-
*/
|
|
415
|
-
function setProps(comp, list, props) {
|
|
416
|
-
for (const key in props) {
|
|
417
|
-
// If key is a custom prop it will be set on the component (i.e.: "data", "customStyle", ecc.)
|
|
418
|
-
if (list[key]) {
|
|
419
|
-
comp[key] = props[key];
|
|
420
|
-
}
|
|
421
|
-
else {
|
|
422
|
-
// Otherwise, it will be set on its HTML element (i.e.: "id", "style", ecc.)
|
|
423
|
-
comp.rootElement[key] = props[key];
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
export { DateTimeFormatOptionsMonth as D, getMonthsAsStringByLocale as a, isValidFormattedStringTime as b, formatTime as c, unformattedStringToFormattedStringTime as d, unformattedStringToFormattedStringTimestamp as e, formattedStringToCustomUnformattedStringTime as f, getProps as g, stringToNumber as h, identify as i, formattedStringToDefaultUnformattedStringTimestamp as j, isValidFormattedStringNumber as k, formattedStringToUnformattedStringNumber as l, unformattedStringNumberToNumber as m, numberToFormattedStringNumber as n, isNumber as o, getDecimalSeparator as p, setProps as s, unformattedStringToFormattedStringNumber as u };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Y as e,Z as c,b as t,_ as a,W as s,$ as n,a0 as l,a1 as i,a2 as r}from"./p-fc2b1229.js";import{h as u}from"./p-d3b542b3.js";import{c as o}from"./p-d6c12c6c.js";import{F as p}from"./p-cd5cfa7c.js";import{F as b}from"./p-edae3076.js";import{h as k}from"./p-682a367a.js";import{F as d}from"./p-38d7584e.js";import{a as h}from"./p-dc62a30f.js";const f=e=>u("div",Object.assign({class:`f-switch ${e.danger?"kup-danger":""} ${e.info?"kup-info":""} ${e.secondary?"kup-secondary":""} ${e.success?"kup-success":""} ${e.warning?"kup-warning":""} ${e.wrapperClass?e.wrapperClass:""}`},e.dataSet,{id:e.id,title:e.title}),u("div",{class:"form-field "+(e.leadingLabel?"form-field--align-end":"")},u("div",{class:`switch ${e.checked?"switch--checked":""} ${e.disabled?"switch--disabled":""}`},u("div",{class:"switch__track"}),u("div",{class:"switch__thumb-underlay"},u("div",{class:"switch__thumb"},u("input",{type:"checkbox",class:"switch__native-control",role:"switch",checked:e.checked,disabled:e.disabled,value:e.checked?"on":"off",onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus})))),u("label",{onClick:e.onChange},e.label))),m=document.documentElement,j=(n,i)=>{const j=n.cell,_=n.column,v=n.row,x=n.shape?n.shape:j.shape?j.shape:_.shape?_.shape:null,$=!m.ketchup.objects.isEmptyKupObj(j.obj),y=!(!j.isEditable||!n.editable),C=n.previousValue!==j.value?j.value:"",z=m.ketchup.data.cell.getType(j,x),F=Object.assign({},j.data);let V=j.cssClass?j.cssClass:_.cssClass?_.cssClass:"";const H={"f-cell":!0,[l.OBJ]:!!$,[z+"-cell"]:!0,[n.wrapperClass]:!!n.wrapperClass,[n.density]:!(!n.density||z===a.BAR),[V]:!!V};let Y=C;y&&e.includes(z)?Y=function(e,c,t,s,n){switch(e){case a.AUTOCOMPLETE:return u("kup-autocomplete",Object.assign({initialValue:t.value},t.data,{class:O(n)?"kup-full-width":"","onkup-autocomplete-change":c=>w(c,n,e,r.UPDATE),"onkup-autocomplete-input":c=>w(c,n,e,r.INPUT),"onkup-autocomplete-iconclick":c=>w(c,n,e,r.ICON_CLICK)}));case a.CHECKBOX:return g(n)&&(c[l.C_CENTERED]=!0),u(p,Object.assign({},t.data,{onChange:c=>w(c,n,e,r.UPDATE)}));case a.COLOR_PICKER:return u("kup-color-picker",Object.assign({initialValue:t.value},t.data,{class:O(n)?"kup-full-width":"",disabled:!1,"onkup-colorpicker-change":c=>w(c,n,e,r.UPDATE)}));case a.COMBOBOX:return u("kup-combobox",Object.assign({initialValue:t.value},t.data,{class:O(n)?"kup-full-width":"","onkup-combobox-change":c=>w(c,n,e,r.UPDATE),"onkup-combobox-input":c=>w(c,n,e,r.INPUT),"onkup-combobox-iconclick":c=>w(c,n,e,r.ICON_CLICK)}));case a.DATE:return u("kup-date-picker",Object.assign({initialValue:t.value},t.data,{class:O(n)?"kup-full-width":"","onkup-datepicker-change":c=>w(c,n,e,r.UPDATE),"onkup-datepicker-input":c=>w(c,n,e,r.INPUT)}));case a.RATING:return u("kup-rating",Object.assign({},t.data,{disabled:!1,"onkup-rating-click":c=>w(c,n,e,r.UPDATE)}));case a.SWITCH:return u(f,Object.assign({},t.data,{disabled:!1,onChange:c=>w(c,n,e,r.UPDATE)}));case a.TIME:return u("kup-time-picker",Object.assign({initialValue:t.value},t.data,{class:O(n)?"kup-full-width":"","onkup-timepicker-change":c=>w(c,n,e,r.UPDATE),"onkup-timepicker-input":c=>w(c,n,e,r.INPUT)}));case a.NUMBER:c[l.C_RIGHT_ALIGNED]=!0;case a.STRING:return u(b,Object.assign({},t.data,{icon:t.icon?t.icon:s.icon?s.icon:null,fullWidth:!!O(n),inputType:e===a.NUMBER?"number":null,value:e===a.NUMBER?k(t.value).toString():t.value,onChange:c=>w(c,n,e,r.UPDATE),onInput:c=>w(c,n,e,r.INPUT),onIconClick:c=>w(c,n,e,r.ICON_CLICK)}))}}(z,H,j,_,n):j.data&&c.includes(z)?(n.setSizes&&function(e,c,t){switch(e){case a.BAR:c.sizeY||(c.sizeY="26px");break;case a.BUTTON:let e="";c.label&&(e="36px"),t.style?t.style.height||(t.style.minHeight=e):t.style={minHeight:e};break;case a.CHART:c.sizeX||(c.sizeX="100%"),c.sizeY||(c.sizeY="100%");break;case a.CHIP:case a.RADIO:t.style?t.style.height||(t.style.minHeight="40px"):t.style={minHeight:"40px"}}}(z,F,j),Y=n.renderKup?function(e,c,t,s,n,i,o){switch(e){case a.BAR:return t.data?u("div",{style:{height:t.sizeY,width:"100%"}},u(d,Object.assign({},t))):u("kup-image",Object.assign({},t));case a.BUTTON:return g(o)&&(c[l.C_CENTERED]=!0),u("kup-button",Object.assign({},t,{"onkup-button-click":c=>w(c,o,e,r.CLICK)}));case a.BUTTON_LIST:return g(o)&&(c[l.C_CENTERED]=!0),t["data-storage"]={cell:s,row:n,column:i},u("kup-button-list",Object.assign({},t));case a.CHART:return g(o)&&(c[l.C_CENTERED]=!0),u("kup-chart",Object.assign({},t));case a.CHIP:return u(h,Object.assign({},t));case a.COLOR_PICKER:return u("kup-color-picker",Object.assign({},t,{class:O(o)?"kup-full-width":"",disabled:!0}));case a.GAUGE:return u("kup-gauge",Object.assign({value:k(s.value),"width-component":"280px"},t));case a.KNOB:case a.PROGRESS_BAR:return u("kup-progress-bar",Object.assign({},t));case a.RADIO:return g(o)&&(c[l.C_CENTERED]=!0),t.disabled=n.readOnly,u("kup-radio",Object.assign({},t));case a.RATING:return u("kup-rating",Object.assign({},t,{disabled:!0}))}}(z,H,F,j,v,_,n):u("span",{class:"cell-"+z+" placeholder"})):(n.setSizes&&function(e,c,t,n){switch(e){case a.CHECKBOX:case a.ICON:c.sizeX||(c.sizeX="18px"),c.sizeY||(c.sizeY="18px"),t.style?t.style.height||(t.style.minHeight=c.sizeY):t.style={minHeight:c.sizeY};break;case a.IMAGE:n.component.rootElement.tagName===s.BOX?(c.sizeY||(c.sizeY="auto"),void 0===c.fit&&(c.fit=!0)):c.sizeX||(c.sizeX="auto"),c.sizeY||(c.sizeY="64px")}}(z,F,j,n),Y=function(e,c,t,s,n,i,r){switch(e){case a.AUTOCOMPLETE:case a.COMBOBOX:case a.DATE:case a.DATETIME:case a.TIME:if(t&&""!=t){const e=o(i,n);return u("div",{class:"f-cell__text"},e)}return t;case a.CHECKBOX:return g(r)&&(s[l.C_CENTERED]=!0),u(d,{resource:c.checked?"check_box":"check_box_outline_blank",sizeX:"18px",sizeY:"18px"});case a.EDITOR:return u("div",{innerHTML:n.value});case a.ICON:case a.IMAGE:return g(r)&&(s[l.C_CENTERED]=!0),c.badgeData&&(s[l.C_PADDED]=!0),u(d,Object.assign({},c));case a.LINK:return u("a",{href:t,target:"_blank"},n.value);case a.NUMBER:if(t&&""!=t){const e=k(n.value),c=o(i,n);return e<0&&(s[l.TEXT_DANGER]=!0),g(r)&&(s[l.C_RIGHT_ALIGNED]=!0),u("div",{class:"f-cell__text"},c)}return u("div",{class:"f-cell__text"},t);case a.SWITCH:return g(r)&&(s[l.C_CENTERED]=!0),c.disabled=!0,u(f,Object.assign({},c));default:return u("div",{class:"f-cell__text"},t)}}(z,F,Y,H,j,_,n));let I=null;!y&&(_.icon||j.icon)&&Y&&(I=u(d,Object.assign({},{color:`rgba(var(${t.TEXT}-rgb), 0.375)`,resource:j.icon?j.icon:_.icon,sizeX:"1.25em",sizeY:"1.25em",wrapperClass:"obj-icon"})));let T=null;m.ketchup.debug.isDebug()&&$?T=j.obj.t+"; "+j.obj.p+"; "+j.obj.k+";":null!=j.title&&""!=j.title.trim()&&(T=j.title);let X=null;if(j.info){const e=Object.assign({},j.info);e.color||(e.color=`var(${t.INFO})`),e.icon||(e.icon="info"),X=u(d,Object.assign({},{color:e.color,resource:e.icon,sizeX:"1.25em",sizeY:"1.25em",title:e.message?e.message:"",wrapperClass:"cell-info"}))}return u("div",{class:H,"kup-get-cell-props":()=>n,style:j.style},u("div",{class:"f-cell__content",style:j.styleContent,title:T},i&&i.length>0?i:[n.indents,X,I,Y]))};function w(e,c,t,s){const n=c.cell,l=c.column,i=c.component,u=c.row;let p="INPUT"===e.target.tagName?e.target.value:e.detail.value;if(s===r.UPDATE){switch(t){case a.AUTOCOMPLETE:case a.COMBOBOX:case a.DATE:case a.TIME:n.data&&(n.data.initialValue=p);break;case a.CHECKBOX:case a.SWITCH:p="on"===p?"0":"1",n.data&&(n.data.checked="0"!==p)}n.obj&&(n.obj.k=p.toString()),n.value=p.toString(),n.displayedValue=null,n.displayedValue=o(l,n)}if(i&&i.rootElement){const c=new CustomEvent(s,{bubbles:!0,cancelable:!0,composed:!0,detail:{comp:i,id:i.rootElement.id,cell:n,column:l,event:e,row:u,type:t}});i.rootElement.dispatchEvent(c);try{i.refresh()}catch(e){}}}function g(e){return i.includes(e.component.rootElement.tagName)}function O(e){return n.includes(e.component.rootElement.tagName)}export{j as F,f as a}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,c as r,f as c,h as i,H as a,g as n}from"./p-d3b542b3.js";import{k as t,b as e,K as d}from"./p-fc2b1229.js";import{g as p,s}from"./p-682a367a.js";import{F as l}from"./p-38d7584e.js";import{c as u}from"./p-97e8ea42.js";import{M as _}from"./p-81605f08.js";import"./p-79b0730b.js";var k;!function(o){o.customStyle="Custom style of the component. For more information: https://ketchup.smeup.com/ketchup-showcase/#/customization",o.data="Data of the accordion.",o.ripple="When enabled displays Material's ripple effect on item headers."}(k||(k={}));const h=class{constructor(c){o(this,c),this.kupAccordionItemSelected=r(this,"kup-accordion-itemselected",6),this.selectedItems=[],this.customStyle="",this.data=null,this.ripple=!0,this.kupManager=t(),this.slotsNames=[]}applyRipple(){const o=this.rootElement.shadowRoot;if(o&&this.ripple){const r=o.querySelectorAll(".mdc-ripple-surface:not(.mdc-ripple-upgraded)");if(r)for(let o=0;o<r.length;o++)_.attachTo(r[o])}}async collapseAll(){const o=[];for(let r=0;r<this.data.columns.length;r++){const c=this.data.columns[r].name;!this.isItemExpandible(c)&&this.isItemSelected(c)&&o.push(c)}this.selectedItems=o}async expandAll(){const o=[];for(let r=0;r<this.data.columns.length;r++){const c=this.data.columns[r].name;this.isItemExpandible(c)&&o.push(c)}this.selectedItems=o}async getProps(o){return p(this,k,o)}async refresh(){c(this)}async setProps(o){s(this,k,o)}async toggleItem(o){const r=this.isItemExpandible(o),c=[...this.selectedItems];c.includes(o)?c.splice(c.indexOf(o),1):c.push(o),this.selectedItems=c,r||this.kupAccordionItemSelected.emit({comp:this,id:this.rootElement.id,itemName:o})}isItemExpandible(o){return this.slotsNames.includes(o)}isItemSelected(o){return this.selectedItems.includes(o)}renderItems(){const o=[],r=Array.prototype.slice.call(this.rootElement.children,0);this.slotsNames=[];for(let o=0;o<r.length;o++)this.slotsNames.push(r[o].slot);for(let r=0;r<this.data.columns.length;r++){const c=this.data.columns[r],a=c.name,n=this.isItemSelected(a),t=this.isItemExpandible(a),p={"accordion-item__content":!0,"accordion-item__content--selected":!!n};o.push(i("div",{class:"accordion-item"},i("div",{title:c.title,class:{"accordion-item__header":!0,"accordion-item__header--selected":!(t||!n),"accordion-item__header--expanded":!(!t||!n),"mdc-ripple-surface":!!this.ripple},onClick:()=>this.toggleItem(a)},c.icon?i(l,{color:`var(${e.ICON})`,resource:c.icon,sizeX:"1.5em",sizeY:"1.5em",wrapperClass:"accordion-item__icon"}):null,i("span",{class:"accordion-item__text"},c.title),t?i("span",{class:`accordion-item__dropdown kup-icon ${d.DROPDOWN.replace("--","")}`}):null),i("div",{class:p},i("slot",{name:c.name}))))}return o}componentWillLoad(){this.kupManager.debug.logLoad(this,!1),this.kupManager.theme.register(this)}componentDidLoad(){this.applyRipple(),this.kupManager.debug.logLoad(this,!0)}componentWillRender(){this.kupManager.debug.logRender(this,!1)}componentDidRender(){const o=this.rootElement.shadowRoot;if(o){const r=o.querySelectorAll(".mdc-ripple-surface");if(r)for(let o=0;o<r.length;o++)_.attachTo(r[o])}this.kupManager.debug.logRender(this,!0)}render(){const o=this.data&&this.data.columns?this.renderItems():null;return i(a,null,i("style",null,this.kupManager.theme.setKupStyle(this.rootElement)),i("div",{id:u},i("div",{class:"accordion"},o)))}disconnectedCallback(){this.kupManager.theme.unregister(this)}get rootElement(){return n(this)}static get watchers(){return{ripple:["applyRipple"]}}};h.style=":host{--kup_accordion_background_color:var(\n --kup-accordion-background-color,\n var(--kup-background-color)\n );--kup_accordion_border:var(\n --kup-accordion-border,\n 1px solid var(--kup-border-color)\n );--kup_accordion_border_radius:var(--kup-accordion-border-radius, 4px);--kup-accordion_dropdown_icon_color:var(\n --kup-accordion-dropdown-icon-color,\n var(--kup-icon-color)\n );--kup_accordion_font_family:var(\n --kup-accordion-font-family,\n var(--kup-font-family)\n );--kup_accordion_font_size:var(\n --kup-accordion-font-size,\n var(--kup-font-size)\n );--kup_accordion_hover_background_color:var(\n --kup-accordion-hover-background-color,\n var(--kup-hover-background-color)\n );--kup_accordion_hover_color:var(\n --kup-accordion-hover-color,\n var(--kup-hover-color)\n );--kup_accordion_padding:var(--kup-accordion-padding, 1em 1.5em);--kup_accordion_primary_color:var(\n --kup-accordion-primary-color,\n var(--kup-primary-color)\n );--kup_accordion_primary_color_rgb:var(\n --kup-accordion-primary-color-rgb,\n var(--kup-primary-color-rgb)\n );--kup_accordion_text_color:var(\n --kup-accordion-text-color,\n var(--kup-text-color)\n );--kup_accordion_text_on_primary_color:var(\n --kup-accordion-text-on-primary-color,\n var(--kup-text-on-primary-color)\n );--kup_accordion_transition:var(--kup-accordion-transition, 80ms);display:block;font-family:var(--kup_accordion_font_family);font-size:var(--kup_accordion_font_size)}.accordion{background-color:var(--kup_accordion_background_color);border-bottom:var(--kup_accordion_border);border-radius:var(--kup_accordion_border_radius);border-top:var(--kup_accordion_border);display:flex;flex-wrap:wrap;flex-direction:column;width:100%}.accordion-item{border-left:var(--kup_accordion_border);border-right:var(--kup_accordion_border);box-sizing:border-box;width:100%}.accordion-item--visible{display:block}.accordion-item:not(:first-of-type){border-top:var(--kup_accordion_border)}.accordion-item__header{align-items:center;border:none;box-sizing:border-box;color:var(--kup_accordion_text_color);cursor:pointer;display:flex;line-height:1.75em;outline:none;padding:var(--kup_accordion_padding);text-align:left;transition:background-color var(--kup_accordion_transition), color var(--kup_accordion_transition);width:100%}.accordion-item__header:hover:not(.accordion-item__header--selected){color:var(--kup_accordion_hover_color);background-color:var(--kup_accordion_hover_background_color)}.accordion-item__header--expanded{color:var(--kup_accordion_hover_color);background-color:var(--kup_accordion_hover_background_color)}.accordion-item__header--expanded .accordion-item__dropdown{transform:rotate(-180deg)}.accordion-item__header--selected{background-color:rgba(var(--kup_accordion_primary_color_rgb), 0.175)}.accordion-item__text{margin-right:0.5em;overflow:hidden;text-overflow:ellipsis;white-space:pre}.accordion-item__text--highlighted{color:var(--kup_accordion_text_on_primary_color);background-color:var(--kup_accordion_primary_color)}.accordion-item__icon{margin-left:0;margin-right:0.5em}.accordion-item__dropdown{background-color:var(--kup-accordion_dropdown_icon_color);height:1.5em;margin-left:auto;margin-right:0;min-width:1.5em;width:1.5em;transition:transform var(--kup_accordion_transition)}.accordion-item__content{animation:fade-in 0.25s ease-out;display:none}.accordion-item__content--selected{display:block}.mdc-ripple-surface{--mdc-ripple-fg-opacity:0.24}.mdc-ripple-surface:before,.mdc-ripple-surface:after{background-color:var(--kup_accordion_primary_color)}.kup-icon.kup-dropdown-icon{-webkit-mask:var(--kup-dropdown-icon);mask:var(--kup-dropdown-icon)}:host(.kup-borderless){--kup-accordion-border:none}:host(.kup-full-height){height:100%}:host(.kup-full-width){width:100%}:host(.kup-danger){--kup-accordion-primary-color:var(--kup-danger-color);--kup-accordion-primary-color-rgb:var(--kup-danger-color-rgb);--kup-accordion-text-on-primary-color:white}:host(.kup-info){--kup-accordion-primary-color:var(--kup-info-color);--kup-accordion-primary-color-rgb:var(--kup-info-color-rgb);--kup-accordion-text-on-primary-color:white}:host(.kup-secondary){--kup-accordion-primary-color:var(--kup-secondary-color);--kup-accordion-primary-color-rgb:var(--kup-secondary-color-rgb);--kup-accordion-text-on-primary-color:var(--kup-text-on-secondary-color)}:host(.kup-success){--kup-accordion-primary-color:var(--kup-success-color);--kup-accordion-primary-color-rgb:var(--kup-success-color-rgb);--kup-accordion-text-on-primary-color:white}:host(.kup-warning){--kup-accordion-primary-color:var(--kup-warning-color);--kup-accordion-primary-color-rgb:var(--kup-warning-color-rgb);--kup-accordion-text-on-primary-color:white}";export{h as kup_accordion}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,f as o,h as e,H as l,g as i}from"./p-d3b542b3.js";import{k as r,_ as n,h as s}from"./p-fc2b1229.js";import{i as a,g as c,s as f}from"./p-682a367a.js";import{c as u}from"./p-97e8ea42.js";import{F as m}from"./p-06c6cc68.js";import{F as d}from"./p-a203f78b.js";import"./p-d6c12c6c.js";import"./p-cd5cfa7c.js";import"./p-edae3076.js";import"./p-38d7584e.js";import"./p-dc62a30f.js";import"./p-79b0730b.js";import"./p-81605f08.js";var h,p,_;!function(t){t.customStyle="Custom style of the component.",t.data="Actual data of the form.",t.layout="How the form will arrange its content."}(h||(h={})),function(t){t.CENTER="center",t.LEFT="left",t.RIGHT="right"}(p||(p={})),function(t){t.BOTTOM="bottom",t.LEFT="left",t.HIDDEN="hidden",t.PLACEHOLDER="placeholder",t.RIGHT="right",t.TOP="top"}(_||(_={}));const b=document.documentElement,v=class{constructor(o){t(this,o),this.customStyle="",this.data=null,this.layout=null,this.kupManager=r(),this.visibleColumns=[]}onDataChanged(){a(this.getRows()),this.initVisibleColumns(),this.checkLayout()}onLayoutChanged(){this.checkLayout()}async getProps(t){return c(this,h,t)}async refresh(){o(this)}async setFocus(t,o){const e=this.rootElement.shadowRoot.querySelectorAll('td[data-column="'+t+'"]');for(let t=0;e&&t<e.length;t++){const l=e[t];if(l["data-row"]&&l["data-row"].id==o){const t=l.querySelector("input");if(t)t.focus();else{const t=l.querySelector(".hydrated");if(t)try{t.setFocus()}catch(t){}}}}}async setProps(t){f(this,h,t)}getColumns(){return this.data&&this.data.columns?this.data.columns:[{title:"",name:"",size:void 0}]}initVisibleColumns(){this.visibleColumns=this.getColumns().filter((t=>!t.hasOwnProperty("visible")||t.visible))}getRows(){return this.data&&this.data.rows?this.data.rows:[]}checkLayout(){if(this.layout)return void(this.formLayout=this.layout);const t={horizontal:!1,sections:[]},o=this.visibleColumns;let e=o.length;const l=[];let i=0;for(;e-- >0;)l.push({column:o[i++].name});t.content=l,this.formLayout={sections:[t]}}renderRow(t){const o=[...this.visibleColumns];let l=null,i=t.layout;i||(i=this.formLayout);let r=!1;if(i){i.horizontal&&(r=!0);const e=i.sections;let n=e.length,s=0;n>0&&(l=[]);const a={horizontal:r};for(;n-- >0;)l.push(this.renderSection(e[s++],a,t,o))}return e("form",{class:{form:!0,"form--column":!r}},l)}renderSection(t,o,l,i){var r;let n=null;if(t.sections&&t.sections.length>0){const o=t.sections;let e=o.length,r=0;for(e>0&&(n=[]);e-- >0;)n.push(this.renderSection(o[r++],t,l,i))}else if(t.content){const o=t.content;let r=o.length,s=0;for(r>0&&(n=[]);r-- >0;){const r=this.renderFormField({formField:o[s++],row:l,visibleColumns:i},t);let a=r;t.horizontal||(a=e("tr",null,r)),n.push(a)}}else i.length>0&&(n=this.renderFormField({formField:{column:i[0].name},row:l,visibleColumns:i}));const s=!!t.columns,a=(null===(r=null==t?void 0:t.label)||void 0===r?void 0:r.placement)||_.LEFT,c={form__section:!0,"form__section--column":!s&&!t.horizontal,"form__section--grid":s,"form__section--titled":!!t.title,"form__section--last":!t.sections||0===t.sections.length,[`form__section--${a}`]:!0},f=t.style||{};return t.dim&&o&&(f.flex=`0 0 ${t.dim}`,o.horizontal?f.maxWidth=t.dim:f.maxHeight=t.dim),s&&(f["grid-template-columns"]=`repeat(${t.columns}, 1fr)`),e("div",{class:c,style:f},t.title?e("h3",null,t.title):null,e("table",null,e("tbody",null,t.horizontal?e("tr",null,n):n)))}renderFormField({formField:t,row:o,visibleColumns:l},i){var r;const s={form__field:!0},a={};let c=null,f=-1;for(let o=0;o<l.length;o++)if(l[o].name===t.column){f=o;break}f>=0?(c=l[f],l.splice(f,1)):i&&(c=this.data.columns.find((o=>o.name===t.column)));const u=o.cells[t.column];let d;if(!u)return null;u.isEditable=!0,this.kupManager.objects.isEmptyKupObj(u.obj)||this.kupManager.debug.isDebug()&&(d=u.obj.t+"; "+u.obj.p+"; "+u.obj.k+";");const h={cell:t.data?Object.assign(Object.assign({},u),{data:t.data}):u,column:c,component:this,editable:!0,renderKup:!0,row:o,setSizes:!0,shape:t.shape},v=t.label||c.title;switch(function(){u.data||(u.data={});try{delete u.data.label}catch(t){}try{delete u.data.data["kup-text-field"].label}catch(t){}}(),null===(r=i.label)||void 0===r?void 0:r.placement){case _.BOTTOM:return[e("tr",null,g()),e("tr",null,k(v))];case _.PLACEHOLDER:!function(){switch(b.ketchup.data.cell.getType(u,u.shape||c.shape||null)){case n.AUTOCOMPLETE:case n.COLOR_PICKER:case n.COMBOBOX:case n.DATE:case n.DATETIME:case n.TIME:u.data.data&&u.data.data["kup-text-field"]?u.data.data["kup-text-field"].label=c.title:u.data.data={"kup-text-field":{label:c.title}};break;case n.CHECKBOX:case n.NUMBER:case n.STRING:case n.SWITCH:u.data.label=c.title}}();case _.HIDDEN:return i?[g()]:[e("tr",null,g())];case _.RIGHT:return i?[g(),k(v)]:[e("tr",null,g(),k(v))];case _.TOP:return[e("tr",null,k(v)),e("tr",null,g())];default:return i?[k(v),g()]:[e("tr",null,k(v),g())]}function g(){return e("td",{"data-cell":u,"data-row":o,"data-column":t.column,class:s,style:a,title:d},u&&c?e(m,Object.assign({},h)):e("span",null,t.value))}function k(t){var o,l,r;const n=(null===(o=null==i?void 0:i.label)||void 0===o?void 0:o.alignment)||p.LEFT,s={width:(null===(l=null==i?void 0:i.label)||void 0===l?void 0:l.width)?null===(r=null==i?void 0:i.label)||void 0===r?void 0:r.width:""};return e("td",{class:`form__label form__label--${n}`,style:s},e("span",null,t))}}componentWillLoad(){this.kupManager.debug.logLoad(this,!1),this.kupManager.language.register(this),this.kupManager.theme.register(this),this.onDataChanged()}componentDidLoad(){this.kupManager.debug.logLoad(this,!0)}componentWillRender(){this.kupManager.debug.logRender(this,!1)}componentDidRender(){const t=this.rootElement.shadowRoot;if(t){const o=t.querySelectorAll(".f-text-field");for(let t=0;t<o.length;t++)d(o[t])}this.kupManager.debug.logRender(this,!0)}render(){let t=null;if(0===this.data.rows.length)t=e("p",null,this.kupManager.language.translate(s.EMPTY_DATA));else{const o=this.data.rows;let e=o.length,l=0;for(t=[];e-- >0;)t.push(this.renderRow(o[l++]))}return e(l,null,e("style",null,this.kupManager.theme.setKupStyle(this.rootElement)),e("div",{id:u},t))}disconnectedCallback(){this.kupManager.language.unregister(this),this.kupManager.theme.unregister(this)}get rootElement(){return i(this)}static get watchers(){return{data:["onDataChanged"],layout:["onLayoutChanged"]}}};v.style=":host{--kup_form_background_color:var(\n --kup-form-background-color,\n var(--kup-background-color)\n );--kup_form_color:var(--kup-form-color, var(--kup-text-color));--kup_form_font_family:var(--kup-form-font-family, var(--kup-font-family));--kup_form_font_size:var(--kup-form-font-size, var(--kup-font-size));--kup_form_label_alignment:var(--kup-form-label-alignment);--kup_form_label_width:var(--kup-form-label-width);display:block;font-family:var(--kup_form_font_family);font-size:var(--kup_form_font_size)}.form{background:var(--kup_form_background_color);color:var(--kup_form_color);display:flex;flex-grow:1;overflow:auto;position:relative}.form--column{flex-direction:column}.form__section{display:flex;flex:1 1 1%;flex-direction:row;flex-wrap:wrap}.form__section--column{flex-direction:column;flex-wrap:unset}.form__section--column>.form__section{flex:0 0 auto}.form__section--grid{display:grid}.form__section--titled{border:1px solid var(--kup-border-color);padding-top:5px;position:relative;margin:10px}.form__section--titled>h3{background:var(--kup-background-color);font-size:calc(var(--kup-font-size) * 1.15);position:absolute;margin:0px;padding:0 8px;top:-11px;left:5px;transition:background-color 0.25s ease}.form__section--left .form__label{width:var(--kup_form_label_width, 0)}.form__section--right .form__field{min-width:200px;width:0}.form__label{-webkit-font-smoothing:antialiased;box-sizing:border-box;font-size:0.875em;letter-spacing:0.0178571429em;white-space:nowrap;width:var(--kup_form_label_width)}.form__label--center{text-align:var(--kup_form_label_alignment, center)}.form__label--left{text-align:var(--kup_form_label_alignment, left)}.form__label--right{text-align:var(--kup_form_label_alignment, right)}.form__field{min-height:16px}.form__field img{height:auto}.form .f-cell.c-right-aligned:not(.c-centered) .f-cell__content{justify-content:flex-start}";export{v as kup_form}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,c as t,f as e,h as a,H as s,g as r}from"./p-d3b542b3.js";import{k as o,h as n,F as l}from"./p-fc2b1229.js";import{g as p,s as m}from"./p-682a367a.js";import{c}from"./p-97e8ea42.js";import{F as g}from"./p-38d7584e.js";import{F as h}from"./p-928c5c36.js";import{F as _}from"./p-6c77a36c.js";import{F as u}from"./p-06c6cc68.js";import{M as d}from"./p-81605f08.js";import"./p-d6c12c6c.js";import"./p-cd5cfa7c.js";import"./p-edae3076.js";import"./p-dc62a30f.js";import"./p-79b0730b.js";var f;!function(i){i.customStyle="Custom style of the component.",i.data="Actual data of the component",i.ripple="When enabled displays Material's ripple effect on clicked items."}(f||(f={}));class k{constructor(){this.load=!1}toDebugString(){return"image-list state"}}var b,v,w,y,x,j,C,M=function(i,t,e,a){if("a"===e&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?i!==t||!a:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?a:"a"===e?a.call(i):a?a.value:t.get(i)};const W=class{constructor(e){i(this,e),this.kupClick=t(this,"kup-imagelist-click",6),this.kupContextMenu=t(this,"kup-imagelist-contextmenu",6),this.kupDblClick=t(this,"kup-imagelist-dblclick",6),b.add(this),this.state=new k,this.currentNode=null,this.navigationBarToggled=!1,this.customStyle="",this.data=[],this.ripple=!0,this.selectedNode=[],this.stateId="",this.kupManager=o(),v.set(this,[]),w.set(this,o()),y.set(this,{icon:"arrow_back",onClick:()=>{this.currentNode=M(this,w,"f").data.node.getParent(this.data,this.currentNode),this.currentNode||(this.navigationBarToggled=!1)},styling:_.FLAT,wrapperClass:"navigation-bar__back"}),x.set(this,{icon:"arrow_upward",onClick:()=>{this.currentNode=null,this.navigationBarToggled=!1},styling:_.FLAT,wrapperClass:"navigation-bar__top"})}initWithPersistedState(){if(this.store&&this.stateId){const i=this.store.getState(this.stateId);null!=i&&(this.currentNode=this.kupManager.data.node.findByStrTreeNodePath(this.data,i.selectedTreeNodePath))}}persistState(){if(this.store&&this.stateId){let i=!1,t=this.currentNode?this.currentNode.id:"";if(this.kupManager.objects.deepEqual(this.state.selectedTreeNodePath,t)||(this.state.selectedTreeNodePath=t,i=!0),!this.state.load)return void(this.state.load=!0);i&&this.store.persistState(this.stateId,this.state)}}onKupClick(i){i.children&&i.children.length>0&&(this.currentNode=i),this.kupClick.emit({comp:this,id:this.rootElement.id,node:i})}onKupContextMenu(i,t){i.preventDefault(),this.kupContextMenu.emit({comp:this,id:this.rootElement.id,node:t})}onKupDblClick(i){for(let i=0;i<M(this,v,"f").length;i++)clearTimeout(M(this,v,"f")[i]);(function(i,t,e,a,s){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?i!==t||!s:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===a?s.call(i,e):s?s.value=e:t.set(i,e)})(this,v,[],"f"),this.kupDblClick.emit({comp:this,id:this.rootElement.id,node:i})}selectNode(i){i&&0!=i.length&&(this.currentNode=this.kupManager.data.node.find(this.data,i))}async getProps(i){return p(this,f,i)}async refresh(){e(this)}async setProps(i){m(this,f,i)}componentWillLoad(){M(this,w,"f").debug.logLoad(this,!1),M(this,w,"f").language.register(this),M(this,w,"f").theme.register(this)}componentDidLoad(){M(this,w,"f").debug.logLoad(this,!0)}componentWillRender(){M(this,w,"f").debug.logRender(this,!1)}componentDidRender(){const i=this.rootElement.shadowRoot;if(i&&this.ripple){const t=i.querySelectorAll(".mdc-ripple-surface:not(.mdc-ripple-upgraded)");if(t)for(let i=0;i<t.length;i++)d.attachTo(t[i])}this.persistState(),M(this,w,"f").debug.logRender(this,!0)}render(){const i=!!this.currentNode;return a(s,null,a("style",null,M(this,w,"f").theme.setKupStyle(this.rootElement)),a("div",{id:c},a("div",{class:"navigation-bar"},i?a("div",{class:"navigation-bar__wrapper "+(this.navigationBarToggled?"navigation-bar__wrapper--active":"")},a("div",{class:"navigation-bar__title",onClick:()=>{this.navigationBarToggled=!this.navigationBarToggled}},a(g,{fit:!0,resource:this.currentNode.icon,sizeX:"1.25em",sizeY:"1.25em",wrapperClass:"navigation-bar__title__image"}),a("div",{class:"navigation-bar__title__label"},this.currentNode.value)),a(h,Object.assign({},M(this,y,"f"),{label:M(this,w,"f").language.translate(n.BACK)})),a(h,Object.assign({},M(this,x,"f"),{label:M(this,w,"f").language.translate(n.TOP)}))):null),a("div",{class:"image-list"},...M(this,b,"m",C).call(this))))}disconnectedCallback(){M(this,w,"f").language.unregister(this),M(this,w,"f").theme.unregister(this)}get rootElement(){return r(this)}static get watchers(){return{selectedNode:["selectNode"]}}};v=new WeakMap,w=new WeakMap,y=new WeakMap,x=new WeakMap,b=new WeakSet,j=function(i){const t=a(g,Object.assign({},{fit:!0,resource:i.icon,title:i.title,wrapperClass:"image-list__image"})),e=a("div",{class:"image-list__label"},i.value);return a(u,{cell:{value:i.value,icon:i.icon,obj:i.obj},column:{name:"IMAGE",title:"Image"},density:l.NONE,row:Object.assign({},i)},a("div",{class:"image-list__wrapper"},t,e))},C=function(){const i=[],t=this.currentNode?this.currentNode.children:this.data;for(let e=0;t&&e<t.length;e++){const s=t[e],r=a("div",{onClick:()=>{M(this,v,"f").push(setTimeout((()=>this.onKupClick(s)),300))},onContextMenu:i=>this.onKupContextMenu(i,s),onDblClick:()=>this.onKupDblClick(s),class:{"image-list__item":!0,"mdc-ripple-surface":!!this.ripple}},M(this,b,"m",j).call(this,s));i.push(r)}return i},W.style=":host{--kup_imagelist_background_color:var(\n --kup-imagelist-background-color,\n transparent\n );--kup_imagelist_columns:var(--kup-imagelist-columns, 4);--kup_imagelist_grid_gap:var(--kup-imagelist-grid-gap, 0.5em);--kup_imagelist_image_margin:var(--kup-imagelist-image-margin, 1em auto);--kup_imagelist_image_min_height:var(--kup-imagelist-image-min-height, 64px);--kup_imagelist_item_border_radius:var(\n --kup-imagelist-item-border-radius,\n 8px\n );--kup_imagelist_item_height:var(--kup-imagelist-item-height, auto);--kup_imagelist_item_padding:var(--kup-imagelist-item-padding, 0);--kup_imagelist_item_width:var(--kup-imagelist-item-width, auto);--kup_imagelist_label_margin:var(\n --kup-imagelist-label-margin,\n 0 auto 1em auto\n );--kup_imagelist_navbar_background_color:var(\n --kup-imagelist-navbar-background-color,\n transparent\n );--kup_imagelist_primary_color:var(\n --kup-imagelist-primary-color,\n var(--kup-primary-color)\n );--kup_imagelist_primary_color_rgb:var(\n --kup-imagelist-primary-color-rgb,\n var(--kup-primary-color-rgb)\n );--kup_imagelist_text_color:var(\n --kup-imagelist-text-color,\n var(--kup-text-color)\n );display:block}.navigation-bar{align-items:center;background-color:var(--kup_imagelist_navbar_background_color);display:flex;justify-content:center}.navigation-bar__wrapper{align-items:center;display:flex;flex-wrap:wrap;justify-content:center;max-width:100%;position:relative}.navigation-bar__wrapper--active .navigation-bar__title{background-color:rgba(var(--kup_imagelist_primary_color_rgb), 0.15);color:var(--kup_imagelist_primary_color)}.navigation-bar__back,.navigation-bar__top{--kup-button-primary-color-rgb:0}.navigation-bar__title{border-radius:16px;box-sizing:border-box;cursor:pointer;display:flex;justify-content:center;padding:0.75em 1em;user-select:none;transition:background-color 125ms, color 125ms;width:100%}.navigation-bar__title__image.f-image{margin:0}.navigation-bar__title__label{font-size:1.2em;font-weight:bold;letter-spacing:0.12em;overflow:hidden;padding:0 0.5em;text-overflow:ellipsis;text-transform:uppercase;white-space:nowrap}.image-list{background-color:var(--kup_imagelist_background_color);display:grid;grid-gap:var(--kup_imagelist_grid_gap);grid-template-columns:repeat(var(--kup_imagelist_columns, 4), minmax(0px, 1fr));margin-top:1em;width:100%}.image-list .f-cell{height:100%;width:100%}.image-list__item{border-radius:var(--kup_imagelist_item_border_radius);cursor:pointer;height:var(--kup_imagelist_item_height);padding:var(--kup_imagelist_item_padding);width:var(--kup_imagelist_item_width)}.image-list__image.f-image{margin:var(--kup_imagelist_image_margin)}.image-list__image.f-image .f-image__icon{min-height:var(--kup_imagelist_image_min_height)}.image-list__label{color:var(--kup_imagelist_text_color);letter-spacing:0.12em;margin:var(--kup_imagelist_label_margin);overflow:hidden;text-align:center;text-overflow:ellipsis}.image-list .mdc-ripple-surface{--mdc-ripple-fg-opacity:0.24}.image-list .mdc-ripple-surface:before,.image-list .mdc-ripple-surface:after{background-color:var(--kup_imagelist_primary_color)}:host(.kup-full-height){height:100%}:host(.kup-full-width){width:100%}:host(.kup-horizontal) .image-list{display:flex}:host(.kup-auto-grid) .image-list{display:flex;flex-wrap:wrap;justify-content:center}";export{W as kup_image_list}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as o,f as i,h as e,H as s,g as r}from"./p-d3b542b3.js";import{k as n,h as a,K as l,c as h,y as c,B as p,C as b,D as d,v as u,M as x}from"./p-fc2b1229.js";import{g}from"./p-d6c12c6c.js";import{f,p as m,s as k,h as w,r as v,k as y,e as _}from"./p-c0219e5e.js";import{i as j,g as C,s as A}from"./p-682a367a.js";import{F as R}from"./p-38d7584e.js";import{a as P}from"./p-dc62a30f.js";import{c as z}from"./p-97e8ea42.js";import{F as I}from"./p-06c6cc68.js";import{F as S}from"./p-a203f78b.js";import"./p-928c5c36.js";import"./p-6c77a36c.js";import"./p-cd5cfa7c.js";import"./p-edae3076.js";import"./p-79b0730b.js";import"./p-81605f08.js";var M;!function(t){t.cardData="Data of the card linked to the box when the latter's layout must be a premade template.",t.columns="Number of columns.",t.customStyle="Custom style of the component.",t.data="Actual data of the box.",t.dragEnabled="Enable dragging.",t.dropEnabled="Enable dropping.",t.dropOnSection="Drop can be done in section.",t.enableRowActions="If enabled, a button to load / display the row actions will be displayed on the right of every box.",t.globalFilter="When set to true it activates the global filter.",t.globalFilterValue="The value of the global filter.",t.kanban="Displays the boxlist as a Kanban.",t.layout="How the field will be displayed. If not present, a default one will be created.",t.multiSelection="Enable multi selection.",t.pageSelected="Current page number.",t.pageSize="Number of boxes per page.",t.pagination="Enables pagination.",t.rowsPerPage="Number of current rows per page.",t.scrollOnHover="Activates the scroll on hover function.",t.selectBox="Automatically selects the box at the specified index.",t.selectedRowsState="Multiple selection.",t.showSelection="If enabled, highlights the selected box/boxes.",t.sortBy="If sorting is enabled, specifies which column to sort.",t.sortEnabled="Enable sorting.",t.stateId="",t.store="",t.swipeDisabled="Disable swipe."}(M||(M={}));class B{constructor(){this.globalFilterValue="",this.sortBy="",this.selectedRowsState="",this.pageSelected=1,this.rowsPerPage=0,this.load=!1}toDebugString(){return"box state"}}const D=class{constructor(i){t(this,i),this.kupBoxClick=o(this,"kup-box-click",6),this.kupBoxSelected=o(this,"kup-box-selected",6),this.kupAutoBoxSelect=o(this,"kup-box-autoselect",6),this.kupRowActionMenuClick=o(this,"kup-box-rowactionmenuclick",6),this.kupRowActionClick=o(this,"kup-box-rowactionclick",6),this.kupDidLoad=o(this,"kup-box-didload",6),this.kupDidUnload=o(this,"kup-box-didunload",6),this.kupBoxContextMenu=o(this,"kup-box-contextmenu",6),this.collapsedSection={},this.selectedRows=[],this.currentPage=1,this.currentRowsPerPage=10,this.state=new B,this.cardData=null,this.columns=1,this.customStyle="",this.data=null,this.dragEnabled=!1,this.dropEnabled=!1,this.dropOnSection=!1,this.editableData=!1,this.enableRowActions=!1,this.globalFilter=!1,this.globalFilterValue="",this.kanban=null,this.multiSelection=!1,this.pageSelected=1,this.pageSize=10,this.pagination=!1,this.scrollOnHover=!1,this.showSelection=!0,this.sortEnabled=!1,this.stateId="",this.swipeDisabled=!1,this.kupManager=n(),this.visibleColumns=[],this.rows=[],this.filteredRows=[],this.sectionRef=null,this.rowsRefs=[],this.hold=!1,this.interactableDrag=[],this.interactableDrop=[],this.interactableTouch=[]}initWithPersistedState(){if(this.store&&this.stateId){const t=this.store.getState(this.stateId);null!=t&&(this.kupManager.debug.logMessage(this,"Initialize with state for stateId "+this.stateId+": "+t),this.sortBy=this.state.sortBy,this.globalFilterValue=this.state.globalFilterValue,this.selectedRowsState=this.state.selectedRowsState,this.pageSelected=this.state.pageSelected,this.rowsPerPage=this.state.rowsPerPage)}}persistState(){if(this.store&&this.stateId){let t=!1;this.kupManager.objects.deepEqual(this.state.sortBy,this.sortBy)||(this.state.sortBy=this.sortBy,t=!0),this.kupManager.objects.deepEqual(this.state.globalFilterValue,this.globalFilterValue)||(this.state.globalFilterValue=this.globalFilterValue,t=!0),this.kupManager.objects.deepEqual(this.state.pageSelected,this.currentPage)||(this.state.pageSelected=this.currentPage,t=!0),this.kupManager.objects.deepEqual(this.state.rowsPerPage,this.currentRowsPerPage)||(this.state.rowsPerPage=this.currentRowsPerPage,t=!0);const o=this.selectedRows.reduce(((t,o,i)=>t+(i>0?";":"")+o.id),"");if(this.kupManager.objects.deepEqual(this.state.selectedRowsState,o)||(this.state.selectedRowsState=o,t=!0),!this.state.load)return void(this.state.load=!0);t&&(this.kupManager.debug.logMessage(this,"Persisting state for stateId "+this.stateId+": "+this.state),this.store.persistState(this.stateId,this.state))}}rowsPerPageHandler(t){this.currentRowsPerPage=t}recalculateRows(){this.initRows()}onDataChanged(){j(this.getRows()),this.initVisibleColumns(),this.initRows(),this.checkLayout()}onLayoutChanged(){this.checkLayout()}onSelectBoxChanged(){this.handleAutomaticBoxSelection()}async getProps(t){return C(this,M,t)}async loadRowActions(t,o){t.actions=o,this.rowActionMenuOpened=t}async refresh(){i(this)}async setProps(t){A(this,M,t)}getColumns(){return this.data&&this.data.columns?this.data.columns:[{title:"",name:"",size:void 0}]}initVisibleColumns(){this.visibleColumns=this.getColumns().filter((t=>!t.hasOwnProperty("visible")||t.visible))}getRows(){return this.data&&this.data.rows?this.data.rows:[]}initRows(){this.filteredRows=this.getRows(),this.globalFilter&&this.globalFilterValue&&(this.filteredRows=f(this.filteredRows,null,this.globalFilterValue,this.visibleColumns)),this.rows=this.sortRows(this.filteredRows),this.pagination&&(this.rows=m(this.rows,this.currentPage,this.currentRowsPerPage,!1))}sortRows(t){let o=t;return this.sortBy&&(o=k(o,[{column:this.sortBy,sortMode:x.A}])),o}checkScrollOnHover(){this.kupManager.scrollOnHover.isRegistered(this.boxContainer)?this.scrollOnHover||this.kupManager.scrollOnHover.unregister(this.boxContainer):this.scrollOnHover&&this.kupManager.scrollOnHover.register(this.boxContainer)}checkLayout(){if(this.layout)return void(this.boxLayout=this.layout);const t={horizontal:!1,sections:[]},o=this.visibleColumns;let i=o.length,e=[],s=0;for(;i-- >0;)e.push({column:o[s++].name});t.content=e,this.boxLayout={sections:[t]}}onSortChange(t){let o=g(this.visibleColumns,t.detail.value);this.sortBy=o.name}onGlobalFilterChange({detail:t}){let o="";t&&t.value&&(o=t.value),this.globalFilterValue=o}isSectionExpanded(t,o){return!(!t.id||!o.id)&&this.collapsedSection[o.id]&&this.collapsedSection[o.id][t.id]}handleAutomaticBoxSelection(){if(this.selectBox&&this.selectBox>0&&this.selectBox<=this.data.rows.length){this.selectedRows=[];for(let t of this.data.rows)if(t.id===(this.selectBox-1).toString()){this.selectedRows.push(t);break}this.kupAutoBoxSelect.emit({comp:this,id:this.rootElement.id,row:this.selectedRows[0]})}}getEventDetails(t,o){let i=null,e=null,s=null,r=null;return t&&(i=t.closest(".box-object")||t.querySelector(".box-object")),i&&(e=i["data-cell"],s=i["data-row"],r=g(this.visibleColumns,i.dataset.column)),{boxObject:i||null,column:r||null,cell:e||null,originalEvent:o,row:s||null}}contextMenuHandler(t){return this.getEventDetails(t.target,t)}checkIfElementIsActionMenuIcon(t){return!(!t.tagName||!t.parentElement)&&"svg"===t.tagName&&t.parentElement.classList.contains("row-actions-toggler")}onBoxClick({target:t},o){if(!(t instanceof HTMLElement))return;let i=t,e=i.classList;for(;!e.contains("box-object")&&!e.contains("box-section")&&!e.contains("box")&&(i=i.parentElement,null!==i);)e=i.classList;let s=null;e.contains("box-object")&&(s=i.dataset.column),this.kupBoxClick.emit({comp:this,id:this.rootElement.id,row:o,column:s}),this.multiSelection?this.onSelectionCheckChange(o):this.selectedRows=[o]}onSelectionCheckChange(t){var o=-1;for(let i=0;i<this.selectedRows.length;i++)if(this.selectedRows[i].id===t.id){o=i;break}o>=0?(this.selectedRows.splice(o,1),this.selectedRows=[...this.selectedRows]):this.selectedRows=[...this.selectedRows,t],this.kupBoxSelected.emit({comp:this,id:this.rootElement.id,rows:this.selectedRows})}toggleSectionExpand(t,o){if(o.id)if(t.id){if(this.collapsedSection[o.id]){const i=this.collapsedSection[o.id];i[t.id]=!i[t.id]||!i[t.id]}else this.collapsedSection[o.id]={},this.collapsedSection[o.id][t.id]=!0;this.collapsedSection=Object.assign({},this.collapsedSection)}else console.error("cannot expand / collapse a section of a row without ad id");else console.error("cannot expand / collapse a section withoun an ID")}onRowAction(t){t&&(t!==this.rowActionMenuOpened?t.actions?this.rowActionMenuOpened=t:this.kupRowActionMenuClick.emit({comp:this,id:this.rootElement.id,row:t}):this.rowActionMenuOpened=null)}onRowActionClick(t,o,i){this.kupRowActionClick.emit({comp:this,id:this.rootElement.id,row:t,action:o,index:i})}clickFunction(t){try{const o=t.composedPath();for(let t of o)if(this.checkIfElementIsActionMenuIcon(t))return}catch(o){if(this.checkIfElementIsActionMenuIcon(t.target))return}this.rowActionMenuOpened=null}handlePageChange(t){const o=w(t,this.filteredRows.length,this.currentRowsPerPage);o&&(this.currentPage=o)}handleRowsPerPageChange(t){const o=v(t,this.filteredRows.length);o&&(this.currentRowsPerPage=o,this.adjustPaginator())}adjustPaginator(){const t=Math.ceil(this.rows.length/this.currentRowsPerPage);this.currentPage>t&&(this.currentPage=1)}renderSectionAsCard(t){let o=!1,i={button:[],image:[],progressbar:[],text:[]};for(var s in t.cells)if(t.cells.hasOwnProperty(s)&&void 0!==(r=t.cells[s]).cardID)switch(r.obj.p){case"BTN":do{i.button.push({})}while(i.button.length<r.cardID);i.button[r.cardID]={label:r.value};break;case"IMG":do{i.image.push({})}while(i.image.length<r.cardID);i.image[r.cardID]={resource:r.value};break;case"PGB":do{i.progressbar.push({})}while(i.progressbar.length<r.cardID);i.progressbar[r.cardID]={value:r.value};break;default:do{i.text.push("")}while(i.text.length<r.cardID);i.text[r.cardID]=r.value}for(var s in t.cells){var r;if(t.cells.hasOwnProperty(s)&&void 0===(r=t.cells[s]).cardID)switch(o=!1,r.obj.p){case"BTN":for(let t=0;t<i.button.length;t++)if(i.button[t]==={}){i.button[t]={label:r.value},o=!0;break}o||i.button.push({label:r.value});break;case"IMG":for(let t=0;t<i.image.length;t++)if(i.image[t]==={}){i.image[t]={resource:r.value},o=!0;break}o||i.image.push({resource:r.value});break;case"PGB":for(let t=0;t<i.progressbar.length;t++)if(i.progressbar[t]==={}){i.progressbar[t]={value:r.value},o=!0;break}o||i.progressbar.push({value:r.value});break;default:for(let t=0;t<i.text.length;t++)if(""===i.text[t]){i.text[t]=r.value,o=!0;break}o||i.text.push(r.value)}}return e("kup-card",Object.assign({data:i},this.cardData))}renderRow(t){const o=[...this.visibleColumns];let i=null,s=t.layout;s||(s=this.boxLayout);let r=!1;if(s){s.horizontal&&(r=!0);const e=s.sections;let n=e.length,a=0;n>0&&(i=[]);const l={horizontal:r};for(;n-- >0;)i.push(null!=this.cardData&&"object"==typeof this.cardData?this.renderSectionAsCard(t):this.renderSection(e[a++],l,t,o))}var n=!1;for(let o of this.selectedRows)o.id===t.id&&(n=!0);let a=null;this.multiSelection&&(a=e("div",{class:"box-selection"},e("kup-checkbox",{checked:n})));let l=null;if(this.enableRowActions&&!this.swipeDisabled){const o={"row-action-menu":!0,open:t===this.rowActionMenuOpened};let i=null;if(t.actions){const o=t.actions.map(((o,i)=>e("li",{tabindex:"0",onClick:()=>this.onRowActionClick(t,o,i)},e("div",{class:`icon ${o.icon}`}),e("div",{class:"text"},o.text))));i=e("ul",null,o)}l=e("div",{class:"row-actions-wrapper"},e("div",{class:"row-actions-toggler"},e("svg",{version:"1.1",width:"24",height:"24",viewBox:"0 0 24 24",onClick:()=>this.onRowAction(t)},e("path",{d:"M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z"})),e("div",{class:o},i)))}let h=null;return t.badgeData&&t.badgeData.length>0&&(h=t.badgeData.map((t=>e("kup-badge",{text:t.text,class:t.className?`centered ${t.className}`:"centered",imageData:t.imageData})))),e("div",{class:"box-wrapper"},e("div",{class:{box:!0,draggable:this.dragEnabled,selected:this.showSelection&&n,column:!r},onClick:o=>this.onBoxClick(o,t),ref:t=>this.rowsRefs.push(t)},a,i,h),l)}renderSection(t,o,i,s){let r=null;if(t.sections&&t.sections.length>0){const o=t.sections;let e=o.length,n=0;for(e>0&&(r=[]);e-- >0;)r.push(this.renderSection(o[n++],t,i,s))}else if(t.content){const o=t.content;let e=o.length,n=0;for(e>0&&(r=[]);e-- >0;)r.push(this.renderBoxObject({boxObject:o[n++],row:i,visibleColumns:s},!0))}else s.length>0&&(r=this.renderBoxObject({boxObject:{column:s[0].name},row:i,visibleColumns:s}));const n=this.isSectionExpanded(i,t),h=!!t.columns,c={"box-section":!0,open:n,column:!h&&!t.horizontal,grid:h,titled:!!t.title,"last-child":!t.sections||0===t.sections.length},p=t.style||{};t.dim&&o&&(p.flex=`0 0 ${t.dim}`,o.horizontal?p.maxWidth=t.dim:p.maxHeight=t.dim),h&&(p["grid-template-columns"]=`repeat(${t.columns}, 1fr)`);let b=null;if(t.collapsible){c["collapse-section"]=!0;const o={content:!0};let s="";s=t.title?t.title:this.kupManager.language.translate(n?a.COLLAPSE:a.EXPAND),b=e("div",{class:c,style:p},e("div",{class:o},r),e("div",{class:"header",role:"button",onClick:o=>{o.stopPropagation(),this.toggleSectionExpand(i,t)}},e("div",{class:"header-content"},e("span",null,s),e(R,{resource:`${l.DROPDOWN}`,sizeX:"1.25em",sizeY:"1.25em",wrapperClass:n?"toggled":""}))))}else{const o=t.title?e("h3",null,t.title):null;b=e("div",{class:c,style:p},o,r)}return b}renderBoxObject({boxObject:t,row:o,visibleColumns:i},s){const r={"box-object":!0};let n=null,a=-1;for(let o=0;o<i.length;o++)if(i[o].name===t.column){a=o;break}a>=0?(n=i[a],i.splice(a,1)):s&&(n=this.data.columns.find((o=>o.name===t.column)));const l=o.cells[t.column];let h;return l&&!this.kupManager.objects.isEmptyKupObj(l.obj)&&(r["is-obj"]=!0,this.kupManager.debug.isDebug()&&(h=l.obj.t+"; "+l.obj.p+"; "+l.obj.k+";")),e("div",{"data-cell":l,"data-row":o,"data-column":t.column,class:r,style:{},title:h},l&&n?e(I,Object.assign({},{cell:l,column:n,component:this,editable:this.editableData,renderKup:!0,row:o,setSizes:!0,shape:t.shape})):e("span",null,t.value))}kanbanMode(){if(!this.kanban.columns||0===this.kanban.columns.length)return this.kupManager.debug.logMessage(this,"No columns to group by detected.",h.ERROR),{jsx:e("div",{id:"empty-data-message",class:"box-wrapper"},e("div",{ref:t=>this.rowsRefs.push(t)}),this.kupManager.language.translate(a.EMPTY_DATA)),style:{"grid-template-columns":"repeat(1, 1fr)"}};const t=[];if(this.kanban.labels)for(let o=0;o<this.kanban.labels.length;o++)t.push({labels:this.kanban.labels[o],nodes:[]});for(let o=0;o<this.rows.length;o++){let i=[];for(let t=0;t<this.kanban.columns.length;t++)try{i.push(this.rows[o].cells[this.kanban.columns[t]].value)}catch(t){this.kupManager.debug.logMessage(this,t,h.WARNING)}const e={found:!1,index:null};for(let o=0;o<t.length;o++){let s=t[o].labels,r=!0;for(let t=0;t<s.length;t++)if(i[t]!==s[t]){r=!1;break}if(r){e.found=!0,e.index=o;break}}e.found?t[e.index].nodes.push(this.renderRow(this.rows[o])):t.push({labels:i,nodes:[this.renderRow(this.rows[o])]})}const o=[];for(let i=0;i<t.length;i++){const s=t[i].labels,r={data:[]};for(let t=0;t<s.length;t++)r.data.push({value:s[t],id:s[t]});o.push(e("div",{class:"kanban-section"},e(P,Object.assign({},r)),t[i].nodes))}return{jsx:o,style:{"grid-template-columns":this.kanban.size?`repeat(${Object.keys(t).length}, ${this.kanban.size})`:`repeat(${Object.keys(t).length}, 1fr)`}}}didLoadInteractables(){this.interactableTouch.push(this.boxContainer),this.kupManager.interact.on(this.boxContainer,c.TAP,(t=>{if(this.hold)this.hold=!1;else switch(t.button){case 2:this.kupBoxContextMenu.emit({comp:this,id:this.rootElement.id,details:this.contextMenuHandler(t)})}})),this.kupManager.interact.on(this.boxContainer,c.HOLD,(t=>{"pen"!==t.pointerType&&"touch"!==t.pointerType||(this.hold=!0,this.kupBoxContextMenu.emit({comp:this,id:this.rootElement.id,details:this.contextMenuHandler(t)}))}))}didRenderInteractables(){if(this.dragEnabled)for(let t=0;t<this.rowsRefs.length;t++){const o=this.rowsRefs[t],i=()=>{const t=this.rootElement.shadowRoot.querySelector(".box-object:hover");return{cell:t["data-cell"],column:g(this.visibleColumns,t.dataset.column),id:this.rootElement.id,multiple:this.multiSelection,row:t["data-row"],selectedRows:this.selectedRows}};o&&!this.interactableDrag.includes(o)&&(this.interactableDrag.push(o),this.kupManager.interact.draggable(o,{allowFrom:".box-object",cursorChecker:()=>null},{callback:i},p.BADGE))}if(this.dropEnabled){const t=()=>{const t=this.getEventDetails(this.rootElement.shadowRoot.querySelector(".box:hover"));return{cell:t.cell,column:t.column,id:this.rootElement.id,row:t.row}};this.interactableDrop.includes(this.sectionRef)||(this.interactableDrop.push(this.sectionRef),this.kupManager.interact.dropzone(this.sectionRef,{accept:`[${b}]`},{dispatcher:this.rootElement,type:d.BOX}));for(let o=0;o<this.rowsRefs.length;o++){const i=this.rowsRefs[o];i&&!this.interactableDrop.includes(i)&&(this.interactableDrop.push(i),this.kupManager.interact.dropzone(i,{accept:`[${b}]`},{callback:t,dispatcher:this.rootElement,type:d.BOX}))}}}componentWillLoad(){this.kupManager.debug.logLoad(this,!1),this.rowsPerPage?this.currentRowsPerPage=this.rowsPerPage:this.pageSize&&(this.currentRowsPerPage=this.pageSize),this.data&&this.data.rows&&this.currentRowsPerPage>this.data.rows.length&&(this.currentRowsPerPage=this.data.rows.length),this.kupManager.language.register(this),this.kupManager.theme.register(this),this.onDataChanged(),this.adjustPaginator()}componentDidLoad(){if(this.handleAutomaticBoxSelection(),document.addEventListener("click",this.clickFunction.bind(this)),this.currentPage=this.pageSelected,this.multiSelection&&this.selectedRowsState){this.selectedRows=[];let t=this.selectedRowsState.split(";");this.selectedRows=this.data.rows.filter((o=>t.indexOf(o.id)>=0))}this.didLoadInteractables(),this.kupDidLoad.emit({comp:this,id:this.rootElement.id}),this.kupManager.debug.logLoad(this,!0)}componentWillRender(){this.kupManager.debug.logRender(this,!1)}componentDidRender(){const t=this.rootElement.shadowRoot;if(t){const o=t.querySelectorAll(".f-text-field");for(let t=0;t<o.length;t++)S(o[t])}this.checkScrollOnHover(),this.persistState(),this.didRenderInteractables(),this.kupManager.debug.logRender(this,!0)}render(){const t=!("object"!=typeof this.kanban||null===this.kanban);let o=null;if(this.sortEnabled){const t=[{value:"",id:""},...this.visibleColumns.map((t=>({value:t.title,id:t.name,selected:t.name===this.sortBy})))];let i={label:this.kupManager.language.translate(a.SORT_BY),trailingIcon:!0};o=e("div",{id:"sort-panel"},e("kup-combobox",{data:{"kup-text-field":i,"kup-list":{data:t,selectable:!0}},initialValue:this.sortBy,"onkup-combobox-itemclick":t=>this.onSortChange(t)}))}let i=null;this.globalFilter&&(i=e("div",{id:"global-filter"},e("kup-text-field",{fullWidth:!0,label:this.kupManager.language.translate(u.SEARCH),icon:l.SEARCH,initialValue:this.globalFilterValue,"onkup-textfield-input":t=>{window.clearTimeout(this.globalFilterTimeout),this.globalFilterTimeout=window.setTimeout((()=>this.onGlobalFilterChange(t)),600)}})));let r=null;this.pagination&&(r=e(_,{id:top?"top-paginator":"bottom-paginator",currentPage:this.currentPage,max:this.filteredRows.length,mode:y.SIMPLE,perPage:this.currentRowsPerPage?this.currentRowsPerPage:this.pageSize,onPageChange:t=>this.handlePageChange(t.detail.value),onRowsChange:t=>this.handleRowsPerPageChange(t.detail.value)}));let n=null,h={};if(0===this.rows.length)n=e("div",{id:"empty-data-message",class:"box-wrapper"},e("div",{class:"box",ref:t=>this.rowsRefs.push(t)},this.kupManager.language.translate(a.EMPTY_DATA))),h={"grid-template-columns":"repeat(1, 1fr)"};else if(t){const t=this.kanbanMode();n=t.jsx,h=t.style}else{h={"grid-template-columns":`repeat(${this.columns}, 1fr)`};const t=this.rows;let o=t.length,i=0;for(n=[];o-- >0;)n.push(this.renderRow(t[i++]))}return e(s,null,e("style",null,this.kupManager.theme.setKupStyle(this.rootElement)),e("div",{id:z},e("div",{class:"box-component",ref:t=>this.sectionRef=t},o,i,r,e("div",{class:t?"is-kanban":"",id:"box-container",style:h,onContextMenu:t=>{t.preventDefault()},ref:t=>this.boxContainer=t},n))))}disconnectedCallback(){this.kupManager.interact.unregister(this.interactableDrag.concat(this.interactableDrop)),this.kupManager.language.unregister(this),this.kupManager.theme.unregister(this),this.scrollOnHover&&this.kupManager.scrollOnHover.unregister(this.boxContainer),document.removeEventListener("click",this.clickFunction.bind(this)),this.kupDidUnload.emit({comp:this,id:this.rootElement.id})}get rootElement(){return r(this)}static get watchers(){return{pageSize:["rowsPerPageHandler","recalculateRows"],globalFilterValue:["recalculateRows"],sortBy:["recalculateRows"],pagination:["recalculateRows"],currentPage:["recalculateRows"],currentRowsPerPage:["recalculateRows"],data:["onDataChanged"],layout:["onLayoutChanged"],selectBox:["onSelectBoxChanged"]}}};D.style=":host{--kup_box_background_color:var(\n --kup-box-background-color,\n var(--kup-background-color)\n );--kup_box_color:var(--kup-box-color, var(--kup-text-color));--kup_box_font_family:var(--kup-box-font-family, var(--kup-font-family));--kup_box_font_size:var(--kup-box-font-size, var(--kup-font-size));--kup_box_grid_gap:var(--kup-box-grid-gap, 1em);--kup_box_hover_box_shadow:var(\n --kup-box-hover-box-shadow,\n 0px 0px 7.5px 0px rgba(128, 128, 128, 0.5)\n );--kup_box_primary_color_rgb:var(\n --kup-box-primary-color-rgb,\n var(--kup-primary-color-rgb)\n );--kup_box_transition:var(--kup-box-transition, 0.25s);display:block;font-family:var(--kup_box_font_family);font-size:var(--kup_box_font_size)}.box-component{background:var(--kup_box_background_color);transition:border var(--kup_box_transition) ease}.box-component[kup-drag-over]{position:relative;border:3px dashed var(--kup-border-color)}#box-container{display:grid;grid-gap:var(--kup_box_grid_gap);color:var(--kup_box_color);overflow:auto}#box-container.is-kanban .kanban-section{overflow:auto}#box-container.is-kanban .box-wrapper{padding-top:1em}#box-container.is-kanban .box-wrapper .box{overflow:auto}#box-container *{box-sizing:border-box}#box-container .box-wrapper{display:flex;align-items:center}#box-container .box-wrapper .box{flex-grow:1;cursor:pointer;position:relative;display:flex;transition:background-color var(--kup_box_transition) ease, box-shadow var(--kup_box_transition) ease, border var(--kup_box_transition) ease}#box-container .box-wrapper .box.draggable{touch-action:none;user-select:none}#box-container .box-wrapper .box.column{flex-direction:column}#box-container .box-wrapper .box:hover{box-shadow:var(--kup_box_hover_box_shadow)}#box-container .box-wrapper .box.selected{background-color:rgba(var(--kup_box_primary_color_rgb), 0.175)}#box-container .box-wrapper .box.selected .box-section.titled>h3{background-color:transparent}#box-container .box-wrapper .box[kup-draggable]{opacity:0.5}#box-container .box-wrapper .box[kup-drag-over]{border:3px dashed var(--kup-border-color);position:relative;z-index:2}#box-container .box-wrapper .box .box-section{display:flex;flex-direction:row;flex:1 1 1%;flex-wrap:wrap}#box-container .box-wrapper .box .box-section.column{flex-direction:column;justify-content:center;flex-wrap:unset}#box-container .box-wrapper .box .box-section.column>.box-section{flex:0 0 auto}#box-container .box-wrapper .box .box-section.grid{display:grid}#box-container .box-wrapper .box .box-section .box-object{min-height:16px}#box-container .box-wrapper .box .box-section .box-object img{height:auto}#box-container .box-wrapper .box .box-section.collapse-section .header{border-top:1px solid var(--kup-border-color);color:rgba(var(--kup-text-color-rgb), 0.75);display:flex;justify-content:space-around;width:100%}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content{margin:0.5em;display:flex;align-items:center}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .f-image{transition:transform 0.15s}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .f-image.toggled{transform:rotate(-180deg)}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .kup-icon.kup-dropdown-icon{margin:0;-webkit-mask:var(--kup-dropdown-icon);mask:var(--kup-dropdown-icon)}#box-container .box-wrapper .box .box-section.collapse-section .content{display:none;width:100%}#box-container .box-wrapper .box .box-section.collapse-section.open .content{display:block}#box-container .box-wrapper .box .box-section.titled{border:1px solid var(--kup-border-color);padding-top:5px;position:relative;margin:10px}#box-container .box-wrapper .box .box-section.titled>h3{background:var(--kup-background-color);font-size:calc(var(--kup-font-size) * 1.15);position:absolute;margin:0px;padding:0 8px;top:-11px;left:5px;transition:background-color 0.25s ease}#box-container .box-wrapper .box .box-selection{position:absolute;top:0.5em;right:0.5em;z-index:1}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler{position:relative;width:24px;height:24px;margin-left:3px}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler svg{cursor:pointer;opacity:0;fill:var(--kup-text-color);transition:opacity 500ms ease-out}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu{background:var(--kup-background-color);border:1px solid var(--kup-border-color);box-shadow:0px 0px 7.5px 0px rgba(128, 128, 128, 0.5);position:absolute;top:0;right:24px;display:none;z-index:10}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul{list-style-type:none;margin:0;padding:0}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul>li{cursor:pointer;white-space:nowrap;padding:0 12px;display:flex;align-items:center;line-height:30px}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul>li:not(:last-child){border-bottom:1px solid var(--kup-border-color)}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu.open{display:block}#box-container .box-wrapper:hover .row-actions-wrapper .row-actions-toggler svg{opacity:1}#sort-panel,#global-filter{margin-bottom:1em}:host(.kup-center-aligned) #kup-component .box-section{text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell{justify-content:center;margin:auto;text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell .f-cell__content{justify-content:center;margin:auto;text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell img{margin:auto}:host(.kup-right-aligned) #kup-component .box-section{text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell{justify-content:flex-end;margin-left:auto;margin-right:0;text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell .f-cell__content{justify-content:flex-end;margin-left:auto;margin-right:0;text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell img{margin-left:auto;margin-right:0}:host(.kup-top-aligned) #box-container .box-wrapper .box .box-section .column{justify-content:flex-start}:host(.kup-bottom-aligned) #box-container .box-wrapper .box .box-section .column{justify-content:flex-end}:host(:not(.kup-borderless)) .box{border:1px solid var(--kup-border-color)}:host(.kup-flat-on-hover) #box-container .box-wrapper .box:hover{box-shadow:none}:host(.kup-shaped) .box{border-radius:10px}:host(.kup-round) .box{border-radius:25px}:host(.kup-dashed-sections) .box-section{border:2px dashed var(--kup-text-color)}:host(:not(.kup-paddingless)) #box-container .box{padding:3px}:host(:not(.kup-paddingless)) #box-container .box .box-section .box-object{padding:1px 4px}:host(:not(.kup-paddingless)) #box-container .box .box-section.last-child{margin:3px 4px}:host(.kup-danger){--kup-box-primary-color-rgb:var(--kup-danger-color-rgb)}:host(.kup-info){--kup-box-primary-color-rgb:var(--kup-info-color-rgb)}:host(.kup-secondary){--kup-box-primary-color-rgb:var(--kup-secondary-color-rgb)}:host(.kup-success){--kup-box-primary-color-rgb:var(--kup-success-color-rgb)}:host(.kup-warning){--kup-box-primary-color-rgb:var(--kup-warning-color-rgb)}";export{D as kup_box}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,f as s,h as e,H as o,g as n}from"./p-d3b542b3.js";import{F as r}from"./p-928c5c36.js";import{F as a}from"./p-cd5cfa7c.js";import{F as h}from"./p-edae3076.js";import{F as l}from"./p-a203f78b.js";import{k as c,a6 as d,h as u,B as p,c as m}from"./p-fc2b1229.js";import{g as f,s as x}from"./p-682a367a.js";import{c as g}from"./p-97e8ea42.js";import"./p-6c77a36c.js";import"./p-38d7584e.js";import"./p-79b0730b.js";import"./p-81605f08.js";var b;!function(t){t.customStyle="Custom style of the component.",t.data="The data of the component.",t.enableDesign="When set to true, the component is in design mode and it is draggable."}(b||(b={}));const y=class{constructor(s){t(this,s),this.kupSave=i(this,"kup-dashboard-save",6),this.resetInternalData=!1,this.customStyle="",this.data=null,this.enableDesign=!1,this.kupManager=c(),this.internalData=null,this.internalDataBackup=null}onKupSave(){this.kupSave.emit({comp:this,id:this.rootElement.id,data:this.internalData})}dataChanged(){this.resetData()}async getProps(t){return f(this,b,t)}async refresh(){s(this)}async setProps(t){x(this,b,t)}buildGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var i=16*Math.random()|0;return("x"===t?i:3&i|8).toString(16)}))}buildHeader(){const t={icon:"cancel",label:this.kupManager.language.translate(d.RESET),secondary:!0,onClick:()=>{this.resetData()}},i={icon:"save",label:this.kupManager.language.translate(d.SAVE),onClick:()=>this.onKupSave()};return e("div",{class:"header"},this.enableDesign?e(r,Object.assign({},t)):void 0,this.enableDesign?e(r,Object.assign({},i)):void 0)}buildForm(t,i){return t?e("div",{class:{form:!0,"layout-column":t&&"column"==t.layout,"layout-row":t&&"row"==t.layout,"form-dropzone":this.enableDesign&&t&&null!=t.sections&&t.sections.length>0},style:this.getGridStyle(t),ref:s=>{s&&(s.kupData={parent:i,form:t})}},t.sections.map((i=>this.buildSection(i,t)))):e("div",null,this.kupManager.language.translate(u.EMPTY_DATA))}buildSectionHeader(t,i){const s={value:t.dim,label:this.kupManager.language.translate(d.DIMENSION),onChange:i=>{const{target:s}=i;t.dim=s.value}},o={icon:"add",slim:!0,onClick:()=>{t.sections||(t.sections=[]),t.sections.push({id:t.id+(t.sections.length+1),loaded:t.loaded,layout:t.layout}),this.resetData(this.internalData)}},n={icon:"remove",slim:!0,secondary:!0,onClick:()=>{const s=i.sections.indexOf(t);i.sections.splice(s,1),this.resetData(this.internalData)}},l={checked:t.loaded,label:this.kupManager.language.translate(d.LOADED),onChange:()=>{t.loaded=!t.loaded,this.refresh()}},c={checked:"column"==t.layout,label:this.kupManager.language.translate(d.VERTICAL),onChange:()=>{t.layout="column"==t.layout?"row":"column",this.refresh()}};return e("div",{class:"section-header"},e("div",null,t.id," - ",t.layout),e("div",null,e("div",{class:"section-header-actions"},e(h,Object.assign({},s)),e(a,Object.assign({},l)),e(a,Object.assign({},c)),e(r,Object.assign({},o)),e(r,Object.assign({},n)))))}buildSection(t,i){const s={"section-body":!0,"layout-column":t&&"column"==t.layout,"layout-row":t&&"row"==t.layout};return e("div",{class:{section:!0,"section-draggable":this.enableDesign,"section-dropzone":this.enableDesign},ref:s=>{s&&(s.kupData={parent:i,section:t})}},this.enableDesign?this.buildSectionHeader(t,i):void 0,e("div",{class:s,style:this.getGridStyle(t)},this.enableDesign||!t.loaded||t.sections&&0!=t.sections.length?void 0:e("slot",{name:t.id}),t.sections&&(t.loaded||this.enableDesign)?t.sections.map((i=>this.buildSection(i,t))):void 0))}didRenderInteractables(){try{const t=[];this.rootElement.shadowRoot.querySelectorAll(".section-draggable").forEach((i=>t.push(i))),t.forEach((t=>{this.kupManager.interact.draggable(t,null,null,p.CLONE)}))}catch(t){this.kupManager.debug.logMessage(this,t,m.ERROR)}try{const t=[];this.rootElement.shadowRoot.querySelectorAll(".section-dropzone").forEach((i=>t.push(i))),this.rootElement.shadowRoot.querySelectorAll(".form-dropzone").forEach((i=>t.push(i))),t.forEach((t=>{this.kupManager.interact.dropzone(t,null,null,{drop:t=>{this.dropped(t.currentTarget,t.relatedTarget)}})}))}catch(t){this.kupManager.debug.logMessage(this,t,m.ERROR)}}dropped(t,i){const s=i.kupData.parent.sections.indexOf(i.kupData.section);if(i.kupData.parent.sections.splice(s,1),t.kupData.form)t.kupData.form.sections||(t.kupData.form.sections=[]),t.kupData.form.sections.push(i.kupData.section),i.kupData.parent=t.kupData.form;else if(t.kupData.section){if(!t.kupData.section.sections||0==t.kupData.section.sections.length){const s=JSON.parse(JSON.stringify(t.kupData.section));s.dim=null,i.kupData.section.dim=null,t.kupData.section.id=this.buildGuid(),t.kupData.section.sections=[],t.kupData.section.sections.push(s)}t.kupData.section.sections.push(i.kupData.section),i.kupData.parent=t.kupData.section}this.resetData(this.internalData)}getGridStyle(t){let i={};if(!this.enableDesign&&t.sections){let s="";t.sections.forEach((t=>{s+=t.dim?t.dim.indexOf("%")<0?" "+t.dim+"px":" "+t.dim:" 1fr"})),"column"==t.layout&&(i.gridTemplateRows=s),"row"==t.layout&&(i.gridTemplateColumns=s)}return i}resetData(t=null){t&&(this.internalDataBackup=t),this.resetInternalData=!0,setTimeout((()=>{this.internalDataBackup&&(this.internalData=this.internalDataBackup,this.internalDataBackup=null),this.resetInternalData=!1}),250)}unregisterInteractables(){this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll(".section-dropzone"))),this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll(".section-draggable"))),this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll(".form-dropzone")))}componentWillLoad(){this.kupManager.dates.register(this),this.kupManager.debug.logLoad(this,!1),this.kupManager.language.register(this),this.kupManager.theme.register(this)}componentDidLoad(){this.kupManager.debug.logLoad(this,!0)}componentWillRender(){this.kupManager.debug.logRender(this,!1),this.resetInternalData?(this.internalData=null,this.unregisterInteractables()):this.internalData||(this.internalData=JSON.parse(JSON.stringify(this.data)))}componentDidRender(){this.kupManager.debug.logRender(this,!0);const t=this.rootElement.shadowRoot;if(t){const i=t.querySelectorAll(".f-text-field");i&&i.forEach((t=>{l(t)}))}this.didRenderInteractables()}render(){return e(o,null,e("style",null,this.kupManager.theme.setKupStyle(this.rootElement)),e("div",{id:g},this.buildHeader(),this.buildForm(this.internalData,null)))}disconnectedCallback(){this.unregisterInteractables(),this.kupManager.dates.unregister(this),this.kupManager.language.unregister(this),this.kupManager.theme.unregister(this)}get rootElement(){return n(this)}static get watchers(){return{data:["dataChanged"]}}};y.style=":host{width:100%;height:100%}#kup-component{height:100%}.header{display:flex;flex-direction:row;justify-content:center}.header>*{margin-left:0.5em}.form{display:grid;height:100%}.form-dropzone{padding:1em;grid-gap:0.5em;border:1px solid var(--kup-primary-color)}.section{display:flex;flex-direction:column;overflow:auto}.section-header{display:flex;flex-direction:column}.section-header>*{width:100%;display:flex;flex-direction:row}.section-header>*>.section-header-actions{display:flex;justify-content:end}.section-header>*>.section-header-actions>*{margin-top:auto;margin-bottom:auto}.section-body{display:grid}.section-dropzone{border:1px solid var(--kup-primary-color)}.section-draggable{border:1px solid var(--kup-secondary-color);padding:1em}.component{height:fit-content;padding:1em;margin:0.5em}.layout-row{grid-auto-flow:column;grid-template-columns:min-content}.layout-column{grid-auto-flow:row;grid-template-rows:min-content}";export{y as kup_dashboard}
|