bt-core-app 2.0.53 → 2.0.54

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.
@@ -9186,8 +9186,8 @@ function bh(e) {
9186
9186
  })), k != null ? p.onSaveAsync ?? (p.onSaveAsync = async (S) => {
9187
9187
  if (S == null)
9188
9188
  return;
9189
- const C = p.getMode(S);
9190
- return p.data = S, C == "new" ? await k().post(p) : await k().patch(p);
9189
+ let C;
9190
+ return p.getMode != null && (typeof p.getMode == "string" ? C = p.getMode : C = p.getMode(S)), p.data = S, C == "new" || C == "post" ? await k().post(p) : await k().patch(p);
9191
9191
  }) : p.onSaveAsync ?? (p.onSaveAsync = (S) => {
9192
9192
  const C = b.findIndex((M) => M.id == S.id);
9193
9193
  return C >= 0 ? b.splice(C, 1, S) : b.push(S), Promise.resolve(S);
package/dist/index.d.ts CHANGED
@@ -1533,7 +1533,7 @@ export declare interface SaveItemOptions {
1533
1533
  }
1534
1534
 
1535
1535
  export declare interface SaveOptions<T, TSave, TReturn> extends StoreAction, StorePathOptions, DoActionOptions {
1536
- getMode?: (item: any) => BladeMode;
1536
+ getMode?: 'post' | 'patch' | ((item: any) => BladeMode);
1537
1537
  /**called to check whether to proceed with save */
1538
1538
  onCanSaveAsync?: OnCanDoAsync<T | TSave>;
1539
1539
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bt-core-app",
3
- "version": "2.0.53",
3
+ "version": "2.0.54",
4
4
  "description": "Core app tools for some basic features like navigation, authentication, server apis, and cosmetics",
5
5
  "homepage": "https://github.com/BlitzItTech/bt-core",
6
6
  "bugs": {