@ngx-smz/ui-kit 21.9.0-next.5 → 21.9.0-next.6
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.
|
@@ -295,6 +295,9 @@ const buttonClasses = smzVariants({
|
|
|
295
295
|
},
|
|
296
296
|
defaults: { size: 'md', variant: 'solid', severity: 'primary', rounded: 'false', loading: 'false', iconOnly: 'false' },
|
|
297
297
|
compound: [
|
|
298
|
+
{ when: { iconOnly: 'true', size: 'sm' }, class: 'w-[var(--smz-control-h-sm)]' },
|
|
299
|
+
{ when: { iconOnly: 'true', size: 'md' }, class: 'w-[var(--smz-control-h)]' },
|
|
300
|
+
{ when: { iconOnly: 'true', size: 'lg' }, class: 'w-[var(--smz-control-h-lg)]' },
|
|
298
301
|
{ when: { variant: 'solid', severity: 'primary' }, class: 'bg-ui-primary text-ui-on-primary hover:bg-ui-primary-hover active:bg-ui-primary-active' },
|
|
299
302
|
{ when: { variant: 'solid', severity: 'secondary' }, class: 'bg-ui-surface-3 text-ui-fg hover:bg-ui-line active:bg-ui-line-strong' },
|
|
300
303
|
{ when: { variant: 'solid', severity: 'danger' }, class: 'bg-ui-danger text-ui-on-danger hover:bg-ui-danger-hover active:bg-ui-danger-active' },
|
|
@@ -3066,12 +3069,28 @@ class SmzAnchoredPanel {
|
|
|
3066
3069
|
}
|
|
3067
3070
|
|
|
3068
3071
|
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/explicit-module-boundary-types */
|
|
3072
|
+
/**
|
|
3073
|
+
* Texto da opcao. Sem `optionLabel`, opcoes-objeto com `label` usam esse campo (como o `p-select` do PrimeNG);
|
|
3074
|
+
* primitivos sao usados como estao.
|
|
3075
|
+
*/
|
|
3069
3076
|
function optionLabel(option, config) {
|
|
3070
|
-
|
|
3077
|
+
let value = option;
|
|
3078
|
+
if (config.optionLabel)
|
|
3079
|
+
value = SmzObjectUtils.resolveFieldData(option, config.optionLabel);
|
|
3080
|
+
else if (option !== null && typeof option === 'object' && option.label !== undefined)
|
|
3081
|
+
value = option.label;
|
|
3071
3082
|
return value === null || value === undefined ? '' : String(value);
|
|
3072
3083
|
}
|
|
3084
|
+
/**
|
|
3085
|
+
* Valor da opcao. Sem `optionValue` (e sem `optionLabel`), opcoes-objeto com `value` usam esse campo
|
|
3086
|
+
* (como o `p-select` do PrimeNG); caso contrario o proprio objeto e o valor.
|
|
3087
|
+
*/
|
|
3073
3088
|
function optionValue(option, config) {
|
|
3074
|
-
|
|
3089
|
+
if (config.optionValue)
|
|
3090
|
+
return SmzObjectUtils.resolveFieldData(option, config.optionValue);
|
|
3091
|
+
if (!config.optionLabel && option !== null && typeof option === 'object' && option.value !== undefined)
|
|
3092
|
+
return option.value;
|
|
3093
|
+
return option;
|
|
3075
3094
|
}
|
|
3076
3095
|
function optionDisabled(option, config) {
|
|
3077
3096
|
return config.optionDisabled ? !!SmzObjectUtils.resolveFieldData(option, config.optionDisabled) : false;
|
|
@@ -3929,8 +3948,8 @@ class SmzSelectButtonComponent extends SmzValueAccessor {
|
|
|
3929
3948
|
: sameValue(value, current, this.dataKey());
|
|
3930
3949
|
}
|
|
3931
3950
|
buttonClasses(option) {
|
|
3932
|
-
const size = this.size() === 'small' ? 'h-control-sm text-ui-sm' : this.size() === 'large' ? 'h-control-lg text-ui-lg' : 'h-control';
|
|
3933
|
-
const tone = this.isSelected(option) ? 'bg-ui-
|
|
3951
|
+
const size = this.size() === 'small' ? 'h-[calc(var(--smz-control-h-sm)-0.5rem)] text-ui-sm' : this.size() === 'large' ? 'h-[calc(var(--smz-control-h-lg)-0.5rem)] text-ui-lg' : 'h-[calc(var(--smz-control-h)-0.5rem)]';
|
|
3952
|
+
const tone = this.isSelected(option) ? 'bg-ui-surface-1 text-ui-fg shadow-card' : 'text-ui-fg-muted hover:text-ui-fg';
|
|
3934
3953
|
return `${size} ${tone}`;
|
|
3935
3954
|
}
|
|
3936
3955
|
toggle(option, event) {
|
|
@@ -3953,11 +3972,11 @@ class SmzSelectButtonComponent extends SmzValueAccessor {
|
|
|
3953
3972
|
}
|
|
3954
3973
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: SmzSelectButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3955
3974
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: SmzSelectButtonComponent, isStandalone: true, selector: "ui-select-button", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, allowEmpty: { classPropertyName: "allowEmpty", publicName: "allowEmpty", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changed: "changed" }, host: { classAttribute: "inline-flex" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SmzSelectButtonComponent), multi: true }], usesInheritance: true, ngImport: i0, template: `
|
|
3956
|
-
<div role="group" class="inline-flex
|
|
3975
|
+
<div role="group" class="inline-flex gap-1 rounded-control bg-ui-surface-3 p-1" [ngClass]="styleClass()">
|
|
3957
3976
|
@for (option of options(); track $index) {
|
|
3958
3977
|
<button
|
|
3959
3978
|
type="button"
|
|
3960
|
-
class="inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap
|
|
3979
|
+
class="inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control px-control-x font-ui text-ui-md font-medium transition-colors duration-ui focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ui-focus disabled:cursor-not-allowed disabled:opacity-50"
|
|
3961
3980
|
[class]="buttonClasses(option)"
|
|
3962
3981
|
[attr.aria-pressed]="isSelected(option)"
|
|
3963
3982
|
[disabled]="isDisabled() || isOptionDisabled(option)"
|
|
@@ -3982,11 +4001,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
3982
4001
|
providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SmzSelectButtonComponent), multi: true }],
|
|
3983
4002
|
host: { class: 'inline-flex' },
|
|
3984
4003
|
template: `
|
|
3985
|
-
<div role="group" class="inline-flex
|
|
4004
|
+
<div role="group" class="inline-flex gap-1 rounded-control bg-ui-surface-3 p-1" [ngClass]="styleClass()">
|
|
3986
4005
|
@for (option of options(); track $index) {
|
|
3987
4006
|
<button
|
|
3988
4007
|
type="button"
|
|
3989
|
-
class="inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap
|
|
4008
|
+
class="inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control px-control-x font-ui text-ui-md font-medium transition-colors duration-ui focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ui-focus disabled:cursor-not-allowed disabled:opacity-50"
|
|
3990
4009
|
[class]="buttonClasses(option)"
|
|
3991
4010
|
[attr.aria-pressed]="isSelected(option)"
|
|
3992
4011
|
[disabled]="isDisabled() || isOptionDisabled(option)"
|
|
@@ -4905,10 +4924,15 @@ class SmzDatePickerComponent extends SmzValueAccessor {
|
|
|
4905
4924
|
fieldRef = viewChild.required('field');
|
|
4906
4925
|
panel = viewChild.required('panel');
|
|
4907
4926
|
anchored = new SmzAnchoredPanel(this.overlay, this.viewContainer);
|
|
4927
|
+
/**
|
|
4928
|
+
* Aceita `Date`, string (ISO ou parseavel) e numero (timestamp), como o `p-datepicker`.
|
|
4929
|
+
* Valores invalidos viram `null` em vez de lancar. O modelo do formulario so muda quando o usuario escolhe uma data.
|
|
4930
|
+
*/
|
|
4908
4931
|
writeValue(value) {
|
|
4909
|
-
|
|
4932
|
+
const coerced = coerceDateValue(value);
|
|
4933
|
+
super.writeValue(coerced);
|
|
4910
4934
|
this.typed.set(null);
|
|
4911
|
-
this.syncViewTo(
|
|
4935
|
+
this.syncViewTo(coerced);
|
|
4912
4936
|
}
|
|
4913
4937
|
ngOnDestroy() {
|
|
4914
4938
|
this.anchored.close();
|
|
@@ -5450,6 +5474,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
5450
5474
|
`,
|
|
5451
5475
|
}]
|
|
5452
5476
|
}], propDecorators: { selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormat", required: false }] }], showTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTime", required: false }] }], timeOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeOnly", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], hourFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourFormat", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], showButtonBar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showButtonBar", required: false }] }], showIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "showIcon", required: false }] }], showOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOnFocus", required: false }] }], keepInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepInvalid", required: false }] }], readonlyInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonlyInput", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], styleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleClass", required: false }] }], appendTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "appendTo", required: false }] }], touchUI: [{ type: i0.Input, args: [{ isSignal: true, alias: "touchUI", required: false }] }], focusTrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusTrap", required: false }] }], selected: [{ type: i0.Output, args: ["selected"] }], cleared: [{ type: i0.Output, args: ["cleared"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], blurred: [{ type: i0.Output, args: ["blurred"] }], anchorRef: [{ type: i0.ViewChild, args: ['anchor', { isSignal: true }] }], fieldRef: [{ type: i0.ViewChild, args: ['field', { isSignal: true }] }], panel: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }] } });
|
|
5477
|
+
function toDate(value) {
|
|
5478
|
+
if (value instanceof Date)
|
|
5479
|
+
return Number.isNaN(value.getTime()) ? null : value;
|
|
5480
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
5481
|
+
if (value === '')
|
|
5482
|
+
return null;
|
|
5483
|
+
const date = new Date(value);
|
|
5484
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
5485
|
+
}
|
|
5486
|
+
return null;
|
|
5487
|
+
}
|
|
5488
|
+
function coerceDateValue(value) {
|
|
5489
|
+
if (Array.isArray(value)) {
|
|
5490
|
+
const dates = value.map(toDate).filter((date) => date !== null);
|
|
5491
|
+
return dates.length > 0 ? dates : null;
|
|
5492
|
+
}
|
|
5493
|
+
return toDate(value);
|
|
5494
|
+
}
|
|
5453
5495
|
|
|
5454
5496
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-unsafe-return, max-len */
|
|
5455
5497
|
/* eslint-disable max-len -- classes Tailwind nos templates */
|
|
@@ -8117,7 +8159,7 @@ class SmzCardComponent {
|
|
|
8117
8159
|
subtitleTemplate = computed(() => smzFindTemplate(this.templates(), 'subtitle'), ...(ngDevMode ? [{ debugName: "subtitleTemplate" }] : []));
|
|
8118
8160
|
footerTemplate = computed(() => smzFindTemplate(this.templates(), 'footer'), ...(ngDevMode ? [{ debugName: "footerTemplate" }] : []));
|
|
8119
8161
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: SmzCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8120
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: SmzCardComponent, isStandalone: true, selector: "ui-card", inputs: { header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, subheader: { classPropertyName: "subheader", publicName: "subheader", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "p-card flex flex-col overflow-hidden rounded-card
|
|
8162
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: SmzCardComponent, isStandalone: true, selector: "ui-card", inputs: { header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, subheader: { classPropertyName: "subheader", publicName: "subheader", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "p-card flex flex-col overflow-hidden rounded-card bg-ui-surface-1 font-ui text-ui-md text-ui-fg shadow-card" }, queries: [{ propertyName: "templates", predicate: SmzTemplateDirective, isSignal: true }], ngImport: i0, template: `
|
|
8121
8163
|
@if (headerTemplate(); as tpl) {
|
|
8122
8164
|
<div class="p-card-header"><ng-container [ngTemplateOutlet]="tpl" /></div>
|
|
8123
8165
|
}
|
|
@@ -8145,7 +8187,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
8145
8187
|
selector: 'ui-card',
|
|
8146
8188
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8147
8189
|
imports: [NgTemplateOutlet],
|
|
8148
|
-
host: { class: 'p-card flex flex-col overflow-hidden rounded-card
|
|
8190
|
+
host: { class: 'p-card flex flex-col overflow-hidden rounded-card bg-ui-surface-1 font-ui text-ui-md text-ui-fg shadow-card' },
|
|
8149
8191
|
template: `
|
|
8150
8192
|
@if (headerTemplate(); as tpl) {
|
|
8151
8193
|
<div class="p-card-header"><ng-container [ngTemplateOutlet]="tpl" /></div>
|