@optionfactory/ful 4.0.5 → 4.0.7
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/ful.css +1 -1
- package/dist/ful.css.map +1 -1
- package/dist/ful.iife.js +64 -19
- package/dist/ful.iife.js.map +1 -1
- package/dist/ful.iife.min.js +1 -1
- package/dist/ful.iife.min.js.map +1 -1
- package/dist/ful.min.mjs +1 -1
- package/dist/ful.min.mjs.map +1 -1
- package/dist/ful.mjs +64 -19
- package/dist/ful.mjs.map +1 -1
- package/package.json +2 -2
package/dist/ful.mjs
CHANGED
|
@@ -1951,6 +1951,7 @@ class Select extends ParsedElement {
|
|
|
1951
1951
|
await this.#loader.prefetch?.();
|
|
1952
1952
|
const fragment = this.template().withOverlay({ slots, name }).render();
|
|
1953
1953
|
this.#input = fragment.querySelector('input');
|
|
1954
|
+
Attributes.forward('input-', this, this.#input);
|
|
1954
1955
|
this.#badges = fragment.querySelector('badges');
|
|
1955
1956
|
|
|
1956
1957
|
this.value = observed.value;
|
|
@@ -2399,15 +2400,33 @@ class SortButton extends ParsedElement {
|
|
|
2399
2400
|
|
|
2400
2401
|
class Pagination extends ParsedElement {
|
|
2401
2402
|
static observed = ["total:number", "current:number"];
|
|
2403
|
+
static l10n = {
|
|
2404
|
+
en: {
|
|
2405
|
+
'showing': 'Page {0} of {1}',
|
|
2406
|
+
'navigation': "Page navigation",
|
|
2407
|
+
'previous': "Previous",
|
|
2408
|
+
'next': "Next",
|
|
2409
|
+
},
|
|
2410
|
+
it: {
|
|
2411
|
+
'showing': 'Pagina {0} di {1}',
|
|
2412
|
+
'navigation': "Navigazione pagine",
|
|
2413
|
+
'previous': "Precedente",
|
|
2414
|
+
'next': "Successivo",
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
static config = {
|
|
2418
|
+
prevIcon: 'bi bi-chevron-left',
|
|
2419
|
+
nextIcon: 'bi bi-chevron-right',
|
|
2420
|
+
reloadIcon: 'bi bi-arrow-clockwise',
|
|
2421
|
+
}
|
|
2402
2422
|
static template = `
|
|
2403
|
-
<nav aria-label="
|
|
2423
|
+
<nav data-tpl-aria-label="#l10n:t('navigation')" class="user-select-none">
|
|
2404
2424
|
<ul class="pagination">
|
|
2405
|
-
<li class="page-item ms-auto me-2
|
|
2406
|
-
<li class="page-item
|
|
2407
|
-
<li class="page-item reload me-2"><a role="button"><i class="bi bi-arrow-clockwise"></i></a></li>
|
|
2425
|
+
<li class="page-item ms-auto me-2 pagination-index"> {{ #l10n:t('showing', curr.label, total) }}</li>
|
|
2426
|
+
<li class="page-item reload me-2"><a role="button"><i data-tpl-class="config.reloadIcon"></i></a></li>
|
|
2408
2427
|
<li class="page-item prev">
|
|
2409
|
-
<a data-tpl-class="prev.enabled?'page-link':'page-link disabled'" aria-label="
|
|
2410
|
-
<i aria-hidden="true" class="
|
|
2428
|
+
<a data-tpl-class="prev.enabled?'page-link':'page-link disabled'" data-tpl-aria-label="#l10n:t('previous')" role="button" data-tpl-data-page="prev.index">
|
|
2429
|
+
<i aria-hidden="true" data-tpl-class="config.prevIcon"></i>
|
|
2411
2430
|
</a>
|
|
2412
2431
|
</li>
|
|
2413
2432
|
<li class="page-item" data-tpl-each="pages" data-tpl-var="page">
|
|
@@ -2416,18 +2435,16 @@ class Pagination extends ParsedElement {
|
|
|
2416
2435
|
</a>
|
|
2417
2436
|
</li>
|
|
2418
2437
|
<li class="page-item next">
|
|
2419
|
-
<a data-tpl-class="next.enabled?'page-link':'page-link disabled'" aria-label="
|
|
2420
|
-
<i aria-hidden="true" class="
|
|
2438
|
+
<a data-tpl-class="next.enabled?'page-link':'page-link disabled'" data-tpl-aria-label="#l10n:t('next')" role="button" data-tpl-data-page="next.index">
|
|
2439
|
+
<i aria-hidden="true" data-tpl-class="config.nextIcon"></i>
|
|
2421
2440
|
</a>
|
|
2422
2441
|
</li>
|
|
2423
2442
|
</ul>
|
|
2424
2443
|
</nav>
|
|
2425
2444
|
`;
|
|
2426
|
-
#paginationLabel;
|
|
2427
2445
|
#total = 0;
|
|
2428
2446
|
#current = 0;
|
|
2429
2447
|
render({ observed }) {
|
|
2430
|
-
this.#paginationLabel = this.hasAttribute('pagination-label');
|
|
2431
2448
|
this.update(observed.current ?? 0, observed.total ?? 0);
|
|
2432
2449
|
this.addEventListener('click', (/** @type any */evt) => {
|
|
2433
2450
|
const el = evt.target.closest('a');
|
|
@@ -2463,8 +2480,7 @@ class Pagination extends ParsedElement {
|
|
|
2463
2480
|
pages.push({ index: n, label: n + 1 });
|
|
2464
2481
|
}
|
|
2465
2482
|
}
|
|
2466
|
-
|
|
2467
|
-
this.template().withOverlay({ total, prev, curr, next, pages, paginationLabel }).renderTo(this);
|
|
2483
|
+
this.template().withOverlay({ total, prev, curr, next, pages }).renderTo(this);
|
|
2468
2484
|
}
|
|
2469
2485
|
get total() {
|
|
2470
2486
|
return this.#total;
|
|
@@ -2556,6 +2572,21 @@ class TableLoader{
|
|
|
2556
2572
|
|
|
2557
2573
|
class Table extends ParsedElement {
|
|
2558
2574
|
static slots = true;
|
|
2575
|
+
static l10n = {
|
|
2576
|
+
en: {
|
|
2577
|
+
'notloaded': 'Start searching to see results.',
|
|
2578
|
+
'error': 'Error while loading data:',
|
|
2579
|
+
'nodata': 'No elements found.',
|
|
2580
|
+
},
|
|
2581
|
+
it: {
|
|
2582
|
+
'notloaded': 'Avvia la ricerca per visualizzare i risultati.',
|
|
2583
|
+
'error': 'Errore nel caricamento dei dati:',
|
|
2584
|
+
'nodata': 'Nessun elemento trovato.',
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
static conf = {
|
|
2588
|
+
sortIcon: '',
|
|
2589
|
+
}
|
|
2559
2590
|
static template = `
|
|
2560
2591
|
<ful-form data-tpl-if="slots.filters">
|
|
2561
2592
|
{{{{ slots.filters }}}}
|
|
@@ -2577,7 +2608,7 @@ class Table extends ParsedElement {
|
|
|
2577
2608
|
<td data-tpl-colspan="schema.length" class="text-center align-middle p-4">
|
|
2578
2609
|
<i class="bi bi-search" style="font-size: 40px; color: #BDC3CA"></i>
|
|
2579
2610
|
<p class="mt-3 mb-0" style="color: #BDC3CA">
|
|
2580
|
-
|
|
2611
|
+
{{ #l10n:t('notloaded') }}
|
|
2581
2612
|
</p>
|
|
2582
2613
|
</td>
|
|
2583
2614
|
</tr>
|
|
@@ -2593,7 +2624,7 @@ class Table extends ParsedElement {
|
|
|
2593
2624
|
<tr>
|
|
2594
2625
|
<td data-tpl-colspan="schema.length" class="text-center align-middle p-4">
|
|
2595
2626
|
<div class="alert alert-danger">
|
|
2596
|
-
<p>
|
|
2627
|
+
<p>{{ #l10n:t('error') }}</p>
|
|
2597
2628
|
<p class="mb-0" data-ref="feedback-error"></p>
|
|
2598
2629
|
</div>
|
|
2599
2630
|
</td>
|
|
@@ -2610,7 +2641,7 @@ class Table extends ParsedElement {
|
|
|
2610
2641
|
row: `
|
|
2611
2642
|
<tr data-tpl-if="pageResponse.data.length == 0">
|
|
2612
2643
|
<td data-tpl-colspan="schema.length" class="text-center align-middle p-4">
|
|
2613
|
-
|
|
2644
|
+
{{ #l10n:t('nodata') }}
|
|
2614
2645
|
</td>
|
|
2615
2646
|
</tr>
|
|
2616
2647
|
<tr data-tpl-each="pageResponse.data" data-tpl-var="row">
|
|
@@ -2759,7 +2790,7 @@ class InstantFilter extends ParsedElement {
|
|
|
2759
2790
|
render({ slots }) {
|
|
2760
2791
|
const label = Fragments.toHtml(slots.default.cloneNode(true)).trim().length === 0 ? null : slots.default;
|
|
2761
2792
|
const name = this.getAttribute("name");
|
|
2762
|
-
const fragment = this.template().withOverlay({ label, name
|
|
2793
|
+
const fragment = this.template().withOverlay({ slots, label, name }).render();
|
|
2763
2794
|
this.#operator = fragment.querySelector('[data-ref=operator]');
|
|
2764
2795
|
this.#value1 = fragment.querySelector('[data-ref=value1]');
|
|
2765
2796
|
this.#value2 = fragment.querySelector('[data-ref=value2]');
|
|
@@ -2855,7 +2886,7 @@ class LocalDateFilter extends ParsedElement {
|
|
|
2855
2886
|
render({ slots }) {
|
|
2856
2887
|
const label = Fragments.toHtml(slots.default.cloneNode(true)).trim().length === 0 ? null : slots.default;
|
|
2857
2888
|
const name = this.getAttribute("name");
|
|
2858
|
-
const fragment = this.template().withOverlay({ label, name }).render(
|
|
2889
|
+
const fragment = this.template().withOverlay({ slots, label, name }).render();
|
|
2859
2890
|
this.#operator = fragment.querySelector('[data-ref=operator]');
|
|
2860
2891
|
this.#value1 = fragment.querySelector('[data-ref=value1]');
|
|
2861
2892
|
this.#value2 = fragment.querySelector('[data-ref=value2]');
|
|
@@ -2945,7 +2976,7 @@ class TextFilter extends ParsedElement {
|
|
|
2945
2976
|
render({ slots }) {
|
|
2946
2977
|
const label = Fragments.toHtml(slots.default.cloneNode(true)).trim().length === 0 ? null : slots.default;
|
|
2947
2978
|
const name = this.getAttribute("name");
|
|
2948
|
-
const fragment = this.template().withOverlay({ label, name }).render(
|
|
2979
|
+
const fragment = this.template().withOverlay({ slots, label, name }).render();
|
|
2949
2980
|
this.#operator = fragment.querySelector('[data-ref=operator]');
|
|
2950
2981
|
this.#value = fragment.querySelector('[data-ref=value]');
|
|
2951
2982
|
this.#fieldError = fragment.querySelector('ful-field-error');
|
|
@@ -3007,6 +3038,17 @@ class Plugin {
|
|
|
3007
3038
|
.withRedirectOnUnauthorized("/")
|
|
3008
3039
|
.build();
|
|
3009
3040
|
registry
|
|
3041
|
+
.defineModule("l10n", {
|
|
3042
|
+
t: function (k, ...args) {
|
|
3043
|
+
const format = this.l10n[this.language][k] ?? this.l10n['en'][k] ?? k;
|
|
3044
|
+
if (args.length === 0) {
|
|
3045
|
+
return format;
|
|
3046
|
+
}
|
|
3047
|
+
return format.replace(/{(\d+)}/g, (m, is) => {
|
|
3048
|
+
return args[Number(is)];
|
|
3049
|
+
});
|
|
3050
|
+
}
|
|
3051
|
+
})
|
|
3010
3052
|
.defineComponent('http-client', httpClient)
|
|
3011
3053
|
.defineElement('ful-spinner', Spinner)
|
|
3012
3054
|
.defineElement('ful-form', Form)
|
|
@@ -3028,7 +3070,10 @@ class Plugin {
|
|
|
3028
3070
|
.defineElement('ful-dropdown', Dropdown)
|
|
3029
3071
|
.defineComponent("loaders:select", SelectLoader)
|
|
3030
3072
|
.defineComponent("loaders:form", FormLoader)
|
|
3031
|
-
.defineComponent("loaders:table", TableLoader)
|
|
3073
|
+
.defineComponent("loaders:table", TableLoader)
|
|
3074
|
+
.defineOverlay({
|
|
3075
|
+
language: navigator?.language?.split("-")?.[0] ?? "en"
|
|
3076
|
+
});
|
|
3032
3077
|
}
|
|
3033
3078
|
}
|
|
3034
3079
|
|