@livenetworks/ashlar 2.0.9 → 2.0.10
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/components/ln-accordion/ln-accordion.js +1 -1
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-core/lifecycle.js +1 -1
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-debug/src/generated-attributes.js +1 -0
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-filter/ln-filter.schema.json +161 -153
- package/components/ln-filter/src/ln-filter.js +77 -5
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-include/ln-include.js +1 -1
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-search/src/ln-search.js +17 -1
- package/components/ln-slug/ln-slug.js +1 -1
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sortable/ln-sortable.js +1 -1
- package/components/ln-stat/ln-stat.js +1 -1
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-tabs/ln-tabs.js +1 -1
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toggle/ln-toggle.js +1 -1
- package/components/ln-tooltip/ln-tooltip.js +1 -1
- package/components/ln-translations/ln-translations.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-upload/ln-upload.js +1 -1
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
- package/ln-ashlar.html-data.json +5 -0
- package/package.json +1 -1
- package/web-types.json +8 -1
|
@@ -1,153 +1,161 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$comment": "This file is partly generated. The $comment, component, generator, and each attribute's direction, sources, type, values, fallback, and description keys are owned by the generator and synchronized from JS source code. All other keys are preserved and safe to hand-author. Regenerate with `npm run sync:ln-schemas`.",
|
|
3
|
-
"component": "ln-filter",
|
|
4
|
-
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
-
"attributes": {
|
|
6
|
-
"data-ln-col": {
|
|
7
|
-
"direction": "author",
|
|
8
|
-
"sources": [
|
|
9
|
-
"src/filter-model.js"
|
|
10
|
-
]
|
|
11
|
-
},
|
|
12
|
-
"data-ln-debug": {
|
|
13
|
-
"direction": null,
|
|
14
|
-
"sources": [
|
|
15
|
-
"ln-filter-dev.scss"
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
"data-ln-empty": {
|
|
19
|
-
"direction": "author",
|
|
20
|
-
"sources": [
|
|
21
|
-
"src/ln-filter.js"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
"data-ln-empty-state": {
|
|
25
|
-
"direction": "author",
|
|
26
|
-
"sources": [
|
|
27
|
-
"src/ln-filter.js"
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
"data-ln-field": {
|
|
31
|
-
"direction": "author",
|
|
32
|
-
"sources": [
|
|
33
|
-
"src/filter-model.js"
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
"data-ln-filter": {
|
|
37
|
-
"direction":
|
|
38
|
-
"sources": [
|
|
39
|
-
"ln-filter-dev.scss",
|
|
40
|
-
"src/ln-filter.js"
|
|
41
|
-
],
|
|
42
|
-
"type": "string",
|
|
43
|
-
"description": "Target table or list element ID to filter"
|
|
44
|
-
},
|
|
45
|
-
"data-ln-filter-col": {
|
|
46
|
-
"direction": "author",
|
|
47
|
-
"sources": [
|
|
48
|
-
"src/filter-model.js",
|
|
49
|
-
"src/ln-filter.js"
|
|
50
|
-
],
|
|
51
|
-
"type": "string",
|
|
52
|
-
"description": "Column name or index filter specifier"
|
|
53
|
-
},
|
|
54
|
-
"data-ln-filter-hide": {
|
|
55
|
-
"direction": "runtime",
|
|
56
|
-
"sources": [
|
|
57
|
-
"ln-filter.scss",
|
|
58
|
-
"src/ln-filter.js"
|
|
59
|
-
],
|
|
60
|
-
"type": "enum",
|
|
61
|
-
"values": [
|
|
62
|
-
"collapse",
|
|
63
|
-
"none"
|
|
64
|
-
],
|
|
65
|
-
"fallback": "collapse",
|
|
66
|
-
"description": "CSS hiding strategy for non-matching rows"
|
|
67
|
-
},
|
|
68
|
-
"data-ln-filter-key": {
|
|
69
|
-
"direction": "author",
|
|
70
|
-
"sources": [
|
|
71
|
-
"ln-filter-dev.scss",
|
|
72
|
-
"src/filter-model.js",
|
|
73
|
-
"src/ln-filter.js"
|
|
74
|
-
],
|
|
75
|
-
"type": "string",
|
|
76
|
-
"description": "Field key for filter matching"
|
|
77
|
-
},
|
|
78
|
-
"data-ln-filter-reset": {
|
|
79
|
-
"direction": "author",
|
|
80
|
-
"sources": [
|
|
81
|
-
"src/ln-filter.js"
|
|
82
|
-
],
|
|
83
|
-
"type": "trigger",
|
|
84
|
-
"description": "Filter reset button or option trigger"
|
|
85
|
-
},
|
|
86
|
-
"data-ln-filter-
|
|
87
|
-
"direction": "
|
|
88
|
-
"sources": [
|
|
89
|
-
"src/ln-filter.js"
|
|
90
|
-
],
|
|
91
|
-
"type": "
|
|
92
|
-
"description": "
|
|
93
|
-
},
|
|
94
|
-
"data-ln-filter-
|
|
95
|
-
"direction": "
|
|
96
|
-
"sources": [
|
|
97
|
-
"src/ln-filter.js"
|
|
98
|
-
],
|
|
99
|
-
"type": "string",
|
|
100
|
-
"description": "
|
|
101
|
-
},
|
|
102
|
-
"data-ln-
|
|
103
|
-
"direction":
|
|
104
|
-
"sources": [
|
|
105
|
-
"src/ln-filter.js"
|
|
106
|
-
],
|
|
107
|
-
"type": "string",
|
|
108
|
-
"description": "
|
|
109
|
-
},
|
|
110
|
-
"data-ln-
|
|
111
|
-
"direction":
|
|
112
|
-
"sources": [
|
|
113
|
-
"src/filter
|
|
114
|
-
]
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$comment": "This file is partly generated. The $comment, component, generator, and each attribute's direction, sources, type, values, fallback, and description keys are owned by the generator and synchronized from JS source code. All other keys are preserved and safe to hand-author. Regenerate with `npm run sync:ln-schemas`.",
|
|
3
|
+
"component": "ln-filter",
|
|
4
|
+
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
+
"attributes": {
|
|
6
|
+
"data-ln-col": {
|
|
7
|
+
"direction": "author",
|
|
8
|
+
"sources": [
|
|
9
|
+
"src/filter-model.js"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"data-ln-debug": {
|
|
13
|
+
"direction": null,
|
|
14
|
+
"sources": [
|
|
15
|
+
"ln-filter-dev.scss"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"data-ln-empty": {
|
|
19
|
+
"direction": "author",
|
|
20
|
+
"sources": [
|
|
21
|
+
"src/ln-filter.js"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"data-ln-empty-state": {
|
|
25
|
+
"direction": "author",
|
|
26
|
+
"sources": [
|
|
27
|
+
"src/ln-filter.js"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"data-ln-field": {
|
|
31
|
+
"direction": "author",
|
|
32
|
+
"sources": [
|
|
33
|
+
"src/filter-model.js"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"data-ln-filter": {
|
|
37
|
+
"direction": "author",
|
|
38
|
+
"sources": [
|
|
39
|
+
"ln-filter-dev.scss",
|
|
40
|
+
"src/ln-filter.js"
|
|
41
|
+
],
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "Target table or list element ID to filter"
|
|
44
|
+
},
|
|
45
|
+
"data-ln-filter-col": {
|
|
46
|
+
"direction": "author",
|
|
47
|
+
"sources": [
|
|
48
|
+
"src/filter-model.js",
|
|
49
|
+
"src/ln-filter.js"
|
|
50
|
+
],
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Column name or index filter specifier"
|
|
53
|
+
},
|
|
54
|
+
"data-ln-filter-hide": {
|
|
55
|
+
"direction": "runtime",
|
|
56
|
+
"sources": [
|
|
57
|
+
"ln-filter.scss",
|
|
58
|
+
"src/ln-filter.js"
|
|
59
|
+
],
|
|
60
|
+
"type": "enum",
|
|
61
|
+
"values": [
|
|
62
|
+
"collapse",
|
|
63
|
+
"none"
|
|
64
|
+
],
|
|
65
|
+
"fallback": "collapse",
|
|
66
|
+
"description": "CSS hiding strategy for non-matching rows"
|
|
67
|
+
},
|
|
68
|
+
"data-ln-filter-key": {
|
|
69
|
+
"direction": "author",
|
|
70
|
+
"sources": [
|
|
71
|
+
"ln-filter-dev.scss",
|
|
72
|
+
"src/filter-model.js",
|
|
73
|
+
"src/ln-filter.js"
|
|
74
|
+
],
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "Field key for filter matching"
|
|
77
|
+
},
|
|
78
|
+
"data-ln-filter-reset": {
|
|
79
|
+
"direction": "author",
|
|
80
|
+
"sources": [
|
|
81
|
+
"src/ln-filter.js"
|
|
82
|
+
],
|
|
83
|
+
"type": "trigger",
|
|
84
|
+
"description": "Filter reset button or option trigger"
|
|
85
|
+
},
|
|
86
|
+
"data-ln-filter-target": {
|
|
87
|
+
"direction": "both",
|
|
88
|
+
"sources": [
|
|
89
|
+
"src/ln-filter.js"
|
|
90
|
+
],
|
|
91
|
+
"type": "marker",
|
|
92
|
+
"description": "Marker on target container or table observed by ln-filter"
|
|
93
|
+
},
|
|
94
|
+
"data-ln-filter-value": {
|
|
95
|
+
"direction": "author",
|
|
96
|
+
"sources": [
|
|
97
|
+
"src/ln-filter.js"
|
|
98
|
+
],
|
|
99
|
+
"type": "string",
|
|
100
|
+
"description": "Value to match for this filter input"
|
|
101
|
+
},
|
|
102
|
+
"data-ln-filter-values": {
|
|
103
|
+
"direction": "both",
|
|
104
|
+
"sources": [
|
|
105
|
+
"src/ln-filter.js"
|
|
106
|
+
],
|
|
107
|
+
"type": "string",
|
|
108
|
+
"description": "Encoded active filter values"
|
|
109
|
+
},
|
|
110
|
+
"data-ln-hash": {
|
|
111
|
+
"direction": null,
|
|
112
|
+
"sources": [
|
|
113
|
+
"src/ln-filter.js"
|
|
114
|
+
],
|
|
115
|
+
"type": "string",
|
|
116
|
+
"description": "URL hash routing key for filter state persistence"
|
|
117
|
+
},
|
|
118
|
+
"data-ln-popover": {
|
|
119
|
+
"direction": "author",
|
|
120
|
+
"sources": [
|
|
121
|
+
"src/filter-model.js"
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"data-ln-popover-for": {
|
|
125
|
+
"direction": "author",
|
|
126
|
+
"sources": [
|
|
127
|
+
"src/filter-model.js"
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
"data-ln-sort-exclude": {
|
|
131
|
+
"direction": "author",
|
|
132
|
+
"sources": [
|
|
133
|
+
"src/ln-filter.js"
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"data-ln-table-col": {
|
|
137
|
+
"direction": "author",
|
|
138
|
+
"sources": [
|
|
139
|
+
"src/filter-model.js"
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
"data-ln-table-empty": {
|
|
143
|
+
"direction": "author",
|
|
144
|
+
"sources": [
|
|
145
|
+
"src/ln-filter.js"
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
"data-ln-table-filter-col": {
|
|
149
|
+
"direction": "author",
|
|
150
|
+
"sources": [
|
|
151
|
+
"src/filter-model.js"
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
"data-ln-value": {
|
|
155
|
+
"direction": "author",
|
|
156
|
+
"sources": [
|
|
157
|
+
"src/ln-filter.js"
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -11,6 +11,7 @@ import { arraysDiffer, decodeFilterValues, deriveActiveFilters, encodeFilterValu
|
|
|
11
11
|
const COL_ATTR = 'data-ln-filter-col';
|
|
12
12
|
const HASH_ATTR = 'data-ln-hash';
|
|
13
13
|
const VALUES_ATTR = 'data-ln-filter-values';
|
|
14
|
+
const TARGET_ATTR = 'data-ln-filter-target';
|
|
14
15
|
|
|
15
16
|
// Shared column filter state per plain table (AND across columns, OR within column)
|
|
16
17
|
const _tableFilters = new WeakMap();
|
|
@@ -19,14 +20,15 @@ import { arraysDiffer, decodeFilterValues, deriveActiveFilters, encodeFilterValu
|
|
|
19
20
|
|
|
20
21
|
// ─── Attribute Contract (SSOT) ──────────────────────────
|
|
21
22
|
const ATTRIBUTES = {
|
|
22
|
-
'data-ln-filter': { prop: 'targetId', type: 'string', read: attrStr, fallback: null, description: 'Target table or list element ID to filter' },
|
|
23
|
+
'data-ln-filter': { prop: 'targetId', type: 'string', read: attrStr, fallback: null, effect: _syncAttribute, description: 'Target table or list element ID to filter' },
|
|
23
24
|
'data-ln-hash': { type: 'string', effect: _syncAttribute, description: 'URL hash routing key for filter state persistence' },
|
|
24
25
|
'data-ln-filter-values': { type: 'string', effect: _syncAttribute, description: 'Encoded active filter values' },
|
|
25
26
|
'data-ln-filter-col': { type: 'string', description: 'Column name or index filter specifier' },
|
|
26
27
|
'data-ln-filter-key': { type: 'string', description: 'Field key for filter matching' },
|
|
27
28
|
'data-ln-filter-reset': { type: 'trigger', description: 'Filter reset button or option trigger' },
|
|
28
29
|
'data-ln-filter-value': { type: 'string', description: 'Value to match for this filter input' },
|
|
29
|
-
'data-ln-filter-hide': { type: 'enum', values: ['collapse', 'none'], fallback: 'collapse', description: 'CSS hiding strategy for non-matching rows' }
|
|
30
|
+
'data-ln-filter-hide': { type: 'enum', values: ['collapse', 'none'], fallback: 'collapse', description: 'CSS hiding strategy for non-matching rows' },
|
|
31
|
+
'data-ln-filter-target': { type: 'marker', description: 'Marker on target container or table observed by ln-filter' }
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
const ATTR_SPEC = attrSpec(ATTRIBUTES);
|
|
@@ -90,6 +92,31 @@ import { arraysDiffer, decodeFilterValues, deriveActiveFilters, encodeFilterValu
|
|
|
90
92
|
});
|
|
91
93
|
|
|
92
94
|
this._queueRender = queueRender;
|
|
95
|
+
|
|
96
|
+
const queueDomFilter = createBatcher(function () {
|
|
97
|
+
if (!self._destroyed) {
|
|
98
|
+
self._applyDomFilter();
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
this._queueDomFilter = queueDomFilter;
|
|
103
|
+
|
|
104
|
+
function _ensureTargetMarked() {
|
|
105
|
+
if (!self.targetId) return;
|
|
106
|
+
const target = document.getElementById(self.targetId);
|
|
107
|
+
if (target && !target.hasAttribute(TARGET_ATTR)) {
|
|
108
|
+
target.setAttribute(TARGET_ATTR, self.targetId);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this._ensureTargetMarked = _ensureTargetMarked;
|
|
113
|
+
_ensureTargetMarked();
|
|
114
|
+
queueBoot(function () {
|
|
115
|
+
if (!self._destroyed) {
|
|
116
|
+
_ensureTargetMarked();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
93
120
|
this._attachHandlers();
|
|
94
121
|
|
|
95
122
|
// Hash change listener
|
|
@@ -274,13 +301,19 @@ import { arraysDiffer, decodeFilterValues, deriveActiveFilters, encodeFilterValu
|
|
|
274
301
|
}
|
|
275
302
|
|
|
276
303
|
if (defaultPrevented) return;
|
|
304
|
+
self._applyDomFilter(target);
|
|
305
|
+
};
|
|
277
306
|
|
|
278
|
-
|
|
307
|
+
_component.prototype._applyDomFilter = function (targetOverride) {
|
|
308
|
+
const target = targetOverride || document.getElementById(this.targetId);
|
|
309
|
+
if (!target) return;
|
|
310
|
+
const active = _deriveActive(this);
|
|
311
|
+
const isReset = active.key === null || active.values.length === 0;
|
|
312
|
+
const table = target.tagName === 'TABLE' ? target : (target.querySelector ? target.querySelector('table') : null);
|
|
279
313
|
|
|
280
314
|
if (table) {
|
|
281
|
-
|
|
315
|
+
this._filterTableRows(active, table);
|
|
282
316
|
} else {
|
|
283
|
-
if (!target) return;
|
|
284
317
|
const children = target.children;
|
|
285
318
|
for (let i = 0; i < children.length; i++) {
|
|
286
319
|
const el = children[i];
|
|
@@ -383,6 +416,13 @@ import { arraysDiffer, decodeFilterValues, deriveActiveFilters, encodeFilterValu
|
|
|
383
416
|
}
|
|
384
417
|
if (Object.keys(filters).length === 0) _tableFilters.delete(table);
|
|
385
418
|
}
|
|
419
|
+
|
|
420
|
+
if (this.targetId) {
|
|
421
|
+
const remaining = document.querySelectorAll('[' + DOM_SELECTOR + '="' + this.targetId + '"]');
|
|
422
|
+
if (remaining.length <= 1) {
|
|
423
|
+
target.removeAttribute(TARGET_ATTR);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
386
426
|
}
|
|
387
427
|
|
|
388
428
|
if (this._onDomChange) {
|
|
@@ -420,6 +460,10 @@ import { arraysDiffer, decodeFilterValues, deriveActiveFilters, encodeFilterValu
|
|
|
420
460
|
_applyInputValues(el, key, values);
|
|
421
461
|
instance._render();
|
|
422
462
|
}
|
|
463
|
+
} else if (attrName === DOM_SELECTOR) {
|
|
464
|
+
instance.targetId = el.getAttribute(DOM_SELECTOR) || null;
|
|
465
|
+
instance._ensureTargetMarked();
|
|
466
|
+
instance._render();
|
|
423
467
|
}
|
|
424
468
|
}
|
|
425
469
|
|
|
@@ -427,6 +471,34 @@ import { arraysDiffer, decodeFilterValues, deriveActiveFilters, encodeFilterValu
|
|
|
427
471
|
|
|
428
472
|
registerComponent(DOM_SELECTOR, DOM_ATTRIBUTE, _component, 'ln-filter', {
|
|
429
473
|
attributes: ATTRIBUTES,
|
|
474
|
+
subtreeQuery: '[' + DOM_SELECTOR + '], [' + TARGET_ATTR + ']',
|
|
475
|
+
onSubtreeChange: function (host, mut) {
|
|
476
|
+
if (mut.addedNodes.length === 0 && mut.removedNodes.length === 0) return;
|
|
477
|
+
|
|
478
|
+
let targetId = null;
|
|
479
|
+
let targetEl = null;
|
|
480
|
+
|
|
481
|
+
if (host.hasAttribute(TARGET_ATTR)) {
|
|
482
|
+
targetEl = host;
|
|
483
|
+
targetId = host.getAttribute(TARGET_ATTR) || host.id;
|
|
484
|
+
} else if (host.hasAttribute(DOM_SELECTOR)) {
|
|
485
|
+
targetId = host.getAttribute(DOM_SELECTOR);
|
|
486
|
+
targetEl = targetId ? document.getElementById(targetId) : null;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
if (!targetId || !targetEl) return;
|
|
490
|
+
|
|
491
|
+
const controls = document.querySelectorAll('[' + DOM_SELECTOR + '="' + targetId + '"]');
|
|
492
|
+
for (let i = 0; i < controls.length; i++) {
|
|
493
|
+
const inst = controls[i][DOM_ATTRIBUTE];
|
|
494
|
+
if (inst && !inst._destroyed) {
|
|
495
|
+
const active = _deriveActive(inst);
|
|
496
|
+
if (active.values.length > 0) {
|
|
497
|
+
inst._queueDomFilter();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
},
|
|
430
502
|
persist: {
|
|
431
503
|
attr: VALUES_ATTR,
|
|
432
504
|
hashActive: function (el) { return !!resolveHashNamespace(el, 'filter'); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function E(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function g(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let i=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){i=t[l];break}if(!g(i))return}e.apply(console,t)}}function z(e,t,n){const i=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function p(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function G(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function X(e,t){const n=!!(t&&t.typed),i=t&&t.exclude,l={},s=e.elements,o={};if(n)for(let a=0;a<s.length;a++){const r=s[a];r.name&&r.type==="checkbox"&&!r.disabled&&(o[r.name]=(o[r.name]||0)+1)}for(let a=0;a<s.length;a++){const r=s[a];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(i&&r.matches&&r.matches(i)))if(r.type==="checkbox")n&&o[r.name]===1?l[r.name]=r.checked:(l[r.name]||(l[r.name]=[]),r.checked&&l[r.name].push(r.value));else if(r.type==="radio")r.checked&&(l[r.name]=r.value);else if(r.type==="select-multiple"){l[r.name]=[];for(let c=0;c<r.options.length;c++)r.options[c].selected&&l[r.name].push(r.options[c].value)}else if(n&&r.type==="hidden")l[r.name]=r.value;else if(n&&(r.type==="number"||r.type==="range")){const c=Number(r.value);l[r.name]=r.value===""||isNaN(c)?null:c}else l[r.name]=r.value}return l}function Y(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function L(e,t){const n=e.elements,i=[],l={};for(let s=0;s<n.length;s++){const o=n[s];o.name&&o.type==="checkbox"&&(l[o.name]=(l[o.name]||0)+1)}for(let s=0;s<n.length;s++){const o=n[s];if(o.type==="file"||o.type==="submit"||o.type==="button")continue;const a=o.getAttribute("data-ln-fill-as")||o.name;if(!a||!(a in t))continue;const r=t[a];if(o.type==="checkbox"){if(Array.isArray(r))o.checked=r.indexOf(o.value)!==-1;else if(l[o.name]>1){const c=String(r).split(",").map(function(u){return u.trim()});o.checked=c.indexOf(o.value)!==-1}else o.checked=Y(r);i.push(o)}else if(o.type==="radio")o.checked=o.value===String(r),i.push(o);else if(o.type==="select-multiple"){if(Array.isArray(r))for(let c=0;c<o.options.length;c++)o.options[c].selected=r.indexOf(o.options[c].value)!==-1;i.push(o)}else o.value=r,o.tagName==="SELECT"&&r!=null&&o.setAttribute("data-ln-value",r),i.push(o)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=L,window.lnCore.serializeForm=X,window.lnCore.resolveFormMethod=G);const T={};function Z(e,t){T[e]=t}function ee(e){return T[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=Z,window.lnCore.getDataMapper=ee);function te(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){z(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const I={};function ne(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];I[n]=t}function oe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return I[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ne,window.lnCore.getLocaleFallback=oe,window.lnCore.ensureLocaleObserver=te);const C={};function re(e,t){C[e]||(C[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=C[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function F(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let o=0;o<n.length;o++){const a=n[o],r=a.getAttribute("data-ln-field");t[r]!=null&&(a.textContent=t[r])}const i=e.querySelectorAll("[data-ln-attr]");for(let o=0;o<i.length;o++){const a=i[o],r=a.getAttribute("data-ln-attr").split(",");for(let c=0;c<r.length;c++){const u=r[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&a.setAttribute(d,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let o=0;o<l.length;o++){const a=l[o],r=a.getAttribute("data-ln-show");r in t&&a.classList.toggle("hidden",!t[r])}const s=e.querySelectorAll("[data-ln-class]");for(let o=0;o<s.length;o++){const a=s[o],r=a.getAttribute("data-ln-class").split(",");for(let c=0;c<r.length;c++){const u=r[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&a.classList.toggle(d,!!t[f])}}return e}function ie(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<n.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[i],t??null),n[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)F(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function $(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,a){return t[a]!==void 0?t[a]:""}))}const i=function(s,o){return t[o]!==void 0?t[o]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const o=l[s],a=o.attributes;for(let r=0;r<a.length;r++){const c=a[r];c.value.indexOf("{{")!==-1&&o.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function le(e,t,n,i,l,s){const o={};for(let r=0;r<e.children.length;r++){const c=e.children[r],u=c.getAttribute("data-ln-render-key");u&&(o[u]=c)}const a=document.createDocumentFragment();for(let r=0;r<t.length;r++){const c=t[r],u=String(i(c));let d=o[u];if(d)l(d,c,r);else{const f=re(n,s);if(!f||($(f,c),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),l(d,c,r)}a.appendChild(d)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=F,window.lnCore.lnFill=ie,window.lnCore.renderList=le);function b(e,t,n){const i=e.getAttribute(t);return i===null?n:i}function M(e,t,n){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?n:i}function D(e,t,n=!1){const i=e.getAttribute(t);if(i===null)return!!n;const l=i.trim().toLowerCase();return!(l==="false"||l==="0")}function R(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const y=new Map;function N(e,t){const n=(e?e.join("|"):"")+"::"+t;if(y.has(n))return y.get(n);const i=new Set(e||[]),l=function(s,o){const a=s.getAttribute(o);return a!==null&&i.has(a)?a:t};return y.set(n,l),l}function q(e,t,n){const i=parseFloat(e.getAttribute(t));return isNaN(i)?n:i}function B(e,t,n){const i=e.getAttribute(t);if(!i)return n;try{return JSON.parse(i)}catch{return n}}function j(e,t,n,i,l){if(!e||t===null)return!0;const s=i||"ln-component",o=e.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||t===""&&e.fallback!==void 0)return!0;const a=r=>{l?console.warn(r,l):console.warn(r)};if(o==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(a(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const r=e.values||[];return r.includes(t)?!0:(a(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(t))return a(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(a(`[${s}] Value ${r} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(a(`[${s}] Value ${r} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(o==="float")return isNaN(Number(t))?(a(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(t),!0}catch(r){return a(`[${s}] Invalid JSON for attribute "${n}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function U(e,t,n){for(const i in n){const[l,s,o]=n[i];Object.defineProperty(e,i,{get:function(){return l(t,s,o)},enumerable:!0,configurable:!0})}return e}function W(e){const t={};for(const n in e){const i=e[n];if(!i||!i.prop)continue;let l=i.read;if(!l&&i.type)switch(i.type){case"enum":l=N(i.values,i.fallback);break;case"integer":l=M;break;case"float":l=q;break;case"boolean":l=D;break;case"list":l=R;break;case"json":l=B;break;case"string":default:l=b;break}l||(l=b),t[i.prop]=[l,n,i.fallback]}return t}function se(e){const t={};for(const n in e){const i=e[n];i&&i.effect&&(t[n]=i.effect)}return Object.keys(t).length?t:null}function ae(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=U,window.lnCore.attrSpec=W,window.lnCore.attrStr=b,window.lnCore.attrInt=M,window.lnCore.attrBool=D,window.lnCore.attrList=R,window.lnCore.attrEnum=N,window.lnCore.attrFloat=q,window.lnCore.attrJson=B);function A(e,t,n,i){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",o=Array.from(e.querySelectorAll(s));e.matches&&e.matches(s)&&o.push(e);for(const a of o)if(!a[n]){window.lnCore._persistSink&&a.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(a,t);try{a[n]=new i(a)}catch(r){console.error("["+n+"] init failed",a,r)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ce(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ue(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function H(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function de(e){const t=H(),n=e.observed||[];for(let i=0;i<n.length;i++){const l=n[i];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const l=t.byDeclaredAttr.get(i);l.some(s=>s.componentTag===e.componentTag)||l.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=ae(e);if(i===null)t.reactiveWildcard.push(e);else for(const l of i)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function V(e,t,n,i){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const o=s.effects&&s.effects[n];o?o(t,n,i):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,i)}}function fe(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const i=H(),l=i.byAttr.get(n);if(E()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(n)&&g(t)){const s=i.byDeclaredAttr.get(n),o=t.getAttribute(n);for(let a=0;a<s.length;a++)j(s[a].spec,o,n,s[a].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const s=i.byReactive.get(n);s&&V(s,t,n,e.oldValue),i.reactiveWildcard.length&&V(i.reactiveWildcard,t,n,e.oldValue)}if(l)for(let s=0;s<l.length;s++){const o=l[s];if(o.handler){o.handler(t,n,e.oldValue);continue}o.onAttributeChange&&t[o.attribute]?o.onAttributeChange(t,n):(A(t,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(t))}}function we(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{fe(t[n])}catch(i){console.error("[ln-core] mutation handler failed",t[n].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function P(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function he(e){const t=P();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const i=t[n];if(i.onSubtreeChange){const l=i.query,s=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;s&&i.onSubtreeChange(s,e)}}for(let n=0;n<e.addedNodes.length;n++){const i=e.addedNodes[n];if(i.nodeType===1)for(let l=0;l<t.length;l++){const s=t[l];A(i,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(i)}}for(let n=0;n<e.removedNodes.length;n++){const i=e.removedNodes[n];if(i.nodeType===1)for(let l=0;l<t.length;l++){const s=t[l],o=s.query,a=Array.from(i.querySelectorAll(o));i.matches&&i.matches(o)&&a.push(i);for(let r=0;r<a.length;r++){const c=a[r];if(!document.contains(c)){const u=c[s.attribute];if(u&&typeof u.destroy=="function")try{u.destroy()}catch(d){console.error("["+s.attribute+"] destroy failed",c,d)}delete c[s.attribute]}}}}}}function pe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const i=t[n];if(i.type==="childList")try{he(i)}catch(l){console.error("[ln-core] lifecycle handler failed",i.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function J(e,t,n,i,l={}){const s=l.extraAttributes||[],o=l.onAttributeChange||null,a=l.onSubtreeChange||null,r=l.onInit||null,c=l.onAttrChange||null,u=l.effects||null,d=l.attributes||null,f=d?se(d):u,ke=d?new Set(Object.keys(d)):null,Se=l.persist||null;function m(x){const w=x||document.body;if(A(w,e,t,n),d&&E())for(const h in d){const Ee=d[h],k=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&k.push(w);for(let S=0;S<k.length;S++){const O=k[S];g(O)&&j(Ee,O.getAttribute(h),h,i,O)}}r&&r(w)}const _=[];if(e.indexOf("[")!==-1){const x=/\[([\w-]+)/g;let w;for(;(w=x.exec(e))!==null;)_.push(w[1])}else _.push(e);de({selector:e,attribute:t,componentTag:i,attributes:d,ComponentFn:n,onInit:r,observed:_.concat(s),onAttributeChange:o,onAttrChange:c,effects:f,declared:ke,persist:Se}),we();const Oe=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";P().push({selector:e,attribute:t,ComponentFn:n,onInit:r,onSubtreeChange:a,query:Oe}),pe(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=J);function Q(){ce()>0?ue(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Q):Q(),m}function K(e){return(e||"").replace(/^#/,"")}function v(e){const t=e===void 0?location.hash:e,n={},i=K(t);if(!i)return n;const l=i.split("&");for(let s=0;s<l.length;s++){const o=l[s];if(!o)continue;const a=o.indexOf(":"),r=a>-1?o.slice(0,a):o,c=a>-1?o.slice(a+1):"";if(r)try{n[r]=decodeURIComponent(c)}catch{n[r]=c}}return n}function be(e){if(!e)return null;const t=v();return e in t?t[e]:null}function me(e,t){if(!e)return;const n=v();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(s){const o=n[s];return o===""?s:s+":"+encodeURIComponent(o)}).join("&");K(location.hash)!==l&&(location.hash=l)}function ge(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ce(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function ye(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ae(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function ve(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function _e(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),i=e.slice(t+1),l=i?i.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=v,window.lnCore.hashGet=be,window.lnCore.hashSet=me,window.lnCore.hashLinkClick=ge,window.lnCore.resolveHashNamespace=Ce,window.lnCore.hashSortEncode=ye,window.lnCore.hashSortDecode=Ae,window.lnCore.hashFilterEncode=ve,window.lnCore.hashFilterDecode=_e);function xe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=xe),(function(){const e="data-ln-form",t="lnForm";if(window[t]!==void 0)return;const n={"data-ln-form":{type:"marker",description:"Identifies the form element as an enhanced ln-form"},"data-ln-form-action-edit":{prop:"_actionEdit",type:"string",read:b,fallback:"",description:"URL template or endpoint used when editing an existing record"},"data-ln-form-action-method":{prop:"_actionMethod",type:"enum",values:["PUT","POST","PATCH"],fallback:"PUT",description:"HTTP method used when submitting edit action"}},i=W(n);function l(s){this.dom=s,U(this,s,i),this._baseAction=s.getAttribute("action")||"";const o=this;function a(){const c=o.dom.querySelectorAll('input[type="hidden"]:not([name="_method"])');for(let u=0;u<c.length;u++)c[u].hasAttribute("data-ln-initial-value")||c[u].setAttribute("data-ln-initial-value",c[u].getAttribute("value")||"")}function r(){const c=o.dom.querySelectorAll('input[type="hidden"]:not([name="_method"])');for(let u=0;u<c.length;u++)c[u].value=c[u].getAttribute("data-ln-initial-value")||""}return a(),this._onLnFill=function(c){c.target===o.dom&&(c.detail?(a(),o.fill(c.detail),o._applyActionMode(c.detail)):(o.dom.reset(),r()))},this._onReset=function(){o._applyActionMode(null),r()},s.addEventListener("ln-fill",this._onLnFill),s.addEventListener("reset",this._onReset),this}l.prototype.fill=function(s){const o=L(this.dom,s);for(let a=0;a<o.length;a++){const r=o[a],c=r.tagName==="SELECT"||r.type==="checkbox"||r.type==="radio";r.dispatchEvent(new Event(c?"change":"input",{bubbles:!0}))}},l.prototype._ensureMethodInput=function(){let s=this.dom.querySelector('input[name="_method"]');return s||(s=document.createElement("input"),s.type="hidden",s.name="_method",s.value="",this.dom.appendChild(s)),s},l.prototype._applyActionMode=function(s){if(!this.dom.hasAttribute("data-ln-form-action-edit"))return;const o=s&&s.id!=null&&s.id!==""?s.id:null,a=this._ensureMethodInput();if(o!==null){const r=this._actionEdit;r?this.dom.setAttribute("action",r.replace(":id",encodeURIComponent(o))):this.dom.setAttribute("action",this._baseAction.replace(/\/$/,"")+"/"+encodeURIComponent(o)),a.value=this._actionMethod||"PUT"}else this.dom.setAttribute("action",this._baseAction),a.value=""},l.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-fill",this._onLnFill),this.dom.removeEventListener("reset",this._onReset),delete this.dom[t])},J(e,t,l,"ln-form",{attributes:n})})()})();
|
|
1
|
+
(function(){"use strict";function E(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function g(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let i=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){i=t[l];break}if(!g(i))return}e.apply(console,t)}}function z(e,t,n){const i=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function p(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function G(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function X(e,t){const n=!!(t&&t.typed),i=t&&t.exclude,l={},s=e.elements,o={};if(n)for(let a=0;a<s.length;a++){const r=s[a];r.name&&r.type==="checkbox"&&!r.disabled&&(o[r.name]=(o[r.name]||0)+1)}for(let a=0;a<s.length;a++){const r=s[a];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(i&&r.matches&&r.matches(i)))if(r.type==="checkbox")n&&o[r.name]===1?l[r.name]=r.checked:(l[r.name]||(l[r.name]=[]),r.checked&&l[r.name].push(r.value));else if(r.type==="radio")r.checked&&(l[r.name]=r.value);else if(r.type==="select-multiple"){l[r.name]=[];for(let c=0;c<r.options.length;c++)r.options[c].selected&&l[r.name].push(r.options[c].value)}else if(n&&r.type==="hidden")l[r.name]=r.value;else if(n&&(r.type==="number"||r.type==="range")){const c=Number(r.value);l[r.name]=r.value===""||isNaN(c)?null:c}else l[r.name]=r.value}return l}function Y(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function L(e,t){const n=e.elements,i=[],l={};for(let s=0;s<n.length;s++){const o=n[s];o.name&&o.type==="checkbox"&&(l[o.name]=(l[o.name]||0)+1)}for(let s=0;s<n.length;s++){const o=n[s];if(o.type==="file"||o.type==="submit"||o.type==="button")continue;const a=o.getAttribute("data-ln-fill-as")||o.name;if(!a||!(a in t))continue;const r=t[a];if(o.type==="checkbox"){if(Array.isArray(r))o.checked=r.indexOf(o.value)!==-1;else if(l[o.name]>1){const c=String(r).split(",").map(function(u){return u.trim()});o.checked=c.indexOf(o.value)!==-1}else o.checked=Y(r);i.push(o)}else if(o.type==="radio")o.checked=o.value===String(r),i.push(o);else if(o.type==="select-multiple"){if(Array.isArray(r))for(let c=0;c<o.options.length;c++)o.options[c].selected=r.indexOf(o.options[c].value)!==-1;i.push(o)}else o.value=r,o.tagName==="SELECT"&&r!=null&&o.setAttribute("data-ln-value",r),i.push(o)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=L,window.lnCore.serializeForm=X,window.lnCore.resolveFormMethod=G);const T={};function Z(e,t){T[e]=t}function ee(e){return T[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=Z,window.lnCore.getDataMapper=ee);function te(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){z(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const I={};function ne(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];I[n]=t}function oe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return I[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ne,window.lnCore.getLocaleFallback=oe,window.lnCore.ensureLocaleObserver=te);const C={};function re(e,t){C[e]||(C[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=C[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function F(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let o=0;o<n.length;o++){const a=n[o],r=a.getAttribute("data-ln-field");t[r]!=null&&(a.textContent=t[r])}const i=e.querySelectorAll("[data-ln-attr]");for(let o=0;o<i.length;o++){const a=i[o],r=a.getAttribute("data-ln-attr").split(",");for(let c=0;c<r.length;c++){const u=r[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&a.setAttribute(d,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let o=0;o<l.length;o++){const a=l[o],r=a.getAttribute("data-ln-show");r in t&&a.classList.toggle("hidden",!t[r])}const s=e.querySelectorAll("[data-ln-class]");for(let o=0;o<s.length;o++){const a=s[o],r=a.getAttribute("data-ln-class").split(",");for(let c=0;c<r.length;c++){const u=r[c].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&a.classList.toggle(d,!!t[f])}}return e}function ie(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<n.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[i],t??null),n[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)F(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function $(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,a){return t[a]!==void 0?t[a]:""}))}const i=function(s,o){return t[o]!==void 0?t[o]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const o=l[s],a=o.attributes;for(let r=0;r<a.length;r++){const c=a[r];c.value.indexOf("{{")!==-1&&o.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function le(e,t,n,i,l,s){const o={};for(let r=0;r<e.children.length;r++){const c=e.children[r],u=c.getAttribute("data-ln-render-key");u&&(o[u]=c)}const a=document.createDocumentFragment();for(let r=0;r<t.length;r++){const c=t[r],u=String(i(c));let d=o[u];if(d)l(d,c,r);else{const f=re(n,s);if(!f||($(f,c),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),l(d,c,r)}a.appendChild(d)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=F,window.lnCore.lnFill=ie,window.lnCore.renderList=le);function b(e,t,n){const i=e.getAttribute(t);return i===null?n:i}function M(e,t,n){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?n:i}function D(e,t,n=!1){const i=e.getAttribute(t);if(i===null)return!!n;const l=i.trim().toLowerCase();return!(l==="false"||l==="0")}function R(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const y=new Map;function N(e,t){const n=(e?e.join("|"):"")+"::"+t;if(y.has(n))return y.get(n);const i=new Set(e||[]),l=function(s,o){const a=s.getAttribute(o);return a!==null&&i.has(a)?a:t};return y.set(n,l),l}function q(e,t,n){const i=parseFloat(e.getAttribute(t));return isNaN(i)?n:i}function B(e,t,n){const i=e.getAttribute(t);if(!i)return n;try{return JSON.parse(i)}catch{return n}}function j(e,t,n,i,l){if(!e||t===null)return!0;const s=i||"ln-component",o=e.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||t===""&&e.fallback!==void 0)return!0;const a=r=>{l?console.warn(r,l):console.warn(r)};if(o==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(a(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const r=e.values||[];return r.includes(t)?!0:(a(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(t))return a(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(a(`[${s}] Value ${r} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(a(`[${s}] Value ${r} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(o==="float")return isNaN(Number(t))?(a(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(t),!0}catch(r){return a(`[${s}] Invalid JSON for attribute "${n}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function U(e,t,n){for(const i in n){const[l,s,o]=n[i];Object.defineProperty(e,i,{get:function(){return l(t,s,o)},enumerable:!0,configurable:!0})}return e}function W(e){const t={};for(const n in e){const i=e[n];if(!i||!i.prop)continue;let l=i.read;if(!l&&i.type)switch(i.type){case"enum":l=N(i.values,i.fallback);break;case"integer":l=M;break;case"float":l=q;break;case"boolean":l=D;break;case"list":l=R;break;case"json":l=B;break;case"string":default:l=b;break}l||(l=b),t[i.prop]=[l,n,i.fallback]}return t}function se(e){const t={};for(const n in e){const i=e[n];i&&i.effect&&(t[n]=i.effect)}return Object.keys(t).length?t:null}function ae(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=U,window.lnCore.attrSpec=W,window.lnCore.attrStr=b,window.lnCore.attrInt=M,window.lnCore.attrBool=D,window.lnCore.attrList=R,window.lnCore.attrEnum=N,window.lnCore.attrFloat=q,window.lnCore.attrJson=B);function A(e,t,n,i){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",o=Array.from(e.querySelectorAll(s));e.matches&&e.matches(s)&&o.push(e);for(const a of o)if(!a[n]){window.lnCore._persistSink&&a.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(a,t);try{a[n]=new i(a)}catch(r){console.error("["+n+"] init failed",a,r)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ce(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ue(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function H(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function de(e){const t=H(),n=e.observed||[];for(let i=0;i<n.length;i++){const l=n[i];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const l=t.byDeclaredAttr.get(i);l.some(s=>s.componentTag===e.componentTag)||l.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=ae(e);if(i===null)t.reactiveWildcard.push(e);else for(const l of i)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function V(e,t,n,i){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const o=s.effects&&s.effects[n];o?o(t,n,i):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,i)}}function fe(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const i=H(),l=i.byAttr.get(n);if(E()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(n)&&g(t)){const s=i.byDeclaredAttr.get(n),o=t.getAttribute(n);for(let a=0;a<s.length;a++)j(s[a].spec,o,n,s[a].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const s=i.byReactive.get(n);s&&V(s,t,n,e.oldValue),i.reactiveWildcard.length&&V(i.reactiveWildcard,t,n,e.oldValue)}if(l)for(let s=0;s<l.length;s++){const o=l[s];if(o.handler){o.handler(t,n,e.oldValue);continue}o.onAttributeChange&&t[o.attribute]?o.onAttributeChange(t,n):(A(t,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(t))}}function we(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{fe(t[n])}catch(i){console.error("[ln-core] mutation handler failed",t[n].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function P(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function he(e){const t=P();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const i=t[n];if(i.onSubtreeChange){const l=i.query,s=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;s&&i.onSubtreeChange(s,e)}}for(let n=0;n<e.addedNodes.length;n++){const i=e.addedNodes[n];if(i.nodeType===1)for(let l=0;l<t.length;l++){const s=t[l];A(i,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(i)}}for(let n=0;n<e.removedNodes.length;n++){const i=e.removedNodes[n];if(i.nodeType===1)for(let l=0;l<t.length;l++){const s=t[l],o=s.query,a=Array.from(i.querySelectorAll(o));i.matches&&i.matches(o)&&a.push(i);for(let r=0;r<a.length;r++){const c=a[r];if(!document.contains(c)){const u=c[s.attribute];if(u&&typeof u.destroy=="function")try{u.destroy()}catch(d){console.error("["+s.attribute+"] destroy failed",c,d)}delete c[s.attribute]}}}}}}function pe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const i=t[n];if(i.type==="childList")try{he(i)}catch(l){console.error("[ln-core] lifecycle handler failed",i.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Q(e,t,n,i,l={}){const s=l.extraAttributes||[],o=l.onAttributeChange||null,a=l.onSubtreeChange||null,r=l.onInit||null,c=l.onAttrChange||null,u=l.effects||null,d=l.attributes||null,f=d?se(d):u,ke=d?new Set(Object.keys(d)):null,Se=l.persist||null;function m(x){const w=x||document.body;if(A(w,e,t,n),d&&E())for(const h in d){const Le=d[h],k=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&k.push(w);for(let S=0;S<k.length;S++){const O=k[S];g(O)&&j(Le,O.getAttribute(h),h,i,O)}}r&&r(w)}const _=[];if(e.indexOf("[")!==-1){const x=/\[([\w-]+)/g;let w;for(;(w=x.exec(e))!==null;)_.push(w[1])}else _.push(e);de({selector:e,attribute:t,componentTag:i,attributes:d,ComponentFn:n,onInit:r,observed:_.concat(s),onAttributeChange:o,onAttrChange:c,effects:f,declared:ke,persist:Se}),we();const Oe=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Ee=l.subtreeQuery||(Oe?e:"["+e+"]");P().push({selector:e,attribute:t,ComponentFn:n,onInit:r,onSubtreeChange:a,query:Ee}),pe(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=Q);function K(){ce()>0?ue(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",K):K(),m}function J(e){return(e||"").replace(/^#/,"")}function v(e){const t=e===void 0?location.hash:e,n={},i=J(t);if(!i)return n;const l=i.split("&");for(let s=0;s<l.length;s++){const o=l[s];if(!o)continue;const a=o.indexOf(":"),r=a>-1?o.slice(0,a):o,c=a>-1?o.slice(a+1):"";if(r)try{n[r]=decodeURIComponent(c)}catch{n[r]=c}}return n}function be(e){if(!e)return null;const t=v();return e in t?t[e]:null}function me(e,t){if(!e)return;const n=v();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(s){const o=n[s];return o===""?s:s+":"+encodeURIComponent(o)}).join("&");J(location.hash)!==l&&(location.hash=l)}function ge(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ce(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function ye(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ae(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function ve(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function _e(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),i=e.slice(t+1),l=i?i.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=v,window.lnCore.hashGet=be,window.lnCore.hashSet=me,window.lnCore.hashLinkClick=ge,window.lnCore.resolveHashNamespace=Ce,window.lnCore.hashSortEncode=ye,window.lnCore.hashSortDecode=Ae,window.lnCore.hashFilterEncode=ve,window.lnCore.hashFilterDecode=_e);function xe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=xe),(function(){const e="data-ln-form",t="lnForm";if(window[t]!==void 0)return;const n={"data-ln-form":{type:"marker",description:"Identifies the form element as an enhanced ln-form"},"data-ln-form-action-edit":{prop:"_actionEdit",type:"string",read:b,fallback:"",description:"URL template or endpoint used when editing an existing record"},"data-ln-form-action-method":{prop:"_actionMethod",type:"enum",values:["PUT","POST","PATCH"],fallback:"PUT",description:"HTTP method used when submitting edit action"}},i=W(n);function l(s){this.dom=s,U(this,s,i),this._baseAction=s.getAttribute("action")||"";const o=this;function a(){const c=o.dom.querySelectorAll('input[type="hidden"]:not([name="_method"])');for(let u=0;u<c.length;u++)c[u].hasAttribute("data-ln-initial-value")||c[u].setAttribute("data-ln-initial-value",c[u].getAttribute("value")||"")}function r(){const c=o.dom.querySelectorAll('input[type="hidden"]:not([name="_method"])');for(let u=0;u<c.length;u++)c[u].value=c[u].getAttribute("data-ln-initial-value")||""}return a(),this._onLnFill=function(c){c.target===o.dom&&(c.detail?(a(),o.fill(c.detail),o._applyActionMode(c.detail)):(o.dom.reset(),r()))},this._onReset=function(){o._applyActionMode(null),r()},s.addEventListener("ln-fill",this._onLnFill),s.addEventListener("reset",this._onReset),this}l.prototype.fill=function(s){const o=L(this.dom,s);for(let a=0;a<o.length;a++){const r=o[a],c=r.tagName==="SELECT"||r.type==="checkbox"||r.type==="radio";r.dispatchEvent(new Event(c?"change":"input",{bubbles:!0}))}},l.prototype._ensureMethodInput=function(){let s=this.dom.querySelector('input[name="_method"]');return s||(s=document.createElement("input"),s.type="hidden",s.name="_method",s.value="",this.dom.appendChild(s)),s},l.prototype._applyActionMode=function(s){if(!this.dom.hasAttribute("data-ln-form-action-edit"))return;const o=s&&s.id!=null&&s.id!==""?s.id:null,a=this._ensureMethodInput();if(o!==null){const r=this._actionEdit;r?this.dom.setAttribute("action",r.replace(":id",encodeURIComponent(o))):this.dom.setAttribute("action",this._baseAction.replace(/\/$/,"")+"/"+encodeURIComponent(o)),a.value=this._actionMethod||"PUT"}else this.dom.setAttribute("action",this._baseAction),a.value=""},l.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-fill",this._onLnFill),this.dom.removeEventListener("reset",this._onReset),delete this.dom[t])},Q(e,t,l,"ln-form",{attributes:n})})()})();
|