@feathery/react 2.32.0 → 2.32.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.
Files changed (136) hide show
  1. package/cjs/Form/grid/Element/index.d.ts.map +1 -1
  2. package/cjs/Form/index.d.ts.map +1 -1
  3. package/cjs/elements/basic/TableElement/Actions.d.ts +1 -3
  4. package/cjs/elements/basic/TableElement/Actions.d.ts.map +1 -1
  5. package/cjs/elements/basic/TableElement/Search.d.ts.map +1 -1
  6. package/cjs/elements/basic/TableElement/index.d.ts +1 -1
  7. package/cjs/elements/basic/TableElement/index.d.ts.map +1 -1
  8. package/cjs/elements/basic/TableElement/styles.d.ts +4 -221
  9. package/cjs/elements/basic/TableElement/styles.d.ts.map +1 -1
  10. package/cjs/elements/basic/TableElement/useTableData.d.ts +1 -6
  11. package/cjs/elements/basic/TableElement/useTableData.d.ts.map +1 -1
  12. package/cjs/elements/components/icons/index.d.ts +1 -2
  13. package/cjs/elements/components/icons/index.d.ts.map +1 -1
  14. package/cjs/{fthry_FormControl.BtNu9i-u.js → fthry_FormControl.DurQlaqU.js} +1 -1
  15. package/cjs/{fthry_InlineTooltip.DuFB8p7w.js → fthry_InlineTooltip.BXWfZzL2.js} +2 -2
  16. package/cjs/{fthry_Overlay.DqGyzI8W.js → fthry_Overlay.CioCMhlq.js} +1 -1
  17. package/cjs/{fthry_PaymentMethodField.D0kI1ZxS.js → fthry_PaymentMethodField.DhSkUuU-.js} +4 -4
  18. package/cjs/{fthry_Placeholder.WRNgQX3l.js → fthry_Placeholder.CX7qc-Cl.js} +1 -1
  19. package/cjs/{fthry_ShowEyeIcon.1seA7I1l.js → fthry_ShowEyeIcon.80VHzelN.js} +1 -1
  20. package/cjs/{fthry_index.oVFShAC8.js → fthry_index.9yf8TiBa.js} +2 -2
  21. package/cjs/{fthry_index.BvkC5P1Q.js → fthry_index.B8tZZXUF.js} +6 -6
  22. package/cjs/{fthry_index.BhC7LkQw.js → fthry_index.BnYce3sm.js} +5 -5
  23. package/cjs/{fthry_index.BEVaTA54.js → fthry_index.Br877QRA.js} +3 -3
  24. package/cjs/{fthry_index.CBJimbrX.js → fthry_index.BrWW45H5.js} +5 -5
  25. package/cjs/{fthry_index.TK6Jx-jy.js → fthry_index.C05KVXV6.js} +1 -1
  26. package/cjs/{fthry_index.J4GcA3vx.js → fthry_index.C5QUdS7L.js} +1 -1
  27. package/cjs/{fthry_index.BM4ep-AK.js → fthry_index.CANZBm-k.js} +5 -5
  28. package/cjs/{fthry_index.C7hxyJ9f.js → fthry_index.CLPl9dPm.js} +1 -1
  29. package/cjs/{fthry_index.BccfyVDL.js → fthry_index.CY58pJ5G.js} +6 -6
  30. package/cjs/{fthry_index.WRjuuH9z.js → fthry_index.Cgn2gw_g.js} +1 -1
  31. package/cjs/{fthry_index.B96nzeqy.js → fthry_index.Cm-Al4PR.js} +4 -4
  32. package/cjs/{fthry_index.CGQA5QkX.js → fthry_index.CwZL5tZB.js} +3 -3
  33. package/cjs/{fthry_index.CUO7vSY3.js → fthry_index.D3P96Nnw.js} +4 -4
  34. package/cjs/{fthry_index.C6CH7RhD.js → fthry_index.DALbyltA.js} +8 -8
  35. package/cjs/{fthry_index.D4RrBVB-.js → fthry_index.DPXTa2dj.js} +1 -1
  36. package/cjs/{fthry_index.CiXHBkVl.js → fthry_index.DQL_RNQ5.js} +28 -29
  37. package/cjs/{fthry_index.KbHjZiIM.js → fthry_index.DXol9L5L.js} +6 -6
  38. package/cjs/{fthry_index.B_-iRvUH.js → fthry_index.Dofn1W06.js} +4 -4
  39. package/cjs/{fthry_index.BTKf9mxG.js → fthry_index.DpeEqUaO.js} +1 -1
  40. package/cjs/{fthry_index.Z6a5kUfj.js → fthry_index.NnMUv723.js} +47 -527
  41. package/cjs/{fthry_index.BI7CrYad.js → fthry_index.Oufk9PK1.js} +2 -2
  42. package/cjs/{fthry_index.DloMkPdT.js → fthry_index.RkgEXvkN.js} +5 -5
  43. package/cjs/{fthry_index.DbijQ61t.js → fthry_index.cjyiNFQz.js} +1 -1
  44. package/cjs/{fthry_input.CUTC1cQr.js → fthry_input.Ek-TePLo.js} +1 -1
  45. package/cjs/{fthry_script.DRtiXuhL.js → fthry_script.D4I5wEAM.js} +1 -1
  46. package/cjs/{fthry_styles.MGVgRzzA.js → fthry_styles.BAOkmtNa.js} +1 -1
  47. package/cjs/{fthry_useElementSize.DXcMVgAq.js → fthry_useElementSize.DxiZSHps.js} +1 -1
  48. package/cjs/{fthry_useSalesforceSync.C87PZunf.js → fthry_useSalesforceSync.0Po-_R2K.js} +1 -1
  49. package/cjs/{fthry_webfontloader.CVSP2Jc5.js → fthry_webfontloader.Dpbr76nZ.js} +1 -1
  50. package/cjs/index.js +1 -1
  51. package/dist/Form/grid/Element/index.d.ts.map +1 -1
  52. package/dist/Form/index.d.ts.map +1 -1
  53. package/dist/elements/basic/TableElement/Actions.d.ts +1 -3
  54. package/dist/elements/basic/TableElement/Actions.d.ts.map +1 -1
  55. package/dist/elements/basic/TableElement/Search.d.ts.map +1 -1
  56. package/dist/elements/basic/TableElement/index.d.ts +1 -1
  57. package/dist/elements/basic/TableElement/index.d.ts.map +1 -1
  58. package/dist/elements/basic/TableElement/styles.d.ts +4 -221
  59. package/dist/elements/basic/TableElement/styles.d.ts.map +1 -1
  60. package/dist/elements/basic/TableElement/useTableData.d.ts +1 -6
  61. package/dist/elements/basic/TableElement/useTableData.d.ts.map +1 -1
  62. package/dist/elements/components/icons/index.d.ts +1 -2
  63. package/dist/elements/components/icons/index.d.ts.map +1 -1
  64. package/dist/{fthry_FormControl.C9K2iuFX.js → fthry_FormControl.CxJVENhU.js} +1 -1
  65. package/dist/{fthry_InlineTooltip.CQ84q5tx.js → fthry_InlineTooltip.CqD5dxb4.js} +2 -2
  66. package/dist/{fthry_Overlay.CaTGHPrf.js → fthry_Overlay.C-S2P_RR.js} +1 -1
  67. package/dist/{fthry_PaymentMethodField.CLy4llPE.js → fthry_PaymentMethodField.QXLEi8jw.js} +4 -4
  68. package/dist/{fthry_Placeholder.C8DX1xTT.js → fthry_Placeholder.DdvJyqsu.js} +1 -1
  69. package/dist/{fthry_ShowEyeIcon.CLCEl1M3.js → fthry_ShowEyeIcon.CZus1erN.js} +1 -1
  70. package/dist/{fthry_index.ty8LJs-R.js → fthry_index.4JG7sxtp.js} +2 -2
  71. package/dist/{fthry_index.BZD_DEzj.js → fthry_index.9VAfgoMl.js} +1 -1
  72. package/dist/{fthry_index.WnliJHmX.js → fthry_index.B3B8bEEX.js} +2 -2
  73. package/dist/{fthry_index.C1_uGweo.js → fthry_index.BJVuZZ2J.js} +1 -1
  74. package/dist/{fthry_index.DqKZq0Ur.js → fthry_index.BL5rEBAF.js} +4 -4
  75. package/dist/{fthry_index.hyYvw_PS.js → fthry_index.BT7cSNXV.js} +1 -1
  76. package/dist/{fthry_index.CeglQZhs.js → fthry_index.BV8FC0Yc.js} +1 -1
  77. package/dist/{fthry_index.BjpHx4_T.js → fthry_index.B_7ywejL.js} +5 -5
  78. package/dist/{fthry_index.Ddf14JA6.js → fthry_index.Bk7-v1ou.js} +29 -30
  79. package/dist/{fthry_index.DKYX71gD.js → fthry_index.BmrKBP2b.js} +4 -4
  80. package/dist/{fthry_index.CqNn14xm.js → fthry_index.Bn5hHeFA.js} +6 -6
  81. package/dist/{fthry_index.B260ADJ4.js → fthry_index.BpZ7gZfF.js} +5 -5
  82. package/dist/{fthry_index.C5zUlrOm.js → fthry_index.BsCv8dPB.js} +1 -1
  83. package/dist/{fthry_index.B-oOxFi4.js → fthry_index.C5ZHl-kt.js} +48 -528
  84. package/dist/{fthry_index.9-q7smC3.js → fthry_index.C6CFRFmj.js} +3 -3
  85. package/dist/{fthry_index.DmcD0QUi.js → fthry_index.CNIO-M5G.js} +1 -1
  86. package/dist/{fthry_index.CYyOgKWx.js → fthry_index.Cr2SZgDK.js} +8 -8
  87. package/dist/{fthry_index.CmpLevaj.js → fthry_index.CsSJubdr.js} +6 -6
  88. package/dist/{fthry_index.DQsvec3-.js → fthry_index.Cv8JZvnf.js} +3 -3
  89. package/dist/{fthry_index.8KDT5i8T.js → fthry_index.DUhZfNzg.js} +4 -4
  90. package/dist/{fthry_index.kP74GhA8.js → fthry_index.DVRFkK73.js} +5 -5
  91. package/dist/{fthry_index.CLgjzDTi.js → fthry_index.DmqZnhoE.js} +1 -1
  92. package/dist/{fthry_index.DoGwIkbA.js → fthry_index.p64tvQaa.js} +6 -6
  93. package/dist/{fthry_index.qJQlILVx.js → fthry_index.wqVaa2JI.js} +5 -5
  94. package/dist/{fthry_input.DjzutNam.js → fthry_input.aOsdUSPt.js} +1 -1
  95. package/dist/{fthry_script.DO2CsvZO.js → fthry_script.HcN-guNp.js} +1 -1
  96. package/dist/{fthry_styles.Ccd48IiB.js → fthry_styles.BLq5f5E_.js} +1 -1
  97. package/dist/{fthry_useElementSize.C-0G4BJy.js → fthry_useElementSize.ZyD83Wr1.js} +1 -1
  98. package/dist/{fthry_useSalesforceSync.B6wBqJLI.js → fthry_useSalesforceSync.Ddbp4SYp.js} +1 -1
  99. package/dist/{fthry_webfontloader.MZhbLTEd.js → fthry_webfontloader.C3IotuWt.js} +1 -1
  100. package/dist/index.js +1 -1
  101. package/package.json +1 -1
  102. package/umd/{277.87e6ca5c1cf2a7477992.js → 277.d9907ecd5dc2117c9171.js} +1 -1
  103. package/umd/{509.bca2ff43c66b1dba064f.js → 509.a863f8749c28540476bb.js} +2 -2
  104. package/umd/{AddressField.2d777eda22a67a0ed3a3.js → AddressField.ec97334fe233830bc05b.js} +1 -1
  105. package/umd/{DateSelectorField.54afc978d2fd9d10b106.js → DateSelectorField.00f321e0b1972feb9d69.js} +1 -1
  106. package/umd/{FileUploadField.7a5028fb6035d09b3e81.js → FileUploadField.ea0067dd62b0454b7c2e.js} +1 -1
  107. package/umd/{PasswordField.7585ef588333cb4181f7.js → PasswordField.1358356d6fbc6880f12a.js} +1 -1
  108. package/umd/{PaymentMethodField.d08bcfa1efb56084572d.js → PaymentMethodField.9a8e934f7450eb141217.js} +1 -1
  109. package/umd/{PhoneField.19c987f04cfcb60ab07c.js → PhoneField.c526085aaa5ccd25e982.js} +1 -1
  110. package/umd/{SignatureField.0e7d60fa2fafcb6be554.js → SignatureField.d710930ca89642eb651c.js} +1 -1
  111. package/umd/TableElement.ee77e0f53a9ccac846ab.js +1 -0
  112. package/umd/{TextArea.7cca0d69e618846660c5.js → TextArea.f566845d458d4c00e0e7.js} +1 -1
  113. package/umd/{TextField.f5cc4a03e69d5872027b.js → TextField.5a5296fe3ea60c4459f2.js} +1 -1
  114. package/umd/index.js +1 -1
  115. package/cjs/elements/basic/TableElement/DeleteConfirm.d.ts +0 -11
  116. package/cjs/elements/basic/TableElement/DeleteConfirm.d.ts.map +0 -1
  117. package/cjs/elements/basic/TableElement/EditableCell.d.ts +0 -10
  118. package/cjs/elements/basic/TableElement/EditableCell.d.ts.map +0 -1
  119. package/cjs/elements/basic/TableElement/useColumnWidths.d.ts +0 -7
  120. package/cjs/elements/basic/TableElement/useColumnWidths.d.ts.map +0 -1
  121. package/cjs/elements/basic/TableElement/useTableMutations.d.ts +0 -23
  122. package/cjs/elements/basic/TableElement/useTableMutations.d.ts.map +0 -1
  123. package/cjs/elements/components/icons/TrashIcon.d.ts +0 -3
  124. package/cjs/elements/components/icons/TrashIcon.d.ts.map +0 -1
  125. package/dist/elements/basic/TableElement/DeleteConfirm.d.ts +0 -11
  126. package/dist/elements/basic/TableElement/DeleteConfirm.d.ts.map +0 -1
  127. package/dist/elements/basic/TableElement/EditableCell.d.ts +0 -10
  128. package/dist/elements/basic/TableElement/EditableCell.d.ts.map +0 -1
  129. package/dist/elements/basic/TableElement/useColumnWidths.d.ts +0 -7
  130. package/dist/elements/basic/TableElement/useColumnWidths.d.ts.map +0 -1
  131. package/dist/elements/basic/TableElement/useTableMutations.d.ts +0 -23
  132. package/dist/elements/basic/TableElement/useTableMutations.d.ts.map +0 -1
  133. package/dist/elements/components/icons/TrashIcon.d.ts +0 -3
  134. package/dist/elements/components/icons/TrashIcon.d.ts.map +0 -1
  135. package/umd/TableElement.b9bb3cedf1a75fd2ea01.js +0 -1
  136. /package/umd/{509.bca2ff43c66b1dba064f.js.LICENSE.txt → 509.a863f8749c28540476bb.js.LICENSE.txt} +0 -0
