ngx-core-components 0.3.6 → 0.3.7
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/charts/combo-chart/combo-chart.component.d.ts +58 -0
- package/charts/public-api.d.ts +3 -0
- package/charts/scatter-plot/scatter-plot.component.d.ts +66 -0
- package/fesm2022/ngx-core-components-charts.mjs +821 -1
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-grid.mjs +1085 -145
- package/fesm2022/ngx-core-components-grid.mjs.map +1 -1
- package/fesm2022/ngx-core-components-inputs.mjs +545 -63
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
- package/fesm2022/ngx-core-components-navigation.mjs +122 -1
- package/fesm2022/ngx-core-components-navigation.mjs.map +1 -1
- package/fesm2022/ngx-core-components-views.mjs +1043 -445
- package/fesm2022/ngx-core-components-views.mjs.map +1 -1
- package/fesm2022/ngx-core-components.mjs +5 -5
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/grid/data-grid/data-grid.component.d.ts +74 -6
- package/grid/pivot-grid/pivot-grid.component.d.ts +32 -0
- package/grid/public-api.d.ts +2 -0
- package/inputs/date-range-picker/date-range-picker.component.d.ts +41 -5
- package/inputs/form-builder/form-builder.component.d.ts +36 -0
- package/inputs/public-api.d.ts +3 -0
- package/inputs/signature-pad/signature-pad.component.d.ts +24 -0
- package/navigation/context-menu/context-menu.component.d.ts +23 -0
- package/navigation/public-api.d.ts +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +13 -8
- package/views/json-viewer/json-viewer.component.d.ts +18 -0
- package/views/kanban/kanban.component.d.ts +38 -18
- package/views/kanban/models.d.ts +21 -0
- package/views/org-chart/org-chart.component.d.ts +18 -0
- package/views/public-api.d.ts +5 -2
- package/views/scheduler/models.d.ts +12 -1
- package/views/scheduler/scheduler.component.d.ts +58 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, signal, computed, forwardRef, ChangeDetectionStrategy, Component, inject, ElementRef, HostListener, effect, model } from '@angular/core';
|
|
2
|
+
import { input, output, signal, computed, forwardRef, ChangeDetectionStrategy, Component, inject, ElementRef, HostListener, effect, model, ViewChild } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
5
5
|
import { CommonModule } from '@angular/common';
|
|
@@ -2104,6 +2104,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
2104
2104
|
|
|
2105
2105
|
class DateRangePickerComponent {
|
|
2106
2106
|
label = input('');
|
|
2107
|
+
start = input(null);
|
|
2108
|
+
end = input(null);
|
|
2109
|
+
min = input(null);
|
|
2110
|
+
max = input(null);
|
|
2111
|
+
disabledDates = input([]);
|
|
2112
|
+
presets = input(DateRangePickerComponent.createDefaultPresets());
|
|
2113
|
+
weekStartsOn = input(0);
|
|
2114
|
+
disabled = input(false);
|
|
2107
2115
|
startDate = signal('');
|
|
2108
2116
|
endDate = signal('');
|
|
2109
2117
|
open = signal(false);
|
|
@@ -2111,140 +2119,327 @@ class DateRangePickerComponent {
|
|
|
2111
2119
|
viewMonth = signal(new Date().getMonth());
|
|
2112
2120
|
viewYear = signal(new Date().getFullYear());
|
|
2113
2121
|
rangeChange = output();
|
|
2114
|
-
|
|
2122
|
+
openChange = output();
|
|
2115
2123
|
monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
this.
|
|
2120
|
-
this.
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
this.
|
|
2124
|
+
baseWeekDays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
2125
|
+
syncInputs = effect(() => {
|
|
2126
|
+
const start = this.toDateString(this.start());
|
|
2127
|
+
const end = this.toDateString(this.end());
|
|
2128
|
+
this.startDate.set(start);
|
|
2129
|
+
this.endDate.set(end);
|
|
2130
|
+
const initialView = this.parseLocalDate(start || end);
|
|
2131
|
+
if (initialView) {
|
|
2132
|
+
this.viewMonth.set(initialView.getMonth());
|
|
2133
|
+
this.viewYear.set(initialView.getFullYear());
|
|
2134
|
+
}
|
|
2135
|
+
});
|
|
2136
|
+
weekDays = computed(() => {
|
|
2137
|
+
const start = this.weekStartsOn();
|
|
2138
|
+
return [...this.baseWeekDays.slice(start), ...this.baseWeekDays.slice(0, start)];
|
|
2139
|
+
});
|
|
2130
2140
|
calendarDays = computed(() => {
|
|
2131
|
-
const y = this.viewYear()
|
|
2132
|
-
const
|
|
2141
|
+
const y = this.viewYear();
|
|
2142
|
+
const m = this.viewMonth();
|
|
2143
|
+
const firstDay = new Date(y, m, 1).getDay();
|
|
2144
|
+
const offset = (firstDay - this.weekStartsOn() + 7) % 7;
|
|
2133
2145
|
const days = [];
|
|
2134
|
-
const today = new Date();
|
|
2135
|
-
|
|
2136
|
-
const
|
|
2137
|
-
const e = this.endDate() ? new Date(this.endDate()) : null;
|
|
2146
|
+
const today = this.startOfDay(new Date());
|
|
2147
|
+
const s = this.parseLocalDate(this.startDate());
|
|
2148
|
+
const e = this.parseLocalDate(this.endDate());
|
|
2138
2149
|
for (let i = 0; i < 42; i++) {
|
|
2139
|
-
const date = new Date(y, m, i -
|
|
2140
|
-
|
|
2141
|
-
const ds = date.toISOString().split('T')[0];
|
|
2150
|
+
const date = this.startOfDay(new Date(y, m, i - offset + 1));
|
|
2151
|
+
const key = this.formatLocalDate(date);
|
|
2142
2152
|
days.push({
|
|
2143
|
-
key
|
|
2153
|
+
key,
|
|
2154
|
+
date,
|
|
2155
|
+
inMonth: date.getMonth() === m,
|
|
2144
2156
|
isToday: date.getTime() === today.getTime(),
|
|
2145
2157
|
isStart: s ? date.getTime() === s.getTime() : false,
|
|
2146
2158
|
isEnd: e ? date.getTime() === e.getTime() : false,
|
|
2147
|
-
inRange: s && e
|
|
2159
|
+
inRange: !!(s && e && date > s && date < e),
|
|
2160
|
+
disabled: this.isDateDisabled(date),
|
|
2148
2161
|
});
|
|
2149
2162
|
}
|
|
2150
2163
|
return days;
|
|
2151
2164
|
});
|
|
2152
|
-
|
|
2165
|
+
monthName(m) {
|
|
2166
|
+
return this.monthNames[m] ?? '';
|
|
2167
|
+
}
|
|
2168
|
+
toggleOpen() {
|
|
2169
|
+
if (this.disabled())
|
|
2170
|
+
return;
|
|
2171
|
+
this.open.update(v => {
|
|
2172
|
+
const next = !v;
|
|
2173
|
+
this.openChange.emit(next);
|
|
2174
|
+
return next;
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
prevMonth(e) {
|
|
2178
|
+
e.stopPropagation();
|
|
2179
|
+
if (this.viewMonth() === 0) {
|
|
2180
|
+
this.viewMonth.set(11);
|
|
2181
|
+
this.viewYear.update(y => y - 1);
|
|
2182
|
+
}
|
|
2183
|
+
else {
|
|
2184
|
+
this.viewMonth.update(m => m - 1);
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
nextMonth(e) {
|
|
2153
2188
|
e.stopPropagation();
|
|
2154
|
-
|
|
2155
|
-
|
|
2189
|
+
if (this.viewMonth() === 11) {
|
|
2190
|
+
this.viewMonth.set(0);
|
|
2191
|
+
this.viewYear.update(y => y + 1);
|
|
2192
|
+
}
|
|
2193
|
+
else {
|
|
2194
|
+
this.viewMonth.update(m => m + 1);
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
selectDay(date, e) {
|
|
2198
|
+
e?.stopPropagation();
|
|
2199
|
+
if (this.disabled() || this.isDateDisabled(date))
|
|
2200
|
+
return;
|
|
2201
|
+
const ds = this.formatLocalDate(date);
|
|
2202
|
+
if (this.picking() === 'start' || !this.startDate()) {
|
|
2156
2203
|
this.startDate.set(ds);
|
|
2157
2204
|
this.endDate.set('');
|
|
2158
2205
|
this.picking.set('end');
|
|
2206
|
+
return;
|
|
2207
|
+
}
|
|
2208
|
+
if (ds >= this.startDate()) {
|
|
2209
|
+
this.endDate.set(ds);
|
|
2210
|
+
this.picking.set('start');
|
|
2211
|
+
this.emitRange(ds);
|
|
2212
|
+
this.open.set(false);
|
|
2213
|
+
this.openChange.emit(false);
|
|
2159
2214
|
}
|
|
2160
2215
|
else {
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
this.picking.set('start');
|
|
2164
|
-
this.rangeChange.emit({ start: this.startDate(), end: ds });
|
|
2165
|
-
this.open.set(false);
|
|
2166
|
-
}
|
|
2167
|
-
else {
|
|
2168
|
-
this.startDate.set(ds);
|
|
2169
|
-
}
|
|
2216
|
+
this.startDate.set(ds);
|
|
2217
|
+
this.endDate.set('');
|
|
2170
2218
|
}
|
|
2171
2219
|
}
|
|
2220
|
+
applyPreset(preset) {
|
|
2221
|
+
const start = this.toDateString(preset.start);
|
|
2222
|
+
const end = this.toDateString(preset.end);
|
|
2223
|
+
if (!start || !end)
|
|
2224
|
+
return;
|
|
2225
|
+
this.startDate.set(start);
|
|
2226
|
+
this.endDate.set(end);
|
|
2227
|
+
this.picking.set('start');
|
|
2228
|
+
const view = this.parseLocalDate(start);
|
|
2229
|
+
if (view) {
|
|
2230
|
+
this.viewMonth.set(view.getMonth());
|
|
2231
|
+
this.viewYear.set(view.getFullYear());
|
|
2232
|
+
}
|
|
2233
|
+
this.rangeChange.emit({ start, end });
|
|
2234
|
+
this.open.set(false);
|
|
2235
|
+
this.openChange.emit(false);
|
|
2236
|
+
}
|
|
2237
|
+
onDayKeydown(event, date) {
|
|
2238
|
+
const deltas = {
|
|
2239
|
+
ArrowLeft: -1,
|
|
2240
|
+
ArrowRight: 1,
|
|
2241
|
+
ArrowUp: -7,
|
|
2242
|
+
ArrowDown: 7,
|
|
2243
|
+
};
|
|
2244
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
2245
|
+
event.preventDefault();
|
|
2246
|
+
this.selectDay(date, event);
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2249
|
+
const delta = deltas[event.key];
|
|
2250
|
+
if (!delta)
|
|
2251
|
+
return;
|
|
2252
|
+
event.preventDefault();
|
|
2253
|
+
const next = new Date(date);
|
|
2254
|
+
next.setDate(date.getDate() + delta);
|
|
2255
|
+
this.viewMonth.set(next.getMonth());
|
|
2256
|
+
this.viewYear.set(next.getFullYear());
|
|
2257
|
+
queueMicrotask(() => {
|
|
2258
|
+
const target = document.querySelector(`.cal-day[data-date="${this.formatLocalDate(next)}"]:not(:disabled)`);
|
|
2259
|
+
target?.focus();
|
|
2260
|
+
});
|
|
2261
|
+
}
|
|
2262
|
+
emitRange(end) {
|
|
2263
|
+
this.rangeChange.emit({ start: this.startDate(), end });
|
|
2264
|
+
}
|
|
2265
|
+
isDateDisabled(date) {
|
|
2266
|
+
const min = this.parseLocalDate(this.toDateString(this.min()));
|
|
2267
|
+
const max = this.parseLocalDate(this.toDateString(this.max()));
|
|
2268
|
+
const key = this.formatLocalDate(date);
|
|
2269
|
+
const disabledSet = new Set(this.disabledDates().map(item => this.toDateString(item)).filter(Boolean));
|
|
2270
|
+
return !!((min && date < min) || (max && date > max) || disabledSet.has(key));
|
|
2271
|
+
}
|
|
2272
|
+
parseLocalDate(value) {
|
|
2273
|
+
if (!value)
|
|
2274
|
+
return null;
|
|
2275
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
2276
|
+
if (!year || !month || !day)
|
|
2277
|
+
return null;
|
|
2278
|
+
return this.startOfDay(new Date(year, month - 1, day));
|
|
2279
|
+
}
|
|
2280
|
+
toDateString(value) {
|
|
2281
|
+
if (!value)
|
|
2282
|
+
return '';
|
|
2283
|
+
if (value instanceof Date)
|
|
2284
|
+
return this.formatLocalDate(value);
|
|
2285
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value))
|
|
2286
|
+
return value;
|
|
2287
|
+
const parsed = new Date(value);
|
|
2288
|
+
return Number.isNaN(parsed.getTime()) ? '' : this.formatLocalDate(parsed);
|
|
2289
|
+
}
|
|
2290
|
+
formatLocalDate(date) {
|
|
2291
|
+
const year = date.getFullYear();
|
|
2292
|
+
const month = `${date.getMonth() + 1}`.padStart(2, '0');
|
|
2293
|
+
const day = `${date.getDate()}`.padStart(2, '0');
|
|
2294
|
+
return `${year}-${month}-${day}`;
|
|
2295
|
+
}
|
|
2296
|
+
startOfDay(date) {
|
|
2297
|
+
const next = new Date(date);
|
|
2298
|
+
next.setHours(0, 0, 0, 0);
|
|
2299
|
+
return next;
|
|
2300
|
+
}
|
|
2301
|
+
static createDefaultPresets() {
|
|
2302
|
+
const today = new Date();
|
|
2303
|
+
const lastSevenStart = new Date(today);
|
|
2304
|
+
lastSevenStart.setDate(today.getDate() - 6);
|
|
2305
|
+
const monthStart = new Date(today.getFullYear(), today.getMonth(), 1);
|
|
2306
|
+
const monthEnd = new Date(today.getFullYear(), today.getMonth() + 1, 0);
|
|
2307
|
+
return [
|
|
2308
|
+
{ label: 'Today', start: today, end: today },
|
|
2309
|
+
{ label: 'Last 7 days', start: lastSevenStart, end: today },
|
|
2310
|
+
{ label: 'This month', start: monthStart, end: monthEnd },
|
|
2311
|
+
];
|
|
2312
|
+
}
|
|
2172
2313
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DateRangePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2173
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DateRangePickerComponent, isStandalone: true, selector: "ngx-date-range-picker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rangeChange: "rangeChange" }, ngImport: i0, template: `
|
|
2314
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DateRangePickerComponent, isStandalone: true, selector: "ngx-date-range-picker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, start: { classPropertyName: "start", publicName: "start", isSignal: true, isRequired: false, transformFunction: null }, end: { classPropertyName: "end", publicName: "end", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, presets: { classPropertyName: "presets", publicName: "presets", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rangeChange: "rangeChange", openChange: "openChange" }, ngImport: i0, template: `
|
|
2174
2315
|
<div class="ngx-date-range-picker">
|
|
2175
2316
|
@if (label()) { <label class="drp-label">{{ label() }}</label> }
|
|
2176
|
-
<div
|
|
2177
|
-
|
|
2317
|
+
<div
|
|
2318
|
+
class="drp-inputs"
|
|
2319
|
+
[class.disabled]="disabled()"
|
|
2320
|
+
role="button"
|
|
2321
|
+
tabindex="0"
|
|
2322
|
+
[attr.aria-expanded]="open()"
|
|
2323
|
+
(click)="toggleOpen()"
|
|
2324
|
+
(keydown.enter)="toggleOpen()"
|
|
2325
|
+
(keydown.space)="toggleOpen(); $event.preventDefault()"
|
|
2326
|
+
(keydown.escape)="open.set(false)"
|
|
2327
|
+
>
|
|
2328
|
+
<input class="drp-input" type="text" readonly [value]="startDate()" placeholder="Start date" [disabled]="disabled()" />
|
|
2178
2329
|
<span class="drp-sep">→</span>
|
|
2179
|
-
<input class="drp-input" type="text" readonly [value]="endDate()" placeholder="End date" />
|
|
2330
|
+
<input class="drp-input" type="text" readonly [value]="endDate()" placeholder="End date" [disabled]="disabled()" />
|
|
2180
2331
|
<span class="drp-icon">📅</span>
|
|
2181
2332
|
</div>
|
|
2182
2333
|
@if (open()) {
|
|
2183
|
-
<div class="drp-calendar-wrap">
|
|
2334
|
+
<div class="drp-calendar-wrap" (click)="$event.stopPropagation()">
|
|
2335
|
+
@if (presets().length > 0) {
|
|
2336
|
+
<div class="drp-presets">
|
|
2337
|
+
@for (preset of presets(); track preset.label) {
|
|
2338
|
+
<button class="preset-btn" type="button" (click)="applyPreset(preset)">
|
|
2339
|
+
{{ preset.label }}
|
|
2340
|
+
</button>
|
|
2341
|
+
}
|
|
2342
|
+
</div>
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2184
2345
|
<div class="drp-calendar">
|
|
2185
2346
|
<div class="cal-header">
|
|
2186
|
-
<button class="cal-nav" (click)="prevMonth($event)">‹</button>
|
|
2347
|
+
<button class="cal-nav" type="button" (click)="prevMonth($event)" aria-label="Previous month">‹</button>
|
|
2187
2348
|
<span class="cal-title">{{ monthName(viewMonth()) }} {{ viewYear() }}</span>
|
|
2188
|
-
<button class="cal-nav" (click)="nextMonth($event)">›</button>
|
|
2349
|
+
<button class="cal-nav" type="button" (click)="nextMonth($event)" aria-label="Next month">›</button>
|
|
2189
2350
|
</div>
|
|
2190
|
-
<div class="cal-grid">
|
|
2191
|
-
@for (day of weekDays; track day) { <div class="cal-weekday">{{ day }}</div> }
|
|
2351
|
+
<div class="cal-grid" role="grid">
|
|
2352
|
+
@for (day of weekDays(); track day) { <div class="cal-weekday">{{ day }}</div> }
|
|
2192
2353
|
@for (cell of calendarDays(); track cell.key) {
|
|
2193
|
-
<
|
|
2354
|
+
<button
|
|
2355
|
+
type="button"
|
|
2194
2356
|
class="cal-day"
|
|
2357
|
+
role="gridcell"
|
|
2195
2358
|
[class.other-month]="!cell.inMonth"
|
|
2196
2359
|
[class.in-range]="cell.inRange"
|
|
2197
2360
|
[class.range-start]="cell.isStart"
|
|
2198
2361
|
[class.range-end]="cell.isEnd"
|
|
2199
2362
|
[class.today]="cell.isToday"
|
|
2363
|
+
[class.disabled]="cell.disabled"
|
|
2364
|
+
[attr.data-date]="cell.key"
|
|
2365
|
+
[attr.aria-selected]="cell.isStart || cell.isEnd"
|
|
2366
|
+
[disabled]="cell.disabled"
|
|
2200
2367
|
(click)="selectDay(cell.date, $event)"
|
|
2201
|
-
|
|
2368
|
+
(keydown)="onDayKeydown($event, cell.date)"
|
|
2369
|
+
>{{ cell.date.getDate() }}</button>
|
|
2202
2370
|
}
|
|
2203
2371
|
</div>
|
|
2204
2372
|
</div>
|
|
2205
2373
|
</div>
|
|
2206
2374
|
}
|
|
2207
2375
|
</div>
|
|
2208
|
-
`, isInline: true, styles: [":host{display:block;position:relative}.drp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px}.drp-inputs{display:flex;align-items:center;gap:8px;padding:9px 12px;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);cursor:pointer;background:var(--ngx-input-bg, #fff);transition:all .2s}.drp-inputs:hover{border-color:var(--primary-color, #4f46e5)}.drp-input{border:none;background:transparent;font-size:13px;color:var(--ngx-input-text, #0f172a);outline:none;cursor:pointer;width:85px;font-family:inherit}.drp-sep{color:#94a3b8;font-weight:650}.drp-icon{font-size:14px;color:#64748b;margin-left:auto}.drp-calendar-wrap{position:absolute;top:calc(100% + 6px);left:0;background:var(--bg-secondary, #fff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--ngx-input-radius, 12px);box-shadow:var(--shadow-lg, 0 10px 25px rgba(0,0,0,.08));z-index:1000;padding:14px}.cal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.cal-nav{background:none;border:1px solid var(--border-color, #e2e8f0);border-radius:6px;cursor:pointer;padding:3px 8px;font-size:14px;color:#64748b;transition:all .15s}.cal-nav:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.cal-title{font-weight:750;font-size:13px;color:var(--text-primary, #0f172a);font-family:var(--ngx-heading-font-family, inherit)}.cal-grid{display:grid;grid-template-columns:repeat(7,34px);gap:3px}.cal-weekday{text-align:center;font-size:10px;font-weight:700;color:#94a3b8;padding:4px 0;text-transform:uppercase;letter-spacing:.5px}.cal-day{width:34px;height:34px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:550;border-radius:6px;cursor:pointer;transition:all .15s;color:var(--text-primary, #0f172a)}.cal-day:hover:not(.range-start):not(.range-end){background:var(--border-light, #f1f5f9)}.cal-day.other-month{color:#cbd5e1}.cal-day.in-range{background:var(--primary-glow, rgba(79, 70, 229, .08));color:var(--primary-color, #4f46e5);border-radius:0}.cal-day.range-start,.cal-day.range-end{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-weight:700;border-radius:50%;box-shadow:0 2px 6px #4f46e559}.cal-day.today:not(.range-start):not(.range-end){font-weight:700;border:1.5px solid var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5)}\n"] });
|
|
2376
|
+
`, isInline: true, styles: [":host{display:block;position:relative}.drp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px}.drp-inputs{display:flex;align-items:center;gap:8px;padding:9px 12px;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);cursor:pointer;background:var(--ngx-input-bg, #fff);transition:all .2s}.drp-inputs:hover,.drp-inputs:focus-visible{border-color:var(--primary-color, #4f46e5);outline:none;box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .12))}.drp-inputs.disabled{cursor:not-allowed;opacity:.6;background:var(--ngx-input-disabled-bg, #f8fafc)}.drp-input{border:none;background:transparent;font-size:13px;color:var(--ngx-input-text, #0f172a);outline:none;cursor:pointer;width:85px;font-family:inherit}.drp-input:disabled{cursor:not-allowed;color:var(--text-secondary, #64748b)}.drp-sep{color:#94a3b8;font-weight:650}.drp-icon{font-size:14px;color:#64748b;margin-left:auto}.drp-calendar-wrap{position:absolute;top:calc(100% + 6px);left:0;display:flex;gap:12px;background:var(--bg-secondary, #fff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--ngx-input-radius, 12px);box-shadow:var(--shadow-lg, 0 10px 25px rgba(0,0,0,.08));z-index:1000;padding:14px}.drp-presets{display:flex;flex-direction:column;gap:6px;min-width:112px;padding-right:12px;border-right:1px solid var(--border-color, #e2e8f0)}.preset-btn{border:1px solid transparent;border-radius:6px;background:transparent;color:var(--text-secondary, #64748b);cursor:pointer;font:inherit;font-size:12px;font-weight:650;padding:7px 9px;text-align:left}.preset-btn:hover,.preset-btn:focus-visible{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a);outline:none}.cal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.cal-nav{background:none;border:1px solid var(--border-color, #e2e8f0);border-radius:6px;cursor:pointer;padding:3px 8px;font-size:14px;color:#64748b;transition:all .15s}.cal-nav:hover,.cal-nav:focus-visible{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a);outline:none}.cal-title{font-weight:750;font-size:13px;color:var(--text-primary, #0f172a);font-family:var(--ngx-heading-font-family, inherit)}.cal-grid{display:grid;grid-template-columns:repeat(7,34px);gap:3px}.cal-weekday{text-align:center;font-size:10px;font-weight:700;color:#94a3b8;padding:4px 0;text-transform:uppercase;letter-spacing:.5px}.cal-day{width:34px;height:34px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:550;border-radius:6px;cursor:pointer;transition:all .15s;color:var(--text-primary, #0f172a);border:0;background:transparent;font-family:inherit}.cal-day:hover:not(.range-start):not(.range-end):not(.disabled),.cal-day:focus-visible:not(.range-start):not(.range-end):not(.disabled){background:var(--border-light, #f1f5f9);outline:none}.cal-day.other-month{color:#cbd5e1}.cal-day.disabled{color:#cbd5e1;cursor:not-allowed;text-decoration:line-through}.cal-day.in-range{background:var(--primary-glow, rgba(79, 70, 229, .08));color:var(--primary-color, #4f46e5);border-radius:0}.cal-day.range-start,.cal-day.range-end{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-weight:700;border-radius:50%;box-shadow:0 2px 6px #4f46e559}.cal-day.today:not(.range-start):not(.range-end){font-weight:700;border:1.5px solid var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5)}@media (max-width: 520px){.drp-calendar-wrap{flex-direction:column;width:max-content;max-width:calc(100vw - 32px)}.drp-presets{flex-direction:row;flex-wrap:wrap;min-width:0;padding:0 0 10px;border-right:0;border-bottom:1px solid var(--border-color, #e2e8f0)}}\n"] });
|
|
2209
2377
|
}
|
|
2210
2378
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DateRangePickerComponent, decorators: [{
|
|
2211
2379
|
type: Component,
|
|
2212
2380
|
args: [{ selector: 'ngx-date-range-picker', standalone: true, template: `
|
|
2213
2381
|
<div class="ngx-date-range-picker">
|
|
2214
2382
|
@if (label()) { <label class="drp-label">{{ label() }}</label> }
|
|
2215
|
-
<div
|
|
2216
|
-
|
|
2383
|
+
<div
|
|
2384
|
+
class="drp-inputs"
|
|
2385
|
+
[class.disabled]="disabled()"
|
|
2386
|
+
role="button"
|
|
2387
|
+
tabindex="0"
|
|
2388
|
+
[attr.aria-expanded]="open()"
|
|
2389
|
+
(click)="toggleOpen()"
|
|
2390
|
+
(keydown.enter)="toggleOpen()"
|
|
2391
|
+
(keydown.space)="toggleOpen(); $event.preventDefault()"
|
|
2392
|
+
(keydown.escape)="open.set(false)"
|
|
2393
|
+
>
|
|
2394
|
+
<input class="drp-input" type="text" readonly [value]="startDate()" placeholder="Start date" [disabled]="disabled()" />
|
|
2217
2395
|
<span class="drp-sep">→</span>
|
|
2218
|
-
<input class="drp-input" type="text" readonly [value]="endDate()" placeholder="End date" />
|
|
2396
|
+
<input class="drp-input" type="text" readonly [value]="endDate()" placeholder="End date" [disabled]="disabled()" />
|
|
2219
2397
|
<span class="drp-icon">📅</span>
|
|
2220
2398
|
</div>
|
|
2221
2399
|
@if (open()) {
|
|
2222
|
-
<div class="drp-calendar-wrap">
|
|
2400
|
+
<div class="drp-calendar-wrap" (click)="$event.stopPropagation()">
|
|
2401
|
+
@if (presets().length > 0) {
|
|
2402
|
+
<div class="drp-presets">
|
|
2403
|
+
@for (preset of presets(); track preset.label) {
|
|
2404
|
+
<button class="preset-btn" type="button" (click)="applyPreset(preset)">
|
|
2405
|
+
{{ preset.label }}
|
|
2406
|
+
</button>
|
|
2407
|
+
}
|
|
2408
|
+
</div>
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2223
2411
|
<div class="drp-calendar">
|
|
2224
2412
|
<div class="cal-header">
|
|
2225
|
-
<button class="cal-nav" (click)="prevMonth($event)">‹</button>
|
|
2413
|
+
<button class="cal-nav" type="button" (click)="prevMonth($event)" aria-label="Previous month">‹</button>
|
|
2226
2414
|
<span class="cal-title">{{ monthName(viewMonth()) }} {{ viewYear() }}</span>
|
|
2227
|
-
<button class="cal-nav" (click)="nextMonth($event)">›</button>
|
|
2415
|
+
<button class="cal-nav" type="button" (click)="nextMonth($event)" aria-label="Next month">›</button>
|
|
2228
2416
|
</div>
|
|
2229
|
-
<div class="cal-grid">
|
|
2230
|
-
@for (day of weekDays; track day) { <div class="cal-weekday">{{ day }}</div> }
|
|
2417
|
+
<div class="cal-grid" role="grid">
|
|
2418
|
+
@for (day of weekDays(); track day) { <div class="cal-weekday">{{ day }}</div> }
|
|
2231
2419
|
@for (cell of calendarDays(); track cell.key) {
|
|
2232
|
-
<
|
|
2420
|
+
<button
|
|
2421
|
+
type="button"
|
|
2233
2422
|
class="cal-day"
|
|
2423
|
+
role="gridcell"
|
|
2234
2424
|
[class.other-month]="!cell.inMonth"
|
|
2235
2425
|
[class.in-range]="cell.inRange"
|
|
2236
2426
|
[class.range-start]="cell.isStart"
|
|
2237
2427
|
[class.range-end]="cell.isEnd"
|
|
2238
2428
|
[class.today]="cell.isToday"
|
|
2429
|
+
[class.disabled]="cell.disabled"
|
|
2430
|
+
[attr.data-date]="cell.key"
|
|
2431
|
+
[attr.aria-selected]="cell.isStart || cell.isEnd"
|
|
2432
|
+
[disabled]="cell.disabled"
|
|
2239
2433
|
(click)="selectDay(cell.date, $event)"
|
|
2240
|
-
|
|
2434
|
+
(keydown)="onDayKeydown($event, cell.date)"
|
|
2435
|
+
>{{ cell.date.getDate() }}</button>
|
|
2241
2436
|
}
|
|
2242
2437
|
</div>
|
|
2243
2438
|
</div>
|
|
2244
2439
|
</div>
|
|
2245
2440
|
}
|
|
2246
2441
|
</div>
|
|
2247
|
-
`, styles: [":host{display:block;position:relative}.drp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px}.drp-inputs{display:flex;align-items:center;gap:8px;padding:9px 12px;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);cursor:pointer;background:var(--ngx-input-bg, #fff);transition:all .2s}.drp-inputs:hover{border-color:var(--primary-color, #4f46e5)}.drp-input{border:none;background:transparent;font-size:13px;color:var(--ngx-input-text, #0f172a);outline:none;cursor:pointer;width:85px;font-family:inherit}.drp-sep{color:#94a3b8;font-weight:650}.drp-icon{font-size:14px;color:#64748b;margin-left:auto}.drp-calendar-wrap{position:absolute;top:calc(100% + 6px);left:0;background:var(--bg-secondary, #fff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--ngx-input-radius, 12px);box-shadow:var(--shadow-lg, 0 10px 25px rgba(0,0,0,.08));z-index:1000;padding:14px}.cal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.cal-nav{background:none;border:1px solid var(--border-color, #e2e8f0);border-radius:6px;cursor:pointer;padding:3px 8px;font-size:14px;color:#64748b;transition:all .15s}.cal-nav:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.cal-title{font-weight:750;font-size:13px;color:var(--text-primary, #0f172a);font-family:var(--ngx-heading-font-family, inherit)}.cal-grid{display:grid;grid-template-columns:repeat(7,34px);gap:3px}.cal-weekday{text-align:center;font-size:10px;font-weight:700;color:#94a3b8;padding:4px 0;text-transform:uppercase;letter-spacing:.5px}.cal-day{width:34px;height:34px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:550;border-radius:6px;cursor:pointer;transition:all .15s;color:var(--text-primary, #0f172a)}.cal-day:hover:not(.range-start):not(.range-end){background:var(--border-light, #f1f5f9)}.cal-day.other-month{color:#cbd5e1}.cal-day.in-range{background:var(--primary-glow, rgba(79, 70, 229, .08));color:var(--primary-color, #4f46e5);border-radius:0}.cal-day.range-start,.cal-day.range-end{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-weight:700;border-radius:50%;box-shadow:0 2px 6px #4f46e559}.cal-day.today:not(.range-start):not(.range-end){font-weight:700;border:1.5px solid var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5)}\n"] }]
|
|
2442
|
+
`, styles: [":host{display:block;position:relative}.drp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px}.drp-inputs{display:flex;align-items:center;gap:8px;padding:9px 12px;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);cursor:pointer;background:var(--ngx-input-bg, #fff);transition:all .2s}.drp-inputs:hover,.drp-inputs:focus-visible{border-color:var(--primary-color, #4f46e5);outline:none;box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .12))}.drp-inputs.disabled{cursor:not-allowed;opacity:.6;background:var(--ngx-input-disabled-bg, #f8fafc)}.drp-input{border:none;background:transparent;font-size:13px;color:var(--ngx-input-text, #0f172a);outline:none;cursor:pointer;width:85px;font-family:inherit}.drp-input:disabled{cursor:not-allowed;color:var(--text-secondary, #64748b)}.drp-sep{color:#94a3b8;font-weight:650}.drp-icon{font-size:14px;color:#64748b;margin-left:auto}.drp-calendar-wrap{position:absolute;top:calc(100% + 6px);left:0;display:flex;gap:12px;background:var(--bg-secondary, #fff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--ngx-input-radius, 12px);box-shadow:var(--shadow-lg, 0 10px 25px rgba(0,0,0,.08));z-index:1000;padding:14px}.drp-presets{display:flex;flex-direction:column;gap:6px;min-width:112px;padding-right:12px;border-right:1px solid var(--border-color, #e2e8f0)}.preset-btn{border:1px solid transparent;border-radius:6px;background:transparent;color:var(--text-secondary, #64748b);cursor:pointer;font:inherit;font-size:12px;font-weight:650;padding:7px 9px;text-align:left}.preset-btn:hover,.preset-btn:focus-visible{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a);outline:none}.cal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.cal-nav{background:none;border:1px solid var(--border-color, #e2e8f0);border-radius:6px;cursor:pointer;padding:3px 8px;font-size:14px;color:#64748b;transition:all .15s}.cal-nav:hover,.cal-nav:focus-visible{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a);outline:none}.cal-title{font-weight:750;font-size:13px;color:var(--text-primary, #0f172a);font-family:var(--ngx-heading-font-family, inherit)}.cal-grid{display:grid;grid-template-columns:repeat(7,34px);gap:3px}.cal-weekday{text-align:center;font-size:10px;font-weight:700;color:#94a3b8;padding:4px 0;text-transform:uppercase;letter-spacing:.5px}.cal-day{width:34px;height:34px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:550;border-radius:6px;cursor:pointer;transition:all .15s;color:var(--text-primary, #0f172a);border:0;background:transparent;font-family:inherit}.cal-day:hover:not(.range-start):not(.range-end):not(.disabled),.cal-day:focus-visible:not(.range-start):not(.range-end):not(.disabled){background:var(--border-light, #f1f5f9);outline:none}.cal-day.other-month{color:#cbd5e1}.cal-day.disabled{color:#cbd5e1;cursor:not-allowed;text-decoration:line-through}.cal-day.in-range{background:var(--primary-glow, rgba(79, 70, 229, .08));color:var(--primary-color, #4f46e5);border-radius:0}.cal-day.range-start,.cal-day.range-end{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-weight:700;border-radius:50%;box-shadow:0 2px 6px #4f46e559}.cal-day.today:not(.range-start):not(.range-end){font-weight:700;border:1.5px solid var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5)}@media (max-width: 520px){.drp-calendar-wrap{flex-direction:column;width:max-content;max-width:calc(100vw - 32px)}.drp-presets{flex-direction:row;flex-wrap:wrap;min-width:0;padding:0 0 10px;border-right:0;border-bottom:1px solid var(--border-color, #e2e8f0)}}\n"] }]
|
|
2248
2443
|
}] });
|
|
2249
2444
|
|
|
2250
2445
|
class FileUploadComponent {
|
|
@@ -3271,6 +3466,293 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
3271
3466
|
`, styles: [":host{display:inline-block;min-width:240px}.ngx-segmented-control{position:relative;display:flex;width:100%;background:#0000000a;padding:3px;border-radius:10px;box-sizing:border-box;-webkit-user-select:none;user-select:none;font-family:var(--ngx-font-family, system-ui, sans-serif);border:1px solid rgba(0,0,0,.03)}.ngx-segmented-control.dark{background:#ffffff0f;border-color:#ffffff08}.ngx-segmented-control.disabled{opacity:.55;pointer-events:none}.ngx-segmented-control__indicator{position:absolute;top:3px;left:0;bottom:3px;background:#fff;border-radius:8px;box-shadow:0 1px 3px #0000001a,0 1px 2px #0000000f;transition:transform .26s cubic-bezier(.25,.8,.25,1);z-index:1}.ngx-segmented-control.dark .ngx-segmented-control__indicator{background:#ffffff26;box-shadow:none}.ngx-segmented-control__option{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 12px;font-size:13px;font-weight:600;color:#64748b;background:transparent;border:none;cursor:pointer;z-index:2;transition:color .2s ease;outline:none;height:30px;box-sizing:border-box}.ngx-segmented-control__option:hover:not([disabled]){color:#0f172a}.ngx-segmented-control__option.selected{color:#0f172a}.ngx-segmented-control.dark .ngx-segmented-control__option{color:#94a3b8}.ngx-segmented-control.dark .ngx-segmented-control__option:hover:not([disabled]),.ngx-segmented-control.dark .ngx-segmented-control__option.selected{color:#fff}.ngx-segmented-control__badge{font-size:9px;padding:1px 5px;border-radius:4px;background:#0000000f;color:#475569;font-weight:700;transition:all .2s ease}.ngx-segmented-control__option.selected .ngx-segmented-control__badge{background:#0000001a}.ngx-segmented-control.dark .ngx-segmented-control__badge{background:#ffffff14;color:#cbd5e1}.ngx-segmented-control.dark .ngx-segmented-control__option.selected .ngx-segmented-control__badge{background:#ffffff26}.ngx-segmented-control__indicator.primary{background:var(--primary-color, #3b82f6)}.ngx-segmented-control__indicator.success{background:#10b981}.ngx-segmented-control__indicator.danger{background:#ef4444}.ngx-segmented-control__indicator.warning{background:#f59e0b}.ngx-segmented-control__indicator.info{background:#3b82f6}.ngx-segmented-control__indicator.primary,.ngx-segmented-control__indicator.success,.ngx-segmented-control__indicator.danger,.ngx-segmented-control__indicator.warning,.ngx-segmented-control__indicator.info{box-shadow:none}.ngx-segmented-control__indicator:not(.default)~.ngx-segmented-control__option.selected{color:#fff}.ngx-segmented-control:has(.ngx-segmented-control__indicator:not(.default)) .ngx-segmented-control__option.selected{color:#fff!important}.ngx-segmented-control:has(.ngx-segmented-control__indicator:not(.default)) .ngx-segmented-control__option.selected .ngx-segmented-control__badge{background:#fff3;color:#fff}\n"] }]
|
|
3272
3467
|
}] });
|
|
3273
3468
|
|
|
3469
|
+
class FormBuilderComponent {
|
|
3470
|
+
fields = input([]);
|
|
3471
|
+
value = input({});
|
|
3472
|
+
showSubmit = input(true);
|
|
3473
|
+
submitLabel = input('Submit');
|
|
3474
|
+
valueChange = output();
|
|
3475
|
+
formSubmit = output();
|
|
3476
|
+
formValue = signal({});
|
|
3477
|
+
syncValue = effect(() => {
|
|
3478
|
+
const fromFields = this.fields().reduce((acc, field) => {
|
|
3479
|
+
if (field.value !== undefined)
|
|
3480
|
+
acc[field.key] = field.value;
|
|
3481
|
+
return acc;
|
|
3482
|
+
}, {});
|
|
3483
|
+
this.formValue.set({ ...fromFields, ...this.value() });
|
|
3484
|
+
});
|
|
3485
|
+
filledValue = computed(() => this.formValue());
|
|
3486
|
+
valueFor(key) {
|
|
3487
|
+
return this.filledValue()[key] ?? '';
|
|
3488
|
+
}
|
|
3489
|
+
updateValue(key, value) {
|
|
3490
|
+
const next = { ...this.formValue(), [key]: value };
|
|
3491
|
+
this.formValue.set(next);
|
|
3492
|
+
this.valueChange.emit(next);
|
|
3493
|
+
}
|
|
3494
|
+
submit(event) {
|
|
3495
|
+
event.preventDefault();
|
|
3496
|
+
this.formSubmit.emit(this.formValue());
|
|
3497
|
+
}
|
|
3498
|
+
coerceInputValue(field, value) {
|
|
3499
|
+
return field.type === 'number' ? (value === '' ? null : Number(value)) : value;
|
|
3500
|
+
}
|
|
3501
|
+
readOptionValue(field, rawValue) {
|
|
3502
|
+
return field.options?.find(option => String(option.value) === rawValue)?.value ?? rawValue;
|
|
3503
|
+
}
|
|
3504
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FormBuilderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3505
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: FormBuilderComponent, isStandalone: true, selector: "ngx-form-builder", inputs: { fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, showSubmit: { classPropertyName: "showSubmit", publicName: "showSubmit", isSignal: true, isRequired: false, transformFunction: null }, submitLabel: { classPropertyName: "submitLabel", publicName: "submitLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", formSubmit: "formSubmit" }, ngImport: i0, template: `
|
|
3506
|
+
<form class="ngx-form-builder" (submit)="submit($event)">
|
|
3507
|
+
@for (field of fields(); track field.key) {
|
|
3508
|
+
<label class="form-field" [class.checkbox-field]="field.type === 'checkbox'">
|
|
3509
|
+
@if (field.type !== 'checkbox') {
|
|
3510
|
+
<span class="field-label">{{ field.label }}@if (field.required) { <strong>*</strong> }</span>
|
|
3511
|
+
}
|
|
3512
|
+
|
|
3513
|
+
@switch (field.type || 'text') {
|
|
3514
|
+
@case ('textarea') {
|
|
3515
|
+
<textarea
|
|
3516
|
+
[placeholder]="field.placeholder || ''"
|
|
3517
|
+
[required]="field.required || false"
|
|
3518
|
+
[disabled]="field.disabled || false"
|
|
3519
|
+
[value]="valueFor(field.key)"
|
|
3520
|
+
(input)="updateValue(field.key, $any($event.target).value)"
|
|
3521
|
+
></textarea>
|
|
3522
|
+
}
|
|
3523
|
+
@case ('select') {
|
|
3524
|
+
<select
|
|
3525
|
+
[required]="field.required || false"
|
|
3526
|
+
[disabled]="field.disabled || false"
|
|
3527
|
+
[value]="valueFor(field.key)"
|
|
3528
|
+
(change)="updateValue(field.key, readOptionValue(field, $any($event.target).value))"
|
|
3529
|
+
>
|
|
3530
|
+
<option value="">Select...</option>
|
|
3531
|
+
@for (option of field.options || []; track option.value) {
|
|
3532
|
+
<option [value]="option.value">{{ option.label }}</option>
|
|
3533
|
+
}
|
|
3534
|
+
</select>
|
|
3535
|
+
}
|
|
3536
|
+
@case ('checkbox') {
|
|
3537
|
+
<input
|
|
3538
|
+
type="checkbox"
|
|
3539
|
+
[checked]="!!valueFor(field.key)"
|
|
3540
|
+
[required]="field.required || false"
|
|
3541
|
+
[disabled]="field.disabled || false"
|
|
3542
|
+
(change)="updateValue(field.key, $any($event.target).checked)"
|
|
3543
|
+
/>
|
|
3544
|
+
<span class="field-label">{{ field.label }}@if (field.required) { <strong>*</strong> }</span>
|
|
3545
|
+
}
|
|
3546
|
+
@default {
|
|
3547
|
+
<input
|
|
3548
|
+
[type]="field.type || 'text'"
|
|
3549
|
+
[placeholder]="field.placeholder || ''"
|
|
3550
|
+
[required]="field.required || false"
|
|
3551
|
+
[disabled]="field.disabled || false"
|
|
3552
|
+
[min]="field.min ?? null"
|
|
3553
|
+
[max]="field.max ?? null"
|
|
3554
|
+
[step]="field.step ?? null"
|
|
3555
|
+
[value]="valueFor(field.key)"
|
|
3556
|
+
(input)="updateValue(field.key, coerceInputValue(field, $any($event.target).value))"
|
|
3557
|
+
/>
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
</label>
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
@if (showSubmit()) {
|
|
3564
|
+
<div class="form-actions">
|
|
3565
|
+
<button type="submit">{{ submitLabel() }}</button>
|
|
3566
|
+
</div>
|
|
3567
|
+
}
|
|
3568
|
+
</form>
|
|
3569
|
+
`, isInline: true, 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"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
3570
|
+
}
|
|
3571
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FormBuilderComponent, decorators: [{
|
|
3572
|
+
type: Component,
|
|
3573
|
+
args: [{ selector: 'ngx-form-builder', standalone: true, imports: [CommonModule], template: `
|
|
3574
|
+
<form class="ngx-form-builder" (submit)="submit($event)">
|
|
3575
|
+
@for (field of fields(); track field.key) {
|
|
3576
|
+
<label class="form-field" [class.checkbox-field]="field.type === 'checkbox'">
|
|
3577
|
+
@if (field.type !== 'checkbox') {
|
|
3578
|
+
<span class="field-label">{{ field.label }}@if (field.required) { <strong>*</strong> }</span>
|
|
3579
|
+
}
|
|
3580
|
+
|
|
3581
|
+
@switch (field.type || 'text') {
|
|
3582
|
+
@case ('textarea') {
|
|
3583
|
+
<textarea
|
|
3584
|
+
[placeholder]="field.placeholder || ''"
|
|
3585
|
+
[required]="field.required || false"
|
|
3586
|
+
[disabled]="field.disabled || false"
|
|
3587
|
+
[value]="valueFor(field.key)"
|
|
3588
|
+
(input)="updateValue(field.key, $any($event.target).value)"
|
|
3589
|
+
></textarea>
|
|
3590
|
+
}
|
|
3591
|
+
@case ('select') {
|
|
3592
|
+
<select
|
|
3593
|
+
[required]="field.required || false"
|
|
3594
|
+
[disabled]="field.disabled || false"
|
|
3595
|
+
[value]="valueFor(field.key)"
|
|
3596
|
+
(change)="updateValue(field.key, readOptionValue(field, $any($event.target).value))"
|
|
3597
|
+
>
|
|
3598
|
+
<option value="">Select...</option>
|
|
3599
|
+
@for (option of field.options || []; track option.value) {
|
|
3600
|
+
<option [value]="option.value">{{ option.label }}</option>
|
|
3601
|
+
}
|
|
3602
|
+
</select>
|
|
3603
|
+
}
|
|
3604
|
+
@case ('checkbox') {
|
|
3605
|
+
<input
|
|
3606
|
+
type="checkbox"
|
|
3607
|
+
[checked]="!!valueFor(field.key)"
|
|
3608
|
+
[required]="field.required || false"
|
|
3609
|
+
[disabled]="field.disabled || false"
|
|
3610
|
+
(change)="updateValue(field.key, $any($event.target).checked)"
|
|
3611
|
+
/>
|
|
3612
|
+
<span class="field-label">{{ field.label }}@if (field.required) { <strong>*</strong> }</span>
|
|
3613
|
+
}
|
|
3614
|
+
@default {
|
|
3615
|
+
<input
|
|
3616
|
+
[type]="field.type || 'text'"
|
|
3617
|
+
[placeholder]="field.placeholder || ''"
|
|
3618
|
+
[required]="field.required || false"
|
|
3619
|
+
[disabled]="field.disabled || false"
|
|
3620
|
+
[min]="field.min ?? null"
|
|
3621
|
+
[max]="field.max ?? null"
|
|
3622
|
+
[step]="field.step ?? null"
|
|
3623
|
+
[value]="valueFor(field.key)"
|
|
3624
|
+
(input)="updateValue(field.key, coerceInputValue(field, $any($event.target).value))"
|
|
3625
|
+
/>
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
</label>
|
|
3629
|
+
}
|
|
3630
|
+
|
|
3631
|
+
@if (showSubmit()) {
|
|
3632
|
+
<div class="form-actions">
|
|
3633
|
+
<button type="submit">{{ submitLabel() }}</button>
|
|
3634
|
+
</div>
|
|
3635
|
+
}
|
|
3636
|
+
</form>
|
|
3637
|
+
`, 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"] }]
|
|
3638
|
+
}] });
|
|
3639
|
+
|
|
3640
|
+
class SignaturePadComponent {
|
|
3641
|
+
canvasRef;
|
|
3642
|
+
width = input(520);
|
|
3643
|
+
height = input(180);
|
|
3644
|
+
strokeColor = input('#111827');
|
|
3645
|
+
strokeWidth = input(2);
|
|
3646
|
+
backgroundColor = input('#ffffff');
|
|
3647
|
+
signatureChange = output();
|
|
3648
|
+
cleared = output();
|
|
3649
|
+
drawing = signal(false);
|
|
3650
|
+
context = null;
|
|
3651
|
+
ngAfterViewInit() {
|
|
3652
|
+
this.setupCanvas();
|
|
3653
|
+
this.clear(false);
|
|
3654
|
+
}
|
|
3655
|
+
startDrawing(event) {
|
|
3656
|
+
const context = this.context;
|
|
3657
|
+
if (!context)
|
|
3658
|
+
return;
|
|
3659
|
+
const point = this.pointerPoint(event);
|
|
3660
|
+
context.beginPath();
|
|
3661
|
+
context.moveTo(point.x, point.y);
|
|
3662
|
+
this.drawing.set(true);
|
|
3663
|
+
this.canvasRef.nativeElement.setPointerCapture(event.pointerId);
|
|
3664
|
+
}
|
|
3665
|
+
draw(event) {
|
|
3666
|
+
const context = this.context;
|
|
3667
|
+
if (!context || !this.drawing())
|
|
3668
|
+
return;
|
|
3669
|
+
const point = this.pointerPoint(event);
|
|
3670
|
+
context.lineTo(point.x, point.y);
|
|
3671
|
+
context.strokeStyle = this.strokeColor();
|
|
3672
|
+
context.lineWidth = this.strokeWidth();
|
|
3673
|
+
context.lineCap = 'round';
|
|
3674
|
+
context.lineJoin = 'round';
|
|
3675
|
+
context.stroke();
|
|
3676
|
+
}
|
|
3677
|
+
stopDrawing() {
|
|
3678
|
+
if (!this.drawing())
|
|
3679
|
+
return;
|
|
3680
|
+
this.drawing.set(false);
|
|
3681
|
+
this.signatureChange.emit(this.toDataUrl());
|
|
3682
|
+
}
|
|
3683
|
+
clear(emit = true) {
|
|
3684
|
+
const canvas = this.canvasRef.nativeElement;
|
|
3685
|
+
const context = this.context;
|
|
3686
|
+
if (!context)
|
|
3687
|
+
return;
|
|
3688
|
+
context.save();
|
|
3689
|
+
context.fillStyle = this.backgroundColor();
|
|
3690
|
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
3691
|
+
context.restore();
|
|
3692
|
+
if (emit) {
|
|
3693
|
+
this.cleared.emit();
|
|
3694
|
+
this.signatureChange.emit(this.toDataUrl());
|
|
3695
|
+
}
|
|
3696
|
+
}
|
|
3697
|
+
toDataUrl() {
|
|
3698
|
+
return this.canvasRef.nativeElement.toDataURL('image/png');
|
|
3699
|
+
}
|
|
3700
|
+
setupCanvas() {
|
|
3701
|
+
const canvas = this.canvasRef.nativeElement;
|
|
3702
|
+
const ratio = window.devicePixelRatio || 1;
|
|
3703
|
+
canvas.width = this.width() * ratio;
|
|
3704
|
+
canvas.height = this.height() * ratio;
|
|
3705
|
+
this.context = canvas.getContext('2d');
|
|
3706
|
+
this.context?.scale(ratio, ratio);
|
|
3707
|
+
}
|
|
3708
|
+
pointerPoint(event) {
|
|
3709
|
+
const rect = this.canvasRef.nativeElement.getBoundingClientRect();
|
|
3710
|
+
return {
|
|
3711
|
+
x: event.clientX - rect.left,
|
|
3712
|
+
y: event.clientY - rect.top,
|
|
3713
|
+
};
|
|
3714
|
+
}
|
|
3715
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SignaturePadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3716
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.20", type: SignaturePadComponent, isStandalone: true, selector: "ngx-signature-pad", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, strokeColor: { classPropertyName: "strokeColor", publicName: "strokeColor", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, backgroundColor: { classPropertyName: "backgroundColor", publicName: "backgroundColor", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { signatureChange: "signatureChange", cleared: "cleared" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvas"], descendants: true, static: true }], ngImport: i0, template: `
|
|
3717
|
+
<div class="ngx-signature-pad">
|
|
3718
|
+
<canvas
|
|
3719
|
+
#canvas
|
|
3720
|
+
[style.width.px]="width()"
|
|
3721
|
+
[style.height.px]="height()"
|
|
3722
|
+
(pointerdown)="startDrawing($event)"
|
|
3723
|
+
(pointermove)="draw($event)"
|
|
3724
|
+
(pointerup)="stopDrawing()"
|
|
3725
|
+
(pointerleave)="stopDrawing()"
|
|
3726
|
+
></canvas>
|
|
3727
|
+
<div class="signature-actions">
|
|
3728
|
+
<button type="button" (click)="clear()">Clear</button>
|
|
3729
|
+
</div>
|
|
3730
|
+
</div>
|
|
3731
|
+
`, isInline: true, styles: [":host{display:block}.ngx-signature-pad{display:grid;gap:8px;font-family:var(--ngx-font-family, inherit)}canvas{display:block;max-width:100%;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-signature-bg, #ffffff);touch-action:none;cursor:crosshair}.signature-actions{display:flex;justify-content:flex-end}.signature-actions button{border:1px solid var(--border-color, #cbd5e1);border-radius:6px;background:var(--bg-secondary, #ffffff);color:var(--text-primary, #0f172a);cursor:pointer;font:inherit;font-size:12px;font-weight:700;padding:6px 11px}.signature-actions button:hover,.signature-actions button:focus-visible{border-color:var(--primary-color, #4f46e5);outline:none}\n"] });
|
|
3732
|
+
}
|
|
3733
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SignaturePadComponent, decorators: [{
|
|
3734
|
+
type: Component,
|
|
3735
|
+
args: [{ selector: 'ngx-signature-pad', standalone: true, template: `
|
|
3736
|
+
<div class="ngx-signature-pad">
|
|
3737
|
+
<canvas
|
|
3738
|
+
#canvas
|
|
3739
|
+
[style.width.px]="width()"
|
|
3740
|
+
[style.height.px]="height()"
|
|
3741
|
+
(pointerdown)="startDrawing($event)"
|
|
3742
|
+
(pointermove)="draw($event)"
|
|
3743
|
+
(pointerup)="stopDrawing()"
|
|
3744
|
+
(pointerleave)="stopDrawing()"
|
|
3745
|
+
></canvas>
|
|
3746
|
+
<div class="signature-actions">
|
|
3747
|
+
<button type="button" (click)="clear()">Clear</button>
|
|
3748
|
+
</div>
|
|
3749
|
+
</div>
|
|
3750
|
+
`, styles: [":host{display:block}.ngx-signature-pad{display:grid;gap:8px;font-family:var(--ngx-font-family, inherit)}canvas{display:block;max-width:100%;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-signature-bg, #ffffff);touch-action:none;cursor:crosshair}.signature-actions{display:flex;justify-content:flex-end}.signature-actions button{border:1px solid var(--border-color, #cbd5e1);border-radius:6px;background:var(--bg-secondary, #ffffff);color:var(--text-primary, #0f172a);cursor:pointer;font:inherit;font-size:12px;font-weight:700;padding:6px 11px}.signature-actions button:hover,.signature-actions button:focus-visible{border-color:var(--primary-color, #4f46e5);outline:none}\n"] }]
|
|
3751
|
+
}], propDecorators: { canvasRef: [{
|
|
3752
|
+
type: ViewChild,
|
|
3753
|
+
args: ['canvas', { static: true }]
|
|
3754
|
+
}] } });
|
|
3755
|
+
|
|
3274
3756
|
/*
|
|
3275
3757
|
* Public API Surface — secondary entry point: ngx-core-components/inputs
|
|
3276
3758
|
*/
|
|
@@ -3280,5 +3762,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
3280
3762
|
* Generated bundle index. Do not edit.
|
|
3281
3763
|
*/
|
|
3282
3764
|
|
|
3283
|
-
export { AutocompleteComponent, CheckboxComponent, ColorPickerComponent, DatePickerComponent, DateRangePickerComponent, DropdownComponent, FilePreviewComponent, FileUploadComponent, MultiSelectComponent, NumericTextBoxComponent, RadioGroupComponent, RatingComponent, SegmentedControlComponent, SliderComponent, SwitchComponent, TagInputComponent, TextBoxComponent, TextareaComponent, TimePickerComponent };
|
|
3765
|
+
export { AutocompleteComponent, CheckboxComponent, ColorPickerComponent, DatePickerComponent, DateRangePickerComponent, DropdownComponent, FilePreviewComponent, FileUploadComponent, FormBuilderComponent, MultiSelectComponent, NumericTextBoxComponent, RadioGroupComponent, RatingComponent, SegmentedControlComponent, SignaturePadComponent, SliderComponent, SwitchComponent, TagInputComponent, TextBoxComponent, TextareaComponent, TimePickerComponent };
|
|
3284
3766
|
//# sourceMappingURL=ngx-core-components-inputs.mjs.map
|