@kne/system-layout 0.2.0-alpha.2 → 0.2.0-alpha.21

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/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  var react = require('react');
2
+ var reactDom = require('react-dom');
2
3
  var antd = require('antd');
3
4
  var classnames = require('classnames');
4
5
  var localStorage = require('@kne/local-storage');
@@ -8,7 +9,8 @@ var reactRouterDom = require('react-router-dom');
8
9
  var Icon = require('@kne/react-icon');
9
10
  var ensureSlash = require('@kne/ensure-slash');
10
11
  var isPlainObject = require('lodash/isPlainObject');
11
- var reactDom = require('react-dom');
12
+ var VirtualList = require('rc-virtual-list');
13
+ var responsiveUtils = require('@kne/responsive-utils');
12
14
  var defaultLogo = require('./defaultLogo~beHinxEU.svg');
13
15
  var expand_bdCTnjYJ_svg = require('./expand~bdCTnjYJ.svg');
14
16
  var ReactErrorBoundary = require('@kne/react-error-boundary');
@@ -16,6 +18,8 @@ var reactIntl = require('@kne/react-intl');
16
18
  var SimpleBar = require('simplebar-react');
17
19
  require('simplebar-react/dist/simplebar.min.css');
18
20
  var ButtonGroup = require('@kne/button-group');
21
+ var merge = require('lodash/merge');
22
+ var transform = require('lodash/transform');
19
23
 
20
24
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
25
 
@@ -24,10 +28,13 @@ var localStorage__default = /*#__PURE__*/_interopDefaultLegacy(localStorage);
24
28
  var Icon__default = /*#__PURE__*/_interopDefaultLegacy(Icon);
25
29
  var ensureSlash__default = /*#__PURE__*/_interopDefaultLegacy(ensureSlash);
26
30
  var isPlainObject__default = /*#__PURE__*/_interopDefaultLegacy(isPlainObject);
31
+ var VirtualList__default = /*#__PURE__*/_interopDefaultLegacy(VirtualList);
27
32
  var defaultLogo__default = /*#__PURE__*/_interopDefaultLegacy(defaultLogo);
28
33
  var ReactErrorBoundary__default = /*#__PURE__*/_interopDefaultLegacy(ReactErrorBoundary);
29
34
  var SimpleBar__default = /*#__PURE__*/_interopDefaultLegacy(SimpleBar);
30
35
  var ButtonGroup__default = /*#__PURE__*/_interopDefaultLegacy(ButtonGroup);
36
+ var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
37
+ var transform__default = /*#__PURE__*/_interopDefaultLegacy(transform);
31
38
 
32
39
  function _extends() {
33
40
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -39,7 +46,7 @@ function _extends() {
39
46
  }, _extends.apply(null, arguments);
40
47
  }
41
48
 
42
- var style$3 = {"layout":"_sK89O","has-toolbar":"_gyKfI","menu":"_-LpWn","open":"_G-zuN","layer-menu":"_6TCwG","ai-entry":"_5qnw5","page":"_HnwkM","toolbar":"_h8PAW","page-children":"_OM1Q2","is-mobile":"_udBgQ","menu-inner":"_7wq3X","logo":"_-T-Dc","menu-header":"_LOrmu","logo-img":"_2cRWf","expand-btn-wrapper":"_5D-Oq","expand-btn-bg":"_p4eOE","expand-btn":"_8dzE7","username":"_b7XeQ","user-description":"_U0YTk","menu-list":"_8gqbZ","ai-dialog-window":"_UAJc-","pulse-dialog-window":"_VjIWn","page-dialog-outer":"_I7Anv","page-dialog":"_UhsFd","pulse-page-dialog":"_H7slV","page-window-content":"_2mdNn","is-scroller":"_6gjkS","page-content":"_nyAa2","ai-dialog-window-title":"_33Tja","ai-dialog-window-content":"_YmBhl"};
49
+ var style$3 = {"kne-responsive-boundary":"kne-system-layout_VtEb1","kne-responsive-scroll":"kne-system-layout_UMzfg","layout":"kne-system-layout_sK89O","has-toolbar":"kne-system-layout_gyKfI","has-navbar":"kne-system-layout_X1wZG","menu":"kne-system-layout_-LpWn","open":"kne-system-layout_G-zuN","layer-menu":"kne-system-layout_6TCwG","ai-entry":"kne-system-layout_5qnw5","page":"kne-system-layout_HnwkM","page-content":"kne-system-layout_nyAa2","toolbar":"kne-system-layout_h8PAW","page-children":"kne-system-layout_OM1Q2","is-scroller":"kne-system-layout_6gjkS","is-mobile":"kne-system-layout_udBgQ","logo":"kne-system-layout_-T-Dc","menu-header":"kne-system-layout_LOrmu","menu-boundary-overlay":"kne-system-layout_-cMpV","is-portaled":"kne-system-layout_leFsD","logo-img":"kne-system-layout_2cRWf","expand-btn-wrapper":"kne-system-layout_5D-Oq","expand-btn-bg":"kne-system-layout_p4eOE","expand-btn":"kne-system-layout_8dzE7","menu-inner":"kne-system-layout_7wq3X","menu-list":"kne-system-layout_8gqbZ","username":"kne-system-layout_b7XeQ","user-description":"kne-system-layout_U0YTk","ai-dialog-window":"kne-system-layout_UAJc-","pulse-dialog-window":"kne-system-layout_VjIWn","is-mobile-full":"kne-system-layout_tiNSQ","is-viewport":"kne-system-layout_UxwXs","ai-dialog-window-title":"kne-system-layout_33Tja","ai-dialog-window-content":"kne-system-layout_YmBhl","ai-boundary-overlay":"kne-system-layout_Nt0Rj","ai-entry-mobile":"kne-system-layout_ln2Ag","is-boundary":"kne-system-layout_dWwHX","page-dialog-outer":"kne-system-layout_I7Anv","page-dialog":"kne-system-layout_UhsFd","pulse-page-dialog":"kne-system-layout_H7slV","page-window-content":"kne-system-layout_2mdNn"};
43
50
 
44
51
  const UserCard = ({
45
52
  name,
@@ -47,7 +54,8 @@ const UserCard = ({
47
54
  email,
48
55
  phone,
49
56
  description,
50
- menuOpen
57
+ menuOpen,
58
+ extra
51
59
  }) => {
52
60
  if (!menuOpen) {
53
61
  return /*#__PURE__*/jsxRuntime.jsx(reactFile.Image.Avatar, {
@@ -75,13 +83,17 @@ const UserCard = ({
75
83
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
76
84
  className: classnames__default["default"]('user-description', style$3['user-description']),
77
85
  children: email || phone || description || '-'
78
- })]
86
+ }), extra]
79
87
  })]
80
88
  });
81
89
  };
82
90
 
83
- var style$2 = {"menu-group":"_Rfzv4","menu-item-icon":"_qoDtD","menu-group-split":"_socoO","menu-item":"_Xa-2h"};
91
+ var style$2 = {"menu-list":"kne-system-layout_dVWvr","menu-group":"kne-system-layout_Rfzv4","menu-item-icon":"kne-system-layout_qoDtD","menu-group-split":"kne-system-layout_socoO","menu-item":"kne-system-layout_Xa-2h"};
84
92
 
