@zentto/studio 0.6.0 → 0.6.2

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.
@@ -43,105 +43,105 @@ let ZenttoStudioRenderer = class ZenttoStudioRenderer extends LitElement {
43
43
  this.activeSection = 0;
44
44
  this.renderCounter = 0; // force re-renders
45
45
  }
46
- static { this.styles = [studioTokens, fieldBaseStyles, css `
47
- :host {
48
- display: block;
49
- font-family: var(--zs-font-family);
50
- color: var(--zs-text);
51
- }
52
- .zs-renderer { background: var(--zs-bg); border-radius: var(--zs-radius-lg); }
53
- .zs-header {
54
- padding: var(--zs-spacing-md);
55
- border-bottom: 1px solid var(--zs-border);
56
- }
57
- .zs-title {
58
- margin: 0; font-size: var(--zs-font-size-xl); font-weight: 600;
59
- color: var(--zs-text);
60
- }
61
- .zs-description {
62
- margin: 4px 0 0; font-size: var(--zs-font-size); color: var(--zs-text-secondary);
63
- }
64
- .zs-body { padding: var(--zs-spacing-md); }
65
- .zs-section {
66
- margin-bottom: var(--zs-spacing-lg);
67
- }
68
- .zs-section-title {
69
- font-size: var(--zs-font-size-lg); font-weight: 600;
70
- margin: 0 0 var(--zs-spacing-sm) 0; color: var(--zs-text);
71
- padding-bottom: var(--zs-spacing-xs);
72
- border-bottom: 2px solid var(--zs-primary-light);
73
- }
74
- .zs-section-description {
75
- font-size: var(--zs-font-size-sm); color: var(--zs-text-secondary);
76
- margin: 0 0 var(--zs-spacing-sm) 0;
77
- }
78
- .zs-section-grid {
79
- display: grid;
80
- gap: var(--zs-spacing-md);
81
- }
82
- .zs-actions {
83
- display: flex; gap: var(--zs-spacing-sm);
84
- padding: var(--zs-spacing-md);
85
- border-top: 1px solid var(--zs-border);
86
- justify-content: flex-end;
87
- }
88
- .zs-btn {
89
- padding: 8px 20px; border-radius: var(--zs-radius);
90
- font-family: var(--zs-font-family); font-size: var(--zs-font-size);
91
- font-weight: 500; cursor: pointer; border: 1px solid transparent;
92
- transition: all var(--zs-transition);
93
- }
94
- .zs-btn--primary {
95
- background: var(--zs-primary); color: white; border-color: var(--zs-primary);
96
- }
97
- .zs-btn--primary:hover { background: var(--zs-primary-hover); }
98
- .zs-btn--secondary {
99
- background: var(--zs-bg); color: var(--zs-text); border-color: var(--zs-border);
100
- }
101
- .zs-btn--secondary:hover { background: var(--zs-bg-hover); }
102
- .zs-btn--danger {
103
- background: var(--zs-danger); color: white; border-color: var(--zs-danger);
104
- }
105
- .zs-btn--ghost {
106
- background: transparent; color: var(--zs-text-secondary); border-color: transparent;
107
- }
108
- .zs-btn--ghost:hover { color: var(--zs-text); background: var(--zs-bg-hover); }
109
- .zs-btn:disabled { opacity: 0.5; cursor: not-allowed; }
110
- .zs-field-hidden { display: none; }
111
-
112
- /* Tabs */
113
- .zs-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--zs-border); margin-bottom: var(--zs-spacing-md); }
114
- .zs-tab {
115
- padding: 8px 16px; cursor: pointer; border: none; background: none;
116
- font-family: var(--zs-font-family); font-size: var(--zs-font-size);
117
- color: var(--zs-text-secondary); border-bottom: 2px solid transparent;
118
- margin-bottom: -2px; transition: all var(--zs-transition);
119
- }
120
- .zs-tab:hover { color: var(--zs-text); }
121
- .zs-tab--active { color: var(--zs-primary); border-bottom-color: var(--zs-primary); font-weight: 500; }
122
-
123
- /* Wizard */
124
- .zs-wizard-steps {
125
- display: flex; align-items: center; gap: 8px;
126
- margin-bottom: var(--zs-spacing-lg); padding: 0 var(--zs-spacing-md);
127
- }
128
- .zs-wizard-step {
129
- display: flex; align-items: center; gap: 8px;
130
- }
131
- .zs-wizard-circle {
132
- width: 32px; height: 32px; border-radius: 50%;
133
- display: flex; align-items: center; justify-content: center;
134
- font-size: var(--zs-font-size-sm); font-weight: 600;
135
- background: var(--zs-bg-secondary); color: var(--zs-text-secondary);
136
- border: 2px solid var(--zs-border);
137
- }
138
- .zs-wizard-circle--active { background: var(--zs-primary); color: white; border-color: var(--zs-primary); }
139
- .zs-wizard-circle--done { background: var(--zs-success); color: white; border-color: var(--zs-success); }
140
- .zs-wizard-label { font-size: var(--zs-font-size-sm); color: var(--zs-text-secondary); }
141
- .zs-wizard-label--active { color: var(--zs-text); font-weight: 500; }
142
- .zs-wizard-line { flex: 1; height: 2px; background: var(--zs-border); }
143
- .zs-wizard-line--done { background: var(--zs-success); }
144
- .zs-wizard-nav { display: flex; justify-content: space-between; padding: var(--zs-spacing-md); }
46
+ static { this.styles = [studioTokens, fieldBaseStyles, css `
47
+ :host {
48
+ display: block;
49
+ font-family: var(--zs-font-family);
50
+ color: var(--zs-text);
51
+ }
52
+ .zs-renderer { background: var(--zs-bg); border-radius: var(--zs-radius-lg); }
53
+ .zs-header {
54
+ padding: var(--zs-spacing-md);
55
+ border-bottom: 1px solid var(--zs-border);
56
+ }
57
+ .zs-title {
58
+ margin: 0; font-size: var(--zs-font-size-xl); font-weight: 600;
59
+ color: var(--zs-text);
60
+ }
61
+ .zs-description {
62
+ margin: 4px 0 0; font-size: var(--zs-font-size); color: var(--zs-text-secondary);
63
+ }
64
+ .zs-body { padding: var(--zs-spacing-md); }
65
+ .zs-section {
66
+ margin-bottom: var(--zs-spacing-lg);
67
+ }
68
+ .zs-section-title {
69
+ font-size: var(--zs-font-size-lg); font-weight: 600;
70
+ margin: 0 0 var(--zs-spacing-sm) 0; color: var(--zs-text);
71
+ padding-bottom: var(--zs-spacing-xs);
72
+ border-bottom: 2px solid var(--zs-primary-light);
73
+ }
74
+ .zs-section-description {
75
+ font-size: var(--zs-font-size-sm); color: var(--zs-text-secondary);
76
+ margin: 0 0 var(--zs-spacing-sm) 0;
77
+ }
78
+ .zs-section-grid {
79
+ display: grid;
80
+ gap: var(--zs-spacing-md);
81
+ }
82
+ .zs-actions {
83
+ display: flex; gap: var(--zs-spacing-sm);
84
+ padding: var(--zs-spacing-md);
85
+ border-top: 1px solid var(--zs-border);
86
+ justify-content: flex-end;
87
+ }
88
+ .zs-btn {
89
+ padding: 8px 20px; border-radius: var(--zs-radius);
90
+ font-family: var(--zs-font-family); font-size: var(--zs-font-size);
91
+ font-weight: 500; cursor: pointer; border: 1px solid transparent;
92
+ transition: all var(--zs-transition);
93
+ }
94
+ .zs-btn--primary {
95
+ background: var(--zs-primary); color: white; border-color: var(--zs-primary);
96
+ }
97
+ .zs-btn--primary:hover { background: var(--zs-primary-hover); }
98
+ .zs-btn--secondary {
99
+ background: var(--zs-bg); color: var(--zs-text); border-color: var(--zs-border);
100
+ }
101
+ .zs-btn--secondary:hover { background: var(--zs-bg-hover); }
102
+ .zs-btn--danger {
103
+ background: var(--zs-danger); color: white; border-color: var(--zs-danger);
104
+ }
105
+ .zs-btn--ghost {
106
+ background: transparent; color: var(--zs-text-secondary); border-color: transparent;
107
+ }
108
+ .zs-btn--ghost:hover { color: var(--zs-text); background: var(--zs-bg-hover); }
109
+ .zs-btn:disabled { opacity: 0.5; cursor: not-allowed; }
110
+ .zs-field-hidden { display: none; }
111
+
112
+ /* Tabs */
113
+ .zs-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--zs-border); margin-bottom: var(--zs-spacing-md); }
114
+ .zs-tab {
115
+ padding: 8px 16px; cursor: pointer; border: none; background: none;
116
+ font-family: var(--zs-font-family); font-size: var(--zs-font-size);
117
+ color: var(--zs-text-secondary); border-bottom: 2px solid transparent;
118
+ margin-bottom: -2px; transition: all var(--zs-transition);
119
+ }
120
+ .zs-tab:hover { color: var(--zs-text); }
121
+ .zs-tab--active { color: var(--zs-primary); border-bottom-color: var(--zs-primary); font-weight: 500; }
122
+
123
+ /* Wizard */
124
+ .zs-wizard-steps {
125
+ display: flex; align-items: center; gap: 8px;
126
+ margin-bottom: var(--zs-spacing-lg); padding: 0 var(--zs-spacing-md);
127
+ }
128
+ .zs-wizard-step {
129
+ display: flex; align-items: center; gap: 8px;
130
+ }
131
+ .zs-wizard-circle {
132
+ width: 32px; height: 32px; border-radius: 50%;
133
+ display: flex; align-items: center; justify-content: center;
134
+ font-size: var(--zs-font-size-sm); font-weight: 600;
135
+ background: var(--zs-bg-secondary); color: var(--zs-text-secondary);
136
+ border: 2px solid var(--zs-border);
137
+ }
138
+ .zs-wizard-circle--active { background: var(--zs-primary); color: white; border-color: var(--zs-primary); }
139
+ .zs-wizard-circle--done { background: var(--zs-success); color: white; border-color: var(--zs-success); }
140
+ .zs-wizard-label { font-size: var(--zs-font-size-sm); color: var(--zs-text-secondary); }
141
+ .zs-wizard-label--active { color: var(--zs-text); font-weight: 500; }
142
+ .zs-wizard-line { flex: 1; height: 2px; background: var(--zs-border); }
143
+ .zs-wizard-line--done { background: var(--zs-success); }
144
+ .zs-wizard-nav { display: flex; justify-content: space-between; padding: var(--zs-spacing-md); }
145
145
  `]; }
146
146
  // ─── Lifecycle ───────────────────────────────────────────────
147
147
  connectedCallback() {
@@ -275,48 +275,48 @@ let ZenttoStudioRenderer = class ZenttoStudioRenderer extends LitElement {
275
275
  return html `<div class="zs-renderer" style="padding:24px;color:var(--zs-text-muted)">No schema loaded</div>`;
276
276
  }
277
277
  const layoutType = this.schema.layout.type;
278
- return html `
279
- <div class="zs-renderer">
280
- ${this.schema.title ? html `
281
- <div class="zs-header">
282
- <h2 class="zs-title">${this.schema.title}</h2>
283
- ${this.schema.description ? html `<p class="zs-description">${this.schema.description}</p>` : ''}
284
- </div>
285
- ` : ''}
286
-
278
+ return html `
279
+ <div class="zs-renderer">
280
+ ${this.schema.title ? html `
281
+ <div class="zs-header">
282
+ <h2 class="zs-title">${this.schema.title}</h2>
283
+ ${this.schema.description ? html `<p class="zs-description">${this.schema.description}</p>` : ''}
284
+ </div>
285
+ ` : ''}
286
+
287
287
  ${layoutType === 'tabs' ? this.renderTabs() :
288
288
  layoutType === 'wizard' ? this.renderWizard() :
289
- this.renderSections()}
290
-
291
- ${this.renderActions('bottom')}
292
- </div>
289
+ this.renderSections()}
290
+
291
+ ${this.renderActions('bottom')}
292
+ </div>
293
293
  `;
