dsh-workbench-salary 0.3.0 → 0.4.1

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/lib/client.js CHANGED
@@ -39,331 +39,39 @@ var __copyProps = (to, from, except, desc) => {
39
39
  };
40
40
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
41
 
42
- // packages/addons/lib/client-base-styles.cjs
43
- var require_client_base_styles = __commonJS({
44
- "packages/addons/lib/client-base-styles.cjs"(exports2, module2) {
45
- "use strict";
46
- var SECRET_FIELD = [
47
- ".wb-secret-field{position:relative;display:flex;align-items:center;min-width:0}",
48
- ".wb-secret-field input{flex:1 1 auto;min-width:0;padding-right:34px}",
49
- ".wb-eye{position:absolute;right:4px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:6px;padding:4px;color:var(--wb-muted,#6b7280);cursor:pointer}",
50
- ".wb-eye:hover:not(:disabled){color:var(--wb-accent,#2563eb);background:color-mix(in srgb, var(--wb-accent,#2563eb) 12%, transparent)}",
51
- ".wb-eye:focus-visible{outline:2px solid var(--wb-accent,#2563eb);outline-offset:1px}",
52
- ".wb-eye:disabled{opacity:.45;cursor:not-allowed}"
53
- ];
54
- module2.exports = function baseStyles(prefix) {
55
- var p = String(prefix || "wb");
56
- var s = "." + p;
57
- return SECRET_FIELD.concat([
58
- s + "-wrap{display:flex;flex-direction:column;gap:12px;padding:16px;overflow:auto;height:100%;box-sizing:border-box}",
59
- s + "-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}",
60
- s + "-title{font-size:16px;font-weight:650;margin:0}",
61
- s + "-sub{font-size:12px;color:var(--wb-muted,#6b7280);margin:2px 0 0}",
62
- s + "-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}",
63
- s + "-card{border:1px solid var(--wb-border,#e5e7eb);border-radius:10px;background:var(--wb-surface,#fff);padding:12px}",
64
- s + "-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}",
65
- s + "-kpi{font-size:22px;font-weight:700;line-height:1.2}" + s + "-kpi-label{font-size:12px;color:var(--wb-muted,#6b7280)}",
66
- s + "-table{width:100%;border-collapse:collapse;font-size:12px}" + s + "-table th," + s + "-table td{padding:7px 8px;border-bottom:1px solid var(--wb-border,#eef0f3);text-align:left;vertical-align:top}",
67
- s + "-table th{font-weight:600;color:var(--wb-muted,#6b7280);white-space:nowrap}",
68
- s + "-btn{border:1px solid var(--wb-border,#d1d5db);background:var(--wb-surface,#fff);color:inherit;border-radius:7px;padding:5px 10px;font-size:12px;cursor:pointer}",
69
- s + "-btn:hover:not(:disabled){border-color:var(--wb-accent,#2563eb)}" + s + "-btn:disabled{opacity:.5;cursor:default}",
70
- s + "-btn.primary{background:var(--wb-accent,#2563eb);border-color:var(--wb-accent,#2563eb);color:#fff}",
71
- s + "-btn.danger{color:#b91c1c;border-color:#fecaca}",
72
- s + "-field{display:flex;flex-direction:column;gap:4px;font-size:12px}" + s + "-label{font-weight:600}",
73
- s + "-field input," + s + "-field select," + s + "-field textarea{border:1px solid var(--wb-border,#d1d5db);border-radius:7px;padding:6px 8px;font:inherit;background:var(--wb-surface,#fff);color:inherit;min-width:0}",
74
- s + "-hint{color:var(--wb-muted,#6b7280);font-size:11px}" + s + "-notice{padding:8px 10px;border-radius:8px;font-size:12px;background:#eff6ff;color:#1e40af}",
75
- s + "-notice.error{background:#fef2f2;color:#b91c1c}" + s + "-notice.ok{background:#ecfdf5;color:#047857}",
76
- s + "-empty{padding:18px;text-align:center;color:var(--wb-muted,#6b7280);font-size:12px;border:1px dashed var(--wb-border,#e5e7eb);border-radius:8px}",
77
- s + "-pill{display:inline-block;padding:1px 7px;border-radius:999px;font-size:11px;background:#f3f4f6;color:#374151}",
78
- s + "-pill.ok{background:#ecfdf5;color:#047857}" + s + "-pill.error{background:#fef2f2;color:#b91c1c}" + s + "-pill.warn{background:#fffbeb;color:#b45309}",
79
- s + "-json{margin:0;padding:8px;background:#f8fafc;border-radius:8px;font-size:11px;max-height:240px;overflow:auto}",
80
- s + "-muted{color:var(--wb-muted,#6b7280)}" + s + "-link{color:var(--wb-accent,#2563eb);cursor:pointer;text-decoration:none}",
81
- s + "-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px}"
82
- ]);
83
- };
84
- module2.exports.secretFieldStyles = SECRET_FIELD;
85
- }
86
- });
87
-
88
- // packages/addons/lib/date-picker-styles.cjs
89
- var require_date_picker_styles = __commonJS({
90
- "packages/addons/lib/date-picker-styles.cjs"(exports2, module2) {
91
- "use strict";
92
- module2.exports = function datePickerStyles(prefix) {
93
- var p = String(prefix || "wb");
94
- return [
95
- ".{p}-dp,.{p}-dr{position:relative;min-width:0}",
96
- ".{p}-dp-field{display:flex;align-items:center;gap:6px;min-width:0}",
97
- ".{p}-dp-trigger{display:flex;align-items:center;gap:8px;min-width:0;width:100%;padding:8px 10px;border:1px solid var(--wb-border);border-radius:8px;background:var(--wb-surface);color:var(--wb-text,inherit);font:inherit;text-align:left;cursor:pointer;transition:border-color .15s,box-shadow .15s}",
98
- ".{p}-dp-trigger:hover{border-color:var(--wb-accent)}",
99
- ".{p}-dp-trigger:focus-visible{outline:2px solid var(--wb-accent);outline-offset:1px}",
100
- ".{p}-dp-trigger[disabled]{opacity:.55;cursor:not-allowed}",
101
- ".{p}-dp-glyph{width:13px;height:13px;flex:none;border:1.5px solid currentColor;border-radius:3px;position:relative;opacity:.72}",
102
- '.{p}-dp-glyph::before{content:"";position:absolute;left:-1.5px;right:-1.5px;top:3px;border-top:1.5px solid currentColor}',
103
- '.{p}-dp-glyph::after{content:"";position:absolute;left:3px;top:-3px;width:1.5px;height:3px;background:currentColor;box-shadow:4px 0 currentColor}',
104
- ".{p}-dp-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums}",
105
- ".{p}-dp-value.is-empty{color:var(--wb-muted)}",
106
- ".{p}-dp-clear{flex:none;width:22px;height:22px;padding:0;border:0;border-radius:50%;background:color-mix(in srgb,var(--wb-muted) 14%,transparent);color:var(--wb-muted);font:inherit;line-height:1;cursor:pointer}",
107
- ".{p}-dp-clear:hover{color:var(--wb-danger);background:color-mix(in srgb,var(--wb-danger) 16%,transparent)}",
108
- ".{p}-dp-pop{position:absolute;z-index:40;top:calc(100% + 6px);left:0;width:272px;padding:10px;border:1px solid var(--wb-border);border-radius:12px;background:var(--wb-card);box-shadow:0 16px 40px color-mix(in srgb,var(--wb-text,var(--wb-border)) 18%,transparent);animation:{p}-dp-in .14s ease-out}",
109
- ".{p}-dp-head{display:flex;align-items:center;gap:6px;margin-bottom:8px}",
110
- ".{p}-dp-title{flex:1;text-align:center;font-size:13px;font-weight:600;font-variant-numeric:tabular-nums}",
111
- ".{p}-dp-nav{width:26px;height:26px;padding:0;border:1px solid var(--wb-border);border-radius:7px;background:transparent;color:inherit;font:inherit;line-height:1;cursor:pointer}",
112
- ".{p}-dp-nav:hover{border-color:var(--wb-accent);color:var(--wb-accent)}",
113
- ".{p}-dp-weekdays,.{p}-dp-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px}",
114
- ".{p}-dp-weekdays{margin-bottom:4px;font-size:11px;color:var(--wb-muted);text-align:center}",
115
- ".{p}-dp-day{min-width:0;height:30px;padding:0;border:0;border-radius:7px;background:transparent;color:inherit;font:inherit;font-variant-numeric:tabular-nums;cursor:pointer}",
116
- ".{p}-dp-day:hover{background:color-mix(in srgb,var(--wb-accent) 12%,transparent)}",
117
- ".{p}-dp-day.is-between{background:color-mix(in srgb,var(--wb-accent) 16%,transparent);border-radius:0}",
118
- ".{p}-dp-day.is-today{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--wb-accent) 55%,transparent)}",
119
- ".{p}-dp-day.is-on{background:var(--wb-accent);color:var(--wb-on-accent,inherit);font-weight:600}",
120
- ".{p}-dp-day:disabled{opacity:.35;cursor:not-allowed}",
121
- ".{p}-dp-day:focus-visible{outline:2px solid var(--wb-accent);outline-offset:-2px}",
122
- ".{p}-dp-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px;padding-top:8px;border-top:1px solid var(--wb-line)}",
123
- ".{p}-dp-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}",
124
- ".{p}-dp-link{padding:4px 8px;border:0;border-radius:6px;background:color-mix(in srgb,var(--wb-muted) 12%,transparent);color:inherit;font:inherit;font-size:12px;cursor:pointer}",
125
- ".{p}-dp-link:hover{background:color-mix(in srgb,var(--wb-accent) 16%,transparent);color:var(--wb-accent)}",
126
- ".{p}-dp-hint{margin:6px 0 0;font-size:11px;color:var(--wb-muted)}",
127
- ".{p}-dp-pop.is-months{width:248px}",
128
- ".{p}-dp-months{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin-bottom:6px}",
129
- ".{p}-dp-months .{p}-dp-day{height:34px}",
130
- "@keyframes {p}-dp-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}"
131
- ].join("\n").replace(/\{p\}/g, p);
132
- };
133
- }
134
- });
135
-
136
- // packages/addons/salary/client/ui/styles.cjs
137
- var require_styles = __commonJS({
138
- "packages/addons/salary/client/ui/styles.cjs"(exports2, module2) {
42
+ // packages/addons/lib/icons.cjs
43
+ var require_icons = __commonJS({
44
+ "packages/addons/lib/icons.cjs"(exports2, module2) {
139
45
  "use strict";
140
- var BASE = require_client_base_styles()("wbsal");
141
- var PAGE = [
142
- /* 页面骨架 */
143
- ".wbsal-page{display:flex;flex-direction:column;gap:18px;padding:22px 24px 48px;box-sizing:border-box;width:100%;min-height:100%}",
144
- ".wbsal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}",
145
- ".wbsal-head-main{display:flex;flex-direction:column;gap:4px;min-width:0}",
146
- ".wbsal-eyebrow{font-size:10.5px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--wb-muted,#8b94a6)}",
147
- ".wbsal-head h2,.wbsal-page h2{font-size:21px;font-weight:650;margin:0;letter-spacing:-.01em;color:var(--wb-text,inherit)}",
148
- ".wbsal-sub{margin:0;font-size:12.5px;color:var(--wb-muted,#8b94a6)}",
149
- ".wbsal-head-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
150
- ".wbsal-toolbar{display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap;padding:12px 14px;border:1px solid var(--wb-border,#e2e6ec);border-radius:12px;background:var(--wb-surface,#fff)}",
151
- ".wbsal-toolbar .wbsal-field{gap:5px}",
152
- ".wbsal-toolbar-count{margin-left:auto;font-size:12px;color:var(--wb-muted,#8b94a6)}",
153
- ".wbsal-toolbar-count b{font-variant-numeric:tabular-nums;color:var(--wb-text,inherit)}",
154
- ".wbsal-toolbar-plain{background:transparent;border:0;padding:0;justify-content:flex-end}",
155
- ".wbsal-toolbar-end{margin-left:auto;display:flex;align-items:center;gap:10px;flex-wrap:wrap}",
156
- ".wbsal-toolbar-end .wbsal-toolbar-count{margin-left:0}",
157
- /* KPI */
158
- ".wbsal-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(186px,1fr));gap:12px}",
159
- ".wbsal-card{border:1px solid var(--wb-border,#e2e6ec);border-radius:12px;padding:14px 16px;background:var(--wb-card,#fff);box-sizing:border-box;min-width:0}",
160
- ".wbsal-kpi{display:flex;flex-direction:column;gap:2px}",
161
- ".wbsal-kpi-head{display:flex;align-items:center;gap:7px;margin-bottom:6px}",
162
- ".wbsal-kpi-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:8px;background:color-mix(in srgb,var(--wb-accent,#2563eb) 12%,transparent);color:var(--wb-accent,#2563eb);flex:0 0 auto}",
163
- ".wbsal-kpi span{display:block;font-size:12px;color:var(--wb-muted,#8b94a6)}",
164
- ".wbsal-kpi strong{display:block;font-size:24px;font-weight:680;font-variant-numeric:tabular-nums;line-height:1.15;letter-spacing:-.01em;color:var(--wb-text,inherit)}",
165
- ".wbsal-kpi em{display:block;font-size:11.5px;font-style:normal;color:var(--wb-muted,#8b94a6);margin-top:4px}",
166
- ".wbsal-kpi em b{font-weight:600;color:var(--wb-ok,#15803d);font-variant-numeric:tabular-nums}",
167
- ".wbsal-kpi em b.neg{color:var(--wb-danger,#b91c1c)}",
168
- /* 按钮与输入 */
169
- ".wbsal-btn{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--wb-border,#d1d5db);background:var(--wb-surface,#fff);color:var(--wb-text,inherit);border-radius:9px;padding:6px 12px;font-size:12.5px;line-height:1.4;cursor:pointer;transition:border-color .12s,background .12s,color .12s}",
170
- ".wbsal-btn:hover:not(:disabled){border-color:var(--wb-accent,#2563eb);color:var(--wb-accent,#2563eb)}",
171
- ".wbsal-btn:disabled{opacity:.5;cursor:default}",
172
- ".wbsal-btn.primary{background:var(--wb-accent,#2563eb);border-color:var(--wb-accent,#2563eb);color:#fff}",
173
- ".wbsal-btn.primary:hover:not(:disabled){filter:brightness(1.06);color:#fff}",
174
- ".wbsal-btn.danger{color:var(--wb-danger,#b91c1c);border-color:color-mix(in srgb,var(--wb-danger,#b91c1c) 35%,transparent)}",
175
- ".wbsal-btn.danger:hover:not(:disabled){background:color-mix(in srgb,var(--wb-danger,#b91c1c) 10%,transparent);color:var(--wb-danger,#b91c1c)}",
176
- ".wbsal-btn.ghost{border-color:transparent;background:color-mix(in srgb,var(--wb-muted,#8b94a6) 11%,transparent);color:var(--wb-text,inherit)}",
177
- ".wbsal-btn.ghost:hover:not(:disabled){background:color-mix(in srgb,var(--wb-accent,#2563eb) 12%,transparent);color:var(--wb-accent,#2563eb)}",
178
- ".wbsal-input{border:1px solid var(--wb-border,#d1d5db);border-radius:8px;padding:7px 9px;font:inherit;font-size:12.5px;background:var(--wb-surface,#fff);color:var(--wb-text,inherit);min-width:88px;box-sizing:border-box}",
179
- ".wbsal-input:focus{outline:2px solid color-mix(in srgb,var(--wb-accent,#2563eb) 45%,transparent);outline-offset:1px;border-color:var(--wb-accent,#2563eb)}",
180
- ".wbsal-field{display:flex;flex-direction:column;gap:4px;font-size:12px;min-width:0}",
181
- ".wbsal-label{font-size:11.5px;font-weight:600;color:var(--wb-muted,#8b94a6)}",
182
- ".wbsal-hint{font-size:11px;color:var(--wb-muted,#8b94a6)}",
183
- ".wbsal-muted{font-size:12px;color:var(--wb-muted,#8b94a6)}",
184
- ".wbsal-danger{color:var(--wb-danger,#b91c1c);font-size:12px}",
185
- /* 月份分组 + 记录表 */
186
- ".wbsal-months{display:flex;flex-direction:column;gap:10px}",
187
- ".wbsal-month{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:2px 2px 0}",
188
- ".wbsal-month-title{display:flex;align-items:baseline;gap:8px}",
189
- ".wbsal-month-title strong{font-size:13.5px;font-weight:650;color:var(--wb-text,inherit)}",
190
- ".wbsal-month-title span{font-size:11.5px;color:var(--wb-muted,#8b94a6)}",
191
- ".wbsal-month-total{font-size:12px;color:var(--wb-muted,#8b94a6)}",
192
- ".wbsal-month-total b{font-size:13px;color:var(--wb-text,inherit);font-variant-numeric:tabular-nums;margin-left:4px}",
193
- ".wbsal-table-wrap{border:1px solid var(--wb-border,#e2e6ec);border-radius:12px;background:var(--wb-card,#fff);overflow:hidden}",
194
- ".wbsal-table{width:100%;border-collapse:collapse;font-size:12.5px}",
195
- ".wbsal-table th,.wbsal-table td{padding:10px 14px;text-align:right;border-bottom:1px solid var(--wb-line,#eef0f4);font-variant-numeric:tabular-nums;white-space:nowrap}",
196
- ".wbsal-table th{font-size:11px;font-weight:600;letter-spacing:.04em;color:var(--wb-muted,#8b94a6);background:var(--wb-surface,#fff);padding-top:9px;padding-bottom:9px}",
197
- ".wbsal-table th:first-child,.wbsal-table td:first-child,.wbsal-table th.left,.wbsal-table td.left{text-align:left}",
198
- ".wbsal-table tbody tr:last-child td{border-bottom:0}",
199
- ".wbsal-record td{height:44px}",
200
- ".wbsal-record-row{cursor:pointer;transition:background .12s}",
201
- ".wbsal-record-row:hover td{background:color-mix(in srgb,var(--wb-accent,#2563eb) 5%,transparent)}",
202
- ".wbsal-record-row.open td{background:color-mix(in srgb,var(--wb-accent,#2563eb) 7%,transparent)}",
203
- ".wbsal-date{display:flex;align-items:baseline;gap:7px}",
204
- ".wbsal-date b{font-weight:600;font-variant-numeric:tabular-nums}",
205
- ".wbsal-date span{font-size:11.5px;color:var(--wb-muted,#8b94a6)}",
206
- ".wbsal-net{font-weight:680;font-size:13px;color:var(--wb-text,inherit)}",
207
- ".wbsal-opt{color:var(--wb-muted,#8b94a6)}",
208
- ".wbsal-caret{display:inline-block;width:14px;color:var(--wb-muted,#8b94a6);transition:transform .15s}",
209
- ".wbsal-record-row.open .wbsal-caret{transform:rotate(90deg)}",
210
- ".wbsal-detail-cell{padding:0 14px 16px !important;background:color-mix(in srgb,var(--wb-accent,#2563eb) 4%,transparent)}",
211
- ".wbsal-detail{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px 24px}",
212
- ".wbsal-detail-block{display:flex;flex-direction:column;gap:6px;min-width:0}",
213
- ".wbsal-group-title{font-size:11px;font-weight:600;letter-spacing:.04em;color:var(--wb-muted,#8b94a6);text-transform:uppercase}",
214
- ".wbsal-fields{display:flex;flex-direction:column;gap:5px;font-size:12px}",
215
- ".wbsal-fields div{display:flex;align-items:baseline;justify-content:space-between;gap:10px;padding-bottom:4px;border-bottom:1px dashed var(--wb-line,#eef0f4)}",
216
- ".wbsal-fields div:last-child{border-bottom:0}",
217
- ".wbsal-fields span{color:var(--wb-muted,#8b94a6)}",
218
- ".wbsal-fields b{font-weight:600;font-variant-numeric:tabular-nums}",
219
- ".wbsal-field-sum b{font-size:13.5px}",
220
- ".wbsal-detail-foot{grid-column:1/-1;display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:space-between;border-top:1px solid var(--wb-line,#eef0f4);padding-top:10px}",
221
- ".wbsal-detail-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
222
- ".wbsal-confirm{display:inline-flex;align-items:center;gap:8px;padding:3px 8px 3px 10px;border-radius:999px;background:color-mix(in srgb,var(--wb-danger,#b91c1c) 10%,transparent)}",
223
- /* 表单 */
224
- ".wbsal-form{display:flex;flex-direction:column;gap:16px}",
225
- ".wbsal-mask{position:fixed;inset:0;z-index:60;display:flex;align-items:flex-start;justify-content:center;padding:38px 18px;overflow:auto;background:transparent;backdrop-filter:brightness(.62) blur(3px);-webkit-backdrop-filter:brightness(.62) blur(3px)}",
226
- "@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.wbsal-mask{background:color-mix(in oklab,currentColor 34%,transparent)}}",
227
- ".wbsal-modal{width:min(960px,100%);margin:auto 0;animation:wbsal-pop .16s ease-out}",
228
- "@keyframes wbsal-pop{from{opacity:0;transform:translateY(10px) scale(.99)}to{opacity:1;transform:none}}",
229
- ".wbsal-form-modal{margin-top:0;max-height:calc(100vh - 76px);overflow:auto;box-shadow:0 24px 64px color-mix(in oklab,currentColor 22%,transparent)}",
230
- ".wbsal-form-modal .wbsal-form-head{position:sticky;top:-14px;z-index:1;margin:-14px -16px 0;padding:14px 16px;background:var(--wb-card,#fff);border-bottom:1px solid var(--wb-line,#eef0f4)}",
231
- ".wbsal-form-head{display:flex;align-items:center;justify-content:space-between;gap:10px}",
232
- ".wbsal-form-head h3{font-size:14px;font-weight:650;margin:0}",
233
- ".wbsal-form-meta{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}",
234
- ".wbsal-form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px 12px}",
235
- ".wbsal-form-group{display:flex;flex-direction:column;gap:8px;padding-top:12px;border-top:1px solid var(--wb-line,#eef0f4)}",
236
- ".wbsal-form-group:first-of-type{border-top:0;padding-top:0}",
237
- ".wbsal-group-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}",
238
- ".wbsal-group-head span{font-size:11px;color:var(--wb-muted,#8b94a6)}",
239
- ".wbsal-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px;padding:14px;border:1px solid var(--wb-border,#e2e6ec);border-radius:12px;background:color-mix(in srgb,var(--wb-accent,#2563eb) 5%,transparent)}",
240
- ".wbsal-summary div span{display:block;font-size:11px;color:var(--wb-muted,#8b94a6);margin-bottom:3px}",
241
- ".wbsal-summary div b{font-size:15px;font-variant-numeric:tabular-nums;font-weight:650}",
242
- ".wbsal-summary .wbsal-lock{grid-column:1/-1;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
243
- ".wbsal-form-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}",
244
- /* 统计 */
245
- ".wbsal-seg{display:inline-flex;align-items:center;gap:6px;padding:4px;border:1px solid var(--wb-border,#e2e6ec);border-radius:10px;background:var(--wb-surface,#fff)}",
246
- ".wbsal-seg .wbsal-btn{border-color:transparent;background:transparent}",
247
- ".wbsal-seg .wbsal-btn.primary{background:var(--wb-accent,#2563eb);color:#fff}",
248
- ".wbsal-seg-year{font-size:13px;font-weight:650;font-variant-numeric:tabular-nums;min-width:64px;text-align:center}",
249
- ".wbsal-section{display:flex;flex-direction:column;gap:12px}",
250
- ".wbsal-section-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}",
251
- ".wbsal-section-head h3{font-size:13.5px;font-weight:650;margin:0}",
252
- ".wbsal-section-head span{font-size:11.5px;color:var(--wb-muted,#8b94a6)}",
253
- ".wbsal-section-tools{display:flex;align-items:center;gap:12px;flex-wrap:wrap}",
254
- // 图表口径切换:与任务插件统计页一致的分段式小控件,选中态用 aria-pressed 表达。
255
- ".wbsal-metric{display:inline-flex;align-items:center;gap:2px;padding:2px;border:1px solid var(--wb-border,#e2e6ec);border-radius:8px;background:var(--wb-surface,#fff)}",
256
- ".wbsal-metric button{appearance:none;border:0;background:transparent;color:var(--wb-muted,#8b94a6);font:inherit;font-size:11.5px;padding:4px 8px;border-radius:6px;cursor:pointer;white-space:nowrap}",
257
- ".wbsal-metric button:hover{background:color-mix(in srgb,var(--wb-muted) 12%,transparent);color:var(--wb-text,#20242c)}",
258
- ".wbsal-metric button.on,.wbsal-metric button[aria-pressed=true]{background:var(--wb-accent,#2563eb);color:var(--wb-on-accent,#fff);font-weight:600}",
259
- ".wbsal-metric button:focus-visible{outline:2px solid var(--wb-accent,#2563eb);outline-offset:1px}",
260
- ".wbsal-chart{display:flex;align-items:flex-end;gap:8px;height:210px;padding:8px 2px 0;border-bottom:1px solid var(--wb-line,#eef0f4)}",
261
- ".wbsal-bar{flex:1 1 0;min-width:14px;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:5px;height:100%}",
262
- ".wbsal-bar-value{font-size:10.5px;line-height:1;color:var(--wb-muted,#8b94a6);font-variant-numeric:tabular-nums;white-space:nowrap}",
263
- ".wbsal-bar-fill{width:72%;max-width:42px;border-radius:6px 6px 2px 2px;background:color-mix(in srgb,var(--wb-accent,#2563eb) 38%,transparent);transition:background .12s}",
264
- ".wbsal-bar-fill.top{background:var(--wb-accent,#2563eb)}",
265
- ".wbsal-bar:hover .wbsal-bar-fill{background:color-mix(in srgb,var(--wb-accent,#2563eb) 70%,transparent)}",
266
- ".wbsal-axis{display:flex;gap:8px;padding-top:7px}",
267
- ".wbsal-axis span{flex:1 1 0;text-align:center;font-size:10.5px;color:var(--wb-muted,#8b94a6);font-variant-numeric:tabular-nums}",
268
- ".wbsal-chart-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:11.5px;color:var(--wb-muted,#8b94a6)}",
269
- ".wbsal-legend{display:inline-flex;align-items:center;gap:6px}",
270
- ".wbsal-legend i{width:8px;height:8px;border-radius:2px;background:var(--wb-accent,#2563eb);display:inline-block}",
271
- ".wbsal-legend i.soft{background:color-mix(in srgb,var(--wb-accent,#2563eb) 38%,transparent)}",
272
- ".wbsal-series{display:flex;align-items:center;gap:6px;flex-wrap:wrap}",
273
- ".wbsal-series button{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border:1px solid var(--wb-border,#e2e6ee);border-radius:999px;background:var(--wb-surface,#fff);color:var(--wb-fg,inherit);font-size:12px;line-height:1;cursor:pointer;transition:opacity .12s,border-color .12s,background .12s}",
274
- ".wbsal-series button:hover{border-color:color-mix(in srgb,var(--wb-accent,#2563eb) 45%,var(--wb-border,#e2e6ee))}",
275
- ".wbsal-series button.off{opacity:.45;color:var(--wb-muted,#8b94a6)}",
276
- ".wbsal-series button.off i{filter:grayscale(1)}",
277
- ".wbsal-series i{width:14px;height:3px;border-radius:2px;display:inline-block;background:var(--wb-muted,#8b94a6)}",
278
- ".wbsal-series i.s1,.wbsal-line-dot.s1{background:var(--wb-accent,#2563eb)}",
279
- ".wbsal-series i.s2,.wbsal-line-dot.s2{background:var(--wb-ok,#16a34a)}",
280
- ".wbsal-series i.s3,.wbsal-line-dot.s3{background:var(--wb-warn,#d97706)}",
281
- ".wbsal-series i.s4,.wbsal-line-dot.s4{background:color-mix(in oklab,var(--wb-accent,#2563eb) 45%,var(--wb-danger,#dc2626))}",
282
- ".wbsal-series i.s5,.wbsal-line-dot.s5{background:color-mix(in oklab,var(--wb-ok,#16a34a) 55%,var(--wb-accent,#2563eb))}",
283
- ".wbsal-series i.s6,.wbsal-line-dot.s6{background:color-mix(in oklab,var(--wb-warn,#d97706) 60%,var(--wb-danger,#dc2626))}",
284
- ".wbsal-series i.sum,.wbsal-line-dot.sum{background:color-mix(in oklab,var(--wb-muted,#8b94a6) 45%,var(--wb-accent,#2563eb))}",
285
- ".wbsal-line.sum{stroke:color-mix(in oklab,var(--wb-muted,#8b94a6) 45%,var(--wb-accent,#2563eb));stroke-dasharray:7 4}",
286
- ".wbsal-line-dot.sum{fill:color-mix(in oklab,var(--wb-muted,#8b94a6) 45%,var(--wb-accent,#2563eb))}",
287
- ".wbsal-linechart{width:100%;padding:10px 2px 0;position:relative}",
288
- ".wbsal-hit{fill:transparent;cursor:crosshair}",
289
- ".wbsal-hit-area{fill:transparent}",
290
- ".wbsal-crosshair{stroke:color-mix(in srgb,var(--wb-accent,#2563eb) 55%,transparent);stroke-width:1;stroke-dasharray:3 3;vector-effect:non-scaling-stroke}",
291
- ".wbsal-line-dot.is-hot{stroke:var(--wb-card,#fff);stroke-width:2}",
292
- ".wbsal-tip{position:absolute;top:6px;transform:translateX(-50%);z-index:3;pointer-events:none;min-width:170px;padding:9px 11px;border:1px solid var(--wb-border,#e2e6ee);border-radius:10px;background:var(--wb-card,#fff);box-shadow:0 8px 22px rgba(15,23,42,.16)}",
293
- ".wbsal-tip.is-right{transform:translateX(-100%)}",
294
- ".wbsal-tip strong{display:block;font-size:12px;color:var(--wb-muted,#8b94a6);font-weight:600;margin-bottom:6px}",
295
- ".wbsal-tip-row{display:flex;align-items:center;gap:7px;font-size:12px;line-height:1.7}",
296
- ".wbsal-tip-row i{width:14px;height:3px;border-radius:2px;background:var(--wb-muted,#8b94a6);flex:0 0 auto}",
297
- ".wbsal-tip-row span{color:var(--wb-muted,#8b94a6)}",
298
- ".wbsal-tip-row b{margin-left:auto;font-variant-numeric:tabular-nums;font-weight:650}",
299
- ".wbsal-tip-row i.s1{background:var(--wb-accent,#2563eb)}",
300
- ".wbsal-tip-row i.s2{background:var(--wb-ok,#16a34a)}",
301
- ".wbsal-tip-row i.s3{background:var(--wb-warn,#d97706)}",
302
- ".wbsal-tip-row i.s4{background:color-mix(in oklab,var(--wb-accent,#2563eb) 45%,var(--wb-danger,#dc2626))}",
303
- ".wbsal-tip-row i.s5{background:color-mix(in oklab,var(--wb-ok,#16a34a) 55%,var(--wb-accent,#2563eb))}",
304
- ".wbsal-tip-row i.s6{background:color-mix(in oklab,var(--wb-warn,#d97706) 60%,var(--wb-danger,#dc2626))}",
305
- ".wbsal-tip-row i.sum{background:color-mix(in oklab,var(--wb-muted,#8b94a6) 45%,var(--wb-accent,#2563eb))}",
306
- ".wbsal-tip em{display:block;margin-top:5px;font-size:11px;font-style:normal;color:var(--wb-muted,#8b94a6)}",
307
- ".wbsal-chart-hint{margin-top:8px;padding:10px 12px;border-radius:8px;background:color-mix(in srgb,var(--wb-muted,#8b94a6) 10%,transparent);color:var(--wb-muted,#8b94a6);font-size:12px}",
308
- ".wbsal-social-foot{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:14px;flex-wrap:wrap}",
309
- ".wbsal-linechart svg{display:block;width:100%;height:auto;overflow:visible}",
310
- ".wbsal-linechart text{fill:var(--wb-muted,#8b94a6);font-size:11px;font-variant-numeric:tabular-nums}",
311
- ".wbsal-line-gridline{stroke:var(--wb-line,#eef0f4);stroke-width:1;vector-effect:non-scaling-stroke}",
312
- ".wbsal-line{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}",
313
- ".wbsal-line.s1{stroke:var(--wb-accent,#2563eb)}",
314
- ".wbsal-line.s2{stroke:var(--wb-ok,#16a34a)}",
315
- ".wbsal-line.s3{stroke:var(--wb-warn,#d97706)}",
316
- ".wbsal-line.s4{stroke:color-mix(in oklab,var(--wb-accent,#2563eb) 45%,var(--wb-danger,#dc2626))}",
317
- ".wbsal-line.s5{stroke:color-mix(in oklab,var(--wb-ok,#16a34a) 55%,var(--wb-accent,#2563eb))}",
318
- ".wbsal-line.s6{stroke:color-mix(in oklab,var(--wb-warn,#d97706) 60%,var(--wb-danger,#dc2626))}",
319
- ".wbsal-line-dot{stroke:none}",
320
- ".wbsal-line-dot.s1{fill:var(--wb-accent,#2563eb)}",
321
- ".wbsal-line-dot.s2{fill:var(--wb-ok,#16a34a)}",
322
- ".wbsal-line-dot.s3{fill:var(--wb-warn,#d97706)}",
323
- ".wbsal-line-dot.s4{fill:color-mix(in oklab,var(--wb-accent,#2563eb) 45%,var(--wb-danger,#dc2626))}",
324
- ".wbsal-line-dot.s5{fill:color-mix(in oklab,var(--wb-ok,#16a34a) 55%,var(--wb-accent,#2563eb))}",
325
- ".wbsal-line-dot.s6{fill:color-mix(in oklab,var(--wb-warn,#d97706) 60%,var(--wb-danger,#dc2626))}",
326
- ".wbsal-comp{display:flex;flex-direction:column;gap:7px}",
327
- ".wbsal-comp-row{display:grid;grid-template-columns:92px minmax(60px,1fr) 132px;gap:10px;align-items:center;font-size:12px}",
328
- ".wbsal-comp-row span:first-child{color:var(--wb-text,inherit)}",
329
- ".wbsal-comp-track{height:7px;border-radius:999px;background:var(--wb-line,#eef0f4);overflow:hidden}",
330
- ".wbsal-comp-fill{height:100%;border-radius:999px;background:var(--wb-accent,#2563eb)}",
331
- ".wbsal-comp-fill.deduction{background:var(--wb-warn,#b45309)}",
332
- ".wbsal-comp-value{text-align:right;font-variant-numeric:tabular-nums;color:var(--wb-muted,#8b94a6)}",
333
- ".wbsal-comp-value b{color:var(--wb-text,inherit);font-weight:600}",
334
- ".wbsal-comp-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:20px}",
335
- ".wbsal-table th.num,.wbsal-table td.num{text-align:right}",
336
- ".wbsal-table tbody tr:hover td{background:color-mix(in srgb,var(--wb-accent,#2563eb) 4%,transparent)}",
337
- /* 空态 */
338
- ".wbsal-empty{display:flex;flex-direction:column;align-items:center;gap:10px;padding:44px 16px;border:1px dashed var(--wb-border,#e2e6ec);border-radius:12px;color:var(--wb-muted,#8b94a6);font-size:12.5px;text-align:center}",
339
- ".wbsal-empty-actions{display:flex;gap:8px;justify-content:center;margin-top:2px}",
340
- ".wbsal-inline-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}",
341
- /* 五险一金 */
342
- ".wbsal-social{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px 14px}",
343
- ".wbsal-social-item{border:1px solid var(--wb-line,#eef0f4);border-radius:10px;padding:10px 12px;display:flex;flex-direction:column;gap:3px;background:color-mix(in srgb,var(--wb-muted,#8b94a6) 5%,transparent)}",
344
- ".wbsal-social-item span{font-size:11px;color:var(--wb-muted,#8b94a6)}",
345
- ".wbsal-social-item b{font-size:15px;font-weight:650;font-variant-numeric:tabular-nums}",
346
- ".wbsal-social-item em{font-size:11px;font-style:normal;color:var(--wb-muted,#8b94a6)}",
347
- /* 共享组件在深色主题下的覆盖:base 里 notice/pill/json 写死了浅色,这里改成 token */
348
- ".wbsal-notice{padding:9px 11px;border-radius:9px;font-size:12px;background:color-mix(in srgb,var(--wb-accent,#2563eb) 10%,transparent);color:var(--wb-text,inherit);border:1px solid color-mix(in srgb,var(--wb-accent,#2563eb) 18%,transparent)}",
349
- ".wbsal-notice.ok{background:color-mix(in srgb,var(--wb-ok,#15803d) 12%,transparent);color:var(--wb-ok,#15803d);border-color:color-mix(in srgb,var(--wb-ok,#15803d) 22%,transparent)}",
350
- ".wbsal-notice.error{background:color-mix(in srgb,var(--wb-danger,#b91c1c) 12%,transparent);color:var(--wb-danger,#b91c1c);border-color:color-mix(in srgb,var(--wb-danger,#b91c1c) 22%,transparent)}",
351
- ".wbsal-pill{display:inline-flex;align-items:center;padding:1px 7px;border-radius:999px;font-size:11px;font-weight:600;line-height:1.7;background:color-mix(in srgb,var(--wb-muted,#8b94a6) 14%,transparent);color:var(--wb-muted,#8b94a6)}",
352
- ".wbsal-pill.ok{background:color-mix(in srgb,var(--wb-ok,#15803d) 13%,transparent);color:var(--wb-ok,#15803d)}",
353
- ".wbsal-pill.warn{background:color-mix(in srgb,var(--wb-warn,#b45309) 15%,transparent);color:var(--wb-warn,#b45309)}",
354
- ".wbsal-pill.error{background:color-mix(in srgb,var(--wb-danger,#b91c1c) 13%,transparent);color:var(--wb-danger,#b91c1c)}",
355
- ".wbsal-json{margin:0;padding:10px;border-radius:9px;background:color-mix(in srgb,var(--wb-muted,#8b94a6) 8%,transparent);font-size:11.5px;line-height:1.6;max-height:240px;overflow:auto;color:var(--wb-text,inherit)}",
356
- /* 说明页 */
357
- ".wbsal-card h3{margin:0 0 10px;font-size:14px;font-weight:600;letter-spacing:-0.01em}",
358
- ".wbsal-page > .wbsal-card + .wbsal-card{margin-top:14px}",
359
- ".wbsal-row{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end}",
360
- /* 响应式 */
361
- "@media (max-width:1100px){.wbsal-detail{grid-template-columns:repeat(2,minmax(0,1fr))}}",
362
- "@media (max-width:900px){.wbsal-table th.hide-md,.wbsal-table td.hide-md{display:none}}",
363
- "@media (max-width:760px){.wbsal-detail{grid-template-columns:minmax(0,1fr)}.wbsal-page{padding:16px 14px 36px}.wbsal-table th,.wbsal-table td{padding:9px 10px}.wbsal-opt,.wbsal-table th.opt{display:none}.wbsal-comp-row{grid-template-columns:80px minmax(50px,1fr) 112px}.wbsal-chart{height:170px}}"
364
- ];
365
- var DATE = require_date_picker_styles()("wbsal");
366
- module2.exports = BASE.concat(PAGE, [DATE]).join("\n");
46
+ var h = require("react").createElement;
47
+ function create(prefix, glyphs, options) {
48
+ var opts = options || {};
49
+ var ICONS = Object.assign({}, glyphs);
50
+ function Icon2(props) {
51
+ var C = ICONS[props.name] || (opts.fallback ? ICONS[opts.fallback] : null);
52
+ if (!C) return null;
53
+ var size = typeof opts.sizeOf === "function" ? opts.sizeOf(props) : props.size || 14;
54
+ var cls = prefix + "-svg" + (opts.classNameAppend && props.className ? " " + props.className : "");
55
+ var attrs = {
56
+ size,
57
+ strokeWidth: props.strokeWidth || 2,
58
+ "aria-hidden": "true",
59
+ className: cls
60
+ };
61
+ if (opts.focusable) attrs.focusable = false;
62
+ return h(C, attrs);
63
+ }
64
+ var set = { ICONS, Icon: Icon2 };
65
+ if (opts.tabIcon) {
66
+ set.tabIcon = function(name) {
67
+ return function TabIcon() {
68
+ return h(Icon2, { name, size: 14 });
69
+ };
70
+ };
71
+ }
72
+ return set;
73
+ }
74
+ module2.exports = { create };
367
75
  }
368
76
  });
369
77
 
@@ -649,52 +357,23 @@ var import_react3;
649
357
  var init_createLucideIcon = __esm({
650
358
  "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.mjs"() {
651
359
  import_react3 = require("react");
652
- init_toLucideIconData();
653
- init_toPascalCase();
654
- init_Icon();
655
- }
656
- });
657
-
658
- // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/wallet.mjs
659
- var wallet_exports = {};
660
- __export(wallet_exports, {
661
- __iconData: () => __iconData,
662
- default: () => Wallet
663
- });
664
- var __iconData, Wallet;
665
- var init_wallet = __esm({
666
- "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/wallet.mjs"() {
667
- init_createLucideIcon();
668
- __iconData = {
669
- name: "wallet",
670
- size: 24,
671
- node: [
672
- [
673
- "path",
674
- {
675
- d: "M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",
676
- key: "18etb6"
677
- }
678
- ],
679
- ["path", { d: "M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4", key: "xoc0q4" }]
680
- ]
681
- };
682
- __iconData.node;
683
- Wallet = createLucideIcon(__iconData);
360
+ init_toLucideIconData();
361
+ init_toPascalCase();
362
+ init_Icon();
684
363
  }
685
364
  });
686
365
 
687
366
  // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/chart-column.mjs
688
367
  var chart_column_exports = {};
689
368
  __export(chart_column_exports, {
690
- __iconData: () => __iconData2,
369
+ __iconData: () => __iconData,
691
370
  default: () => ChartColumn
692
371
  });
693
- var __iconData2, ChartColumn;
372
+ var __iconData, ChartColumn;
694
373
  var init_chart_column = __esm({
695
374
  "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/chart-column.mjs"() {
696
375
  init_createLucideIcon();
697
- __iconData2 = {
376
+ __iconData = {
698
377
  name: "chart-column",
699
378
  size: 24,
700
379
  node: [
@@ -705,22 +384,22 @@ var init_chart_column = __esm({
705
384
  ],
706
385
  aliases: ["bar-chart-3"]
707
386
  };
708
- __iconData2.node;
709
- ChartColumn = createLucideIcon(__iconData2);
387
+ __iconData.node;
388
+ ChartColumn = createLucideIcon(__iconData);
710
389
  }
711
390
  });
712
391
 
713
392
  // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/database.mjs
714
393
  var database_exports = {};
715
394
  __export(database_exports, {
716
- __iconData: () => __iconData3,
395
+ __iconData: () => __iconData2,
717
396
  default: () => Database
718
397
  });
719
- var __iconData3, Database;
398
+ var __iconData2, Database;
720
399
  var init_database = __esm({
721
400
  "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/database.mjs"() {
722
401
  init_createLucideIcon();
723
- __iconData3 = {
402
+ __iconData2 = {
724
403
  name: "database",
725
404
  size: 24,
726
405
  node: [
@@ -729,22 +408,22 @@ var init_database = __esm({
729
408
  ["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
730
409
  ]
731
410
  };
732
- __iconData3.node;
733
- Database = createLucideIcon(__iconData3);
411
+ __iconData2.node;
412
+ Database = createLucideIcon(__iconData2);
734
413
  }
735
414
  });
736
415
 
737
416
  // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list.mjs
738
417
  var list_exports = {};
739
418
  __export(list_exports, {
740
- __iconData: () => __iconData4,
419
+ __iconData: () => __iconData3,
741
420
  default: () => List
742
421
  });
743
- var __iconData4, List;
422
+ var __iconData3, List;
744
423
  var init_list = __esm({
745
424
  "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list.mjs"() {
746
425
  init_createLucideIcon();
747
- __iconData4 = {
426
+ __iconData3 = {
748
427
  name: "list",
749
428
  size: 24,
750
429
  node: [
@@ -756,8 +435,383 @@ var init_list = __esm({
756
435
  ["path", { d: "M8 19h13", key: "m83p4d" }]
757
436
  ]
758
437
  };
438
+ __iconData3.node;
439
+ List = createLucideIcon(__iconData3);
440
+ }
441
+ });
442
+
443
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/wallet.mjs
444
+ var wallet_exports = {};
445
+ __export(wallet_exports, {
446
+ __iconData: () => __iconData4,
447
+ default: () => Wallet
448
+ });
449
+ var __iconData4, Wallet;
450
+ var init_wallet = __esm({
451
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/wallet.mjs"() {
452
+ init_createLucideIcon();
453
+ __iconData4 = {
454
+ name: "wallet",
455
+ size: 24,
456
+ node: [
457
+ [
458
+ "path",
459
+ {
460
+ d: "M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",
461
+ key: "18etb6"
462
+ }
463
+ ],
464
+ ["path", { d: "M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4", key: "xoc0q4" }]
465
+ ]
466
+ };
759
467
  __iconData4.node;
760
- List = createLucideIcon(__iconData4);
468
+ Wallet = createLucideIcon(__iconData4);
469
+ }
470
+ });
471
+
472
+ // packages/addons/salary/client/ui/icons.cjs
473
+ var require_icons2 = __commonJS({
474
+ "packages/addons/salary/client/ui/icons.cjs"(exports2, module2) {
475
+ "use strict";
476
+ var icons = require_icons();
477
+ var set = icons.create("wbsal", {
478
+ "chart-column": (init_chart_column(), __toCommonJS(chart_column_exports)).default,
479
+ "database": (init_database(), __toCommonJS(database_exports)).default,
480
+ "list": (init_list(), __toCommonJS(list_exports)).default,
481
+ "wallet": (init_wallet(), __toCommonJS(wallet_exports)).default
482
+ });
483
+ module2.exports = { ICONS: set.ICONS, Icon: set.Icon };
484
+ }
485
+ });
486
+
487
+ // packages/addons/lib/client-base-styles.cjs
488
+ var require_client_base_styles = __commonJS({
489
+ "packages/addons/lib/client-base-styles.cjs"(exports2, module2) {
490
+ "use strict";
491
+ var SECRET_FIELD = [
492
+ ".wb-secret-field{position:relative;display:flex;align-items:center;min-width:0}",
493
+ ".wb-secret-field input{flex:1 1 auto;min-width:0;padding-right:34px}",
494
+ ".wb-eye{position:absolute;right:4px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:6px;padding:4px;color:var(--wb-muted,#6b7280);cursor:pointer}",
495
+ ".wb-eye:hover:not(:disabled){color:var(--wb-accent,#2563eb);background:color-mix(in srgb, var(--wb-accent,#2563eb) 12%, transparent)}",
496
+ ".wb-eye:focus-visible{outline:2px solid var(--wb-accent,#2563eb);outline-offset:1px}",
497
+ ".wb-eye:disabled{opacity:.45;cursor:not-allowed}"
498
+ ];
499
+ module2.exports = function baseStyles(prefix) {
500
+ var p = String(prefix || "wb");
501
+ var s = "." + p;
502
+ return SECRET_FIELD.concat([
503
+ s + "-wrap{display:flex;flex-direction:column;gap:12px;padding:16px;overflow:auto;height:100%;box-sizing:border-box}",
504
+ s + "-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}",
505
+ s + "-title{font-size:16px;font-weight:650;margin:0}",
506
+ s + "-sub{font-size:12px;color:var(--wb-muted,#6b7280);margin:2px 0 0}",
507
+ s + "-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}",
508
+ s + "-card{border:1px solid var(--wb-border,#e5e7eb);border-radius:10px;background:var(--wb-surface,#fff);padding:12px}",
509
+ s + "-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}",
510
+ s + "-kpi{font-size:22px;font-weight:700;line-height:1.2}" + s + "-kpi-label{font-size:12px;color:var(--wb-muted,#6b7280)}",
511
+ s + "-table{width:100%;border-collapse:collapse;font-size:12px}" + s + "-table th," + s + "-table td{padding:7px 8px;border-bottom:1px solid var(--wb-border,#eef0f3);text-align:left;vertical-align:top}",
512
+ s + "-table th{font-weight:600;color:var(--wb-muted,#6b7280);white-space:nowrap}",
513
+ s + "-btn{border:1px solid var(--wb-border,#d1d5db);background:var(--wb-surface,#fff);color:inherit;border-radius:7px;padding:5px 10px;font-size:12px;cursor:pointer}",
514
+ s + "-btn:hover:not(:disabled){border-color:var(--wb-accent,#2563eb)}" + s + "-btn:disabled{opacity:.5;cursor:default}",
515
+ s + "-btn.primary{background:var(--wb-accent,#2563eb);border-color:var(--wb-accent,#2563eb);color:#fff}",
516
+ s + "-btn.danger{color:#b91c1c;border-color:#fecaca}",
517
+ s + "-field{display:flex;flex-direction:column;gap:4px;font-size:12px}" + s + "-label{font-weight:600}",
518
+ s + "-field input," + s + "-field select," + s + "-field textarea{border:1px solid var(--wb-border,#d1d5db);border-radius:7px;padding:6px 8px;font:inherit;background:var(--wb-surface,#fff);color:inherit;min-width:0}",
519
+ s + "-hint{color:var(--wb-muted,#6b7280);font-size:11px}" + s + "-notice{padding:8px 10px;border-radius:8px;font-size:12px;background:#eff6ff;color:#1e40af}",
520
+ s + "-notice.error{background:#fef2f2;color:#b91c1c}" + s + "-notice.ok{background:#ecfdf5;color:#047857}",
521
+ s + "-empty{padding:18px;text-align:center;color:var(--wb-muted,#6b7280);font-size:12px;border:1px dashed var(--wb-border,#e5e7eb);border-radius:8px}",
522
+ s + "-pill{display:inline-block;padding:1px 7px;border-radius:999px;font-size:11px;background:#f3f4f6;color:#374151}",
523
+ s + "-pill.ok{background:#ecfdf5;color:#047857}" + s + "-pill.error{background:#fef2f2;color:#b91c1c}" + s + "-pill.warn{background:#fffbeb;color:#b45309}",
524
+ s + "-json{margin:0;padding:8px;background:#f8fafc;border-radius:8px;font-size:11px;max-height:240px;overflow:auto}",
525
+ s + "-muted{color:var(--wb-muted,#6b7280)}" + s + "-link{color:var(--wb-accent,#2563eb);cursor:pointer;text-decoration:none}",
526
+ s + "-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px}"
527
+ ]);
528
+ };
529
+ module2.exports.secretFieldStyles = SECRET_FIELD;
530
+ }
531
+ });
532
+
533
+ // packages/addons/lib/date-picker-styles.cjs
534
+ var require_date_picker_styles = __commonJS({
535
+ "packages/addons/lib/date-picker-styles.cjs"(exports2, module2) {
536
+ "use strict";
537
+ module2.exports = function datePickerStyles(prefix) {
538
+ var p = String(prefix || "wb");
539
+ return [
540
+ ".{p}-dp,.{p}-dr{position:relative;min-width:0}",
541
+ ".{p}-dp-field{display:flex;align-items:center;gap:6px;min-width:0}",
542
+ ".{p}-dp-trigger{display:flex;align-items:center;gap:8px;min-width:0;width:100%;padding:8px 10px;border:1px solid var(--wb-border);border-radius:8px;background:var(--wb-surface);color:var(--wb-text,inherit);font:inherit;text-align:left;cursor:pointer;transition:border-color .15s,box-shadow .15s}",
543
+ ".{p}-dp-trigger:hover{border-color:var(--wb-accent)}",
544
+ ".{p}-dp-trigger:focus-visible{outline:2px solid var(--wb-accent);outline-offset:1px}",
545
+ ".{p}-dp-trigger[disabled]{opacity:.55;cursor:not-allowed}",
546
+ ".{p}-dp-glyph{width:13px;height:13px;flex:none;border:1.5px solid currentColor;border-radius:3px;position:relative;opacity:.72}",
547
+ '.{p}-dp-glyph::before{content:"";position:absolute;left:-1.5px;right:-1.5px;top:3px;border-top:1.5px solid currentColor}',
548
+ '.{p}-dp-glyph::after{content:"";position:absolute;left:3px;top:-3px;width:1.5px;height:3px;background:currentColor;box-shadow:4px 0 currentColor}',
549
+ ".{p}-dp-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums}",
550
+ ".{p}-dp-value.is-empty{color:var(--wb-muted)}",
551
+ ".{p}-dp-clear{flex:none;width:22px;height:22px;padding:0;border:0;border-radius:50%;background:color-mix(in srgb,var(--wb-muted) 14%,transparent);color:var(--wb-muted);font:inherit;line-height:1;cursor:pointer}",
552
+ ".{p}-dp-clear:hover{color:var(--wb-danger);background:color-mix(in srgb,var(--wb-danger) 16%,transparent)}",
553
+ ".{p}-dp-pop{position:absolute;z-index:40;top:calc(100% + 6px);left:0;width:272px;padding:10px;border:1px solid var(--wb-border);border-radius:12px;background:var(--wb-card);box-shadow:0 16px 40px color-mix(in srgb,var(--wb-text,var(--wb-border)) 18%,transparent);animation:{p}-dp-in .14s ease-out}",
554
+ ".{p}-dp-head{display:flex;align-items:center;gap:6px;margin-bottom:8px}",
555
+ ".{p}-dp-title{flex:1;text-align:center;font-size:13px;font-weight:600;font-variant-numeric:tabular-nums}",
556
+ ".{p}-dp-nav{width:26px;height:26px;padding:0;border:1px solid var(--wb-border);border-radius:7px;background:transparent;color:inherit;font:inherit;line-height:1;cursor:pointer}",
557
+ ".{p}-dp-nav:hover{border-color:var(--wb-accent);color:var(--wb-accent)}",
558
+ ".{p}-dp-weekdays,.{p}-dp-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px}",
559
+ ".{p}-dp-weekdays{margin-bottom:4px;font-size:11px;color:var(--wb-muted);text-align:center}",
560
+ ".{p}-dp-day{min-width:0;height:30px;padding:0;border:0;border-radius:7px;background:transparent;color:inherit;font:inherit;font-variant-numeric:tabular-nums;cursor:pointer}",
561
+ ".{p}-dp-day:hover{background:color-mix(in srgb,var(--wb-accent) 12%,transparent)}",
562
+ ".{p}-dp-day.is-between{background:color-mix(in srgb,var(--wb-accent) 16%,transparent);border-radius:0}",
563
+ ".{p}-dp-day.is-today{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--wb-accent) 55%,transparent)}",
564
+ ".{p}-dp-day.is-on{background:var(--wb-accent);color:var(--wb-on-accent,inherit);font-weight:600}",
565
+ ".{p}-dp-day:disabled{opacity:.35;cursor:not-allowed}",
566
+ ".{p}-dp-day:focus-visible{outline:2px solid var(--wb-accent);outline-offset:-2px}",
567
+ ".{p}-dp-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px;padding-top:8px;border-top:1px solid var(--wb-line)}",
568
+ ".{p}-dp-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}",
569
+ ".{p}-dp-link{padding:4px 8px;border:0;border-radius:6px;background:color-mix(in srgb,var(--wb-muted) 12%,transparent);color:inherit;font:inherit;font-size:12px;cursor:pointer}",
570
+ ".{p}-dp-link:hover{background:color-mix(in srgb,var(--wb-accent) 16%,transparent);color:var(--wb-accent)}",
571
+ ".{p}-dp-hint{margin:6px 0 0;font-size:11px;color:var(--wb-muted)}",
572
+ ".{p}-dp-pop.is-months{width:248px}",
573
+ ".{p}-dp-months{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin-bottom:6px}",
574
+ ".{p}-dp-months .{p}-dp-day{height:34px}",
575
+ "@keyframes {p}-dp-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}"
576
+ ].join("\n").replace(/\{p\}/g, p);
577
+ };
578
+ }
579
+ });
580
+
581
+ // packages/addons/salary/client/ui/styles.cjs
582
+ var require_styles = __commonJS({
583
+ "packages/addons/salary/client/ui/styles.cjs"(exports2, module2) {
584
+ "use strict";
585
+ var BASE = require_client_base_styles()("wbsal");
586
+ var PAGE = [
587
+ /* 页面骨架 */
588
+ ".wbsal-page{display:flex;flex-direction:column;gap:18px;padding:22px 24px 48px;box-sizing:border-box;width:100%;min-height:100%}",
589
+ ".wbsal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}",
590
+ ".wbsal-head-main{display:flex;flex-direction:column;gap:4px;min-width:0}",
591
+ ".wbsal-eyebrow{font-size:10.5px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--wb-muted,#8b94a6)}",
592
+ ".wbsal-head h2,.wbsal-page h2{font-size:21px;font-weight:650;margin:0;letter-spacing:-.01em;color:var(--wb-text,inherit)}",
593
+ ".wbsal-sub{margin:0;font-size:12.5px;color:var(--wb-muted,#8b94a6)}",
594
+ ".wbsal-head-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
595
+ ".wbsal-toolbar{display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap;padding:12px 14px;border:1px solid var(--wb-border,#e2e6ec);border-radius:12px;background:var(--wb-surface,#fff)}",
596
+ ".wbsal-toolbar .wbsal-field{gap:5px}",
597
+ ".wbsal-toolbar-count{margin-left:auto;font-size:12px;color:var(--wb-muted,#8b94a6)}",
598
+ ".wbsal-toolbar-count b{font-variant-numeric:tabular-nums;color:var(--wb-text,inherit)}",
599
+ ".wbsal-toolbar-plain{background:transparent;border:0;padding:0;justify-content:flex-end}",
600
+ ".wbsal-toolbar-end{margin-left:auto;display:flex;align-items:center;gap:10px;flex-wrap:wrap}",
601
+ ".wbsal-toolbar-end .wbsal-toolbar-count{margin-left:0}",
602
+ /* KPI */
603
+ ".wbsal-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(186px,1fr));gap:12px}",
604
+ ".wbsal-card{border:1px solid var(--wb-border,#e2e6ec);border-radius:12px;padding:14px 16px;background:var(--wb-card,#fff);box-sizing:border-box;min-width:0}",
605
+ ".wbsal-kpi{display:flex;flex-direction:column;gap:2px}",
606
+ ".wbsal-kpi-head{display:flex;align-items:center;gap:7px;margin-bottom:6px}",
607
+ ".wbsal-kpi-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:8px;background:color-mix(in srgb,var(--wb-accent,#2563eb) 12%,transparent);color:var(--wb-accent,#2563eb);flex:0 0 auto}",
608
+ ".wbsal-kpi span{display:block;font-size:12px;color:var(--wb-muted,#8b94a6)}",
609
+ ".wbsal-kpi strong{display:block;font-size:24px;font-weight:680;font-variant-numeric:tabular-nums;line-height:1.15;letter-spacing:-.01em;color:var(--wb-text,inherit)}",
610
+ ".wbsal-kpi em{display:block;font-size:11.5px;font-style:normal;color:var(--wb-muted,#8b94a6);margin-top:4px}",
611
+ ".wbsal-kpi em b{font-weight:600;color:var(--wb-ok,#15803d);font-variant-numeric:tabular-nums}",
612
+ ".wbsal-kpi em b.neg{color:var(--wb-danger,#b91c1c)}",
613
+ /* 按钮与输入 */
614
+ ".wbsal-btn{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--wb-border,#d1d5db);background:var(--wb-surface,#fff);color:var(--wb-text,inherit);border-radius:9px;padding:6px 12px;font-size:12.5px;line-height:1.4;cursor:pointer;transition:border-color .12s,background .12s,color .12s}",
615
+ ".wbsal-btn:hover:not(:disabled){border-color:var(--wb-accent,#2563eb);color:var(--wb-accent,#2563eb)}",
616
+ ".wbsal-btn:disabled{opacity:.5;cursor:default}",
617
+ ".wbsal-btn.primary{background:var(--wb-accent,#2563eb);border-color:var(--wb-accent,#2563eb);color:#fff}",
618
+ ".wbsal-btn.primary:hover:not(:disabled){filter:brightness(1.06);color:#fff}",
619
+ ".wbsal-btn.danger{color:var(--wb-danger,#b91c1c);border-color:color-mix(in srgb,var(--wb-danger,#b91c1c) 35%,transparent)}",
620
+ ".wbsal-btn.danger:hover:not(:disabled){background:color-mix(in srgb,var(--wb-danger,#b91c1c) 10%,transparent);color:var(--wb-danger,#b91c1c)}",
621
+ ".wbsal-btn.ghost{border-color:transparent;background:color-mix(in srgb,var(--wb-muted,#8b94a6) 11%,transparent);color:var(--wb-text,inherit)}",
622
+ ".wbsal-btn.ghost:hover:not(:disabled){background:color-mix(in srgb,var(--wb-accent,#2563eb) 12%,transparent);color:var(--wb-accent,#2563eb)}",
623
+ ".wbsal-input{border:1px solid var(--wb-border,#d1d5db);border-radius:8px;padding:7px 9px;font:inherit;font-size:12.5px;background:var(--wb-surface,#fff);color:var(--wb-text,inherit);min-width:88px;box-sizing:border-box}",
624
+ ".wbsal-input:focus{outline:2px solid color-mix(in srgb,var(--wb-accent,#2563eb) 45%,transparent);outline-offset:1px;border-color:var(--wb-accent,#2563eb)}",
625
+ ".wbsal-field{display:flex;flex-direction:column;gap:4px;font-size:12px;min-width:0}",
626
+ ".wbsal-label{font-size:11.5px;font-weight:600;color:var(--wb-muted,#8b94a6)}",
627
+ ".wbsal-hint{font-size:11px;color:var(--wb-muted,#8b94a6)}",
628
+ ".wbsal-muted{font-size:12px;color:var(--wb-muted,#8b94a6)}",
629
+ ".wbsal-danger{color:var(--wb-danger,#b91c1c);font-size:12px}",
630
+ /* 月份分组 + 记录表 */
631
+ ".wbsal-months{display:flex;flex-direction:column;gap:10px}",
632
+ ".wbsal-month{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:2px 2px 0}",
633
+ ".wbsal-month-title{display:flex;align-items:baseline;gap:8px}",
634
+ ".wbsal-month-title strong{font-size:13.5px;font-weight:650;color:var(--wb-text,inherit)}",
635
+ ".wbsal-month-title span{font-size:11.5px;color:var(--wb-muted,#8b94a6)}",
636
+ ".wbsal-month-total{font-size:12px;color:var(--wb-muted,#8b94a6)}",
637
+ ".wbsal-month-total b{font-size:13px;color:var(--wb-text,inherit);font-variant-numeric:tabular-nums;margin-left:4px}",
638
+ ".wbsal-table-wrap{border:1px solid var(--wb-border,#e2e6ec);border-radius:12px;background:var(--wb-card,#fff);overflow:hidden}",
639
+ ".wbsal-table{width:100%;border-collapse:collapse;font-size:12.5px}",
640
+ ".wbsal-table th,.wbsal-table td{padding:10px 14px;text-align:right;border-bottom:1px solid var(--wb-line,#eef0f4);font-variant-numeric:tabular-nums;white-space:nowrap}",
641
+ ".wbsal-table th{font-size:11px;font-weight:600;letter-spacing:.04em;color:var(--wb-muted,#8b94a6);background:var(--wb-surface,#fff);padding-top:9px;padding-bottom:9px}",
642
+ ".wbsal-table th:first-child,.wbsal-table td:first-child,.wbsal-table th.left,.wbsal-table td.left{text-align:left}",
643
+ ".wbsal-table tbody tr:last-child td{border-bottom:0}",
644
+ ".wbsal-record td{height:44px}",
645
+ ".wbsal-record-row{cursor:pointer;transition:background .12s}",
646
+ ".wbsal-record-row:hover td{background:color-mix(in srgb,var(--wb-accent,#2563eb) 5%,transparent)}",
647
+ ".wbsal-record-row.open td{background:color-mix(in srgb,var(--wb-accent,#2563eb) 7%,transparent)}",
648
+ ".wbsal-date{display:flex;align-items:baseline;gap:7px}",
649
+ ".wbsal-date b{font-weight:600;font-variant-numeric:tabular-nums}",
650
+ ".wbsal-date span{font-size:11.5px;color:var(--wb-muted,#8b94a6)}",
651
+ ".wbsal-net{font-weight:680;font-size:13px;color:var(--wb-text,inherit)}",
652
+ ".wbsal-opt{color:var(--wb-muted,#8b94a6)}",
653
+ ".wbsal-caret{display:inline-block;width:14px;color:var(--wb-muted,#8b94a6);transition:transform .15s}",
654
+ ".wbsal-record-row.open .wbsal-caret{transform:rotate(90deg)}",
655
+ ".wbsal-detail-cell{padding:0 14px 16px !important;background:color-mix(in srgb,var(--wb-accent,#2563eb) 4%,transparent)}",
656
+ ".wbsal-detail{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px 24px}",
657
+ ".wbsal-detail-block{display:flex;flex-direction:column;gap:6px;min-width:0}",
658
+ ".wbsal-group-title{font-size:11px;font-weight:600;letter-spacing:.04em;color:var(--wb-muted,#8b94a6);text-transform:uppercase}",
659
+ ".wbsal-fields{display:flex;flex-direction:column;gap:5px;font-size:12px}",
660
+ ".wbsal-fields div{display:flex;align-items:baseline;justify-content:space-between;gap:10px;padding-bottom:4px;border-bottom:1px dashed var(--wb-line,#eef0f4)}",
661
+ ".wbsal-fields div:last-child{border-bottom:0}",
662
+ ".wbsal-fields span{color:var(--wb-muted,#8b94a6)}",
663
+ ".wbsal-fields b{font-weight:600;font-variant-numeric:tabular-nums}",
664
+ ".wbsal-field-sum b{font-size:13.5px}",
665
+ ".wbsal-detail-foot{grid-column:1/-1;display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:space-between;border-top:1px solid var(--wb-line,#eef0f4);padding-top:10px}",
666
+ ".wbsal-detail-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
667
+ ".wbsal-confirm{display:inline-flex;align-items:center;gap:8px;padding:3px 8px 3px 10px;border-radius:999px;background:color-mix(in srgb,var(--wb-danger,#b91c1c) 10%,transparent)}",
668
+ /* 表单 */
669
+ ".wbsal-form{display:flex;flex-direction:column;gap:16px}",
670
+ ".wbsal-mask{position:fixed;inset:0;z-index:60;display:flex;align-items:flex-start;justify-content:center;padding:38px 18px;overflow:auto;background:transparent;backdrop-filter:brightness(.62) blur(3px);-webkit-backdrop-filter:brightness(.62) blur(3px)}",
671
+ "@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.wbsal-mask{background:color-mix(in oklab,currentColor 34%,transparent)}}",
672
+ ".wbsal-modal{width:min(960px,100%);margin:auto 0;animation:wbsal-pop .16s ease-out}",
673
+ "@keyframes wbsal-pop{from{opacity:0;transform:translateY(10px) scale(.99)}to{opacity:1;transform:none}}",
674
+ ".wbsal-form-modal{margin-top:0;max-height:calc(100vh - 76px);overflow:auto;box-shadow:0 24px 64px color-mix(in oklab,currentColor 22%,transparent)}",
675
+ ".wbsal-form-modal .wbsal-form-head{position:sticky;top:-14px;z-index:1;margin:-14px -16px 0;padding:14px 16px;background:var(--wb-card,#fff);border-bottom:1px solid var(--wb-line,#eef0f4)}",
676
+ ".wbsal-form-head{display:flex;align-items:center;justify-content:space-between;gap:10px}",
677
+ ".wbsal-form-head h3{font-size:14px;font-weight:650;margin:0}",
678
+ ".wbsal-form-meta{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}",
679
+ ".wbsal-form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px 12px}",
680
+ ".wbsal-form-group{display:flex;flex-direction:column;gap:8px;padding-top:12px;border-top:1px solid var(--wb-line,#eef0f4)}",
681
+ ".wbsal-form-group:first-of-type{border-top:0;padding-top:0}",
682
+ ".wbsal-group-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}",
683
+ ".wbsal-group-head span{font-size:11px;color:var(--wb-muted,#8b94a6)}",
684
+ ".wbsal-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px;padding:14px;border:1px solid var(--wb-border,#e2e6ec);border-radius:12px;background:color-mix(in srgb,var(--wb-accent,#2563eb) 5%,transparent)}",
685
+ ".wbsal-summary div span{display:block;font-size:11px;color:var(--wb-muted,#8b94a6);margin-bottom:3px}",
686
+ ".wbsal-summary div b{font-size:15px;font-variant-numeric:tabular-nums;font-weight:650}",
687
+ ".wbsal-summary .wbsal-lock{grid-column:1/-1;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
688
+ ".wbsal-form-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}",
689
+ /* 统计 */
690
+ ".wbsal-seg{display:inline-flex;align-items:center;gap:6px;padding:4px;border:1px solid var(--wb-border,#e2e6ec);border-radius:10px;background:var(--wb-surface,#fff)}",
691
+ ".wbsal-seg .wbsal-btn{border-color:transparent;background:transparent}",
692
+ ".wbsal-seg .wbsal-btn.primary{background:var(--wb-accent,#2563eb);color:#fff}",
693
+ ".wbsal-seg-year{font-size:13px;font-weight:650;font-variant-numeric:tabular-nums;min-width:64px;text-align:center}",
694
+ ".wbsal-section{display:flex;flex-direction:column;gap:12px}",
695
+ ".wbsal-section-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}",
696
+ ".wbsal-section-head h3{font-size:13.5px;font-weight:650;margin:0}",
697
+ ".wbsal-section-head span{font-size:11.5px;color:var(--wb-muted,#8b94a6)}",
698
+ ".wbsal-section-tools{display:flex;align-items:center;gap:12px;flex-wrap:wrap}",
699
+ // 图表口径切换:与任务插件统计页一致的分段式小控件,选中态用 aria-pressed 表达。
700
+ ".wbsal-metric{display:inline-flex;align-items:center;gap:2px;padding:2px;border:1px solid var(--wb-border,#e2e6ec);border-radius:8px;background:var(--wb-surface,#fff)}",
701
+ ".wbsal-metric button{appearance:none;border:0;background:transparent;color:var(--wb-muted,#8b94a6);font:inherit;font-size:11.5px;padding:4px 8px;border-radius:6px;cursor:pointer;white-space:nowrap}",
702
+ ".wbsal-metric button:hover{background:color-mix(in srgb,var(--wb-muted) 12%,transparent);color:var(--wb-text,#20242c)}",
703
+ ".wbsal-metric button.on,.wbsal-metric button[aria-pressed=true]{background:var(--wb-accent,#2563eb);color:var(--wb-on-accent,#fff);font-weight:600}",
704
+ ".wbsal-metric button:focus-visible{outline:2px solid var(--wb-accent,#2563eb);outline-offset:1px}",
705
+ ".wbsal-chart{display:flex;align-items:flex-end;gap:8px;height:210px;padding:8px 2px 0;border-bottom:1px solid var(--wb-line,#eef0f4)}",
706
+ ".wbsal-bar{flex:1 1 0;min-width:14px;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:5px;height:100%}",
707
+ ".wbsal-bar-value{font-size:10.5px;line-height:1;color:var(--wb-muted,#8b94a6);font-variant-numeric:tabular-nums;white-space:nowrap}",
708
+ ".wbsal-bar-fill{width:72%;max-width:42px;border-radius:6px 6px 2px 2px;background:color-mix(in srgb,var(--wb-accent,#2563eb) 38%,transparent);transition:background .12s}",
709
+ ".wbsal-bar-fill.top{background:var(--wb-accent,#2563eb)}",
710
+ ".wbsal-bar:hover .wbsal-bar-fill{background:color-mix(in srgb,var(--wb-accent,#2563eb) 70%,transparent)}",
711
+ ".wbsal-axis{display:flex;gap:8px;padding-top:7px}",
712
+ ".wbsal-axis span{flex:1 1 0;text-align:center;font-size:10.5px;color:var(--wb-muted,#8b94a6);font-variant-numeric:tabular-nums}",
713
+ ".wbsal-chart-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:11.5px;color:var(--wb-muted,#8b94a6)}",
714
+ ".wbsal-legend{display:inline-flex;align-items:center;gap:6px}",
715
+ ".wbsal-legend i{width:8px;height:8px;border-radius:2px;background:var(--wb-accent,#2563eb);display:inline-block}",
716
+ ".wbsal-legend i.soft{background:color-mix(in srgb,var(--wb-accent,#2563eb) 38%,transparent)}",
717
+ ".wbsal-series{display:flex;align-items:center;gap:6px;flex-wrap:wrap}",
718
+ ".wbsal-series button{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border:1px solid var(--wb-border,#e2e6ee);border-radius:999px;background:var(--wb-surface,#fff);color:var(--wb-fg,inherit);font-size:12px;line-height:1;cursor:pointer;transition:opacity .12s,border-color .12s,background .12s}",
719
+ ".wbsal-series button:hover{border-color:color-mix(in srgb,var(--wb-accent,#2563eb) 45%,var(--wb-border,#e2e6ee))}",
720
+ ".wbsal-series button.off{opacity:.45;color:var(--wb-muted,#8b94a6)}",
721
+ ".wbsal-series button.off i{filter:grayscale(1)}",
722
+ ".wbsal-series i{width:14px;height:3px;border-radius:2px;display:inline-block;background:var(--wb-muted,#8b94a6)}",
723
+ ".wbsal-series i.s1,.wbsal-line-dot.s1{background:var(--wb-accent,#2563eb)}",
724
+ ".wbsal-series i.s2,.wbsal-line-dot.s2{background:var(--wb-ok,#16a34a)}",
725
+ ".wbsal-series i.s3,.wbsal-line-dot.s3{background:var(--wb-warn,#d97706)}",
726
+ ".wbsal-series i.s4,.wbsal-line-dot.s4{background:color-mix(in oklab,var(--wb-accent,#2563eb) 45%,var(--wb-danger,#dc2626))}",
727
+ ".wbsal-series i.s5,.wbsal-line-dot.s5{background:color-mix(in oklab,var(--wb-ok,#16a34a) 55%,var(--wb-accent,#2563eb))}",
728
+ ".wbsal-series i.s6,.wbsal-line-dot.s6{background:color-mix(in oklab,var(--wb-warn,#d97706) 60%,var(--wb-danger,#dc2626))}",
729
+ ".wbsal-series i.sum,.wbsal-line-dot.sum{background:color-mix(in oklab,var(--wb-muted,#8b94a6) 45%,var(--wb-accent,#2563eb))}",
730
+ ".wbsal-line.sum{stroke:color-mix(in oklab,var(--wb-muted,#8b94a6) 45%,var(--wb-accent,#2563eb));stroke-dasharray:7 4}",
731
+ ".wbsal-line-dot.sum{fill:color-mix(in oklab,var(--wb-muted,#8b94a6) 45%,var(--wb-accent,#2563eb))}",
732
+ ".wbsal-linechart{width:100%;padding:10px 2px 0;position:relative}",
733
+ ".wbsal-hit{fill:transparent;cursor:crosshair}",
734
+ ".wbsal-hit-area{fill:transparent}",
735
+ ".wbsal-crosshair{stroke:color-mix(in srgb,var(--wb-accent,#2563eb) 55%,transparent);stroke-width:1;stroke-dasharray:3 3;vector-effect:non-scaling-stroke}",
736
+ ".wbsal-line-dot.is-hot{stroke:var(--wb-card,#fff);stroke-width:2}",
737
+ ".wbsal-tip{position:absolute;top:6px;transform:translateX(-50%);z-index:3;pointer-events:none;min-width:170px;padding:9px 11px;border:1px solid var(--wb-border,#e2e6ee);border-radius:10px;background:var(--wb-card,#fff);box-shadow:0 8px 22px rgba(15,23,42,.16)}",
738
+ ".wbsal-tip.is-right{transform:translateX(-100%)}",
739
+ ".wbsal-tip strong{display:block;font-size:12px;color:var(--wb-muted,#8b94a6);font-weight:600;margin-bottom:6px}",
740
+ ".wbsal-tip-row{display:flex;align-items:center;gap:7px;font-size:12px;line-height:1.7}",
741
+ ".wbsal-tip-row i{width:14px;height:3px;border-radius:2px;background:var(--wb-muted,#8b94a6);flex:0 0 auto}",
742
+ ".wbsal-tip-row span{color:var(--wb-muted,#8b94a6)}",
743
+ ".wbsal-tip-row b{margin-left:auto;font-variant-numeric:tabular-nums;font-weight:650}",
744
+ ".wbsal-tip-row i.s1{background:var(--wb-accent,#2563eb)}",
745
+ ".wbsal-tip-row i.s2{background:var(--wb-ok,#16a34a)}",
746
+ ".wbsal-tip-row i.s3{background:var(--wb-warn,#d97706)}",
747
+ ".wbsal-tip-row i.s4{background:color-mix(in oklab,var(--wb-accent,#2563eb) 45%,var(--wb-danger,#dc2626))}",
748
+ ".wbsal-tip-row i.s5{background:color-mix(in oklab,var(--wb-ok,#16a34a) 55%,var(--wb-accent,#2563eb))}",
749
+ ".wbsal-tip-row i.s6{background:color-mix(in oklab,var(--wb-warn,#d97706) 60%,var(--wb-danger,#dc2626))}",
750
+ ".wbsal-tip-row i.sum{background:color-mix(in oklab,var(--wb-muted,#8b94a6) 45%,var(--wb-accent,#2563eb))}",
751
+ ".wbsal-tip em{display:block;margin-top:5px;font-size:11px;font-style:normal;color:var(--wb-muted,#8b94a6)}",
752
+ ".wbsal-stack{display:flex;flex-direction:column;gap:16px}",
753
+ ".wbsal-section-note{font-size:11.5px;color:var(--wb-muted,#8b94a6);font-variant-numeric:tabular-nums}",
754
+ ".wbsal-linechart .wbsalc-trend-wrap{width:100%}",
755
+ ".wbsal-chart-hint{margin-top:8px;padding:10px 12px;border-radius:8px;background:color-mix(in srgb,var(--wb-muted,#8b94a6) 10%,transparent);color:var(--wb-muted,#8b94a6);font-size:12px}",
756
+ ".wbsal-social-foot{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:14px;flex-wrap:wrap}",
757
+ ".wbsal-linechart svg{display:block;width:100%;height:auto;overflow:visible}",
758
+ ".wbsal-linechart text{fill:var(--wb-muted,#8b94a6);font-size:11px;font-variant-numeric:tabular-nums}",
759
+ ".wbsal-line-gridline{stroke:var(--wb-line,#eef0f4);stroke-width:1;vector-effect:non-scaling-stroke}",
760
+ ".wbsal-line{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}",
761
+ ".wbsal-line.s1{stroke:var(--wb-accent,#2563eb)}",
762
+ ".wbsal-line.s2{stroke:var(--wb-ok,#16a34a)}",
763
+ ".wbsal-line.s3{stroke:var(--wb-warn,#d97706)}",
764
+ ".wbsal-line.s4{stroke:color-mix(in oklab,var(--wb-accent,#2563eb) 45%,var(--wb-danger,#dc2626))}",
765
+ ".wbsal-line.s5{stroke:color-mix(in oklab,var(--wb-ok,#16a34a) 55%,var(--wb-accent,#2563eb))}",
766
+ ".wbsal-line.s6{stroke:color-mix(in oklab,var(--wb-warn,#d97706) 60%,var(--wb-danger,#dc2626))}",
767
+ ".wbsal-line-dot{stroke:none}",
768
+ ".wbsal-line-dot.s1{fill:var(--wb-accent,#2563eb)}",
769
+ ".wbsal-line-dot.s2{fill:var(--wb-ok,#16a34a)}",
770
+ ".wbsal-line-dot.s3{fill:var(--wb-warn,#d97706)}",
771
+ ".wbsal-line-dot.s4{fill:color-mix(in oklab,var(--wb-accent,#2563eb) 45%,var(--wb-danger,#dc2626))}",
772
+ ".wbsal-line-dot.s5{fill:color-mix(in oklab,var(--wb-ok,#16a34a) 55%,var(--wb-accent,#2563eb))}",
773
+ ".wbsal-line-dot.s6{fill:color-mix(in oklab,var(--wb-warn,#d97706) 60%,var(--wb-danger,#dc2626))}",
774
+ ".wbsal-comp{display:flex;flex-direction:column;gap:7px}",
775
+ ".wbsal-comp-row{display:grid;grid-template-columns:92px minmax(60px,1fr) 132px;gap:10px;align-items:center;font-size:12px}",
776
+ ".wbsal-comp-row span:first-child{color:var(--wb-text,inherit)}",
777
+ ".wbsal-comp-track{height:7px;border-radius:999px;background:var(--wb-line,#eef0f4);overflow:hidden}",
778
+ ".wbsal-comp-fill{height:100%;border-radius:999px;background:var(--wb-accent,#2563eb)}",
779
+ ".wbsal-comp-fill.deduction{background:var(--wb-warn,#b45309)}",
780
+ ".wbsal-comp-value{text-align:right;font-variant-numeric:tabular-nums;color:var(--wb-muted,#8b94a6)}",
781
+ ".wbsal-comp-value b{color:var(--wb-text,inherit);font-weight:600}",
782
+ ".wbsal-comp-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:20px}",
783
+ ".wbsal-table th.num,.wbsal-table td.num{text-align:right}",
784
+ ".wbsal-table tbody tr:hover td{background:color-mix(in srgb,var(--wb-accent,#2563eb) 4%,transparent)}",
785
+ /* 空态 */
786
+ ".wbsal-empty{display:flex;flex-direction:column;align-items:center;gap:10px;padding:44px 16px;border:1px dashed var(--wb-border,#e2e6ec);border-radius:12px;color:var(--wb-muted,#8b94a6);font-size:12.5px;text-align:center}",
787
+ ".wbsal-empty-actions{display:flex;gap:8px;justify-content:center;margin-top:2px}",
788
+ ".wbsal-inline-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}",
789
+ /* 五险一金 */
790
+ ".wbsal-social{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px 14px}",
791
+ ".wbsal-social-item{border:1px solid var(--wb-line,#eef0f4);border-radius:10px;padding:10px 12px;display:flex;flex-direction:column;gap:3px;background:color-mix(in srgb,var(--wb-muted,#8b94a6) 5%,transparent)}",
792
+ ".wbsal-social-item span{font-size:11px;color:var(--wb-muted,#8b94a6)}",
793
+ ".wbsal-social-item b{font-size:15px;font-weight:650;font-variant-numeric:tabular-nums}",
794
+ ".wbsal-social-item em{font-size:11px;font-style:normal;color:var(--wb-muted,#8b94a6)}",
795
+ /* 共享组件在深色主题下的覆盖:base 里 notice/pill/json 写死了浅色,这里改成 token */
796
+ ".wbsal-notice{padding:9px 11px;border-radius:9px;font-size:12px;background:color-mix(in srgb,var(--wb-accent,#2563eb) 10%,transparent);color:var(--wb-text,inherit);border:1px solid color-mix(in srgb,var(--wb-accent,#2563eb) 18%,transparent)}",
797
+ ".wbsal-notice.ok{background:color-mix(in srgb,var(--wb-ok,#15803d) 12%,transparent);color:var(--wb-ok,#15803d);border-color:color-mix(in srgb,var(--wb-ok,#15803d) 22%,transparent)}",
798
+ ".wbsal-notice.error{background:color-mix(in srgb,var(--wb-danger,#b91c1c) 12%,transparent);color:var(--wb-danger,#b91c1c);border-color:color-mix(in srgb,var(--wb-danger,#b91c1c) 22%,transparent)}",
799
+ ".wbsal-pill{display:inline-flex;align-items:center;padding:1px 7px;border-radius:999px;font-size:11px;font-weight:600;line-height:1.7;background:color-mix(in srgb,var(--wb-muted,#8b94a6) 14%,transparent);color:var(--wb-muted,#8b94a6)}",
800
+ ".wbsal-pill.ok{background:color-mix(in srgb,var(--wb-ok,#15803d) 13%,transparent);color:var(--wb-ok,#15803d)}",
801
+ ".wbsal-pill.warn{background:color-mix(in srgb,var(--wb-warn,#b45309) 15%,transparent);color:var(--wb-warn,#b45309)}",
802
+ ".wbsal-pill.error{background:color-mix(in srgb,var(--wb-danger,#b91c1c) 13%,transparent);color:var(--wb-danger,#b91c1c)}",
803
+ ".wbsal-json{margin:0;padding:10px;border-radius:9px;background:color-mix(in srgb,var(--wb-muted,#8b94a6) 8%,transparent);font-size:11.5px;line-height:1.6;max-height:240px;overflow:auto;color:var(--wb-text,inherit)}",
804
+ /* 说明页 */
805
+ ".wbsal-card h3{margin:0 0 10px;font-size:14px;font-weight:600;letter-spacing:-0.01em}",
806
+ ".wbsal-page > .wbsal-card + .wbsal-card{margin-top:14px}",
807
+ ".wbsal-row{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end}",
808
+ /* 响应式 */
809
+ "@media (max-width:1100px){.wbsal-detail{grid-template-columns:repeat(2,minmax(0,1fr))}}",
810
+ "@media (max-width:900px){.wbsal-table th.hide-md,.wbsal-table td.hide-md{display:none}}",
811
+ "@media (max-width:760px){.wbsal-detail{grid-template-columns:minmax(0,1fr)}.wbsal-page{padding:16px 14px 36px}.wbsal-table th,.wbsal-table td{padding:9px 10px}.wbsal-opt,.wbsal-table th.opt{display:none}.wbsal-comp-row{grid-template-columns:80px minmax(50px,1fr) 112px}.wbsal-chart{height:170px}}"
812
+ ];
813
+ var DATE = require_date_picker_styles()("wbsal");
814
+ module2.exports = BASE.concat(PAGE, [DATE]).join("\n");
761
815
  }
762
816
  });
763
817
 
@@ -896,6 +950,21 @@ var require_fields = __commonJS({
896
950
  { id: "pretax", title: "\u7A0E\u524D\u6263\u6B3E", hint: "\u5148\u4ECE\u6536\u5165\u4E2D\u6263\u9664", keys: ["sickDeduction", "personalDeduction", "otherDeduction"] },
897
951
  { id: "social", title: "\u793E\u4FDD\u4E0E\u4E2A\u7A0E", hint: "\u518D\u4ECE\u5E94\u53D1\u4E2D\u6263\u9664", keys: ["pension", "medical", "unemployment", "housingFund", "incomeTax", "postTaxDeduction"] }
898
952
  ];
953
+ var EMPLOYMENT_TYPES = [
954
+ { value: "", label: "\u672A\u8BBE\u7F6E" },
955
+ { value: "temp", label: "\u4E34\u65F6" },
956
+ { value: "parttime", label: "\u517C\u804C" },
957
+ { value: "side", label: "\u5916\u5FEB" },
958
+ { value: "intern", label: "\u5B9E\u4E60" },
959
+ { value: "probation", label: "\u8BD5\u7528" },
960
+ { value: "regular", label: "\u6B63\u5F0F" }
961
+ ];
962
+ function employmentLabel(value) {
963
+ for (var i = 0; i < EMPLOYMENT_TYPES.length; i += 1) {
964
+ if (EMPLOYMENT_TYPES[i].value === value) return EMPLOYMENT_TYPES[i].label;
965
+ }
966
+ return "\u672A\u8BBE\u7F6E";
967
+ }
899
968
  var LABELS = {
900
969
  basePay: "\u57FA\u672C\u5DE5\u8D44",
901
970
  performancePay: "\u7EE9\u6548\u5DE5\u8D44",
@@ -984,6 +1053,8 @@ var require_fields = __commonJS({
984
1053
  GROUPS,
985
1054
  KEYS,
986
1055
  LABELS,
1056
+ EMPLOYMENT_TYPES,
1057
+ employmentLabel,
987
1058
  INCOME_KEYS,
988
1059
  PRETAX_KEYS,
989
1060
  SOCIAL_KEYS,
@@ -1003,899 +1074,1861 @@ var require_fields = __commonJS({
1003
1074
  }
1004
1075
  });
1005
1076
 
1006
- // packages/addons/salary/client/views/stats.cjs
1007
- var require_stats = __commonJS({
1008
- "packages/addons/salary/client/views/stats.cjs"(exports2, module2) {
1077
+ // packages/addons/salary/client/views/stats-parts.cjs
1078
+ var require_stats_parts = __commonJS({
1079
+ "packages/addons/salary/client/views/stats-parts.cjs"(exports2, module2) {
1009
1080
  "use strict";
1010
- module2.exports = function Stats(props) {
1011
- var h = props.h, React = props.React, api = props.api;
1012
- var C = require_common();
1013
- var F = require_fields();
1014
- var yearState = React.useState((/* @__PURE__ */ new Date()).getFullYear());
1015
- var year = yearState[0], setYear = yearState[1];
1016
- var basisState = React.useState("arrival");
1017
- var basis = basisState[0], setBasis = basisState[1];
1018
- var basisLabel = basis === "income" ? "\u6309\u6240\u5C5E\u6708" : "\u6309\u5230\u8D26\u6708";
1019
- var load = C.useLoad(React, api, "salary.stats", { year, basis }, [year, basis]);
1020
- var data = load.data;
1021
- var METRICS = [
1022
- { key: "netPay", label: "\u5B9E\u53D1" },
1023
- { key: "basePay", label: "\u57FA\u672C" },
1024
- { key: "performancePay", label: "\u7EE9\u6548" },
1025
- { key: "allowance", label: "\u8865\u8D34" },
1026
- { key: "performanceBonus", label: "\u7EE9\u6548\u5956\u60E9" },
1027
- { key: "grossPay", label: "\u5E94\u53D1" }
1028
- ];
1029
- var metricState = React.useState(props.initialMetric || "netPay");
1030
- var metric = metricState[0], setMetric = metricState[1];
1031
- var metricLabel = "\u5B9E\u53D1";
1032
- METRICS.forEach(function(m) {
1033
- if (m.key === metric) metricLabel = m.label;
1081
+ var TONE_COLOR = {
1082
+ s1: "var(--wb-accent,#2563eb)",
1083
+ s2: "var(--wb-ok,#16a34a)",
1084
+ s3: "var(--wb-warn,#d97706)",
1085
+ s4: "color-mix(in oklab,var(--wb-accent,#2563eb) 45%,var(--wb-danger,#dc2626))",
1086
+ s5: "color-mix(in oklab,var(--wb-ok,#16a34a) 55%,var(--wb-accent,#2563eb))",
1087
+ s6: "color-mix(in oklab,var(--wb-warn,#d97706) 60%,var(--wb-danger,#dc2626))",
1088
+ sum: "color-mix(in oklab,var(--wb-muted,#8b94a6) 45%,var(--wb-accent,#2563eb))",
1089
+ t1: "var(--wb-accent,#2563eb)",
1090
+ t2: "color-mix(in oklab,var(--wb-ok,#16a34a) 60%,var(--wb-muted,#8b94a6))",
1091
+ t3: "color-mix(in oklab,var(--wb-warn,#d97706) 55%,var(--wb-muted,#8b94a6))"
1092
+ };
1093
+ function segGroup(h, options, value, onPick, ariaLabel) {
1094
+ return h("div", { className: "wbsal-metric", role: "group", "aria-label": ariaLabel }, options.map(function(option) {
1095
+ return h("button", {
1096
+ key: option[0],
1097
+ type: "button",
1098
+ className: value === option[0] ? "on" : "",
1099
+ "aria-pressed": value === option[0],
1100
+ onClick: function() {
1101
+ onPick(option[0]);
1102
+ }
1103
+ }, option[1]);
1104
+ }));
1105
+ }
1106
+ function seriesSwitch(h, series, shown, onToggle, ariaLabel) {
1107
+ return h("div", { className: "wbsal-series", role: "group", "aria-label": ariaLabel }, series.map(function(m) {
1108
+ return h("button", {
1109
+ key: m.key,
1110
+ type: "button",
1111
+ className: shown[m.key] === false ? "off" : "",
1112
+ "aria-pressed": shown[m.key] !== false,
1113
+ title: (shown[m.key] === false ? "\u663E\u793A" : "\u9690\u85CF") + m.label,
1114
+ onClick: function() {
1115
+ onToggle(m.key);
1116
+ }
1117
+ }, h("i", { className: m.tone }), m.label);
1118
+ }));
1119
+ }
1120
+ function anyShown(series, shown) {
1121
+ return series.some(function(m) {
1122
+ return shown[m.key] !== false;
1034
1123
  });
1035
- var monthly = data && data.monthly || [];
1036
- function metricValue(bucket) {
1037
- return Number(bucket[metric]) || 0;
1038
- }
1039
- var maxNet = 1;
1040
- monthly.forEach(function(bucket) {
1041
- if (metricValue(bucket) > maxNet) maxNet = metricValue(bucket);
1124
+ }
1125
+ function tipCard(h, ctx) {
1126
+ if (ctx.index === null || ctx.index === void 0) return null;
1127
+ var kids = [h("strong", { key: "t" }, ctx.title)];
1128
+ (ctx.rows || []).forEach(function(row) {
1129
+ kids.push(h(
1130
+ "div",
1131
+ { key: row.key, className: "wbsal-tip-row" },
1132
+ h("i", { className: row.tone }),
1133
+ h("span", null, row.label),
1134
+ h("b", null, ctx.fmt(row.value))
1135
+ ));
1042
1136
  });
1043
- var topMonth = -1;
1044
- monthly.forEach(function(bucket, i) {
1045
- if (metricValue(bucket) > 0 && (topMonth < 0 || metricValue(bucket) > metricValue(monthly[topMonth]))) topMonth = i;
1137
+ if (ctx.note) kids.push(h("em", { key: "n" }, ctx.note));
1138
+ var length = ctx.length || 1;
1139
+ var ratio = length > 1 ? ctx.index / (length - 1) : 0;
1140
+ return h("div", {
1141
+ className: "wbsal-tip" + (ratio > 0.62 ? " is-right" : ""),
1142
+ style: { left: ratio * 100 + "%" }
1143
+ }, kids);
1144
+ }
1145
+ function trendCard(opts) {
1146
+ var h = opts.h, CH = opts.CH;
1147
+ var rows = opts.rows || [];
1148
+ var series = (opts.series || []).map(function(s) {
1149
+ return { key: s.key, label: s.label, className: s.tone, color: s.color || TONE_COLOR[s.tone] || void 0 };
1046
1150
  });
1047
- var LINE_SERIES = [
1048
- { key: "netPay", label: "\u5B9E\u53D1", tone: "s1" },
1049
- { key: "grossPay", label: "\u5E94\u53D1", tone: "s2" },
1050
- { key: "basePay", label: "\u57FA\u672C", tone: "s3" },
1051
- { key: "performancePay", label: "\u7EE9\u6548", tone: "s4" },
1052
- { key: "allowance", label: "\u8865\u8D34", tone: "s5" },
1053
- { key: "performanceBonus", label: "\u7EE9\u6548\u5956\u60E9", tone: "s6" }
1054
- ];
1055
- var visibleState = React.useState(Object.assign({ netPay: true, grossPay: true, basePay: true, performancePay: true, allowance: true, performanceBonus: true }, props.initialVisible || {}));
1056
- var visible = visibleState[0];
1057
- function toggleSeries(key) {
1058
- var next = {};
1059
- LINE_SERIES.forEach(function(m) {
1060
- next[m.key] = !!visible[m.key];
1061
- });
1062
- next[key] = !next[key];
1063
- visibleState[1](next);
1064
- }
1065
- function round2(value) {
1066
- return Math.round((Number(value) || 0) * 100) / 100;
1067
- }
1068
- function deductOf(bucket) {
1069
- return round2((Number(bucket.pension) || 0) + (Number(bucket.medical) || 0) + (Number(bucket.unemployment) || 0) + (Number(bucket.housingFund) || 0) + (Number(bucket.incomeTax) || 0));
1070
- }
1071
- function seriesValue(m, bucket) {
1072
- if (typeof m.get === "function") return m.get(bucket);
1073
- return Number(bucket[m.key]) || 0;
1074
- }
1075
- var DEDUCT_TOTAL_ALL = round2((data && data.socialTotal) + (data && data.incomeTaxTotal));
1076
- var DEDUCT_SERIES = F.SOCIAL_KEYS.map(function(key, index) {
1077
- return { key, label: F.LABELS[key], tone: "s" + (index + 1) };
1078
- }).concat([
1079
- { key: "incomeTax", label: "\u4E2A\u7A0E", tone: "s5" },
1080
- { key: "deductTotal", label: "\u5408\u8BA1", tone: "sum", get: deductOf }
1081
- ]);
1082
- var socialVisibleState = React.useState(Object.assign({ pension: true, medical: true, unemployment: true, housingFund: true, incomeTax: true, deductTotal: true }, props.initialSocialVisible || {}));
1083
- var socialVisible = socialVisibleState[0];
1084
- function toggleSocial(key) {
1085
- var next = {};
1086
- DEDUCT_SERIES.forEach(function(m) {
1087
- next[m.key] = !!socialVisible[m.key];
1088
- });
1089
- next[key] = !next[key];
1090
- socialVisibleState[1](next);
1091
- }
1092
- var hoverState = React.useState(props.initialHover || null);
1093
- var hover = hoverState[0], setHover = hoverState[1];
1094
- var socialHoverState = React.useState(props.initialSocialHover || null);
1095
- var socialHover = socialHoverState[0], setSocialHover = socialHoverState[1];
1096
- var recordedMonths = monthly.filter(function(bucket) {
1097
- return bucket.records > 0;
1151
+ var shown = opts.visible || {};
1152
+ var empty = rows.length === 0;
1153
+ var idx = typeof opts.hover === "number" && opts.hover >= 0 && opts.hover < rows.length ? opts.hover : null;
1154
+ var row = idx === null ? null : rows[idx];
1155
+ return h(
1156
+ "div",
1157
+ { className: "wbsal-card wbsal-section" },
1158
+ h(
1159
+ "div",
1160
+ { className: "wbsal-section-head" },
1161
+ h("h3", null, opts.title),
1162
+ h(
1163
+ "div",
1164
+ { className: "wbsal-section-tools" },
1165
+ opts.note ? h("span", { className: "wbsal-section-note" }, opts.note) : null,
1166
+ seriesSwitch(h, opts.series || [], shown, opts.onToggle, (opts.title || "\u6298\u7EBF") + "\u663E\u793A\u5F00\u5173")
1167
+ )
1168
+ ),
1169
+ empty ? h(CH.Empty, { text: opts.emptyText || "\u8FD8\u6CA1\u6709\u53EF\u753B\u7684\u8BB0\u5F55" }) : h(
1170
+ "div",
1171
+ { className: "wbsal-linechart" },
1172
+ h(CH.Trend, {
1173
+ data: rows.map(function(row2) {
1174
+ return row2;
1175
+ }),
1176
+ series,
1177
+ lang: opts.lang,
1178
+ height: opts.height || 210,
1179
+ showLegend: false,
1180
+ visible: shown,
1181
+ active: idx,
1182
+ onHover: opts.onHover,
1183
+ format: opts.fmt,
1184
+ label: opts.label,
1185
+ note: opts.noteOf,
1186
+ aria: opts.ariaLabel,
1187
+ emptyText: opts.emptyText
1188
+ }),
1189
+ empty || idx === null ? null : tipCard(h, {
1190
+ index: idx,
1191
+ length: rows.length,
1192
+ title: opts.tipTitle ? opts.tipTitle(row) : "",
1193
+ rows: opts.tipRows ? opts.tipRows(row) : [],
1194
+ note: opts.tipNote ? opts.tipNote(row) : "",
1195
+ fmt: opts.fmt
1196
+ })
1197
+ ),
1198
+ !empty && anyShown(opts.series || [], shown) ? null : h("div", { className: "wbsal-chart-hint" }, opts.allOffHint || "\u6240\u6709\u7EBF\u90FD\u5173\u6389\u4E86\uFF0C\u70B9\u4E0A\u65B9\u7684\u6807\u7B7E\u4EFB\u610F\u4E00\u4E2A\u6062\u590D\u663E\u793A"),
1199
+ h(
1200
+ "div",
1201
+ { className: "wbsal-chart-foot" },
1202
+ h("span", null, opts.footLeft || ""),
1203
+ h("span", null, opts.footRight || "")
1204
+ )
1205
+ );
1206
+ }
1207
+ function barChart(opts) {
1208
+ var h = opts.h, F = opts.F;
1209
+ var rows = opts.rows || [];
1210
+ var values = rows.map(function(b) {
1211
+ return opts.value(b);
1098
1212
  });
1099
- var LPAD = { l: 62, r: 16, t: 14, b: 30 };
1100
- var LW = 1e3, LH = 250;
1101
- var plotW = LW - LPAD.l - LPAD.r;
1102
- var plotH = LH - LPAD.t - LPAD.b;
1103
- function plotX(month) {
1104
- return LPAD.l + (month - 1) / 11 * plotW;
1105
- }
1106
- function gridLabel(value) {
1107
- if (value >= 100 || value === 0) return Math.round(value).toLocaleString("zh-CN");
1108
- return Number(value.toFixed(1)).toLocaleString("zh-CN");
1109
- }
1110
- function niceStep(raw) {
1111
- if (!(raw > 0)) return 1;
1112
- var exp = Math.pow(10, Math.floor(Math.log(raw) / Math.LN10));
1113
- var norm = raw / exp;
1114
- var mult = norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 2.5 ? 2.5 : norm <= 5 ? 5 : 10;
1115
- return mult * exp;
1116
- }
1117
- function renderChart(series, shown, ariaLabel, activeMonth, onHover) {
1118
- var max = 0;
1119
- recordedMonths.forEach(function(bucket) {
1120
- series.forEach(function(m) {
1121
- if (!shown[m.key]) return;
1122
- var v = seriesValue(m, bucket);
1123
- if (v > max) max = v;
1124
- });
1125
- });
1126
- var step = niceStep(Math.max(max, 1) / 5);
1127
- var axisMax = step * 5;
1128
- function plotY(value) {
1129
- return LPAD.t + plotH * (1 - Math.min(1, (Number(value) || 0) / axisMax));
1213
+ var max = Math.max(1, Math.max.apply(null, values));
1214
+ var topIndex = -1;
1215
+ values.forEach(function(v, i) {
1216
+ if (v > 0 && (topIndex < 0 || v > values[topIndex])) topIndex = i;
1217
+ });
1218
+ var top = rows[topIndex];
1219
+ return h(
1220
+ "div",
1221
+ null,
1222
+ h("div", { className: "wbsal-chart" }, rows.map(function(bucket, i) {
1223
+ var value = values[i];
1224
+ var ratio = value > 0 ? value / max : 0;
1225
+ var height = Math.round(Math.max(ratio * 150, value > 0 ? 6 : 0));
1226
+ return h(
1227
+ "div",
1228
+ {
1229
+ key: bucket.month,
1230
+ className: "wbsal-bar",
1231
+ title: bucket.month + " \u6708 \xB7 \u57FA\u672C " + F.money(bucket.basePay) + " / \u7EE9\u6548 " + F.money(bucket.performancePay) + " / \u8865\u8D34 " + F.money(bucket.allowance) + " / \u7EE9\u6548\u5956\u60E9 " + F.money(bucket.performanceBonus) + " / \u5E94\u53D1 " + F.money(bucket.grossPay) + " / \u5B9E\u53D1 " + F.money(bucket.netPay)
1232
+ },
1233
+ h("div", { className: "wbsal-bar-value" }, value > 0 ? Math.round(value).toLocaleString("zh-CN") : ""),
1234
+ h("div", { className: "wbsal-bar-fill" + (i === topIndex ? " top" : ""), style: { height: height + "px" } }),
1235
+ h("div", { className: "wbsal-bar-label" }, "")
1236
+ );
1237
+ })),
1238
+ h("div", { className: "wbsal-axis" }, rows.map(function(bucket) {
1239
+ return h("span", { key: bucket.month }, bucket.month);
1240
+ })),
1241
+ h(
1242
+ "div",
1243
+ { className: "wbsal-chart-foot" },
1244
+ h("span", { className: "wbsal-legend" }, h("i", null), "\u6700\u9AD8\u6708", h("i", { className: "soft" }), "\u5176\u4ED6\u6708\u4EFD"),
1245
+ h("span", null, top ? "\u6700\u9AD8 " + F.monthLabel(top.period) + " \xB7 " + F.money(Math.max(0, values[topIndex] || 0)) : "")
1246
+ ),
1247
+ h(
1248
+ "div",
1249
+ { className: "wbsal-chart-foot" },
1250
+ h("span", null, "\u67F1\u9AD8\u6309" + opts.metricLabel + "\u53D6\u503C\uFF0C\u60AC\u505C\u770B\u8BE5\u6708\u5168\u90E8\u7EF4\u5EA6"),
1251
+ h("span", null, "\u5355\u4F4D\uFF1A\u5143 \xB7 " + opts.basisLabel)
1252
+ )
1253
+ );
1254
+ }
1255
+ function kpi(h, label, value, sub) {
1256
+ return h("div", { className: "wbsal-card wbsal-kpi" }, h("span", null, label), h("strong", null, value), h("em", null, sub));
1257
+ }
1258
+ function compRows(h, F, fields, keys, total, deduction) {
1259
+ var rows = keys.filter(function(key) {
1260
+ return (fields[key] || 0) !== 0;
1261
+ });
1262
+ if (rows.length === 0) return null;
1263
+ return h("div", { className: "wbsal-comp" }, rows.map(function(key) {
1264
+ var amount = fields[key] || 0;
1265
+ var percent = total ? Math.max(2, Math.min(100, Math.round(Math.abs(amount) / total * 100))) : 0;
1266
+ return h(
1267
+ "div",
1268
+ { key, className: "wbsal-comp-row" },
1269
+ h("span", null, F.LABELS[key]),
1270
+ h("div", { className: "wbsal-comp-track" }, h("div", { className: "wbsal-comp-fill" + (deduction ? " deduction" : ""), style: { width: percent + "%" } })),
1271
+ h("span", { className: "wbsal-comp-value" }, h("b", null, F.money(amount)), " \xB7 " + percent + "%")
1272
+ );
1273
+ }));
1274
+ }
1275
+ module2.exports = {
1276
+ TONE_COLOR,
1277
+ segGroup,
1278
+ seriesSwitch,
1279
+ anyShown,
1280
+ trendCard,
1281
+ barChart,
1282
+ kpi,
1283
+ compRows
1284
+ };
1285
+ }
1286
+ });
1287
+
1288
+ // packages/addons/lib/date-picker.cjs
1289
+ var require_date_picker = __commonJS({
1290
+ "packages/addons/lib/date-picker.cjs"(exports2, module2) {
1291
+ "use strict";
1292
+ var ReactDefault = require("react");
1293
+ var MONTH_EN = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
1294
+ function pad(n) {
1295
+ return String(n).padStart(2, "0");
1296
+ }
1297
+ function todayISO() {
1298
+ var d = /* @__PURE__ */ new Date();
1299
+ return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
1300
+ }
1301
+ function validDate(value) {
1302
+ if (!value) return false;
1303
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return false;
1304
+ var d = /* @__PURE__ */ new Date(value + "T00:00:00Z");
1305
+ return isFinite(d.getTime()) && d.toISOString().slice(0, 10) === value && value.slice(0, 4) !== "0000";
1306
+ }
1307
+ function toUTC(iso) {
1308
+ return /* @__PURE__ */ new Date(iso + "T00:00:00Z");
1309
+ }
1310
+ function shiftDate(iso, days) {
1311
+ var d = toUTC(iso);
1312
+ d.setUTCDate(d.getUTCDate() + days);
1313
+ return d.toISOString().slice(0, 10);
1314
+ }
1315
+ function shiftMonth(month, delta) {
1316
+ var d = toUTC(month + "-01");
1317
+ d.setUTCMonth(d.getUTCMonth() + delta);
1318
+ return d.toISOString().slice(0, 7);
1319
+ }
1320
+ function monthKey(iso) {
1321
+ return (iso || todayISO()).slice(0, 7);
1322
+ }
1323
+ function monthLabel(month, en) {
1324
+ return en ? month.slice(0, 4) + "-" + month.slice(5) : month.slice(0, 4) + "\u5E74" + Number(month.slice(5)) + "\u6708";
1325
+ }
1326
+ function daysInMonth(month) {
1327
+ return new Date(Date.UTC(Number(month.slice(0, 4)), Number(month.slice(5)), 0)).getUTCDate();
1328
+ }
1329
+ function normalizeRange(value) {
1330
+ var from = value && validDate(value.from) ? value.from : "";
1331
+ var to = value && validDate(value.to) ? value.to : "";
1332
+ if (from && to && from > to) return { from: to, to: from, swapped: true };
1333
+ return { from, to, swapped: false };
1334
+ }
1335
+ function clampDay(iso, min, max) {
1336
+ if (min && iso < min) return false;
1337
+ if (max && iso > max) return false;
1338
+ return true;
1339
+ }
1340
+ function ctx(props) {
1341
+ var R = props && props.React || ReactDefault;
1342
+ return { R, h: props && props.h || R.createElement };
1343
+ }
1344
+ function usePopover(R, open, setOpen, root) {
1345
+ R.useEffect(function() {
1346
+ if (!open) return void 0;
1347
+ function onDoc(ev) {
1348
+ if (root.current && !root.current.contains(ev.target)) setOpen(false);
1130
1349
  }
1131
- var children = [];
1132
- if (onHover) {
1133
- var slot = plotW / 12;
1134
- children.push(h("rect", {
1135
- key: "hit-area",
1136
- x: LPAD.l - slot / 2,
1137
- y: LPAD.t,
1138
- width: plotW + slot,
1139
- height: plotH,
1140
- className: "wbsal-hit-area",
1141
- onMouseLeave: function() {
1142
- onHover(null);
1143
- }
1144
- }));
1145
- recordedMonths.forEach(function(bucket) {
1146
- children.push(h("rect", {
1147
- key: "hit" + bucket.month,
1148
- x: plotX(bucket.month) - slot / 2,
1149
- y: LPAD.t,
1150
- width: slot,
1151
- height: plotH,
1152
- className: "wbsal-hit",
1153
- onMouseEnter: function() {
1154
- onHover(bucket.month);
1155
- }
1156
- }));
1157
- });
1350
+ function onKey(ev) {
1351
+ if (ev.key === "Escape") setOpen(false);
1158
1352
  }
1159
- [1, 0.8, 0.6, 0.4, 0.2, 0].forEach(function(ratio) {
1160
- var value = axisMax * ratio;
1161
- var y = plotY(value);
1162
- children.push(h("line", { key: "g" + ratio, x1: LPAD.l, y1: y, x2: LW - LPAD.r, y2: y, className: "wbsal-line-gridline" }));
1163
- children.push(h("text", { key: "gt" + ratio, x: LPAD.l - 10, y: y + 4, textAnchor: "end" }, gridLabel(value)));
1164
- });
1165
- monthly.forEach(function(bucket) {
1166
- children.push(h("text", { key: "x" + bucket.month, x: plotX(bucket.month), y: LH - 10, textAnchor: "middle" }, bucket.month));
1167
- });
1168
- if (activeMonth) {
1169
- children.push(h("line", {
1170
- key: "crosshair",
1171
- x1: plotX(activeMonth),
1172
- y1: LPAD.t,
1173
- x2: plotX(activeMonth),
1174
- y2: LPAD.t + plotH,
1175
- className: "wbsal-crosshair"
1176
- }));
1353
+ if (typeof document !== "undefined" && typeof document.addEventListener === "function") {
1354
+ document.addEventListener("mousedown", onDoc);
1355
+ document.addEventListener("keydown", onKey);
1356
+ return function() {
1357
+ document.removeEventListener("mousedown", onDoc);
1358
+ document.removeEventListener("keydown", onKey);
1359
+ };
1177
1360
  }
1178
- series.forEach(function(m) {
1179
- if (!shown[m.key] || recordedMonths.length === 0) return;
1180
- var points = recordedMonths.map(function(bucket) {
1181
- return { month: bucket.month, value: seriesValue(m, bucket) };
1182
- });
1183
- if (points.length > 1) {
1184
- children.push(h("polyline", {
1185
- key: "line" + m.key,
1186
- className: "wbsal-line " + m.tone,
1187
- points: points.map(function(pt) {
1188
- return plotX(pt.month) + "," + plotY(pt.value);
1189
- }).join(" ")
1190
- }));
1361
+ return void 0;
1362
+ }, [open]);
1363
+ }
1364
+ function Calendar(props) {
1365
+ var h = props.h, p = props.prefix, en = props.lang === "en";
1366
+ var month = props.month, cells = [];
1367
+ var offset = toUTC(month + "-01").getUTCDay();
1368
+ var count = daysInMonth(month);
1369
+ var i;
1370
+ for (i = 0; i < offset; i++) cells.push(h("span", { key: "e" + i, "aria-hidden": "true" }));
1371
+ for (i = 1; i <= count; i++) {
1372
+ var day = month + "-" + pad(i);
1373
+ var disabled = !clampDay(day, props.min, props.max);
1374
+ var selected = props.isSelected ? props.isSelected(day) : false;
1375
+ var between = props.isBetween ? props.isBetween(day) : false;
1376
+ cells.push(h("button", {
1377
+ key: day,
1378
+ type: "button",
1379
+ disabled,
1380
+ "data-day": day,
1381
+ "aria-label": day,
1382
+ "aria-pressed": selected,
1383
+ "aria-current": day === todayISO() ? "date" : void 0,
1384
+ className: p + "-dp-day" + (selected ? " is-on" : "") + (between ? " is-between" : "") + (day === todayISO() ? " is-today" : ""),
1385
+ onClick: props.onPick.bind(null, day),
1386
+ onKeyDown: function(ev) {
1387
+ var delta = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -7, ArrowDown: 7 }[ev.key];
1388
+ if (!delta) return;
1389
+ ev.preventDefault();
1390
+ var next = shiftDate(ev.currentTarget.getAttribute("data-day"), delta);
1391
+ if (clampDay(next, props.min, props.max)) props.onMove(monthKey(next), next);
1191
1392
  }
1192
- points.forEach(function(pt) {
1193
- children.push(h("circle", {
1194
- key: "dot" + m.key + pt.month,
1195
- className: "wbsal-line-dot " + m.tone + (pt.month === activeMonth ? " is-hot" : ""),
1196
- cx: plotX(pt.month),
1197
- cy: plotY(pt.value),
1198
- r: pt.month === activeMonth ? 5 : 3.6
1199
- }, h("title", null, pt.month + " \u6708 \xB7 " + m.label + " " + F.money(pt.value))));
1200
- });
1201
- });
1202
- return h("svg", { viewBox: "0 0 " + LW + " " + LH, role: "img", "aria-label": ariaLabel }, children);
1393
+ }, i));
1203
1394
  }
1204
- function seriesSwitch(series, shown, onToggle, ariaLabel) {
1205
- return h("div", { className: "wbsal-series", role: "group", "aria-label": ariaLabel }, series.map(function(m) {
1206
- return h("button", {
1207
- key: m.key,
1208
- type: "button",
1209
- className: shown[m.key] ? "on" : "off",
1210
- "aria-pressed": !!shown[m.key],
1211
- title: (shown[m.key] ? "\u9690\u85CF" : "\u663E\u793A") + m.label,
1212
- onClick: function() {
1213
- onToggle(m.key);
1214
- }
1215
- }, h("i", { className: m.tone }), m.label);
1216
- }));
1395
+ return h(
1396
+ "div",
1397
+ { className: p + "-dp-cal", role: "group", "aria-label": en ? "Calendar" : "\u65E5\u5386" },
1398
+ h(
1399
+ "div",
1400
+ { className: p + "-dp-head" },
1401
+ h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Previous month" : "\u4E0A\u4E2A\u6708", onClick: function() {
1402
+ props.onMove(shiftMonth(month, -1), "");
1403
+ } }, "\u2039"),
1404
+ h("strong", { className: p + "-dp-title", "aria-live": "polite" }, monthLabel(month, en)),
1405
+ h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Next month" : "\u4E0B\u4E2A\u6708", onClick: function() {
1406
+ props.onMove(shiftMonth(month, 1), "");
1407
+ } }, "\u203A")
1408
+ ),
1409
+ h(
1410
+ "div",
1411
+ { className: p + "-dp-weekdays", "aria-hidden": "true" },
1412
+ (en ? ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] : ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"]).map(function(w) {
1413
+ return h("span", { key: w }, w);
1414
+ })
1415
+ ),
1416
+ h("div", { className: p + "-dp-grid" }, cells)
1417
+ );
1418
+ }
1419
+ function DatePicker(props) {
1420
+ var c = ctx(props), R = c.R, h = c.h;
1421
+ var p = props.prefix, en = props.lang === "en";
1422
+ var value = validDate(props.value) ? props.value : "";
1423
+ var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
1424
+ var monthS = R.useState(monthKey(value || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
1425
+ var root = R.useRef(null);
1426
+ usePopover(R, open, setOpen, root);
1427
+ function pick(day) {
1428
+ if (props.onChange) props.onChange(day);
1429
+ setOpen(false);
1217
1430
  }
1218
- function anyShown(series, shown) {
1219
- return series.some(function(m) {
1220
- return shown[m.key];
1221
- });
1431
+ function toggle() {
1432
+ setMonth(monthKey(validDate(props.value) ? props.value : props.max || todayISO()));
1433
+ setOpen(!open);
1222
1434
  }
1223
- function renderTip(series, shown, month) {
1224
- if (!month) return null;
1225
- var bucket = null;
1226
- monthly.forEach(function(b) {
1227
- if (b.month === month) bucket = b;
1228
- });
1229
- if (!bucket) return null;
1230
- var kids = [h("strong", { key: "m" }, F.monthLabel(bucket.period))];
1231
- series.forEach(function(m) {
1232
- if (!shown[m.key]) return;
1233
- kids.push(h(
1435
+ return h(
1436
+ "div",
1437
+ { className: p + "-dp" + (props.className ? " " + props.className : ""), ref: root },
1438
+ h(
1439
+ "div",
1440
+ { className: p + "-dp-field" },
1441
+ h(
1442
+ "button",
1443
+ {
1444
+ type: "button",
1445
+ className: p + "-dp-trigger",
1446
+ disabled: !!props.disabled,
1447
+ "aria-haspopup": "dialog",
1448
+ "aria-expanded": open,
1449
+ "aria-label": (props.label ? props.label + ": " : "") + (value || props.placeholder || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F")),
1450
+ onClick: toggle
1451
+ },
1452
+ h("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
1453
+ h("span", { className: p + "-dp-value" + (value ? "" : " is-empty") }, value || props.placeholder || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F"))
1454
+ ),
1455
+ value && !props.disabled && props.clearable !== false ? h("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear date" : "\u6E05\u9664\u65E5\u671F", onClick: function() {
1456
+ if (props.onChange) props.onChange("");
1457
+ } }, "\xD7") : null
1458
+ ),
1459
+ open ? h(
1460
+ "div",
1461
+ { className: p + "-dp-pop", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F") },
1462
+ h(Calendar, { h, prefix: p, lang: props.lang, month, min: props.min, max: props.max, onMove: function(m) {
1463
+ setMonth(m);
1464
+ }, isSelected: function(d) {
1465
+ return d === value;
1466
+ }, onPick: pick }),
1467
+ h(
1234
1468
  "div",
1235
- { key: m.key, className: "wbsal-tip-row" },
1236
- h("i", { className: m.tone }),
1237
- h("span", null, m.label),
1238
- h("b", null, F.money(seriesValue(m, bucket)))
1239
- ));
1240
- });
1241
- kids.push(h("em", { key: "n" }, bucket.records + " \u7B14\u8BB0\u5F55"));
1242
- return h("div", {
1243
- className: "wbsal-tip" + (month >= 8 ? " is-right" : ""),
1244
- style: { left: plotX(month) / LW * 100 + "%" }
1245
- }, kids);
1246
- }
1247
- function signed(amount) {
1248
- var n = Number(amount) || 0;
1249
- return (n > 0 ? "+" : n < 0 ? "-" : "") + F.money(Math.abs(n));
1469
+ { className: p + "-dp-foot" },
1470
+ h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1471
+ pick(todayISO());
1472
+ } }, en ? "Today" : "\u4ECA\u5929"),
1473
+ props.min || props.max ? h("span", { className: p + "-dp-hint" }, [props.min, props.max].filter(Boolean).join(" \u2014 ")) : null
1474
+ )
1475
+ ) : null
1476
+ );
1477
+ }
1478
+ function RangePicker(props) {
1479
+ var c = ctx(props), R = c.R, h = c.h;
1480
+ var p = props.prefix, en = props.lang === "en";
1481
+ var range = normalizeRange(props.value);
1482
+ var from = range.from, to = range.to;
1483
+ var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
1484
+ var startS = R.useState(""), start = startS[0], setStart = startS[1];
1485
+ var monthS = R.useState(monthKey(from || to || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
1486
+ var root = R.useRef(null);
1487
+ usePopover(R, open, setOpen, root);
1488
+ function apply(next) {
1489
+ if (typeof props.onChange === "function") props.onChange(normalizeRange(next));
1490
+ setStart("");
1491
+ setOpen(false);
1250
1492
  }
1251
- function kpi(label, value, sub) {
1252
- return h("div", { className: "wbsal-card wbsal-kpi" }, h("span", null, label), h("strong", null, value), h("em", null, sub));
1493
+ function pick(day) {
1494
+ if (!start) {
1495
+ setStart(day);
1496
+ return;
1497
+ }
1498
+ apply({ from: start, to: day });
1253
1499
  }
1254
- function compRows(keys, total, deduction) {
1255
- var rows = keys.filter(function(key) {
1256
- return (data.latestMonth.breakdown.fields[key] || 0) !== 0;
1257
- });
1258
- if (rows.length === 0) return null;
1259
- return h("div", { className: "wbsal-comp" }, rows.map(function(key) {
1260
- var amount = data.latestMonth.breakdown.fields[key] || 0;
1261
- var percent = total ? Math.max(2, Math.min(100, Math.round(Math.abs(amount) / total * 100))) : 0;
1262
- return h(
1263
- "div",
1264
- { key, className: "wbsal-comp-row" },
1265
- h("span", null, F.LABELS[key]),
1266
- h("div", { className: "wbsal-comp-track" }, h("div", { className: "wbsal-comp-fill" + (deduction ? " deduction" : ""), style: { width: percent + "%" } })),
1267
- h("span", { className: "wbsal-comp-value" }, h("b", null, F.money(amount)), " \xB7 " + percent + "%")
1268
- );
1269
- }));
1500
+ function toggle() {
1501
+ setStart("");
1502
+ setMonth(monthKey(from || to || props.max || todayISO()));
1503
+ setOpen(!open);
1270
1504
  }
1271
- var body;
1272
- if (load.error) body = h(C.Notice, { h, kind: "error", text: load.error });
1273
- else if (load.loading || data && (data.year !== year || data.basis !== basis)) body = h(C.Empty, { h, text: "\u52A0\u8F7D\u4E2D\u2026" });
1274
- else if (!data || data.records === 0) {
1275
- body = h(
1276
- "div",
1277
- { className: "wbsal-empty" },
1278
- h("div", null, year + " \u5E74\u6CA1\u6709\u6309\u5F53\u524D\u53E3\u5F84\u5F52\u5165\u7684\u5DE5\u8D44\u8BB0\u5F55")
1279
- );
1280
- } else {
1281
- var latestBreakdown = data.latestMonth && data.latestMonth.breakdown;
1282
- var deductionTotal = latestBreakdown ? latestBreakdown.preTax + latestBreakdown.social + latestBreakdown.tax : 0;
1283
- var chartMax = Math.max(1, maxNet);
1284
- body = h(
1505
+ var summary = from && to ? from + " \u2014 " + to : from ? from + (en ? " onward" : " \u8D77") : to ? (en ? "Until " : "\u622A\u81F3 ") + to : props.placeholder || (en ? "Choose date range" : "\u9009\u62E9\u65E5\u671F\u8303\u56F4");
1506
+ return h(
1507
+ "div",
1508
+ { className: p + "-dr" + (props.className ? " " + props.className : ""), ref: root },
1509
+ h(
1285
1510
  "div",
1286
- { className: "wbsal-section" },
1287
- h(
1288
- "div",
1289
- { className: "wbsal-kpis" },
1290
- kpi("\u6700\u8FD1\u5B9E\u53D1", data.latest ? F.money(data.latest.netPay) : "\u2014", data.latest ? data.latest.payDate + " \xB7 \u6700\u8FD1\u4E00\u7B14" : "\u8FD8\u6CA1\u6709\u8BB0\u5F55"),
1291
- kpi("\u6708\u5747\u5B9E\u53D1", F.money(data.avgNetPay), "\u6309\u6709\u8BB0\u5F55\u7684\u6708\u4EFD\u5E73\u5747"),
1292
- kpi("\u5E74\u5EA6\u5B9E\u53D1\u5408\u8BA1", F.money(data.netTotal), data.records + " \u7B14 \xB7 \u8986\u76D6 " + data.months + " \u4E2A\u6708"),
1293
- kpi("\u5E74\u5EA6\u5E94\u53D1", F.money(data.grossTotal), "\u7A0E\u524D"),
1294
- kpi("\u5E74\u5EA6\u4E2A\u7A0E", F.money(data.incomeTaxTotal), "\u5DE5\u8D44\u85AA\u91D1\u9884\u6263"),
1295
- kpi("\u5E74\u5EA6\u4E94\u9669\u4E00\u91D1", F.money(data.socialTotal), "\u517B\u8001 / \u533B\u7597 / \u5931\u4E1A / \u516C\u79EF\u91D1")
1296
- ),
1297
- // 环比 / 最近月份 / 最近一笔:紧贴月度趋势图上方,先给结论再看图
1511
+ { className: p + "-dp-field" },
1298
1512
  h(
1299
- "div",
1300
- { className: "wbsal-kpis" },
1301
- kpi(
1302
- "\u73AF\u6BD4",
1303
- data.mom ? signed(data.mom.amount) : "\u2014",
1304
- data.mom ? data.mom.percent === null ? "\u4E0A\u6708\u4E3A 0" : (data.mom.percent > 0 ? "+" : "") + data.mom.percent + "% \xB7 \u6700\u8FD1\u4E24\u4E2A\u6708" : "\u81F3\u5C11\u9700\u8981\u4E24\u4E2A\u6708\u8BB0\u5F55"
1305
- ),
1306
- kpi("\u6700\u8FD1\u6708\u4EFD", data.latestMonth ? F.monthLabel(data.latestMonth.period) : "\u2014", data.latestMonth ? data.latestMonth.records + " \u7B14" : ""),
1307
- kpi("\u6700\u8FD1\u4E00\u7B14", data.latest ? data.latest.payDate : "\u2014", data.latest ? (data.latest.cycle === "daily" ? "\u65E5\u7ED3" : "\u6708\u7ED3") + " \xB7 " + F.money(data.latest.netPay) : "")
1513
+ "button",
1514
+ {
1515
+ type: "button",
1516
+ className: p + "-dp-trigger",
1517
+ "aria-haspopup": "dialog",
1518
+ "aria-expanded": open,
1519
+ "aria-label": (props.label || (en ? "Date range" : "\u65E5\u671F\u8303\u56F4")) + ": " + summary,
1520
+ onClick: toggle
1521
+ },
1522
+ h("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
1523
+ h("span", { className: p + "-dp-value" + (from || to ? "" : " is-empty") }, summary)
1308
1524
  ),
1525
+ (from || to) && props.clearable !== false ? h("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear range" : "\u6E05\u9664\u8303\u56F4", onClick: function() {
1526
+ apply({ from: "", to: "" });
1527
+ } }, "\xD7") : null
1528
+ ),
1529
+ open ? h(
1530
+ "div",
1531
+ { className: p + "-dp-pop", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Date range" : "\u65E5\u671F\u8303\u56F4") },
1532
+ h(Calendar, {
1533
+ h,
1534
+ prefix: p,
1535
+ lang: props.lang,
1536
+ month,
1537
+ min: props.min,
1538
+ max: props.max,
1539
+ onMove: function(m) {
1540
+ setMonth(m);
1541
+ },
1542
+ isSelected: function(d) {
1543
+ return start ? d === start : d === from || d === to;
1544
+ },
1545
+ isBetween: function(d) {
1546
+ return start ? start < d && d < (to || "") : !!(from && to && d > from && d < to);
1547
+ },
1548
+ onPick: pick
1549
+ }),
1309
1550
  h(
1310
- "div",
1311
- { className: "wbsal-card wbsal-section" },
1312
- h(
1313
- "div",
1314
- { className: "wbsal-section-head" },
1315
- h("h3", null, "\u6708\u5EA6" + metricLabel + "\u8D8B\u52BF"),
1316
- h(
1317
- "div",
1318
- { className: "wbsal-section-tools" },
1319
- h("div", { className: "wbsal-metric", role: "group", "aria-label": "\u56FE\u8868\u7EDF\u8BA1\u53E3\u5F84" }, METRICS.map(function(m) {
1320
- return h("button", {
1321
- key: m.key,
1322
- type: "button",
1323
- className: m.key === metric ? "on" : "",
1324
- "aria-pressed": m.key === metric,
1325
- onClick: function() {
1326
- setMetric(m.key);
1327
- }
1328
- }, m.label);
1329
- })),
1330
- h("span", { className: "wbsal-section-note" }, "\u6700\u9AD8 " + F.monthLabel(monthly[topMonth] ? monthly[topMonth].period : "") + " \xB7 " + F.money(maxNet))
1331
- )
1332
- ),
1333
- h("div", { className: "wbsal-chart" }, monthly.map(function(bucket, i) {
1334
- var value = metricValue(bucket);
1335
- var ratio = value > 0 ? value / chartMax : 0;
1336
- var height = Math.round(Math.max(ratio * 150, value > 0 ? 6 : 0));
1337
- return h(
1338
- "div",
1339
- {
1340
- key: bucket.month,
1341
- className: "wbsal-bar",
1342
- title: bucket.month + " \u6708 \xB7 \u57FA\u672C " + F.money(bucket.basePay) + " / \u7EE9\u6548 " + F.money(bucket.performancePay) + " / \u8865\u8D34 " + F.money(bucket.allowance) + " / \u7EE9\u6548\u5956\u60E9 " + F.money(bucket.performanceBonus) + " / \u5E94\u53D1 " + F.money(bucket.grossPay) + " / \u5B9E\u53D1 " + F.money(bucket.netPay)
1343
- },
1344
- h("div", { className: "wbsal-bar-value" }, value > 0 ? Math.round(value).toLocaleString("zh-CN") : ""),
1345
- h("div", { className: "wbsal-bar-fill" + (i === topMonth ? " top" : ""), style: { height: height + "px" } }),
1346
- h("div", { className: "wbsal-bar-label" }, "")
1347
- );
1348
- })),
1349
- h("div", { className: "wbsal-axis" }, monthly.map(function(bucket) {
1350
- return h("span", { key: bucket.month }, bucket.month);
1351
- })),
1352
- h(
1353
- "div",
1354
- { className: "wbsal-chart-foot" },
1355
- h("span", { className: "wbsal-legend" }, h("i", null), "\u6709\u8BB0\u5F55\u6708\u4EFD", h("i", { className: "soft" }), "\u5176\u4ED6\u6708\u4EFD"),
1356
- h("span", null, "\u5355\u4F4D\uFF1A\u5143 \xB7 " + basisLabel + " \xB7 " + metricLabel)
1357
- )
1551
+ "p",
1552
+ { className: p + "-dp-hint", role: "status" },
1553
+ start ? en ? "Start " + start + " \xB7 pick the end date" : "\u8D77\u59CB " + start + " \xB7 \u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F" : en ? "Pick start, then end date" : "\u5148\u9009\u5F00\u59CB\u65E5\u671F\uFF0C\u518D\u9009\u7ED3\u675F\u65E5\u671F"
1358
1554
  ),
1359
- h(
1555
+ start ? h(
1360
1556
  "div",
1361
- { className: "wbsal-card wbsal-section" },
1362
- h(
1363
- "div",
1364
- { className: "wbsal-section-head" },
1365
- h("h3", null, "\u6708\u5EA6\u8D8B\u52BF\u5BF9\u6BD4"),
1366
- seriesSwitch(LINE_SERIES, visible, toggleSeries, "\u6298\u7EBF\u663E\u793A\u5F00\u5173")
1367
- ),
1368
- h(
1369
- "div",
1370
- { className: "wbsal-linechart" },
1371
- renderChart(LINE_SERIES, visible, "\u6708\u5EA6\u5B9E\u53D1/\u5E94\u53D1/\u57FA\u672C/\u7EE9\u6548/\u8865\u8D34/\u7EE9\u6548\u5956\u60E9\u6298\u7EBF\u56FE", hover, setHover),
1372
- renderTip(LINE_SERIES, visible, hover)
1373
- ),
1374
- anyShown(LINE_SERIES, visible) ? null : h("div", { className: "wbsal-chart-hint" }, "\u516D\u6761\u7EBF\u90FD\u5173\u6389\u4E86\uFF0C\u70B9\u4E0A\u65B9\u300C\u5B9E\u53D1 / \u5E94\u53D1 / \u57FA\u672C / \u7EE9\u6548 / \u8865\u8D34 / \u7EE9\u6548\u5956\u60E9\u300D\u4EFB\u610F\u4E00\u4E2A\u6062\u590D\u663E\u793A"),
1375
- h(
1376
- "div",
1377
- { className: "wbsal-chart-foot" },
1378
- h("span", null, "\u516D\u6761\u7EBF\u53EF\u70B9\u4E0A\u65B9\u6807\u7B7E\u5355\u72EC\u5F00\u5173 \xB7 \u9F20\u6807\u79FB\u5230\u67D0\u4E2A\u6708\u4EFD\u770B\u8BE5\u6708\u5168\u90E8\u7EF4\u5EA6"),
1379
- h("span", null, "\u5355\u4F4D\uFF1A\u5143 \xB7 \u4EC5\u8FDE\u63A5\u6709\u8BB0\u5F55\u7684\u6708\u4EFD")
1380
- )
1381
- ),
1557
+ { className: p + "-dp-acts" },
1558
+ h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1559
+ apply({ from: start, to: "" });
1560
+ } }, en ? "Only start" : "\u4EC5\u8D77\u59CB\u65E5\u671F"),
1561
+ h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1562
+ apply({ from: "", to: start });
1563
+ } }, en ? "Only end" : "\u4EC5\u622A\u6B62\u65E5\u671F")
1564
+ ) : null,
1382
1565
  h(
1383
1566
  "div",
1384
- { className: "wbsal-card wbsal-section" },
1385
- h(
1386
- "div",
1387
- { className: "wbsal-section-head" },
1388
- h("h3", null, "\u793E\u4FDD\u4E0E\u4E2A\u7A0E"),
1389
- h("span", null, "\u5E74\u5EA6\u5408\u8BA1 " + F.money(DEDUCT_TOTAL_ALL) + " \xB7 \u5360\u5E94\u53D1 " + (data.grossTotal ? Math.round(DEDUCT_TOTAL_ALL / data.grossTotal * 100) : 0) + "%")
1390
- ),
1391
- h("div", { className: "wbsal-social" }, F.SOCIAL_KEYS.concat(["incomeTax"]).map(function(key) {
1392
- var amount = key === "incomeTax" ? data.incomeTaxTotal || 0 : data.social && data.social[key] || 0;
1393
- var share = DEDUCT_TOTAL_ALL ? Math.round(amount / DEDUCT_TOTAL_ALL * 100) : 0;
1394
- return h(
1395
- "div",
1396
- { key, className: "wbsal-social-item" },
1397
- h("span", null, F.LABELS[key]),
1398
- h("b", null, F.money(amount)),
1399
- h("em", null, "\u5360\u793E\u4FDD\u4E0E\u4E2A\u7A0E " + share + "%")
1400
- );
1401
- })),
1402
- h("div", { className: "wbsal-social-foot" }, seriesSwitch(DEDUCT_SERIES, socialVisible, toggleSocial, "\u793E\u4FDD\u4E0E\u4E2A\u7A0E\u6298\u7EBF\u663E\u793A\u5F00\u5173")),
1403
- h(
1404
- "div",
1405
- { className: "wbsal-linechart" },
1406
- renderChart(DEDUCT_SERIES, socialVisible, "\u6708\u5EA6\u517B\u8001/\u533B\u7597/\u5931\u4E1A/\u516C\u79EF\u91D1/\u4E2A\u7A0E\u6298\u7EBF\u56FE", socialHover, setSocialHover),
1407
- renderTip(DEDUCT_SERIES, socialVisible, socialHover)
1408
- ),
1409
- anyShown(DEDUCT_SERIES, socialVisible) ? null : h("div", { className: "wbsal-chart-hint" }, "\u6240\u6709\u7EBF\u90FD\u5173\u6389\u4E86\uFF0C\u70B9\u4E0A\u65B9\u300C\u517B\u8001 / \u533B\u7597 / \u5931\u4E1A / \u516C\u79EF\u91D1 / \u4E2A\u7A0E / \u5408\u8BA1\u300D\u4EFB\u610F\u4E00\u4E2A\u6062\u590D\u663E\u793A"),
1410
- h(
1411
- "div",
1412
- { className: "wbsal-chart-foot" },
1413
- h("span", null, "\u4E94\u6761\u7EBF + \u865A\u7EBF\u5408\u8BA1\uFF08\u4E94\u9879\u4E4B\u548C\uFF09\u53EF\u5355\u72EC\u5F00\u5173 \xB7 \u9F20\u6807\u79FB\u5230\u67D0\u4E2A\u6708\u4EFD\u770B\u8BE5\u6708\u5206\u9879"),
1414
- h("span", null, "\u5355\u4F4D\uFF1A\u5143 \xB7 \u4EC5\u8FDE\u63A5\u6709\u8BB0\u5F55\u7684\u6708\u4EFD")
1415
- )
1416
- ),
1417
- data.latestMonth ? h(
1418
- "div",
1419
- { className: "wbsal-card wbsal-section" },
1420
- h(
1421
- "div",
1422
- { className: "wbsal-section-head" },
1423
- h("h3", null, F.monthLabel(data.latestMonth.period) + " \u6536\u5165\u4E0E\u6263\u6B3E\u6784\u6210"),
1424
- h("span", null, "\u5171 " + data.latestMonth.records + " \u7B14")
1425
- ),
1426
- h(
1427
- "div",
1428
- { className: "wbsal-comp-grid" },
1429
- h(
1430
- "div",
1431
- null,
1432
- h("div", { className: "wbsal-group-title" }, "\u6536\u5165\u9879 \xB7 \u5408\u8BA1 " + F.money(latestBreakdown.income)),
1433
- compRows(F.INCOME_KEYS, latestBreakdown.income, false)
1434
- ),
1435
- h(
1436
- "div",
1437
- null,
1438
- h("div", { className: "wbsal-group-title" }, "\u6263\u6B3E\u9879 \xB7 \u5408\u8BA1 " + F.money(deductionTotal)),
1439
- compRows(F.PRETAX_KEYS.concat(F.SOCIAL_KEYS, F.TAX_KEYS), deductionTotal, true)
1440
- )
1441
- )
1442
- ) : null
1443
- );
1567
+ { className: p + "-dp-foot" },
1568
+ h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1569
+ setOpen(false);
1570
+ setStart("");
1571
+ } }, en ? "Cancel" : "\u53D6\u6D88")
1572
+ )
1573
+ ) : null
1574
+ );
1575
+ }
1576
+ function MonthPicker(props) {
1577
+ var c = ctx(props), R = c.R, h = c.h;
1578
+ var p = props.prefix, en = props.lang === "en";
1579
+ var value = /^\d{4}-\d{2}$/.test(props.value || "") ? props.value : "";
1580
+ var base = value || monthKey(props.max || todayISO());
1581
+ var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
1582
+ var yearS = R.useState(Number(base.slice(0, 4))), year = yearS[0], setYear = yearS[1];
1583
+ var root = R.useRef(null);
1584
+ usePopover(R, open, setOpen, root);
1585
+ function pick(month) {
1586
+ if (props.onChange) props.onChange(month);
1587
+ setOpen(false);
1588
+ }
1589
+ var months = [];
1590
+ for (var m = 1; m <= 12; m++) {
1591
+ var key = year + "-" + pad(m);
1592
+ months.push(h("button", {
1593
+ key,
1594
+ type: "button",
1595
+ "data-month": key,
1596
+ "aria-pressed": key === value,
1597
+ className: p + "-dp-day" + (key === value ? " is-on" : "") + (key === monthKey(todayISO()) ? " is-today" : ""),
1598
+ onClick: pick.bind(null, key)
1599
+ }, en ? MONTH_EN[m - 1] : m + "\u6708"));
1444
1600
  }
1445
1601
  return h(
1446
1602
  "div",
1447
- { className: "wbsal-page" },
1603
+ { className: p + "-dp" + (props.className ? " " + props.className : ""), ref: root },
1448
1604
  h(
1449
1605
  "div",
1450
- { className: "wbsal-toolbar wbsal-toolbar-plain" },
1606
+ { className: p + "-dp-field" },
1607
+ h(
1608
+ "button",
1609
+ {
1610
+ type: "button",
1611
+ className: p + "-dp-trigger",
1612
+ "aria-haspopup": "dialog",
1613
+ "aria-expanded": open,
1614
+ "aria-label": (props.label || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD")) + ": " + (value ? monthLabel(value, en) : ""),
1615
+ onClick: function() {
1616
+ setYear(Number((value || base).slice(0, 4)));
1617
+ setOpen(!open);
1618
+ }
1619
+ },
1620
+ h("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
1621
+ h("span", { className: p + "-dp-value" + (value ? "" : " is-empty") }, value ? monthLabel(value, en) : props.placeholder || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD"))
1622
+ ),
1623
+ value && props.clearable !== false ? h("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear month" : "\u6E05\u9664\u6708\u4EFD", onClick: function() {
1624
+ if (props.onChange) props.onChange("");
1625
+ } }, "\xD7") : null
1626
+ ),
1627
+ open ? h(
1628
+ "div",
1629
+ { className: p + "-dp-pop is-months", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD") },
1451
1630
  h(
1452
1631
  "div",
1453
- { className: "wbsal-toolbar-end" },
1454
- h(
1455
- "div",
1456
- { className: "wbsal-metric", role: "group", "aria-label": "\u5DE5\u8D44\u5F52\u6708\u53E3\u5F84" },
1457
- [["arrival", "\u6309\u5230\u8D26\u6708"], ["income", "\u6309\u6240\u5C5E\u6708"]].map(function(option) {
1458
- return h("button", {
1459
- key: option[0],
1460
- type: "button",
1461
- "aria-pressed": basis === option[0],
1462
- onClick: function() {
1463
- setBasis(option[0]);
1464
- setHover(null);
1465
- setSocialHover(null);
1466
- }
1467
- }, option[1]);
1468
- })
1469
- ),
1470
- h(
1471
- "div",
1472
- { className: "wbsal-seg" },
1473
- h(C.Btn, { h, kind: "ghost", onClick: function() {
1474
- setYear(Math.max(2e3, year - 1));
1475
- } }, "\u2039"),
1476
- h("span", { className: "wbsal-seg-year" }, year + " \u5E74"),
1477
- h(C.Btn, { h, kind: "ghost", onClick: function() {
1478
- setYear(Math.min(2100, year + 1));
1479
- } }, "\u203A")
1480
- )
1632
+ { className: p + "-dp-head" },
1633
+ h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Previous year" : "\u4E0A\u4E00\u5E74", onClick: function() {
1634
+ setYear(year - 1);
1635
+ } }, "\u2039"),
1636
+ h("strong", { className: p + "-dp-title", "aria-live": "polite" }, en ? String(year) : year + "\u5E74"),
1637
+ h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Next year" : "\u4E0B\u4E00\u5E74", onClick: function() {
1638
+ setYear(year + 1);
1639
+ } }, "\u203A")
1640
+ ),
1641
+ h("div", { className: p + "-dp-months" }, months),
1642
+ h(
1643
+ "div",
1644
+ { className: p + "-dp-foot" },
1645
+ h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1646
+ pick(monthKey(todayISO()));
1647
+ } }, en ? "This month" : "\u672C\u6708"),
1648
+ h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1649
+ setOpen(false);
1650
+ } }, en ? "Cancel" : "\u53D6\u6D88")
1481
1651
  )
1482
- ),
1483
- basis === "income" && data && data.year === year && data.basis === basis && data.unassignedRecords > 0 ? h(C.Notice, { h, text: "\u5168\u90E8\u5E74\u4EFD\u5171 " + data.unassignedRecords + " \u7B14\u5DE5\u8D44\u672A\u586B\u5199\u6240\u5C5E\u671F\uFF0C\u672A\u8BA1\u5165\u6240\u5C5E\u6708\u7EDF\u8BA1\u3002" }) : null,
1484
- body
1652
+ ) : null
1485
1653
  );
1654
+ }
1655
+ function InlineCalendar(props) {
1656
+ var c = ctx(props), R = c.R, h = c.h;
1657
+ var p = props.prefix;
1658
+ var value = validDate(props.value) ? props.value : "";
1659
+ var monthS = R.useState(monthKey(props.month || value || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
1660
+ return h(
1661
+ "div",
1662
+ { className: p + "-dp is-inline" },
1663
+ h(Calendar, {
1664
+ h,
1665
+ prefix: p,
1666
+ lang: props.lang,
1667
+ month,
1668
+ min: props.min,
1669
+ max: props.max,
1670
+ onMove: function(m) {
1671
+ setMonth(m);
1672
+ if (props.onMonthChange) props.onMonthChange(m);
1673
+ },
1674
+ isSelected: function(d) {
1675
+ return d === value;
1676
+ },
1677
+ isBetween: props.isBetween,
1678
+ onPick: function(d) {
1679
+ if (props.onChange) props.onChange(d);
1680
+ }
1681
+ }),
1682
+ props.footer ? h("div", { className: p + "-dp-foot" }, props.footer) : null
1683
+ );
1684
+ }
1685
+ module2.exports = {
1686
+ DatePicker,
1687
+ RangePicker,
1688
+ MonthPicker,
1689
+ InlineCalendar,
1690
+ todayISO,
1691
+ validDate,
1692
+ shiftDate,
1693
+ shiftMonth,
1694
+ normalizeRange,
1695
+ monthLabel,
1696
+ daysInMonth
1486
1697
  };
1487
1698
  }
1488
1699
  });
1489
1700
 
1490
- // packages/addons/lib/date-picker.cjs
1491
- var require_date_picker = __commonJS({
1492
- "packages/addons/lib/date-picker.cjs"(exports2, module2) {
1701
+ // packages/addons/lib/stats-charts.cjs
1702
+ var require_stats_charts = __commonJS({
1703
+ "packages/addons/lib/stats-charts.cjs"(exports2, module2) {
1493
1704
  "use strict";
1494
- var ReactDefault = require("react");
1495
- var MONTH_EN = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
1496
- function pad(n) {
1497
- return String(n).padStart(2, "0");
1498
- }
1499
- function todayISO() {
1500
- var d = /* @__PURE__ */ new Date();
1501
- return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
1502
- }
1503
- function validDate(value) {
1504
- if (!value) return false;
1505
- if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return false;
1506
- var d = /* @__PURE__ */ new Date(value + "T00:00:00Z");
1507
- return isFinite(d.getTime()) && d.toISOString().slice(0, 10) === value && value.slice(0, 4) !== "0000";
1508
- }
1509
- function toUTC(iso) {
1510
- return /* @__PURE__ */ new Date(iso + "T00:00:00Z");
1511
- }
1512
- function shiftDate(iso, days) {
1513
- var d = toUTC(iso);
1514
- d.setUTCDate(d.getUTCDate() + days);
1515
- return d.toISOString().slice(0, 10);
1516
- }
1517
- function shiftMonth(month, delta) {
1518
- var d = toUTC(month + "-01");
1519
- d.setUTCMonth(d.getUTCMonth() + delta);
1520
- return d.toISOString().slice(0, 7);
1521
- }
1522
- function monthKey(iso) {
1523
- return (iso || todayISO()).slice(0, 7);
1524
- }
1525
- function monthLabel(month, en) {
1526
- return en ? month.slice(0, 4) + "-" + month.slice(5) : month.slice(0, 4) + "\u5E74" + Number(month.slice(5)) + "\u6708";
1527
- }
1528
- function daysInMonth(month) {
1529
- return new Date(Date.UTC(Number(month.slice(0, 4)), Number(month.slice(5)), 0)).getUTCDate();
1530
- }
1531
- function normalizeRange(value) {
1532
- var from = value && validDate(value.from) ? value.from : "";
1533
- var to = value && validDate(value.to) ? value.to : "";
1534
- if (from && to && from > to) return { from: to, to: from, swapped: true };
1535
- return { from, to, swapped: false };
1536
- }
1537
- function clampDay(iso, min, max) {
1538
- if (min && iso < min) return false;
1539
- if (max && iso > max) return false;
1540
- return true;
1541
- }
1542
- function ctx(props) {
1543
- var R = props && props.React || ReactDefault;
1544
- return { R, h: props && props.h || R.createElement };
1705
+ var React = require("react");
1706
+ var h = React.createElement;
1707
+ var DP = require_date_picker();
1708
+ var COLORS = [
1709
+ "var(--dsw-alias-state-business-primary, #4f6ef7)",
1710
+ "var(--dsw-alias-state-success-primary, #2f9e6e)",
1711
+ "var(--dsw-alias-state-warn-primary, #d99100)",
1712
+ "var(--dsw-alias-state-error-primary, #d9534f)",
1713
+ "var(--dsw-alias-state-done-primary, #7c5cff)",
1714
+ "var(--dsw-alias-state-idle-primary, #8f959e)"
1715
+ ];
1716
+ function css(prefix, extra) {
1717
+ return [
1718
+ ".@-stats{display:flex;flex-direction:column;gap:14px;padding:4px 2px 24px;color:var(--dsw-alias-label-primary,#1f2329)}",
1719
+ ".@-stoolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
1720
+ ".@-seg{display:inline-flex;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:9px;overflow:hidden;background:var(--dsw-alias-bg-layer-1,#fff)}",
1721
+ ".@-seg button{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#646a73);font-size:12px;padding:6px 10px;cursor:pointer;white-space:nowrap}",
1722
+ ".@-seg button.@-on{background:var(--dsw-alias-brand-primary,#4f6ef7);color:var(--dsw-alias-label-primary-inverted,#fff)}",
1723
+ ".@-range{display:inline-flex;align-items:center;gap:4px}",
1724
+ ".@-date{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#646a73);font-family:inherit;font-size:12px;padding:4px 2px;width:116px;outline:none}",
1725
+ ".@-date::-webkit-calendar-picker-indicator{opacity:.55;cursor:pointer}",
1726
+ ".@-dash{color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
1727
+ ".@-clear{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-tertiary,#8f959e);font-size:14px;line-height:1;padding:2px 4px;cursor:pointer;border-radius:4px}",
1728
+ ".@-clear:hover{color:var(--dsw-alias-state-error-primary,#d9534f);background:var(--dsw-alias-bg-skeleton,#f2f3f5)}",
1729
+ ".@-hint{font-size:11px;color:var(--dsw-alias-state-error-primary,#d9534f);white-space:nowrap}",
1730
+ ".@-ghost{appearance:none;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-secondary,#646a73);border-radius:8px;font-size:12px;padding:6px 10px;cursor:pointer;display:inline-flex;align-items:center;gap:5px;font-family:inherit}",
1731
+ ".@-ghost:disabled{opacity:.6;cursor:progress}",
1732
+ ".@-ico{display:block;flex:none}",
1733
+ ".@-kpi-l .@-ico{opacity:.7}",
1734
+ ".@-ghost:hover{border-color:var(--dsw-alias-brand-primary,#4f6ef7);color:var(--dsw-alias-brand-primary,#4f6ef7)}",
1735
+ ".@-muted{color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
1736
+ ".@-sgrid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:12px}",
1737
+ ".@-scard{grid-column:span 6;min-width:0;background:var(--dsw-alias-bg-layer-1,#fff);border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:12px;padding:14px 16px}",
1738
+ ".@-span-3{grid-column:span 3}.@-span-4{grid-column:span 4}.@-span-6{grid-column:span 6}.@-span-8{grid-column:span 8}.@-span-12{grid-column:span 12}",
1739
+ ".@-chead{display:flex;align-items:baseline;gap:8px;margin-bottom:10px;flex-wrap:wrap}",
1740
+ ".@-ctitle{font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary,#1f2329)}",
1741
+ ".@-cnote{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
1742
+ ".@-kpis{grid-column:span 12;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}",
1743
+ ".@-kpi{background:var(--dsw-alias-bg-layer-1,#fff);border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:12px;padding:12px 14px;min-width:0}",
1744
+ ".@-kpi-l{font-size:12px;color:var(--dsw-alias-label-tertiary,#8f959e);display:flex;align-items:center;gap:6px}",
1745
+ ".@-kpi-v{font-size:26px;line-height:1.25;font-weight:650;margin-top:4px;font-variant-numeric:tabular-nums}",
1746
+ ".@-kpi-u{font-size:12px;font-weight:400;color:var(--dsw-alias-label-tertiary,#8f959e);margin-left:3px}",
1747
+ ".@-kpi-h{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e);margin-top:3px}",
1748
+ ".@-kpi.@-danger .@-kpi-v{color:var(--dsw-alias-state-error-primary,#d9534f)}",
1749
+ ".@-kpi.@-warn .@-kpi-v{color:var(--dsw-alias-state-warn-primary,#d99100)}",
1750
+ ".@-kpi.@-ok .@-kpi-v{color:var(--dsw-alias-state-success-primary,#2f9e6e)}",
1751
+ ".@-donut{display:flex;align-items:center;gap:16px;flex-wrap:wrap}",
1752
+ ".@-donut svg{flex:0 0 auto}",
1753
+ ".@-legend{display:flex;flex-direction:column;gap:7px;min-width:120px;flex:1}",
1754
+ ".@-leg{display:flex;align-items:center;gap:7px;font-size:12px;color:var(--dsw-alias-label-secondary,#646a73)}",
1755
+ ".@-dot{width:8px;height:8px;border-radius:50%;flex:0 0 auto}",
1756
+ ".@-leg b{margin-left:auto;font-weight:600;color:var(--dsw-alias-label-primary,#1f2329);font-variant-numeric:tabular-nums}",
1757
+ ".@-bars{display:flex;flex-direction:column;gap:9px}",
1758
+ ".@-bar{display:grid;grid-template-columns:minmax(72px,1.2fr) 3fr auto;gap:8px;align-items:center;font-size:12px}",
1759
+ ".@-bar-l{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary,#646a73)}",
1760
+ ".@-bar-t{display:block;height:8px;border-radius:6px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);overflow:hidden}",
1761
+ ".@-bar-f{display:block;height:100%;border-radius:6px;background:var(--dsw-alias-state-business-primary,#4f6ef7);min-width:2px}",
1762
+ ".@-bar-v{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary,#1f2329);font-weight:600;min-width:34px;text-align:right}",
1763
+ ".@-stack{display:flex;flex-direction:column;gap:10px}",
1764
+ ".@-srow-l{font-size:12px;color:var(--dsw-alias-label-secondary,#646a73);margin-bottom:4px;display:flex}",
1765
+ ".@-srow-l b{margin-left:auto;color:var(--dsw-alias-label-primary,#1f2329);font-variant-numeric:tabular-nums}",
1766
+ ".@-strack{display:flex;height:10px;border-radius:6px;overflow:hidden;background:var(--dsw-alias-bg-skeleton,#f2f3f5)}",
1767
+ ".@-seg-f{height:100%}",
1768
+ ".@-hist{display:flex;align-items:flex-end;gap:8px;height:150px;padding-top:16px}",
1769
+ ".@-hbar{flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:5px;min-width:0;height:100%}",
1770
+ ".@-hbar-v{font-size:11px;color:var(--dsw-alias-label-secondary,#646a73);font-variant-numeric:tabular-nums}",
1771
+ ".@-hbar-f{width:100%;max-width:44px;border-radius:5px 5px 0 0;background:var(--dsw-alias-state-business-primary,#4f6ef7);min-height:2px}",
1772
+ ".@-hbar-l{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}",
1773
+ ".@-trend{width:100%;height:auto;display:block}",
1774
+ ".@-tlegend{display:flex;gap:14px;flex-wrap:wrap;margin-top:6px;font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
1775
+ ".@-trend-wrap{position:relative}",
1776
+ ".@-trend-hit{fill:transparent}",
1777
+ ".@-trend-slot{fill:transparent;cursor:crosshair}",
1778
+ ".@-trend-cross{stroke:var(--dsw-alias-border-l2,#e5e6eb);stroke-width:1;stroke-dasharray:3 3}",
1779
+ ".@-tlegend{display:flex;gap:10px;flex-wrap:wrap;margin-top:6px;font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
1780
+ ".@-tleg-item{appearance:none;border:0;background:transparent;color:inherit;font:inherit;display:inline-flex;align-items:center;gap:5px;padding:2px 4px;border-radius:5px;cursor:pointer}",
1781
+ ".@-tleg-item.off{opacity:.45;text-decoration:line-through}",
1782
+ ".@-tleg-item:hover{background:var(--dsw-alias-bg-skeleton,#f2f3f5)}",
1783
+ ".@-table-scroll{max-width:100%;overflow-x:auto}.@-table{width:100%;border-collapse:collapse;font-size:12px}",
1784
+ ".@-table th{text-align:left;font-weight:500;color:var(--dsw-alias-label-tertiary,#8f959e);padding:6px 8px;border-bottom:1px solid var(--dsw-alias-border-l2,#e5e6eb);white-space:nowrap}",
1785
+ ".@-table td{padding:7px 8px;border-bottom:1px solid var(--dsw-alias-border-l1,#f2f3f5);color:var(--dsw-alias-label-secondary,#646a73);vertical-align:top}",
1786
+ ".@-table tr:last-child td{border-bottom:0}",
1787
+ ".@-table th.@-num,.@-table td.@-num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}",
1788
+ ".@-empty{padding:26px 8px;text-align:center;color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
1789
+ ".@-err{display:flex;align-items:center;gap:10px;background:color-mix(in srgb,var(--dsw-alias-state-error-primary,#d9534f) 8%,transparent);border:1px solid color-mix(in srgb,var(--dsw-alias-state-error-primary,#d9534f) 30%,transparent);color:var(--dsw-alias-state-error-primary,#d9534f);border-radius:10px;padding:10px 12px;font-size:12px}",
1790
+ ".@-warn{grid-column:span 12;border:1px dashed var(--dsw-alias-state-warn-primary,#d99100);border-radius:10px;padding:9px 12px;font-size:12px;color:var(--dsw-alias-state-warn-primary,#d99100);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#d99100) 6%,transparent)}",
1791
+ ".@-sk{height:14px;border-radius:6px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);margin:7px 0;animation:@-pulse 1.2s ease-in-out infinite}",
1792
+ "@keyframes @-pulse{0%,100%{opacity:.55}50%{opacity:1}}",
1793
+ "@media (max-width:900px){.@-scard{grid-column:span 12}.@-span-3,.@-span-4,.@-span-6,.@-span-8{grid-column:span 12}.@-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}",
1794
+ "@media (max-width:600px){.@-stats{padding-bottom:16px}.@-hist{height:130px}.@-kpi-v{font-size:22px}}",
1795
+ "@media (prefers-reduced-motion:reduce){.@-sk{animation:none}}"
1796
+ ].concat(extra || []).concat([require_date_picker_styles()(prefix)]).join("\n").replace(/@-/g, prefix + "-");
1545
1797
  }
1546
- function usePopover(R, open, setOpen, root) {
1547
- R.useEffect(function() {
1548
- if (!open) return void 0;
1549
- function onDoc(ev) {
1550
- if (root.current && !root.current.contains(ev.target)) setOpen(false);
1798
+ function primitives(prefix, options) {
1799
+ var opts = options || {};
1800
+ var ICONS = opts.icons || {};
1801
+ var showNote = !!opts.showNote;
1802
+ function ico(name, size) {
1803
+ var C = ICONS[name];
1804
+ if (!C) return null;
1805
+ return h(C, { size: size || 13, strokeWidth: 2, "aria-hidden": "true", className: prefix + "-ico" });
1806
+ }
1807
+ function num(lang, n) {
1808
+ var v = Number(n);
1809
+ if (!isFinite(v)) return "\u2014";
1810
+ try {
1811
+ return new Intl.NumberFormat(lang === "en" ? "en-US" : "zh-CN").format(v);
1812
+ } catch (e) {
1813
+ return String(v);
1551
1814
  }
1552
- function onKey(ev) {
1553
- if (ev.key === "Escape") setOpen(false);
1815
+ }
1816
+ function pct(v, digits) {
1817
+ if (v === null || v === void 0 || !isFinite(Number(v))) return "\u2014";
1818
+ return (Number(v) * 100).toFixed(digits === void 0 ? 1 : digits) + "%";
1819
+ }
1820
+ function timeText(ms) {
1821
+ if (!ms) return "";
1822
+ var d = new Date(Number(ms));
1823
+ function p(n) {
1824
+ return String(n).padStart(2, "0");
1554
1825
  }
1555
- if (typeof document !== "undefined" && typeof document.addEventListener === "function") {
1556
- document.addEventListener("mousedown", onDoc);
1557
- document.addEventListener("keydown", onKey);
1826
+ return p(d.getHours()) + ":" + p(d.getMinutes()) + ":" + p(d.getSeconds());
1827
+ }
1828
+ function dateText(ms) {
1829
+ if (!ms) return "\u2014";
1830
+ var d = new Date(Number(ms));
1831
+ function p(n) {
1832
+ return String(n).padStart(2, "0");
1833
+ }
1834
+ return d.getFullYear() + "-" + p(d.getMonth() + 1) + "-" + p(d.getDate());
1835
+ }
1836
+ function Card(props) {
1837
+ var cls = prefix + "-scard" + (props.span ? " " + prefix + "-span-" + props.span : "");
1838
+ return h(
1839
+ "section",
1840
+ { className: cls },
1841
+ props.title || props.right ? h(
1842
+ "div",
1843
+ { className: prefix + "-chead" },
1844
+ h("span", { className: prefix + "-ctitle" }, props.title),
1845
+ props.note ? h("span", { className: prefix + "-cnote" }, props.note) : null,
1846
+ props.right ? h("span", { style: { marginLeft: "auto" } }, props.right) : null
1847
+ ) : null,
1848
+ props.children
1849
+ );
1850
+ }
1851
+ function Kpi(props) {
1852
+ var tone = props.tone ? " " + prefix + "-" + props.tone : "";
1853
+ return h(
1854
+ "div",
1855
+ { className: prefix + "-kpi" + tone },
1856
+ h("div", { className: prefix + "-kpi-l" }, ico(props.icon, 13), props.label),
1857
+ h(
1858
+ "div",
1859
+ { className: prefix + "-kpi-v" },
1860
+ props.value === null || props.value === void 0 ? "\u2014" : typeof props.value === "number" ? num(props.lang, props.value) : props.value,
1861
+ props.unit ? h("span", { className: prefix + "-kpi-u" }, props.unit) : null
1862
+ ),
1863
+ props.hint ? h("div", { className: prefix + "-kpi-h" }, props.hint) : null
1864
+ );
1865
+ }
1866
+ function Donut(props) {
1867
+ var data = (props.data || []).filter(function(d) {
1868
+ return Number(d.count) > 0;
1869
+ });
1870
+ var total = Number(props.total || 0);
1871
+ var size = props.size || 168;
1872
+ var r = size / 2 - 16;
1873
+ var c = 2 * Math.PI * r;
1874
+ var offset = 0;
1875
+ var aria = props.aria || data.map(function(d) {
1876
+ return d.label + " " + d.count;
1877
+ }).join("\uFF0C");
1878
+ return h(
1879
+ "div",
1880
+ { className: prefix + "-donut" },
1881
+ h(
1882
+ "svg",
1883
+ { width: size, height: size, viewBox: "0 0 " + size + " " + size, role: "img", "aria-label": aria },
1884
+ h("circle", { cx: size / 2, cy: size / 2, r, fill: "none", stroke: "var(--dsw-alias-bg-skeleton,#f2f3f5)", strokeWidth: 18 }),
1885
+ total > 0 ? data.map(function(d, i) {
1886
+ var len = Number(d.count) / total * c;
1887
+ var seg = h("circle", {
1888
+ key: d.key || d.label || i,
1889
+ cx: size / 2,
1890
+ cy: size / 2,
1891
+ r,
1892
+ fill: "none",
1893
+ stroke: d.color || COLORS[i % COLORS.length],
1894
+ strokeWidth: 18,
1895
+ strokeDasharray: len + " " + (c - len),
1896
+ strokeDashoffset: -offset,
1897
+ transform: "rotate(-90 " + size / 2 + " " + size / 2 + ")",
1898
+ strokeLinecap: "butt"
1899
+ }, h("title", null, d.label + "\uFF1A" + d.count + (showNote && d.note ? "\uFF08" + d.note + "\uFF09" : "")));
1900
+ offset += len;
1901
+ return seg;
1902
+ }) : null,
1903
+ h("text", { x: size / 2, y: size / 2 - 2, textAnchor: "middle", fill: "var(--dsw-alias-label-primary,#1f2329)", fontSize: 24, fontWeight: 650 }, num(props.lang, total)),
1904
+ h("text", { x: size / 2, y: size / 2 + 18, textAnchor: "middle", fill: "var(--dsw-alias-label-tertiary,#8f959e)", fontSize: 11 }, props.centerLabel || "")
1905
+ ),
1906
+ h("div", { className: prefix + "-legend" }, (props.data || []).map(function(d, i) {
1907
+ return h(
1908
+ "div",
1909
+ { key: d.key || d.label || i, className: prefix + "-leg" },
1910
+ h("span", { className: prefix + "-dot", style: { background: d.color || COLORS[i % COLORS.length] } }),
1911
+ h("span", null, d.label, showNote && d.note ? h("i", { className: prefix + "-leg-note" }, "\xB7 " + d.note) : null),
1912
+ h("b", null, num(props.lang, d.count))
1913
+ );
1914
+ }))
1915
+ );
1916
+ }
1917
+ function BarList(props) {
1918
+ var data = props.data || [];
1919
+ var max = Number(props.max || 0) || data.reduce(function(m, d) {
1920
+ return Math.max(m, Number(d.value || 0));
1921
+ }, 0) || 1;
1922
+ return h("div", { className: prefix + "-bars" }, data.map(function(d, i) {
1923
+ var v = Number(d.value || 0);
1924
+ return h(
1925
+ "div",
1926
+ { key: d.key || d.label || i, className: prefix + "-bar" },
1927
+ h("span", { className: prefix + "-bar-l", title: d.title || d.label }, d.label),
1928
+ h("span", { className: prefix + "-bar-t" }, h("span", { className: prefix + "-bar-f", style: { width: Math.max(2, v / max * 100) + "%", background: d.color || props.color || COLORS[0] } })),
1929
+ h("span", { className: prefix + "-bar-v" }, props.format ? props.format(v) : num(props.lang, v))
1930
+ );
1931
+ }));
1932
+ }
1933
+ function StackedRows(props) {
1934
+ var rows = props.rows || [];
1935
+ var keys = props.keys || [];
1936
+ return h("div", { className: prefix + "-stack" }, rows.map(function(row, ri) {
1937
+ var total = Number(row.total || 0) || 1;
1938
+ return h(
1939
+ "div",
1940
+ { key: row.key || ri },
1941
+ h("div", { className: prefix + "-srow-l" }, h("span", null, row.label), h("b", null, num(props.lang, row.total))),
1942
+ h("div", { className: prefix + "-strack" }, keys.map(function(k, i) {
1943
+ var v = Number(row.parts && row.parts[k.key] || 0);
1944
+ if (v <= 0) return null;
1945
+ return h("span", {
1946
+ key: k.key,
1947
+ className: prefix + "-seg-f",
1948
+ title: k.label + " " + v,
1949
+ style: { width: v / total * 100 + "%", background: k.color || COLORS[i % COLORS.length] }
1950
+ });
1951
+ }))
1952
+ );
1953
+ }));
1954
+ }
1955
+ function useWidth() {
1956
+ if (typeof React.useRef !== "function" || typeof React.useEffect !== "function") return [null, 0];
1957
+ var state = React.useState(0);
1958
+ var ref = React.useRef(null);
1959
+ var setWidth = state[1];
1960
+ var useIso = React.useLayoutEffect || React.useEffect;
1961
+ useIso(function() {
1962
+ var node = ref.current;
1963
+ if (!node) return void 0;
1964
+ function read() {
1965
+ var w = node.clientWidth || 0;
1966
+ if (w > 0) setWidth(w);
1967
+ }
1968
+ read();
1969
+ if (typeof ResizeObserver === "undefined") return void 0;
1970
+ var ro = new ResizeObserver(read);
1971
+ ro.observe(node);
1558
1972
  return function() {
1559
- document.removeEventListener("mousedown", onDoc);
1560
- document.removeEventListener("keydown", onKey);
1973
+ ro.disconnect();
1561
1974
  };
1975
+ }, []);
1976
+ return [ref, state[0]];
1977
+ }
1978
+ function Trend(props) {
1979
+ var data = props.data || [];
1980
+ var series = props.series || [];
1981
+ var lang = props.lang;
1982
+ var fmt = typeof props.format === "function" ? props.format : function(v) {
1983
+ return num(lang, v);
1984
+ };
1985
+ var visible = props.visible || null;
1986
+ var shown = series.filter(function(s) {
1987
+ return !visible || visible[s.key] !== false;
1988
+ });
1989
+ if (!data.length) return h("div", { className: prefix + "-empty" }, props.emptyText || "\u6682\u65E0\u6570\u636E");
1990
+ var size = useWidth();
1991
+ var width = Math.max(260, size[1] || props.width || 640);
1992
+ var height = props.height || 200;
1993
+ var left = props.left || 60, right = 12, top = 14, bottom = 26;
1994
+ var pw = width - left - right, ph = height - top - bottom;
1995
+ var max = 0;
1996
+ data.forEach(function(d) {
1997
+ shown.forEach(function(s) {
1998
+ max = Math.max(max, Math.abs(Number(d[s.key] || 0)));
1999
+ });
2000
+ });
2001
+ var raw = Math.max(max, 1) / 4;
2002
+ var exp = Math.pow(10, Math.floor(Math.log(raw) / Math.LN10));
2003
+ var norm = raw / exp;
2004
+ var mult = norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 2.5 ? 2.5 : norm <= 5 ? 5 : 10;
2005
+ var step = mult * exp;
2006
+ var axisMax = step * 4;
2007
+ function x(i2) {
2008
+ return left + (data.length <= 1 ? pw / 2 : i2 / (data.length - 1) * pw);
1562
2009
  }
1563
- return void 0;
1564
- }, [open]);
1565
- }
1566
- function Calendar(props) {
1567
- var h = props.h, p = props.prefix, en = props.lang === "en";
1568
- var month = props.month, cells = [];
1569
- var offset = toUTC(month + "-01").getUTCDay();
1570
- var count = daysInMonth(month);
1571
- var i;
1572
- for (i = 0; i < offset; i++) cells.push(h("span", { key: "e" + i, "aria-hidden": "true" }));
1573
- for (i = 1; i <= count; i++) {
1574
- var day = month + "-" + pad(i);
1575
- var disabled = !clampDay(day, props.min, props.max);
1576
- var selected = props.isSelected ? props.isSelected(day) : false;
1577
- var between = props.isBetween ? props.isBetween(day) : false;
1578
- cells.push(h("button", {
1579
- key: day,
1580
- type: "button",
1581
- disabled,
1582
- "data-day": day,
1583
- "aria-label": day,
1584
- "aria-pressed": selected,
1585
- "aria-current": day === todayISO() ? "date" : void 0,
1586
- className: p + "-dp-day" + (selected ? " is-on" : "") + (between ? " is-between" : "") + (day === todayISO() ? " is-today" : ""),
1587
- onClick: props.onPick.bind(null, day),
1588
- onKeyDown: function(ev) {
1589
- var delta = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -7, ArrowDown: 7 }[ev.key];
1590
- if (!delta) return;
1591
- ev.preventDefault();
1592
- var next = shiftDate(ev.currentTarget.getAttribute("data-day"), delta);
1593
- if (clampDay(next, props.min, props.max)) props.onMove(monthKey(next), next);
2010
+ function y(v) {
2011
+ return top + ph - Math.max(0, Number(v) || 0) / axisMax * ph;
2012
+ }
2013
+ var active = typeof props.active === "number" ? props.active : null;
2014
+ var band = data.length > 1 ? pw / (data.length - 1) : pw;
2015
+ var labelIdx = [];
2016
+ var labelStep = Math.max(1, Math.ceil(data.length / 8));
2017
+ for (var i = 0; i < data.length; i += labelStep) labelIdx.push(i);
2018
+ if (labelIdx[labelIdx.length - 1] !== data.length - 1) labelIdx.push(data.length - 1);
2019
+ var aria = props.aria || shown.map(function(s) {
2020
+ return s.label + " " + data.reduce(function(n, d) {
2021
+ return n + Number(d[s.key] || 0);
2022
+ }, 0);
2023
+ }).join("\uFF0C");
2024
+ var ticks = [];
2025
+ for (var t = 0; t <= 4; t++) ticks.push(step * t);
2026
+ var children = [];
2027
+ if (typeof props.onHover === "function") {
2028
+ children.push(h("rect", {
2029
+ key: "hit-area",
2030
+ x: left,
2031
+ y: top,
2032
+ width: pw,
2033
+ height: ph,
2034
+ className: prefix + "-trend-hit",
2035
+ onMouseLeave: function() {
2036
+ props.onHover(null);
2037
+ }
2038
+ }));
2039
+ data.forEach(function(d, di) {
2040
+ children.push(h("rect", {
2041
+ key: "hit" + di,
2042
+ x: x(di) - band / 2,
2043
+ y: top,
2044
+ width: band,
2045
+ height: ph,
2046
+ className: prefix + "-trend-slot",
2047
+ onMouseEnter: function() {
2048
+ props.onHover(di);
2049
+ }
2050
+ }));
2051
+ });
2052
+ }
2053
+ ticks.forEach(function(v, ti) {
2054
+ children.push(h(
2055
+ "g",
2056
+ { key: "t" + ti },
2057
+ h("line", { x1: left, x2: width - right, y1: y(v), y2: y(v), stroke: "var(--dsw-alias-border-l1,#f2f3f5)", strokeWidth: 1 }),
2058
+ h("text", { x: left - 8, y: y(v) + 3, textAnchor: "end", fontSize: 11, fill: "var(--dsw-alias-label-tertiary,#8f959e)" }, fmt(v))
2059
+ ));
2060
+ });
2061
+ if (active !== null && data[active]) {
2062
+ children.push(h("line", {
2063
+ key: "cross",
2064
+ x1: x(active),
2065
+ y1: top,
2066
+ x2: x(active),
2067
+ y2: top + ph,
2068
+ className: prefix + "-trend-cross"
2069
+ }));
2070
+ }
2071
+ shown.forEach(function(s, si) {
2072
+ var color = s.color || COLORS[series.indexOf(s) % COLORS.length];
2073
+ var pts = data.map(function(d, di) {
2074
+ return x(di) + "," + y(d[s.key]);
2075
+ }).join(" ");
2076
+ if (data.length > 1) {
2077
+ children.push(h("polyline", {
2078
+ key: "line" + s.key,
2079
+ points: pts,
2080
+ fill: "none",
2081
+ stroke: color,
2082
+ strokeWidth: 2,
2083
+ strokeLinejoin: "round",
2084
+ strokeLinecap: "round",
2085
+ // className 供插件用自有色调样式挂靠,也方便测试按系列归类
2086
+ className: prefix + "-trend-line" + (s.className ? " " + s.className : "")
2087
+ }));
1594
2088
  }
1595
- }, i));
1596
- }
1597
- return h(
1598
- "div",
1599
- { className: p + "-dp-cal", role: "group", "aria-label": en ? "Calendar" : "\u65E5\u5386" },
1600
- h(
2089
+ data.forEach(function(d, di) {
2090
+ children.push(h("circle", {
2091
+ key: "dot" + s.key + di,
2092
+ cx: x(di),
2093
+ cy: y(d[s.key]),
2094
+ fill: color,
2095
+ r: di === active ? 5 : 3,
2096
+ className: prefix + "-trend-dot" + (di === active ? " is-hot" : "")
2097
+ }, h("title", null, labelOf(d, di) + " \xB7 " + s.label + " " + fmt(d[s.key]) + (props.note ? " \xB7 " + props.note(d) : ""))));
2098
+ });
2099
+ });
2100
+ function labelOf(d, di) {
2101
+ if (typeof props.label === "function") return props.label(d, di);
2102
+ return String(d.bucket === void 0 ? di + 1 : d.bucket).slice(5);
2103
+ }
2104
+ labelIdx.forEach(function(di) {
2105
+ children.push(h("text", { key: "x" + di, x: x(di), y: height - 8, textAnchor: "middle", fontSize: 11, fill: "var(--dsw-alias-label-tertiary,#8f959e)" }, labelOf(data[di], di)));
2106
+ });
2107
+ var legend = props.showLegend === false ? null : h("div", { className: prefix + "-tlegend" }, series.map(function(s, si) {
2108
+ var off = !!(visible && visible[s.key] === false);
2109
+ var color = s.color || COLORS[si % COLORS.length];
2110
+ var inner = [h("span", { key: "d", className: prefix + "-dot", style: { background: color } }), s.label];
2111
+ if (typeof props.onToggle !== "function") {
2112
+ return h("span", { key: s.key, className: prefix + "-tleg-item" + (off ? " off" : "") }, inner);
2113
+ }
2114
+ return h("button", {
2115
+ key: s.key,
2116
+ type: "button",
2117
+ className: prefix + "-tleg-item" + (off ? " off" : ""),
2118
+ "aria-pressed": !off,
2119
+ title: (off ? "\u663E\u793A" : "\u9690\u85CF") + s.label,
2120
+ onClick: function() {
2121
+ props.onToggle(s.key);
2122
+ }
2123
+ }, inner);
2124
+ }));
2125
+ return h(
1601
2126
  "div",
1602
- { className: p + "-dp-head" },
1603
- h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Previous month" : "\u4E0A\u4E2A\u6708", onClick: function() {
1604
- props.onMove(shiftMonth(month, -1), "");
1605
- } }, "\u2039"),
1606
- h("strong", { className: p + "-dp-title", "aria-live": "polite" }, monthLabel(month, en)),
1607
- h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Next month" : "\u4E0B\u4E2A\u6708", onClick: function() {
1608
- props.onMove(shiftMonth(month, 1), "");
1609
- } }, "\u203A")
1610
- ),
1611
- h(
2127
+ { className: prefix + "-trend-wrap", ref: size[0] },
2128
+ h("svg", { className: prefix + "-trend", viewBox: "0 0 " + width + " " + height, width, height, role: "img", "aria-label": aria }, children),
2129
+ legend
2130
+ );
2131
+ }
2132
+ function Histogram(props) {
2133
+ var data = props.data || [];
2134
+ var max = data.reduce(function(m, d) {
2135
+ return Math.max(m, Number(d.count || 0));
2136
+ }, 0) || 1;
2137
+ return h(
1612
2138
  "div",
1613
- { className: p + "-dp-weekdays", "aria-hidden": "true" },
1614
- (en ? ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] : ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"]).map(function(w) {
1615
- return h("span", { key: w }, w);
2139
+ { className: prefix + "-hist", role: "img", "aria-label": props.aria || data.map(function(d) {
2140
+ return d.label + " " + d.count;
2141
+ }).join("\uFF0C") },
2142
+ data.map(function(d, i) {
2143
+ return h(
2144
+ "div",
2145
+ { key: d.key || d.label || i, className: prefix + "-hbar", title: d.label + "\uFF1A" + d.count },
2146
+ h("span", { className: prefix + "-hbar-v" }, num(props.lang, d.count)),
2147
+ h("span", { className: prefix + "-hbar-f", style: { height: Math.max(2, Number(d.count || 0) / max * 100) + "%", background: d.color || props.color || COLORS[0] } }),
2148
+ h("span", { className: prefix + "-hbar-l" }, d.label)
2149
+ );
1616
2150
  })
1617
- ),
1618
- h("div", { className: p + "-dp-grid" }, cells)
1619
- );
1620
- }
1621
- function DatePicker(props) {
1622
- var c = ctx(props), R = c.R, h = c.h;
1623
- var p = props.prefix, en = props.lang === "en";
1624
- var value = validDate(props.value) ? props.value : "";
1625
- var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
1626
- var monthS = R.useState(monthKey(value || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
1627
- var root = R.useRef(null);
1628
- usePopover(R, open, setOpen, root);
1629
- function pick(day) {
1630
- if (props.onChange) props.onChange(day);
1631
- setOpen(false);
2151
+ );
1632
2152
  }
1633
- function toggle() {
1634
- setMonth(monthKey(validDate(props.value) ? props.value : props.max || todayISO()));
1635
- setOpen(!open);
2153
+ function DataTable(props) {
2154
+ var cols = props.columns || [];
2155
+ var rows = props.rows || [];
2156
+ if (!rows.length) return h("div", { className: prefix + "-empty" }, props.empty || "\u6682\u65E0\u6570\u636E");
2157
+ return h("div", { className: prefix + "-table-scroll", tabIndex: 0, role: "region", "aria-label": props.lang === "en" ? "Data table" : "\u6570\u636E\u8868\u683C" }, h(
2158
+ "table",
2159
+ { className: prefix + "-table" },
2160
+ h("thead", null, h("tr", null, cols.map(function(c) {
2161
+ return h("th", { key: c.key, className: c.num ? prefix + "-num" : "" }, c.label);
2162
+ }))),
2163
+ h("tbody", null, rows.map(function(row, ri) {
2164
+ return h("tr", { key: row.id || row.key || ri }, cols.map(function(c) {
2165
+ return h("td", { key: c.key, className: c.num ? prefix + "-num" : "" }, c.render ? c.render(row) : row[c.key]);
2166
+ }));
2167
+ }))
2168
+ ));
1636
2169
  }
1637
- return h(
1638
- "div",
1639
- { className: p + "-dp" + (props.className ? " " + props.className : ""), ref: root },
1640
- h(
2170
+ function RangeSwitch(props) {
2171
+ var custom = props.custom || null;
2172
+ var from = custom && custom.from ? custom.from : "";
2173
+ var to = custom && custom.to ? custom.to : "";
2174
+ function setDate(key, value) {
2175
+ if (typeof props.onCustomChange !== "function") return;
2176
+ var next = { from, to };
2177
+ next[key] = value;
2178
+ props.onCustomChange(next);
2179
+ }
2180
+ return h(
1641
2181
  "div",
1642
- { className: p + "-dp-field" },
2182
+ { className: prefix + "-stoolbar" },
2183
+ h("div", { className: prefix + "-seg", role: "group", "aria-label": props.aria || "\u65F6\u95F4\u8303\u56F4" }, (props.options || []).map(function(o) {
2184
+ return h("button", {
2185
+ key: o.key,
2186
+ type: "button",
2187
+ className: o.key === props.value ? prefix + "-on" : "",
2188
+ "aria-pressed": !!props.value && o.key === props.value,
2189
+ onClick: function() {
2190
+ props.onChange(o.key);
2191
+ }
2192
+ }, o.label);
2193
+ })),
1643
2194
  h(
1644
- "button",
1645
- {
2195
+ "div",
2196
+ { className: prefix + "-range", role: "group", "aria-label": props.customAria || "\u81EA\u5B9A\u4E49\u65E5\u671F\u8303\u56F4" },
2197
+ h(DP.RangePicker, {
2198
+ React,
2199
+ h,
2200
+ prefix,
2201
+ lang: props.lang,
2202
+ label: props.customAria || "\u81EA\u5B9A\u4E49\u65E5\u671F\u8303\u56F4",
2203
+ value: { from, to },
2204
+ max: props.today || void 0,
2205
+ clearable: false,
2206
+ onChange: function(next) {
2207
+ if (typeof props.onCustomChange !== "function") return;
2208
+ props.onCustomChange({ from: next.from, to: next.to });
2209
+ }
2210
+ }),
2211
+ from || to ? h("button", {
1646
2212
  type: "button",
1647
- className: p + "-dp-trigger",
1648
- disabled: !!props.disabled,
1649
- "aria-haspopup": "dialog",
1650
- "aria-expanded": open,
1651
- "aria-label": (props.label ? props.label + ": " : "") + (value || props.placeholder || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F")),
1652
- onClick: toggle
1653
- },
1654
- h("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
1655
- h("span", { className: p + "-dp-value" + (value ? "" : " is-empty") }, value || props.placeholder || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F"))
2213
+ className: prefix + "-clear",
2214
+ "aria-label": props.clearLabel || "\u6E05\u9664\u81EA\u5B9A\u4E49\u8303\u56F4",
2215
+ title: props.clearLabel || "\u6E05\u9664\u81EA\u5B9A\u4E49\u8303\u56F4",
2216
+ onClick: function() {
2217
+ if (props.onCustomClear) props.onCustomClear();
2218
+ }
2219
+ }, "\xD7") : null
1656
2220
  ),
1657
- value && !props.disabled && props.clearable !== false ? h("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear date" : "\u6E05\u9664\u65E5\u671F", onClick: function() {
1658
- if (props.onChange) props.onChange("");
1659
- } }, "\xD7") : null
1660
- ),
1661
- open ? h(
2221
+ props.customHint ? h("span", { className: prefix + "-hint", role: "status" }, props.customHint) : null,
2222
+ h("button", { type: "button", className: prefix + "-ghost", disabled: !!props.loading, onClick: props.onRefresh }, ico("refresh", 13), props.refreshLabel || "\u5237\u65B0"),
2223
+ h("span", { className: prefix + "-muted" }, props.generatedAt ? (props.timeLabel || "\u622A\u81F3") + " " + timeText(props.generatedAt) : ""),
2224
+ props.right ? h("span", { style: { marginLeft: "auto" } }, props.right) : null
2225
+ );
2226
+ }
2227
+ function Empty(props) {
2228
+ return h("div", { className: prefix + "-empty" }, props.text || "\u6682\u65E0\u6570\u636E");
2229
+ }
2230
+ function Skeleton() {
2231
+ return h(
1662
2232
  "div",
1663
- { className: p + "-dp-pop", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F") },
1664
- h(Calendar, { h, prefix: p, lang: props.lang, month, min: props.min, max: props.max, onMove: function(m) {
1665
- setMonth(m);
1666
- }, isSelected: function(d) {
1667
- return d === value;
1668
- }, onPick: pick }),
1669
- h(
1670
- "div",
1671
- { className: p + "-dp-foot" },
1672
- h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1673
- pick(todayISO());
1674
- } }, en ? "Today" : "\u4ECA\u5929"),
1675
- props.min || props.max ? h("span", { className: p + "-dp-hint" }, [props.min, props.max].filter(Boolean).join(" \u2014 ")) : null
1676
- )
1677
- ) : null
1678
- );
2233
+ { className: prefix + "-sgrid" },
2234
+ h("div", { className: prefix + "-kpis" }, [0, 1, 2, 3].map(function(i) {
2235
+ return h(
2236
+ "div",
2237
+ { key: i, className: prefix + "-kpi" },
2238
+ h("div", { className: prefix + "-sk", style: { width: "40%" } }),
2239
+ h("div", { className: prefix + "-sk", style: { width: "65%", height: 26 } })
2240
+ );
2241
+ })),
2242
+ [0, 1].map(function(i) {
2243
+ return h(
2244
+ "div",
2245
+ { key: "c" + i, className: prefix + "-scard " + prefix + "-span-6" },
2246
+ h("div", { className: prefix + "-sk", style: { width: "30%" } }),
2247
+ h("div", { className: prefix + "-sk", style: { height: 120 } })
2248
+ );
2249
+ })
2250
+ );
2251
+ }
2252
+ function ErrorBar(props) {
2253
+ return h(
2254
+ "div",
2255
+ { className: prefix + "-err", role: "alert" },
2256
+ h("span", null, props.message),
2257
+ props.onRetry ? h("button", { type: "button", className: prefix + "-ghost", onClick: props.onRetry }, props.retryLabel || "\u91CD\u8BD5") : null
2258
+ );
2259
+ }
2260
+ function Warnings(props) {
2261
+ var items = props.items || [];
2262
+ if (!items.length) return null;
2263
+ return h("div", { className: prefix + "-warn", role: "status" }, items.map(function(w) {
2264
+ return w.message;
2265
+ }).join("\uFF1B"));
2266
+ }
2267
+ return {
2268
+ Card,
2269
+ Kpi,
2270
+ Donut,
2271
+ BarList,
2272
+ StackedRows,
2273
+ Trend,
2274
+ Histogram,
2275
+ DataTable,
2276
+ RangeSwitch,
2277
+ Empty,
2278
+ Skeleton,
2279
+ ErrorBar,
2280
+ Warnings,
2281
+ num,
2282
+ pct,
2283
+ timeText,
2284
+ dateText,
2285
+ colors: COLORS,
2286
+ useWidth
2287
+ };
1679
2288
  }
1680
- function RangePicker(props) {
1681
- var c = ctx(props), R = c.R, h = c.h;
1682
- var p = props.prefix, en = props.lang === "en";
1683
- var range = normalizeRange(props.value);
1684
- var from = range.from, to = range.to;
1685
- var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
1686
- var startS = R.useState(""), start = startS[0], setStart = startS[1];
1687
- var monthS = R.useState(monthKey(from || to || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
1688
- var root = R.useRef(null);
1689
- usePopover(R, open, setOpen, root);
1690
- function apply(next) {
1691
- if (typeof props.onChange === "function") props.onChange(normalizeRange(next));
1692
- setStart("");
1693
- setOpen(false);
2289
+ function makeCharts(prefix, options) {
2290
+ var opts = options || {};
2291
+ if (typeof document !== "undefined" && !document.getElementById(prefix + "-charts-css")) {
2292
+ var el = document.createElement("style");
2293
+ el.id = prefix + "-charts-css";
2294
+ el.textContent = css(prefix, opts.styles);
2295
+ document.head.appendChild(el);
1694
2296
  }
1695
- function pick(day) {
1696
- if (!start) {
1697
- setStart(day);
1698
- return;
2297
+ return primitives(prefix, opts);
2298
+ }
2299
+ module2.exports = { makeCharts, primitives, css, colors: COLORS };
2300
+ }
2301
+ });
2302
+
2303
+ // packages/addons/salary/client/views/stats.cjs
2304
+ var require_stats = __commonJS({
2305
+ "packages/addons/salary/client/views/stats.cjs"(exports2, module2) {
2306
+ "use strict";
2307
+ module2.exports = function Stats(props) {
2308
+ var h = props.h, React = props.React, api = props.api;
2309
+ var C = require_common();
2310
+ var F = require_fields();
2311
+ var P = require_stats_parts();
2312
+ var charts = require_stats_charts();
2313
+ var ch = React.useMemo(function() {
2314
+ return charts.makeCharts("wbsalc");
2315
+ }, []);
2316
+ var yearState = React.useState(props.initialYear || (/* @__PURE__ */ new Date()).getFullYear());
2317
+ var year = yearState[0], setYear = yearState[1];
2318
+ var basisState = React.useState(props.initialBasis || "arrival");
2319
+ var basis = basisState[0], setBasis = basisState[1];
2320
+ var basisLabel = basis === "income" ? "\u6309\u6240\u5C5E\u6708" : "\u6309\u5230\u8D26\u6708";
2321
+ var amountState = React.useState(props.initialAmount || "net");
2322
+ var amount = amountState[0], setAmount = amountState[1];
2323
+ var amountLabel = amount === "gross" ? "\u5E94\u53D1" : "\u5B9E\u53D1";
2324
+ var load = C.useLoad(React, api, "salary.stats", { year, basis }, [year, basis]);
2325
+ var data = load.data;
2326
+ var METRICS = [
2327
+ { key: "netPay", label: "\u5B9E\u53D1" },
2328
+ { key: "basePay", label: "\u57FA\u672C" },
2329
+ { key: "performancePay", label: "\u7EE9\u6548" },
2330
+ { key: "allowance", label: "\u8865\u8D34" },
2331
+ { key: "performanceBonus", label: "\u7EE9\u6548\u5956\u60E9" },
2332
+ { key: "grossPay", label: "\u5E94\u53D1" }
2333
+ ];
2334
+ var metricState = React.useState(props.initialMetric || "netPay");
2335
+ var metric = metricState[0], setMetric = metricState[1];
2336
+ var metricLabel = "\u5B9E\u53D1";
2337
+ METRICS.forEach(function(m) {
2338
+ if (m.key === metric) metricLabel = m.label;
2339
+ });
2340
+ var monthly = data && data.monthly || [];
2341
+ var recordedMonths = monthly.filter(function(bucket) {
2342
+ return bucket.records > 0;
2343
+ });
2344
+ var LINE_SERIES = [
2345
+ { key: "netPay", label: "\u5B9E\u53D1", tone: "s1" },
2346
+ { key: "grossPay", label: "\u5E94\u53D1", tone: "s2" },
2347
+ { key: "basePay", label: "\u57FA\u672C", tone: "s3" },
2348
+ { key: "performancePay", label: "\u7EE9\u6548", tone: "s4" },
2349
+ { key: "allowance", label: "\u8865\u8D34", tone: "s5" },
2350
+ { key: "performanceBonus", label: "\u7EE9\u6548\u5956\u60E9", tone: "s6" }
2351
+ ];
2352
+ var visibleState = React.useState(Object.assign({ netPay: true, grossPay: true, basePay: true, performancePay: true, allowance: true, performanceBonus: true }, props.initialVisible || {}));
2353
+ var visible = visibleState[0];
2354
+ function toggleIn(state, series) {
2355
+ return function(key) {
2356
+ var next = {};
2357
+ series.forEach(function(m) {
2358
+ next[m.key] = state[0][m.key] !== false;
2359
+ });
2360
+ next[key] = !next[key];
2361
+ state[1](next);
2362
+ };
2363
+ }
2364
+ function round2(value) {
2365
+ return Math.round((Number(value) || 0) * 100) / 100;
2366
+ }
2367
+ function deductOf(bucket) {
2368
+ return round2((Number(bucket.pension) || 0) + (Number(bucket.medical) || 0) + (Number(bucket.unemployment) || 0) + (Number(bucket.housingFund) || 0) + (Number(bucket.incomeTax) || 0));
2369
+ }
2370
+ function seriesValue(m, bucket) {
2371
+ if (typeof m.get === "function") return m.get(bucket);
2372
+ return Number(bucket[m.key]) || 0;
2373
+ }
2374
+ var DEDUCT_TOTAL_ALL = round2((data && data.socialTotal || 0) + (data && data.incomeTaxTotal || 0));
2375
+ var DEDUCT_SERIES = F.SOCIAL_KEYS.map(function(key, index) {
2376
+ return { key, label: F.LABELS[key], tone: "s" + (index + 1) };
2377
+ }).concat([
2378
+ { key: "incomeTax", label: "\u4E2A\u7A0E", tone: "s5" },
2379
+ { key: "deductTotal", label: "\u5408\u8BA1", tone: "sum", get: deductOf }
2380
+ ]);
2381
+ var socialState = React.useState(Object.assign({ pension: true, medical: true, unemployment: true, housingFund: true, incomeTax: true, deductTotal: true }, props.initialSocialVisible || {}));
2382
+ var socialVisible = socialState[0];
2383
+ var hoverState = React.useState(typeof props.initialHover === "number" ? props.initialHover : null);
2384
+ var socialHoverState = React.useState(typeof props.initialSocialHover === "number" ? props.initialSocialHover : null);
2385
+ var yearHoverState = React.useState(null);
2386
+ var quarterHoverState = React.useState(null);
2387
+ var yoyHoverState = React.useState(null);
2388
+ function monthIndexOf(value) {
2389
+ if (typeof value !== "number") return null;
2390
+ for (var i = 0; i < recordedMonths.length; i += 1) {
2391
+ if (recordedMonths[i].month === value) return i;
1699
2392
  }
1700
- apply({ from: start, to: day });
2393
+ return null;
1701
2394
  }
1702
- function toggle() {
1703
- setStart("");
1704
- setMonth(monthKey(from || to || props.max || todayISO()));
1705
- setOpen(!open);
2395
+ function monthOfIndex(index) {
2396
+ if (index === null || index === void 0 || !recordedMonths[index]) return null;
2397
+ return recordedMonths[index].month;
1706
2398
  }
1707
- var summary = from && to ? from + " \u2014 " + to : from ? from + (en ? " onward" : " \u8D77") : to ? (en ? "Until " : "\u622A\u81F3 ") + to : props.placeholder || (en ? "Choose date range" : "\u9009\u62E9\u65E5\u671F\u8303\u56F4");
1708
- return h(
1709
- "div",
1710
- { className: p + "-dr" + (props.className ? " " + props.className : ""), ref: root },
1711
- h(
2399
+ function sumSeries() {
2400
+ return [
2401
+ { key: "total", label: "\u5408\u8BA1", tone: "s1" },
2402
+ { key: "max", label: "\u5355\u7B14\u6700\u9AD8", tone: "s3" },
2403
+ { key: "avg", label: "\u5355\u7B14\u5747\u503C", tone: "s2" }
2404
+ ];
2405
+ }
2406
+ var SUM_SERIES = sumSeries();
2407
+ var yearVisibleState = React.useState({ total: true, max: true, avg: true });
2408
+ var quarterVisibleState = React.useState({ total: true, max: true, avg: true });
2409
+ var yoyVisibleState = React.useState({ now: true, prior: true });
2410
+ var YOY_SERIES = [
2411
+ { key: "now", label: year + " \u5E74", tone: "s1" },
2412
+ { key: "prior", label: year - 1 + " \u5E74", tone: "s2" }
2413
+ ];
2414
+ function flatten(list, suffix) {
2415
+ return (list || []).map(function(item) {
2416
+ return {
2417
+ bucket: item.bucket,
2418
+ count: item.count || 0,
2419
+ total: Number(item[amount + "Total"] !== void 0 ? item[amount + "Total"] : 0) || 0,
2420
+ max: Number(item[amount + "Max"] !== void 0 ? item[amount + "Max"] : 0) || 0,
2421
+ avg: Number(item[amount + "Avg"] !== void 0 ? item[amount + "Avg"] : 0) || 0,
2422
+ suffix
2423
+ };
2424
+ });
2425
+ }
2426
+ var yearlyRows = flatten(data && data.yearly, "\u5E74");
2427
+ var quarterRows = flatten(data && data.quarterly, "");
2428
+ var priorByMonth = {};
2429
+ (data && data.priorMonthly || []).forEach(function(item) {
2430
+ priorByMonth[item.month] = item;
2431
+ });
2432
+ var yoyRows = (data && data.monthly || []).map(function(bucket) {
2433
+ var prior = priorByMonth[bucket.month] || {};
2434
+ return {
2435
+ bucket: bucket.period || year + "-" + String(bucket.month).padStart(2, "0"),
2436
+ month: bucket.month,
2437
+ count: bucket.records || 0,
2438
+ now: amount === "gross" ? Number(bucket.grossPay) || 0 : Number(bucket.netPay) || 0,
2439
+ prior: amount === "gross" ? Number(prior.grossPay) || 0 : Number(prior.netPay) || 0,
2440
+ priorRecords: prior.records || 0
2441
+ };
2442
+ }).filter(function(row) {
2443
+ return row.count > 0 || row.prior > 0;
2444
+ });
2445
+ function money(v) {
2446
+ return F.money(v);
2447
+ }
2448
+ function axisFmt(v) {
2449
+ var n = Number(v) || 0;
2450
+ if (Math.abs(n) >= 1e4) return Number((n / 1e4).toFixed(1)) + "\u4E07";
2451
+ return String(Math.round(n));
2452
+ }
2453
+ function monthLabel(bucket) {
2454
+ return String(bucket).slice(5) + " \u6708";
2455
+ }
2456
+ function quarterLabel(bucket) {
2457
+ return String(bucket).replace("-Q", " Q");
2458
+ }
2459
+ var yearNet = Number(data && data.netTotal) || 0;
2460
+ var yearGross = Number(data && data.grossTotal) || 0;
2461
+ var yearTax = Number(data && data.incomeTaxTotal) || 0;
2462
+ var yearSocial = Number(data && data.socialTotal) || 0;
2463
+ var yearMax = 0, yearMin = null;
2464
+ recordedMonths.forEach(function(bucket) {
2465
+ var value = Number(bucket.netPay) || 0;
2466
+ if (value > yearMax) yearMax = value;
2467
+ if (value > 0 && (yearMin === null || value < yearMin)) yearMin = value;
2468
+ });
2469
+ var mom = data && data.mom;
2470
+ var momText = mom && mom.percent !== null && mom.percent !== void 0 ? (mom.percent >= 0 ? "+" : "") + mom.percent + "%" : "\u2014";
2471
+ var body;
2472
+ if (load.loading || data && (data.year !== year || data.basis !== basis)) {
2473
+ body = h("div", { className: "wbsal-card" }, h(ch.Skeleton, { text: "\u52A0\u8F7D\u4E2D\u2026" }));
2474
+ } else if (!data) {
2475
+ body = h(
1712
2476
  "div",
1713
- { className: p + "-dp-field" },
1714
- h(
1715
- "button",
1716
- {
1717
- type: "button",
1718
- className: p + "-dp-trigger",
1719
- "aria-haspopup": "dialog",
1720
- "aria-expanded": open,
1721
- "aria-label": (props.label || (en ? "Date range" : "\u65E5\u671F\u8303\u56F4")) + ": " + summary,
1722
- onClick: toggle
2477
+ { className: "wbsal-card wbsal-empty" },
2478
+ h("strong", null, "\u7EDF\u8BA1\u52A0\u8F7D\u5931\u8D25"),
2479
+ h("span", null, load.error || "\u8BF7\u7A0D\u540E\u91CD\u8BD5"),
2480
+ h("div", { className: "wbsal-empty-actions" }, h(C.Btn, { h, onClick: function() {
2481
+ load.refresh();
2482
+ } }, "\u91CD\u8BD5"))
2483
+ );
2484
+ } else {
2485
+ var hasYear = data.records > 0;
2486
+ var latest = data.latestMonth;
2487
+ var latestBreakdown = latest && latest.breakdown ? latest.breakdown : null;
2488
+ var deductionTotal = Number(data.deductionTotal) || 0;
2489
+ var sections = [];
2490
+ sections.push(P.trendCard({
2491
+ h,
2492
+ CH: ch,
2493
+ lang: props.lang,
2494
+ title: "\u5E74\u5EA6\u8D8B\u52BF",
2495
+ note: "\u5168\u90E8\u5E74\u4EFD \xB7 \u4E09\u6761\u7EBF\u5747\u6309" + amountLabel,
2496
+ series: SUM_SERIES,
2497
+ rows: yearlyRows,
2498
+ visible: yearVisibleState[0],
2499
+ onToggle: toggleIn(yearVisibleState, SUM_SERIES),
2500
+ hover: yearHoverState[0],
2501
+ onHover: yearHoverState[1],
2502
+ fmt: money,
2503
+ label: function(row) {
2504
+ return row.bucket + " \u5E74";
2505
+ },
2506
+ tipTitle: function(row) {
2507
+ return row.bucket + " \u5E74 \xB7 " + amountLabel;
2508
+ },
2509
+ tipRows: function(row) {
2510
+ return [
2511
+ { key: "total", label: "\u5408\u8BA1", tone: "s1", value: row.total },
2512
+ { key: "max", label: "\u5355\u7B14\u6700\u9AD8", tone: "s3", value: row.max },
2513
+ { key: "avg", label: "\u5355\u7B14\u5747\u503C", tone: "s2", value: row.avg }
2514
+ ];
2515
+ },
2516
+ tipNote: function(row) {
2517
+ return "\u5171 " + row.count + " \u7B14";
2518
+ },
2519
+ ariaLabel: "\u5E74\u5EA6\u5408\u8BA1\u3001\u5355\u7B14\u6700\u9AD8\u4E0E\u5355\u7B14\u5747\u503C\u6298\u7EBF\u56FE",
2520
+ emptyText: "\u8FD8\u6CA1\u6709\u8DE8\u5E74\u5EA6\u7684\u5DE5\u8D44\u8BB0\u5F55",
2521
+ allOffHint: "\u4E09\u6761\u7EBF\u90FD\u5173\u6389\u4E86\uFF0C\u70B9\u4E0A\u65B9\u300C\u5408\u8BA1 / \u5355\u7B14\u6700\u9AD8 / \u5355\u7B14\u5747\u503C\u300D\u4EFB\u610F\u4E00\u4E2A\u6062\u590D\u663E\u793A",
2522
+ footLeft: "\u6BCF\u6761\u7EBF\u53EF\u70B9\u4E0A\u65B9\u6807\u7B7E\u5355\u72EC\u5F00\u5173 \xB7 \u9F20\u6807\u79FB\u5230\u67D0\u4E00\u5E74\u770B\u5408\u8BA1\u3001\u6700\u9AD8\u4E0E\u5747\u503C",
2523
+ footRight: "\u5355\u4F4D\uFF1A\u5143 \xB7 " + basisLabel,
2524
+ height: 200
2525
+ }));
2526
+ sections.push(P.trendCard({
2527
+ h,
2528
+ CH: ch,
2529
+ lang: props.lang,
2530
+ title: "\u5B63\u5EA6\u8D8B\u52BF",
2531
+ note: "\u6700\u8FD1 8 \u4E2A\u6709\u8BB0\u5F55\u7684\u5B63\u5EA6",
2532
+ series: SUM_SERIES,
2533
+ rows: quarterRows,
2534
+ visible: quarterVisibleState[0],
2535
+ onToggle: toggleIn(quarterVisibleState, SUM_SERIES),
2536
+ hover: quarterHoverState[0],
2537
+ onHover: quarterHoverState[1],
2538
+ fmt: money,
2539
+ label: function(row) {
2540
+ return quarterLabel(row.bucket);
2541
+ },
2542
+ tipTitle: function(row) {
2543
+ return quarterLabel(row.bucket) + " \xB7 " + amountLabel;
2544
+ },
2545
+ tipRows: function(row) {
2546
+ return [
2547
+ { key: "total", label: "\u5408\u8BA1", tone: "s1", value: row.total },
2548
+ { key: "max", label: "\u5355\u7B14\u6700\u9AD8", tone: "s3", value: row.max },
2549
+ { key: "avg", label: "\u5355\u7B14\u5747\u503C", tone: "s2", value: row.avg }
2550
+ ];
2551
+ },
2552
+ tipNote: function(row) {
2553
+ return "\u5171 " + row.count + " \u7B14";
2554
+ },
2555
+ ariaLabel: "\u5B63\u5EA6\u5408\u8BA1\u3001\u5355\u7B14\u6700\u9AD8\u4E0E\u5355\u7B14\u5747\u503C\u6298\u7EBF\u56FE",
2556
+ emptyText: "\u8FD8\u6CA1\u6709\u5E26\u65E5\u671F\u7684\u5DE5\u8D44\u8BB0\u5F55",
2557
+ allOffHint: "\u4E09\u6761\u7EBF\u90FD\u5173\u6389\u4E86\uFF0C\u70B9\u4E0A\u65B9\u300C\u5408\u8BA1 / \u5355\u7B14\u6700\u9AD8 / \u5355\u7B14\u5747\u503C\u300D\u4EFB\u610F\u4E00\u4E2A\u6062\u590D\u663E\u793A",
2558
+ footLeft: "\u5B63\u5EA6\u6309" + (basis === "income" ? "\u5DE5\u8D44\u6240\u5C5E\u671F" : "\u5230\u8D26\u65E5\u671F") + "\u5F52\u96C6 \xB7 \u672A\u6765\u5B63\u5EA6\u4E0D\u753B 0",
2559
+ footRight: "\u5355\u4F4D\uFF1A\u5143 \xB7 " + amountLabel,
2560
+ height: 200
2561
+ }));
2562
+ if (hasYear) {
2563
+ sections.push(h(
2564
+ "div",
2565
+ { key: "kpi", className: "wbsal-kpis" },
2566
+ P.kpi(h, "\u5E74\u5EA6\u5B9E\u53D1\u5408\u8BA1", money(yearNet), data.records + " \u7B14 \xB7 \u8986\u76D6 " + data.months + " \u4E2A\u6708"),
2567
+ P.kpi(h, "\u5E74\u5EA6\u5E94\u53D1\u5408\u8BA1", money(yearGross), "\u4E2A\u7A0E " + money(yearTax) + " \xB7 \u4E94\u9669\u4E00\u91D1 " + money(yearSocial)),
2568
+ P.kpi(h, "\u6708\u5747\u5B9E\u53D1", money(data.avgNetPay), "\u5355\u7B14\u6700\u9AD8 " + money(yearMax)),
2569
+ P.kpi(h, "\u793E\u4FDD\u4E0E\u4E2A\u7A0E", money(DEDUCT_TOTAL_ALL), yearGross ? "\u5360\u5E94\u53D1 " + Math.round(DEDUCT_TOTAL_ALL / yearGross * 100) + "%" : "\u65E0\u5E94\u53D1\u8BB0\u5F55"),
2570
+ P.kpi(h, "\u73AF\u6BD4\u4E0A\u6708", momText, data.previousMonth ? F.monthLabel(data.previousMonth.period) + " \u2192 " + F.monthLabel((data.latestMonth || {}).period || "") : "\u6682\u65E0\u4E0A\u6708\u6570\u636E"),
2571
+ P.kpi(h, "\u6700\u9AD8 / \u6700\u4F4E\u5355\u6708", money(yearMax) + " / " + money(yearMin === null ? 0 : yearMin), data.peakMonth ? "\u5CF0\u503C " + F.monthLabel(data.peakMonth.period) : "\u6682\u65E0\u8BB0\u5F55")
2572
+ ));
2573
+ sections.push(h(
2574
+ "div",
2575
+ { key: "bar", className: "wbsal-card wbsal-section" },
2576
+ h(
2577
+ "div",
2578
+ { className: "wbsal-section-head" },
2579
+ h("h3", null, "\u6708\u5EA6" + metricLabel + "\u5206\u5E03"),
2580
+ h(
2581
+ "div",
2582
+ { className: "wbsal-section-tools" },
2583
+ h("span", { className: "wbsal-section-note" }, "\u6700\u9AD8 " + (data.peakMonth ? F.monthLabel(data.peakMonth.period) : "\u2014")),
2584
+ P.segGroup(h, METRICS.map(function(m) {
2585
+ return [m.key, m.label];
2586
+ }), metric, setMetric, "\u67F1\u72B6\u56FE\u53E3\u5F84")
2587
+ )
2588
+ ),
2589
+ P.barChart({
2590
+ h,
2591
+ F,
2592
+ rows: monthly,
2593
+ value: function(bucket) {
2594
+ return Number(bucket[metric]) || 0;
2595
+ },
2596
+ metricLabel,
2597
+ basisLabel: basisLabel + " \xB7 " + year + " \u5E74"
2598
+ })
2599
+ ));
2600
+ sections.push(P.trendCard({
2601
+ h,
2602
+ CH: ch,
2603
+ lang: props.lang,
2604
+ title: "\u6708\u5EA6\u8D8B\u52BF\u5BF9\u6BD4",
2605
+ note: "\u516D\u6761\u53E3\u5F84\u7EBF",
2606
+ series: LINE_SERIES,
2607
+ rows: recordedMonths,
2608
+ visible,
2609
+ onToggle: toggleIn(visibleState, LINE_SERIES),
2610
+ hover: monthIndexOf(hoverState[0]),
2611
+ onHover: function(index) {
2612
+ hoverState[1](monthOfIndex(index));
1723
2613
  },
1724
- h("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
1725
- h("span", { className: p + "-dp-value" + (from || to ? "" : " is-empty") }, summary)
1726
- ),
1727
- (from || to) && props.clearable !== false ? h("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear range" : "\u6E05\u9664\u8303\u56F4", onClick: function() {
1728
- apply({ from: "", to: "" });
1729
- } }, "\xD7") : null
1730
- ),
1731
- open ? h(
1732
- "div",
1733
- { className: p + "-dp-pop", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Date range" : "\u65E5\u671F\u8303\u56F4") },
1734
- h(Calendar, {
2614
+ fmt: money,
2615
+ label: function(row) {
2616
+ return F.monthLabel(row.period || year + "-" + String(row.month).padStart(2, "0"));
2617
+ },
2618
+ tipTitle: function(row) {
2619
+ return F.monthLabel(row.period || year + "-" + String(row.month).padStart(2, "0")) + " \u6536\u5165\u9762";
2620
+ },
2621
+ tipRows: function(row) {
2622
+ return LINE_SERIES.map(function(m) {
2623
+ return { key: m.key, label: m.label, tone: m.tone, value: seriesValue(m, row) };
2624
+ });
2625
+ },
2626
+ tipNote: function(row) {
2627
+ return "\u5171 " + row.records + " \u7B14";
2628
+ },
2629
+ ariaLabel: "\u6708\u5EA6\u5B9E\u53D1/\u5E94\u53D1/\u57FA\u672C/\u7EE9\u6548/\u8865\u8D34/\u7EE9\u6548\u5956\u60E9\u6298\u7EBF\u56FE",
2630
+ emptyText: year + " \u5E74\u8FD8\u6CA1\u6709\u5DE5\u8D44\u8BB0\u5F55",
2631
+ allOffHint: "\u516D\u6761\u7EBF\u90FD\u5173\u6389\u4E86\uFF0C\u70B9\u4E0A\u65B9\u7684\u300C\u5B9E\u53D1 / \u5E94\u53D1 / \u57FA\u672C / \u7EE9\u6548 / \u8865\u8D34 / \u7EE9\u6548\u5956\u60E9\u300D\u4EFB\u610F\u4E00\u4E2A\u6062\u590D\u663E\u793A",
2632
+ footLeft: "\u516D\u6761\u7EBF\u53EF\u5355\u72EC\u5F00\u5173 \xB7 \u9F20\u6807\u79FB\u5230\u67D0\u4E2A\u6708\u4EFD\u770B\u8BE5\u6708\u5168\u90E8\u7EF4\u5EA6",
2633
+ footRight: "\u5355\u4F4D\uFF1A\u5143 \xB7 \u4EC5\u8FDE\u63A5\u6709\u8BB0\u5F55\u7684\u6708\u4EFD",
2634
+ height: 220
2635
+ }));
2636
+ sections.push(h(
2637
+ "div",
2638
+ { key: "social", className: "wbsal-card wbsal-section" },
2639
+ h(
2640
+ "div",
2641
+ { className: "wbsal-section-head" },
2642
+ h("h3", null, "\u793E\u4FDD\u4E0E\u4E2A\u7A0E"),
2643
+ h(
2644
+ "div",
2645
+ { className: "wbsal-section-tools" },
2646
+ h("span", { className: "wbsal-section-note" }, "\u5E74\u5EA6\u5408\u8BA1 " + money(DEDUCT_TOTAL_ALL)),
2647
+ P.seriesSwitch(h, DEDUCT_SERIES, socialVisible, toggleIn(socialState, DEDUCT_SERIES), "\u793E\u4FDD\u4E0E\u4E2A\u7A0E\u6298\u7EBF\u663E\u793A\u5F00\u5173")
2648
+ )
2649
+ ),
2650
+ h("div", { className: "wbsal-social" }, F.SOCIAL_KEYS.concat(["incomeTax"]).map(function(key) {
2651
+ var amount2 = key === "incomeTax" ? yearTax : Number((data.social || {})[key]) || 0;
2652
+ var share = DEDUCT_TOTAL_ALL ? Math.round(amount2 / DEDUCT_TOTAL_ALL * 100) : 0;
2653
+ return h(
2654
+ "div",
2655
+ { key, className: "wbsal-social-item" },
2656
+ h("span", null, F.LABELS[key]),
2657
+ h("b", null, money(amount2)),
2658
+ h("em", null, "\u5360\u793E\u4FDD\u4E0E\u4E2A\u7A0E " + share + "%")
2659
+ );
2660
+ })),
2661
+ h("div", { className: "wbsal-linechart" }, h(ch.Trend, {
2662
+ data: recordedMonths,
2663
+ series: DEDUCT_SERIES.map(function(m) {
2664
+ return { key: m.key, label: m.label, className: m.tone, color: P.TONE_COLOR[m.tone] };
2665
+ }),
2666
+ lang: props.lang,
2667
+ height: 200,
2668
+ showLegend: false,
2669
+ visible: socialVisible,
2670
+ active: monthIndexOf(socialHoverState[0]),
2671
+ onHover: function(index) {
2672
+ socialHoverState[1](monthOfIndex(index));
2673
+ },
2674
+ format: money,
2675
+ label: function(row) {
2676
+ return F.monthLabel(row.period || year + "-" + String(row.month).padStart(2, "0"));
2677
+ },
2678
+ note: function(row) {
2679
+ return row.records + " \u7B14";
2680
+ },
2681
+ aria: "\u6708\u5EA6\u517B\u8001/\u533B\u7597/\u5931\u4E1A/\u516C\u79EF\u91D1/\u4E2A\u7A0E\u6298\u7EBF\u56FE",
2682
+ emptyText: "\u8FD8\u6CA1\u6709\u793E\u4FDD\u4E0E\u4E2A\u7A0E\u8BB0\u5F55"
2683
+ })),
2684
+ P.anyShown(DEDUCT_SERIES, socialVisible) ? null : h("div", { className: "wbsal-chart-hint" }, "\u6240\u6709\u7EBF\u90FD\u5173\u6389\u4E86\uFF0C\u70B9\u4E0A\u65B9\u300C\u517B\u8001 / \u533B\u7597 / \u5931\u4E1A / \u516C\u79EF\u91D1 / \u4E2A\u7A0E / \u5408\u8BA1\u300D\u4EFB\u610F\u4E00\u4E2A\u6062\u590D\u663E\u793A"),
2685
+ h(
2686
+ "div",
2687
+ { className: "wbsal-chart-foot" },
2688
+ h("span", null, "\u4E94\u6761\u5206\u9879\u7EBF + \u5408\u8BA1\u7EBF\u53EF\u5355\u72EC\u5F00\u5173 \xB7 \u5408\u8BA1\u4E3A\u4E94\u9879\u4E4B\u548C"),
2689
+ h("span", null, "\u5355\u4F4D\uFF1A\u5143 \xB7 " + basisLabel)
2690
+ )
2691
+ ));
2692
+ sections.push(P.trendCard({
1735
2693
  h,
1736
- prefix: p,
2694
+ CH: ch,
1737
2695
  lang: props.lang,
1738
- month,
1739
- min: props.min,
1740
- max: props.max,
1741
- onMove: function(m) {
1742
- setMonth(m);
2696
+ title: "\u540C\u6BD4\u5BF9\u7167",
2697
+ note: year + " \u5E74 vs " + (year - 1) + " \u5E74",
2698
+ series: YOY_SERIES,
2699
+ rows: yoyRows,
2700
+ visible: yoyVisibleState[0],
2701
+ onToggle: toggleIn(yoyVisibleState, YOY_SERIES),
2702
+ hover: yoyHoverState[0],
2703
+ onHover: yoyHoverState[1],
2704
+ fmt: money,
2705
+ label: function(row) {
2706
+ return row.month + " \u6708";
1743
2707
  },
1744
- isSelected: function(d) {
1745
- return start ? d === start : d === from || d === to;
2708
+ tipTitle: function(row) {
2709
+ return row.month + " \u6708 \xB7 " + amountLabel + "\u540C\u6BD4";
1746
2710
  },
1747
- isBetween: function(d) {
1748
- return start ? start < d && d < (to || "") : !!(from && to && d > from && d < to);
2711
+ tipRows: function(row) {
2712
+ return [
2713
+ { key: "now", label: year + " \u5E74", tone: "s1", value: row.now },
2714
+ { key: "prior", label: year - 1 + " \u5E74", tone: "s2", value: row.prior }
2715
+ ];
1749
2716
  },
1750
- onPick: pick
1751
- }),
1752
- h(
1753
- "p",
1754
- { className: p + "-dp-hint", role: "status" },
1755
- start ? en ? "Start " + start + " \xB7 pick the end date" : "\u8D77\u59CB " + start + " \xB7 \u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F" : en ? "Pick start, then end date" : "\u5148\u9009\u5F00\u59CB\u65E5\u671F\uFF0C\u518D\u9009\u7ED3\u675F\u65E5\u671F"
1756
- ),
1757
- start ? h(
2717
+ tipNote: function(row) {
2718
+ return "\u4ECA\u5E74 " + row.count + " \u7B14 \xB7 \u53BB\u5E74 " + row.priorRecords + " \u7B14";
2719
+ },
2720
+ ariaLabel: "\u4ECA\u5E74\u4E0E\u53BB\u5E74\u540C\u6708\u5B9E\u53D1\u5BF9\u7167\u6298\u7EBF\u56FE",
2721
+ emptyText: "\u8FD9\u4E24\u5E74\u90FD\u8FD8\u6CA1\u6709\u5DE5\u8D44\u8BB0\u5F55",
2722
+ allOffHint: "\u4E24\u6761\u7EBF\u90FD\u5173\u6389\u4E86\uFF0C\u70B9\u4E0A\u65B9\u5E74\u4EFD\u6807\u7B7E\u6062\u590D\u663E\u793A",
2723
+ footLeft: "\u53BB\u5E74\u540C\u6708\u6309\u540C\u53E3\u5F84\u6C47\u603B \xB7 \u53EA\u753B\u4E24\u5E74\u91CC\u81F3\u5C11\u6709\u4E00\u7B14\u7684\u6708\u4EFD",
2724
+ footRight: "\u5355\u4F4D\uFF1A\u5143 \xB7 " + amountLabel,
2725
+ height: 200
2726
+ }));
2727
+ sections.push(h(
1758
2728
  "div",
1759
- { className: p + "-dp-acts" },
1760
- h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1761
- apply({ from: start, to: "" });
1762
- } }, en ? "Only start" : "\u4EC5\u8D77\u59CB\u65E5\u671F"),
1763
- h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1764
- apply({ from: "", to: start });
1765
- } }, en ? "Only end" : "\u4EC5\u622A\u6B62\u65E5\u671F")
1766
- ) : null,
1767
- h(
2729
+ { key: "dist", className: "wbsal-card wbsal-section" },
2730
+ h(
2731
+ "div",
2732
+ { className: "wbsal-section-head" },
2733
+ h("h3", null, "\u5355\u7B14\u5B9E\u53D1\u5206\u5E03"),
2734
+ h("span", { className: "wbsal-section-note" }, "\u5171 " + data.records + " \u7B14")
2735
+ ),
2736
+ h(ch.Histogram, {
2737
+ data: (data.distribution || []).map(function(item) {
2738
+ return { key: item.key, label: item.label, count: item.count || 0 };
2739
+ }),
2740
+ lang: props.lang,
2741
+ aria: "\u5355\u7B14\u5B9E\u53D1\u91D1\u989D\u5206\u5E03\u76F4\u65B9\u56FE"
2742
+ }),
2743
+ h(
2744
+ "div",
2745
+ { className: "wbsal-chart-foot" },
2746
+ h("span", null, "\u6309\u5355\u7B14\u5B9E\u53D1\u91D1\u989D\u5206\u4E94\u6863\uFF0C\u6863\u4F4D\u56FA\u5B9A\u4FBF\u4E8E\u8DE8\u5E74\u5BF9\u6BD4"),
2747
+ h("span", null, "\u8BA1\u6570\u5355\u4F4D\uFF1A\u7B14")
2748
+ )
2749
+ ));
2750
+ if (latest && latestBreakdown) {
2751
+ sections.push(h(
2752
+ "div",
2753
+ { key: "comp", className: "wbsal-card wbsal-section" },
2754
+ h(
2755
+ "div",
2756
+ { className: "wbsal-section-head" },
2757
+ h("h3", null, F.monthLabel(latest.period) + " \u6536\u5165\u4E0E\u6263\u6B3E\u6784\u6210"),
2758
+ h("span", { className: "wbsal-section-note" }, "\u5171 " + latest.records + " \u7B14")
2759
+ ),
2760
+ h(
2761
+ "div",
2762
+ { className: "wbsal-comp-grid" },
2763
+ h(
2764
+ "div",
2765
+ null,
2766
+ h("div", { className: "wbsal-group-title" }, "\u6536\u5165\u9879 \xB7 \u5408\u8BA1 " + money(latestBreakdown.income)),
2767
+ P.compRows(h, F, latestBreakdown.fields, F.INCOME_KEYS, latestBreakdown.income, false)
2768
+ ),
2769
+ h(
2770
+ "div",
2771
+ null,
2772
+ h("div", { className: "wbsal-group-title" }, "\u6263\u6B3E\u9879 \xB7 \u5408\u8BA1 " + money(deductionTotal)),
2773
+ P.compRows(h, F, latestBreakdown.fields, F.PRETAX_KEYS.concat(F.SOCIAL_KEYS, F.TAX_KEYS), deductionTotal, true)
2774
+ )
2775
+ )
2776
+ ));
2777
+ }
2778
+ } else {
2779
+ sections.push(h(
1768
2780
  "div",
1769
- { className: p + "-dp-foot" },
1770
- h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1771
- setOpen(false);
1772
- setStart("");
1773
- } }, en ? "Cancel" : "\u53D6\u6D88")
1774
- )
1775
- ) : null
1776
- );
1777
- }
1778
- function MonthPicker(props) {
1779
- var c = ctx(props), R = c.R, h = c.h;
1780
- var p = props.prefix, en = props.lang === "en";
1781
- var value = /^\d{4}-\d{2}$/.test(props.value || "") ? props.value : "";
1782
- var base = value || monthKey(props.max || todayISO());
1783
- var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
1784
- var yearS = R.useState(Number(base.slice(0, 4))), year = yearS[0], setYear = yearS[1];
1785
- var root = R.useRef(null);
1786
- usePopover(R, open, setOpen, root);
1787
- function pick(month) {
1788
- if (props.onChange) props.onChange(month);
1789
- setOpen(false);
1790
- }
1791
- var months = [];
1792
- for (var m = 1; m <= 12; m++) {
1793
- var key = year + "-" + pad(m);
1794
- months.push(h("button", {
1795
- key,
1796
- type: "button",
1797
- "data-month": key,
1798
- "aria-pressed": key === value,
1799
- className: p + "-dp-day" + (key === value ? " is-on" : "") + (key === monthKey(todayISO()) ? " is-today" : ""),
1800
- onClick: pick.bind(null, key)
1801
- }, en ? MONTH_EN[m - 1] : m + "\u6708"));
2781
+ { key: "empty", className: "wbsal-card wbsal-empty" },
2782
+ h("strong", null, year + " \u5E74\u8FD8\u6CA1\u6709\u5DE5\u8D44\u8BB0\u5F55"),
2783
+ h("span", null, "\u4E0A\u9762\u4E24\u5F20\u8DE8\u5E74\u5EA6\u8D8B\u52BF\u4ECD\u6309\u5168\u90E8\u5386\u53F2\u6570\u636E\u5C55\u793A\uFF1B\u6362\u4E00\u4E2A\u5E74\u4EFD\u6216\u5148\u8BB0\u4E00\u7B14\u5DE5\u8D44\u3002")
2784
+ ));
2785
+ }
2786
+ body = h("div", { className: "wbsal-stack" }, sections);
1802
2787
  }
1803
2788
  return h(
1804
2789
  "div",
1805
- { className: p + "-dp" + (props.className ? " " + props.className : ""), ref: root },
2790
+ { className: "wbsal-page" },
1806
2791
  h(
1807
2792
  "div",
1808
- { className: p + "-dp-field" },
1809
- h(
1810
- "button",
1811
- {
1812
- type: "button",
1813
- className: p + "-dp-trigger",
1814
- "aria-haspopup": "dialog",
1815
- "aria-expanded": open,
1816
- "aria-label": (props.label || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD")) + ": " + (value ? monthLabel(value, en) : ""),
1817
- onClick: function() {
1818
- setYear(Number((value || base).slice(0, 4)));
1819
- setOpen(!open);
1820
- }
1821
- },
1822
- h("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
1823
- h("span", { className: p + "-dp-value" + (value ? "" : " is-empty") }, value ? monthLabel(value, en) : props.placeholder || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD"))
1824
- ),
1825
- value && props.clearable !== false ? h("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear month" : "\u6E05\u9664\u6708\u4EFD", onClick: function() {
1826
- if (props.onChange) props.onChange("");
1827
- } }, "\xD7") : null
1828
- ),
1829
- open ? h(
1830
- "div",
1831
- { className: p + "-dp-pop is-months", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD") },
1832
- h(
1833
- "div",
1834
- { className: p + "-dp-head" },
1835
- h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Previous year" : "\u4E0A\u4E00\u5E74", onClick: function() {
1836
- setYear(year - 1);
1837
- } }, "\u2039"),
1838
- h("strong", { className: p + "-dp-title", "aria-live": "polite" }, en ? String(year) : year + "\u5E74"),
1839
- h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Next year" : "\u4E0B\u4E00\u5E74", onClick: function() {
1840
- setYear(year + 1);
1841
- } }, "\u203A")
1842
- ),
1843
- h("div", { className: p + "-dp-months" }, months),
2793
+ { className: "wbsal-toolbar wbsal-toolbar-plain" },
1844
2794
  h(
1845
2795
  "div",
1846
- { className: p + "-dp-foot" },
1847
- h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1848
- pick(monthKey(todayISO()));
1849
- } }, en ? "This month" : "\u672C\u6708"),
1850
- h("button", { type: "button", className: p + "-dp-link", onClick: function() {
1851
- setOpen(false);
1852
- } }, en ? "Cancel" : "\u53D6\u6D88")
2796
+ { className: "wbsal-toolbar-end" },
2797
+ h(
2798
+ "div",
2799
+ { className: "wbsal-metric", role: "group", "aria-label": "\u5DE5\u8D44\u5F52\u6708\u53E3\u5F84" },
2800
+ [["arrival", "\u6309\u5230\u8D26\u6708"], ["income", "\u6309\u6240\u5C5E\u6708"]].map(function(option) {
2801
+ return h("button", {
2802
+ key: option[0],
2803
+ type: "button",
2804
+ "aria-pressed": basis === option[0],
2805
+ className: basis === option[0] ? "on" : "",
2806
+ onClick: function() {
2807
+ setBasis(option[0]);
2808
+ hoverState[1](null);
2809
+ socialHoverState[1](null);
2810
+ }
2811
+ }, option[1]);
2812
+ })
2813
+ ),
2814
+ P.segGroup(h, [["net", "\u5B9E\u53D1"], ["gross", "\u5E94\u53D1"]], amount, setAmount, "\u8D8B\u52BF\u91D1\u989D\u53E3\u5F84"),
2815
+ h(
2816
+ "div",
2817
+ { className: "wbsal-seg" },
2818
+ h(C.Btn, { h, kind: "ghost", onClick: function() {
2819
+ setYear(Math.max(2e3, year - 1));
2820
+ } }, "\u2039"),
2821
+ h("span", { className: "wbsal-seg-year" }, year + " \u5E74"),
2822
+ h(C.Btn, { h, kind: "ghost", onClick: function() {
2823
+ setYear(Math.min(2100, year + 1));
2824
+ } }, "\u203A")
2825
+ )
1853
2826
  )
1854
- ) : null
2827
+ ),
2828
+ basis === "income" && data && data.year === year && data.basis === basis && data.unassignedRecords > 0 ? h(C.Notice, { h, text: "\u5168\u90E8\u5E74\u4EFD\u5171 " + data.unassignedRecords + " \u7B14\u5DE5\u8D44\u672A\u586B\u5199\u6240\u5C5E\u671F\uFF0C\u672A\u8BA1\u5165\u6240\u5C5E\u6708\u7EDF\u8BA1\u3002" }) : null,
2829
+ data && (data.year !== year || data.basis !== basis) ? null : body,
2830
+ load.error ? h(C.Notice, { h, kind: "error", text: load.error }) : null
1855
2831
  );
1856
- }
1857
- function InlineCalendar(props) {
1858
- var c = ctx(props), R = c.R, h = c.h;
1859
- var p = props.prefix;
1860
- var value = validDate(props.value) ? props.value : "";
1861
- var monthS = R.useState(monthKey(props.month || value || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
1862
- return h(
1863
- "div",
1864
- { className: p + "-dp is-inline" },
1865
- h(Calendar, {
1866
- h,
1867
- prefix: p,
1868
- lang: props.lang,
1869
- month,
1870
- min: props.min,
1871
- max: props.max,
1872
- onMove: function(m) {
1873
- setMonth(m);
1874
- if (props.onMonthChange) props.onMonthChange(m);
1875
- },
1876
- isSelected: function(d) {
1877
- return d === value;
1878
- },
1879
- isBetween: props.isBetween,
1880
- onPick: function(d) {
1881
- if (props.onChange) props.onChange(d);
2832
+ };
2833
+ }
2834
+ });
2835
+
2836
+ // packages/addons/lib/overlay.cjs
2837
+ var require_overlay = __commonJS({
2838
+ "packages/addons/lib/overlay.cjs"(exports2, module2) {
2839
+ "use strict";
2840
+ var defaultReact = require("react");
2841
+ var FOCUSABLE = "button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href]";
2842
+ module2.exports = function createOverlay(options) {
2843
+ var opts = options || {};
2844
+ var React = opts.React || defaultReact;
2845
+ var h = React.createElement;
2846
+ var tag = opts.tag || "section";
2847
+ var maskClass = opts.maskClass;
2848
+ var dialogClass = opts.dialogClass;
2849
+ var dialogClassOf = opts.dialogClassOf || function() {
2850
+ return "";
2851
+ };
2852
+ var ariaLabelOf = opts.ariaLabelOf || function(props) {
2853
+ return props["aria-label"] || props.title;
2854
+ };
2855
+ var ariaLabelledByOf = opts.ariaLabelledByOf || function() {
2856
+ return null;
2857
+ };
2858
+ var header = opts.header || null;
2859
+ var closeOnEscape = opts.closeOnEscape || function() {
2860
+ return true;
2861
+ };
2862
+ var closeOnMask = opts.closeOnMask || function() {
2863
+ return true;
2864
+ };
2865
+ var extraKeyDown = opts.onKeyDown || null;
2866
+ var autoFocusDialog = opts.autoFocusDialog !== false;
2867
+ var focusableSelector = opts.focusableSelector || FOCUSABLE;
2868
+ function Modal(props) {
2869
+ var ref = React.useRef(null);
2870
+ React.useEffect(function() {
2871
+ var previous = typeof document !== "undefined" ? document.activeElement : null;
2872
+ var focusIt = props.autoFocus !== void 0 ? props.autoFocus : autoFocusDialog;
2873
+ if (focusIt && ref.current) ref.current.focus();
2874
+ return function() {
2875
+ if (previous && previous.isConnected) previous.focus();
2876
+ };
2877
+ }, []);
2878
+ function onKeyDown(e) {
2879
+ if (extraKeyDown && extraKeyDown(e, props, ref)) return;
2880
+ if (e.key === "Escape") {
2881
+ if (!(props.closeOnEscape !== void 0 ? props.closeOnEscape : closeOnEscape(props))) return;
2882
+ e.preventDefault();
2883
+ e.stopPropagation();
2884
+ if (props.onClose) props.onClose();
2885
+ return;
1882
2886
  }
1883
- }),
1884
- props.footer ? h("div", { className: p + "-dp-foot" }, props.footer) : null
1885
- );
1886
- }
1887
- module2.exports = {
1888
- DatePicker,
1889
- RangePicker,
1890
- MonthPicker,
1891
- InlineCalendar,
1892
- todayISO,
1893
- validDate,
1894
- shiftDate,
1895
- shiftMonth,
1896
- normalizeRange,
1897
- monthLabel,
1898
- daysInMonth
2887
+ if (e.key !== "Tab" || !ref.current) return;
2888
+ var els = ref.current.querySelectorAll(focusableSelector);
2889
+ if (!els.length) {
2890
+ e.preventDefault();
2891
+ return;
2892
+ }
2893
+ var first = els[0];
2894
+ var last = els[els.length - 1];
2895
+ if (e.shiftKey && (document.activeElement === first || document.activeElement === ref.current)) {
2896
+ e.preventDefault();
2897
+ last.focus();
2898
+ }
2899
+ if (!e.shiftKey && document.activeElement === last) {
2900
+ e.preventDefault();
2901
+ first.focus();
2902
+ }
2903
+ }
2904
+ var labelledBy = ariaLabelledByOf(props);
2905
+ return h(
2906
+ "div",
2907
+ {
2908
+ className: maskClass,
2909
+ onMouseDown: function(e) {
2910
+ var allowed = props.closeOnMask !== void 0 ? props.closeOnMask : closeOnMask(props);
2911
+ if (e.target === e.currentTarget && props.onClose && allowed) props.onClose();
2912
+ }
2913
+ },
2914
+ h(
2915
+ tag,
2916
+ {
2917
+ className: dialogClass + dialogClassOf(props),
2918
+ role: "dialog",
2919
+ "aria-modal": true,
2920
+ "aria-label": labelledBy ? null : ariaLabelOf(props),
2921
+ "aria-labelledby": labelledBy || null,
2922
+ ref,
2923
+ tabIndex: -1,
2924
+ onKeyDown
2925
+ },
2926
+ header ? header(props) : null,
2927
+ props.children
2928
+ )
2929
+ );
2930
+ }
2931
+ return Modal;
1899
2932
  };
1900
2933
  }
1901
2934
  });
@@ -1904,19 +2937,25 @@ var require_date_picker = __commonJS({
1904
2937
  var require_records = __commonJS({
1905
2938
  "packages/addons/salary/client/views/records.cjs"(exports2, module2) {
1906
2939
  "use strict";
2940
+ var createOverlay = require_overlay();
2941
+ var FormOverlay = createOverlay({
2942
+ maskClass: "wbsal-mask",
2943
+ dialogClass: "wbsal-modal"
2944
+ });
1907
2945
  module2.exports = function Records(props) {
1908
2946
  var h = props.h, React = props.React, api = props.api, lang = props.lang;
1909
2947
  var C = require_common();
1910
2948
  var DP = require_date_picker();
1911
2949
  var F = require_fields();
1912
2950
  var status = C.useLoad(React, api, "salary.status", {}, []);
1913
- var filterState = React.useState({ year: String((/* @__PURE__ */ new Date()).getFullYear()), cycle: "" });
2951
+ var filterState = React.useState({ year: String((/* @__PURE__ */ new Date()).getFullYear()), cycle: "", employmentType: "" });
1914
2952
  var filter = filterState[0], setFilter = filterState[1];
1915
2953
  var list = C.useLoad(React, api, "salary.recordList", {
1916
2954
  year: filter.year ? Number(filter.year) : void 0,
1917
2955
  cycle: filter.cycle || void 0,
2956
+ employmentType: filter.employmentType || void 0,
1918
2957
  limit: 400
1919
- }, [filter.year, filter.cycle]);
2958
+ }, [filter.year, filter.cycle, filter.employmentType]);
1920
2959
  var openState = React.useState(props.initialOpenId || "");
1921
2960
  var openId = openState[0], setOpenId = openState[1];
1922
2961
  var confirmState = React.useState("");
@@ -1956,7 +2995,7 @@ var require_records = __commonJS({
1956
2995
  setOpenId("");
1957
2996
  setMsg(null);
1958
2997
  var payDate = pickDate("monthly");
1959
- setForm({ mode: "create", id: "", payDate, incomePeriod: defaultPeriod(payDate, "monthly"), cycle: "monthly", note: F.defaultNote(payDate, "monthly"), values: F.blankValues(), lockGross: false });
2998
+ setForm({ mode: "create", id: "", payDate, incomePeriod: defaultPeriod(payDate, "monthly"), cycle: "monthly", employmentType: "", note: F.defaultNote(payDate, "monthly"), values: F.blankValues(), lockGross: false });
1960
2999
  }
1961
3000
  function openEdit(item) {
1962
3001
  var values = F.blankValues();
@@ -1969,7 +3008,7 @@ var require_records = __commonJS({
1969
3008
  setConfirmId("");
1970
3009
  setOpenId("");
1971
3010
  setMsg(null);
1972
- setForm({ mode: "edit", id: item.id, payDate: item.payDate, incomePeriod: item.incomePeriod || "", cycle: item.cycle || "monthly", note: item.note || "", values, original: item, lockGross: incomeZero && F.num(item.grossPay) > 0 });
3011
+ setForm({ mode: "edit", id: item.id, payDate: item.payDate, incomePeriod: item.incomePeriod || "", cycle: item.cycle || "monthly", employmentType: item.employmentType || "", note: item.note || "", values, original: item, lockGross: incomeZero && F.num(item.grossPay) > 0 });
1973
3012
  }
1974
3013
  function defaultPeriod(payDate, cycle) {
1975
3014
  return cycle === "daily" ? payDate : payDate === "" || payDate.startsWith("2000-01-") ? "" : F.incomePeriod(payDate);
@@ -2017,6 +3056,7 @@ var require_records = __commonJS({
2017
3056
  payDate: form.payDate,
2018
3057
  cycle: form.cycle,
2019
3058
  incomePeriod: form.incomePeriod || "",
3059
+ employmentType: form.employmentType || "",
2020
3060
  note: form.note || ""
2021
3061
  };
2022
3062
  var moneyChanged = !form.original || F.KEYS.some(function(key) {
@@ -2114,7 +3154,7 @@ var require_records = __commonJS({
2114
3154
  ),
2115
3155
  h(
2116
3156
  C.Field,
2117
- { h, label: "\u7C7B\u578B" },
3157
+ { h, label: "\u7ED3\u7B97\u65B9\u5F0F" },
2118
3158
  h(
2119
3159
  "select",
2120
3160
  { className: "wbsal-input", value: form.cycle, onChange: function(e) {
@@ -2124,6 +3164,19 @@ var require_records = __commonJS({
2124
3164
  h("option", { value: "daily" }, "\u65E5\u7ED3")
2125
3165
  )
2126
3166
  ),
3167
+ h(
3168
+ C.Field,
3169
+ { h, label: "\u7528\u5DE5\u7C7B\u578B" },
3170
+ h(
3171
+ "select",
3172
+ { className: "wbsal-input", value: form.employmentType, onChange: function(e) {
3173
+ setField("employmentType", e.target.value);
3174
+ } },
3175
+ F.EMPLOYMENT_TYPES.map(function(t) {
3176
+ return h("option", { key: t.value || "none", value: t.value }, t.label);
3177
+ })
3178
+ )
3179
+ ),
2127
3180
  h(
2128
3181
  C.Field,
2129
3182
  { h, label: "\u5DE5\u8D44\u6240\u5C5E\u671F" },
@@ -2202,17 +3255,8 @@ var require_records = __commonJS({
2202
3255
  );
2203
3256
  }
2204
3257
  function renderModal() {
2205
- return h("div", {
2206
- className: "wbsal-mask",
2207
- onClick: function(event) {
2208
- if (event.target === event.currentTarget) closeForm();
2209
- }
2210
- }, h("div", {
2211
- className: "wbsal-modal",
2212
- role: "dialog",
2213
- "aria-modal": "true",
2214
- "aria-label": form.mode === "edit" ? "\u7F16\u8F91\u5DE5\u8D44" : "\u8BB0\u4E00\u7B14\u5DE5\u8D44"
2215
- }, renderForm()));
3258
+ var label = form.mode === "edit" ? "\u7F16\u8F91\u5DE5\u8D44" : "\u8BB0\u4E00\u7B14\u5DE5\u8D44";
3259
+ return h(FormOverlay, { "aria-label": label, onClose: closeForm }, renderForm());
2216
3260
  }
2217
3261
  function renderDetail(item) {
2218
3262
  var blocks = F.GROUPS.map(function(group) {
@@ -2248,7 +3292,7 @@ var require_records = __commonJS({
2248
3292
  h(
2249
3293
  "div",
2250
3294
  { className: "wbsal-muted" },
2251
- "\u5DE5\u8D44\u6240\u5C5E\u671F\uFF1A" + (item.incomePeriod ? F.monthLabel(item.incomePeriod) : "\u672A\u5F52\u5C5E") + " \xB7 " + (item.note ? "\u5907\u6CE8\uFF1A" + item.note + " \xB7 " : "") + "\u66F4\u65B0\u4E8E " + C.fmtTime(item.updatedAt, lang)
3295
+ "\u7528\u5DE5\u7C7B\u578B\uFF1A" + F.employmentLabel(item.employmentType) + " \xB7 \u7ED3\u7B97\u65B9\u5F0F\uFF1A" + (item.cycle === "daily" ? "\u65E5\u7ED3" : "\u6708\u7ED3") + " \xB7 \u5DE5\u8D44\u6240\u5C5E\u671F\uFF1A" + (item.incomePeriod ? F.monthLabel(item.incomePeriod) : "\u672A\u5F52\u5C5E") + " \xB7 " + (item.note ? "\u5907\u6CE8\uFF1A" + item.note + " \xB7 " : "") + "\u66F4\u65B0\u4E8E " + C.fmtTime(item.updatedAt, lang)
2252
3296
  ),
2253
3297
  h(
2254
3298
  "div",
@@ -2293,13 +3337,14 @@ var require_records = __commonJS({
2293
3337
  h(C.Pill, { h, kind: item.cycle === "daily" ? "warn" : "ok" }, item.cycle === "daily" ? "\u65E5\u7ED3" : "\u6708\u7ED3"),
2294
3338
  h("div", { className: "wbsal-muted" }, item.incomePeriod ? F.monthLabel(item.incomePeriod) : "\u672A\u5F52\u5C5E")
2295
3339
  ),
3340
+ h("td", { className: "left" }, h(C.Pill, { h, kind: item.employmentType === "regular" ? "ok" : item.employmentType === "probation" ? "warn" : "" }, F.employmentLabel(item.employmentType))),
2296
3341
  h("td", null, h("span", { className: "wbsal-net" }, F.money(item.netPay))),
2297
3342
  h("td", { className: "wbsal-opt" }, F.money(item.grossPay)),
2298
3343
  h("td", { className: "wbsal-opt hide-md" }, F.money(F.sumValues(item, F.SOCIAL_KEYS))),
2299
3344
  h("td", { className: "wbsal-opt hide-md" }, F.money(item.incomeTax)),
2300
3345
  h("td", null, h("span", { className: "wbsal-caret" }, "\u203A"))
2301
3346
  ),
2302
- expanded ? h("tr", { key: item.id + "-detail" }, h("td", { className: "wbsal-detail-cell", colSpan: 7 }, renderDetail(item))) : null
3347
+ expanded ? h("tr", { key: item.id + "-detail" }, h("td", { className: "wbsal-detail-cell", colSpan: 8 }, renderDetail(item))) : null
2303
3348
  ];
2304
3349
  return rows;
2305
3350
  }
@@ -2310,12 +3355,12 @@ var require_records = __commonJS({
2310
3355
  body = h(
2311
3356
  "div",
2312
3357
  { className: "wbsal-empty" },
2313
- h("div", null, filter.year || filter.cycle ? "\u8FD9\u4E2A\u7B5B\u9009\u6761\u4EF6\u4E0B\u6CA1\u6709\u8BB0\u5F55" : "\u8FD8\u6CA1\u6709\u5DE5\u8D44\u8BB0\u5F55\uFF0C\u5148\u8BB0\u4E00\u7B14"),
3358
+ h("div", null, filter.year || filter.cycle || filter.employmentType ? "\u8FD9\u4E2A\u7B5B\u9009\u6761\u4EF6\u4E0B\u6CA1\u6709\u8BB0\u5F55" : "\u8FD8\u6CA1\u6709\u5DE5\u8D44\u8BB0\u5F55\uFF0C\u5148\u8BB0\u4E00\u7B14"),
2314
3359
  h(
2315
3360
  "div",
2316
3361
  { className: "wbsal-empty-actions" },
2317
- filter.year || filter.cycle ? h(C.Btn, { h, onClick: function() {
2318
- setFilter({ year: "", cycle: "" });
3362
+ filter.year || filter.cycle || filter.employmentType ? h(C.Btn, { h, onClick: function() {
3363
+ setFilter({ year: "", cycle: "", employmentType: "" });
2319
3364
  } }, "\u6E05\u9664\u7B5B\u9009") : null,
2320
3365
  h(C.Btn, { h, kind: "primary", onClick: openCreate }, "\uFF0B \u8BB0\u4E00\u7B14")
2321
3366
  )
@@ -2350,7 +3395,8 @@ var require_records = __commonJS({
2350
3395
  "tr",
2351
3396
  null,
2352
3397
  h("th", { className: "left" }, "\u53D1\u85AA\u65E5"),
2353
- h("th", { className: "left" }, "\u7C7B\u578B"),
3398
+ h("th", { className: "left" }, "\u7ED3\u7B97"),
3399
+ h("th", { className: "left" }, "\u7528\u5DE5\u7C7B\u578B"),
2354
3400
  h("th", null, "\u5B9E\u53D1"),
2355
3401
  h("th", null, "\u5E94\u53D1"),
2356
3402
  h("th", { className: "hide-md" }, "\u793E\u4FDD\u516C\u79EF\u91D1"),
@@ -2378,7 +3424,7 @@ var require_records = __commonJS({
2378
3424
  return h("option", { key: value || "all", value }, value ? value + " \u5E74" : "\u5168\u90E8\u5E74\u4EFD");
2379
3425
  })
2380
3426
  )),
2381
- h(C.Field, { h, label: "\u7C7B\u578B" }, h(
3427
+ h(C.Field, { h, label: "\u7ED3\u7B97\u65B9\u5F0F" }, h(
2382
3428
  "select",
2383
3429
  { className: "wbsal-input", value: filter.cycle, onChange: function(e) {
2384
3430
  setFilter(Object.assign({}, filter, { cycle: e.target.value }));
@@ -2387,6 +3433,16 @@ var require_records = __commonJS({
2387
3433
  h("option", { value: "monthly" }, "\u6708\u7ED3"),
2388
3434
  h("option", { value: "daily" }, "\u65E5\u7ED3")
2389
3435
  )),
3436
+ h(C.Field, { h, label: "\u7528\u5DE5\u7C7B\u578B" }, h(
3437
+ "select",
3438
+ { className: "wbsal-input", value: filter.employmentType, onChange: function(e) {
3439
+ setFilter(Object.assign({}, filter, { employmentType: e.target.value }));
3440
+ } },
3441
+ h("option", { value: "" }, "\u5168\u90E8"),
3442
+ F.EMPLOYMENT_TYPES.slice(1).map(function(t) {
3443
+ return h("option", { key: t.value, value: t.value }, t.label);
3444
+ })
3445
+ )),
2390
3446
  h(
2391
3447
  "div",
2392
3448
  { className: "wbsal-toolbar-end" },
@@ -4258,6 +5314,7 @@ var require_actions = __commonJS({
4258
5314
  });
4259
5315
 
4260
5316
  // packages/addons/salary/client/client.src.cjs
5317
+ var GLYPHS = require_icons2().ICONS;
4261
5318
  (function() {
4262
5319
  var root = typeof window !== "undefined" ? window : null;
4263
5320
  var host = root && root.__WB_HOST__;
@@ -4271,10 +5328,10 @@ var require_actions = __commonJS({
4271
5328
  var h = host.h;
4272
5329
  var CSS = require_styles();
4273
5330
  var ICONS = {
4274
- records: (init_wallet(), __toCommonJS(wallet_exports)).default,
4275
- stats: (init_chart_column(), __toCommonJS(chart_column_exports)).default,
4276
- data: (init_database(), __toCommonJS(database_exports)).default,
4277
- actions: (init_list(), __toCommonJS(list_exports)).default
5331
+ records: GLYPHS["wallet"],
5332
+ stats: GLYPHS["chart-column"],
5333
+ data: GLYPHS["database"],
5334
+ actions: GLYPHS["list"]
4278
5335
  };
4279
5336
  function Icon2(props) {
4280
5337
  var C = ICONS[props.name] || ICONS.records;
@@ -4301,8 +5358,8 @@ var require_actions = __commonJS({
4301
5358
  ensureStyles();
4302
5359
  host.registerAddon({
4303
5360
  id: "wb-addon-salary",
4304
- version: "0.3.0",
4305
- icon: (init_wallet(), __toCommonJS(wallet_exports)).default,
5361
+ version: "0.4.1",
5362
+ icon: GLYPHS["wallet"],
4306
5363
  views: [
4307
5364
  { id: "stats", icon: tabIcon("stats"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: withProps(require_stats(), "\u7EDF\u8BA1") },
4308
5365
  { id: "records", icon: tabIcon("records"), title: { zh: "\u8BB0\u5F55", en: "Records" }, component: withProps(require_records(), "\u8BB0\u5F55") },