djm-ui 0.67.2 → 0.67.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/djm-ui.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! DJM UI v0.67.2 · MIT · 2026-10-26 */
1
+ /*! DJM UI v0.67.4 · MIT · 2026-10-26 */
2
2
 
3
3
  /* ---- tokens.css ---- */
4
4
 
@@ -1,4 +1,4 @@
1
- /*! DJM UI v0.67.2 · MIT · 2026-10-26 */
1
+ /*! DJM UI v0.67.4 · MIT · 2026-10-26 */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __esm = (fn, res, err) => function __init() {
@@ -1085,6 +1085,13 @@ var input_default = {
1085
1085
  this.$emit("update:modelValue", event.target.value);
1086
1086
  this.$emit("input", event);
1087
1087
  },
1088
+ // 浏览器自动填充与前进后退的表单恢复只改 DOM 值、不触发 input,
1089
+ // 模型为空时清掉,否则会看到有值但实际没按它筛选;登录类字段保留自动填充
1090
+ clearStaleValue() {
1091
+ const input = this.$refs.input;
1092
+ if (!input || this.autocomplete !== "off") return;
1093
+ if (String(this.modelValue ?? "").length === 0 && input.value) input.value = "";
1094
+ },
1088
1095
  clear() {
1089
1096
  this.$emit("update:modelValue", "");
1090
1097
  this.$emit("clear");
@@ -1092,12 +1099,31 @@ var input_default = {
1092
1099
  this.focus();
1093
1100
  },
1094
1101
  focus() {
1102
+ this.clearStaleValue();
1095
1103
  if (this.$refs.input) this.$refs.input.focus();
1096
1104
  },
1105
+ onFocus(event) {
1106
+ this.clearStaleValue();
1107
+ this.$emit("focus", event);
1108
+ },
1097
1109
  blur() {
1098
1110
  if (this.$refs.input) this.$refs.input.blur();
1099
1111
  }
1100
1112
  },
1113
+ mounted() {
1114
+ this.staleTimers = [null, 200, 600, 1200, 2400].map((delay) => {
1115
+ if (delay === null) {
1116
+ this.clearStaleValue();
1117
+ return null;
1118
+ }
1119
+ return setTimeout(() => this.clearStaleValue(), delay);
1120
+ });
1121
+ window.addEventListener("pageshow", this.clearStaleValue);
1122
+ },
1123
+ beforeUnmount() {
1124
+ this.staleTimers.forEach((timer) => clearTimeout(timer));
1125
+ window.removeEventListener("pageshow", this.clearStaleValue);
1126
+ },
1101
1127
  template: `
1102
1128
  <div v-if="hasAffix" class="djm-input-wrap">
1103
1129
  <input
@@ -1115,7 +1141,7 @@ var input_default = {
1115
1141
  @input="onInput"
1116
1142
  @change="$emit('change', $event)"
1117
1143
  @keyup.enter="$emit('enter', $event)"
1118
- @focus="$emit('focus', $event)"
1144
+ @focus="onFocus"
1119
1145
  @blur="$emit('blur', $event)"
1120
1146
  />
1121
1147
  <button
@@ -1145,7 +1171,7 @@ var input_default = {
1145
1171
  @input="onInput"
1146
1172
  @change="$emit('change', $event)"
1147
1173
  @keyup.enter="$emit('enter', $event)"
1148
- @focus="$emit('focus', $event)"
1174
+ @focus="onFocus"
1149
1175
  @blur="$emit('blur', $event)"
1150
1176
  />
1151
1177
  `
@@ -15227,7 +15253,7 @@ var components = [
15227
15253
  org_chart_default,
15228
15254
  page_tabs_default
15229
15255
  ];
15230
- var version = "0.67.2";
15256
+ var version = "0.67.4";
15231
15257
  function install(app, options = {}) {
15232
15258
  if (options.locale) setLocale(options.locale);
15233
15259
  components.forEach((component) => app.component(component.name, component));