poi-plugin-kai-planner 1.0.0

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.
Files changed (54) hide show
  1. package/README.md +48 -0
  2. package/index.js +35 -0
  3. package/package.json +25 -0
  4. package/src/app/KaiPlannerApp.js +211 -0
  5. package/src/app/tabs/daily/DailyTab.js +439 -0
  6. package/src/app/tabs/debug/DebugTab.js +554 -0
  7. package/src/app/tabs/wishlist/CreatePlanForm.js +185 -0
  8. package/src/app/tabs/wishlist/WishlistTab.js +704 -0
  9. package/src/app/tabs/wishlist/components/MouseComboBox.js +185 -0
  10. package/src/app/tabs/wishlist/components/WishlistExpandedDetail.js +170 -0
  11. package/src/app/tabs/wishlist/components/WishlistTable.js +253 -0
  12. package/src/core/poi/secretaryName.js +64 -0
  13. package/src/data/indexes/buildArrangementIndex.js +103 -0
  14. package/src/data/loaders/loadStaticData.js +182 -0
  15. package/src/data/static/data_manifest.json +15 -0
  16. package/src/data/static/equip_base_cost.json +5000 -0
  17. package/src/data/static/equipment_upgrade_path.json +3555 -0
  18. package/src/data/static/improvement_arrangement.json +15677 -0
  19. package/src/data/static/improvement_consume_item.json +8933 -0
  20. package/src/data/static/improvement_consume_step.json +9284 -0
  21. package/src/data/static/improvement_upgrade_cost.json +4766 -0
  22. package/src/data/static/improvement_upgrade_target.json +2641 -0
  23. package/src/data/static/material.json +90 -0
  24. package/src/services/common/secretaryDisplay.js +42 -0
  25. package/src/services/daily/buildDailyViewModel.js +402 -0
  26. package/src/services/planner/buildUpgradePath.js +79 -0
  27. package/src/services/planner/calcImproveSteps.js +104 -0
  28. package/src/services/planner/calcRemainingPlan.js +169 -0
  29. package/src/services/planner/calcRoutePlan.js +85 -0
  30. package/src/services/planner/calcUpgradeStep.js +85 -0
  31. package/src/services/planner/detectCurrentPosition.js +57 -0
  32. package/src/services/planner/summarizeShortage.js +76 -0
  33. package/src/services/player/countPlayerEquipByMasterId.js +27 -0
  34. package/src/services/player/getEquipOwnerShip.js +66 -0
  35. package/src/services/player/getPlayerData.js +14 -0
  36. package/src/services/player/getPlayerItemCountByUseitemId.js +45 -0
  37. package/src/services/player/getReduxStateFromEnvWindow.js +12 -0
  38. package/src/services/player/resolveMaterialKeyToUseitemId.js +54 -0
  39. package/src/services/static/indexes/buildConsumeIndexes.js +28 -0
  40. package/src/services/static/indexes/buildPathIndexes.js +29 -0
  41. package/src/services/static/indexes/buildUpgradeIndexes.js +57 -0
  42. package/src/services/static/version/dataSourceConfig.js +25 -0
  43. package/src/services/static/version/dataUpdateManager.js +176 -0
  44. package/src/services/static/version/versionStore.js +205 -0
  45. package/src/services/utils/toInt.js +11 -0
  46. package/src/services/utils/tokyoTime.js +58 -0
  47. package/src/services/wishlist/buildWishlistViewModel.js +56 -0
  48. package/src/services/wishlist/dropdownInteraction.js +30 -0
  49. package/src/services/wishlist/wishlistActions.js +485 -0
  50. package/src/storage/userPlans/fileStore.js +106 -0
  51. package/src/storage/userPlans/localStorageStore.js +50 -0
  52. package/src/storage/userPlans/migrate.js +60 -0
  53. package/src/storage/userPlans/planStore.js +107 -0
  54. package/src/storage/userPlans/storeAdapter.js +77 -0
