@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260616060453 → 0.8.1-dev.20260616104505

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 (3) hide show
  1. package/dist/index.js +121 -29
  2. package/dist/index.mjs +115 -23
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1266,7 +1266,7 @@ var init_LinkNodeButton = __esm({
1266
1266
  const fieldNames = extractFieldNames(template);
1267
1267
  if (responseData) {
1268
1268
  fieldNames.forEach((fieldName) => {
1269
- const value = getNestedValue4(responseData, fieldName);
1269
+ const value = getNestedValue5(responseData, fieldName);
1270
1270
  if (value !== void 0) {
1271
1271
  const regex1 = new RegExp(`\\{${fieldName}\\}`, "g");
1272
1272
  const regex2 = new RegExp(`\\{\\{${fieldName}\\}\\}`, "g");
@@ -1289,7 +1289,7 @@ var init_LinkNodeButton = __esm({
1289
1289
  }
1290
1290
  return result;
1291
1291
  }, [props.routeParameters, dataitem, extractFieldNames]);
1292
- const getNestedValue4 = (0, import_react35.useCallback)((obj, path) => {
1292
+ const getNestedValue5 = (0, import_react35.useCallback)((obj, path) => {
1293
1293
  if (!obj || !path) return void 0;
1294
1294
  if (obj[path] !== void 0) {
1295
1295
  return obj[path];
@@ -1339,15 +1339,15 @@ var init_LinkNodeButton = __esm({
1339
1339
  console.log("Field names in redirect URL:", fieldNames);
1340
1340
  const fieldValueMap = {};
1341
1341
  fieldNames.forEach((fieldName) => {
1342
- const value = getNestedValue4(response, fieldName);
1342
+ const value = getNestedValue5(response, fieldName);
1343
1343
  if (value !== void 0) {
1344
1344
  fieldValueMap[fieldName] = String(value);
1345
1345
  } else {
1346
- const resultValue = getNestedValue4(response, `result.${fieldName}`);
1346
+ const resultValue = getNestedValue5(response, `result.${fieldName}`);
1347
1347
  if (resultValue !== void 0) {
1348
1348
  fieldValueMap[fieldName] = String(resultValue);
1349
1349
  } else {
1350
- const dataValue = getNestedValue4(response, `data.${fieldName}`);
1350
+ const dataValue = getNestedValue5(response, `data.${fieldName}`);
1351
1351
  if (dataValue !== void 0) {
1352
1352
  fieldValueMap[fieldName] = String(dataValue);
1353
1353
  }
@@ -1385,7 +1385,7 @@ var init_LinkNodeButton = __esm({
1385
1385
  setIsLoading(false);
1386
1386
  return { isSuccessful: false, message: err.message };
1387
1387
  }
1388
- }, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue4, props.apiBaseUrl, props.session]);
1388
+ }, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue5, props.apiBaseUrl, props.session]);
1389
1389
  const renderButtonContent = () => {
1390
1390
  if (children) {
1391
1391
  return children;
@@ -2852,7 +2852,7 @@ var SelectWithSearchPanel = (props) => {
2852
2852
  const containerRef = (0, import_react29.useRef)(null);
2853
2853
  const [isCreateOpen, setIsCreateOpen] = (0, import_react29.useState)(false);
2854
2854
  const [formData, setFormData] = (0, import_react29.useState)({});
2855
- const getNestedValue4 = (obj, path) => {
2855
+ const getNestedValue5 = (obj, path) => {
2856
2856
  return path.split(".").reduce((acc, key) => acc?.[key], obj);
2857
2857
  };
2858
2858
  (0, import_react29.useEffect)(() => {
@@ -2890,7 +2890,7 @@ var SelectWithSearchPanel = (props) => {
2890
2890
  props.dataSourceDependsOn
2891
2891
  ]);
2892
2892
  const filteredItems = list?.filter((item) => {
2893
- const value = getNestedValue4(item, props.dataTextFieldName);
2893
+ const value = getNestedValue5(item, props.dataTextFieldName);
2894
2894
  return value?.toLowerCase().includes(searchTerm?.toLowerCase());
2895
2895
  });
2896
2896
  const playBeep = () => {
@@ -2921,7 +2921,7 @@ var SelectWithSearchPanel = (props) => {
2921
2921
  }, [searchTerm]);
2922
2922
  const handleSelect = (event, item) => {
2923
2923
  event.preventDefault();
2924
- setSearchTerm(getNestedValue4(item, props.dataTextFieldName));
2924
+ setSearchTerm(getNestedValue5(item, props.dataTextFieldName));
2925
2925
  if (props.callback) {
2926
2926
  const val = {};
2927
2927
  props.callback({
@@ -3076,7 +3076,7 @@ var SelectWithSearchPanel = (props) => {
3076
3076
  role: "option",
3077
3077
  tabIndex: -1,
3078
3078
  onMouseEnter: () => setHighlightedIndex(index),
3079
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: getNestedValue4(item, props.dataTextFieldName) })
3079
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: getNestedValue5(item, props.dataTextFieldName) })
3080
3080
  }
3081
3081
  ) }, item[props.dataKeyFieldName])) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
3082
3082
  }
@@ -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) {
@@ -5365,10 +5389,69 @@ var parseMaybeNumber = (value) => {
5365
5389
  const n = Number(value);
5366
5390
  return Number.isFinite(n) ? n : void 0;
5367
5391
  };
5392
+ function resolveAssetUrl(fieldValue, tag) {
5393
+ if (!fieldValue) {
5394
+ return void 0;
5395
+ }
5396
+ if (typeof fieldValue === "string") {
5397
+ const trimmed = fieldValue.trim();
5398
+ if (trimmed.startsWith("itemassets/") || trimmed.startsWith("/itemassets/") || trimmed.startsWith("http")) {
5399
+ return trimmed;
5400
+ }
5401
+ try {
5402
+ const parsed = JSON.parse(trimmed);
5403
+ return resolveAssetUrl(parsed, tag);
5404
+ } catch {
5405
+ return void 0;
5406
+ }
5407
+ }
5408
+ if (Array.isArray(fieldValue)) {
5409
+ const asset = tag ? fieldValue.find(
5410
+ (x) => x?.tag?.toLowerCase() === tag?.toLowerCase()
5411
+ ) : fieldValue[0];
5412
+ return asset?.assetUrl;
5413
+ }
5414
+ if (typeof fieldValue === "object" && fieldValue !== null) {
5415
+ const assetObject = fieldValue;
5416
+ if (assetObject.assetUrl) {
5417
+ return assetObject.assetUrl;
5418
+ }
5419
+ }
5420
+ return void 0;
5421
+ }
5422
+ var getNestedValue3 = (obj, path) => {
5423
+ if (!obj || !path) {
5424
+ return void 0;
5425
+ }
5426
+ return path.split(".").reduce(
5427
+ (current, key) => {
5428
+ return current?.[key];
5429
+ },
5430
+ obj
5431
+ );
5432
+ };
5368
5433
  var ImageGalleryNode = (props) => {
5369
- const resolveImageUrl = (imageUrl) => {
5370
- if (!imageUrl) return "";
5371
- if (imageUrl.startsWith("http")) return imageUrl;
5434
+ const resolveImageUrl = (image) => {
5435
+ let imageUrl = image.imageUrl;
5436
+ if (image.datafield && props.dataitem) {
5437
+ const fieldValue = getNestedValue3(
5438
+ props.dataitem,
5439
+ image.datafield
5440
+ );
5441
+ const resolvedAsset = resolveAssetUrl(
5442
+ fieldValue,
5443
+ image.tag
5444
+ );
5445
+ if (resolvedAsset) {
5446
+ imageUrl = resolvedAsset;
5447
+ }
5448
+ }
5449
+ if (!imageUrl) {
5450
+ return "";
5451
+ }
5452
+ if (imageUrl.startsWith("http")) {
5453
+ return imageUrl;
5454
+ }
5372
5455
  const base = props.assetBaseUrl.replace(/\/$/, "");
5373
5456
  const path = imageUrl.replace(/^\//, "");
5374
5457
  return `${base}/${path}`;
@@ -5379,23 +5462,23 @@ var ImageGalleryNode = (props) => {
5379
5462
  };
5380
5463
  const rawImages = Array.isArray(props.node.images) ? props.node.images : [];
5381
5464
  const hlsImages = rawImages.filter(
5382
- (img) => resolveImageUrl(img.imageUrl).endsWith(".m3u8")
5465
+ (img) => resolveImageUrl(img).endsWith(".m3u8")
5383
5466
  );
5384
5467
  const staticImages = rawImages.filter(
5385
- (img) => !resolveImageUrl(img.imageUrl).endsWith(".m3u8")
5468
+ (img) => !resolveImageUrl(img).endsWith(".m3u8")
5386
5469
  );
5387
5470
  const hlsSources = [
5388
5471
  ...DEVICE_ORDER.flatMap((deviceKey) => {
5389
5472
  const img = hlsImages.find((i) => i.device === deviceKey);
5390
5473
  if (!img) return [];
5391
- const src = resolveImageUrl(img.imageUrl);
5474
+ const src = resolveImageUrl(img);
5392
5475
  if (!src) return [];
5393
5476
  const media = deviceToMediaQuery(img.device);
5394
5477
  const posterUrl = resolvePosterUrl(img.posterUrl);
5395
5478
  return [{ src, ...media ? { media } : {}, ...posterUrl ? { posterUrl } : {} }];
5396
5479
  }),
5397
5480
  ...hlsImages.filter((img) => !img.device).map((img) => {
5398
- const src = resolveImageUrl(img.imageUrl);
5481
+ const src = resolveImageUrl(img);
5399
5482
  const posterUrl = resolvePosterUrl(img.posterUrl);
5400
5483
  return { src, ...posterUrl ? { posterUrl } : {} };
5401
5484
  }).filter((s) => !!s.src)
@@ -5435,7 +5518,7 @@ var ImageGalleryNode = (props) => {
5435
5518
  DEVICE_ORDER.map((deviceKey) => {
5436
5519
  const match = staticSources.find((img) => img.device === deviceKey);
5437
5520
  if (!match) return null;
5438
- const srcUrl = resolveImageUrl(match.imageUrl);
5521
+ const srcUrl = resolveImageUrl(match);
5439
5522
  if (!srcUrl) return null;
5440
5523
  const mediaQuery = deviceToMediaQuery(match.device);
5441
5524
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
@@ -5451,7 +5534,7 @@ var ImageGalleryNode = (props) => {
5451
5534
  }),
5452
5535
  (() => {
5453
5536
  const img = staticFallback;
5454
- const imageUrl = resolveImageUrl(img.imageUrl);
5537
+ const imageUrl = resolveImageUrl(img);
5455
5538
  if (!imageUrl) return null;
5456
5539
  const intrinsicWidth = parseMaybeNumber(img.intrinsicWidth);
5457
5540
  const intrinsicHeight = parseMaybeNumber(img.intrinsicHeight);
@@ -5497,7 +5580,7 @@ function convertKeysToCamelCase(obj) {
5497
5580
  ])
5498
5581
  );
5499
5582
  }
5500
- var getNestedValue3 = (obj, path) => {
5583
+ var getNestedValue4 = (obj, path) => {
5501
5584
  if (!obj || !path) return void 0;
5502
5585
  return path.split(".").reduce((current, key) => {
5503
5586
  {
@@ -5505,7 +5588,7 @@ var getNestedValue3 = (obj, path) => {
5505
5588
  return current && current[key] !== void 0 ? current[key] : void 0;
5506
5589
  }, obj);
5507
5590
  };
5508
- function resolveAssetUrl(fieldValue, tag) {
5591
+ function resolveAssetUrl2(fieldValue, tag) {
5509
5592
  if (!fieldValue) {
5510
5593
  return void 0;
5511
5594
  }
@@ -5516,7 +5599,7 @@ function resolveAssetUrl(fieldValue, tag) {
5516
5599
  }
5517
5600
  try {
5518
5601
  const parsed = JSON.parse(trimmed);
5519
- return resolveAssetUrl(parsed, tag);
5602
+ return resolveAssetUrl2(parsed, tag);
5520
5603
  } catch {
5521
5604
  return void 0;
5522
5605
  }
@@ -5542,11 +5625,11 @@ function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
5542
5625
  const imageValue = layer.value;
5543
5626
  let assetUrl = imageValue.assetUrl || "";
5544
5627
  if (layer.datafield && dataItem) {
5545
- const fieldValue = getNestedValue3(
5628
+ const fieldValue = getNestedValue4(
5546
5629
  dataItem,
5547
5630
  layer.datafield
5548
5631
  );
5549
- const resolvedAssetUrl = resolveAssetUrl(
5632
+ const resolvedAssetUrl = resolveAssetUrl2(
5550
5633
  fieldValue,
5551
5634
  layer.tag
5552
5635
  );
@@ -5703,7 +5786,7 @@ var DivContainer = async (props) => {
5703
5786
  const condition = props.node.fieldVisibleOnTrue;
5704
5787
  const isNegated = condition.startsWith("!");
5705
5788
  const fieldName = isNegated ? condition.substring(1) : condition;
5706
- const fieldValue = getNestedValue3(props.dataitem, fieldName);
5789
+ const fieldValue = getNestedValue4(props.dataitem, fieldName);
5707
5790
  if (fieldValue === void 0) {
5708
5791
  return false;
5709
5792
  }
@@ -5736,7 +5819,7 @@ var DivContainer = async (props) => {
5736
5819
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(NoDataFound_default, {});
5737
5820
  }
5738
5821
  if (dataBindingProperties.childCollectionName && props.dataitem) {
5739
- childCollectionData = getNestedValue3(props.dataitem, dataBindingProperties.childCollectionName);
5822
+ childCollectionData = getNestedValue4(props.dataitem, dataBindingProperties.childCollectionName);
5740
5823
  }
5741
5824
  }
5742
5825
  const cssResult = generateCssString(
@@ -6178,7 +6261,9 @@ var DataList = (props) => {
6178
6261
  lastPropertyChanged: ""
6179
6262
  };
6180
6263
  const [formState, dispatch] = (0, import_react55.useReducer)(FormReducer_default, initialState);
6181
- 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
+ };
6182
6267
  const handleFilterChange = (0, import_react55.useCallback)(
6183
6268
  (updatedValues) => {
6184
6269
  dispatch({
@@ -6211,11 +6296,18 @@ var DataList = (props) => {
6211
6296
  [dispatch, props, router]
6212
6297
  );
6213
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
+ }
6214
6305
  const timeout = setTimeout(() => {
6215
6306
  const builder2 = new OdataBuilder(props.path);
6216
6307
  builder2.setQuery({
6217
6308
  ...props.query,
6218
6309
  searchTerm,
6310
+ searchCols: getSearchableColumns(),
6219
6311
  $skip: "0"
6220
6312
  });
6221
6313
  router.push(builder2.getUrl());
@@ -6405,7 +6497,7 @@ var DataList = (props) => {
6405
6497
  children: [
6406
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", {}),
6407
6499
  /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex items-center gap-3", children: [
6408
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6500
+ props.columns.some((col) => col.isSearchable) && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6409
6501
  InputControl_default,
6410
6502
  {
6411
6503
  name: "Search_input",
@@ -6567,7 +6659,7 @@ var DataList = (props) => {
6567
6659
  children: [
6568
6660
  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", {}),
6569
6661
  /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex items-center gap-3", children: [
6570
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6662
+ props.columns.some((col) => col.isSearchable) && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6571
6663
  InputControl_default,
6572
6664
  {
6573
6665
  name: "Search_input",
package/dist/index.mjs CHANGED
@@ -1252,7 +1252,7 @@ var SelectWithSearchPanel = (props) => {
1252
1252
  const containerRef = useRef2(null);
1253
1253
  const [isCreateOpen, setIsCreateOpen] = useState4(false);
1254
1254
  const [formData, setFormData] = useState4({});
1255
- const getNestedValue4 = (obj, path) => {
1255
+ const getNestedValue5 = (obj, path) => {
1256
1256
  return path.split(".").reduce((acc, key) => acc?.[key], obj);
1257
1257
  };
1258
1258
  useEffect5(() => {
@@ -1290,7 +1290,7 @@ var SelectWithSearchPanel = (props) => {
1290
1290
  props.dataSourceDependsOn
1291
1291
  ]);
1292
1292
  const filteredItems = list?.filter((item) => {
1293
- const value = getNestedValue4(item, props.dataTextFieldName);
1293
+ const value = getNestedValue5(item, props.dataTextFieldName);
1294
1294
  return value?.toLowerCase().includes(searchTerm?.toLowerCase());
1295
1295
  });
1296
1296
  const playBeep = () => {
@@ -1321,7 +1321,7 @@ var SelectWithSearchPanel = (props) => {
1321
1321
  }, [searchTerm]);
1322
1322
  const handleSelect = (event, item) => {
1323
1323
  event.preventDefault();
1324
- setSearchTerm(getNestedValue4(item, props.dataTextFieldName));
1324
+ setSearchTerm(getNestedValue5(item, props.dataTextFieldName));
1325
1325
  if (props.callback) {
1326
1326
  const val = {};
1327
1327
  props.callback({
@@ -1476,7 +1476,7 @@ var SelectWithSearchPanel = (props) => {
1476
1476
  role: "option",
1477
1477
  tabIndex: -1,
1478
1478
  onMouseEnter: () => setHighlightedIndex(index),
1479
- children: /* @__PURE__ */ jsx25("span", { children: getNestedValue4(item, props.dataTextFieldName) })
1479
+ children: /* @__PURE__ */ jsx25("span", { children: getNestedValue5(item, props.dataTextFieldName) })
1480
1480
  }
1481
1481
  ) }, item[props.dataKeyFieldName])) : /* @__PURE__ */ jsx25("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
1482
1482
  }
@@ -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) {
@@ -3759,10 +3783,69 @@ var parseMaybeNumber = (value) => {
3759
3783
  const n = Number(value);
3760
3784
  return Number.isFinite(n) ? n : void 0;
3761
3785
  };
3786
+ function resolveAssetUrl(fieldValue, tag) {
3787
+ if (!fieldValue) {
3788
+ return void 0;
3789
+ }
3790
+ if (typeof fieldValue === "string") {
3791
+ const trimmed = fieldValue.trim();
3792
+ if (trimmed.startsWith("itemassets/") || trimmed.startsWith("/itemassets/") || trimmed.startsWith("http")) {
3793
+ return trimmed;
3794
+ }
3795
+ try {
3796
+ const parsed = JSON.parse(trimmed);
3797
+ return resolveAssetUrl(parsed, tag);
3798
+ } catch {
3799
+ return void 0;
3800
+ }
3801
+ }
3802
+ if (Array.isArray(fieldValue)) {
3803
+ const asset = tag ? fieldValue.find(
3804
+ (x) => x?.tag?.toLowerCase() === tag?.toLowerCase()
3805
+ ) : fieldValue[0];
3806
+ return asset?.assetUrl;
3807
+ }
3808
+ if (typeof fieldValue === "object" && fieldValue !== null) {
3809
+ const assetObject = fieldValue;
3810
+ if (assetObject.assetUrl) {
3811
+ return assetObject.assetUrl;
3812
+ }
3813
+ }
3814
+ return void 0;
3815
+ }
3816
+ var getNestedValue3 = (obj, path) => {
3817
+ if (!obj || !path) {
3818
+ return void 0;
3819
+ }
3820
+ return path.split(".").reduce(
3821
+ (current, key) => {
3822
+ return current?.[key];
3823
+ },
3824
+ obj
3825
+ );
3826
+ };
3762
3827
  var ImageGalleryNode = (props) => {
3763
- const resolveImageUrl = (imageUrl) => {
3764
- if (!imageUrl) return "";
3765
- if (imageUrl.startsWith("http")) return imageUrl;
3828
+ const resolveImageUrl = (image) => {
3829
+ let imageUrl = image.imageUrl;
3830
+ if (image.datafield && props.dataitem) {
3831
+ const fieldValue = getNestedValue3(
3832
+ props.dataitem,
3833
+ image.datafield
3834
+ );
3835
+ const resolvedAsset = resolveAssetUrl(
3836
+ fieldValue,
3837
+ image.tag
3838
+ );
3839
+ if (resolvedAsset) {
3840
+ imageUrl = resolvedAsset;
3841
+ }
3842
+ }
3843
+ if (!imageUrl) {
3844
+ return "";
3845
+ }
3846
+ if (imageUrl.startsWith("http")) {
3847
+ return imageUrl;
3848
+ }
3766
3849
  const base = props.assetBaseUrl.replace(/\/$/, "");
3767
3850
  const path = imageUrl.replace(/^\//, "");
3768
3851
  return `${base}/${path}`;
@@ -3773,23 +3856,23 @@ var ImageGalleryNode = (props) => {
3773
3856
  };
3774
3857
  const rawImages = Array.isArray(props.node.images) ? props.node.images : [];
3775
3858
  const hlsImages = rawImages.filter(
3776
- (img) => resolveImageUrl(img.imageUrl).endsWith(".m3u8")
3859
+ (img) => resolveImageUrl(img).endsWith(".m3u8")
3777
3860
  );
3778
3861
  const staticImages = rawImages.filter(
3779
- (img) => !resolveImageUrl(img.imageUrl).endsWith(".m3u8")
3862
+ (img) => !resolveImageUrl(img).endsWith(".m3u8")
3780
3863
  );
3781
3864
  const hlsSources = [
3782
3865
  ...DEVICE_ORDER.flatMap((deviceKey) => {
3783
3866
  const img = hlsImages.find((i) => i.device === deviceKey);
3784
3867
  if (!img) return [];
3785
- const src = resolveImageUrl(img.imageUrl);
3868
+ const src = resolveImageUrl(img);
3786
3869
  if (!src) return [];
3787
3870
  const media = deviceToMediaQuery(img.device);
3788
3871
  const posterUrl = resolvePosterUrl(img.posterUrl);
3789
3872
  return [{ src, ...media ? { media } : {}, ...posterUrl ? { posterUrl } : {} }];
3790
3873
  }),
3791
3874
  ...hlsImages.filter((img) => !img.device).map((img) => {
3792
- const src = resolveImageUrl(img.imageUrl);
3875
+ const src = resolveImageUrl(img);
3793
3876
  const posterUrl = resolvePosterUrl(img.posterUrl);
3794
3877
  return { src, ...posterUrl ? { posterUrl } : {} };
3795
3878
  }).filter((s) => !!s.src)
@@ -3829,7 +3912,7 @@ var ImageGalleryNode = (props) => {
3829
3912
  DEVICE_ORDER.map((deviceKey) => {
3830
3913
  const match = staticSources.find((img) => img.device === deviceKey);
3831
3914
  if (!match) return null;
3832
- const srcUrl = resolveImageUrl(match.imageUrl);
3915
+ const srcUrl = resolveImageUrl(match);
3833
3916
  if (!srcUrl) return null;
3834
3917
  const mediaQuery = deviceToMediaQuery(match.device);
3835
3918
  return /* @__PURE__ */ jsx58(
@@ -3845,7 +3928,7 @@ var ImageGalleryNode = (props) => {
3845
3928
  }),
3846
3929
  (() => {
3847
3930
  const img = staticFallback;
3848
- const imageUrl = resolveImageUrl(img.imageUrl);
3931
+ const imageUrl = resolveImageUrl(img);
3849
3932
  if (!imageUrl) return null;
3850
3933
  const intrinsicWidth = parseMaybeNumber(img.intrinsicWidth);
3851
3934
  const intrinsicHeight = parseMaybeNumber(img.intrinsicHeight);
@@ -3891,7 +3974,7 @@ function convertKeysToCamelCase(obj) {
3891
3974
  ])
3892
3975
  );
3893
3976
  }
3894
- var getNestedValue3 = (obj, path) => {
3977
+ var getNestedValue4 = (obj, path) => {
3895
3978
  if (!obj || !path) return void 0;
3896
3979
  return path.split(".").reduce((current, key) => {
3897
3980
  {
@@ -3899,7 +3982,7 @@ var getNestedValue3 = (obj, path) => {
3899
3982
  return current && current[key] !== void 0 ? current[key] : void 0;
3900
3983
  }, obj);
3901
3984
  };
3902
- function resolveAssetUrl(fieldValue, tag) {
3985
+ function resolveAssetUrl2(fieldValue, tag) {
3903
3986
  if (!fieldValue) {
3904
3987
  return void 0;
3905
3988
  }
@@ -3910,7 +3993,7 @@ function resolveAssetUrl(fieldValue, tag) {
3910
3993
  }
3911
3994
  try {
3912
3995
  const parsed = JSON.parse(trimmed);
3913
- return resolveAssetUrl(parsed, tag);
3996
+ return resolveAssetUrl2(parsed, tag);
3914
3997
  } catch {
3915
3998
  return void 0;
3916
3999
  }
@@ -3936,11 +4019,11 @@ function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
3936
4019
  const imageValue = layer.value;
3937
4020
  let assetUrl = imageValue.assetUrl || "";
3938
4021
  if (layer.datafield && dataItem) {
3939
- const fieldValue = getNestedValue3(
4022
+ const fieldValue = getNestedValue4(
3940
4023
  dataItem,
3941
4024
  layer.datafield
3942
4025
  );
3943
- const resolvedAssetUrl = resolveAssetUrl(
4026
+ const resolvedAssetUrl = resolveAssetUrl2(
3944
4027
  fieldValue,
3945
4028
  layer.tag
3946
4029
  );
@@ -4097,7 +4180,7 @@ var DivContainer = async (props) => {
4097
4180
  const condition = props.node.fieldVisibleOnTrue;
4098
4181
  const isNegated = condition.startsWith("!");
4099
4182
  const fieldName = isNegated ? condition.substring(1) : condition;
4100
- const fieldValue = getNestedValue3(props.dataitem, fieldName);
4183
+ const fieldValue = getNestedValue4(props.dataitem, fieldName);
4101
4184
  if (fieldValue === void 0) {
4102
4185
  return false;
4103
4186
  }
@@ -4130,7 +4213,7 @@ var DivContainer = async (props) => {
4130
4213
  return /* @__PURE__ */ jsx59(NoDataFound_default, {});
4131
4214
  }
4132
4215
  if (dataBindingProperties.childCollectionName && props.dataitem) {
4133
- childCollectionData = getNestedValue3(props.dataitem, dataBindingProperties.childCollectionName);
4216
+ childCollectionData = getNestedValue4(props.dataitem, dataBindingProperties.childCollectionName);
4134
4217
  }
4135
4218
  }
4136
4219
  const cssResult = generateCssString(
@@ -4566,7 +4649,9 @@ var DataList = (props) => {
4566
4649
  lastPropertyChanged: ""
4567
4650
  };
4568
4651
  const [formState, dispatch] = useReducer2(FormReducer_default, initialState);
4569
- 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
+ };
4570
4655
  const handleFilterChange = useCallback3(
4571
4656
  (updatedValues) => {
4572
4657
  dispatch({
@@ -4599,11 +4684,18 @@ var DataList = (props) => {
4599
4684
  [dispatch, props, router]
4600
4685
  );
4601
4686
  useEffect10(() => {
4687
+ if (!props.columns.some((col) => col.isSearchable)) {
4688
+ return;
4689
+ }
4690
+ if (searchTerm === (props.query?.searchTerm ?? "")) {
4691
+ return;
4692
+ }
4602
4693
  const timeout = setTimeout(() => {
4603
4694
  const builder2 = new OdataBuilder(props.path);
4604
4695
  builder2.setQuery({
4605
4696
  ...props.query,
4606
4697
  searchTerm,
4698
+ searchCols: getSearchableColumns(),
4607
4699
  $skip: "0"
4608
4700
  });
4609
4701
  router.push(builder2.getUrl());
@@ -4793,7 +4885,7 @@ var DataList = (props) => {
4793
4885
  children: [
4794
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", {}),
4795
4887
  /* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-3", children: [
4796
- /* @__PURE__ */ jsx65(
4888
+ props.columns.some((col) => col.isSearchable) && /* @__PURE__ */ jsx65(
4797
4889
  InputControl_default,
4798
4890
  {
4799
4891
  name: "Search_input",
@@ -4955,7 +5047,7 @@ var DataList = (props) => {
4955
5047
  children: [
4956
5048
  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", {}),
4957
5049
  /* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-3", children: [
4958
- /* @__PURE__ */ jsx65(
5050
+ props.columns.some((col) => col.isSearchable) && /* @__PURE__ */ jsx65(
4959
5051
  InputControl_default,
4960
5052
  {
4961
5053
  name: "Search_input",
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.20260616060453",
3
+ "version": "0.8.1-dev.20260616104505",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",