93
+ const MENU_ITEM_HEIGHT = 52;
94
+ const MENU_GROUP_HEIGHT = 48;
95
+ const MENU_GROUP_SPLIT_HEIGHT = 17;
96
+ const getItemKey = (item, index) => item.key || item.path || index;
85
97
  const Menu = ({
86
98
  className,
87
99
  menuOpen,
@@ -92,94 +104,169 @@ const Menu = ({
92
104
  }) => {
93
105
  const location = reactRouterDom.useLocation();
94
106
  const navigate = reactRouterDom.useNavigate();
107
+ const listRef = react.useRef(null);
108
+ const virtualListRef = react.useRef(null);
109
+ const [listHeight, setListHeight] = react.useState(0);
95
110
  const currentPathname = base ? location.pathname.replace(new RegExp(`^${base}`), '') : location.pathname;
96
- return /*#__PURE__*/jsxRuntime.jsx("div", {
97
- className: classnames__default["default"]('menu', className, style$2['menu-list']),
98
- children: items.map((item, index) => {
99
- const active = (() => {
100
- if (typeof activeKey === 'string') {
101
- return activeKey === item.key;
111
+ const isItemActive = react.useCallback(item => {
112
+ if (typeof activeKey === 'string') {
113
+ return activeKey === item.key;
114
+ }
115
+ if (typeof activeKey === 'function') {
116
+ return activeKey(item, {
117
+ menuOpen,
118
+ base
119
+ });
120
+ }
121
+ if (typeof item.path === 'string') {
122
+ return ensureSlash__default["default"](currentPathname) === ensureSlash__default["default"](item.path);
123
+ }
124
+ return false;
125
+ }, [activeKey, base, currentPathname, menuOpen]);
126
+ const getEstimatedItemHeight = react.useCallback((item, index) => {
127
+ const hasGroup = item.group && item.group !== items[index - 1]?.group;
128
+ if (!hasGroup) {
129
+ return MENU_ITEM_HEIGHT;
130
+ }
131
+ return MENU_ITEM_HEIGHT + (menuOpen ? MENU_GROUP_HEIGHT : MENU_GROUP_SPLIT_HEIGHT);
132
+ }, [items, menuOpen]);
133
+ const estimatedItemHeight = react.useMemo(() => {
134
+ if (!items.length) {
135
+ return MENU_ITEM_HEIGHT;
136
+ }
137
+ const total = items.reduce((sum, item, index) => sum + getEstimatedItemHeight(item, index), 0);
138
+ return Math.max(MENU_ITEM_HEIGHT, Math.ceil(total / items.length));
139
+ }, [getEstimatedItemHeight, items]);
140
+ const listData = react.useMemo(() => items.map((item, index) => ({
141
+ item,
142
+ index,
143
+ key: getItemKey(item, index)
144
+ })), [items]);
145
+ const activeIndex = react.useMemo(() => listData.findIndex(({
146
+ item
147
+ }) => isItemActive(item)), [isItemActive, listData]);
148
+ react.useLayoutEffect(() => {
149
+ const el = listRef.current;
150
+ if (!el) {
151
+ return;
152
+ }
153
+ const updateHeight = () => {
154
+ const styles = getComputedStyle(el);
155
+ const paddingY = parseFloat(styles.paddingTop) + parseFloat(styles.paddingBottom);
156
+ setListHeight(el.clientHeight - paddingY);
157
+ };
158
+ updateHeight();
159
+ const observer = new ResizeObserver(updateHeight);
160
+ observer.observe(el);
161
+ return () => observer.disconnect();
162
+ }, []);
163
+ react.useLayoutEffect(() => {
164
+ if (activeIndex < 0 || listHeight <= 0) {
165
+ return;
166
+ }
167
+ virtualListRef.current?.scrollTo({
168
+ index: activeIndex,
169
+ align: 'auto'
170
+ });
171
+ }, [activeIndex, listHeight, menuOpen, listData.length]);
172
+ const renderMenuItem = (item, index) => {
173
+ const active = isItemActive(item);
174
+ const icon = typeof item.icon === 'function' ? item.icon({
175
+ menuOpen,
176
+ active
177
+ }) : item.icon;
178
+ const hasGroup = item.group && item.group !== items[index - 1]?.group;
179
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
180
+ title: item.label,
181
+ onClick: e => {
182
+ if (active) {
183
+ return;
102
184
  }
103
- if (typeof activeKey === 'function') {
104
- return activeKey(item, {
185
+ onChange && onChange(item, {
186
+ menuOpen,
187
+ base
188
+ });
189
+ if (typeof item.onClick === 'function') {
190
+ item.onClick(item, {
105
191
  menuOpen,
106
- base
192
+ base,
193
+ event: e
107
194
  });
195
+ return;
108
196
  }
109
- if (typeof item.path === 'string') {
110
- return ensureSlash__default["default"](currentPathname) === ensureSlash__default["default"](item.path);
197
+ if (item.path) {
198
+ navigate(ensureSlash__default["default"](`${base}${item.path}`));
111
199
  }
112
- return false;
113
- })();
114
- const icon = typeof item.icon === 'function' ? item.icon({
115
- menuOpen,
116
- active
117
- }) : item.icon;
118
- const hasGroup = item.group && item.group !== items[index - 1]?.group;
119
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
120
- title: item.label,
121
- onClick: e => {
122
- if (active) {
123
- return;
200
+ },
201
+ children: [hasGroup && menuOpen ? /*#__PURE__*/jsxRuntime.jsx("div", {
202
+ className: classnames__default["default"]('menu-group', style$2['menu-group']),
203
+ children: item.groupLabel || item.group
204
+ }) : null, hasGroup && !menuOpen ? /*#__PURE__*/jsxRuntime.jsx("div", {
205
+ className: classnames__default["default"]('menu-group-split', style$2['menu-group-split'])
206
+ }) : null, /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
207
+ className: classnames__default["default"]('menu-item', style$2['menu-item'], {
208
+ ['is-active']: active,
209
+ ['is-closed']: !menuOpen
210
+ }),
211
+ align: "center",
212
+ gap: 8,
213
+ children: [(icon => {
214
+ if (typeof icon === 'string') {
215
+ return /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
216
+ className: classnames__default["default"]('menu-item-icon', style$2['menu-item-icon']),
217
+ type: icon,
218
+ fontClassName: "system"
219
+ });
124
220
  }
125
- onChange && onChange(item, {
126
- menuOpen,
127
- base
128
- });
129
- if (typeof item.onClick === 'function') {
130
- item.onClick(item, {
131
- menuOpen,
132
- base,
133
- event: e
221
+ if (/*#__PURE__*/react.isValidElement(icon)) {
222
+ return /*#__PURE__*/jsxRuntime.jsx("span", {
223
+ className: classnames__default["default"]('menu-item-icon', style$2['menu-item-icon']),
224
+ children: icon
134
225
  });
135
- return;
136
226
  }
137
- if (item.path) {
138
- navigate(ensureSlash__default["default"](`${base}${item.path}`));
227
+ if (isPlainObject__default["default"](icon) && typeof icon.type === 'string') {
228
+ return /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
229
+ ...icon,
230
+ className: classnames__default["default"]('menu-item-icon', style$2['menu-item-icon'])
231
+ });
139
232
  }
140
- },
141
- children: [hasGroup && menuOpen ? /*#__PURE__*/jsxRuntime.jsx("div", {
142
- className: classnames__default["default"]('menu-group', style$2['menu-group']),
143
- children: item.groupLabel || item.group
144
- }) : null, hasGroup && !menuOpen ? /*#__PURE__*/jsxRuntime.jsx("div", {
145
- className: classnames__default["default"]('menu-group-split', style$2['menu-group-split'])
146
- }) : null, /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
147
- className: classnames__default["default"]('menu-item', style$2['menu-item'], {
148
- ['is-active']: active,
149
- ['is-closed']: !menuOpen
150
- }),
151
- align: "center",
152
- gap: 8,
153
- children: [(icon => {
154
- if (typeof icon === 'string') {
155
- return /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
156
- className: classnames__default["default"]('menu-item-icon', style$2['menu-item-icon']),
157
- type: icon,
158
- fontClassName: "system"
159
- });
160
- }
161
- if (/*#__PURE__*/react.isValidElement(icon)) {
162
- return /*#__PURE__*/jsxRuntime.jsx("span", {
163
- className: classnames__default["default"]('menu-item-icon', style$2['menu-item-icon']),
164
- children: icon
165
- });
166
- }
167
- if (isPlainObject__default["default"](icon) && typeof icon.type === 'string') {
168
- return /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
169
- ...icon,
170
- className: classnames__default["default"]('menu-item-icon', style$2['menu-item-icon'])
171
- });
172
- }
173
- return null;
174
- })(icon), menuOpen && item.label]
175
- })]
176
- }, item.key || item.path || index);
177
- })
233
+ return null;
234
+ })(icon), menuOpen && item.label]
235
+ })]
236
+ }, getItemKey(item, index));
237
+ };
238
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
239
+ ref: listRef,
240
+ className: classnames__default["default"]('menu', className, style$2['menu-list']),
241
+ children: listHeight > 0 ? /*#__PURE__*/jsxRuntime.jsx(VirtualList__default["default"], {
242
+ ref: virtualListRef,
243
+ data: listData,
244
+ height: listHeight,
245
+ itemHeight: estimatedItemHeight,
246
+ itemKey: "key",
247
+ virtual: listData.length > 0,
248
+ children: ({
249
+ item,
250
+ index
251
+ }) => renderMenuItem(item, index)
252
+ }) : null
178
253
  });
179
254
  };
180
255
 
181
- var style$1 = {"toolbar":"_SLK-0","toolbar-list":"_GTQvM","toolbar-item":"_fAZ3n","toolbar-item-icon":"_qOB9o","toolbar-item-label":"_h48es"};
256
+ var style$1 = {"toolbar":"kne-system-layout_SLK-0","toolbar-inline":"kne-system-layout_RgKpk","toolbar-boundary-overlay":"kne-system-layout_VEMgn","toolbar-list":"kne-system-layout_GTQvM","is-viewport":"kne-system-layout_c6f0m","is-boundary":"kne-system-layout_3ctCY","toolbar-item":"kne-system-layout_fAZ3n","toolbar-item-icon":"kne-system-layout_qOB9o","is-hidden":"kne-system-layout_ss5zk","toolbar-item-label":"kne-system-layout_h48es","toolbar-indicator":"kne-system-layout_1s-bc","toolbar-click":"kne-system-layout_Ys3yu"};
257
+
258
+ const context = /*#__PURE__*/react.createContext({});
259
+ const useContext = () => {
260
+ return react.useContext(context);
261
+ };
262
+ const Provider = context.Provider;
182
263
 
