@fgv/ts-res-ui-components 5.0.0-18 → 5.0.0-19
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/README.md +267 -1
- package/dist/ts-res-ui-components.d.ts +250 -8
- package/lib/components/common/QualifierContextControl.d.ts +59 -1
- package/lib/components/common/QualifierContextControl.js +101 -17
- package/lib/components/common/ResolutionContextOptionsControl.d.ts +59 -0
- package/lib/components/common/ResolutionContextOptionsControl.js +182 -0
- package/lib/components/orchestrator/ResourceOrchestrator.d.ts +5 -1
- package/lib/components/orchestrator/ResourceOrchestrator.js +5 -2
- package/lib/components/views/FilterView/index.js +56 -11
- package/lib/components/views/ResolutionView/index.js +73 -17
- package/lib/hooks/useResourceData.d.ts +14 -2
- package/lib/hooks/useResourceData.js +24 -34
- package/lib/namespaces/ResolutionTools.d.ts +3 -1
- package/lib/namespaces/ResolutionTools.js +1 -0
- package/lib/types/index.d.ts +104 -0
- package/lib/utils/configurationUtils.d.ts +4 -4
- package/lib/utils/configurationUtils.js +36 -269
- package/lib/utils/tsResIntegration.d.ts +3 -3
- package/lib/utils/tsResIntegration.js +9 -6
- package/lib/utils/zipLoader/zipProcessingHelpers.js +3 -15
- package/lib-commonjs/components/common/QualifierContextControl.js +101 -17
- package/lib-commonjs/components/common/ResolutionContextOptionsControl.js +187 -0
- package/lib-commonjs/components/orchestrator/ResourceOrchestrator.js +5 -2
- package/lib-commonjs/components/views/FilterView/index.js +56 -11
- package/lib-commonjs/components/views/ResolutionView/index.js +72 -16
- package/lib-commonjs/hooks/useResourceData.js +24 -34
- package/lib-commonjs/namespaces/ResolutionTools.js +3 -1
- package/lib-commonjs/utils/configurationUtils.js +36 -269
- package/lib-commonjs/utils/tsResIntegration.js +9 -6
- package/lib-commonjs/utils/zipLoader/zipProcessingHelpers.js +2 -14
- package/package.json +7 -7
- package/src/components/common/QualifierContextControl.tsx +112 -19
- package/src/components/common/ResolutionContextOptionsControl.tsx +409 -0
- package/src/components/orchestrator/ResourceOrchestrator.tsx +19 -11
- package/src/components/views/FilterView/index.tsx +115 -38
- package/src/components/views/ResolutionView/index.tsx +158 -57
- package/src/hooks/useConfigurationState.ts +0 -1
- package/src/hooks/useResourceData.ts +58 -32
- package/src/namespaces/ResolutionTools.ts +5 -1
- package/src/types/index.ts +110 -0
- package/src/utils/configurationUtils.ts +38 -276
- package/src/utils/tsResIntegration.ts +35 -6
- package/src/utils/zipLoader/zipProcessingHelpers.ts +6 -12
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ This packlet is largely AI written, and it shows.
|
|
|
14
14
|
- **🔄 Resource Management**: Import, process, and manage ts-res configurations and bundles
|
|
15
15
|
- **🔍 Advanced Filtering**: Filter resources by context with qualifier reduction
|
|
16
16
|
- **🎯 Resource Resolution**: Test resource resolution with dynamic context values
|
|
17
|
+
- **🔒 View Mode Locking**: Lock to single view mode for simplified interfaces
|
|
17
18
|
- **📊 Visualization**: Multiple views for exploring resource structures and compiled output
|
|
18
19
|
- **⚙️ Configuration**: Visual configuration management for qualifier types, qualifiers, and resource types
|
|
19
20
|
- **📁 File Handling**: Support for directory imports, ZIP files via ts-res zip-archive packlet, and bundle loading
|
|
@@ -363,7 +364,7 @@ Shows the compiled resource structure with detailed candidate information using
|
|
|
363
364
|
|
|
364
365
|
### ResolutionView
|
|
365
366
|
|
|
366
|
-
Interactive resource resolution testing with context management and support for custom resource editors via the ResourceEditorFactory pattern.
|
|
367
|
+
Interactive resource resolution testing with context management and support for custom resource editors via the ResourceEditorFactory pattern. Supports locking to a single view mode to simplify the interface for specific use cases.
|
|
367
368
|
|
|
368
369
|
> 📚 **[See ResolutionView documentation →](./docs/ts-res-ui-components.resolutionview.md)**
|
|
369
370
|
|
|
@@ -442,6 +443,271 @@ const editorFactory = new MyResourceEditorFactory();
|
|
|
442
443
|
- **Extensible**: Easy to add new editors for new resource types
|
|
443
444
|
- **Error Handling**: Factory failures are caught and reported to users
|
|
444
445
|
|
|
446
|
+
#### Context Control Extensibility
|
|
447
|
+
|
|
448
|
+
ResolutionView provides comprehensive control over the context configuration UI, allowing hosts to customize which qualifiers are editable, provide external values, and control the presentation. This is especially useful for applications that need to drive context externally or provide selective user control.
|
|
449
|
+
|
|
450
|
+
**Hide Context UI Entirely (Host-Driven Context):**
|
|
451
|
+
```tsx
|
|
452
|
+
<ResolutionView
|
|
453
|
+
resources={processedResources}
|
|
454
|
+
resolutionState={resolutionState}
|
|
455
|
+
resolutionActions={resolutionActions}
|
|
456
|
+
contextOptions={{
|
|
457
|
+
showContextControls: false // Hide all context UI
|
|
458
|
+
}}
|
|
459
|
+
/>
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
**Lock to Single View Mode:**
|
|
463
|
+
```tsx
|
|
464
|
+
<ResolutionView
|
|
465
|
+
resources={processedResources}
|
|
466
|
+
resolutionState={resolutionState}
|
|
467
|
+
resolutionActions={resolutionActions}
|
|
468
|
+
lockedViewMode="composed" // Lock to composed view, hide view selector
|
|
469
|
+
/>
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
**Lock to Best View Mode:**
|
|
473
|
+
```tsx
|
|
474
|
+
<ResolutionView
|
|
475
|
+
resources={processedResources}
|
|
476
|
+
resolutionState={resolutionState}
|
|
477
|
+
resolutionActions={resolutionActions}
|
|
478
|
+
lockedViewMode="best" // Lock to best view, hide view selector
|
|
479
|
+
/>
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
**Custom Section Titles:**
|
|
483
|
+
```tsx
|
|
484
|
+
<ResolutionView
|
|
485
|
+
resources={processedResources}
|
|
486
|
+
resolutionState={resolutionState}
|
|
487
|
+
resolutionActions={resolutionActions}
|
|
488
|
+
sectionTitles={{
|
|
489
|
+
resources: "Available Items", // Custom title for resources picker
|
|
490
|
+
results: "Resolution Output" // Custom title for results section
|
|
491
|
+
}}
|
|
492
|
+
/>
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**Fine-Grained Qualifier Control:**
|
|
496
|
+
```tsx
|
|
497
|
+
<ResolutionView
|
|
498
|
+
resources={processedResources}
|
|
499
|
+
resolutionState={resolutionState}
|
|
500
|
+
resolutionActions={resolutionActions}
|
|
501
|
+
contextOptions={{
|
|
502
|
+
// Panel visibility control
|
|
503
|
+
showContextControls: true,
|
|
504
|
+
showCurrentContext: true,
|
|
505
|
+
showContextActions: true,
|
|
506
|
+
|
|
507
|
+
// Per-qualifier configuration
|
|
508
|
+
qualifierOptions: {
|
|
509
|
+
language: {
|
|
510
|
+
editable: true,
|
|
511
|
+
placeholder: "Select language..."
|
|
512
|
+
},
|
|
513
|
+
platform: {
|
|
514
|
+
editable: false,
|
|
515
|
+
hostValue: "web",
|
|
516
|
+
showHostValue: true
|
|
517
|
+
},
|
|
518
|
+
environment: {
|
|
519
|
+
visible: false // Hidden from UI entirely
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
|
|
523
|
+
// Host-managed values (invisible but active in context)
|
|
524
|
+
hostManagedValues: {
|
|
525
|
+
environment: "production",
|
|
526
|
+
deployment: "us-east-1"
|
|
527
|
+
},
|
|
528
|
+
|
|
529
|
+
// Appearance customization
|
|
530
|
+
contextPanelTitle: "Resolution Context",
|
|
531
|
+
globalPlaceholder: "Enter {qualifierName}..."
|
|
532
|
+
}}
|
|
533
|
+
/>
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
**Visual Indicators:**
|
|
537
|
+
- **🔵 Blue border + light blue background** - Host-managed qualifiers have subtle visual styling
|
|
538
|
+
- **🖱️ Hover tooltip** - "Host-managed value - controlled externally" appears on hover
|
|
539
|
+
- **🎯 Actual values displayed** - Shows real host values instead of generic "Disabled" text
|
|
540
|
+
- **📋 Current context** - Displays combined user + host-managed values
|
|
541
|
+
|
|
542
|
+
**Development & Debug Controls:**
|
|
543
|
+
Enable the context options gear icon during development for interactive configuration:
|
|
544
|
+
|
|
545
|
+
```tsx
|
|
546
|
+
<ResolutionView
|
|
547
|
+
resources={processedResources}
|
|
548
|
+
pickerOptionsPresentation="collapsible" // Shows both picker & context gear icons
|
|
549
|
+
resolutionState={resolutionState}
|
|
550
|
+
resolutionActions={resolutionActions}
|
|
551
|
+
/>
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
The gear icon provides a live configuration interface for:
|
|
555
|
+
- **Context Panel Visibility** - Show/hide controls, current context display, action buttons
|
|
556
|
+
- **Global Defaults** - Set default visibility and editability for all qualifiers
|
|
557
|
+
- **Per-Qualifier Settings** - Configure visibility, editability, host values, and custom placeholders
|
|
558
|
+
- **Host-Managed Values** - Set external values that override user input
|
|
559
|
+
|
|
560
|
+
This extensibility is perfect for:
|
|
561
|
+
- **Embedded applications** where the host drives context from sidebar controls
|
|
562
|
+
- **Guided workflows** where only specific qualifiers should be user-editable
|
|
563
|
+
- **Multi-tenant applications** where some context is determined by tenant configuration
|
|
564
|
+
- **Progressive disclosure** where advanced qualifiers are hidden from basic users
|
|
565
|
+
|
|
566
|
+
### FilterView
|
|
567
|
+
|
|
568
|
+
Provides context-based resource filtering with candidate count analysis and export functionality.
|
|
569
|
+
|
|
570
|
+
> 📚 **[See FilterView documentation →](./docs/ts-res-ui-components.filterview.md)**
|
|
571
|
+
|
|
572
|
+
```tsx
|
|
573
|
+
import { FilterView, ResourceTools } from '@fgv/ts-res-ui-components';
|
|
574
|
+
|
|
575
|
+
function MyFilterTool() {
|
|
576
|
+
const { state, actions } = ResourceTools.useResourceData();
|
|
577
|
+
|
|
578
|
+
return (
|
|
579
|
+
<FilterView
|
|
580
|
+
resources={state.resources}
|
|
581
|
+
filterState={state.filterState}
|
|
582
|
+
filterActions={{
|
|
583
|
+
updateFilterEnabled: (enabled) => actions.updateFilterState({ enabled }),
|
|
584
|
+
updateFilterValues: (values) => actions.updateFilterState({ values }),
|
|
585
|
+
applyFilterValues: () => actions.applyFilter(),
|
|
586
|
+
resetFilterValues: () => actions.resetFilter(),
|
|
587
|
+
updateReduceQualifiers: (reduce) => actions.updateFilterState({ reduceQualifiers: reduce })
|
|
588
|
+
}}
|
|
589
|
+
filterResult={state.filterResult}
|
|
590
|
+
onMessage={(type, message) => console.log(`${type}: ${message}`)}
|
|
591
|
+
/>
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
#### FilterView Context Control Extensibility
|
|
597
|
+
|
|
598
|
+
FilterView provides the same comprehensive context control features as ResolutionView, allowing hosts to customize which qualifiers are editable for filtering, provide external values, and control the presentation. This is especially useful for filtering applications that need to drive filter context externally or provide selective user control.
|
|
599
|
+
|
|
600
|
+
**Hide Context UI Entirely (Host-Driven Filtering):**
|
|
601
|
+
```tsx
|
|
602
|
+
<FilterView
|
|
603
|
+
resources={processedResources}
|
|
604
|
+
filterState={filterState}
|
|
605
|
+
filterActions={filterActions}
|
|
606
|
+
filterResult={filterResult}
|
|
607
|
+
contextOptions={{
|
|
608
|
+
showContextControls: false // Hide all context filter controls
|
|
609
|
+
}}
|
|
610
|
+
/>
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
**Fine-Grained Filter Context Control:**
|
|
614
|
+
```tsx
|
|
615
|
+
<FilterView
|
|
616
|
+
resources={processedResources}
|
|
617
|
+
filterState={filterState}
|
|
618
|
+
filterActions={filterActions}
|
|
619
|
+
filterResult={filterResult}
|
|
620
|
+
contextOptions={{
|
|
621
|
+
// Panel appearance
|
|
622
|
+
contextPanelTitle: "Filter Criteria",
|
|
623
|
+
globalPlaceholder: "Filter by {qualifierName}...",
|
|
624
|
+
|
|
625
|
+
// Per-qualifier configuration
|
|
626
|
+
qualifierOptions: {
|
|
627
|
+
language: {
|
|
628
|
+
editable: true,
|
|
629
|
+
placeholder: "Filter by language..."
|
|
630
|
+
},
|
|
631
|
+
platform: {
|
|
632
|
+
editable: false,
|
|
633
|
+
hostValue: "web",
|
|
634
|
+
showHostValue: true
|
|
635
|
+
},
|
|
636
|
+
environment: {
|
|
637
|
+
visible: false // Hidden from filter UI entirely
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
|
|
641
|
+
// Host-managed filter values (invisible but active in filter context)
|
|
642
|
+
hostManagedValues: {
|
|
643
|
+
environment: "production",
|
|
644
|
+
deployment: "us-east-1"
|
|
645
|
+
},
|
|
646
|
+
|
|
647
|
+
// UI visibility control
|
|
648
|
+
showCurrentContext: true, // Show pending/applied filter summary
|
|
649
|
+
showContextActions: true // Show filter reset/apply buttons
|
|
650
|
+
}}
|
|
651
|
+
/>
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
**Combined with External Filter Logic:**
|
|
655
|
+
```tsx
|
|
656
|
+
function SmartFilterView() {
|
|
657
|
+
const [externalContext, setExternalContext] = useState({
|
|
658
|
+
userRole: 'admin',
|
|
659
|
+
tenant: 'enterprise'
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
return (
|
|
663
|
+
<FilterView
|
|
664
|
+
resources={processedResources}
|
|
665
|
+
filterState={filterState}
|
|
666
|
+
filterActions={filterActions}
|
|
667
|
+
contextOptions={{
|
|
668
|
+
contextPanelTitle: "Available Filters",
|
|
669
|
+
qualifierOptions: {
|
|
670
|
+
// Hide sensitive qualifiers from basic users
|
|
671
|
+
environment: {
|
|
672
|
+
visible: externalContext.userRole === 'admin'
|
|
673
|
+
},
|
|
674
|
+
// Lock tenant-specific qualifiers
|
|
675
|
+
tenant: {
|
|
676
|
+
editable: false,
|
|
677
|
+
hostValue: externalContext.tenant
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}}
|
|
681
|
+
/>
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
**Development & Debug Controls:**
|
|
687
|
+
Enable the context options gear icon during development for interactive filter configuration:
|
|
688
|
+
|
|
689
|
+
```tsx
|
|
690
|
+
<FilterView
|
|
691
|
+
resources={processedResources}
|
|
692
|
+
pickerOptionsPresentation="collapsible" // Shows both picker & context gear icons
|
|
693
|
+
filterState={filterState}
|
|
694
|
+
filterActions={filterActions}
|
|
695
|
+
/>
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
The gear icon provides a live configuration interface for:
|
|
699
|
+
- **Context Panel Visibility** - Show/hide filter controls, current context display, action buttons
|
|
700
|
+
- **Global Defaults** - Set default visibility and editability for all filter qualifiers
|
|
701
|
+
- **Per-Qualifier Settings** - Configure visibility, editability, host values, and custom placeholders
|
|
702
|
+
- **Host-Managed Values** - Set external filter values that override user input
|
|
703
|
+
|
|
704
|
+
This filter extensibility is perfect for:
|
|
705
|
+
- **Dashboard applications** where filters are driven from external controls
|
|
706
|
+
- **Multi-tenant systems** where filter options vary by tenant or user role
|
|
707
|
+
- **Guided filter workflows** where only specific criteria should be user-selectable
|
|
708
|
+
- **Advanced/basic user modes** where filter complexity adapts to user expertise
|
|
709
|
+
- **Integration scenarios** where filter context comes from external systems
|
|
710
|
+
|
|
445
711
|
### MessagesWindow
|
|
446
712
|
|
|
447
713
|
Displays and manages application messages with filtering, search, and copy functionality. Perfect for debugging interfaces and development tools where message visibility is critical.
|
|
@@ -274,15 +274,15 @@ declare interface ConfigurationState {
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
|
-
*
|
|
277
|
+
* Configuration template using predefined configurations from ts-res
|
|
278
278
|
* @internal
|
|
279
279
|
*/
|
|
280
280
|
declare interface ConfigurationTemplate {
|
|
281
|
-
id:
|
|
281
|
+
id: Config.PredefinedSystemConfiguration;
|
|
282
282
|
name: string;
|
|
283
283
|
description: string;
|
|
284
284
|
configuration: Config.Model.ISystemConfiguration;
|
|
285
|
-
category: 'basic' | 'intermediate' | 'advanced'
|
|
285
|
+
category: 'basic' | 'intermediate' | 'advanced';
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
export declare namespace ConfigurationTools {
|
|
@@ -518,7 +518,7 @@ declare function createSimpleContext(qualifiers: Qualifiers.IReadOnlyQualifierCo
|
|
|
518
518
|
* Create ts-res system from configuration
|
|
519
519
|
*/
|
|
520
520
|
/** @internal */
|
|
521
|
-
declare function createTsResSystemFromConfig(systemConfig?: Config.Model.ISystemConfiguration): Result<{
|
|
521
|
+
declare function createTsResSystemFromConfig(systemConfig?: Config.Model.ISystemConfiguration, qualifierTypeFactory?: Config.IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierTypes.QualifierType>, resourceTypeFactory?: Config.IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceTypes.ResourceType>): Result<{
|
|
522
522
|
qualifierTypes: QualifierTypes.ReadOnlyQualifierTypeCollector;
|
|
523
523
|
qualifiers: Qualifiers.IReadOnlyQualifierCollector;
|
|
524
524
|
resourceTypes: ResourceTypes.ReadOnlyResourceTypeCollector;
|
|
@@ -1336,6 +1336,8 @@ declare interface FilterViewProps extends ViewBaseProps {
|
|
|
1336
1336
|
onFilterResult?: (result: FilterResult | null) => void;
|
|
1337
1337
|
/** Optional configuration for the ResourcePicker behavior */
|
|
1338
1338
|
pickerOptions?: ResourcePickerOptions;
|
|
1339
|
+
/** Optional configuration for context control behavior */
|
|
1340
|
+
contextOptions?: ResolutionContextOptions;
|
|
1339
1341
|
}
|
|
1340
1342
|
|
|
1341
1343
|
/**
|
|
@@ -2314,7 +2316,7 @@ declare interface ProcessedResources {
|
|
|
2314
2316
|
* Process imported directory using the ts-res system
|
|
2315
2317
|
*/
|
|
2316
2318
|
/** @internal */
|
|
2317
|
-
declare function processImportedDirectory(directory: ImportedDirectory, systemConfig?: Config.Model.ISystemConfiguration): Result<{
|
|
2319
|
+
declare function processImportedDirectory(directory: ImportedDirectory, systemConfig?: Config.Model.ISystemConfiguration, qualifierTypeFactory?: Config.IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierTypes.QualifierType>, resourceTypeFactory?: Config.IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceTypes.ResourceType>): Result<{
|
|
2318
2320
|
system: {
|
|
2319
2321
|
qualifierTypes: QualifierTypes.ReadOnlyQualifierTypeCollector;
|
|
2320
2322
|
qualifiers: Qualifiers.IReadOnlyQualifierCollector;
|
|
@@ -2338,7 +2340,7 @@ declare function processImportedDirectory(directory: ImportedDirectory, systemCo
|
|
|
2338
2340
|
* Process imported files using the ts-res system
|
|
2339
2341
|
*/
|
|
2340
2342
|
/** @internal */
|
|
2341
|
-
declare function processImportedFiles(files: ImportedFile[], systemConfig?: Config.Model.ISystemConfiguration): Result<{
|
|
2343
|
+
declare function processImportedFiles(files: ImportedFile[], systemConfig?: Config.Model.ISystemConfiguration, qualifierTypeFactory?: Config.IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierTypes.QualifierType>, resourceTypeFactory?: Config.IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceTypes.ResourceType>): Result<{
|
|
2342
2344
|
system: {
|
|
2343
2345
|
qualifierTypes: QualifierTypes.ReadOnlyQualifierTypeCollector;
|
|
2344
2346
|
qualifiers: Qualifiers.IReadOnlyQualifierCollector;
|
|
@@ -2436,6 +2438,62 @@ declare function processZipResources(files: ImportedFile[], directory: ImportedD
|
|
|
2436
2438
|
* }
|
|
2437
2439
|
* ```
|
|
2438
2440
|
*
|
|
2441
|
+
* @example
|
|
2442
|
+
* ```tsx
|
|
2443
|
+
* // Using with host-managed values and custom options
|
|
2444
|
+
* import { ResolutionTools } from '@fgv/ts-res-ui-components';
|
|
2445
|
+
*
|
|
2446
|
+
* function HostControlledQualifier() {
|
|
2447
|
+
* return (
|
|
2448
|
+
* <ResolutionTools.QualifierContextControl
|
|
2449
|
+
* qualifierName="platform"
|
|
2450
|
+
* value={undefined} // Ignored when hostValue is set
|
|
2451
|
+
* onChange={() => {}} // Called only when editable
|
|
2452
|
+
* options={{
|
|
2453
|
+
* editable: false,
|
|
2454
|
+
* hostValue: 'web',
|
|
2455
|
+
* showHostValue: true,
|
|
2456
|
+
* placeholder: 'Platform controlled by application',
|
|
2457
|
+
* className: 'border-blue-300'
|
|
2458
|
+
* }}
|
|
2459
|
+
* />
|
|
2460
|
+
* );
|
|
2461
|
+
* }
|
|
2462
|
+
* ```
|
|
2463
|
+
*
|
|
2464
|
+
* @example
|
|
2465
|
+
* ```tsx
|
|
2466
|
+
* // Using for selective visibility and editability
|
|
2467
|
+
* function ConditionalQualifierControls() {
|
|
2468
|
+
* const [userRole, setUserRole] = useState<'admin' | 'user'>('user');
|
|
2469
|
+
*
|
|
2470
|
+
* return (
|
|
2471
|
+
* <div>
|
|
2472
|
+
* <ResolutionTools.QualifierContextControl
|
|
2473
|
+
* qualifierName="environment"
|
|
2474
|
+
* value={envValue}
|
|
2475
|
+
* onChange={handleEnvChange}
|
|
2476
|
+
* options={{
|
|
2477
|
+
* visible: userRole === 'admin', // Only visible to admins
|
|
2478
|
+
* editable: true,
|
|
2479
|
+
* placeholder: 'Select environment...'
|
|
2480
|
+
* }}
|
|
2481
|
+
* />
|
|
2482
|
+
* <ResolutionTools.QualifierContextControl
|
|
2483
|
+
* qualifierName="language"
|
|
2484
|
+
* value={langValue}
|
|
2485
|
+
* onChange={handleLangChange}
|
|
2486
|
+
* options={{
|
|
2487
|
+
* visible: true,
|
|
2488
|
+
* editable: userRole === 'admin', // Only editable by admins
|
|
2489
|
+
* placeholder: userRole === 'admin' ? 'Select language...' : 'Language locked'
|
|
2490
|
+
* }}
|
|
2491
|
+
* />
|
|
2492
|
+
* </div>
|
|
2493
|
+
* );
|
|
2494
|
+
* }
|
|
2495
|
+
* ```
|
|
2496
|
+
*
|
|
2439
2497
|
* @public
|
|
2440
2498
|
*/
|
|
2441
2499
|
declare const QualifierContextControl: React_2.FC<QualifierContextControlProps>;
|
|
@@ -2460,6 +2518,44 @@ declare interface QualifierContextControlProps {
|
|
|
2460
2518
|
resources?: ProcessedResources | null;
|
|
2461
2519
|
/** Optional CSS classes to apply to the control */
|
|
2462
2520
|
className?: string;
|
|
2521
|
+
/** Extended options for controlling the qualifier behavior */
|
|
2522
|
+
options?: QualifierControlOptions;
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
/**
|
|
2526
|
+
* Options for controlling individual qualifier context controls.
|
|
2527
|
+
*
|
|
2528
|
+
* Provides fine-grained control over the behavior, appearance, and editability
|
|
2529
|
+
* of individual qualifier inputs. This allows hosts to customize which qualifiers
|
|
2530
|
+
* are editable, provide external values, and control the presentation.
|
|
2531
|
+
*
|
|
2532
|
+
* @example
|
|
2533
|
+
* ```tsx
|
|
2534
|
+
* // Make a qualifier readonly with external value
|
|
2535
|
+
* const languageOptions: QualifierControlOptions = {
|
|
2536
|
+
* visible: true,
|
|
2537
|
+
* editable: false,
|
|
2538
|
+
* hostValue: 'en-US',
|
|
2539
|
+
* showHostValue: true,
|
|
2540
|
+
* placeholder: 'Language managed externally'
|
|
2541
|
+
* };
|
|
2542
|
+
* ```
|
|
2543
|
+
*
|
|
2544
|
+
* @public
|
|
2545
|
+
*/
|
|
2546
|
+
declare interface QualifierControlOptions {
|
|
2547
|
+
/** Whether this qualifier should be visible at all */
|
|
2548
|
+
visible?: boolean;
|
|
2549
|
+
/** Whether this qualifier is editable by the user */
|
|
2550
|
+
editable?: boolean;
|
|
2551
|
+
/** External/host-managed value that overrides user input */
|
|
2552
|
+
hostValue?: string | undefined;
|
|
2553
|
+
/** Whether to show host-managed values in the display */
|
|
2554
|
+
showHostValue?: boolean;
|
|
2555
|
+
/** Custom placeholder text for this qualifier */
|
|
2556
|
+
placeholder?: string;
|
|
2557
|
+
/** Custom CSS classes for this qualifier control */
|
|
2558
|
+
className?: string;
|
|
2463
2559
|
}
|
|
2464
2560
|
|
|
2465
2561
|
/**
|
|
@@ -2726,6 +2822,120 @@ declare interface ResolutionActions {
|
|
|
2726
2822
|
discardEdits: () => void;
|
|
2727
2823
|
}
|
|
2728
2824
|
|
|
2825
|
+
/**
|
|
2826
|
+
* Configuration options for the resolution context controls in ResolutionView.
|
|
2827
|
+
*
|
|
2828
|
+
* Controls the visibility and behavior of the context configuration panel,
|
|
2829
|
+
* allowing hosts to customize which qualifiers are editable and provide
|
|
2830
|
+
* externally managed context values. Uses QualifierControlOptions for
|
|
2831
|
+
* per-qualifier customization.
|
|
2832
|
+
*
|
|
2833
|
+
* @example
|
|
2834
|
+
* ```tsx
|
|
2835
|
+
* // Hide context UI entirely - host controls context externally
|
|
2836
|
+
* <ResolutionView
|
|
2837
|
+
* contextOptions={{ showContextControls: false }}
|
|
2838
|
+
* // ... other props
|
|
2839
|
+
* />
|
|
2840
|
+
*
|
|
2841
|
+
* // Fine-grained qualifier control
|
|
2842
|
+
* <ResolutionView
|
|
2843
|
+
* contextOptions={{
|
|
2844
|
+
* showContextControls: true,
|
|
2845
|
+
* qualifierOptions: {
|
|
2846
|
+
* language: { editable: true, placeholder: 'Select language...' },
|
|
2847
|
+
* platform: { editable: false, hostValue: 'web', showHostValue: true },
|
|
2848
|
+
* env: { visible: false } // Hidden from UI entirely
|
|
2849
|
+
* },
|
|
2850
|
+
* hostManagedValues: { env: 'production' } // Invisible but active
|
|
2851
|
+
* }}
|
|
2852
|
+
* // ... other props
|
|
2853
|
+
* />
|
|
2854
|
+
* ```
|
|
2855
|
+
*
|
|
2856
|
+
* @public
|
|
2857
|
+
*/
|
|
2858
|
+
declare interface ResolutionContextOptions {
|
|
2859
|
+
/** Visibility options */
|
|
2860
|
+
/** Whether to show the context configuration panel at all */
|
|
2861
|
+
showContextControls?: boolean;
|
|
2862
|
+
/** Whether to show the current context display */
|
|
2863
|
+
showCurrentContext?: boolean;
|
|
2864
|
+
/** Whether to show the Apply/Reset buttons */
|
|
2865
|
+
showContextActions?: boolean;
|
|
2866
|
+
/** Per-qualifier control options */
|
|
2867
|
+
qualifierOptions?: Record<string, QualifierControlOptions>;
|
|
2868
|
+
/** Global defaults for qualifiers not specifically configured */
|
|
2869
|
+
defaultQualifierEditable?: boolean;
|
|
2870
|
+
defaultQualifierVisible?: boolean;
|
|
2871
|
+
/** Host-managed values that override all user input for invisible qualifiers */
|
|
2872
|
+
hostManagedValues?: Record<string, string | undefined>;
|
|
2873
|
+
/** Appearance options */
|
|
2874
|
+
/** Custom title for the context configuration panel */
|
|
2875
|
+
contextPanelTitle?: string;
|
|
2876
|
+
/** Global placeholder text pattern for qualifier inputs */
|
|
2877
|
+
globalPlaceholder?: string | ((qualifierName: string) => string);
|
|
2878
|
+
/** Additional CSS classes for the context panel */
|
|
2879
|
+
contextPanelClassName?: string;
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
/**
|
|
2883
|
+
* Reusable control for configuring ResolutionView context options.
|
|
2884
|
+
*
|
|
2885
|
+
* Provides a clean interface for adjusting context behavior including:
|
|
2886
|
+
* - Visibility of context controls, current context display, and action buttons
|
|
2887
|
+
* - Per-qualifier options (visibility, editability, host values)
|
|
2888
|
+
* - Global defaults and appearance customization
|
|
2889
|
+
*
|
|
2890
|
+
* Can be rendered in multiple presentation modes:
|
|
2891
|
+
* - 'hidden': Not displayed (default for production)
|
|
2892
|
+
* - 'inline': Always expanded with full controls visible
|
|
2893
|
+
* - 'collapsible': Expandable/collapsible section
|
|
2894
|
+
* - 'popover': Small dropdown overlay
|
|
2895
|
+
* - 'popup': Full modal dialog
|
|
2896
|
+
*
|
|
2897
|
+
* @example
|
|
2898
|
+
* ```tsx
|
|
2899
|
+
* import { ResolutionContextOptionsControl } from '@fgv/ts-res-ui-components';
|
|
2900
|
+
*
|
|
2901
|
+
* function ContextConfiguration() {
|
|
2902
|
+
* const [contextOptions, setContextOptions] = useState<ResolutionContextOptions>({});
|
|
2903
|
+
*
|
|
2904
|
+
* return (
|
|
2905
|
+
* <ResolutionContextOptionsControl
|
|
2906
|
+
* options={contextOptions}
|
|
2907
|
+
* onOptionsChange={setContextOptions}
|
|
2908
|
+
* availableQualifiers={['language', 'platform', 'env']}
|
|
2909
|
+
* presentation="collapsible"
|
|
2910
|
+
* title="Context Configuration"
|
|
2911
|
+
* />
|
|
2912
|
+
* );
|
|
2913
|
+
* }
|
|
2914
|
+
* ```
|
|
2915
|
+
*
|
|
2916
|
+
* @public
|
|
2917
|
+
*/
|
|
2918
|
+
declare const ResolutionContextOptionsControl: React_2.FC<ResolutionContextOptionsControlProps>;
|
|
2919
|
+
|
|
2920
|
+
/**
|
|
2921
|
+
* Props for the ResolutionContextOptionsControl component.
|
|
2922
|
+
* @public
|
|
2923
|
+
*/
|
|
2924
|
+
declare interface ResolutionContextOptionsControlProps {
|
|
2925
|
+
/** Current context options */
|
|
2926
|
+
options: ResolutionContextOptions;
|
|
2927
|
+
/** Callback when options change */
|
|
2928
|
+
onOptionsChange: (options: ResolutionContextOptions) => void;
|
|
2929
|
+
/** Available qualifiers for configuration */
|
|
2930
|
+
availableQualifiers?: string[];
|
|
2931
|
+
/** How to present the options control (default: 'hidden' for production use) */
|
|
2932
|
+
presentation?: 'hidden' | 'inline' | 'collapsible' | 'popup' | 'popover';
|
|
2933
|
+
/** Custom class name */
|
|
2934
|
+
className?: string;
|
|
2935
|
+
/** Title for the control section */
|
|
2936
|
+
title?: string;
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2729
2939
|
/**
|
|
2730
2940
|
* Control panel for managing pending resource edits during resolution testing.
|
|
2731
2941
|
*
|
|
@@ -3122,6 +3332,7 @@ export declare namespace ResolutionTools {
|
|
|
3122
3332
|
EditableJsonView,
|
|
3123
3333
|
ResolutionEditControls,
|
|
3124
3334
|
QualifierContextControl,
|
|
3335
|
+
ResolutionContextOptionsControl,
|
|
3125
3336
|
useResolutionState,
|
|
3126
3337
|
createResolverWithContext,
|
|
3127
3338
|
evaluateConditionsForCandidate,
|
|
@@ -3136,7 +3347,10 @@ export declare namespace ResolutionTools {
|
|
|
3136
3347
|
CandidateInfo,
|
|
3137
3348
|
ConditionEvaluationResult,
|
|
3138
3349
|
EditedResourceInfo,
|
|
3139
|
-
|
|
3350
|
+
ResolutionContextOptions,
|
|
3351
|
+
QualifierControlOptions,
|
|
3352
|
+
EditableJsonViewProps,
|
|
3353
|
+
ResolutionContextOptionsControlProps
|
|
3140
3354
|
}
|
|
3141
3355
|
}
|
|
3142
3356
|
|
|
@@ -3214,6 +3428,17 @@ declare interface ResolutionViewProps extends ViewBaseProps {
|
|
|
3214
3428
|
resourceEditorFactory?: ResourceEditorFactory;
|
|
3215
3429
|
/** Optional configuration for the ResourcePicker behavior */
|
|
3216
3430
|
pickerOptions?: ResourcePickerOptions;
|
|
3431
|
+
/** Optional configuration for the resolution context controls */
|
|
3432
|
+
contextOptions?: ResolutionContextOptions;
|
|
3433
|
+
/** Lock to a single view state and suppress the view state selector */
|
|
3434
|
+
lockedViewMode?: 'composed' | 'best' | 'all' | 'raw';
|
|
3435
|
+
/** Custom titles for the main sections */
|
|
3436
|
+
sectionTitles?: {
|
|
3437
|
+
/** Title for the resources picker section (default: "Resources") */
|
|
3438
|
+
resources?: string;
|
|
3439
|
+
/** Title for the results section (default: "Results") */
|
|
3440
|
+
results?: string;
|
|
3441
|
+
};
|
|
3217
3442
|
}
|
|
3218
3443
|
|
|
3219
3444
|
/**
|
|
@@ -3679,6 +3904,10 @@ declare interface ResourceOrchestratorProps {
|
|
|
3679
3904
|
}) => ReactNode;
|
|
3680
3905
|
/** Optional initial configuration to apply on mount */
|
|
3681
3906
|
initialConfiguration?: Config.Model.ISystemConfiguration;
|
|
3907
|
+
/** Optional qualifier type factory for creating custom qualifier types */
|
|
3908
|
+
qualifierTypeFactory?: Config.IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierTypes.QualifierType>;
|
|
3909
|
+
/** Optional resource type factory for creating custom resource types */
|
|
3910
|
+
resourceTypeFactory?: Config.IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceTypes.ResourceType>;
|
|
3682
3911
|
/** Callback fired when orchestrator state changes */
|
|
3683
3912
|
onStateChange?: (state: Partial<OrchestratorState>) => void;
|
|
3684
3913
|
}
|
|
@@ -4637,7 +4866,20 @@ declare interface UseResolutionStateReturn {
|
|
|
4637
4866
|
*
|
|
4638
4867
|
* @public
|
|
4639
4868
|
*/
|
|
4640
|
-
declare function useResourceData(): UseResourceDataReturn;
|
|
4869
|
+
declare function useResourceData(params?: UseResourceDataParams): UseResourceDataReturn;
|
|
4870
|
+
|
|
4871
|
+
/**
|
|
4872
|
+
* Parameters for the useResourceData hook.
|
|
4873
|
+
* Allows customization of type factories for extended functionality.
|
|
4874
|
+
*
|
|
4875
|
+
* @public
|
|
4876
|
+
*/
|
|
4877
|
+
declare interface UseResourceDataParams {
|
|
4878
|
+
/** Optional qualifier type factory for creating custom qualifier types */
|
|
4879
|
+
qualifierTypeFactory?: Config.IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierTypes.QualifierType>;
|
|
4880
|
+
/** Optional resource type factory for creating custom resource types */
|
|
4881
|
+
resourceTypeFactory?: Config.IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceTypes.ResourceType>;
|
|
4882
|
+
}
|
|
4641
4883
|
|
|
4642
4884
|
/**
|
|
4643
4885
|
* Return type for the useResourceData hook.
|