drf-react-by-schema 0.17.12 → 0.17.14

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.
@@ -81,9 +81,9 @@ const CustomToolbar = ({ preparedColumns, setPreparedColumns, onSelectActions, s
81
81
  }
82
82
  selectAction.action(selectionModel, bulkUpdateData);
83
83
  } }, selectAction.title)))))),
84
- hideColumnsButton && (react_1.default.createElement(x_data_grid_1.GridToolbarColumnsButton, { sx: { ml: '10px', fontSize: '13px' }, placeholder: '' })),
85
- hideFilterButton && (react_1.default.createElement(x_data_grid_1.GridToolbarFilterButton, { sx: { ml: '10px', fontSize: '13px' }, placeholder: '' })),
86
- hideDensityButton && (react_1.default.createElement(react_1.default.Fragment, null,
84
+ !hideColumnsButton && (react_1.default.createElement(x_data_grid_1.GridToolbarColumnsButton, { sx: { ml: '10px', fontSize: '13px' }, placeholder: '' })),
85
+ !hideFilterButton && (react_1.default.createElement(x_data_grid_1.GridToolbarFilterButton, { sx: { ml: '10px', fontSize: '13px' }, placeholder: '' })),
86
+ !hideDensityButton && (react_1.default.createElement(react_1.default.Fragment, null,
87
87
  react_1.default.createElement(x_data_grid_1.GridToolbarDensitySelector, { sx: { ml: '10px', fontSize: '13px' }, placeholder: '' }),
88
88
  react_1.default.createElement(Button_1.default, { onClick: openResizeMenu, sx: { ml: '0px', fontSize: '13px' } },
89
89
  react_1.default.createElement(Expand_1.default, { sx: { transform: 'rotate(90deg)', mr: '6px' } }),
@@ -97,8 +97,8 @@ const CustomToolbar = ({ preparedColumns, setPreparedColumns, onSelectActions, s
97
97
  closeResizeMenu();
98
98
  setPreparedColumns((0, utils_1.resizeColumns)(preparedColumns, 'maxContent', apiRef));
99
99
  } }, "Ajustar ao conte\u00FAdo")))),
100
- hideExportButton && react_1.default.createElement(x_data_grid_1.GridToolbarExport, { sx: { ml: '0px', fontSize: '13px' } })),
101
- hideQuickFilterBar && (react_1.default.createElement("div", null,
100
+ !hideExportButton && react_1.default.createElement(x_data_grid_1.GridToolbarExport, { sx: { ml: '0px', fontSize: '13px' } })),
101
+ !hideQuickFilterBar && (react_1.default.createElement("div", null,
102
102
  react_1.default.createElement(x_data_grid_1.GridToolbarQuickFilter, null)))));
103
103
  };
104
104
  exports.CustomToolbar = CustomToolbar;
@@ -129,6 +129,16 @@ function SelectEditInputCell({ field, id, value, column, type, optionsAC, isInde
129
129
  }
130
130
  if (newValue && newValue.inputValue) {
131
131
  const tmpId = (0, utils_1.getTmpId)();
132
+ if (onEditModel) {
133
+ // Open modal to save new item:
134
+ onEditModel({
135
+ model: field,
136
+ id: tmpId,
137
+ labelKey,
138
+ fieldsLayout,
139
+ });
140
+ }
141
+ // Define new Item as an "optimistic response"
132
142
  newValue = {
133
143
  [valueKey]: tmpId,
134
144
  [labelKey]: newValue.inputValue,
@@ -142,7 +152,7 @@ function SelectEditInputCell({ field, id, value, column, type, optionsAC, isInde
142
152
  open: true,
143
153
  loading: false,
144
154
  title: 'Linha sendo criada',
145
- Body: 'Esta linha está sendo criado agora por você. Para editar suas propriedades, salve antes, e depois você poderá editar!',
155
+ Body: 'Esta linha está sendo criada agora por você. Para editar suas propriedades, salve antes, e depois você poderá editar!',
146
156
  Actions: (react_1.default.createElement(DialogActions_1.default, { setDialog: setDialog, btnCancel: "Entendi" })),
147
157
  });
148
158
  return;
@@ -122,6 +122,20 @@ const EditableAutocompleteFieldBySchema = react_1.default.forwardRef((_a, ref) =
122
122
  }
123
123
  if (newValue && newValue.inputValue) {
124
124
  const tmpId = (0, utils_1.getTmpId)();
125
+ if (onEditModel) {
126
+ // Open modal to save new item:
127
+ onEditModel({
128
+ fieldKey,
129
+ index,
130
+ model: optionsModel,
131
+ id: tmpId,
132
+ labelKey,
133
+ setValue,
134
+ getValues,
135
+ fieldsLayout,
136
+ });
137
+ }
138
+ // Define new Item as an "optimistic response"
125
139
  newValue = {
126
140
  id: tmpId,
127
141
  label: newValue.inputValue,
@@ -210,7 +224,7 @@ const EditableAutocompleteFieldBySchema = react_1.default.forwardRef((_a, ref) =
210
224
  return option.label;
211
225
  }, renderOption: renderOption
212
226
  ? renderOption
213
- : (props, option) => (react_1.default.createElement("li", Object.assign({ key: option.id }, props), option.label)), renderTags: multiple
227
+ : (props, option) => react_1.default.createElement("li", Object.assign({}, props), option.label), renderTags: multiple
214
228
  ? (tagValue, getTagProps) => {
215
229
  return tagValue.map((option, index) => (react_1.default.createElement(Chip_1.default, Object.assign({}, getTagProps({ index }), { label: option.label, icon: (0, utils_1.isTmpId)(option.id) ? (react_1.default.createElement(react_1.default.Fragment, null)) : (react_1.default.createElement(IconButton_1.default, { size: "small", onClick: () => {
216
230
  if (optionsModel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drf-react-by-schema",
3
- "version": "0.17.12",
3
+ "version": "0.17.14",
4
4
  "description": "Components and Tools for building a React App having Django Rest Framework (DRF) as server",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -59,7 +59,7 @@
59
59
  "semver": "^7.5.1",
60
60
  "ts-loader": "^9.4.2",
61
61
  "typedoc": "^0.23.23",
62
- "typescript": "^4.9.4",
62
+ "typescript": "^5.7.3",
63
63
  "webpack": "^5.75.0"
64
64
  },
65
65
  "peerDependencies": {