@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260616091934 → 0.8.1-dev.20260616111809

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
@@ -4948,6 +4948,9 @@ var OdataBuilder = class {
4948
4948
  if (key == "searchTerm") {
4949
4949
  this.searchTerm = odata[key];
4950
4950
  }
4951
+ if (key == "searchCols") {
4952
+ this.searchCols = odata[key];
4953
+ }
4951
4954
  }
4952
4955
  }
4953
4956
  }
@@ -4971,6 +4974,9 @@ var OdataBuilder = class {
4971
4974
  if (obj?.["searchTerm"] && obj["searchTerm"].trim() !== "") {
4972
4975
  queryString += `&searchTerm=${encodeURIComponent(obj["searchTerm"])}`;
4973
4976
  }
4977
+ if (obj?.["searchCols"] && obj["searchCols"].trim() !== "") {
4978
+ queryString += `&searchCols=${encodeURIComponent(obj["searchCols"])}`;
4979
+ }
4974
4980
  if (obj) {
4975
4981
  if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
4976
4982
  queryString = queryString + `&$filter=${encodeURIComponent(obj["$filter"])}`;
@@ -5029,6 +5035,9 @@ var OdataBuilder = class {
5029
5035
  if (this.searchTerm) {
5030
5036
  url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
5031
5037
  }
5038
+ if (this.searchCols) {
5039
+ url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
5040
+ }
5032
5041
  console.log(url);
5033
5042
  return url;
5034
5043
  }
@@ -5040,6 +5049,9 @@ var OdataBuilder = class {
5040
5049
  if (this.searchTerm) {
5041
5050
  url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
5042
5051
  }
5052
+ if (this.searchCols) {
5053
+ url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
5054
+ }
5043
5055
  url = url + `&$orderby=${encodeURIComponent(orderBy)}`;
5044
5056
  return url;
5045
5057
  }
@@ -5051,6 +5063,12 @@ var OdataBuilder = class {
5051
5063
  if (this.orderBy !== null && this.orderBy !== "") {
5052
5064
  url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
5053
5065
  }
5066
+ if (this.searchTerm) {
5067
+ url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
5068
+ }
5069
+ if (this.searchCols) {
5070
+ url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
5071
+ }
5054
5072
  return url;
5055
5073
  }
5056
5074
  getNewPageUrl(page) {
@@ -5062,6 +5080,12 @@ var OdataBuilder = class {
5062
5080
  if (this.orderBy !== null && this.orderBy !== "") {
5063
5081
  url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
5064
5082
  }
5083
+ if (this.searchTerm) {
5084
+ url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
5085
+ }
5086
+ if (this.searchCols) {
5087
+ url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
5088
+ }
5065
5089
  return url;
5066
5090
  }
5067
5091
  getNewPageSizeUrl(pageSize) {
@@ -6237,7 +6261,9 @@ var DataList = (props) => {
6237
6261
  lastPropertyChanged: ""
6238
6262
  };
6239
6263
  const [formState, dispatch] = (0, import_react55.useReducer)(FormReducer_default, initialState);
6240
- const searchableColumns = props.columns.filter((x) => x.isSearchable).map((x) => x.name).join(",");
6264
+ const getSearchableColumns = () => {
6265
+ return props.columns?.filter((c) => c.isSearchable)?.map((c) => c.name)?.join(",");
6266
+ };
6241
6267
  const handleFilterChange = (0, import_react55.useCallback)(
6242
6268
  (updatedValues) => {
6243
6269
  dispatch({
@@ -6270,11 +6296,18 @@ var DataList = (props) => {
6270
6296
  [dispatch, props, router]
6271
6297
  );
6272
6298
  (0, import_react55.useEffect)(() => {
6299
+ if (!props.columns.some((col) => col.isSearchable)) {
6300
+ return;
6301
+ }
6302
+ if (searchTerm === (props.query?.searchTerm ?? "")) {
6303
+ return;
6304
+ }
6273
6305
  const timeout = setTimeout(() => {
6274
6306
  const builder2 = new OdataBuilder(props.path);
6275
6307
  builder2.setQuery({
6276
6308
  ...props.query,
6277
6309
  searchTerm,
6310
+ searchCols: getSearchableColumns(),
6278
6311
  $skip: "0"
6279
6312
  });
6280
6313
  router.push(builder2.getUrl());
@@ -6464,14 +6497,16 @@ var DataList = (props) => {
6464
6497
  children: [
6465
6498
  props.title ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "inline-flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("h2", { className: "text-lg font-semibold text-black-800", children: props.title }) }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", {}),
6466
6499
  /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex items-center gap-3", children: [
6467
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6500
+ props.columns.some((col) => col.isSearchable) && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6468
6501
  InputControl_default,
6469
6502
  {
6470
6503
  name: "Search_input",
6471
6504
  controlType: InputControlType_default.lineTextInput,
6472
6505
  value: searchTerm,
6473
6506
  callback: (e) => setSearchTerm(e.value),
6474
- attributes: { placeholder: "Search..." }
6507
+ attributes: {
6508
+ placeholder: `Search by ${props.columns.filter((col) => col.isSearchable).map((col) => col.label).join(", ")}`
6509
+ }
6475
6510
  }
6476
6511
  ),
6477
6512
  props.filters && props.filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
@@ -6626,14 +6661,16 @@ var DataList = (props) => {
6626
6661
  children: [
6627
6662
  props.title ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "inline-flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("h2", { className: "text-lg font-semibold text-black", children: props.title }) }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", {}),
6628
6663
  /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex items-center gap-3", children: [
6629
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6664
+ props.columns.some((col) => col.isSearchable) && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6630
6665
  InputControl_default,
6631
6666
  {
6632
6667
  name: "Search_input",
6633
6668
  controlType: InputControlType_default.lineTextInput,
6634
6669
  value: searchTerm,
6635
6670
  callback: (e) => setSearchTerm(e.value),
6636
- attributes: { placeholder: "Search..." }
6671
+ attributes: {
6672
+ placeholder: `Search by ${props.columns.filter((col) => col.isSearchable).map((col) => col.label).join(", ")}`
6673
+ }
6637
6674
  }
6638
6675
  ),
6639
6676
  props.filters && props.filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
package/dist/index.mjs CHANGED
@@ -3343,6 +3343,9 @@ var OdataBuilder = class {
3343
3343
  if (key == "searchTerm") {
3344
3344
  this.searchTerm = odata[key];
3345
3345
  }
3346
+ if (key == "searchCols") {
3347
+ this.searchCols = odata[key];
3348
+ }
3346
3349
  }
3347
3350
  }
3348
3351
  }
@@ -3366,6 +3369,9 @@ var OdataBuilder = class {
3366
3369
  if (obj?.["searchTerm"] && obj["searchTerm"].trim() !== "") {
3367
3370
  queryString += `&searchTerm=${encodeURIComponent(obj["searchTerm"])}`;
3368
3371
  }
3372
+ if (obj?.["searchCols"] && obj["searchCols"].trim() !== "") {
3373
+ queryString += `&searchCols=${encodeURIComponent(obj["searchCols"])}`;
3374
+ }
3369
3375
  if (obj) {
3370
3376
  if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
3371
3377
  queryString = queryString + `&$filter=${encodeURIComponent(obj["$filter"])}`;
@@ -3424,6 +3430,9 @@ var OdataBuilder = class {
3424
3430
  if (this.searchTerm) {
3425
3431
  url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
3426
3432
  }
3433
+ if (this.searchCols) {
3434
+ url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
3435
+ }
3427
3436
  console.log(url);
3428
3437
  return url;
3429
3438
  }
@@ -3435,6 +3444,9 @@ var OdataBuilder = class {
3435
3444
  if (this.searchTerm) {
3436
3445
  url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
3437
3446
  }
3447
+ if (this.searchCols) {
3448
+ url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
3449
+ }
3438
3450
  url = url + `&$orderby=${encodeURIComponent(orderBy)}`;
3439
3451
  return url;
3440
3452
  }
@@ -3446,6 +3458,12 @@ var OdataBuilder = class {
3446
3458
  if (this.orderBy !== null && this.orderBy !== "") {
3447
3459
  url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
3448
3460
  }
3461
+ if (this.searchTerm) {
3462
+ url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
3463
+ }
3464
+ if (this.searchCols) {
3465
+ url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
3466
+ }
3449
3467
  return url;
3450
3468
  }
3451
3469
  getNewPageUrl(page) {
@@ -3457,6 +3475,12 @@ var OdataBuilder = class {
3457
3475
  if (this.orderBy !== null && this.orderBy !== "") {
3458
3476
  url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
3459
3477
  }
3478
+ if (this.searchTerm) {
3479
+ url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
3480
+ }
3481
+ if (this.searchCols) {
3482
+ url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
3483
+ }
3460
3484
  return url;
3461
3485
  }
3462
3486
  getNewPageSizeUrl(pageSize) {
@@ -4625,7 +4649,9 @@ var DataList = (props) => {
4625
4649
  lastPropertyChanged: ""
4626
4650
  };
4627
4651
  const [formState, dispatch] = useReducer2(FormReducer_default, initialState);
4628
- const searchableColumns = props.columns.filter((x) => x.isSearchable).map((x) => x.name).join(",");
4652
+ const getSearchableColumns = () => {
4653
+ return props.columns?.filter((c) => c.isSearchable)?.map((c) => c.name)?.join(",");
4654
+ };
4629
4655
  const handleFilterChange = useCallback3(
4630
4656
  (updatedValues) => {
4631
4657
  dispatch({
@@ -4658,11 +4684,18 @@ var DataList = (props) => {
4658
4684
  [dispatch, props, router]
4659
4685
  );
4660
4686
  useEffect10(() => {
4687
+ if (!props.columns.some((col) => col.isSearchable)) {
4688
+ return;
4689
+ }
4690
+ if (searchTerm === (props.query?.searchTerm ?? "")) {
4691
+ return;
4692
+ }
4661
4693
  const timeout = setTimeout(() => {
4662
4694
  const builder2 = new OdataBuilder(props.path);
4663
4695
  builder2.setQuery({
4664
4696
  ...props.query,
4665
4697
  searchTerm,
4698
+ searchCols: getSearchableColumns(),
4666
4699
  $skip: "0"
4667
4700
  });
4668
4701
  router.push(builder2.getUrl());
@@ -4852,14 +4885,16 @@ var DataList = (props) => {
4852
4885
  children: [
4853
4886
  props.title ? /* @__PURE__ */ jsx65("div", { className: "inline-flex items-center gap-2", children: /* @__PURE__ */ jsx65("h2", { className: "text-lg font-semibold text-black-800", children: props.title }) }) : /* @__PURE__ */ jsx65("div", {}),
4854
4887
  /* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-3", children: [
4855
- /* @__PURE__ */ jsx65(
4888
+ props.columns.some((col) => col.isSearchable) && /* @__PURE__ */ jsx65(
4856
4889
  InputControl_default,
4857
4890
  {
4858
4891
  name: "Search_input",
4859
4892
  controlType: InputControlType_default.lineTextInput,
4860
4893
  value: searchTerm,
4861
4894
  callback: (e) => setSearchTerm(e.value),
4862
- attributes: { placeholder: "Search..." }
4895
+ attributes: {
4896
+ placeholder: `Search by ${props.columns.filter((col) => col.isSearchable).map((col) => col.label).join(", ")}`
4897
+ }
4863
4898
  }
4864
4899
  ),
4865
4900
  props.filters && props.filters.map((filter) => /* @__PURE__ */ jsx65(
@@ -5014,14 +5049,16 @@ var DataList = (props) => {
5014
5049
  children: [
5015
5050
  props.title ? /* @__PURE__ */ jsx65("div", { className: "inline-flex items-center gap-2", children: /* @__PURE__ */ jsx65("h2", { className: "text-lg font-semibold text-black", children: props.title }) }) : /* @__PURE__ */ jsx65("div", {}),
5016
5051
  /* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-3", children: [
5017
- /* @__PURE__ */ jsx65(
5052
+ props.columns.some((col) => col.isSearchable) && /* @__PURE__ */ jsx65(
5018
5053
  InputControl_default,
5019
5054
  {
5020
5055
  name: "Search_input",
5021
5056
  controlType: InputControlType_default.lineTextInput,
5022
5057
  value: searchTerm,
5023
5058
  callback: (e) => setSearchTerm(e.value),
5024
- attributes: { placeholder: "Search..." }
5059
+ attributes: {
5060
+ placeholder: `Search by ${props.columns.filter((col) => col.isSearchable).map((col) => col.label).join(", ")}`
5061
+ }
5025
5062
  }
5026
5063
  ),
5027
5064
  props.filters && props.filters.map((filter) => /* @__PURE__ */ jsx65(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acoustte-digital-services/digitalstore-controls-dev",
3
- "version": "0.8.1-dev.20260616091934",
3
+ "version": "0.8.1-dev.20260616111809",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",