@itwin/grouping-mapping-widget 0.6.0 → 0.8.0

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 (110) hide show
  1. package/README.md +84 -0
  2. package/lib/cjs/grouping-mapping-widget.d.ts +1 -0
  3. package/lib/cjs/grouping-mapping-widget.js +3 -1
  4. package/lib/cjs/grouping-mapping-widget.js.map +1 -1
  5. package/lib/cjs/test/GroupingMappingCustomUI.test.d.ts +2 -0
  6. package/lib/cjs/test/GroupingMappingCustomUI.test.js +162 -0
  7. package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -0
  8. package/lib/cjs/test/WidgetHeader.test.d.ts +2 -0
  9. package/lib/cjs/test/WidgetHeader.test.js +36 -0
  10. package/lib/cjs/test/WidgetHeader.test.js.map +1 -0
  11. package/lib/cjs/test/test-utils.d.ts +72 -0
  12. package/lib/cjs/test/test-utils.js +71 -0
  13. package/lib/cjs/test/test-utils.js.map +1 -0
  14. package/lib/cjs/widget/components/GroupAction.d.ts +2 -1
  15. package/lib/cjs/widget/components/GroupAction.js +82 -75
  16. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  17. package/lib/cjs/widget/components/GroupAction.scss +1 -13
  18. package/lib/cjs/widget/components/GroupPropertyAction.d.ts +1 -1
  19. package/lib/cjs/widget/components/GroupPropertyAction.js +149 -302
  20. package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
  21. package/lib/cjs/widget/components/GroupPropertyAction.scss +82 -8
  22. package/lib/cjs/widget/components/GroupPropertyUtils.d.ts +21 -0
  23. package/lib/cjs/widget/components/GroupPropertyUtils.js +287 -0
  24. package/lib/cjs/widget/components/GroupPropertyUtils.js.map +1 -0
  25. package/lib/cjs/widget/components/Grouping.d.ts +5 -0
  26. package/lib/cjs/widget/components/Grouping.js +107 -44
  27. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  28. package/lib/cjs/widget/components/Grouping.scss +18 -3
  29. package/lib/cjs/widget/components/GroupingMapping.d.ts +6 -1
  30. package/lib/cjs/widget/components/GroupingMapping.js +22 -9
  31. package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
  32. package/lib/cjs/widget/components/HorizontalTile.d.ts +5 -3
  33. package/lib/cjs/widget/components/HorizontalTile.js +9 -6
  34. package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
  35. package/lib/cjs/widget/components/HorizontalTile.scss +46 -22
  36. package/lib/cjs/widget/components/Mapping.scss +4 -5
  37. package/lib/cjs/widget/components/SelectProject.js +2 -0
  38. package/lib/cjs/widget/components/SelectProject.js.map +1 -1
  39. package/lib/cjs/widget/components/SortableHorizontalTile.d.ts +8 -0
  40. package/lib/cjs/widget/components/SortableHorizontalTile.js +51 -0
  41. package/lib/cjs/widget/components/SortableHorizontalTile.js.map +1 -0
  42. package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.d.ts +6 -0
  43. package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.js +25 -0
  44. package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.js.map +1 -0
  45. package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.d.ts +91 -0
  46. package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.js +9 -0
  47. package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.js.map +1 -0
  48. package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.d.ts +6 -0
  49. package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +31 -0
  50. package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -0
  51. package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.scss +17 -0
  52. package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.d.ts +6 -0
  53. package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js +97 -0
  54. package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -0
  55. package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.scss +17 -0
  56. package/lib/esm/grouping-mapping-widget.d.ts +1 -0
  57. package/lib/esm/grouping-mapping-widget.js +1 -0
  58. package/lib/esm/grouping-mapping-widget.js.map +1 -1
  59. package/lib/esm/test/GroupingMappingCustomUI.test.d.ts +2 -0
  60. package/lib/esm/test/GroupingMappingCustomUI.test.js +138 -0
  61. package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -0
  62. package/lib/esm/test/WidgetHeader.test.d.ts +2 -0
  63. package/lib/esm/test/WidgetHeader.test.js +31 -0
  64. package/lib/esm/test/WidgetHeader.test.js.map +1 -0
  65. package/lib/esm/test/test-utils.d.ts +72 -0
  66. package/lib/esm/test/test-utils.js +42 -0
  67. package/lib/esm/test/test-utils.js.map +1 -0
  68. package/lib/esm/widget/components/GroupAction.d.ts +2 -1
  69. package/lib/esm/widget/components/GroupAction.js +85 -78
  70. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  71. package/lib/esm/widget/components/GroupAction.scss +1 -13
  72. package/lib/esm/widget/components/GroupPropertyAction.d.ts +1 -1
  73. package/lib/esm/widget/components/GroupPropertyAction.js +151 -304
  74. package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
  75. package/lib/esm/widget/components/GroupPropertyAction.scss +82 -8
  76. package/lib/esm/widget/components/GroupPropertyUtils.d.ts +21 -0
  77. package/lib/esm/widget/components/GroupPropertyUtils.js +280 -0
  78. package/lib/esm/widget/components/GroupPropertyUtils.js.map +1 -0
  79. package/lib/esm/widget/components/Grouping.d.ts +5 -0
  80. package/lib/esm/widget/components/Grouping.js +107 -44
  81. package/lib/esm/widget/components/Grouping.js.map +1 -1
  82. package/lib/esm/widget/components/Grouping.scss +18 -3
  83. package/lib/esm/widget/components/GroupingMapping.d.ts +6 -1
  84. package/lib/esm/widget/components/GroupingMapping.js +23 -10
  85. package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
  86. package/lib/esm/widget/components/HorizontalTile.d.ts +5 -3
  87. package/lib/esm/widget/components/HorizontalTile.js +9 -6
  88. package/lib/esm/widget/components/HorizontalTile.js.map +1 -1
  89. package/lib/esm/widget/components/HorizontalTile.scss +46 -22
  90. package/lib/esm/widget/components/Mapping.scss +4 -5
  91. package/lib/esm/widget/components/SelectProject.js +2 -0
  92. package/lib/esm/widget/components/SelectProject.js.map +1 -1
  93. package/lib/esm/widget/components/SortableHorizontalTile.d.ts +8 -0
  94. package/lib/esm/widget/components/SortableHorizontalTile.js +30 -0
  95. package/lib/esm/widget/components/SortableHorizontalTile.js.map +1 -0
  96. package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.d.ts +6 -0
  97. package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.js +20 -0
  98. package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.js.map +1 -0
  99. package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.d.ts +91 -0
  100. package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.js +6 -0
  101. package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.js.map +1 -0
  102. package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.d.ts +6 -0
  103. package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +26 -0
  104. package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -0
  105. package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.scss +17 -0
  106. package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.d.ts +6 -0
  107. package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js +92 -0
  108. package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -0
  109. package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.scss +17 -0
  110. package/package.json +24 -5
