@aiaiai-pt/design-system 0.55.2 → 0.57.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/components/ActionFormRenderer.svelte +65 -16
- package/components/ActionFormRenderer.svelte.d.ts +30 -0
- package/components/Calendar.svelte +12 -4
- package/components/Calendar.svelte.d.ts +8 -0
- package/components/Combobox.svelte +6 -2
- package/components/Combobox.svelte.d.ts +4 -0
- package/components/DataTable.svelte +5 -1
- package/components/FileUpload.svelte +3 -1
- package/components/FileUpload.svelte.d.ts +2 -0
- package/components/FilterPanel.svelte +12 -4
- package/components/FilterPanel.svelte.d.ts +8 -0
- package/components/Modal.svelte +3 -1
- package/components/Modal.svelte.d.ts +2 -0
- package/components/MultiSelectCombobox.svelte +12 -2
- package/components/MultiSelectCombobox.svelte.d.ts +8 -0
- package/components/Pagination.svelte +9 -4
- package/components/Pagination.svelte.d.ts +4 -0
- package/components/Tag.svelte +3 -1
- package/components/Tag.svelte.d.ts +2 -0
- package/components/action-form-renderer-relationships.d.ts +10 -0
- package/components/action-form-renderer-relationships.ts +23 -0
- package/package.json +1 -1
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
isRelationshipParam,
|
|
46
46
|
normalizeRelIds,
|
|
47
47
|
relationshipTypeCode,
|
|
48
|
+
relationshipDisplayName,
|
|
48
49
|
} from "./action-form-renderer-relationships";
|
|
49
50
|
// #36/#37 — widget-first dispatch (field summaries carry render intent in
|
|
50
51
|
// `widget`; derived-action params in `ui_schema.widget`; legacy params fall
|
|
@@ -141,6 +142,12 @@
|
|
|
141
142
|
* in submit modes. */
|
|
142
143
|
captcha?: Snippet;
|
|
143
144
|
submitLabel?: string;
|
|
145
|
+
/** Consumer-provided placeholder builder for relationship pickers.
|
|
146
|
+
* Receives the target type's display name (or type code as fallback);
|
|
147
|
+
* returns the full placeholder string. The consumer owns the translation
|
|
148
|
+
* (e.g. `(name) => t('Search {0}...', name)`); the DS provides the
|
|
149
|
+
* English default. Consistent with the `submitLabel` pattern. */
|
|
150
|
+
searchPlaceholder?: (displayName: string) => string;
|
|
144
151
|
/** Forwarded VERBATIM to every `geo` parameter's MapPicker (the renderer
|
|
145
152
|
* stays generic — boundary/overlay semantics live in the consumer):
|
|
146
153
|
* `boundary` draws the dashed tenant-boundary overlay and arms the
|
|
@@ -169,6 +176,33 @@
|
|
|
169
176
|
* complete payload (incl. attachment_keys) to review and submit. Read-only
|
|
170
177
|
* consumers omit it. */
|
|
171
178
|
onchange?: (payload: Record<string, unknown>) => void;
|
|
179
|
+
|
|
180
|
+
// #2672 L4 — consumer-overridable labels for i18n. Each has today's
|
|
181
|
+
// English as the default so no consumer changes behaviour.
|
|
182
|
+
/** Hint appended to required file-param labels, e.g. " (required)". */
|
|
183
|
+
requiredLabel?: string;
|
|
184
|
+
/** Placeholder for choice-type selects. */
|
|
185
|
+
selectPlaceholder?: string;
|
|
186
|
+
/** Shown in a choice select while options load. */
|
|
187
|
+
loadingOptionsLabel?: string;
|
|
188
|
+
/** Shown in a choice select when no options exist. */
|
|
189
|
+
noOptionsLabel?: string;
|
|
190
|
+
/** Boolean toggle "yes" option label. */
|
|
191
|
+
booleanYesLabel?: string;
|
|
192
|
+
/** Boolean toggle "no" option label. */
|
|
193
|
+
booleanNoLabel?: string;
|
|
194
|
+
/** Hint shown when a file param has a stored file on edit. */
|
|
195
|
+
fileReplaceLabel?: string;
|
|
196
|
+
/** Hint shown below a required field (submit modes). */
|
|
197
|
+
requiredHintLabel?: string;
|
|
198
|
+
/** Combobox: shown when search returns nothing (passed through). */
|
|
199
|
+
noResultsLabel?: string;
|
|
200
|
+
/** Combobox: shown while searching / debouncing (passed through). */
|
|
201
|
+
searchingLabel?: string;
|
|
202
|
+
/** FileUpload: drop-zone instruction text (passed through). */
|
|
203
|
+
dropLabel?: string;
|
|
204
|
+
/** Default section heading when no section label is declared. */
|
|
205
|
+
defaultSectionLabel?: string;
|
|
172
206
|
}
|
|
173
207
|
|
|
174
208
|
let {
|
|
@@ -185,6 +219,7 @@
|
|
|
185
219
|
fieldErrors = undefined,
|
|
186
220
|
captcha = undefined,
|
|
187
221
|
submitLabel = "Submit",
|
|
222
|
+
searchPlaceholder = (name: string) => name ? `Search ${name}...` : "Search...",
|
|
188
223
|
boundary = undefined,
|
|
189
224
|
layers = [],
|
|
190
225
|
onoutofbounds = undefined,
|
|
@@ -192,6 +227,18 @@
|
|
|
192
227
|
activeSectionKey = null,
|
|
193
228
|
hideSubmit = false,
|
|
194
229
|
onchange = undefined,
|
|
230
|
+
requiredLabel = " (required)",
|
|
231
|
+
selectPlaceholder = "Select value",
|
|
232
|
+
loadingOptionsLabel = "Loading options...",
|
|
233
|
+
noOptionsLabel = "No options available",
|
|
234
|
+
booleanYesLabel = "Yes",
|
|
235
|
+
booleanNoLabel = "No",
|
|
236
|
+
fileReplaceLabel = "Current file — uploading replaces it",
|
|
237
|
+
requiredHintLabel = "Required",
|
|
238
|
+
noResultsLabel = "No results found",
|
|
239
|
+
searchingLabel = "Searching…",
|
|
240
|
+
dropLabel = "Drop files here or click to browse",
|
|
241
|
+
defaultSectionLabel = "Details",
|
|
195
242
|
}: Props = $props();
|
|
196
243
|
|
|
197
244
|
let values = $state<Record<string, unknown>>({});
|
|
@@ -369,7 +416,7 @@
|
|
|
369
416
|
const section = row.section_label || row.section;
|
|
370
417
|
if (section) return String(section);
|
|
371
418
|
}
|
|
372
|
-
return
|
|
419
|
+
return defaultSectionLabel;
|
|
373
420
|
}
|
|
374
421
|
|
|
375
422
|
function groupIntoSections(items: Entity[]): Array<{ name: string; items: Entity[] }> {
|
|
@@ -395,7 +442,7 @@
|
|
|
395
442
|
// predicate, and `order` (the server emits sections pre-sorted; the
|
|
396
443
|
// sort below is a defensive mirror, stable via declaration index).
|
|
397
444
|
return {
|
|
398
|
-
name: String(section.label ?? section.key ??
|
|
445
|
+
name: String(section.label ?? section.key ?? defaultSectionLabel),
|
|
399
446
|
key: section.key ? String(section.key) : undefined,
|
|
400
447
|
columns: Number(section.columns ?? 1),
|
|
401
448
|
visibleWhen:
|
|
@@ -834,13 +881,13 @@
|
|
|
834
881
|
name={key}
|
|
835
882
|
value={String(values[key] ?? initialValue(parameter) ?? "")}
|
|
836
883
|
{options}
|
|
837
|
-
placeholder=
|
|
884
|
+
placeholder={selectPlaceholder}
|
|
838
885
|
disabled={fieldDisabled || !editable || options.length === 0}
|
|
839
886
|
error={fieldError}
|
|
840
887
|
help={parameter.loading === true
|
|
841
|
-
?
|
|
888
|
+
? loadingOptionsLabel
|
|
842
889
|
: options.length === 0
|
|
843
|
-
?
|
|
890
|
+
? noOptionsLabel
|
|
844
891
|
: undefined}
|
|
845
892
|
onchange={(value: string) => setValue(key, value)}
|
|
846
893
|
aria-required={ariaRequired}
|
|
@@ -866,8 +913,8 @@
|
|
|
866
913
|
name={key}
|
|
867
914
|
value={values[key] ? "true" : "false"}
|
|
868
915
|
options={[
|
|
869
|
-
{ value: "true", label:
|
|
870
|
-
{ value: "false", label:
|
|
916
|
+
{ value: "true", label: booleanYesLabel },
|
|
917
|
+
{ value: "false", label: booleanNoLabel },
|
|
871
918
|
]}
|
|
872
919
|
disabled={fieldDisabled || !editable}
|
|
873
920
|
error={fieldError}
|
|
@@ -907,12 +954,13 @@
|
|
|
907
954
|
value: id,
|
|
908
955
|
label: relLabel(key, id),
|
|
909
956
|
}))}
|
|
910
|
-
placeholder={
|
|
911
|
-
? `Search ${relationshipTypeCode(parameter)}...`
|
|
912
|
-
: "Search..."}
|
|
957
|
+
placeholder={searchPlaceholder(relationshipDisplayName(parameter))}
|
|
913
958
|
disabled={!searchEntities || !editable || fieldDisabled}
|
|
914
959
|
loading={(referenceLoading[key] ?? false) || parameter.loading === true}
|
|
915
960
|
error={fieldError}
|
|
961
|
+
{noResultsLabel}
|
|
962
|
+
{searchingLabel}
|
|
963
|
+
requiredLabel={requiredLabel}
|
|
916
964
|
onsearch={(query: string) => handleReferenceSearch(parameter, query)}
|
|
917
965
|
onadd={(value: string) => addRelId(key, value)}
|
|
918
966
|
onremove={(value: string) => removeRelId(key, value)}
|
|
@@ -922,12 +970,12 @@
|
|
|
922
970
|
label={String(parameter.label ?? key)}
|
|
923
971
|
items={relComboItems(parameter)}
|
|
924
972
|
value={String(values[key] ?? "")}
|
|
925
|
-
placeholder={
|
|
926
|
-
? `Search ${relationshipTypeCode(parameter)}...`
|
|
927
|
-
: "Search..."}
|
|
973
|
+
placeholder={searchPlaceholder(relationshipDisplayName(parameter))}
|
|
928
974
|
disabled={!searchEntities || !editable || fieldDisabled}
|
|
929
975
|
loading={(referenceLoading[key] ?? false) || parameter.loading === true}
|
|
930
976
|
error={fieldError}
|
|
977
|
+
{noResultsLabel}
|
|
978
|
+
{searchingLabel}
|
|
931
979
|
onsearch={(query: string) => handleReferenceSearch(parameter, query)}
|
|
932
980
|
onchange={(value: string) => pickSingleRel(key, value)}
|
|
933
981
|
/>
|
|
@@ -943,7 +991,7 @@
|
|
|
943
991
|
<div class="afr-file-param" role="group" aria-labelledby={`${key}-file-label`}>
|
|
944
992
|
<span id={`${key}-file-label`} class="afr-file-label"
|
|
945
993
|
>{String(parameter.label ?? key)}{parameter.required
|
|
946
|
-
?
|
|
994
|
+
? requiredLabel
|
|
947
995
|
: ""}</span
|
|
948
996
|
>
|
|
949
997
|
<!-- #40 — REPLACE semantics: the stored current shows until a pending
|
|
@@ -962,7 +1010,7 @@
|
|
|
962
1010
|
{:else}
|
|
963
1011
|
<span class="afr-file-current-name">{storedFile.name}</span>
|
|
964
1012
|
{/if}
|
|
965
|
-
<span class="afr-file-current-hint">
|
|
1013
|
+
<span class="afr-file-current-hint">{fileReplaceLabel}</span>
|
|
966
1014
|
</div>
|
|
967
1015
|
{/if}
|
|
968
1016
|
{#each fileUploads[key] ?? [] as f (f.key)}
|
|
@@ -977,6 +1025,7 @@
|
|
|
977
1025
|
maxSize={fileMaxBytes(parameter)}
|
|
978
1026
|
multiple={!replaceMode}
|
|
979
1027
|
disabled={!uploadFile || fileBusy[key]}
|
|
1028
|
+
{dropLabel}
|
|
980
1029
|
onfiles={(files: File[]) => handleFiles(key, files, replaceMode)}
|
|
981
1030
|
onreject={() => {
|
|
982
1031
|
fileError = {
|
|
@@ -1059,7 +1108,7 @@
|
|
|
1059
1108
|
<!-- EXECUTE surfaces (citizen public-submit AND staff admin-execute,
|
|
1060
1109
|
#629 follow-up): just a quiet required hint — the "Required / type"
|
|
1061
1110
|
line is operator DEBUG chrome, preview modes only. -->
|
|
1062
|
-
{#if parameter.required}<p class="field-meta">
|
|
1111
|
+
{#if parameter.required}<p class="field-meta">{requiredHintLabel}</p>{/if}
|
|
1063
1112
|
{:else}
|
|
1064
1113
|
<p class="field-meta">
|
|
1065
1114
|
{String(parameter.required ? "Required" : "Optional")} / {type}
|
|
@@ -84,6 +84,12 @@ interface Props {
|
|
|
84
84
|
* in submit modes. */
|
|
85
85
|
captcha?: Snippet;
|
|
86
86
|
submitLabel?: string;
|
|
87
|
+
/** Consumer-provided placeholder builder for relationship pickers.
|
|
88
|
+
* Receives the target type's display name (or type code as fallback);
|
|
89
|
+
* returns the full placeholder string. The consumer owns the translation
|
|
90
|
+
* (e.g. `(name) => t('Search {0}...', name)`); the DS provides the
|
|
91
|
+
* English default. Consistent with the `submitLabel` pattern. */
|
|
92
|
+
searchPlaceholder?: (displayName: string) => string;
|
|
87
93
|
/** Forwarded VERBATIM to every `geo` parameter's MapPicker (the renderer
|
|
88
94
|
* stays generic — boundary/overlay semantics live in the consumer):
|
|
89
95
|
* `boundary` draws the dashed tenant-boundary overlay and arms the
|
|
@@ -112,6 +118,30 @@ interface Props {
|
|
|
112
118
|
* complete payload (incl. attachment_keys) to review and submit. Read-only
|
|
113
119
|
* consumers omit it. */
|
|
114
120
|
onchange?: (payload: Record<string, unknown>) => void;
|
|
121
|
+
/** Hint appended to required file-param labels, e.g. " (required)". */
|
|
122
|
+
requiredLabel?: string;
|
|
123
|
+
/** Placeholder for choice-type selects. */
|
|
124
|
+
selectPlaceholder?: string;
|
|
125
|
+
/** Shown in a choice select while options load. */
|
|
126
|
+
loadingOptionsLabel?: string;
|
|
127
|
+
/** Shown in a choice select when no options exist. */
|
|
128
|
+
noOptionsLabel?: string;
|
|
129
|
+
/** Boolean toggle "yes" option label. */
|
|
130
|
+
booleanYesLabel?: string;
|
|
131
|
+
/** Boolean toggle "no" option label. */
|
|
132
|
+
booleanNoLabel?: string;
|
|
133
|
+
/** Hint shown when a file param has a stored file on edit. */
|
|
134
|
+
fileReplaceLabel?: string;
|
|
135
|
+
/** Hint shown below a required field (submit modes). */
|
|
136
|
+
requiredHintLabel?: string;
|
|
137
|
+
/** Combobox: shown when search returns nothing (passed through). */
|
|
138
|
+
noResultsLabel?: string;
|
|
139
|
+
/** Combobox: shown while searching / debouncing (passed through). */
|
|
140
|
+
searchingLabel?: string;
|
|
141
|
+
/** FileUpload: drop-zone instruction text (passed through). */
|
|
142
|
+
dropLabel?: string;
|
|
143
|
+
/** Default section heading when no section label is declared. */
|
|
144
|
+
defaultSectionLabel?: string;
|
|
115
145
|
}
|
|
116
146
|
declare const ActionFormRenderer: import("svelte").Component<Props, {}, "">;
|
|
117
147
|
type ActionFormRenderer = ReturnType<typeof ActionFormRenderer>;
|
|
@@ -60,6 +60,14 @@
|
|
|
60
60
|
ondateclick = undefined,
|
|
61
61
|
/** @type {import('svelte').Snippet<[CalendarEvent]> | undefined} */
|
|
62
62
|
event: eventSnippet = undefined,
|
|
63
|
+
/** @type {string} — "Today" button label */
|
|
64
|
+
todayLabel = 'Today',
|
|
65
|
+
/** @type {string} — "Month" view toggle label */
|
|
66
|
+
monthLabel = 'Month',
|
|
67
|
+
/** @type {string} — "Week" view toggle label */
|
|
68
|
+
weekLabel = 'Week',
|
|
69
|
+
/** @type {string} — "Day" view toggle label */
|
|
70
|
+
dayLabel = 'Day',
|
|
63
71
|
/** @type {string} */
|
|
64
72
|
class: className = '',
|
|
65
73
|
...rest
|
|
@@ -278,7 +286,7 @@
|
|
|
278
286
|
<polyline points="96,48 176,128 96,208" fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" />
|
|
279
287
|
</svg>
|
|
280
288
|
</button>
|
|
281
|
-
<button type="button" class="calendar-today-btn" onclick={(e) => { goToday(); /** @type {HTMLElement} */ (e.currentTarget).blur(); }}>
|
|
289
|
+
<button type="button" class="calendar-today-btn" onclick={(e) => { goToday(); /** @type {HTMLElement} */ (e.currentTarget).blur(); }}>{todayLabel}</button>
|
|
282
290
|
<h2 class="calendar-title">
|
|
283
291
|
{#if view === 'month'}
|
|
284
292
|
{format(date, 'LLLL yyyy', { locale })}
|
|
@@ -296,19 +304,19 @@
|
|
|
296
304
|
class="calendar-toggle-btn"
|
|
297
305
|
class:calendar-toggle-active={view === 'month'}
|
|
298
306
|
onclick={(e) => { view = 'month'; /** @type {HTMLElement} */ (e.currentTarget).blur(); }}
|
|
299
|
-
>
|
|
307
|
+
>{monthLabel}</button>
|
|
300
308
|
<button
|
|
301
309
|
type="button"
|
|
302
310
|
class="calendar-toggle-btn"
|
|
303
311
|
class:calendar-toggle-active={view === 'week'}
|
|
304
312
|
onclick={(e) => { view = 'week'; /** @type {HTMLElement} */ (e.currentTarget).blur(); }}
|
|
305
|
-
>
|
|
313
|
+
>{weekLabel}</button>
|
|
306
314
|
<button
|
|
307
315
|
type="button"
|
|
308
316
|
class="calendar-toggle-btn"
|
|
309
317
|
class:calendar-toggle-active={view === 'day'}
|
|
310
318
|
onclick={(e) => { view = 'day'; /** @type {HTMLElement} */ (e.currentTarget).blur(); }}
|
|
311
|
-
>
|
|
319
|
+
>{dayLabel}</button>
|
|
312
320
|
</div>
|
|
313
321
|
</div>
|
|
314
322
|
</div>
|
|
@@ -34,6 +34,10 @@ declare const Calendar: import("svelte").Component<{
|
|
|
34
34
|
oneventclick?: any;
|
|
35
35
|
ondateclick?: any;
|
|
36
36
|
event?: any;
|
|
37
|
+
todayLabel?: string;
|
|
38
|
+
monthLabel?: string;
|
|
39
|
+
weekLabel?: string;
|
|
40
|
+
dayLabel?: string;
|
|
37
41
|
class?: string;
|
|
38
42
|
} & Record<string, any>, {}, "view" | "date">;
|
|
39
43
|
type $$ComponentProps = {
|
|
@@ -45,6 +49,10 @@ type $$ComponentProps = {
|
|
|
45
49
|
oneventclick?: any;
|
|
46
50
|
ondateclick?: any;
|
|
47
51
|
event?: any;
|
|
52
|
+
todayLabel?: string;
|
|
53
|
+
monthLabel?: string;
|
|
54
|
+
weekLabel?: string;
|
|
55
|
+
dayLabel?: string;
|
|
48
56
|
class?: string;
|
|
49
57
|
} & Record<string, any>;
|
|
50
58
|
import { enUS } from 'date-fns/locale';
|
|
@@ -57,6 +57,10 @@
|
|
|
57
57
|
onsearch = undefined,
|
|
58
58
|
/** @type {boolean} */
|
|
59
59
|
loading = false,
|
|
60
|
+
/** @type {string} — shown when loading (async search debounce) */
|
|
61
|
+
searchingLabel = 'Searching…',
|
|
62
|
+
/** @type {string} — shown when the filtered list is empty */
|
|
63
|
+
noResultsLabel = 'No results found',
|
|
60
64
|
/** @type {string} */
|
|
61
65
|
class: className = '',
|
|
62
66
|
...rest
|
|
@@ -247,11 +251,11 @@
|
|
|
247
251
|
>
|
|
248
252
|
{#if loading}
|
|
249
253
|
<li class="combobox-empty" role="option" aria-selected="false" aria-disabled="true">
|
|
250
|
-
|
|
254
|
+
{searchingLabel}
|
|
251
255
|
</li>
|
|
252
256
|
{:else if filtered.length === 0}
|
|
253
257
|
<li class="combobox-empty" role="option" aria-selected="false" aria-disabled="true">
|
|
254
|
-
|
|
258
|
+
{noResultsLabel}
|
|
255
259
|
</li>
|
|
256
260
|
{:else}
|
|
257
261
|
{#each [...grouped.entries()] as [group, groupItems]}
|
|
@@ -46,6 +46,8 @@ declare const Combobox: import("svelte").Component<{
|
|
|
46
46
|
onchange?: any;
|
|
47
47
|
onsearch?: any;
|
|
48
48
|
loading?: boolean;
|
|
49
|
+
searchingLabel?: string;
|
|
50
|
+
noResultsLabel?: string;
|
|
49
51
|
class?: string;
|
|
50
52
|
} & Record<string, any>, {}, "value">;
|
|
51
53
|
type $$ComponentProps = {
|
|
@@ -60,5 +62,7 @@ type $$ComponentProps = {
|
|
|
60
62
|
onchange?: any;
|
|
61
63
|
onsearch?: any;
|
|
62
64
|
loading?: boolean;
|
|
65
|
+
searchingLabel?: string;
|
|
66
|
+
noResultsLabel?: string;
|
|
63
67
|
class?: string;
|
|
64
68
|
} & Record<string, any>;
|
|
@@ -447,7 +447,11 @@
|
|
|
447
447
|
background: var(--color-surface-secondary);
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
-
.
|
|
450
|
+
/* #2668 P3b — only clickable rows highlight on hover. A list whose rows
|
|
451
|
+
go nowhere (no on_row_click) looked clickable because .table-row:hover
|
|
452
|
+
highlighted all rows. Selectable rows keep their .table-row-selected
|
|
453
|
+
affordance (the checkbox cell has its own click handler). */
|
|
454
|
+
.table-row-clickable:hover {
|
|
451
455
|
background: var(--color-surface-tertiary);
|
|
452
456
|
}
|
|
453
457
|
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
icon = undefined,
|
|
37
37
|
/** @type {import('svelte').Snippet | undefined} */
|
|
38
38
|
children = undefined,
|
|
39
|
+
/** @type {string} — drop-zone instruction text */
|
|
40
|
+
dropLabel = 'Drop files here or click to browse',
|
|
39
41
|
/** @type {string} */
|
|
40
42
|
class: className = '',
|
|
41
43
|
...rest
|
|
@@ -192,7 +194,7 @@
|
|
|
192
194
|
{#if icon}
|
|
193
195
|
<span class="fileupload-icon">{@render icon()}</span>
|
|
194
196
|
{/if}
|
|
195
|
-
<span class="fileupload-text">
|
|
197
|
+
<span class="fileupload-text">{dropLabel}</span>
|
|
196
198
|
{#if accept || maxSize}
|
|
197
199
|
<span class="fileupload-hint">
|
|
198
200
|
{#if accept}{accept}{/if}
|
|
@@ -32,6 +32,7 @@ declare const FileUpload: import("svelte").Component<{
|
|
|
32
32
|
onreject?: any;
|
|
33
33
|
icon?: any;
|
|
34
34
|
children?: any;
|
|
35
|
+
dropLabel?: string;
|
|
35
36
|
class?: string;
|
|
36
37
|
} & Record<string, any>, {}, "">;
|
|
37
38
|
type $$ComponentProps = {
|
|
@@ -43,5 +44,6 @@ type $$ComponentProps = {
|
|
|
43
44
|
onreject?: any;
|
|
44
45
|
icon?: any;
|
|
45
46
|
children?: any;
|
|
47
|
+
dropLabel?: string;
|
|
46
48
|
class?: string;
|
|
47
49
|
} & Record<string, any>;
|
|
@@ -47,6 +47,14 @@
|
|
|
47
47
|
onchange = undefined,
|
|
48
48
|
/** @type {(() => void) | undefined} */
|
|
49
49
|
onclear = undefined,
|
|
50
|
+
/** @type {string} — default option label in select filters */
|
|
51
|
+
allLabel = 'All',
|
|
52
|
+
/** @type {string} — clear-all button label */
|
|
53
|
+
clearLabel = 'Clear all',
|
|
54
|
+
/** @type {string} — boolean filter "yes" label */
|
|
55
|
+
booleanYesLabel = 'Yes',
|
|
56
|
+
/** @type {string} — boolean filter "no" label */
|
|
57
|
+
booleanNoLabel = 'No',
|
|
50
58
|
/** @type {string} */
|
|
51
59
|
class: className = '',
|
|
52
60
|
...rest
|
|
@@ -102,7 +110,7 @@
|
|
|
102
110
|
value={value[filter.key] ?? ''}
|
|
103
111
|
onchange={(e) => setFilter(filter.key, /** @type {HTMLSelectElement} */ (e.currentTarget).value)}
|
|
104
112
|
>
|
|
105
|
-
<option value="">
|
|
113
|
+
<option value="">{allLabel}</option>
|
|
106
114
|
{#each filter.options as opt (opt.value)}
|
|
107
115
|
<option value={opt.value}>{opt.label}</option>
|
|
108
116
|
{/each}
|
|
@@ -112,7 +120,7 @@
|
|
|
112
120
|
</span>
|
|
113
121
|
</div>
|
|
114
122
|
{:else if filter.type === 'boolean'}
|
|
115
|
-
{@const opts = filter.options ?? [{ value: 'true', label:
|
|
123
|
+
{@const opts = filter.options ?? [{ value: 'true', label: booleanYesLabel }, { value: 'false', label: booleanNoLabel }]}
|
|
116
124
|
<span class="filter-field-label">{filter.label}</span>
|
|
117
125
|
<div class="filter-bool-chips">
|
|
118
126
|
{#each opts as opt (opt.value)}
|
|
@@ -130,7 +138,7 @@
|
|
|
130
138
|
<Combobox
|
|
131
139
|
size="sm"
|
|
132
140
|
label={filter.label}
|
|
133
|
-
placeholder=
|
|
141
|
+
placeholder={allLabel}
|
|
134
142
|
items={filter.searchItems ?? []}
|
|
135
143
|
value={value[filter.key] ?? ''}
|
|
136
144
|
onchange={(val) => setFilter(filter.key, val)}
|
|
@@ -147,7 +155,7 @@
|
|
|
147
155
|
onclick={clearAll}
|
|
148
156
|
type="button"
|
|
149
157
|
>
|
|
150
|
-
|
|
158
|
+
{clearLabel}
|
|
151
159
|
</button>
|
|
152
160
|
{/if}
|
|
153
161
|
</div>
|
|
@@ -43,6 +43,10 @@ declare const FilterPanel: import("svelte").Component<{
|
|
|
43
43
|
value?: Record<string, any>;
|
|
44
44
|
onchange?: any;
|
|
45
45
|
onclear?: any;
|
|
46
|
+
allLabel?: string;
|
|
47
|
+
clearLabel?: string;
|
|
48
|
+
booleanYesLabel?: string;
|
|
49
|
+
booleanNoLabel?: string;
|
|
46
50
|
class?: string;
|
|
47
51
|
} & Record<string, any>, {}, "value">;
|
|
48
52
|
type $$ComponentProps = {
|
|
@@ -50,5 +54,9 @@ type $$ComponentProps = {
|
|
|
50
54
|
value?: Record<string, any>;
|
|
51
55
|
onchange?: any;
|
|
52
56
|
onclear?: any;
|
|
57
|
+
allLabel?: string;
|
|
58
|
+
clearLabel?: string;
|
|
59
|
+
booleanYesLabel?: string;
|
|
60
|
+
booleanNoLabel?: string;
|
|
53
61
|
class?: string;
|
|
54
62
|
} & Record<string, any>;
|
package/components/Modal.svelte
CHANGED
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
width = 'default',
|
|
38
38
|
/** @type {(() => void) | undefined} */
|
|
39
39
|
onclose,
|
|
40
|
+
/** @type {string} — aria-label for the close button */
|
|
41
|
+
closeLabel = 'Close',
|
|
40
42
|
/** @type {string} */
|
|
41
43
|
class: className = '',
|
|
42
44
|
/** @type {import('svelte').Snippet | undefined} */
|
|
@@ -124,7 +126,7 @@
|
|
|
124
126
|
<button
|
|
125
127
|
class="modal-close"
|
|
126
128
|
onclick={onclose}
|
|
127
|
-
aria-label=
|
|
129
|
+
aria-label={closeLabel}
|
|
128
130
|
>
|
|
129
131
|
<svg viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
130
132
|
<path d="M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
@@ -29,6 +29,7 @@ declare const Modal: import("svelte").Component<{
|
|
|
29
29
|
title: any;
|
|
30
30
|
width?: string;
|
|
31
31
|
onclose: any;
|
|
32
|
+
closeLabel?: string;
|
|
32
33
|
class?: string;
|
|
33
34
|
header?: any;
|
|
34
35
|
footer?: any;
|
|
@@ -39,6 +40,7 @@ type $$ComponentProps = {
|
|
|
39
40
|
title: any;
|
|
40
41
|
width?: string;
|
|
41
42
|
onclose: any;
|
|
43
|
+
closeLabel?: string;
|
|
42
44
|
class?: string;
|
|
43
45
|
header?: any;
|
|
44
46
|
footer?: any;
|
|
@@ -56,6 +56,14 @@
|
|
|
56
56
|
onremove = undefined,
|
|
57
57
|
/** @type {((query: string) => void) | undefined} — async search; parent owns items */
|
|
58
58
|
onsearch = undefined,
|
|
59
|
+
/** @type {string} — shown when search returns nothing (forwarded to Combobox) */
|
|
60
|
+
noResultsLabel = 'No results found',
|
|
61
|
+
/** @type {string} — shown while searching (forwarded to Combobox) */
|
|
62
|
+
searchingLabel = 'Searching…',
|
|
63
|
+
/** @type {string} — aria-label for chip remove buttons (forwarded to Tag) */
|
|
64
|
+
removeLabel = 'Remove tag',
|
|
65
|
+
/** @type {string} — hint appended to the label when required */
|
|
66
|
+
requiredLabel = ' (required)',
|
|
59
67
|
/** @type {string} */
|
|
60
68
|
class: className = '',
|
|
61
69
|
...rest
|
|
@@ -89,14 +97,14 @@
|
|
|
89
97
|
>
|
|
90
98
|
{#if label}
|
|
91
99
|
<span id={`${mscId}-label`} class="msc-label"
|
|
92
|
-
>{label}{required ?
|
|
100
|
+
>{label}{required ? requiredLabel : ''}</span
|
|
93
101
|
>
|
|
94
102
|
{/if}
|
|
95
103
|
|
|
96
104
|
{#if selected.length}
|
|
97
105
|
<div class="msc-chips">
|
|
98
106
|
{#each selected as entry (entry.value)}
|
|
99
|
-
<Tag removable={!disabled} onremove={() => onremove?.(entry.value)}>
|
|
107
|
+
<Tag removable={!disabled} {removeLabel} onremove={() => onremove?.(entry.value)}>
|
|
100
108
|
{entry.label}
|
|
101
109
|
</Tag>
|
|
102
110
|
{/each}
|
|
@@ -112,6 +120,8 @@
|
|
|
112
120
|
{error}
|
|
113
121
|
{help}
|
|
114
122
|
{size}
|
|
123
|
+
{noResultsLabel}
|
|
124
|
+
{searchingLabel}
|
|
115
125
|
onsearch={onsearch}
|
|
116
126
|
onchange={handlePick}
|
|
117
127
|
/>
|
|
@@ -42,6 +42,10 @@ declare const MultiSelectCombobox: import("svelte").Component<{
|
|
|
42
42
|
onadd?: any;
|
|
43
43
|
onremove?: any;
|
|
44
44
|
onsearch?: any;
|
|
45
|
+
noResultsLabel?: string;
|
|
46
|
+
searchingLabel?: string;
|
|
47
|
+
removeLabel?: string;
|
|
48
|
+
requiredLabel?: string;
|
|
45
49
|
class?: string;
|
|
46
50
|
} & Record<string, any>, {}, "">;
|
|
47
51
|
type $$ComponentProps = {
|
|
@@ -58,5 +62,9 @@ type $$ComponentProps = {
|
|
|
58
62
|
onadd?: any;
|
|
59
63
|
onremove?: any;
|
|
60
64
|
onsearch?: any;
|
|
65
|
+
noResultsLabel?: string;
|
|
66
|
+
searchingLabel?: string;
|
|
67
|
+
removeLabel?: string;
|
|
68
|
+
requiredLabel?: string;
|
|
61
69
|
class?: string;
|
|
62
70
|
} & Record<string, any>;
|
|
@@ -61,6 +61,11 @@
|
|
|
61
61
|
/** @type {((size: number) => void) | undefined} */
|
|
62
62
|
on_page_size_change = undefined,
|
|
63
63
|
|
|
64
|
+
/** @type {string} — label for the "previous" nav button */
|
|
65
|
+
prevLabel = 'PREV',
|
|
66
|
+
/** @type {string} — label for the "next" nav button */
|
|
67
|
+
nextLabel = 'NEXT',
|
|
68
|
+
|
|
64
69
|
/** @type {string} */
|
|
65
70
|
class: className = '',
|
|
66
71
|
...rest
|
|
@@ -146,15 +151,15 @@
|
|
|
146
151
|
|
|
147
152
|
{#if mode === 'cursor'}
|
|
148
153
|
<button class="pagination-nav" disabled={!has_prev} onclick={on_prev} aria-label="Previous page">
|
|
149
|
-
{@render chevronLeft()}<span>
|
|
154
|
+
{@render chevronLeft()}<span>{prevLabel}</span>
|
|
150
155
|
</button>
|
|
151
156
|
<button class="pagination-nav" disabled={!has_next} onclick={on_next} aria-label="Next page">
|
|
152
|
-
<span>
|
|
157
|
+
<span>{nextLabel}</span>{@render chevronRight()}
|
|
153
158
|
</button>
|
|
154
159
|
|
|
155
160
|
{:else}
|
|
156
161
|
<button class="pagination-nav" disabled={current_page <= 1} onclick={() => on_page_change?.(current_page - 1)} aria-label="Previous page">
|
|
157
|
-
{@render chevronLeft()}<span>
|
|
162
|
+
{@render chevronLeft()}<span>{prevLabel}</span>
|
|
158
163
|
</button>
|
|
159
164
|
|
|
160
165
|
<div class="pagination-pages">
|
|
@@ -177,7 +182,7 @@
|
|
|
177
182
|
</div>
|
|
178
183
|
|
|
179
184
|
<button class="pagination-nav" disabled={current_page >= (total_pages ?? current_page)} onclick={() => on_page_change?.(current_page + 1)} aria-label="Next page">
|
|
180
|
-
<span>
|
|
185
|
+
<span>{nextLabel}</span>{@render chevronRight()}
|
|
181
186
|
</button>
|
|
182
187
|
{/if}
|
|
183
188
|
</div>
|
|
@@ -44,6 +44,8 @@ declare const Pagination: import("svelte").Component<{
|
|
|
44
44
|
page_size?: number;
|
|
45
45
|
page_sizes?: any;
|
|
46
46
|
on_page_size_change?: any;
|
|
47
|
+
prevLabel?: string;
|
|
48
|
+
nextLabel?: string;
|
|
47
49
|
class?: string;
|
|
48
50
|
} & Record<string, any>, {}, "">;
|
|
49
51
|
type $$ComponentProps = {
|
|
@@ -59,5 +61,7 @@ type $$ComponentProps = {
|
|
|
59
61
|
page_size?: number;
|
|
60
62
|
page_sizes?: any;
|
|
61
63
|
on_page_size_change?: any;
|
|
64
|
+
prevLabel?: string;
|
|
65
|
+
nextLabel?: string;
|
|
62
66
|
class?: string;
|
|
63
67
|
} & Record<string, any>;
|
package/components/Tag.svelte
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
removable = false,
|
|
17
17
|
/** @type {(() => void) | undefined} */
|
|
18
18
|
onremove = undefined,
|
|
19
|
+
/** @type {string} — aria-label for the remove button */
|
|
20
|
+
removeLabel = 'Remove tag',
|
|
19
21
|
/** @type {string} */
|
|
20
22
|
class: className = '',
|
|
21
23
|
/** @type {import('svelte').Snippet | undefined} */
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
<button
|
|
40
42
|
type="button"
|
|
41
43
|
class="tag-remove"
|
|
42
|
-
aria-label=
|
|
44
|
+
aria-label={removeLabel}
|
|
43
45
|
onclick={(e) => {
|
|
44
46
|
e.stopPropagation();
|
|
45
47
|
onremove?.();
|
|
@@ -18,12 +18,14 @@ type Tag = {
|
|
|
18
18
|
declare const Tag: import("svelte").Component<{
|
|
19
19
|
removable?: boolean;
|
|
20
20
|
onremove?: any;
|
|
21
|
+
removeLabel?: string;
|
|
21
22
|
class?: string;
|
|
22
23
|
children?: any;
|
|
23
24
|
} & Record<string, any>, {}, "">;
|
|
24
25
|
type $$ComponentProps = {
|
|
25
26
|
removable?: boolean;
|
|
26
27
|
onremove?: any;
|
|
28
|
+
removeLabel?: string;
|
|
27
29
|
class?: string;
|
|
28
30
|
children?: any;
|
|
29
31
|
} & Record<string, any>;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export type RelationshipMeta = {
|
|
2
2
|
relCode?: string;
|
|
3
3
|
targetTypeCode: string;
|
|
4
|
+
/** Human display name for the target type (e.g. "Pessoa Vulneravel" instead
|
|
5
|
+
* of "vulnerable_person"). Consumers pass it from the ontology schema; the
|
|
6
|
+
* renderer prefers it for the picker placeholder. Falls back to
|
|
7
|
+
* `targetTypeCode` when absent (backward-compatible). */
|
|
8
|
+
targetDisplayName?: string;
|
|
4
9
|
cardinality?: string;
|
|
5
10
|
};
|
|
6
11
|
type Entity = Record<string, unknown>;
|
|
@@ -15,6 +20,11 @@ export declare function isRelationshipParam(parameter: Entity): boolean;
|
|
|
15
20
|
export declare function isMultiRelationship(parameter: Entity): boolean;
|
|
16
21
|
/** The entity type code the picker searches/hydrates against. */
|
|
17
22
|
export declare function relationshipTypeCode(parameter: Entity): string;
|
|
23
|
+
/** Human display name for the relationship target, for use in the picker
|
|
24
|
+
* placeholder. Prefers `targetDisplayName` from the relationship metadata
|
|
25
|
+
* (populated by the consumer from the ontology schema); falls back to the
|
|
26
|
+
* raw type code so existing consumers without the display name are unchanged. */
|
|
27
|
+
export declare function relationshipDisplayName(parameter: Entity): string;
|
|
18
28
|
/** Normalize a rel value-bag entry onto the ID-list wire shape. */
|
|
19
29
|
export declare function normalizeRelIds(value: unknown): string[];
|
|
20
30
|
export {};
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
export type RelationshipMeta = {
|
|
11
11
|
relCode?: string;
|
|
12
12
|
targetTypeCode: string;
|
|
13
|
+
/** Human display name for the target type (e.g. "Pessoa Vulneravel" instead
|
|
14
|
+
* of "vulnerable_person"). Consumers pass it from the ontology schema; the
|
|
15
|
+
* renderer prefers it for the picker placeholder. Falls back to
|
|
16
|
+
* `targetTypeCode` when absent (backward-compatible). */
|
|
17
|
+
targetDisplayName?: string;
|
|
13
18
|
cardinality?: string;
|
|
14
19
|
};
|
|
15
20
|
|
|
@@ -34,9 +39,14 @@ export function relationshipMeta(parameter: Entity): RelationshipMeta | null {
|
|
|
34
39
|
if (!targetTypeCode) return null;
|
|
35
40
|
const relCode = carrier.relCode ?? carrier.rel_code;
|
|
36
41
|
const cardinality = carrier.cardinality;
|
|
42
|
+
const targetDisplayName =
|
|
43
|
+
carrier.targetDisplayName ?? carrier.target_display_name;
|
|
37
44
|
return {
|
|
38
45
|
relCode: relCode ? String(relCode) : undefined,
|
|
39
46
|
targetTypeCode,
|
|
47
|
+
...(targetDisplayName
|
|
48
|
+
? { targetDisplayName: String(targetDisplayName) }
|
|
49
|
+
: {}),
|
|
40
50
|
cardinality: cardinality ? String(cardinality) : undefined,
|
|
41
51
|
};
|
|
42
52
|
}
|
|
@@ -67,6 +77,19 @@ export function relationshipTypeCode(parameter: Entity): string {
|
|
|
67
77
|
);
|
|
68
78
|
}
|
|
69
79
|
|
|
80
|
+
/** Human display name for the relationship target, for use in the picker
|
|
81
|
+
* placeholder. Prefers `targetDisplayName` from the relationship metadata
|
|
82
|
+
* (populated by the consumer from the ontology schema); falls back to the
|
|
83
|
+
* raw type code so existing consumers without the display name are unchanged. */
|
|
84
|
+
export function relationshipDisplayName(parameter: Entity): string {
|
|
85
|
+
const meta = relationshipMeta(parameter);
|
|
86
|
+
return (
|
|
87
|
+
meta?.targetDisplayName ??
|
|
88
|
+
meta?.targetTypeCode ??
|
|
89
|
+
String(parameter.object_type ?? "")
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
70
93
|
/** Normalize a rel value-bag entry onto the ID-list wire shape. */
|
|
71
94
|
export function normalizeRelIds(value: unknown): string[] {
|
|
72
95
|
if (Array.isArray(value)) {
|