componenteshospitais 4.0.1 → 4.0.3

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/cjs/index.js CHANGED
@@ -16685,7 +16685,7 @@ var ActionBar = function (_a) {
16685
16685
  };
16686
16686
 
16687
16687
  var TableStandardButtons = function (_a) {
16688
- var dados = _a.dados, onRowClick = _a.onRowClick, _b = _a.idColumn, idColumn = _b === void 0 ? 'id' : _b, _c = _a.showExcelDownloadButton, showExcelDownloadButton = _c === void 0 ? false : _c, _d = _a.cor, cor = _d === void 0 ? false : _d, _e = _a.numeroPaginas, numeroPaginas = _e === void 0 ? 10 : _e, empresa = _a.empresa, _f = _a.paginacao, paginacao = _f === void 0 ? true : _f, borderRadius = _a.borderRadius, borderColor = _a.borderColor, cellsPadding = _a.cellsPadding, cellSpacing = _a.cellSpacing, _g = _a.linhasZebradas, linhasZebradas = _g === void 0 ? false : _g, onCheckboxChange = _a.onCheckboxChange, onInputChange = _a.onInputChange, onInputKeyDown = _a.onInputKeyDown, minWidth = _a.minWidth;
16688
+ var dados = _a.dados, onRowClick = _a.onRowClick, _b = _a.idColumn, idColumn = _b === void 0 ? 'id' : _b, _c = _a.showExcelDownloadButton, showExcelDownloadButton = _c === void 0 ? false : _c, _d = _a.cor, cor = _d === void 0 ? false : _d, _e = _a.numeroPaginas, numeroPaginas = _e === void 0 ? 10 : _e, empresa = _a.empresa, _f = _a.paginacao, paginacao = _f === void 0 ? true : _f, borderRadius = _a.borderRadius, borderColor = _a.borderColor, cellsPadding = _a.cellsPadding, cellSpacing = _a.cellSpacing, _g = _a.linhasZebradas, linhasZebradas = _g === void 0 ? false : _g, onCheckboxChange = _a.onCheckboxChange, onInputChange = _a.onInputChange, onInputKeyDown = _a.onInputKeyDown, minWidth = _a.minWidth, minHeight = _a.minHeight;
16689
16689
  var _h = React.useState(null), selectedRow = _h[0], setSelectedRow = _h[1];
16690
16690
  var _j = React.useState(1), currentPage = _j[0], setCurrentPage = _j[1];
16691
16691
  var ultimoItem = currentPage * numeroPaginas;
@@ -16803,7 +16803,7 @@ var TableStandardButtons = function (_a) {
16803
16803
  for (var i = 1; i <= Math.ceil(dados.length / numeroPaginas); i++) {
16804
16804
  pageNumbers.push(i);
16805
16805
  }
16806
- return (React.createElement("div", { className: styles$2.tableResponsive },
16806
+ return (React.createElement("div", { className: "".concat(styles$2.tableResponsive), style: { minHeight: minHeight ? minHeight : '' } },
16807
16807
  React.createElement("div", { style: { minWidth: minWidth ? "".concat(minWidth, "px") : '' }, className: empresaClass },
16808
16808
  showExcelDownloadButton && (React.createElement("div", { className: styles$2.excelWrapper },
16809
16809
  React.createElement("button", { onClick: handleDownloadClick, className: styles$2.downloadButton },
@@ -16843,9 +16843,9 @@ var TableStandardButtons = function (_a) {
16843
16843
  // </i>
16844
16844
  ,
16845
16845
  row[key].typeColumn && row[key].typeColumn === 'checkbox' && (React.createElement("div", { className: styles$2.formGroupRadio },
16846
- React.createElement(InputField, { type: "checkbox", id: "checkbox_".concat(index, "_").concat(String(row.id.value), "_").concat(String(row[key].value)), placeholder: "", value: row[key].value, checked: checkboxStates["".concat(String(index), "_").concat(String(row.id.value), "_").concat(String(row[key].value))] || false, onChange: function () {
16847
- return row[key].value !== undefined && handleCheckboxChange(String(index), String(row.id.value), String(row[key].value));
16848
- }, disabled: row[key].disabled, "data-inativo": row[key].inativo ? row[key].inativo : false }))),
16846
+ React.createElement(InputField, { type: "checkbox", id: "checkbox_".concat(index, "_").concat(String(row.id.value), "_").concat(String(row[key].value)), placeholder: "", value: row.id.value, checked: checkboxStates["".concat(String(index), "_").concat(String(row.id.value), "_").concat(String(row[key].value))] !== undefined
16847
+ ? checkboxStates["".concat(String(index), "_").concat(String(row.id.value), "_").concat(String(row[key].value))]
16848
+ : row[key].initialValue === '1', onChange: function () { return handleCheckboxChange(String(index), String(row.id.value), String(row[key].value)); }, disabled: row[key].disabled, "data-inativo": row[key].inativo ? row[key].inativo : false }))),
16849
16849
  row[key].typeColumn && row[key].typeColumn === 'input' && (React.createElement("div", { className: styles$2.formGroupRadio },
16850
16850
  React.createElement(InputField, { type: row[key].typeInput || 'text', id: "input_".concat(String(row[key].value), "_").concat(String(row.id.value)), value: inputStates["".concat(String(row[key].value), "_").concat(String(row.id.value))] || '', disabled: row[key].disabled, onChange: function (e) {
16851
16851
  return row[key].value !== undefined && handleInputChange(String(row[key].value), String(row.id.value), e.target.value);
package/dist/esm/index.js CHANGED
@@ -16683,7 +16683,7 @@ var ActionBar = function (_a) {
16683
16683
  };
16684
16684
 
16685
16685
  var TableStandardButtons = function (_a) {
16686
- var dados = _a.dados, onRowClick = _a.onRowClick, _b = _a.idColumn, idColumn = _b === void 0 ? 'id' : _b, _c = _a.showExcelDownloadButton, showExcelDownloadButton = _c === void 0 ? false : _c, _d = _a.cor, cor = _d === void 0 ? false : _d, _e = _a.numeroPaginas, numeroPaginas = _e === void 0 ? 10 : _e, empresa = _a.empresa, _f = _a.paginacao, paginacao = _f === void 0 ? true : _f, borderRadius = _a.borderRadius, borderColor = _a.borderColor, cellsPadding = _a.cellsPadding, cellSpacing = _a.cellSpacing, _g = _a.linhasZebradas, linhasZebradas = _g === void 0 ? false : _g, onCheckboxChange = _a.onCheckboxChange, onInputChange = _a.onInputChange, onInputKeyDown = _a.onInputKeyDown, minWidth = _a.minWidth;
16686
+ var dados = _a.dados, onRowClick = _a.onRowClick, _b = _a.idColumn, idColumn = _b === void 0 ? 'id' : _b, _c = _a.showExcelDownloadButton, showExcelDownloadButton = _c === void 0 ? false : _c, _d = _a.cor, cor = _d === void 0 ? false : _d, _e = _a.numeroPaginas, numeroPaginas = _e === void 0 ? 10 : _e, empresa = _a.empresa, _f = _a.paginacao, paginacao = _f === void 0 ? true : _f, borderRadius = _a.borderRadius, borderColor = _a.borderColor, cellsPadding = _a.cellsPadding, cellSpacing = _a.cellSpacing, _g = _a.linhasZebradas, linhasZebradas = _g === void 0 ? false : _g, onCheckboxChange = _a.onCheckboxChange, onInputChange = _a.onInputChange, onInputKeyDown = _a.onInputKeyDown, minWidth = _a.minWidth, minHeight = _a.minHeight;
16687
16687
  var _h = useState(null), selectedRow = _h[0], setSelectedRow = _h[1];
16688
16688
  var _j = useState(1), currentPage = _j[0], setCurrentPage = _j[1];
16689
16689
  var ultimoItem = currentPage * numeroPaginas;
@@ -16801,7 +16801,7 @@ var TableStandardButtons = function (_a) {
16801
16801
  for (var i = 1; i <= Math.ceil(dados.length / numeroPaginas); i++) {
16802
16802
  pageNumbers.push(i);
16803
16803
  }
16804
- return (React.createElement("div", { className: styles$2.tableResponsive },
16804
+ return (React.createElement("div", { className: "".concat(styles$2.tableResponsive), style: { minHeight: minHeight ? minHeight : '' } },
16805
16805
  React.createElement("div", { style: { minWidth: minWidth ? "".concat(minWidth, "px") : '' }, className: empresaClass },
16806
16806
  showExcelDownloadButton && (React.createElement("div", { className: styles$2.excelWrapper },
16807
16807
  React.createElement("button", { onClick: handleDownloadClick, className: styles$2.downloadButton },
@@ -16841,9 +16841,9 @@ var TableStandardButtons = function (_a) {
16841
16841
  // </i>
16842
16842
  ,
16843
16843
  row[key].typeColumn && row[key].typeColumn === 'checkbox' && (React.createElement("div", { className: styles$2.formGroupRadio },
16844
- React.createElement(InputField, { type: "checkbox", id: "checkbox_".concat(index, "_").concat(String(row.id.value), "_").concat(String(row[key].value)), placeholder: "", value: row[key].value, checked: checkboxStates["".concat(String(index), "_").concat(String(row.id.value), "_").concat(String(row[key].value))] || false, onChange: function () {
16845
- return row[key].value !== undefined && handleCheckboxChange(String(index), String(row.id.value), String(row[key].value));
16846
- }, disabled: row[key].disabled, "data-inativo": row[key].inativo ? row[key].inativo : false }))),
16844
+ React.createElement(InputField, { type: "checkbox", id: "checkbox_".concat(index, "_").concat(String(row.id.value), "_").concat(String(row[key].value)), placeholder: "", value: row.id.value, checked: checkboxStates["".concat(String(index), "_").concat(String(row.id.value), "_").concat(String(row[key].value))] !== undefined
16845
+ ? checkboxStates["".concat(String(index), "_").concat(String(row.id.value), "_").concat(String(row[key].value))]
16846
+ : row[key].initialValue === '1', onChange: function () { return handleCheckboxChange(String(index), String(row.id.value), String(row[key].value)); }, disabled: row[key].disabled, "data-inativo": row[key].inativo ? row[key].inativo : false }))),
16847
16847
  row[key].typeColumn && row[key].typeColumn === 'input' && (React.createElement("div", { className: styles$2.formGroupRadio },
16848
16848
  React.createElement(InputField, { type: row[key].typeInput || 'text', id: "input_".concat(String(row[key].value), "_").concat(String(row.id.value)), value: inputStates["".concat(String(row[key].value), "_").concat(String(row.id.value))] || '', disabled: row[key].disabled, onChange: function (e) {
16849
16849
  return row[key].value !== undefined && handleInputChange(String(row[key].value), String(row.id.value), e.target.value);
@@ -41,6 +41,7 @@ export interface TableStandardButtonsProps {
41
41
  onInputChange?: (rowId: string, value: string) => void;
42
42
  onInputKeyDown?: (rowId: string) => void;
43
43
  minWidth?: string;
44
+ minHeight?: string;
44
45
  }
45
46
  declare const TableStandardButtons: React.FC<TableStandardButtonsProps>;
46
47
  export default TableStandardButtons;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "componenteshospitais",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -50,6 +50,7 @@ export interface TableStandardButtonsProps {
50
50
  onInputChange?: (rowId: string, value: string) => void;
51
51
  onInputKeyDown?: (rowId: string) => void;
52
52
  minWidth?: string;
53
+ minHeight?: string;
53
54
  }
54
55
 
55
56
  const TableStandardButtons: React.FC<TableStandardButtonsProps> = ({
@@ -69,7 +70,8 @@ const TableStandardButtons: React.FC<TableStandardButtonsProps> = ({
69
70
  onCheckboxChange,
70
71
  onInputChange,
71
72
  onInputKeyDown,
72
- minWidth
73
+ minWidth,
74
+ minHeight
73
75
  }) => {
74
76
  const [selectedRow, setSelectedRow] = useState<string | null>(null);
75
77
  const [currentPage, setCurrentPage] = useState(1);
@@ -225,7 +227,7 @@ const TableStandardButtons: React.FC<TableStandardButtonsProps> = ({
225
227
  }
226
228
 
227
229
  return (
228
- <div className={styles.tableResponsive}>
230
+ <div className={`${styles.tableResponsive}`} style={{minHeight: minHeight ? minHeight : ''}}>
229
231
  <div style={{minWidth: minWidth ? `${minWidth}px` : ''}} className={empresaClass}>
230
232
  {showExcelDownloadButton && (
231
233
  <div className={styles.excelWrapper}>
@@ -352,10 +354,13 @@ const TableStandardButtons: React.FC<TableStandardButtonsProps> = ({
352
354
  type="checkbox"
353
355
  id={`checkbox_${index}_${String(row.id.value)}_${String(row[key].value)}`}
354
356
  placeholder=""
355
- value={row[key].value}
356
- checked={checkboxStates[`${String(index)}_${String(row.id.value)}_${String(row[key].value)}`] || false}
357
- onChange={() =>
358
- row[key].value !== undefined && handleCheckboxChange(String(index), String(row.id.value), String(row[key].value))
357
+ value={row.id.value}
358
+ checked={
359
+ checkboxStates[`${String(index)}_${String(row.id.value)}_${String(row[key].value)}`] !== undefined
360
+ ? checkboxStates[`${String(index)}_${String(row.id.value)}_${String(row[key].value)}`]
361
+ : row[key].initialValue === '1'
362
+ }
363
+ onChange={() => handleCheckboxChange(String(index), String(row.id.value), String(row[key].value))
359
364
  }// Passa o rowId para identificar o checkbox
360
365
  disabled={row[key].disabled}
361
366
  data-inativo={row[key].inativo ? row[key].inativo : false}
@@ -104,7 +104,7 @@ const teste = (rowId:any, checked:any) => {
104
104
  alert(`Linha ${rowId} está ${checked ? 'marcada' : 'desmarcada'}`);
105
105
  }
106
106
 
107
- const Template: StoryFn<TableStandardButtonsProps> = (args) => <TableStandardButtons {...args} onCheckboxChange={teste}/>;
107
+ const Template: StoryFn<TableStandardButtonsProps> = (args) => <TableStandardButtons {...args} onCheckboxChange={teste} />;
108
108
 
109
109
  // Definição dos dados de exemplo para a tabela
110
110
  const sampleData: Data[] = [
@@ -115,7 +115,7 @@ const sampleData: Data[] = [
115
115
  idade: {value: '40', typeColumn: '', iconButton: '', colorButton: 'var(--red)', initialValue: ''},
116
116
  visualizar: {value: 'Visualizar', typeColumn: 'button', iconButton: '', colorButton: 'var(--red)', initialValue: '', borderRadius: '5', inativo: true},
117
117
  cargo: {value: 'Analista', typeColumn: '', iconButton: '', colorButton: 'var(--red)', initialValue: '',},
118
- padrao: {value: '1', typeColumn: 'checkbox', iconButton: '', colorButton: 'var(--red)', initialValue: '',},
118
+ padrao: {value: '1', typeColumn: 'checkbox', iconButton: '', colorButton: 'var(--red)', initialValue: '1',},
119
119
  menu: {value: 'Menu',
120
120
  typeColumn: 'menu',
121
121
  iconButton: '',
@@ -169,7 +169,12 @@ const sampleData: Data[] = [
169
169
  visualizar: {value: 'Visualizar', typeColumn: 'button', iconButton: '', colorButton: 'var(--red)', initialValue: '', borderRadius: '5'},
170
170
  cargo: {value: 'Analista', typeColumn: '', iconButton: '', colorButton: 'var(--red)', initialValue: ''},
171
171
  ativo: {value: '1', typeColumn: 'checkbox', iconButton: '', colorButton: 'var(--red)', initialValue: '', },
172
- valor: {value: '123', typeColumn: 'input', iconButton: '', maxLength: 5, typeInput: 'number'}
172
+ valor: {value: '123', typeColumn: 'input', iconButton: '', maxLength: 5, typeInput: 'number'},
173
+ menu: {value: 'Menu', typeColumn: 'menu', iconButton: '', colorButton: 'var(--red)', initialValue: '', borderRadius: '5', menus: [{nome: 'Preencher/Emitir AF', onClick: (rowId)=>alert(rowId)}, {nome: 'hr'}, {nome:'Alterar observações do Mapa de cotação', onClick: (rowId)=>alert(rowId)}, {nome: 'Preencher/Emitir AF', onClick: (rowId)=>alert(rowId), disabled: true},
174
+ {nome: 'hr'},
175
+ {nome:'Alterar observações do Mapa de cotação', onClick: (rowId)=>alert(rowId)}, {nome: 'Preencher/Emitir AF', onClick: (rowId)=>alert(rowId), disabled: true},
176
+ {nome: 'hr'},
177
+ {nome:'Alterar observações do Mapa de cotação', onClick: (rowId)=>alert(rowId)}]},
173
178
  },
174
179
  {
175
180
  id: {value: '6', typeColumn: 'hidden', iconButton: '', colorButton: 'var(--red)', initialValue: ''},