dfish-widget 1.0.40 → 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
  }
@@ -6217,7 +6221,7 @@ var script$A = {
6217
6221
  }
6218
6222
  },
6219
6223
  snapElem() {
6220
- return this.el('main')
6224
+ return this.el('form')
6221
6225
  },
6222
6226
  hasBubble(a) {
6223
6227
  return this.snapElem().contains(a.isWidget ? a.el() : a)
@@ -6288,7 +6292,7 @@ var script$A = {
6288
6292
  html_button() {
6289
6293
  return []
6290
6294
  },
6291
- html_form() {
6295
+ html_form_slot() {
6292
6296
  return [
6293
6297
  this.slot('prepend'),
6294
6298
  this.html_input(),
@@ -6297,10 +6301,13 @@ var script$A = {
6297
6301
  ]
6298
6302
  },
6299
6303
  html_main() {
6304
+ return h('div', {class: 'w-formbase-main'}, [this.html_form(), this.slot('down')])
6305
+ },
6306
+ html_form() {
6300
6307
  let fh = this.x.inputHeight && $$1.unitSize(this.x.inputHeight);
6301
6308
  return h('div', mergeProps({
6302
- ref: 'main',
6303
- id: this.uid + 'main',
6309
+ ref: 'form',
6310
+ id: this.uid + 'form',
6304
6311
  class: ['w-input', {
6305
6312
  'w-input-border': this.hasBorder,
6306
6313
  [`f-${this.dir}-gap`]: $$1.br.compat.gap && this.x.gap,
@@ -6309,10 +6316,10 @@ var script$A = {
6309
6316
  'height': fh
6310
6317
  },
6311
6318
  title: this.input_title
6312
- }, this.main_prop), this.html_form())
6319
+ }, this.form_prop), this.html_form_slot())
6313
6320
  },
6314
6321
  html_slots() {
6315
- return [this.html_label(), this.html_main(), this.slot('after'), this.slot('dialog')]
6322
+ return [this.html_label(), this.html_main(), this.slot('right')]
6316
6323
  }
6317
6324
  },
6318
6325
  computed: {
@@ -6404,7 +6411,7 @@ var script$A = {
6404
6411
  }
6405
6412
  return s
6406
6413
  },
6407
- main_prop() {
6414
+ form_prop() {
6408
6415
  // implement
6409
6416
  },
6410
6417
  hasVal() {
@@ -6434,7 +6441,8 @@ var script$A = {
6434
6441
  'z-req': this.rules.required,
6435
6442
  'z-label-vertical': this.labelVertical,
6436
6443
  'z-fixed': !!fw,
6437
- 'z-full': this.x.inputWidth === '*'
6444
+ 'z-full': this.x.inputWidth === '*',
6445
+ 'z-slot-down': !!this.$slots.down
6438
6446
  }],
6439
6447
  style: fw && {
6440
6448
  '--w-input-width': fw
@@ -8671,7 +8679,7 @@ var script$k = {
8671
8679
  gap: 15
8672
8680
  }
8673
8681
  },
8674
- html_form() {
8682
+ html_form_slot() {
8675
8683
  return this.x.vertical ? h('div', {class: 'w-boxgroup-grid'}, this.$slots) : this.$slots
8676
8684
  },
8677
8685
  },
@@ -9270,14 +9278,24 @@ const suffixHooks = {
9270
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',
9271
9279
  img: 'jpg.jpeg.gif.png.bmp.tif.tiff.ico'
9272
9280
  };
9273
-
9274
- const suffix = (function() {
9275
- let r = {};
9276
- for (let k in suffixHooks) {
9277
- suffixHooks[k].split('.').forEach(v => r[v] = k == '0' ? v : k);
9278
- }
9279
- return r
9280
- })();
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
+ }
9281
9299
 
9282
9300
  const getSuffix = function(url) {
9283
9301
  let a = $$1.strFrom(url || '', '.', true).toLowerCase();
@@ -9297,12 +9315,6 @@ const suffixHooks = {
9297
9315
  'T' ? 1024 * 1024 * 1024 * 1024 : 1)
9298
9316
  };
9299
9317
 
9300
- const fileTypeHooks = {
9301
- video: suffixHooks.vid,
9302
- audio: suffixHooks.aud,
9303
- image: suffixHooks.img
9304
- };
9305
-
9306
9318
  var script$g = {
9307
9319
  name: 'w-fileupload',
9308
9320
  mixins: [script$A],
@@ -9342,6 +9354,9 @@ const suffixHooks = {
9342
9354
  },
9343
9355
  getFileTypes() {
9344
9356
  let t = this.x.fileTypes;
9357
+ if (fileTypesAlias[t]) {
9358
+ t = fileTypesAlias[t];
9359
+ }
9345
9360
  return t && t !== '*.*' ? t.replace(/\*/g, '').replace(/;/g, ',').toLowerCase() : ''
9346
9361
  },
9347
9362
  getAccept() {
@@ -9350,8 +9365,7 @@ const suffixHooks = {
9350
9365
  if (!t) return
9351
9366
  let n = [];
9352
9367
  t.toLowerCase().split(',').forEach(b => {
9353
- if (!b) return
9354
- n.push(fileTypeHooks[b] || b);
9368
+ b && n.push(b);
9355
9369
  });
9356
9370
  n.forEach(b => {
9357
9371
  b && r.push(mimeType$1(b) || b);
@@ -9540,18 +9554,25 @@ const suffixHooks = {
9540
9554
  ]
9541
9555
  },
9542
9556
  html_input_button() {
9543
- return h(script$J, {
9544
- ref: 'uploadbbr',
9545
- class: 'w-fileupload-bbr',
9546
- gap: 10,
9547
- }, {
9548
- default: () => [this.$slots.button ? this.$slots.button() : h(script$_, {
9549
- text: '选择文件',
9550
- icon: '.f-i .f-i-upload',
9551
- class: 'w-fileupload-button',
9552
- onclick: this.chooseFile
9553
- })]
9554
- })
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
+ ])
9555
9576
  },
9556
9577
  html_input_list() {
9557
9578
  return this.list.length ? h('div', {
@@ -9564,7 +9585,12 @@ const suffixHooks = {
9564
9585
  html_input() {
9565
9586
  return this.html_input_form().concat(this.canUpload && this.html_input_button(), this.html_input_list())
9566
9587
  },
9567
-
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
+ }
9568
9594
  },
9569
9595
  computed: {
9570
9596
  validHooks() {
@@ -9822,22 +9848,28 @@ var script$e = {
9822
9848
  })
9823
9849
  },
9824
9850
  html_input_button() {
9825
- return h(script$J, {
9826
- ref: 'uploadbbr',
9827
- class: 'w-fileupload-bbr'
9828
- }, {
9829
- default: () => [this.$slots.button ? this.$slots.button() : h(script$_, {
9830
- ref: 'uploadbutton',
9831
- title: $$1.loc.form.choose_image,
9832
- icon: '.f-i .f-i-plus',
9833
- class: 'w-mediaupload-button',
9834
- style: {
9835
- width: $$1.unitSize(this.x.thumbnailWidth),
9836
- height: $$1.unitSize(this.x.thumbnailHeight),
9837
- },
9838
- onclick: this.chooseFile
9839
- })]
9840
- })
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
+ ])
9841
9873
  },
9842
9874
  html_input() {
9843
9875
  return this.html_input_form().concat(h('div', {
@@ -10363,7 +10395,7 @@ var script$a = {
10363
10395
  onkeyup: this.onkeyup,
10364
10396
  }
10365
10397
  },
10366
- main_prop() {
10398
+ form_prop() {
10367
10399
  return {
10368
10400
  onclick: this.isNormal && this.drop
10369
10401
  }
@@ -10444,10 +10476,10 @@ var script$9 = {
10444
10476
  context: this,
10445
10477
  ownproperty: true,
10446
10478
  class: 'f-dfish-dialog w-dropbox-dialog' + (m ? ' z-mob' : ''),
10447
- width: m ? '100%' : $$1.bcr(this.el('main')).width,
10479
+ width: m ? '100%' : $$1.bcr(this.el('form')).width,
10448
10480
  autoHide: true,
10449
10481
  cover: m,
10450
- snap: m ? null : () => this.el('main'),
10482
+ snap: m ? null : () => this.el('form'),
10451
10483
  position: m ? null : 'v',
10452
10484
  indent: 1,
10453
10485
  onClose: () => this.showDrop = false
@@ -10480,7 +10512,7 @@ var script$9 = {
10480
10512
  });
10481
10513
  return r.sort().map(v => s[v].props.text).join(', ')
10482
10514
  },
10483
- main_prop() {
10515
+ form_prop() {
10484
10516
  return {
10485
10517
  onclick: this.isNormal && this.click
10486
10518
  }
@@ -10621,14 +10653,15 @@ var script$6 = {
10621
10653
  }
10622
10654
  },
10623
10655
  forms() {
10624
- return this.ownerView.fAll(null, this.el('main'))
10656
+ const to = this.$refs.to;
10657
+ return to && this.ownerView.fAll(null, to.parentNode)
10625
10658
  },
10626
10659
  snapElem() {
10627
- return this.forms()[0] || this.el('main')
10660
+ return this.forms()[0] || this.el('form')
10628
10661
  },
10629
10662
  html_form() {
10630
10663
  let c = this.slots_children();
10631
- 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));
10632
10665
  //c.push(h('input', {type: 'hidden', ref:'v', id: this.uid + 'hdn'}))
10633
10666
  return c
10634
10667
  },
@@ -10843,9 +10876,9 @@ var script$5 = {
10843
10876
  context: this,
10844
10877
  ownproperty: true,
10845
10878
  class: 'f-dfish-dialog',
10846
- width: $$1.bcr(this.el('main')).width,
10879
+ width: $$1.bcr(this.el('form')).width,
10847
10880
  autoHide: true,
10848
- snap:() => this.el('main'),
10881
+ snap:() => this.el('form'),
10849
10882
  position: 'v',
10850
10883
  indent: 1,
10851
10884
  onClose: () => this.showSuggest = false
@@ -10913,7 +10946,7 @@ var script$5 = {
10913
10946
  'z-clearable': this.x.clearable,
10914
10947
  }
10915
10948
  },
10916
- main_prop() {
10949
+ form_prop() {
10917
10950
  return {
10918
10951
  onclick: this.isNormal && this.onclick
10919
10952
  }
@@ -11298,10 +11331,10 @@ var script$4 = {
11298
11331
  context: this,
11299
11332
  ownproperty: true,
11300
11333
  class: 'f-dfish-dialog',
11301
- width: $$1.bcr(this.el('main')).width,
11334
+ width: $$1.bcr(this.el('form')).width,
11302
11335
  scrollY: true,
11303
11336
  autoHide: true,
11304
- snap: () => this.el('main'),
11337
+ snap: () => this.el('form'),
11305
11338
  position: 'v',
11306
11339
  indent: 1,
11307
11340
  onClose: () => this.showSuggest = false
@@ -11584,7 +11617,7 @@ const init_text = $$1.loc.form.jigsaw_drag_right;
11584
11617
  return $$1.bcr(this.$refs.thumb).width
11585
11618
  },
11586
11619
  mainWidth() {
11587
- return $$1.bcr(this.$refs.main).width
11620
+ return $$1.bcr(this.$refs.form).width
11588
11621
  },
11589
11622
  html_input() {
11590
11623
  return [
@@ -11615,7 +11648,7 @@ const init_text = $$1.loc.form.jigsaw_drag_right;
11615
11648
  })
11616
11649
  ];
11617
11650
  if (this.showDrop) {
11618
- 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);
11619
11652
  let height = Math.ceil(width * (this.x.big.height / this.x.big.width));
11620
11653
  r.push(h(script$3, {
11621
11654
  ownproperty: true,
@@ -11623,7 +11656,7 @@ const init_text = $$1.loc.form.jigsaw_drag_right;
11623
11656
  height,
11624
11657
  autoHide: true,
11625
11658
  context: this,
11626
- snap: () => this.el('main'),
11659
+ snap: () => this.el('form'),
11627
11660
  position: 'v',
11628
11661
  onClose: () => this.showDrop = null
11629
11662
  }));
@@ -11647,7 +11680,7 @@ const init_text = $$1.loc.form.jigsaw_drag_right;
11647
11680
  'z-success': this.isSuccess,
11648
11681
  }
11649
11682
  },
11650
- main_prop() {
11683
+ form_prop() {
11651
11684
  return {
11652
11685
  onmouseenter: this.mouseenter
11653
11686
  }
@@ -11694,7 +11727,7 @@ var script$1 = {
11694
11727
  '--w-form-gap': $$1.unitSize(this.x.gap)
11695
11728
  }
11696
11729
  },
11697
- main_prop() {
11730
+ form_prop() {
11698
11731
  return this.name && {
11699
11732
  onclick: e => this.warn(false)
11700
11733
  }