@genexus/genexus-ide-ui 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-ai-message.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-dashboard-home.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-kb-manager-import.cjs.entry.js +336 -419
- package/dist/cjs/gx-ide-kb-manager-import.cjs.entry.js.map +1 -1
- package/dist/cjs/gx-ide-new-environment.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-new-kb.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-object-selector.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-team-dev-update.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-ww-images.cjs.entry.js +1 -1
- package/dist/cjs/{helpers-b5b4a659.js → helpers-75a5c5cc.js} +1 -16
- package/dist/cjs/helpers-75a5c5cc.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/kb-manager-import/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.en.json +2 -1
- package/dist/collection/components/kb-manager-import/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.ja.json +2 -1
- package/dist/collection/components/kb-manager-import/helpers.js +62 -88
- package/dist/collection/components/kb-manager-import/helpers.js.map +1 -1
- package/dist/collection/components/kb-manager-import/kb-manager-import.css +38 -1804
- package/dist/collection/components/kb-manager-import/kb-manager-import.js +347 -441
- package/dist/collection/components/kb-manager-import/kb-manager-import.js.map +1 -1
- package/dist/components/gx-ide-kb-manager-import.js +362 -450
- package/dist/components/gx-ide-kb-manager-import.js.map +1 -1
- package/dist/components/gx-ide-ww-images.js +1 -1
- package/dist/components/helpers.js +1 -15
- package/dist/components/helpers.js.map +1 -1
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-ai-message.entry.js +1 -1
- package/dist/esm/gx-ide-dashboard-home.entry.js +1 -1
- package/dist/esm/gx-ide-kb-manager-import.entry.js +336 -419
- package/dist/esm/gx-ide-kb-manager-import.entry.js.map +1 -1
- package/dist/esm/gx-ide-new-environment.entry.js +1 -1
- package/dist/esm/gx-ide-new-kb.entry.js +1 -1
- package/dist/esm/gx-ide-object-selector.entry.js +1 -1
- package/dist/esm/gx-ide-team-dev-commit.entry.js +1 -1
- package/dist/esm/gx-ide-team-dev-update.entry.js +1 -1
- package/dist/esm/gx-ide-ww-images.entry.js +1 -1
- package/dist/esm/{helpers-64e1dd0b.js → helpers-a933d577.js} +2 -16
- package/dist/esm/helpers-a933d577.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js.map +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.en.json +2 -1
- package/dist/genexus-ide-ui/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.ja.json +2 -1
- package/dist/genexus-ide-ui/{p-c339f703.js → p-014916d7.js} +34 -48
- package/dist/genexus-ide-ui/p-014916d7.js.map +1 -0
- package/dist/genexus-ide-ui/{p-39792ac8.entry.js → p-2dcce235.entry.js} +2 -2
- package/dist/genexus-ide-ui/p-336c340f.entry.js +607 -0
- package/dist/genexus-ide-ui/p-336c340f.entry.js.map +1 -0
- package/dist/genexus-ide-ui/{p-4a0dab98.entry.js → p-3adbc04c.entry.js} +2 -2
- package/dist/genexus-ide-ui/{p-f1558097.entry.js → p-3d5fea0a.entry.js} +2 -2
- package/dist/genexus-ide-ui/{p-ac670f62.entry.js → p-5dfb7c66.entry.js} +2 -2
- package/dist/genexus-ide-ui/{p-62f4ad99.entry.js → p-734bc4e1.entry.js} +2 -2
- package/dist/genexus-ide-ui/{p-e8975ac0.entry.js → p-79f63922.entry.js} +2 -2
- package/dist/genexus-ide-ui/{p-4ce47bcd.entry.js → p-96b4f74b.entry.js} +2 -2
- package/dist/genexus-ide-ui/{p-6abe5291.entry.js → p-d06d21d2.entry.js} +2 -2
- package/dist/types/components/kb-manager-import/helpers.d.ts +5 -9
- package/dist/types/components/kb-manager-import/kb-manager-import.d.ts +49 -84
- package/dist/types/components.d.ts +22 -40
- package/package.json +5 -5
- package/dist/cjs/helpers-b5b4a659.js.map +0 -1
- package/dist/esm/helpers-64e1dd0b.js.map +0 -1
- package/dist/genexus-ide-ui/p-c339f703.js.map +0 -1
- package/dist/genexus-ide-ui/p-ca8b0024.entry.js +0 -683
- package/dist/genexus-ide-ui/p-ca8b0024.entry.js.map +0 -1
- /package/dist/genexus-ide-ui/{p-39792ac8.entry.js.map → p-2dcce235.entry.js.map} +0 -0
- /package/dist/genexus-ide-ui/{p-4a0dab98.entry.js.map → p-3adbc04c.entry.js.map} +0 -0
- /package/dist/genexus-ide-ui/{p-f1558097.entry.js.map → p-3d5fea0a.entry.js.map} +0 -0
- /package/dist/genexus-ide-ui/{p-ac670f62.entry.js.map → p-5dfb7c66.entry.js.map} +0 -0
- /package/dist/genexus-ide-ui/{p-62f4ad99.entry.js.map → p-734bc4e1.entry.js.map} +0 -0
- /package/dist/genexus-ide-ui/{p-e8975ac0.entry.js.map → p-79f63922.entry.js.map} +0 -0
- /package/dist/genexus-ide-ui/{p-4ce47bcd.entry.js.map → p-96b4f74b.entry.js.map} +0 -0
- /package/dist/genexus-ide-ui/{p-6abe5291.entry.js.map → p-d06d21d2.entry.js.map} +0 -0
|
@@ -894,42 +894,33 @@ export namespace Components {
|
|
|
894
894
|
*/
|
|
895
895
|
"addResultItem": (item: ImportItemResultData) => Promise<void>;
|
|
896
896
|
/**
|
|
897
|
-
* Callback invoked when
|
|
898
|
-
* @returns It returns a boolean indicating whether the process could be canceled or not.
|
|
897
|
+
* Callback invoked when user wants to cancel the export process.
|
|
899
898
|
*/
|
|
900
899
|
"cancelCallback": CancelCallback8;
|
|
901
900
|
/**
|
|
902
|
-
*
|
|
903
|
-
*/
|
|
904
|
-
"displayTitle": false;
|
|
905
|
-
/**
|
|
906
|
-
* Callback invoked when the user wants to initiate the import process.
|
|
901
|
+
* Callback invoked when user wants to initiate the import process.
|
|
907
902
|
*/
|
|
908
903
|
"importCallback": ImportCallback;
|
|
909
904
|
/**
|
|
910
|
-
* Callback invoked when
|
|
905
|
+
* Callback invoked when user wants to load the xpz information
|
|
911
906
|
*/
|
|
912
907
|
"loadCallback": LoadCallback1;
|
|
913
908
|
/**
|
|
914
|
-
*
|
|
909
|
+
* Displays status buttons (errors, warning, succeeded) with minimal UI (no captions)
|
|
915
910
|
*/
|
|
916
911
|
"objectContextMenuCallback": ObjectContextMenuCallback;
|
|
917
912
|
/**
|
|
918
|
-
* Callback invoked when
|
|
913
|
+
* Callback invoked when user wants to access the export options.
|
|
919
914
|
*/
|
|
920
915
|
"optionsCallback": OptionsCallback1;
|
|
921
916
|
/**
|
|
922
|
-
*
|
|
917
|
+
* Imported xml or xps file name
|
|
923
918
|
*/
|
|
924
919
|
"selectedFile": File;
|
|
925
920
|
/**
|
|
926
|
-
*
|
|
921
|
+
* Displays status buttons (error, warning, success) with minimal UI (no captions).
|
|
927
922
|
*/
|
|
928
923
|
"statusMinimal": false;
|
|
929
|
-
/**
|
|
930
|
-
* If true, it will display a loader when needed.
|
|
931
|
-
*/
|
|
932
|
-
"topStateBar": true;
|
|
933
924
|
}
|
|
934
925
|
interface GxIdeListSelector {
|
|
935
926
|
/**
|
|
@@ -2311,8 +2302,8 @@ declare global {
|
|
|
2311
2302
|
new (): HTMLGxIdeKbManagerExportElement;
|
|
2312
2303
|
};
|
|
2313
2304
|
interface HTMLGxIdeKbManagerImportElementEventMap {
|
|
2314
|
-
"componentDidRenderFirstTime": boolean;
|
|
2315
2305
|
"componentDidLoadEvent": boolean;
|
|
2306
|
+
"componentDidRenderFirstTime": boolean;
|
|
2316
2307
|
}
|
|
2317
2308
|
interface HTMLGxIdeKbManagerImportElement extends Components.GxIdeKbManagerImport, HTMLStencilElement {
|
|
2318
2309
|
addEventListener<K extends keyof HTMLGxIdeKbManagerImportElementEventMap>(type: K, listener: (this: HTMLGxIdeKbManagerImportElement, ev: GxIdeKbManagerImportCustomEvent<HTMLGxIdeKbManagerImportElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -3602,50 +3593,41 @@ declare namespace LocalJSX {
|
|
|
3602
3593
|
}
|
|
3603
3594
|
interface GxIdeKbManagerImport {
|
|
3604
3595
|
/**
|
|
3605
|
-
* Callback invoked when
|
|
3606
|
-
* @returns It returns a boolean indicating whether the process could be canceled or not.
|
|
3596
|
+
* Callback invoked when user wants to cancel the export process.
|
|
3607
3597
|
*/
|
|
3608
|
-
"cancelCallback"
|
|
3609
|
-
/**
|
|
3610
|
-
* If true it displays the component title on the header
|
|
3611
|
-
*/
|
|
3612
|
-
"displayTitle"?: false;
|
|
3598
|
+
"cancelCallback": CancelCallback8;
|
|
3613
3599
|
/**
|
|
3614
|
-
* Callback invoked when
|
|
3600
|
+
* Callback invoked when user wants to initiate the import process.
|
|
3615
3601
|
*/
|
|
3616
|
-
"importCallback"
|
|
3602
|
+
"importCallback": ImportCallback;
|
|
3617
3603
|
/**
|
|
3618
|
-
* Callback invoked when
|
|
3604
|
+
* Callback invoked when user wants to load the xpz information
|
|
3619
3605
|
*/
|
|
3620
|
-
"loadCallback"
|
|
3606
|
+
"loadCallback": LoadCallback1;
|
|
3621
3607
|
/**
|
|
3622
|
-
*
|
|
3608
|
+
* Displays status buttons (errors, warning, succeeded) with minimal UI (no captions)
|
|
3623
3609
|
*/
|
|
3624
|
-
"objectContextMenuCallback"
|
|
3610
|
+
"objectContextMenuCallback": ObjectContextMenuCallback;
|
|
3625
3611
|
/**
|
|
3626
|
-
*
|
|
3612
|
+
* Emitted once just after the component is fully loaded.
|
|
3627
3613
|
*/
|
|
3628
3614
|
"onComponentDidLoadEvent"?: (event: GxIdeKbManagerImportCustomEvent<boolean>) => void;
|
|
3629
3615
|
/**
|
|
3630
|
-
*
|
|
3616
|
+
* Emitted once just after the component is fully loaded and the first render() occurs
|
|
3631
3617
|
*/
|
|
3632
3618
|
"onComponentDidRenderFirstTime"?: (event: GxIdeKbManagerImportCustomEvent<boolean>) => void;
|
|
3633
3619
|
/**
|
|
3634
|
-
* Callback invoked when
|
|
3620
|
+
* Callback invoked when user wants to access the export options.
|
|
3635
3621
|
*/
|
|
3636
|
-
"optionsCallback"
|
|
3622
|
+
"optionsCallback": OptionsCallback1;
|
|
3637
3623
|
/**
|
|
3638
|
-
*
|
|
3624
|
+
* Imported xml or xps file name
|
|
3639
3625
|
*/
|
|
3640
3626
|
"selectedFile"?: File;
|
|
3641
3627
|
/**
|
|
3642
|
-
*
|
|
3628
|
+
* Displays status buttons (error, warning, success) with minimal UI (no captions).
|
|
3643
3629
|
*/
|
|
3644
3630
|
"statusMinimal"?: false;
|
|
3645
|
-
/**
|
|
3646
|
-
* If true, it will display a loader when needed.
|
|
3647
|
-
*/
|
|
3648
|
-
"topStateBar"?: true;
|
|
3649
3631
|
}
|
|
3650
3632
|
interface GxIdeListSelector {
|
|
3651
3633
|
/**
|
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.
|
|
4
|
+
"version": "1.0.22",
|
|
5
5
|
"description": "GeneXus IDE UI components",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"validate.ci": "npm run build -- --max-workers 1 --debug"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@genexus/chameleon-controls-library": ">=6.0.0-next.
|
|
36
|
+
"@genexus/chameleon-controls-library": ">=6.0.0-next.51",
|
|
37
37
|
"@genexus/gemini": "*2.0.1",
|
|
38
|
-
"@genexus/mercury": "*0.9.
|
|
38
|
+
"@genexus/mercury": "*0.9.15"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@genexus/chameleon-controls-library": ">=6.0.0-next.
|
|
41
|
+
"@genexus/chameleon-controls-library": ">=6.0.0-next.51",
|
|
42
42
|
"@genexus/gemini": "*2.0.1",
|
|
43
|
-
"@genexus/mercury": "*0.9.
|
|
43
|
+
"@genexus/mercury": "*0.9.15",
|
|
44
44
|
"@stencil-community/eslint-plugin": "~0.7.1",
|
|
45
45
|
"@stencil/core": "~4.9.0",
|
|
46
46
|
"@stencil/sass": "~1.4.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"helpers-b5b4a659.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,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,IAAI,KAAK,CAAC,YAAY,EAAE,KAAK,IAAI,CAAC,YAAY,EAAE,EAAE;QAChD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAAU;IAC7B,MAAM,SAAS,G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AAgB;IAEhB,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC3C,OAAO,IAAI,CAAC;KACb;AACH,EAAE;MAEW,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,QACEA,yBACE,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":["h"],"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
|
-
{"file":"helpers-64e1dd0b.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,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,IAAI,KAAK,CAAC,YAAY,EAAE,KAAK,IAA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AI,CAAC,OAAO,CAAC,EAAE,EAAE,gCAAgC,CAAC,GACvD,EACR;KACH;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,EAAE;MAEW,0BAA0B,GAAG,CACxC,SAAuB,EACvB,GAAgB;IAEhB,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC3C,OAAO,IAAI,CAAC;KACb;AACH,EAAE;MAEW,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","closeOnOutsideClickHandler","eventInfo","ref","composedPath","includes","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,cAAe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