@pnkx-lib/ui 1.9.467 → 1.9.469
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/style.css +1 -1
- package/es/chunks/{AntdIcon-KP2HuB_x.js → AntdIcon--fhhlrN2.js} +55 -3
- package/es/chunks/{CloseCircleFilled-4jnV3XJV.js → CloseCircleFilled-CFf9JuKT.js} +1 -1
- package/es/chunks/{CloseOutlined-DdLJZQvZ.js → CloseOutlined-Dr0OzVF3.js} +1 -1
- package/es/chunks/{DownOutlined-Cl95zPIN.js → DownOutlined-DeqIkZcf.js} +1 -1
- package/es/chunks/ExportFile-HZ8zFqRV.js +64 -0
- package/es/chunks/GenericUploadModal-ClzfSP57.js +11605 -0
- package/es/chunks/{InboxOutlined-W7xl_mLq.js → InboxOutlined-BSPALM_S.js} +1 -1
- package/es/chunks/Layout-CRPluSOs.js +598 -0
- package/es/chunks/{LoadingOutlined-C5-PNVpb.js → LoadingOutlined-RxqeOpLJ.js} +1 -1
- package/es/chunks/PlusOutlined-BTNAWDVD.js +20 -0
- package/es/chunks/SearchFilterForm-dvW624w0.js +88 -0
- package/es/chunks/createForOfIteratorHelper-DEc7rz3b.js +52 -0
- package/es/chunks/{createSuper-CnOp-EUR.js → createSuper-DsoUqJ1E.js} +2 -2
- package/es/chunks/{defineProperty-CTLrw71t.js → defineProperty-CnMPreZi.js} +1 -1
- package/es/chunks/{index-xdC7i8zM.js → index-BLRvgOFN.js} +1 -1
- package/es/chunks/index-ClFSxOLW.js +655 -0
- package/es/chunks/{toArray-GtzhUyP3.js → toArray-DA_RJdbk.js} +186 -8
- package/es/constants/index.js +1 -0
- package/es/fields/DatePicker.js +4 -52
- package/es/fields/Select.js +2 -2
- package/es/fields/Upload.js +1 -18
- package/es/index.js +5 -5
- package/es/ui/BreadcrumbHeading.js +1 -1
- package/es/ui/ExportFile.js +6 -64
- package/es/ui/GenericUploadModal.js +7 -11585
- package/es/ui/Heading.js +1 -1
- package/es/ui/ImportFile.js +2 -2
- package/es/ui/Layout.js +2 -598
- package/es/ui/SearchFilterForm.js +4 -88
- package/es/ui/Sidebar/index.js +1 -655
- package/es/ui/UploadComponent.js +1 -1
- package/es/ui/UploadMultiple.js +1 -1
- package/es/ui/index.js +131806 -149
- package/package.json +1 -1
- package/types/components/ui/Table/ActionRowTable/index.d.ts +3 -1
- package/types/constants/table.d.ts +2 -1
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { g as genStyleHooks, u as unit, C as ConfigContext, o as omit, t as toArray, a as useComponentConfig, _ as _toConsumableArray } from './toArray-DA_RJdbk.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useContext, useState, useEffect, useRef } from 'react';
|
|
5
|
+
import { c as classNames } from './index-BLRvgOFN.js';
|
|
6
|
+
import { I as Icon, _ as _extends } from './AntdIcon--fhhlrN2.js';
|
|
7
|
+
|
|
8
|
+
// This icon file is generated automatically.
|
|
9
|
+
var BarsOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "bars", "theme": "outlined" };
|
|
10
|
+
|
|
11
|
+
var BarsOutlined = function BarsOutlined(props, ref) {
|
|
12
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
13
|
+
ref: ref,
|
|
14
|
+
icon: BarsOutlined$1
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** */
|
|
19
|
+
var RefIcon$2 = /*#__PURE__*/React.forwardRef(BarsOutlined);
|
|
20
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
21
|
+
RefIcon$2.displayName = 'BarsOutlined';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// This icon file is generated automatically.
|
|
25
|
+
var LeftOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" } }] }, "name": "left", "theme": "outlined" };
|
|
26
|
+
|
|
27
|
+
var LeftOutlined = function LeftOutlined(props, ref) {
|
|
28
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
29
|
+
ref: ref,
|
|
30
|
+
icon: LeftOutlined$1
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** */
|
|
35
|
+
var RefIcon$1 = /*#__PURE__*/React.forwardRef(LeftOutlined);
|
|
36
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
37
|
+
RefIcon$1.displayName = 'LeftOutlined';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// This icon file is generated automatically.
|
|
41
|
+
var RightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" };
|
|
42
|
+
|
|
43
|
+
var RightOutlined = function RightOutlined(props, ref) {
|
|
44
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
45
|
+
ref: ref,
|
|
46
|
+
icon: RightOutlined$1
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** */
|
|
51
|
+
var RefIcon = /*#__PURE__*/React.forwardRef(RightOutlined);
|
|
52
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
53
|
+
RefIcon.displayName = 'RightOutlined';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const LayoutContext = /*#__PURE__*/React.createContext({
|
|
57
|
+
siderHook: {
|
|
58
|
+
addSider: () => null,
|
|
59
|
+
removeSider: () => null
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const addMediaQueryListener = (mql, handler) => {
|
|
64
|
+
// Don't delete here, please keep the code compatible
|
|
65
|
+
if (typeof (mql === null || mql === void 0 ? void 0 : mql.addEventListener) !== 'undefined') {
|
|
66
|
+
mql.addEventListener('change', handler);
|
|
67
|
+
} else if (typeof (mql === null || mql === void 0 ? void 0 : mql.addListener) !== 'undefined') {
|
|
68
|
+
mql.addListener(handler);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const removeMediaQueryListener = (mql, handler) => {
|
|
72
|
+
// Don't delete here, please keep the code compatible
|
|
73
|
+
if (typeof (mql === null || mql === void 0 ? void 0 : mql.removeEventListener) !== 'undefined') {
|
|
74
|
+
mql.removeEventListener('change', handler);
|
|
75
|
+
} else if (typeof (mql === null || mql === void 0 ? void 0 : mql.removeListener) !== 'undefined') {
|
|
76
|
+
mql.removeListener(handler);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const genLayoutStyle = token => {
|
|
81
|
+
const {
|
|
82
|
+
antCls,
|
|
83
|
+
// .ant
|
|
84
|
+
componentCls,
|
|
85
|
+
// .ant-layout
|
|
86
|
+
colorText,
|
|
87
|
+
footerBg,
|
|
88
|
+
headerHeight,
|
|
89
|
+
headerPadding,
|
|
90
|
+
headerColor,
|
|
91
|
+
footerPadding,
|
|
92
|
+
fontSize,
|
|
93
|
+
bodyBg,
|
|
94
|
+
headerBg
|
|
95
|
+
} = token;
|
|
96
|
+
return {
|
|
97
|
+
[componentCls]: {
|
|
98
|
+
display: 'flex',
|
|
99
|
+
flex: 'auto',
|
|
100
|
+
flexDirection: 'column',
|
|
101
|
+
/* fix firefox can't set height smaller than content on flex item */
|
|
102
|
+
minHeight: 0,
|
|
103
|
+
background: bodyBg,
|
|
104
|
+
'&, *': {
|
|
105
|
+
boxSizing: 'border-box'
|
|
106
|
+
},
|
|
107
|
+
[`&${componentCls}-has-sider`]: {
|
|
108
|
+
flexDirection: 'row',
|
|
109
|
+
[`> ${componentCls}, > ${componentCls}-content`]: {
|
|
110
|
+
// https://segmentfault.com/a/1190000019498300
|
|
111
|
+
width: 0
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
[`${componentCls}-header, &${componentCls}-footer`]: {
|
|
115
|
+
flex: '0 0 auto'
|
|
116
|
+
},
|
|
117
|
+
// RTL
|
|
118
|
+
'&-rtl': {
|
|
119
|
+
direction: 'rtl'
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
// ==================== Header ====================
|
|
123
|
+
[`${componentCls}-header`]: {
|
|
124
|
+
height: headerHeight,
|
|
125
|
+
padding: headerPadding,
|
|
126
|
+
color: headerColor,
|
|
127
|
+
lineHeight: unit(headerHeight),
|
|
128
|
+
background: headerBg,
|
|
129
|
+
// Other components/menu/style/index.less line:686
|
|
130
|
+
// Integration with header element so menu items have the same height
|
|
131
|
+
[`${antCls}-menu`]: {
|
|
132
|
+
lineHeight: 'inherit'
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
// ==================== Footer ====================
|
|
136
|
+
[`${componentCls}-footer`]: {
|
|
137
|
+
padding: footerPadding,
|
|
138
|
+
color: colorText,
|
|
139
|
+
fontSize,
|
|
140
|
+
background: footerBg
|
|
141
|
+
},
|
|
142
|
+
// =================== Content ====================
|
|
143
|
+
[`${componentCls}-content`]: {
|
|
144
|
+
flex: 'auto',
|
|
145
|
+
color: colorText,
|
|
146
|
+
// fix firefox can't set height smaller than content on flex item
|
|
147
|
+
minHeight: 0
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
const prepareComponentToken = token => {
|
|
152
|
+
const {
|
|
153
|
+
colorBgLayout,
|
|
154
|
+
controlHeight,
|
|
155
|
+
controlHeightLG,
|
|
156
|
+
colorText,
|
|
157
|
+
controlHeightSM,
|
|
158
|
+
marginXXS,
|
|
159
|
+
colorTextLightSolid,
|
|
160
|
+
colorBgContainer
|
|
161
|
+
} = token;
|
|
162
|
+
const paddingInline = controlHeightLG * 1.25;
|
|
163
|
+
return {
|
|
164
|
+
// Deprecated
|
|
165
|
+
colorBgHeader: '#001529',
|
|
166
|
+
colorBgBody: colorBgLayout,
|
|
167
|
+
colorBgTrigger: '#002140',
|
|
168
|
+
bodyBg: colorBgLayout,
|
|
169
|
+
headerBg: '#001529',
|
|
170
|
+
headerHeight: controlHeight * 2,
|
|
171
|
+
headerPadding: `0 ${paddingInline}px`,
|
|
172
|
+
headerColor: colorText,
|
|
173
|
+
footerPadding: `${controlHeightSM}px ${paddingInline}px`,
|
|
174
|
+
footerBg: colorBgLayout,
|
|
175
|
+
siderBg: '#001529',
|
|
176
|
+
triggerHeight: controlHeightLG + marginXXS * 2,
|
|
177
|
+
triggerBg: '#002140',
|
|
178
|
+
triggerColor: colorTextLightSolid,
|
|
179
|
+
zeroTriggerWidth: controlHeightLG,
|
|
180
|
+
zeroTriggerHeight: controlHeightLG,
|
|
181
|
+
lightSiderBg: colorBgContainer,
|
|
182
|
+
lightTriggerBg: colorBgContainer,
|
|
183
|
+
lightTriggerColor: colorText
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
// ============================== Export ==============================
|
|
187
|
+
const DEPRECATED_TOKENS = [['colorBgBody', 'bodyBg'], ['colorBgHeader', 'headerBg'], ['colorBgTrigger', 'triggerBg']];
|
|
188
|
+
const useStyle$1 = genStyleHooks('Layout', genLayoutStyle, prepareComponentToken, {
|
|
189
|
+
deprecatedTokens: DEPRECATED_TOKENS
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
const genSiderStyle = token => {
|
|
193
|
+
const {
|
|
194
|
+
componentCls,
|
|
195
|
+
siderBg,
|
|
196
|
+
motionDurationMid,
|
|
197
|
+
motionDurationSlow,
|
|
198
|
+
antCls,
|
|
199
|
+
triggerHeight,
|
|
200
|
+
triggerColor,
|
|
201
|
+
triggerBg,
|
|
202
|
+
headerHeight,
|
|
203
|
+
zeroTriggerWidth,
|
|
204
|
+
zeroTriggerHeight,
|
|
205
|
+
borderRadiusLG,
|
|
206
|
+
lightSiderBg,
|
|
207
|
+
lightTriggerColor,
|
|
208
|
+
lightTriggerBg,
|
|
209
|
+
bodyBg
|
|
210
|
+
} = token;
|
|
211
|
+
return {
|
|
212
|
+
[componentCls]: {
|
|
213
|
+
position: 'relative',
|
|
214
|
+
// fix firefox can't set width smaller than content on flex item
|
|
215
|
+
minWidth: 0,
|
|
216
|
+
background: siderBg,
|
|
217
|
+
transition: `all ${motionDurationMid}, background 0s`,
|
|
218
|
+
'&-has-trigger': {
|
|
219
|
+
paddingBottom: triggerHeight
|
|
220
|
+
},
|
|
221
|
+
'&-right': {
|
|
222
|
+
order: 1
|
|
223
|
+
},
|
|
224
|
+
[`${componentCls}-children`]: {
|
|
225
|
+
height: '100%',
|
|
226
|
+
// Hack for fixing margin collapse bug
|
|
227
|
+
// https://github.com/ant-design/ant-design/issues/7967
|
|
228
|
+
// solution from https://stackoverflow.com/a/33132624/3040605
|
|
229
|
+
marginTop: -0.1,
|
|
230
|
+
paddingTop: 0.1,
|
|
231
|
+
[`${antCls}-menu${antCls}-menu-inline-collapsed`]: {
|
|
232
|
+
width: 'auto'
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
[`&-zero-width ${componentCls}-children`]: {
|
|
236
|
+
overflow: 'hidden'
|
|
237
|
+
},
|
|
238
|
+
[`${componentCls}-trigger`]: {
|
|
239
|
+
position: 'fixed',
|
|
240
|
+
bottom: 0,
|
|
241
|
+
zIndex: 1,
|
|
242
|
+
height: triggerHeight,
|
|
243
|
+
color: triggerColor,
|
|
244
|
+
lineHeight: unit(triggerHeight),
|
|
245
|
+
textAlign: 'center',
|
|
246
|
+
background: triggerBg,
|
|
247
|
+
cursor: 'pointer',
|
|
248
|
+
transition: `all ${motionDurationMid}`
|
|
249
|
+
},
|
|
250
|
+
[`${componentCls}-zero-width-trigger`]: {
|
|
251
|
+
position: 'absolute',
|
|
252
|
+
top: headerHeight,
|
|
253
|
+
insetInlineEnd: token.calc(zeroTriggerWidth).mul(-1).equal(),
|
|
254
|
+
zIndex: 1,
|
|
255
|
+
width: zeroTriggerWidth,
|
|
256
|
+
height: zeroTriggerHeight,
|
|
257
|
+
color: triggerColor,
|
|
258
|
+
fontSize: token.fontSizeXL,
|
|
259
|
+
display: 'flex',
|
|
260
|
+
alignItems: 'center',
|
|
261
|
+
justifyContent: 'center',
|
|
262
|
+
background: siderBg,
|
|
263
|
+
borderRadius: `0 ${unit(borderRadiusLG)} ${unit(borderRadiusLG)} 0`,
|
|
264
|
+
cursor: 'pointer',
|
|
265
|
+
transition: `background ${motionDurationSlow} ease`,
|
|
266
|
+
'&::after': {
|
|
267
|
+
position: 'absolute',
|
|
268
|
+
inset: 0,
|
|
269
|
+
background: 'transparent',
|
|
270
|
+
transition: `all ${motionDurationSlow}`,
|
|
271
|
+
content: '""'
|
|
272
|
+
},
|
|
273
|
+
'&:hover::after': {
|
|
274
|
+
background: `rgba(255, 255, 255, 0.2)`
|
|
275
|
+
},
|
|
276
|
+
'&-right': {
|
|
277
|
+
insetInlineStart: token.calc(zeroTriggerWidth).mul(-1).equal(),
|
|
278
|
+
borderRadius: `${unit(borderRadiusLG)} 0 0 ${unit(borderRadiusLG)}`
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
// Light
|
|
282
|
+
'&-light': {
|
|
283
|
+
background: lightSiderBg,
|
|
284
|
+
[`${componentCls}-trigger`]: {
|
|
285
|
+
color: lightTriggerColor,
|
|
286
|
+
background: lightTriggerBg
|
|
287
|
+
},
|
|
288
|
+
[`${componentCls}-zero-width-trigger`]: {
|
|
289
|
+
color: lightTriggerColor,
|
|
290
|
+
background: lightTriggerBg,
|
|
291
|
+
border: `1px solid ${bodyBg}`,
|
|
292
|
+
// Safe to modify to any other color
|
|
293
|
+
borderInlineStart: 0
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
const useStyle = genStyleHooks(['Layout', 'Sider'], genSiderStyle, prepareComponentToken, {
|
|
300
|
+
deprecatedTokens: DEPRECATED_TOKENS
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
var __rest$1 = undefined && undefined.__rest || function (s, e) {
|
|
304
|
+
var t = {};
|
|
305
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
306
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
307
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
308
|
+
}
|
|
309
|
+
return t;
|
|
310
|
+
};
|
|
311
|
+
const dimensionMaxMap = {
|
|
312
|
+
xs: '479.98px',
|
|
313
|
+
sm: '575.98px',
|
|
314
|
+
md: '767.98px',
|
|
315
|
+
lg: '991.98px',
|
|
316
|
+
xl: '1199.98px',
|
|
317
|
+
xxl: '1599.98px'
|
|
318
|
+
};
|
|
319
|
+
const isNumeric = value => !Number.isNaN(Number.parseFloat(value)) && isFinite(value);
|
|
320
|
+
const SiderContext = /*#__PURE__*/React.createContext({});
|
|
321
|
+
const generateId = (() => {
|
|
322
|
+
let i = 0;
|
|
323
|
+
return (prefix = '') => {
|
|
324
|
+
i += 1;
|
|
325
|
+
return `${prefix}${i}`;
|
|
326
|
+
};
|
|
327
|
+
})();
|
|
328
|
+
const Sider = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
329
|
+
const {
|
|
330
|
+
prefixCls: customizePrefixCls,
|
|
331
|
+
className,
|
|
332
|
+
trigger,
|
|
333
|
+
children,
|
|
334
|
+
defaultCollapsed = false,
|
|
335
|
+
theme = 'dark',
|
|
336
|
+
style = {},
|
|
337
|
+
collapsible = false,
|
|
338
|
+
reverseArrow = false,
|
|
339
|
+
width = 200,
|
|
340
|
+
collapsedWidth = 80,
|
|
341
|
+
zeroWidthTriggerStyle,
|
|
342
|
+
breakpoint,
|
|
343
|
+
onCollapse,
|
|
344
|
+
onBreakpoint
|
|
345
|
+
} = props,
|
|
346
|
+
otherProps = __rest$1(props, ["prefixCls", "className", "trigger", "children", "defaultCollapsed", "theme", "style", "collapsible", "reverseArrow", "width", "collapsedWidth", "zeroWidthTriggerStyle", "breakpoint", "onCollapse", "onBreakpoint"]);
|
|
347
|
+
const {
|
|
348
|
+
siderHook
|
|
349
|
+
} = useContext(LayoutContext);
|
|
350
|
+
const [collapsed, setCollapsed] = useState('collapsed' in props ? props.collapsed : defaultCollapsed);
|
|
351
|
+
const [below, setBelow] = useState(false);
|
|
352
|
+
useEffect(() => {
|
|
353
|
+
if ('collapsed' in props) {
|
|
354
|
+
setCollapsed(props.collapsed);
|
|
355
|
+
}
|
|
356
|
+
}, [props.collapsed]);
|
|
357
|
+
const handleSetCollapsed = (value, type) => {
|
|
358
|
+
if (!('collapsed' in props)) {
|
|
359
|
+
setCollapsed(value);
|
|
360
|
+
}
|
|
361
|
+
onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse(value, type);
|
|
362
|
+
};
|
|
363
|
+
// =========================== Prefix ===========================
|
|
364
|
+
const {
|
|
365
|
+
getPrefixCls,
|
|
366
|
+
direction
|
|
367
|
+
} = useContext(ConfigContext);
|
|
368
|
+
const prefixCls = getPrefixCls('layout-sider', customizePrefixCls);
|
|
369
|
+
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
|
|
370
|
+
// ========================= Responsive =========================
|
|
371
|
+
const responsiveHandlerRef = useRef(null);
|
|
372
|
+
responsiveHandlerRef.current = mql => {
|
|
373
|
+
setBelow(mql.matches);
|
|
374
|
+
onBreakpoint === null || onBreakpoint === void 0 ? void 0 : onBreakpoint(mql.matches);
|
|
375
|
+
if (collapsed !== mql.matches) {
|
|
376
|
+
handleSetCollapsed(mql.matches, 'responsive');
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
useEffect(() => {
|
|
380
|
+
function responsiveHandler(mql) {
|
|
381
|
+
var _a;
|
|
382
|
+
return (_a = responsiveHandlerRef.current) === null || _a === void 0 ? void 0 : _a.call(responsiveHandlerRef, mql);
|
|
383
|
+
}
|
|
384
|
+
let mql;
|
|
385
|
+
if (typeof (window === null || window === void 0 ? void 0 : window.matchMedia) !== 'undefined' && breakpoint && breakpoint in dimensionMaxMap) {
|
|
386
|
+
mql = window.matchMedia(`screen and (max-width: ${dimensionMaxMap[breakpoint]})`);
|
|
387
|
+
addMediaQueryListener(mql, responsiveHandler);
|
|
388
|
+
responsiveHandler(mql);
|
|
389
|
+
}
|
|
390
|
+
return () => {
|
|
391
|
+
removeMediaQueryListener(mql, responsiveHandler);
|
|
392
|
+
};
|
|
393
|
+
}, [breakpoint]); // in order to accept dynamic 'breakpoint' property, we need to add 'breakpoint' into dependency array.
|
|
394
|
+
useEffect(() => {
|
|
395
|
+
const uniqueId = generateId('ant-sider-');
|
|
396
|
+
siderHook.addSider(uniqueId);
|
|
397
|
+
return () => siderHook.removeSider(uniqueId);
|
|
398
|
+
}, []);
|
|
399
|
+
const toggle = () => {
|
|
400
|
+
handleSetCollapsed(!collapsed, 'clickTrigger');
|
|
401
|
+
};
|
|
402
|
+
const divProps = omit(otherProps, ['collapsed']);
|
|
403
|
+
const rawWidth = collapsed ? collapsedWidth : width;
|
|
404
|
+
// use "px" as fallback unit for width
|
|
405
|
+
const siderWidth = isNumeric(rawWidth) ? `${rawWidth}px` : String(rawWidth);
|
|
406
|
+
// special trigger when collapsedWidth == 0
|
|
407
|
+
const zeroWidthTrigger = parseFloat(String(collapsedWidth || 0)) === 0 ? (/*#__PURE__*/React.createElement("span", {
|
|
408
|
+
onClick: toggle,
|
|
409
|
+
className: classNames(`${prefixCls}-zero-width-trigger`, `${prefixCls}-zero-width-trigger-${reverseArrow ? 'right' : 'left'}`),
|
|
410
|
+
style: zeroWidthTriggerStyle
|
|
411
|
+
}, trigger || /*#__PURE__*/React.createElement(RefIcon$2, null))) : null;
|
|
412
|
+
const reverseIcon = direction === 'rtl' === !reverseArrow;
|
|
413
|
+
const iconObj = {
|
|
414
|
+
expanded: reverseIcon ? /*#__PURE__*/React.createElement(RefIcon, null) : /*#__PURE__*/React.createElement(RefIcon$1, null),
|
|
415
|
+
collapsed: reverseIcon ? /*#__PURE__*/React.createElement(RefIcon$1, null) : /*#__PURE__*/React.createElement(RefIcon, null)
|
|
416
|
+
};
|
|
417
|
+
const status = collapsed ? 'collapsed' : 'expanded';
|
|
418
|
+
const defaultTrigger = iconObj[status];
|
|
419
|
+
const triggerDom = trigger !== null ? zeroWidthTrigger || (/*#__PURE__*/React.createElement("div", {
|
|
420
|
+
className: `${prefixCls}-trigger`,
|
|
421
|
+
onClick: toggle,
|
|
422
|
+
style: {
|
|
423
|
+
width: siderWidth
|
|
424
|
+
}
|
|
425
|
+
}, trigger || defaultTrigger)) : null;
|
|
426
|
+
const divStyle = Object.assign(Object.assign({}, style), {
|
|
427
|
+
flex: `0 0 ${siderWidth}`,
|
|
428
|
+
maxWidth: siderWidth,
|
|
429
|
+
minWidth: siderWidth,
|
|
430
|
+
width: siderWidth
|
|
431
|
+
});
|
|
432
|
+
const siderCls = classNames(prefixCls, `${prefixCls}-${theme}`, {
|
|
433
|
+
[`${prefixCls}-collapsed`]: !!collapsed,
|
|
434
|
+
[`${prefixCls}-has-trigger`]: collapsible && trigger !== null && !zeroWidthTrigger,
|
|
435
|
+
[`${prefixCls}-below`]: !!below,
|
|
436
|
+
[`${prefixCls}-zero-width`]: parseFloat(siderWidth) === 0
|
|
437
|
+
}, className, hashId, cssVarCls);
|
|
438
|
+
const contextValue = React.useMemo(() => ({
|
|
439
|
+
siderCollapsed: collapsed
|
|
440
|
+
}), [collapsed]);
|
|
441
|
+
return wrapCSSVar(/*#__PURE__*/React.createElement(SiderContext.Provider, {
|
|
442
|
+
value: contextValue
|
|
443
|
+
}, /*#__PURE__*/React.createElement("aside", Object.assign({
|
|
444
|
+
className: siderCls
|
|
445
|
+
}, divProps, {
|
|
446
|
+
style: divStyle,
|
|
447
|
+
ref: ref
|
|
448
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
449
|
+
className: `${prefixCls}-children`
|
|
450
|
+
}, children), collapsible || below && zeroWidthTrigger ? triggerDom : null)));
|
|
451
|
+
});
|
|
452
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
453
|
+
Sider.displayName = 'Sider';
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function useHasSider(siders, children, hasSider) {
|
|
457
|
+
if (typeof hasSider === 'boolean') {
|
|
458
|
+
return hasSider;
|
|
459
|
+
}
|
|
460
|
+
if (siders.length) {
|
|
461
|
+
return true;
|
|
462
|
+
}
|
|
463
|
+
const childNodes = toArray(children);
|
|
464
|
+
return childNodes.some(node => node.type === Sider);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
468
|
+
var t = {};
|
|
469
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
470
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
471
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
472
|
+
}
|
|
473
|
+
return t;
|
|
474
|
+
};
|
|
475
|
+
function generator({
|
|
476
|
+
suffixCls,
|
|
477
|
+
tagName,
|
|
478
|
+
displayName
|
|
479
|
+
}) {
|
|
480
|
+
return BasicComponent => {
|
|
481
|
+
const Adapter = /*#__PURE__*/React.forwardRef((props, ref) => (/*#__PURE__*/React.createElement(BasicComponent, Object.assign({
|
|
482
|
+
ref: ref,
|
|
483
|
+
suffixCls: suffixCls,
|
|
484
|
+
tagName: tagName
|
|
485
|
+
}, props))));
|
|
486
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
487
|
+
Adapter.displayName = displayName;
|
|
488
|
+
}
|
|
489
|
+
return Adapter;
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
const Basic = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
493
|
+
const {
|
|
494
|
+
prefixCls: customizePrefixCls,
|
|
495
|
+
suffixCls,
|
|
496
|
+
className,
|
|
497
|
+
tagName: TagName
|
|
498
|
+
} = props,
|
|
499
|
+
others = __rest(props, ["prefixCls", "suffixCls", "className", "tagName"]);
|
|
500
|
+
const {
|
|
501
|
+
getPrefixCls
|
|
502
|
+
} = React.useContext(ConfigContext);
|
|
503
|
+
const prefixCls = getPrefixCls('layout', customizePrefixCls);
|
|
504
|
+
const [wrapSSR, hashId, cssVarCls] = useStyle$1(prefixCls);
|
|
505
|
+
const prefixWithSuffixCls = suffixCls ? `${prefixCls}-${suffixCls}` : prefixCls;
|
|
506
|
+
return wrapSSR(/*#__PURE__*/React.createElement(TagName, Object.assign({
|
|
507
|
+
className: classNames(customizePrefixCls || prefixWithSuffixCls, className, hashId, cssVarCls),
|
|
508
|
+
ref: ref
|
|
509
|
+
}, others)));
|
|
510
|
+
});
|
|
511
|
+
const BasicLayout = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
512
|
+
const {
|
|
513
|
+
direction
|
|
514
|
+
} = React.useContext(ConfigContext);
|
|
515
|
+
const [siders, setSiders] = React.useState([]);
|
|
516
|
+
const {
|
|
517
|
+
prefixCls: customizePrefixCls,
|
|
518
|
+
className,
|
|
519
|
+
rootClassName,
|
|
520
|
+
children,
|
|
521
|
+
hasSider,
|
|
522
|
+
tagName: Tag,
|
|
523
|
+
style
|
|
524
|
+
} = props,
|
|
525
|
+
others = __rest(props, ["prefixCls", "className", "rootClassName", "children", "hasSider", "tagName", "style"]);
|
|
526
|
+
const passedProps = omit(others, ['suffixCls']);
|
|
527
|
+
const {
|
|
528
|
+
getPrefixCls,
|
|
529
|
+
className: contextClassName,
|
|
530
|
+
style: contextStyle
|
|
531
|
+
} = useComponentConfig('layout');
|
|
532
|
+
const prefixCls = getPrefixCls('layout', customizePrefixCls);
|
|
533
|
+
const mergedHasSider = useHasSider(siders, children, hasSider);
|
|
534
|
+
const [wrapCSSVar, hashId, cssVarCls] = useStyle$1(prefixCls);
|
|
535
|
+
const classString = classNames(prefixCls, {
|
|
536
|
+
[`${prefixCls}-has-sider`]: mergedHasSider,
|
|
537
|
+
[`${prefixCls}-rtl`]: direction === 'rtl'
|
|
538
|
+
}, contextClassName, className, rootClassName, hashId, cssVarCls);
|
|
539
|
+
const contextValue = React.useMemo(() => ({
|
|
540
|
+
siderHook: {
|
|
541
|
+
addSider: id => {
|
|
542
|
+
setSiders(prev => [].concat(_toConsumableArray(prev), [id]));
|
|
543
|
+
},
|
|
544
|
+
removeSider: id => {
|
|
545
|
+
setSiders(prev => prev.filter(currentId => currentId !== id));
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}), []);
|
|
549
|
+
return wrapCSSVar(/*#__PURE__*/React.createElement(LayoutContext.Provider, {
|
|
550
|
+
value: contextValue
|
|
551
|
+
}, /*#__PURE__*/React.createElement(Tag, Object.assign({
|
|
552
|
+
ref: ref,
|
|
553
|
+
className: classString,
|
|
554
|
+
style: Object.assign(Object.assign({}, contextStyle), style)
|
|
555
|
+
}, passedProps), children)));
|
|
556
|
+
});
|
|
557
|
+
const Layout$1 = generator({
|
|
558
|
+
tagName: 'div',
|
|
559
|
+
displayName: 'Layout'
|
|
560
|
+
})(BasicLayout);
|
|
561
|
+
const Header = generator({
|
|
562
|
+
suffixCls: 'header',
|
|
563
|
+
tagName: 'header',
|
|
564
|
+
displayName: 'Header'
|
|
565
|
+
})(Basic);
|
|
566
|
+
const Footer = generator({
|
|
567
|
+
suffixCls: 'footer',
|
|
568
|
+
tagName: 'footer',
|
|
569
|
+
displayName: 'Footer'
|
|
570
|
+
})(Basic);
|
|
571
|
+
const Content = generator({
|
|
572
|
+
suffixCls: 'content',
|
|
573
|
+
tagName: 'main',
|
|
574
|
+
displayName: 'Content'
|
|
575
|
+
})(Basic);
|
|
576
|
+
|
|
577
|
+
const LayoutComponent = ({
|
|
578
|
+
layoutClassName,
|
|
579
|
+
className,
|
|
580
|
+
...rest
|
|
581
|
+
}) => {
|
|
582
|
+
return /* @__PURE__ */ jsx(
|
|
583
|
+
Layout$1,
|
|
584
|
+
{
|
|
585
|
+
className: [layoutClassName, className].filter(Boolean).join(" "),
|
|
586
|
+
...rest
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
};
|
|
590
|
+
const Layout = Object.assign(LayoutComponent, {
|
|
591
|
+
Header,
|
|
592
|
+
Footer,
|
|
593
|
+
Content,
|
|
594
|
+
Sider,
|
|
595
|
+
_InternalSiderContext: SiderContext
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
export { Layout as L, RefIcon$2 as R, RefIcon$1 as a, RefIcon as b };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { I as Icon, _ as _extends } from './AntdIcon--fhhlrN2.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
// This icon file is generated automatically.
|
|
5
|
+
var PlusOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
|
|
6
|
+
|
|
7
|
+
var PlusOutlined = function PlusOutlined(props, ref) {
|
|
8
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
9
|
+
ref: ref,
|
|
10
|
+
icon: PlusOutlined$1
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** */
|
|
15
|
+
var RefIcon = /*#__PURE__*/React.forwardRef(PlusOutlined);
|
|
16
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
17
|
+
RefIcon.displayName = 'PlusOutlined';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { RefIcon as R };
|