commons-shared-web-ui 0.0.78 → 0.0.80
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/index.d.ts
CHANGED
|
@@ -3770,6 +3770,70 @@ interface TableColumnSubField {
|
|
|
3770
3770
|
defaultValue?: any;
|
|
3771
3771
|
};
|
|
3772
3772
|
}
|
|
3773
|
+
/**
|
|
3774
|
+
* Resolves raw codes returned by the row API into human-readable labels by
|
|
3775
|
+
* calling a secondary "lookup" API (roles, MDM master data, statuses, ...).
|
|
3776
|
+
*
|
|
3777
|
+
* Works for BOTH shapes of row value:
|
|
3778
|
+
* - a single code -> `gender: "GENDER.FEMALE"` => "Female"
|
|
3779
|
+
* - an array of codes -> `roleCodes: ["role.a", "role.b"]` => "Role A, Role B"
|
|
3780
|
+
* An object value (e.g. `{ code: 'X' }`) is normalized to its `code`/`value`/`id`
|
|
3781
|
+
* before matching, so the same config works regardless of the API shape.
|
|
3782
|
+
*
|
|
3783
|
+
* The lookup API is called ONCE per distinct endpoint (not per row, not per cell)
|
|
3784
|
+
* and the resulting code -> label map is cached for the life of the component.
|
|
3785
|
+
* Columns pointing at the same endpoint share the same cache entry.
|
|
3786
|
+
*
|
|
3787
|
+
* Any HTTP verb is supported (`apiMethod`), with free-form `queryParams`,
|
|
3788
|
+
* `apiPayload` and `headers` — this is not limited to plain GET endpoints.
|
|
3789
|
+
*/
|
|
3790
|
+
interface ColumnLookupConfig {
|
|
3791
|
+
/**
|
|
3792
|
+
* Name of a shared lookup declared in `TableConfig.lookups`. Any property set
|
|
3793
|
+
* here overrides the shared definition, so `{ "ref": "roles" }` alone is enough
|
|
3794
|
+
* to reuse one lookup across several columns.
|
|
3795
|
+
*/
|
|
3796
|
+
ref?: string;
|
|
3797
|
+
/** Lookup endpoint. Supports a `{codes}` / `{value}` placeholder (see `paramName`). */
|
|
3798
|
+
apiUrl?: string;
|
|
3799
|
+
/** HTTP verb. Default: 'GET'. */
|
|
3800
|
+
apiMethod?: 'GET' | 'POST' | 'PUT' | 'PATCH';
|
|
3801
|
+
/** Static request body for non-GET verbs. Merged with `paramName` in targeted mode. */
|
|
3802
|
+
apiPayload?: any;
|
|
3803
|
+
/** Static query params, e.g. `{ classCode: 'CLASS.GENDER', size: 200 }`. Array values are repeated. */
|
|
3804
|
+
queryParams?: {
|
|
3805
|
+
[key: string]: any;
|
|
3806
|
+
};
|
|
3807
|
+
/** Extra headers, merged on top of the table's auth header. */
|
|
3808
|
+
headers?: {
|
|
3809
|
+
[key: string]: string;
|
|
3810
|
+
};
|
|
3811
|
+
/** Path to the array inside the response. Omit (or '') when the response IS the array. e.g. 'elements'. */
|
|
3812
|
+
dataPath?: string;
|
|
3813
|
+
/** Path inside each lookup item holding the code matched against the row value. Default: 'code'. */
|
|
3814
|
+
valueKey?: string;
|
|
3815
|
+
/** Path inside each lookup item holding the label. Supports array indexes, e.g. 'name[0].text'. Default: 'name'. */
|
|
3816
|
+
labelKey?: string;
|
|
3817
|
+
/**
|
|
3818
|
+
* TARGETED MODE. When set, the full list is NOT downloaded: only the distinct
|
|
3819
|
+
* codes present on the current page are requested, under this key.
|
|
3820
|
+
* GET -> query param (`?codes=A,B`); non-GET -> body key (`{ "codes": ["A","B"] }`).
|
|
3821
|
+
* Leave unset to fetch the whole list once and resolve everything client-side.
|
|
3822
|
+
*/
|
|
3823
|
+
paramName?: string;
|
|
3824
|
+
/** How multiple codes are sent in targeted mode. Default: 'csv' for GET, 'array' otherwise. */
|
|
3825
|
+
paramFormat?: 'csv' | 'repeat' | 'array';
|
|
3826
|
+
/** Separator used when codes are joined into a CSV param / the `{codes}` placeholder. Default: ','. */
|
|
3827
|
+
paramSeparator?: string;
|
|
3828
|
+
/** Joins the labels when the row value is an array. Default: ', '. */
|
|
3829
|
+
separator?: string;
|
|
3830
|
+
/** Match codes case-insensitively. Default: true. */
|
|
3831
|
+
caseInsensitive?: boolean;
|
|
3832
|
+
/** What to show for a code with no match: 'code' shows the raw code (default), 'empty' drops it. */
|
|
3833
|
+
fallback?: 'code' | 'empty';
|
|
3834
|
+
/** Explicit cache bucket. Defaults to `ref`, else derived from method + url + params + payload. */
|
|
3835
|
+
cacheKey?: string;
|
|
3836
|
+
}
|
|
3773
3837
|
interface TableColumn {
|
|
3774
3838
|
key: string;
|
|
3775
3839
|
label: string;
|
|
@@ -3791,6 +3855,11 @@ interface TableColumn {
|
|
|
3791
3855
|
clickAction?: 'route' | 'callback';
|
|
3792
3856
|
clickRoute?: string;
|
|
3793
3857
|
subFields?: TableColumnSubField[];
|
|
3858
|
+
/**
|
|
3859
|
+
* Resolves the code(s) held in this column into display labels via a secondary API.
|
|
3860
|
+
* Handles both a single code and an array of codes. See {@link ColumnLookupConfig}.
|
|
3861
|
+
*/
|
|
3862
|
+
lookupConfig?: ColumnLookupConfig;
|
|
3794
3863
|
editConfig?: {
|
|
3795
3864
|
disabled?: boolean;
|
|
3796
3865
|
defaultValue?: any;
|
|
@@ -3934,6 +4003,13 @@ interface TableConfig {
|
|
|
3934
4003
|
filterData?: {
|
|
3935
4004
|
[key: string]: any[];
|
|
3936
4005
|
};
|
|
4006
|
+
/**
|
|
4007
|
+
* Reusable lookup definitions, referenced from a column via
|
|
4008
|
+
* `lookupConfig: { "ref": "<key>" }`. Columns may override any property inline.
|
|
4009
|
+
*/
|
|
4010
|
+
lookups?: {
|
|
4011
|
+
[key: string]: ColumnLookupConfig;
|
|
4012
|
+
};
|
|
3937
4013
|
pagination?: PaginationConfig;
|
|
3938
4014
|
actions?: TableAction[];
|
|
3939
4015
|
topBarButtons?: TableAction[];
|
|
@@ -5073,6 +5149,12 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
|
|
|
5073
5149
|
deleteModalOpen: boolean;
|
|
5074
5150
|
deleteModalConfig: any;
|
|
5075
5151
|
private pendingDeleteAction;
|
|
5152
|
+
/** code -> label maps for column lookups, bucketed by lookup cache key. */
|
|
5153
|
+
private lookupMaps;
|
|
5154
|
+
/** Guards against firing the same lookup request twice. */
|
|
5155
|
+
private lookupInFlight;
|
|
5156
|
+
/** Full-list lookups already attempted — stops an empty/failed list refetching on every page. */
|
|
5157
|
+
private lookupLoaded;
|
|
5076
5158
|
searchSubject: Subject<string>;
|
|
5077
5159
|
stickyHeaders: QueryList<ElementRef>;
|
|
5078
5160
|
private resizeObserver;
|
|
@@ -5130,6 +5212,40 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
|
|
|
5130
5212
|
getAscOpacity(key: string): number;
|
|
5131
5213
|
getDescOpacity(key: string): number;
|
|
5132
5214
|
private replaceParams;
|
|
5215
|
+
/**
|
|
5216
|
+
* Merges a column's inline lookup config with the shared definition it
|
|
5217
|
+
* references (`TableConfig.lookups`). Inline properties win.
|
|
5218
|
+
*/
|
|
5219
|
+
private getLookupConfig;
|
|
5220
|
+
/** Bucket the resolved code -> label map lives in. Identical endpoints share one. */
|
|
5221
|
+
private getLookupCacheKey;
|
|
5222
|
+
/**
|
|
5223
|
+
* Fires the lookup request for every column that declares one.
|
|
5224
|
+
* - Full-list mode (no `paramName`): one request per endpoint, ever.
|
|
5225
|
+
* - Targeted mode (`paramName` set): requests only the codes on the current
|
|
5226
|
+
* page that are not cached yet, so it re-runs as the user pages/searches.
|
|
5227
|
+
*/
|
|
5228
|
+
private loadColumnLookups;
|
|
5229
|
+
/** Distinct, non-empty codes held by `col` across the rows currently loaded. */
|
|
5230
|
+
private collectColumnCodes;
|
|
5231
|
+
/** Substitutes the `{codes}` / `{value}` placeholder in a url or param value. */
|
|
5232
|
+
private applyLookupPlaceholders;
|
|
5233
|
+
/**
|
|
5234
|
+
* Issues the lookup request with any verb, then folds the response into the
|
|
5235
|
+
* code -> label map. `codes` is null in full-list mode.
|
|
5236
|
+
*/
|
|
5237
|
+
private fetchLookup;
|
|
5238
|
+
/** A label must be printable — objects/arrays degrade to the raw code. */
|
|
5239
|
+
private coerceLookupLabel;
|
|
5240
|
+
/** Map key for a code, honouring `caseInsensitive` (default true). */
|
|
5241
|
+
private normalizeLookupKey;
|
|
5242
|
+
/**
|
|
5243
|
+
* Turns the raw cell value into its label(s). Accepts a single code, an array
|
|
5244
|
+
* of codes, or objects wrapping a code. Unresolved codes are shown as-is
|
|
5245
|
+
* (`fallback: 'code'`, the default) or dropped (`fallback: 'empty'`).
|
|
5246
|
+
* Returns null when nothing is left, so the caller applies `emptyValue`.
|
|
5247
|
+
*/
|
|
5248
|
+
private resolveLookupLabel;
|
|
5133
5249
|
private loadFilterOptions;
|
|
5134
5250
|
private getValueByPath;
|
|
5135
5251
|
private calculateStickyPositions;
|
|
@@ -5413,6 +5529,14 @@ interface HierarchyCfg {
|
|
|
5413
5529
|
colSpan: number;
|
|
5414
5530
|
payloadPrefix: string;
|
|
5415
5531
|
dependencyParam: string;
|
|
5532
|
+
/**
|
|
5533
|
+
* Per-classCode overrides, keyed by the template's classCode (e.g. "GREF.REGION_DISTRICT").
|
|
5534
|
+
* Recognized keys: name, label, placeholder, payloadField, colSpan, required, errorMessage,
|
|
5535
|
+
* noDependency, hidden (skip this node but keep walking its children), disabled (render the
|
|
5536
|
+
* generated field as disabled — e.g. to lock a level to a known value), and leaf (stop
|
|
5537
|
+
* descending past this classCode, so deeper template levels — e.g. Ward below District —
|
|
5538
|
+
* are never generated for this consumer).
|
|
5539
|
+
*/
|
|
5416
5540
|
nodes: Record<string, any>;
|
|
5417
5541
|
branchSubType: string;
|
|
5418
5542
|
showLoader: boolean;
|
|
@@ -5477,4 +5601,4 @@ declare class SnackbarModule {
|
|
|
5477
5601
|
}
|
|
5478
5602
|
|
|
5479
5603
|
export { AlertComponent, AlertModule, ButtonComponent, ButtonDropdownComponent, ButtonDropdownModule, ButtonModule, CheckboxComponent, ClickOutsideDirective, ConfigColumnNodeComponent, ConfigFieldNodeComponent, ConfigSchemaTreeService, ConfigSectionNodeComponent, ConfigurableFormComponent, configurableForm_examples_d as ConfigurableFormExamples, ConfigurableFormModule, ConfirmationModalComponent, ConfirmationModalModule, DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_SIDE_NAV_TOOLTIP_POSITION, DatepickerComponent, DropdownComponent, ExpressionService, FieldConfigurationService, FieldConfiguratorComponent, FieldSelectionComponent, FilterComponent, FilterModule, FilterSidebarComponent, FilterSidebarModule, FilterTableSelectorComponent, FilterTableSelectorModule, FormBuilderModule, FormComponentsModule, FormFieldConfigurationComponent, FormFieldConfigurationModule, InputComponent, MaterialModule, NAV_ORIENTATION_DEFAULT, NAV_VARIANT_DEFAULT, NavComponent, NavModule, PAGINATION_THEME_DARK, PAGINATION_THEME_DEFAULT, PaginationComponent, PaginationModule, RadioComponent, SearchComponent, SharedUiModule, SideNavComponent, SideNavModule, SmartFormComponent, SmartFormController, smartForm_examples_d as SmartFormExamples, SmartFormModule, SmartTableComponent, SmartTableModule, SnackbarComponent, SnackbarModule, SnackbarService, StringUtils, SummaryCardComponent, SummaryCardModule, TableColumnConfigurationComponent, TableColumnConfigurationModule, TableColumnConfigurationService, TimePickerComponent, TimePickerModule, TimeWheelPanelComponent, ToggleComponent, ValidationUtils, appendBaseUrlRecursively, clearLocalStorage, clearSessionStorage, getLocalStorageItem, getSessionStorageItem, removeLocalStorageItem, removeSessionStorageItem, setLocalStorageItem, setSessionStorageItem, translateConfig };
|
|
5480
|
-
export type { ActionVisibility, AlertLabels, AlertVariant, AttachmentConfig, ButtonLabels, ButtonVariant, CheckboxConfig, CheckboxLabels, CheckboxOption, ConfigColumnNode, ConfigFieldNode, ConfigSectionNode, ConfirmationModalConfig, DateConfig, DatePickerConfig, DatepickerLabels, DropdownAction, DropdownConfig, DropdownLabels, DropdownOption, EmailConfig, FieldColSpanPayload, FieldConfig, FieldEventPayload, FieldReorderPayload, FieldType, FilterChangeEvent, FilterConfig, FilterItem, FilterItemType, FilterOutput, FilterPanelConfig, FilterParamMap, FilterSearchConfig, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOutput, FilterTableConfig, FilterTableSelectorConfig, FormConfig, FormField, FormOption, FormSchema, FormSection, GeneratedConfig, HierarchyCfg, IconInput, InputConfig, InputLabels, InputType, JsonFieldConfig, JsonFormConfig, KeyType, LengthConstraint, LocationConfig, NavItem, NavStyleConfig, NestedStringConfig, NumberConfig, OptionConfig, OptionDTO, OptionItem, PaginationConfig, PaginationLabels, PhoneConfig, QueryParamsConfig, RadioConfig, RadioLabels, RadioOption, RangeConfig, RatingConfig, SearchConfig, SearchLabels, SectionConfig, SelectionConfig, SideNavItem, SideNavSection, SideNavStyleConfig, SnackbarConfig, SnackbarVariant, StepperConfig, SubmitConfig, SuffixActionIcon, SummaryCardConfig, SummaryCardLabels, SummaryCardMeta, TableAction, TableActionItem, TableColumn, TableColumnSubField, TableConfig, TableDataChangeEvent, TableFilter, TableFilterChangeEvent, TableFilterColumn, TableFilterConfig, TableFilterItem, TableFilterLabels, TableFilterOutput, TableLabels, TableOption, TableRowSaveEvent, TableTheme, TextConfig, TimeMode, TimePickerConfig, TimePickerLabels, TimePickerVariant, ToggleConfig, ToggleLabels, UIConfig, UISubType, UIType, UploadedFile, ValidationResult, ValidationRules, VisibilityRule };
|
|
5604
|
+
export type { ActionVisibility, AlertLabels, AlertVariant, AttachmentConfig, ButtonLabels, ButtonVariant, CheckboxConfig, CheckboxLabels, CheckboxOption, ColumnLookupConfig, ConfigColumnNode, ConfigFieldNode, ConfigSectionNode, ConfirmationModalConfig, DateConfig, DatePickerConfig, DatepickerLabels, DropdownAction, DropdownConfig, DropdownLabels, DropdownOption, EmailConfig, FieldColSpanPayload, FieldConfig, FieldEventPayload, FieldReorderPayload, FieldType, FilterChangeEvent, FilterConfig, FilterItem, FilterItemType, FilterOutput, FilterPanelConfig, FilterParamMap, FilterSearchConfig, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOutput, FilterTableConfig, FilterTableSelectorConfig, FormConfig, FormField, FormOption, FormSchema, FormSection, GeneratedConfig, HierarchyCfg, IconInput, InputConfig, InputLabels, InputType, JsonFieldConfig, JsonFormConfig, KeyType, LengthConstraint, LocationConfig, NavItem, NavStyleConfig, NestedStringConfig, NumberConfig, OptionConfig, OptionDTO, OptionItem, PaginationConfig, PaginationLabels, PhoneConfig, QueryParamsConfig, RadioConfig, RadioLabels, RadioOption, RangeConfig, RatingConfig, SearchConfig, SearchLabels, SectionConfig, SelectionConfig, SideNavItem, SideNavSection, SideNavStyleConfig, SnackbarConfig, SnackbarVariant, StepperConfig, SubmitConfig, SuffixActionIcon, SummaryCardConfig, SummaryCardLabels, SummaryCardMeta, TableAction, TableActionItem, TableColumn, TableColumnSubField, TableConfig, TableDataChangeEvent, TableFilter, TableFilterChangeEvent, TableFilterColumn, TableFilterConfig, TableFilterItem, TableFilterLabels, TableFilterOutput, TableLabels, TableOption, TableRowSaveEvent, TableTheme, TextConfig, TimeMode, TimePickerConfig, TimePickerLabels, TimePickerVariant, ToggleConfig, ToggleLabels, UIConfig, UISubType, UIType, UploadedFile, ValidationResult, ValidationRules, VisibilityRule };
|