@kubex/zinc 1.1.39 → 1.1.41
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/dist/custom-elements.json +321 -20
- package/dist/vscode.html-custom-data.json +38 -4
- package/dist/web-types.json +100 -6
- package/dist/zn.d.ts +236 -173
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +541 -521
- package/docs/_utilities/code-previews.cjs +6 -2
- package/docs/pages/components/datepicker.md +10 -1
- package/docs/pages/components/editor.md +17 -0
- package/docs/pages/components/style.md +46 -0
- package/package.json +1 -1
- package/scss/_root.scss +21 -1
- package/scss/air-datapicker.scss +50 -0
- package/scss/boot.scss +1 -48
- package/src/components/data-table/data-table.component.ts +152 -73
- package/src/components/data-table/data-table.scss +6 -0
- package/src/components/data-table/data-table.test.ts +15 -0
- package/src/components/data-table-search/data-table-search.component.ts +13 -1
- package/src/components/datepicker/datepicker.component.ts +66 -12
- package/src/components/datepicker/datepicker.scss +1 -0
- package/src/components/editor/editor.component.ts +51 -6
- package/src/components/editor/editor.test.ts +62 -1
- package/src/components/query-builder/query-builder.component.ts +62 -21
- package/src/components/query-builder/query-builder.scss +4 -0
- package/src/components/style/style.component.ts +43 -4
- package/src/components/style/style.test.ts +71 -0
- package/src/utilities/query.test.ts +63 -0
- package/src/utilities/query.ts +27 -0
package/dist/zn.d.ts
CHANGED
|
@@ -688,6 +688,8 @@ declare module "events/zn-select" {
|
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
declare module "utilities/query" {
|
|
691
|
+
export function deepQuery<T extends Element = Element>(selector: string, root?: Document | ShadowRoot | Element): T | null;
|
|
692
|
+
export function deepQueryAll<T extends Element = Element>(selector: string, root?: Document | ShadowRoot | Element, out?: T[]): T[];
|
|
691
693
|
export function deepQuerySelectorAll(selector: string, element: Element, stopSelector: string): Element[];
|
|
692
694
|
}
|
|
693
695
|
declare module "internal/offset" {
|
|
@@ -2787,6 +2789,196 @@ declare module "events/zn-change" {
|
|
|
2787
2789
|
}
|
|
2788
2790
|
}
|
|
2789
2791
|
}
|
|
2792
|
+
declare module "components/datepicker/datepicker.component" {
|
|
2793
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
2794
|
+
import ZincElement from "internal/zinc-element";
|
|
2795
|
+
import ZnIcon from "components/icon/index";
|
|
2796
|
+
import ZnTooltip from "components/tooltip/index";
|
|
2797
|
+
import type { ZincFormControl } from "internal/zinc-element";
|
|
2798
|
+
/**
|
|
2799
|
+
* @summary A date picker component with calendar popup and input validation.
|
|
2800
|
+
* @documentation https://zinc.style/components/datepicker
|
|
2801
|
+
* @status experimental
|
|
2802
|
+
* @since 1.0
|
|
2803
|
+
*
|
|
2804
|
+
* @dependency zn-icon
|
|
2805
|
+
* @dependency zn-tooltip
|
|
2806
|
+
*
|
|
2807
|
+
* @event zn-change - Emitted when the date value changes.
|
|
2808
|
+
* @event zn-input - Emitted when the input value changes.
|
|
2809
|
+
* @event zn-blur - Emitted when the input loses focus.
|
|
2810
|
+
* @event zn-focus - Emitted when the input gains focus.
|
|
2811
|
+
*
|
|
2812
|
+
* @slot label - The datepicker's label. Alternatively, you can use the `label` attribute.
|
|
2813
|
+
* @slot label-tooltip - Tooltip content for the label. Alternatively, you can use the `label-tooltip` attribute.
|
|
2814
|
+
* @slot context-note - Additional context text displayed above the input. Alternatively, you can use the `context-note` attribute.
|
|
2815
|
+
* @slot help-text - Help text displayed below the input. Alternatively, you can use the `help-text` attribute.
|
|
2816
|
+
* @slot prefix - Content to display before the input (in addition to the default calendar icon).
|
|
2817
|
+
* @slot suffix - Content to display after the input.
|
|
2818
|
+
*
|
|
2819
|
+
* @csspart base - The component's base wrapper.
|
|
2820
|
+
* @csspart form-control - The form control wrapper.
|
|
2821
|
+
* @csspart form-control-label - The label element.
|
|
2822
|
+
* @csspart form-control-input - The input wrapper.
|
|
2823
|
+
* @csspart form-control-help-text - The help text element.
|
|
2824
|
+
*
|
|
2825
|
+
* @property format - Date format using AirDatepicker tokens. Default: 'dd/MM/yyyy'
|
|
2826
|
+
* Supported formats:
|
|
2827
|
+
* - dd/MM/yyyy (31/12/2024) - Default
|
|
2828
|
+
* - MM/dd/yyyy (12/31/2024)
|
|
2829
|
+
* - yyyy-MM-dd (2024-12-31)
|
|
2830
|
+
* - dd-MM-yyyy (31-12-2024)
|
|
2831
|
+
* - yyyy/MM/dd (2024/12/31)
|
|
2832
|
+
*
|
|
2833
|
+
* @cssproperty --zn-input-* - Inherited input component CSS custom properties.
|
|
2834
|
+
*/
|
|
2835
|
+
export default class ZnDatepicker extends ZincElement implements ZincFormControl {
|
|
2836
|
+
static styles: CSSResultGroup;
|
|
2837
|
+
static dependencies: {
|
|
2838
|
+
'zn-icon': typeof ZnIcon;
|
|
2839
|
+
'zn-tooltip': typeof ZnTooltip;
|
|
2840
|
+
};
|
|
2841
|
+
private readonly formControlController;
|
|
2842
|
+
private readonly hasSlotController;
|
|
2843
|
+
input: HTMLInputElement;
|
|
2844
|
+
private hasFocus;
|
|
2845
|
+
title: string;
|
|
2846
|
+
/** The name of the input, submitted as a name/value pair with form data. */
|
|
2847
|
+
name: string;
|
|
2848
|
+
/** The current value of the input, submitted as a name/value pair with form data. */
|
|
2849
|
+
value: any;
|
|
2850
|
+
/** The default value of the form control. Primarily used for resetting the form control. */
|
|
2851
|
+
defaultValue: string;
|
|
2852
|
+
/** The inputs size **/
|
|
2853
|
+
size: 'small' | 'medium' | 'large';
|
|
2854
|
+
/** The inputs label. If you need to display HTML, use the `label` slot. **/
|
|
2855
|
+
label: string;
|
|
2856
|
+
/** Text that appears in a tooltip next to the label. If you need to display HTML in the tooltip, use the
|
|
2857
|
+
* `label-tooltip` slot.
|
|
2858
|
+
* **/
|
|
2859
|
+
labelTooltip: string;
|
|
2860
|
+
/**
|
|
2861
|
+
* Text that appears above the input, on the right, to add additional context. If you need to display HTML
|
|
2862
|
+
* in this text, use the `context-note` slot instead
|
|
2863
|
+
*/
|
|
2864
|
+
contextNote: string;
|
|
2865
|
+
/** The input's help text. If you need to display HTML, use the `help-text` slot instead. **/
|
|
2866
|
+
helpText: string;
|
|
2867
|
+
/** Disables the input **/
|
|
2868
|
+
disabled: boolean;
|
|
2869
|
+
/** Placeholder text to show as a hint when the input is empty. */
|
|
2870
|
+
placeholder: string;
|
|
2871
|
+
/** Makes the input read-only **/
|
|
2872
|
+
readonly: boolean;
|
|
2873
|
+
/**
|
|
2874
|
+
* By default, form-controls are associated with the nearest containing `<form>` element. This attribute allows you
|
|
2875
|
+
* to place the form control outside a form and associate it with the form that has this `id`. The form must be
|
|
2876
|
+
* in the same document or shadow root for this to work.
|
|
2877
|
+
*/
|
|
2878
|
+
form: string;
|
|
2879
|
+
flush: boolean;
|
|
2880
|
+
/** Makes the input a required field. */
|
|
2881
|
+
required: boolean;
|
|
2882
|
+
/** Adds a clear button to the calendar for removing a selected date. **/
|
|
2883
|
+
clearable: boolean;
|
|
2884
|
+
/** Makes the input a range picker. **/
|
|
2885
|
+
range: boolean;
|
|
2886
|
+
/** Disallows selecting past dates. **/
|
|
2887
|
+
disablePastDates: boolean;
|
|
2888
|
+
/** Minimum date that can be selected. Overrides disable-past-dates if both are set. Accepts Date object or date string. **/
|
|
2889
|
+
minDate?: string | Date;
|
|
2890
|
+
/** Maximum date that can be selected. Accepts Date object or date string. **/
|
|
2891
|
+
maxDate?: string | Date;
|
|
2892
|
+
/**
|
|
2893
|
+
* Date format for display and input. Uses AirDatepicker format tokens.
|
|
2894
|
+
*
|
|
2895
|
+
* Common formats:
|
|
2896
|
+
* - 'dd/MM/yyyy' (31/12/2024) - Default, European style
|
|
2897
|
+
* - 'MM/dd/yyyy' (12/31/2024) - US style
|
|
2898
|
+
* - 'yyyy-MM-dd' (2024-12-31) - ISO style
|
|
2899
|
+
* - 'dd-MM-yyyy' (31-12-2024) - Alternative European
|
|
2900
|
+
* - 'yyyy/MM/dd' (2024/12/31) - Alternative ISO
|
|
2901
|
+
*
|
|
2902
|
+
* Format tokens:
|
|
2903
|
+
* - dd: Day with leading zero (01-31)
|
|
2904
|
+
* - MM: Month with leading zero (01-12)
|
|
2905
|
+
* - yyyy: Full year (2024)
|
|
2906
|
+
*/
|
|
2907
|
+
format: string;
|
|
2908
|
+
/** Display time selector. **/
|
|
2909
|
+
timePicker?: boolean;
|
|
2910
|
+
/** Display only time selector, without date. **/
|
|
2911
|
+
onlyTimepicker?: boolean;
|
|
2912
|
+
/**
|
|
2913
|
+
* Time format for display and input selector. Uses AirDatepicker format tokens.
|
|
2914
|
+
* Default : hh:mm AA
|
|
2915
|
+
*
|
|
2916
|
+
* Possible symbols:
|
|
2917
|
+
* h — hours in 12-hour mode
|
|
2918
|
+
* hh — hours in 12-hour mode with leading zero
|
|
2919
|
+
* H — hours in 24-hour mode
|
|
2920
|
+
* HH — hours in 24-hour mode with leading zero
|
|
2921
|
+
* m — minutes
|
|
2922
|
+
* mm — minutes with leading zero
|
|
2923
|
+
* aa — day period lower case
|
|
2924
|
+
* AA — day period upper case
|
|
2925
|
+
*/
|
|
2926
|
+
timeFormat?: string;
|
|
2927
|
+
container?: string | HTMLElement;
|
|
2928
|
+
private _instance;
|
|
2929
|
+
get timestamp(): number;
|
|
2930
|
+
/** Gets the validity state object */
|
|
2931
|
+
get validity(): ValidityState;
|
|
2932
|
+
/** Gets the validation message */
|
|
2933
|
+
get validationMessage(): string;
|
|
2934
|
+
handleDisabledChange(): void;
|
|
2935
|
+
handleValueChange(): Promise<void>;
|
|
2936
|
+
handleDatepickerOptionsChange(): void;
|
|
2937
|
+
/** Sets focus on the input. */
|
|
2938
|
+
focus(options?: FocusOptions): void;
|
|
2939
|
+
/** Removes focus from the input. */
|
|
2940
|
+
blur(): void;
|
|
2941
|
+
/** Selects all the text in the input. */
|
|
2942
|
+
select(): void;
|
|
2943
|
+
/** Checks the validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
|
|
2944
|
+
checkValidity(): boolean;
|
|
2945
|
+
/** Gets the associated form, if one exists. */
|
|
2946
|
+
getForm(): HTMLFormElement | null;
|
|
2947
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
2948
|
+
reportValidity(): boolean;
|
|
2949
|
+
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
2950
|
+
setCustomValidity(message: string): void;
|
|
2951
|
+
init(): void;
|
|
2952
|
+
private handleInput;
|
|
2953
|
+
private handleChange;
|
|
2954
|
+
private handleInvalid;
|
|
2955
|
+
private handleKeyDown;
|
|
2956
|
+
private handlePaste;
|
|
2957
|
+
private handleBlur;
|
|
2958
|
+
private isValidDateString;
|
|
2959
|
+
private parseDate;
|
|
2960
|
+
private parseDateString;
|
|
2961
|
+
private isDateInRange;
|
|
2962
|
+
private clearInvalidDate;
|
|
2963
|
+
private getFormatSeparator;
|
|
2964
|
+
private escapeRegex;
|
|
2965
|
+
private normalizeDate;
|
|
2966
|
+
private autoFormatDate;
|
|
2967
|
+
updated(_changedProperties: PropertyValues): void;
|
|
2968
|
+
firstUpdated(): void;
|
|
2969
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
declare module "components/datepicker/index" {
|
|
2973
|
+
import ZnDatepicker from "components/datepicker/datepicker.component";
|
|
2974
|
+
export * from "components/datepicker/datepicker.component";
|
|
2975
|
+
export default ZnDatepicker;
|
|
2976
|
+
global {
|
|
2977
|
+
interface HTMLElementTagNameMap {
|
|
2978
|
+
'zn-datepicker': ZnDatepicker;
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2790
2982
|
declare module "components/query-builder/query-builder.component" {
|
|
2791
2983
|
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
2792
2984
|
import ZincElement from "internal/zinc-element";
|
|
@@ -2802,9 +2994,21 @@ declare module "components/query-builder/query-builder.component" {
|
|
|
2802
2994
|
type?: QueryBuilderType;
|
|
2803
2995
|
options?: QueryBuilderOptions;
|
|
2804
2996
|
operators: QueryBuilderOperators[];
|
|
2997
|
+
dateSubmitFormat?: QueryBuilderDateSubmitFormat;
|
|
2805
2998
|
maxOptionsVisible?: string;
|
|
2806
2999
|
}
|
|
2807
|
-
|
|
3000
|
+
/**
|
|
3001
|
+
* Controls how `date` and `dateTime` filter values are serialized when the
|
|
3002
|
+
* query is submitted.
|
|
3003
|
+
*
|
|
3004
|
+
* - `'iso'` — RFC 3339 / ISO 8601 (e.g. `2026-06-09T16:05:00Z`).
|
|
3005
|
+
* - `'timestamp'` — Unix timestamp in seconds since epoch.
|
|
3006
|
+
* - `'legacy'` — whatever format the current system emits. Kept so existing
|
|
3007
|
+
* backends keep working while consumers migrate to one of the
|
|
3008
|
+
* formats above. - DEFAULT
|
|
3009
|
+
*/
|
|
3010
|
+
export type QueryBuilderDateSubmitFormat = 'iso' | 'timestamp' | 'legacy';
|
|
3011
|
+
export type QueryBuilderType = 'bool' | 'boolean' | 'date' | 'dateTime' | 'number';
|
|
2808
3012
|
export interface QueryBuilderOptions {
|
|
2809
3013
|
[key: string | number]: string | number;
|
|
2810
3014
|
}
|
|
@@ -3134,7 +3338,8 @@ declare module "components/style/style.component" {
|
|
|
3134
3338
|
static styles: CSSResultGroup;
|
|
3135
3339
|
private readonly localize;
|
|
3136
3340
|
color: string;
|
|
3137
|
-
border:
|
|
3341
|
+
border: string;
|
|
3342
|
+
size: string;
|
|
3138
3343
|
error: boolean;
|
|
3139
3344
|
success: boolean;
|
|
3140
3345
|
info: boolean;
|
|
@@ -3148,6 +3353,7 @@ declare module "components/style/style.component" {
|
|
|
3148
3353
|
height: string;
|
|
3149
3354
|
pad: string;
|
|
3150
3355
|
margin: string;
|
|
3356
|
+
muted: boolean;
|
|
3151
3357
|
gutter: boolean;
|
|
3152
3358
|
autoMargin: string;
|
|
3153
3359
|
connectedCallback(): void;
|
|
@@ -3188,6 +3394,8 @@ declare module "components/data-table/data-table.component" {
|
|
|
3188
3394
|
style?: string;
|
|
3189
3395
|
iconSrc?: string;
|
|
3190
3396
|
iconColor?: string;
|
|
3397
|
+
iconSize?: number;
|
|
3398
|
+
iconStyle?: string;
|
|
3191
3399
|
hoverContent?: string;
|
|
3192
3400
|
hoverPlacement?: string;
|
|
3193
3401
|
chipColor?: string;
|
|
@@ -3243,7 +3451,11 @@ declare module "components/data-table/data-table.component" {
|
|
|
3243
3451
|
hideHeader?: boolean;
|
|
3244
3452
|
hideColumn?: boolean;
|
|
3245
3453
|
secondary?: boolean;
|
|
3454
|
+
type?: string;
|
|
3455
|
+
cellTemplate?: Cell;
|
|
3456
|
+
ifEmpty?: Cell;
|
|
3246
3457
|
}
|
|
3458
|
+
type DisplayTemplate = (cell: Cell, row: Row, header: HeaderConfig) => TemplateResult | string;
|
|
3247
3459
|
/**
|
|
3248
3460
|
* @summary Short summary of the component's intended use.
|
|
3249
3461
|
* @documentation https://zinc.style/components/data-table
|
|
@@ -3294,7 +3506,7 @@ declare module "components/data-table/data-table.component" {
|
|
|
3294
3506
|
'zn-data-table-search': typeof ZnDataTableSearch;
|
|
3295
3507
|
};
|
|
3296
3508
|
dataUri: string;
|
|
3297
|
-
data:
|
|
3509
|
+
data: Row[] | Row;
|
|
3298
3510
|
sortColumn: string;
|
|
3299
3511
|
sortDirection: string;
|
|
3300
3512
|
localSort: boolean;
|
|
@@ -3303,6 +3515,7 @@ declare module "components/data-table/data-table.component" {
|
|
|
3303
3515
|
wideColumn: string;
|
|
3304
3516
|
key: string;
|
|
3305
3517
|
headers: Record<string, HeaderConfig>;
|
|
3518
|
+
displayTemplates: Record<string, DisplayTemplate>;
|
|
3306
3519
|
hiddenHeaders: string;
|
|
3307
3520
|
hiddenColumns: string;
|
|
3308
3521
|
unsortableHeaders: string;
|
|
@@ -3318,11 +3531,11 @@ declare module "components/data-table/data-table.component" {
|
|
|
3318
3531
|
noInitialLoad: boolean;
|
|
3319
3532
|
groupBy: string;
|
|
3320
3533
|
groups: string;
|
|
3534
|
+
itemsPerPage: number;
|
|
3321
3535
|
selectAllButton: ZnButton;
|
|
3322
3536
|
private _initialLoad;
|
|
3323
3537
|
private _lastTableContent;
|
|
3324
3538
|
private readonly resizeObserver;
|
|
3325
|
-
private itemsPerPage;
|
|
3326
3539
|
private page;
|
|
3327
3540
|
private totalPages;
|
|
3328
3541
|
private _rows;
|
|
@@ -3335,10 +3548,12 @@ declare module "components/data-table/data-table.component" {
|
|
|
3335
3548
|
private _expandedRows;
|
|
3336
3549
|
private _hiddenCells;
|
|
3337
3550
|
private _secondaryHeaders;
|
|
3551
|
+
private _formatTemplates;
|
|
3338
3552
|
requestParams: Record<string, any>;
|
|
3339
3553
|
refresh(): void;
|
|
3340
3554
|
render(): TemplateResult<1>;
|
|
3341
3555
|
connectedCallback(): void;
|
|
3556
|
+
private getTemplate;
|
|
3342
3557
|
disconnectedCallback(): void;
|
|
3343
3558
|
filterChangeListener: (e: ZnFilterChangeEvent) => void;
|
|
3344
3559
|
searchChangeListener: (e: ZnSearchChangeEvent) => void;
|
|
@@ -3363,7 +3578,7 @@ declare module "components/data-table/data-table.component" {
|
|
|
3363
3578
|
selectRow(e: Event): void;
|
|
3364
3579
|
clearSelectedRows(event: Event): void;
|
|
3365
3580
|
updateSort(key: string): () => void;
|
|
3366
|
-
renderCell(data: Cell): TemplateResult;
|
|
3581
|
+
renderCell(data: Cell, row?: Row, header?: HeaderConfig): TemplateResult | ZincElement;
|
|
3367
3582
|
private updateActionKeys;
|
|
3368
3583
|
private getTableSortIcon;
|
|
3369
3584
|
private renderCellHeader;
|
|
@@ -6030,6 +6245,7 @@ declare module "components/editor/modules/time-tracking/time-tracking" {
|
|
|
6030
6245
|
}
|
|
6031
6246
|
declare module "components/editor/editor.component" {
|
|
6032
6247
|
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
6248
|
+
import { Store } from "internal/storage";
|
|
6033
6249
|
import ZincElement from "internal/zinc-element";
|
|
6034
6250
|
import type { ZincFormControl } from "internal/zinc-element";
|
|
6035
6251
|
export interface EditorFeatureConfig {
|
|
@@ -6082,6 +6298,17 @@ declare module "components/editor/editor.component" {
|
|
|
6082
6298
|
codeEnabled: boolean;
|
|
6083
6299
|
aiEnabled: boolean;
|
|
6084
6300
|
aiPath: string;
|
|
6301
|
+
/**
|
|
6302
|
+
* Caches unsent content while typing and restores it when the editor next loads,
|
|
6303
|
+
* so agent replies in tickets/chats survive reloads and navigation. Use a key
|
|
6304
|
+
* unique to the conversation (e.g. the ticket ID). The cache is cleared on submit.
|
|
6305
|
+
*/
|
|
6306
|
+
storeKey: string;
|
|
6307
|
+
/** Cached-content expiry in seconds. Defaults to 1 day. */
|
|
6308
|
+
storeTtl: number;
|
|
6309
|
+
/** Cache to localStorage instead of sessionStorage, persisting across tabs and browser restarts. */
|
|
6310
|
+
localStorage: boolean;
|
|
6311
|
+
protected _store: Store;
|
|
6085
6312
|
private quillElement;
|
|
6086
6313
|
private _content;
|
|
6087
6314
|
private _selectionRange;
|
|
@@ -6091,8 +6318,12 @@ declare module "components/editor/editor.component" {
|
|
|
6091
6318
|
getForm(): HTMLFormElement | null;
|
|
6092
6319
|
reportValidity(): boolean;
|
|
6093
6320
|
setCustomValidity(message: string): void;
|
|
6321
|
+
connectedCallback(): void;
|
|
6094
6322
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
6095
6323
|
private _handleTextChange;
|
|
6324
|
+
private _isEmpty;
|
|
6325
|
+
private _cacheContent;
|
|
6326
|
+
private _clearCachedContent;
|
|
6096
6327
|
private _getQuillKeyboardBindings;
|
|
6097
6328
|
private _handleEditorChange;
|
|
6098
6329
|
private _replaceTextAtSelection;
|
|
@@ -6251,174 +6482,6 @@ declare module "components/checkbox/index" {
|
|
|
6251
6482
|
}
|
|
6252
6483
|
}
|
|
6253
6484
|
}
|
|
6254
|
-
declare module "components/datepicker/datepicker.component" {
|
|
6255
|
-
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
6256
|
-
import ZincElement from "internal/zinc-element";
|
|
6257
|
-
import ZnIcon from "components/icon/index";
|
|
6258
|
-
import ZnTooltip from "components/tooltip/index";
|
|
6259
|
-
import type { ZincFormControl } from "internal/zinc-element";
|
|
6260
|
-
/**
|
|
6261
|
-
* @summary A date picker component with calendar popup and input validation.
|
|
6262
|
-
* @documentation https://zinc.style/components/datepicker
|
|
6263
|
-
* @status experimental
|
|
6264
|
-
* @since 1.0
|
|
6265
|
-
*
|
|
6266
|
-
* @dependency zn-icon
|
|
6267
|
-
* @dependency zn-tooltip
|
|
6268
|
-
*
|
|
6269
|
-
* @event zn-change - Emitted when the date value changes.
|
|
6270
|
-
* @event zn-input - Emitted when the input value changes.
|
|
6271
|
-
* @event zn-blur - Emitted when the input loses focus.
|
|
6272
|
-
* @event zn-focus - Emitted when the input gains focus.
|
|
6273
|
-
*
|
|
6274
|
-
* @slot label - The datepicker's label. Alternatively, you can use the `label` attribute.
|
|
6275
|
-
* @slot label-tooltip - Tooltip content for the label. Alternatively, you can use the `label-tooltip` attribute.
|
|
6276
|
-
* @slot context-note - Additional context text displayed above the input. Alternatively, you can use the `context-note` attribute.
|
|
6277
|
-
* @slot help-text - Help text displayed below the input. Alternatively, you can use the `help-text` attribute.
|
|
6278
|
-
* @slot prefix - Content to display before the input (in addition to the default calendar icon).
|
|
6279
|
-
* @slot suffix - Content to display after the input.
|
|
6280
|
-
*
|
|
6281
|
-
* @csspart base - The component's base wrapper.
|
|
6282
|
-
* @csspart form-control - The form control wrapper.
|
|
6283
|
-
* @csspart form-control-label - The label element.
|
|
6284
|
-
* @csspart form-control-input - The input wrapper.
|
|
6285
|
-
* @csspart form-control-help-text - The help text element.
|
|
6286
|
-
*
|
|
6287
|
-
* @property format - Date format using AirDatepicker tokens. Default: 'dd/MM/yyyy'
|
|
6288
|
-
* Supported formats:
|
|
6289
|
-
* - dd/MM/yyyy (31/12/2024) - Default
|
|
6290
|
-
* - MM/dd/yyyy (12/31/2024)
|
|
6291
|
-
* - yyyy-MM-dd (2024-12-31)
|
|
6292
|
-
* - dd-MM-yyyy (31-12-2024)
|
|
6293
|
-
* - yyyy/MM/dd (2024/12/31)
|
|
6294
|
-
*
|
|
6295
|
-
* @cssproperty --zn-input-* - Inherited input component CSS custom properties.
|
|
6296
|
-
*/
|
|
6297
|
-
export default class ZnDatepicker extends ZincElement implements ZincFormControl {
|
|
6298
|
-
static styles: CSSResultGroup;
|
|
6299
|
-
static dependencies: {
|
|
6300
|
-
'zn-icon': typeof ZnIcon;
|
|
6301
|
-
'zn-tooltip': typeof ZnTooltip;
|
|
6302
|
-
};
|
|
6303
|
-
private readonly formControlController;
|
|
6304
|
-
private readonly hasSlotController;
|
|
6305
|
-
input: HTMLInputElement;
|
|
6306
|
-
private hasFocus;
|
|
6307
|
-
title: string;
|
|
6308
|
-
/** The name of the input, submitted as a name/value pair with form data. */
|
|
6309
|
-
name: string;
|
|
6310
|
-
/** The current value of the input, submitted as a name/value pair with form data. */
|
|
6311
|
-
value: any;
|
|
6312
|
-
/** The default value of the form control. Primarily used for resetting the form control. */
|
|
6313
|
-
defaultValue: string;
|
|
6314
|
-
/** The inputs size **/
|
|
6315
|
-
size: 'small' | 'medium' | 'large';
|
|
6316
|
-
/** The inputs label. If you need to display HTML, use the `label` slot. **/
|
|
6317
|
-
label: string;
|
|
6318
|
-
/** Text that appears in a tooltip next to the label. If you need to display HTML in the tooltip, use the
|
|
6319
|
-
* `label-tooltip` slot.
|
|
6320
|
-
* **/
|
|
6321
|
-
labelTooltip: string;
|
|
6322
|
-
/**
|
|
6323
|
-
* Text that appears above the input, on the right, to add additional context. If you need to display HTML
|
|
6324
|
-
* in this text, use the `context-note` slot instead
|
|
6325
|
-
*/
|
|
6326
|
-
contextNote: string;
|
|
6327
|
-
/** The input's help text. If you need to display HTML, use the `help-text` slot instead. **/
|
|
6328
|
-
helpText: string;
|
|
6329
|
-
/** Disables the input **/
|
|
6330
|
-
disabled: boolean;
|
|
6331
|
-
/** Placeholder text to show as a hint when the input is empty. */
|
|
6332
|
-
placeholder: string;
|
|
6333
|
-
/** Makes the input read-only **/
|
|
6334
|
-
readonly: boolean;
|
|
6335
|
-
/**
|
|
6336
|
-
* By default, form-controls are associated with the nearest containing `<form>` element. This attribute allows you
|
|
6337
|
-
* to place the form control outside a form and associate it with the form that has this `id`. The form must be
|
|
6338
|
-
* in the same document or shadow root for this to work.
|
|
6339
|
-
*/
|
|
6340
|
-
form: string;
|
|
6341
|
-
flush: boolean;
|
|
6342
|
-
/** Makes the input a required field. */
|
|
6343
|
-
required: boolean;
|
|
6344
|
-
/** Adds a clear button to the calendar for removing a selected date. **/
|
|
6345
|
-
clearable: boolean;
|
|
6346
|
-
/** Makes the input a range picker. **/
|
|
6347
|
-
range: boolean;
|
|
6348
|
-
/** Disallows selecting past dates. **/
|
|
6349
|
-
disablePastDates: boolean;
|
|
6350
|
-
/** Minimum date that can be selected. Overrides disable-past-dates if both are set. Accepts Date object or date string. **/
|
|
6351
|
-
minDate?: string | Date;
|
|
6352
|
-
/** Maximum date that can be selected. Accepts Date object or date string. **/
|
|
6353
|
-
maxDate?: string | Date;
|
|
6354
|
-
/**
|
|
6355
|
-
* Date format for display and input. Uses AirDatepicker format tokens.
|
|
6356
|
-
*
|
|
6357
|
-
* Common formats:
|
|
6358
|
-
* - 'dd/MM/yyyy' (31/12/2024) - Default, European style
|
|
6359
|
-
* - 'MM/dd/yyyy' (12/31/2024) - US style
|
|
6360
|
-
* - 'yyyy-MM-dd' (2024-12-31) - ISO style
|
|
6361
|
-
* - 'dd-MM-yyyy' (31-12-2024) - Alternative European
|
|
6362
|
-
* - 'yyyy/MM/dd' (2024/12/31) - Alternative ISO
|
|
6363
|
-
*
|
|
6364
|
-
* Format tokens:
|
|
6365
|
-
* - dd: Day with leading zero (01-31)
|
|
6366
|
-
* - MM: Month with leading zero (01-12)
|
|
6367
|
-
* - yyyy: Full year (2024)
|
|
6368
|
-
*/
|
|
6369
|
-
format: string;
|
|
6370
|
-
private _instance;
|
|
6371
|
-
/** Gets the validity state object */
|
|
6372
|
-
get validity(): ValidityState;
|
|
6373
|
-
/** Gets the validation message */
|
|
6374
|
-
get validationMessage(): string;
|
|
6375
|
-
handleDisabledChange(): void;
|
|
6376
|
-
handleValueChange(): Promise<void>;
|
|
6377
|
-
handleDatepickerOptionsChange(): void;
|
|
6378
|
-
/** Sets focus on the input. */
|
|
6379
|
-
focus(options?: FocusOptions): void;
|
|
6380
|
-
/** Removes focus from the input. */
|
|
6381
|
-
blur(): void;
|
|
6382
|
-
/** Selects all the text in the input. */
|
|
6383
|
-
select(): void;
|
|
6384
|
-
/** Checks the validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
|
|
6385
|
-
checkValidity(): boolean;
|
|
6386
|
-
/** Gets the associated form, if one exists. */
|
|
6387
|
-
getForm(): HTMLFormElement | null;
|
|
6388
|
-
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
6389
|
-
reportValidity(): boolean;
|
|
6390
|
-
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
6391
|
-
setCustomValidity(message: string): void;
|
|
6392
|
-
init(): void;
|
|
6393
|
-
private handleInput;
|
|
6394
|
-
private handleChange;
|
|
6395
|
-
private handleInvalid;
|
|
6396
|
-
private handleKeyDown;
|
|
6397
|
-
private handlePaste;
|
|
6398
|
-
private handleBlur;
|
|
6399
|
-
private isValidDateString;
|
|
6400
|
-
private parseDate;
|
|
6401
|
-
private parseDateString;
|
|
6402
|
-
private isDateInRange;
|
|
6403
|
-
private clearInvalidDate;
|
|
6404
|
-
private getFormatSeparator;
|
|
6405
|
-
private escapeRegex;
|
|
6406
|
-
private normalizeDate;
|
|
6407
|
-
private autoFormatDate;
|
|
6408
|
-
protected updated(_changedProperties: PropertyValues): void;
|
|
6409
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
6410
|
-
}
|
|
6411
|
-
}
|
|
6412
|
-
declare module "components/datepicker/index" {
|
|
6413
|
-
import ZnDatepicker from "components/datepicker/datepicker.component";
|
|
6414
|
-
export * from "components/datepicker/datepicker.component";
|
|
6415
|
-
export default ZnDatepicker;
|
|
6416
|
-
global {
|
|
6417
|
-
interface HTMLElementTagNameMap {
|
|
6418
|
-
'zn-datepicker': ZnDatepicker;
|
|
6419
|
-
}
|
|
6420
|
-
}
|
|
6421
|
-
}
|
|
6422
6485
|
declare module "components/form-group/form-group.component" {
|
|
6423
6486
|
import { type CSSResultGroup } from 'lit';
|
|
6424
6487
|
import ZincElement from "internal/zinc-element";
|