294
294
  }
295
295
  renderSections() {
296
296
  if (!this.schema || !this.model)
297
297
  return nothing;
298
- return html `
299
- <div class="zs-body">
300
- ${this.schema.sections.map(section => this.renderSection(section))}
301
- </div>
298
+ return html `
299
+ <div class="zs-body">
300
+ ${this.schema.sections.map(section => this.renderSection(section))}
301
+ </div>
302
302
  `;
303
303
  }
304
304
  renderTabs() {
305
305
  if (!this.schema || !this.model)
306
306
  return nothing;
307
307
  const sections = this.schema.sections;
308
- return html `
309
- <div class="zs-tabs">
310
- ${sections.map((s, i) => html `
311
- <button
312
- class="zs-tab ${i === this.activeSection ? 'zs-tab--active' : ''}"
313
- @click="${() => { this.activeSection = i; }}"
314
- >${s.title ?? `Tab ${i + 1}`}</button>
315
- `)}
316
- </div>
317
- <div class="zs-body">
318
- ${this.renderSection(sections[this.activeSection])}
319
- </div>
308
+ return html `
309
+ <div class="zs-tabs">
310
+ ${sections.map((s, i) => html `
311
+ <button
312
+ class="zs-tab ${i === this.activeSection ? 'zs-tab--active' : ''}"
313
+ @click="${() => { this.activeSection = i; }}"
314
+ >${s.title ?? `Tab ${i + 1}`}</button>
315
+ `)}
316
+ </div>
317
+ <div class="zs-body">
318
+ ${this.renderSection(sections[this.activeSection])}
319
+ </div>
320
320
  `;
321
321
  }
