ngx-core-components 0.3.21 → 0.3.22
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/ai/ai-chat/ai-chat.component.d.ts +2 -1
- package/ai/ngx-web-llm.service.d.ts +22 -0
- package/ai/public-api.d.ts +2 -0
- package/charts/gantt-chart/gantt-chart.component.d.ts +4 -1
- package/charts/line-chart/line-chart.component.d.ts +19 -1
- package/fesm2022/ngx-core-components-ai.mjs +173 -9
- package/fesm2022/ngx-core-components-ai.mjs.map +1 -1
- package/fesm2022/ngx-core-components-charts.mjs +119 -12
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-grid.mjs +119 -38
- package/fesm2022/ngx-core-components-grid.mjs.map +1 -1
- package/fesm2022/ngx-core-components-inputs.mjs +714 -3
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
- package/fesm2022/ngx-core-components-navigation.mjs +19 -13
- package/fesm2022/ngx-core-components-navigation.mjs.map +1 -1
- package/fesm2022/ngx-core-components.mjs +2 -2
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/grid/data-grid/data-grid.component.d.ts +40 -1
- package/inputs/form-builder/form-builder.component.d.ts +20 -0
- package/inputs/form-builder/form-designer.component.d.ts +42 -0
- package/inputs/public-api.d.ts +1 -0
- package/package.json +9 -9
- package/public-api.d.ts +3 -1
- package/themes/theme.css +22 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, output, signal, computed, forwardRef, ChangeDetectionStrategy, Component, inject, ElementRef, HostListener, model, effect, ViewChild } from '@angular/core';
|
|
3
|
-
import * as
|
|
3
|
+
import * as i2 from '@angular/forms';
|
|
4
4
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
5
5
|
import { NGX_CORE_I18N } from 'ngx-core-components/i18n';
|
|
6
|
+
import * as i1 from '@angular/common';
|
|
6
7
|
import { CommonModule } from '@angular/common';
|
|
7
8
|
|
|
8
9
|
class TextBoxComponent {
|
|
@@ -3670,7 +3671,7 @@ class TagInputComponent {
|
|
|
3670
3671
|
<span class="ngx-tag-input__max-hint">Max {{ maxTags() }} tags</span>
|
|
3671
3672
|
}
|
|
3672
3673
|
</div>
|
|
3673
|
-
`, isInline: true, styles: [":host{display:block}.ngx-tag-input{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:8px 12px;min-height:44px;border-radius:10px;border:1.5px solid var(--ngx-tag-border, hsl(220, 15%, 82%));background:var(--ngx-tag-bg, #ffffff);font-family:var(--ngx-font-family, system-ui, sans-serif);cursor:text;transition:border-color .18s ease,box-shadow .18s ease}.ngx-tag-input.focused{border-color:var(--ngx-tag-focus-border, hsl(250, 70%, 58%));box-shadow:0 0 0 3px var(--primary-glow, rgba(124, 95, 240, .15));outline:none}.ngx-tag-input.disabled{background:var(--ngx-tag-disabled-bg, hsl(220, 15%, 97%));border-color:var(--ngx-tag-disabled-border, hsl(220, 10%, 88%));cursor:not-allowed;opacity:.72}.ngx-tag-input.dark{background:var(--ngx-tag-dark-bg, hsl(225, 20%, 14%));border-color:var(--ngx-tag-dark-border, hsl(225, 15%, 28%))}.ngx-tag-input.dark.focused{border-color:var(--ngx-tag-focus-border, hsl(250, 65%, 65%));box-shadow:0 0 0 3px #7c5ff038}.ngx-tag-input.dark.disabled{background:#15171e;border-color:#31353f}.ngx-tag-chip{display:inline-flex;align-items:center;gap:4px;padding:3px 8px 3px 10px;background:var(--ngx-tag-chip-bg, hsl(250, 65%, 94%));color:var(--ngx-tag-chip-color, hsl(250, 55%, 38%));border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap;border:1px solid var(--ngx-tag-chip-border, hsl(250, 55%, 85%));transition:background .15s ease,border-color .15s ease;animation:chip-pop .18s cubic-bezier(.34,1.56,.64,1)}.dark .ngx-tag-chip{background:var(--ngx-tag-chip-dark-bg, hsl(250, 45%, 20%));color:var(--ngx-tag-chip-dark-color, hsl(250, 75%, 80%));border-color:#362a6f}@keyframes chip-pop{0%{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}.ngx-tag-chip__label{max-width:160px;overflow:hidden;text-overflow:ellipsis}.ngx-tag-chip__remove{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;background:transparent;border:none;border-radius:50%;color:inherit;font-size:9px;line-height:1;cursor:pointer;opacity:.5;transition:opacity .12s ease,background .12s ease;flex-shrink:0}.ngx-tag-chip__remove:hover{opacity:1;background:#0000001a}.dark .ngx-tag-chip__remove:hover{background:#ffffff1f}.ngx-tag-input__field{flex:1;min-width:100px;border:none;outline:none;background:transparent;font-size:13px;font-family:inherit;color:var(--ngx-tag-input-color, hsl(220, 20%, 18%));padding:2px 0}.ngx-tag-input__field::placeholder{color:var(--ngx-tag-placeholder-color, hsl(220, 12%, 65%))}.ngx-tag-input__field:disabled{cursor:not-allowed}.dark .ngx-tag-input__field{color:var(--ngx-tag-input-dark-color, hsl(220, 15%, 88%))}.dark .ngx-tag-input__field::placeholder{color:#6c7689}.ngx-tag-input__max-hint{font-size:11px;font-style:italic;color:#89909f;padding:2px 4px;align-self:center}.dark .ngx-tag-input__max-hint{color:#6e7687}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type:
|
|
3674
|
+
`, isInline: true, styles: [":host{display:block}.ngx-tag-input{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:8px 12px;min-height:44px;border-radius:10px;border:1.5px solid var(--ngx-tag-border, hsl(220, 15%, 82%));background:var(--ngx-tag-bg, #ffffff);font-family:var(--ngx-font-family, system-ui, sans-serif);cursor:text;transition:border-color .18s ease,box-shadow .18s ease}.ngx-tag-input.focused{border-color:var(--ngx-tag-focus-border, hsl(250, 70%, 58%));box-shadow:0 0 0 3px var(--primary-glow, rgba(124, 95, 240, .15));outline:none}.ngx-tag-input.disabled{background:var(--ngx-tag-disabled-bg, hsl(220, 15%, 97%));border-color:var(--ngx-tag-disabled-border, hsl(220, 10%, 88%));cursor:not-allowed;opacity:.72}.ngx-tag-input.dark{background:var(--ngx-tag-dark-bg, hsl(225, 20%, 14%));border-color:var(--ngx-tag-dark-border, hsl(225, 15%, 28%))}.ngx-tag-input.dark.focused{border-color:var(--ngx-tag-focus-border, hsl(250, 65%, 65%));box-shadow:0 0 0 3px #7c5ff038}.ngx-tag-input.dark.disabled{background:#15171e;border-color:#31353f}.ngx-tag-chip{display:inline-flex;align-items:center;gap:4px;padding:3px 8px 3px 10px;background:var(--ngx-tag-chip-bg, hsl(250, 65%, 94%));color:var(--ngx-tag-chip-color, hsl(250, 55%, 38%));border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap;border:1px solid var(--ngx-tag-chip-border, hsl(250, 55%, 85%));transition:background .15s ease,border-color .15s ease;animation:chip-pop .18s cubic-bezier(.34,1.56,.64,1)}.dark .ngx-tag-chip{background:var(--ngx-tag-chip-dark-bg, hsl(250, 45%, 20%));color:var(--ngx-tag-chip-dark-color, hsl(250, 75%, 80%));border-color:#362a6f}@keyframes chip-pop{0%{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}.ngx-tag-chip__label{max-width:160px;overflow:hidden;text-overflow:ellipsis}.ngx-tag-chip__remove{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;background:transparent;border:none;border-radius:50%;color:inherit;font-size:9px;line-height:1;cursor:pointer;opacity:.5;transition:opacity .12s ease,background .12s ease;flex-shrink:0}.ngx-tag-chip__remove:hover{opacity:1;background:#0000001a}.dark .ngx-tag-chip__remove:hover{background:#ffffff1f}.ngx-tag-input__field{flex:1;min-width:100px;border:none;outline:none;background:transparent;font-size:13px;font-family:inherit;color:var(--ngx-tag-input-color, hsl(220, 20%, 18%));padding:2px 0}.ngx-tag-input__field::placeholder{color:var(--ngx-tag-placeholder-color, hsl(220, 12%, 65%))}.ngx-tag-input__field:disabled{cursor:not-allowed}.dark .ngx-tag-input__field{color:var(--ngx-tag-input-dark-color, hsl(220, 15%, 88%))}.dark .ngx-tag-input__field::placeholder{color:#6c7689}.ngx-tag-input__max-hint{font-size:11px;font-style:italic;color:#89909f;padding:2px 4px;align-self:center}.dark .ngx-tag-input__max-hint{color:#6e7687}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3674
3675
|
}
|
|
3675
3676
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TagInputComponent, decorators: [{
|
|
3676
3677
|
type: Component,
|
|
@@ -4163,11 +4164,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
4163
4164
|
}] });
|
|
4164
4165
|
|
|
4165
4166
|
class FormBuilderComponent {
|
|
4167
|
+
/**
|
|
4168
|
+
* The schema definition list of form fields to render dynamically.
|
|
4169
|
+
*/
|
|
4166
4170
|
fields = input([]);
|
|
4171
|
+
/**
|
|
4172
|
+
* The initial/controlled form value dictionary mapping field keys to values.
|
|
4173
|
+
*/
|
|
4167
4174
|
value = input({});
|
|
4175
|
+
/**
|
|
4176
|
+
* Whether to render the default form submit button at the bottom.
|
|
4177
|
+
* @default true
|
|
4178
|
+
*/
|
|
4168
4179
|
showSubmit = input(true);
|
|
4180
|
+
/**
|
|
4181
|
+
* The text label to display on the default form submit button.
|
|
4182
|
+
* @default 'Submit'
|
|
4183
|
+
*/
|
|
4169
4184
|
submitLabel = input('Submit');
|
|
4185
|
+
/**
|
|
4186
|
+
* Emits when any field value in the form changes.
|
|
4187
|
+
*/
|
|
4170
4188
|
valueChange = output();
|
|
4189
|
+
/**
|
|
4190
|
+
* Emits the entire form value dictionary when the form is submitted successfully.
|
|
4191
|
+
*/
|
|
4171
4192
|
formSubmit = output();
|
|
4172
4193
|
formValue = signal({});
|
|
4173
4194
|
syncValue = effect(() => {
|
|
@@ -4333,6 +4354,696 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
4333
4354
|
`, styles: [":host{display:block}.ngx-form-builder{display:grid;gap:14px;font-family:var(--ngx-font-family, inherit);color:var(--text-primary, #0f172a)}.form-field{display:grid;gap:6px}.checkbox-field{display:flex;align-items:center;gap:8px}.field-label{font-size:12px;font-weight:700;color:var(--ngx-input-label, #475569)}.field-label strong{color:var(--ngx-input-error, #dc2626);margin-left:2px}input:not([type=checkbox]),textarea,select{width:100%;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #ffffff);color:var(--ngx-input-text, #0f172a);font:inherit;font-size:13px;padding:9px 11px;outline:none;transition:all .15s}textarea{min-height:96px;resize:vertical}input:focus,textarea:focus,select:focus{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79,70,229,.12))}input:disabled,textarea:disabled,select:disabled{background:var(--ngx-input-disabled-bg, #f8fafc);color:var(--text-secondary, #64748b);cursor:not-allowed}input[type=checkbox]{width:16px;height:16px;accent-color:var(--primary-color, #4f46e5)}.form-actions{display:flex;justify-content:flex-end}.form-actions button{border:0;border-radius:7px;background:var(--primary-color, #4f46e5);color:#fff;cursor:pointer;font:inherit;font-size:13px;font-weight:750;padding:9px 14px}.form-actions button:hover,.form-actions button:focus-visible{background:var(--primary-hover, #4338ca);outline:none}\n"] }]
|
|
4334
4355
|
}] });
|
|
4335
4356
|
|
|
4357
|
+
class FormDesignerComponent {
|
|
4358
|
+
theme = input('light');
|
|
4359
|
+
schemaChange = output();
|
|
4360
|
+
designerFields = signal([]);
|
|
4361
|
+
selectedField = signal(null);
|
|
4362
|
+
activeTab = signal('properties');
|
|
4363
|
+
// Drag states
|
|
4364
|
+
isDraggingFromToolbox = false;
|
|
4365
|
+
draggingToolboxField = null;
|
|
4366
|
+
isDraggingOverCanvas = false;
|
|
4367
|
+
draggingIndex = signal(null);
|
|
4368
|
+
dragOverIndex = signal(null);
|
|
4369
|
+
// Modal import states
|
|
4370
|
+
importSchemaPopupOpen = signal(false);
|
|
4371
|
+
importSchemaText = '';
|
|
4372
|
+
importError = signal(null);
|
|
4373
|
+
// Live preview submit state
|
|
4374
|
+
previewSubmitData = signal(null);
|
|
4375
|
+
toolboxFields = [
|
|
4376
|
+
{ type: 'text', label: 'Short Text', key: 'text_field', placeholder: 'Enter text...' },
|
|
4377
|
+
{ type: 'email', label: 'Email', key: 'email_field', placeholder: 'Enter email address...' },
|
|
4378
|
+
{ type: 'password', label: 'Password', key: 'password_field', placeholder: 'Enter password...' },
|
|
4379
|
+
{ type: 'number', label: 'Number', key: 'number_field', placeholder: 'Enter number...' },
|
|
4380
|
+
{ type: 'textarea', label: 'Long Text', key: 'textarea_field', placeholder: 'Enter long text...' },
|
|
4381
|
+
{ type: 'select', label: 'Dropdown', key: 'select_field', placeholder: 'Select...', options: [{ label: 'Option 1', value: 'opt1' }, { label: 'Option 2', value: 'opt2' }] },
|
|
4382
|
+
{ type: 'checkbox', label: 'Checkbox', key: 'checkbox_field' },
|
|
4383
|
+
{ type: 'date', label: 'Date Picker', key: 'date_field' }
|
|
4384
|
+
];
|
|
4385
|
+
schemaJsonString = computed(() => {
|
|
4386
|
+
return JSON.stringify(this.designerFields(), null, 2);
|
|
4387
|
+
});
|
|
4388
|
+
constructor() {
|
|
4389
|
+
// Sync notifications on change
|
|
4390
|
+
effect(() => {
|
|
4391
|
+
this.schemaChange.emit(this.designerFields());
|
|
4392
|
+
});
|
|
4393
|
+
}
|
|
4394
|
+
getIconForType(type) {
|
|
4395
|
+
switch (type) {
|
|
4396
|
+
case 'text': return '🔤';
|
|
4397
|
+
case 'email': return '📧';
|
|
4398
|
+
case 'password': return '🔑';
|
|
4399
|
+
case 'number': return '🔢';
|
|
4400
|
+
case 'textarea': return '📝';
|
|
4401
|
+
case 'select': return '▼';
|
|
4402
|
+
case 'checkbox': return '☑️';
|
|
4403
|
+
case 'date': return '📅';
|
|
4404
|
+
default: return '📄';
|
|
4405
|
+
}
|
|
4406
|
+
}
|
|
4407
|
+
// Toolbox drag handlers
|
|
4408
|
+
onToolboxDragStart(event, field) {
|
|
4409
|
+
this.isDraggingFromToolbox = true;
|
|
4410
|
+
this.draggingToolboxField = field;
|
|
4411
|
+
if (event.dataTransfer) {
|
|
4412
|
+
event.dataTransfer.setData('text/plain', 'toolbox');
|
|
4413
|
+
event.dataTransfer.effectAllowed = 'copy';
|
|
4414
|
+
}
|
|
4415
|
+
}
|
|
4416
|
+
// Canvas Drag/Drop handlers
|
|
4417
|
+
onCanvasDragOver(event) {
|
|
4418
|
+
event.preventDefault();
|
|
4419
|
+
if (this.isDraggingFromToolbox) {
|
|
4420
|
+
this.isDraggingOverCanvas = true;
|
|
4421
|
+
if (event.dataTransfer) {
|
|
4422
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
4423
|
+
}
|
|
4424
|
+
}
|
|
4425
|
+
}
|
|
4426
|
+
onCanvasDragLeave() {
|
|
4427
|
+
this.isDraggingOverCanvas = false;
|
|
4428
|
+
}
|
|
4429
|
+
onCanvasDrop(event) {
|
|
4430
|
+
event.preventDefault();
|
|
4431
|
+
this.isDraggingOverCanvas = false;
|
|
4432
|
+
if (this.isDraggingFromToolbox && this.draggingToolboxField) {
|
|
4433
|
+
const type = this.draggingToolboxField.type;
|
|
4434
|
+
const count = this.designerFields().filter(f => f.type === type).length + 1;
|
|
4435
|
+
const key = `${type}_${Math.random().toString(36).substr(2, 4)}`;
|
|
4436
|
+
const newField = {
|
|
4437
|
+
...this.draggingToolboxField,
|
|
4438
|
+
key,
|
|
4439
|
+
label: `${this.draggingToolboxField.label} ${count}`,
|
|
4440
|
+
options: this.draggingToolboxField.options ? JSON.parse(JSON.stringify(this.draggingToolboxField.options)) : undefined
|
|
4441
|
+
};
|
|
4442
|
+
this.designerFields.update(arr => [...arr, newField]);
|
|
4443
|
+
this.selectField(newField);
|
|
4444
|
+
}
|
|
4445
|
+
this.onDragEnd();
|
|
4446
|
+
}
|
|
4447
|
+
// Canvas sorting / reordering drag handlers
|
|
4448
|
+
onCanvasFieldDragStart(event, idx) {
|
|
4449
|
+
this.isDraggingFromToolbox = false;
|
|
4450
|
+
this.draggingIndex.set(idx);
|
|
4451
|
+
if (event.dataTransfer) {
|
|
4452
|
+
event.dataTransfer.setData('text/plain', String(idx));
|
|
4453
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
4454
|
+
}
|
|
4455
|
+
}
|
|
4456
|
+
onCanvasFieldDragOver(event, idx) {
|
|
4457
|
+
event.preventDefault();
|
|
4458
|
+
if (this.draggingIndex() !== null && this.draggingIndex() !== idx) {
|
|
4459
|
+
this.dragOverIndex.set(idx);
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4462
|
+
onCanvasFieldDragLeave() {
|
|
4463
|
+
this.dragOverIndex.set(null);
|
|
4464
|
+
}
|
|
4465
|
+
onCanvasFieldDrop(event, targetIdx) {
|
|
4466
|
+
event.preventDefault();
|
|
4467
|
+
const sourceIdx = this.draggingIndex();
|
|
4468
|
+
this.dragOverIndex.set(null);
|
|
4469
|
+
if (sourceIdx !== null && sourceIdx !== targetIdx) {
|
|
4470
|
+
this.designerFields.update(arr => {
|
|
4471
|
+
const next = [...arr];
|
|
4472
|
+
const [moved] = next.splice(sourceIdx, 1);
|
|
4473
|
+
next.splice(targetIdx, 0, moved);
|
|
4474
|
+
return next;
|
|
4475
|
+
});
|
|
4476
|
+
}
|
|
4477
|
+
this.onDragEnd();
|
|
4478
|
+
}
|
|
4479
|
+
onDragEnd() {
|
|
4480
|
+
this.isDraggingFromToolbox = false;
|
|
4481
|
+
this.draggingToolboxField = null;
|
|
4482
|
+
this.isDraggingOverCanvas = false;
|
|
4483
|
+
this.draggingIndex.set(null);
|
|
4484
|
+
this.dragOverIndex.set(null);
|
|
4485
|
+
}
|
|
4486
|
+
// Selection & mutations
|
|
4487
|
+
selectField(field) {
|
|
4488
|
+
// Make a shallow copy of properties to support reactive form updates
|
|
4489
|
+
this.selectedField.set(field);
|
|
4490
|
+
}
|
|
4491
|
+
onFieldPropertyChange() {
|
|
4492
|
+
const selected = this.selectedField();
|
|
4493
|
+
if (!selected)
|
|
4494
|
+
return;
|
|
4495
|
+
this.designerFields.update(arr => {
|
|
4496
|
+
return arr.map(f => (f.key === selected.key ? { ...selected } : f));
|
|
4497
|
+
});
|
|
4498
|
+
}
|
|
4499
|
+
deleteField(field, event) {
|
|
4500
|
+
event.stopPropagation();
|
|
4501
|
+
this.designerFields.update(arr => arr.filter(f => f.key !== field.key));
|
|
4502
|
+
if (this.selectedField()?.key === field.key) {
|
|
4503
|
+
this.selectedField.set(null);
|
|
4504
|
+
}
|
|
4505
|
+
}
|
|
4506
|
+
clearAll() {
|
|
4507
|
+
if (confirm('Are you sure you want to delete all fields?')) {
|
|
4508
|
+
this.designerFields.set([]);
|
|
4509
|
+
this.selectedField.set(null);
|
|
4510
|
+
this.previewSubmitData.set(null);
|
|
4511
|
+
}
|
|
4512
|
+
}
|
|
4513
|
+
// Options list mutations
|
|
4514
|
+
addOption() {
|
|
4515
|
+
const selected = this.selectedField();
|
|
4516
|
+
if (!selected)
|
|
4517
|
+
return;
|
|
4518
|
+
const opts = selected.options || [];
|
|
4519
|
+
const count = opts.length + 1;
|
|
4520
|
+
const nextOpts = [
|
|
4521
|
+
...opts,
|
|
4522
|
+
{ label: `Option ${count}`, value: `opt${count}` }
|
|
4523
|
+
];
|
|
4524
|
+
selected.options = nextOpts;
|
|
4525
|
+
this.onFieldPropertyChange();
|
|
4526
|
+
}
|
|
4527
|
+
deleteOption(idx) {
|
|
4528
|
+
const selected = this.selectedField();
|
|
4529
|
+
if (!selected || !selected.options)
|
|
4530
|
+
return;
|
|
4531
|
+
selected.options = selected.options.filter((_, i) => i !== idx);
|
|
4532
|
+
this.onFieldPropertyChange();
|
|
4533
|
+
}
|
|
4534
|
+
// Schema copying
|
|
4535
|
+
async copySchema() {
|
|
4536
|
+
try {
|
|
4537
|
+
await navigator.clipboard.writeText(this.schemaJsonString());
|
|
4538
|
+
alert('Schema copied to clipboard!');
|
|
4539
|
+
}
|
|
4540
|
+
catch (err) {
|
|
4541
|
+
console.error('Failed to copy schema:', err);
|
|
4542
|
+
}
|
|
4543
|
+
}
|
|
4544
|
+
// Import Schema Dialog
|
|
4545
|
+
importSchema() {
|
|
4546
|
+
this.importError.set(null);
|
|
4547
|
+
try {
|
|
4548
|
+
const parsed = JSON.parse(this.importSchemaText);
|
|
4549
|
+
if (!Array.isArray(parsed)) {
|
|
4550
|
+
throw new Error('Schema must be a JSON array of FormBuilderField elements.');
|
|
4551
|
+
}
|
|
4552
|
+
// Verify minimal elements
|
|
4553
|
+
for (const item of parsed) {
|
|
4554
|
+
if (!item.key || !item.label) {
|
|
4555
|
+
throw new Error('Each field in the schema array must have at least "key" and "label" properties.');
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
this.designerFields.set(parsed);
|
|
4559
|
+
this.selectedField.set(null);
|
|
4560
|
+
this.importSchemaPopupOpen.set(false);
|
|
4561
|
+
this.importSchemaText = '';
|
|
4562
|
+
}
|
|
4563
|
+
catch (err) {
|
|
4564
|
+
this.importError.set(err?.message || 'Invalid JSON syntax.');
|
|
4565
|
+
}
|
|
4566
|
+
}
|
|
4567
|
+
// Live preview actions
|
|
4568
|
+
onPreviewSubmit(data) {
|
|
4569
|
+
this.previewSubmitData.set(data);
|
|
4570
|
+
}
|
|
4571
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FormDesignerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4572
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: FormDesignerComponent, isStandalone: true, selector: "ngx-form-designer", inputs: { theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { schemaChange: "schemaChange" }, ngImport: i0, template: `
|
|
4573
|
+
<div class="ngx-form-designer-container" [class.dark-mode]="theme() === 'dark'">
|
|
4574
|
+
|
|
4575
|
+
<!-- Top Actions Bar -->
|
|
4576
|
+
<div class="designer-header">
|
|
4577
|
+
<h3 class="designer-title">Visual Form Designer</h3>
|
|
4578
|
+
<div class="designer-header-actions">
|
|
4579
|
+
<button class="header-action-btn primary" (click)="importSchemaPopupOpen.set(true)">📥 Import Schema</button>
|
|
4580
|
+
<button class="header-action-btn" (click)="clearAll()">🗑️ Clear All</button>
|
|
4581
|
+
</div>
|
|
4582
|
+
</div>
|
|
4583
|
+
|
|
4584
|
+
<div class="designer-workspace">
|
|
4585
|
+
<!-- 1. Toolbox Panel -->
|
|
4586
|
+
<div class="designer-panel toolbox-panel">
|
|
4587
|
+
<h4 class="panel-title">Toolbox</h4>
|
|
4588
|
+
<p class="panel-subtitle">Drag fields to the canvas</p>
|
|
4589
|
+
|
|
4590
|
+
<div class="toolbox-items">
|
|
4591
|
+
@for (item of toolboxFields; track item.type) {
|
|
4592
|
+
<div
|
|
4593
|
+
class="toolbox-card"
|
|
4594
|
+
draggable="true"
|
|
4595
|
+
(dragstart)="onToolboxDragStart($event, item)"
|
|
4596
|
+
(dragend)="onDragEnd()"
|
|
4597
|
+
>
|
|
4598
|
+
<span class="toolbox-icon">{{ getIconForType(item.type) }}</span>
|
|
4599
|
+
<span class="toolbox-label">{{ item.label }}</span>
|
|
4600
|
+
</div>
|
|
4601
|
+
}
|
|
4602
|
+
</div>
|
|
4603
|
+
</div>
|
|
4604
|
+
|
|
4605
|
+
<!-- 2. Interactive Canvas -->
|
|
4606
|
+
<div class="designer-panel canvas-panel">
|
|
4607
|
+
<div class="panel-header">
|
|
4608
|
+
<h4 class="panel-title">Canvas</h4>
|
|
4609
|
+
<span class="field-count-badge">{{ designerFields().length }} Fields</span>
|
|
4610
|
+
</div>
|
|
4611
|
+
|
|
4612
|
+
<div
|
|
4613
|
+
class="canvas-dropzone"
|
|
4614
|
+
[class.drag-over]="isDraggingOverCanvas && isDraggingFromToolbox"
|
|
4615
|
+
(dragover)="onCanvasDragOver($event)"
|
|
4616
|
+
(dragleave)="onCanvasDragLeave()"
|
|
4617
|
+
(drop)="onCanvasDrop($event)"
|
|
4618
|
+
>
|
|
4619
|
+
@if (designerFields().length === 0) {
|
|
4620
|
+
<div class="canvas-placeholder">
|
|
4621
|
+
<span class="placeholder-icon">🎯</span>
|
|
4622
|
+
<p class="placeholder-text">Drag and drop fields here to start designing your form</p>
|
|
4623
|
+
</div>
|
|
4624
|
+
} @else {
|
|
4625
|
+
<div class="canvas-fields-list">
|
|
4626
|
+
@for (field of designerFields(); track field.key; let idx = $index) {
|
|
4627
|
+
<div
|
|
4628
|
+
class="canvas-field-row"
|
|
4629
|
+
[class.selected]="selectedField()?.key === field.key"
|
|
4630
|
+
[class.drag-over]="dragOverIndex() === idx"
|
|
4631
|
+
[class.dragging]="draggingIndex() === idx"
|
|
4632
|
+
draggable="true"
|
|
4633
|
+
(dragstart)="onCanvasFieldDragStart($event, idx)"
|
|
4634
|
+
(dragover)="onCanvasFieldDragOver($event, idx)"
|
|
4635
|
+
(dragleave)="onCanvasFieldDragLeave()"
|
|
4636
|
+
(drop)="onCanvasFieldDrop($event, idx)"
|
|
4637
|
+
(dragend)="onDragEnd()"
|
|
4638
|
+
(click)="selectField(field)"
|
|
4639
|
+
>
|
|
4640
|
+
<!-- Drag handle -->
|
|
4641
|
+
<div class="field-drag-handle">⋮⋮</div>
|
|
4642
|
+
|
|
4643
|
+
<!-- Content -->
|
|
4644
|
+
<div class="field-details">
|
|
4645
|
+
<div class="field-header">
|
|
4646
|
+
<span class="field-type-badge">{{ field.type || 'text' }}</span>
|
|
4647
|
+
<span class="field-key-badge">{{ field.key }}</span>
|
|
4648
|
+
</div>
|
|
4649
|
+
<span class="field-label-text">{{ field.label }} @if (field.required) { <strong class="req-star">*</strong> }</span>
|
|
4650
|
+
@if (field.placeholder) {
|
|
4651
|
+
<span class="field-placeholder-text">Placeholder: "{{ field.placeholder }}"</span>
|
|
4652
|
+
}
|
|
4653
|
+
</div>
|
|
4654
|
+
|
|
4655
|
+
<!-- Delete button -->
|
|
4656
|
+
<button class="delete-field-btn" (click)="deleteField(field, $event)" title="Delete Field">✕</button>
|
|
4657
|
+
</div>
|
|
4658
|
+
}
|
|
4659
|
+
</div>
|
|
4660
|
+
}
|
|
4661
|
+
</div>
|
|
4662
|
+
</div>
|
|
4663
|
+
|
|
4664
|
+
<!-- 3. Inspector Settings / Schema Panel -->
|
|
4665
|
+
<div class="designer-panel inspector-panel">
|
|
4666
|
+
<div class="inspector-tabs">
|
|
4667
|
+
<button class="tab-btn" [class.active]="activeTab() === 'properties'" (click)="activeTab.set('properties')">Properties</button>
|
|
4668
|
+
<button class="tab-btn" [class.active]="activeTab() === 'schema'" (click)="activeTab.set('schema')">JSON Schema</button>
|
|
4669
|
+
<button class="tab-btn" [class.active]="activeTab() === 'preview'" (click)="activeTab.set('preview')">Live Preview</button>
|
|
4670
|
+
</div>
|
|
4671
|
+
|
|
4672
|
+
<!-- Properties Inspector Tab -->
|
|
4673
|
+
@if (activeTab() === 'properties') {
|
|
4674
|
+
<div class="tab-content properties-content">
|
|
4675
|
+
@if (!selectedField()) {
|
|
4676
|
+
<div class="inspector-placeholder">
|
|
4677
|
+
<span>⚙️</span>
|
|
4678
|
+
<p>Select a field on the canvas to configure its properties.</p>
|
|
4679
|
+
</div>
|
|
4680
|
+
} @else {
|
|
4681
|
+
<div class="properties-form">
|
|
4682
|
+
<label class="inspector-field">
|
|
4683
|
+
<span class="inspector-label">Unique Key</span>
|
|
4684
|
+
<input type="text" [(ngModel)]="selectedField()!.key" (ngModelChange)="onFieldPropertyChange()" />
|
|
4685
|
+
</label>
|
|
4686
|
+
|
|
4687
|
+
<label class="inspector-field">
|
|
4688
|
+
<span class="inspector-label">Field Label</span>
|
|
4689
|
+
<input type="text" [(ngModel)]="selectedField()!.label" (ngModelChange)="onFieldPropertyChange()" />
|
|
4690
|
+
</label>
|
|
4691
|
+
|
|
4692
|
+
@if (selectedField()!.type !== 'checkbox') {
|
|
4693
|
+
<label class="inspector-field">
|
|
4694
|
+
<span class="inspector-label">Placeholder Text</span>
|
|
4695
|
+
<input type="text" [(ngModel)]="selectedField()!.placeholder" (ngModelChange)="onFieldPropertyChange()" />
|
|
4696
|
+
</label>
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
@if (selectedField()!.type === 'number') {
|
|
4700
|
+
<div class="properties-row">
|
|
4701
|
+
<label class="inspector-field">
|
|
4702
|
+
<span class="inspector-label">Min Value</span>
|
|
4703
|
+
<input type="number" [(ngModel)]="selectedField()!.min" (ngModelChange)="onFieldPropertyChange()" />
|
|
4704
|
+
</label>
|
|
4705
|
+
<label class="inspector-field">
|
|
4706
|
+
<span class="inspector-label">Max Value</span>
|
|
4707
|
+
<input type="number" [(ngModel)]="selectedField()!.max" (ngModelChange)="onFieldPropertyChange()" />
|
|
4708
|
+
</label>
|
|
4709
|
+
</div>
|
|
4710
|
+
<label class="inspector-field">
|
|
4711
|
+
<span class="inspector-label">Step</span>
|
|
4712
|
+
<input type="number" [(ngModel)]="selectedField()!.step" (ngModelChange)="onFieldPropertyChange()" />
|
|
4713
|
+
</label>
|
|
4714
|
+
}
|
|
4715
|
+
|
|
4716
|
+
<div class="checkbox-row">
|
|
4717
|
+
<label class="inspector-checkbox">
|
|
4718
|
+
<input type="checkbox" [(ngModel)]="selectedField()!.required" (ngModelChange)="onFieldPropertyChange()" />
|
|
4719
|
+
<span>Required Field</span>
|
|
4720
|
+
</label>
|
|
4721
|
+
|
|
4722
|
+
<label class="inspector-checkbox">
|
|
4723
|
+
<input type="checkbox" [(ngModel)]="selectedField()!.disabled" (ngModelChange)="onFieldPropertyChange()" />
|
|
4724
|
+
<span>Disabled Field</span>
|
|
4725
|
+
</label>
|
|
4726
|
+
</div>
|
|
4727
|
+
|
|
4728
|
+
<!-- Options list editor (for Select fields) -->
|
|
4729
|
+
@if (selectedField()!.type === 'select') {
|
|
4730
|
+
<div class="options-editor-section">
|
|
4731
|
+
<div class="options-header">
|
|
4732
|
+
<span class="inspector-label">Dropdown Options</span>
|
|
4733
|
+
<button class="add-opt-btn" (click)="addOption()">➕ Add</button>
|
|
4734
|
+
</div>
|
|
4735
|
+
|
|
4736
|
+
<div class="options-list">
|
|
4737
|
+
@for (opt of selectedField()!.options || []; track $index; let oidx = $index) {
|
|
4738
|
+
<div class="option-edit-row">
|
|
4739
|
+
<input type="text" placeholder="Label" [(ngModel)]="opt.label" (ngModelChange)="onFieldPropertyChange()" />
|
|
4740
|
+
<input type="text" placeholder="Value" [(ngModel)]="opt.value" (ngModelChange)="onFieldPropertyChange()" />
|
|
4741
|
+
<button class="delete-opt-btn" (click)="deleteOption(oidx)" title="Delete Option">✕</button>
|
|
4742
|
+
</div>
|
|
4743
|
+
}
|
|
4744
|
+
</div>
|
|
4745
|
+
</div>
|
|
4746
|
+
}
|
|
4747
|
+
</div>
|
|
4748
|
+
}
|
|
4749
|
+
</div>
|
|
4750
|
+
}
|
|
4751
|
+
|
|
4752
|
+
<!-- JSON Schema Tab -->
|
|
4753
|
+
@if (activeTab() === 'schema') {
|
|
4754
|
+
<div class="tab-content schema-content">
|
|
4755
|
+
<div class="schema-actions">
|
|
4756
|
+
<button class="schema-action-btn" (click)="copySchema()">📋 Copy Schema</button>
|
|
4757
|
+
</div>
|
|
4758
|
+
<pre class="schema-code-block"><code>{{ schemaJsonString() }}</code></pre>
|
|
4759
|
+
</div>
|
|
4760
|
+
}
|
|
4761
|
+
|
|
4762
|
+
<!-- Live Preview Tab -->
|
|
4763
|
+
@if (activeTab() === 'preview') {
|
|
4764
|
+
<div class="tab-content preview-content">
|
|
4765
|
+
<div class="preview-card">
|
|
4766
|
+
<ngx-form-builder
|
|
4767
|
+
[fields]="designerFields()"
|
|
4768
|
+
[showSubmit]="true"
|
|
4769
|
+
submitLabel="Test Submit"
|
|
4770
|
+
(formSubmit)="onPreviewSubmit($event)"
|
|
4771
|
+
></ngx-form-builder>
|
|
4772
|
+
</div>
|
|
4773
|
+
@if (previewSubmitData()) {
|
|
4774
|
+
<div class="preview-submit-banner">
|
|
4775
|
+
<span class="banner-title">Form Submitted Data:</span>
|
|
4776
|
+
<pre><code>{{ previewSubmitData() | json }}</code></pre>
|
|
4777
|
+
</div>
|
|
4778
|
+
}
|
|
4779
|
+
</div>
|
|
4780
|
+
}
|
|
4781
|
+
</div>
|
|
4782
|
+
</div>
|
|
4783
|
+
|
|
4784
|
+
<!-- Popups / Modals -->
|
|
4785
|
+
@if (importSchemaPopupOpen()) {
|
|
4786
|
+
<div class="designer-modal-overlay">
|
|
4787
|
+
<div class="designer-modal-card">
|
|
4788
|
+
<h4 class="modal-title">Import JSON Schema</h4>
|
|
4789
|
+
<p class="modal-subtitle">Paste a valid FormBuilderField[] JSON array below:</p>
|
|
4790
|
+
<textarea
|
|
4791
|
+
class="modal-textarea"
|
|
4792
|
+
placeholder="[ { "key": "firstname", "label": "First Name", "type": "text" } ]"
|
|
4793
|
+
[(ngModel)]="importSchemaText"
|
|
4794
|
+
></textarea>
|
|
4795
|
+
@if (importError()) {
|
|
4796
|
+
<div class="modal-error-banner">{{ importError() }}</div>
|
|
4797
|
+
}
|
|
4798
|
+
<div class="modal-actions">
|
|
4799
|
+
<button class="modal-action-btn cancel" (click)="importSchemaPopupOpen.set(false)">Cancel</button>
|
|
4800
|
+
<button class="modal-action-btn primary" (click)="importSchema()">Import</button>
|
|
4801
|
+
</div>
|
|
4802
|
+
</div>
|
|
4803
|
+
</div>
|
|
4804
|
+
}
|
|
4805
|
+
</div>
|
|
4806
|
+
`, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-form-designer-container{display:flex;flex-direction:column;height:100%;min-height:580px;background:var(--ngx-designer-bg, #f8fafc);color:var(--ngx-designer-text, #0f172a);font-family:var(--ngx-font-family, sans-serif);border-radius:12px;overflow:hidden;border:1px solid var(--ngx-designer-border, #e2e8f0)}.ngx-form-designer-container.dark-mode{--ngx-designer-bg: #0f172a;--ngx-designer-text: #f8fafc;--ngx-designer-border: #334155}.designer-header{display:flex;justify-content:space-between;align-items:center;padding:14px 20px;border-bottom:1px solid var(--ngx-designer-border, #e2e8f0);background:var(--ngx-designer-bg, #ffffff)}.designer-title{margin:0;font-size:16px;font-weight:700}.designer-header-actions{display:flex;gap:10px}.header-action-btn{border:1px solid var(--ngx-designer-border, #e2e8f0);background:transparent;padding:7px 14px;border-radius:6px;font-size:12px;font-weight:600;color:inherit;cursor:pointer;transition:all .15s}.header-action-btn:hover{background:#00000008}.header-action-btn.primary{background:var(--primary-color, #4f46e5);color:#fff;border:none}.header-action-btn.primary:hover{background:var(--primary-hover, #4338ca)}.designer-workspace{display:grid;grid-template-columns:240px 1fr 340px;flex:1;height:calc(100% - 60px);overflow:hidden}@media (max-width: 950px){.designer-workspace{grid-template-columns:200px 1fr}.inspector-panel{grid-column:1 / span 2;border-top:1px solid var(--ngx-designer-border, #e2e8f0);height:auto}}.designer-panel{display:flex;flex-direction:column;overflow:hidden;background:var(--ngx-designer-panel-bg, #ffffff)}.dark-mode .designer-panel{--ngx-designer-panel-bg: #1e293b}.toolbox-panel{border-right:1px solid var(--ngx-designer-border, #e2e8f0);padding:16px}.panel-title{margin:0;font-size:14px;font-weight:700}.panel-subtitle{margin:4px 0 16px;font-size:11px;opacity:.6}.toolbox-items{display:flex;flex-direction:column;gap:10px;overflow-y:auto}.toolbox-card{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px dashed var(--ngx-designer-border, #cbd5e1);border-radius:8px;cursor:grab;font-size:12px;font-weight:600;transition:all .2s}.toolbox-card:hover{border-color:var(--primary-color, #4f46e5);background:#4f46e508}.toolbox-icon{font-size:16px}.canvas-panel{border-right:1px solid var(--ngx-designer-border, #e2e8f0);background:var(--ngx-designer-canvas-bg, #f1f5f9);padding:16px}.dark-mode .canvas-panel{--ngx-designer-canvas-bg: #0f172a}.panel-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.field-count-badge{font-size:10px;font-weight:700;background:#0000000f;padding:3px 8px;border-radius:12px}.dark-mode .field-count-badge{background:#ffffff14}.canvas-dropzone{flex:1;border:2px dashed var(--ngx-designer-border, #cbd5e1);border-radius:10px;background:var(--ngx-designer-panel-bg, #ffffff);padding:16px;overflow-y:auto;transition:all .2s;min-height:250px}.canvas-dropzone.drag-over{border-color:var(--primary-color, #4f46e5);background:#4f46e505}.canvas-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-align:center;opacity:.5;padding:40px 10px}.placeholder-icon{font-size:32px;margin-bottom:10px}.placeholder-text{font-size:12px;max-width:200px;margin:0}.canvas-fields-list{display:flex;flex-direction:column;gap:12px}.canvas-field-row{display:flex;align-items:center;padding:12px 14px;border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:8px;background:var(--ngx-designer-panel-bg, #ffffff);cursor:pointer;position:relative;transition:all .2s}.canvas-field-row:hover{box-shadow:0 4px 12px #0000000a;border-color:var(--ngx-designer-border-hover, #cbd5e1)}.canvas-field-row.selected{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 2px #4f46e514;background:#4f46e503}.canvas-field-row.dragging{opacity:.4;border-style:dashed}.canvas-field-row.drag-over{border-top:2px solid var(--primary-color, #4f46e5)}.field-drag-handle{cursor:grab;margin-right:12px;opacity:.3;font-size:16px;-webkit-user-select:none;user-select:none}.field-details{flex:1;display:flex;flex-direction:column;gap:2px}.field-header{display:flex;gap:8px;align-items:center;margin-bottom:2px}.field-type-badge{font-size:9px;font-weight:700;text-transform:uppercase;background:#4f46e514;color:var(--primary-color, #4f46e5);padding:1px 6px;border-radius:4px}.field-key-badge{font-size:9px;font-family:monospace;opacity:.5}.field-label-text{font-size:13px;font-weight:600}.req-star{color:#dc2626}.field-placeholder-text{font-size:10px;opacity:.5}.delete-field-btn{background:transparent;border:0;color:#ef4444;cursor:pointer;font-size:12px;font-weight:700;opacity:.3;padding:6px;border-radius:4px;transition:all .15s}.canvas-field-row:hover .delete-field-btn{opacity:1}.delete-field-btn:hover{background:#ef44440f}.inspector-panel{padding:0}.inspector-tabs{display:flex;border-bottom:1px solid var(--ngx-designer-border, #e2e8f0)}.tab-btn{flex:1;border:0;background:transparent;padding:12px 6px;font-size:11px;font-weight:700;color:inherit;opacity:.6;cursor:pointer;border-bottom:2px solid transparent;transition:all .2s}.tab-btn:hover{opacity:.9}.tab-btn.active{opacity:1;border-bottom-color:var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5)}.tab-content{flex:1;overflow-y:auto;padding:16px}.inspector-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-align:center;opacity:.5;padding:40px 10px}.inspector-placeholder span{font-size:32px;margin-bottom:10px}.inspector-placeholder p{font-size:11px;margin:0;max-width:180px}.properties-form{display:flex;flex-direction:column;gap:14px}.inspector-field{display:flex;flex-direction:column;gap:4px}.inspector-label{font-size:11px;font-weight:700;opacity:.7}.properties-form input[type=text],.properties-form input[type=number]{width:100%;border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:6px;background:transparent;color:inherit;padding:8px 10px;font-size:12px;outline:none;transition:border-color .2s}.properties-form input[type=text]:focus,.properties-form input[type=number]:focus{border-color:var(--primary-color, #4f46e5)}.properties-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}.checkbox-row{display:flex;flex-direction:column;gap:8px;margin:6px 0}.inspector-checkbox{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:600;cursor:pointer}.inspector-checkbox input{accent-color:var(--primary-color, #4f46e5)}.options-editor-section{border-top:1px solid var(--ngx-designer-border, #e2e8f0);padding-top:14px;margin-top:6px}.options-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.add-opt-btn{background:transparent;border:0;color:var(--primary-color, #4f46e5);font-size:11px;font-weight:700;cursor:pointer}.options-list{display:flex;flex-direction:column;gap:8px}.option-edit-row{display:grid;grid-template-columns:1fr 1fr 24px;gap:6px;align-items:center}.option-edit-row input{border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:4px;padding:5px 8px;font-size:11px;background:transparent;color:inherit}.delete-opt-btn{background:transparent;border:0;color:#ef4444;cursor:pointer;font-size:11px;font-weight:700}.schema-actions{display:flex;justify-content:flex-end;margin-bottom:10px}.schema-action-btn{border:0;background:var(--primary-color, #4f46e5);color:#fff;border-radius:5px;padding:6px 12px;font-size:11px;font-weight:600;cursor:pointer}.schema-code-block{background:#00000008;padding:12px;border-radius:8px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;margin:0}.dark-mode .schema-code-block{background:#ffffff08}.preview-card{border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:8px;padding:16px;background:var(--ngx-designer-panel-bg, #ffffff)}.preview-submit-banner{margin-top:14px;padding:10px 12px;background:#10b98114;border:1px solid rgba(16,185,129,.15);border-radius:6px}.banner-title{font-size:11px;font-weight:700;color:#059669}.preview-submit-banner pre{margin:6px 0 0;font-family:monospace;font-size:10px;overflow-x:auto}.designer-modal-overlay{position:fixed;inset:0;background:#00000073;backdrop-filter:blur(4px);display:flex;align-items:center;justify-content:center;z-index:1000}.designer-modal-card{background:var(--ngx-designer-panel-bg, #ffffff);border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:12px;padding:20px;width:420px;box-shadow:0 10px 25px #0000001a;display:flex;flex-direction:column;gap:10px}.modal-title{margin:0;font-size:14px;font-weight:700}.modal-subtitle{margin:0;font-size:11px;opacity:.6}.modal-textarea{width:100%;height:140px;border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:6px;background:transparent;color:inherit;padding:8px 10px;font-family:monospace;font-size:11px;outline:none;resize:none}.modal-error-banner{color:#dc2626;font-size:10px;font-weight:600}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}.modal-action-btn{border:0;border-radius:5px;padding:7px 14px;font-size:12px;font-weight:600;cursor:pointer}.modal-action-btn.cancel{background:transparent;border:1px solid var(--ngx-designer-border, #cbd5e1);color:inherit}.modal-action-btn.primary{background:var(--primary-color, #4f46e5);color:#fff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.JsonPipe, name: "json" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: FormBuilderComponent, selector: "ngx-form-builder", inputs: ["fields", "value", "showSubmit", "submitLabel"], outputs: ["valueChange", "formSubmit"] }] });
|
|
4807
|
+
}
|
|
4808
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FormDesignerComponent, decorators: [{
|
|
4809
|
+
type: Component,
|
|
4810
|
+
args: [{ selector: 'ngx-form-designer', standalone: true, imports: [CommonModule, FormsModule, FormBuilderComponent], template: `
|
|
4811
|
+
<div class="ngx-form-designer-container" [class.dark-mode]="theme() === 'dark'">
|
|
4812
|
+
|
|
4813
|
+
<!-- Top Actions Bar -->
|
|
4814
|
+
<div class="designer-header">
|
|
4815
|
+
<h3 class="designer-title">Visual Form Designer</h3>
|
|
4816
|
+
<div class="designer-header-actions">
|
|
4817
|
+
<button class="header-action-btn primary" (click)="importSchemaPopupOpen.set(true)">📥 Import Schema</button>
|
|
4818
|
+
<button class="header-action-btn" (click)="clearAll()">🗑️ Clear All</button>
|
|
4819
|
+
</div>
|
|
4820
|
+
</div>
|
|
4821
|
+
|
|
4822
|
+
<div class="designer-workspace">
|
|
4823
|
+
<!-- 1. Toolbox Panel -->
|
|
4824
|
+
<div class="designer-panel toolbox-panel">
|
|
4825
|
+
<h4 class="panel-title">Toolbox</h4>
|
|
4826
|
+
<p class="panel-subtitle">Drag fields to the canvas</p>
|
|
4827
|
+
|
|
4828
|
+
<div class="toolbox-items">
|
|
4829
|
+
@for (item of toolboxFields; track item.type) {
|
|
4830
|
+
<div
|
|
4831
|
+
class="toolbox-card"
|
|
4832
|
+
draggable="true"
|
|
4833
|
+
(dragstart)="onToolboxDragStart($event, item)"
|
|
4834
|
+
(dragend)="onDragEnd()"
|
|
4835
|
+
>
|
|
4836
|
+
<span class="toolbox-icon">{{ getIconForType(item.type) }}</span>
|
|
4837
|
+
<span class="toolbox-label">{{ item.label }}</span>
|
|
4838
|
+
</div>
|
|
4839
|
+
}
|
|
4840
|
+
</div>
|
|
4841
|
+
</div>
|
|
4842
|
+
|
|
4843
|
+
<!-- 2. Interactive Canvas -->
|
|
4844
|
+
<div class="designer-panel canvas-panel">
|
|
4845
|
+
<div class="panel-header">
|
|
4846
|
+
<h4 class="panel-title">Canvas</h4>
|
|
4847
|
+
<span class="field-count-badge">{{ designerFields().length }} Fields</span>
|
|
4848
|
+
</div>
|
|
4849
|
+
|
|
4850
|
+
<div
|
|
4851
|
+
class="canvas-dropzone"
|
|
4852
|
+
[class.drag-over]="isDraggingOverCanvas && isDraggingFromToolbox"
|
|
4853
|
+
(dragover)="onCanvasDragOver($event)"
|
|
4854
|
+
(dragleave)="onCanvasDragLeave()"
|
|
4855
|
+
(drop)="onCanvasDrop($event)"
|
|
4856
|
+
>
|
|
4857
|
+
@if (designerFields().length === 0) {
|
|
4858
|
+
<div class="canvas-placeholder">
|
|
4859
|
+
<span class="placeholder-icon">🎯</span>
|
|
4860
|
+
<p class="placeholder-text">Drag and drop fields here to start designing your form</p>
|
|
4861
|
+
</div>
|
|
4862
|
+
} @else {
|
|
4863
|
+
<div class="canvas-fields-list">
|
|
4864
|
+
@for (field of designerFields(); track field.key; let idx = $index) {
|
|
4865
|
+
<div
|
|
4866
|
+
class="canvas-field-row"
|
|
4867
|
+
[class.selected]="selectedField()?.key === field.key"
|
|
4868
|
+
[class.drag-over]="dragOverIndex() === idx"
|
|
4869
|
+
[class.dragging]="draggingIndex() === idx"
|
|
4870
|
+
draggable="true"
|
|
4871
|
+
(dragstart)="onCanvasFieldDragStart($event, idx)"
|
|
4872
|
+
(dragover)="onCanvasFieldDragOver($event, idx)"
|
|
4873
|
+
(dragleave)="onCanvasFieldDragLeave()"
|
|
4874
|
+
(drop)="onCanvasFieldDrop($event, idx)"
|
|
4875
|
+
(dragend)="onDragEnd()"
|
|
4876
|
+
(click)="selectField(field)"
|
|
4877
|
+
>
|
|
4878
|
+
<!-- Drag handle -->
|
|
4879
|
+
<div class="field-drag-handle">⋮⋮</div>
|
|
4880
|
+
|
|
4881
|
+
<!-- Content -->
|
|
4882
|
+
<div class="field-details">
|
|
4883
|
+
<div class="field-header">
|
|
4884
|
+
<span class="field-type-badge">{{ field.type || 'text' }}</span>
|
|
4885
|
+
<span class="field-key-badge">{{ field.key }}</span>
|
|
4886
|
+
</div>
|
|
4887
|
+
<span class="field-label-text">{{ field.label }} @if (field.required) { <strong class="req-star">*</strong> }</span>
|
|
4888
|
+
@if (field.placeholder) {
|
|
4889
|
+
<span class="field-placeholder-text">Placeholder: "{{ field.placeholder }}"</span>
|
|
4890
|
+
}
|
|
4891
|
+
</div>
|
|
4892
|
+
|
|
4893
|
+
<!-- Delete button -->
|
|
4894
|
+
<button class="delete-field-btn" (click)="deleteField(field, $event)" title="Delete Field">✕</button>
|
|
4895
|
+
</div>
|
|
4896
|
+
}
|
|
4897
|
+
</div>
|
|
4898
|
+
}
|
|
4899
|
+
</div>
|
|
4900
|
+
</div>
|
|
4901
|
+
|
|
4902
|
+
<!-- 3. Inspector Settings / Schema Panel -->
|
|
4903
|
+
<div class="designer-panel inspector-panel">
|
|
4904
|
+
<div class="inspector-tabs">
|
|
4905
|
+
<button class="tab-btn" [class.active]="activeTab() === 'properties'" (click)="activeTab.set('properties')">Properties</button>
|
|
4906
|
+
<button class="tab-btn" [class.active]="activeTab() === 'schema'" (click)="activeTab.set('schema')">JSON Schema</button>
|
|
4907
|
+
<button class="tab-btn" [class.active]="activeTab() === 'preview'" (click)="activeTab.set('preview')">Live Preview</button>
|
|
4908
|
+
</div>
|
|
4909
|
+
|
|
4910
|
+
<!-- Properties Inspector Tab -->
|
|
4911
|
+
@if (activeTab() === 'properties') {
|
|
4912
|
+
<div class="tab-content properties-content">
|
|
4913
|
+
@if (!selectedField()) {
|
|
4914
|
+
<div class="inspector-placeholder">
|
|
4915
|
+
<span>⚙️</span>
|
|
4916
|
+
<p>Select a field on the canvas to configure its properties.</p>
|
|
4917
|
+
</div>
|
|
4918
|
+
} @else {
|
|
4919
|
+
<div class="properties-form">
|
|
4920
|
+
<label class="inspector-field">
|
|
4921
|
+
<span class="inspector-label">Unique Key</span>
|
|
4922
|
+
<input type="text" [(ngModel)]="selectedField()!.key" (ngModelChange)="onFieldPropertyChange()" />
|
|
4923
|
+
</label>
|
|
4924
|
+
|
|
4925
|
+
<label class="inspector-field">
|
|
4926
|
+
<span class="inspector-label">Field Label</span>
|
|
4927
|
+
<input type="text" [(ngModel)]="selectedField()!.label" (ngModelChange)="onFieldPropertyChange()" />
|
|
4928
|
+
</label>
|
|
4929
|
+
|
|
4930
|
+
@if (selectedField()!.type !== 'checkbox') {
|
|
4931
|
+
<label class="inspector-field">
|
|
4932
|
+
<span class="inspector-label">Placeholder Text</span>
|
|
4933
|
+
<input type="text" [(ngModel)]="selectedField()!.placeholder" (ngModelChange)="onFieldPropertyChange()" />
|
|
4934
|
+
</label>
|
|
4935
|
+
}
|
|
4936
|
+
|
|
4937
|
+
@if (selectedField()!.type === 'number') {
|
|
4938
|
+
<div class="properties-row">
|
|
4939
|
+
<label class="inspector-field">
|
|
4940
|
+
<span class="inspector-label">Min Value</span>
|
|
4941
|
+
<input type="number" [(ngModel)]="selectedField()!.min" (ngModelChange)="onFieldPropertyChange()" />
|
|
4942
|
+
</label>
|
|
4943
|
+
<label class="inspector-field">
|
|
4944
|
+
<span class="inspector-label">Max Value</span>
|
|
4945
|
+
<input type="number" [(ngModel)]="selectedField()!.max" (ngModelChange)="onFieldPropertyChange()" />
|
|
4946
|
+
</label>
|
|
4947
|
+
</div>
|
|
4948
|
+
<label class="inspector-field">
|
|
4949
|
+
<span class="inspector-label">Step</span>
|
|
4950
|
+
<input type="number" [(ngModel)]="selectedField()!.step" (ngModelChange)="onFieldPropertyChange()" />
|
|
4951
|
+
</label>
|
|
4952
|
+
}
|
|
4953
|
+
|
|
4954
|
+
<div class="checkbox-row">
|
|
4955
|
+
<label class="inspector-checkbox">
|
|
4956
|
+
<input type="checkbox" [(ngModel)]="selectedField()!.required" (ngModelChange)="onFieldPropertyChange()" />
|
|
4957
|
+
<span>Required Field</span>
|
|
4958
|
+
</label>
|
|
4959
|
+
|
|
4960
|
+
<label class="inspector-checkbox">
|
|
4961
|
+
<input type="checkbox" [(ngModel)]="selectedField()!.disabled" (ngModelChange)="onFieldPropertyChange()" />
|
|
4962
|
+
<span>Disabled Field</span>
|
|
4963
|
+
</label>
|
|
4964
|
+
</div>
|
|
4965
|
+
|
|
4966
|
+
<!-- Options list editor (for Select fields) -->
|
|
4967
|
+
@if (selectedField()!.type === 'select') {
|
|
4968
|
+
<div class="options-editor-section">
|
|
4969
|
+
<div class="options-header">
|
|
4970
|
+
<span class="inspector-label">Dropdown Options</span>
|
|
4971
|
+
<button class="add-opt-btn" (click)="addOption()">➕ Add</button>
|
|
4972
|
+
</div>
|
|
4973
|
+
|
|
4974
|
+
<div class="options-list">
|
|
4975
|
+
@for (opt of selectedField()!.options || []; track $index; let oidx = $index) {
|
|
4976
|
+
<div class="option-edit-row">
|
|
4977
|
+
<input type="text" placeholder="Label" [(ngModel)]="opt.label" (ngModelChange)="onFieldPropertyChange()" />
|
|
4978
|
+
<input type="text" placeholder="Value" [(ngModel)]="opt.value" (ngModelChange)="onFieldPropertyChange()" />
|
|
4979
|
+
<button class="delete-opt-btn" (click)="deleteOption(oidx)" title="Delete Option">✕</button>
|
|
4980
|
+
</div>
|
|
4981
|
+
}
|
|
4982
|
+
</div>
|
|
4983
|
+
</div>
|
|
4984
|
+
}
|
|
4985
|
+
</div>
|
|
4986
|
+
}
|
|
4987
|
+
</div>
|
|
4988
|
+
}
|
|
4989
|
+
|
|
4990
|
+
<!-- JSON Schema Tab -->
|
|
4991
|
+
@if (activeTab() === 'schema') {
|
|
4992
|
+
<div class="tab-content schema-content">
|
|
4993
|
+
<div class="schema-actions">
|
|
4994
|
+
<button class="schema-action-btn" (click)="copySchema()">📋 Copy Schema</button>
|
|
4995
|
+
</div>
|
|
4996
|
+
<pre class="schema-code-block"><code>{{ schemaJsonString() }}</code></pre>
|
|
4997
|
+
</div>
|
|
4998
|
+
}
|
|
4999
|
+
|
|
5000
|
+
<!-- Live Preview Tab -->
|
|
5001
|
+
@if (activeTab() === 'preview') {
|
|
5002
|
+
<div class="tab-content preview-content">
|
|
5003
|
+
<div class="preview-card">
|
|
5004
|
+
<ngx-form-builder
|
|
5005
|
+
[fields]="designerFields()"
|
|
5006
|
+
[showSubmit]="true"
|
|
5007
|
+
submitLabel="Test Submit"
|
|
5008
|
+
(formSubmit)="onPreviewSubmit($event)"
|
|
5009
|
+
></ngx-form-builder>
|
|
5010
|
+
</div>
|
|
5011
|
+
@if (previewSubmitData()) {
|
|
5012
|
+
<div class="preview-submit-banner">
|
|
5013
|
+
<span class="banner-title">Form Submitted Data:</span>
|
|
5014
|
+
<pre><code>{{ previewSubmitData() | json }}</code></pre>
|
|
5015
|
+
</div>
|
|
5016
|
+
}
|
|
5017
|
+
</div>
|
|
5018
|
+
}
|
|
5019
|
+
</div>
|
|
5020
|
+
</div>
|
|
5021
|
+
|
|
5022
|
+
<!-- Popups / Modals -->
|
|
5023
|
+
@if (importSchemaPopupOpen()) {
|
|
5024
|
+
<div class="designer-modal-overlay">
|
|
5025
|
+
<div class="designer-modal-card">
|
|
5026
|
+
<h4 class="modal-title">Import JSON Schema</h4>
|
|
5027
|
+
<p class="modal-subtitle">Paste a valid FormBuilderField[] JSON array below:</p>
|
|
5028
|
+
<textarea
|
|
5029
|
+
class="modal-textarea"
|
|
5030
|
+
placeholder="[ { "key": "firstname", "label": "First Name", "type": "text" } ]"
|
|
5031
|
+
[(ngModel)]="importSchemaText"
|
|
5032
|
+
></textarea>
|
|
5033
|
+
@if (importError()) {
|
|
5034
|
+
<div class="modal-error-banner">{{ importError() }}</div>
|
|
5035
|
+
}
|
|
5036
|
+
<div class="modal-actions">
|
|
5037
|
+
<button class="modal-action-btn cancel" (click)="importSchemaPopupOpen.set(false)">Cancel</button>
|
|
5038
|
+
<button class="modal-action-btn primary" (click)="importSchema()">Import</button>
|
|
5039
|
+
</div>
|
|
5040
|
+
</div>
|
|
5041
|
+
</div>
|
|
5042
|
+
}
|
|
5043
|
+
</div>
|
|
5044
|
+
`, styles: [":host{display:block;width:100%;height:100%}.ngx-form-designer-container{display:flex;flex-direction:column;height:100%;min-height:580px;background:var(--ngx-designer-bg, #f8fafc);color:var(--ngx-designer-text, #0f172a);font-family:var(--ngx-font-family, sans-serif);border-radius:12px;overflow:hidden;border:1px solid var(--ngx-designer-border, #e2e8f0)}.ngx-form-designer-container.dark-mode{--ngx-designer-bg: #0f172a;--ngx-designer-text: #f8fafc;--ngx-designer-border: #334155}.designer-header{display:flex;justify-content:space-between;align-items:center;padding:14px 20px;border-bottom:1px solid var(--ngx-designer-border, #e2e8f0);background:var(--ngx-designer-bg, #ffffff)}.designer-title{margin:0;font-size:16px;font-weight:700}.designer-header-actions{display:flex;gap:10px}.header-action-btn{border:1px solid var(--ngx-designer-border, #e2e8f0);background:transparent;padding:7px 14px;border-radius:6px;font-size:12px;font-weight:600;color:inherit;cursor:pointer;transition:all .15s}.header-action-btn:hover{background:#00000008}.header-action-btn.primary{background:var(--primary-color, #4f46e5);color:#fff;border:none}.header-action-btn.primary:hover{background:var(--primary-hover, #4338ca)}.designer-workspace{display:grid;grid-template-columns:240px 1fr 340px;flex:1;height:calc(100% - 60px);overflow:hidden}@media (max-width: 950px){.designer-workspace{grid-template-columns:200px 1fr}.inspector-panel{grid-column:1 / span 2;border-top:1px solid var(--ngx-designer-border, #e2e8f0);height:auto}}.designer-panel{display:flex;flex-direction:column;overflow:hidden;background:var(--ngx-designer-panel-bg, #ffffff)}.dark-mode .designer-panel{--ngx-designer-panel-bg: #1e293b}.toolbox-panel{border-right:1px solid var(--ngx-designer-border, #e2e8f0);padding:16px}.panel-title{margin:0;font-size:14px;font-weight:700}.panel-subtitle{margin:4px 0 16px;font-size:11px;opacity:.6}.toolbox-items{display:flex;flex-direction:column;gap:10px;overflow-y:auto}.toolbox-card{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px dashed var(--ngx-designer-border, #cbd5e1);border-radius:8px;cursor:grab;font-size:12px;font-weight:600;transition:all .2s}.toolbox-card:hover{border-color:var(--primary-color, #4f46e5);background:#4f46e508}.toolbox-icon{font-size:16px}.canvas-panel{border-right:1px solid var(--ngx-designer-border, #e2e8f0);background:var(--ngx-designer-canvas-bg, #f1f5f9);padding:16px}.dark-mode .canvas-panel{--ngx-designer-canvas-bg: #0f172a}.panel-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.field-count-badge{font-size:10px;font-weight:700;background:#0000000f;padding:3px 8px;border-radius:12px}.dark-mode .field-count-badge{background:#ffffff14}.canvas-dropzone{flex:1;border:2px dashed var(--ngx-designer-border, #cbd5e1);border-radius:10px;background:var(--ngx-designer-panel-bg, #ffffff);padding:16px;overflow-y:auto;transition:all .2s;min-height:250px}.canvas-dropzone.drag-over{border-color:var(--primary-color, #4f46e5);background:#4f46e505}.canvas-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-align:center;opacity:.5;padding:40px 10px}.placeholder-icon{font-size:32px;margin-bottom:10px}.placeholder-text{font-size:12px;max-width:200px;margin:0}.canvas-fields-list{display:flex;flex-direction:column;gap:12px}.canvas-field-row{display:flex;align-items:center;padding:12px 14px;border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:8px;background:var(--ngx-designer-panel-bg, #ffffff);cursor:pointer;position:relative;transition:all .2s}.canvas-field-row:hover{box-shadow:0 4px 12px #0000000a;border-color:var(--ngx-designer-border-hover, #cbd5e1)}.canvas-field-row.selected{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 2px #4f46e514;background:#4f46e503}.canvas-field-row.dragging{opacity:.4;border-style:dashed}.canvas-field-row.drag-over{border-top:2px solid var(--primary-color, #4f46e5)}.field-drag-handle{cursor:grab;margin-right:12px;opacity:.3;font-size:16px;-webkit-user-select:none;user-select:none}.field-details{flex:1;display:flex;flex-direction:column;gap:2px}.field-header{display:flex;gap:8px;align-items:center;margin-bottom:2px}.field-type-badge{font-size:9px;font-weight:700;text-transform:uppercase;background:#4f46e514;color:var(--primary-color, #4f46e5);padding:1px 6px;border-radius:4px}.field-key-badge{font-size:9px;font-family:monospace;opacity:.5}.field-label-text{font-size:13px;font-weight:600}.req-star{color:#dc2626}.field-placeholder-text{font-size:10px;opacity:.5}.delete-field-btn{background:transparent;border:0;color:#ef4444;cursor:pointer;font-size:12px;font-weight:700;opacity:.3;padding:6px;border-radius:4px;transition:all .15s}.canvas-field-row:hover .delete-field-btn{opacity:1}.delete-field-btn:hover{background:#ef44440f}.inspector-panel{padding:0}.inspector-tabs{display:flex;border-bottom:1px solid var(--ngx-designer-border, #e2e8f0)}.tab-btn{flex:1;border:0;background:transparent;padding:12px 6px;font-size:11px;font-weight:700;color:inherit;opacity:.6;cursor:pointer;border-bottom:2px solid transparent;transition:all .2s}.tab-btn:hover{opacity:.9}.tab-btn.active{opacity:1;border-bottom-color:var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5)}.tab-content{flex:1;overflow-y:auto;padding:16px}.inspector-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-align:center;opacity:.5;padding:40px 10px}.inspector-placeholder span{font-size:32px;margin-bottom:10px}.inspector-placeholder p{font-size:11px;margin:0;max-width:180px}.properties-form{display:flex;flex-direction:column;gap:14px}.inspector-field{display:flex;flex-direction:column;gap:4px}.inspector-label{font-size:11px;font-weight:700;opacity:.7}.properties-form input[type=text],.properties-form input[type=number]{width:100%;border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:6px;background:transparent;color:inherit;padding:8px 10px;font-size:12px;outline:none;transition:border-color .2s}.properties-form input[type=text]:focus,.properties-form input[type=number]:focus{border-color:var(--primary-color, #4f46e5)}.properties-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}.checkbox-row{display:flex;flex-direction:column;gap:8px;margin:6px 0}.inspector-checkbox{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:600;cursor:pointer}.inspector-checkbox input{accent-color:var(--primary-color, #4f46e5)}.options-editor-section{border-top:1px solid var(--ngx-designer-border, #e2e8f0);padding-top:14px;margin-top:6px}.options-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.add-opt-btn{background:transparent;border:0;color:var(--primary-color, #4f46e5);font-size:11px;font-weight:700;cursor:pointer}.options-list{display:flex;flex-direction:column;gap:8px}.option-edit-row{display:grid;grid-template-columns:1fr 1fr 24px;gap:6px;align-items:center}.option-edit-row input{border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:4px;padding:5px 8px;font-size:11px;background:transparent;color:inherit}.delete-opt-btn{background:transparent;border:0;color:#ef4444;cursor:pointer;font-size:11px;font-weight:700}.schema-actions{display:flex;justify-content:flex-end;margin-bottom:10px}.schema-action-btn{border:0;background:var(--primary-color, #4f46e5);color:#fff;border-radius:5px;padding:6px 12px;font-size:11px;font-weight:600;cursor:pointer}.schema-code-block{background:#00000008;padding:12px;border-radius:8px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;margin:0}.dark-mode .schema-code-block{background:#ffffff08}.preview-card{border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:8px;padding:16px;background:var(--ngx-designer-panel-bg, #ffffff)}.preview-submit-banner{margin-top:14px;padding:10px 12px;background:#10b98114;border:1px solid rgba(16,185,129,.15);border-radius:6px}.banner-title{font-size:11px;font-weight:700;color:#059669}.preview-submit-banner pre{margin:6px 0 0;font-family:monospace;font-size:10px;overflow-x:auto}.designer-modal-overlay{position:fixed;inset:0;background:#00000073;backdrop-filter:blur(4px);display:flex;align-items:center;justify-content:center;z-index:1000}.designer-modal-card{background:var(--ngx-designer-panel-bg, #ffffff);border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:12px;padding:20px;width:420px;box-shadow:0 10px 25px #0000001a;display:flex;flex-direction:column;gap:10px}.modal-title{margin:0;font-size:14px;font-weight:700}.modal-subtitle{margin:0;font-size:11px;opacity:.6}.modal-textarea{width:100%;height:140px;border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:6px;background:transparent;color:inherit;padding:8px 10px;font-family:monospace;font-size:11px;outline:none;resize:none}.modal-error-banner{color:#dc2626;font-size:10px;font-weight:600}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}.modal-action-btn{border:0;border-radius:5px;padding:7px 14px;font-size:12px;font-weight:600;cursor:pointer}.modal-action-btn.cancel{background:transparent;border:1px solid var(--ngx-designer-border, #cbd5e1);color:inherit}.modal-action-btn.primary{background:var(--primary-color, #4f46e5);color:#fff}\n"] }]
|
|
5045
|
+
}], ctorParameters: () => [] });
|
|
5046
|
+
|
|
4336
5047
|
class SignaturePadComponent {
|
|
4337
5048
|
canvasRef;
|
|
4338
5049
|
width = input(520);
|
|
@@ -4458,5 +5169,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
4458
5169
|
* Generated bundle index. Do not edit.
|
|
4459
5170
|
*/
|
|
4460
5171
|
|
|
4461
|
-
export { AutocompleteComponent, CheckboxComponent, ColorPickerComponent, DatePickerComponent, DateRangePickerComponent, DropdownComponent, FilePreviewComponent, FileUploadComponent, FormBuilderComponent, MultiSelectComponent, NumericTextBoxComponent, RadioGroupComponent, RatingComponent, SegmentedControlComponent, SignaturePadComponent, SliderComponent, SwitchComponent, TagInputComponent, TextBoxComponent, TextareaComponent, TimePickerComponent };
|
|
5172
|
+
export { AutocompleteComponent, CheckboxComponent, ColorPickerComponent, DatePickerComponent, DateRangePickerComponent, DropdownComponent, FilePreviewComponent, FileUploadComponent, FormBuilderComponent, FormDesignerComponent, MultiSelectComponent, NumericTextBoxComponent, RadioGroupComponent, RatingComponent, SegmentedControlComponent, SignaturePadComponent, SliderComponent, SwitchComponent, TagInputComponent, TextBoxComponent, TextareaComponent, TimePickerComponent };
|
|
4462
5173
|
//# sourceMappingURL=ngx-core-components-inputs.mjs.map
|