@ceed/cds 1.38.0 → 1.39.1

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.cjs CHANGED
@@ -3055,6 +3055,14 @@ var DatePicker = (0, import_react21.forwardRef)((inProps, ref) => {
3055
3055
  },
3056
3056
  [inputReadOnly, isAlphabeticDisplay, buttonRef]
3057
3057
  );
3058
+ const handleInputClick = (0, import_react21.useCallback)(
3059
+ (event) => {
3060
+ if (inputReadOnly && !readOnly) {
3061
+ handleCalendarToggle(event);
3062
+ }
3063
+ },
3064
+ [inputReadOnly, readOnly, handleCalendarToggle]
3065
+ );
3058
3066
  const handlePresetClick = (0, import_react21.useCallback)(
3059
3067
  (presetValue) => {
3060
3068
  handleChange({
@@ -3106,7 +3114,8 @@ var DatePicker = (0, import_react21.forwardRef)((inProps, ref) => {
3106
3114
  cursor: isAlphabeticDisplay || inputReadOnly || readOnly ? "default" : "text"
3107
3115
  }
3108
3116
  },
3109
- onMouseDown: handleInputMouseDown
3117
+ onMouseDown: handleInputMouseDown,
3118
+ onClick: handleInputClick
3110
3119
  }
3111
3120
  },
3112
3121
  className,
@@ -4079,8 +4088,10 @@ function useDataTableRenderer({
4079
4088
  () => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
4080
4089
  [pinnedColumns?.right, visibleFieldSet]
4081
4090
  );
4091
+ const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
4092
+ const inferredFields = (0, import_react26.useMemo)(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
4082
4093
  const columns = (0, import_react26.useMemo)(() => {
4083
- const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : Object.keys(rows[0] || {}).map((key) => ({
4094
+ const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
4084
4095
  field: key
4085
4096
  }));
4086
4097
  return baseColumns.map((column) => {
@@ -4104,7 +4115,7 @@ function useDataTableRenderer({
4104
4115
  }, [
4105
4116
  visibleColumns,
4106
4117
  reorderedColumns,
4107
- rows,
4118
+ inferredFields,
4108
4119
  effectivePinnedLeft,
4109
4120
  effectivePinnedRight,
4110
4121
  visibleColumnsByField,
@@ -5351,6 +5362,14 @@ var DateRangePicker = (0, import_react30.forwardRef)((inProps, ref) => {
5351
5362
  },
5352
5363
  [inputReadOnly, isAlphabeticDisplay, buttonRef]
5353
5364
  );
5365
+ const handleInputClick = (0, import_react30.useCallback)(
5366
+ (event) => {
5367
+ if (inputReadOnly && !readOnly) {
5368
+ handleCalendarToggle(event);
5369
+ }
5370
+ },
5371
+ [inputReadOnly, readOnly, handleCalendarToggle]
5372
+ );
5354
5373
  const handlePresetClick = (0, import_react30.useCallback)(
5355
5374
  (presetValue) => {
5356
5375
  if (props.value !== void 0) {
@@ -5404,7 +5423,8 @@ var DateRangePicker = (0, import_react30.forwardRef)((inProps, ref) => {
5404
5423
  cursor: isAlphabeticDisplay || inputReadOnly || readOnly ? "default" : "text"
5405
5424
  }
5406
5425
  },
5407
- onMouseDown: handleInputMouseDown
5426
+ onMouseDown: handleInputMouseDown,
5427
+ onClick: handleInputClick
5408
5428
  }
5409
5429
  },
5410
5430
  error,
package/dist/index.js CHANGED
@@ -2935,6 +2935,14 @@ var DatePicker = forwardRef6((inProps, ref) => {
2935
2935
  },
2936
2936
  [inputReadOnly, isAlphabeticDisplay, buttonRef]
2937
2937
  );
2938
+ const handleInputClick = useCallback9(
2939
+ (event) => {
2940
+ if (inputReadOnly && !readOnly) {
2941
+ handleCalendarToggle(event);
2942
+ }
2943
+ },
2944
+ [inputReadOnly, readOnly, handleCalendarToggle]
2945
+ );
2938
2946
  const handlePresetClick = useCallback9(
2939
2947
  (presetValue) => {
2940
2948
  handleChange({
@@ -2986,7 +2994,8 @@ var DatePicker = forwardRef6((inProps, ref) => {
2986
2994
  cursor: isAlphabeticDisplay || inputReadOnly || readOnly ? "default" : "text"
2987
2995
  }
2988
2996
  },
2989
- onMouseDown: handleInputMouseDown
2997
+ onMouseDown: handleInputMouseDown,
2998
+ onClick: handleInputClick
2990
2999
  }
2991
3000
  },
2992
3001
  className,
@@ -3964,8 +3973,10 @@ function useDataTableRenderer({
3964
3973
  () => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
3965
3974
  [pinnedColumns?.right, visibleFieldSet]
3966
3975
  );
3976
+ const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
3977
+ const inferredFields = useMemo10(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
3967
3978
  const columns = useMemo10(() => {
3968
- const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : Object.keys(rows[0] || {}).map((key) => ({
3979
+ const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
3969
3980
  field: key
3970
3981
  }));
3971
3982
  return baseColumns.map((column) => {
@@ -3989,7 +4000,7 @@ function useDataTableRenderer({
3989
4000
  }, [
3990
4001
  visibleColumns,
3991
4002
  reorderedColumns,
3992
- rows,
4003
+ inferredFields,
3993
4004
  effectivePinnedLeft,
3994
4005
  effectivePinnedRight,
3995
4006
  visibleColumnsByField,
@@ -5236,6 +5247,14 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
5236
5247
  },
5237
5248
  [inputReadOnly, isAlphabeticDisplay, buttonRef]
5238
5249
  );
5250
+ const handleInputClick = useCallback14(
5251
+ (event) => {
5252
+ if (inputReadOnly && !readOnly) {
5253
+ handleCalendarToggle(event);
5254
+ }
5255
+ },
5256
+ [inputReadOnly, readOnly, handleCalendarToggle]
5257
+ );
5239
5258
  const handlePresetClick = useCallback14(
5240
5259
  (presetValue) => {
5241
5260
  if (props.value !== void 0) {
@@ -5289,7 +5308,8 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
5289
5308
  cursor: isAlphabeticDisplay || inputReadOnly || readOnly ? "default" : "text"
5290
5309
  }
5291
5310
  },
5292
- onMouseDown: handleInputMouseDown
5311
+ onMouseDown: handleInputMouseDown,
5312
+ onClick: handleInputClick
5293
5313
  }
5294
5314
  },
5295
5315
  error,