@genexus/genexus-ide-ui 1.0.20 → 1.0.21

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.
Files changed (71) hide show
  1. package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
  2. package/dist/cjs/gx-ide-ai-message.cjs.entry.js +1 -1
  3. package/dist/cjs/gx-ide-dashboard-home.cjs.entry.js +1 -1
  4. package/dist/cjs/gx-ide-kb-manager-import.cjs.entry.js +1 -1
  5. package/dist/cjs/gx-ide-new-environment.cjs.entry.js +1 -1
  6. package/dist/cjs/gx-ide-new-kb.cjs.entry.js +1 -1
  7. package/dist/cjs/gx-ide-object-selector.cjs.entry.js +1 -1
  8. package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +1 -1
  9. package/dist/cjs/gx-ide-team-dev-update.cjs.entry.js +1 -1
  10. package/dist/cjs/gx-ide-ww-images.cjs.entry.js +279 -396
  11. package/dist/cjs/gx-ide-ww-images.cjs.entry.js.map +1 -1
  12. package/dist/cjs/{helpers-19194a5a.js → helpers-b5b4a659.js} +7 -1
  13. package/dist/cjs/helpers-b5b4a659.js.map +1 -0
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/collection/components/ww-images/gx-ide-assets/ww-images/langs/ww-images.lang.en.json +3 -7
  16. package/dist/collection/components/ww-images/gx-ide-assets/ww-images/langs/ww-images.lang.ja.json +4 -8
  17. package/dist/collection/components/ww-images/ww-images.css +733 -80
  18. package/dist/collection/components/ww-images/ww-images.js +413 -465
  19. package/dist/collection/components/ww-images/ww-images.js.map +1 -1
  20. package/dist/components/gx-ide-ww-images.js +306 -419
  21. package/dist/components/gx-ide-ww-images.js.map +1 -1
  22. package/dist/components/helpers.js +6 -1
  23. package/dist/components/helpers.js.map +1 -1
  24. package/dist/esm/genexus-ide-ui.js +1 -1
  25. package/dist/esm/gx-ide-ai-message.entry.js +1 -1
  26. package/dist/esm/gx-ide-dashboard-home.entry.js +1 -1
  27. package/dist/esm/gx-ide-kb-manager-import.entry.js +1 -1
  28. package/dist/esm/gx-ide-new-environment.entry.js +1 -1
  29. package/dist/esm/gx-ide-new-kb.entry.js +1 -1
  30. package/dist/esm/gx-ide-object-selector.entry.js +1 -1
  31. package/dist/esm/gx-ide-team-dev-commit.entry.js +1 -1
  32. package/dist/esm/gx-ide-team-dev-update.entry.js +1 -1
  33. package/dist/esm/gx-ide-ww-images.entry.js +279 -396
  34. package/dist/esm/gx-ide-ww-images.entry.js.map +1 -1
  35. package/dist/esm/{helpers-9ee6ddce.js → helpers-64e1dd0b.js} +7 -2
  36. package/dist/esm/helpers-64e1dd0b.js.map +1 -0
  37. package/dist/esm/loader.js +1 -1
  38. package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
  39. package/dist/genexus-ide-ui/genexus-ide-ui.esm.js.map +1 -1
  40. package/dist/genexus-ide-ui/gx-ide-assets/ww-images/langs/ww-images.lang.en.json +3 -7
  41. package/dist/genexus-ide-ui/gx-ide-assets/ww-images/langs/ww-images.lang.ja.json +4 -8
  42. package/dist/genexus-ide-ui/{p-c4d1d0ce.entry.js → p-39792ac8.entry.js} +2 -2
  43. package/dist/genexus-ide-ui/{p-806fc181.entry.js → p-4a0dab98.entry.js} +2 -2
  44. package/dist/genexus-ide-ui/{p-acf0cbac.entry.js → p-4ce47bcd.entry.js} +2 -2
  45. package/dist/genexus-ide-ui/p-62f4ad99.entry.js +612 -0
  46. package/dist/genexus-ide-ui/p-62f4ad99.entry.js.map +1 -0
  47. package/dist/genexus-ide-ui/{p-278afab1.entry.js → p-6abe5291.entry.js} +2 -2
  48. package/dist/genexus-ide-ui/{p-4ce0a85e.entry.js → p-ac670f62.entry.js} +2 -2
  49. package/dist/genexus-ide-ui/{p-066028bc.js → p-c339f703.js} +14 -8
  50. package/dist/{cjs/helpers-19194a5a.js.map → genexus-ide-ui/p-c339f703.js.map} +1 -1
  51. package/dist/genexus-ide-ui/{p-b785673d.entry.js → p-ca8b0024.entry.js} +2 -2
  52. package/dist/genexus-ide-ui/{p-44d779c9.entry.js → p-e8975ac0.entry.js} +2 -2
  53. package/dist/genexus-ide-ui/{p-8c986256.entry.js → p-f1558097.entry.js} +2 -2
  54. package/dist/types/components/ww-images/ww-images.d.ts +118 -98
  55. package/dist/types/components.d.ts +62 -34
  56. package/package.json +1 -1
  57. package/dist/collection/components/ww-images/helpers.js +0 -11
  58. package/dist/collection/components/ww-images/helpers.js.map +0 -1
  59. package/dist/esm/helpers-9ee6ddce.js.map +0 -1
  60. package/dist/genexus-ide-ui/p-066028bc.js.map +0 -1
  61. package/dist/genexus-ide-ui/p-62efd8f2.entry.js +0 -712
  62. package/dist/genexus-ide-ui/p-62efd8f2.entry.js.map +0 -1
  63. package/dist/types/components/ww-images/helpers.d.ts +0 -3
  64. /package/dist/genexus-ide-ui/{p-c4d1d0ce.entry.js.map → p-39792ac8.entry.js.map} +0 -0
  65. /package/dist/genexus-ide-ui/{p-806fc181.entry.js.map → p-4a0dab98.entry.js.map} +0 -0
  66. /package/dist/genexus-ide-ui/{p-acf0cbac.entry.js.map → p-4ce47bcd.entry.js.map} +0 -0
  67. /package/dist/genexus-ide-ui/{p-278afab1.entry.js.map → p-6abe5291.entry.js.map} +0 -0
  68. /package/dist/genexus-ide-ui/{p-4ce0a85e.entry.js.map → p-ac670f62.entry.js.map} +0 -0
  69. /package/dist/genexus-ide-ui/{p-b785673d.entry.js.map → p-ca8b0024.entry.js.map} +0 -0
  70. /package/dist/genexus-ide-ui/{p-44d779c9.entry.js.map → p-e8975ac0.entry.js.map} +0 -0
  71. /package/dist/genexus-ide-ui/{p-8c986256.entry.js.map → p-f1558097.entry.js.map} +0 -0