322
322
  renderWizard() {
@@ -324,31 +324,31 @@ let ZenttoStudioRenderer = class ZenttoStudioRenderer extends LitElement {
324
324
  return nothing;
325
325
  const sections = this.schema.sections;
326
326
  const total = sections.length;
327
- return html `
328
- <div class="zs-wizard-steps">
329
- ${sections.map((s, i) => html `
330
- ${i > 0 ? html `<div class="zs-wizard-line ${i <= this.activeSection ? 'zs-wizard-line--done' : ''}"></div>` : ''}
331
- <div class="zs-wizard-step">
332
- <div class="zs-wizard-circle ${i === this.activeSection ? 'zs-wizard-circle--active' : i < this.activeSection ? 'zs-wizard-circle--done' : ''}">
333
- ${i < this.activeSection ? '✓' : i + 1}
334
- </div>
335
- <span class="zs-wizard-label ${i === this.activeSection ? 'zs-wizard-label--active' : ''}">${s.title ?? `Paso ${i + 1}`}</span>
336
- </div>
337
- `)}
338
- </div>
339
- <div class="zs-body">
340
- ${this.renderSection(sections[this.activeSection])}
341
- </div>
342
- <div class="zs-wizard-nav">
343
- <button
344
- class="zs-btn zs-btn--secondary"
345
- ?disabled="${this.activeSection === 0}"
346
- @click="${() => { this.activeSection = Math.max(0, this.activeSection - 1); }}"
347
- >Anterior</button>
327
+ return html `
328
+ <div class="zs-wizard-steps">
329
+ ${sections.map((s, i) => html `
330
+ ${i > 0 ? html `<div class="zs-wizard-line ${i <= this.activeSection ? 'zs-wizard-line--done' : ''}"></div>` : ''}
331
+ <div class="zs-wizard-step">
332
+ <div class="zs-wizard-circle ${i === this.activeSection ? 'zs-wizard-circle--active' : i < this.activeSection ? 'zs-wizard-circle--done' : ''}">
333
+ ${i < this.activeSection ? '✓' : i + 1}
334
+ </div>
335
+ <span class="zs-wizard-label ${i === this.activeSection ? 'zs-wizard-label--active' : ''}">${s.title ?? `Paso ${i + 1}`}</span>
336
+ </div>
337
+ `)}
338
+ </div>
339
+ <div class="zs-body">
340
+ ${this.renderSection(sections[this.activeSection])}
341
+ </div>
342
+ <div class="zs-wizard-nav">
343
+ <button
344
+ class="zs-btn zs-btn--secondary"
345
+ ?disabled="${this.activeSection === 0}"
346
+ @click="${() => { this.activeSection = Math.max(0, this.activeSection - 1); }}"
347
+ >Anterior</button>
348
348
  ${this.activeSection < total - 1
349
349
  ? html `<button class="zs-btn zs-btn--primary" @click="${() => { this.activeSection = Math.min(total - 1, this.activeSection + 1); }}">Siguiente</button>`
350
- : html `<button class="zs-btn zs-btn--primary" @click="${() => this.handleAction('__wizard_finish__')}">Finalizar</button>`}
351
- </div>
350
+ : html `<button class="zs-btn zs-btn--primary" @click="${() => this.handleAction('__wizard_finish__')}">Finalizar</button>`}
351
+ </div>
352
352
  `;
353
353
  }
354
354
  renderSection(section) {
@@ -363,14 +363,14 @@ let ZenttoStudioRenderer = class ZenttoStudioRenderer extends LitElement {
363
363
  }
364
364
  const columns = section.columns ?? this.schema?.layout.columns ?? 1;
365
365
  const gap = this.schema?.layout.gap ?? 16;
366
- return html `
367
- <div class="zs-section">
368
- ${section.title ? html `<h3 class="zs-section-title">${section.title}</h3>` : ''}
369
- ${section.description ? html `<p class="zs-section-description">${section.description}</p>` : ''}
370
- <div class="zs-section-grid" style="grid-template-columns: repeat(${columns}, 1fr); gap: ${gap}px;">
371
- ${section.fields.map(field => this.renderField(field))}
372
- </div>
373
- </div>
366
+ return html `
367
+ <div class="zs-section">
368
+ ${section.title ? html `<h3 class="zs-section-title">${section.title}</h3>` : ''}
369
+ ${section.description ? html `<p class="zs-section-description">${section.description}</p>` : ''}
370
+ <div class="zs-section-grid" style="grid-template-columns: repeat(${columns}, 1fr); gap: ${gap}px;">
371
+ ${section.fields.map(field => this.renderField(field))}
372
+ </div>
373
+ </div>
374
374
  `;
375
375
  }