264
+ const resolveTarget = target => {
265
+ if (!target) {
266
+ return null;
267
+ }
268
+ return typeof target === 'function' ? target() : target;
269
+ };
183
270
  const Toolbar = ({
184
271
  show = true,
185
272
  className,
@@ -191,89 +278,229 @@ const Toolbar = ({
191
278
  }) => {
192
279
  const location = reactRouterDom.useLocation();
193
280
  const navigate = reactRouterDom.useNavigate();
281
+ const getScrollElement = responsiveUtils.useScrollElement();
282
+ const getBoundaryElement = responsiveUtils.usePopupContainer();
283
+ const {
284
+ mode
285
+ } = responsiveUtils.useResponsiveContext();
286
+ const isMobile = responsiveUtils.useIsMobile();
287
+ const {
288
+ scrollReady
289
+ } = useContext();
194
290
  const currentPathname = base ? location.pathname.replace(new RegExp(`^${base}`), '') : location.pathname;
195
291
  const toolbarMenu = items.filter(item => item.toolbar);
292
+ const itemRefs = react.useRef([]);
293
+ const firstRenderRef = react.useRef(true);
294
+ const [indicator, setIndicator] = react.useState({
295
+ left: 0,
296
+ width: 0,
297
+ scale: 1,
298
+ visible: false
299
+ });
300
+ const [clicked, setClicked] = react.useState(false);
301
+ const [scrolling, setScrolling] = react.useState(false);
302
+ const scrollTimerRef = react.useRef(null);
303
+ const activeIndex = toolbarMenu.findIndex(item => {
304
+ if (typeof activeKey === 'string') {
305
+ return activeKey === item.key;
306
+ }
307
+ if (typeof activeKey === 'function') {
308
+ return activeKey(item, {
309
+ base
310
+ });
311
+ }
312
+ if (typeof item.path === 'string') {
313
+ return ensureSlash__default["default"](currentPathname) === ensureSlash__default["default"](item.path);
314
+ }
315
+ return false;
316
+ });
317
+ const displayIndex = activeIndex >= 0 ? activeIndex : 0;
318
+ const listRef = react.useRef(null);
319
+ const explicitTarget = resolveTarget(target);
320
+ const useBoundaryMount = isMobile && mode === 'container' && !explicitTarget;
321
+ const useViewportFixed = isMobile && mode !== 'container' && !explicitTarget;
322
+ const boundaryTarget = useBoundaryMount ? getBoundaryElement() : null;
323
+ react.useLayoutEffect(() => {
324
+ if (activeIndex < 0) {
325
+ return;
326
+ }
327
+ const item = itemRefs.current[activeIndex];
328
+ const list = listRef.current;
329
+ if (!item || !list) {
330
+ return;
331
+ }
332
+ const itemRect = item.getBoundingClientRect();
333
+ const listRect = list.getBoundingClientRect();
334
+ const newLeft = itemRect.left - listRect.left;
335
+ const newWidth = itemRect.width;
336
+ if (firstRenderRef.current) {
337
+ firstRenderRef.current = false;
338
+ setIndicator({
339
+ left: newLeft,
340
+ width: newWidth,
341
+ scale: 1,
342
+ visible: true
343
+ });
344
+ return;
345
+ }
346
+ setIndicator(prev => ({
347
+ ...prev,
348
+ scale: 1.15
349
+ }));
350
+ const t1 = setTimeout(() => {
351
+ setIndicator(prev => ({
352
+ ...prev,
353
+ left: newLeft,
354
+ width: newWidth
355
+ }));
356
+ }, 120);
357
+ const t2 = setTimeout(() => {
358
+ setIndicator(prev => ({
359
+ ...prev,
360
+ scale: 1
361
+ }));
362
+ }, 380);
363
+ return () => {
364
+ clearTimeout(t1);
365
+ clearTimeout(t2);
366
+ };
367
+ }, [activeIndex, show, target, useBoundaryMount, useViewportFixed]);
368
+ react.useEffect(() => {
369
+ const scrollEl = getScrollElement();
370
+ if (!scrollEl || typeof scrollEl.addEventListener !== 'function') {
371
+ return;
372
+ }
373
+ const handleScroll = () => {
374
+ setScrolling(true);
375
+ if (scrollTimerRef.current) {
376
+ clearTimeout(scrollTimerRef.current);
377
+ }
378
+ scrollTimerRef.current = setTimeout(() => {
379
+ setScrolling(false);
380
+ }, 500);
381
+ };
382
+ scrollEl.addEventListener('scroll', handleScroll, {
383
+ passive: true
384
+ });
385
+ return () => {
386
+ scrollEl.removeEventListener('scroll', handleScroll);
387
+ if (scrollTimerRef.current) {
388
+ clearTimeout(scrollTimerRef.current);
389
+ }
390
+ };
391
+ }, [getScrollElement, show, scrollReady]);
196
392
  if (!show) {
197
393
  return null;
198
394
  }
199
- return /*#__PURE__*/jsxRuntime.jsx("div", {
200
- className: classnames__default["default"]('toolbar', style$1['toolbar'], className),
201
- children: /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
202
- className: classnames__default["default"]('toolbar-list', style$1['toolbar-list']),
203
- children: toolbarMenu.map((item, index) => {
204
- const active = (() => {
205
- if (typeof activeKey === 'string') {
206
- return activeKey === item.key;
395
+ const toolbarList = /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
396
+ ref: listRef,
397
+ className: classnames__default["default"]('toolbar-list', style$1['toolbar-list'], {
398
+ ['is-clicked']: clicked,
399
+ ['is-scrolling']: scrolling,
400
+ [style$1['is-boundary']]: useBoundaryMount,
401
+ [style$1['is-viewport']]: useViewportFixed
402
+ }),
403
+ style: {
404
+ '--toolbar-count': toolbarMenu.length || 1
405
+ },
406
+ onAnimationEnd: () => {
407
+ if (clicked) {
408
+ setClicked(false);
409
+ }
410
+ },
411
+ children: [indicator.visible && /*#__PURE__*/jsxRuntime.jsx("div", {
412
+ className: classnames__default["default"]('toolbar-indicator', style$1['toolbar-indicator']),
413
+ style: {
414
+ left: `${indicator.left}px`,
415
+ width: `${indicator.width}px`,
416
+ transform: `scale(${indicator.scale})`
417
+ }
418
+ }), toolbarMenu.map((item, index) => {
419
+ const active = index === activeIndex;
420
+ const icon = typeof item.icon === 'function' ? item.icon({
421
+ active
422
+ }) : item.icon;
423
+ return /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
424
+ ref: el => {
425
+ itemRefs.current[index] = el;
426
+ },
427
+ vertical: true,
428
+ flex: 1,
429
+ justify: "center",
430
+ align: "center",
431
+ className: classnames__default["default"]('toolbar-item', style$1['toolbar-item'], {
432
+ ['is-active']: active,
433
+ [style$1['is-hidden']]: scrolling && index !== displayIndex
434
+ }),
435
+ onClick: e => {
436
+ if (active) {
437
+ return;
207
438
  }
208
- if (typeof activeKey === 'function') {
209
- return activeKey(item, {
210
- base
439
+ setClicked(true);
440
+ onChange && onChange(item, {
441
+ base
442
+ });
443
+ if (typeof item.onClick === 'function') {
444
+ item.onClick(item, {
445
+ base,
446
+ event: e
211
447
  });
448
+ return;
212
449
  }
213
- if (typeof item.path === 'string') {
214
- return ensureSlash__default["default"](currentPathname) === ensureSlash__default["default"](item.path);
450
+ if (item.path) {
451
+ navigate(ensureSlash__default["default"](`${base}${item.path}`));
215
452
  }
216
- return false;
217
- })();
218
- const icon = typeof item.icon === 'function' ? item.icon({
219
- active
220
- }) : item.icon;
221
- return /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
222
- vertical: true,
223
- flex: 1,
224
- justify: "center",
225
- align: "center",
226
- className: classnames__default["default"]('toolbar-item', style$1['toolbar-item'], {
227
- ['is-active']: active
228
- }),
229
- onClick: e => {
230
- if (active) {
231
- return;
232
- }
233
- onChange && onChange(item, {
234
- base
453
+ },
454
+ children: [(icon => {
455
+ if (typeof icon === 'string') {
456
+ return /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
457
+ className: classnames__default["default"]('toolbar-item-icon', style$1['toolbar-item-icon']),
458
+ type: icon,
459
+ fontClassName: "system"
235
460
  });
236
- if (typeof item.onClick === 'function') {
237
- item.onClick(item, {
238
- menuOpen,
239
- base,
240
- event: e
241
- });
242
- return;
243
- }
244
- if (item.path) {
245
- navigate(ensureSlash__default["default"](`${base}${item.path}`));
246
- }
247
- },
248
- children: [(icon => {
249
- if (typeof icon === 'string') {
250
- return /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
251
- className: classnames__default["default"]('toolbar-item-icon', style$1['toolbar-item-icon']),
252
- type: icon,
253
- fontClassName: "system"
254
- });
255
- }
256
- if (/*#__PURE__*/react.isValidElement(icon)) {
257
- return /*#__PURE__*/jsxRuntime.jsx("span", {
258
- className: classnames__default["default"]('toolbar-item-icon', style$1['toolbar-item-icon']),
259
- children: icon
260
- });
261
- }
262
- if (isPlainObject__default["default"](icon) && typeof icon.type === 'string') {
263
- return /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
264
- ...icon,
265
- className: classnames__default["default"]('toolbar-item-icon', style$1['toolbar-item-icon'])
266
- });
267
- }
268
- return null;
269
- })(icon), /*#__PURE__*/jsxRuntime.jsx("div", {
270
- className: classnames__default["default"]('toolbar-item-label', style$1['toolbar-item-label']),
271
- children: item.label
272
- })]
273
- }, item.key || item.path || index);
274
- })
275
- }), target ? typeof target === 'function' ? target() : target : document.body)
461
+ }
462
+ if (/*#__PURE__*/react.isValidElement(icon)) {
463
+ return /*#__PURE__*/jsxRuntime.jsx("span", {
464
+ className: classnames__default["default"]('toolbar-item-icon', style$1['toolbar-item-icon']),
465
+ children: icon
466
+ });
467
+ }
468
+ if (isPlainObject__default["default"](icon) && typeof icon.type === 'string') {
469
+ return /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
470
+ ...icon,
471
+ className: classnames__default["default"]('toolbar-item-icon', style$1['toolbar-item-icon'])
472
+ });
473
+ }
474
+ return null;
475
+ })(icon), /*#__PURE__*/jsxRuntime.jsx("div", {
476
+ className: classnames__default["default"]('toolbar-item-label', style$1['toolbar-item-label']),
477
+ children: item.label
478
+ })]
479
+ }, item.key || item.path || index);
480
+ })]
276
481
  });