@@ -0,0 +1,185 @@
1
+ /* src/app/tabs/wishlist/CreatePlanForm.js */
2
+
3
+ const React = require("react");
4
+ const { MouseComboBox } = require("./components/MouseComboBox");
5
+ const {
6
+ EVENT_COMBO_CLOSE_ALL,
7
+ isInComboRoot,
8
+ } = require("../../../services/wishlist/dropdownInteraction");
9
+
10
+ function CreatePlanForm({
11
+ visible,
12
+ create,
13
+ createError,
14
+ improvable,
15
+ priorities,
16
+ targetOptions,
17
+ startOptions,
18
+ startOptionsTip,
19
+ targetInputValue,
20
+ startInputValue,
21
+ selectedTargetText,
22
+ selectedStartText,
23
+ onPatchCreate,
24
+ onSelectTarget,
25
+ onSelectStart,
26
+ onClearTarget,
27
+ onClearStart,
28
+ onSubmit,
29
+ onCancel,
30
+ }) {
31
+ if (!visible) return null;
32
+
33
+ const panelStyle = {
34
+ marginTop: 10,
35
+ padding: 10,
36
+ border: "1px solid rgba(255,255,255,0.12)",
37
+ borderRadius: 8,
38
+ background: "rgba(0,0,0,0.12)",
39
+ };
40
+ const formRow = { display: "flex", gap: 8, alignItems: "center", flexWrap: "wrap", marginTop: 8 };
41
+ const labelStyle = { width: 84, opacity: 0.88, fontWeight: 700 };
42
+ const inputStyle = {
43
+ padding: "6px 8px",
44
+ borderRadius: 8,
45
+ border: "1px solid rgba(255,255,255,0.12)",
46
+ background: "rgba(0,0,0,0.15)",
47
+ color: "#e5e7eb",
48
+ minWidth: 180,
49
+ };
50
+
51
+ return React.createElement(
52
+ "div",
53
+ {
54
+ style: panelStyle,
55
+ onMouseDownCapture: (e) => {
56
+ if (isInComboRoot(e && e.target)) return;
57
+ if (typeof document !== "undefined" && typeof CustomEvent === "function" && document.dispatchEvent) {
58
+ document.dispatchEvent(new CustomEvent(EVENT_COMBO_CLOSE_ALL));
59
+ }
60
+ },
61
+ },
62
+ React.createElement("div", { style: { fontWeight: 800 } }, "新增改修计划"),
63
+
64
+ React.createElement(
65
+ "div",
66
+ { style: formRow },
67
+ React.createElement("div", { style: labelStyle }, "目标装备:"),
68
+ React.createElement(MouseComboBox, {
69
+ inputStyle: { ...inputStyle, minWidth: 590 },
70
+ dropdownWidth: 590,
71
+ inputValue: targetInputValue,
72
+ placeholder: "搜索并选择目标装备(名称/equipId)",
73
+ onInputChange: (v) => onPatchCreate({ targetQuery: v }),
74
+ options: targetOptions,
75
+ emptyText: "无匹配目标装备",
76
+ onSelect: (value, option) => onSelectTarget(value, option),
77
+ }),
78
+ selectedTargetText
79
+ ? React.createElement(
80
+ "button",
81
+ {
82
+ type: "button",
83
+ onClick: () => onClearTarget && onClearTarget(),
84
+ style: {
85
+ border: "1px solid rgba(147,197,253,0.45)",
86
+ background: "rgba(59,130,246,0.14)",
87
+ color: "#93c5fd",
88
+ borderRadius: 8,
89
+ padding: "4px 8px",
90
+ cursor: "pointer",
91
+ },
92
+ title: "点击清空已选目标装备",
93
+ },
94
+ `已选:${selectedTargetText} ×`
95
+ )
96
+ : null
97
+ ),
98
+
99
+ React.createElement(
100
+ "div",
101
+ { style: formRow },
102
+ React.createElement("div", { style: labelStyle }, "改修星数:"),
103
+ React.createElement("input", {
104
+ style: { ...inputStyle, minWidth: 100, opacity: improvable ? 1 : 0.6 },
105
+ type: "number",
106
+ min: 0,
107
+ max: 10,
108
+ disabled: !improvable,
109
+ value: improvable ? create.targetLevel : "0",
110
+ onChange: (e) => onPatchCreate({ targetLevel: e.target.value }),
111
+ placeholder: "目标星数",
112
+ }),
113
+ React.createElement("div", { style: { ...labelStyle, width: 70 } }, "优先级:"),
114
+ React.createElement(
115
+ "select",
116
+ {
117
+ style: { ...inputStyle, minWidth: 100 },
118
+ value: create.priority,
119
+ onChange: (e) => onPatchCreate({ priority: e.target.value }),
120
+ },
121
+ priorities.map((p) => React.createElement("option", { key: p, value: p }, p))
122
+ )
123
+ ),
124
+
125
+ React.createElement(
126
+ "div",
127
+ { style: formRow },
128
+ React.createElement("div", { style: labelStyle }, "起点装备:"),
129
+ React.createElement(MouseComboBox, {
130
+ inputStyle: { ...inputStyle, minWidth: 590 },
131
+ dropdownWidth: 590,
132
+ disabled: !create.targetEquipId,
133
+ inputValue: startInputValue,
134
+ placeholder: create.targetEquipId ? "搜索并选择起点装备(名称/api_id/舰船名)" : "请先选择目标装备",
135
+ onInputChange: (v) => onPatchCreate({ startQuery: v }),
136
+ options: startOptions,
137
+ emptyText: "无匹配起点装备",
138
+ footerTip: startOptionsTip || "",
139
+ onSelect: (value, option) => onSelectStart(value, option),
140
+ }),
141
+ selectedStartText
142
+ ? React.createElement(
143
+ "button",
144
+ {
145
+ type: "button",
146
+ onClick: () => onClearStart && onClearStart(),
147
+ style: {
148
+ border: "1px solid rgba(147,197,253,0.45)",
149
+ background: "rgba(59,130,246,0.14)",
150
+ color: "#93c5fd",
151
+ borderRadius: 8,
152
+ padding: "4px 8px",
153
+ cursor: "pointer",
154
+ },
155
+ title: "点击清空已选起点装备",
156
+ },
157
+ `已选:${selectedStartText} ×`
158
+ )
159
+ : null
160
+ ),
161
+
162
+ React.createElement(
163
+ "div",
164
+ { style: formRow },
165
+ React.createElement("div", { style: labelStyle }, "备注:"),
166
+ React.createElement("input", {
167
+ style: { ...inputStyle, minWidth: 520 },
168
+ value: create.note,
169
+ onChange: (e) => onPatchCreate({ note: e.target.value }),
170
+ placeholder: "备注",
171
+ })
172
+ ),
173
+
174
+ React.createElement(
175
+ "div",
176
+ { style: { ...formRow, marginTop: 10 } },
177
+ React.createElement("button", { onClick: onSubmit }, "确认新增"),
178
+ React.createElement("button", { onClick: onCancel }, "取消")
179
+ ),
180
+
181
+ createError ? React.createElement("div", { style: { marginTop: 8, color: "#fca5a5" } }, createError) : null
182
+ );
183
+ }
184
+
185
+ module.exports = { CreatePlanForm };