376
376
  renderField(field) {
@@ -405,10 +405,10 @@ let ZenttoStudioRenderer = class ZenttoStudioRenderer extends LitElement {
405
405
  const gridStyle = fullWidth ? 'grid-column: 1 / -1' : colSpan > 1 ? `grid-column: span ${colSpan}` : '';
406
406
  // Render based on tag name
407
407
  const tag = getFieldTag(field.type);
408
- return html `
409
- <div style="${gridStyle}" @field-change="${this.handleFieldChange}">
410
- ${this.renderFieldByTag(tag, field, value, errors, disabled, readOnly, required, mergedProps)}
411
- </div>
408
+ return html `
409
+ <div style="${gridStyle}" @field-change="${this.handleFieldChange}">
410
+ ${this.renderFieldByTag(tag, field, value, errors, disabled, readOnly, required, mergedProps)}
411
+ </div>
412
412
  `;
413
413
  }
414
414
  renderFieldByTag(tag, field, value, errors, disabled, readOnly, required, props) {
@@ -421,178 +421,181 @@ let ZenttoStudioRenderer = class ZenttoStudioRenderer extends LitElement {
421
421
  };
422
422
  switch (tag) {
423
423
  case 'zs-field-text':
424
- return html `<zs-field-text
425
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
426
- .value="${value != null ? String(value) : ''}"
427
- .placeholder="${baseAttrs.placeholder}" .helpText="${baseAttrs.helpText}"
428
- .inputType="${props.inputType ?? 'text'}"
429
- .multiline="${field.type === 'textarea'}"
430
- .errors="${baseAttrs.errors}"
431
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}" ?readOnly="${baseAttrs.readOnly}"
424
+ return html `<zs-field-text
425
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
426
+ .value="${value != null ? String(value) : ''}"
427
+ .placeholder="${baseAttrs.placeholder}" .helpText="${baseAttrs.helpText}"
428
+ .inputType="${props.inputType ?? 'text'}"
429
+ .multiline="${field.type === 'textarea'}"
430
+ .errors="${baseAttrs.errors}"
431
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}" ?readOnly="${baseAttrs.readOnly}"
432
432
  ></zs-field-text>`;
433
433
  case 'zs-field-number':
434
- return html `<zs-field-number
435
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
436
- .value="${value != null ? Number(value) : null}"
437
- .placeholder="${baseAttrs.placeholder}" .helpText="${baseAttrs.helpText}"
438
- .isCurrency="${!!props.isCurrency}" .isPercentage="${!!props.isPercentage}"
439
- .currencySymbol="${props.currencySymbol ?? '$'}"
440
- .mode="${props.mode ?? 'input'}"
441
- .min="${props.min ?? 0}" .max="${props.max ?? 100}"
442
- .step="${props.step ?? 1}"
443
- .maxRating="${props.maxRating ?? 5}"
444
- .errors="${baseAttrs.errors}"
445
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}" ?readOnly="${baseAttrs.readOnly}"
434
+ return html `<zs-field-number
435
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
436
+ .value="${value != null ? Number(value) : null}"
437
+ .placeholder="${baseAttrs.placeholder}" .helpText="${baseAttrs.helpText}"
438
+ .isCurrency="${!!props.isCurrency}" .isPercentage="${!!props.isPercentage}"
439
+ .currencySymbol="${props.currencySymbol ?? '$'}"
440
+ .mode="${props.mode ?? 'input'}"
441
+ .min="${props.min ?? 0}" .max="${props.max ?? 100}"
442
+ .step="${props.step ?? 1}"
443
+ .maxRating="${props.maxRating ?? 5}"
444
+ .errors="${baseAttrs.errors}"
445
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}" ?readOnly="${baseAttrs.readOnly}"
446
446
  ></zs-field-number>`;
447
447
  case 'zs-field-select':
448
- return html `<zs-field-select
449
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
450
- .value="${value ?? ''}"
451
- .placeholder="${baseAttrs.placeholder}" .helpText="${baseAttrs.helpText}"
452
- .options="${props.options ?? []}"
453
- .multiple="${!!props.multiple}"
454
- .mode="${props.mode ?? 'select'}"
455
- .errors="${baseAttrs.errors}"
456
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
448
+ return html `<zs-field-select
449
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
450
+ .value="${value ?? ''}"
451
+ .placeholder="${baseAttrs.placeholder}" .helpText="${baseAttrs.helpText}"
452
+ .options="${props.options ?? []}"
453
+ .multiple="${!!props.multiple}"
454
+ .mode="${props.mode ?? 'select'}"
455
+ .errors="${baseAttrs.errors}"
456
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
457
457
  ></zs-field-select>`;