482
+ if (useBoundaryMount && boundaryTarget) {
483
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
484
+ className: classnames__default["default"]('toolbar', style$1['toolbar'], className),
485
+ children: /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsx("div", {
486
+ className: classnames__default["default"]('toolbar-boundary-overlay', style$1['toolbar-boundary-overlay']),
487
+ children: toolbarList
488
+ }), boundaryTarget)
489
+ });
490
+ }
491
+ if (useViewportFixed) {
492
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
493
+ className: classnames__default["default"]('toolbar', style$1['toolbar'], style$1['toolbar-inline'], className),
494
+ children: toolbarList
495
+ });
496
+ }
497
+ if (explicitTarget) {
498
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
499
+ className: classnames__default["default"]('toolbar', style$1['toolbar'], className),
500
+ children: /*#__PURE__*/reactDom.createPortal(toolbarList, explicitTarget)
501
+ });
502
+ }
503
+ return null;
277
504
  };
278
505
 
279
506
  const locale$1 = {
@@ -322,313 +549,676 @@ const ErrorBoundary = props => {
322
549
  });
323
550
  };
324
551
 
325
- const isMobile = () => {
326
- return /iPhone|iPod|Android|ios|iPad/i.test(navigator.userAgent);
552
+ const hasParentResponsiveProvider = parent => {
553
+ return parent.getBoundaryElement !== responsiveUtils.defaultResponsiveContextValue.getBoundaryElement || parent.getScrollElement !== responsiveUtils.defaultResponsiveContextValue.getScrollElement;
327
554
  };
328
-
329
- const context = /*#__PURE__*/react.createContext({});
330
- const useContext = () => {
331
- return react.useContext(context);
555
+ const resolvePageScrollElement = (pageScrollRef, openScrollbar, deviceIsMobile) => {
556
+ if (deviceIsMobile && !openScrollbar) {
557
+ const anchor = pageScrollRef.current;
558
+ if (anchor && anchor.parentElement) {
559
+ const parentScroll = responsiveUtils.findResponsiveScroll(anchor.parentElement);
560
+ if (parentScroll) {
561
+ return parentScroll;
562
+ }
563
+ }
564
+ return responsiveUtils.getDefaultScrollElement();
565
+ }
566
+ const anchor = pageScrollRef.current;
567
+ if (anchor && typeof anchor.getScrollElement === 'function') {
568
+ return anchor.getScrollElement();
569
+ }
570
+ if (anchor && anchor.nodeType === 1 && openScrollbar) {
571
+ const wrapper = anchor.querySelector('.simplebar-content-wrapper');
572
+ if (wrapper) {
573
+ return wrapper;
574
+ }
575
+ }
576
+ return responsiveUtils.findResponsiveScroll(anchor) || responsiveUtils.getDefaultScrollElement();
577
+ };
578
+ const LayoutResponsiveScope = _ref => {
579
+ let boundaryRef = _ref.boundaryRef,
580
+ scrollRef = _ref.scrollRef,
581
+ getScrollElement = _ref.getScrollElement,
582
+ children = _ref.children;
583
+ const parent = responsiveUtils.useResponsiveContext();
584
+ if (hasParentResponsiveProvider(parent)) {
585
+ return children;
586
+ }
587
+ return /*#__PURE__*/jsxRuntime.jsx(responsiveUtils.ResponsiveProvider, {
588
+ boundaryRef: boundaryRef,
589
+ scrollRef: scrollRef,
590
+ getScrollElement: getScrollElement,
591
+ children: children
592
+ });
332
593
  };
333
- const {
334
- Provider,
335
- Consumer
336
- } = context;
337
-
338
594
  const LayoutMenuOpenKey = 'LAYOUT_MENU_OPEN';
339
- const Layout = _ref => {
340
- let {
341
- className,
342
- menu,
343
- background = 'linear-gradient(0deg, #BBCFE7 0%, #BBCFE7 100%), #FFFFFF',
344
- menuMaxWidth = '254px',
345
- menuMinWidth = '84px',
346
- logo,
347
- menuHeader,
348
- userInfo,
349
- aiDialog = null,
350
- openScrollbar: openScrollbarProps,
351
- isMobile: isMobileProps,
352
- toolbarTarget,
353
- children
354
- } = _ref;
595
+ const DRAG_THRESHOLD = 4;
596
+ const MobileAiEntry = _ref2 => {
597
+ let variant = _ref2.variant,
598
+ onOpen = _ref2.onOpen;
599
+ const btnRef = react.useRef(null);
600
+ const dragRef = react.useRef(null);
601
+ const _useState = react.useState(null),
602
+ pos = _useState[0],
603
+ setPos = _useState[1];
604
+ const handlePointerDown = event => {
605
+ const node = btnRef.current;
606
+ if (!node) {
607
+ return;
608
+ }
609
+ // 与 toolbar 一致:boundary 模式下相对定位容器为 offsetParent,viewport 模式下相对视口
610
+ const container = node.offsetParent;
611
+ const rect = node.getBoundingClientRect();
612
+ const refLeft = container ? container.getBoundingClientRect().left : 0;
613
+ const refTop = container ? container.getBoundingClientRect().top : 0;
614
+ dragRef.current = {
615
+ startX: event.clientX,
616
+ startY: event.clientY,
617
+ originLeft: rect.left - refLeft,
618
+ originTop: rect.top - refTop,
619
+ refWidth: container ? container.clientWidth : window.innerWidth,
620
+ refHeight: container ? container.clientHeight : window.innerHeight,
621
+ size: node.offsetWidth,
622
+ moved: false
623
+ };
624
+ node.setPointerCapture == null || node.setPointerCapture(event.pointerId);
625
+ };
626
+ const handlePointerMove = event => {
627
+ const drag = dragRef.current;
628
+ if (!drag) {
629
+ return;
630
+ }
631
+ const dx = event.clientX - drag.startX;
632
+ const dy = event.clientY - drag.startY;
633
+ if (Math.abs(dx) > DRAG_THRESHOLD || Math.abs(dy) > DRAG_THRESHOLD) {
634
+ drag.moved = true;
635
+ }
636
+ const maxLeft = Math.max(8, drag.refWidth - drag.size - 8);
637
+ const maxTop = Math.max(8, drag.refHeight - drag.size - 8);
638
+ setPos({
639
+ left: Math.min(Math.max(8, drag.originLeft + dx), maxLeft),
640
+ top: Math.min(Math.max(8, drag.originTop + dy), maxTop)
641
+ });
642
+ };
643
+ const handlePointerUp = event => {
644
+ var _btnRef$current;
645
+ const drag = dragRef.current;
646
+ dragRef.current = null;
647
+ (_btnRef$current = btnRef.current) == null || _btnRef$current.releasePointerCapture == null || _btnRef$current.releasePointerCapture(event.pointerId);
648
+ if (drag && !drag.moved) {
649
+ onOpen();
650
+ }
651
+ };
652
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
653
+ ref: btnRef,
654
+ className: classnames__default["default"]('ai-entry-mobile', style$3['ai-entry-mobile'], {
655
+ [style$3['is-viewport']]: variant === 'viewport',
656
+ [style$3['is-boundary']]: variant !== 'viewport'
657
+ }),
658
+ style: pos ? {
659
+ left: pos.left + "px",
660
+ top: pos.top + "px",
661
+ right: 'auto',
662
+ bottom: 'auto'
663
+ } : undefined,
664
+ onPointerDown: handlePointerDown,
665
+ onPointerMove: handlePointerMove,
666
+ onPointerUp: handlePointerUp,
667
+ children: /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
668
+ type: "system-prompt",
669
+ colorful: true
670
+ })
671
+ });
672
+ };
673
+ const Layout = _ref3 => {
674
+ let className = _ref3.className,
675
+ menu = _ref3.menu,
676
+ _ref3$background = _ref3.background,
677
+ background = _ref3$background === void 0 ? 'linear-gradient(0deg, #BBCFE7 0%, #BBCFE7 100%), #FFFFFF' : _ref3$background,
678
+ _ref3$menuMaxWidth = _ref3.menuMaxWidth,
679
+ menuMaxWidth = _ref3$menuMaxWidth === void 0 ? '254px' : _ref3$menuMaxWidth,
680
+ _ref3$menuMinWidth = _ref3.menuMinWidth,
681
+ menuMinWidth = _ref3$menuMinWidth === void 0 ? '84px' : _ref3$menuMinWidth,
682
+ logo = _ref3.logo,
683
+ menuHeader = _ref3.menuHeader,
684
+ userInfo = _ref3.userInfo,
685
+ _ref3$aiDialog = _ref3.aiDialog,
686
+ aiDialog = _ref3$aiDialog === void 0 ? null : _ref3$aiDialog,
687
+ openScrollbarProps = _ref3.openScrollbar,
688
+ isMobileProps = _ref3.isMobile,
689
+ toolbarTarget = _ref3.toolbarTarget,
690
+ children = _ref3.children;
355
691
  const localMenuOpen = localStorage__default["default"].getItem(LayoutMenuOpenKey);
356
- const [menuOpen, setMenuOpen] = react.useState(typeof localMenuOpen === 'boolean' ? localMenuOpen : true);
357
- const [toolbarShow, setToolbarShow] = react.useState(true);
358
- const [aiType, setAiType] = react.useState('closed');
359
- const deviceIsMobile = typeof isMobileProps === 'boolean' ? isMobileProps : isMobile();
692
+ const isMobile = responsiveUtils.useIsMobile();
693
+ const responsiveContext = responsiveUtils.useResponsiveContext();
694
+ const deviceIsMobile = typeof isMobileProps === 'boolean' ? isMobileProps : isMobile;
695
+ const useMenuPortal = deviceIsMobile && responsiveContext.mode === 'container';
696
+ const _useState2 = react.useState(null),
697
+ menuPortalTarget = _useState2[0],
698
+ setMenuPortalTarget = _useState2[1];
699
+ const _useState3 = react.useState(typeof localMenuOpen === 'boolean' && !deviceIsMobile ? localMenuOpen : !deviceIsMobile),
700
+ menuOpen = _useState3[0],
701
+ setMenuOpen = _useState3[1];
702
+ const _useState4 = react.useState(true),
703
+ toolbarShow = _useState4[0],
704
+ setToolbarShow = _useState4[1];
705
+ const _useState5 = react.useState(true),
706
+ navbarShow = _useState5[0],
707
+ setNavbarShow = _useState5[1];
708
+ const _useState6 = react.useState('closed'),
709
+ aiType = _useState6[0],
710
+ setAiType = _useState6[1];
711
+ const _useState7 = react.useState(0),
712
+ scrollReady = _useState7[0],
713
+ setScrollReady = _useState7[1];
360
714
  const openScrollbar = typeof openScrollbarProps === 'boolean' ? openScrollbarProps : !deviceIsMobile && !window.__COMPONENTS_CORE_SIMPLE_BAR_DISABLED;
361
715
  const userAvatar = userInfo == null ? void 0 : userInfo.avatar;
362
716
  const contextValue = react.useMemo(() => {
363
717
  return {
364
718
  setToolbarShow,
719
+ setNavbarShow,
365
720
  setMenuOpen,
366
721
  deviceIsMobile,
722
+ scrollReady,
367
723
  logo: Object.assign({}, logo ? logo : {
368
724
  src: defaultLogo__default["default"]
369
725
  }),
370
726
  userAvatar
371
727
  };
372
- }, [deviceIsMobile, logo, userAvatar]);
728
+ }, [deviceIsMobile, logo, userAvatar, scrollReady]);
373
729
  const topRef = react.useRef(null);
