@dialob/composer-material 0.0.14 → 0.0.15
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 +126 -41
- package/dist-lib/index.d.ts +10 -1
- package/dist-lib/index.js +12766 -12529
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,21 +103,34 @@ Starts preview server for built application from `/dist` (No hot-reload!). Run `
|
|
|
103
103
|
|
|
104
104
|
### Item type configuration
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
Item type configuration defines the structure of the "Add Item" menu and available item types with their properties and behavior.
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
**See full example:** [`src/defaults/itemTypes.ts`](src/defaults/itemTypes.ts)
|
|
109
|
+
|
|
110
|
+
**TypeScript types:** [`src/defaults/types.ts`](src/defaults/types.ts)
|
|
111
|
+
|
|
112
|
+
#### Menu Structure
|
|
113
|
+
|
|
114
|
+
The configuration supports **flexible menu nesting** with three options:
|
|
115
|
+
|
|
116
|
+
1. **Flat structure** - Direct items in a category
|
|
117
|
+
2. **Nested structure** - Items organized in subcategories
|
|
118
|
+
3. **Mixed mode** - Both direct items AND subcategories in the same category
|
|
119
|
+
|
|
120
|
+
#### Basic Example
|
|
109
121
|
|
|
110
122
|
```typescript
|
|
111
|
-
DEFAULT_ITEMTYPE_CONFIG: ItemTypeConfig = {
|
|
112
|
-
|
|
123
|
+
export const DEFAULT_ITEMTYPE_CONFIG: ItemTypeConfig = {
|
|
124
|
+
categories: [
|
|
113
125
|
{
|
|
114
126
|
title: 'Structure',
|
|
115
127
|
type: 'structure',
|
|
116
128
|
items: [
|
|
117
129
|
{
|
|
118
130
|
title: 'Group',
|
|
131
|
+
convertible: ['rowgroup'],
|
|
119
132
|
optionEditors: [
|
|
120
|
-
{name: 'Additional option', editor: PropEditors.InputProp}
|
|
133
|
+
{ name: 'Additional option', editor: PropEditors.InputProp }
|
|
121
134
|
],
|
|
122
135
|
propEditors: {
|
|
123
136
|
columns: {
|
|
@@ -135,56 +148,128 @@ Item type configuration corresponds to "Add new" item creation menu structure an
|
|
|
135
148
|
columns: 1
|
|
136
149
|
}
|
|
137
150
|
}
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### Nested Structure with Subcategories
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
{
|
|
162
|
+
title: 'Inputs',
|
|
163
|
+
type: 'input',
|
|
164
|
+
subcategories: [
|
|
165
|
+
{
|
|
166
|
+
title: 'Text fields',
|
|
167
|
+
items: [
|
|
168
|
+
{
|
|
169
|
+
title: 'Text',
|
|
170
|
+
convertible: ['textBox', 'address'],
|
|
171
|
+
config: {
|
|
172
|
+
type: 'text',
|
|
173
|
+
view: 'text'
|
|
174
|
+
}
|
|
138
175
|
},
|
|
139
176
|
{
|
|
140
|
-
title: '
|
|
141
|
-
convertible: ['
|
|
142
|
-
propEditors: {
|
|
143
|
-
display: {
|
|
144
|
-
component: PropEditors.ChoiceProp,
|
|
145
|
-
props: {
|
|
146
|
-
options: [
|
|
147
|
-
{key: 'dropdown', label: 'Dropdown'},
|
|
148
|
-
{key: 'button', label: 'Button'},
|
|
149
|
-
{key: 'checkbox', label: 'Checkbox'}
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
},
|
|
177
|
+
title: 'Text box',
|
|
178
|
+
convertible: ['text', 'address'],
|
|
154
179
|
config: {
|
|
155
|
-
type: '
|
|
156
|
-
|
|
157
|
-
display: 'dropdown',
|
|
158
|
-
}
|
|
180
|
+
type: 'text',
|
|
181
|
+
view: 'textBox'
|
|
159
182
|
}
|
|
160
183
|
}
|
|
161
184
|
]
|
|
162
185
|
},
|
|
163
|
-
|
|
186
|
+
{
|
|
187
|
+
title: 'Numbers',
|
|
188
|
+
items: [
|
|
189
|
+
{
|
|
190
|
+
title: 'Decimal',
|
|
191
|
+
config: { type: 'decimal' }
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
title: 'Integer',
|
|
195
|
+
config: { type: 'number' }
|
|
196
|
+
}
|
|
164
197
|
]
|
|
165
|
-
}
|
|
166
|
-
// ....
|
|
198
|
+
}
|
|
167
199
|
]
|
|
168
|
-
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
This creates a menu hierarchy:
|
|
204
|
+
```
|
|
205
|
+
Inputs →
|
|
206
|
+
├─ Text fields →
|
|
207
|
+
│ ├─ Text
|
|
208
|
+
│ └─ Text box
|
|
209
|
+
└─ Numbers →
|
|
210
|
+
├─ Decimal
|
|
211
|
+
└─ Integer
|
|
169
212
|
```
|
|
170
213
|
|
|
171
|
-
|
|
214
|
+
#### Mixed Mode (Direct Items + Subcategories)
|
|
215
|
+
|
|
216
|
+
You can combine both approaches in the same category:
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
{
|
|
220
|
+
title: 'Inputs',
|
|
221
|
+
type: 'input',
|
|
222
|
+
items: [
|
|
223
|
+
// Direct items (no submenu)
|
|
224
|
+
{ title: 'Boolean', config: { type: 'boolean' } },
|
|
225
|
+
{ title: 'Date', config: { type: 'date' } }
|
|
226
|
+
],
|
|
227
|
+
subcategories: [
|
|
228
|
+
// Nested items (with submenu)
|
|
229
|
+
{
|
|
230
|
+
title: 'Text fields',
|
|
231
|
+
items: [
|
|
232
|
+
{ title: 'Text', config: { type: 'text', view: 'text' } },
|
|
233
|
+
{ title: 'Text box', config: { type: 'text', view: 'textBox' } }
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Renders as:
|
|
241
|
+
```
|
|
242
|
+
Inputs →
|
|
243
|
+
├─ Boolean (clickable)
|
|
244
|
+
├─ Date (clickable)
|
|
245
|
+
├─── (separator) ───
|
|
246
|
+
└─ Text fields →
|
|
247
|
+
├─ Text
|
|
248
|
+
└─ Text box
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### Configuration Reference
|
|
252
|
+
|
|
253
|
+
**Category attributes:**
|
|
254
|
+
* **`title`** - Label displayed in the menu
|
|
255
|
+
* **`type`** - Category type: `'structure'`, `'input'`, or `'output'`. Used to filter which items can be added in different contexts
|
|
256
|
+
* **`items`** - (Optional) Array of item configurations for direct menu items
|
|
257
|
+
* **`subcategories`** - (Optional) Array of subcategory objects for nested menu structure
|
|
258
|
+
|
|
259
|
+
**Subcategory attributes:**
|
|
260
|
+
* **`title`** - Label displayed in the submenu
|
|
261
|
+
* **`items`** - Array of item configurations
|
|
172
262
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
* `optionEditors` (Optional) Array of additional pages for item options dialog. Array of objects: `{name: 'Title of page', editor: OptionEditorComponent}` (see below)
|
|
180
|
-
* `propEditors` (Optional) if custom property editors are configured for item. If prop editor is not defined, it will be fallen back to plain text. Editor configuration is set of objects having prop name as a key:
|
|
181
|
-
* `component` : React component to use for editing the prop
|
|
182
|
-
* `props` : (Optional) Additional properties for the editing component. (see below)
|
|
183
|
-
* `config` : Snippet of Dialob form item configuration (See Dialob Form API). Any predefined structure is supported. only mandatory attribute is `type`. Item's default ID will be based on `view` attribute falling back to `type`
|
|
263
|
+
**Item attributes:**
|
|
264
|
+
* **`title`** - Label displayed in the menu
|
|
265
|
+
* **`convertible`** - (Optional) Array of type identifiers this item can be converted to. Matched by `view` first, then `type`. If omitted, item cannot be converted
|
|
266
|
+
* **`optionEditors`** - (Optional) Additional option pages for the item dialog: `{name: 'Title', editor: Component}`
|
|
267
|
+
* **`propEditors`** - (Optional) Custom property editors (see below). If not defined, falls back to plain text input
|
|
268
|
+
* **`config`** - Dialob form item configuration snippet. Required field: `type`. The item's default ID is based on `view` (if present) or `type`
|
|
184
269
|
|
|
185
|
-
**Note
|
|
270
|
+
**Note:** `props` in the config are item-specific properties available at form filling time, not to be confused with React component props.
|
|
186
271
|
|
|
187
|
-
#### Prop
|
|
272
|
+
#### Prop Editor Configurations
|
|
188
273
|
|
|
189
274
|
Built in editors:
|
|
190
275
|
|
package/dist-lib/index.d.ts
CHANGED
|
@@ -227,6 +227,7 @@ declare namespace DefaultTypes {
|
|
|
227
227
|
ConfigItemProps,
|
|
228
228
|
ItemTypeConfig,
|
|
229
229
|
ItemTypeCategory,
|
|
230
|
+
Subcategory,
|
|
230
231
|
CategoryItem,
|
|
231
232
|
OptionEditor,
|
|
232
233
|
PropEditorsType
|
|
@@ -353,6 +354,7 @@ declare interface FlattenedItem extends TreeItem {
|
|
|
353
354
|
parentId: UniqueIdentifier | null;
|
|
354
355
|
depth: number;
|
|
355
356
|
index: number;
|
|
357
|
+
isFallbackLabel?: boolean;
|
|
356
358
|
}
|
|
357
359
|
|
|
358
360
|
declare type FormMetadata = {
|
|
@@ -438,7 +440,8 @@ declare interface ItemProp {
|
|
|
438
440
|
declare interface ItemTypeCategory {
|
|
439
441
|
title: string;
|
|
440
442
|
type: DialobCategoryType;
|
|
441
|
-
items
|
|
443
|
+
items?: CategoryItem[];
|
|
444
|
+
subcategories?: Subcategory[];
|
|
442
445
|
}
|
|
443
446
|
|
|
444
447
|
declare interface ItemTypeConfig {
|
|
@@ -563,6 +566,11 @@ export declare const SimpleField: default_2.FC<{
|
|
|
563
566
|
|
|
564
567
|
export { StyledTable }
|
|
565
568
|
|
|
569
|
+
declare interface Subcategory {
|
|
570
|
+
title: string;
|
|
571
|
+
items: CategoryItem[];
|
|
572
|
+
}
|
|
573
|
+
|
|
566
574
|
export declare const TranslationDialog: default_2.FC<{
|
|
567
575
|
open: boolean;
|
|
568
576
|
onClose: () => void;
|
|
@@ -587,6 +595,7 @@ declare interface TreeItem {
|
|
|
587
595
|
title: string;
|
|
588
596
|
collapsible?: boolean;
|
|
589
597
|
collapsed?: boolean;
|
|
598
|
+
isFallbackLabel?: boolean;
|
|
590
599
|
}
|
|
591
600
|
|
|
592
601
|
export declare const UploadValuesetDialog: default_2.FC<{
|