458
458
  case 'zs-field-date':
459
- return html `<zs-field-date
460
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
461
- .value="${value != null ? String(value) : ''}"
462
- .helpText="${baseAttrs.helpText}"
463
- .mode="${props.mode ?? 'date'}"
464
- .min="${props.min ?? ''}" .max="${props.max ?? ''}"
465
- .errors="${baseAttrs.errors}"
466
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}" ?readOnly="${baseAttrs.readOnly}"
459
+ return html `<zs-field-date
460
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
461
+ .value="${value != null ? String(value) : ''}"
462
+ .helpText="${baseAttrs.helpText}"
463
+ .mode="${props.mode ?? 'date'}"
464
+ .min="${props.min ?? ''}" .max="${props.max ?? ''}"
465
+ .errors="${baseAttrs.errors}"
466
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}" ?readOnly="${baseAttrs.readOnly}"
467
467
  ></zs-field-date>`;
468
468
  case 'zs-field-checkbox':
469
- return html `<zs-field-checkbox
470
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
471
- .value="${value ?? false}"
472
- .helpText="${baseAttrs.helpText}"
473
- .mode="${props.mode ?? 'checkbox'}"
474
- .options="${props.options ?? []}"
475
- .horizontal="${!!props.horizontal}"
476
- .errors="${baseAttrs.errors}"
477
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
469
+ return html `<zs-field-checkbox
470
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
471
+ .value="${value ?? false}"
472
+ .helpText="${baseAttrs.helpText}"
473
+ .mode="${props.mode ?? 'checkbox'}"
474
+ .options="${props.options ?? []}"
475
+ .horizontal="${!!props.horizontal}"
476
+ .errors="${baseAttrs.errors}"
477
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
478
478
  ></zs-field-checkbox>`;