730
+ const pageRef = react.useRef(null);
731
+ const layoutBoundaryRef = react.useRef(null);
732
+ const pageScrollRef = react.useRef(null);
374
733
  const location = reactRouterDom.useLocation();
734
+ const getPageScrollElement = react.useCallback(() => {
735
+ return resolvePageScrollElement(pageScrollRef, openScrollbar, deviceIsMobile);
736
+ }, [openScrollbar, deviceIsMobile]);
737
+ const handlePageScrollRef = react.useCallback(node => {
738
+ pageScrollRef.current = node;
739
+ if (node) {
740
+ setScrollReady(version => version + 1);
741
+ }
742
+ }, []);
743
+ react.useEffect(() => {
744
+ if (!useMenuPortal) {
745
+ setMenuPortalTarget(null);
746
+ return;
747
+ }
748
+ const target = typeof responsiveContext.getBoundaryElement === 'function' ? responsiveContext.getBoundaryElement() : null;
749
+ setMenuPortalTarget(target || null);
750
+ }, [useMenuPortal, responsiveContext, scrollReady]);
375
751
  react.useEffect(() => {
376
- topRef.current && topRef.current.scrollIntoView();
377
- }, [location]);
378
- return /*#__PURE__*/jsxRuntime.jsxs(Provider, {
379
- value: contextValue,
752
+ var _topRef$current;
753
+ const scrollEl = getPageScrollElement();
754
+ if (scrollEl && typeof scrollEl.scrollTo === 'function') {
755
+ scrollEl.scrollTo(0, 0);
756
+ return;
757
+ }
758
+ (_topRef$current = topRef.current) == null || _topRef$current.scrollIntoView();
759
+ }, [location, getPageScrollElement]);
760
+ const userCard = /*#__PURE__*/jsxRuntime.jsx(UserCard, _extends({
761
+ menuOpen: menuOpen
762
+ }, Object.assign({}, userInfo)));
763
+ const menuPortalVars = useMenuPortal ? {
764
+ '--menu-max-width': menuMaxWidth,
765
+ '--menu-min-width': menuMinWidth,
766
+ '--background': background
767
+ } : undefined;
768
+ const layerMenuNode = deviceIsMobile ? /*#__PURE__*/jsxRuntime.jsx("div", {
769
+ className: classnames__default["default"]('layer-menu', style$3['layer-menu'], {
770
+ ['open']: menuOpen,
771
+ [style$3['open']]: menuOpen,
772
+ [style$3['is-portaled']]: useMenuPortal
773
+ }),
774
+ style: menuPortalVars,
775
+ onClick: () => {
776
+ setMenuOpen(false);
777
+ }
778
+ }) : null;
779
+ const menuNode = /*#__PURE__*/jsxRuntime.jsxs("div", {
780
+ className: classnames__default["default"]('menu', style$3['menu'], {
781
+ ['open']: menuOpen,
782
+ [style$3['open']]: menuOpen,
783
+ [style$3['is-portaled']]: useMenuPortal
784
+ }),
785
+ style: menuPortalVars,
380
786
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
381
- ref: topRef
382
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
383
- className: classnames__default["default"](className, 'layout', style$3['layout'], {
384
- 'is-mobile': deviceIsMobile,
385
- [style$3['is-mobile']]: deviceIsMobile,
386
- 'has-toolbar': toolbarShow,
387
- [style$3['has-toolbar']]: toolbarShow
388
- }),
389
- style: {
390
- '--menu-max-width': menuMaxWidth,
391
- '--menu-min-width': menuMinWidth,
392
- '--background': background
787
+ className: classnames__default["default"]('logo', style$3['logo']),
788
+ children: /*#__PURE__*/jsxRuntime.jsx(reactFile.Image, _extends({
789
+ className: style$3['logo-img']
790
+ }, contextValue.logo))
791
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
792
+ className: classnames__default["default"]('expand-btn-wrapper', style$3['expand-btn-wrapper']),
793
+ onClick: () => {
794
+ setMenuOpen(menuOpen => {
795
+ localStorage__default["default"].setItem(LayoutMenuOpenKey, !menuOpen);
796
+ return !menuOpen;
797
+ });
393
798
  },
394
- children: [deviceIsMobile && /*#__PURE__*/jsxRuntime.jsx("div", {
395
- className: classnames__default["default"]('layer-menu', style$3['layer-menu'], {
396
- ['open']: menuOpen,
397
- [style$3['open']]: menuOpen
398
- }),
799
+ children: /*#__PURE__*/jsxRuntime.jsx(expand_bdCTnjYJ_svg.ReactComponent, {
800
+ className: classnames__default["default"]('expand-btn', style$3['expand-btn'], {
801
+ 'is-closed': !menuOpen
802
+ })
803
+ })
804
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
805
+ className: classnames__default["default"]('menu-inner', style$3['menu-inner']),
806
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
807
+ className: classnames__default["default"]('menu-header', style$3['menu-header']),
808
+ children: /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary, {
809
+ children: menuHeader ? typeof menuHeader === 'function' ? menuHeader({
810
+ menuOpen,
811
+ userCard
812
+ }) : menuHeader : userCard
813
+ })
814
+ }), /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary, {
815
+ children: /*#__PURE__*/jsxRuntime.jsx(Menu, _extends({
816
+ className: classnames__default["default"]('menu-list', style$3['menu-list']),
817
+ menuOpen: menuOpen
818
+ }, menu, {
819
+ onChange: () => {
820
+ deviceIsMobile && setMenuOpen(false);
821
+ }
822
+ }))
823
+ }), aiDialog && !deviceIsMobile && /*#__PURE__*/jsxRuntime.jsx("div", {
824
+ className: classnames__default["default"]('ai-entry', style$3['ai-entry']),
399
825
  onClick: () => {
400
- setMenuOpen(false);
401
- }
826
+ setAiType('small');
827
+ },
828
+ children: /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
829
+ type: "system-prompt",
830
+ colorful: true
831
+ })
832
+ })]
833
+ })]
834
+ });
835
+ const portalMenu = useMenuPortal && menuPortalTarget;
836
+ const aiDialogWindow = aiDialog && aiType === 'small' ? /*#__PURE__*/jsxRuntime.jsxs("div", {
837
+ className: classnames__default["default"]('ai-dialog-window', style$3['ai-dialog-window'], {
838
+ 'is-mobile-full': deviceIsMobile,
839
+ [style$3['is-mobile-full']]: deviceIsMobile,
840
+ [style$3['is-viewport']]: deviceIsMobile && !portalMenu
841
+ }),
842
+ children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
843
+ className: classnames__default["default"]('ai-dialog-window-title', style$3['ai-dialog-window-title']),
844
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
845
+ children: aiDialog.title
402
846
  }), /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
