dfish-widget 1.0.108 → 1.0.110

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/index.esm.js CHANGED
@@ -1739,9 +1739,8 @@ $$1.config = function(opt) {
1739
1739
  }
1740
1740
  };
1741
1741
 
1742
- $$1.pop = (template, props, options = {}) => {
1743
- const commander = $$1(options.target) || $$1.vm();
1744
- return $$1.vm(commander).createPop(commander, template, props, options)
1742
+ $$1.pop = (template, props, target, mode) => {
1743
+ return (target ? $$1(target) : $$1.vm()).pop(template, props, {mode})
1745
1744
  };
1746
1745
 
1747
1746
  $$1.submit = (request, options = {}) => {
@@ -11401,6 +11400,20 @@ var script$c = {
11401
11400
  }
11402
11401
  }
11403
11402
  },
11403
+ isReadonly() {
11404
+ if (this.x.readonly == null) {
11405
+ let p = this.provideRangeParent;
11406
+ if (p && p.x.readonly) return true
11407
+ }
11408
+ return !!this.x.readonly
11409
+ },
11410
+ isDisabled() {
11411
+ if (this.x.disabled == null) {
11412
+ let p = this.provideRangeParent;
11413
+ if (p && p.x.disabled) return true
11414
+ }
11415
+ return !!this.x.disabled
11416
+ },
11404
11417
  input_prop() {
11405
11418
  return {
11406
11419
  'w-valuetype': 'number',
@@ -11602,11 +11615,11 @@ var script$b = {
11602
11615
  ...this.pubValidHooks,
11603
11616
  minValue: (v, r, q) => {
11604
11617
  if (v && $$1.dateParse(v, this.x.format) < $$1.dateParse(r, this.x.format))
11605
- return this.formErr(q)
11618
+ return this.formErr(q, [r])
11606
11619
  },
11607
11620
  maxValue: (v, r, q) => {
11608
11621
  if (v && $$1.dateParse(v, this.x.format) > $$1.dateParse(r, this.x.format))
11609
- return this.formErr(q)
11622
+ return this.formErr(q, [r])
11610
11623
  },
11611
11624
  compare: (v, r, q) => {
11612
11625
  let e = this.getCompareError(v, r);
@@ -11636,6 +11649,20 @@ var script$b = {
11636
11649
  }
11637
11650
  }
11638
11651
  },
11652
+ isReadonly() {
11653
+ if (this.x.readonly == null) {
11654
+ let p = this.provideRangeParent;
11655
+ if (p && p.x.readonly) return true
11656
+ }
11657
+ return !!this.x.readonly
11658
+ },
11659
+ isDisabled() {
11660
+ if (this.x.disabled == null) {
11661
+ let p = this.provideRangeParent;
11662
+ if (p && p.x.disabled) return true
11663
+ }
11664
+ return !!this.x.disabled
11665
+ },
11639
11666
  input_prop() {
11640
11667
  return $$1.br.mobile ? {
11641
11668
  readonly: true,
@@ -11927,7 +11954,6 @@ var script$7 = {
11927
11954
  html_form() {
11928
11955
  let c = this.slots_children();
11929
11956
  c.splice(1, 0, h('div', {ref: 'to', class: 'w-range-to'}, $$1.loc.to));
11930
- //c.push(h('input', {type: 'hidden', ref:'v', id: this.uid + 'hdn'}))
11931
11957
  return c
11932
11958
  },
11933
11959
  },
@@ -13124,10 +13150,35 @@ var script$1 = {
13124
13150
 
13125
13151
  script$1.__file = "src/widgets/Rate.vue";
13126
13152
 
13127
- var script = {
13153
+ // 获取小数点后面有几位
13154
+ function getDecimalPlacesFinal(num, { trimZeros = false } = {}) {
13155
+ // Step 1: 转换为非科学计数法的字符串
13156
+ let numStr = Number(num).toLocaleString('fullwide', {
13157
+ useGrouping: false,
13158
+ minimumFractionDigits: 0,
13159
+ maximumFractionDigits: 20 // 限制精度防止溢出
13160
+ });
13161
+
13162
+ // Step 2: 处理科学计数法(如 0.0000001 → 1e-7)
13163
+ if (numStr.includes('e')) {
13164
+ const [sig, exp] = numStr.split('e');
13165
+ const exponent = parseInt(exp, 10);
13166
+ numStr = Number(num).toFixed(Math.abs(exponent) + (sig.split('.')?.length || 0));
13167
+ }
13168
+
13169
+ // Step 3: 分割整数和小数部分
13170
+ const [integer, decimal] = numStr.split('.');
13171
+ if (!decimal) return 0;
13172
+
13173
+ // Step 4: 可选去除末尾零
13174
+ const trimmed = trimZeros ? decimal.replace(/0+$/, '') : decimal;
13175
+ return trimmed.length;
13176
+ }
13177
+
13178
+ var script = {
13128
13179
  name: 'w-slider',
13129
13180
  mixins: [script$B],
13130
- props: ['minValue', 'maxValue'],
13181
+ props: ['minValue', 'maxValue', 'step'],
13131
13182
  emits: ['drop'],
13132
13183
  data() {
13133
13184
  return {
@@ -13138,7 +13189,8 @@ var script = {
13138
13189
  x_default() {
13139
13190
  return {
13140
13191
  minValue: 0,
13141
- maxValue: 100
13192
+ maxValue: 100,
13193
+ step: 1,
13142
13194
  }
13143
13195
  },
13144
13196
  onmousedown(e) {
@@ -13146,10 +13198,12 @@ var script = {
13146
13198
  let mv = $$1.number(this.x.modelValue);
13147
13199
  let dn_x = e.clientX;
13148
13200
  this.grabbing = true;
13201
+ const fixed = getDecimalPlacesFinal(this.x.step);
13149
13202
  $$1.moveup((e) => {
13150
13203
  let dist = e.clientX - dn_x;
13151
13204
  let v = mv + (dist / bar.width) * (this.x.maxValue - this.x.minValue);
13152
13205
  v = $$1.numRange(v, this.x.minValue, this.x.maxValue);
13206
+ v = Number(Number(v).toFixed(fixed));
13153
13207
  this.val(v);
13154
13208
  }, (e) => {
13155
13209
  this.grabbing = false;
@@ -13161,7 +13215,9 @@ var script = {
13161
13215
  const bar = $$1.bcr(this.$refs.form);
13162
13216
  let dist = e.clientX - bar.left;
13163
13217
  let v = (dist / (bar.width)) * (this.x.maxValue - this.x.minValue);
13218
+ const fixed = getDecimalPlacesFinal(this.x.step);
13164
13219
  v = $$1.numRange(v, this.x.minValue, this.x.maxValue);
13220
+ v = Number(Number(v).toFixed(fixed));
13165
13221
  this.val(v);
13166
13222
  this.trigger('drop', v);
13167
13223
  }
@@ -13189,7 +13245,7 @@ var script = {
13189
13245
  },
13190
13246
  computed: {
13191
13247
  percent() {
13192
- let v = this.x.modelValue;
13248
+ let v = (this.x.modelValue - this.x.minValue) * 100 / (this.x.maxValue - this.x.minValue);
13193
13249
  if (!v) return 0
13194
13250
  return v
13195
13251
  },