@@ -1,11 +1,14 @@
1
1
  import React from "react";
2
2
  import { Text } from "@itwin/itwinui-react";
3
3
  import "./HorizontalTile.scss";
4
- export const HorizontalTile = ({ title, subText, onClickTitle, titleTooltip, subtextToolTip, actionGroup }) => {
5
- return (React.createElement("div", { className: "gmw-horizontal-tile-container", "data-testid": "gmw-horizontal-tile" },
6
- React.createElement("div", { className: "gmw-body" },
7
- React.createElement(Text, { className: `gmw-body-text ${onClickTitle ? "iui-anchor" : ""}`, onClick: onClickTitle, variant: "body", title: titleTooltip }, title),
8
- subText && React.createElement(Text, { className: "gmw-body-text", isMuted: true, title: subtextToolTip, variant: "small" }, subText)),
9
- React.createElement("div", { className: "gmw-action-button", "data-testid": "tile-action-button" }, actionGroup)));
4
+ import classNames from "classnames";
5
+ export const HorizontalTile = (props) => {
6
+ return (React.createElement("div", { className: classNames("gmw-horizontal-tile-container", { "gmw-horizontal-tile-selected": props.selected }), onClick: props.onClick, "data-testid": "gmw-horizontal-tile" },
7
+ React.createElement("div", { className: "gmw-body-container" },
8
+ props.dragHandle,
9
+ React.createElement("div", { className: "gmw-body" },
10
+ React.createElement(Text, { className: classNames("gmw-body-text", { "iui-anchor": !!props.onClickTitle }), onClick: props.onClickTitle, variant: "body", title: props.titleTooltip }, props.title),
11
+ props.subText && React.createElement(Text, { className: "gmw-body-text", isMuted: true, title: props.subtextToolTip, variant: "small" }, props.subText))),
12
+ React.createElement("div", { className: "gmw-action-button", "data-testid": "tile-action-button" }, props.actionGroup)));
10
13
  };
11
14
  //# sourceMappingURL=HorizontalTile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalTile.js","sourceRoot":"","sources":["../../../../src/widget/components/HorizontalTile.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,uBAAuB,CAAC;AAW/B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAsB,EAAE,EAAE;IAEhI,OAAO,CACL,6BAAK,SAAS,EAAC,+BAA+B,iBAAa,qBAAqB;QAC9E,6BAAK,SAAS,EAAC,UAAU;YACvB,oBAAC,IAAI,IAAC,SAAS,EAAE,iBAAiB,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,YAAY,IAAG,KAAK,CAAQ;YAC9I,OAAO,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAC,eAAe,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAC,OAAO,IAAE,OAAO,CAAQ,CAC9G;QACN,6BAAK,SAAS,EAAC,mBAAmB,iBAAa,oBAAoB,IAChE,WAAW,CACR,CACF,CACP,CAAC;AAEJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { ReactNode } from \"react\";\nimport React from \"react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport \"./HorizontalTile.scss\";\n\ninterface HorizontalTileProps {\n title: string;\n actionGroup: ReactNode;\n subText?: string;\n onClickTitle?: () => void;\n titleTooltip?: string;\n subtextToolTip?: string;\n}\n\nexport const HorizontalTile = ({ title, subText, onClickTitle, titleTooltip, subtextToolTip, actionGroup}: HorizontalTileProps) => {\n\n return (\n <div className=\"gmw-horizontal-tile-container\" data-testid=\"gmw-horizontal-tile\">\n <div className=\"gmw-body\">\n <Text className={`gmw-body-text ${onClickTitle ? \"iui-anchor\" : \"\"}`} onClick={onClickTitle} variant=\"body\" title={titleTooltip}>{title}</Text>\n {subText && <Text className=\"gmw-body-text\" isMuted={true} title={subtextToolTip} variant=\"small\">{subText}</Text>}\n </div>\n <div className=\"gmw-action-button\" data-testid=\"tile-action-button\">\n {actionGroup}\n </div>\n </div>\n );\n\n};\n"]}
1
+ {"version":3,"file":"HorizontalTile.js","sourceRoot":"","sources":["../../../../src/widget/components/HorizontalTile.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,uBAAuB,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AAcpC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAE,EAAE;IAE3D,OAAO,CACL,6BAAK,SAAS,EAAE,UAAU,CAAC,+BAA+B,EAAE,EAAE,8BAA8B,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,iBAAc,qBAAqB;QACxK,6BAAK,SAAS,EAAC,oBAAoB;YAChC,KAAK,CAAC,UAAU;YACjB,6BAAK,SAAS,EAAC,UAAU;gBACvB,oBAAC,IAAI,IAAC,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,CAAC,YAAY,IAAG,KAAK,CAAC,KAAK,CAAQ;gBAChL,KAAK,CAAC,OAAO,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAC,eAAe,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,cAAc,EAAE,OAAO,EAAC,OAAO,IAAE,KAAK,CAAC,OAAO,CAAQ,CAChI,CACF;QACN,6BAAK,SAAS,EAAC,mBAAmB,iBAAa,oBAAoB,IAChE,KAAK,CAAC,WAAW,CACd,CACF,CACP,CAAC;AAEJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { ReactNode } from \"react\";\nimport React from \"react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport \"./HorizontalTile.scss\";\nimport classNames from \"classnames\";\n\nexport interface HorizontalTileProps {\n title: string;\n actionGroup: ReactNode;\n subText?: string;\n onClick?: () => void;\n onClickTitle?: () => void;\n titleTooltip?: string;\n subtextToolTip?: string;\n selected?: boolean;\n dragHandle?: ReactNode;\n}\n\nexport const HorizontalTile = (props: HorizontalTileProps) => {\n\n return (\n <div className={classNames(\"gmw-horizontal-tile-container\", { \"gmw-horizontal-tile-selected\": props.selected })} onClick={props.onClick} data-testid=\"gmw-horizontal-tile\">\n <div className=\"gmw-body-container\">\n {props.dragHandle}\n <div className=\"gmw-body\">\n <Text className={classNames(\"gmw-body-text\", { \"iui-anchor\": !!props.onClickTitle })} onClick={props.onClickTitle} variant=\"body\" title={props.titleTooltip}>{props.title}</Text>\n {props.subText && <Text className=\"gmw-body-text\" isMuted={true} title={props.subtextToolTip} variant=\"small\">{props.subText}</Text>}\n </div>\n </div>\n <div className=\"gmw-action-button\" data-testid=\"tile-action-button\">\n {props.actionGroup}\n </div>\n </div>\n );\n\n};\n"]}
@@ -2,31 +2,55 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import '~@itwin/itwinui-css/scss/variables';
5
+ @import "~@itwin/itwinui-css/scss/variables";
6
+ @import "~@itwin/itwinui-css/scss/icon/index";
6
7
 
7
- .gmw-horizontal-tile-container {
8
- display: flex;
9
- justify-content: space-between;
10
- border-radius: 5px;
11
- background-color: var(--iui-color-background-2);
12
- height: $iui-baseline * 4;
13
- padding: 5.5px $iui-s;
14
- .gmw-body {
8
+ .gmw-horizontal-tile {
9
+ &-container {
15
10
  display: flex;
16
- flex-direction: column;
17
- min-width: 0;
18
- justify-content: center;
19
- &-text {
20
- overflow: hidden;
21
- white-space: nowrap;
22
- text-overflow: ellipsis;
11
+ justify-content: space-between;
12
+ border-radius: 5px;
13
+ background-color: var(--iui-color-background-2);
14
+ min-height: $iui-baseline * 4;
15
+ padding: 5.5px $iui-s;
16
+
17
+ .gmw-body-container {
18
+ display: flex;
19
+ min-width: 0;
20
+ .gmw-drag-icon {
21
+ @include iui-icons-large();
22
+ justify-content: center;
23
+ height: 100%;
24
+ }
25
+ .gmw-body {
26
+ display: flex;
27
+ flex-direction: column;
28
+ min-width: 0;
29
+ justify-content: center;
30
+ &-text {
31
+ overflow: hidden;
32
+ white-space: nowrap;
33
+ text-overflow: ellipsis;
34
+ }
35
+ }
36
+ }
37
+ .gmw-action-button {
38
+ margin-left: 0;
39
+ align-self: center;
40
+ min-width: 36px;
41
+ margin-right: $iui-xs;
42
+ flex-shrink: 0;
23
43
  }
24
44
  }
25
- .gmw-action-button {
26
- margin-left: 0;
27
- align-self: center;
28
- min-width: 36px;
29
- margin-right: $iui-xs;
30
- flex-shrink: 0;
45
+
46
+ &-selected {
47
+ @include themed {
48
+ border: 1px solid t(iui-color-foreground-primary);
49
+ background: linear-gradient(
50
+ rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-6)),
51
+ rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-6))
52
+ ),
53
+ linear-gradient(t(iui-color-background-1), t(iui-color-background-1));
54
+ }
31
55
  }
32
56
  }
@@ -2,14 +2,14 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import '~@itwin/itwinui-css/scss/variables';
5
+ @import "~@itwin/itwinui-css/scss/variables";
6
6
 
7
7
  .gmw-mappings-container {
8
8
  display: flex;
9
9
  flex-direction: column;
10
10
  flex-grow: 1;
11
11
  padding: $iui-baseline $iui-m;
12
- min-height: 0;;
12
+ min-height: 0;
13
13
 
14
14
  .gmw-table-toolbar {
15
15
  display: flex;
@@ -33,8 +33,7 @@
33
33
  display: flex;
34
34
  flex-direction: column;
35
35
  overflow-y: overlay;
36
- gap: 7.5px;
37
- margin-top: 7.5px;
36
+ gap: $iui-s;
37
+ margin-top: $iui-s;
38
38
  }
39
39
  }
40
-
@@ -28,6 +28,8 @@ const SelectProject = ({ onSelect, onCancel }) => {
28
28
  void fetchAccessToken();
29
29
  }, [getAccessToken]);