403
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
404
- className: classnames__default["default"]('menu', style$3['menu'], {
405
- ['open']: menuOpen,
406
- [style$3['open']]: menuOpen
407
- }),
408
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
409
- className: classnames__default["default"]('logo', style$3['logo']),
410
- children: /*#__PURE__*/jsxRuntime.jsx(reactFile.Image, _extends({
411
- className: style$3['logo-img']
412
- }, contextValue.logo))
413
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
414
- className: classnames__default["default"]('expand-btn-wrapper', style$3['expand-btn-wrapper']),
415
- onClick: () => {
416
- setMenuOpen(menuOpen => {
417
- localStorage__default["default"].setItem(LayoutMenuOpenKey, !menuOpen);
418
- return !menuOpen;
419
- });
420
- },
421
- children: /*#__PURE__*/jsxRuntime.jsx(expand_bdCTnjYJ_svg.ReactComponent, {
422
- className: classnames__default["default"]('expand-btn', style$3['expand-btn'], {
423
- 'is-closed': !menuOpen
424
- })
425
- })
426
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
427
- className: classnames__default["default"]('menu-inner', style$3['menu-inner']),
428
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
429
- className: classnames__default["default"]('menu-header', style$3['menu-header']),
430
- children: /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary, {
431
- children: menuHeader ? typeof menuHeader === 'function' ? menuHeader({
432
- menuOpen
433
- }) : menuHeader : /*#__PURE__*/jsxRuntime.jsx(UserCard, _extends({
434
- menuOpen: menuOpen
435
- }, Object.assign({}, userInfo)))
436
- })
437
- }), /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary, {
438
- children: /*#__PURE__*/jsxRuntime.jsx(Menu, _extends({
439
- className: classnames__default["default"]('menu-list', style$3['menu-list']),
440
- menuOpen: menuOpen
441
- }, menu, {
442
- onChange: () => {
443
- deviceIsMobile && setMenuOpen(false);
444
- }
445
- }))
446
- }), aiDialog && /*#__PURE__*/jsxRuntime.jsx("div", {
447
- className: classnames__default["default"]('ai-entry', style$3['ai-entry']),
448
- onClick: () => {
449
- setAiType('small');
450
- },
451
- children: /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
452
- type: "system-prompt",
453
- colorful: true
454
- })
455
- })]
456
- })]
457
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
458
- flex: 1,
459
- className: classnames__default["default"]('page', style$3['page']),
460
- children: /*#__PURE__*/jsxRuntime.jsxs(antd.Row, {
461
- className: classnames__default["default"]('page-content', style$3['page-content']),
462
- children: [!deviceIsMobile && aiDialog && aiType === 'inner' && /*#__PURE__*/jsxRuntime.jsx(antd.Col, {
463
- span: 8,
464
- className: classnames__default["default"]('page-dialog-outer', style$3['page-dialog-outer']),
465
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
466
- className: classnames__default["default"]('page-dialog', style$3['page-dialog']),
467
- children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
468
- className: classnames__default["default"]('ai-dialog-window-title', style$3['ai-dialog-window-title']),
469
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
470
- children: aiDialog.title
471
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
472
- gap: 10,
473
- children: /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
474
- className: "btn",
475
- type: "icon-a-Typeclose",
476
- fontClassName: "system",
477
- onClick: () => {
478
- setAiType('closed');
479
- }
847
+ gap: 10,
848
+ children: [!deviceIsMobile && /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
849
+ className: "btn",
850
+ type: "icon-a-Typeopen_in_full",
851
+ fontClassName: "system",
852
+ onClick: () => {
853
+ setAiType('inner');
854
+ }
855
+ }), /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
856
+ className: "btn",
857
+ type: "icon-a-Typeclose",
858
+ fontClassName: "system",
859
+ onClick: () => {
860
+ setAiType('closed');
861
+ }
862
+ })]
863
+ })]
864
+ }), /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary, {
865
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
866
+ className: classnames__default["default"]('ai-dialog-window-content', style$3['ai-dialog-window-content']),
867
+ children: aiDialog.content
868
+ })
869
+ })]
870
+ }) : null;
871
+ const aiEntryMobile = deviceIsMobile && aiDialog && aiType === 'closed' ? /*#__PURE__*/jsxRuntime.jsx(MobileAiEntry, {
872
+ variant: portalMenu ? 'boundary' : 'viewport',
873
+ onOpen: () => setAiType('small')
874
+ }) : null;
875
+
876
+ // portal 到 boundary(popup 挂载点)时,layout 上的 CSS 变量不会随 portal 继承,需要显式透传
877
+ const aiPortalVars = {
878
+ '--background': background,
879
+ '--toolbar-height': deviceIsMobile && toolbarShow ? '72px' : '0px',
880
+ '--safe-area-inset-top': 'env(safe-area-inset-top)',
881
+ '--safe-area-inset-bottom': 'env(safe-area-inset-bottom)'
882
+ };
883
+ const aiOverlayContent = aiDialogWindow || aiEntryMobile ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
884
+ children: [aiDialogWindow, aiEntryMobile]
885
+ }) : null;
886
+ const aiOverlay = !aiOverlayContent ? null : portalMenu ? /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsx("div", {
887
+ className: classnames__default["default"]('ai-boundary-overlay', style$3['ai-boundary-overlay']),
888
+ style: aiPortalVars,
889
+ children: aiOverlayContent
890
+ }), menuPortalTarget) : aiOverlayContent;
891
+ return /*#__PURE__*/jsxRuntime.jsx(LayoutResponsiveScope, {
892
+ boundaryRef: layoutBoundaryRef,
893
+ scrollRef: pageScrollRef,
894
+ getScrollElement: getPageScrollElement,
895
+ children: /*#__PURE__*/jsxRuntime.jsxs(Provider, {
896
+ value: contextValue,
897
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
898
+ ref: topRef
899
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
900
+ ref: layoutBoundaryRef,
901
+ className: classnames__default["default"](className, 'layout', style$3['layout'], responsiveUtils.RESPONSIVE_BOUNDARY_CLASS, {
902
+ 'is-mobile': deviceIsMobile,
903
+ [style$3['is-mobile']]: deviceIsMobile,
904
+ 'has-toolbar': deviceIsMobile && toolbarShow,
905
+ [style$3['has-toolbar']]: deviceIsMobile && toolbarShow,
906
+ 'has-navbar': deviceIsMobile && navbarShow,
907
+ [style$3['has-navbar']]: deviceIsMobile && navbarShow
908
+ }),
909
+ style: {
910
+ '--menu-max-width': menuMaxWidth,
911
+ '--menu-min-width': menuMinWidth,
912
+ '--background': background
913
+ },
914
+ children: [!portalMenu && layerMenuNode, /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
915
+ style: {
916
+ flex: 1,
917
+ minHeight: 0,
918
+ width: '100%',
919
+ height: 0
920
+ },
921
+ children: [!portalMenu && menuNode, portalMenu && /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsxs("div", {
922
+ className: classnames__default["default"](style$3['menu-boundary-overlay']),
923
+ style: menuPortalVars,
924
+ children: [layerMenuNode, menuNode]
925
+ }), menuPortalTarget), /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
926
+ flex: 1,
927
+ ref: pageRef,
928
+ className: classnames__default["default"]('page', style$3['page']),
929
+ children: /*#__PURE__*/jsxRuntime.jsxs(antd.Row, {
930
+ className: classnames__default["default"]('page-content', style$3['page-content']),
931
+ children: [!deviceIsMobile && aiDialog && aiType === 'inner' && /*#__PURE__*/jsxRuntime.jsx(antd.Col, {
932
+ span: 8,
933
+ className: classnames__default["default"]('page-dialog-outer', style$3['page-dialog-outer']),
934
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
935
+ className: classnames__default["default"]('page-dialog', style$3['page-dialog']),
936
+ children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
937
+ className: classnames__default["default"]('ai-dialog-window-title', style$3['ai-dialog-window-title']),
938
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
939
+ children: aiDialog.title
940
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
941
+ gap: 10,
942
+ children: /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
943
+ className: "btn",
944
+ type: "icon-a-Typeclose",
945
+ fontClassName: "system",
946
+ onClick: () => {
947
+ setAiType('closed');
948
+ }
949
+ })
950
+ })]
951
+ }), /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary, {
952
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
953
+ className: classnames__default["default"]('page-window-content', style$3['page-window-content']),
954
+ children: aiDialog.content
480
955
  })
481
956
  })]
