weifuwu 0.60.0 → 0.60.1
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/client/index.js +13 -1
- package/dist/components/index.js +25 -19
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -284,6 +284,18 @@ function setProp(el, key, value) {
|
|
|
284
284
|
el.setAttribute(key, String(value));
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
+
var _refChurn = /* @__PURE__ */ new WeakMap();
|
|
288
|
+
function warnRefChurn(el) {
|
|
289
|
+
const entry = _refChurn.get(el) ?? { count: 0, warned: false };
|
|
290
|
+
entry.count++;
|
|
291
|
+
if (entry.count >= 3 && !entry.warned) {
|
|
292
|
+
entry.warned = true;
|
|
293
|
+
console.warn(
|
|
294
|
+
"[weifuwu] ref \u51FD\u6570\u6BCF\u6B21\u6E32\u67D3\u90FD\u53D8\u5316\uFF08\u5185\u8054 ref\uFF09\u2014\u2014ref \u56DE\u8C03\u5728\u6BCF\u6B21\u6E32\u67D3\u540E\u91CD\u65B0\u6267\u884C\uFF08\u6027\u80FD\u635F\u8017\uFF09\u3002\u628A ref \u5B9A\u4E49\u5230 mount \u4F5C\u7528\u57DF\uFF08\u7A33\u5B9A\u5F15\u7528\uFF09\uFF1Aconst listRef = (el) => {...}; return h('div', { ref: listRef })"
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
_refChurn.set(el, entry);
|
|
298
|
+
}
|
|
287
299
|
function patchValue(parent, oldNode, oldInput, newInput, ctx) {
|
|
288
300
|
if (oldInput == null) {
|
|
289
301
|
if (newInput == null) return null;
|
|
@@ -379,8 +391,8 @@ function patchValue(parent, oldNode, oldInput, newInput, ctx) {
|
|
|
379
391
|
const oldRef = oldV.props?.ref;
|
|
380
392
|
const newRef = newV.props?.ref;
|
|
381
393
|
if (oldRef !== newRef) {
|
|
382
|
-
if (typeof oldRef === "function") oldRef(null);
|
|
383
394
|
if (typeof newRef === "function") newRef(oldNode);
|
|
395
|
+
if (typeof oldRef === "function" && typeof newRef === "function") warnRefChurn(oldNode);
|
|
384
396
|
}
|
|
385
397
|
patchProps(oldNode, oldV.props, newV.props);
|
|
386
398
|
patchChildren(oldNode, oldV, newV, ctx);
|
package/dist/components/index.js
CHANGED
|
@@ -987,6 +987,9 @@ var Tabs = (_init, _ctx) => (props) => {
|
|
|
987
987
|
// src/components/Dropdown/Dropdown.ts
|
|
988
988
|
var Dropdown = (_init, ctx) => {
|
|
989
989
|
let wrapEl = null;
|
|
990
|
+
const wrapRef = (el) => {
|
|
991
|
+
wrapEl = el;
|
|
992
|
+
};
|
|
990
993
|
let latestOpen = false;
|
|
991
994
|
let prevOpen = false;
|
|
992
995
|
const pos = ctx.ui.usePopupPosition({
|
|
@@ -1016,9 +1019,7 @@ var Dropdown = (_init, ctx) => {
|
|
|
1016
1019
|
const portalContent = open ? createPortal(menu, "dropdown") : null;
|
|
1017
1020
|
return h("div", {
|
|
1018
1021
|
class: `wf-dropdown${open ? " wf-dropdown--open" : ""}`,
|
|
1019
|
-
ref:
|
|
1020
|
-
wrapEl = el;
|
|
1021
|
-
}
|
|
1022
|
+
ref: wrapRef
|
|
1022
1023
|
}, [trigger, portalContent].filter(Boolean));
|
|
1023
1024
|
};
|
|
1024
1025
|
};
|
|
@@ -1402,6 +1403,10 @@ function formatSize(bytes) {
|
|
|
1402
1403
|
}
|
|
1403
1404
|
var FileUpload = (_init, ctx) => {
|
|
1404
1405
|
const FL = ctx?.i18n?.components?.FileUpload ?? {};
|
|
1406
|
+
let fileInput = null;
|
|
1407
|
+
const fileInputRef = (el) => {
|
|
1408
|
+
if (el) fileInput = el;
|
|
1409
|
+
};
|
|
1405
1410
|
return (props) => {
|
|
1406
1411
|
const { accept, multiple, maxSize, disabled, error, hint, value, onChange, children } = props;
|
|
1407
1412
|
const files = value ?? [];
|
|
@@ -1446,7 +1451,6 @@ var FileUpload = (_init, ctx) => {
|
|
|
1446
1451
|
const updated = files.filter((_, idx) => idx !== i);
|
|
1447
1452
|
onChange?.(updated);
|
|
1448
1453
|
};
|
|
1449
|
-
let fileInput = null;
|
|
1450
1454
|
const inputEl = h("input", {
|
|
1451
1455
|
type: "file",
|
|
1452
1456
|
class: "wf-upload-input",
|
|
@@ -1455,9 +1459,7 @@ var FileUpload = (_init, ctx) => {
|
|
|
1455
1459
|
disabled: disabled || void 0,
|
|
1456
1460
|
onChange: handleChange,
|
|
1457
1461
|
style: { display: "none" },
|
|
1458
|
-
ref:
|
|
1459
|
-
if (el) fileInput = el;
|
|
1460
|
-
}
|
|
1462
|
+
ref: fileInputRef
|
|
1461
1463
|
});
|
|
1462
1464
|
const dropZone = h("div", {
|
|
1463
1465
|
class: `wf-upload-zone${disabled ? " wf-upload-zone--disabled" : ""}${error ? " wf-upload-zone--err" : ""}`,
|
|
@@ -1525,6 +1527,9 @@ function computeFixedPosRect(rect, placement = "bottom", gap = 6, center = true)
|
|
|
1525
1527
|
var Tooltip = (_props, ctx) => {
|
|
1526
1528
|
let show = false;
|
|
1527
1529
|
let wrapEl = null;
|
|
1530
|
+
const wrapRef = (el) => {
|
|
1531
|
+
if (el) wrapEl = el;
|
|
1532
|
+
};
|
|
1528
1533
|
let latestPosition = "top";
|
|
1529
1534
|
let prevOpen = false;
|
|
1530
1535
|
const pos = ctx.ui.usePopupPosition({
|
|
@@ -1554,9 +1559,7 @@ var Tooltip = (_props, ctx) => {
|
|
|
1554
1559
|
const portalContent = !disabled ? createPortal(tip, "tooltip") : null;
|
|
1555
1560
|
return h("div", {
|
|
1556
1561
|
class: "wf-tooltip-wrap",
|
|
1557
|
-
ref:
|
|
1558
|
-
if (el) wrapEl = el;
|
|
1559
|
-
},
|
|
1562
|
+
ref: wrapRef,
|
|
1560
1563
|
onMouseEnter: showe,
|
|
1561
1564
|
onMouseLeave: hide,
|
|
1562
1565
|
onFocus: showe,
|
|
@@ -1622,6 +1625,9 @@ var Drawer = (_props, ctx) => {
|
|
|
1622
1625
|
var Popover = (_props, ctx) => {
|
|
1623
1626
|
let show = false;
|
|
1624
1627
|
let wrapEl = null;
|
|
1628
|
+
const wrapRef = (el) => {
|
|
1629
|
+
if (el) wrapEl = el;
|
|
1630
|
+
};
|
|
1625
1631
|
let latestOpen = false;
|
|
1626
1632
|
let latestPosition = "bottom";
|
|
1627
1633
|
let prevOpen = false;
|
|
@@ -1671,9 +1677,7 @@ var Popover = (_props, ctx) => {
|
|
|
1671
1677
|
const portalContent = isOpen ? createPortal([overlay, popover].filter(Boolean), "popover") : null;
|
|
1672
1678
|
return h("div", {
|
|
1673
1679
|
class: `wf-popover-wrap${isOpen ? " wf-popover-wrap--open" : ""}`,
|
|
1674
|
-
ref:
|
|
1675
|
-
if (el) wrapEl = el;
|
|
1676
|
-
},
|
|
1680
|
+
ref: wrapRef,
|
|
1677
1681
|
...hoverProps,
|
|
1678
1682
|
onClick
|
|
1679
1683
|
}, [children, portalContent].filter(Boolean));
|
|
@@ -1869,6 +1873,9 @@ var DatePicker = (_props, ctx) => {
|
|
|
1869
1873
|
let rangeStart = null;
|
|
1870
1874
|
let rangeEnd = null;
|
|
1871
1875
|
let inputEl = null;
|
|
1876
|
+
const inputRef = (el) => {
|
|
1877
|
+
inputEl = el;
|
|
1878
|
+
};
|
|
1872
1879
|
let prevOpen = false;
|
|
1873
1880
|
const pos = ctx.ui.usePopupPosition({
|
|
1874
1881
|
el: () => inputEl,
|
|
@@ -2131,9 +2138,7 @@ var DatePicker = (_props, ctx) => {
|
|
|
2131
2138
|
type: "text",
|
|
2132
2139
|
placeholder,
|
|
2133
2140
|
value: displayValue || "",
|
|
2134
|
-
ref:
|
|
2135
|
-
inputEl = el;
|
|
2136
|
-
},
|
|
2141
|
+
ref: inputRef,
|
|
2137
2142
|
readonly: true,
|
|
2138
2143
|
disabled,
|
|
2139
2144
|
onClick: toggle
|
|
@@ -2729,6 +2734,9 @@ var Editor = (_props, ctx) => {
|
|
|
2729
2734
|
let tableHoverCol = -1;
|
|
2730
2735
|
let sourceText = "";
|
|
2731
2736
|
let editorEl = null;
|
|
2737
|
+
const editorRef = (el) => {
|
|
2738
|
+
if (el) editorEl = el;
|
|
2739
|
+
};
|
|
2732
2740
|
let savedRange = null;
|
|
2733
2741
|
const saveSelection = () => {
|
|
2734
2742
|
const sel = window.getSelection();
|
|
@@ -3032,9 +3040,7 @@ var Editor = (_props, ctx) => {
|
|
|
3032
3040
|
onKeyUp: handleKeyUp,
|
|
3033
3041
|
onMouseUp: handleMouseUp,
|
|
3034
3042
|
onMouseDown: handleMouseDown,
|
|
3035
|
-
ref:
|
|
3036
|
-
if (el) editorEl = el;
|
|
3037
|
-
}
|
|
3043
|
+
ref: editorRef
|
|
3038
3044
|
});
|
|
3039
3045
|
} else {
|
|
3040
3046
|
editorBody = h("textarea", {
|