dfish-widget 1.0.75 → 1.0.76

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
@@ -712,7 +712,9 @@ const frag = function(s) {
712
712
 
713
713
  const el = function(o) {
714
714
  if (o) {
715
- return o.isWidget ? o.el() : (o.$el || o)
715
+ const d = o.$el;
716
+ if (d) return d.nodeType === 1 ? d : d.nextElementSibling
717
+ return o.isWidget ? o.el() : o
716
718
  }
717
719
  };
718
720
  // o -> el, s -> html string/object, r -> where[`after`, `prepend`, `before`, `append`]
@@ -1546,7 +1548,7 @@ $$1.ease = function(fn, ms, count) {
1546
1548
 
1547
1549
  // @a -> widget|HTMLElement, y -> {print: T/F(是否打印), head: "head标签", input2text: T/F(把表单值转为文本)
1548
1550
  $$1.print = function(a, y) {
1549
- let d = a.el ? a.el() : (a.$el || a), w = d.ownerDocument, b = $$1.q('link[media=print]', w), c = [];
1551
+ let d = $$1.el(a), w = d.ownerDocument, b = $$1.q('link[media=print]', w), c = [];
1550
1552
  y = y || {};
1551
1553
  $$1.q('meta', w).each(function() {c.push(this.outerHTML);});
1552
1554
  (b.length > 0 ? b : $$1.q('link', w)).each(function() {c.push('<link rel="stylesheet" type="text/css" href="' + this.getAttribute('href') + '"/>');});
@@ -5518,6 +5520,7 @@ const props = __props;
5518
5520
  const propValue = alias.value || 'id';
5519
5521
  alias.text || 'text';
5520
5522
  const propChildren = alias.children || 'children';
5523
+ const propClass = alias.class || 'class';
5521
5524
 
5522
5525
  const leafSymbol = Symbol('leaf');
5523
5526
  const showCount = ref(0);
@@ -5546,6 +5549,10 @@ const props = __props;
5546
5549
  return s
5547
5550
  };
5548
5551
 
5552
+ const itemClass = (item) => {
5553
+ return typeof propClass === 'function' ? propClass(item) : item[propClass]
5554
+ };
5555
+
5549
5556
  const itemStyle = (item) => {
5550
5557
  return {
5551
5558
  top: `${item[leafSymbol].showIndex * itemHeight}px`,
@@ -5818,7 +5825,7 @@ return (_ctx, _cache) => {
5818
5825
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(showList), (item, index) => {
5819
5826
  return (openBlock(), createElementBlock("div", {
5820
5827
  key: index,
5821
- class: normalizeClass(['w-table-v2-tr', {'z-on': isCurrent(item)}]),
5828
+ class: normalizeClass(['w-table-v2-tr', itemClass(item), {'z-on': isCurrent(item)}]),
5822
5829
  style: normalizeStyle(itemStyle(item)),
5823
5830
  onClick: $event => (clickItem($event, item))
5824
5831
  }, [
@@ -6559,6 +6566,8 @@ const props = __props;
6559
6566
  const propValue = alias.value || 'id';
6560
6567
  const propText = alias.text || 'text';
6561
6568
  const propChildren = alias.children || 'children';
6569
+ const propClass = alias.class || 'class';
6570
+ const propDisabled = alias.disabled || 'disabled';
6562
6571
 
6563
6572
  const leafSymbol = Symbol('leaf');
6564
6573
  const showCount = ref(0);
@@ -6575,6 +6584,10 @@ const props = __props;
6575
6584
  }
6576
6585
  });
6577
6586
 
6587
+ const itemClass = (item, index) => {
6588
+ return typeof propClass === 'function' ? propClass(item, index) : item[propClass]
6589
+ };
6590
+
6578
6591
  const itemStyle = (item) => {
6579
6592
  return {
6580
6593
  top: `${item[leafSymbol].showIndex * itemHeight}px`,
@@ -6598,8 +6611,12 @@ const props = __props;
6598
6611
  return Array.isArray(props.current) ? props.current.includes(item[propValue]) : (props.current === item[propValue])
6599
6612
  };
6600
6613
 
6614
+ const isDisabled = (item, index) => {
6615
+ return typeof propDisabled === 'function' ? propDisabled(item, index) : item[propDisabled]
6616
+ };
6617
+
6601
6618
  const clickItem = (e, item) => {
6602
- emits('click:item', e, item);
6619
+ if (!isDisabled(item)) emits('click:item', e, item);
6603
6620
  };
6604
6621
 
6605
6622
  const clickToggle = (e, item) => {
@@ -6820,7 +6837,7 @@ return (_ctx, _cache) => {
6820
6837
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(showList), (item, index) => {
6821
6838
  return (openBlock(), createElementBlock("div", {
6822
6839
  key: index,
6823
- class: normalizeClass(['w-leaf w-leaf-v2', {'z-folder': isFolder(item), 'z-on': isCurrent(item)}]),
6840
+ class: normalizeClass(['w-leaf w-leaf-v2', itemClass(item, index), {'z-folder': isFolder(item), 'z-on': isCurrent(item), 'z-ds': isDisabled(item, index)}]),
6824
6841
  style: normalizeStyle(itemStyle(item)),
6825
6842
  onClick: $event => (clickItem($event, item))
6826
6843
  }, [