482
- }), /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary, {
483
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
484
- className: classnames__default["default"]('page-window-content', style$3['page-window-content']),
485
- children: aiDialog.content
957
+ })
958
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Col, {
959
+ span: !deviceIsMobile && aiDialog && aiType === 'inner' ? 16 : 24,
960
+ className: responsiveUtils.RESPONSIVE_CONTAINER_CLASS,
961
+ children: /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary, {
962
+ children: openScrollbar ? /*#__PURE__*/jsxRuntime.jsx(SimpleBar__default["default"], {
963
+ ref: handlePageScrollRef,
964
+ className: classnames__default["default"]('page-children', style$3['page-children'], responsiveUtils.RESPONSIVE_SCROLL_CLASS, {
965
+ ['has-left']: aiType === 'inner'
966
+ }),
967
+ children: children
968
+ }) : /*#__PURE__*/jsxRuntime.jsx("div", {
969
+ ref: handlePageScrollRef,
970
+ className: classnames__default["default"]('page-children', style$3['page-children'], !deviceIsMobile && 'is-scroller', !deviceIsMobile && style$3['is-scroller'], !deviceIsMobile && responsiveUtils.RESPONSIVE_SCROLL_CLASS, {
971
+ ['has-left']: aiType === 'inner'
972
+ }),
973
+ children: children
486
974
  })
487
- })]
488
- })
489
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Col, {
490
- span: !deviceIsMobile && aiDialog && aiType === 'inner' ? 16 : 24,
491
- children: /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary, {
492
- children: openScrollbar ? /*#__PURE__*/jsxRuntime.jsx(SimpleBar__default["default"], {
493
- className: classnames__default["default"]('page-children', style$3['page-children'], {
494
- ['has-left']: aiType === 'inner'
495
- }),
496
- children: children
497
- }) : /*#__PURE__*/jsxRuntime.jsx("div", {
498
- className: classnames__default["default"]('page-children', 'is-scroller', style$3['page-children'], style$3['is-scroller'], {
499
- ['has-left']: aiType === 'inner'
500
- }),
501
- children: children
502
975
  })
503
- })
504
- })]
505
- })
506
- }), aiDialog && aiType === 'small' && /*#__PURE__*/jsxRuntime.jsxs("div", {
507
- className: classnames__default["default"]('ai-dialog-window', style$3['ai-dialog-window']),
508
- children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
509
- className: classnames__default["default"]('ai-dialog-window-title', style$3['ai-dialog-window-title']),
510
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
511
- children: aiDialog.title
512
- }), /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
513
- gap: 10,
514
- children: [/*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
515
- className: "btn",
516
- type: "icon-a-Typeopen_in_full",
517
- fontClassName: "system",
518
- onClick: () => {
519
- setAiType('inner');
520
- }
521
- }), /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
522
- className: "btn",
523
- type: "icon-a-Typeclose",
524
- fontClassName: "system",
525
- onClick: () => {
526
- setAiType('closed');
527
- }
528
976
  })]
529
- })]
530
- }), /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary, {
531
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
532
- className: classnames__default["default"]('ai-dialog-window-content', style$3['ai-dialog-window-content']),
533
- children: aiDialog.content
534
977
  })
535
978
  })]
536
- })]
537
- }), /*#__PURE__*/jsxRuntime.jsx(Toolbar, _extends({}, menu, {
538
- className: classnames__default["default"](style$3['toolbar']),
539
- show: toolbarShow,
540
- target: toolbarTarget
541
- }))]
542
- })]
979
+ }), aiOverlay, /*#__PURE__*/jsxRuntime.jsx(Toolbar, _extends({}, menu, {
980
+ className: classnames__default["default"](style$3['toolbar']),
981
+ show: deviceIsMobile && toolbarShow,
982
+ target: toolbarTarget
983
+ }))]
984
+ })]
985
+ })
543
986
  });
544
987
  };
545
988
 
546
- var style = {"page":"_c1kXt","page-header":"_h-YXH","page-title":"_IOVGr","page-title-extra":"_mKsLu","page-inner":"_wHWje","is-mobile":"_yRZMx","back-icon":"_07Mna"};
989
+ var style = {"page":"kne-system-layout_c1kXt","page-header":"kne-system-layout_h-YXH","is-scrolled":"kne-system-layout_dEXMy","page-title-outer":"kne-system-layout_jhcGo","capsule-click":"kne-system-layout_Ps1FA","page-title-extra":"kne-system-layout_mKsLu","page-title":"kne-system-layout_IOVGr","page-top":"kne-system-layout_Y1y7o","page-inner":"kne-system-layout_wHWje","no-padding":"kne-system-layout_tBnAD","is-mobile":"kne-system-layout_yRZMx","page-loading":"kne-system-layout_vcf3J","page-bottom":"kne-system-layout_vXk1s","back-icon":"kne-system-layout_07Mna"};
547
990
 
991
+ const PageLoading = () => {
992
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
993
+ flex: 1,
994
+ justify: "center",
995
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
996
+ className: style['page-loading'],
997
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Skeleton, {
998
+ active: true
999
+ })
1000
+ })
1001
+ });
1002
+ };
548
1003
  const Page = _ref => {
549
- let {
550
- title,
551
- extra = null,
552
- back,
553
- buttonProps,
554
- children,
555
- toolbar = true
556
- } = _ref;
557
- const {
558
- setToolbarShow,
559
- setMenuOpen,
560
- deviceIsMobile,
561
- userAvatar
562
- } = useContext();
1004
+ let title = _ref.title,
1005
+ _ref$extra = _ref.extra,
1006
+ extra = _ref$extra === void 0 ? null : _ref$extra,
1007
+ back = _ref.back,
1008
+ buttonProps = _ref.buttonProps,
1009
+ children = _ref.children,
1010
+ _ref$toolbar = _ref.toolbar,
1011
+ toolbar = _ref$toolbar === void 0 ? true : _ref$toolbar,
1012
+ _ref$navbar = _ref.navbar,
1013
+ navbar = _ref$navbar === void 0 ? true : _ref$navbar,
1014
+ noPadding = _ref.noPadding;
1015
+ const _useContext = useContext(),
1016
+ setToolbarShow = _useContext.setToolbarShow,
1017
+ setNavbarShow = _useContext.setNavbarShow,
1018
+ setMenuOpen = _useContext.setMenuOpen,
1019
+ deviceIsMobile = _useContext.deviceIsMobile,
1020
+ userAvatar = _useContext.userAvatar,
1021
+ scrollReady = _useContext.scrollReady;
1022
+ const navigate = reactRouterDom.useNavigate();
1023
+ const getScrollElement = responsiveUtils.useScrollElement();
1024
+ const navbarRef = react.useRef(null);
1025
+ const _useState = react.useState(false),
1026
+ isScrolled = _useState[0],
1027
+ setIsScrolled = _useState[1];
563
1028
  react.useEffect(() => {
564
1029
  setToolbarShow && setToolbarShow(!!toolbar);
565
- }, [toolbar]);
566
- return /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
567
- vertical: true,
568
- gap: 24,
569
- className: classnames__default["default"]('page', style['page'], {
570
- ['is-mobile']: deviceIsMobile,
571
- [style['is-mobile']]: deviceIsMobile
1030
+ setNavbarShow && setNavbarShow(!!navbar);
1031
+ }, [toolbar, navbar]);
1032
+ react.useEffect(() => {
1033
+ if (!deviceIsMobile || !navbar) {
1034
+ return;
1035
+ }
1036
+ const scrollEl = getScrollElement();
1037
+ if (!scrollEl || typeof scrollEl.addEventListener !== 'function') {
1038
+ return;
1039
+ }
1040
+ const handleScroll = () => {
1041
+ const threshold = navbarRef.current ? navbarRef.current.offsetHeight : 48;
1042
+ setIsScrolled(scrollEl.scrollTop > threshold);
1043
+ };
1044
+ handleScroll();
1045
+ scrollEl.addEventListener('scroll', handleScroll, {
1046
+ passive: true
1047
+ });
1048
+ return () => scrollEl.removeEventListener('scroll', handleScroll);
1049
+ }, [deviceIsMobile, navbar, getScrollElement, scrollReady]);
1050
+ const navbarEl = navbar ? /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
1051
+ ref: navbarRef,
1052
+ justify: "space-between",
1053
+ align: "center",
1054
+ gap: 20,
1055
+ className: classnames__default["default"]('page-header', style['page-header'], {
1056
+ ['is-scrolled']: isScrolled,
1057
+ [style['is-scrolled']]: isScrolled
572
1058
  }),
573
1059
  children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
574
- justify: "space-between",
1060
+ className: classnames__default["default"]('page-title-outer', style['page-title-outer']),
575
1061
  align: "center",
576
- gap: 20,
577
- className: classnames__default["default"]('page-header', style['page-header']),
578
- children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
579
- className: classnames__default["default"]('page-title-outer', style['page-title-outer']),
580
- align: "center",
581
- gap: 4,
582
- children: [back && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
583
- type: "text",
584
- icon: /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
585
- className: style['back-icon'],
586
- type: "a-Typearrow_forward_ios",
587
- fontClassName: "system"
588
- })
589
- }), !back && deviceIsMobile && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
590
- type: "link",
591
- icon: /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
592
- className: style['back-icon'],
593
- type: "a-Typeequal",
594
- fontClassName: "system"
595
- }),
596
- onClick: () => {
597
- setMenuOpen(open => !open);
598
- }
599
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
600
- className: classnames__default["default"]('page-title', style['page-title']),
601
- children: title
602
- })]
1062
+ gap: 4,
1063
+ children: [back && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
1064
+ type: "text",
1065
+ icon: /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
1066
+ className: style['back-icon'],
1067
+ type: "a-Typearrow_forward_ios",
1068
+ fontClassName: "system"
1069
+ }),
1070
+ onClick: () => {
1071
+ navigate(-1);
1072
+ }
1073
+ }), !back && deviceIsMobile && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
1074
+ type: "link",
1075
+ icon: /*#__PURE__*/jsxRuntime.jsx(Icon__default["default"], {
1076
+ className: style['back-icon'],
1077
+ type: "a-Typeequal",
1078
+ fontClassName: "system"
1079
+ }),
1080
+ onClick: () => {
1081
+ setMenuOpen(open => !open);
1082
+ }
603
1083
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
604
- className: classnames__default["default"]('page-title-extra', style['page-title-extra']),
605
- children: extra ? extra : deviceIsMobile ? /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
606
- gap: 4,
607
- align: "center",
608
- children: [buttonProps && /*#__PURE__*/jsxRuntime.jsx(ButtonGroup__default["default"], _extends({}, Object.assign({}, buttonProps, deviceIsMobile ? {
609
- showLength: 0,
610
- moreType: 'link'
611
- } : {}))), /*#__PURE__*/jsxRuntime.jsx(reactFile.Image.Avatar, {
612
- id: userAvatar,
613
- src: userAvatar,
614
- shape: "circle",
615
- size: 30,
616
- alt: "avatar"
617
- })]
618
- }) : buttonProps && /*#__PURE__*/jsxRuntime.jsx(ButtonGroup__default["default"], _extends({}, buttonProps))
1084
+ className: classnames__default["default"]('page-title', style['page-title']),
1085
+ children: title
619
1086
  })]
