dsh-workbench-salary 0.4.18 → 0.4.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/client.js +85 -8
  2. package/package.json +2 -2
package/lib/client.js CHANGED
@@ -700,11 +700,14 @@ var require_stepper = __commonJS({
700
700
  ".wbctl-step-index{display:inline-flex;align-items:center;justify-content:center;flex:none;width:20px;height:20px;border-radius:50%;font-size:11px;font-variant-numeric:tabular-nums;background:color-mix(in oklab,currentColor 15%,transparent)}",
701
701
  ".wbctl-step[data-state=current] .wbctl-step-index{background:var(--wb-accent,#2563eb);color:var(--wb-on-accent,#fff)}",
702
702
  ".wbctl-step[data-state=done] .wbctl-step-index{background:color-mix(in oklab,var(--wb-ok,var(--wb-accent,#2563eb)) 20%,transparent);color:var(--wb-ok,var(--wb-accent,#2563eb))}",
703
- ".wbctl-step-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
704
- ".wbctl-step-hint{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:400;opacity:.62}",
703
+ // 标题优先可读:label 不收缩、不省略,宽度不够时让 hint 先让位(截断或整体隐藏),
704
+ // 不再出现「关联凭…」这种把步骤标题截掉的结果。
705
+ ".wbctl-step-label{flex:0 0 auto;min-width:0;white-space:nowrap}",
706
+ ".wbctl-step-hint{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:400;opacity:.62}",
705
707
  ".wbctl-step-opt{flex:none;font-size:10px;font-weight:400;opacity:.55}",
706
- "@media (max-width:760px){.wbctl-step{padding:6px 7px;font-size:11.5px}.wbctl-step-hint,.wbctl-step-opt{display:none}.wbctl-step-index{width:18px;height:18px;font-size:10px}}",
707
- "@media (max-width:520px){.wbctl-step-list{gap:4px}.wbctl-step-label{white-space:normal}.wbctl-step{gap:5px}}",
708
+ // 窄屏先藏提示,标题仍占满整行;再窄就把标题折行,宁可变高也不截字。
709
+ "@media (max-width:760px){.wbctl-step-list{flex-wrap:wrap}.wbctl-step{padding:6px 7px;font-size:11.5px}.wbctl-step-hint,.wbctl-step-opt{display:none}.wbctl-step-index{width:18px;height:18px;font-size:10px}}",
710
+ "@media (max-width:520px){.wbctl-step-list{gap:4px}.wbctl-step-label{white-space:normal;overflow-wrap:anywhere}.wbctl-step{gap:5px}}",
708
711
  "@media (prefers-reduced-motion:reduce){.wbctl-step{transition:none}}"
709
712
  ];
710
713
  module2.exports = { Steps, stepState, styles: STYLES };
@@ -832,15 +835,53 @@ var require_staged_dialog = __commonJS({
832
835
  }
833
836
  return null;
834
837
  }
838
+ var ENTER_OWN_SELECTOR = [
839
+ "[data-role=checklist]",
840
+ "[data-role=datepicker]",
841
+ "[role=combobox]",
842
+ "[role=listbox]",
843
+ "[role=menu]",
844
+ "[aria-haspopup]",
845
+ ".wbctl-step"
846
+ ].join(",");
847
+ var INPUT_TYPES_OWN_ENTER = [
848
+ "checkbox",
849
+ "radio",
850
+ "file",
851
+ "range",
852
+ "color",
853
+ "button",
854
+ "submit",
855
+ "reset",
856
+ "search"
857
+ ];
858
+ function isEnterTarget(target) {
859
+ if (!target || typeof target.tagName !== "string") return false;
860
+ if (target.isContentEditable) return false;
861
+ if (target.tagName.toUpperCase() !== "INPUT") return false;
862
+ var type = String(target.type || "text").toLowerCase();
863
+ if (INPUT_TYPES_OWN_ENTER.indexOf(type) >= 0) return false;
864
+ if (target.disabled || target.readOnly) return false;
865
+ if (typeof target.closest === "function" && target.closest(ENTER_OWN_SELECTOR)) return false;
866
+ return true;
867
+ }
868
+ var STEP_FIELD_SELECTOR = [
869
+ "input:not([type=hidden]):not([disabled]):not([readonly])",
870
+ "textarea:not([disabled]):not([readonly])",
871
+ "select:not([disabled])",
872
+ "[contenteditable=true]"
873
+ ].join(",");
835
874
  function createStagedDialog(options) {
836
875
  var opts = options || {};
837
876
  var React = opts.React || defaultReact;
838
877
  var h = React.createElement;
839
878
  var dialogClass = ((opts.dialogClass || "") + " wbctl-dialog").trim();
879
+ var maskClass = ((opts.maskClass || "") + " wbctl-mask").trim();
840
880
  var Overlay = overlayFactory(
841
881
  Object.assign({}, opts, {
842
882
  React,
843
883
  dialogClass,
884
+ maskClass,
844
885
  // 首焦点由外壳送进对话框,字段由 focusStep 负责,避免打开瞬间落进第一个输入框。
845
886
  autoFocusDialog: opts.autoFocusDialog !== false
846
887
  })
@@ -880,10 +921,26 @@ var require_staged_dialog = __commonJS({
880
921
  var el = bodyRef.current;
881
922
  if (el && typeof el.focus === "function") el.focus();
882
923
  }
924
+ function focusFirstField() {
925
+ var el = bodyRef.current;
926
+ if (!el || typeof el.querySelector !== "function") {
927
+ focusBody();
928
+ return;
929
+ }
930
+ var field = el.querySelector(STEP_FIELD_SELECTOR);
931
+ if (field && typeof field.focus === "function") field.focus();
932
+ else focusBody();
933
+ }
934
+ var firstStep = R.useRef(true);
883
935
  R.useEffect(
884
936
  function() {
885
937
  if (!mounted.current) return;
886
- focusBody();
938
+ if (firstStep.current) {
939
+ firstStep.current = false;
940
+ focusBody();
941
+ return;
942
+ }
943
+ focusFirstField();
887
944
  },
888
945
  [index]
889
946
  );
@@ -962,7 +1019,17 @@ var require_staged_dialog = __commonJS({
962
1019
  {
963
1020
  className: "wbctl-dialog-body" + (props.bodyClassName ? " " + props.bodyClassName : ""),
964
1021
  ref: bodyRef,
965
- tabIndex: -1
1022
+ tabIndex: -1,
1023
+ // Enter 在当前步的单个输入框里等于「下一步 / 保存」:连续回车能一路走完表单。
1024
+ onKeyDown: function(e) {
1025
+ if (e.key !== "Enter") return;
1026
+ if (e.isComposing || e.keyCode === 229) return;
1027
+ if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) return;
1028
+ if (busy || !isEnterTarget(e.target)) return;
1029
+ e.preventDefault();
1030
+ if (isLast) submit();
1031
+ else next();
1032
+ }
966
1033
  },
967
1034
  current ? current.render(h, props) : null
968
1035
  ),
@@ -999,6 +1066,12 @@ var require_staged_dialog = __commonJS({
999
1066
  return StagedDialog;
1000
1067
  }
1001
1068
  var STYLES = [
1069
+ // 遮罩:比各插件原来的 45% 更深,并模糊背后内容——自定义主题把底色写成半透明时,
1070
+ // 背后的表格文字也不会透出来(用双类名压过插件自己的 .xxx-modal 单类规则,不依赖拼接顺序)。
1071
+ ".wbctl-mask.wbctl-mask{background:color-mix(in oklab,var(--wb-muted,var(--wb-border,currentColor)) 58%,transparent);backdrop-filter:blur(4px)}",
1072
+ // 弹窗底板:先铺主题的页面底色(一般是实色),再把可能带透明的卡片色叠上去,
1073
+ // 最后模糊背后内容;任何主题下弹窗本体都可读,不再依赖各插件自己写背景。
1074
+ ".wbctl-dialog.wbctl-dialog{background-color:var(--dsw-alias-bg-layer-1,var(--dsw-alias-bg-layer-2,var(--wb-card,transparent)));background-image:linear-gradient(var(--wb-card,transparent),var(--wb-card,transparent));backdrop-filter:blur(12px) saturate(1.04)}",
1002
1075
  // 宽表单:内容多时给足横向空间,窄屏留 16px 边距后铺满。
1003
1076
  ".wbctl-dialog{width:min(880px,calc(100vw - 32px));max-height:min(92vh,760px);display:flex;flex-direction:column;overflow:hidden}",
1004
1077
  ".wbctl-dialog-body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;padding:2px 2px 10px;outline:none}",
@@ -1024,6 +1097,9 @@ var require_staged_dialog = __commonJS({
1024
1097
  createStagedDialog,
1025
1098
  validateStep,
1026
1099
  firstFailing,
1100
+ isEnterTarget,
1101
+ enterOwnSelector: ENTER_OWN_SELECTOR,
1102
+ stepFieldSelector: STEP_FIELD_SELECTOR,
1027
1103
  styles: STYLES
1028
1104
  };
1029
1105
  }
@@ -1591,10 +1667,11 @@ var require_client_common = __commonJS({
1591
1667
  var h = props.h;
1592
1668
  return h("button", {
1593
1669
  type: props.type || "button",
1594
- className: p + "-btn" + (props.kind ? " " + props.kind : ""),
1670
+ className: p + "-btn" + (props.kind ? " " + props.kind : "") + (props.className ? " " + props.className : ""),
1595
1671
  disabled: props.disabled,
1596
1672
  onClick: props.onClick,
1597
1673
  title: props.title,
1674
+ "aria-label": props["aria-label"],
1598
1675
  children: props.children
1599
1676
  });
1600
1677
  }
@@ -4237,7 +4314,7 @@ var GLYPHS = require_icons2().ICONS;
4237
4314
  ensureStyles();
4238
4315
  host.registerAddon({
4239
4316
  id: "wb-addon-salary",
4240
- version: "0.4.18",
4317
+ version: "0.4.19",
4241
4318
  icon: GLYPHS["wallet"],
4242
4319
  views: [
4243
4320
  { id: "stats", icon: tabIcon("stats"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: withProps(require_stats(), "\u7EDF\u8BA1") },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-workbench-salary",
3
- "version": "0.4.18",
3
+ "version": "0.4.19",
4
4
  "description": "个人工作台工资插件:按发薪日期记录工资构成、扣款与实发",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -16,7 +16,7 @@
16
16
  "addon": {
17
17
  "id": "wb-addon-salary",
18
18
  "title": "工资",
19
- "version": "0.4.18",
19
+ "version": "0.4.19",
20
20
  "minShell": "0.8.0",
21
21
  "tables": [
22
22
  "salary_record"