479
479
  case 'zs-field-switch':
480
- return html `<zs-field-switch
481
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
482
- .value="${!!value}"
483
- .helpText="${baseAttrs.helpText}"
484
- .errors="${baseAttrs.errors}"
485
- ?disabled="${baseAttrs.disabled}"
480
+ return html `<zs-field-switch
481
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
482
+ .value="${!!value}"
483
+ .helpText="${baseAttrs.helpText}"
484
+ .errors="${baseAttrs.errors}"
485
+ ?disabled="${baseAttrs.disabled}"
486
486
  ></zs-field-switch>`;
487
487
  case 'zs-field-file':
488
- return html `<zs-field-file
489
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
490
- .helpText="${baseAttrs.helpText}"
491
- .accept="${props.accept ?? ''}"
492
- .multiple="${!!props.multiple}"
493
- .errors="${baseAttrs.errors}"
494
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
488
+ return html `<zs-field-file
489
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
490
+ .helpText="${baseAttrs.helpText}"
491
+ .accept="${props.accept ?? ''}"
492
+ .multiple="${!!props.multiple}"
493
+ .errors="${baseAttrs.errors}"
494
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
495
495
  ></zs-field-file>`;
496
496
  case 'zs-field-lookup':
497
- return html `<zs-field-lookup
498
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
499
- .value="${value ?? ''}" .displayValue="${props.displayValue ?? ''}"
500
- .placeholder="${baseAttrs.placeholder}" .helpText="${baseAttrs.helpText}"
501
- .options="${props.lookupOptions ?? []}"
502
- .minChars="${props.minChars ?? 2}"
503
- .debounceMs="${props.debounceMs ?? 300}"
504
- .errors="${baseAttrs.errors}"
505
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
497
+ return html `<zs-field-lookup
498
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
499
+ .value="${value ?? ''}" .displayValue="${props.displayValue ?? ''}"
500
+ .placeholder="${baseAttrs.placeholder}" .helpText="${baseAttrs.helpText}"
501
+ .options="${props.lookupOptions ?? []}"
502
+ .minChars="${props.minChars ?? 2}"
503
+ .debounceMs="${props.debounceMs ?? 300}"
504
+ .errors="${baseAttrs.errors}"
505
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
506
506
  ></zs-field-lookup>`;
507
507
  case 'zs-field-separator':
508
- return html `<zs-field-separator
509
- .variant="${props.variant ?? 'thin'}"
508
+ return html `<zs-field-separator
509
+ .variant="${props.variant ?? 'thin'}"
510
510
  ></zs-field-separator>`;
