@fctc/sme-widget-ui 2.7.5 → 2.7.7

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/index.js CHANGED
@@ -15678,7 +15678,7 @@ var PopupFilter = ({
15678
15678
  right: 0,
15679
15679
  zIndex: 33
15680
15680
  },
15681
- className: "popup-filter w-full overflow-x-auto rounded-lg border bg-white border-none shadow-xl",
15681
+ className: "popup-filter w-full overflow-x-auto rounded-lg border border-[var(--stroke-default)] bg-white shadow-xl",
15682
15682
  children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
15683
15683
  "div",
15684
15684
  {
@@ -16031,8 +16031,9 @@ var Search = ({
16031
16031
  const searchDefaults = Object.entries(context || {}).filter(
16032
16032
  ([key]) => key.startsWith("search_default_")
16033
16033
  );
16034
+ const defaultGroupBy = context ? Object.entries(context).filter(([key]) => key.includes("group_by")) : [];
16034
16035
  const hasGroupBy = viewData?.views?.search?.filters_by?.length > 0;
16035
- if (searchDefaults.length === 0 && !hasGroupBy) {
16036
+ if (searchDefaults.length === 0 && !hasGroupBy && defaultGroupBy?.length === 0) {
16036
16037
  setIsReadyFormatDomain(true);
16037
16038
  setDidInit(true);
16038
16039
  return;
@@ -16053,7 +16054,23 @@ var Search = ({
16053
16054
  }
16054
16055
  return item;
16055
16056
  });
16057
+ const updatedGroupBy = groupBy?.map((item) => {
16058
+ const defaultGroupByItem = defaultGroupBy.find(
16059
+ ([_2, value]) => item?.context?.includes(value)
16060
+ );
16061
+ if (defaultGroupByItem && typeof handleAddTagSearch == "function") {
16062
+ handleAddTagSearch({
16063
+ name: item?.name,
16064
+ value: item?.string,
16065
+ type: SearchType.GROUP,
16066
+ context: JSON.parse(item?.context.replace(/'/g, '"'))
16067
+ });
16068
+ return { ...item, active: true };
16069
+ }
16070
+ return item;
16071
+ });
16056
16072
  if (updatedFilter) setFilterBy(updatedFilter);
16073
+ if (updatedGroupBy) setGroupBy(updatedGroupBy);
16057
16074
  if (hasGroupBy) {
16058
16075
  viewData?.views?.search?.filters_by?.forEach((item, idx) => {
16059
16076
  const groupCtx = evalJSONContext(item?.context);
@@ -16080,7 +16097,7 @@ var Search = ({
16080
16097
  /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
16081
16098
  "div",
16082
16099
  {
16083
- className: `relative flex md:min-w-[400px] max-w-full items-center gap-[8px] w-full ${(showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && "border-r border-[rgba(242,242,242,1)]"}`,
16100
+ className: `relative flex md:min-w-[400px] max-w-full items-center gap-[8px] w-full ${showFiltersGroups && "border-r border-[rgba(242,242,242,1)]"}`,
16084
16101
  children: [
16085
16102
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "min-h-5 min-w-5", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SearchIcon, {}) }),
16086
16103
  /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-1 flex-wrap items-center gap-[8px]", children: [
@@ -16122,7 +16139,7 @@ var Search = ({
16122
16139
  ]
16123
16140
  }
16124
16141
  ),
16125
- (showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
16142
+ showFiltersGroups && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
16126
16143
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
16127
16144
  "div",
16128
16145
  {
package/dist/index.mjs CHANGED
@@ -15551,7 +15551,7 @@ var PopupFilter = ({
15551
15551
  right: 0,
15552
15552
  zIndex: 33
15553
15553
  },
15554
- className: "popup-filter w-full overflow-x-auto rounded-lg border bg-white border-none shadow-xl",
15554
+ className: "popup-filter w-full overflow-x-auto rounded-lg border border-[var(--stroke-default)] bg-white shadow-xl",
15555
15555
  children: /* @__PURE__ */ jsxs38(
15556
15556
  "div",
15557
15557
  {
@@ -15904,8 +15904,9 @@ var Search = ({
15904
15904
  const searchDefaults = Object.entries(context || {}).filter(
15905
15905
  ([key]) => key.startsWith("search_default_")
15906
15906
  );
15907
+ const defaultGroupBy = context ? Object.entries(context).filter(([key]) => key.includes("group_by")) : [];
15907
15908
  const hasGroupBy = viewData?.views?.search?.filters_by?.length > 0;
15908
- if (searchDefaults.length === 0 && !hasGroupBy) {
15909
+ if (searchDefaults.length === 0 && !hasGroupBy && defaultGroupBy?.length === 0) {
15909
15910
  setIsReadyFormatDomain(true);
15910
15911
  setDidInit(true);
15911
15912
  return;
@@ -15926,7 +15927,23 @@ var Search = ({
15926
15927
  }
15927
15928
  return item;
15928
15929
  });
15930
+ const updatedGroupBy = groupBy?.map((item) => {
15931
+ const defaultGroupByItem = defaultGroupBy.find(
15932
+ ([_2, value]) => item?.context?.includes(value)
15933
+ );
15934
+ if (defaultGroupByItem && typeof handleAddTagSearch == "function") {
15935
+ handleAddTagSearch({
15936
+ name: item?.name,
15937
+ value: item?.string,
15938
+ type: SearchType.GROUP,
15939
+ context: JSON.parse(item?.context.replace(/'/g, '"'))
15940
+ });
15941
+ return { ...item, active: true };
15942
+ }
15943
+ return item;
15944
+ });
15929
15945
  if (updatedFilter) setFilterBy(updatedFilter);
15946
+ if (updatedGroupBy) setGroupBy(updatedGroupBy);
15930
15947
  if (hasGroupBy) {
15931
15948
  viewData?.views?.search?.filters_by?.forEach((item, idx) => {
15932
15949
  const groupCtx = evalJSONContext(item?.context);
@@ -15953,7 +15970,7 @@ var Search = ({
15953
15970
  /* @__PURE__ */ jsxs41(
15954
15971
  "div",
15955
15972
  {
15956
- className: `relative flex md:min-w-[400px] max-w-full items-center gap-[8px] w-full ${(showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && "border-r border-[rgba(242,242,242,1)]"}`,
15973
+ className: `relative flex md:min-w-[400px] max-w-full items-center gap-[8px] w-full ${showFiltersGroups && "border-r border-[rgba(242,242,242,1)]"}`,
15957
15974
  children: [
15958
15975
  /* @__PURE__ */ jsx65("div", { className: "min-h-5 min-w-5", children: /* @__PURE__ */ jsx65(SearchIcon, {}) }),
15959
15976
  /* @__PURE__ */ jsxs41("div", { className: "flex flex-1 flex-wrap items-center gap-[8px]", children: [
@@ -15995,7 +16012,7 @@ var Search = ({
15995
16012
  ]
15996
16013
  }
15997
16014
  ),
15998
- (showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && /* @__PURE__ */ jsxs41(Fragment10, { children: [
16015
+ showFiltersGroups && /* @__PURE__ */ jsxs41(Fragment10, { children: [
15999
16016
  /* @__PURE__ */ jsx65(
16000
16017
  "div",
16001
16018
  {
package/dist/widgets.js CHANGED
@@ -14681,7 +14681,7 @@ var PopupFilter = ({
14681
14681
  right: 0,
14682
14682
  zIndex: 33
14683
14683
  },
14684
- className: "popup-filter w-full overflow-x-auto rounded-lg border bg-white border-none shadow-xl",
14684
+ className: "popup-filter w-full overflow-x-auto rounded-lg border border-[var(--stroke-default)] bg-white shadow-xl",
14685
14685
  children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
14686
14686
  "div",
14687
14687
  {
@@ -15280,8 +15280,9 @@ var Search = ({
15280
15280
  const searchDefaults = Object.entries(context || {}).filter(
15281
15281
  ([key]) => key.startsWith("search_default_")
15282
15282
  );
15283
+ const defaultGroupBy = context ? Object.entries(context).filter(([key]) => key.includes("group_by")) : [];
15283
15284
  const hasGroupBy = viewData?.views?.search?.filters_by?.length > 0;
15284
- if (searchDefaults.length === 0 && !hasGroupBy) {
15285
+ if (searchDefaults.length === 0 && !hasGroupBy && defaultGroupBy?.length === 0) {
15285
15286
  setIsReadyFormatDomain(true);
15286
15287
  setDidInit(true);
15287
15288
  return;
@@ -15302,7 +15303,23 @@ var Search = ({
15302
15303
  }
15303
15304
  return item;
15304
15305
  });
15306
+ const updatedGroupBy = groupBy?.map((item) => {
15307
+ const defaultGroupByItem = defaultGroupBy.find(
15308
+ ([_2, value]) => item?.context?.includes(value)
15309
+ );
15310
+ if (defaultGroupByItem && typeof handleAddTagSearch == "function") {
15311
+ handleAddTagSearch({
15312
+ name: item?.name,
15313
+ value: item?.string,
15314
+ type: SearchType.GROUP,
15315
+ context: JSON.parse(item?.context.replace(/'/g, '"'))
15316
+ });
15317
+ return { ...item, active: true };
15318
+ }
15319
+ return item;
15320
+ });
15305
15321
  if (updatedFilter) setFilterBy(updatedFilter);
15322
+ if (updatedGroupBy) setGroupBy(updatedGroupBy);
15306
15323
  if (hasGroupBy) {
15307
15324
  viewData?.views?.search?.filters_by?.forEach((item, idx) => {
15308
15325
  const groupCtx = evalJSONContext(item?.context);
@@ -15329,7 +15346,7 @@ var Search = ({
15329
15346
  /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
15330
15347
  "div",
15331
15348
  {
15332
- className: `relative flex md:min-w-[400px] max-w-full items-center gap-[8px] w-full ${(showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && "border-r border-[rgba(242,242,242,1)]"}`,
15349
+ className: `relative flex md:min-w-[400px] max-w-full items-center gap-[8px] w-full ${showFiltersGroups && "border-r border-[rgba(242,242,242,1)]"}`,
15333
15350
  children: [
15334
15351
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "min-h-5 min-w-5", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SearchIcon, {}) }),
15335
15352
  /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-1 flex-wrap items-center gap-[8px]", children: [
@@ -15371,7 +15388,7 @@ var Search = ({
15371
15388
  ]
15372
15389
  }
15373
15390
  ),
15374
- (showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
15391
+ showFiltersGroups && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
15375
15392
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
15376
15393
  "div",
15377
15394
  {
package/dist/widgets.mjs CHANGED
@@ -14618,7 +14618,7 @@ var PopupFilter = ({
14618
14618
  right: 0,
14619
14619
  zIndex: 33
14620
14620
  },
14621
- className: "popup-filter w-full overflow-x-auto rounded-lg border bg-white border-none shadow-xl",
14621
+ className: "popup-filter w-full overflow-x-auto rounded-lg border border-[var(--stroke-default)] bg-white shadow-xl",
14622
14622
  children: /* @__PURE__ */ jsxs38(
14623
14623
  "div",
14624
14624
  {
@@ -15217,8 +15217,9 @@ var Search = ({
15217
15217
  const searchDefaults = Object.entries(context || {}).filter(
15218
15218
  ([key]) => key.startsWith("search_default_")
15219
15219
  );
15220
+ const defaultGroupBy = context ? Object.entries(context).filter(([key]) => key.includes("group_by")) : [];
15220
15221
  const hasGroupBy = viewData?.views?.search?.filters_by?.length > 0;
15221
- if (searchDefaults.length === 0 && !hasGroupBy) {
15222
+ if (searchDefaults.length === 0 && !hasGroupBy && defaultGroupBy?.length === 0) {
15222
15223
  setIsReadyFormatDomain(true);
15223
15224
  setDidInit(true);
15224
15225
  return;
@@ -15239,7 +15240,23 @@ var Search = ({
15239
15240
  }
15240
15241
  return item;
15241
15242
  });
15243
+ const updatedGroupBy = groupBy?.map((item) => {
15244
+ const defaultGroupByItem = defaultGroupBy.find(
15245
+ ([_2, value]) => item?.context?.includes(value)
15246
+ );
15247
+ if (defaultGroupByItem && typeof handleAddTagSearch == "function") {
15248
+ handleAddTagSearch({
15249
+ name: item?.name,
15250
+ value: item?.string,
15251
+ type: SearchType.GROUP,
15252
+ context: JSON.parse(item?.context.replace(/'/g, '"'))
15253
+ });
15254
+ return { ...item, active: true };
15255
+ }
15256
+ return item;
15257
+ });
15242
15258
  if (updatedFilter) setFilterBy(updatedFilter);
15259
+ if (updatedGroupBy) setGroupBy(updatedGroupBy);
15243
15260
  if (hasGroupBy) {
15244
15261
  viewData?.views?.search?.filters_by?.forEach((item, idx) => {
15245
15262
  const groupCtx = evalJSONContext(item?.context);
@@ -15266,7 +15283,7 @@ var Search = ({
15266
15283
  /* @__PURE__ */ jsxs41(
15267
15284
  "div",
15268
15285
  {
15269
- className: `relative flex md:min-w-[400px] max-w-full items-center gap-[8px] w-full ${(showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && "border-r border-[rgba(242,242,242,1)]"}`,
15286
+ className: `relative flex md:min-w-[400px] max-w-full items-center gap-[8px] w-full ${showFiltersGroups && "border-r border-[rgba(242,242,242,1)]"}`,
15270
15287
  children: [
15271
15288
  /* @__PURE__ */ jsx65("div", { className: "min-h-5 min-w-5", children: /* @__PURE__ */ jsx65(SearchIcon, {}) }),
15272
15289
  /* @__PURE__ */ jsxs41("div", { className: "flex flex-1 flex-wrap items-center gap-[8px]", children: [
@@ -15308,7 +15325,7 @@ var Search = ({
15308
15325
  ]
15309
15326
  }
15310
15327
  ),
15311
- (showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && /* @__PURE__ */ jsxs41(Fragment10, { children: [
15328
+ showFiltersGroups && /* @__PURE__ */ jsxs41(Fragment10, { children: [
15312
15329
  /* @__PURE__ */ jsx65(
15313
15330
  "div",
15314
15331
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/sme-widget-ui",
3
- "version": "2.7.5",
3
+ "version": "2.7.7",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",