620
1087
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
621
- className: classnames__default["default"]('page-inner', style['page-inner']),
622
- children: children
1088
+ className: classnames__default["default"]('page-title-extra', style['page-title-extra']),
1089
+ children: extra ? extra : deviceIsMobile ? /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
1090
+ gap: 4,
1091
+ align: "center",
1092
+ children: [buttonProps && /*#__PURE__*/jsxRuntime.jsx(ButtonGroup__default["default"], _extends({}, Object.assign({}, buttonProps, deviceIsMobile ? {
1093
+ showLength: 0,
1094
+ moreType: 'link'
1095
+ } : {}))), /*#__PURE__*/jsxRuntime.jsx(reactFile.Image.Avatar, {
1096
+ id: userAvatar,
1097
+ src: userAvatar,
1098
+ shape: "circle",
1099
+ size: 30,
1100
+ alt: "avatar"
1101
+ })]
1102
+ }) : buttonProps && /*#__PURE__*/jsxRuntime.jsx(ButtonGroup__default["default"], _extends({}, buttonProps))
623
1103
  })]
1104
+ }) : null;
1105
+ const pageInnerClassNameOrigin = classnames__default["default"]('page-inner', style['page-inner']);
1106
+ const pageInnerClassName = classnames__default["default"](pageInnerClassNameOrigin, {
1107
+ ['no-padding']: noPadding,
1108
+ [style['no-padding']]: noPadding
1109
+ });
1110
+ const render = _ref2 => {
1111
+ let children = _ref2.children,
1112
+ className = _ref2.className;
1113
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1114
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1115
+ className: style['page-top']
1116
+ }), /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
1117
+ vertical: true,
1118
+ flex: 1,
1119
+ children: [navbarEl, /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
1120
+ vertical: true,
1121
+ flex: 1,
1122
+ className: classnames__default["default"](pageInnerClassNameOrigin, className),
1123
+ children: children
1124
+ })]
1125
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1126
+ className: style['page-bottom']
1127
+ })]
1128
+ });
1129
+ };
1130
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
1131
+ vertical: true,
1132
+ flex: 1,
1133
+ className: classnames__default["default"]('page', style['page'], {
1134
+ ['is-mobile']: deviceIsMobile,
1135
+ [style['is-mobile']]: deviceIsMobile
1136
+ }),
1137
+ children: typeof children === 'function' ? children({
1138
+ navbar: navbarEl,
1139
+ className: pageInnerClassName,
1140
+ render,
1141
+ pageLoading: render({
1142
+ children: /*#__PURE__*/jsxRuntime.jsx(PageLoading, {})
1143
+ })
1144
+ }) : render({
1145
+ children
1146
+ })
624
1147
  });
625
1148
  };
1149
+ Page.PageLoading = PageLoading;
626
1150
 
627
- Promise.resolve().then(function () { return require('./index-48821d71.js'); });
1151
+ const isMobile = () => {
1152
+ if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
1153
+ return false;
1154
+ }
1155
+ return window.matchMedia(responsiveUtils.IS_MOBILE_QUERY).matches;
1156
+ };
628
1157
 
1158
+ const transparentBgContainer = {
1159
+ colorBgContainer: 'transparent'
1160
+ };
1161
+ const transparentBgContainerComponents = ['Input', 'InputNumber', 'Card', 'Tree', 'Select', 'DatePicker'];
1162
+ const themeToken = {
1163
+ components: merge__default["default"]({}, transform__default["default"](transparentBgContainerComponents, (result, component) => {
1164
+ result[component] = transparentBgContainer;
1165
+ }, {}))
1166
+ };
1167
+
1168
+ Promise.resolve().then(function () { return require('./index-8a15a9a8.js'); });
1169
+
1170
+ Object.defineProperty(exports, 'MOBILE_BREAKPOINT', {
1171
+ enumerable: true,
1172
+ get: function () { return responsiveUtils.MOBILE_BREAKPOINT; }
1173
+ });
1174
+ Object.defineProperty(exports, 'RESPONSIVE_BOUNDARY_CLASS', {
1175
+ enumerable: true,
1176
+ get: function () { return responsiveUtils.RESPONSIVE_BOUNDARY_CLASS; }
1177
+ });
1178
+ Object.defineProperty(exports, 'RESPONSIVE_CONTAINER_CLASS', {
1179
+ enumerable: true,
1180
+ get: function () { return responsiveUtils.RESPONSIVE_CONTAINER_CLASS; }
1181
+ });
1182
+ Object.defineProperty(exports, 'RESPONSIVE_SCROLL_CLASS', {
1183
+ enumerable: true,
1184
+ get: function () { return responsiveUtils.RESPONSIVE_SCROLL_CLASS; }
1185
+ });
1186
+ Object.defineProperty(exports, 'ResponsiveProvider', {
1187
+ enumerable: true,
1188
+ get: function () { return responsiveUtils.ResponsiveProvider; }
1189
+ });
1190
+ Object.defineProperty(exports, 'mobileBreakpoint', {
1191
+ enumerable: true,
1192
+ get: function () { return responsiveUtils.MOBILE_BREAKPOINT; }
1193
+ });
1194
+ Object.defineProperty(exports, 'useBreakpoint', {
1195
+ enumerable: true,
1196
+ get: function () { return responsiveUtils.useBreakpoint; }
1197
+ });
1198
+ Object.defineProperty(exports, 'useIsMobile', {
1199
+ enumerable: true,
1200
+ get: function () { return responsiveUtils.useIsMobile; }
1201
+ });
1202
+ Object.defineProperty(exports, 'useMediaQuery', {
1203
+ enumerable: true,
1204
+ get: function () { return responsiveUtils.useMediaQuery; }
1205
+ });
1206
+ Object.defineProperty(exports, 'usePopupContainer', {
1207
+ enumerable: true,
1208
+ get: function () { return responsiveUtils.usePopupContainer; }
1209
+ });
1210
+ Object.defineProperty(exports, 'useResponsiveContext', {
1211
+ enumerable: true,
1212
+ get: function () { return responsiveUtils.useResponsiveContext; }
1213
+ });
1214
+ Object.defineProperty(exports, 'useScrollElement', {
1215
+ enumerable: true,
1216
+ get: function () { return responsiveUtils.useScrollElement; }
1217
+ });
629
1218
  exports.Layout = Layout;
630
1219
  exports.Page = Page;
631
1220
  exports["default"] = Layout;
632
1221
  exports.isMobile = isMobile;
1222
+ exports.themeToken = themeToken;
633
1223
  exports.useLayoutContext = useContext;
634
1224
  //# sourceMappingURL=index.js.map