@headless-adminapp/app 0.0.17-alpha.22 → 0.0.17-alpha.23

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.
@@ -132,7 +132,7 @@ var FormCommandBuilder;
132
132
  if (!(confirmResult === null || confirmResult === void 0 ? void 0 : confirmResult.confirmed)) {
133
133
  return;
134
134
  }
135
- context.utility.showProgressIndicator(stringSet.status.deleting + '...');
135
+ context.utility.showProgressIndicator((0, utils_1.plurialize)(1, localizeSelector((s) => s.status.deleting)) + '...');
136
136
  yield context.dataService.deleteRecord(context.primaryControl.logicalName, recordId);
137
137
  context.utility.showNotification({
138
138
  title: (0, utils_1.plurialize)(1, localizeSelector((s) => s.successNotification.title)),
@@ -50,7 +50,7 @@ var SubgridCommandBuilder;
50
50
  onClick: (context) => {
51
51
  if (context.secondaryControl.associated) {
52
52
  context.navigation.openForm({
53
- logicalName: context.primaryControl.schema.logicalName,
53
+ logicalName: context.secondaryControl.schema.logicalName,
54
54
  parameters: {
55
55
  [context.secondaryControl.associated.refAttributeName]: {
56
56
  id: context.secondaryControl.associated.id,
@@ -62,7 +62,7 @@ var SubgridCommandBuilder;
62
62
  }
63
63
  else {
64
64
  context.navigation.openForm({
65
- logicalName: context.primaryControl.schema.logicalName,
65
+ logicalName: context.secondaryControl.schema.logicalName,
66
66
  });
67
67
  }
68
68
  },
@@ -119,7 +119,7 @@ var SubgridCommandBuilder;
119
119
  }
120
120
  context.utility.showProgressIndicator(plurialize(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
121
121
  for (const recordId of recordIds) {
122
- yield context.dataService.deleteRecord(context.primaryControl.logicalName, recordId);
122
+ yield context.dataService.deleteRecord(context.secondaryControl.logicalName, recordId);
123
123
  }
124
124
  context.utility.showNotification({
125
125
  title: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.title)),
@@ -1,16 +1,5 @@
1
1
  import { EntityFormCommandContext } from '@headless-adminapp/core/experience/form';
2
2
  import { CommandItemState } from '../../command';
3
- export declare function useFormControlContext(): {
4
- data: any;
5
- logicalName: string;
6
- schema: import("@headless-adminapp/core/schema").Schema<import("@headless-adminapp/core/schema").SchemaAttributes>;
7
- form: import("@headless-adminapp/core/experience/form").Form<import("@headless-adminapp/core/schema").SchemaAttributes>;
8
- formId: string;
9
- originalData: import("@headless-adminapp/core/transport").Data<import("@headless-adminapp/core/schema").InferredSchemaType<import("@headless-adminapp/core/schema").SchemaAttributes>> | null;
10
- recordId: string | number;
11
- refresh: () => Promise<void>;
12
- save: (mode?: import("@headless-adminapp/core/experience/form").SaveMode) => Promise<void>;
13
- readonly: boolean | undefined;
14
- };
3
+ export declare function useFormControlContext(): EntityFormCommandContext['primaryControl'];
15
4
  export declare function useMainFormCommandHandlerContext(): EntityFormCommandContext;
16
5
  export declare function useMainFormCommands(): CommandItemState[][];
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useFormControlContext = useFormControlContext;
4
4
  exports.useMainFormCommandHandlerContext = useMainFormCommandHandlerContext;
5
5
  exports.useMainFormCommands = useMainFormCommands;
6
+ const route_1 = require("@headless-adminapp/app/route");
7
+ const react_1 = require("react");
6
8
  const command_1 = require("../../command");
7
9
  const context_1 = require("../../mutable/context");
8
10
  const context_2 = require("../context");
@@ -13,6 +15,7 @@ const useFormSave_1 = require("./useFormSave");
13
15
  const useFormSchema_1 = require("./useFormSchema");
14
16
  const useRecordId_1 = require("./useRecordId");
15
17
  function useFormControlContext() {
18
+ var _a;
16
19
  const schema = (0, useFormSchema_1.useDataFormSchema)();
17
20
  const form = (0, context_1.useContextSelector)(context_2.DataFormContext, (state) => state.form);
18
21
  const originalData = (0, useFormRecord_1.useFormRecord)();
@@ -20,8 +23,12 @@ function useFormControlContext() {
20
23
  const save = (0, useFormSave_1.useFormSave)();
21
24
  const refresh = (0, context_1.useContextSelector)(context_2.DataFormContext, (state) => state.refresh);
22
25
  const formInstance = (0, useFormInstance_1.useFormInstance)();
23
- const readonly = (0, useFormIsReadonly_1.useFormIsReadonly)();
26
+ const readonly = (_a = (0, useFormIsReadonly_1.useFormIsReadonly)()) !== null && _a !== void 0 ? _a : false;
24
27
  const data = formInstance.watch();
28
+ const router = (0, route_1.useRouter)();
29
+ const close = (0, react_1.useCallback)(() => {
30
+ router.back();
31
+ }, [router]);
25
32
  return {
26
33
  data,
27
34
  logicalName: schema.logicalName,
@@ -33,6 +40,7 @@ function useFormControlContext() {
33
40
  refresh,
34
41
  save,
35
42
  readonly,
43
+ close,
36
44
  };
37
45
  }
38
46
  function useMainFormCommandHandlerContext() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/app",
3
- "version": "0.0.17-alpha.22",
3
+ "version": "0.0.17-alpha.23",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -39,5 +39,5 @@
39
39
  "react-hook-form": "7.52.2",
40
40
  "yup": "^1.4.0"
41
41
  },
42
- "gitHead": "a6d5c09c93ce38a63c40db11e217000bb2276c99"
42
+ "gitHead": "ff177d1491eff81fa8ab0cdfc7e5e1d1b3edc18b"
43
43
  }