dfish-widget 1.0.39 → 1.0.41

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
@@ -1465,7 +1465,11 @@ $$1.slotsChildren = function(slots, name = 'default') {
1465
1465
  const getChildren = (d) => {
1466
1466
  d && d.forEach(v => {
1467
1467
  if (typeof v.type === 'symbol') {
1468
- Array.isArray(v.children) && getChildren(v.children);
1468
+ if (Array.isArray(v.children)) {
1469
+ getChildren(v.children);
1470
+ } else if (v.type.toString() === 'Symbol(v-txt)') {
1471
+ r.push(v);
1472
+ }
1469
1473
  } else
1470
1474
  r.push(v);
1471
1475
  });
@@ -1530,7 +1534,7 @@ $$1.print = function(a, y) {
1530
1534
  if (y.input2text) {
1531
1535
  let g = $$1(this);
1532
1536
  if (g && g.isFormWidget) {
1533
- h = g.el('main').outerHTML;
1537
+ h = g.el('form').outerHTML;
1534
1538
  v = g.formText();
1535
1539
  } else
1536
1540
  v = this.value;
@@ -1557,7 +1561,7 @@ $$1.print = function(a, y) {
1557
1561
  $$1.q('input[type=hidden]', d).each(function() {
1558
1562
  var g = $$1(this);
1559
1563
  if (g && g.isFormWidget && g.$options.name != 'w-hidden') {
1560
- s = s.replace(g.el('main').outerHTML, () => '<div class="f-wdbr f-print-input-text">' + g.formText() + '</div>');
1564
+ s = s.replace(g.el('form').outerHTML, () => '<div class="f-wdbr f-print-input-text">' + g.formText() + '</div>');
1561
1565
  }
1562
1566
  });
1563
1567
  }
@@ -6034,6 +6038,7 @@ var script$A = {
6034
6038
  isFocus: false,
6035
6039
  hasBorder: false,
6036
6040
  isPlural: false,
6041
+ isEdit: false,
6037
6042
  loading: false,
6038
6043
  warnClass: '',
6039
6044
  labelVertical: false,
@@ -6043,6 +6048,18 @@ var script$A = {
6043
6048
  validIndex: 0,
6044
6049
  }
6045
6050
  },
6051
+ watch: {
6052
+ modelValue(v, ov) {
6053
+ if (this.isEdit) {
6054
+ this.isEdit = false;
6055
+ } else {
6056
+ if (v == null) v = '';
6057
+ if (ov == null) ov = '';
6058
+ this.watchModelValue(v, ov);
6059
+ }
6060
+ }
6061
+ },
6062
+
6046
6063
  methods: {
6047
6064
  val(v) {
6048
6065
  if (arguments.length == 0)
@@ -6062,6 +6079,7 @@ var script$A = {
6062
6079
  if (changed) {
6063
6080
  this.warnClass && this.warn(false);
6064
6081
  if (this.isUsableVal(v)) {
6082
+ this.isEdit = true;
6065
6083
  this.$emit('update:modelValue', v);
6066
6084
  this.trigger('change', v);
6067
6085
  }
@@ -6083,6 +6101,11 @@ var script$A = {
6083
6101
  return r && r.value ? r.value : r
6084
6102
  }
6085
6103
  },
6104
+ watchModelValue(v, ov) {
6105
+ if (ov != v) {
6106
+ this.trigger('change', v);
6107
+ }
6108
+ },
6086
6109
  async valid(trigger) {
6087
6110
  let error = await this.getValidError(trigger);
6088
6111
  if (error) {
@@ -6198,7 +6221,7 @@ var script$A = {
6198
6221
  }
6199
6222
  },
6200
6223
  snapElem() {
6201
- return this.el('main')
6224
+ return this.el('form')
6202
6225
  },
6203
6226
  hasBubble(a) {
6204
6227
  return this.snapElem().contains(a.isWidget ? a.el() : a)
@@ -6269,7 +6292,7 @@ var script$A = {
6269
6292
  html_button() {
6270
6293
  return []
6271
6294
  },
6272
- html_form() {
6295
+ html_form_slot() {
6273
6296
  return [
6274
6297
  this.slot('prepend'),
6275
6298
  this.html_input(),
@@ -6278,10 +6301,13 @@ var script$A = {
6278
6301
  ]
6279
6302
  },
6280
6303
  html_main() {
6304
+ return h('div', {class: 'w-formbase-main'}, [this.html_form(), this.slot('down')])
6305
+ },
6306
+ html_form() {
6281
6307
  let fh = this.x.inputHeight && $$1.unitSize(this.x.inputHeight);
6282
6308
  return h('div', mergeProps({
6283
- ref: 'main',
6284
- id: this.uid + 'main',
6309
+ ref: 'form',
6310
+ id: this.uid + 'form',
6285
6311
  class: ['w-input', {
6286
6312
  'w-input-border': this.hasBorder,
6287
6313
  [`f-${this.dir}-gap`]: $$1.br.compat.gap && this.x.gap,
@@ -6290,10 +6316,10 @@ var script$A = {
6290
6316
  'height': fh
6291
6317
  },
6292
6318
  title: this.input_title
6293
- }, this.main_prop), this.html_form())
6319
+ }, this.form_prop), this.html_form_slot())
6294
6320
  },
6295
6321
  html_slots() {
6296
- return [this.html_label(), this.html_main(), this.slot('after'), this.slot('dialog')]
6322
+ return [this.html_label(), this.html_main(), this.slot('right')]
6297
6323
  }
6298
6324
  },
6299
6325
  computed: {
@@ -6385,7 +6411,7 @@ var script$A = {
6385
6411
  }
6386
6412
  return s
6387
6413
  },
6388
- main_prop() {
6414
+ form_prop() {
6389
6415
  // implement
6390
6416
  },
6391
6417
  hasVal() {
@@ -6415,7 +6441,8 @@ var script$A = {
6415
6441
  'z-req': this.rules.required,
6416
6442
  'z-label-vertical': this.labelVertical,
6417
6443
  'z-fixed': !!fw,
6418
- 'z-full': this.x.inputWidth === '*'
6444
+ 'z-full': this.x.inputWidth === '*',
6445
+ 'z-slot-down': !!this.$slots.down
6419
6446
  }],
6420
6447
  style: fw && {
6421
6448
  '--w-input-width': fw
@@ -6496,6 +6523,15 @@ var script$z = {
6496
6523
  }
6497
6524
  $$1.lodash.each(this.siblings(), f => f.val($$1.idsAny(a, f.checkValue)));
6498
6525
  },
6526
+ watchModelValue(v, ov) {
6527
+ if (ov != v) {
6528
+ this.trigger('change', v);
6529
+ if (this.pubParent && this.pubParent.watchValue != v) {
6530
+ this.pubParent.watchValue = v;
6531
+ this.pubParent.trigger('change', v);
6532
+ }
6533
+ }
6534
+ },
6499
6535
  check(a) {
6500
6536
  if (!this.isNormal) return
6501
6537
  this.val(a);
@@ -6521,8 +6557,8 @@ var script$z = {
6521
6557
  e.stopPropagation();
6522
6558
  },
6523
6559
  onbasechange(e) {
6524
- if (this.warnClass && this.x.name) {
6525
- this.ownerView.fAll(this.x.name).forEach(v => v.warn && v.warn(false));
6560
+ if (this.warnClass) {
6561
+ this.siblings().forEach(v => v.warn && v.warn(false));
6526
6562
  }
6527
6563
  this.setVal(e.target.checked, e);
6528
6564
  },
@@ -8632,13 +8668,18 @@ var script$k = {
8632
8668
  providePubParent: this
8633
8669
  }
8634
8670
  },
8671
+ data() {
8672
+ return {
8673
+ watchValue: ''
8674
+ }
8675
+ },
8635
8676
  methods: {
8636
8677
  x_default() {
8637
8678
  return {
8638
8679
  gap: 15
8639
8680
  }
8640
8681
  },
8641
- html_form() {
8682
+ html_form_slot() {
8642
8683
  return this.x.vertical ? h('div', {class: 'w-boxgroup-grid'}, this.$slots) : this.$slots
8643
8684
  },
8644
8685
  },
@@ -9237,14 +9278,24 @@ const suffixHooks = {
9237
9278
  aud: 'aif.aifc.aiff.als.awb.mp3.aac.au.wav.wma.cda.flac.m4a.mid.mka.mp2.mpc.ape.ofr.ogg.ra.wv.tta.ac3.dts.wv.shn.vqf.spc.nsf.adx.psf.minipsf.psf2.minipsf2.rsn.zst',
9238
9279
  img: 'jpg.jpeg.gif.png.bmp.tif.tiff.ico'
9239
9280
  };
9240
-
9241
- const suffix = (function() {
9242
- let r = {};
9243
- for (let k in suffixHooks) {
9244
- suffixHooks[k].split('.').forEach(v => r[v] = k == '0' ? v : k);
9245
- }
9246
- return r
9247
- })();
9281
+
9282
+ const suffix = {};
9283
+
9284
+ for (let k in suffixHooks) {
9285
+ suffixHooks[k].split('.').forEach(v => {
9286
+ suffix[v] = k == '0' ? v : k;
9287
+ });
9288
+ }
9289
+
9290
+ const fileTypesAlias = {
9291
+ video: suffixHooks.vid,
9292
+ audio: suffixHooks.aud,
9293
+ image: suffixHooks.img
9294
+ };
9295
+
9296
+ for (let k in fileTypesAlias) {
9297
+ fileTypesAlias[k] = fileTypesAlias[k].split('.').map(v => `*.${v};`).join('');
9298
+ }
9248
9299
 
9249
9300
  const getSuffix = function(url) {
9250
9301
  let a = $$1.strFrom(url || '', '.', true).toLowerCase();
@@ -9264,12 +9315,6 @@ const suffixHooks = {
9264
9315
  'T' ? 1024 * 1024 * 1024 * 1024 : 1)
9265
9316
  };
9266
9317
 
9267
- const fileTypeHooks = {
9268
- video: suffixHooks.vid,
9269
- audio: suffixHooks.aud,
9270
- image: suffixHooks.img
9271
- };
9272
-
9273
9318
  var script$g = {
9274
9319
  name: 'w-fileupload',
9275
9320
  mixins: [script$A],
@@ -9309,6 +9354,9 @@ const suffixHooks = {
9309
9354
  },
9310
9355
  getFileTypes() {
9311
9356
  let t = this.x.fileTypes;
9357
+ if (fileTypesAlias[t]) {
9358
+ t = fileTypesAlias[t];
9359
+ }
9312
9360
  return t && t !== '*.*' ? t.replace(/\*/g, '').replace(/;/g, ',').toLowerCase() : ''
9313
9361
  },
9314
9362
  getAccept() {
@@ -9317,8 +9365,7 @@ const suffixHooks = {
9317
9365
  if (!t) return
9318
9366
  let n = [];
9319
9367
  t.toLowerCase().split(',').forEach(b => {
9320
- if (!b) return
9321
- n.push(fileTypeHooks[b] || b);
9368
+ b && n.push(b);
9322
9369
  });
9323
9370
  n.forEach(b => {
9324
9371
  b && r.push(mimeType$1(b) || b);
@@ -9507,18 +9554,25 @@ const suffixHooks = {
9507
9554
  ]
9508
9555
  },
9509
9556
  html_input_button() {
9510
- return h(script$J, {
9511
- ref: 'uploadbbr',
9512
- class: 'w-fileupload-bbr',
9513
- gap: 10,
9514
- }, {
9515
- default: () => [this.$slots.button ? this.$slots.button() : h(script$_, {
9516
- text: '选择文件',
9517
- icon: '.f-i .f-i-upload',
9518
- class: 'w-fileupload-button',
9519
- onclick: this.chooseFile
9520
- })]
9521
- })
9557
+ return h('div', {}, [
9558
+ h(script$J, {
9559
+ ref: 'uploadbbr',
9560
+ class: 'w-fileupload-bbr',
9561
+ gap: 10,
9562
+ }, {
9563
+ default: () => [
9564
+ this.$slots.button ? this.$slots.button({chooseFile: this.chooseFile}) :
9565
+ h(script$_, {
9566
+ text: '选择文件',
9567
+ icon: '.f-i .f-i-upload',
9568
+ class: 'w-fileupload-button',
9569
+ onclick: this.chooseFile
9570
+ }),
9571
+ this.slot('right')
9572
+ ]
9573
+ }),
9574
+ this.slot('down')
9575
+ ])
9522
9576
  },
9523
9577
  html_input_list() {
9524
9578
  return this.list.length ? h('div', {
@@ -9531,7 +9585,12 @@ const suffixHooks = {
9531
9585
  html_input() {
9532
9586
  return this.html_input_form().concat(this.canUpload && this.html_input_button(), this.html_input_list())
9533
9587
  },
9534
-
9588
+ html_main() {
9589
+ return h('div', {class: 'w-formbase-main'}, this.html_form())
9590
+ },
9591
+ html_slots() {
9592
+ return [this.html_label(), this.html_main()]
9593
+ }
9535
9594
  },
9536
9595
  computed: {
9537
9596
  validHooks() {
@@ -9789,22 +9848,28 @@ var script$e = {
9789
9848
  })
9790
9849
  },
9791
9850
  html_input_button() {
9792
- return h(script$J, {
9793
- ref: 'uploadbbr',
9794
- class: 'w-fileupload-bbr'
9795
- }, {
9796
- default: () => [this.$slots.button ? this.$slots.button() : h(script$_, {
9797
- ref: 'uploadbutton',
9798
- title: $$1.loc.form.choose_image,
9799
- icon: '.f-i .f-i-plus',
9800
- class: 'w-mediaupload-button',
9801
- style: {
9802
- width: $$1.unitSize(this.x.thumbnailWidth),
9803
- height: $$1.unitSize(this.x.thumbnailHeight),
9804
- },
9805
- onclick: this.chooseFile
9806
- })]
9807
- })
9851
+ return h('div', {}, [
9852
+ h(script$J, {
9853
+ ref: 'uploadbbr',
9854
+ class: 'w-fileupload-bbr'
9855
+ }, {
9856
+ default: () => [
9857
+ this.$slots.button ? this.$slots.button({chooseFile: this.chooseFile}) : h(script$_, {
9858
+ ref: 'uploadbutton',
9859
+ title: $$1.loc.form.choose_image,
9860
+ icon: '.f-i .f-i-plus',
9861
+ class: 'w-mediaupload-button',
9862
+ style: {
9863
+ width: $$1.unitSize(this.x.thumbnailWidth),
9864
+ height: $$1.unitSize(this.x.thumbnailHeight),
9865
+ },
9866
+ onclick: this.chooseFile
9867
+ }),
9868
+ this.slot('right')
9869
+ ]
9870
+ }),
9871
+ this.slot('down')
9872
+ ])
9808
9873
  },
9809
9874
  html_input() {
9810
9875
  return this.html_input_form().concat(h('div', {
@@ -10330,7 +10395,7 @@ var script$a = {
10330
10395
  onkeyup: this.onkeyup,
10331
10396
  }
10332
10397
  },
10333
- main_prop() {
10398
+ form_prop() {
10334
10399
  return {
10335
10400
  onclick: this.isNormal && this.drop
10336
10401
  }
@@ -10411,10 +10476,10 @@ var script$9 = {
10411
10476
  context: this,
10412
10477
  ownproperty: true,
10413
10478
  class: 'f-dfish-dialog w-dropbox-dialog' + (m ? ' z-mob' : ''),
10414
- width: m ? '100%' : $$1.bcr(this.el('main')).width,
10479
+ width: m ? '100%' : $$1.bcr(this.el('form')).width,
10415
10480
  autoHide: true,
10416
10481
  cover: m,
10417
- snap: m ? null : () => this.el('main'),
10482
+ snap: m ? null : () => this.el('form'),
10418
10483
  position: m ? null : 'v',
10419
10484
  indent: 1,
10420
10485
  onClose: () => this.showDrop = false
@@ -10447,7 +10512,7 @@ var script$9 = {
10447
10512
  });
10448
10513
  return r.sort().map(v => s[v].props.text).join(', ')
10449
10514
  },
10450
- main_prop() {
10515
+ form_prop() {
10451
10516
  return {
10452
10517
  onclick: this.isNormal && this.click
10453
10518
  }
@@ -10588,14 +10653,15 @@ var script$6 = {
10588
10653
  }
10589
10654
  },
10590
10655
  forms() {
10591
- return this.ownerView.fAll(null, this.el('main'))
10656
+ const to = this.$refs.to;
10657
+ return to && this.ownerView.fAll(null, to.parentNode)
10592
10658
  },
10593
10659
  snapElem() {
10594
- return this.forms()[0] || this.el('main')
10660
+ return this.forms()[0] || this.el('form')
10595
10661
  },
10596
10662
  html_form() {
10597
10663
  let c = this.slots_children();
10598
- c.splice(1, 0, h('div', {class: 'w-range-to'}, $$1.loc.to));
10664
+ c.splice(1, 0, h('div', {ref: 'to', class: 'w-range-to'}, $$1.loc.to));
10599
10665
  //c.push(h('input', {type: 'hidden', ref:'v', id: this.uid + 'hdn'}))
10600
10666
  return c
10601
10667
  },
@@ -10627,14 +10693,19 @@ var script$5 = {
10627
10693
  }
10628
10694
  },
10629
10695
  watch: {
10630
- modelValue(v) {
10631
- this.clear();
10632
- },
10633
10696
  inputValue(v) {
10634
10697
  this.sensor_text = v;
10635
10698
  }
10636
10699
  },
10637
10700
  methods: {
10701
+ watchModelValue(v, ov) {
10702
+ this.clear();
10703
+ const or = ov && ov.map ? ov.map(n => n.value).join(',') : '';
10704
+ const r = v && v.map ? v.map(n => n.value).join(',') : '';
10705
+ if (or != r) {
10706
+ this.trigger('change', v);
10707
+ }
10708
+ },
10638
10709
  addVal(v) {
10639
10710
  let mv;
10640
10711
  if (this.x.multiple) {
@@ -10805,9 +10876,9 @@ var script$5 = {
10805
10876
  context: this,
10806
10877
  ownproperty: true,
10807
10878
  class: 'f-dfish-dialog',
10808
- width: $$1.bcr(this.el('main')).width,
10879
+ width: $$1.bcr(this.el('form')).width,
10809
10880
  autoHide: true,
10810
- snap:() => this.el('main'),
10881
+ snap:() => this.el('form'),
10811
10882
  position: 'v',
10812
10883
  indent: 1,
10813
10884
  onClose: () => this.showSuggest = false
@@ -10875,7 +10946,7 @@ var script$5 = {
10875
10946
  'z-clearable': this.x.clearable,
10876
10947
  }
10877
10948
  },
10878
- main_prop() {
10949
+ form_prop() {
10879
10950
  return {
10880
10951
  onclick: this.isNormal && this.onclick
10881
10952
  }
@@ -11260,10 +11331,10 @@ var script$4 = {
11260
11331
  context: this,
11261
11332
  ownproperty: true,
11262
11333
  class: 'f-dfish-dialog',
11263
- width: $$1.bcr(this.el('main')).width,
11334
+ width: $$1.bcr(this.el('form')).width,
11264
11335
  scrollY: true,
11265
11336
  autoHide: true,
11266
- snap: () => this.el('main'),
11337
+ snap: () => this.el('form'),
11267
11338
  position: 'v',
11268
11339
  indent: 1,
11269
11340
  onClose: () => this.showSuggest = false
@@ -11546,7 +11617,7 @@ const init_text = $$1.loc.form.jigsaw_drag_right;
11546
11617
  return $$1.bcr(this.$refs.thumb).width
11547
11618
  },
11548
11619
  mainWidth() {
11549
- return $$1.bcr(this.$refs.main).width
11620
+ return $$1.bcr(this.$refs.form).width
11550
11621
  },
11551
11622
  html_input() {
11552
11623
  return [
@@ -11577,7 +11648,7 @@ const init_text = $$1.loc.form.jigsaw_drag_right;
11577
11648
  })
11578
11649
  ];
11579
11650
  if (this.showDrop) {
11580
- let width = Math.max($$1.number(this.x.dropWidth), $$1.bcr(this.el('main')).width);
11651
+ let width = Math.max($$1.number(this.x.dropWidth), $$1.bcr(this.el('form')).width);
11581
11652
  let height = Math.ceil(width * (this.x.big.height / this.x.big.width));
11582
11653
  r.push(h(script$3, {
11583
11654
  ownproperty: true,
@@ -11585,7 +11656,7 @@ const init_text = $$1.loc.form.jigsaw_drag_right;
11585
11656
  height,
11586
11657
  autoHide: true,
11587
11658
  context: this,
11588
- snap: () => this.el('main'),
11659
+ snap: () => this.el('form'),
11589
11660
  position: 'v',
11590
11661
  onClose: () => this.showDrop = null
11591
11662
  }));
@@ -11609,7 +11680,7 @@ const init_text = $$1.loc.form.jigsaw_drag_right;
11609
11680
  'z-success': this.isSuccess,
11610
11681
  }
11611
11682
  },
11612
- main_prop() {
11683
+ form_prop() {
11613
11684
  return {
11614
11685
  onmouseenter: this.mouseenter
11615
11686
  }
@@ -11656,7 +11727,7 @@ var script$1 = {
11656
11727
  '--w-form-gap': $$1.unitSize(this.x.gap)
11657
11728
  }
11658
11729
  },
11659
- main_prop() {
11730
+ form_prop() {
11660
11731
  return this.name && {
11661
11732
  onclick: e => this.warn(false)
11662
11733
  }