@@ -1,17 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./fthry_index.CiXHBkVl.js');
3
+ var index = require('./fthry_index.DQL_RNQ5.js');
4
4
  var React = require('react');
5
5
  var ReactDOM = require('react-dom');
6
6
  require('react/jsx-runtime');
7
7
  require('react-dom/client');
8
8
  require('jszip');
9
9
 
10
- function TrashIcon(_a) {
11
- var _b = _a.width, width = _b === void 0 ? 16 : _b, _c = _a.height, height = _c === void 0 ? 16 : _c, props = index.__rest(_a, ["width", "height"]);
12
- return (index.jsx("svg", index.__assign({ width: width, height: height, fill: 'none', viewBox: '0 0 24 24', stroke: 'currentColor', strokeWidth: 2, xmlns: 'http://www.w3.org/2000/svg' }, props, { children: index.jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16' }) })));
13
- }
14
-
15
10
  var colors = {
16
11
  white: '#ffffff',
17
12
  gray50: '#f9fafb',
@@ -23,9 +18,7 @@ var colors = {
23
18
  gray700: '#374151',
24
19
  gray900: '#111827',
25
20
  blue50: '#eff6ff',
26
- blue700: '#1d4ed8',
27
- red500: '#ef4444',
28
- red600: '#dc2626'
21
+ blue700: '#1d4ed8'
29
22
  };
30
23
  var searchIconStyle = {
31
24
  width: '16px',
@@ -84,9 +77,12 @@ var emptyStateTextStyle = {
84
77
  fontWeight: '500',
85
78
  margin: 0
86
79
  };
80
+ var searchContainerStyle = {
81
+ padding: '16px',
82
+ borderBottom: "1px solid ".concat(colors.gray200)
83
+ };
87
84
  var searchWrapperStyle = {
88
- position: 'relative',
89
- flex: 1
85
+ position: 'relative'
90
86
  };
91
87
  var searchIconWrapperStyle = {
92
88
  position: 'absolute',
@@ -133,8 +129,7 @@ var theadStyle = {
133
129
  var thStyle = {
134
130
  padding: '12px 24px',
135
131
  fontWeight: '500',
136
- userSelect: 'none',
137
- whiteSpace: 'nowrap'
132
+ userSelect: 'none'
138
133
  };
139
134
  var rowStyle = {
140
135
  backgroundColor: colors.white,
@@ -242,14 +237,6 @@ var actionMenuItemStyle = {
242
237
  borderBottomRightRadius: '4px'
243
238
  }
244
239
  };
245
- var actionMenuSeparatorStyle = {
246
- borderTop: "1px solid ".concat(colors.gray200),
247
- margin: '4px 0'
248
- };
249
- var actionMenuDeleteItemStyle = index.__assign(index.__assign({}, actionMenuItemStyle), { color: colors.red500, '&:hover': {
250
- backgroundColor: colors.gray100,
251
- color: colors.red600
252
- } });
253
240
  var actionIconButtonStyle = index.__assign(index.__assign({}, actionButtonStyle), { aspectRatio: 1, paddingLeft: 0, paddingRight: 0 });
254
241
  var actionContainerStyle = {
255
242
  display: 'flex',
@@ -274,111 +261,6 @@ var overflowSelectStyle = index.__assign(index.__assign({}, pageButtonStyle), {
274
261
  color: colors.gray900
275
262
  }, '&:focus': {
276
263
  outline: 'none'
277
- } });
278
- // Editing styles
279
- var toolbarStyle = {
280
- display: 'flex',
281
- alignItems: 'center',
282
- justifyContent: 'space-between',
283
- padding: '16px',
284
- borderBottom: "1px solid ".concat(colors.gray200),
285
- gap: '12px'
286
- };
287
- var addRowButtonStyle = index.__assign(index.__assign({}, buttonStyle), { borderRadius: '8px', paddingLeft: '12px', paddingRight: '12px', whiteSpace: 'nowrap' });
288
- var clickToEditStyle = {
289
- color: colors.gray400,
290
- cursor: 'pointer',
291
- userSelect: 'none',
292
- fontSize: '14px'
293
- };
294
- var cellInputStyle = {
295
- width: '100%',
296
- padding: '4px 8px',
297
- border: "1px solid ".concat(colors.blue700),
298
- borderRadius: '4px',
299
- fontSize: '14px',
300
- color: colors.gray900,
301
- outline: 'none',
302
- boxSizing: 'border-box'
303
- };
304
- var editableCellContentStyle = {
305
- display: 'flex',
306
- alignItems: 'center',
307
- gap: '8px'
308
- };
309
- var overflowIconStyle = {
310
- display: 'flex',
311
- alignItems: 'center',
312
- justifyContent: 'center',
313
- width: '24px',
314
- height: '24px',
315
- borderRadius: '4px',
316
- border: 'none',
317
- backgroundColor: 'transparent',
318
- color: colors.gray400,
319
- cursor: 'pointer',
320
- opacity: 0,
321
- transition: 'opacity 0.15s',
322
- flexShrink: 0,
323
- padding: 0,
324
- 'tr:hover &, &[aria-expanded="true"]': {
325
- opacity: 1
326
- },
327
- '&:hover': {
328
- backgroundColor: colors.gray100,
329
- color: colors.gray600
330
- }
331
- };
332
- var deleteColumnStyle = {
333
- width: '40px',
334
- padding: '0 8px'
335
- };
336
- var deleteIconStyle = {
337
- display: 'flex',
338
- alignItems: 'center',
339
- justifyContent: 'center',
340
- width: '28px',
341
- height: '28px',
342
- borderRadius: '4px',
343
- border: 'none',
344
- backgroundColor: 'transparent',
345
- color: colors.gray400,
346
- cursor: 'pointer',
347
- opacity: 0,
348
- transition: 'opacity 0.15s',
349
- padding: 0,
350
- 'tr:hover &': {
351
- opacity: 1
352
- },
353
- '&:hover': {
354
- backgroundColor: colors.gray100,
355
- color: colors.red500
356
- }
357
- };
358
- var confirmPopoverStyle = {
359
- position: 'fixed',
360
- backgroundColor: colors.white,
361
- border: "1px solid ".concat(colors.gray300),
362
- borderRadius: '8px',
363
- boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',
364
- zIndex: 9999,
365
- padding: '12px 16px'
366
- };
367
- var confirmTextStyle = {
368
- margin: '0 0 12px 0',
369
- fontSize: '14px',
370
- fontWeight: '500',
371
- color: colors.gray900
372
- };
373
- var confirmButtonRowStyle = {
374
- display: 'flex',
375
- gap: '8px',
376
- justifyContent: 'flex-end'
377
- };
378
- var confirmCancelButtonStyle = index.__assign(index.__assign({}, buttonStyle), { borderRadius: '6px', paddingLeft: '12px', paddingRight: '12px', height: '32px' });
379
- var confirmDeleteButtonStyle = index.__assign(index.__assign({}, buttonStyle), { borderRadius: '6px', paddingLeft: '12px', paddingRight: '12px', height: '32px', backgroundColor: colors.red500, color: colors.white, border: "1px solid ".concat(colors.red500), '&:hover': {
380
- backgroundColor: colors.red600,
381
- color: colors.white
382
264
  } });
383
265
 
384
266
  function SearchIcon() {
@@ -391,7 +273,7 @@ function Search(_a) {
391
273
  e.preventDefault();
392
274
  }
393
275
  };
394
- return (index.jsxs("div", index.__assign({ css: searchWrapperStyle }, { children: [index.jsx("div", index.__assign({ css: searchIconWrapperStyle }, { children: index.jsx(SearchIcon, {}) })), index.jsx("input", { type: 'text', css: searchInputStyle, placeholder: 'Search', value: searchQuery, onChange: function (e) { return onSearchChange(e.target.value); }, onKeyDown: handleKeyDown })] })));
276
+ return (index.jsx("div", index.__assign({ css: searchContainerStyle }, { children: index.jsxs("div", index.__assign({ css: searchWrapperStyle }, { children: [index.jsx("div", index.__assign({ css: searchIconWrapperStyle }, { children: index.jsx(SearchIcon, {}) })), index.jsx("input", { type: 'text', css: searchInputStyle, placeholder: 'Search', value: searchQuery, onChange: function (e) { return onSearchChange(e.target.value); }, onKeyDown: handleKeyDown })] })) })));
395
277
  }
396
278
 
397
279
  function SortIcon(_a) {
@@ -476,11 +358,11 @@ function MenuIcon() {
476
358
  }
477
359
  function ActionButtons(_a) {
478
360
  var _b, _c, _d;
479
- var actions = _a.actions, rowIndex = _a.rowIndex, columnData = _a.columnData, fieldValuesProp = _a.fieldValues, onClick = _a.onClick, _e = _a.forceInlineButtons, forceInlineButtons = _e === void 0 ? false : _e, _f = _a.tableId, tableId = _f === void 0 ? '' : _f, _g = _a.buttonLoaders, buttonLoaders = _g === void 0 ? {} : _g, _h = _a.canDeleteRows, canDeleteRows = _h === void 0 ? false : _h, onDeleteRow = _a.onDeleteRow;
361
+ var actions = _a.actions, rowIndex = _a.rowIndex, columnData = _a.columnData, fieldValuesProp = _a.fieldValues, onClick = _a.onClick, _e = _a.forceInlineButtons, forceInlineButtons = _e === void 0 ? false : _e, _f = _a.tableId, tableId = _f === void 0 ? '' : _f, _g = _a.buttonLoaders, buttonLoaders = _g === void 0 ? {} : _g;
480
362
  if (actions.length === 0)
481
363
  return null;
482
- var _j = index.__read(React.useState(false), 2), isMenuOpen = _j[0], setIsMenuOpen = _j[1];
483
- var _k = index.__read(React.useState({ top: 0, left: 0 }), 2), menuPosition = _k[0], setMenuPosition = _k[1];
364
+ var _h = index.__read(React.useState(false), 2), isMenuOpen = _h[0], setIsMenuOpen = _h[1];
365
+ var _j = index.__read(React.useState({ top: 0, left: 0 }), 2), menuPosition = _j[0], setMenuPosition = _j[1];
484
366
  var containerRef = React.useRef(null);
485
367
  var menuRef = React.useRef(null);
486
368
  var menuButtonRef = React.useRef(null);
@@ -547,17 +429,13 @@ function ActionButtons(_a) {
547
429
  alignItems: 'center',
548
430
  justifyContent: 'center'
549
431
  } }, { children: overflowLoader }))) : (index.jsx(MenuIcon, {})) })), isMenuOpen &&
550
- ReactDOM.createPortal(index.jsxs("div", index.__assign({ ref: menuRef, css: index.__assign(index.__assign({}, actionMenuStyle), { top: "".concat(menuPosition.top, "px"), left: "".concat(menuPosition.left, "px"), transform: 'translateX(-100%)' }) }, { children: [actions.map(function (action, index$1) {
551
- var disabled = Object.keys(buttonLoaders).length > 0;
552
- return (index.jsx("button", index.__assign({ type: 'button', onClick: function (e) {
553
- e.stopPropagation();
554
- handleActionClick(action);
555
- }, css: actionMenuItemStyle, disabled: disabled }, { children: action.label }), index$1));
556
- }), canDeleteRows && onDeleteRow && (index.jsxs(index.Fragment, { children: [index.jsx("div", { css: actionMenuSeparatorStyle }), index.jsx("button", index.__assign({ type: 'button', onClick: function (e) {
557
- e.stopPropagation();
558
- setIsMenuOpen(false);
559
- onDeleteRow(rowIndex);
560
- }, css: actionMenuDeleteItemStyle }, { children: "Delete" }))] }))] })), index.featheryDoc().body)] })) : (actions.map(function (action, index$1) {
432
+ ReactDOM.createPortal(index.jsx("div", index.__assign({ ref: menuRef, css: index.__assign(index.__assign({}, actionMenuStyle), { top: "".concat(menuPosition.top, "px"), left: "".concat(menuPosition.left, "px"), transform: 'translateX(-100%)' }) }, { children: actions.map(function (action, index$1) {
433
+ var disabled = Object.keys(buttonLoaders).length > 0;
434
+ return (index.jsx("button", index.__assign({ type: 'button', onClick: function (e) {
435
+ e.stopPropagation();
436
+ handleActionClick(action);
437
+ }, css: actionMenuItemStyle, disabled: disabled }, { children: action.label }), index$1));
438
+ }) })), index.featheryDoc().body)] })) : (actions.map(function (action, index$1) {
561
439
  var _a;
562
440
  var buttonKey = "".concat(tableId, "_").concat(rowIndex, "_").concat(action.label);
563
441
  var loader = (_a = buttonLoaders[buttonKey]) === null || _a === void 0 ? void 0 : _a.loader;
@@ -586,153 +464,6 @@ function EmptyState(_a) {
586
464
  }, fill: 'none', viewBox: '0 0 24 24', stroke: 'currentColor', strokeWidth: 1.5 }, { children: index.jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z' }) }))), index.jsx("p", index.__assign({ css: emptyStateTextStyle }, { children: hasSearchQuery ? 'No results found' : 'No data available' })), hasSearchQuery && (index.jsx("p", index.__assign({ css: index.__assign(index.__assign({}, emptyStateTextStyle), { fontSize: '14px', marginTop: '8px' }) }, { children: "Try adjusting your search query" })))] })));
587
465
  }
588
466
 
589
- function DeleteConfirm(_a) {
590
- var anchorEl = _a.anchorEl, onConfirm = _a.onConfirm, onCancel = _a.onCancel, _b = _a.message, message = _b === void 0 ? 'Delete this row?' : _b, _c = _a.confirmLabel, confirmLabel = _c === void 0 ? 'Delete' : _c;
591
- var popoverRef = React.useRef(null);
592
- if (!anchorEl)
593
- return null;
594
- var anchorRect = anchorEl.getBoundingClientRect();
595
- var top = anchorRect.bottom + 4;
596
- var left = anchorRect.right;
597
- React.useEffect(function () {
598
- var handleClickOutside = function (event) {
599
- if (popoverRef.current &&
600
- !popoverRef.current.contains(event.target) &&
601
- anchorEl &&
602
- !anchorEl.contains(event.target)) {
603
- onCancel();
604
- }
605
- };
606
- var handleScroll = function () { return onCancel(); };
607
- var handleKeyDown = function (event) {
608
- if (event.key === 'Escape')
609
- onCancel();
610
- };
611
- var doc = index.featheryDoc();
612
- doc.addEventListener('mousedown', handleClickOutside);
613
- doc.addEventListener('scroll', handleScroll, true);
614
- doc.addEventListener('keydown', handleKeyDown);
615
- return function () {
616
- doc.removeEventListener('mousedown', handleClickOutside);
617
- doc.removeEventListener('scroll', handleScroll, true);
618
- doc.removeEventListener('keydown', handleKeyDown);
619
- };
620
- }, [onCancel, anchorEl]);
621
- return ReactDOM.createPortal(index.jsxs("div", index.__assign({ ref: popoverRef, role: 'alertdialog', "aria-label": message, css: index.__assign(index.__assign({}, confirmPopoverStyle), { top: "".concat(top, "px"), left: "".concat(left, "px"), transform: 'translateX(-100%)' }) }, { children: [index.jsx("p", index.__assign({ css: confirmTextStyle }, { children: message })), index.jsxs("div", index.__assign({ css: confirmButtonRowStyle }, { children: [index.jsx("button", index.__assign({ type: 'button', css: confirmCancelButtonStyle, onClick: function (e) {
622
- e.stopPropagation();
623
- onCancel();
624
- } }, { children: "Cancel" })), index.jsx("button", index.__assign({ type: 'button', css: confirmDeleteButtonStyle, onClick: function (e) {
625
- e.stopPropagation();
626
- onConfirm();
627
- } }, { children: confirmLabel }))] }))] })), index.featheryDoc().body);
628
- }
629
-
630
- function OverflowIcon() {
631
- return (index.jsxs("svg", index.__assign({ width: '16', height: '16', fill: 'currentColor', viewBox: '0 0 24 24' }, { children: [index.jsx("circle", { cx: '12', cy: '5', r: '2' }), index.jsx("circle", { cx: '12', cy: '12', r: '2' }), index.jsx("circle", { cx: '12', cy: '19', r: '2' })] })));
632
- }
633
- function EditableCell(_a) {
634
- var _b;
635
- var value = _a.value, fieldKey = _a.fieldKey, rowIndex = _a.rowIndex, onEdit = _a.onEdit, onClear = _a.onClear;
636
- var _c = index.__read(React.useState(false), 2), isEditing = _c[0], setIsEditing = _c[1];
637
- var _d = index.__read(React.useState(''), 2), editValue = _d[0], setEditValue = _d[1];
638
- var _e = index.__read(React.useState(false), 2), isMenuOpen = _e[0], setIsMenuOpen = _e[1];
639
- var _f = index.__read(React.useState(false), 2), showClearConfirm = _f[0], setShowClearConfirm = _f[1];
640
- var _g = index.__read(React.useState({ top: 0, left: 0 }), 2), menuPosition = _g[0], setMenuPosition = _g[1];
641
- var inputRef = React.useRef(null);
642
- var menuButtonRef = React.useRef(null);
643
- var menuRef = React.useRef(null);
644
- var shouldSaveRef = React.useRef(true);
645
- var closeClearConfirm = React.useCallback(function () { return setShowClearConfirm(false); }, []);
646
- var displayValue = (_b = index.stringifyWithNull(value)) !== null && _b !== void 0 ? _b : '';
647
- var isEmpty = displayValue === '';
648
- React.useEffect(function () {
649
- if (isEditing && inputRef.current) {
650
- inputRef.current.focus();
651
- }
652
- }, [isEditing]);
653
- React.useEffect(function () {
654
- if (!isMenuOpen)
655
- return;
656
- var handleClickOutside = function (event) {
657
- if (menuRef.current &&
658
- !menuRef.current.contains(event.target) &&
659
- menuButtonRef.current &&
660
- !menuButtonRef.current.contains(event.target)) {
661
- setIsMenuOpen(false);
662
- }
663
- };
664
- var handleScroll = function () { return setIsMenuOpen(false); };
665
- var doc = index.featheryDoc();
666
- doc.addEventListener('mousedown', handleClickOutside);
667
- doc.addEventListener('scroll', handleScroll, true);
668
- return function () {
669
- doc.removeEventListener('mousedown', handleClickOutside);
670
- doc.removeEventListener('scroll', handleScroll, true);
671
- };
672
- }, [isMenuOpen]);
673
- var startEditing = function () {
674
- setEditValue(displayValue);
675
- setIsEditing(true);
676
- setIsMenuOpen(false);
677
- };
678
- var saveEdit = function () {
679
- if (editValue !== displayValue) {
680
- onEdit(fieldKey, rowIndex, editValue);
681
- }
682
- setIsEditing(false);
683
- };
684
- var cancelEdit = function () {
685
- shouldSaveRef.current = false;
686
- setIsEditing(false);
687
- };
688
- var handleBlur = function () {
689
- if (shouldSaveRef.current)
690
- saveEdit();
691
- shouldSaveRef.current = true;
692
- };
693
- var handleKeyDown = function (e) {
694
- if (e.key === 'Enter') {
695
- e.preventDefault();
696
- shouldSaveRef.current = false;
697
- saveEdit();
698
- }
699
- else if (e.key === 'Escape') {
700
- e.preventDefault();
701
- cancelEdit();
702
- }
703
- else if (e.key === 'Tab') {
704
- shouldSaveRef.current = false;
705
- saveEdit();
706
- }
707
- };
708
- var handleMenuToggle = function (e) {
709
- e.stopPropagation();
710
- if (!isMenuOpen && menuButtonRef.current) {
711
- var rect = menuButtonRef.current.getBoundingClientRect();
712
- setMenuPosition({ top: rect.bottom + 4, left: rect.right });
713
- }
714
- setIsMenuOpen(!isMenuOpen);
715
- };
716
- if (isEditing) {
717
- return (index.jsx("input", { ref: inputRef, type: 'text', value: editValue, onChange: function (e) { return setEditValue(e.target.value); }, onBlur: handleBlur, onKeyDown: handleKeyDown, css: cellInputStyle, onClick: function (e) { return e.stopPropagation(); } }));
718
- }
719
- if (isEmpty) {
720
- return (index.jsx("span", index.__assign({ css: clickToEditStyle, onClick: startEditing }, { children: "Click to edit" })));
721
- }
722
- return (index.jsxs("div", index.__assign({ css: editableCellContentStyle }, { children: [index.jsx("span", index.__assign({ css: { flex: 1, minWidth: 0 } }, { children: displayValue })), index.jsx("button", index.__assign({ ref: menuButtonRef, type: 'button', "aria-expanded": isMenuOpen, "aria-haspopup": 'menu', css: overflowIconStyle, onClick: handleMenuToggle }, { children: index.jsx(OverflowIcon, {}) })), isMenuOpen &&
723
- ReactDOM.createPortal(index.jsxs("div", index.__assign({ ref: menuRef, role: 'menu', css: index.__assign(index.__assign({}, actionMenuStyle), { top: "".concat(menuPosition.top, "px"), left: "".concat(menuPosition.left, "px"), transform: 'translateX(-100%)' }) }, { children: [index.jsx("button", index.__assign({ type: 'button', role: 'menuitem', css: actionMenuItemStyle, onClick: function (e) {
724
- e.stopPropagation();
725
- startEditing();
726
- } }, { children: "Edit Value" })), index.jsx("button", index.__assign({ type: 'button', role: 'menuitem', css: actionMenuItemStyle, onClick: function (e) {
727
- e.stopPropagation();
728
- setIsMenuOpen(false);
729
- setShowClearConfirm(true);
730
- } }, { children: "Clear Field" }))] })), index.featheryDoc().body), showClearConfirm && (index.jsx(DeleteConfirm, { anchorEl: menuButtonRef.current, message: 'Clear this field?', confirmLabel: 'Clear', onConfirm: function () {
731
- closeClearConfirm();
732
- onClear(fieldKey, rowIndex);
733
- }, onCancel: closeClearConfirm }))] })));
734
- }
735
-
736
467
  // Utility functions for sorting strings as numbers and dates
737
468
  function tryParseNumber(value) {
738
469
  if (value === null || value === undefined || value === '')
@@ -923,16 +654,14 @@ function setCachedPage(elementId, page) {
923
654
  sessionStorage.setItem(key, page.toString());
924
655
  }
925
656
  function useTableData(_a) {
926
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
927
- var element = _a.element, _r = _a.editMode, editMode = _r === void 0 ? false : _r, _s = _a.dataVersion, dataVersion = _s === void 0 ? 0 : _s;
657
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
658
+ var element = _a.element, _m = _a.editMode, editMode = _m === void 0 ? false : _m;
928
659
  var userColumns = ((_b = element.properties) === null || _b === void 0 ? void 0 : _b.columns) || [];
929
660
  var actions = (((_c = element.properties) === null || _c === void 0 ? void 0 : _c.actions) || []).filter(function (action) { return action.label && action.label.trim() !== ''; });
930
661
  var enableSearch = (_e = (_d = element.properties) === null || _d === void 0 ? void 0 : _d.search) !== null && _e !== void 0 ? _e : false;
931
662
  var enableSort = (_g = (_f = element.properties) === null || _f === void 0 ? void 0 : _f.sort) !== null && _g !== void 0 ? _g : false;
932
663
  var enableTranspose = (_j = (_h = element.properties) === null || _h === void 0 ? void 0 : _h.transpose) !== null && _j !== void 0 ? _j : false;
933
- var enableEditing = (_l = (_k = element.properties) === null || _k === void 0 ? void 0 : _k.enable_editing) !== null && _l !== void 0 ? _l : false;
934
- var enableAddDeleteRows = (_o = (_m = element.properties) === null || _m === void 0 ? void 0 : _m.add_delete_rows) !== null && _o !== void 0 ? _o : false;
935
- var paginationSetting = (_q = (_p = element.properties) === null || _p === void 0 ? void 0 : _p.pagination) !== null && _q !== void 0 ? _q : 0;
664
+ var paginationSetting = (_l = (_k = element.properties) === null || _k === void 0 ? void 0 : _k.pagination) !== null && _l !== void 0 ? _l : 0;
936
665
  var rowsPerPage = typeof paginationSetting === 'number' && paginationSetting > 0
937
666
  ? Math.floor(paginationSetting)
938
667
  : 0;
@@ -945,20 +674,19 @@ function useTableData(_a) {
945
674
  }
946
675
  return cols;
947
676
  }, [editMode, userColumns]);
948
- // fieldValues is mutated outside React state, so we need dataVersion
949
- // as a manual dirty flag to trigger re-snapshots
677
+ // Use example data in edit mode
950
678
  var baseFieldValues = React.useMemo(function () {
951
679
  if (editMode) {
952
680
  return generateExampleData(baseColumns);
953
681
  }
954
- return index.__assign({}, index.fieldValues);
955
- }, [editMode, baseColumns, dataVersion]);
956
- var _t = index.__read(React.useState(''), 2), searchQuery = _t[0], setSearchQuery = _t[1];
957
- var _u = index.__read(React.useState(null), 2), sortColumn = _u[0], setSortColumn = _u[1];
958
- var _v = index.__read(React.useState('asc'), 2), sortDirection = _v[0], setSortDirection = _v[1];
959
- var _w = index.__read(React.useState(function () {
682
+ return index.fieldValues;
683
+ }, [editMode, baseColumns, userColumns.length]);
684
+ var _o = index.__read(React.useState(''), 2), searchQuery = _o[0], setSearchQuery = _o[1];
685
+ var _p = index.__read(React.useState(null), 2), sortColumn = _p[0], setSortColumn = _p[1];
686
+ var _q = index.__read(React.useState('asc'), 2), sortDirection = _q[0], setSortDirection = _q[1];
687
+ var _r = index.__read(React.useState(function () {
960
688
  return getCachedPage(element.id);
961
- }), 2), currentPage = _w[0], setCurrentPage = _w[1];
689
+ }), 2), currentPage = _r[0], setCurrentPage = _r[1];
962
690
  var baseNumRows = React.useMemo(function () {
963
691
  return baseColumns.reduce(function (maxRows, column) {
964
692
  var fieldValue = baseFieldValues[column.field_key];
@@ -994,7 +722,7 @@ function useTableData(_a) {
994
722
  enableSearch,
995
723
  baseFieldValues
996
724
  ]);
997
- var _x = index.__read(React.useState(null), 2), sortedColumnIndex = _x[0], setSortedColumnIndex = _x[1];
725
+ var _s = index.__read(React.useState(null), 2), sortedColumnIndex = _s[0], setSortedColumnIndex = _s[1];
998
726
  var sortedBaseRowIndices = React.useMemo(function () {
999
727
  if (!enableTranspose || !enableSort || sortedColumnIndex === null) {
1000
728
  return filteredBaseRowIndices;
@@ -1034,7 +762,7 @@ function useTableData(_a) {
1034
762
  rowsPerPage,
1035
763
  enablePagination
1036
764
  ]);
1037
- var _y = React.useMemo(function () {
765
+ var _t = React.useMemo(function () {
1038
766
  if (!enableTranspose || baseNumRows === 0) {
1039
767
  return {
1040
768
  columns: baseColumns,
@@ -1054,7 +782,7 @@ function useTableData(_a) {
1054
782
  baseFieldValues,
1055
783
  baseNumRows,
1056
784
  paginatedBaseRowIndices
1057
- ]), columns = _y.columns, activeFieldValues = _y.activeFieldValues, transposedRowIndices = _y.transposedRowIndices;
785
+ ]), columns = _t.columns, activeFieldValues = _t.activeFieldValues, transposedRowIndices = _t.transposedRowIndices;
1058
786
  var numRows = React.useMemo(function () {
1059
787
  return columns.reduce(function (maxRows, column) {
1060
788
  var fieldValue = activeFieldValues[column.field_key];
@@ -1235,8 +963,6 @@ function useTableData(_a) {
1235
963
  actions: actions,
1236
964
  isTransposed: isTransposed,
1237
965
  transposedRowIndices: transposedRowIndices,
1238
- enableEditing: enableEditing,
1239
- enableAddDeleteRows: enableAddDeleteRows,
1240
966
  totalRows: totalRows,
1241
967
  totalPages: totalPages,
1242
968
  hasData: hasData,
@@ -1246,209 +972,24 @@ function useTableData(_a) {
1246
972
  };
1247
973
  }
1248
974
 
1249
- function useTableMutations(_a) {
1250
- var columns = _a.columns, updateFieldValues = _a.updateFieldValues, submitCustom = _a.submitCustom, editMode = _a.editMode, editModeFieldValues = _a.editModeFieldValues, enablePagination = _a.enablePagination, setCurrentPage = _a.setCurrentPage, setSearchQuery = _a.setSearchQuery, searchQuery = _a.searchQuery, onMutate = _a.onMutate;
1251
- var editModeFieldValuesRef = React.useRef(editModeFieldValues);
1252
- editModeFieldValuesRef.current = editModeFieldValues;
1253
- var getFieldArray = React.useCallback(function (fieldKey) {
1254
- var source = editMode ? editModeFieldValuesRef.current : index.fieldValues;
1255
- var val = source[fieldKey];
1256
- return Array.isArray(val) ? val : [];
1257
- }, [editMode]);
1258
- var handleAddRow = React.useCallback(function () {
1259
- var updates = {};
1260
- columns.forEach(function (col) {
1261
- var existing = getFieldArray(col.field_key);
1262
- updates[col.field_key] = index.__spreadArray([''], index.__read(existing), false);
1263
- });
1264
- // Clear search so the new row is visible
1265
- if (searchQuery)
1266
- setSearchQuery('');
1267
- // No submitCustom — new rows are provisional until the user edits a cell,
1268
- // avoiding empty-row noise in the backend
1269
- updateFieldValues(updates);
1270
- onMutate();
1271
- // Navigate to first page where the new row appears
1272
- if (enablePagination)
1273
- setCurrentPage(0);
1274
- }, [
1275
- columns,
1276
- getFieldArray,
1277
- updateFieldValues,
1278
- onMutate,
1279
- enablePagination,
1280
- setCurrentPage,
1281
- setSearchQuery,
1282
- searchQuery
1283
- ]);
1284
- var buildRowRemovalUpdates = React.useCallback(function (rowIndex) {
1285
- var updates = {};
1286
- columns.forEach(function (col) {
1287
- var existing = getFieldArray(col.field_key);
1288
- updates[col.field_key] = existing.filter(function (_, i) { return i !== rowIndex; });
1289
- });
1290
- return updates;
1291
- }, [columns, getFieldArray]);
1292
- var handleDeleteRow = React.useCallback(function (rowIndex) {
1293
- var updates = buildRowRemovalUpdates(rowIndex);
1294
- updateFieldValues(updates);
1295
- if (!editMode)
1296
- submitCustom(updates);
1297
- onMutate();
1298
- }, [
1299
- buildRowRemovalUpdates,
1300
- updateFieldValues,
1301
- submitCustom,
1302
- editMode,
1303
- onMutate
1304
- ]);
1305
- var handleRemoveRowLocal = React.useCallback(function (rowIndex) {
1306
- var updates = buildRowRemovalUpdates(rowIndex);
1307
- updateFieldValues(updates);
1308
- onMutate();
1309
- }, [buildRowRemovalUpdates, updateFieldValues, onMutate]);
1310
- var handleCellEdit = React.useCallback(function (fieldKey, rowIndex, newValue) {
1311
- var _a;
1312
- var existing = getFieldArray(fieldKey);
1313
- var updated = index.__spreadArray([], index.__read(existing), false);
1314
- updated[rowIndex] = newValue;
1315
- var values = (_a = {}, _a[fieldKey] = updated, _a);
1316
- updateFieldValues(values);
1317
- if (!editMode)
1318
- submitCustom(values);
1319
- onMutate();
1320
- }, [getFieldArray, updateFieldValues, submitCustom, editMode, onMutate]);
1321
- var handleCellClear = React.useCallback(function (fieldKey, rowIndex) {
1322
- handleCellEdit(fieldKey, rowIndex, '');
1323
- }, [handleCellEdit]);
1324
- return {
1325
- handleAddRow: handleAddRow,
1326
- handleDeleteRow: handleDeleteRow,
1327
- handleRemoveRowLocal: handleRemoveRowLocal,
1328
- handleCellEdit: handleCellEdit,
1329
- handleCellClear: handleCellClear
1330
- };
1331
- }
1332
-
1333
- /**
1334
- * Measures column widths from the browser's auto layout, then locks them
1335
- * for use with table-layout: fixed. Re-measures when columnCount changes.
1336
- */
1337
- function useColumnWidths(tableRef, columnCount) {
1338
- var _a = index.__read(React.useState(null), 2), widths = _a[0], setWidths = _a[1];
1339
- var prevColumnCount = React.useRef(columnCount);
1340
- if (prevColumnCount.current !== columnCount) {
1341
- prevColumnCount.current = columnCount;
1342
- setWidths(null);
1343
- }
1344
- React.useLayoutEffect(function () {
1345
- var _a;
1346
- if (widths !== null)
1347
- return;
1348
- var win = index.featheryWindow();
1349
- if (!win || typeof win.getComputedStyle !== 'function')
1350
- return;
1351
- var table = tableRef.current;
1352
- if (!table)
1353
- return;
1354
- var headerRow = (_a = table.querySelector('thead tr')) !== null && _a !== void 0 ? _a : table.querySelector('tbody tr');
1355
- if (!headerRow)
1356
- return;
1357
- var measured = [];
1358
- for (var i = 0; i < headerRow.children.length; i++) {
1359
- measured.push(headerRow.children[i].getBoundingClientRect().width);
1360
- }
1361
- if (measured.length > 0)
1362
- setWidths(measured);
1363
- }, [widths, columnCount]);
1364
- return widths;
1365
- }
1366
-
1367
975
  function applyTableStyles(responsiveStyles) {
1368
976
  responsiveStyles.addTargets('table', 'thead', 'tbody', 'th', 'td', 'tr');
1369
977
  return responsiveStyles;
1370
978
  }
1371
979
  function TableElement(_a) {
1372
- var element = _a.element, responsiveStyles = _a.responsiveStyles, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b, _c = _a.updateFieldValues, updateFieldValues = _c === void 0 ? function () { } : _c, _d = _a.submitCustom, submitCustom = _d === void 0 ? function () { } : _d, _e = _a.editMode, editMode = _e === void 0 ? false : _e, _f = _a.buttonLoaders, buttonLoaders = _f === void 0 ? {} : _f;
980
+ var element = _a.element, responsiveStyles = _a.responsiveStyles, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b, _c = _a.editMode, editMode = _c === void 0 ? false : _c, _d = _a.buttonLoaders, buttonLoaders = _d === void 0 ? {} : _d;
1373
981
  var styles = React.useMemo(function () { return applyTableStyles(responsiveStyles); }, [responsiveStyles]);
1374
- var _g = index.__read(React.useState(0), 2), dataVersion = _g[0], setDataVersion = _g[1];
1375
- var onMutate = React.useCallback(function () { return setDataVersion(function (v) { return v + 1; }); }, []);
1376
- var _h = useTableData({ element: element, editMode: editMode, dataVersion: dataVersion }),
982
+ var _e = useTableData({ element: element, editMode: editMode }),
1377
983
  // search
1378
- enableSearch = _h.enableSearch, searchQuery = _h.searchQuery, setSearchQuery = _h.setSearchQuery,
984
+ enableSearch = _e.enableSearch, searchQuery = _e.searchQuery, setSearchQuery = _e.setSearchQuery,
1379
985
  // sort
1380
- enableSort = _h.enableSort, sortColumn = _h.sortColumn, sortDirection = _h.sortDirection, sortedColumnIndex = _h.sortedColumnIndex, handleSort = _h.handleSort, handleTransposedSort = _h.handleTransposedSort,
986
+ enableSort = _e.enableSort, sortColumn = _e.sortColumn, sortDirection = _e.sortDirection, sortedColumnIndex = _e.sortedColumnIndex, handleSort = _e.handleSort, handleTransposedSort = _e.handleTransposedSort,
1381
987
  // pagination
1382
- enablePagination = _h.enablePagination, currentPage = _h.currentPage, setCurrentPage = _h.setCurrentPage, paginatedRowIndices = _h.paginatedRowIndices, rowsPerPage = _h.rowsPerPage,
1383
- // editing
1384
- enableEditing = _h.enableEditing, enableAddDeleteRows = _h.enableAddDeleteRows,
988
+ enablePagination = _e.enablePagination, currentPage = _e.currentPage, setCurrentPage = _e.setCurrentPage, paginatedRowIndices = _e.paginatedRowIndices, rowsPerPage = _e.rowsPerPage,
1385
989
  // data
1386
- columns = _h.columns, actions = _h.actions, isTransposed = _h.isTransposed, transposedRowIndices = _h.transposedRowIndices, totalRows = _h.totalRows, totalPages = _h.totalPages, hasData = _h.hasData, hasSearchResults = _h.hasSearchResults, activeFieldValues = _h.activeFieldValues, baseColumns = _h.baseColumns, baseFieldValues = _h.baseFieldValues;
1387
- var _j = useTableMutations({
1388
- columns: baseColumns,
1389
- updateFieldValues: updateFieldValues,
1390
- submitCustom: submitCustom,
1391
- editMode: editMode,
1392
- editModeFieldValues: activeFieldValues,
1393
- enablePagination: enablePagination,
1394
- setCurrentPage: setCurrentPage,
1395
- setSearchQuery: setSearchQuery,
1396
- searchQuery: searchQuery,
1397
- onMutate: onMutate
1398
- }), handleAddRow = _j.handleAddRow, handleDeleteRow = _j.handleDeleteRow, handleCellEdit = _j.handleCellEdit, handleCellClear = _j.handleCellClear;
1399
- var canEdit = enableEditing && !isTransposed;
1400
- var showAddRow = canEdit && enableAddDeleteRows;
1401
- var canDeleteRows = canEdit && enableAddDeleteRows;
1402
- var hasOverflowMenu = actions.length > 1;
1403
- var showStandaloneDeleteColumn = canDeleteRows && !hasOverflowMenu;
1404
- var _k = index.__read(React.useState(new Set()), 2), pendingAddRows = _k[0], setPendingAddRows = _k[1];
1405
- var pendingAddRowsRef = React.useRef(pendingAddRows);
1406
- pendingAddRowsRef.current = pendingAddRows;
1407
- var wrappedHandleCellEdit = React.useCallback(function (fieldKey, rowIndex, newValue) {
1408
- if (pendingAddRowsRef.current.has(rowIndex)) {
1409
- setPendingAddRows(function (prev) {
1410
- var next = new Set(prev);
1411
- next.delete(rowIndex);
1412
- return next;
1413
- });
1414
- }
1415
- handleCellEdit(fieldKey, rowIndex, newValue);
1416
- }, [handleCellEdit]);
1417
- var _l = index.__read(React.useState(null), 2), deleteRowIndex = _l[0], setDeleteRowIndex = _l[1];
1418
- var prevPageRef = React.useRef(currentPage);
1419
- if (prevPageRef.current !== currentPage) {
1420
- prevPageRef.current = currentPage;
1421
- setDeleteRowIndex(null);
1422
- }
1423
- var handleCancelDelete = React.useCallback(function () { return setDeleteRowIndex(null); }, []);
1424
- var deleteIconRefs = React.useRef(new Map());
1425
- var actionCellRefs = React.useRef(new Map());
1426
- var showEmptyState = !hasData || !hasSearchResults;
1427
- var showToolbar = enableSearch || showAddRow;
1428
- var tableRef = React.useRef(null);
1429
- var visibleColumnCount = columns.length +
1430
- (!isTransposed && actions.length > 0 ? 1 : 0) +
1431
- (showStandaloneDeleteColumn ? 1 : 0);
1432
- var columnWidths = useColumnWidths(tableRef, visibleColumnCount);
1433
- return (index.jsxs("div", index.__assign({ css: index.__assign(index.__assign({}, containerStyle), styles.getTarget('container')) }, { children: [showToolbar && (index.jsxs("div", index.__assign({ css: toolbarStyle }, { children: [enableSearch ? (index.jsx(Search, { searchQuery: searchQuery, onSearchChange: setSearchQuery })) : (index.jsx("div", {})), showAddRow && (index.jsx("button", index.__assign({ type: 'button', css: addRowButtonStyle, onClick: function () {
1434
- setDeleteRowIndex(null);
1435
- handleAddRow();
1436
- setPendingAddRows(function (prev) {
1437
- var next = new Set();
1438
- next.add(0);
1439
- prev.forEach(function (idx) { return next.add(idx + 1); });
1440
- return next;
1441
- });
1442
- } }, { children: "+ Add Row" })))] }))), showEmptyState ? (index.jsx(EmptyState, { hasSearchQuery: searchQuery.trim().length > 0 })) : (index.jsx("div", index.__assign({ css: { overflowX: 'auto' } }, { children: index.jsxs("table", index.__assign({ ref: tableRef, css: index.__assign(index.__assign(index.__assign({}, tableStyle), (columnWidths
1443
- ? {
1444
- tableLayout: 'fixed',
1445
- minWidth: "".concat(columnWidths.reduce(function (a, b) { return a + b; }, 0), "px")
1446
- }
1447
- : {
1448
- tableLayout: 'auto',
1449
- width: 'max-content'
1450
- })), styles.getTarget('table')) }, { children: [columnWidths && (index.jsx("colgroup", { children: columnWidths.map(function (w, i) { return (index.jsx("col", { style: { width: "".concat(w, "px") } }, i)); }) })), !isTransposed && (index.jsx("thead", index.__assign({ css: theadStyle }, { children: index.jsxs("tr", { children: [index.jsx(SortHeader, { columns: columns, enableSort: enableSort, sortColumn: sortColumn, sortDirection: sortDirection, onSort: handleSort, styles: styles }), actions.length > 0 && (index.jsx("th", { scope: 'col', css: index.__assign(index.__assign(index.__assign({}, thStyle), { paddingLeft: 0 }), styles.getTarget('th')) })), showStandaloneDeleteColumn && (index.jsx("th", { scope: 'col', css: index.__assign(index.__assign(index.__assign({}, thStyle), deleteColumnStyle), styles.getTarget('th')) }))] }) }))), index.jsxs("tbody", index.__assign({ css: styles.getTarget('tbody') }, { children: [paginatedRowIndices.map(function (rowIndex) {
1451
- var _a, _b;
990
+ columns = _e.columns, actions = _e.actions, isTransposed = _e.isTransposed, transposedRowIndices = _e.transposedRowIndices, totalRows = _e.totalRows, totalPages = _e.totalPages, hasData = _e.hasData, hasSearchResults = _e.hasSearchResults, activeFieldValues = _e.activeFieldValues, baseColumns = _e.baseColumns, baseFieldValues = _e.baseFieldValues;
991
+ var showEmptyState = !hasData || (hasData && !hasSearchResults);
992
+ return (index.jsx("div", index.__assign({ css: index.__assign(index.__assign({}, containerStyle), styles.getTarget('container')) }, { children: index.jsxs("div", index.__assign({ css: { minWidth: 'fit-content' } }, { children: [enableSearch && (index.jsx(Search, { searchQuery: searchQuery, onSearchChange: setSearchQuery })), showEmptyState ? (index.jsx(EmptyState, { hasSearchQuery: searchQuery.trim().length > 0 })) : (index.jsxs("table", index.__assign({ css: index.__assign(index.__assign({}, tableStyle), styles.getTarget('table')) }, { children: [!isTransposed && (index.jsx("thead", index.__assign({ css: theadStyle }, { children: index.jsxs("tr", { children: [index.jsx(SortHeader, { columns: columns, enableSort: enableSort, sortColumn: sortColumn, sortDirection: sortDirection, onSort: handleSort, styles: styles }), actions.length > 0 && (index.jsx("th", { scope: 'col', css: index.__assign(index.__assign(index.__assign({}, thStyle), { paddingLeft: 0 }), styles.getTarget('th')) }))] }) }))), index.jsxs("tbody", index.__assign({ css: styles.getTarget('tbody') }, { children: [paginatedRowIndices.map(function (rowIndex) {
1452
993
  var rowData = {};
1453
994
  if (!isTransposed) {
1454
995
  columns.forEach(function (col) {
@@ -1460,7 +1001,7 @@ function TableElement(_a) {
1460
1001
  });
1461
1002
  }
1462
1003
  var handleRowClick = function () {
1463
- if (!isTransposed && !canEdit) {
1004
+ if (!isTransposed) {
1464
1005
  onClick({
1465
1006
  rowIndex: rowIndex,
1466
1007
  rowData: rowData
@@ -1478,6 +1019,7 @@ function TableElement(_a) {
1478
1019
  var isSorted = sortedColumnIndex === rowIndex;
1479
1020
  var isFirstColumn = colIndex === 0;
1480
1021
  var isSecondColumn = colIndex === 1;
1022
+ // In transposed mode, get the original row index from the column
1481
1023
  var originalRowIndex = isTransposed && !isFirstColInTranspose
1482
1024
  ? column.originalRowIndex
1483
1025
  : undefined;
@@ -1498,6 +1040,7 @@ function TableElement(_a) {
1498
1040
  }
1499
1041
  else if (isTransposed &&
1500
1042
  originalRowIndex !== undefined) {
1043
+ // In transposed mode, clicking a cell triggers with original row data
1501
1044
  e.stopPropagation();
1502
1045
  var originalRowData_1 = {};
1503
1046
  baseColumns.forEach(function (col) {
@@ -1513,32 +1056,9 @@ function TableElement(_a) {
1513
1056
  });
1514
1057
  }
1515
1058
  };
1516
- return (index.jsx(CellElement, index.__assign({ css: cellCss, onClick: handleCellClick }, (isFirstColInTranspose ? { scope: 'row' } : {}), { children: isFirstColInTranspose && isSortable ? (index.jsxs("div", index.__assign({ css: index.__assign(index.__assign({}, sortHeaderContentStyle), { justifyContent: 'space-between' }) }, { children: [index.jsx("span", { children: (_a = index.stringifyWithNull(cellValue)) !== null && _a !== void 0 ? _a : '' }), index.jsx("span", index.__assign({ css: sortIconContainerStyle }, { children: index.jsx(SortIcon, { isSorted: isSorted, sortDirection: sortDirection }) }))] }))) : canEdit ? (index.jsx(EditableCell, { value: cellValue, fieldKey: column.field_key, rowIndex: rowIndex, onEdit: wrappedHandleCellEdit, onClear: handleCellClear })) : ((_b = index.stringifyWithNull(cellValue)) !== null && _b !== void 0 ? _b : '') }), colIndex));
1517
- }), !isTransposed && actions.length > 0 && (index.jsxs("td", index.__assign({ ref: function (el) {
1518
- if (el)
1519
- actionCellRefs.current.set(rowIndex, el);
1520
- else
1521
- actionCellRefs.current.delete(rowIndex);
1522
- }, css: index.__assign(index.__assign(index.__assign({}, cellStyle), { paddingLeft: 0 }), styles.getTarget('td')) }, { children: [index.jsx(ActionButtons, { actions: actions, rowIndex: rowIndex, columnData: baseColumns, fieldValues: baseFieldValues, onClick: onClick, tableId: element.id, buttonLoaders: buttonLoaders, canDeleteRows: canDeleteRows && hasOverflowMenu, onDeleteRow: function (ri) { return setDeleteRowIndex(ri); } }), hasOverflowMenu &&
1523
- canDeleteRows &&
1524
- deleteRowIndex === rowIndex && (index.jsx(DeleteConfirm, { anchorEl: (_a = actionCellRefs.current.get(rowIndex)) !== null && _a !== void 0 ? _a : null, onConfirm: function () {
1525
- handleDeleteRow(rowIndex);
1526
- setDeleteRowIndex(null);
1527
- }, onCancel: handleCancelDelete }))] }))), showStandaloneDeleteColumn && (index.jsxs("td", index.__assign({ css: index.__assign(index.__assign({}, deleteColumnStyle), styles.getTarget('td')) }, { children: [index.jsx("button", index.__assign({ type: 'button', ref: function (el) {
1528
- if (el)
1529
- deleteIconRefs.current.set(rowIndex, el);
1530
- else
1531
- deleteIconRefs.current.delete(rowIndex);
1532
- }, css: index.__assign(index.__assign({}, deleteIconStyle), (deleteRowIndex === rowIndex && {
1533
- opacity: 1
1534
- })), onClick: function (e) {
1535
- e.stopPropagation();
1536
- setDeleteRowIndex(deleteRowIndex === rowIndex ? null : rowIndex);
1537
- } }, { children: index.jsx(TrashIcon, {}) })), deleteRowIndex === rowIndex && (index.jsx(DeleteConfirm, { anchorEl: (_b = deleteIconRefs.current.get(rowIndex)) !== null && _b !== void 0 ? _b : null, onConfirm: function () {
1538
- handleDeleteRow(rowIndex);
1539
- setDeleteRowIndex(null);
1540
- }, onCancel: handleCancelDelete }))] })))] }), rowIndex));
1541
- }), isTransposed && actions.length > 0 && (index.jsxs("tr", index.__assign({ css: index.__assign(index.__assign({}, rowStyle), styles.getTarget('tr')) }, { children: [index.jsx("th", { scope: 'row', css: index.__assign(index.__assign(index.__assign({}, thStyle), { backgroundColor: '#f9fafb', borderRight: '1px solid #e5e7eb', width: '1px', whiteSpace: 'nowrap' }), styles.getTarget('th')) }), transposedRowIndices.map(function (originalRowIndex, idx) { return (index.jsx("td", index.__assign({ css: index.__assign(index.__assign(index.__assign({}, cellStyle), (idx === 0 ? {} : { paddingLeft: 0 })), styles.getTarget('td')) }, { children: index.jsx("div", index.__assign({ css: { display: 'flex', justifyContent: 'flex-start' } }, { children: index.jsx(ActionButtons, { actions: actions, rowIndex: originalRowIndex, columnData: baseColumns, fieldValues: baseFieldValues, onClick: onClick, forceInlineButtons: true, tableId: element.id, buttonLoaders: buttonLoaders }) })) }), originalRowIndex)); })] })))] }))] })) }))), !showEmptyState && enablePagination && (index.jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, totalItems: totalRows, rowsPerPage: rowsPerPage, onPageChange: setCurrentPage }))] })));
1059
+ return (index.jsx(CellElement, index.__assign({ css: cellCss, onClick: handleCellClick }, (isFirstColInTranspose ? { scope: 'row' } : {}), { children: isFirstColInTranspose && isSortable ? (index.jsxs("div", index.__assign({ css: index.__assign(index.__assign({}, sortHeaderContentStyle), { justifyContent: 'space-between' }) }, { children: [index.jsx("span", { children: (_a = index.stringifyWithNull(cellValue)) !== null && _a !== void 0 ? _a : '' }), index.jsx("span", index.__assign({ css: sortIconContainerStyle }, { children: index.jsx(SortIcon, { isSorted: isSorted, sortDirection: sortDirection }) }))] }))) : ((_b = index.stringifyWithNull(cellValue)) !== null && _b !== void 0 ? _b : '') }), colIndex));
1060
+ }), !isTransposed && actions.length > 0 && (index.jsx("td", index.__assign({ css: index.__assign(index.__assign(index.__assign({}, cellStyle), { paddingLeft: 0 }), styles.getTarget('td')) }, { children: index.jsx(ActionButtons, { actions: actions, rowIndex: rowIndex, columnData: baseColumns, fieldValues: baseFieldValues, onClick: onClick, tableId: element.id, buttonLoaders: buttonLoaders }) })))] }), rowIndex));
1061
+ }), isTransposed && actions.length > 0 && (index.jsxs("tr", index.__assign({ css: index.__assign(index.__assign({}, rowStyle), styles.getTarget('tr')) }, { children: [index.jsx("th", { scope: 'row', css: index.__assign(index.__assign(index.__assign({}, thStyle), { backgroundColor: '#f9fafb', borderRight: '1px solid #e5e7eb', width: '1px', whiteSpace: 'nowrap' }), styles.getTarget('th')) }), transposedRowIndices.map(function (originalRowIndex, idx) { return (index.jsx("td", index.__assign({ css: index.__assign(index.__assign(index.__assign({}, cellStyle), (idx === 0 ? {} : { paddingLeft: 0 })), styles.getTarget('td')) }, { children: index.jsx("div", index.__assign({ css: { display: 'flex', justifyContent: 'flex-start' } }, { children: index.jsx(ActionButtons, { actions: actions, rowIndex: originalRowIndex, columnData: baseColumns, fieldValues: baseFieldValues, onClick: onClick, forceInlineButtons: true, tableId: element.id, buttonLoaders: buttonLoaders }) })) }), originalRowIndex)); })] })))] }))] }))), !showEmptyState && enablePagination && (index.jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, totalItems: totalRows, rowsPerPage: rowsPerPage, onPageChange: setCurrentPage }))] })) })));
1542
1062
  }
1543
1063
 
1544
1064
  exports.default = TableElement;