@meshmakers/octo-ui 3.3.33 → 3.3.380

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 CHANGED
@@ -1,24 +1,172 @@
1
- # OctoUi
1
+ # @meshmakers/octo-ui
2
2
 
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.0.
3
+ Angular library providing reusable UI components for OctoMesh applications.
4
4
 
5
- ## Code scaffolding
5
+ ## Features
6
6
 
7
- Run `ng generate component component-name --project octo-ui` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project octo-ui`.
8
- > Note: Don't forget to add `--project octo-ui` or else it will be added to the default project in your `angular.json` file.
7
+ - **Data Sources** - GraphQL-based data source abstractions for list views and hierarchies
8
+ - **Property Grid** - Dynamic property editor with type-aware value display
9
+ - **Selector Dialogs** - Attribute and CK type selection dialogs
10
+ - **Filter Editor** - Visual query filter configuration
11
+ - **Theme Independent** - Works with any Kendo UI theme
9
12
 
10
- ## Build
13
+ ## Documentation
14
+
15
+ - [Developer Documentation](CLAUDE.md) - Complete API reference and usage examples
16
+
17
+ ## Quick Start
18
+
19
+ ### 1. Import Components
20
+
21
+ ```typescript
22
+ import {
23
+ PropertyGridComponent,
24
+ CkTypeSelectorInputComponent,
25
+ AttributeSelectorDialogService
26
+ } from '@meshmakers/octo-ui';
27
+
28
+ @Component({
29
+ imports: [PropertyGridComponent, CkTypeSelectorInputComponent],
30
+ // ...
31
+ })
32
+ export class MyComponent {}
33
+ ```
34
+
35
+ ### 2. Use Property Grid
36
+
37
+ ```typescript
38
+ import { PropertyGridComponent, PropertyGridItem, AttributeValueTypeDto } from '@meshmakers/octo-ui';
39
+
40
+ @Component({
41
+ template: `
42
+ <mm-property-grid
43
+ [properties]="properties"
44
+ [readOnlyMode]="false"
45
+ (propertyChange)="onPropertyChange($event)">
46
+ </mm-property-grid>
47
+ `
48
+ })
49
+ export class EntityDetailComponent {
50
+ properties: PropertyGridItem[] = [
51
+ {
52
+ id: 'name',
53
+ name: 'name',
54
+ displayName: 'Customer Name',
55
+ value: 'Acme Corp',
56
+ type: AttributeValueTypeDto.StringDto,
57
+ readOnly: false,
58
+ category: 'General'
59
+ }
60
+ ];
61
+
62
+ onPropertyChange(event: PropertyChangeEvent) {
63
+ console.log('Property changed:', event.propertyId, event.newValue);
64
+ }
65
+ }
66
+ ```
67
+
68
+ ### 3. Use CK Type Selector
69
+
70
+ ```typescript
71
+ import { CkTypeSelectorInputComponent, CkTypeSelectorItem } from '@meshmakers/octo-ui';
72
+
73
+ @Component({
74
+ template: `
75
+ <mm-ck-type-selector-input
76
+ [(ngModel)]="selectedType"
77
+ [ckModelIds]="['OctoSdkDemo']"
78
+ (ckTypeSelected)="onTypeSelected($event)">
79
+ </mm-ck-type-selector-input>
80
+ `
81
+ })
82
+ export class TypeSelectorComponent {
83
+ selectedType: CkTypeSelectorItem | null = null;
11
84
 
12
- Run `ng build octo-ui` to build the project. The build artifacts will be stored in the `dist/` directory.
85
+ onTypeSelected(type: CkTypeSelectorItem) {
86
+ // Use type.rtCkTypeId for runtime queries
87
+ console.log('Selected:', type.rtCkTypeId);
88
+ }
89
+ }
90
+ ```
13
91
 
14
- ## Publishing
92
+ ### 4. Use Data Source with List View
93
+
94
+ ```typescript
95
+ import { OctoGraphQlDataSource, FetchDataOptions, FetchResultTyped } from '@meshmakers/octo-ui';
96
+ import { DataSourceBase, ListViewComponent } from '@meshmakers/shared-ui';
97
+
98
+ @Directive({
99
+ selector: '[appCustomerDataSource]',
100
+ exportAs: 'appCustomerDataSource',
101
+ providers: [{ provide: DataSourceBase, useExisting: forwardRef(() => CustomerDataSourceDirective) }]
102
+ })
103
+ export class CustomerDataSourceDirective extends OctoGraphQlDataSource<CustomerDto> {
104
+ private readonly getCustomersGQL = inject(GetCustomersDtoGQL);
105
+
106
+ constructor() {
107
+ super(inject(ListViewComponent));
108
+ this.searchFilterAttributePaths = ['name', 'email'];
109
+ }
110
+
111
+ fetchData(options: FetchDataOptions): Observable<FetchResultTyped<CustomerDto>> {
112
+ return this.getCustomersGQL.fetch({
113
+ variables: {
114
+ first: options.state.take,
115
+ after: GraphQL.offsetToCursor(options.state.skip ?? 0),
116
+ sortOrder: this.getSortDefinitions(options.state),
117
+ fieldFilter: this.getFieldFilterDefinitions(options.state),
118
+ searchFilter: this.getSearchFilterDefinitions(options.textSearch)
119
+ },
120
+ fetchPolicy: 'network-only'
121
+ }).pipe(map(result => new FetchResultTyped<CustomerDto>(
122
+ result.data?.runtime?.customers?.items ?? [],
123
+ result.data?.runtime?.customers?.totalCount ?? 0
124
+ )));
125
+ }
126
+ }
127
+ ```
128
+
129
+ ## Available Components
130
+
131
+ | Component | Description |
132
+ |-----------|-------------|
133
+ | `PropertyGridComponent` | Dynamic property grid with type-aware editing |
134
+ | `PropertyValueDisplayComponent` | Read-only value display with type formatting |
135
+ | `CkTypeSelectorInputComponent` | Autocomplete input for CK type selection |
136
+ | `FieldFilterEditorComponent` | Visual filter editor for queries |
137
+
138
+ ## Available Services
139
+
140
+ | Service | Description |
141
+ |---------|-------------|
142
+ | `PropertyConverterService` | Convert entities to property grid items |
143
+ | `AttributeSelectorDialogService` | Open attribute selection dialog |
144
+ | `AttributeSortSelectorDialogService` | Open attribute selection with sort order |
145
+ | `CkTypeSelectorDialogService` | Open CK type selection dialog |
146
+
147
+ ## Data Source Classes
148
+
149
+ | Class | Description |
150
+ |-------|-------------|
151
+ | `OctoGraphQlDataSource` | Base class for GraphQL list data sources |
152
+ | `OctoGraphQlHierarchyDataSource` | Base class for tree/hierarchy data sources |
153
+ | `FetchResultTyped` | Typed result wrapper with items and totalCount |
154
+
155
+ ## Build
15
156
 
16
- After building your library with `ng build octo-ui`, go to the dist folder `cd dist/octo-ui` and run `npm publish`.
157
+ ```bash
158
+ # From frontend-libraries directory
159
+ npm run build:octo-ui
160
+ ```
17
161
 
18
- ## Running unit tests
162
+ ## Test
19
163
 
20
- Run `ng test octo-ui` to execute the unit tests via [Karma](https://karma-runner.github.io).
164
+ ```bash
165
+ npm test -- --project=@meshmakers/octo-ui --watch=false
166
+ ```
21
167
 
22
- ## Further help
168
+ ## Lint
23
169
 
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
170
+ ```bash
171
+ npm run lint:octo-ui
172
+ ```