30
30
  const startSearch = useCallback(() => {
31
+ if (!searchInput)
32
+ return;
31
33
  setActiveSearchInput(searchInput);
32
34
  setSearched(true);
33
35
  }, [searchInput]);
@@ -1 +1 @@
1
- {"version":3,"file":"SelectProject.js","sourceRoot":"","sources":["../../../../src/widget/components/SelectProject.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,aAAa,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,cAAc,EACd,UAAU,EACV,YAAY,EACZ,GAAG,GACJ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,sBAAsB,CAAC;AAE9B,MAAM,aAAa,GAAG;IACpB,oBAAC,GAAG,IACF,GAAG,EAAC,UAAU,EACd,KAAK,EAAC,mBAAmB,EACzB,SAAS,EAAE,oBAAC,aAAa,OAAG,GAC5B;IACF,oBAAC,GAAG,IAAC,GAAG,EAAC,SAAS,EAAC,KAAK,EAAC,iBAAiB,EAAC,SAAS,EAAE,oBAAC,WAAW,OAAG,GAAI;IACzE,oBAAC,GAAG,IAAC,GAAG,EAAC,KAAK,EAAC,KAAK,EAAC,aAAa,EAAC,SAAS,EAAE,oBAAC,OAAO,OAAG,GAAI;CAC9D,CAAC;AAKF,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAsB,EAAE,EAAE;IACnE,MAAM,EAAE,cAAc,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EAAC,kBAAkB;YAC/B,oBAAC,WAAW,IACV,gBAAgB,EAAE,QAAQ,EAC1B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,iBAAiB,EAChC,WAAW,EACT,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAEtE,CACE;QACN,6BAAK,SAAS,EAAC,iCAAiC;YAC9C,oBAAC,MAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport type {\n ApiOverrides,\n IModelFull,\n ProjectFull,\n} from \"@itwin/imodel-browser-react\";\nimport { ProjectGrid } from \"@itwin/imodel-browser-react\";\nimport {\n SvgCalendar,\n SvgClose,\n SvgList,\n SvgSearch,\n SvgStarHollow,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n HorizontalTabs,\n IconButton,\n LabeledInput,\n Tab,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport \"./SelectProject.scss\";\n\nconst tabsWithIcons = [\n <Tab\n key=\"favorite\"\n label=\"Favorite projects\"\n startIcon={<SvgStarHollow />}\n />,\n <Tab key=\"recents\" label=\"Recent projects\" startIcon={<SvgCalendar />} />,\n <Tab key=\"all\" label=\"My projects\" startIcon={<SvgList />} />,\n];\ninterface SelectProjectProps {\n onSelect: (project: ProjectFull) => void;\n onCancel: () => void;\n}\nconst SelectProject = ({ onSelect, onCancel }: SelectProjectProps) => {\n const { getAccessToken, prefix } = useGroupingMappingApiConfig();\n const [projectType, setProjectType] = useState<number>(0);\n const [searchInput, setSearchInput] = useState<string>(\"\");\n const [activeSearchInput, setActiveSearchInput] = useState<string>(\"\");\n const [accessToken, setAccessToken] = useState<AccessToken>();\n const [apiOverrides, setApiOverrides] = useState<ApiOverrides<IModelFull[]>>({\n serverEnvironmentPrefix: prefix,\n });\n const [searched, setSearched] = useState<boolean>(false);\n\n useEffect(\n () => setApiOverrides({ serverEnvironmentPrefix: prefix }),\n [prefix]\n );\n\n useEffect(() => {\n const fetchAccessToken = async () => {\n const accessToken = await getAccessToken();\n setAccessToken(accessToken);\n };\n void fetchAccessToken();\n }, [getAccessToken]);\n\n const startSearch = useCallback(() => {\n setActiveSearchInput(searchInput);\n setSearched(true);\n }, [searchInput]);\n\n const clearSearch = useCallback(() => {\n setSearchInput(\"\");\n setActiveSearchInput(\"\");\n setSearched(false);\n }, []);\n\n useEffect(() => {\n if (searchInput.length === 0) {\n setSearched(false);\n clearSearch();\n }\n }, [searchInput, setSearched, clearSearch]);\n\n return (\n <div className=\"gmw-select-project-grid-container\">\n <HorizontalTabs\n labels={tabsWithIcons}\n onTabSelected={setProjectType}\n activeIndex={projectType}\n type={\"borderless\"}\n contentClassName=\"gmw-grid-holding-tab\"\n >\n <LabeledInput\n displayStyle=\"inline\"\n iconDisplayStyle=\"inline\"\n className=\"gmw-search-input\"\n label=\"Search\"\n value={searchInput}\n placeholder=\"Search....\"\n onChange={(event) => {\n const {\n target: { value },\n } = event;\n setSearchInput(value);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n startSearch();\n }\n }}\n svgIcon={\n searched ? (\n <IconButton onClick={clearSearch} styleType=\"borderless\">\n <SvgClose />\n </IconButton>\n ) : (\n <IconButton onClick={startSearch} styleType=\"borderless\">\n <SvgSearch />\n </IconButton>\n )\n }\n />\n </HorizontalTabs>\n <div className=\"gmw-project-grid\">\n <ProjectGrid\n onThumbnailClick={onSelect}\n accessToken={accessToken}\n apiOverrides={apiOverrides}\n filterOptions={activeSearchInput}\n requestType={\n projectType === 0 ? \"favorites\" : projectType === 1 ? \"recents\" : \"\"\n }\n />\n </div>\n <div className=\"gmw-select-project-action-panel\">\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n );\n};\n\nexport default SelectProject;\n"]}
1
+ {"version":3,"file":"SelectProject.js","sourceRoot":"","sources":["../../../../src/widget/components/SelectProject.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,aAAa,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,cAAc,EACd,UAAU,EACV,YAAY,EACZ,GAAG,GACJ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,sBAAsB,CAAC;AAE9B,MAAM,aAAa,GAAG;IACpB,oBAAC,GAAG,IACF,GAAG,EAAC,UAAU,EACd,KAAK,EAAC,mBAAmB,EACzB,SAAS,EAAE,oBAAC,aAAa,OAAG,GAC5B;IACF,oBAAC,GAAG,IAAC,GAAG,EAAC,SAAS,EAAC,KAAK,EAAC,iBAAiB,EAAC,SAAS,EAAE,oBAAC,WAAW,OAAG,GAAI;IACzE,oBAAC,GAAG,IAAC,GAAG,EAAC,KAAK,EAAC,KAAK,EAAC,aAAa,EAAC,SAAS,EAAE,oBAAC,OAAO,OAAG,GAAI;CAC9D,CAAC;AAKF,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAsB,EAAE,EAAE;IACnE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,2BAA2B,EAAE,CAAC;IACjE,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YAC/B,oBAAC,WAAW,IACV,gBAAgB,EAAE,QAAQ,EAC1B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,iBAAiB,EAChC,WAAW,EACT,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAEtE,CACE;QACN,6BAAK,SAAS,EAAC,iCAAiC;YAC9C,oBAAC,MAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport type {\n ApiOverrides,\n IModelFull,\n ProjectFull,\n} from \"@itwin/imodel-browser-react\";\nimport { ProjectGrid } from \"@itwin/imodel-browser-react\";\nimport {\n SvgCalendar,\n SvgClose,\n SvgList,\n SvgSearch,\n SvgStarHollow,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n HorizontalTabs,\n IconButton,\n LabeledInput,\n Tab,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport \"./SelectProject.scss\";\n\nconst tabsWithIcons = [\n <Tab\n key=\"favorite\"\n label=\"Favorite projects\"\n startIcon={<SvgStarHollow />}\n />,\n <Tab key=\"recents\" label=\"Recent projects\" startIcon={<SvgCalendar />} />,\n <Tab key=\"all\" label=\"My projects\" startIcon={<SvgList />} />,\n];\ninterface SelectProjectProps {\n onSelect: (project: ProjectFull) => void;\n onCancel: () => void;\n}\nconst SelectProject = ({ onSelect, onCancel }: SelectProjectProps) => {\n const { getAccessToken, prefix } = useGroupingMappingApiConfig();\n const [projectType, setProjectType] = useState<number>(0);\n const [searchInput, setSearchInput] = useState<string>(\"\");\n const [activeSearchInput, setActiveSearchInput] = useState<string>(\"\");\n const [accessToken, setAccessToken] = useState<AccessToken>();\n const [apiOverrides, setApiOverrides] = useState<ApiOverrides<IModelFull[]>>({\n serverEnvironmentPrefix: prefix,\n });\n const [searched, setSearched] = useState<boolean>(false);\n\n useEffect(\n () => setApiOverrides({ serverEnvironmentPrefix: prefix }),\n [prefix]\n );\n\n useEffect(() => {\n const fetchAccessToken = async () => {\n const accessToken = await getAccessToken();\n setAccessToken(accessToken);\n };\n void fetchAccessToken();\n }, [getAccessToken]);\n\n const startSearch = useCallback(() => {\n if (!searchInput) return;\n setActiveSearchInput(searchInput);\n setSearched(true);\n }, [searchInput]);\n\n const clearSearch = useCallback(() => {\n setSearchInput(\"\");\n setActiveSearchInput(\"\");\n setSearched(false);\n }, []);\n\n useEffect(() => {\n if (searchInput.length === 0) {\n setSearched(false);\n clearSearch();\n }\n }, [searchInput, setSearched, clearSearch]);\n\n return (\n <div className=\"gmw-select-project-grid-container\">\n <HorizontalTabs\n labels={tabsWithIcons}\n onTabSelected={setProjectType}\n activeIndex={projectType}\n type={\"borderless\"}\n contentClassName=\"gmw-grid-holding-tab\"\n >\n <LabeledInput\n displayStyle=\"inline\"\n iconDisplayStyle=\"inline\"\n className=\"gmw-search-input\"\n label=\"Search\"\n value={searchInput}\n placeholder=\"Search....\"\n onChange={(event) => {\n const {\n target: { value },\n } = event;\n setSearchInput(value);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n startSearch();\n }\n }}\n svgIcon={\n searched ? (\n <IconButton onClick={clearSearch} styleType=\"borderless\">\n <SvgClose />\n </IconButton>\n ) : (\n <IconButton onClick={startSearch} styleType=\"borderless\">\n <SvgSearch />\n </IconButton>\n )\n }\n />\n </HorizontalTabs>\n <div className=\"gmw-project-grid\">\n <ProjectGrid\n onThumbnailClick={onSelect}\n accessToken={accessToken}\n apiOverrides={apiOverrides}\n filterOptions={activeSearchInput}\n requestType={\n projectType === 0 ? \"favorites\" : projectType === 1 ? \"recents\" : \"\"\n }\n />\n </div>\n <div className=\"gmw-select-project-action-panel\">\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n );\n};\n\nexport default SelectProject;\n"]}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { HorizontalTileProps } from "./HorizontalTile";
3
+ interface SortableHorizontalTileProps extends HorizontalTileProps {
4
+ id: string;
5
+ }
6
+ declare const SortableHorizontalTile: ({ id, ...props }: SortableHorizontalTileProps) => JSX.Element;
7
+ export default SortableHorizontalTile;
8
+ //# sourceMappingURL=SortableHorizontalTile.d.ts.map
@@ -0,0 +1,30 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import React, { useEffect } from "react";
6
+ import { useSortable } from "@dnd-kit/sortable";
7
+ import { HorizontalTile } from "./HorizontalTile";
8
+ import { CSS } from "@dnd-kit/utilities";
9
+ import { SvgDragHandleVertical } from "@itwin/itwinui-icons-react";
10
+ const SortableHorizontalTile = ({ id, ...props }) => {
11
+ const { attributes, listeners, isDragging, setNodeRef, transform, transition, } = useSortable({ id });
12
+ const style = {
13
+ transform: CSS.Transform.toString(transform),
14
+ transition,
15
+ };
16
+ useEffect(() => {
17
+ if (!isDragging) {
18
+ return;
19
+ }
20
+ document.body.style.cursor = "grabbing";
21
+ return () => {
22
+ document.body.style.cursor = "";
23
+ };
24
+ }, [isDragging]);
25
+ return (React.createElement("div", { ref: setNodeRef, ...attributes, style: { ...style, visibility: isDragging ? "hidden" : "visible" } },
26
+ React.createElement(HorizontalTile, { dragHandle: React.createElement("div", { className: "gmw-drag-icon", style: { cursor: "grab" }, title: "Drag & Drop", ...listeners },
27
+ React.createElement(SvgDragHandleVertical, null)), ...props })));
28
+ };
29
+ export default SortableHorizontalTile;
30
+ //# sourceMappingURL=SortableHorizontalTile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SortableHorizontalTile.js","sourceRoot":"","sources":["../../../../src/widget/components/SortableHorizontalTile.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAMnE,MAAM,sBAAsB,GAAG,CAAC,EAAE,EAAE,EAAE,GAAG,KAAK,EAA+B,EAAE,EAAE;IAC/E,MAAM,EACJ,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,GACX,GAAG,WAAW,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAExB,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC5C,UAAU;KACX,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QACD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC;QACxC,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;QAClC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO,CACL,6BACE,GAAG,EAAE,UAAU,KACX,UAAU,EACd,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE;QAElE,oBAAC,cAAc,IACb,UAAU,EACR,6BAAK,SAAS,EAAC,eAAe,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAC,aAAa,KAAK,SAAS;gBACzF,oBAAC,qBAAqB,OAAG,CACrB,KAEJ,KAAK,GACT,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React, { useEffect } from \"react\";\nimport { useSortable } from \"@dnd-kit/sortable\";\nimport type { HorizontalTileProps } from \"./HorizontalTile\";\nimport { HorizontalTile } from \"./HorizontalTile\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { SvgDragHandleVertical } from \"@itwin/itwinui-icons-react\";\n\ninterface SortableHorizontalTileProps extends HorizontalTileProps {\n id: string;\n}\n\nconst SortableHorizontalTile = ({ id, ...props }: SortableHorizontalTileProps) => {\n const {\n attributes,\n listeners,\n isDragging,\n setNodeRef,\n transform,\n transition,\n } = useSortable({ id });\n\n const style = {\n transform: CSS.Transform.toString(transform),\n transition,\n };\n\n useEffect(() => {\n if (!isDragging) {\n return;\n }\n document.body.style.cursor = \"grabbing\";\n return () => {\n document.body.style.cursor = \"\";\n };\n }, [isDragging]);\n\n return (\n <div\n ref={setNodeRef}\n {...attributes}\n style={{ ...style, visibility: isDragging ? \"hidden\" : \"visible\" }}\n >\n <HorizontalTile\n dragHandle={\n <div className=\"gmw-drag-icon\" style={{ cursor: \"grab\" }} title=\"Drag & Drop\" {...listeners}>\n <SvgDragHandleVertical />\n </div>\n }\n {...props}\n />\n </div>\n );\n};\n\nexport default SortableHorizontalTile;\n"]}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import type { GroupingMappingCustomUI } from "../customUI/GroupingMappingCustomUI";
3
+ export declare const createGroupingMappingCustomUI: (customUIs: GroupingMappingCustomUI[] | undefined) => GroupingMappingCustomUI[];
4
+ export declare const GroupingMappingCustomUIContext: import("react").Context<GroupingMappingCustomUI[]>;
5
+ export declare const useGroupingMappingCustomUI: () => GroupingMappingCustomUI[];
6
+ //# sourceMappingURL=GroupingMappingCustomUIContext.d.ts.map
@@ -0,0 +1,20 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { createContext, useContext } from "react";
6
+ export const createGroupingMappingCustomUI = (customUIs) => {
7
+ if (undefined === customUIs) {
8
+ return [];
9
+ }
10
+ return customUIs;
11
+ };
12
+ export const GroupingMappingCustomUIContext = createContext([]);
13
+ export const useGroupingMappingCustomUI = () => {
14
+ const context = useContext(GroupingMappingCustomUIContext);
15
+ if (!context) {
16
+ throw new Error("useGroupingMappingCustomUI should be used within a GroupingMappingCustomUIContext provider");
17
+ }
18
+ return context;
19
+ };
20
+ //# sourceMappingURL=GroupingMappingCustomUIContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupingMappingCustomUIContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupingMappingCustomUIContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGlD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,SAAgD,EACrB,EAAE;IAC7B,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO,EAAE,CAAC;KACX;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,aAAa,CAA4B,EAAE,CAAC,CAAC;AAE3F,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,MAAM,OAAO,GAAG,UAAU,CAAC,8BAA8B,CAAC,CAAC;IAC3D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,4FAA4F,CAC7F,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { createContext, useContext } from \"react\";\nimport type { GroupingMappingCustomUI } from \"../customUI/GroupingMappingCustomUI\";\n\nexport const createGroupingMappingCustomUI = (\n customUIs: GroupingMappingCustomUI[] | undefined,\n): GroupingMappingCustomUI[] => {\n if (undefined === customUIs) {\n return [];\n }\n return customUIs;\n};\n\nexport const GroupingMappingCustomUIContext = createContext<GroupingMappingCustomUI[]>([]);\n\nexport const useGroupingMappingCustomUI = () => {\n const context = useContext(GroupingMappingCustomUIContext);\n if (!context) {\n throw new Error(\n \"useGroupingMappingCustomUI should be used within a GroupingMappingCustomUIContext provider\",\n );\n }\n return context;\n};\n"]}
@@ -0,0 +1,91 @@
1
+ import type { ReactElement } from "react";
2
+ export declare enum GroupingMappingCustomUIType {
3
+ Grouping = 0,
4
+ Context = 1
5
+ }
6
+ export declare type GroupingMappingCustomUI = GroupingCustomUI | ContextCustomUI;
7
+ /** Custom UI Definitions. */
8
+ export interface IGroupingMappingCustomUI {
9
+ /**
10
+ * See GroupingMappingCustomUIType.
11
+ */
12
+ type: GroupingMappingCustomUIType;
13
+ /**
14
+ * Unique identifier of the custom UI.
15
+ */
16
+ name: string;
17
+ /**
18
+ * Display label in the widget.
19
+ */
20
+ displayLabel: string;
21
+ /**
22
+ * Optional icon, will be shown before display label in widget.
23
+ */
24
+ icon?: ReactElement;
25
+ }
26
+ /**
27
+ * Context custom UI type definition.
28
+ */
29
+ export interface ContextCustomUI extends IGroupingMappingCustomUI {
30
+ /**
31
+ * See GroupingMappingCustomUIType.
32
+ */
33
+ type: GroupingMappingCustomUIType.Context;
34
+ /**
35
+ * User defined component for UI interaction with grouping mapping widget.
36
+ */
37
+ uiComponent?: (props: ContextCustomUIProps) => JSX.Element;
38
+ /**
39
+ * Callback function for context custom UI menu item click event.
40
+ */
41
+ onClick?: (groupId: string, mappingId: string, iModelId: string) => void;
42
+ }
43
+ /**
44
+ * Group custom UI type definition.
45
+ */
46
+ export interface GroupingCustomUI extends IGroupingMappingCustomUI {
47
+ /**
48
+ * See GroupingMappingCustomUIType.
49
+ */
50
+ type: GroupingMappingCustomUIType.Grouping;
51
+ /**
52
+ * Custom UI Component to build query interactively. Refer to SearchGroupingCustomUI/ManualGroupingCustomUI.
53
+ */
54
+ uiComponent: (props: GroupingCustomUIProps) => JSX.Element;
55
+ }
56
+ /** Custom UI Component props definitions. */
57
+ /**
58
+ * Context custom UI component arguments definition.
59
+ */
60
+ export interface ContextCustomUIProps {
61
+ /**
62
+ * IModel Id.
63
+ */
64
+ iModelId: string;
65
+ /**
66
+ * Mapping Id.
67
+ */
68
+ mappingId: string;
69
+ /**
70
+ * Group Id.
71
+ */
72
+ groupId: string;
73
+ }
74
+ /**
75
+ * Group custom UI component arguments definition.
76
+ */
77
+ export interface GroupingCustomUIProps {
78
+ /**
79
+ * To validate and update current query.
80
+ */
81
+ updateQuery: (query: string) => void;
82
+ /**
83
+ * To get the query loading status.
84
+ */
85
+ isUpdating?: boolean;
86
+ /**
87
+ * To reset the viewer.
88
+ */
89
+ resetView?: () => Promise<void>;
90
+ }
91
+ //# sourceMappingURL=GroupingMappingCustomUI.d.ts.map
@@ -0,0 +1,6 @@
1
+ export var GroupingMappingCustomUIType;
2
+ (function (GroupingMappingCustomUIType) {
3
+ GroupingMappingCustomUIType[GroupingMappingCustomUIType["Grouping"] = 0] = "Grouping";
4
+ GroupingMappingCustomUIType[GroupingMappingCustomUIType["Context"] = 1] = "Context";
5
+ })(GroupingMappingCustomUIType || (GroupingMappingCustomUIType = {}));
6
+ //# sourceMappingURL=GroupingMappingCustomUI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupingMappingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/GroupingMappingCustomUI.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,qFAAQ,CAAA;IACR,mFAAO,CAAA;AACT,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { ReactElement } from \"react\";\n\nexport enum GroupingMappingCustomUIType {\n Grouping,\n Context,\n}\n\nexport type GroupingMappingCustomUI = GroupingCustomUI | ContextCustomUI;\n\n/** Custom UI Definitions. */\n\nexport interface IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType;\n /**\n * Unique identifier of the custom UI.\n */\n name: string;\n /**\n * Display label in the widget.\n */\n displayLabel: string;\n /**\n * Optional icon, will be shown before display label in widget.\n */\n icon?: ReactElement;\n}\n\n/**\n * Context custom UI type definition.\n */\nexport interface ContextCustomUI extends IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType.Context;\n /**\n * User defined component for UI interaction with grouping mapping widget.\n */\n uiComponent?: (props: ContextCustomUIProps) => JSX.Element;\n /**\n * Callback function for context custom UI menu item click event.\n */\n onClick?: (groupId: string, mappingId: string, iModelId: string) => void;\n}\n\n/**\n * Group custom UI type definition.\n */\nexport interface GroupingCustomUI extends IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType.Grouping;\n /**\n * Custom UI Component to build query interactively. Refer to SearchGroupingCustomUI/ManualGroupingCustomUI.\n */\n uiComponent: (props: GroupingCustomUIProps) => JSX.Element;\n}\n\n/** Custom UI Component props definitions. */\n\n/**\n * Context custom UI component arguments definition.\n */\nexport interface ContextCustomUIProps {\n /**\n * IModel Id.\n */\n iModelId: string;\n /**\n * Mapping Id.\n */\n mappingId: string;\n /**\n * Group Id.\n */\n groupId: string;\n}\n\n/**\n * Group custom UI component arguments definition.\n */\nexport interface GroupingCustomUIProps {\n /**\n * To validate and update current query.\n */\n updateQuery: (query: string) => void;\n /**\n * To get the query loading status.\n */\n isUpdating?: boolean;\n /**\n * To reset the viewer.\n */\n resetView?: () => Promise<void>;\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import "./ManualGroupingCustomUI.scss";
3
+ import type { GroupingCustomUIProps } from "./GroupingMappingCustomUI";
4
+ declare const ManualGroupingCustomUI: ({ updateQuery, isUpdating, resetView, }: GroupingCustomUIProps) => JSX.Element;
5
+ export default ManualGroupingCustomUI;
6
+ //# sourceMappingURL=ManualGroupingCustomUI.d.ts.map
@@ -0,0 +1,26 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import React from "react";
6
+ import { Button, LabeledTextarea, Text } from "@itwin/itwinui-react";
7
+ import { LoadingSpinner } from "../utils";
8
+ import "./ManualGroupingCustomUI.scss";
9
+ const ManualGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
10
+ const [manualInput, setManualInput] = React.useState("");
11
+ return (React.createElement("div", { className: 'gmw-manual-form' },
12
+ React.createElement(Text, null, "Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query."),
13
+ React.createElement(LabeledTextarea, { label: 'Query', required: true, value: manualInput, onChange: (event) => setManualInput(event.target.value), disabled: isUpdating, placeholder: `E.g. "SELECT ECInstanceId, ECClassId FROM BisCore:PhysicalElement"` }),
14
+ React.createElement("div", { className: 'gmw-manual-actions' },
15
+ isUpdating && React.createElement(LoadingSpinner, null),
16
+ React.createElement(Button, { disabled: isUpdating, onClick: () => updateQuery(manualInput) }, "Apply"),
17
+ React.createElement(Button, { disabled: isUpdating, onClick: async () => {
18
+ updateQuery("");
19
+ setManualInput("");
20
+ if (resetView) {
21
+ await resetView();
22
+ }
23
+ } }, "Clear"))));
24
+ };
25
+ export default ManualGroupingCustomUI;
26
+ //# sourceMappingURL=ManualGroupingCustomUI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManualGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/ManualGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAGvC,MAAM,sBAAsB,GAAG,CAAC,EAC9B,WAAW,EACX,UAAU,EACV,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEzD,OAAO,CACL,6BAAK,SAAS,EAAC,iBAAiB;QAC9B,oBAAC,IAAI,8GAEE;QACP,oBAAC,eAAe,IACd,KAAK,EAAC,OAAO,EACb,QAAQ,QACR,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACvD,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,oEAAoE,GACjF;QACF,6BAAK,SAAS,EAAC,oBAAoB;YAChC,UAAU,IAAI,oBAAC,cAAc,OAAG;YACjC,oBAAC,MAAM,IAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,YAE5D;YACT,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,WAAW,CAAC,EAAE,CAAC,CAAC;oBAChB,cAAc,CAAC,EAAE,CAAC,CAAC;oBACnB,IAAI,SAAS,EAAE;wBACb,MAAM,SAAS,EAAE,CAAC;qBACnB;gBACH,CAAC,YAGM,CACL,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { Button, LabeledTextarea, Text } from \"@itwin/itwinui-react\";\nimport { LoadingSpinner } from \"../utils\";\nimport \"./ManualGroupingCustomUI.scss\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\n\nconst ManualGroupingCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n}: GroupingCustomUIProps) => {\n const [manualInput, setManualInput] = React.useState(\"\");\n\n return (\n <div className='gmw-manual-form'>\n <Text>\n Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query.\n </Text>\n <LabeledTextarea\n label='Query'\n required\n value={manualInput}\n onChange={(event) => setManualInput(event.target.value)}\n disabled={isUpdating}\n placeholder={`E.g. \"SELECT ECInstanceId, ECClassId FROM BisCore:PhysicalElement\"`}\n />\n <div className='gmw-manual-actions'>\n {isUpdating && <LoadingSpinner />}\n <Button disabled={isUpdating} onClick={() => updateQuery(manualInput)}>\n Apply\n </Button>\n <Button\n disabled={isUpdating}\n onClick={async () => {\n updateQuery(\"\");\n setManualInput(\"\");\n if (resetView) {\n await resetView();\n }\n }}\n >\n Clear\n </Button>\n </div>\n </div>\n );\n};\n\nexport default ManualGroupingCustomUI;\n"]}
@@ -0,0 +1,17 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "~@itwin/itwinui-css/scss/variables";
6
+
7
+ .gmw-manual-form {
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: $iui-baseline;
11
+ margin-top: $iui-baseline;
12
+ > .gmw-manual-actions {
13
+ display: flex;
14
+ justify-content: flex-end;
15
+ gap: $iui-s;
16
+ }
17
+ }
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import type { GroupingCustomUIProps } from "./GroupingMappingCustomUI";
3
+ import "./SearchGroupingCustomUI.scss";
4
+ declare const SearchGroupingCustomUI: ({ updateQuery, isUpdating, resetView, }: GroupingCustomUIProps) => JSX.Element;
5
+ export default SearchGroupingCustomUI;
6
+ //# sourceMappingURL=SearchGroupingCustomUI.d.ts.map
@@ -0,0 +1,92 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import React from "react";
6
+ import { Button, LabeledTextarea, Text } from "@itwin/itwinui-react";
7
+ import { LoadingSpinner } from "../utils";
8
+ import "./SearchGroupingCustomUI.scss";
9
+ const SearchGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
10
+ const [searchInput, setSearchInput] = React.useState("");
11
+ const isWrappedInQuotes = (text) => {
12
+ return text.startsWith(`"`) && text.endsWith(`"`);
13
+ };
14
+ const needsAndOperator = (token, index, searchQuery) => isWrappedInQuotes(token) ||
15
+ (index === 1 && isWrappedInQuotes(searchQuery[0]));
16
+ const generateSearchQuery = (searchQuery) => {
17
+ if (searchQuery.length === 0) {
18
+ updateQuery("");
19
+ return;
20
+ }
21
+ let generatedSearchQuery = `SELECT be.ECInstanceId, be.ECClassId FROM bis.geometricelement3d be `;
22
+ generatedSearchQuery += `LEFT JOIN bis.SpatialCategory cat ON be.Category.Id = cat.ECInstanceID LEFT JOIN ecdbmeta.ECClassDef ecc ON be.ECClassId = ecc.ECInstanceId `;
23
+ generatedSearchQuery += `LEFT JOIN bis.PhysicalType pt ON be.TypeDefinition.Id = pt.ECInstanceID`;
24
+ generatedSearchQuery += ` WHERE `;
25
+ generatedSearchQuery += `((${searchQuery
26
+ .map((token, index) => `${index === 0
27
+ ? ""
28
+ : needsAndOperator(token, index, searchQuery)
29
+ ? "AND"
30
+ : "OR"} be.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
31
+ .join(" ")}) OR (${searchQuery
32
+ .map((token, index) => `${index === 0
33
+ ? ""
34
+ : needsAndOperator(token, index, searchQuery)
35
+ ? "AND"
36
+ : "OR"} be.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
37
+ .join(" ")})) OR ((${searchQuery
38
+ .map((token, index) => `${index === 0
39
+ ? ""
40
+ : needsAndOperator(token, index, searchQuery)
41
+ ? "AND"
42
+ : "OR"} cat.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
43
+ .join(" ")}) OR (${searchQuery
44
+ .map((token, index) => `${index === 0
45
+ ? ""
46
+ : needsAndOperator(token, index, searchQuery)
47
+ ? "AND"
48
+ : "OR"} cat.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
49
+ .join(" ")})) OR (${searchQuery
50
+ .map((token, index) => `${index === 0
51
+ ? ""
52
+ : needsAndOperator(token, index, searchQuery)
53
+ ? "AND"
54
+ : "OR"} ecc.name LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
55
+ .join(" ")})`;
56
+ // Physical Types
57
+ generatedSearchQuery += ` OR ((${searchQuery
58
+ .map((token, index) => `${index === 0
59
+ ? ""
60
+ : needsAndOperator(token, index, searchQuery)
61
+ ? "AND"
62
+ : "OR"} pt.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
63
+ .join(" ")}) OR (${searchQuery
64
+ .map((token, index) => `${index === 0
65
+ ? ""
66
+ : needsAndOperator(token, index, searchQuery)
67
+ ? "AND"
68
+ : "OR"} pt.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
69
+ .join(" ")})) `;
70
+ updateQuery(generatedSearchQuery);
71
+ };
72
+ return (React.createElement("div", { className: 'gmw-search-form' },
73
+ React.createElement(Text, null, "Generate a query by keywords. Keywords wrapped in double quotes will be considered a required criteria."),
74
+ React.createElement(LabeledTextarea, { label: 'Query Keywords', required: true, value: searchInput, onChange: (event) => setSearchInput(event.target.value), disabled: isUpdating, placeholder: `E.g. "red" chair` }),
75
+ React.createElement("div", { className: 'gmw-search-actions' },
76
+ isUpdating && React.createElement(LoadingSpinner, null),
77
+ React.createElement(Button, { disabled: isUpdating, onClick: () => generateSearchQuery(searchInput
78
+ ? searchInput
79
+ .replace(/(\r\n|\n|\r)/gm, "")
80
+ .trim()
81
+ .split(" ")
82
+ : []) }, "Apply"),
83
+ React.createElement(Button, { disabled: isUpdating, onClick: async () => {
84
+ updateQuery("");
85
+ setSearchInput("");
86
+ if (resetView) {
87
+ await resetView();
88
+ }
89
+ } }, "Clear"))));
90
+ };
91
+ export default SearchGroupingCustomUI;
92
+ //# sourceMappingURL=SearchGroupingCustomUI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/SearchGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+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CAAC,CAAC,CAAC,CAAC,KACxE,IAAI,CACP;aACA,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;QAElB,WAAW,CAAC,oBAAoB,CAAC,CAAC;IACpC,CAAC,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,iBAAiB;QAC9B,oBAAC,IAAI,kHAGE;QACP,oBAAC,eAAe,IACd,KAAK,EAAC,gBAAgB,EACtB,QAAQ,QACR,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACvD,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,kBAAkB,GAC/B;QACF,6BAAK,SAAS,EAAC,oBAAoB;YAChC,UAAU,IAAI,oBAAC,cAAc,OAAG;YACjC,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,GAAG,EAAE,CACZ,mBAAmB,CACjB,WAAW;oBACT,CAAC,CAAC,WAAW;yBACV,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC;yBAC7B,IAAI,EAAE;yBACN,KAAK,CAAC,GAAG,CAAC;oBACb,CAAC,CAAC,EAAE,CACP,YAII;YACT,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,WAAW,CAAC,EAAE,CAAC,CAAC;oBAChB,cAAc,CAAC,EAAE,CAAC,CAAC;oBACnB,IAAI,SAAS,EAAE;wBACb,MAAM,SAAS,EAAE,CAAC;qBACnB;gBACH,CAAC,YAGM,CACL,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { Button, LabeledTextarea, Text } from \"@itwin/itwinui-react\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\nimport { LoadingSpinner } from \"../utils\";\nimport \"./SearchGroupingCustomUI.scss\";\n\nconst SearchGroupingCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n}: GroupingCustomUIProps) => {\n const [searchInput, setSearchInput] = React.useState(\"\");\n const isWrappedInQuotes = (text: string) => {\n return text.startsWith(`\"`) && text.endsWith(`\"`);\n };\n\n const needsAndOperator = (\n token: string,\n index: number,\n searchQuery: string[],\n ) =>\n isWrappedInQuotes(token) ||\n (index === 1 && isWrappedInQuotes(searchQuery[0]));\n\n const generateSearchQuery = (searchQuery: string[]) => {\n if (searchQuery.length === 0) {\n updateQuery(\"\");\n return;\n }\n\n let generatedSearchQuery = `SELECT be.ECInstanceId, be.ECClassId FROM bis.geometricelement3d be `;\n generatedSearchQuery += `LEFT JOIN bis.SpatialCategory cat ON be.Category.Id = cat.ECInstanceID LEFT JOIN ecdbmeta.ECClassDef ecc ON be.ECClassId = ecc.ECInstanceId `;\n generatedSearchQuery += `LEFT JOIN bis.PhysicalType pt ON be.TypeDefinition.Id = pt.ECInstanceID`;\n generatedSearchQuery += ` WHERE `;\n generatedSearchQuery += `((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } be.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } be.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) OR ((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } cat.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } cat.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } ecc.name LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})`;\n // Physical Types\n generatedSearchQuery += ` OR ((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } pt.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } pt.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) `;\n\n updateQuery(generatedSearchQuery);\n };\n\n return (\n <div className='gmw-search-form'>\n <Text>\n Generate a query by keywords. Keywords wrapped in double quotes will be\n considered a required criteria.\n </Text>\n <LabeledTextarea\n label='Query Keywords'\n required\n value={searchInput}\n onChange={(event) => setSearchInput(event.target.value)}\n disabled={isUpdating}\n placeholder={`E.g. \"red\" chair`}\n />\n <div className='gmw-search-actions'>\n {isUpdating && <LoadingSpinner />}\n <Button\n disabled={isUpdating}\n onClick={() =>\n generateSearchQuery(\n searchInput\n ? searchInput\n .replace(/(\\r\\n|\\n|\\r)/gm, \"\")\n .trim()\n .split(\" \")\n : [],\n )\n }\n >\n Apply\n </Button>\n <Button\n disabled={isUpdating}\n onClick={async () => {\n updateQuery(\"\");\n setSearchInput(\"\");\n if (resetView) {\n await resetView();\n }\n }}\n >\n Clear\n </Button>\n </div>\n </div>\n );\n};\n\nexport default SearchGroupingCustomUI;\n"]}
@@ -0,0 +1,17 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "~@itwin/itwinui-css/scss/variables";
6
+
7
+ .gmw-search-form {
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: $iui-baseline;
11
+ margin-top: $iui-baseline;
12
+ > .gmw-search-actions {
13
+ display: flex;
14
+ justify-content: flex-end;
15
+ gap: $iui-s;
16
+ }
17
+ }