@@ -1,179 +1,194 @@
1
1
  import { EventEmitter } from "../../stencil-public-runtime";
2
- import { ComboBoxModel } from "@genexus/chameleon-controls-library";
3
- import { ContextMenuInfo, EntityData, GxOption } from "../../common/types";
2
+ import { GxOption } from "../../common/types";
3
+ import { EntityData, ContextMenuInfo } from "../../common/types";
4
4
  export declare class GxIdeWWImages {
5
- #private;
6
- el: HTMLGxIdeWwImagesElement;
7
- categoriesComboBoxModel: ComboBoxModel;
8
- densitiesComboBoxModel: ComboBoxModel;
9
- languagesComboBoxModel: ComboBoxModel;
10
- layersComboBoxModel: ComboBoxModel;
11
- stylesComboBoxModel: ComboBoxModel;
12
- /**
13
- * If true the filter sidebar will be expanded, otherwise collapsed.
14
- */
15
- filterSidebarExpanded: boolean;
16
5
  /**
17
- * The current value of the "After" combo box options.
6
+ * The component hard-coded strings translations.
18
7
  */
19
- afterCurrentValue: string;
20
- /**
21
- * The options for the "After" combo-box
8
+ private _componentLocale;
9
+ private renderedFirstTime;
10
+ private filterInitialData;
11
+ el: HTMLGxIdeWwImagesElement;
12
+ private filterEl;
13
+ private filterNameEl;
14
+ private filterSearchContentsEl;
15
+ private filterCategoryEl;
16
+ private filterModuleEl;
17
+ private filterModifiedEl;
18
+ private filterAllDescendantsEl;
19
+ private filterAfterTypeEl;
20
+ private filterUserEl;
21
+ private filterModifiedDateEl;
22
+ private filterStyleEl;
23
+ private filterLanguageEl;
24
+ private filterDensityEl;
25
+ private filterLayerEl;
26
+ private chGridEl;
27
+ filtersHidden: boolean;
28
+ filtersHiddenHandler(hidden: boolean): void;
29
+ /**
30
+ * The after types render in the after selector
31
+ */
32
+ filterAfterType: string;
33
+ /**
34
+ * For show or hide the filters relative to modifiers
22
35
  */
23
- filterAfterOptions: ComboBoxModel;
36
+ filterModified: boolean;
24
37
  /**
25
- * Images filter input value
38
+ * The images rendered in the table
26
39
  */
27
- filterImagesInputValue: string;
40
+ images: ImageData[];
28
41
  /**
29
- * Shows or hides filters related to modifiers
42
+ * The images rendered in the table, after the filter
30
43
  */
31
- filterModified: boolean;
44
+ filteredImages: ImageData[];
32
45
  /**
33
- * Images rendered in the table after filtering
46
+ * The items of the image that is selected
34
47
  */
35
- filteredImages: ImageData[];
48
+ imagesSelectedItems: ImageItemData[];
36
49
  /**
37
- * Images rendered in the table
50
+ * The selected images in the table of images
38
51
  */
39
- images: ImageData[];
52
+ selectedObjectsIds: string[];
40
53
  /**
41
- * Items of the selected image
54
+ * The images filter input text value
42
55
  */
43
- imagesSelectedItems: ImageItemData[];
56
+ filterImagesInputValue: string;
44
57
  /**
45
- * Selected images in the images table
58
+ * If true it displays the component title on the header
46
59
  */
47
- selectedObjectsIds: string[];
60
+ readonly displayTitle = false;
48
61
  /**
49
- * If true, the "Toggle Filter" button will display activated, and the sidebar of filters
50
- * will toggle on mouse enter or leave.
62
+ * Displays a secondary filter, used to filter over the filtered images
51
63
  */
52
- toggleFilterButtonActive: boolean;
53
- toggleFilterButtonActiveChanged(active: boolean): void;
64
+ readonly secondaryFilter = false;
54
65
  /**
55
- * Categories rendered in the filter selector
66
+ * The categories render in the filter category selector
56
67
  */
57
68
  readonly categories: GxOption[];
58
- categoriesChanged(newCategories: GxOption[]): void;
59
69
  /**
60
- * Function to expand data when right-click
70
+ * The densities render in the filter density selector
61
71
  */
62
- readonly contextMenuCallback: ContextMenuCallback;
72
+ readonly densities: GxOption[];
63
73
  /**
64
- * Default value for the 'categories' filter
74
+ * The default value for the 'categories' filter
65
75
  */
66
76
  readonly defaultCategory: string;
67
77
  /**
68
- * Default value for the module/folder filter
78
+ * The default value for the module/folder filter
69
79
  */
70
80
  readonly defaultModule: EntityData;
71
81
  /**
72
- * Function to delete the selected images.
82
+ * The default value for the type filter
73
83
  */
74
- readonly deleteSelectionCallback: DeleteSelectionCallback;
84
+ readonly defaultType: string;
75
85
  /**
76
- * Densities rendered in the filter selector
86
+ * The modules/folders render in the module/folder selector
77
87
  */
78
- readonly densities: GxOption[];
79
- densitiesChanged(newDensities: GxOption[]): void;
88
+ readonly filterModules: GxOption[];
80
89
  /**
81
- * Languages rendered in the filter selector
90
+ * The languages render in the filter language selector
82
91
  */
83
92
  readonly languages: GxOption[];
84
- languagesChanged(newLanguages: GxOption[]): void;
85
93
  /**
86
- * Layers rendered in the filter selector
94
+ * The layers render in the filter layer selector
87
95
  */
88
96
  readonly layers: GxOption[];
89
- layersChanged(newLayers: GxOption[]): void;
90
97
  /**
91
- * Function that returns a list of images for the table
98
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
99
+ */
100
+ readonly contextMenuCallback: ContextMenuCallback;
101
+ /**
102
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
103
+ */
104
+ readonly deleteSelectionCallback: DeleteSelectionCallback;
105
+ /**
106
+ * This is a function provided by the developer that return a list of images to populate the table of images.
92
107
  */
93
108
  readonly loadCallback: LoadCallback;
94
109
  /**
95
- * Function that returns a list of items for the selected image
110
+ * This is a function provided by the developer that return a list of items of the image selected.
96
111
  */
97
112
  readonly loadImageItemsCallback: LoadImageItemsCallback;
98
113
  /**
99
- * Callback invoked when user press New button.
114
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
100
115
  */
101
116
  readonly newObjectCallback: NewObjectCallback;
102
117
  /**
103
- * Function to expand data for double-clicked or entered images
118
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
104
119
  */
105
120
  readonly openSelectionCallback: OpenSelectionCallback;
106
121
  /**
107
- * Callback invoked when an action is executed on the Module/Folder filter.
122
+ * Callback invoked when the action is executed on the Module/Folder filter (button '...'). It returns the information of the selected object (id and name) or 'undefined' if it was canceled.
108
123
  */
109
124
  readonly selectModuleCallback: SelectModuleCallback;
110
125
  /**
111
- * Callback invoked when an item is selected
126
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
112
127
  */
113
128
  readonly selectionObjectChangedCallback: SelectionObjectCallback;
114
- /**
115
- * Displays a secondary filter, used to filter over the filtered images
116
- */
117
- readonly secondaryFilter = false;
118
129
  /**
119
130
  * Applies a shadow all around
120
131
  */
121
132
  readonly shadow = false;
122
133
  /**
123
- * Styles rendered in the filter style selector
134
+ * The styles render in the filter style selector
124
135
  */
125
136
  readonly styles: GxOption[];
126
- stylesChanged(newStyles: GxOption[]): void;
127
137
  /**
128
- * Types rendered in the filter type selector
138
+ * The types render in the filter type selector
129
139
  */
130
140
  readonly types: GxOption[];
131
- connectedCallback(): Promise<void>;
132
141
  /**
133
- * Emitted once after the component fully loads and renders for the first time.
142
+ * This event is emitted once just after the component is fully loaded and the first render() occurs.
134
143
  */
135
144
  componentDidLoadEvent: EventEmitter<boolean>;
136
145
  /**
137
146
  * @description Gets fired when the component has rendered for the first time.
138
147
  */
139
148
  componentDidRenderFirstTime: EventEmitter<string>;
149
+ componentWillLoad(): Promise<void>;
140
150
  componentDidLoad(): void;
141
151
  componentDidRender(): void;
142
- componentWillLoad(): Promise<void>;
143
152
  keyDownHandler(eventInfo: KeyboardEvent): void;
144
153
  /**
145
- * Reloads the view, refreshing the filters and the images table.
154
+ * Validate necessary data input
155
+ */
156
+ validate(): Promise<boolean>;
157
+ /**
158
+ * This method reload the view, refreshing the filters and the table of images.
146
159
  */
147
160
  reload(): Promise<void>;
161
+ private attachDetectClickOutsideFilter;
162
+ private removeDetectClickOutsideFilter;
163
+ private detectClickOutsideFilter;
164
+ /**
165
+ * @description This is needed for resetting the filter. When the user resets the filter, all the filter controls values have to be restored to the value they had on componentDidLoad.
166
+ */
167
+ private saveInitialFilterData;
168
+ private renderFilter;
169
+ private renderImagesData;
170
+ private renderImages;
171
+ private getImages;
172
+ private newObjectCallbackHandler;
173
+ private openSelectionCallBackHandler;
174
+ private deleteSelectionCallbackHandler;
175
+ private resetFilterHandler;
176
+ private toggleFiltersHandler;
177
+ private selectAll;
178
+ private deselectAll;
179
+ private listenChanges;
180
+ private filterInputHandler;
181
+ private filterImagesInformationHandler;
148
182
  render(): void;
149
183
  }
