@amirjalili1374/ui-kit 1.4.9 → 1.4.11

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/ui-kit.es.js CHANGED
@@ -13181,11 +13181,8 @@ function apiService(axiosInst, resource) {
13181
13181
  const response = await axiosInst.post(baseUrl, data2);
13182
13182
  return response;
13183
13183
  },
13184
- async update(data2) {
13185
- if (!data2.id) {
13186
- throw new Error("Update requires an id field");
13187
- }
13188
- const response = await axiosInst.put(`${baseUrl}/${data2.id}`, data2);
13184
+ async update(id, data2) {
13185
+ const response = await axiosInst.put(`${baseUrl}/${id}`, data2);
13189
13186
  return response;
13190
13187
  },
13191
13188
  async delete(id) {
@@ -17268,7 +17265,9 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
17268
17265
  const resolveAutocompleteMultiple = (header) => {
17269
17266
  return header.autocompleteMultiple === true;
17270
17267
  };
17271
- const formHeaders = computed(() => props.headers);
17268
+ const formHeaders = computed(() => {
17269
+ return props.headers.filter((header) => !header.excludeFromForm);
17270
+ });
17272
17271
  const isMoneyHeader = (header) => {
17273
17272
  if (!header || typeof header.type !== "string") {
17274
17273
  return false;
@@ -17555,6 +17554,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
17555
17554
  if (!formModel.value) return;
17556
17555
  try {
17557
17556
  const dataToSave = { ...formModel.value };
17557
+ props.headers.forEach((header) => {
17558
+ if (header.excludeFromForm && dataToSave[header.key] !== void 0) {
17559
+ delete dataToSave[header.key];
17560
+ }
17561
+ });
17558
17562
  props.headers.forEach((header) => {
17559
17563
  if (header.isDate && dataToSave[header.key]) {
17560
17564
  try {
@@ -17587,7 +17591,9 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
17587
17591
  }
17588
17592
  });
17589
17593
  if (isEditing.value && dataToSave.id) {
17590
- await api.update(dataToSave);
17594
+ const recordId = dataToSave.id;
17595
+ const { id, ...dataWithoutId } = dataToSave;
17596
+ await api.update(recordId, dataWithoutId);
17591
17597
  snackbarMessage.value = "✅ آیتم با موفقیت بروزرسانی شد!";
17592
17598
  } else {
17593
17599
  const response = await api.create(dataToSave);