511
511
  case 'zs-field-heading':
512
- return html `<zs-field-heading
513
- .label="${baseAttrs.label}" .helpText="${baseAttrs.helpText}"
514
- .level="${props.level ?? 'h2'}"
512
+ return html `<zs-field-heading
513
+ .label="${baseAttrs.label}" .helpText="${baseAttrs.helpText}"
514
+ .level="${props.level ?? 'h2'}"
515
515
  ></zs-field-heading>`;
516
516
  case 'zs-field-html':
517
- return html `<zs-field-html
518
- .content="${props.content ?? String(value ?? '')}"
517
+ return html `<zs-field-html
518
+ .content="${props.content ?? String(value ?? '')}"
519
519
  ></zs-field-html>`;
520
520
  case 'zs-field-signature':
521
- return html `<zs-field-signature
522
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
523
- .value="${value != null ? String(value) : ''}"
524
- .helpText="${baseAttrs.helpText}"
525
- .penWidth="${props.penWidth ?? 2}"
526
- .penColor="${props.penColor ?? '#000000'}"
527
- .errors="${baseAttrs.errors}"
528
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
521
+ return html `<zs-field-signature
522
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
523
+ .value="${value != null ? String(value) : ''}"
524
+ .helpText="${baseAttrs.helpText}"
525
+ .penWidth="${props.penWidth ?? 2}"
526
+ .penColor="${props.penColor ?? '#000000'}"
527
+ .errors="${baseAttrs.errors}"
528
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
529
529
  ></zs-field-signature>`;
530
530
  case 'zs-field-address':
531
- return html `<zs-field-address
532
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
533
- .value="${value ?? {}}" .helpText="${baseAttrs.helpText}"
534
- .errors="${baseAttrs.errors}"
535
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}" ?readOnly="${baseAttrs.readOnly}"
531
+ return html `<zs-field-address
532
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
533
+ .value="${value ?? {}}" .helpText="${baseAttrs.helpText}"
534
+ .errors="${baseAttrs.errors}"
535
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}" ?readOnly="${baseAttrs.readOnly}"
536
536
  ></zs-field-address>`;
537
537
  case 'zs-field-chart':
538
- return html `<zs-field-chart
539
- .label="${baseAttrs.label}"
540
- .chartType="${props.chartType ?? 'bar'}"
541
- .data="${props.chartData ?? []}"
542
- .width="${props.width ?? 400}"
543
- .height="${props.height ?? 250}"
538
+ return html `<zs-field-chart
539
+ .label="${baseAttrs.label}"
540
+ .chartType="${props.chartType ?? 'bar'}"
541
+ .data="${props.chartData ?? []}"
542
+ .width="${props.width ?? 400}"
543
+ .height="${props.height ?? 250}"
544
544
  ></zs-field-chart>`;
545
545
  case 'zs-field-media':
546
- return html `<zs-field-media
547
- .label="${baseAttrs.label}"
548
- .src="${value != null ? String(value) : props.src ?? ''}"
549
- .mediaType="${props.mediaType ?? 'image'}"
550
- .alt="${props.alt ?? ''}"
546
+ return html `<zs-field-media
547
+ .label="${baseAttrs.label}"
548
+ .src="${value != null ? String(value) : props.src ?? ''}"
549
+ .mediaType="${props.mediaType ?? 'image'}"
550
+ .alt="${props.alt ?? ''}"
551
551
  ></zs-field-media>`;
552
552
  case 'zs-field-treeview':
