@pisell/materials 1.0.1062 → 1.0.1064
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +9 -9
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +22 -22
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +26 -26
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.js +43 -31
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.js +60 -16
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.less +8 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.js +22 -12
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.less +7 -5
- package/es/components/pisellFloorMapLayout/components/MapLayer.js +5 -2
- package/es/components/pisellFloorMapLayout/components/ViewControls.d.ts +4 -0
- package/es/components/pisellFloorMapLayout/components/ViewControls.js +29 -10
- package/es/components/pisellFloorMapLayout/components/ViewControls.less +36 -12
- package/es/components/pisellFloorMapLayout/components/ViewControlsWithZoom.d.ts +2 -0
- package/es/components/pisellFloorMapLayout/components/ViewControlsWithZoom.js +3 -1
- package/es/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.js +2 -2
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +1 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEditState.js +166 -43
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.d.ts +1 -1
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.js +90 -13
- package/es/components/pisellFloorMapLayout/index.d.ts +2 -0
- package/es/components/pisellFloorMapLayout/index.js +2 -0
- package/es/components/pisellFloorMapLayout/locales.d.ts +6 -0
- package/es/components/pisellFloorMapLayout/locales.js +9 -3
- package/es/components/pisellFloorMapLayout/types.d.ts +9 -2
- package/es/components/pisellFloorMapLayout/utils/floorMapDropUtils.d.ts +1 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapDropUtils.js +10 -1
- package/es/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.d.ts +11 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.js +86 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapFallbackRender.js +3 -2
- package/es/components/pisellRecordBoard/PisellRecordBoard.js +6 -3
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +1 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.js +21 -10
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/recordBoardToolbar.less +23 -0
- package/es/components/pisellRecordBoard/shellFrame/index.d.ts +2 -0
- package/es/components/pisellRecordBoard/shellFrame/index.js +9 -3
- package/es/components/pisellRecordBoard/shellFrame/shellFrameFloorMap.less +25 -0
- package/es/components/pisellRecordBoard/types.d.ts +6 -0
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.js +4 -1
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.less +18 -1
- package/es/components/pisellReservationScheduleBand/types.d.ts +4 -0
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.js +187 -29
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.less +11 -0
- package/es/components/pisellTimeNavigator/components/CursorLayer.d.ts +7 -1
- package/es/components/pisellTimeNavigator/components/CursorLayer.js +27 -7
- package/es/components/pisellTimeNavigator/components/GestureLayer.d.ts +3 -1
- package/es/components/pisellTimeNavigator/components/GestureLayer.js +14 -5
- package/es/components/pisellTimeNavigator/components/ScaleLayer.d.ts +6 -1
- package/es/components/pisellTimeNavigator/components/ScaleLayer.js +28 -6
- package/es/components/pisellTimeNavigator/types.d.ts +11 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.js +39 -36
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.js +56 -12
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.less +8 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.js +19 -10
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.less +7 -5
- package/lib/components/pisellFloorMapLayout/components/MapLayer.js +3 -1
- package/lib/components/pisellFloorMapLayout/components/ViewControls.d.ts +4 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControls.js +28 -6
- package/lib/components/pisellFloorMapLayout/components/ViewControls.less +36 -12
- package/lib/components/pisellFloorMapLayout/components/ViewControlsWithZoom.d.ts +2 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControlsWithZoom.js +3 -1
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +1 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEditState.js +143 -29
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.d.ts +1 -1
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.js +86 -13
- package/lib/components/pisellFloorMapLayout/index.d.ts +2 -0
- package/lib/components/pisellFloorMapLayout/index.js +6 -0
- package/lib/components/pisellFloorMapLayout/locales.d.ts +6 -0
- package/lib/components/pisellFloorMapLayout/locales.js +9 -3
- package/lib/components/pisellFloorMapLayout/types.d.ts +9 -2
- package/lib/components/pisellFloorMapLayout/utils/floorMapDropUtils.d.ts +1 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapDropUtils.js +7 -1
- package/lib/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.d.ts +11 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.js +69 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapFallbackRender.js +2 -1
- package/lib/components/pisellRecordBoard/PisellRecordBoard.js +5 -1
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +1 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.js +13 -5
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/recordBoardToolbar.less +23 -0
- package/lib/components/pisellRecordBoard/shellFrame/index.d.ts +2 -0
- package/lib/components/pisellRecordBoard/shellFrame/index.js +11 -4
- package/lib/components/pisellRecordBoard/shellFrame/shellFrameFloorMap.less +25 -0
- package/lib/components/pisellRecordBoard/types.d.ts +6 -0
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.js +2 -1
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.less +18 -1
- package/lib/components/pisellReservationScheduleBand/types.d.ts +4 -0
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.js +176 -8
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.less +11 -0
- package/lib/components/pisellTimeNavigator/components/CursorLayer.d.ts +7 -1
- package/lib/components/pisellTimeNavigator/components/CursorLayer.js +24 -3
- package/lib/components/pisellTimeNavigator/components/GestureLayer.d.ts +3 -1
- package/lib/components/pisellTimeNavigator/components/GestureLayer.js +16 -5
- package/lib/components/pisellTimeNavigator/components/ScaleLayer.d.ts +6 -1
- package/lib/components/pisellTimeNavigator/components/ScaleLayer.js +24 -3
- package/lib/components/pisellTimeNavigator/types.d.ts +11 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +8 -0
- package/lowcode/floor-map-image-element/meta.ts +113 -0
- package/lowcode/floor-map-layout-provider/meta.ts +1 -1
- package/lowcode/pisell-floor-map-layout/meta.ts +37 -1
- package/lowcode/render-figma-style-round-table-card/meta.ts +1 -1
- package/lowcode/render-figma-style-table-card/meta.ts +1 -1
- package/package.json +3 -3
|
@@ -4,6 +4,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
12
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -32,9 +36,11 @@ var CURSOR_MOVES_NOW_RESERVE_PX = 56;
|
|
|
32
36
|
var CURSOR_MOVES_H_PADDING_PX = 8;
|
|
33
37
|
/** cursor-moves 横向:每格最小宽度(再小刻度不可读) */
|
|
34
38
|
var CURSOR_MOVES_MIN_CELL_PX = 8;
|
|
39
|
+
/** 密度层高度:时间轴 48px 内留少量上下边距 */
|
|
40
|
+
var DENSITY_LAYER_HEIGHT = 46;
|
|
35
41
|
|
|
36
|
-
/**
|
|
37
|
-
* PisellTimeNavigator:可拖动的时间导航轴,时间范围内浏览、选择、控制
|
|
42
|
+
/**
|
|
43
|
+
* PisellTimeNavigator:可拖动的时间导航轴,时间范围内浏览、选择、控制
|
|
38
44
|
*/
|
|
39
45
|
export function PisellTimeNavigator(props) {
|
|
40
46
|
var _context$engine;
|
|
@@ -74,12 +80,14 @@ export function PisellTimeNavigator(props) {
|
|
|
74
80
|
_props$timeFormat = props.timeFormat,
|
|
75
81
|
timeFormat = _props$timeFormat === void 0 ? 'HH:mm' : _props$timeFormat,
|
|
76
82
|
renderNowButton = props.renderNowButton,
|
|
77
|
-
onUserInteraction = props.onUserInteraction
|
|
83
|
+
onUserInteraction = props.onUserInteraction,
|
|
84
|
+
densitySeriesProp = props.densitySeries,
|
|
85
|
+
loadDensityProp = props.loadDensity;
|
|
78
86
|
var context = useEngineContext();
|
|
79
87
|
locales.init(pisellTimeNavigatorLocales, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || 'en');
|
|
80
88
|
|
|
81
|
-
/**
|
|
82
|
-
* 锚定日历日:传入 prop 时以 prop 为准;不传则每帧取当天 0 点(与历史行为一致,便于跨自然日)
|
|
89
|
+
/**
|
|
90
|
+
* 锚定日历日:传入 prop 时以 prop 为准;不传则每帧取当天 0 点(与历史行为一致,便于跨自然日)
|
|
83
91
|
*/
|
|
84
92
|
var referenceDateFromProp = useMemo(function () {
|
|
85
93
|
if (referenceDateProp == null) return undefined;
|
|
@@ -88,14 +96,53 @@ export function PisellTimeNavigator(props) {
|
|
|
88
96
|
}, [referenceDateProp]);
|
|
89
97
|
var referenceDate = referenceDateFromProp !== null && referenceDateFromProp !== void 0 ? referenceDateFromProp : dayjs().startOf('day');
|
|
90
98
|
var isHorizontal = orientation === 'horizontal';
|
|
99
|
+
|
|
100
|
+
/** 按自然日稳定依赖,避免无 referenceDate prop 时每次 render 新建 dayjs 触发重复 loadDensity */
|
|
101
|
+
var referenceDayKey = referenceDateFromProp != null ? referenceDateFromProp.format('YYYY-MM-DD') : dayjs().format('YYYY-MM-DD');
|
|
102
|
+
var _useState = useState(),
|
|
103
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
104
|
+
densityLoaded = _useState2[0],
|
|
105
|
+
setDensityLoaded = _useState2[1];
|
|
106
|
+
var densityReqId = useRef(0);
|
|
107
|
+
var densityGradientId = useMemo(function () {
|
|
108
|
+
return "pisell-time-density-fill-".concat(Math.random().toString(36).slice(2, 8));
|
|
109
|
+
}, []);
|
|
110
|
+
useEffect(function () {
|
|
111
|
+
if (densitySeriesProp !== undefined) {
|
|
112
|
+
setDensityLoaded(undefined);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (!loadDensityProp) {
|
|
116
|
+
setDensityLoaded(undefined);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
var req = ++densityReqId.current;
|
|
120
|
+
var cancelled = false;
|
|
121
|
+
setDensityLoaded(undefined);
|
|
122
|
+
var refDay = dayjs(referenceDayKey).startOf('day');
|
|
123
|
+
void loadDensityProp({
|
|
124
|
+
referenceDate: refDay,
|
|
125
|
+
stepMinutes: stepMinutes
|
|
126
|
+
}).then(function (arr) {
|
|
127
|
+
if (cancelled || req !== densityReqId.current) return;
|
|
128
|
+
setDensityLoaded(Array.isArray(arr) ? arr : []);
|
|
129
|
+
}).catch(function () {
|
|
130
|
+
if (cancelled || req !== densityReqId.current) return;
|
|
131
|
+
setDensityLoaded(undefined);
|
|
132
|
+
});
|
|
133
|
+
return function () {
|
|
134
|
+
cancelled = true;
|
|
135
|
+
};
|
|
136
|
+
}, [referenceDayKey, stepMinutes, loadDensityProp, densitySeriesProp]);
|
|
137
|
+
var resolvedDensity = densitySeriesProp !== undefined ? densitySeriesProp : densityLoaded;
|
|
91
138
|
var isAxisMoves = cursorMode === 'axis-moves';
|
|
92
|
-
var
|
|
139
|
+
var _useState3 = useState({
|
|
93
140
|
w: 0,
|
|
94
141
|
h: 0
|
|
95
142
|
}),
|
|
96
|
-
|
|
97
|
-
viewportSize =
|
|
98
|
-
setViewportSize =
|
|
143
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
144
|
+
viewportSize = _useState4[0],
|
|
145
|
+
setViewportSize = _useState4[1];
|
|
99
146
|
|
|
100
147
|
/** 挂载和视口变化时同步尺寸(需在 cellSize 计算之前声明 state) */
|
|
101
148
|
var viewportWrapRef = useRef(null);
|
|
@@ -142,14 +189,54 @@ export function PisellTimeNavigator(props) {
|
|
|
142
189
|
orientation: orientation,
|
|
143
190
|
cellSizePx: cellSizePx
|
|
144
191
|
});
|
|
192
|
+
var horizontalDensityCurve = useMemo(function () {
|
|
193
|
+
if (!isHorizontal || !(resolvedDensity !== null && resolvedDensity !== void 0 && resolvedDensity.length)) return null;
|
|
194
|
+
var ticksN = axis.ticks.length;
|
|
195
|
+
var n = Math.min(resolvedDensity.length, ticksN);
|
|
196
|
+
if (n < 2) return null;
|
|
197
|
+
var slice = resolvedDensity.slice(0, n);
|
|
198
|
+
var maxV = Math.max.apply(Math, _toConsumableArray(slice).concat([0]));
|
|
199
|
+
var minV = Math.min.apply(Math, _toConsumableArray(slice).concat([0]));
|
|
200
|
+
var span = Math.max(1, maxV - minV);
|
|
201
|
+
var h = DENSITY_LAYER_HEIGHT;
|
|
202
|
+
var points = slice.map(function (v, i) {
|
|
203
|
+
var x = i * cellSizePx + cellSizePx / 2;
|
|
204
|
+
/** 映射到 [0,1]:最低值贴底,最高值接近顶部,基本吃满密度层高度 */
|
|
205
|
+
var t = (v - minV) / span;
|
|
206
|
+
var y = h - 1 - t * (h - 3);
|
|
207
|
+
return {
|
|
208
|
+
x: x,
|
|
209
|
+
y: y
|
|
210
|
+
};
|
|
211
|
+
});
|
|
212
|
+
var first = points[0];
|
|
213
|
+
var last = points[points.length - 1];
|
|
214
|
+
var linePath = "M ".concat(first.x, " ").concat(first.y);
|
|
215
|
+
for (var i = 0; i < points.length - 1; i += 1) {
|
|
216
|
+
var p0 = points[i];
|
|
217
|
+
var p1 = points[i + 1];
|
|
218
|
+
var cx = (p0.x + p1.x) / 2;
|
|
219
|
+
var cy = (p0.y + p1.y) / 2;
|
|
220
|
+
linePath += " Q ".concat(p0.x, " ").concat(p0.y, " ").concat(cx, " ").concat(cy);
|
|
221
|
+
}
|
|
222
|
+
linePath += " T ".concat(last.x, " ").concat(last.y);
|
|
223
|
+
var areaPath = "".concat(linePath, " L ").concat(last.x, " ").concat(h, " L ").concat(first.x, " ").concat(h, " Z");
|
|
224
|
+
return {
|
|
225
|
+
points: points,
|
|
226
|
+
linePath: linePath,
|
|
227
|
+
areaPath: areaPath,
|
|
228
|
+
h: h,
|
|
229
|
+
w: axis.totalLengthPx
|
|
230
|
+
};
|
|
231
|
+
}, [isHorizontal, resolvedDensity, axis.ticks, axis.totalLengthPx, cellSizePx]);
|
|
145
232
|
var isControlled = valueProp !== undefined;
|
|
146
|
-
var
|
|
233
|
+
var _useState5 = useState(function () {
|
|
147
234
|
var v = valueProp !== null && valueProp !== void 0 ? valueProp : defaultValue;
|
|
148
235
|
return parseValue(v, referenceDate);
|
|
149
236
|
}),
|
|
150
|
-
|
|
151
|
-
internalValue =
|
|
152
|
-
setInternalValue =
|
|
237
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
238
|
+
internalValue = _useState6[0],
|
|
239
|
+
setInternalValue = _useState6[1];
|
|
153
240
|
var value = isControlled ? valueProp != null ? parseValue(valueProp, referenceDate) : null : internalValue;
|
|
154
241
|
var effectiveValue = value !== null && value !== void 0 ? value : axis.rangeStart;
|
|
155
242
|
var scrollRef = useRef(null);
|
|
@@ -159,17 +246,17 @@ export function PisellTimeNavigator(props) {
|
|
|
159
246
|
var valueUpdatedByScrollRef = useRef(false);
|
|
160
247
|
/** 手指是否仍按在滚动区域上;仅当完全松手后才执行吸附 */
|
|
161
248
|
var isPointerDownRef = useRef(false);
|
|
162
|
-
var
|
|
249
|
+
var _useState7 = useState({
|
|
163
250
|
scrollLeft: 0,
|
|
164
251
|
scrollTop: 0
|
|
165
252
|
}),
|
|
166
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
167
|
-
scrollPosition = _useState6[0],
|
|
168
|
-
setScrollPosition = _useState6[1];
|
|
169
|
-
/** 每分钟更新一次,使当前时间线/渐变块随真实时间移动 */
|
|
170
|
-
var _useState7 = useState(0),
|
|
171
253
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
172
|
-
|
|
254
|
+
scrollPosition = _useState8[0],
|
|
255
|
+
setScrollPosition = _useState8[1];
|
|
256
|
+
/** 每分钟更新一次,使当前时间线/渐变块随真实时间移动 */
|
|
257
|
+
var _useState9 = useState(0),
|
|
258
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
259
|
+
setNowTick = _useState10[1];
|
|
173
260
|
useEffect(function () {
|
|
174
261
|
var id = setInterval(function () {
|
|
175
262
|
return setNowTick(function (n) {
|
|
@@ -208,6 +295,43 @@ export function PisellTimeNavigator(props) {
|
|
|
208
295
|
var axisStartMarginW = isHorizontal && !isAxisMoves ? CURSOR_MOVES_H_PADDING_PX : Math.max(0, halfViewportW - dotOffsetPx);
|
|
209
296
|
var axisStartMarginH = Math.max(0, halfViewportH - dotOffsetPx);
|
|
210
297
|
|
|
298
|
+
/**
|
|
299
|
+
* 横向 axis-wrap:无 Now 时用 width:100% + minWidth:自然内容宽,铺满滚动视口;内容更长时仍可横向滚动。
|
|
300
|
+
* 依赖 effectiveViewportW(须在 viewportSize 之后计算)。
|
|
301
|
+
*/
|
|
302
|
+
var horizontalAxisWrapStyle = useMemo(function () {
|
|
303
|
+
if (!isHorizontal) return null;
|
|
304
|
+
var minHeight = 48;
|
|
305
|
+
if (isAxisMoves) {
|
|
306
|
+
var _natural = axis.totalLengthPx + (effectiveViewportW - cellSizePx);
|
|
307
|
+
if (!showNowButton) {
|
|
308
|
+
return {
|
|
309
|
+
width: '100%',
|
|
310
|
+
minWidth: _natural,
|
|
311
|
+
minHeight: minHeight,
|
|
312
|
+
boxSizing: 'border-box'
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
return {
|
|
316
|
+
width: _natural,
|
|
317
|
+
minHeight: minHeight
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
var natural = CURSOR_MOVES_H_PADDING_PX + axis.totalLengthPx + CURSOR_MOVES_H_PADDING_PX;
|
|
321
|
+
if (!showNowButton) {
|
|
322
|
+
return {
|
|
323
|
+
width: '100%',
|
|
324
|
+
minWidth: natural,
|
|
325
|
+
minHeight: minHeight,
|
|
326
|
+
boxSizing: 'border-box'
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
width: natural,
|
|
331
|
+
minHeight: minHeight
|
|
332
|
+
};
|
|
333
|
+
}, [isHorizontal, isAxisMoves, axis.totalLengthPx, effectiveViewportW, cellSizePx, showNowButton]);
|
|
334
|
+
|
|
211
335
|
/** 拖动中:用连续映射按 1 分钟步长显示时间(不吸附到 stepMinutes) */
|
|
212
336
|
var handleScroll = useCallback(function (data) {
|
|
213
337
|
/** 程序性滚动到中心(如点 Now)过程中不更新任何状态,避免时间轴再动、value 被覆盖 */
|
|
@@ -327,9 +451,9 @@ export function PisellTimeNavigator(props) {
|
|
|
327
451
|
// 以点为基准:有留白时 targetScroll = cursorOffsetPx - dotOffsetPx(使该点对准视口中心)
|
|
328
452
|
var SCROLL_SYNC_THRESHOLD_PX = 2;
|
|
329
453
|
var hasScrollPadding = isHorizontal ? effectiveViewportW > 0 : effectiveViewportH > 0;
|
|
330
|
-
/**
|
|
331
|
-
* 竖向:上留白用 axis marginTop,下留白用 axis marginBottom(均为半屏)
|
|
332
|
-
* axis-wrap 高度 = marginTop + 轴内容 + marginBottom
|
|
454
|
+
/**
|
|
455
|
+
* 竖向:上留白用 axis marginTop,下留白用 axis marginBottom(均为半屏)
|
|
456
|
+
* axis-wrap 高度 = marginTop + 轴内容 + marginBottom
|
|
333
457
|
*/
|
|
334
458
|
var verticalTailPx = effectiveViewportH / 2;
|
|
335
459
|
var verticalWrapHeight = axisStartMarginH + axis.totalLengthPx + verticalTailPx;
|
|
@@ -519,11 +643,7 @@ export function PisellTimeNavigator(props) {
|
|
|
519
643
|
onPointerLeave: inertiaHandlers.onPointerUp
|
|
520
644
|
}, /*#__PURE__*/React.createElement("div", {
|
|
521
645
|
className: "pisell-time-navigator-axis-wrap",
|
|
522
|
-
style: isHorizontal ?
|
|
523
|
-
width: axis.totalLengthPx + (effectiveViewportW - cellSizePx),
|
|
524
|
-
minHeight: 48
|
|
525
|
-
} : {
|
|
526
|
-
width: CURSOR_MOVES_H_PADDING_PX + axis.totalLengthPx + CURSOR_MOVES_H_PADDING_PX,
|
|
646
|
+
style: isHorizontal ? horizontalAxisWrapStyle !== null && horizontalAxisWrapStyle !== void 0 ? horizontalAxisWrapStyle : {
|
|
527
647
|
minHeight: 48
|
|
528
648
|
} : {
|
|
529
649
|
width: '100%'
|
|
@@ -555,7 +675,45 @@ export function PisellTimeNavigator(props) {
|
|
|
555
675
|
orientation: orientation,
|
|
556
676
|
pastTimeFade: pastTimeFade,
|
|
557
677
|
businessHoursPx: businessHoursPx
|
|
558
|
-
}), /*#__PURE__*/React.createElement(
|
|
678
|
+
}), horizontalDensityCurve ? /*#__PURE__*/React.createElement("svg", {
|
|
679
|
+
className: "pisell-time-navigator-density-layer",
|
|
680
|
+
width: horizontalDensityCurve.w,
|
|
681
|
+
height: horizontalDensityCurve.h,
|
|
682
|
+
viewBox: "0 0 ".concat(horizontalDensityCurve.w, " ").concat(horizontalDensityCurve.h),
|
|
683
|
+
preserveAspectRatio: "none",
|
|
684
|
+
"aria-hidden": true
|
|
685
|
+
}, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
686
|
+
id: densityGradientId,
|
|
687
|
+
x1: "0",
|
|
688
|
+
y1: "0",
|
|
689
|
+
x2: "0",
|
|
690
|
+
y2: "1"
|
|
691
|
+
}, /*#__PURE__*/React.createElement("stop", {
|
|
692
|
+
offset: "0%",
|
|
693
|
+
stopColor: "#ff9c66",
|
|
694
|
+
stopOpacity: "0.32"
|
|
695
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
696
|
+
offset: "100%",
|
|
697
|
+
stopColor: "#ff9c66",
|
|
698
|
+
stopOpacity: "0.02"
|
|
699
|
+
}))), /*#__PURE__*/React.createElement("path", {
|
|
700
|
+
d: horizontalDensityCurve.areaPath,
|
|
701
|
+
fill: "url(#".concat(densityGradientId, ")")
|
|
702
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
703
|
+
d: horizontalDensityCurve.linePath,
|
|
704
|
+
fill: "none",
|
|
705
|
+
stroke: "#ff8a4a",
|
|
706
|
+
strokeWidth: 1.8,
|
|
707
|
+
vectorEffect: "non-scaling-stroke"
|
|
708
|
+
}), horizontalDensityCurve.points.map(function (p, i) {
|
|
709
|
+
return /*#__PURE__*/React.createElement("circle", {
|
|
710
|
+
key: i,
|
|
711
|
+
cx: p.x,
|
|
712
|
+
cy: p.y,
|
|
713
|
+
r: 1.4,
|
|
714
|
+
fill: "#ff8a4a"
|
|
715
|
+
});
|
|
716
|
+
})) : null, /*#__PURE__*/React.createElement(ScaleLayer, {
|
|
559
717
|
orientation: orientation,
|
|
560
718
|
ticks: axis.ticks,
|
|
561
719
|
stepMinutes: stepMinutes,
|
|
@@ -128,6 +128,15 @@
|
|
|
128
128
|
flex-shrink: 0;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
.pisell-time-navigator-density-layer {
|
|
132
|
+
position: absolute;
|
|
133
|
+
left: 0;
|
|
134
|
+
top: 1px;
|
|
135
|
+
z-index: 0;
|
|
136
|
+
pointer-events: none;
|
|
137
|
+
overflow: visible;
|
|
138
|
+
}
|
|
139
|
+
|
|
131
140
|
/* 背景层(营业时间、过去时间淡化等;当前时间渐变已拆出为独立块) */
|
|
132
141
|
.pisell-time-navigator-background {
|
|
133
142
|
position: absolute;
|
|
@@ -369,6 +378,8 @@
|
|
|
369
378
|
|
|
370
379
|
&--horizontal {
|
|
371
380
|
height: 100%;
|
|
381
|
+
width: 100%;
|
|
382
|
+
box-sizing: border-box;
|
|
372
383
|
}
|
|
373
384
|
|
|
374
385
|
&--vertical {
|
|
@@ -11,10 +11,16 @@ export interface CursorLayerProps {
|
|
|
11
11
|
fixedCenter?: boolean;
|
|
12
12
|
style?: React.CSSProperties;
|
|
13
13
|
className?: string;
|
|
14
|
+
/** cursor-moves:允许拖指针改时间 */
|
|
15
|
+
dragInteractive?: boolean;
|
|
16
|
+
onDragPointerDown?: React.PointerEventHandler<HTMLDivElement>;
|
|
17
|
+
onDragPointerMove?: React.PointerEventHandler<HTMLDivElement>;
|
|
18
|
+
onDragPointerUp?: React.PointerEventHandler<HTMLDivElement>;
|
|
19
|
+
onDragPointerCancel?: React.PointerEventHandler<HTMLDivElement>;
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
16
22
|
* 时间指示器层:竖线/横线 + 时间气泡
|
|
17
23
|
* 对齐基准为内部的竖线/横线,不是整块(气泡)的边或中心。
|
|
18
24
|
* 横向:竖线 3px;竖向:横线 2px。Realtime 态 #FF692E,浏览态 #344054
|
|
19
25
|
*/
|
|
20
|
-
export declare function CursorLayer({ orientation, value, timeFormat, locale, isRealtime, offsetPx, fixedCenter, style, className, }: CursorLayerProps): JSX.Element | null;
|
|
26
|
+
export declare function CursorLayer({ orientation, value, timeFormat, locale, isRealtime, offsetPx, fixedCenter, style, className, dragInteractive, onDragPointerDown, onDragPointerMove, onDragPointerUp, onDragPointerCancel, }: CursorLayerProps): JSX.Element | null;
|
|
@@ -10,10 +10,10 @@ import classNames from 'classnames';
|
|
|
10
10
|
var CURSOR_LINE_WIDTH_H = 3;
|
|
11
11
|
var CURSOR_LINE_HEIGHT_V = 2;
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* 时间指示器层:竖线/横线 + 时间气泡
|
|
15
|
-
* 对齐基准为内部的竖线/横线,不是整块(气泡)的边或中心。
|
|
16
|
-
* 横向:竖线 3px;竖向:横线 2px。Realtime 态 #FF692E,浏览态 #344054
|
|
13
|
+
/**
|
|
14
|
+
* 时间指示器层:竖线/横线 + 时间气泡
|
|
15
|
+
* 对齐基准为内部的竖线/横线,不是整块(气泡)的边或中心。
|
|
16
|
+
* 横向:竖线 3px;竖向:横线 2px。Realtime 态 #FF692E,浏览态 #344054
|
|
17
17
|
*/
|
|
18
18
|
export function CursorLayer(_ref) {
|
|
19
19
|
var orientation = _ref.orientation,
|
|
@@ -24,20 +24,40 @@ export function CursorLayer(_ref) {
|
|
|
24
24
|
offsetPx = _ref.offsetPx,
|
|
25
25
|
fixedCenter = _ref.fixedCenter,
|
|
26
26
|
style = _ref.style,
|
|
27
|
-
className = _ref.className
|
|
27
|
+
className = _ref.className,
|
|
28
|
+
dragInteractive = _ref.dragInteractive,
|
|
29
|
+
onDragPointerDown = _ref.onDragPointerDown,
|
|
30
|
+
onDragPointerMove = _ref.onDragPointerMove,
|
|
31
|
+
onDragPointerUp = _ref.onDragPointerUp,
|
|
32
|
+
onDragPointerCancel = _ref.onDragPointerCancel;
|
|
28
33
|
if (value == null) return null;
|
|
29
34
|
var label = locale ? value.locale(locale).format(timeFormat) : value.format(timeFormat);
|
|
30
35
|
var isHorizontal = orientation === 'horizontal';
|
|
31
36
|
/** 以竖线/横线中心为 offsetPx,故定位到 offsetPx - 线宽/2 */
|
|
32
37
|
var lineOffset = offsetPx - (isHorizontal ? CURSOR_LINE_WIDTH_H / 2 : CURSOR_LINE_HEIGHT_V / 2);
|
|
38
|
+
var positionStyle = fixedCenter ? style !== null && style !== void 0 ? style : {} : dragInteractive && isHorizontal ? _objectSpread(_objectSpread({}, style), {}, {
|
|
39
|
+
left: offsetPx,
|
|
40
|
+
transform: 'translateX(-50%)',
|
|
41
|
+
width: 36
|
|
42
|
+
}) : dragInteractive && !isHorizontal ? _objectSpread(_objectSpread({}, style), {}, {
|
|
43
|
+
top: offsetPx,
|
|
44
|
+
transform: 'translateX(-50%) translateY(-50%)',
|
|
45
|
+
height: 40
|
|
46
|
+
}) : _objectSpread(_objectSpread({}, style), {}, _defineProperty({}, isHorizontal ? 'left' : 'top', lineOffset));
|
|
33
47
|
return /*#__PURE__*/React.createElement("div", {
|
|
34
48
|
className: classNames('pisell-time-navigator-cursor', "pisell-time-navigator-cursor--".concat(orientation), {
|
|
35
49
|
'pisell-time-navigator-cursor--realtime': isRealtime
|
|
36
50
|
}, {
|
|
37
51
|
'pisell-time-navigator-cursor--fixed': fixedCenter
|
|
52
|
+
}, {
|
|
53
|
+
'pisell-time-navigator-cursor--draggable': dragInteractive
|
|
38
54
|
}, className),
|
|
39
|
-
style:
|
|
40
|
-
"aria-hidden": true
|
|
55
|
+
style: positionStyle,
|
|
56
|
+
"aria-hidden": true,
|
|
57
|
+
onPointerDown: dragInteractive ? onDragPointerDown : undefined,
|
|
58
|
+
onPointerMove: dragInteractive ? onDragPointerMove : undefined,
|
|
59
|
+
onPointerUp: dragInteractive ? onDragPointerUp : undefined,
|
|
60
|
+
onPointerCancel: dragInteractive ? onDragPointerCancel : undefined
|
|
41
61
|
}, /*#__PURE__*/React.createElement("span", {
|
|
42
62
|
className: "pisell-time-navigator-cursor-line"
|
|
43
63
|
}), /*#__PURE__*/React.createElement("span", {
|
|
@@ -23,9 +23,11 @@ export interface GestureLayerProps {
|
|
|
23
23
|
onPointerMove?: React.PointerEventHandler;
|
|
24
24
|
onPointerUp?: React.PointerEventHandler;
|
|
25
25
|
onPointerLeave?: React.PointerEventHandler;
|
|
26
|
+
/** 轴上任意指针按下(含惯性拖轴) */
|
|
27
|
+
onUserInteraction?: () => void;
|
|
26
28
|
children: React.ReactNode;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* 交互层:点击刻度跳转、键盘左右/上下 + 回车
|
|
30
32
|
*/
|
|
31
|
-
export declare function GestureLayer({ orientation, cellSizePx, axisStartMarginPx, offsetToTime, onSelectTime, isInDisabledRanges, snapToStep, stepMinutes, snapFn, scrollPosition, viewportSize, onPointerDown, onPointerMove, onPointerUp, onPointerLeave, children, }: GestureLayerProps): JSX.Element;
|
|
33
|
+
export declare function GestureLayer({ orientation, cellSizePx, axisStartMarginPx, offsetToTime, onSelectTime, isInDisabledRanges, snapToStep, stepMinutes, snapFn, scrollPosition, viewportSize, onPointerDown, onPointerMove, onPointerUp, onPointerLeave, onUserInteraction, children, }: GestureLayerProps): JSX.Element;
|
|
@@ -18,9 +18,11 @@ export function GestureLayer(_ref) {
|
|
|
18
18
|
onPointerMove = _ref.onPointerMove,
|
|
19
19
|
onPointerUp = _ref.onPointerUp,
|
|
20
20
|
onPointerLeave = _ref.onPointerLeave,
|
|
21
|
+
onUserInteraction = _ref.onUserInteraction,
|
|
21
22
|
children = _ref.children;
|
|
22
23
|
var isHorizontal = orientation === 'horizontal';
|
|
23
24
|
var handleClick = useCallback(function (e) {
|
|
25
|
+
onUserInteraction === null || onUserInteraction === void 0 || onUserInteraction();
|
|
24
26
|
var viewport = e.currentTarget.parentElement;
|
|
25
27
|
if (!viewport) return;
|
|
26
28
|
var vRect = viewport.getBoundingClientRect();
|
|
@@ -32,7 +34,7 @@ export function GestureLayer(_ref) {
|
|
|
32
34
|
var candidate = snapToStep ? snapFn(t) : t;
|
|
33
35
|
if (isInDisabledRanges(candidate)) return;
|
|
34
36
|
onSelectTime(candidate);
|
|
35
|
-
}, [isHorizontal, axisStartMarginPx, offsetToTime, onSelectTime, isInDisabledRanges, snapToStep, snapFn]);
|
|
37
|
+
}, [isHorizontal, axisStartMarginPx, offsetToTime, onSelectTime, isInDisabledRanges, snapToStep, snapFn, onUserInteraction]);
|
|
36
38
|
var handleKeyDown = useCallback(function (e) {
|
|
37
39
|
var scrollContentCenter = orientation === 'horizontal' ? scrollPosition.scrollLeft + viewportSize.w / 2 : scrollPosition.scrollTop + viewportSize.h / 2;
|
|
38
40
|
var centerOffset = Math.max(0, scrollContentCenter - axisStartMarginPx);
|
|
@@ -40,7 +42,10 @@ export function GestureLayer(_ref) {
|
|
|
40
42
|
if (currentTime == null) return;
|
|
41
43
|
if (e.key === 'Enter') {
|
|
42
44
|
var candidate = snapToStep ? snapFn(currentTime) : currentTime;
|
|
43
|
-
if (!isInDisabledRanges(candidate))
|
|
45
|
+
if (!isInDisabledRanges(candidate)) {
|
|
46
|
+
onUserInteraction === null || onUserInteraction === void 0 || onUserInteraction();
|
|
47
|
+
onSelectTime(candidate);
|
|
48
|
+
}
|
|
44
49
|
e.preventDefault();
|
|
45
50
|
return;
|
|
46
51
|
}
|
|
@@ -53,14 +58,18 @@ export function GestureLayer(_ref) {
|
|
|
53
58
|
}
|
|
54
59
|
e.preventDefault();
|
|
55
60
|
var snapped = snapToStep ? snapFn(next) : next;
|
|
56
|
-
if (!isInDisabledRanges(snapped))
|
|
57
|
-
|
|
61
|
+
if (!isInDisabledRanges(snapped)) {
|
|
62
|
+
onUserInteraction === null || onUserInteraction === void 0 || onUserInteraction();
|
|
63
|
+
onSelectTime(snapped);
|
|
64
|
+
}
|
|
65
|
+
}, [orientation, axisStartMarginPx, offsetToTime, onSelectTime, isInDisabledRanges, snapToStep, snapFn, stepMinutes, scrollPosition.scrollLeft, scrollPosition.scrollTop, viewportSize.w, viewportSize.h, onUserInteraction]);
|
|
58
66
|
var handlePointerDown = useCallback(function (e) {
|
|
67
|
+
onUserInteraction === null || onUserInteraction === void 0 || onUserInteraction();
|
|
59
68
|
if (onPointerDown) {
|
|
60
69
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
61
70
|
onPointerDown(e);
|
|
62
71
|
}
|
|
63
|
-
}, [onPointerDown]);
|
|
72
|
+
}, [onPointerDown, onUserInteraction]);
|
|
64
73
|
var handlePointerUp = useCallback(function (e) {
|
|
65
74
|
if (onPointerUp) {
|
|
66
75
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
@@ -9,9 +9,14 @@ export interface ScaleLayerProps {
|
|
|
9
9
|
locale?: string;
|
|
10
10
|
style?: React.CSSProperties;
|
|
11
11
|
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* 横向每格宽度(px),须与 useTimeAxis 的 cellSizePx 一致;
|
|
14
|
+
* 不传时样式表默认 82(axis-moves);cursor-moves 压缩比例时必传
|
|
15
|
+
*/
|
|
16
|
+
horizontalCellSizePx?: number;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* 刻度层:渲染时间刻度与标签
|
|
15
20
|
* 横向:整点数字 + 小圆点;竖向:整点/半点数字 + 分割线
|
|
16
21
|
*/
|
|
17
|
-
export declare function ScaleLayer({ orientation, ticks, stepMinutes, majorStepMinutes, timeFormat, locale, style, className, }: ScaleLayerProps): JSX.Element;
|
|
22
|
+
export declare function ScaleLayer({ orientation, ticks, stepMinutes, majorStepMinutes, timeFormat, locale, style, className, horizontalCellSizePx, }: ScaleLayerProps): JSX.Element;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
7
|
import React from 'react';
|
|
2
8
|
import classNames from 'classnames';
|
|
3
|
-
/**
|
|
4
|
-
* 刻度层:渲染时间刻度与标签
|
|
5
|
-
* 横向:整点数字 + 小圆点;竖向:整点/半点数字 + 分割线
|
|
9
|
+
/**
|
|
10
|
+
* 刻度层:渲染时间刻度与标签
|
|
11
|
+
* 横向:整点数字 + 小圆点;竖向:整点/半点数字 + 分割线
|
|
6
12
|
*/
|
|
7
13
|
export function ScaleLayer(_ref) {
|
|
8
14
|
var orientation = _ref.orientation,
|
|
@@ -12,7 +18,8 @@ export function ScaleLayer(_ref) {
|
|
|
12
18
|
timeFormat = _ref.timeFormat,
|
|
13
19
|
locale = _ref.locale,
|
|
14
20
|
style = _ref.style,
|
|
15
|
-
className = _ref.className
|
|
21
|
+
className = _ref.className,
|
|
22
|
+
horizontalCellSizePx = _ref.horizontalCellSizePx;
|
|
16
23
|
var isHorizontal = orientation === 'horizontal';
|
|
17
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
25
|
className: classNames('pisell-time-navigator-scale', "pisell-time-navigator-scale--".concat(orientation), className),
|
|
@@ -22,13 +29,28 @@ export function ScaleLayer(_ref) {
|
|
|
22
29
|
/** 横向整点只展示小时,非整点用 timeFormat;竖向沿用 timeFormat */
|
|
23
30
|
var label = isHorizontal && isMajor ? locale ? tick.locale(locale).format('H') : tick.format('H') : locale ? tick.locale(locale).format(timeFormat) : tick.format(timeFormat);
|
|
24
31
|
if (isHorizontal) {
|
|
32
|
+
var cw = horizontalCellSizePx != null && horizontalCellSizePx > 0 ? horizontalCellSizePx : undefined;
|
|
33
|
+
var compactPad = cw != null ? cw < 36 ? 2 : cw < 52 ? 6 : 10 : undefined;
|
|
25
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
35
|
key: i,
|
|
27
36
|
className: classNames('pisell-time-navigator-scale-cell', 'pisell-time-navigator-scale-cell--h', {
|
|
28
37
|
'pisell-time-navigator-scale-cell--major': isMajor
|
|
29
|
-
})
|
|
38
|
+
}),
|
|
39
|
+
style: cw != null ? _objectSpread({
|
|
40
|
+
width: cw,
|
|
41
|
+
minWidth: cw,
|
|
42
|
+
maxWidth: cw,
|
|
43
|
+
flex: '0 0 auto',
|
|
44
|
+
boxSizing: 'border-box'
|
|
45
|
+
}, compactPad != null ? {
|
|
46
|
+
padding: compactPad
|
|
47
|
+
} : {}) : undefined
|
|
30
48
|
}, isMajor && /*#__PURE__*/React.createElement("span", {
|
|
31
|
-
className: "pisell-time-navigator-scale-label"
|
|
49
|
+
className: "pisell-time-navigator-scale-label",
|
|
50
|
+
style: cw != null && cw < 48 ? {
|
|
51
|
+
fontSize: Math.max(10, Math.round(cw * 0.32)),
|
|
52
|
+
lineHeight: 1.15
|
|
53
|
+
} : undefined
|
|
32
54
|
}, label), !isMajor && /*#__PURE__*/React.createElement("span", {
|
|
33
55
|
className: "pisell-time-navigator-scale-dot",
|
|
34
56
|
"aria-hidden": true
|
|
@@ -142,6 +142,17 @@ export interface PisellTimeNavigatorProps {
|
|
|
142
142
|
* 自定义 Now 按钮内容(覆盖默认文案与图标时使用)
|
|
143
143
|
*/
|
|
144
144
|
renderNowButton?: () => ReactNode;
|
|
145
|
+
/**
|
|
146
|
+
* 横向轴上与刻度槽位数一致的密度序列(任意正数,内部按最大值归一化折线高度)
|
|
147
|
+
*/
|
|
148
|
+
densitySeries?: number[];
|
|
149
|
+
/**
|
|
150
|
+
* 未传 `densitySeries` 时按 `referenceDate` 拉取;日历日变更会重新请求,过期响应丢弃
|
|
151
|
+
*/
|
|
152
|
+
loadDensity?: (params: {
|
|
153
|
+
referenceDate: Dayjs;
|
|
154
|
+
stepMinutes: number;
|
|
155
|
+
}) => Promise<number[]>;
|
|
145
156
|
/**
|
|
146
157
|
* 用户开始操作时间轴(拖轴、点刻度、键盘、拖指针等)时回调;用于上层关闭「跟随当前」等。
|
|
147
158
|
*/
|
package/es/index.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ export { default as PisellRow } from './components/pisellRow';
|
|
|
129
129
|
export { default as Div } from './components/div';
|
|
130
130
|
export { default as PisellBasicGrid } from './components/PisellBasicGrid';
|
|
131
131
|
export { default as PisellScrollView } from './components/PisellScrollView';
|
|
132
|
-
export { PisellFloorMapLayout, FloorMapLayoutProvider, useFloorMapLayoutContext, EMPTY_FLOOR_MAP_LAYOUT_CONTEXT, mergeFloorMapLayoutPropsFromContext, getFigmaTableCardFromMerged, renderFigmaStyleTableCard, renderFigmaStyleRoundTableCard, getRenderItemByKindTable, getRenderItemByKindRoundTable, } from './components/pisellFloorMapLayout';
|
|
132
|
+
export { PisellFloorMapLayout, FloorMapLayoutProvider, useFloorMapLayoutContext, EMPTY_FLOOR_MAP_LAYOUT_CONTEXT, mergeFloorMapLayoutPropsFromContext, getFigmaTableCardFromMerged, renderFigmaStyleTableCard, renderFigmaStyleRoundTableCard, getRenderItemByKindTable, getRenderItemByKindRoundTable, FloorMapImageElement, FLOOR_MAP_IMAGE_ELEMENT_KIND, renderFloorMapFallbackPlaceholder, isFloorMapImageElementKind, } from './components/pisellFloorMapLayout';
|
|
133
133
|
export type { FloorMapViewConfig, FloorMapSceneElement, FloorMapCanvasNameI18n, FloorMapMergedItem, FloorMapDataSources, FloorMapItemBase, FloorMapRenderOptions, } from './components/pisellFloorMapLayout';
|
|
134
134
|
/** PisellLayouts 命名空间另含 PisellFloorMapLayoutProps 等;平面图场景细粒度类型见上方 */
|
|
135
135
|
export { default as PisellViewGrid } from './components/pisellViewGrid';
|
package/es/index.js
CHANGED
|
@@ -134,7 +134,7 @@ export { default as Div } from "./components/div";
|
|
|
134
134
|
export { default as PisellBasicGrid } from "./components/PisellBasicGrid";
|
|
135
135
|
// 类型已在 PisellLayouts 命名空间中导出
|
|
136
136
|
export { default as PisellScrollView } from "./components/PisellScrollView";
|
|
137
|
-
export { PisellFloorMapLayout, FloorMapLayoutProvider, useFloorMapLayoutContext, EMPTY_FLOOR_MAP_LAYOUT_CONTEXT, mergeFloorMapLayoutPropsFromContext, getFigmaTableCardFromMerged, renderFigmaStyleTableCard, renderFigmaStyleRoundTableCard, getRenderItemByKindTable, getRenderItemByKindRoundTable } from "./components/pisellFloorMapLayout";
|
|
137
|
+
export { PisellFloorMapLayout, FloorMapLayoutProvider, useFloorMapLayoutContext, EMPTY_FLOOR_MAP_LAYOUT_CONTEXT, mergeFloorMapLayoutPropsFromContext, getFigmaTableCardFromMerged, renderFigmaStyleTableCard, renderFigmaStyleRoundTableCard, getRenderItemByKindTable, getRenderItemByKindRoundTable, FloorMapImageElement, FLOOR_MAP_IMAGE_ELEMENT_KIND, renderFloorMapFallbackPlaceholder, isFloorMapImageElementKind } from "./components/pisellFloorMapLayout";
|
|
138
138
|
/** PisellLayouts 命名空间另含 PisellFloorMapLayoutProps 等;平面图场景细粒度类型见上方 */
|
|
139
139
|
export { default as PisellViewGrid } from "./components/pisellViewGrid";
|
|
140
140
|
|