@isi-ui7/bos7-shared 0.2.8 → 0.2.10
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/crud-types.d.ts +6 -0
- package/package.json +6 -5
- package/src/crud-components.tsx +21 -5
- package/src/crud-types.ts +6 -0
package/dist/crud-types.d.ts
CHANGED
|
@@ -51,6 +51,12 @@ export type CrudCustomActionSchema = {
|
|
|
51
51
|
/** API endpoint — string or function receiving row id. */
|
|
52
52
|
apiPath: string | ((id: string) => string);
|
|
53
53
|
method?: "POST" | "PATCH" | "PUT";
|
|
54
|
+
/**
|
|
55
|
+
* Direct action (no workflow): endpoint mengembalikan 2xx langsung (bukan
|
|
56
|
+
* 202 + instance_id). Tabel di-refresh segera tanpa workflow tracking.
|
|
57
|
+
* Dipakai untuk aksi operasional seperti employee terminate/reactivate.
|
|
58
|
+
*/
|
|
59
|
+
direct?: boolean;
|
|
54
60
|
};
|
|
55
61
|
export type CrudListSchema = {
|
|
56
62
|
title: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isi-ui7/bos7-shared",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "Shared auth7 and layout primitives for bos7 applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"./form-rules": "./src/form-rules.ts",
|
|
51
51
|
"./i18n": "./src/i18n.tsx",
|
|
52
52
|
"./workflow/use-crud-form": "./src/workflow/use-crud-form.ts",
|
|
53
|
-
"./styles": "./src/form-contract.css"
|
|
53
|
+
"./styles": "./src/form-contract.css",
|
|
54
|
+
"./form-value-schema": "./src/form-value-schema.ts"
|
|
54
55
|
},
|
|
55
56
|
"publishConfig": {
|
|
56
57
|
"registry": "https://registry.npmjs.org",
|
|
@@ -100,8 +101,8 @@
|
|
|
100
101
|
"@carbon/react": "^1.97.0",
|
|
101
102
|
"@carbon/icons-react": "^11.71.0",
|
|
102
103
|
"@isi-ui7/corporate-themes": "0.2.4",
|
|
103
|
-
"@isi-ui7/ui-shell": "0.2.4",
|
|
104
104
|
"@isi-ui7/i18n": "0.2.1",
|
|
105
|
+
"@isi-ui7/ui-shell": "0.2.4",
|
|
105
106
|
"@isi-ui7/modal-manager": "0.2.2",
|
|
106
107
|
"@isi-ui7/realtime": "0.2.3",
|
|
107
108
|
"@isi-ui7/data-table": "0.2.3",
|
|
@@ -120,8 +121,8 @@
|
|
|
120
121
|
"@opentelemetry/exporter-trace-otlp-http": "^0.57.0",
|
|
121
122
|
"@opentelemetry/auto-instrumentations-node": "^0.57.0",
|
|
122
123
|
"@isi-ui7/data-table": "0.2.3",
|
|
123
|
-
"@isi-ui7/
|
|
124
|
-
"@isi-ui7/
|
|
124
|
+
"@isi-ui7/editable-table": "0.2.3",
|
|
125
|
+
"@isi-ui7/lookup-input": "0.2.3"
|
|
125
126
|
},
|
|
126
127
|
"scripts": {
|
|
127
128
|
"build": "vite build",
|
package/src/crud-components.tsx
CHANGED
|
@@ -188,11 +188,27 @@ export function CrudSchemaListPage<TData extends Record<string, unknown>>({
|
|
|
188
188
|
setCustomActioning(true);
|
|
189
189
|
setCustomActionError(null);
|
|
190
190
|
try {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
if (schema.direct) {
|
|
192
|
+
// Direct action (no workflow): endpoint returns 2xx immediately.
|
|
193
|
+
const res = await fetch(path, {
|
|
194
|
+
method: schema.method ?? "POST",
|
|
195
|
+
headers: { "Content-Type": "application/json" },
|
|
196
|
+
body: JSON.stringify({}),
|
|
197
|
+
});
|
|
198
|
+
if (!res.ok) {
|
|
199
|
+
const body = (await res.json().catch(() => ({}))) as { error?: string };
|
|
200
|
+
throw new Error(body.error ?? `Gagal (HTTP ${res.status})`);
|
|
201
|
+
}
|
|
202
|
+
setCustomActionId(null);
|
|
203
|
+
setCustomActionRow(null);
|
|
204
|
+
setTableKey((v) => v + 1);
|
|
205
|
+
} else {
|
|
206
|
+
const instanceId = await submitWorkflowForm(path, schema.method ?? "POST", {});
|
|
207
|
+
setCustomActionId(null);
|
|
208
|
+
setCustomActionRow(null);
|
|
209
|
+
setTableKey((v) => v + 1);
|
|
210
|
+
tracker.track(instanceId);
|
|
211
|
+
}
|
|
196
212
|
} catch (e: unknown) {
|
|
197
213
|
setCustomActionError(e instanceof Error ? e.message : String(e));
|
|
198
214
|
} finally {
|
package/src/crud-types.ts
CHANGED
|
@@ -31,6 +31,12 @@ export type CrudCustomActionSchema = {
|
|
|
31
31
|
/** API endpoint — string or function receiving row id. */
|
|
32
32
|
apiPath: string | ((id: string) => string);
|
|
33
33
|
method?: "POST" | "PATCH" | "PUT";
|
|
34
|
+
/**
|
|
35
|
+
* Direct action (no workflow): endpoint mengembalikan 2xx langsung (bukan
|
|
36
|
+
* 202 + instance_id). Tabel di-refresh segera tanpa workflow tracking.
|
|
37
|
+
* Dipakai untuk aksi operasional seperti employee terminate/reactivate.
|
|
38
|
+
*/
|
|
39
|
+
direct?: boolean;
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
export type CrudListSchema = {
|