tntd 3.0.47 → 3.0.48-beta.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/es/_util/hooks/useScrollLock.js +68 -0
- package/es/_util/hooks/useScrollLock.js.map +1 -0
- package/es/anchor/anchor.js +96 -0
- package/es/anchor/anchor.js.map +1 -0
- package/es/anchor/anchor.less +79 -0
- package/es/anchor/index.js +7 -9
- package/es/anchor/index.js.map +1 -1
- package/es/array-input/icon.js +36 -0
- package/es/array-input/icon.js.map +1 -0
- package/es/checkbox/checkbox-group.js +16 -0
- package/es/checkbox/checkbox-group.js.map +1 -0
- package/es/ellipsis/index.js +30 -10
- package/es/ellipsis/index.js.map +1 -1
- package/es/form/style/index.less +5 -5
- package/es/index.js +7 -0
- package/es/index.js.map +1 -1
- package/es/page-loading/index.less +4 -4
- package/es/page-loading/loading.gif +0 -0
- package/es/page-loading/loading1.gif +0 -0
- package/es/query-form/Field/Checkbox.js +1 -1
- package/es/query-form/Field/Checkbox.js.map +1 -1
- package/es/query-form/Field/Composition/FieldPopover.js +13 -109
- package/es/query-form/Field/Composition/Select.js +13 -109
- package/es/query-form/Field/Composition/SelectInput.js +10 -87
- package/es/query-form/Field/Composition/ValueTag.js +10 -87
- package/es/query-form/Field/Composition/index.js +17 -121
- package/es/query-form/Field/Composition/utils.js +1 -5
- package/es/query-form/Field/SelectInput.js +16 -12
- package/es/query-form/Field/SelectInput.js.map +1 -1
- package/es/query-form/Field/fieldsMap.js +2 -2
- package/es/query-form/Field/fieldsMap.js.map +1 -1
- package/es/query-form/Field/index.js +2 -1
- package/es/query-form/Field/index.js.map +1 -1
- package/es/query-form/index.js +226 -357
- package/es/query-form/index.js.map +1 -1
- package/es/query-form/index.less +26 -63
- package/es/query-list-scene/List.js +16 -3
- package/es/query-list-scene/List.js.map +1 -1
- package/es/query-list-scene/QueryForm.js +35 -13
- package/es/query-list-scene/QueryForm.js.map +1 -1
- package/es/query-list-scene/index.js +2 -1
- package/es/query-list-scene/index.js.map +1 -1
- package/es/radio/radio-group.js +16 -0
- package/es/radio/radio-group.js.map +1 -0
- package/es/scroll-bar/Bar.js +10 -87
- package/es/scroll-bar/Context.js +1 -5
- package/es/scroll-bar/ScrollBar.js +4 -39
- package/es/scroll-bar/Thumb.js +10 -87
- package/es/scroll-bar/index.js +1 -5
- package/es/scroll-bar/util.js +4 -31
- package/es/steps/stepStyle/small.less +5 -0
- package/es/table/hooks/use-column-setting.js.map +1 -1
- package/es/table/resizableTable/index.js +34 -5
- package/es/table/resizableTable/index.js.map +1 -1
- package/es/table/resizableTable/index.less +9 -1
- package/es/table/table.js +8 -2
- package/es/table/table.js.map +1 -1
- package/es/table/total-shower.js +20 -0
- package/es/table/total-shower.js.map +1 -0
- package/es/tntd-rc-select/style/index.less +20 -2
- package/es/tntd-select/index.js.map +1 -1
- package/es/tntd-virtual-tree/index.js +0 -3
- package/es/tntd-virtual-tree/index.js.map +1 -1
- package/es/tooltip/tooltip.js +19 -5
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/utils/simple-template.js +19 -0
- package/es/utils/simple-template.js.map +1 -0
- package/lib/_util/hooks/useScrollLock.d.ts +9 -0
- package/lib/_util/hooks/useScrollLock.d.ts.map +1 -0
- package/lib/_util/hooks/useScrollLock.js +114 -0
- package/lib/_util/hooks/useScrollLock.js.map +1 -0
- package/lib/anchor/anchor.d.ts +15 -0
- package/lib/anchor/anchor.d.ts.map +1 -0
- package/lib/anchor/anchor.js +131 -0
- package/lib/anchor/anchor.js.map +1 -0
- package/lib/anchor/anchor.less +79 -0
- package/lib/anchor/index.d.ts +3 -2
- package/lib/anchor/index.d.ts.map +1 -1
- package/lib/anchor/index.js +7 -40
- package/lib/anchor/index.js.map +1 -1
- package/lib/array-input/icon.d.ts +4 -0
- package/lib/array-input/icon.d.ts.map +1 -0
- package/lib/array-input/icon.js +36 -0
- package/lib/array-input/icon.js.map +1 -0
- package/lib/checkbox/checkbox-group.d.ts +8 -0
- package/lib/checkbox/checkbox-group.d.ts.map +1 -0
- package/lib/checkbox/checkbox-group.js +16 -0
- package/lib/checkbox/checkbox-group.js.map +1 -0
- package/lib/ellipsis/index.d.ts.map +1 -1
- package/lib/ellipsis/index.js +30 -10
- package/lib/ellipsis/index.js.map +1 -1
- package/lib/form/style/index.less +5 -5
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -1
- package/lib/notification/assets/svg-error-tip.d.ts +1 -1
- package/lib/notification/assets/svg-success-tip.d.ts +1 -1
- package/lib/page-loading/index.less +4 -4
- package/lib/page-loading/loading.gif +0 -0
- package/lib/page-loading/loading1.gif +0 -0
- package/lib/query-form/Field/Checkbox.js +1 -1
- package/lib/query-form/Field/Checkbox.js.map +1 -1
- package/lib/query-form/Field/SelectInput.d.ts.map +1 -1
- package/lib/query-form/Field/SelectInput.js +16 -12
- package/lib/query-form/Field/SelectInput.js.map +1 -1
- package/lib/query-form/Field/fieldsMap.d.ts +6 -3
- package/lib/query-form/Field/fieldsMap.d.ts.map +1 -1
- package/lib/query-form/Field/fieldsMap.js +2 -2
- package/lib/query-form/Field/fieldsMap.js.map +1 -1
- package/lib/query-form/Field/index.d.ts.map +1 -1
- package/lib/query-form/Field/index.js +2 -1
- package/lib/query-form/Field/index.js.map +1 -1
- package/lib/query-form/index.d.ts +1 -36
- package/lib/query-form/index.d.ts.map +1 -1
- package/lib/query-form/index.js +262 -397
- package/lib/query-form/index.js.map +1 -1
- package/lib/query-form/index.less +26 -63
- package/lib/query-list-scene/List.d.ts.map +1 -1
- package/lib/query-list-scene/List.js +16 -3
- package/lib/query-list-scene/List.js.map +1 -1
- package/lib/query-list-scene/QueryForm.d.ts +5 -4
- package/lib/query-list-scene/QueryForm.d.ts.map +1 -1
- package/lib/query-list-scene/QueryForm.js +35 -13
- package/lib/query-list-scene/QueryForm.js.map +1 -1
- package/lib/query-list-scene/index.d.ts.map +1 -1
- package/lib/query-list-scene/index.js +2 -1
- package/lib/query-list-scene/index.js.map +1 -1
- package/lib/radio/radio-group.d.ts +8 -0
- package/lib/radio/radio-group.d.ts.map +1 -0
- package/lib/radio/radio-group.js +16 -0
- package/lib/radio/radio-group.js.map +1 -0
- package/lib/segmented/index.d.ts +1 -1
- package/lib/steps/stepStyle/small.less +5 -0
- package/lib/svg-components/illustration-403.d.ts +1 -1
- package/lib/svg-components/illustration-404.d.ts +1 -1
- package/lib/svg-components/illustration-500.d.ts +1 -1
- package/lib/svg-components/illustration-empty.d.ts +1 -1
- package/lib/svg-components/illustration-failure.d.ts +1 -1
- package/lib/svg-components/illustration-no-access.d.ts +1 -1
- package/lib/svg-components/illustration-no-chart.d.ts +1 -1
- package/lib/svg-components/illustration-no-result.d.ts +1 -1
- package/lib/svg-components/illustration-offline.d.ts +1 -1
- package/lib/svg-components/illustration-success.d.ts +1 -1
- package/lib/table/assets/image-loading-background.d.ts +1 -1
- package/lib/table/assets/image-loading.d.ts +1 -1
- package/lib/table/hooks/use-column-setting.d.ts +1 -0
- package/lib/table/hooks/use-column-setting.d.ts.map +1 -1
- package/lib/table/hooks/use-column-setting.js.map +1 -1
- package/lib/table/resizableTable/index.d.ts +3 -0
- package/lib/table/resizableTable/index.d.ts.map +1 -1
- package/lib/table/resizableTable/index.js +34 -5
- package/lib/table/resizableTable/index.js.map +1 -1
- package/lib/table/resizableTable/index.less +9 -1
- package/lib/table/table.d.ts.map +1 -1
- package/lib/table/table.js +8 -2
- package/lib/table/table.js.map +1 -1
- package/lib/table/total-shower.d.ts +9 -0
- package/lib/table/total-shower.d.ts.map +1 -0
- package/lib/table/total-shower.js +20 -0
- package/lib/table/total-shower.js.map +1 -0
- package/lib/tntd-rc-select/style/index.less +20 -2
- package/lib/tntd-select/index.d.ts.map +1 -1
- package/lib/tntd-select/index.js.map +1 -1
- package/lib/tntd-virtual-tree/index.js +0 -3
- package/lib/tntd-virtual-tree/index.js.map +1 -1
- package/lib/tooltip/tooltip.d.ts +1 -0
- package/lib/tooltip/tooltip.d.ts.map +1 -1
- package/lib/tooltip/tooltip.js +23 -9
- package/lib/tooltip/tooltip.js.map +1 -1
- package/lib/utils/simple-template.d.ts +9 -0
- package/lib/utils/simple-template.d.ts.map +1 -0
- package/lib/utils/simple-template.js +19 -0
- package/lib/utils/simple-template.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _debounce2 = _interopRequireDefault(require("lodash/debounce"));
|
|
8
|
+
var _throttle2 = _interopRequireDefault(require("lodash/throttle"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
function _interopRequireDefault(e) {
|
|
11
|
+
return e && e.__esModule ? e : {
|
|
12
|
+
"default": e
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function _slicedToArray(r, e) {
|
|
16
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
17
|
+
}
|
|
18
|
+
function _nonIterableRest() {
|
|
19
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
20
|
+
}
|
|
21
|
+
function _unsupportedIterableToArray(r, a) {
|
|
22
|
+
if (r) {
|
|
23
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
24
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
25
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function _arrayLikeToArray(r, a) {
|
|
29
|
+
(null == a || a > r.length) && (a = r.length);
|
|
30
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
31
|
+
return n;
|
|
32
|
+
}
|
|
33
|
+
function _iterableToArrayLimit(r, l) {
|
|
34
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
35
|
+
if (null != t) {
|
|
36
|
+
var e,
|
|
37
|
+
n,
|
|
38
|
+
i,
|
|
39
|
+
u,
|
|
40
|
+
a = [],
|
|
41
|
+
f = !0,
|
|
42
|
+
o = !1;
|
|
43
|
+
try {
|
|
44
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
45
|
+
if (Object(t) !== t) return;
|
|
46
|
+
f = !1;
|
|
47
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
48
|
+
} catch (r) {
|
|
49
|
+
o = !0, n = r;
|
|
50
|
+
} finally {
|
|
51
|
+
try {
|
|
52
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
53
|
+
} finally {
|
|
54
|
+
if (o) throw n;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return a;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function _arrayWithHoles(r) {
|
|
61
|
+
if (Array.isArray(r)) return r;
|
|
62
|
+
}
|
|
63
|
+
// ==================== 优化版 Hook ====================
|
|
64
|
+
var _default = exports["default"] = function _default(config) {
|
|
65
|
+
var _ref = config || {},
|
|
66
|
+
_ref$enableScrollObse = _ref.enableScrollObserver,
|
|
67
|
+
enableScrollObserver = _ref$enableScrollObse === void 0 ? true : _ref$enableScrollObse,
|
|
68
|
+
_ref$debounceTime = _ref.debounceTime,
|
|
69
|
+
debounceTime = _ref$debounceTime === void 0 ? 100 : _ref$debounceTime,
|
|
70
|
+
_ref$throttleTime = _ref.throttleTime,
|
|
71
|
+
throttleTime = _ref$throttleTime === void 0 ? 50 : _ref$throttleTime,
|
|
72
|
+
_ref$scrollContainer = _ref.scrollContainer,
|
|
73
|
+
scrollContainer = _ref$scrollContainer === void 0 ? window : _ref$scrollContainer;
|
|
74
|
+
var _useState = (0, _react.useState)(false),
|
|
75
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
76
|
+
isScrolling = _useState2[0],
|
|
77
|
+
setIsScrolling = _useState2[1];
|
|
78
|
+
var throttledHandlerRef = (0, _react.useRef)();
|
|
79
|
+
var debouncedEndRef = (0, _react.useRef)();
|
|
80
|
+
// ==================== 核心逻辑 ====================
|
|
81
|
+
var handleScroll = (0, _react.useCallback)(function () {
|
|
82
|
+
var _a;
|
|
83
|
+
// 标记开始滚动
|
|
84
|
+
setIsScrolling(true);
|
|
85
|
+
// 启动防抖结束检测
|
|
86
|
+
(_a = debouncedEndRef.current) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
87
|
+
debouncedEndRef.current = (0, _debounce2["default"])(function () {
|
|
88
|
+
return setIsScrolling(false);
|
|
89
|
+
}, debounceTime);
|
|
90
|
+
debouncedEndRef.current();
|
|
91
|
+
}, [debounceTime]);
|
|
92
|
+
// ==================== 事件监听 ====================
|
|
93
|
+
(0, _react.useEffect)(function () {
|
|
94
|
+
var container = scrollContainer || window;
|
|
95
|
+
if (!container || !enableScrollObserver) return;
|
|
96
|
+
// 使用 lodash 节流包装处理函数
|
|
97
|
+
throttledHandlerRef.current = (0, _throttle2["default"])(handleScroll, throttleTime, {
|
|
98
|
+
leading: true,
|
|
99
|
+
trailing: true
|
|
100
|
+
});
|
|
101
|
+
var options = {
|
|
102
|
+
passive: true
|
|
103
|
+
};
|
|
104
|
+
container.addEventListener('scroll', throttledHandlerRef.current, options);
|
|
105
|
+
return function () {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
// 清理事件和定时器
|
|
108
|
+
container.removeEventListener('scroll', throttledHandlerRef.current, options);
|
|
109
|
+
(_a = throttledHandlerRef.current) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
110
|
+
(_b = debouncedEndRef.current) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
111
|
+
};
|
|
112
|
+
}, [handleScroll, scrollContainer, enableScrollObserver, throttleTime]);
|
|
113
|
+
return isScrolling;
|
|
114
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollLock.js","sourceRoot":"","sources":["../../../src/_util/hooks/useScrollLock.ts"],"names":[],"mappings":";;AAAA,iCAAgE;AAChE,mCAA2C;AAU3C,qDAAqD;AACrD,kBAAe,CAAC,MAA4B,EAAE,EAAE;IAC9C,MAAM,EACJ,oBAAoB,GAAG,IAAI,EAC3B,YAAY,GAAG,GAAG,EAClB,YAAY,GAAG,EAAE,EACjB,eAAe,GAAG,MAAM,GACzB,GAAG,MAAM,IAAI,EAAE,CAAA;IAEhB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAA;IACrD,MAAM,mBAAmB,GAAG,IAAA,cAAM,GAA+B,CAAA;IACjE,MAAM,eAAe,GAAG,IAAA,cAAM,GAA+B,CAAA;IAE7D,iDAAiD;IACjD,MAAM,YAAY,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;;QACpC,SAAS;QACT,cAAc,CAAC,IAAI,CAAC,CAAA;QAEpB,WAAW;QACX,MAAA,eAAe,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAA;QACjC,eAAe,CAAC,OAAO,GAAG,IAAA,iBAAQ,EAAC,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,CAAA;QAC7E,eAAe,CAAC,OAAO,EAAE,CAAA;IAC3B,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;IAElB,iDAAiD;IACjD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,eAAe,IAAI,MAAM,CAAA;QAC3C,IAAI,CAAC,SAAS,IAAI,CAAC,oBAAoB;YAAE,OAAM;QAE/C,qBAAqB;QACrB,mBAAmB,CAAC,OAAO,GAAG,IAAA,iBAAQ,EAAC,YAAY,EAAE,YAAY,EAAE;YACjE,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CAAA;QAEF,MAAM,OAAO,GAA4B,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;QAC1D,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAE1E,OAAO,GAAG,EAAE;;YACV,WAAW;YACX,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,mBAAmB,CAAC,OAAQ,EAAE,OAAO,CAAC,CAAA;YAC9E,MAAA,mBAAmB,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAA;YACrC,MAAA,eAAe,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAA;QACnC,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,CAAC,CAAC,CAAA;IAEvE,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA","sourcesContent":["import { useState, useEffect, useRef, useCallback } from 'react'\nimport { throttle, debounce } from 'lodash'\n\n// ==================== 类型定义 ====================\ninterface ScrollControlConfig {\n debounceTime?: number // 防抖时间 (默认: 100ms)\n throttleTime?: number // 节流时间 (默认: 50ms)\n scrollContainer?: HTMLElement | Window | null\n enableScrollObserver?: boolean\n}\n\n// ==================== 优化版 Hook ====================\nexport default (config?: ScrollControlConfig) => {\n const {\n enableScrollObserver = true,\n debounceTime = 100,\n throttleTime = 50,\n scrollContainer = window,\n } = config || {}\n\n const [isScrolling, setIsScrolling] = useState(false)\n const throttledHandlerRef = useRef<ReturnType<typeof throttle>>()\n const debouncedEndRef = useRef<ReturnType<typeof debounce>>()\n\n // ==================== 核心逻辑 ====================\n const handleScroll = useCallback(() => {\n // 标记开始滚动\n setIsScrolling(true)\n\n // 启动防抖结束检测\n debouncedEndRef.current?.cancel()\n debouncedEndRef.current = debounce(() => setIsScrolling(false), debounceTime)\n debouncedEndRef.current()\n }, [debounceTime])\n\n // ==================== 事件监听 ====================\n useEffect(() => {\n const container = scrollContainer || window\n if (!container || !enableScrollObserver) return\n\n // 使用 lodash 节流包装处理函数\n throttledHandlerRef.current = throttle(handleScroll, throttleTime, {\n leading: true,\n trailing: true,\n })\n\n const options: AddEventListenerOptions = { passive: true }\n container.addEventListener('scroll', throttledHandlerRef.current, options)\n\n return () => {\n // 清理事件和定时器\n container.removeEventListener('scroll', throttledHandlerRef.current!, options)\n throttledHandlerRef.current?.cancel()\n debouncedEndRef.current?.cancel()\n }\n }, [handleScroll, scrollContainer, enableScrollObserver, throttleTime])\n\n return isScrolling\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AnchorProps as AntdAnchorProps, AnchorLinkProps } from 'antd/lib/anchor';
|
|
3
|
+
import { default as AntdAnchor } from 'antd/lib/anchor';
|
|
4
|
+
import { default as AntdAnchorLink } from 'antd/lib/anchor/AnchorLink';
|
|
5
|
+
export * from 'antd/lib/anchor';
|
|
6
|
+
export interface AnchorProps extends AntdAnchorProps {
|
|
7
|
+
tdAnchor?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const AnchorLink: React.ForwardRefExoticComponent<AnchorLinkProps & React.RefAttributes<AntdAnchorLink>>;
|
|
10
|
+
interface AnchorComponent extends React.ForwardRefExoticComponent<AnchorProps & React.RefAttributes<AntdAnchor>> {
|
|
11
|
+
Link: typeof AnchorLink;
|
|
12
|
+
}
|
|
13
|
+
export declare const Anchor: AnchorComponent;
|
|
14
|
+
export default Anchor;
|
|
15
|
+
//# sourceMappingURL=anchor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/anchor/anchor.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAIrE,cAAc,gBAAgB,CAAA;AAE9B,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAGD,QAAA,MAAM,UAAU,wFAcd,CAAA;AAEF,UAAU,eACR,SAAQ,KAAK,CAAC,yBAAyB,CAAC,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACtF,IAAI,EAAE,OAAO,UAAU,CAAA;CACxB;AAGD,eAAO,MAAM,MAAM,iBAwBE,CAAA;AAMrB,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) {
|
|
4
|
+
"@babel/helpers - typeof";
|
|
5
|
+
|
|
6
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7
|
+
return typeof o;
|
|
8
|
+
} : function (o) {
|
|
9
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10
|
+
}, _typeof(o);
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(exports, "__esModule", {
|
|
13
|
+
value: true
|
|
14
|
+
});
|
|
15
|
+
var _exportNames = {
|
|
16
|
+
Anchor: true
|
|
17
|
+
};
|
|
18
|
+
exports["default"] = exports.Anchor = void 0;
|
|
19
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
20
|
+
var _configProvider = require("../config-provider");
|
|
21
|
+
var _anchor = _interopRequireWildcard(require("antd/lib/anchor"));
|
|
22
|
+
Object.keys(_anchor).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
25
|
+
if (key in exports && exports[key] === _anchor[key]) return;
|
|
26
|
+
Object.defineProperty(exports, key, {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _anchor[key];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
var _AnchorLink = _interopRequireDefault(require("antd/lib/anchor/AnchorLink"));
|
|
34
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
35
|
+
var _useScrollLock = _interopRequireDefault(require("../_util/hooks/useScrollLock"));
|
|
36
|
+
function _interopRequireDefault(e) {
|
|
37
|
+
return e && e.__esModule ? e : {
|
|
38
|
+
"default": e
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function _getRequireWildcardCache(e) {
|
|
42
|
+
if ("function" != typeof WeakMap) return null;
|
|
43
|
+
var r = new WeakMap(),
|
|
44
|
+
t = new WeakMap();
|
|
45
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
46
|
+
return e ? t : r;
|
|
47
|
+
})(e);
|
|
48
|
+
}
|
|
49
|
+
function _interopRequireWildcard(e, r) {
|
|
50
|
+
if (!r && e && e.__esModule) return e;
|
|
51
|
+
if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
|
|
52
|
+
"default": e
|
|
53
|
+
};
|
|
54
|
+
var t = _getRequireWildcardCache(r);
|
|
55
|
+
if (t && t.has(e)) return t.get(e);
|
|
56
|
+
var n = {
|
|
57
|
+
__proto__: null
|
|
58
|
+
},
|
|
59
|
+
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
60
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
61
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
62
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
63
|
+
}
|
|
64
|
+
return n["default"] = e, t && t.set(e, n), n;
|
|
65
|
+
}
|
|
66
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
67
|
+
var t = {};
|
|
68
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
69
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
70
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
71
|
+
}
|
|
72
|
+
return t;
|
|
73
|
+
};
|
|
74
|
+
/*
|
|
75
|
+
* @Author: 周泽飞 zefei.zhou@tongdun.net
|
|
76
|
+
* @Date: 2023-10-26 09:46:28
|
|
77
|
+
* @LastEditors: 周泽飞 zefei.zhou@tongdun.net
|
|
78
|
+
* @LastEditTime: 2023-10-31 09:59:35
|
|
79
|
+
* @FilePath: /tntd/packages/tntd/src/button/button.tsx
|
|
80
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
// 新增 AnchorLink 组件
|
|
84
|
+
var AnchorLink = (0, _react.forwardRef)(function (props, ref) {
|
|
85
|
+
var href = props.href,
|
|
86
|
+
children = props.children,
|
|
87
|
+
restProps = __rest(props
|
|
88
|
+
// 简单的错误处理示例
|
|
89
|
+
, ["href", "children"]);
|
|
90
|
+
// 简单的错误处理示例
|
|
91
|
+
if (typeof href !== 'string') {
|
|
92
|
+
console.error('Invalid href prop. Expected a string.');
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
return _react["default"].createElement(_AnchorLink["default"], Object.assign({
|
|
96
|
+
ref: ref,
|
|
97
|
+
href: href
|
|
98
|
+
}, restProps), children);
|
|
99
|
+
});
|
|
100
|
+
// 新增 Anchor 组件
|
|
101
|
+
var Anchor = exports.Anchor = (0, _react.forwardRef)(function (props, ref) {
|
|
102
|
+
var className = props.className,
|
|
103
|
+
children = props.children,
|
|
104
|
+
_props$tdAnchor = props.tdAnchor,
|
|
105
|
+
tdAnchor = _props$tdAnchor === void 0 ? false : _props$tdAnchor,
|
|
106
|
+
restProps = __rest(props, ["className", "children", "tdAnchor"]);
|
|
107
|
+
var isScrolling = (0, _useScrollLock["default"])({
|
|
108
|
+
debounceTime: 400,
|
|
109
|
+
throttleTime: 50,
|
|
110
|
+
enableScrollObserver: tdAnchor
|
|
111
|
+
});
|
|
112
|
+
return _react["default"].createElement(_configProvider.ConfigConsumer, null, function (_ref) {
|
|
113
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
114
|
+
var prefixCls = getPrefixCls('anchor');
|
|
115
|
+
var anchorClass = (0, _classnames["default"])(prefixCls, className, {
|
|
116
|
+
'tnt-anchor': true,
|
|
117
|
+
'tnt-td-anchor': tdAnchor,
|
|
118
|
+
'tnt-anchor-hide': isScrolling
|
|
119
|
+
});
|
|
120
|
+
return _react["default"].createElement(_anchor["default"], Object.assign({
|
|
121
|
+
ref: ref,
|
|
122
|
+
className: anchorClass
|
|
123
|
+
}, restProps, {
|
|
124
|
+
showInkInFixed: true
|
|
125
|
+
}), children);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
// 新增 AnchorLink 组件
|
|
129
|
+
// 保留 Anchor.Link 的关系
|
|
130
|
+
Anchor.Link = AnchorLink;
|
|
131
|
+
var _default = exports["default"] = Anchor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor.js","sourceRoot":"","sources":["../../src/anchor/anchor.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;GAOG;AACH,+CAAyC;AACzC,wDAAmD;AAEnD,4DAAsD;AACtD,2EAAqE;AACrE,4DAAmC;AACnC,iFAAwD;AAExD,iDAA8B;AAM9B,mBAAmB;AACnB,MAAM,UAAU,GAAG,IAAA,kBAAU,EAAkC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC5E,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAmB,KAAK,EAAnB,SAAS,UAAK,KAAK;IAE9C,YAAY;MAFN,oBAAgC,CAAQ,CAAA;IAE9C,YAAY;IACZ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAA;QACtD,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,CACL,8BAAC,oBAAc,kBAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,IAAM,SAAS,GAChD,QAAQ,CACM,CAClB,CAAA;AACH,CAAC,CAAC,CAAA;AAOF,eAAe;AACF,QAAA,MAAM,GAAG,IAAA,kBAAU,EAA0B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACvE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,KAAmB,KAAK,EAAnB,SAAS,UAAK,KAAK,EAA/D,qCAAuD,CAAQ,CAAA;IACrE,MAAM,WAAW,GAAG,IAAA,uBAAa,EAAC;QAChC,YAAY,EAAE,GAAG;QACjB,YAAY,EAAE,EAAE;QAChB,oBAAoB,EAAE,QAAQ;KAC/B,CAAC,CAAA;IACF,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,MAAM,SAAS,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;QACxC,MAAM,WAAW,GAAG,IAAA,oBAAU,EAAC,SAAS,EAAE,SAAS,EAAE;YACnD,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,QAAQ;YACzB,iBAAiB,EAAE,WAAW;SAC/B,CAAC,CAAA;QACF,OAAO,CACL,8BAAC,gBAAU,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,WAAW,IAAM,SAAS,IAAE,cAAc,EAAE,IAAI,KAC9E,QAAQ,CACE,CACd,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAoB,CAAA;AAErB,mBAAmB;AACnB,qBAAqB;AACrB,cAAM,CAAC,IAAI,GAAG,UAAU,CAAA;AAExB,kBAAe,cAAM,CAAA","sourcesContent":["/*\n * @Author: 周泽飞 zefei.zhou@tongdun.net\n * @Date: 2023-10-26 09:46:28\n * @LastEditors: 周泽飞 zefei.zhou@tongdun.net\n * @LastEditTime: 2023-10-31 09:59:35\n * @FilePath: /tntd/packages/tntd/src/button/button.tsx\n * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE\n */\nimport React, { forwardRef } from 'react'\nimport { ConfigConsumer } from '../config-provider'\nimport type { AnchorProps as AntdAnchorProps, AnchorLinkProps } from 'antd/lib/anchor'\nimport { default as AntdAnchor } from 'antd/lib/anchor'\nimport { default as AntdAnchorLink } from 'antd/lib/anchor/AnchorLink'\nimport classNames from 'classnames'\nimport useScrollLock from '../_util/hooks/useScrollLock'\n\nexport * from 'antd/lib/anchor'\n\nexport interface AnchorProps extends AntdAnchorProps {\n tdAnchor?: boolean\n}\n\n// 新增 AnchorLink 组件\nconst AnchorLink = forwardRef<AntdAnchorLink, AnchorLinkProps>((props, ref) => {\n const { href, children, ...restProps } = props\n\n // 简单的错误处理示例\n if (typeof href !== 'string') {\n console.error('Invalid href prop. Expected a string.')\n return null\n }\n\n return (\n <AntdAnchorLink ref={ref} href={href} {...restProps}>\n {children}\n </AntdAnchorLink>\n )\n})\n\ninterface AnchorComponent\n extends React.ForwardRefExoticComponent<AnchorProps & React.RefAttributes<AntdAnchor>> {\n Link: typeof AnchorLink\n}\n\n// 新增 Anchor 组件\nexport const Anchor = forwardRef<AntdAnchor, AnchorProps>((props, ref) => {\n const { className, children, tdAnchor = false, ...restProps } = props\n const isScrolling = useScrollLock({\n debounceTime: 400,\n throttleTime: 50,\n enableScrollObserver: tdAnchor,\n })\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n const prefixCls = getPrefixCls('anchor')\n const anchorClass = classNames(prefixCls, className, {\n 'tnt-anchor': true,\n 'tnt-td-anchor': tdAnchor,\n 'tnt-anchor-hide': isScrolling,\n })\n return (\n <AntdAnchor ref={ref} className={anchorClass} {...restProps} showInkInFixed={true}>\n {children}\n </AntdAnchor>\n )\n }}\n </ConfigConsumer>\n )\n}) as AnchorComponent\n\n// 新增 AnchorLink 组件\n// 保留 Anchor.Link 的关系\nAnchor.Link = AnchorLink\n\nexport default Anchor\n"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// 使用 Less 变量管理层级参数
|
|
2
|
+
@anchor-level: 10;
|
|
3
|
+
@anchor-indent-step: 8px; // 每级递进步长
|
|
4
|
+
@anchor-active-line-left: 2px; // 激活线基准位置
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
.tnt-td-anchor{
|
|
8
|
+
background: #fff;
|
|
9
|
+
border-radius: calc(@border-radius-base * 2);
|
|
10
|
+
box-shadow: 0 0 20px 0 rgba(0, 0, 0, .05);
|
|
11
|
+
padding: 16px 16px 8px 16px;
|
|
12
|
+
right:0;
|
|
13
|
+
position: absolute;
|
|
14
|
+
|
|
15
|
+
.ant-anchor-ink-ball {
|
|
16
|
+
display: none !important;
|
|
17
|
+
}
|
|
18
|
+
.ant-anchor-link {
|
|
19
|
+
padding: 0 0 0 8px;
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
22
|
+
// 通用激活线样式
|
|
23
|
+
&-active::before {
|
|
24
|
+
content: " ";
|
|
25
|
+
position: absolute;
|
|
26
|
+
left: -@anchor-active-line-left;
|
|
27
|
+
top: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
height: 24px;
|
|
30
|
+
width: @anchor-active-line-left;
|
|
31
|
+
background: @primary-color;
|
|
32
|
+
transition: top 0.3s ease-in-out;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 文字样式统一管理
|
|
36
|
+
&-title {
|
|
37
|
+
color: @text-color-secondary;
|
|
38
|
+
transition: none !important;
|
|
39
|
+
margin-bottom: 0;
|
|
40
|
+
padding-top: 4px;
|
|
41
|
+
padding-bottom: 4px;
|
|
42
|
+
margin-bottom: 10px;
|
|
43
|
+
// 激活状态文字样式
|
|
44
|
+
&.ant-anchor-link-title-active{
|
|
45
|
+
color: @text-color;
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
transition: none !important;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 层级递进生成器
|
|
52
|
+
.level-indent(@level) when (@level < @anchor-level) { // 生成最多10级
|
|
53
|
+
.ant-anchor-link {
|
|
54
|
+
padding-left: @anchor-indent-step;
|
|
55
|
+
|
|
56
|
+
// 激活线递进算法
|
|
57
|
+
&.ant-anchor-link-active::before {
|
|
58
|
+
left: calc(-@anchor-active-line-left - @anchor-indent-step * @level);
|
|
59
|
+
}
|
|
60
|
+
// 递归生成下一级
|
|
61
|
+
.level-indent(@level + 1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 初始化递归生成
|
|
66
|
+
.level-indent(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
.tnt-anchor.tnt-td-anchor{
|
|
73
|
+
&.tnt-anchor-hide{
|
|
74
|
+
width: 32px;
|
|
75
|
+
overflow-x: hidden;
|
|
76
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 平滑缓动曲线 */
|
|
77
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.6, 1); /* 反向缓动 */
|
|
78
|
+
}
|
|
79
|
+
}
|
package/lib/anchor/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/anchor/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/anchor/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAChB,OAAO,eAAe,CAAA;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,cAAc,UAAU,CAAA;AACxB,eAAe,MAAM,CAAA"}
|
package/lib/anchor/index.js
CHANGED
|
@@ -1,55 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) {
|
|
4
|
-
"@babel/helpers - typeof";
|
|
5
|
-
|
|
6
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7
|
-
return typeof o;
|
|
8
|
-
} : function (o) {
|
|
9
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10
|
-
}, _typeof(o);
|
|
11
|
-
}
|
|
12
3
|
Object.defineProperty(exports, "__esModule", {
|
|
13
4
|
value: true
|
|
14
5
|
});
|
|
15
6
|
var _exportNames = {};
|
|
16
7
|
exports["default"] = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
require("./style");
|
|
9
|
+
require("./anchor.less");
|
|
10
|
+
var _anchor2 = require("./anchor");
|
|
11
|
+
Object.keys(_anchor2).forEach(function (key) {
|
|
19
12
|
if (key === "default" || key === "__esModule") return;
|
|
20
13
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
21
|
-
if (key in exports && exports[key] ===
|
|
14
|
+
if (key in exports && exports[key] === _anchor2[key]) return;
|
|
22
15
|
Object.defineProperty(exports, key, {
|
|
23
16
|
enumerable: true,
|
|
24
17
|
get: function get() {
|
|
25
|
-
return
|
|
18
|
+
return _anchor2[key];
|
|
26
19
|
}
|
|
27
20
|
});
|
|
28
21
|
});
|
|
29
|
-
|
|
30
|
-
function _getRequireWildcardCache(e) {
|
|
31
|
-
if ("function" != typeof WeakMap) return null;
|
|
32
|
-
var r = new WeakMap(),
|
|
33
|
-
t = new WeakMap();
|
|
34
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
35
|
-
return e ? t : r;
|
|
36
|
-
})(e);
|
|
37
|
-
}
|
|
38
|
-
function _interopRequireWildcard(e, r) {
|
|
39
|
-
if (!r && e && e.__esModule) return e;
|
|
40
|
-
if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
|
|
41
|
-
"default": e
|
|
42
|
-
};
|
|
43
|
-
var t = _getRequireWildcardCache(r);
|
|
44
|
-
if (t && t.has(e)) return t.get(e);
|
|
45
|
-
var n = {
|
|
46
|
-
__proto__: null
|
|
47
|
-
},
|
|
48
|
-
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
50
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
51
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
52
|
-
}
|
|
53
|
-
return n["default"] = e, t && t.set(e, n), n;
|
|
54
|
-
}
|
|
55
|
-
var _default = exports["default"] = _anchor["default"];
|
|
22
|
+
var _default = exports["default"] = _anchor2.Anchor;
|
package/lib/anchor/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/anchor/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/anchor/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mBAAgB;AAChB,yBAAsB;AACtB,qCAAiC;AACjC,2CAAwB;AACxB,kBAAe,eAAM,CAAA","sourcesContent":["import './style'\nimport './anchor.less'\nimport { Anchor } from './anchor'\nexport * from './anchor'\nexport default Anchor\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/array-input/icon.js"],"names":[],"mappings":"AAEA,yCAaC;AAED,2CAYC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.plusIcon = exports.deleteIcon = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(e) {
|
|
9
|
+
return e && e.__esModule ? e : {
|
|
10
|
+
"default": e
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
var plusIcon = exports.plusIcon = _react["default"].createElement("svg", {
|
|
14
|
+
viewBox: "64 64 896 896",
|
|
15
|
+
focusable: "false",
|
|
16
|
+
"data-icon": "plus-circle",
|
|
17
|
+
width: "1em",
|
|
18
|
+
height: "1em",
|
|
19
|
+
fill: "currentColor",
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
}, _react["default"].createElement("path", {
|
|
22
|
+
d: "M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"
|
|
23
|
+
}), _react["default"].createElement("path", {
|
|
24
|
+
d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"
|
|
25
|
+
}));
|
|
26
|
+
var deleteIcon = exports.deleteIcon = _react["default"].createElement("svg", {
|
|
27
|
+
viewBox: "64 64 896 896",
|
|
28
|
+
focusable: "false",
|
|
29
|
+
"data-icon": "delete",
|
|
30
|
+
width: "1em",
|
|
31
|
+
height: "1em",
|
|
32
|
+
fill: "currentColor",
|
|
33
|
+
"aria-hidden": "true"
|
|
34
|
+
}, _react["default"].createElement("path", {
|
|
35
|
+
d: "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"
|
|
36
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../src/array-input/icon.js"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAEZ,QAAA,QAAQ,GAAG,CACtB,uCACE,OAAO,EAAC,eAAe,EACvB,SAAS,EAAC,OAAO,eACP,aAAa,EACvB,KAAK,EAAC,KAAK,EACX,MAAM,EAAC,KAAK,EACZ,IAAI,EAAC,cAAc,iBACP,MAAM;IAElB,wCAAM,CAAC,EAAC,2LAA2L,GAAQ;IAC3M,wCAAM,CAAC,EAAC,+KAA+K,GAAQ,CAC3L,CACP,CAAA;AAEY,QAAA,UAAU,GAAG,CACxB,uCACE,OAAO,EAAC,eAAe,EACvB,SAAS,EAAC,OAAO,eACP,QAAQ,EAClB,KAAK,EAAC,KAAK,EACX,MAAM,EAAC,KAAK,EACZ,IAAI,EAAC,cAAc,iBACP,MAAM;IAElB,wCAAM,CAAC,EAAC,qVAAqV,GAAQ,CACjW,CACP,CAAA","sourcesContent":["import React from 'react'\n\nexport const plusIcon = (\n <svg\n viewBox=\"64 64 896 896\"\n focusable=\"false\"\n data-icon=\"plus-circle\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path d=\"M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z\"></path>\n <path d=\"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z\"></path>\n </svg>\n)\n\nexport const deleteIcon = (\n <svg\n viewBox=\"64 64 896 896\"\n focusable=\"false\"\n data-icon=\"delete\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path d=\"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z\"></path>\n </svg>\n)\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CheckboxGroupProps as AntdCheckboxGroupProps } from 'antd/lib/checkbox/Group';
|
|
3
|
+
export declare type CheckboxGroupProps = AntdCheckboxGroupProps & {
|
|
4
|
+
readonly?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: React.ForwardRefExoticComponent<AntdCheckboxGroupProps & React.RefAttributes<unknown>>;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=checkbox-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../src/checkbox/checkbox-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,kBAAkB,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAI1F,oBAAY,kBAAkB,GAAG,sBAAsB,GAAG;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;;AAED,wBAA2E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
require("react");
|
|
8
|
+
var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
|
|
9
|
+
var _connect = require("../connect");
|
|
10
|
+
var _previewText = require("../preview-text");
|
|
11
|
+
function _interopRequireDefault(e) {
|
|
12
|
+
return e && e.__esModule ? e : {
|
|
13
|
+
"default": e
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
var _default = exports["default"] = (0, _connect.connectReadonlyComponent)(_checkbox["default"].Group, _previewText.PreviewText.Select);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-group.js","sourceRoot":"","sources":["../../src/checkbox/checkbox-group.tsx"],"names":[],"mappings":";;;;;AAAA,iBAAyC;AACzC,gEAAuC;AAEvC,wCAAqD;AACrD,kDAA6C;AAM7C,kBAAe,IAAA,kCAAwB,EAAC,kBAAQ,CAAC,KAAK,EAAE,0BAAW,CAAC,MAAM,CAAC,CAAA","sourcesContent":["import React, { forwardRef } from 'react'\nimport Checkbox from 'antd/lib/checkbox'\nimport type { CheckboxGroupProps as AntdCheckboxGroupProps } from 'antd/lib/checkbox/Group'\nimport { connectReadonlyComponent } from '../connect'\nimport { PreviewText } from '../preview-text'\n\nexport type CheckboxGroupProps = AntdCheckboxGroupProps & {\n readonly?: boolean\n}\n\nexport default connectReadonlyComponent(Checkbox.Group, PreviewText.Select)\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ellipsis/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ellipsis/index.js"],"names":[],"mappings":"AAkCe,yDAgKd"}
|
package/lib/ellipsis/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var _popover2 = _interopRequireDefault(require("../popover"));
|
|
|
19
19
|
var _tooltip = _interopRequireDefault(require("../tooltip"));
|
|
20
20
|
var _CopySVG = _interopRequireDefault(require("./Svg/CopySVG"));
|
|
21
21
|
var _TickSVG = _interopRequireDefault(require("./Svg/TickSVG"));
|
|
22
|
+
var _useScrollLock = _interopRequireDefault(require("../_util/hooks/useScrollLock"));
|
|
22
23
|
require("./index.less");
|
|
23
24
|
function _getRequireWildcardCache(e) {
|
|
24
25
|
if ("function" != typeof WeakMap) return null;
|
|
@@ -105,15 +106,16 @@ function _arrayWithHoles(r) {
|
|
|
105
106
|
var tolerance = 0; // In px. Depends on the font you are using
|
|
106
107
|
var isEllipsisActive = function isEllipsisActive(e) {
|
|
107
108
|
var _a, _b;
|
|
109
|
+
e.setAttribute('style', '');
|
|
108
110
|
if (e.offsetWidth === e.scrollWidth && e.offsetHeight === e.scrollHeight) {
|
|
109
111
|
var styleStr = 'overflow:visible; ';
|
|
110
112
|
if (!((_b = (_a = e === null || e === void 0 ? void 0 : e.parentNode) === null || _a === void 0 ? void 0 : _a.getAttribute('style')) === null || _b === void 0 ? void 0 : _b.includes('width'))) {
|
|
111
113
|
styleStr += 'max-width:100%;';
|
|
112
114
|
}
|
|
113
115
|
e.parentNode.setAttribute('style', styleStr);
|
|
114
|
-
e.setAttribute(
|
|
116
|
+
e.setAttribute('style', 'overflow:inherit');
|
|
115
117
|
} else {
|
|
116
|
-
e.setAttribute(
|
|
118
|
+
e.setAttribute('style', '');
|
|
117
119
|
}
|
|
118
120
|
return e.offsetWidth + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight;
|
|
119
121
|
};
|
|
@@ -134,7 +136,8 @@ var _default = exports["default"] = function _default(props) {
|
|
|
134
136
|
prefix = props.prefix,
|
|
135
137
|
suffix = props.suffix,
|
|
136
138
|
_props$needRefresh = props.needRefresh,
|
|
137
|
-
needRefresh = _props$needRefresh === void 0 ? true : _props$needRefresh
|
|
139
|
+
needRefresh = _props$needRefresh === void 0 ? true : _props$needRefresh,
|
|
140
|
+
enableScrollObserver = props.enableScrollObserver;
|
|
138
141
|
var _useState = (0, _react.useState)(1),
|
|
139
142
|
_useState2 = _slicedToArray(_useState, 2),
|
|
140
143
|
renderId = _useState2[0],
|
|
@@ -159,12 +162,25 @@ var _default = exports["default"] = function _default(props) {
|
|
|
159
162
|
lineHeight = _useState10[0],
|
|
160
163
|
setLineHeight = _useState10[1];
|
|
161
164
|
var elementRef = (0, _react.useRef)();
|
|
165
|
+
var isScrolling = (0, _useScrollLock["default"])({
|
|
166
|
+
enableScrollObserver: enableScrollObserver
|
|
167
|
+
});
|
|
168
|
+
(0, _react.useEffect)(function () {
|
|
169
|
+
if (isScrolling) {
|
|
170
|
+
setTipVisible(false);
|
|
171
|
+
}
|
|
172
|
+
}, [isScrolling]);
|
|
162
173
|
var computeElement = function computeElement() {
|
|
163
174
|
elementRef.current && isEllipsisActive(elementRef.current) ? setFlag(true) : (setFlag(false), setTipVisible(false));
|
|
164
175
|
if (elementRef.current) {
|
|
165
176
|
setLineHeight(getComputedStyle(elementRef.current, null).getPropertyValue('line-height'));
|
|
166
177
|
}
|
|
167
178
|
};
|
|
179
|
+
(0, _react.useEffect)(function () {
|
|
180
|
+
return function () {
|
|
181
|
+
elementRef.current = null; // 清理引用
|
|
182
|
+
};
|
|
183
|
+
}, []);
|
|
168
184
|
(0, _react.useLayoutEffect)(function () {
|
|
169
185
|
if (needRefresh) {
|
|
170
186
|
setRenderId(function (id) {
|
|
@@ -183,17 +199,18 @@ var _default = exports["default"] = function _default(props) {
|
|
|
183
199
|
computeElement();
|
|
184
200
|
}, [renderId]);
|
|
185
201
|
(0, _react.useEffect)(function () {
|
|
186
|
-
|
|
202
|
+
var handleResize = function handleResize() {
|
|
203
|
+
return computeElement();
|
|
204
|
+
};
|
|
205
|
+
window.addEventListener('resize', handleResize);
|
|
187
206
|
return function () {
|
|
188
|
-
window.removeEventListener('resize',
|
|
207
|
+
window.removeEventListener('resize', handleResize);
|
|
189
208
|
};
|
|
190
209
|
}, []);
|
|
191
210
|
// original Node
|
|
192
211
|
var inner = typeof children === 'string' ? children : _popover ? content : title;
|
|
193
212
|
// for className
|
|
194
|
-
var getClassName =
|
|
195
|
-
return "overflow min-width-0 ".concat(_lines ? 'ellipsis-wrap' : 'ellipsis-nowrap', " ").concat(className || '');
|
|
196
|
-
};
|
|
213
|
+
var getClassName = "overflow min-width-0 ".concat(_lines ? 'ellipsis-wrap' : 'ellipsis-nowrap', " ").concat(className || '');
|
|
197
214
|
// Tooltip.trigger(default 'hover') ==trigger==> onVisibleChange(visible)
|
|
198
215
|
var handleVisibleChange = function handleVisibleChange(visible) {
|
|
199
216
|
// const { onVisibleChange } = props;
|
|
@@ -204,9 +221,12 @@ var _default = exports["default"] = function _default(props) {
|
|
|
204
221
|
var handleCopy = function handleCopy(innerText) {
|
|
205
222
|
(0, _copyToClipboard["default"])(innerText);
|
|
206
223
|
setHasCopy(!hasCopy);
|
|
207
|
-
setTimeout(function () {
|
|
224
|
+
var timer = setTimeout(function () {
|
|
208
225
|
setHasCopy(false);
|
|
209
226
|
}, 1000);
|
|
227
|
+
return function () {
|
|
228
|
+
return clearTimeout(timer);
|
|
229
|
+
}; // 清除定时器
|
|
210
230
|
};
|
|
211
231
|
var renderNode = function renderNode() {
|
|
212
232
|
var popoverNode = _react["default"].createElement(_popover2["default"], Object.assign({}, props, {
|
|
@@ -243,7 +263,7 @@ var _default = exports["default"] = function _default(props) {
|
|
|
243
263
|
maxWidth: widthLimit
|
|
244
264
|
})
|
|
245
265
|
}, prefix && prefix, _react["default"].createElement("div", {
|
|
246
|
-
className: getClassName
|
|
266
|
+
className: getClassName,
|
|
247
267
|
key: renderId
|
|
248
268
|
}, inner || inner === 0 ? renderNode() : emptyText), !!suffix && suffix, (inner || inner === 0) && _copyable && lineHeight && _react["default"].createElement("div", {
|
|
249
269
|
className: "svg-button",
|