150
- export type ContextMenuCallback = (contextMenuInfo: ContextMenuInfo) => Promise<void>;
184
+ export type SelectionObjectCallback = (ids: string[]) => Promise<void>;
185
+ export type OpenSelectionCallback = (ids: string[]) => Promise<void>;
151
186
  export type DeleteSelectionCallback = (ids: string[]) => Promise<void>;
152
- export type FilerInitialData = {
153
- name: string;
154
- module: EntityData;
155
- searchContents: string;
156
- category: string;
157
- allDescendants: string;
158
- modifiedAfter: string;
159
- modifiedDateTime: string;
160
- modifiedUser: string;
161
- style: string;
162
- language: string;
163
- density: string;
164
- layer: string;
165
- };
166
- export type ImageData = {
167
- id: string;
168
- icon: string;
169
- name: string;
170
- description: string;
171
- parent: string;
172
- module: string;
173
- modifiedDate?: Date;
174
- lastUser?: string;
175
- importDate?: Date;
176
- };
187
+ export type SelectModuleCallback = () => Promise<EntityData | undefined>;
188
+ export type ContextMenuCallback = (contextMenuInfo: ContextMenuInfo) => Promise<void>;
189
+ export type NewObjectCallback = () => Promise<void>;
190
+ export type LoadCallback = (filters: ImageFiltersData) => Promise<ImageData[]>;
191
+ export type LoadImageItemsCallback = (id: string) => Promise<ImageItemData[]>;
177
192
  export type ImageFiltersData = {
178
193
  name?: string;
179
194
  searchContents?: string;
@@ -188,14 +203,19 @@ export type ImageFiltersData = {
188
203
  density?: string;
189
204
  layer?: string;
190
205
  };
206
+ export type ImageData = {
207
+ id: string;
208
+ icon: string;
209
+ name: string;
210
+ description: string;
211
+ parent: string;
212
+ module: string;
213
+ modifiedDate?: Date;
214
+ lastUser?: string;
215
+ importDate?: Date;
216
+ };
191
217
  export type ImageItemData = {
192
218
  id: string;
193
219
  name: string;
194
220
  url: string;
195
221
  };
196
- export type LoadCallback = (filters: ImageFiltersData) => Promise<ImageData[]>;
197
- export type LoadImageItemsCallback = (id: string) => Promise<ImageItemData[]>;
198
- export type NewObjectCallback = () => Promise<void>;
199
- export type OpenSelectionCallback = (ids: string[]) => Promise<void>;
200
- export type SelectModuleCallback = () => Promise<EntityData | undefined>;
201
- export type SelectionObjectCallback = (ids: string[]) => Promise<void>;
@@ -1766,55 +1766,67 @@ export namespace Components {
1766
1766
  }
1767
1767
  interface GxIdeWwImages {
1768
1768
  /**
1769
- * Categories rendered in the filter selector
1769
+ * The categories render in the filter category selector
1770
1770
  */
1771
1771
  "categories": GxOption[];
1772
1772
  /**
1773
- * Function to expand data when right-click
1773
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
1774
1774
  */
1775
1775
  "contextMenuCallback": ContextMenuCallback;
1776
1776
  /**
1777
- * Default value for the 'categories' filter
1777
+ * The default value for the 'categories' filter
1778
1778
  */
1779
1779
  "defaultCategory": string;
1780
1780
  /**
1781
- * Default value for the module/folder filter
1781
+ * The default value for the module/folder filter
1782
1782
  */
1783
1783
  "defaultModule": EntityData;
1784
1784
  /**
1785
- * Function to delete the selected images.
1785
+ * The default value for the type filter
1786
+ */
1787
+ "defaultType": string;
1788
+ /**
1789
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
1786
1790
  */
1787
1791
  "deleteSelectionCallback": DeleteSelectionCallback;
1788
1792
  /**
1789
- * Densities rendered in the filter selector
1793
+ * The densities render in the filter density selector
1790
1794
  */
1791
1795
  "densities": GxOption[];
1792
1796
  /**
1793
- * Languages rendered in the filter selector
1797
+ * If true it displays the component title on the header
1798
+ */
1799
+ "displayTitle": false;
1800
+ /**
1801
+ * The modules/folders render in the module/folder selector
1802
+ */
1803
+ "filterModules": GxOption[];
1804
+ /**
1805
+ * The languages render in the filter language selector
1794
1806
  */
1795
1807
  "languages": GxOption[];
1796
1808
  /**
1797
- * Layers rendered in the filter selector
1809
+ * The layers render in the filter layer selector
1798
1810
  */
1799
1811
  "layers": GxOption[];
1800
1812
  /**
1801
- * Function that returns a list of images for the table
1813
+ * This is a function provided by the developer that return a list of images to populate the table of images.
1802
1814
  */
1803
1815
  "loadCallback": LoadCallback5;
1804
1816
  /**
1805
- * Function that returns a list of items for the selected image
1817
+ * This is a function provided by the developer that return a list of items of the image selected.
1806
1818
  */
1807
1819
  "loadImageItemsCallback": LoadImageItemsCallback;
1808
1820
  /**
1809
- * Callback invoked when user press New button.
1821
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
1810
1822
  */
1811
1823
  "newObjectCallback": NewObjectCallback1;
1812
1824
  /**
1813
- * Function to expand data for double-clicked or entered images
1825
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
1814
1826
  */
1815
1827
  "openSelectionCallback": OpenSelectionCallback1;
1816
1828
  /**
1817
- * Reloads the view, refreshing the filters and the images table.
1829
+ * This method reload the view, refreshing the filters and the table of images.
1818
1830
  */
1819
1831
  "reload": () => Promise<void>;
1820
1832
  /**
@@ -1822,11 +1834,11 @@ export namespace Components {
1822
1834
  */
1823
1835
  "secondaryFilter": false;
1824
1836
  /**
1825
- * Callback invoked when an action is executed on the Module/Folder filter.
1837
+ * Callback invoked when the action is executed on the Module/Folder filter (button '...'). It returns the information of the selected object (id and name) or 'undefined' if it was canceled.
1826
1838
  */
1827
1839
  "selectModuleCallback": SelectModuleCallback3;
1828
1840
  /**
1829
- * Callback invoked when an item is selected
1841
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
1830
1842
  */
1831
1843
  "selectionObjectChangedCallback": SelectionObjectCallback;
1832
1844
  /**
@@ -1834,13 +1846,17 @@ export namespace Components {
1834
1846
  */
1835
1847
  "shadow": false;
1836
1848
  /**
1837
- * Styles rendered in the filter style selector
1849
+ * The styles render in the filter style selector
1838
1850
  */
1839
1851
  "styles": GxOption[];
1840
1852
  /**
1841
- * Types rendered in the filter type selector
1853
+ * The types render in the filter type selector
1842
1854
  */
1843
1855
  "types": GxOption[];
1856
+ /**
1857
+ * Validate necessary data input
1858
+ */
1859
+ "validate": () => Promise<boolean>;
1844
1860
  }
1845
1861
  }