553
- return html `<zs-field-treeview
554
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
555
- .value="${Array.isArray(value) ? value : (value ? [value] : [])}"
556
- .helpText="${baseAttrs.helpText}"
557
- .nodes="${props.nodes ?? []}"
558
- .multiSelect="${!!props.multiSelect}"
559
- .showCheckboxes="${!!props.showCheckboxes}"
560
- .searchable="${!!props.searchable}"
561
- .errors="${baseAttrs.errors}"
562
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
553
+ return html `<zs-field-treeview
554
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
555
+ .value="${Array.isArray(value) ? value : (value ? [value] : [])}"
556
+ .helpText="${baseAttrs.helpText}"
557
+ .nodes="${props.nodes ?? []}"
558
+ .multiSelect="${!!props.multiSelect}"
559
+ .showCheckboxes="${!!props.showCheckboxes}"
560
+ .searchable="${!!props.searchable}"
561
+ .errors="${baseAttrs.errors}"
562
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
563
563
  ></zs-field-treeview>`;
564
564
  case 'zs-field-chips':
565
- return html `<zs-field-chips
566
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
567
- .value="${Array.isArray(value) ? value : []}"
568
- .placeholder="${baseAttrs.placeholder}" .helpText="${baseAttrs.helpText}"
569
- .options="${props.options ?? []}"
570
- .allowCustom="${props.allowCustom !== false}"
571
- .maxChips="${props.maxChips ?? 0}"
572
- .colorMode="${props.colorMode ?? 'default'}"
573
- .errors="${baseAttrs.errors}"
574
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
565
+ return html `<zs-field-chips
566
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
567
+ .value="${Array.isArray(value) ? value : []}"
568
+ .placeholder="${baseAttrs.placeholder}" .helpText="${baseAttrs.helpText}"
569
+ .options="${props.options ?? []}"
570
+ .allowCustom="${props.allowCustom !== false}"
571
+ .maxChips="${props.maxChips ?? 0}"
572
+ .colorMode="${props.colorMode ?? 'default'}"
573
+ .errors="${baseAttrs.errors}"
574
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
575
575
  ></zs-field-chips>`;
576
576
  case 'zs-field-datagrid':
577
- return html `<zs-field-datagrid
578
- .config="${field}"
579
- .rows="${Array.isArray(value) ? value : props.rows ?? []}"
580
- .theme="${this.themeMode}"
577
+ return html `<zs-field-datagrid
578
+ .config="${field}"
579
+ .rows="${Array.isArray(value) ? value : props.rows ?? []}"
580
+ .endpoint="${props.endpoint ?? ''}"
581
+ .authHeaders="${props.authHeaders ?? {}}"
582
+ .authToken="${props.authToken ?? ''}"
583
+ .theme="${this.themeMode}"
581
584
  ></zs-field-datagrid>`;
582
585
  case 'zs-field-report':
583
- return html `<zs-field-report
584
- .config="${field}"
585
- .template="${props.template ?? null}"
586
- .data="${value ?? props.data ?? null}"
587
- .theme="${this.themeMode}"
586
+ return html `<zs-field-report
587
+ .config="${field}"
588
+ .template="${props.template ?? null}"
589
+ .data="${value ?? props.data ?? null}"
590
+ .theme="${this.themeMode}"
588
591
  ></zs-field-report>`;
589
592
  default:
590
- return html `<zs-field-text
591
- .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
592
- .value="${value != null ? String(value) : ''}"
593
- .placeholder="${baseAttrs.placeholder}"
594
- .errors="${baseAttrs.errors}"
595
- ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
593
+ return html `<zs-field-text
594
+ .fieldId="${baseAttrs.fieldId}" .label="${baseAttrs.label}"
595
+ .value="${value != null ? String(value) : ''}"
596
+ .placeholder="${baseAttrs.placeholder}"
597
+ .errors="${baseAttrs.errors}"
598
+ ?required="${baseAttrs.required}" ?disabled="${baseAttrs.disabled}"
596
599
  ></zs-field-text>`;
597
600
  }
598
601
  }
@@ -603,20 +606,20 @@ let ZenttoStudioRenderer = class ZenttoStudioRenderer extends LitElement {
603
606
  if (actions.length === 0)
604
607
  return nothing;
605
608
  const ctx = this.buildContext();
606
- return html `
607
- <div class="zs-actions">
609
+ return html `
610
+ <div class="zs-actions">
608
611
  ${actions.map(action => {
609
612
  const enabled = isActionEnabled(action, ctx);
610
613
  const variant = action.variant ?? 'secondary';
611
- return html `
612
- <button
613
- class="zs-btn zs-btn--${variant}"
614
- ?disabled="${!enabled}"
615
- @click="${() => this.handleAction(action.id)}"
616
- >${action.label}</button>
614
+ return html `
615
+ <button
616
+ class="zs-btn zs-btn--${variant}"
617
+ ?disabled="${!enabled}"
618
+ @click="${() => this.handleAction(action.id)}"
619
+ >${action.label}</button>
617
620
  `;
618
- })}
619
- </div>
621
+ })}
622
+ </div>
620
623
  `;
621
624
  }
622
625
  };