@eintrek/erp-shell 0.1.71 → 0.1.72
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/README.md +6 -0
- package/dist/chunks/{guide-runtime-BTatpm-V.esm.js → guide-runtime-B-3myqxe.esm.js} +28 -4
- package/dist/chunks/guide-runtime-B-3myqxe.esm.js.map +1 -0
- package/dist/chunks/{guide-runtime-B_fYkQv7.cjs → guide-runtime-DfnNdrjZ.cjs} +28 -4
- package/dist/chunks/guide-runtime-DfnNdrjZ.cjs.map +1 -0
- package/dist/guide/machine.d.ts +9 -0
- package/dist/guide-core.cjs +1 -1
- package/dist/guide-core.esm.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.esm.js +3 -3
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/guide-runtime-BTatpm-V.esm.js.map +0 -1
- package/dist/chunks/guide-runtime-B_fYkQv7.cjs.map +0 -1
|
@@ -747,11 +747,34 @@ function announceStep(d, suite, env) {
|
|
|
747
747
|
const ctx = guideContext(env, d.state.progress.context, routeParamsFor(step, env));
|
|
748
748
|
const title = s.bridge ? COPY.bridgeTitle : plainTitle(resolveText(step.title, ctx));
|
|
749
749
|
const why = s.bridge ? COPY.bridgeWhy(suite.appName) : plainTitle(resolveText(step.why, ctx));
|
|
750
|
+
const pos = stepPosition(mission, s.index, env, d.state.progress.context);
|
|
750
751
|
d.effects.push({
|
|
751
752
|
type: "announce",
|
|
752
|
-
text: `ขั้นที่ ${
|
|
753
|
+
text: `ขั้นที่ ${pos.no} จาก ${pos.total}. ${title}${why ? `. ${why}` : ""}`,
|
|
753
754
|
});
|
|
754
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* "ขั้นที่ no จาก total" counting only the steps this person will see: a step
|
|
758
|
+
* whose `requires` they lack or whose `skipIf` holds is left out (the step on
|
|
759
|
+
* screen always counts).
|
|
760
|
+
*/
|
|
761
|
+
function stepPosition(mission, index, env, context) {
|
|
762
|
+
let no = 0;
|
|
763
|
+
let total = 0;
|
|
764
|
+
mission.steps.forEach((step, i) => {
|
|
765
|
+
if (i !== index) {
|
|
766
|
+
if (step.requires && !safe(() => env.can(step.requires), true))
|
|
767
|
+
return;
|
|
768
|
+
const ctx = guideContext(env, context, routeParamsFor(step, env));
|
|
769
|
+
if (step.skipIf && safe(() => step.skipIf(ctx), false))
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
total++;
|
|
773
|
+
if (i <= index)
|
|
774
|
+
no = total;
|
|
775
|
+
});
|
|
776
|
+
return { no: Math.max(no, 1), total: Math.max(total, 1) };
|
|
777
|
+
}
|
|
755
778
|
/** "กด [บันทึก]" → "กด บันทึก" (for screen readers). */
|
|
756
779
|
function plainTitle(t) {
|
|
757
780
|
return t.replace(/\[([^\]]+)\]/g, "$1");
|
|
@@ -3809,8 +3832,9 @@ function GuideRuntimeInner({ config, organizationId, code, routing, progress: pr
|
|
|
3809
3832
|
missionNo,
|
|
3810
3833
|
missionTitle: mission.title,
|
|
3811
3834
|
replay: screen.replay,
|
|
3812
|
-
|
|
3813
|
-
|
|
3835
|
+
// Steps this person skips (requires / skipIf) are not counted.
|
|
3836
|
+
index: stepPosition(mission, screen.index, env(), state.progress.context).no - 1,
|
|
3837
|
+
total: stepPosition(mission, screen.index, env(), state.progress.context).total,
|
|
3814
3838
|
title: bridge ? "กดปุ่มเมนู" : resolveText(step.title, stepCtx),
|
|
3815
3839
|
why: bridge ? `เมนูทั้งหมดของ ${suite.appName} อยู่ในนี้` : resolveText(step.why, stepCtx),
|
|
3816
3840
|
error: screen.error,
|
|
@@ -3884,4 +3908,4 @@ exports.reportApiCall = reportApiCall;
|
|
|
3884
3908
|
exports.reportApiEvent = reportApiEvent;
|
|
3885
3909
|
exports.storeGuides = storeGuides;
|
|
3886
3910
|
exports.useGuideEntry = useGuideEntry;
|
|
3887
|
-
//# sourceMappingURL=guide-runtime-
|
|
3911
|
+
//# sourceMappingURL=guide-runtime-DfnNdrjZ.cjs.map
|