1846
1862
  export interface GxIdeAiAssistantCustomEvent<T> extends CustomEvent<T> {
@@ -4514,51 +4530,63 @@ declare namespace LocalJSX {
4514
4530
  }
4515
4531
  interface GxIdeWwImages {
4516
4532
  /**
4517
- * Categories rendered in the filter selector
4533
+ * The categories render in the filter category selector
4518
4534
  */
4519
4535
  "categories": GxOption[];
4520
4536
  /**
4521
- * Function to expand data when right-click
4537
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
4522
4538
  */
4523
4539
  "contextMenuCallback": ContextMenuCallback;
4524
4540
  /**
4525
- * Default value for the 'categories' filter
4541
+ * The default value for the 'categories' filter
4526
4542
  */
4527
4543
  "defaultCategory"?: string;
4528
4544
  /**
4529
- * Default value for the module/folder filter
4545
+ * The default value for the module/folder filter
4530
4546
  */
4531
4547
  "defaultModule"?: EntityData;
4532
4548
  /**
4533
- * Function to delete the selected images.
4549
+ * The default value for the type filter
4550
+ */
4551
+ "defaultType"?: string;
4552
+ /**
4553
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
4534
4554
  */
4535
4555
  "deleteSelectionCallback": DeleteSelectionCallback;
4536
4556
  /**
4537
- * Densities rendered in the filter selector
4557
+ * The densities render in the filter density selector
4538
4558
  */
4539
4559
  "densities": GxOption[];
4540
4560
  /**
4541
- * Languages rendered in the filter selector
4561
+ * If true it displays the component title on the header
4562
+ */
4563
+ "displayTitle"?: false;
4564
+ /**
4565
+ * The modules/folders render in the module/folder selector
4566
+ */
4567
+ "filterModules": GxOption[];
4568
+ /**
4569
+ * The languages render in the filter language selector
4542
4570
  */
4543
4571
  "languages": GxOption[];
4544
4572
  /**
4545
- * Layers rendered in the filter selector
4573
+ * The layers render in the filter layer selector
4546
4574
  */
4547
4575
  "layers": GxOption[];
4548
4576
  /**
4549
- * Function that returns a list of images for the table
4577
+ * This is a function provided by the developer that return a list of images to populate the table of images.
4550
4578
  */
4551
4579
  "loadCallback": LoadCallback5;
4552
4580
  /**
4553
- * Function that returns a list of items for the selected image
4581
+ * This is a function provided by the developer that return a list of items of the image selected.
4554
4582
  */
4555
4583
  "loadImageItemsCallback": LoadImageItemsCallback;
4556
4584
  /**
4557
- * Callback invoked when user press New button.
4585
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
4558
4586
  */
4559
4587
  "newObjectCallback": NewObjectCallback1;
4560
4588
  /**
4561
- * Emitted once after the component fully loads and renders for the first time.
4589
+ * This event is emitted once just after the component is fully loaded and the first render() occurs.
4562
4590
  */
4563
4591
  "onComponentDidLoadEvent"?: (event: GxIdeWwImagesCustomEvent<boolean>) => void;
4564
4592
  /**
@@ -4566,7 +4594,7 @@ declare namespace LocalJSX {
4566
4594
  */
4567
4595
  "onComponentDidRenderFirstTime"?: (event: GxIdeWwImagesCustomEvent<string>) => void;
4568
4596
  /**
4569
- * Function to expand data for double-clicked or entered images
4597
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
4570
4598
  */
4571
4599
  "openSelectionCallback": OpenSelectionCallback1;
4572
4600
  /**
@@ -4574,11 +4602,11 @@ declare namespace LocalJSX {
4574
4602
  */
4575
4603
  "secondaryFilter"?: false;
4576
4604
  /**
4577
- * Callback invoked when an action is executed on the Module/Folder filter.
4605
+ * Callback invoked when the action is executed on the Module/Folder filter (button '...'). It returns the information of the selected object (id and name) or 'undefined' if it was canceled.
4578
4606
  */
4579
4607
  "selectModuleCallback": SelectModuleCallback3;
4580
4608
  /**
4581
- * Callback invoked when an item is selected
4609
+ * This is a function provided by the developer for expanded the data of images that is double-clicked or entered.
4582
4610
  */
4583
4611
  "selectionObjectChangedCallback": SelectionObjectCallback;
4584
4612
  /**
@@ -4586,11 +4614,11 @@ declare namespace LocalJSX {
4586
4614
  */
4587
4615
  "shadow"?: false;
4588
4616
  /**
4589
- * Styles rendered in the filter style selector
4617
+ * The styles render in the filter style selector
4590
4618
  */
4591
4619
  "styles": GxOption[];
4592
4620
  /**
4593
- * Types rendered in the filter type selector
4621
+ * The types render in the filter type selector
4594
4622
  */
4595
4623
  "types": GxOption[];
4596
4624
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genexus/genexus-ide-ui",
3
3
  "license": "Apache-2.0",
4
- "version": "1.0.20",
4
+ "version": "1.0.21",
5
5
  "description": "GeneXus IDE UI components",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.js",
@@ -1,11 +0,0 @@
1
- export const mapOptionsToComboBoxItemModel = (options) => {
2
- return options.map(option => {
3
- var _a;
4
- return {
5
- value: option.id,
6
- caption: option.label,
7
- startImgSrc: (_a = option.iconName) !== null && _a !== void 0 ? _a : ""
8
- };
9
- });
10
- };
11
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/components/ww-images/helpers.tsx"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,OAAmB,EACJ,EAAE;IACjB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;;QAC1B,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,EAAE;YAChB,OAAO,EAAE,MAAM,CAAC,KAAK;YACrB,WAAW,EAAE,MAAA,MAAM,CAAC,QAAQ,mCAAI,EAAE;SACnC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { ComboBoxModel } from \"@genexus/chameleon-controls-library\";\nimport { GxOption } from \"../..\";\n\nexport const mapOptionsToComboBoxItemModel = (\n options: GxOption[]\n): ComboBoxModel => {\n return options.map(option => {\n return {\n value: option.id,\n caption: option.label,\n startImgSrc: option.iconName ?? \"\"\n };\n });\n};\n"]}
@@ -1 +0,0 @@
1
- {"file":"helpers-9ee6ddce.js","mappings":";;AAWA,MAAM,UAAU,GAAG;IACjB,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;CACX,CAAC;AA8EF,MAAM,aAAa,GAAG,CAAC,IAAU;IAC/B,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;;IAEzB,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;;IAExD,MAAM,cAAc,GAAG,cAAc,IAAI,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF;AACA;AACA;AAEA,MAAM,OAAO,GAAG,CAAC,IAAU;IACzB,MAAM,K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IAAI,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;QAChD,QACE,YACE,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,gCAAgC,CAAC,GACvD,EACR;KACH;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,EAAE;MAWW,6BAA6B,GAAG,CAC3C,OAAmB,KAEnB,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK;IACrB,KAAK,EAAE,MAAM,CAAC,EAAE;IAChB,OAAO,EAAE,MAAM,CAAC,KAAK;;CAEtB,CAAC,EAAE;MAEO,qBAAqB,GAAG,CACnC,OAA+B,EAC/B,4BAES,EACT,UAAoB;IAEpB,OAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,MAAM;QACxB,MAAM,KAAK,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAC5B,EAAE,IAAI,MAAM,CAAC,KAAK,KAAK,EAAE,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,CAC9C,CAAC;QACF,QACE,mBACE,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,KAAK,EAAC,UAAU,EAChB,YAAY,EAAE,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,EAAE,EACvC,OAAO,EAAE,MAAM,CAAC,KAAK,EACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,4BAA4B,EACrC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAC5B,GAAG,EAAE,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,EAAE,GACjB,EACf;KACH,CAAC,CAAC;AACL;;;;","names":[],"sources":["src/common/helpers.tsx"],"sourcesContent":["import { h } from \"@stencil/core\";\n\nimport {\n ChCheckboxCustomEvent,\n ComboBoxModel,\n TreeViewItemModel\n} from \"@genexus/chameleon-controls-library\";\nexport type ChCheckboxArray = HTMLChCheckboxElement[] | null;\n\nimport { GxOption } from \"./types\";\n\nconst daysOfWeek = [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\"\n];\n\n/**\n * @param element an HTMLElement\n * @returns an alphabetically ordered array of all the parts and exportparts the element contains.\n */\nexport const getElementSelectorParts = (element: HTMLElement) => {\n const queries: string[] = [];\n const elementParts = element.shadowRoot?.querySelectorAll(`[part]`);\n const elementExportParts =\n element.shadowRoot?.querySelectorAll(`[exportparts]`);\n\n elementParts?.forEach(el => {\n queries.push(\n `${element.tagName.toLowerCase()}::part(${el.getAttribute(\"part\")})`\n );\n });\n elementExportParts?.forEach(el => {\n queries.push(\n ...[\n ...el.getAttribute(\"exportparts\").matchAll(/(?:[\\w-]+:)?([\\w-]+)/g)\n ].map(item => `${element.tagName.toLowerCase()}::part(${item[1]})`)\n );\n });\n\n return queries.sort();\n};\n\n/**\n * @param selector a part selector\n * @returns A reference to the element the part belongs to.\n */\nexport const querySelectorPart = (selector: string) => {\n const querySelectorDeep = (\n element: HTMLElement,\n parts: string\n ): HTMLElement => {\n const shadow = element.shadowRoot;\n const partList = parts.split(\" \");\n\n const partElement: HTMLElement = shadow.querySelector(\n partList.map(partName => `[part~=\"${partName}\"]`).join(\"\")\n );\n if (partElement) {\n return partElement;\n }\n\n const exportPartElement: HTMLElement = shadow.querySelector(\n partList.map(partName => `[exportparts*=\"${partName}\"]`).join(\"\")\n );\n if (exportPartElement) {\n const exportPartList: string[] = [];\n const exportparts = exportPartElement.getAttribute(\"exportparts\");\n\n partList.forEach(partItem => {\n const exportPartName = exportparts.match(\n `(?:([\\\\w-]+):)?(${partItem})`\n )[1];\n if (exportPartName) {\n exportPartList.push(exportPartName);\n }\n });\n\n if (partList.length === exportPartList.length) {\n return querySelectorDeep(exportPartElement, exportPartList.join(\" \"));\n }\n }\n\n return null;\n };\n\n const selectorItems = selector.match(\"(.*)::part\\\\(([^)]+)\\\\)\");\n const entity = selectorItems[1];\n const partName = selectorItems[2];\n\n return querySelectorDeep(document.querySelector(entity), partName);\n};\n\nconst daysFromToday = (date: Date): number => {\n const today = new Date();\n // To calculate the time difference of two dates\n const timeDifference = today.getTime() - date.getTime();\n // To calculate the no. of days between two dates\n const daysDifference = timeDifference / (1000 * 3600 * 24);\n return Math.floor(daysDifference);\n};\n\n// - - - - - - - - - - - -\n// Date Functions\n// - - - - - - - - - - - -\n\nconst isToday = (date: Date): boolean => {\n const today = new Date();\n if (today.toDateString() === date.toDateString()) {\n return true;\n }\n return false;\n};\n\nconst isYesterday = (date: Date): boolean => {\n const yesterday = new Date();\n yesterday.setDate(yesterday.getDate() - 1);\n if (yesterday.toDateString() === date.toDateString()) {\n return true;\n }\n return false;\n};\n\nexport const formatDate = (\n date: Date,\n type: FormatDateType = \"date-time\"\n): string => {\n let formattedDate;\n // validate date\n // undefined or null\n if (date === undefined || date === null) {\n return \"\";\n }\n // If the date object is invalid it will return 'NaN' on getTime() and NaN is never equal to itself\n const dateIsValid = date.getTime() === date.getTime();\n if (!dateIsValid) {\n return \"Invalid date\";\n }\n let locale = \"en-US\";\n const lang = document\n .getElementsByTagName(\"html\")[0]\n .getAttribute(\"lang\")\n ?.valueOf();\n if (lang === \"es\") {\n locale = \"es-ES\";\n }\n formattedDate = date.toLocaleDateString(locale);\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n const hours = String(date.getHours()).padStart(2, \"0\");\n const minutes = String(date.getMinutes()).padStart(2, \"0\");\n const time = `${hours}:${minutes}`;\n if (type === \"date-time\") {\n formattedDate += ` / ${date.toLocaleTimeString()}`;\n } else if (type === \"date-time-short\") {\n // No seconds\n if (locale === \"es-ES\") {\n formattedDate = `${year}-${month}-${day} ${time}`;\n } else {\n formattedDate = `${month}/${day}/${year} ${time}`;\n }\n } else if (\"pretty\") {\n const daysPassedFromToday = daysFromToday(date);\n const today = new Date();\n const currentYear = today.getFullYear();\n if (isToday(date)) {\n return `Today ${time}`;\n } else if (isYesterday(date)) {\n return `Yesterday ${time}`;\n } else if (daysPassedFromToday <= 7) {\n // If one week or less, just show the day of the week, and the time\n const day = daysOfWeek[date.getDay()];\n return `${day} ${time}`;\n } else if (currentYear === year) {\n // If current year, show day number and month name. Example: November 17th\n if (locale === \"es-ES\") {\n formattedDate = `${day} de ${date.toLocaleString(\"es-ES\", {\n month: \"long\"\n })} ${time}`;\n } else {\n formattedDate = `${date.toLocaleString(\"en-US\", {\n month: \"long\"\n })} ${day} ${time}`;\n }\n } else {\n // Display date as usual\n formattedDate = formatDate(date, \"date-time-short\");\n }\n }\n return formattedDate;\n};\n\nexport type FormatDateType =\n | \"date\"\n | \"date-time\"\n | \"date-time-short\"\n | \"pretty\";\n\n// - - - - - - - - - - - -\n// /End of Date Functions\n// - - - - - - - - - - - -\n\n/* Count the total tree nodes (by default it does not count the first level nodes)*/\nexport const countTreeItems = (\n treeModel: TreeViewItemModel[],\n children = false\n): number => {\n let totalNodes = 0;\n treeModel.forEach(node => {\n children && totalNodes++;\n if (node.items) {\n totalNodes += countTreeItems(node.items, true);\n }\n });\n return totalNodes;\n};\n\n/**\n * @description it evaluates the initial selected combo item\n * @param options an array of GxOption\n * @returns the initial combo value, which in this case is the id\n */\nexport const setInitialComboValue = (options: GxOption[]): string => {\n const selected = options.find(option => option.selected);\n if (selected) {\n return selected.value || selected.id;\n } else {\n return options[0].value || options[0].id;\n }\n};\n\nexport const escapeRegExp = (str: string) => {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n};\n\n/**\n * @description this function highlights the character(s) that match(es) the filter value.\n * hiChar comes from (hi)light (Char)acters\n * @param text the string to find the filter value on\n * @param filterValue the filter value\n * @returns a span element\n */\nexport const hiChar = function (text: string, filterValue: string) {\n if (text && filterValue) {\n const escapedFilterValue = escapeRegExp(filterValue);\n const re = new RegExp(escapedFilterValue, \"gi\");\n return (\n <span\n innerHTML={text.replace(re, '<span class=\"hiChar\">$&</span>')}\n ></span>\n );\n } else {\n return text;\n }\n};\n\nexport const closeOnOutsideClickHandler = (\n eventInfo: PointerEvent,\n ref: HTMLElement\n): true | void => {\n if (!eventInfo.composedPath().includes(ref)) {\n return true;\n }\n};\n\nexport const mapOptionsToComboBoxItemModel = (\n options: GxOption[]\n): ComboBoxModel =>\n options.map(option => ({\n value: option.id,\n caption: option.label\n // startImgSrc: option.iconName\n }));\n\nexport const renderChCheckboxItems = (\n options: GxOption[] | undefined,\n frontEndCheckboxInputHandler: (\n event: ChCheckboxCustomEvent<string> | InputEvent\n ) => void,\n checkedIds: string[]\n): HTMLChCheckboxElement[] => {\n return options?.map(option => {\n const value = checkedIds?.find(\n id => option.value === id || option.id === id\n );\n return (\n <ch-checkbox\n name={option.name}\n class=\"checkbox\"\n checkedValue={option.value || option.id}\n caption={option.label}\n disabled={option.disabled}\n value={value}\n onInput={frontEndCheckboxInputHandler}\n startImgSrc={option.iconName}\n key={option.value || option.id}\n ></ch-checkbox>\n );\n });\n};\n"],"version":3}
@@ -1 +0,0 @@
1
- {"version":3,"names":["daysOfWeek","daysFromToday","date","today","Date","timeDifference","getTime","daysDifference","Math","floor","isToday","toDateString","isYesterday","yesterday","setDate","getDate","formatDate","type","formattedDate","undefined","dateIsValid","locale","lang","_a","document","getElementsByTagName","getAttribute","valueOf","toLocaleDateString","year","getFullYear","month","String","getMonth","padStart","day","hours","getHours","minutes","getMinutes","time","toLocaleTimeString","daysPassedFromToday","currentYear","getDay","toLocaleString","countTreeItems","treeModel","children","totalNodes","forEach","node","items","escapeRegExp","str","replace","hiChar","text","filterValue","escapedFilterValue","re","RegExp","h","innerHTML","mapOptionsToComboBoxItemModel","options","map","option","value","id","caption","label","renderChCheckboxItems","frontEndCheckboxInputHandler","checkedIds","find","name","class","checkedValue","disabled","onInput","startImgSrc","iconName","key"],"sources":["src/common/helpers.tsx"],"sourcesContent":["import { h } from \"@stencil/core\";\n\nimport {\n ChCheckboxCustomEvent,\n ComboBoxModel,\n TreeViewItemModel\n} from \"@genexus/chameleon-controls-library\";\nexport type ChCheckboxArray = HTMLChCheckboxElement[] | null;\n\nimport { GxOption } from \"./types\";\n\nconst daysOfWeek = [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\"\n];\n\n/**\n * @param element an HTMLElement\n * @returns an alphabetically ordered array of all the parts and exportparts the element contains.\n */\nexport const getElementSelectorParts = (element: HTMLElement) => {\n const queries: string[] = [];\n const elementParts = element.shadowRoot?.querySelectorAll(`[part]`);\n const elementExportParts =\n element.shadowRoot?.querySelectorAll(`[exportparts]`);\n\n elementParts?.forEach(el => {\n queries.push(\n `${element.tagName.toLowerCase()}::part(${el.getAttribute(\"part\")})`\n );\n });\n elementExportParts?.forEach(el => {\n queries.push(\n ...[\n ...el.getAttribute(\"exportparts\").matchAll(/(?:[\\w-]+:)?([\\w-]+)/g)\n ].map(item => `${element.tagName.toLowerCase()}::part(${item[1]})`)\n );\n });\n\n return queries.sort();\n};\n\n/**\n * @param selector a part selector\n * @returns A reference to the element the part belongs to.\n */\nexport const querySelectorPart = (selector: string) => {\n const querySelectorDeep = (\n element: HTMLElement,\n parts: string\n ): HTMLElement => {\n const shadow = element.shadowRoot;\n const partList = parts.split(\" \");\n\n const partElement: HTMLElement = shadow.querySelector(\n partList.map(partName => `[part~=\"${partName}\"]`).join(\"\")\n );\n if (partElement) {\n return partElement;\n }\n\n const exportPartElement: HTMLElement = shadow.querySelector(\n partList.map(partName => `[exportparts*=\"${partName}\"]`).join(\"\")\n );\n if (exportPartElement) {\n const exportPartList: string[] = [];\n const exportparts = exportPartElement.getAttribute(\"exportparts\");\n\n partList.forEach(partItem => {\n const exportPartName = exportparts.match(\n `(?:([\\\\w-]+):)?(${partItem})`\n )[1];\n if (exportPartName) {\n exportPartList.push(exportPartName);\n }\n });\n\n if (partList.length === exportPartList.length) {\n return querySelectorDeep(exportPartElement, exportPartList.join(\" \"));\n }\n }\n\n return null;\n };\n\n const selectorItems = selector.match(\"(.*)::part\\\\(([^)]+)\\\\)\");\n const entity = selectorItems[1];\n const partName = selectorItems[2];\n\n return querySelectorDeep(document.querySelector(entity), partName);\n};\n\nconst daysFromToday = (date: Date): number => {\n const today = new Date();\n // To calculate the time difference of two dates\n const timeDifference = today.getTime() - date.getTime();\n // To calculate the no. of days between two dates\n const daysDifference = timeDifference / (1000 * 3600 * 24);\n return Math.floor(daysDifference);\n};\n\n// - - - - - - - - - - - -\n// Date Functions\n// - - - - - - - - - - - -\n\nconst isToday = (date: Date): boolean => {\n const today = new Date();\n if (today.toDateString() === date.toDateString()) {\n return true;\n }\n return false;\n};\n\nconst isYesterday = (date: Date): boolean => {\n const yesterday = new Date();\n yesterday.setDate(yesterday.getDate() - 1);\n if (yesterday.toDateString() === date.toDateString()) {\n return true;\n }\n return false;\n};\n\nexport const formatDate = (\n date: Date,\n type: FormatDateType = \"date-time\"\n): string => {\n let formattedDate;\n // validate date\n // undefined or null\n if (date === undefined || date === null) {\n return \"\";\n }\n // If the date object is invalid it will return 'NaN' on getTime() and NaN is never equal to itself\n const dateIsValid = date.getTime() === date.getTime();\n if (!dateIsValid) {\n return \"Invalid date\";\n }\n let locale = \"en-US\";\n const lang = document\n .getElementsByTagName(\"html\")[0]\n .getAttribute(\"lang\")\n ?.valueOf();\n if (lang === \"es\") {\n locale = \"es-ES\";\n }\n formattedDate = date.toLocaleDateString(locale);\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n const hours = String(date.getHours()).padStart(2, \"0\");\n const minutes = String(date.getMinutes()).padStart(2, \"0\");\n const time = `${hours}:${minutes}`;\n if (type === \"date-time\") {\n formattedDate += ` / ${date.toLocaleTimeString()}`;\n } else if (type === \"date-time-short\") {\n // No seconds\n if (locale === \"es-ES\") {\n formattedDate = `${year}-${month}-${day} ${time}`;\n } else {\n formattedDate = `${month}/${day}/${year} ${time}`;\n }\n } else if (\"pretty\") {\n const daysPassedFromToday = daysFromToday(date);\n const today = new Date();\n const currentYear = today.getFullYear();\n if (isToday(date)) {\n return `Today ${time}`;\n } else if (isYesterday(date)) {\n return `Yesterday ${time}`;\n } else if (daysPassedFromToday <= 7) {\n // If one week or less, just show the day of the week, and the time\n const day = daysOfWeek[date.getDay()];\n return `${day} ${time}`;\n } else if (currentYear === year) {\n // If current year, show day number and month name. Example: November 17th\n if (locale === \"es-ES\") {\n formattedDate = `${day} de ${date.toLocaleString(\"es-ES\", {\n month: \"long\"\n })} ${time}`;\n } else {\n formattedDate = `${date.toLocaleString(\"en-US\", {\n month: \"long\"\n })} ${day} ${time}`;\n }\n } else {\n // Display date as usual\n formattedDate = formatDate(date, \"date-time-short\");\n }\n }\n return formattedDate;\n};\n\nexport type FormatDateType =\n | \"date\"\n | \"date-time\"\n | \"date-time-short\"\n | \"pretty\";\n\n// - - - - - - - - - - - -\n// /End of Date Functions\n// - - - - - - - - - - - -\n\n/* Count the total tree nodes (by default it does not count the first level nodes)*/\nexport const countTreeItems = (\n treeModel: TreeViewItemModel[],\n children = false\n): number => {\n let totalNodes = 0;\n treeModel.forEach(node => {\n children && totalNodes++;\n if (node.items) {\n totalNodes += countTreeItems(node.items, true);\n }\n });\n return totalNodes;\n};\n\n/**\n * @description it evaluates the initial selected combo item\n * @param options an array of GxOption\n * @returns the initial combo value, which in this case is the id\n */\nexport const setInitialComboValue = (options: GxOption[]): string => {\n const selected = options.find(option => option.selected);\n if (selected) {\n return selected.value || selected.id;\n } else {\n return options[0].value || options[0].id;\n }\n};\n\nexport const escapeRegExp = (str: string) => {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n};\n\n/**\n * @description this function highlights the character(s) that match(es) the filter value.\n * hiChar comes from (hi)light (Char)acters\n * @param text the string to find the filter value on\n * @param filterValue the filter value\n * @returns a span element\n */\nexport const hiChar = function (text: string, filterValue: string) {\n if (text && filterValue) {\n const escapedFilterValue = escapeRegExp(filterValue);\n const re = new RegExp(escapedFilterValue, \"gi\");\n return (\n <span\n innerHTML={text.replace(re, '<span class=\"hiChar\">$&</span>')}\n ></span>\n );\n } else {\n return text;\n }\n};\n\nexport const closeOnOutsideClickHandler = (\n eventInfo: PointerEvent,\n ref: HTMLElement\n): true | void => {\n if (!eventInfo.composedPath().includes(ref)) {\n return true;\n }\n};\n\nexport const mapOptionsToComboBoxItemModel = (\n options: GxOption[]\n): ComboBoxModel =>\n options.map(option => ({\n value: option.id,\n caption: option.label\n // startImgSrc: option.iconName\n }));\n\nexport const renderChCheckboxItems = (\n options: GxOption[] | undefined,\n frontEndCheckboxInputHandler: (\n event: ChCheckboxCustomEvent<string> | InputEvent\n ) => void,\n checkedIds: string[]\n): HTMLChCheckboxElement[] => {\n return options?.map(option => {\n const value = checkedIds?.find(\n id => option.value === id || option.id === id\n );\n return (\n <ch-checkbox\n name={option.name}\n class=\"checkbox\"\n checkedValue={option.value || option.id}\n caption={option.label}\n disabled={option.disabled}\n value={value}\n onInput={frontEndCheckboxInputHandler}\n startImgSrc={option.iconName}\n key={option.value || option.id}\n ></ch-checkbox>\n );\n });\n};\n"],"mappings":";;AAWA,MAAMA,IAAa,EACjB,UACA,UACA,WACA,aACA,YACA,UACA;;AA+EF,MAAMC,gBAAiBC;EACrB,MAAMC,IAAQ,IAAIC;;IAElB,MAAMC,IAAiBF,EAAMG,YAAYJ,EAAKI;;IAE9C,MAAMC,IAAiBF,KAAkB,MAAO,OAAO;EACvD,OAAOG,KAAKC,MAAMF;AAAe;;;;0BAOnC;MAAMG,UAAWR;EACf,MAAMC,IAAQ,IAAIC;EAClB,IAAID,EAAMQ,mBAAmBT,EAAKS,gBAAgB;IAChD,OAAO;;EAET,OAAO;AAAK;;AAGd,MAAMC,cAAeV;EACnB,MAAMW,IAAY,IAAIT;EACtBS,EAAUC,QAAQD,EAAUE,YAAY;EACxC,IAAIF,EAAUF,mBAAmBT,EAAKS,gBAAgB;IACpD,OAAO;;EAET,OAAO;AAAK;;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