@geektech/one 0.1.0 → 0.2.0
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/README-zh.md +112 -9
- package/README.md +117 -10
- package/dist/avatar/OneAvatar.d.ts +21 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/categories.d.ts +4 -4
- package/dist/collapse/OneCollapse.d.ts +31 -0
- package/dist/collapse/index.d.ts +2 -0
- package/dist/index.d.ts +23 -1
- package/dist/index.js +3083 -1005
- package/dist/index.js.map +18 -6
- package/dist/loading/OneLoading.d.ts +16 -0
- package/dist/loading/index.d.ts +2 -0
- package/dist/progress/OneProgress.d.ts +15 -0
- package/dist/progress/index.d.ts +2 -0
- package/dist/radio/OneRadio.d.ts +32 -0
- package/dist/radio/OneRadioGroup.d.ts +30 -0
- package/dist/radio/index.d.ts +4 -0
- package/dist/rate/OneRate.d.ts +28 -0
- package/dist/rate/index.d.ts +2 -0
- package/dist/skeleton/OneSkeleton.d.ts +16 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/slider/OneSlider.d.ts +29 -0
- package/dist/slider/index.d.ts +2 -0
- package/dist/table/OneTable.d.ts +26 -0
- package/dist/table/index.d.ts +2 -0
- package/dist/time-picker/OneTimePicker.d.ts +47 -0
- package/dist/time-picker/index.d.ts +2 -0
- package/dist/upload/OneUpload.d.ts +36 -0
- package/dist/upload/index.d.ts +2 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1118,8 +1118,252 @@ class OneSwitch extends Component7 {
|
|
|
1118
1118
|
input.checked = this.props.checked;
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
1121
|
+
// lib/radio/OneRadio.ts
|
|
1122
|
+
import { Component as Component8, slot as slot4 } from "@geektech/tsone";
|
|
1123
|
+
var ONE_RADIO_STYLES = [
|
|
1124
|
+
{
|
|
1125
|
+
name: "one-radio-base",
|
|
1126
|
+
selector: ".one-radio",
|
|
1127
|
+
properties: {
|
|
1128
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
1129
|
+
display: "inline-flex",
|
|
1130
|
+
gap: "8px",
|
|
1131
|
+
alignItems: "center",
|
|
1132
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
1133
|
+
}
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
name: "one-radio-input",
|
|
1137
|
+
selector: ".one-radio__input",
|
|
1138
|
+
properties: {
|
|
1139
|
+
accentColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
1140
|
+
}
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
name: "one-radio-invalid",
|
|
1144
|
+
selector: ".one-radio--invalid",
|
|
1145
|
+
properties: {
|
|
1146
|
+
color: `var(--one-color-danger, ${ONE_THEME_DEFAULTS.colorDanger})`
|
|
1147
|
+
}
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
name: "one-radio-disabled",
|
|
1151
|
+
selector: ".one-radio--disabled",
|
|
1152
|
+
properties: { opacity: "0.5", cursor: "not-allowed" }
|
|
1153
|
+
}
|
|
1154
|
+
];
|
|
1155
|
+
|
|
1156
|
+
class OneRadio extends Component8 {
|
|
1157
|
+
fieldContext;
|
|
1158
|
+
unsubscribe;
|
|
1159
|
+
initState() {
|
|
1160
|
+
return { internalChecked: this.props.defaultChecked ?? false, revision: 0 };
|
|
1161
|
+
}
|
|
1162
|
+
initStyles() {
|
|
1163
|
+
ONE_RADIO_STYLES.forEach(({ name, ...style }) => this.styleManager.addStyle(name, style));
|
|
1164
|
+
}
|
|
1165
|
+
beforeMount() {
|
|
1166
|
+
this.fieldContext = this.inject(ONE_FORM_FIELD_KEY);
|
|
1167
|
+
if (this.props.checked === true || this.props.defaultChecked === true) {
|
|
1168
|
+
this.fieldContext?.model.ensureValue(this.fieldContext.name, this.props.value ?? "");
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
onMounted() {
|
|
1172
|
+
this.unsubscribe = this.fieldContext?.model.subscribe(() => {
|
|
1173
|
+
this.state.revision += 1;
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
onUnmounted() {
|
|
1177
|
+
this.unsubscribe?.();
|
|
1178
|
+
this.unsubscribe = undefined;
|
|
1179
|
+
this.fieldContext = undefined;
|
|
1180
|
+
}
|
|
1181
|
+
onUpdated() {
|
|
1182
|
+
const element = this.getElement();
|
|
1183
|
+
const input = element instanceof HTMLElement ? element.querySelector("input") : null;
|
|
1184
|
+
if (input instanceof HTMLInputElement)
|
|
1185
|
+
input.checked = this.getChecked();
|
|
1186
|
+
}
|
|
1187
|
+
render() {
|
|
1188
|
+
this.state.revision;
|
|
1189
|
+
const checked = this.getChecked();
|
|
1190
|
+
const invalid = this.props.invalid || (this.fieldContext?.model.getErrors(this.fieldContext.name).length ?? 0) > 0;
|
|
1191
|
+
return {
|
|
1192
|
+
tag: "label",
|
|
1193
|
+
props: {
|
|
1194
|
+
className: [
|
|
1195
|
+
"one-radio",
|
|
1196
|
+
...invalid ? ["one-radio--invalid"] : [],
|
|
1197
|
+
...this.props.disabled ? ["one-radio--disabled"] : []
|
|
1198
|
+
].join(" ")
|
|
1199
|
+
},
|
|
1200
|
+
children: [
|
|
1201
|
+
{
|
|
1202
|
+
tag: "input",
|
|
1203
|
+
props: {
|
|
1204
|
+
className: "one-radio__input",
|
|
1205
|
+
type: "radio",
|
|
1206
|
+
value: this.props.value,
|
|
1207
|
+
checked,
|
|
1208
|
+
name: this.fieldContext?.name ?? this.props.name,
|
|
1209
|
+
disabled: this.props.disabled === true,
|
|
1210
|
+
required: this.props.required === true,
|
|
1211
|
+
id: this.fieldContext?.controlId,
|
|
1212
|
+
"aria-label": this.props.ariaLabel,
|
|
1213
|
+
"aria-invalid": invalid ? "true" : undefined,
|
|
1214
|
+
"aria-describedby": this.fieldContext?.describedBy
|
|
1215
|
+
},
|
|
1216
|
+
listeners: {
|
|
1217
|
+
input: (event) => this.emitChecked("input", event),
|
|
1218
|
+
change: (event) => this.emitChecked("change", event)
|
|
1219
|
+
}
|
|
1220
|
+
},
|
|
1221
|
+
slot4("default")
|
|
1222
|
+
]
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
getChecked() {
|
|
1226
|
+
const value = this.fieldContext?.model.getValue(this.fieldContext.name);
|
|
1227
|
+
if (typeof value === "string")
|
|
1228
|
+
return value === (this.props.value ?? "");
|
|
1229
|
+
return this.props.checked ?? this.state.internalChecked;
|
|
1230
|
+
}
|
|
1231
|
+
emitChecked(eventName, event) {
|
|
1232
|
+
const input = event.currentTarget;
|
|
1233
|
+
if (!(input instanceof HTMLInputElement) || this.props.disabled)
|
|
1234
|
+
return;
|
|
1235
|
+
const value = this.props.value ?? "";
|
|
1236
|
+
if (this.fieldContext)
|
|
1237
|
+
this.fieldContext.model.setValue(this.fieldContext.name, value);
|
|
1238
|
+
else if (this.props.checked === undefined)
|
|
1239
|
+
this.state.internalChecked = input.checked;
|
|
1240
|
+
this.emit(eventName, {
|
|
1241
|
+
value,
|
|
1242
|
+
originalEvent: event
|
|
1243
|
+
});
|
|
1244
|
+
if (!this.fieldContext && this.props.checked !== undefined)
|
|
1245
|
+
input.checked = this.props.checked;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
// lib/radio/OneRadioGroup.ts
|
|
1249
|
+
import { Component as Component9 } from "@geektech/tsone";
|
|
1250
|
+
var ONE_RADIO_GROUP_STYLES = [
|
|
1251
|
+
{
|
|
1252
|
+
name: "one-radio-group-base",
|
|
1253
|
+
selector: ".one-radio-group",
|
|
1254
|
+
properties: {
|
|
1255
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
1256
|
+
display: "inline-flex",
|
|
1257
|
+
flexDirection: "column",
|
|
1258
|
+
gap: "8px"
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
name: "one-radio-group-option",
|
|
1263
|
+
selector: ".one-radio-group__option",
|
|
1264
|
+
properties: {
|
|
1265
|
+
display: "inline-flex",
|
|
1266
|
+
gap: "8px",
|
|
1267
|
+
alignItems: "center"
|
|
1268
|
+
}
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
name: "one-radio-group-input",
|
|
1272
|
+
selector: ".one-radio-group__option input",
|
|
1273
|
+
properties: {
|
|
1274
|
+
accentColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
1275
|
+
}
|
|
1276
|
+
},
|
|
1277
|
+
{
|
|
1278
|
+
name: "one-radio-group-disabled",
|
|
1279
|
+
selector: ".one-radio-group--disabled",
|
|
1280
|
+
properties: { opacity: "0.5", cursor: "not-allowed" }
|
|
1281
|
+
}
|
|
1282
|
+
];
|
|
1283
|
+
|
|
1284
|
+
class OneRadioGroup extends Component9 {
|
|
1285
|
+
fieldContext;
|
|
1286
|
+
unsubscribe;
|
|
1287
|
+
initState() {
|
|
1288
|
+
return { internalValue: this.props.defaultValue ?? "", revision: 0 };
|
|
1289
|
+
}
|
|
1290
|
+
initStyles() {
|
|
1291
|
+
ONE_RADIO_GROUP_STYLES.forEach(({ name, ...style }) => this.styleManager.addStyle(name, style));
|
|
1292
|
+
}
|
|
1293
|
+
beforeMount() {
|
|
1294
|
+
this.fieldContext = this.inject(ONE_FORM_FIELD_KEY);
|
|
1295
|
+
this.fieldContext?.model.ensureValue(this.fieldContext.name, this.props.value ?? this.props.defaultValue ?? "");
|
|
1296
|
+
}
|
|
1297
|
+
onMounted() {
|
|
1298
|
+
this.unsubscribe = this.fieldContext?.model.subscribe(() => {
|
|
1299
|
+
this.state.revision += 1;
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
onUnmounted() {
|
|
1303
|
+
this.unsubscribe?.();
|
|
1304
|
+
this.unsubscribe = undefined;
|
|
1305
|
+
this.fieldContext = undefined;
|
|
1306
|
+
}
|
|
1307
|
+
render() {
|
|
1308
|
+
this.state.revision;
|
|
1309
|
+
const value = this.getValue();
|
|
1310
|
+
const invalid = this.props.invalid || (this.fieldContext?.model.getErrors(this.fieldContext.name).length ?? 0) > 0;
|
|
1311
|
+
return {
|
|
1312
|
+
tag: "div",
|
|
1313
|
+
props: {
|
|
1314
|
+
className: [
|
|
1315
|
+
"one-radio-group",
|
|
1316
|
+
...this.props.disabled ? ["one-radio-group--disabled"] : []
|
|
1317
|
+
].join(" "),
|
|
1318
|
+
role: "radiogroup",
|
|
1319
|
+
"aria-label": this.props.ariaLabel,
|
|
1320
|
+
"aria-invalid": invalid ? "true" : undefined,
|
|
1321
|
+
"aria-describedby": this.fieldContext?.describedBy
|
|
1322
|
+
},
|
|
1323
|
+
children: this.props.options.map((option) => ({
|
|
1324
|
+
tag: "label",
|
|
1325
|
+
props: { className: "one-radio-group__option" },
|
|
1326
|
+
children: [
|
|
1327
|
+
{
|
|
1328
|
+
tag: "input",
|
|
1329
|
+
props: {
|
|
1330
|
+
type: "radio",
|
|
1331
|
+
value: option.value,
|
|
1332
|
+
checked: value === option.value,
|
|
1333
|
+
disabled: this.props.disabled || option.disabled,
|
|
1334
|
+
name: this.fieldContext?.name ?? this.props.name
|
|
1335
|
+
},
|
|
1336
|
+
listeners: { change: (event) => this.select(option, event) }
|
|
1337
|
+
},
|
|
1338
|
+
option.label
|
|
1339
|
+
]
|
|
1340
|
+
}))
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
getValue() {
|
|
1344
|
+
const value = this.fieldContext?.model.getValue(this.fieldContext.name);
|
|
1345
|
+
return typeof value === "string" ? value : this.props.value ?? this.state.internalValue;
|
|
1346
|
+
}
|
|
1347
|
+
select(option, event) {
|
|
1348
|
+
const input = event.currentTarget;
|
|
1349
|
+
if (!(input instanceof HTMLInputElement) || this.props.disabled || option.disabled)
|
|
1350
|
+
return;
|
|
1351
|
+
if (this.fieldContext)
|
|
1352
|
+
this.fieldContext.model.setValue(this.fieldContext.name, option.value);
|
|
1353
|
+
else if (this.props.value === undefined)
|
|
1354
|
+
this.state.internalValue = option.value;
|
|
1355
|
+
this.emit("input", {
|
|
1356
|
+
value: option.value,
|
|
1357
|
+
originalEvent: event
|
|
1358
|
+
});
|
|
1359
|
+
this.emit("change", {
|
|
1360
|
+
value: option.value,
|
|
1361
|
+
originalEvent: event
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1121
1365
|
// lib/select/OneSelect.ts
|
|
1122
|
-
import { Component as
|
|
1366
|
+
import { Component as Component10 } from "@geektech/tsone";
|
|
1123
1367
|
var ONE_SELECT_STYLES = [
|
|
1124
1368
|
{
|
|
1125
1369
|
name: "one-select-base",
|
|
@@ -1196,7 +1440,7 @@ function matchesSearch(option, query) {
|
|
|
1196
1440
|
return option.label.toLowerCase().includes(query.trim().toLowerCase());
|
|
1197
1441
|
}
|
|
1198
1442
|
|
|
1199
|
-
class OneSelect extends
|
|
1443
|
+
class OneSelect extends Component10 {
|
|
1200
1444
|
fieldContext;
|
|
1201
1445
|
unsubscribe;
|
|
1202
1446
|
initState() {
|
|
@@ -1382,1317 +1626,3029 @@ class OneSelect extends Component8 {
|
|
|
1382
1626
|
}
|
|
1383
1627
|
}
|
|
1384
1628
|
}
|
|
1385
|
-
// lib/
|
|
1386
|
-
import { Component as
|
|
1387
|
-
var
|
|
1388
|
-
function createTabsId() {
|
|
1389
|
-
tabsInstanceId += 1;
|
|
1390
|
-
return `one-tabs-${tabsInstanceId}`;
|
|
1391
|
-
}
|
|
1392
|
-
function normalizeId(value) {
|
|
1393
|
-
return typeof value === "string" && /^[A-Za-z_][A-Za-z0-9_-]*$/.test(value) ? value : createTabsId();
|
|
1394
|
-
}
|
|
1395
|
-
var ONE_TABS_STYLES = [
|
|
1629
|
+
// lib/time-picker/OneTimePicker.ts
|
|
1630
|
+
import { Component as Component11 } from "@geektech/tsone";
|
|
1631
|
+
var ONE_TIME_PICKER_STYLES = [
|
|
1396
1632
|
{
|
|
1397
|
-
name: "one-
|
|
1398
|
-
selector: ".one-
|
|
1633
|
+
name: "one-time-picker-base",
|
|
1634
|
+
selector: ".one-time-picker",
|
|
1399
1635
|
properties: {
|
|
1400
1636
|
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
1401
|
-
|
|
1637
|
+
position: "relative",
|
|
1638
|
+
width: "100%"
|
|
1402
1639
|
}
|
|
1403
1640
|
},
|
|
1404
1641
|
{
|
|
1405
|
-
name: "one-
|
|
1406
|
-
selector: ".one-
|
|
1642
|
+
name: "one-time-picker-input",
|
|
1643
|
+
selector: ".one-time-picker__input",
|
|
1407
1644
|
properties: {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1645
|
+
boxSizing: "border-box",
|
|
1646
|
+
width: "100%",
|
|
1647
|
+
border: oneThemeBorder(`var(--one-input-border-color, var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder}))`),
|
|
1648
|
+
borderRadius: `var(--one-radius-md, ${ONE_THEME_DEFAULTS.radiusMd})`,
|
|
1649
|
+
color: `var(--one-input-color, var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText}))`,
|
|
1650
|
+
backgroundColor: `var(--one-input-background, var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface}))`,
|
|
1651
|
+
cursor: "pointer",
|
|
1652
|
+
transition: "150ms ease"
|
|
1411
1653
|
}
|
|
1412
1654
|
},
|
|
1413
1655
|
{
|
|
1414
|
-
name: "one-
|
|
1415
|
-
selector: ".one-
|
|
1656
|
+
name: "one-time-picker-input-sm",
|
|
1657
|
+
selector: ".one-time-picker__input--sm",
|
|
1416
1658
|
properties: {
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
color: "inherit",
|
|
1421
|
-
backgroundColor: "transparent",
|
|
1422
|
-
border: "0",
|
|
1423
|
-
cursor: "pointer",
|
|
1424
|
-
font: "inherit"
|
|
1425
|
-
},
|
|
1426
|
-
hover: {
|
|
1427
|
-
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
1659
|
+
minHeight: "32px",
|
|
1660
|
+
padding: `var(--one-input-padding-sm, ${ONE_THEME_DEFAULTS.spaceXs} ${ONE_THEME_DEFAULTS.spaceSm})`,
|
|
1661
|
+
fontSize: `var(--one-font-size-sm, ${ONE_THEME_DEFAULTS.fontSizeSm})`
|
|
1428
1662
|
}
|
|
1429
1663
|
},
|
|
1430
1664
|
{
|
|
1431
|
-
name: "one-
|
|
1432
|
-
selector:
|
|
1665
|
+
name: "one-time-picker-input-md",
|
|
1666
|
+
selector: ".one-time-picker__input--md",
|
|
1433
1667
|
properties: {
|
|
1434
|
-
|
|
1668
|
+
minHeight: "40px",
|
|
1669
|
+
padding: `var(--one-input-padding-md, ${ONE_THEME_DEFAULTS.spaceSm} ${ONE_THEME_DEFAULTS.spaceMd})`,
|
|
1670
|
+
fontSize: `var(--one-font-size-md, ${ONE_THEME_DEFAULTS.fontSizeMd})`
|
|
1435
1671
|
}
|
|
1436
1672
|
},
|
|
1437
1673
|
{
|
|
1438
|
-
name: "one-
|
|
1439
|
-
selector:
|
|
1674
|
+
name: "one-time-picker-input-lg",
|
|
1675
|
+
selector: ".one-time-picker__input--lg",
|
|
1440
1676
|
properties: {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
left: "0",
|
|
1445
|
-
height: "2px",
|
|
1446
|
-
backgroundColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`,
|
|
1447
|
-
content: '""'
|
|
1677
|
+
minHeight: "48px",
|
|
1678
|
+
padding: `var(--one-input-padding-lg, ${ONE_THEME_DEFAULTS.spaceMd} ${ONE_THEME_DEFAULTS.spaceLg})`,
|
|
1679
|
+
fontSize: `var(--one-font-size-lg, ${ONE_THEME_DEFAULTS.fontSizeLg})`
|
|
1448
1680
|
}
|
|
1449
1681
|
},
|
|
1450
1682
|
{
|
|
1451
|
-
name: "one-
|
|
1452
|
-
selector: ".one-
|
|
1683
|
+
name: "one-time-picker-input-invalid",
|
|
1684
|
+
selector: ".one-time-picker__input--invalid",
|
|
1453
1685
|
properties: {
|
|
1454
|
-
|
|
1455
|
-
cursor: "not-allowed"
|
|
1686
|
+
borderColor: `var(--one-color-danger, ${ONE_THEME_DEFAULTS.colorDanger})`
|
|
1456
1687
|
}
|
|
1457
1688
|
},
|
|
1458
1689
|
{
|
|
1459
|
-
name: "one-
|
|
1460
|
-
selector: ".one-
|
|
1690
|
+
name: "one-time-picker-input-disabled",
|
|
1691
|
+
selector: ".one-time-picker__input:disabled",
|
|
1692
|
+
properties: {
|
|
1693
|
+
opacity: "0.5",
|
|
1694
|
+
cursor: "not-allowed"
|
|
1695
|
+
}
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
name: "one-time-picker-input-focus-visible",
|
|
1699
|
+
selector: ".one-time-picker__input:focus-visible",
|
|
1461
1700
|
properties: {
|
|
1462
1701
|
outline: `2px solid var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus})`,
|
|
1463
|
-
outlineOffset: "
|
|
1702
|
+
outlineOffset: "2px",
|
|
1703
|
+
borderColor: `var(--one-input-focus-border-color, var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus}))`
|
|
1464
1704
|
}
|
|
1465
1705
|
},
|
|
1466
1706
|
{
|
|
1467
|
-
name: "one-
|
|
1468
|
-
selector: ".one-
|
|
1707
|
+
name: "one-time-picker-panel",
|
|
1708
|
+
selector: ".one-time-picker__panel",
|
|
1469
1709
|
properties: {
|
|
1470
|
-
|
|
1710
|
+
position: "absolute",
|
|
1711
|
+
top: "calc(100% + 4px)",
|
|
1712
|
+
left: "0",
|
|
1713
|
+
zIndex: "1",
|
|
1714
|
+
display: "flex",
|
|
1715
|
+
gap: "8px",
|
|
1716
|
+
padding: "8px",
|
|
1717
|
+
border: oneThemeBorder(),
|
|
1718
|
+
borderRadius: `var(--one-radius-md, ${ONE_THEME_DEFAULTS.radiusMd})`,
|
|
1719
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
1720
|
+
boxShadow: `var(--one-shadow-card, ${ONE_THEME_DEFAULTS.shadowCard})`
|
|
1721
|
+
}
|
|
1722
|
+
},
|
|
1723
|
+
{
|
|
1724
|
+
name: "one-time-picker-column",
|
|
1725
|
+
selector: ".one-time-picker__column",
|
|
1726
|
+
properties: {
|
|
1727
|
+
display: "flex",
|
|
1728
|
+
flexDirection: "column",
|
|
1729
|
+
gap: "2px",
|
|
1730
|
+
maxHeight: "240px",
|
|
1731
|
+
overflowY: "auto"
|
|
1732
|
+
}
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
name: "one-time-picker-column-label",
|
|
1736
|
+
selector: ".one-time-picker__column-label",
|
|
1737
|
+
properties: {
|
|
1738
|
+
padding: "2px 8px",
|
|
1739
|
+
fontSize: `var(--one-font-size-sm, ${ONE_THEME_DEFAULTS.fontSizeSm})`,
|
|
1740
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`
|
|
1741
|
+
}
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
name: "one-time-picker-option",
|
|
1745
|
+
selector: ".one-time-picker__option",
|
|
1746
|
+
properties: {
|
|
1747
|
+
padding: "4px 8px",
|
|
1748
|
+
border: "0",
|
|
1749
|
+
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`,
|
|
1750
|
+
backgroundColor: "transparent",
|
|
1751
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`,
|
|
1752
|
+
cursor: "pointer",
|
|
1753
|
+
textAlign: "center"
|
|
1754
|
+
}
|
|
1755
|
+
},
|
|
1756
|
+
{
|
|
1757
|
+
name: "one-time-picker-option-selected",
|
|
1758
|
+
selector: ".one-time-picker__option--selected",
|
|
1759
|
+
properties: {
|
|
1760
|
+
backgroundColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`,
|
|
1761
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
1471
1762
|
}
|
|
1472
1763
|
}
|
|
1473
1764
|
];
|
|
1765
|
+
function normalizeStep(value) {
|
|
1766
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : 60;
|
|
1767
|
+
}
|
|
1768
|
+
function pad(value) {
|
|
1769
|
+
return value < 10 ? `0${value}` : String(value);
|
|
1770
|
+
}
|
|
1771
|
+
function parseTime(value) {
|
|
1772
|
+
const match = /^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(value.trim());
|
|
1773
|
+
if (!match) {
|
|
1774
|
+
return null;
|
|
1775
|
+
}
|
|
1776
|
+
const hour = Number(match[1]);
|
|
1777
|
+
const minute = Number(match[2]);
|
|
1778
|
+
const second = match[3] === undefined ? 0 : Number(match[3]);
|
|
1779
|
+
if (hour > 23 || minute > 59 || second > 59) {
|
|
1780
|
+
return null;
|
|
1781
|
+
}
|
|
1782
|
+
return { hour, minute, second };
|
|
1783
|
+
}
|
|
1784
|
+
function formatTime(parts, includeSeconds) {
|
|
1785
|
+
return includeSeconds ? `${pad(parts.hour)}:${pad(parts.minute)}:${pad(parts.second)}` : `${pad(parts.hour)}:${pad(parts.minute)}`;
|
|
1786
|
+
}
|
|
1474
1787
|
|
|
1475
|
-
class
|
|
1476
|
-
|
|
1788
|
+
class OneTimePicker extends Component11 {
|
|
1789
|
+
fieldContext;
|
|
1790
|
+
unsubscribe;
|
|
1477
1791
|
initState() {
|
|
1478
|
-
return {
|
|
1792
|
+
return {
|
|
1793
|
+
internalValue: this.props.defaultValue ?? "",
|
|
1794
|
+
open: false,
|
|
1795
|
+
revision: 0
|
|
1796
|
+
};
|
|
1479
1797
|
}
|
|
1480
1798
|
initStyles() {
|
|
1481
|
-
|
|
1799
|
+
ONE_TIME_PICKER_STYLES.forEach(({ name, ...style }) => {
|
|
1482
1800
|
this.styleManager.addStyle(name, style);
|
|
1483
1801
|
});
|
|
1484
1802
|
}
|
|
1485
1803
|
render() {
|
|
1486
|
-
|
|
1487
|
-
const
|
|
1804
|
+
this.state.revision;
|
|
1805
|
+
const size = normalizeOneSize(this.props.size);
|
|
1806
|
+
const step = normalizeStep(this.props.step);
|
|
1807
|
+
const includeSeconds = step < 60;
|
|
1808
|
+
const minuteIncrement = includeSeconds ? 1 : Math.max(1, Math.floor(step / 60));
|
|
1809
|
+
const fieldContext = this.fieldContext;
|
|
1810
|
+
const fieldErrors = fieldContext?.model.getErrors(fieldContext.name) ?? [];
|
|
1811
|
+
const invalid = this.props.invalid || fieldErrors.length > 0;
|
|
1812
|
+
const text = this.getDisplayValue();
|
|
1813
|
+
const parts = parseTime(text);
|
|
1814
|
+
const disabled = this.props.disabled === true;
|
|
1815
|
+
const readonly = this.props.readonly === true;
|
|
1816
|
+
const minParts = this.props.min ? parseTime(this.props.min) : undefined;
|
|
1817
|
+
const maxParts = this.props.max ? parseTime(this.props.max) : undefined;
|
|
1818
|
+
const startHour = minParts?.hour ?? 0;
|
|
1819
|
+
const endHour = maxParts?.hour ?? 23;
|
|
1820
|
+
const minuteStart = minParts && parts?.hour === minParts.hour ? minParts.minute : 0;
|
|
1821
|
+
const minuteEnd = maxParts && parts?.hour === maxParts.hour ? maxParts.minute : 59;
|
|
1822
|
+
const secondStart = minParts && parts?.hour === minParts.hour && parts?.minute === minParts.minute ? minParts.second : 0;
|
|
1823
|
+
const secondEnd = maxParts && parts?.hour === maxParts.hour && parts?.minute === maxParts.minute ? maxParts.second : 59;
|
|
1824
|
+
const inputClassNames = [
|
|
1825
|
+
"one-time-picker__input",
|
|
1826
|
+
...invalid ? ["one-time-picker__input--invalid"] : [],
|
|
1827
|
+
`one-time-picker__input--${size}`
|
|
1828
|
+
];
|
|
1488
1829
|
return {
|
|
1489
|
-
tag: "
|
|
1490
|
-
props: { className: "one-
|
|
1830
|
+
tag: "div",
|
|
1831
|
+
props: { className: "one-time-picker" },
|
|
1491
1832
|
children: [
|
|
1492
1833
|
{
|
|
1493
|
-
tag: "
|
|
1834
|
+
tag: "input",
|
|
1494
1835
|
props: {
|
|
1495
|
-
className: "
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1836
|
+
className: inputClassNames.join(" "),
|
|
1837
|
+
type: "text",
|
|
1838
|
+
value: text,
|
|
1839
|
+
name: fieldContext?.name ?? this.props.name,
|
|
1840
|
+
id: fieldContext?.controlId,
|
|
1841
|
+
placeholder: this.props.placeholder ?? "请选择时间",
|
|
1842
|
+
disabled,
|
|
1843
|
+
readonly,
|
|
1844
|
+
required: this.props.required === true,
|
|
1845
|
+
"aria-invalid": invalid ? "true" : undefined,
|
|
1846
|
+
"aria-expanded": this.state.open ? "true" : "false",
|
|
1847
|
+
"aria-haspopup": "dialog",
|
|
1848
|
+
"aria-describedby": fieldContext?.describedBy,
|
|
1849
|
+
"aria-label": this.props.ariaLabel
|
|
1499
1850
|
},
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
tabindex: selected ? 0 : -1,
|
|
1511
|
-
"aria-selected": selected ? "true" : "false",
|
|
1512
|
-
"aria-controls": `${this.idPrefix}-panel-${index}`
|
|
1513
|
-
},
|
|
1514
|
-
listeners: {
|
|
1515
|
-
click: (event) => this.activate(item, index, event),
|
|
1516
|
-
keydown: (event) => this.handleKeydown(event, index)
|
|
1517
|
-
},
|
|
1518
|
-
children: [item.label]
|
|
1519
|
-
};
|
|
1520
|
-
})
|
|
1851
|
+
listeners: {
|
|
1852
|
+
click: () => {
|
|
1853
|
+
if (!disabled && !readonly) {
|
|
1854
|
+
this.state.open = !this.state.open;
|
|
1855
|
+
}
|
|
1856
|
+
},
|
|
1857
|
+
keydown: (event) => this.handleKeydown(event),
|
|
1858
|
+
input: (event) => this.emitValue("input", event),
|
|
1859
|
+
change: (event) => this.emitValue("change", event)
|
|
1860
|
+
}
|
|
1521
1861
|
},
|
|
1522
|
-
...
|
|
1862
|
+
...this.state.open ? [
|
|
1863
|
+
{
|
|
1864
|
+
tag: "div",
|
|
1865
|
+
props: {
|
|
1866
|
+
className: "one-time-picker__panel",
|
|
1867
|
+
role: "dialog",
|
|
1868
|
+
"aria-label": "选择时间"
|
|
1869
|
+
},
|
|
1870
|
+
children: [
|
|
1871
|
+
this.buildColumn("时", this.rangeValues(startHour, endHour, 1), parts?.hour, "hour", false),
|
|
1872
|
+
this.buildColumn("分", this.rangeValues(minuteStart, minuteEnd, minuteIncrement), parts?.minute, "minute", !includeSeconds),
|
|
1873
|
+
...includeSeconds ? [
|
|
1874
|
+
this.buildColumn("秒", this.rangeValues(secondStart, secondEnd, step), parts?.second, "second", true)
|
|
1875
|
+
] : []
|
|
1876
|
+
]
|
|
1877
|
+
}
|
|
1878
|
+
] : []
|
|
1879
|
+
]
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
onUpdated() {
|
|
1883
|
+
if (this.fieldContext || this.props.value === undefined) {
|
|
1884
|
+
return;
|
|
1885
|
+
}
|
|
1886
|
+
const root = this.getElement();
|
|
1887
|
+
const input = root instanceof HTMLInputElement ? root : root instanceof HTMLElement ? root.querySelector("input") : null;
|
|
1888
|
+
if (input instanceof HTMLInputElement) {
|
|
1889
|
+
input.value = this.props.value;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
beforeMount() {
|
|
1893
|
+
this.fieldContext = this.inject(ONE_FORM_FIELD_KEY);
|
|
1894
|
+
if (this.fieldContext) {
|
|
1895
|
+
this.fieldContext.model.ensureValue(this.fieldContext.name, this.props.value ?? this.props.defaultValue ?? "");
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
onMounted() {
|
|
1899
|
+
this.unsubscribe = this.fieldContext?.model.subscribe(() => {
|
|
1900
|
+
this.state.revision += 1;
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
onUnmounted() {
|
|
1904
|
+
this.unsubscribe?.();
|
|
1905
|
+
this.unsubscribe = undefined;
|
|
1906
|
+
this.fieldContext = undefined;
|
|
1907
|
+
}
|
|
1908
|
+
getDisplayValue() {
|
|
1909
|
+
const value = this.fieldContext ? this.fieldContext.model.getValue(this.fieldContext.name) : this.props.value ?? this.state.internalValue;
|
|
1910
|
+
return typeof value === "string" ? value : "";
|
|
1911
|
+
}
|
|
1912
|
+
rangeValues(start, end, increment) {
|
|
1913
|
+
const values = [];
|
|
1914
|
+
for (let value = start;value <= end; value += increment) {
|
|
1915
|
+
values.push(value);
|
|
1916
|
+
}
|
|
1917
|
+
return values;
|
|
1918
|
+
}
|
|
1919
|
+
buildColumn(label, values, selectedValue, part, isLast) {
|
|
1920
|
+
return {
|
|
1921
|
+
tag: "div",
|
|
1922
|
+
props: { className: "one-time-picker__column" },
|
|
1923
|
+
children: [
|
|
1924
|
+
{
|
|
1523
1925
|
tag: "div",
|
|
1926
|
+
props: { className: "one-time-picker__column-label" },
|
|
1927
|
+
children: [label]
|
|
1928
|
+
},
|
|
1929
|
+
...values.map((value) => ({
|
|
1930
|
+
tag: "button",
|
|
1524
1931
|
props: {
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
"aria-labelledby": `${this.idPrefix}-tab-${index}`
|
|
1932
|
+
type: "button",
|
|
1933
|
+
className: [
|
|
1934
|
+
"one-time-picker__option",
|
|
1935
|
+
...selectedValue === value ? ["one-time-picker__option--selected"] : []
|
|
1936
|
+
].join(" ")
|
|
1531
1937
|
},
|
|
1532
|
-
children: [
|
|
1938
|
+
children: [pad(value)],
|
|
1939
|
+
listeners: {
|
|
1940
|
+
click: (event) => this.commitPart(part, value, isLast, event)
|
|
1941
|
+
}
|
|
1533
1942
|
}))
|
|
1534
1943
|
]
|
|
1535
1944
|
};
|
|
1536
1945
|
}
|
|
1537
|
-
|
|
1538
|
-
const
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
})
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
const selected = items.find((item) => item.value === candidate && !item.disabled);
|
|
1551
|
-
return selected?.value ?? items.find((item) => !item.disabled)?.value;
|
|
1552
|
-
}
|
|
1553
|
-
activate(item, index, event) {
|
|
1554
|
-
if (item.disabled) {
|
|
1555
|
-
return;
|
|
1946
|
+
commitPart(part, value, isLast, event) {
|
|
1947
|
+
const current = parseTime(this.getDisplayValue()) ?? {
|
|
1948
|
+
hour: 0,
|
|
1949
|
+
minute: 0,
|
|
1950
|
+
second: 0
|
|
1951
|
+
};
|
|
1952
|
+
const next = { ...current };
|
|
1953
|
+
if (part === "hour") {
|
|
1954
|
+
next.hour = value;
|
|
1955
|
+
} else if (part === "minute") {
|
|
1956
|
+
next.minute = value;
|
|
1957
|
+
} else {
|
|
1958
|
+
next.second = value;
|
|
1556
1959
|
}
|
|
1557
|
-
this.
|
|
1558
|
-
|
|
1559
|
-
|
|
1960
|
+
const formatted = formatTime(next, normalizeStep(this.props.step) < 60);
|
|
1961
|
+
this.writeValue(formatted, event);
|
|
1962
|
+
if (isLast) {
|
|
1963
|
+
this.state.open = false;
|
|
1560
1964
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1965
|
+
}
|
|
1966
|
+
writeValue(value, event) {
|
|
1967
|
+
if (this.fieldContext) {
|
|
1968
|
+
this.fieldContext.model.setValue(this.fieldContext.name, value);
|
|
1969
|
+
} else if (this.props.value === undefined) {
|
|
1970
|
+
this.state.internalValue = value;
|
|
1563
1971
|
}
|
|
1972
|
+
this.emit("input", {
|
|
1973
|
+
value,
|
|
1974
|
+
originalEvent: event
|
|
1975
|
+
});
|
|
1564
1976
|
this.emit("change", {
|
|
1565
|
-
value
|
|
1977
|
+
value,
|
|
1566
1978
|
originalEvent: event
|
|
1567
1979
|
});
|
|
1568
1980
|
}
|
|
1569
|
-
handleKeydown(event
|
|
1981
|
+
handleKeydown(event) {
|
|
1570
1982
|
if (!(event instanceof KeyboardEvent)) {
|
|
1571
1983
|
return;
|
|
1572
1984
|
}
|
|
1573
|
-
if (
|
|
1574
|
-
|
|
1575
|
-
}
|
|
1576
|
-
const items = this.normalizedItems();
|
|
1577
|
-
const enabled = this.enabledIndices(items);
|
|
1578
|
-
if (enabled.length === 0) {
|
|
1579
|
-
return;
|
|
1985
|
+
if (event.key === "Escape") {
|
|
1986
|
+
this.state.open = false;
|
|
1580
1987
|
}
|
|
1581
|
-
event.preventDefault();
|
|
1582
|
-
const currentPosition = Math.max(0, enabled.indexOf(currentIndex));
|
|
1583
|
-
const nextPosition = event.key === "Home" ? 0 : event.key === "End" ? enabled.length - 1 : event.key === "ArrowRight" ? (currentPosition + 1) % enabled.length : (currentPosition - 1 + enabled.length) % enabled.length;
|
|
1584
|
-
const nextIndex = enabled[nextPosition];
|
|
1585
|
-
this.focusTab(nextIndex);
|
|
1586
|
-
this.activate(items[nextIndex], nextIndex, event);
|
|
1587
1988
|
}
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
focusTab(index) {
|
|
1592
|
-
const element = this.getElement();
|
|
1593
|
-
if (!(element instanceof HTMLElement)) {
|
|
1989
|
+
emitValue(eventName, event) {
|
|
1990
|
+
const input = event.currentTarget;
|
|
1991
|
+
if (!(input instanceof HTMLInputElement)) {
|
|
1594
1992
|
return;
|
|
1595
1993
|
}
|
|
1596
|
-
const
|
|
1597
|
-
|
|
1994
|
+
const nextValue = input.value;
|
|
1995
|
+
if (this.fieldContext) {
|
|
1996
|
+
this.fieldContext.model.setValue(this.fieldContext.name, nextValue);
|
|
1997
|
+
} else if (this.props.value === undefined) {
|
|
1998
|
+
this.state.internalValue = nextValue;
|
|
1999
|
+
}
|
|
2000
|
+
this.emit(eventName, { value: nextValue, originalEvent: event });
|
|
2001
|
+
if (!this.fieldContext && this.props.value !== undefined) {
|
|
2002
|
+
input.value = this.props.value;
|
|
2003
|
+
}
|
|
1598
2004
|
}
|
|
1599
2005
|
}
|
|
1600
|
-
// lib/
|
|
1601
|
-
import { Component as
|
|
1602
|
-
|
|
1603
|
-
// lib/navigation/normalize.ts
|
|
1604
|
-
function normalizeNonNegativeInteger(value, fallback) {
|
|
1605
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : Math.max(0, Math.floor(fallback));
|
|
1606
|
-
}
|
|
1607
|
-
function normalizePositiveInteger(value, fallback) {
|
|
1608
|
-
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : Math.max(1, Math.floor(fallback));
|
|
1609
|
-
}
|
|
1610
|
-
function normalizePositiveIntegerList(values, fallback) {
|
|
1611
|
-
const source = Array.isArray(values) ? values : fallback;
|
|
1612
|
-
return [
|
|
1613
|
-
...new Set(source.filter((value) => typeof value === "number" && Number.isFinite(value) && value > 0).map(Math.floor))
|
|
1614
|
-
];
|
|
1615
|
-
}
|
|
1616
|
-
// lib/breadcrumb/OneBreadcrumb.ts
|
|
1617
|
-
var ONE_BREADCRUMB_STYLES = [
|
|
2006
|
+
// lib/slider/OneSlider.ts
|
|
2007
|
+
import { Component as Component12 } from "@geektech/tsone";
|
|
2008
|
+
var ONE_SLIDER_STYLES = [
|
|
1618
2009
|
{
|
|
1619
|
-
name: "one-
|
|
1620
|
-
selector: ".one-
|
|
2010
|
+
name: "one-slider-base",
|
|
2011
|
+
selector: ".one-slider",
|
|
1621
2012
|
properties: {
|
|
1622
2013
|
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
1623
|
-
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
1624
|
-
}
|
|
1625
|
-
},
|
|
1626
|
-
{
|
|
1627
|
-
name: "one-breadcrumb-list",
|
|
1628
|
-
selector: ".one-breadcrumb__list",
|
|
1629
|
-
properties: {
|
|
1630
|
-
display: "flex",
|
|
1631
|
-
flexWrap: "wrap",
|
|
1632
|
-
gap: ONE_THEME_DEFAULTS.spaceXs,
|
|
1633
|
-
alignItems: "center",
|
|
1634
|
-
margin: "0",
|
|
1635
|
-
padding: "0",
|
|
1636
|
-
listStyle: "none"
|
|
1637
|
-
}
|
|
1638
|
-
},
|
|
1639
|
-
{
|
|
1640
|
-
name: "one-breadcrumb-token",
|
|
1641
|
-
selector: ".one-breadcrumb__item, .one-breadcrumb__collapse",
|
|
1642
|
-
properties: {
|
|
1643
2014
|
display: "inline-flex",
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
{
|
|
1649
|
-
name: "one-breadcrumb-link",
|
|
1650
|
-
selector: ".one-breadcrumb__link",
|
|
1651
|
-
properties: {
|
|
1652
|
-
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
1653
|
-
textDecoration: "none"
|
|
1654
|
-
},
|
|
1655
|
-
hover: {
|
|
1656
|
-
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
1657
|
-
}
|
|
1658
|
-
},
|
|
1659
|
-
{
|
|
1660
|
-
name: "one-breadcrumb-link-focus-visible",
|
|
1661
|
-
selector: ".one-breadcrumb__link:focus-visible",
|
|
1662
|
-
properties: {
|
|
1663
|
-
outline: `2px solid var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus})`,
|
|
1664
|
-
outlineOffset: "2px"
|
|
2015
|
+
alignItems: "center",
|
|
2016
|
+
gap: "12px",
|
|
2017
|
+
width: "100%",
|
|
2018
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
1665
2019
|
}
|
|
1666
2020
|
},
|
|
1667
2021
|
{
|
|
1668
|
-
name: "one-
|
|
1669
|
-
selector: ".one-
|
|
1670
|
-
properties: { fontWeight: "600" }
|
|
1671
|
-
},
|
|
1672
|
-
{
|
|
1673
|
-
name: "one-breadcrumb-separator",
|
|
1674
|
-
selector: ".one-breadcrumb__separator",
|
|
2022
|
+
name: "one-slider-input",
|
|
2023
|
+
selector: ".one-slider__input",
|
|
1675
2024
|
properties: {
|
|
1676
|
-
|
|
1677
|
-
|
|
2025
|
+
flex: "1",
|
|
2026
|
+
minWidth: "160px",
|
|
2027
|
+
accentColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
1678
2028
|
}
|
|
1679
2029
|
},
|
|
1680
2030
|
{
|
|
1681
|
-
name: "one-
|
|
1682
|
-
selector: ".one-
|
|
2031
|
+
name: "one-slider-value",
|
|
2032
|
+
selector: ".one-slider__value",
|
|
1683
2033
|
properties: {
|
|
1684
|
-
|
|
2034
|
+
minWidth: "3em",
|
|
2035
|
+
textAlign: "right",
|
|
1685
2036
|
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
1686
|
-
|
|
1687
|
-
border: "0",
|
|
1688
|
-
cursor: "pointer",
|
|
1689
|
-
font: "inherit"
|
|
2037
|
+
fontSize: `var(--one-font-size-sm, ${ONE_THEME_DEFAULTS.fontSizeSm})`
|
|
1690
2038
|
}
|
|
1691
2039
|
},
|
|
1692
2040
|
{
|
|
1693
|
-
name: "one-
|
|
1694
|
-
selector: ".one-
|
|
1695
|
-
properties: {
|
|
1696
|
-
outline: `2px solid var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus})`,
|
|
1697
|
-
outlineOffset: "2px"
|
|
1698
|
-
}
|
|
2041
|
+
name: "one-slider-disabled",
|
|
2042
|
+
selector: ".one-slider--disabled",
|
|
2043
|
+
properties: { opacity: "0.5" }
|
|
1699
2044
|
}
|
|
1700
2045
|
];
|
|
2046
|
+
function normalizeOneSliderNumber(value, fallback) {
|
|
2047
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
2048
|
+
}
|
|
2049
|
+
function clampOneSliderValue(value, min, max) {
|
|
2050
|
+
return Math.min(max, Math.max(min, value));
|
|
2051
|
+
}
|
|
1701
2052
|
|
|
1702
|
-
class
|
|
2053
|
+
class OneSlider extends Component12 {
|
|
1703
2054
|
initState() {
|
|
1704
|
-
return {
|
|
2055
|
+
return {
|
|
2056
|
+
internalValue: normalizeOneSliderNumber(this.props.defaultValue, 0)
|
|
2057
|
+
};
|
|
1705
2058
|
}
|
|
1706
2059
|
initStyles() {
|
|
1707
|
-
|
|
2060
|
+
ONE_SLIDER_STYLES.forEach(({ name, ...style }) => {
|
|
1708
2061
|
this.styleManager.addStyle(name, style);
|
|
1709
2062
|
});
|
|
1710
2063
|
}
|
|
1711
2064
|
render() {
|
|
1712
|
-
const
|
|
1713
|
-
const
|
|
1714
|
-
const
|
|
2065
|
+
const min = normalizeOneSliderNumber(this.props.min, 0);
|
|
2066
|
+
const max = normalizeOneSliderNumber(this.props.max, 100);
|
|
2067
|
+
const step = normalizeOneSliderNumber(this.props.step, 1);
|
|
2068
|
+
const rawValue = normalizeOneSliderNumber(this.props.value ?? this.state.internalValue, 0);
|
|
2069
|
+
const value = clampOneSliderValue(rawValue, min, max);
|
|
2070
|
+
const disabled = this.props.disabled === true;
|
|
1715
2071
|
return {
|
|
1716
|
-
tag: "
|
|
2072
|
+
tag: "div",
|
|
1717
2073
|
props: {
|
|
1718
|
-
className:
|
|
1719
|
-
|
|
2074
|
+
className: [
|
|
2075
|
+
"one-slider",
|
|
2076
|
+
...disabled ? ["one-slider--disabled"] : []
|
|
2077
|
+
].join(" ")
|
|
1720
2078
|
},
|
|
1721
2079
|
children: [
|
|
1722
2080
|
{
|
|
1723
|
-
tag: "
|
|
1724
|
-
props: {
|
|
1725
|
-
|
|
1726
|
-
|
|
2081
|
+
tag: "input",
|
|
2082
|
+
props: {
|
|
2083
|
+
className: "one-slider__input",
|
|
2084
|
+
type: "range",
|
|
2085
|
+
min: String(min),
|
|
2086
|
+
max: String(max),
|
|
2087
|
+
step: String(step),
|
|
2088
|
+
value: String(value),
|
|
2089
|
+
disabled,
|
|
2090
|
+
"aria-label": this.props.ariaLabel,
|
|
2091
|
+
"aria-valuenow": String(value),
|
|
2092
|
+
"aria-valuemin": String(min),
|
|
2093
|
+
"aria-valuemax": String(max)
|
|
2094
|
+
},
|
|
2095
|
+
listeners: {
|
|
2096
|
+
input: (event) => this.emitValue("input", event),
|
|
2097
|
+
change: (event) => this.emitValue("change", event)
|
|
2098
|
+
}
|
|
2099
|
+
},
|
|
2100
|
+
...this.props.showValue ? [
|
|
2101
|
+
{
|
|
2102
|
+
tag: "output",
|
|
2103
|
+
props: { className: "one-slider__value" },
|
|
2104
|
+
children: [String(value)]
|
|
2105
|
+
}
|
|
2106
|
+
] : []
|
|
1727
2107
|
]
|
|
1728
2108
|
};
|
|
1729
2109
|
}
|
|
1730
|
-
|
|
1731
|
-
const
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
const
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
const limit = Math.max(3, normalizePositiveInteger(this.props.maxItems, items.length || 3));
|
|
1740
|
-
if (this.state.expanded || items.length <= limit) {
|
|
1741
|
-
return items.map((item, index) => ({ type: "item", item, index }));
|
|
2110
|
+
emitValue(eventName, event) {
|
|
2111
|
+
const input = event.currentTarget;
|
|
2112
|
+
if (!(input instanceof HTMLInputElement) || this.props.disabled)
|
|
2113
|
+
return;
|
|
2114
|
+
const min = normalizeOneSliderNumber(this.props.min, 0);
|
|
2115
|
+
const max = normalizeOneSliderNumber(this.props.max, 100);
|
|
2116
|
+
const value = clampOneSliderValue(normalizeOneSliderNumber(Number(input.value), 0), min, max);
|
|
2117
|
+
if (this.props.value === undefined) {
|
|
2118
|
+
this.setState({ internalValue: value });
|
|
1742
2119
|
}
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
visible.add(index);
|
|
1747
|
-
});
|
|
1748
|
-
const result = [];
|
|
1749
|
-
let hiddenStart = -1;
|
|
1750
|
-
items.forEach((item, index) => {
|
|
1751
|
-
if (!visible.has(index)) {
|
|
1752
|
-
if (hiddenStart < 0)
|
|
1753
|
-
hiddenStart = index;
|
|
1754
|
-
return;
|
|
1755
|
-
}
|
|
1756
|
-
if (hiddenStart >= 0) {
|
|
1757
|
-
result.push({ type: "collapse", key: `${hiddenStart}-${index - 1}` });
|
|
1758
|
-
hiddenStart = -1;
|
|
1759
|
-
}
|
|
1760
|
-
result.push({ type: "item", item, index });
|
|
2120
|
+
this.emit(eventName, {
|
|
2121
|
+
value,
|
|
2122
|
+
originalEvent: event
|
|
1761
2123
|
});
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
// lib/rate/OneRate.ts
|
|
2127
|
+
import { Component as Component13 } from "@geektech/tsone";
|
|
2128
|
+
var ONE_RATE_STYLES = [
|
|
2129
|
+
{
|
|
2130
|
+
name: "one-rate-base",
|
|
2131
|
+
selector: ".one-rate",
|
|
2132
|
+
properties: {
|
|
2133
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
2134
|
+
display: "inline-flex",
|
|
2135
|
+
alignItems: "center",
|
|
2136
|
+
gap: "2px",
|
|
2137
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
1767
2138
|
}
|
|
1768
|
-
|
|
2139
|
+
},
|
|
2140
|
+
{
|
|
2141
|
+
name: "one-rate-star",
|
|
2142
|
+
selector: ".one-rate__star",
|
|
2143
|
+
properties: {
|
|
2144
|
+
appearance: "none",
|
|
2145
|
+
border: "none",
|
|
2146
|
+
background: "transparent",
|
|
2147
|
+
padding: "2px",
|
|
2148
|
+
fontSize: "22px",
|
|
2149
|
+
lineHeight: "1",
|
|
2150
|
+
cursor: "pointer",
|
|
2151
|
+
color: `var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`,
|
|
2152
|
+
transition: "color 120ms ease"
|
|
2153
|
+
}
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
name: "one-rate-star-filled",
|
|
2157
|
+
selector: ".one-rate__star--filled",
|
|
2158
|
+
properties: {
|
|
2159
|
+
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
2160
|
+
}
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
name: "one-rate-star-hover",
|
|
2164
|
+
selector: ".one-rate__star:hover:not(:disabled)",
|
|
2165
|
+
properties: {
|
|
2166
|
+
color: `var(--one-color-primary-hover, ${ONE_THEME_DEFAULTS.colorPrimaryHover})`
|
|
2167
|
+
}
|
|
2168
|
+
},
|
|
2169
|
+
{
|
|
2170
|
+
name: "one-rate-readonly",
|
|
2171
|
+
selector: ".one-rate--readonly .one-rate__star",
|
|
2172
|
+
properties: { cursor: "default" }
|
|
2173
|
+
},
|
|
2174
|
+
{
|
|
2175
|
+
name: "one-rate-disabled",
|
|
2176
|
+
selector: ".one-rate--disabled",
|
|
2177
|
+
properties: { opacity: "0.5" }
|
|
1769
2178
|
}
|
|
1770
|
-
|
|
1771
|
-
|
|
2179
|
+
];
|
|
2180
|
+
function normalizeOneRateValue(value, fallback) {
|
|
2181
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
class OneRate extends Component13 {
|
|
2185
|
+
initState() {
|
|
1772
2186
|
return {
|
|
1773
|
-
|
|
1774
|
-
props: {
|
|
1775
|
-
className: token.type === "item" ? "one-breadcrumb__item" : "one-breadcrumb__collapse"
|
|
1776
|
-
},
|
|
1777
|
-
children: [content, ...hasSeparator ? [this.renderSeparator()] : []]
|
|
2187
|
+
internalValue: normalizeOneRateValue(this.props.defaultValue, 0)
|
|
1778
2188
|
};
|
|
1779
2189
|
}
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
2190
|
+
initStyles() {
|
|
2191
|
+
ONE_RATE_STYLES.forEach(({ name, ...style }) => {
|
|
2192
|
+
this.styleManager.addStyle(name, style);
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2195
|
+
render() {
|
|
2196
|
+
const count = this.getCount();
|
|
2197
|
+
const rawValue = normalizeOneRateValue(this.props.value ?? this.state.internalValue, 0);
|
|
2198
|
+
const value = Math.min(count, Math.max(0, rawValue));
|
|
2199
|
+
const disabled = this.props.disabled === true;
|
|
2200
|
+
const readonly = this.props.readonly === true;
|
|
2201
|
+
const stars = [];
|
|
2202
|
+
for (let index = 1;index <= count; index += 1) {
|
|
2203
|
+
const filled = index <= value;
|
|
2204
|
+
stars.push({
|
|
2205
|
+
tag: "button",
|
|
1784
2206
|
props: {
|
|
1785
|
-
|
|
1786
|
-
|
|
2207
|
+
type: "button",
|
|
2208
|
+
role: "radio",
|
|
2209
|
+
className: [
|
|
2210
|
+
"one-rate__star",
|
|
2211
|
+
...filled ? ["one-rate__star--filled"] : []
|
|
2212
|
+
].join(" "),
|
|
2213
|
+
"aria-checked": filled ? "true" : "false",
|
|
2214
|
+
"aria-label": this.props.ariaLabel ? `${index} ${this.props.ariaLabel}` : String(index),
|
|
2215
|
+
disabled: disabled || undefined
|
|
1787
2216
|
},
|
|
1788
|
-
|
|
1789
|
-
|
|
2217
|
+
listeners: {
|
|
2218
|
+
click: (event) => this.emitValue(index, event)
|
|
2219
|
+
},
|
|
2220
|
+
children: ["★"]
|
|
2221
|
+
});
|
|
1790
2222
|
}
|
|
1791
2223
|
return {
|
|
1792
|
-
tag: "
|
|
1793
|
-
props: { className: "one-breadcrumb__link", href: item.href },
|
|
1794
|
-
listeners: { click: (event) => this.handleItemClick(event, item, index) },
|
|
1795
|
-
children: [item.label]
|
|
1796
|
-
};
|
|
1797
|
-
}
|
|
1798
|
-
renderCollapse() {
|
|
1799
|
-
return {
|
|
1800
|
-
tag: "button",
|
|
2224
|
+
tag: "div",
|
|
1801
2225
|
props: {
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
2226
|
+
role: "radiogroup",
|
|
2227
|
+
className: [
|
|
2228
|
+
"one-rate",
|
|
2229
|
+
...disabled ? ["one-rate--disabled"] : [],
|
|
2230
|
+
...readonly ? ["one-rate--readonly"] : []
|
|
2231
|
+
].join(" "),
|
|
2232
|
+
"aria-label": this.props.ariaLabel
|
|
1806
2233
|
},
|
|
1807
|
-
|
|
1808
|
-
children: ["…"]
|
|
2234
|
+
children: stars
|
|
1809
2235
|
};
|
|
1810
2236
|
}
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
props: { className: "one-breadcrumb__separator", "aria-hidden": "true" },
|
|
1815
|
-
children: [
|
|
1816
|
-
this.hasSlot("separator") ? slot5("separator") : this.props.separator ?? "/"
|
|
1817
|
-
]
|
|
1818
|
-
};
|
|
2237
|
+
getCount() {
|
|
2238
|
+
const count = this.props.count;
|
|
2239
|
+
return typeof count === "number" && Number.isFinite(count) && count >= 1 ? Math.floor(count) : 5;
|
|
1819
2240
|
}
|
|
1820
|
-
|
|
1821
|
-
if (
|
|
2241
|
+
emitValue(index, event) {
|
|
2242
|
+
if (this.props.disabled === true || this.props.readonly === true)
|
|
1822
2243
|
return;
|
|
1823
|
-
this.
|
|
1824
|
-
|
|
1825
|
-
|
|
2244
|
+
const value = this.getCount();
|
|
2245
|
+
const current = Math.min(value, Math.max(0, normalizeOneRateValue(this.props.value ?? this.state.internalValue, 0)));
|
|
2246
|
+
let next = index;
|
|
2247
|
+
if (this.props.allowClear === true && index === current)
|
|
2248
|
+
next = 0;
|
|
2249
|
+
if (this.props.value === undefined) {
|
|
2250
|
+
this.setState({ internalValue: next });
|
|
2251
|
+
}
|
|
2252
|
+
this.emit("change", {
|
|
2253
|
+
value: next,
|
|
1826
2254
|
originalEvent: event
|
|
1827
2255
|
});
|
|
1828
2256
|
}
|
|
1829
|
-
hasSlot(name) {
|
|
1830
|
-
return this.props.children?.some((child) => typeof child !== "string" && child.slot === name) ?? false;
|
|
1831
|
-
}
|
|
1832
2257
|
}
|
|
1833
|
-
// lib/
|
|
1834
|
-
import { Component as
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
const sorted = [...pages].sort((left, right) => left - right);
|
|
1846
|
-
return sorted.flatMap((value, index) => {
|
|
1847
|
-
if (index === 0)
|
|
1848
|
-
return [value];
|
|
1849
|
-
const previous = sorted[index - 1];
|
|
1850
|
-
const gap = value - previous;
|
|
1851
|
-
if (gap === 2)
|
|
1852
|
-
return [previous + 1, value];
|
|
1853
|
-
if (gap > 2) {
|
|
1854
|
-
return [previous === 1 ? "ellipsis-start" : "ellipsis-end", value];
|
|
2258
|
+
// lib/upload/OneUpload.ts
|
|
2259
|
+
import { Component as Component14 } from "@geektech/tsone";
|
|
2260
|
+
var ONE_UPLOAD_STYLES = [
|
|
2261
|
+
{
|
|
2262
|
+
name: "one-upload-base",
|
|
2263
|
+
selector: ".one-upload",
|
|
2264
|
+
properties: {
|
|
2265
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
2266
|
+
display: "flex",
|
|
2267
|
+
flexDirection: "column",
|
|
2268
|
+
gap: `var(--one-space-sm, ${ONE_THEME_DEFAULTS.spaceSm})`,
|
|
2269
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
1855
2270
|
}
|
|
1856
|
-
|
|
1857
|
-
|
|
2271
|
+
},
|
|
2272
|
+
{
|
|
2273
|
+
name: "one-upload-trigger",
|
|
2274
|
+
selector: ".one-upload__trigger",
|
|
2275
|
+
properties: {
|
|
2276
|
+
display: "inline-flex",
|
|
2277
|
+
alignItems: "center",
|
|
2278
|
+
justifyContent: "center",
|
|
2279
|
+
alignSelf: "flex-start",
|
|
2280
|
+
gap: `var(--one-space-xs, ${ONE_THEME_DEFAULTS.spaceXs})`,
|
|
2281
|
+
boxSizing: "border-box",
|
|
2282
|
+
padding: `${ONE_THEME_DEFAULTS.spaceSm} ${ONE_THEME_DEFAULTS.spaceMd}`,
|
|
2283
|
+
borderRadius: `var(--one-radius-md, ${ONE_THEME_DEFAULTS.radiusMd})`,
|
|
2284
|
+
border: `1px dashed var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`,
|
|
2285
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
2286
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`,
|
|
2287
|
+
cursor: "pointer",
|
|
2288
|
+
transition: "border-color 150ms ease, color 150ms ease"
|
|
2289
|
+
}
|
|
2290
|
+
},
|
|
2291
|
+
{
|
|
2292
|
+
name: "one-upload-trigger-hover",
|
|
2293
|
+
selector: ".one-upload__trigger:hover",
|
|
2294
|
+
properties: {
|
|
2295
|
+
borderColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`,
|
|
2296
|
+
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
2297
|
+
}
|
|
2298
|
+
},
|
|
2299
|
+
{
|
|
2300
|
+
name: "one-upload-input",
|
|
2301
|
+
selector: ".one-upload__input",
|
|
2302
|
+
properties: {
|
|
2303
|
+
position: "absolute",
|
|
2304
|
+
width: "1px",
|
|
2305
|
+
height: "1px",
|
|
2306
|
+
padding: "0",
|
|
2307
|
+
margin: "-1px",
|
|
2308
|
+
overflow: "hidden",
|
|
2309
|
+
clip: "rect(0 0 0 0)",
|
|
2310
|
+
whiteSpace: "nowrap",
|
|
2311
|
+
border: "0"
|
|
2312
|
+
}
|
|
2313
|
+
},
|
|
2314
|
+
{
|
|
2315
|
+
name: "one-upload-list",
|
|
2316
|
+
selector: ".one-upload__list",
|
|
2317
|
+
properties: {
|
|
2318
|
+
display: "flex",
|
|
2319
|
+
flexDirection: "column",
|
|
2320
|
+
gap: `var(--one-space-xs, ${ONE_THEME_DEFAULTS.spaceXs})`
|
|
2321
|
+
}
|
|
2322
|
+
},
|
|
2323
|
+
{
|
|
2324
|
+
name: "one-upload-item",
|
|
2325
|
+
selector: ".one-upload__item",
|
|
2326
|
+
properties: {
|
|
2327
|
+
display: "flex",
|
|
2328
|
+
alignItems: "center",
|
|
2329
|
+
gap: `var(--one-space-sm, ${ONE_THEME_DEFAULTS.spaceSm})`,
|
|
2330
|
+
padding: `${ONE_THEME_DEFAULTS.spaceXs} ${ONE_THEME_DEFAULTS.spaceSm}`,
|
|
2331
|
+
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`,
|
|
2332
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
2333
|
+
border: oneThemeBorder(`var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`)
|
|
2334
|
+
}
|
|
2335
|
+
},
|
|
2336
|
+
{
|
|
2337
|
+
name: "one-upload-item-name",
|
|
2338
|
+
selector: ".one-upload__item-name",
|
|
2339
|
+
properties: {
|
|
2340
|
+
flex: "1",
|
|
2341
|
+
overflow: "hidden",
|
|
2342
|
+
textOverflow: "ellipsis",
|
|
2343
|
+
whiteSpace: "nowrap",
|
|
2344
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
2345
|
+
}
|
|
2346
|
+
},
|
|
2347
|
+
{
|
|
2348
|
+
name: "one-upload-item-size",
|
|
2349
|
+
selector: ".one-upload__item-size",
|
|
2350
|
+
properties: {
|
|
2351
|
+
flexShrink: "0",
|
|
2352
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
2353
|
+
fontSize: `var(--one-font-size-sm, ${ONE_THEME_DEFAULTS.fontSizeSm})`
|
|
2354
|
+
}
|
|
2355
|
+
},
|
|
2356
|
+
{
|
|
2357
|
+
name: "one-upload-remove",
|
|
2358
|
+
selector: ".one-upload__remove",
|
|
2359
|
+
properties: {
|
|
2360
|
+
appearance: "none",
|
|
2361
|
+
border: "none",
|
|
2362
|
+
background: "transparent",
|
|
2363
|
+
padding: "2px 6px",
|
|
2364
|
+
cursor: "pointer",
|
|
2365
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
2366
|
+
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`
|
|
2367
|
+
}
|
|
2368
|
+
},
|
|
2369
|
+
{
|
|
2370
|
+
name: "one-upload-remove-hover",
|
|
2371
|
+
selector: ".one-upload__remove:hover",
|
|
2372
|
+
properties: {
|
|
2373
|
+
color: `var(--one-color-danger, ${ONE_THEME_DEFAULTS.colorDanger})`,
|
|
2374
|
+
backgroundColor: `var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`
|
|
2375
|
+
}
|
|
2376
|
+
},
|
|
2377
|
+
{
|
|
2378
|
+
name: "one-upload-disabled",
|
|
2379
|
+
selector: ".one-upload--disabled",
|
|
2380
|
+
properties: { opacity: "0.5", pointerEvents: "none" }
|
|
2381
|
+
}
|
|
2382
|
+
];
|
|
2383
|
+
var uploadFileSequence = 0;
|
|
2384
|
+
function nextUploadFileId() {
|
|
2385
|
+
uploadFileSequence += 1;
|
|
2386
|
+
return `one-upload-${uploadFileSequence}`;
|
|
2387
|
+
}
|
|
2388
|
+
function formatOneFileSize(bytes) {
|
|
2389
|
+
if (bytes < 1024)
|
|
2390
|
+
return `${bytes} B`;
|
|
2391
|
+
if (bytes < 1024 * 1024)
|
|
2392
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
2393
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
1858
2394
|
}
|
|
1859
2395
|
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
2396
|
+
class OneUpload extends Component14 {
|
|
2397
|
+
initState() {
|
|
2398
|
+
return { internalFiles: [...this.props.defaultValue ?? []] };
|
|
2399
|
+
}
|
|
2400
|
+
initStyles() {
|
|
2401
|
+
ONE_UPLOAD_STYLES.forEach(({ name, ...style }) => {
|
|
2402
|
+
this.styleManager.addStyle(name, style);
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
render() {
|
|
2406
|
+
const disabled = this.props.disabled === true;
|
|
2407
|
+
const files = this.getFiles();
|
|
2408
|
+
const triggerLabel = this.props.children && this.props.children.length > 0 ? this.props.children : ["选择文件"];
|
|
2409
|
+
return {
|
|
2410
|
+
tag: "div",
|
|
2411
|
+
props: {
|
|
2412
|
+
className: ["one-upload", ...disabled ? ["one-upload--disabled"] : []].join(" ")
|
|
2413
|
+
},
|
|
2414
|
+
children: [
|
|
2415
|
+
{
|
|
2416
|
+
tag: "label",
|
|
2417
|
+
props: { className: "one-upload__trigger" },
|
|
2418
|
+
children: [
|
|
2419
|
+
{
|
|
2420
|
+
tag: "input",
|
|
2421
|
+
props: {
|
|
2422
|
+
type: "file",
|
|
2423
|
+
className: "one-upload__input",
|
|
2424
|
+
accept: this.props.accept,
|
|
2425
|
+
multiple: this.props.multiple === true || undefined,
|
|
2426
|
+
disabled: this.props.disabled === true || undefined,
|
|
2427
|
+
"aria-label": this.props.ariaLabel
|
|
2428
|
+
},
|
|
2429
|
+
listeners: {
|
|
2430
|
+
change: (event) => this.handleFiles(event)
|
|
2431
|
+
}
|
|
2432
|
+
},
|
|
2433
|
+
...triggerLabel
|
|
2434
|
+
]
|
|
2435
|
+
},
|
|
2436
|
+
...files.length > 0 ? [
|
|
2437
|
+
{
|
|
2438
|
+
tag: "ul",
|
|
2439
|
+
props: { className: "one-upload__list" },
|
|
2440
|
+
children: files.map((file) => ({
|
|
2441
|
+
tag: "li",
|
|
2442
|
+
props: { className: "one-upload__item" },
|
|
2443
|
+
children: [
|
|
2444
|
+
{
|
|
2445
|
+
tag: "span",
|
|
2446
|
+
props: { className: "one-upload__item-name" },
|
|
2447
|
+
children: [file.name]
|
|
2448
|
+
},
|
|
2449
|
+
...file.size !== undefined ? [
|
|
2450
|
+
{
|
|
2451
|
+
tag: "span",
|
|
2452
|
+
props: { className: "one-upload__item-size" },
|
|
2453
|
+
children: [formatOneFileSize(file.size)]
|
|
2454
|
+
}
|
|
2455
|
+
] : [],
|
|
2456
|
+
{
|
|
2457
|
+
tag: "button",
|
|
2458
|
+
props: {
|
|
2459
|
+
type: "button",
|
|
2460
|
+
className: "one-upload__remove",
|
|
2461
|
+
"aria-label": `移除 ${file.name}`,
|
|
2462
|
+
disabled: this.props.disabled === true || undefined
|
|
2463
|
+
},
|
|
2464
|
+
listeners: {
|
|
2465
|
+
click: () => this.removeFile(file.id)
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
]
|
|
2469
|
+
}))
|
|
2470
|
+
}
|
|
2471
|
+
] : []
|
|
2472
|
+
]
|
|
2473
|
+
};
|
|
2474
|
+
}
|
|
2475
|
+
getFiles() {
|
|
2476
|
+
return this.props.value ?? this.state.internalFiles;
|
|
2477
|
+
}
|
|
2478
|
+
handleFiles(event) {
|
|
2479
|
+
const input = event.currentTarget;
|
|
2480
|
+
if (!(input instanceof HTMLInputElement) || this.props.disabled)
|
|
2481
|
+
return;
|
|
2482
|
+
const incoming = Array.from(input.files ?? []).map((file) => ({
|
|
2483
|
+
id: nextUploadFileId(),
|
|
2484
|
+
name: file.name,
|
|
2485
|
+
size: file.size,
|
|
2486
|
+
type: file.type
|
|
2487
|
+
}));
|
|
2488
|
+
const current = this.getFiles();
|
|
2489
|
+
const merged = this.props.multiple === true ? [...current, ...incoming] : incoming;
|
|
2490
|
+
const max = this.props.max;
|
|
2491
|
+
const files = typeof max === "number" && max >= 1 ? merged.slice(0, max) : merged;
|
|
2492
|
+
if (this.props.value === undefined) {
|
|
2493
|
+
this.setState({ internalFiles: files });
|
|
2494
|
+
}
|
|
2495
|
+
this.emit("change", {
|
|
2496
|
+
files,
|
|
2497
|
+
originalEvent: event
|
|
2498
|
+
});
|
|
2499
|
+
input.value = "";
|
|
2500
|
+
}
|
|
2501
|
+
removeFile(id) {
|
|
2502
|
+
if (this.props.disabled === true)
|
|
2503
|
+
return;
|
|
2504
|
+
const files = this.getFiles().filter((file) => file.id !== id);
|
|
2505
|
+
if (this.props.value === undefined) {
|
|
2506
|
+
this.setState({ internalFiles: files });
|
|
2507
|
+
}
|
|
2508
|
+
this.emit("change", {
|
|
2509
|
+
files,
|
|
2510
|
+
originalEvent: new Event("change")
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
// lib/tabs/OneTabs.ts
|
|
2515
|
+
import { Component as Component15, slot as slot5 } from "@geektech/tsone";
|
|
2516
|
+
var tabsInstanceId = 0;
|
|
2517
|
+
function createTabsId() {
|
|
2518
|
+
tabsInstanceId += 1;
|
|
2519
|
+
return `one-tabs-${tabsInstanceId}`;
|
|
2520
|
+
}
|
|
2521
|
+
function normalizeId(value) {
|
|
2522
|
+
return typeof value === "string" && /^[A-Za-z_][A-Za-z0-9_-]*$/.test(value) ? value : createTabsId();
|
|
2523
|
+
}
|
|
2524
|
+
var ONE_TABS_STYLES = [
|
|
1863
2525
|
{
|
|
1864
|
-
name: "one-
|
|
1865
|
-
selector: ".one-
|
|
2526
|
+
name: "one-tabs-base",
|
|
2527
|
+
selector: ".one-tabs",
|
|
1866
2528
|
properties: {
|
|
1867
2529
|
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
1868
|
-
display: "flex",
|
|
1869
|
-
flexWrap: "wrap",
|
|
1870
|
-
gap: ONE_THEME_DEFAULTS.spaceSm,
|
|
1871
|
-
alignItems: "center",
|
|
1872
2530
|
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
1873
2531
|
}
|
|
1874
2532
|
},
|
|
1875
2533
|
{
|
|
1876
|
-
name: "one-
|
|
1877
|
-
selector: ".one-
|
|
2534
|
+
name: "one-tabs-list",
|
|
2535
|
+
selector: ".one-tabs__list",
|
|
1878
2536
|
properties: {
|
|
1879
2537
|
display: "flex",
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
2538
|
+
overflowX: "auto",
|
|
2539
|
+
borderBottom: oneThemeBorder()
|
|
2540
|
+
}
|
|
2541
|
+
},
|
|
2542
|
+
{
|
|
2543
|
+
name: "one-tabs-tab",
|
|
2544
|
+
selector: ".one-tabs__tab",
|
|
2545
|
+
properties: {
|
|
2546
|
+
position: "relative",
|
|
2547
|
+
flex: "0 0 auto",
|
|
2548
|
+
padding: `${ONE_THEME_DEFAULTS.spaceSm} ${ONE_THEME_DEFAULTS.spaceMd}`,
|
|
2549
|
+
color: "inherit",
|
|
2550
|
+
backgroundColor: "transparent",
|
|
2551
|
+
border: "0",
|
|
2552
|
+
cursor: "pointer",
|
|
2553
|
+
font: "inherit"
|
|
2554
|
+
},
|
|
2555
|
+
hover: {
|
|
2556
|
+
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
2557
|
+
}
|
|
2558
|
+
},
|
|
2559
|
+
{
|
|
2560
|
+
name: "one-tabs-tab-selected",
|
|
2561
|
+
selector: '.one-tabs__tab[aria-selected="true"]',
|
|
2562
|
+
properties: {
|
|
2563
|
+
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
2564
|
+
}
|
|
2565
|
+
},
|
|
2566
|
+
{
|
|
2567
|
+
name: "one-tabs-tab-selected-indicator",
|
|
2568
|
+
selector: '.one-tabs__tab[aria-selected="true"]::after',
|
|
2569
|
+
properties: {
|
|
2570
|
+
position: "absolute",
|
|
2571
|
+
right: "0",
|
|
2572
|
+
bottom: "-1px",
|
|
2573
|
+
left: "0",
|
|
2574
|
+
height: "2px",
|
|
2575
|
+
backgroundColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`,
|
|
2576
|
+
content: '""'
|
|
2577
|
+
}
|
|
2578
|
+
},
|
|
2579
|
+
{
|
|
2580
|
+
name: "one-tabs-tab-disabled",
|
|
2581
|
+
selector: ".one-tabs__tab:disabled",
|
|
2582
|
+
properties: {
|
|
2583
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
2584
|
+
cursor: "not-allowed"
|
|
2585
|
+
}
|
|
2586
|
+
},
|
|
2587
|
+
{
|
|
2588
|
+
name: "one-tabs-tab-focus-visible",
|
|
2589
|
+
selector: ".one-tabs__tab:focus-visible",
|
|
2590
|
+
properties: {
|
|
2591
|
+
outline: `2px solid var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus})`,
|
|
2592
|
+
outlineOffset: "-2px"
|
|
2593
|
+
}
|
|
2594
|
+
},
|
|
2595
|
+
{
|
|
2596
|
+
name: "one-tabs-panel",
|
|
2597
|
+
selector: ".one-tabs__panel",
|
|
2598
|
+
properties: {
|
|
2599
|
+
padding: `${ONE_THEME_DEFAULTS.spaceLg} 0`
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
];
|
|
2603
|
+
|
|
2604
|
+
class OneTabs extends Component15 {
|
|
2605
|
+
idPrefix = normalizeId(this.props.id);
|
|
2606
|
+
initState() {
|
|
2607
|
+
return { internalValue: this.props.defaultValue };
|
|
2608
|
+
}
|
|
2609
|
+
initStyles() {
|
|
2610
|
+
ONE_TABS_STYLES.forEach(({ name, ...style }) => {
|
|
2611
|
+
this.styleManager.addStyle(name, style);
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2614
|
+
render() {
|
|
2615
|
+
const items = this.normalizedItems();
|
|
2616
|
+
const value = this.effectiveValue(items);
|
|
2617
|
+
return {
|
|
2618
|
+
tag: "section",
|
|
2619
|
+
props: { className: "one-tabs" },
|
|
2620
|
+
children: [
|
|
2621
|
+
{
|
|
2622
|
+
tag: "div",
|
|
2623
|
+
props: {
|
|
2624
|
+
className: "one-tabs__list",
|
|
2625
|
+
role: "tablist",
|
|
2626
|
+
"aria-label": this.props.ariaLabel,
|
|
2627
|
+
"aria-orientation": "horizontal"
|
|
2628
|
+
},
|
|
2629
|
+
children: items.map((item, index) => {
|
|
2630
|
+
const selected = item.value === value;
|
|
2631
|
+
return {
|
|
2632
|
+
tag: "button",
|
|
2633
|
+
props: {
|
|
2634
|
+
className: "one-tabs__tab",
|
|
2635
|
+
type: "button",
|
|
2636
|
+
id: `${this.idPrefix}-tab-${index}`,
|
|
2637
|
+
role: "tab",
|
|
2638
|
+
disabled: item.disabled === true,
|
|
2639
|
+
tabindex: selected ? 0 : -1,
|
|
2640
|
+
"aria-selected": selected ? "true" : "false",
|
|
2641
|
+
"aria-controls": `${this.idPrefix}-panel-${index}`
|
|
2642
|
+
},
|
|
2643
|
+
listeners: {
|
|
2644
|
+
click: (event) => this.activate(item, index, event),
|
|
2645
|
+
keydown: (event) => this.handleKeydown(event, index)
|
|
2646
|
+
},
|
|
2647
|
+
children: [item.label]
|
|
2648
|
+
};
|
|
2649
|
+
})
|
|
2650
|
+
},
|
|
2651
|
+
...items.map((item, index) => ({
|
|
2652
|
+
tag: "div",
|
|
2653
|
+
props: {
|
|
2654
|
+
className: "one-tabs__panel",
|
|
2655
|
+
id: `${this.idPrefix}-panel-${index}`,
|
|
2656
|
+
role: "tabpanel",
|
|
2657
|
+
hidden: item.value === value ? undefined : true,
|
|
2658
|
+
tabindex: 0,
|
|
2659
|
+
"aria-labelledby": `${this.idPrefix}-tab-${index}`
|
|
2660
|
+
},
|
|
2661
|
+
children: [slot5(item.value)]
|
|
2662
|
+
}))
|
|
2663
|
+
]
|
|
2664
|
+
};
|
|
2665
|
+
}
|
|
2666
|
+
normalizedItems() {
|
|
2667
|
+
const items = Array.isArray(this.props.items) ? this.props.items : [];
|
|
2668
|
+
const values = new Set;
|
|
2669
|
+
return items.flatMap((item) => {
|
|
2670
|
+
if (!item || typeof item.value !== "string" || typeof item.label !== "string" || values.has(item.value)) {
|
|
2671
|
+
return [];
|
|
2672
|
+
}
|
|
2673
|
+
values.add(item.value);
|
|
2674
|
+
return [{ ...item, disabled: item.disabled === true }];
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
effectiveValue(items) {
|
|
2678
|
+
const candidate = this.props.value ?? this.state.internalValue;
|
|
2679
|
+
const selected = items.find((item) => item.value === candidate && !item.disabled);
|
|
2680
|
+
return selected?.value ?? items.find((item) => !item.disabled)?.value;
|
|
2681
|
+
}
|
|
2682
|
+
activate(item, index, event) {
|
|
2683
|
+
if (item.disabled) {
|
|
2684
|
+
return;
|
|
2685
|
+
}
|
|
2686
|
+
this.focusTab(index);
|
|
2687
|
+
if (item.value === this.effectiveValue(this.normalizedItems())) {
|
|
2688
|
+
return;
|
|
2689
|
+
}
|
|
2690
|
+
if (this.props.value === undefined) {
|
|
2691
|
+
this.state.internalValue = item.value;
|
|
2692
|
+
}
|
|
2693
|
+
this.emit("change", {
|
|
2694
|
+
value: item.value,
|
|
2695
|
+
originalEvent: event
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2698
|
+
handleKeydown(event, currentIndex) {
|
|
2699
|
+
if (!(event instanceof KeyboardEvent)) {
|
|
2700
|
+
return;
|
|
2701
|
+
}
|
|
2702
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) {
|
|
2703
|
+
return;
|
|
2704
|
+
}
|
|
2705
|
+
const items = this.normalizedItems();
|
|
2706
|
+
const enabled = this.enabledIndices(items);
|
|
2707
|
+
if (enabled.length === 0) {
|
|
2708
|
+
return;
|
|
2709
|
+
}
|
|
2710
|
+
event.preventDefault();
|
|
2711
|
+
const currentPosition = Math.max(0, enabled.indexOf(currentIndex));
|
|
2712
|
+
const nextPosition = event.key === "Home" ? 0 : event.key === "End" ? enabled.length - 1 : event.key === "ArrowRight" ? (currentPosition + 1) % enabled.length : (currentPosition - 1 + enabled.length) % enabled.length;
|
|
2713
|
+
const nextIndex = enabled[nextPosition];
|
|
2714
|
+
this.focusTab(nextIndex);
|
|
2715
|
+
this.activate(items[nextIndex], nextIndex, event);
|
|
2716
|
+
}
|
|
2717
|
+
enabledIndices(items) {
|
|
2718
|
+
return items.flatMap((item, index) => item.disabled ? [] : [index]);
|
|
2719
|
+
}
|
|
2720
|
+
focusTab(index) {
|
|
2721
|
+
const element = this.getElement();
|
|
2722
|
+
if (!(element instanceof HTMLElement)) {
|
|
2723
|
+
return;
|
|
2724
|
+
}
|
|
2725
|
+
const tab = element.querySelectorAll('[role="tab"]')[index];
|
|
2726
|
+
tab?.focus();
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
// lib/breadcrumb/OneBreadcrumb.ts
|
|
2730
|
+
import { Component as Component16, slot as slot6 } from "@geektech/tsone";
|
|
2731
|
+
|
|
2732
|
+
// lib/navigation/normalize.ts
|
|
2733
|
+
function normalizeNonNegativeInteger(value, fallback) {
|
|
2734
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : Math.max(0, Math.floor(fallback));
|
|
2735
|
+
}
|
|
2736
|
+
function normalizePositiveInteger(value, fallback) {
|
|
2737
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : Math.max(1, Math.floor(fallback));
|
|
2738
|
+
}
|
|
2739
|
+
function normalizePositiveIntegerList(values, fallback) {
|
|
2740
|
+
const source = Array.isArray(values) ? values : fallback;
|
|
2741
|
+
return [
|
|
2742
|
+
...new Set(source.filter((value) => typeof value === "number" && Number.isFinite(value) && value > 0).map(Math.floor))
|
|
2743
|
+
];
|
|
2744
|
+
}
|
|
2745
|
+
// lib/breadcrumb/OneBreadcrumb.ts
|
|
2746
|
+
var ONE_BREADCRUMB_STYLES = [
|
|
2747
|
+
{
|
|
2748
|
+
name: "one-breadcrumb-base",
|
|
2749
|
+
selector: ".one-breadcrumb",
|
|
2750
|
+
properties: {
|
|
2751
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
2752
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
2753
|
+
}
|
|
2754
|
+
},
|
|
2755
|
+
{
|
|
2756
|
+
name: "one-breadcrumb-list",
|
|
2757
|
+
selector: ".one-breadcrumb__list",
|
|
2758
|
+
properties: {
|
|
2759
|
+
display: "flex",
|
|
2760
|
+
flexWrap: "wrap",
|
|
2761
|
+
gap: ONE_THEME_DEFAULTS.spaceXs,
|
|
2762
|
+
alignItems: "center",
|
|
2763
|
+
margin: "0",
|
|
2764
|
+
padding: "0",
|
|
2765
|
+
listStyle: "none"
|
|
2766
|
+
}
|
|
2767
|
+
},
|
|
2768
|
+
{
|
|
2769
|
+
name: "one-breadcrumb-token",
|
|
2770
|
+
selector: ".one-breadcrumb__item, .one-breadcrumb__collapse",
|
|
2771
|
+
properties: {
|
|
2772
|
+
display: "inline-flex",
|
|
2773
|
+
gap: ONE_THEME_DEFAULTS.spaceXs,
|
|
2774
|
+
alignItems: "center"
|
|
2775
|
+
}
|
|
2776
|
+
},
|
|
2777
|
+
{
|
|
2778
|
+
name: "one-breadcrumb-link",
|
|
2779
|
+
selector: ".one-breadcrumb__link",
|
|
2780
|
+
properties: {
|
|
2781
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
2782
|
+
textDecoration: "none"
|
|
2783
|
+
},
|
|
2784
|
+
hover: {
|
|
2785
|
+
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
2786
|
+
}
|
|
2787
|
+
},
|
|
2788
|
+
{
|
|
2789
|
+
name: "one-breadcrumb-link-focus-visible",
|
|
2790
|
+
selector: ".one-breadcrumb__link:focus-visible",
|
|
2791
|
+
properties: {
|
|
2792
|
+
outline: `2px solid var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus})`,
|
|
2793
|
+
outlineOffset: "2px"
|
|
2794
|
+
}
|
|
2795
|
+
},
|
|
2796
|
+
{
|
|
2797
|
+
name: "one-breadcrumb-current",
|
|
2798
|
+
selector: ".one-breadcrumb__current",
|
|
2799
|
+
properties: { fontWeight: "600" }
|
|
2800
|
+
},
|
|
2801
|
+
{
|
|
2802
|
+
name: "one-breadcrumb-separator",
|
|
2803
|
+
selector: ".one-breadcrumb__separator",
|
|
2804
|
+
properties: {
|
|
2805
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
2806
|
+
userSelect: "none"
|
|
2807
|
+
}
|
|
2808
|
+
},
|
|
2809
|
+
{
|
|
2810
|
+
name: "one-breadcrumb-ellipsis",
|
|
2811
|
+
selector: ".one-breadcrumb__ellipsis",
|
|
2812
|
+
properties: {
|
|
2813
|
+
padding: `0 ${ONE_THEME_DEFAULTS.spaceXs}`,
|
|
2814
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
2815
|
+
backgroundColor: "transparent",
|
|
2816
|
+
border: "0",
|
|
2817
|
+
cursor: "pointer",
|
|
2818
|
+
font: "inherit"
|
|
2819
|
+
}
|
|
2820
|
+
},
|
|
2821
|
+
{
|
|
2822
|
+
name: "one-breadcrumb-ellipsis-focus-visible",
|
|
2823
|
+
selector: ".one-breadcrumb__ellipsis:focus-visible",
|
|
2824
|
+
properties: {
|
|
2825
|
+
outline: `2px solid var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus})`,
|
|
2826
|
+
outlineOffset: "2px"
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
];
|
|
2830
|
+
|
|
2831
|
+
class OneBreadcrumb extends Component16 {
|
|
2832
|
+
initState() {
|
|
2833
|
+
return { expanded: false };
|
|
2834
|
+
}
|
|
2835
|
+
initStyles() {
|
|
2836
|
+
ONE_BREADCRUMB_STYLES.forEach(({ name, ...style }) => {
|
|
2837
|
+
this.styleManager.addStyle(name, style);
|
|
2838
|
+
});
|
|
2839
|
+
}
|
|
2840
|
+
render() {
|
|
2841
|
+
const items = this.normalizedItems();
|
|
2842
|
+
const currentIndex = this.currentIndex(items);
|
|
2843
|
+
const tokens = this.tokens(items, currentIndex);
|
|
2844
|
+
return {
|
|
2845
|
+
tag: "nav",
|
|
2846
|
+
props: {
|
|
2847
|
+
className: "one-breadcrumb",
|
|
2848
|
+
"aria-label": this.props.ariaLabel ?? "面包屑"
|
|
2849
|
+
},
|
|
2850
|
+
children: [
|
|
2851
|
+
{
|
|
2852
|
+
tag: "ol",
|
|
2853
|
+
props: { className: "one-breadcrumb__list" },
|
|
2854
|
+
children: tokens.map((token, tokenIndex) => this.renderToken(token, tokenIndex < tokens.length - 1, currentIndex))
|
|
2855
|
+
}
|
|
2856
|
+
]
|
|
2857
|
+
};
|
|
2858
|
+
}
|
|
2859
|
+
normalizedItems() {
|
|
2860
|
+
const items = Array.isArray(this.props.items) ? this.props.items : [];
|
|
2861
|
+
return items.flatMap((item) => item && typeof item.label === "string" ? [{ ...item }] : []);
|
|
2862
|
+
}
|
|
2863
|
+
currentIndex(items) {
|
|
2864
|
+
const explicit = items.findIndex((item) => item.current === true);
|
|
2865
|
+
return explicit >= 0 ? explicit : items.length - 1;
|
|
2866
|
+
}
|
|
2867
|
+
tokens(items, currentIndex) {
|
|
2868
|
+
const limit = Math.max(3, normalizePositiveInteger(this.props.maxItems, items.length || 3));
|
|
2869
|
+
if (this.state.expanded || items.length <= limit) {
|
|
2870
|
+
return items.map((item, index) => ({ type: "item", item, index }));
|
|
2871
|
+
}
|
|
2872
|
+
const visible = new Set([0, currentIndex, items.length - 1]);
|
|
2873
|
+
const candidates = items.map((_, index) => index).filter((index) => !visible.has(index)).sort((left, right) => Math.abs(left - currentIndex) - Math.abs(right - currentIndex) || left - right);
|
|
2874
|
+
candidates.slice(0, Math.max(0, limit - visible.size)).forEach((index) => {
|
|
2875
|
+
visible.add(index);
|
|
2876
|
+
});
|
|
2877
|
+
const result = [];
|
|
2878
|
+
let hiddenStart = -1;
|
|
2879
|
+
items.forEach((item, index) => {
|
|
2880
|
+
if (!visible.has(index)) {
|
|
2881
|
+
if (hiddenStart < 0)
|
|
2882
|
+
hiddenStart = index;
|
|
2883
|
+
return;
|
|
2884
|
+
}
|
|
2885
|
+
if (hiddenStart >= 0) {
|
|
2886
|
+
result.push({ type: "collapse", key: `${hiddenStart}-${index - 1}` });
|
|
2887
|
+
hiddenStart = -1;
|
|
2888
|
+
}
|
|
2889
|
+
result.push({ type: "item", item, index });
|
|
2890
|
+
});
|
|
2891
|
+
if (hiddenStart >= 0) {
|
|
2892
|
+
result.push({
|
|
2893
|
+
type: "collapse",
|
|
2894
|
+
key: `${hiddenStart}-${items.length - 1}`
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2897
|
+
return result;
|
|
2898
|
+
}
|
|
2899
|
+
renderToken(token, hasSeparator, currentIndex) {
|
|
2900
|
+
const content = token.type === "collapse" ? this.renderCollapse() : this.renderItem(token.item, token.index, token.index === currentIndex);
|
|
2901
|
+
return {
|
|
2902
|
+
tag: "li",
|
|
2903
|
+
props: {
|
|
2904
|
+
className: token.type === "item" ? "one-breadcrumb__item" : "one-breadcrumb__collapse"
|
|
2905
|
+
},
|
|
2906
|
+
children: [content, ...hasSeparator ? [this.renderSeparator()] : []]
|
|
2907
|
+
};
|
|
2908
|
+
}
|
|
2909
|
+
renderItem(item, index, current) {
|
|
2910
|
+
if (current || !item.href) {
|
|
2911
|
+
return {
|
|
2912
|
+
tag: "span",
|
|
2913
|
+
props: {
|
|
2914
|
+
className: current ? "one-breadcrumb__current" : "one-breadcrumb__label",
|
|
2915
|
+
"aria-current": current ? "page" : undefined
|
|
2916
|
+
},
|
|
2917
|
+
children: [item.label]
|
|
2918
|
+
};
|
|
2919
|
+
}
|
|
2920
|
+
return {
|
|
2921
|
+
tag: "a",
|
|
2922
|
+
props: { className: "one-breadcrumb__link", href: item.href },
|
|
2923
|
+
listeners: { click: (event) => this.handleItemClick(event, item, index) },
|
|
2924
|
+
children: [item.label]
|
|
2925
|
+
};
|
|
2926
|
+
}
|
|
2927
|
+
renderCollapse() {
|
|
2928
|
+
return {
|
|
2929
|
+
tag: "button",
|
|
2930
|
+
props: {
|
|
2931
|
+
className: "one-breadcrumb__ellipsis",
|
|
2932
|
+
type: "button",
|
|
2933
|
+
"aria-label": "展开面包屑",
|
|
2934
|
+
"aria-expanded": "false"
|
|
2935
|
+
},
|
|
2936
|
+
listeners: { click: () => this.state.expanded = true },
|
|
2937
|
+
children: ["…"]
|
|
2938
|
+
};
|
|
2939
|
+
}
|
|
2940
|
+
renderSeparator() {
|
|
2941
|
+
return {
|
|
2942
|
+
tag: "span",
|
|
2943
|
+
props: { className: "one-breadcrumb__separator", "aria-hidden": "true" },
|
|
2944
|
+
children: [
|
|
2945
|
+
this.hasSlot("separator") ? slot6("separator") : this.props.separator ?? "/"
|
|
2946
|
+
]
|
|
2947
|
+
};
|
|
2948
|
+
}
|
|
2949
|
+
handleItemClick(event, item, index) {
|
|
2950
|
+
if (!(event instanceof MouseEvent))
|
|
2951
|
+
return;
|
|
2952
|
+
this.emit("itemClick", {
|
|
2953
|
+
item,
|
|
2954
|
+
index,
|
|
2955
|
+
originalEvent: event
|
|
2956
|
+
});
|
|
2957
|
+
}
|
|
2958
|
+
hasSlot(name) {
|
|
2959
|
+
return this.props.children?.some((child) => typeof child !== "string" && child.slot === name) ?? false;
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
// lib/pagination/OnePagination.ts
|
|
2963
|
+
import { Component as Component17 } from "@geektech/tsone";
|
|
2964
|
+
|
|
2965
|
+
// lib/pagination/tokens.ts
|
|
2966
|
+
function createOnePaginationTokens(pageCount, page, siblingCount) {
|
|
2967
|
+
const normalizedCount = normalizePositiveInteger(pageCount, 1);
|
|
2968
|
+
const normalizedPage = Math.min(normalizedCount, normalizePositiveInteger(page, 1));
|
|
2969
|
+
const normalizedSiblings = normalizeNonNegativeInteger(siblingCount, 1);
|
|
2970
|
+
const pages = new Set([1, normalizedCount]);
|
|
2971
|
+
for (let candidate = Math.max(1, normalizedPage - normalizedSiblings);candidate <= Math.min(normalizedCount, normalizedPage + normalizedSiblings); candidate += 1) {
|
|
2972
|
+
pages.add(candidate);
|
|
2973
|
+
}
|
|
2974
|
+
const sorted = [...pages].sort((left, right) => left - right);
|
|
2975
|
+
return sorted.flatMap((value, index) => {
|
|
2976
|
+
if (index === 0)
|
|
2977
|
+
return [value];
|
|
2978
|
+
const previous = sorted[index - 1];
|
|
2979
|
+
const gap = value - previous;
|
|
2980
|
+
if (gap === 2)
|
|
2981
|
+
return [previous + 1, value];
|
|
2982
|
+
if (gap > 2) {
|
|
2983
|
+
return [previous === 1 ? "ellipsis-start" : "ellipsis-end", value];
|
|
2984
|
+
}
|
|
2985
|
+
return [value];
|
|
2986
|
+
});
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
// lib/pagination/OnePagination.ts
|
|
2990
|
+
var DEFAULT_PAGE_SIZE_OPTIONS = [10, 20, 50, 100];
|
|
2991
|
+
var ONE_PAGINATION_STYLES = [
|
|
2992
|
+
{
|
|
2993
|
+
name: "one-pagination-base",
|
|
2994
|
+
selector: ".one-pagination",
|
|
2995
|
+
properties: {
|
|
2996
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
2997
|
+
display: "flex",
|
|
2998
|
+
flexWrap: "wrap",
|
|
2999
|
+
gap: ONE_THEME_DEFAULTS.spaceSm,
|
|
3000
|
+
alignItems: "center",
|
|
3001
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
3002
|
+
}
|
|
3003
|
+
},
|
|
3004
|
+
{
|
|
3005
|
+
name: "one-pagination-pages",
|
|
3006
|
+
selector: ".one-pagination__pages",
|
|
3007
|
+
properties: {
|
|
3008
|
+
display: "flex",
|
|
3009
|
+
flexWrap: "wrap",
|
|
3010
|
+
gap: ONE_THEME_DEFAULTS.spaceXs,
|
|
3011
|
+
alignItems: "center"
|
|
3012
|
+
}
|
|
3013
|
+
},
|
|
3014
|
+
{
|
|
3015
|
+
name: "one-pagination-button",
|
|
3016
|
+
selector: ".one-pagination__button",
|
|
3017
|
+
properties: {
|
|
3018
|
+
minWidth: "32px",
|
|
3019
|
+
height: "32px",
|
|
3020
|
+
padding: `0 ${ONE_THEME_DEFAULTS.spaceSm}`,
|
|
3021
|
+
color: "inherit",
|
|
3022
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3023
|
+
border: oneThemeBorder(),
|
|
3024
|
+
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`,
|
|
3025
|
+
cursor: "pointer",
|
|
3026
|
+
font: "inherit"
|
|
3027
|
+
},
|
|
3028
|
+
hover: {
|
|
3029
|
+
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`,
|
|
3030
|
+
borderColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
3031
|
+
}
|
|
3032
|
+
},
|
|
3033
|
+
{
|
|
3034
|
+
name: "one-pagination-button-current",
|
|
3035
|
+
selector: '.one-pagination__button[aria-current="page"]',
|
|
3036
|
+
properties: {
|
|
3037
|
+
color: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3038
|
+
backgroundColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`,
|
|
3039
|
+
borderColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
3040
|
+
}
|
|
3041
|
+
},
|
|
3042
|
+
{
|
|
3043
|
+
name: "one-pagination-button-disabled",
|
|
3044
|
+
selector: ".one-pagination__button:disabled",
|
|
3045
|
+
properties: {
|
|
3046
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
3047
|
+
cursor: "not-allowed",
|
|
3048
|
+
opacity: "0.55"
|
|
3049
|
+
}
|
|
3050
|
+
},
|
|
3051
|
+
{
|
|
3052
|
+
name: "one-pagination-button-focus-visible",
|
|
3053
|
+
selector: ".one-pagination__button:focus-visible",
|
|
3054
|
+
properties: {
|
|
3055
|
+
outline: `2px solid var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus})`,
|
|
3056
|
+
outlineOffset: "2px"
|
|
3057
|
+
}
|
|
3058
|
+
},
|
|
3059
|
+
{
|
|
3060
|
+
name: "one-pagination-ellipsis",
|
|
3061
|
+
selector: ".one-pagination__ellipsis",
|
|
3062
|
+
properties: {
|
|
3063
|
+
minWidth: "24px",
|
|
3064
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
3065
|
+
textAlign: "center"
|
|
3066
|
+
}
|
|
3067
|
+
},
|
|
3068
|
+
{
|
|
3069
|
+
name: "one-pagination-control",
|
|
3070
|
+
selector: ".one-pagination__size, .one-pagination__jumper",
|
|
3071
|
+
properties: {
|
|
3072
|
+
height: "32px",
|
|
3073
|
+
padding: `0 ${ONE_THEME_DEFAULTS.spaceSm}`,
|
|
3074
|
+
color: "inherit",
|
|
3075
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3076
|
+
border: oneThemeBorder(),
|
|
3077
|
+
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`,
|
|
3078
|
+
font: "inherit"
|
|
3079
|
+
}
|
|
3080
|
+
},
|
|
3081
|
+
{
|
|
3082
|
+
name: "one-pagination-control-focus-visible",
|
|
3083
|
+
selector: ".one-pagination__size:focus-visible, .one-pagination__jumper:focus-visible",
|
|
3084
|
+
properties: {
|
|
3085
|
+
outline: `2px solid var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus})`,
|
|
3086
|
+
outlineOffset: "2px"
|
|
3087
|
+
}
|
|
3088
|
+
},
|
|
3089
|
+
{
|
|
3090
|
+
name: "one-pagination-jumper",
|
|
3091
|
+
selector: ".one-pagination__jumper",
|
|
3092
|
+
properties: { width: "80px" }
|
|
3093
|
+
}
|
|
3094
|
+
];
|
|
3095
|
+
|
|
3096
|
+
class OnePagination extends Component17 {
|
|
3097
|
+
initState() {
|
|
3098
|
+
return {
|
|
3099
|
+
internalPage: normalizePositiveInteger(this.props.defaultPage, 1),
|
|
3100
|
+
internalPageSize: normalizePositiveInteger(this.props.defaultPageSize, 10),
|
|
3101
|
+
jumpValue: ""
|
|
3102
|
+
};
|
|
3103
|
+
}
|
|
3104
|
+
initStyles() {
|
|
3105
|
+
ONE_PAGINATION_STYLES.forEach(({ name, ...style }) => {
|
|
3106
|
+
this.styleManager.addStyle(name, style);
|
|
3107
|
+
});
|
|
3108
|
+
}
|
|
3109
|
+
render() {
|
|
3110
|
+
const pageSize = this.effectivePageSize();
|
|
3111
|
+
const pageCount = this.pageCount(pageSize);
|
|
3112
|
+
const page = this.effectivePage(pageSize);
|
|
3113
|
+
const disabled = this.props.disabled === true;
|
|
3114
|
+
const siblingCount = normalizeNonNegativeInteger(this.props.siblingCount, 1);
|
|
3115
|
+
return {
|
|
3116
|
+
tag: "nav",
|
|
3117
|
+
props: {
|
|
3118
|
+
className: "one-pagination",
|
|
3119
|
+
"aria-label": this.props.ariaLabel ?? "分页"
|
|
3120
|
+
},
|
|
3121
|
+
children: [
|
|
3122
|
+
{
|
|
3123
|
+
tag: "div",
|
|
3124
|
+
props: { className: "one-pagination__pages" },
|
|
3125
|
+
children: [
|
|
3126
|
+
this.renderPageButton("上一页", "‹", page - 1, page <= 1),
|
|
3127
|
+
...createOnePaginationTokens(pageCount, page, siblingCount).map((token) => typeof token === "number" ? this.renderPageButton(`第 ${token} 页`, String(token), token, false, token === page) : this.renderEllipsis(token)),
|
|
3128
|
+
this.renderPageButton("下一页", "›", page + 1, page >= pageCount)
|
|
3129
|
+
]
|
|
3130
|
+
},
|
|
3131
|
+
{
|
|
3132
|
+
tag: "select",
|
|
3133
|
+
props: {
|
|
3134
|
+
className: "one-pagination__size",
|
|
3135
|
+
value: String(pageSize),
|
|
3136
|
+
disabled,
|
|
3137
|
+
"aria-label": "每页条数"
|
|
3138
|
+
},
|
|
3139
|
+
listeners: { change: (event) => this.handleSizeChange(event) },
|
|
3140
|
+
children: this.sizeOptions().map((option) => ({
|
|
3141
|
+
tag: "option",
|
|
3142
|
+
props: {
|
|
3143
|
+
value: String(option),
|
|
3144
|
+
selected: option === pageSize
|
|
3145
|
+
},
|
|
3146
|
+
children: [`${option} 条/页`]
|
|
3147
|
+
}))
|
|
3148
|
+
},
|
|
3149
|
+
...this.props.showQuickJumper ? [
|
|
3150
|
+
{
|
|
3151
|
+
tag: "input",
|
|
3152
|
+
props: {
|
|
3153
|
+
className: "one-pagination__jumper",
|
|
3154
|
+
type: "text",
|
|
3155
|
+
inputmode: "numeric",
|
|
3156
|
+
value: this.state.jumpValue,
|
|
3157
|
+
disabled,
|
|
3158
|
+
"aria-label": "快速跳转页码",
|
|
3159
|
+
placeholder: "跳至页码"
|
|
3160
|
+
},
|
|
3161
|
+
listeners: {
|
|
3162
|
+
input: (event) => this.handleJumpInput(event),
|
|
3163
|
+
keydown: (event) => this.handleJumpKeydown(event),
|
|
3164
|
+
blur: (event) => this.submitJump(event)
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
] : []
|
|
3168
|
+
]
|
|
3169
|
+
};
|
|
3170
|
+
}
|
|
3171
|
+
effectivePageSize() {
|
|
3172
|
+
return normalizePositiveInteger(this.props.pageSize ?? this.state.internalPageSize, 10);
|
|
3173
|
+
}
|
|
3174
|
+
pageCount(pageSize = this.effectivePageSize()) {
|
|
3175
|
+
const total = normalizeNonNegativeInteger(this.props.total, 0);
|
|
3176
|
+
return Math.max(1, Math.ceil(total / pageSize));
|
|
3177
|
+
}
|
|
3178
|
+
effectivePage(pageSize = this.effectivePageSize()) {
|
|
3179
|
+
const candidate = normalizePositiveInteger(this.props.page ?? this.state.internalPage, 1);
|
|
3180
|
+
return Math.min(this.pageCount(pageSize), candidate);
|
|
3181
|
+
}
|
|
3182
|
+
sizeOptions() {
|
|
3183
|
+
const active = this.effectivePageSize();
|
|
3184
|
+
const options = normalizePositiveIntegerList(this.props.pageSizeOptions, DEFAULT_PAGE_SIZE_OPTIONS);
|
|
3185
|
+
if (!options.includes(active))
|
|
3186
|
+
options.push(active);
|
|
3187
|
+
return options;
|
|
3188
|
+
}
|
|
3189
|
+
renderPageButton(ariaLabel, label, targetPage, boundaryDisabled, current = false) {
|
|
3190
|
+
const disabled = this.props.disabled === true || boundaryDisabled;
|
|
3191
|
+
return {
|
|
3192
|
+
tag: "button",
|
|
3193
|
+
props: {
|
|
3194
|
+
className: "one-pagination__button",
|
|
3195
|
+
type: "button",
|
|
3196
|
+
disabled,
|
|
3197
|
+
"aria-label": ariaLabel,
|
|
3198
|
+
"aria-current": current ? "page" : undefined
|
|
3199
|
+
},
|
|
3200
|
+
listeners: {
|
|
3201
|
+
click: (event) => this.requestChange(targetPage, this.effectivePageSize(), event)
|
|
3202
|
+
},
|
|
3203
|
+
children: [label]
|
|
3204
|
+
};
|
|
3205
|
+
}
|
|
3206
|
+
renderEllipsis(token) {
|
|
3207
|
+
return {
|
|
3208
|
+
tag: "span",
|
|
3209
|
+
props: {
|
|
3210
|
+
className: "one-pagination__ellipsis",
|
|
3211
|
+
"aria-hidden": "true",
|
|
3212
|
+
"data-token": token
|
|
3213
|
+
},
|
|
3214
|
+
children: ["…"]
|
|
3215
|
+
};
|
|
3216
|
+
}
|
|
3217
|
+
handleSizeChange(event) {
|
|
3218
|
+
const select = event.currentTarget;
|
|
3219
|
+
if (!(select instanceof HTMLSelectElement) || this.props.disabled)
|
|
3220
|
+
return;
|
|
3221
|
+
const pageSize = normalizePositiveInteger(Number(select.value), 10);
|
|
3222
|
+
this.requestChange(this.effectivePage(), pageSize, event);
|
|
3223
|
+
}
|
|
3224
|
+
handleJumpInput(event) {
|
|
3225
|
+
const input = event.currentTarget;
|
|
3226
|
+
if (!(input instanceof HTMLInputElement) || this.props.disabled)
|
|
3227
|
+
return;
|
|
3228
|
+
this.state.jumpValue = input.value;
|
|
3229
|
+
}
|
|
3230
|
+
handleJumpKeydown(event) {
|
|
3231
|
+
if (!(event instanceof KeyboardEvent) || event.key !== "Enter")
|
|
3232
|
+
return;
|
|
3233
|
+
event.preventDefault();
|
|
3234
|
+
this.submitJump(event);
|
|
3235
|
+
}
|
|
3236
|
+
requestChange(page, pageSize, event) {
|
|
3237
|
+
if (this.props.disabled)
|
|
3238
|
+
return;
|
|
3239
|
+
const nextPageSize = normalizePositiveInteger(pageSize, 10);
|
|
3240
|
+
const nextPage = Math.min(this.pageCount(nextPageSize), normalizePositiveInteger(page, 1));
|
|
3241
|
+
const currentPage = this.effectivePage();
|
|
3242
|
+
const currentPageSize = this.effectivePageSize();
|
|
3243
|
+
if (nextPage === currentPage && nextPageSize === currentPageSize)
|
|
3244
|
+
return;
|
|
3245
|
+
if (this.props.pageSize === undefined) {
|
|
3246
|
+
this.state.internalPageSize = nextPageSize;
|
|
3247
|
+
}
|
|
3248
|
+
if (this.props.page === undefined) {
|
|
3249
|
+
this.state.internalPage = nextPage;
|
|
3250
|
+
}
|
|
3251
|
+
this.emit("change", {
|
|
3252
|
+
page: nextPage,
|
|
3253
|
+
pageSize: nextPageSize,
|
|
3254
|
+
originalEvent: event
|
|
3255
|
+
});
|
|
3256
|
+
}
|
|
3257
|
+
submitJump(event) {
|
|
3258
|
+
if (this.props.disabled)
|
|
3259
|
+
return;
|
|
3260
|
+
const value = this.state.jumpValue.trim();
|
|
3261
|
+
if (!value)
|
|
3262
|
+
return;
|
|
3263
|
+
const page = Number(value);
|
|
3264
|
+
this.state.jumpValue = "";
|
|
3265
|
+
if (event.currentTarget instanceof HTMLInputElement) {
|
|
3266
|
+
event.currentTarget.value = "";
|
|
3267
|
+
}
|
|
3268
|
+
if (!Number.isFinite(page))
|
|
3269
|
+
return;
|
|
3270
|
+
this.requestChange(page, this.effectivePageSize(), event);
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
// lib/categories.ts
|
|
3274
|
+
var ONE_COMPONENT_CATEGORIES = [
|
|
3275
|
+
{ id: "basic", label: "基础", components: ["OneButton"] },
|
|
3276
|
+
{
|
|
3277
|
+
id: "form",
|
|
3278
|
+
label: "表单",
|
|
3279
|
+
components: [
|
|
3280
|
+
"OneForm",
|
|
3281
|
+
"OneFormItem",
|
|
3282
|
+
"OneInput",
|
|
3283
|
+
"OneSelect",
|
|
3284
|
+
"OneTimePicker",
|
|
3285
|
+
"OneCheckbox",
|
|
3286
|
+
"OneCheckboxGroup",
|
|
3287
|
+
"OneRadio",
|
|
3288
|
+
"OneRadioGroup",
|
|
3289
|
+
"OneSwitch",
|
|
3290
|
+
"OneSlider",
|
|
3291
|
+
"OneRate",
|
|
3292
|
+
"OneUpload"
|
|
3293
|
+
]
|
|
3294
|
+
},
|
|
3295
|
+
{
|
|
3296
|
+
id: "navigation",
|
|
3297
|
+
label: "导航",
|
|
3298
|
+
components: ["OneTabs", "OneBreadcrumb", "OnePagination"]
|
|
3299
|
+
},
|
|
3300
|
+
{
|
|
3301
|
+
id: "data-display",
|
|
3302
|
+
label: "数据展示",
|
|
3303
|
+
components: [
|
|
3304
|
+
"OneCard",
|
|
3305
|
+
"OneAvatar",
|
|
3306
|
+
"OneTag",
|
|
3307
|
+
"OneBadge",
|
|
3308
|
+
"OneProgress",
|
|
3309
|
+
"OneEmpty",
|
|
3310
|
+
"OneTable",
|
|
3311
|
+
"OneCollapse",
|
|
3312
|
+
"OneSkeleton"
|
|
3313
|
+
]
|
|
3314
|
+
},
|
|
3315
|
+
{
|
|
3316
|
+
id: "feedback",
|
|
3317
|
+
label: "反馈与浮层",
|
|
3318
|
+
components: [
|
|
3319
|
+
"OneAlert",
|
|
3320
|
+
"OneMessage",
|
|
3321
|
+
"OneDialog",
|
|
3322
|
+
"OneTooltip",
|
|
3323
|
+
"OneLoading"
|
|
3324
|
+
]
|
|
3325
|
+
}
|
|
3326
|
+
];
|
|
3327
|
+
// lib/card/OneCard.ts
|
|
3328
|
+
import { Component as Component18, slot as slot7 } from "@geektech/tsone";
|
|
3329
|
+
var ONE_CARD_STYLES = [
|
|
3330
|
+
{
|
|
3331
|
+
name: "one-card-base",
|
|
3332
|
+
selector: ".one-card",
|
|
3333
|
+
properties: {
|
|
3334
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
3335
|
+
overflow: "hidden",
|
|
3336
|
+
color: `var(--one-card-color, var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText}))`,
|
|
3337
|
+
backgroundColor: `var(--one-card-background, var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface}))`,
|
|
3338
|
+
border: oneThemeBorder(`var(--one-card-border-color, var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder}))`),
|
|
3339
|
+
borderRadius: `var(--one-card-radius, var(--one-radius-lg, ${ONE_THEME_DEFAULTS.radiusMd}))`,
|
|
3340
|
+
boxShadow: `var(--one-card-shadow, var(--one-shadow-card, ${ONE_THEME_DEFAULTS.shadowCard}))`
|
|
3341
|
+
}
|
|
3342
|
+
},
|
|
3343
|
+
{
|
|
3344
|
+
name: "one-card-header",
|
|
3345
|
+
selector: ".one-card__header",
|
|
3346
|
+
properties: {
|
|
3347
|
+
padding: `var(--one-card-header-padding, var(--one-space-lg, ${ONE_THEME_DEFAULTS.spaceLg}))`,
|
|
3348
|
+
borderBottom: oneThemeBorder(`var(--one-card-border-color, var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder}))`),
|
|
3349
|
+
fontWeight: "500"
|
|
3350
|
+
}
|
|
3351
|
+
},
|
|
3352
|
+
{
|
|
3353
|
+
name: "one-card-body",
|
|
3354
|
+
selector: ".one-card__body",
|
|
3355
|
+
properties: {
|
|
3356
|
+
padding: `var(--one-card-body-padding, var(--one-space-lg, ${ONE_THEME_DEFAULTS.spaceLg}))`
|
|
3357
|
+
}
|
|
3358
|
+
},
|
|
3359
|
+
{
|
|
3360
|
+
name: "one-card-footer",
|
|
3361
|
+
selector: ".one-card__footer",
|
|
3362
|
+
properties: {
|
|
3363
|
+
padding: `var(--one-card-footer-padding, var(--one-space-lg, ${ONE_THEME_DEFAULTS.spaceLg}))`,
|
|
3364
|
+
borderTop: oneThemeBorder(`var(--one-card-border-color, var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder}))`)
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
];
|
|
3368
|
+
function hasNamedSlot(children, name) {
|
|
3369
|
+
return children.some((child) => typeof child !== "string" && child.slot === name);
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
class OneCard extends Component18 {
|
|
3373
|
+
initState() {
|
|
3374
|
+
return {};
|
|
3375
|
+
}
|
|
3376
|
+
initStyles() {
|
|
3377
|
+
ONE_CARD_STYLES.forEach(({ name, ...style }) => {
|
|
3378
|
+
this.styleManager.addStyle(name, style);
|
|
3379
|
+
});
|
|
3380
|
+
}
|
|
3381
|
+
render() {
|
|
3382
|
+
const children = this.props.children ?? [];
|
|
3383
|
+
const hasHeaderSlot = hasNamedSlot(children, "header");
|
|
3384
|
+
const hasFooterSlot = hasNamedSlot(children, "footer");
|
|
3385
|
+
const headerChildren = hasHeaderSlot ? [slot7("header")] : this.props.title ? [this.props.title] : [];
|
|
3386
|
+
return {
|
|
3387
|
+
tag: "section",
|
|
3388
|
+
props: { className: "one-card" },
|
|
3389
|
+
children: [
|
|
3390
|
+
...headerChildren.length > 0 ? [
|
|
3391
|
+
{
|
|
3392
|
+
tag: "header",
|
|
3393
|
+
props: { className: "one-card__header" },
|
|
3394
|
+
children: headerChildren
|
|
3395
|
+
}
|
|
3396
|
+
] : [],
|
|
3397
|
+
{
|
|
3398
|
+
tag: "div",
|
|
3399
|
+
props: { className: "one-card__body" },
|
|
3400
|
+
children: [slot7("default")]
|
|
3401
|
+
},
|
|
3402
|
+
...hasFooterSlot ? [
|
|
3403
|
+
{
|
|
3404
|
+
tag: "footer",
|
|
3405
|
+
props: { className: "one-card__footer" },
|
|
3406
|
+
children: [slot7("footer")]
|
|
3407
|
+
}
|
|
3408
|
+
] : []
|
|
3409
|
+
]
|
|
3410
|
+
};
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
// lib/tag/OneTag.ts
|
|
3414
|
+
import { Component as Component19 } from "@geektech/tsone";
|
|
3415
|
+
|
|
3416
|
+
// lib/data-display/types.ts
|
|
3417
|
+
var VARIANTS = [
|
|
3418
|
+
"neutral",
|
|
3419
|
+
"primary",
|
|
3420
|
+
"success",
|
|
3421
|
+
"warning",
|
|
3422
|
+
"error"
|
|
3423
|
+
];
|
|
3424
|
+
function normalizeOneDataDisplayVariant(value, fallback = "neutral") {
|
|
3425
|
+
return VARIANTS.includes(value) ? value : fallback;
|
|
3426
|
+
}
|
|
3427
|
+
// lib/tag/OneTag.ts
|
|
3428
|
+
var ONE_TAG_STYLES = [
|
|
3429
|
+
{
|
|
3430
|
+
name: "one-tag-base",
|
|
3431
|
+
selector: ".one-tag",
|
|
3432
|
+
properties: {
|
|
3433
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
3434
|
+
display: "inline-flex",
|
|
3435
|
+
alignItems: "center",
|
|
3436
|
+
gap: ONE_THEME_DEFAULTS.spaceXs,
|
|
3437
|
+
border: oneThemeBorder(),
|
|
3438
|
+
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`
|
|
3439
|
+
}
|
|
3440
|
+
},
|
|
3441
|
+
{
|
|
3442
|
+
name: "one-tag-neutral",
|
|
3443
|
+
selector: ".one-tag--neutral",
|
|
3444
|
+
properties: {
|
|
3445
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`,
|
|
3446
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3447
|
+
borderColor: `var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`
|
|
3448
|
+
}
|
|
3449
|
+
},
|
|
3450
|
+
{
|
|
3451
|
+
name: "one-tag-primary",
|
|
3452
|
+
selector: ".one-tag--primary",
|
|
3453
|
+
properties: {
|
|
3454
|
+
color: `var(--one-color-primary-contrast, ${ONE_THEME_DEFAULTS.colorText})`,
|
|
3455
|
+
backgroundColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`,
|
|
3456
|
+
borderColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
3457
|
+
}
|
|
3458
|
+
},
|
|
3459
|
+
{
|
|
3460
|
+
name: "one-tag-success",
|
|
3461
|
+
selector: ".one-tag--success",
|
|
3462
|
+
properties: {
|
|
3463
|
+
color: `var(--one-color-success, ${ONE_THEME_DEFAULTS.colorSuccess})`,
|
|
3464
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3465
|
+
borderColor: `var(--one-color-success, ${ONE_THEME_DEFAULTS.colorSuccess})`
|
|
3466
|
+
}
|
|
3467
|
+
},
|
|
3468
|
+
{
|
|
3469
|
+
name: "one-tag-warning",
|
|
3470
|
+
selector: ".one-tag--warning",
|
|
3471
|
+
properties: {
|
|
3472
|
+
color: `var(--one-color-warning, ${ONE_THEME_DEFAULTS.colorWarning})`,
|
|
3473
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3474
|
+
borderColor: `var(--one-color-warning, ${ONE_THEME_DEFAULTS.colorWarning})`
|
|
3475
|
+
}
|
|
3476
|
+
},
|
|
3477
|
+
{
|
|
3478
|
+
name: "one-tag-error",
|
|
3479
|
+
selector: ".one-tag--error",
|
|
3480
|
+
properties: {
|
|
3481
|
+
color: `var(--one-color-danger, ${ONE_THEME_DEFAULTS.colorDanger})`,
|
|
3482
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3483
|
+
borderColor: `var(--one-color-danger, ${ONE_THEME_DEFAULTS.colorDanger})`
|
|
3484
|
+
}
|
|
3485
|
+
},
|
|
3486
|
+
{
|
|
3487
|
+
name: "one-tag-sm",
|
|
3488
|
+
selector: ".one-tag--sm",
|
|
3489
|
+
properties: {
|
|
3490
|
+
padding: "2px 6px",
|
|
3491
|
+
fontSize: `var(--one-font-size-sm, ${ONE_THEME_DEFAULTS.fontSizeSm})`
|
|
3492
|
+
}
|
|
3493
|
+
},
|
|
3494
|
+
{
|
|
3495
|
+
name: "one-tag-md",
|
|
3496
|
+
selector: ".one-tag--md",
|
|
3497
|
+
properties: {
|
|
3498
|
+
padding: "4px 8px",
|
|
3499
|
+
fontSize: `var(--one-font-size-md, ${ONE_THEME_DEFAULTS.fontSizeMd})`
|
|
3500
|
+
}
|
|
3501
|
+
},
|
|
3502
|
+
{
|
|
3503
|
+
name: "one-tag-lg",
|
|
3504
|
+
selector: ".one-tag--lg",
|
|
3505
|
+
properties: {
|
|
3506
|
+
padding: "6px 10px",
|
|
3507
|
+
fontSize: `var(--one-font-size-lg, ${ONE_THEME_DEFAULTS.fontSizeLg})`
|
|
3508
|
+
}
|
|
3509
|
+
},
|
|
3510
|
+
{
|
|
3511
|
+
name: "one-tag-close",
|
|
3512
|
+
selector: ".one-tag__close",
|
|
3513
|
+
properties: {
|
|
3514
|
+
display: "inline-grid",
|
|
3515
|
+
placeItems: "center",
|
|
3516
|
+
padding: "0",
|
|
3517
|
+
color: "inherit",
|
|
3518
|
+
backgroundColor: "transparent",
|
|
3519
|
+
border: "0",
|
|
3520
|
+
cursor: "pointer",
|
|
3521
|
+
font: "inherit",
|
|
3522
|
+
lineHeight: "1"
|
|
3523
|
+
}
|
|
3524
|
+
},
|
|
3525
|
+
{
|
|
3526
|
+
name: "one-tag-close-focus-visible",
|
|
3527
|
+
selector: ".one-tag__close:focus-visible",
|
|
3528
|
+
properties: {
|
|
3529
|
+
outline: `2px solid var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus})`,
|
|
3530
|
+
outlineOffset: "2px"
|
|
3531
|
+
}
|
|
3532
|
+
}
|
|
3533
|
+
];
|
|
3534
|
+
|
|
3535
|
+
class OneTag extends Component19 {
|
|
3536
|
+
initState() {
|
|
3537
|
+
return { visible: true };
|
|
3538
|
+
}
|
|
3539
|
+
initStyles() {
|
|
3540
|
+
ONE_TAG_STYLES.forEach(({ name, ...style }) => {
|
|
3541
|
+
this.styleManager.addStyle(name, style);
|
|
3542
|
+
});
|
|
3543
|
+
}
|
|
3544
|
+
render() {
|
|
3545
|
+
if (!this.state.visible) {
|
|
3546
|
+
return {
|
|
3547
|
+
tag: "span",
|
|
3548
|
+
props: { hidden: true, "data-one-tag-anchor": "" }
|
|
3549
|
+
};
|
|
3550
|
+
}
|
|
3551
|
+
const variant = normalizeOneDataDisplayVariant(this.props.variant);
|
|
3552
|
+
const size = normalizeOneSize(this.props.size);
|
|
3553
|
+
return {
|
|
3554
|
+
tag: "span",
|
|
3555
|
+
props: {
|
|
3556
|
+
className: `one-tag one-tag--${variant} one-tag--${size}`
|
|
3557
|
+
},
|
|
3558
|
+
children: [
|
|
3559
|
+
...this.props.children ?? [],
|
|
3560
|
+
...this.props.closable ? [
|
|
3561
|
+
{
|
|
3562
|
+
tag: "button",
|
|
3563
|
+
props: {
|
|
3564
|
+
className: "one-tag__close",
|
|
3565
|
+
type: "button",
|
|
3566
|
+
"aria-label": "关闭标签"
|
|
3567
|
+
},
|
|
3568
|
+
listeners: { click: () => this.close() },
|
|
3569
|
+
children: ["×"]
|
|
3570
|
+
}
|
|
3571
|
+
] : []
|
|
3572
|
+
]
|
|
3573
|
+
};
|
|
3574
|
+
}
|
|
3575
|
+
close() {
|
|
3576
|
+
if (!this.state.visible) {
|
|
3577
|
+
return;
|
|
3578
|
+
}
|
|
3579
|
+
this.emit("close");
|
|
3580
|
+
this.state.visible = false;
|
|
3581
|
+
}
|
|
3582
|
+
}
|
|
3583
|
+
// lib/badge/OneBadge.ts
|
|
3584
|
+
import { Component as Component20 } from "@geektech/tsone";
|
|
3585
|
+
var ONE_BADGE_STYLES = [
|
|
3586
|
+
{
|
|
3587
|
+
name: "one-badge-base",
|
|
3588
|
+
selector: ".one-badge",
|
|
3589
|
+
properties: {
|
|
3590
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
3591
|
+
position: "relative",
|
|
3592
|
+
display: "inline-flex",
|
|
3593
|
+
verticalAlign: "middle"
|
|
3594
|
+
}
|
|
3595
|
+
},
|
|
3596
|
+
{
|
|
3597
|
+
name: "one-badge-content",
|
|
3598
|
+
selector: ".one-badge__content",
|
|
3599
|
+
properties: {
|
|
3600
|
+
position: "absolute",
|
|
3601
|
+
top: "0",
|
|
3602
|
+
right: "0",
|
|
3603
|
+
display: "inline-flex",
|
|
3604
|
+
alignItems: "center",
|
|
3605
|
+
justifyContent: "center",
|
|
3606
|
+
boxSizing: "border-box",
|
|
3607
|
+
minWidth: "18px",
|
|
3608
|
+
height: "18px",
|
|
3609
|
+
padding: "0 5px",
|
|
3610
|
+
borderRadius: "999px",
|
|
3611
|
+
fontFamily: `var(--one-font-family, ${ONE_THEME_DEFAULTS.fontFamily})`,
|
|
3612
|
+
fontSize: `var(--one-font-size-sm, ${ONE_THEME_DEFAULTS.fontSizeSm})`,
|
|
3613
|
+
lineHeight: "1",
|
|
3614
|
+
transform: "translate(50%, -50%)"
|
|
3615
|
+
}
|
|
3616
|
+
},
|
|
3617
|
+
{
|
|
3618
|
+
name: "one-badge-standalone-content",
|
|
3619
|
+
selector: ".one-badge--standalone .one-badge__content",
|
|
3620
|
+
properties: {
|
|
3621
|
+
position: "static",
|
|
3622
|
+
transform: "none"
|
|
3623
|
+
}
|
|
3624
|
+
},
|
|
3625
|
+
{
|
|
3626
|
+
name: "one-badge-dot",
|
|
3627
|
+
selector: ".one-badge__content--dot",
|
|
3628
|
+
properties: {
|
|
3629
|
+
width: "8px",
|
|
3630
|
+
minWidth: "8px",
|
|
3631
|
+
height: "8px",
|
|
3632
|
+
padding: "0"
|
|
3633
|
+
}
|
|
3634
|
+
},
|
|
3635
|
+
{
|
|
3636
|
+
name: "one-badge-neutral",
|
|
3637
|
+
selector: ".one-badge--neutral .one-badge__content",
|
|
3638
|
+
properties: {
|
|
3639
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`,
|
|
3640
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3641
|
+
border: oneThemeBorder()
|
|
3642
|
+
}
|
|
3643
|
+
},
|
|
3644
|
+
{
|
|
3645
|
+
name: "one-badge-primary",
|
|
3646
|
+
selector: ".one-badge--primary .one-badge__content",
|
|
3647
|
+
properties: {
|
|
3648
|
+
color: `var(--one-color-primary-contrast, ${ONE_THEME_DEFAULTS.colorText})`,
|
|
3649
|
+
backgroundColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
3650
|
+
}
|
|
3651
|
+
},
|
|
3652
|
+
{
|
|
3653
|
+
name: "one-badge-success",
|
|
3654
|
+
selector: ".one-badge--success .one-badge__content",
|
|
3655
|
+
properties: {
|
|
3656
|
+
color: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3657
|
+
backgroundColor: `var(--one-color-success, ${ONE_THEME_DEFAULTS.colorSuccess})`
|
|
3658
|
+
}
|
|
3659
|
+
},
|
|
3660
|
+
{
|
|
3661
|
+
name: "one-badge-warning",
|
|
3662
|
+
selector: ".one-badge--warning .one-badge__content",
|
|
3663
|
+
properties: {
|
|
3664
|
+
color: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3665
|
+
backgroundColor: `var(--one-color-warning, ${ONE_THEME_DEFAULTS.colorWarning})`
|
|
3666
|
+
}
|
|
3667
|
+
},
|
|
3668
|
+
{
|
|
3669
|
+
name: "one-badge-error",
|
|
3670
|
+
selector: ".one-badge--error .one-badge__content",
|
|
3671
|
+
properties: {
|
|
3672
|
+
color: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3673
|
+
backgroundColor: `var(--one-color-danger, ${ONE_THEME_DEFAULTS.colorDanger})`
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
];
|
|
3677
|
+
function normalizeMax(value) {
|
|
3678
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : 99;
|
|
3679
|
+
}
|
|
3680
|
+
function displayValue(props) {
|
|
3681
|
+
if (props.dot) {
|
|
3682
|
+
return "";
|
|
3683
|
+
}
|
|
3684
|
+
if (props.value === undefined || props.value === "") {
|
|
3685
|
+
return;
|
|
3686
|
+
}
|
|
3687
|
+
if (props.value === 0 && props.showZero !== true) {
|
|
3688
|
+
return;
|
|
3689
|
+
}
|
|
3690
|
+
if (typeof props.value === "number" && !Number.isFinite(props.value)) {
|
|
3691
|
+
return;
|
|
3692
|
+
}
|
|
3693
|
+
if (typeof props.value === "number") {
|
|
3694
|
+
const max = normalizeMax(props.max);
|
|
3695
|
+
return props.value > max ? `${max}+` : String(props.value);
|
|
3696
|
+
}
|
|
3697
|
+
return props.value;
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
class OneBadge extends Component20 {
|
|
3701
|
+
initState() {
|
|
3702
|
+
return {};
|
|
3703
|
+
}
|
|
3704
|
+
initStyles() {
|
|
3705
|
+
ONE_BADGE_STYLES.forEach(({ name, ...style }) => {
|
|
3706
|
+
this.styleManager.addStyle(name, style);
|
|
3707
|
+
});
|
|
3708
|
+
}
|
|
3709
|
+
render() {
|
|
3710
|
+
const children = this.props.children ?? [];
|
|
3711
|
+
const standalone = children.length === 0;
|
|
3712
|
+
const variant = normalizeOneDataDisplayVariant(this.props.variant, "primary");
|
|
3713
|
+
const value = displayValue(this.props);
|
|
3714
|
+
const showContent = this.props.dot === true || value !== undefined;
|
|
3715
|
+
return {
|
|
3716
|
+
tag: "span",
|
|
3717
|
+
props: {
|
|
3718
|
+
className: [
|
|
3719
|
+
"one-badge",
|
|
3720
|
+
`one-badge--${variant}`,
|
|
3721
|
+
...standalone ? ["one-badge--standalone"] : []
|
|
3722
|
+
].join(" ")
|
|
3723
|
+
},
|
|
3724
|
+
children: [
|
|
3725
|
+
...children,
|
|
3726
|
+
...showContent ? [
|
|
3727
|
+
{
|
|
3728
|
+
tag: "span",
|
|
3729
|
+
props: {
|
|
3730
|
+
className: [
|
|
3731
|
+
"one-badge__content",
|
|
3732
|
+
...this.props.dot ? ["one-badge__content--dot"] : []
|
|
3733
|
+
].join(" "),
|
|
3734
|
+
"aria-label": this.props.ariaLabel,
|
|
3735
|
+
"aria-hidden": this.props.dot && !this.props.ariaLabel ? "true" : undefined
|
|
3736
|
+
},
|
|
3737
|
+
children: value ? [value] : []
|
|
3738
|
+
}
|
|
3739
|
+
] : []
|
|
3740
|
+
]
|
|
3741
|
+
};
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3744
|
+
// lib/empty/OneEmpty.ts
|
|
3745
|
+
import { Component as Component21, slot as slot8 } from "@geektech/tsone";
|
|
3746
|
+
var ONE_EMPTY_STYLES = [
|
|
3747
|
+
{
|
|
3748
|
+
name: "one-empty-base",
|
|
3749
|
+
selector: ".one-empty",
|
|
3750
|
+
properties: {
|
|
3751
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
3752
|
+
display: "grid",
|
|
3753
|
+
justifyItems: "center",
|
|
3754
|
+
gap: ONE_THEME_DEFAULTS.spaceMd,
|
|
3755
|
+
padding: "24px",
|
|
3756
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`,
|
|
3757
|
+
textAlign: "center"
|
|
1883
3758
|
}
|
|
1884
3759
|
},
|
|
1885
3760
|
{
|
|
1886
|
-
name: "one-
|
|
1887
|
-
selector: ".one-
|
|
3761
|
+
name: "one-empty-image",
|
|
3762
|
+
selector: ".one-empty__image",
|
|
1888
3763
|
properties: {
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
color: "inherit",
|
|
1893
|
-
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
1894
|
-
border: oneThemeBorder(),
|
|
1895
|
-
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`,
|
|
1896
|
-
cursor: "pointer",
|
|
1897
|
-
font: "inherit"
|
|
1898
|
-
},
|
|
1899
|
-
hover: {
|
|
1900
|
-
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`,
|
|
1901
|
-
borderColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
3764
|
+
display: "grid",
|
|
3765
|
+
placeItems: "center",
|
|
3766
|
+
minHeight: "56px"
|
|
1902
3767
|
}
|
|
1903
3768
|
},
|
|
1904
3769
|
{
|
|
1905
|
-
name: "one-
|
|
1906
|
-
selector:
|
|
3770
|
+
name: "one-empty-illustration",
|
|
3771
|
+
selector: ".one-empty__illustration",
|
|
1907
3772
|
properties: {
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
3773
|
+
display: "flex",
|
|
3774
|
+
flexDirection: "column",
|
|
3775
|
+
alignItems: "center",
|
|
3776
|
+
justifyContent: "center",
|
|
3777
|
+
gap: "4px",
|
|
3778
|
+
width: "48px",
|
|
3779
|
+
height: "36px",
|
|
3780
|
+
boxSizing: "border-box",
|
|
3781
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3782
|
+
border: `2px solid var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`,
|
|
3783
|
+
borderRadius: `var(--one-radius-md, ${ONE_THEME_DEFAULTS.radiusMd})`
|
|
1911
3784
|
}
|
|
1912
3785
|
},
|
|
1913
3786
|
{
|
|
1914
|
-
name: "one-
|
|
1915
|
-
selector: ".one-
|
|
3787
|
+
name: "one-empty-illustration-line",
|
|
3788
|
+
selector: ".one-empty__illustration-line",
|
|
1916
3789
|
properties: {
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
3790
|
+
display: "block",
|
|
3791
|
+
width: "20px",
|
|
3792
|
+
height: "3px",
|
|
3793
|
+
borderRadius: "999px",
|
|
3794
|
+
backgroundColor: `var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`
|
|
1920
3795
|
}
|
|
1921
3796
|
},
|
|
1922
3797
|
{
|
|
1923
|
-
name: "one-
|
|
1924
|
-
selector: ".one-
|
|
1925
|
-
properties: {
|
|
1926
|
-
outline: `2px solid var(--one-color-focus, ${ONE_THEME_DEFAULTS.colorFocus})`,
|
|
1927
|
-
outlineOffset: "2px"
|
|
1928
|
-
}
|
|
3798
|
+
name: "one-empty-illustration-line-short",
|
|
3799
|
+
selector: ".one-empty__illustration-line--short",
|
|
3800
|
+
properties: { width: "12px" }
|
|
1929
3801
|
},
|
|
1930
3802
|
{
|
|
1931
|
-
name: "one-
|
|
1932
|
-
selector: ".one-
|
|
3803
|
+
name: "one-empty-description",
|
|
3804
|
+
selector: ".one-empty__description",
|
|
1933
3805
|
properties: {
|
|
1934
|
-
minWidth: "24px",
|
|
1935
3806
|
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
1936
|
-
|
|
1937
|
-
}
|
|
1938
|
-
},
|
|
1939
|
-
{
|
|
1940
|
-
name: "one-pagination-control",
|
|
1941
|
-
selector: ".one-pagination__size, .one-pagination__jumper",
|
|
1942
|
-
properties: {
|
|
1943
|
-
height: "32px",
|
|
1944
|
-
padding: `0 ${ONE_THEME_DEFAULTS.spaceSm}`,
|
|
1945
|
-
color: "inherit",
|
|
1946
|
-
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
1947
|
-
border: oneThemeBorder(),
|
|
1948
|
-
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`,
|
|
1949
|
-
font: "inherit"
|
|
3807
|
+
fontSize: `var(--one-font-size-md, ${ONE_THEME_DEFAULTS.fontSizeMd})`
|
|
1950
3808
|
}
|
|
1951
3809
|
},
|
|
1952
3810
|
{
|
|
1953
|
-
name: "one-
|
|
1954
|
-
selector: ".one-
|
|
3811
|
+
name: "one-empty-actions",
|
|
3812
|
+
selector: ".one-empty__actions",
|
|
1955
3813
|
properties: {
|
|
1956
|
-
|
|
1957
|
-
|
|
3814
|
+
display: "flex",
|
|
3815
|
+
flexWrap: "wrap",
|
|
3816
|
+
justifyContent: "center",
|
|
3817
|
+
gap: ONE_THEME_DEFAULTS.spaceSm
|
|
1958
3818
|
}
|
|
1959
|
-
},
|
|
1960
|
-
{
|
|
1961
|
-
name: "one-pagination-jumper",
|
|
1962
|
-
selector: ".one-pagination__jumper",
|
|
1963
|
-
properties: { width: "80px" }
|
|
1964
3819
|
}
|
|
1965
3820
|
];
|
|
3821
|
+
function hasNamedSlot2(children, name) {
|
|
3822
|
+
return children.some((child) => typeof child !== "string" && child.slot === name);
|
|
3823
|
+
}
|
|
3824
|
+
function hasDefaultSlot(children) {
|
|
3825
|
+
return children.some((child) => typeof child === "string" || child.slot === undefined);
|
|
3826
|
+
}
|
|
1966
3827
|
|
|
1967
|
-
class
|
|
3828
|
+
class OneEmpty extends Component21 {
|
|
1968
3829
|
initState() {
|
|
1969
|
-
return {
|
|
1970
|
-
internalPage: normalizePositiveInteger(this.props.defaultPage, 1),
|
|
1971
|
-
internalPageSize: normalizePositiveInteger(this.props.defaultPageSize, 10),
|
|
1972
|
-
jumpValue: ""
|
|
1973
|
-
};
|
|
3830
|
+
return {};
|
|
1974
3831
|
}
|
|
1975
3832
|
initStyles() {
|
|
1976
|
-
|
|
3833
|
+
ONE_EMPTY_STYLES.forEach(({ name, ...style }) => {
|
|
1977
3834
|
this.styleManager.addStyle(name, style);
|
|
1978
3835
|
});
|
|
1979
3836
|
}
|
|
1980
3837
|
render() {
|
|
1981
|
-
const
|
|
1982
|
-
const
|
|
1983
|
-
const
|
|
1984
|
-
const
|
|
1985
|
-
const siblingCount = normalizeNonNegativeInteger(this.props.siblingCount, 1);
|
|
3838
|
+
const children = this.props.children ?? [];
|
|
3839
|
+
const customImage = hasNamedSlot2(children, "image");
|
|
3840
|
+
const customDescription = hasDefaultSlot(children);
|
|
3841
|
+
const customActions = hasNamedSlot2(children, "actions");
|
|
1986
3842
|
return {
|
|
1987
|
-
tag: "
|
|
1988
|
-
props: {
|
|
1989
|
-
className: "one-pagination",
|
|
1990
|
-
"aria-label": this.props.ariaLabel ?? "分页"
|
|
1991
|
-
},
|
|
3843
|
+
tag: "section",
|
|
3844
|
+
props: { className: "one-empty" },
|
|
1992
3845
|
children: [
|
|
1993
3846
|
{
|
|
1994
3847
|
tag: "div",
|
|
1995
|
-
props: {
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
3848
|
+
props: {
|
|
3849
|
+
className: "one-empty__image",
|
|
3850
|
+
"aria-hidden": customImage ? undefined : "true"
|
|
3851
|
+
},
|
|
3852
|
+
children: customImage ? [slot8("image")] : [
|
|
3853
|
+
{
|
|
3854
|
+
tag: "span",
|
|
3855
|
+
props: { className: "one-empty__illustration" },
|
|
3856
|
+
children: [
|
|
3857
|
+
{
|
|
3858
|
+
tag: "span",
|
|
3859
|
+
props: { className: "one-empty__illustration-line" }
|
|
3860
|
+
},
|
|
3861
|
+
{
|
|
3862
|
+
tag: "span",
|
|
3863
|
+
props: {
|
|
3864
|
+
className: "one-empty__illustration-line one-empty__illustration-line--short"
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3867
|
+
]
|
|
3868
|
+
}
|
|
2000
3869
|
]
|
|
2001
3870
|
},
|
|
2002
3871
|
{
|
|
2003
|
-
tag: "
|
|
2004
|
-
props: {
|
|
2005
|
-
|
|
2006
|
-
value: String(pageSize),
|
|
2007
|
-
disabled,
|
|
2008
|
-
"aria-label": "每页条数"
|
|
2009
|
-
},
|
|
2010
|
-
listeners: { change: (event) => this.handleSizeChange(event) },
|
|
2011
|
-
children: this.sizeOptions().map((option) => ({
|
|
2012
|
-
tag: "option",
|
|
2013
|
-
props: {
|
|
2014
|
-
value: String(option),
|
|
2015
|
-
selected: option === pageSize
|
|
2016
|
-
},
|
|
2017
|
-
children: [`${option} 条/页`]
|
|
2018
|
-
}))
|
|
3872
|
+
tag: "div",
|
|
3873
|
+
props: { className: "one-empty__description" },
|
|
3874
|
+
children: customDescription ? [slot8("default")] : [this.props.description ?? "暂无数据"]
|
|
2019
3875
|
},
|
|
2020
|
-
...
|
|
3876
|
+
...customActions ? [
|
|
2021
3877
|
{
|
|
2022
|
-
tag: "
|
|
2023
|
-
props: {
|
|
2024
|
-
|
|
2025
|
-
type: "text",
|
|
2026
|
-
inputmode: "numeric",
|
|
2027
|
-
value: this.state.jumpValue,
|
|
2028
|
-
disabled,
|
|
2029
|
-
"aria-label": "快速跳转页码",
|
|
2030
|
-
placeholder: "跳至页码"
|
|
2031
|
-
},
|
|
2032
|
-
listeners: {
|
|
2033
|
-
input: (event) => this.handleJumpInput(event),
|
|
2034
|
-
keydown: (event) => this.handleJumpKeydown(event),
|
|
2035
|
-
blur: (event) => this.submitJump(event)
|
|
2036
|
-
}
|
|
3878
|
+
tag: "div",
|
|
3879
|
+
props: { className: "one-empty__actions" },
|
|
3880
|
+
children: [slot8("actions")]
|
|
2037
3881
|
}
|
|
2038
3882
|
] : []
|
|
2039
3883
|
]
|
|
2040
3884
|
};
|
|
2041
3885
|
}
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
}
|
|
2060
|
-
renderPageButton(ariaLabel, label, targetPage, boundaryDisabled, current = false) {
|
|
2061
|
-
const disabled = this.props.disabled === true || boundaryDisabled;
|
|
2062
|
-
return {
|
|
2063
|
-
tag: "button",
|
|
2064
|
-
props: {
|
|
2065
|
-
className: "one-pagination__button",
|
|
2066
|
-
type: "button",
|
|
2067
|
-
disabled,
|
|
2068
|
-
"aria-label": ariaLabel,
|
|
2069
|
-
"aria-current": current ? "page" : undefined
|
|
2070
|
-
},
|
|
2071
|
-
listeners: {
|
|
2072
|
-
click: (event) => this.requestChange(targetPage, this.effectivePageSize(), event)
|
|
2073
|
-
},
|
|
2074
|
-
children: [label]
|
|
2075
|
-
};
|
|
2076
|
-
}
|
|
2077
|
-
renderEllipsis(token) {
|
|
2078
|
-
return {
|
|
2079
|
-
tag: "span",
|
|
2080
|
-
props: {
|
|
2081
|
-
className: "one-pagination__ellipsis",
|
|
2082
|
-
"aria-hidden": "true",
|
|
2083
|
-
"data-token": token
|
|
2084
|
-
},
|
|
2085
|
-
children: ["…"]
|
|
2086
|
-
};
|
|
2087
|
-
}
|
|
2088
|
-
handleSizeChange(event) {
|
|
2089
|
-
const select = event.currentTarget;
|
|
2090
|
-
if (!(select instanceof HTMLSelectElement) || this.props.disabled)
|
|
2091
|
-
return;
|
|
2092
|
-
const pageSize = normalizePositiveInteger(Number(select.value), 10);
|
|
2093
|
-
this.requestChange(this.effectivePage(), pageSize, event);
|
|
2094
|
-
}
|
|
2095
|
-
handleJumpInput(event) {
|
|
2096
|
-
const input = event.currentTarget;
|
|
2097
|
-
if (!(input instanceof HTMLInputElement) || this.props.disabled)
|
|
2098
|
-
return;
|
|
2099
|
-
this.state.jumpValue = input.value;
|
|
2100
|
-
}
|
|
2101
|
-
handleJumpKeydown(event) {
|
|
2102
|
-
if (!(event instanceof KeyboardEvent) || event.key !== "Enter")
|
|
2103
|
-
return;
|
|
2104
|
-
event.preventDefault();
|
|
2105
|
-
this.submitJump(event);
|
|
2106
|
-
}
|
|
2107
|
-
requestChange(page, pageSize, event) {
|
|
2108
|
-
if (this.props.disabled)
|
|
2109
|
-
return;
|
|
2110
|
-
const nextPageSize = normalizePositiveInteger(pageSize, 10);
|
|
2111
|
-
const nextPage = Math.min(this.pageCount(nextPageSize), normalizePositiveInteger(page, 1));
|
|
2112
|
-
const currentPage = this.effectivePage();
|
|
2113
|
-
const currentPageSize = this.effectivePageSize();
|
|
2114
|
-
if (nextPage === currentPage && nextPageSize === currentPageSize)
|
|
2115
|
-
return;
|
|
2116
|
-
if (this.props.pageSize === undefined) {
|
|
2117
|
-
this.state.internalPageSize = nextPageSize;
|
|
3886
|
+
}
|
|
3887
|
+
// lib/avatar/OneAvatar.ts
|
|
3888
|
+
import { Component as Component22 } from "@geektech/tsone";
|
|
3889
|
+
var ONE_AVATAR_STYLES = [
|
|
3890
|
+
{
|
|
3891
|
+
name: "one-avatar-base",
|
|
3892
|
+
selector: ".one-avatar",
|
|
3893
|
+
properties: {
|
|
3894
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
3895
|
+
display: "inline-flex",
|
|
3896
|
+
alignItems: "center",
|
|
3897
|
+
justifyContent: "center",
|
|
3898
|
+
overflow: "hidden",
|
|
3899
|
+
boxSizing: "border-box",
|
|
3900
|
+
color: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
3901
|
+
backgroundColor: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
3902
|
+
verticalAlign: "middle"
|
|
2118
3903
|
}
|
|
2119
|
-
|
|
2120
|
-
|
|
3904
|
+
},
|
|
3905
|
+
{
|
|
3906
|
+
name: "one-avatar-sm",
|
|
3907
|
+
selector: ".one-avatar--sm",
|
|
3908
|
+
properties: {
|
|
3909
|
+
width: "24px",
|
|
3910
|
+
height: "24px",
|
|
3911
|
+
fontSize: `var(--one-font-size-sm, ${ONE_THEME_DEFAULTS.fontSizeSm})`
|
|
2121
3912
|
}
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
return;
|
|
2131
|
-
const value = this.state.jumpValue.trim();
|
|
2132
|
-
if (!value)
|
|
2133
|
-
return;
|
|
2134
|
-
const page = Number(value);
|
|
2135
|
-
this.state.jumpValue = "";
|
|
2136
|
-
if (event.currentTarget instanceof HTMLInputElement) {
|
|
2137
|
-
event.currentTarget.value = "";
|
|
3913
|
+
},
|
|
3914
|
+
{
|
|
3915
|
+
name: "one-avatar-md",
|
|
3916
|
+
selector: ".one-avatar--md",
|
|
3917
|
+
properties: {
|
|
3918
|
+
width: "32px",
|
|
3919
|
+
height: "32px",
|
|
3920
|
+
fontSize: `var(--one-font-size-md, ${ONE_THEME_DEFAULTS.fontSizeMd})`
|
|
2138
3921
|
}
|
|
2139
|
-
|
|
2140
|
-
return;
|
|
2141
|
-
this.requestChange(page, this.effectivePageSize(), event);
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
// lib/categories.ts
|
|
2145
|
-
var ONE_COMPONENT_CATEGORIES = [
|
|
2146
|
-
{ id: "basic", label: "基础", components: ["OneButton", "OneInput"] },
|
|
3922
|
+
},
|
|
2147
3923
|
{
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
"
|
|
2152
|
-
"
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
"OneCheckboxGroup",
|
|
2156
|
-
"OneSwitch"
|
|
2157
|
-
]
|
|
3924
|
+
name: "one-avatar-lg",
|
|
3925
|
+
selector: ".one-avatar--lg",
|
|
3926
|
+
properties: {
|
|
3927
|
+
width: "40px",
|
|
3928
|
+
height: "40px",
|
|
3929
|
+
fontSize: `var(--one-font-size-lg, ${ONE_THEME_DEFAULTS.fontSizeLg})`
|
|
3930
|
+
}
|
|
2158
3931
|
},
|
|
2159
3932
|
{
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
3933
|
+
name: "one-avatar-circle",
|
|
3934
|
+
selector: ".one-avatar--circle",
|
|
3935
|
+
properties: { borderRadius: "50%" }
|
|
2163
3936
|
},
|
|
2164
3937
|
{
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
3938
|
+
name: "one-avatar-square",
|
|
3939
|
+
selector: ".one-avatar--square",
|
|
3940
|
+
properties: {
|
|
3941
|
+
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`
|
|
3942
|
+
}
|
|
2168
3943
|
},
|
|
2169
3944
|
{
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
import { Component as Component12, slot as slot6 } from "@geektech/tsone";
|
|
2177
|
-
var ONE_CARD_STYLES = [
|
|
3945
|
+
name: "one-avatar-neutral",
|
|
3946
|
+
selector: ".one-avatar--neutral",
|
|
3947
|
+
properties: {
|
|
3948
|
+
backgroundColor: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`
|
|
3949
|
+
}
|
|
3950
|
+
},
|
|
2178
3951
|
{
|
|
2179
|
-
name: "one-
|
|
2180
|
-
selector: ".one-
|
|
3952
|
+
name: "one-avatar-primary",
|
|
3953
|
+
selector: ".one-avatar--primary",
|
|
2181
3954
|
properties: {
|
|
2182
|
-
|
|
2183
|
-
overflow: "hidden",
|
|
2184
|
-
color: `var(--one-card-color, var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText}))`,
|
|
2185
|
-
backgroundColor: `var(--one-card-background, var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface}))`,
|
|
2186
|
-
border: oneThemeBorder(`var(--one-card-border-color, var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder}))`),
|
|
2187
|
-
borderRadius: `var(--one-card-radius, var(--one-radius-lg, ${ONE_THEME_DEFAULTS.radiusMd}))`,
|
|
2188
|
-
boxShadow: `var(--one-card-shadow, var(--one-shadow-card, ${ONE_THEME_DEFAULTS.shadowCard}))`
|
|
3955
|
+
backgroundColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
2189
3956
|
}
|
|
2190
3957
|
},
|
|
2191
3958
|
{
|
|
2192
|
-
name: "one-
|
|
2193
|
-
selector: ".one-
|
|
3959
|
+
name: "one-avatar-success",
|
|
3960
|
+
selector: ".one-avatar--success",
|
|
2194
3961
|
properties: {
|
|
2195
|
-
|
|
2196
|
-
borderBottom: oneThemeBorder(`var(--one-card-border-color, var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder}))`),
|
|
2197
|
-
fontWeight: "500"
|
|
3962
|
+
backgroundColor: `var(--one-color-success, ${ONE_THEME_DEFAULTS.colorSuccess})`
|
|
2198
3963
|
}
|
|
2199
3964
|
},
|
|
2200
3965
|
{
|
|
2201
|
-
name: "one-
|
|
2202
|
-
selector: ".one-
|
|
3966
|
+
name: "one-avatar-warning",
|
|
3967
|
+
selector: ".one-avatar--warning",
|
|
2203
3968
|
properties: {
|
|
2204
|
-
|
|
3969
|
+
backgroundColor: `var(--one-color-warning, ${ONE_THEME_DEFAULTS.colorWarning})`
|
|
2205
3970
|
}
|
|
2206
3971
|
},
|
|
2207
3972
|
{
|
|
2208
|
-
name: "one-
|
|
2209
|
-
selector: ".one-
|
|
3973
|
+
name: "one-avatar-error",
|
|
3974
|
+
selector: ".one-avatar--error",
|
|
2210
3975
|
properties: {
|
|
2211
|
-
|
|
2212
|
-
|
|
3976
|
+
backgroundColor: `var(--one-color-danger, ${ONE_THEME_DEFAULTS.colorDanger})`
|
|
3977
|
+
}
|
|
3978
|
+
},
|
|
3979
|
+
{
|
|
3980
|
+
name: "one-avatar-img",
|
|
3981
|
+
selector: ".one-avatar__img",
|
|
3982
|
+
properties: {
|
|
3983
|
+
width: "100%",
|
|
3984
|
+
height: "100%",
|
|
3985
|
+
objectFit: "cover"
|
|
3986
|
+
}
|
|
3987
|
+
},
|
|
3988
|
+
{
|
|
3989
|
+
name: "one-avatar-fallback",
|
|
3990
|
+
selector: ".one-avatar__fallback",
|
|
3991
|
+
properties: {
|
|
3992
|
+
display: "inline-flex",
|
|
3993
|
+
alignItems: "center",
|
|
3994
|
+
justifyContent: "center",
|
|
3995
|
+
padding: `0 ${ONE_THEME_DEFAULTS.spaceXs}`,
|
|
3996
|
+
lineHeight: "1"
|
|
2213
3997
|
}
|
|
2214
3998
|
}
|
|
2215
3999
|
];
|
|
2216
|
-
function
|
|
2217
|
-
return
|
|
4000
|
+
function normalizeOneAvatarShape(value) {
|
|
4001
|
+
return value === "square" ? "square" : "circle";
|
|
2218
4002
|
}
|
|
2219
4003
|
|
|
2220
|
-
class
|
|
4004
|
+
class OneAvatar extends Component22 {
|
|
2221
4005
|
initState() {
|
|
2222
4006
|
return {};
|
|
2223
4007
|
}
|
|
2224
4008
|
initStyles() {
|
|
2225
|
-
|
|
4009
|
+
ONE_AVATAR_STYLES.forEach(({ name, ...style }) => {
|
|
2226
4010
|
this.styleManager.addStyle(name, style);
|
|
2227
4011
|
});
|
|
2228
4012
|
}
|
|
2229
4013
|
render() {
|
|
2230
|
-
const
|
|
2231
|
-
const
|
|
2232
|
-
const
|
|
2233
|
-
const
|
|
4014
|
+
const size = normalizeOneSize(this.props.size);
|
|
4015
|
+
const shape = normalizeOneAvatarShape(this.props.shape);
|
|
4016
|
+
const variant = normalizeOneDataDisplayVariant(this.props.variant);
|
|
4017
|
+
const hasImage = Boolean(this.props.src);
|
|
4018
|
+
const fallback = this.props.children && this.props.children.length > 0 ? this.props.children : this.props.text ? [this.props.text] : [];
|
|
2234
4019
|
return {
|
|
2235
|
-
tag: "
|
|
2236
|
-
props: {
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
children: headerChildren
|
|
2243
|
-
}
|
|
2244
|
-
] : [],
|
|
4020
|
+
tag: "span",
|
|
4021
|
+
props: {
|
|
4022
|
+
className: `one-avatar one-avatar--${size} one-avatar--${shape} one-avatar--${variant}`,
|
|
4023
|
+
role: this.props.ariaLabel ? "img" : undefined,
|
|
4024
|
+
"aria-label": this.props.ariaLabel
|
|
4025
|
+
},
|
|
4026
|
+
children: hasImage ? [
|
|
2245
4027
|
{
|
|
2246
|
-
tag: "
|
|
2247
|
-
props: {
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
{
|
|
2252
|
-
tag: "footer",
|
|
2253
|
-
props: { className: "one-card__footer" },
|
|
2254
|
-
children: [slot6("footer")]
|
|
4028
|
+
tag: "img",
|
|
4029
|
+
props: {
|
|
4030
|
+
className: "one-avatar__img",
|
|
4031
|
+
src: this.props.src,
|
|
4032
|
+
alt: this.props.alt
|
|
2255
4033
|
}
|
|
2256
|
-
|
|
4034
|
+
}
|
|
4035
|
+
] : [
|
|
4036
|
+
{
|
|
4037
|
+
tag: "span",
|
|
4038
|
+
props: { className: "one-avatar__fallback" },
|
|
4039
|
+
children: fallback
|
|
4040
|
+
}
|
|
2257
4041
|
]
|
|
2258
4042
|
};
|
|
2259
4043
|
}
|
|
2260
4044
|
}
|
|
2261
|
-
// lib/
|
|
2262
|
-
import { Component as
|
|
2263
|
-
|
|
2264
|
-
// lib/data-display/types.ts
|
|
2265
|
-
var VARIANTS = [
|
|
2266
|
-
"neutral",
|
|
2267
|
-
"primary",
|
|
2268
|
-
"success",
|
|
2269
|
-
"warning",
|
|
2270
|
-
"error"
|
|
2271
|
-
];
|
|
2272
|
-
function normalizeOneDataDisplayVariant(value, fallback = "neutral") {
|
|
2273
|
-
return VARIANTS.includes(value) ? value : fallback;
|
|
2274
|
-
}
|
|
2275
|
-
// lib/tag/OneTag.ts
|
|
2276
|
-
var ONE_TAG_STYLES = [
|
|
4045
|
+
// lib/progress/OneProgress.ts
|
|
4046
|
+
import { Component as Component23 } from "@geektech/tsone";
|
|
4047
|
+
var ONE_PROGRESS_STYLES = [
|
|
2277
4048
|
{
|
|
2278
|
-
name: "one-
|
|
2279
|
-
selector: ".one-
|
|
4049
|
+
name: "one-progress-base",
|
|
4050
|
+
selector: ".one-progress",
|
|
2280
4051
|
properties: {
|
|
2281
4052
|
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
2282
|
-
display: "
|
|
4053
|
+
display: "flex",
|
|
2283
4054
|
alignItems: "center",
|
|
2284
|
-
gap: ONE_THEME_DEFAULTS.
|
|
2285
|
-
border: oneThemeBorder(),
|
|
2286
|
-
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`
|
|
4055
|
+
gap: `var(--one-space-sm, ${ONE_THEME_DEFAULTS.spaceSm})`
|
|
2287
4056
|
}
|
|
2288
4057
|
},
|
|
2289
4058
|
{
|
|
2290
|
-
name: "one-
|
|
2291
|
-
selector: ".one-
|
|
4059
|
+
name: "one-progress-track",
|
|
4060
|
+
selector: ".one-progress__track",
|
|
2292
4061
|
properties: {
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
4062
|
+
flex: "1",
|
|
4063
|
+
height: "8px",
|
|
4064
|
+
overflow: "hidden",
|
|
4065
|
+
borderRadius: "999px",
|
|
4066
|
+
backgroundColor: `var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`
|
|
2296
4067
|
}
|
|
2297
4068
|
},
|
|
2298
4069
|
{
|
|
2299
|
-
name: "one-
|
|
2300
|
-
selector: ".one-
|
|
4070
|
+
name: "one-progress-bar",
|
|
4071
|
+
selector: ".one-progress__bar",
|
|
2301
4072
|
properties: {
|
|
2302
|
-
|
|
4073
|
+
height: "100%",
|
|
4074
|
+
borderRadius: "999px",
|
|
2303
4075
|
backgroundColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`,
|
|
2304
|
-
|
|
4076
|
+
transition: "width 150ms ease"
|
|
2305
4077
|
}
|
|
2306
4078
|
},
|
|
2307
4079
|
{
|
|
2308
|
-
name: "one-
|
|
2309
|
-
selector: ".one-
|
|
4080
|
+
name: "one-progress-neutral",
|
|
4081
|
+
selector: ".one-progress__bar--neutral",
|
|
2310
4082
|
properties: {
|
|
2311
|
-
|
|
2312
|
-
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
2313
|
-
borderColor: `var(--one-color-success, ${ONE_THEME_DEFAULTS.colorSuccess})`
|
|
4083
|
+
backgroundColor: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`
|
|
2314
4084
|
}
|
|
2315
4085
|
},
|
|
2316
4086
|
{
|
|
2317
|
-
name: "one-
|
|
2318
|
-
selector: ".one-
|
|
4087
|
+
name: "one-progress-primary",
|
|
4088
|
+
selector: ".one-progress__bar--primary",
|
|
2319
4089
|
properties: {
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
4090
|
+
backgroundColor: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
4091
|
+
}
|
|
4092
|
+
},
|
|
4093
|
+
{
|
|
4094
|
+
name: "one-progress-success",
|
|
4095
|
+
selector: ".one-progress__bar--success",
|
|
4096
|
+
properties: {
|
|
4097
|
+
backgroundColor: `var(--one-color-success, ${ONE_THEME_DEFAULTS.colorSuccess})`
|
|
4098
|
+
}
|
|
4099
|
+
},
|
|
4100
|
+
{
|
|
4101
|
+
name: "one-progress-warning",
|
|
4102
|
+
selector: ".one-progress__bar--warning",
|
|
4103
|
+
properties: {
|
|
4104
|
+
backgroundColor: `var(--one-color-warning, ${ONE_THEME_DEFAULTS.colorWarning})`
|
|
4105
|
+
}
|
|
4106
|
+
},
|
|
4107
|
+
{
|
|
4108
|
+
name: "one-progress-error",
|
|
4109
|
+
selector: ".one-progress__bar--error",
|
|
4110
|
+
properties: {
|
|
4111
|
+
backgroundColor: `var(--one-color-danger, ${ONE_THEME_DEFAULTS.colorDanger})`
|
|
4112
|
+
}
|
|
4113
|
+
},
|
|
4114
|
+
{
|
|
4115
|
+
name: "one-progress-text",
|
|
4116
|
+
selector: ".one-progress__text",
|
|
4117
|
+
properties: {
|
|
4118
|
+
minWidth: "3em",
|
|
4119
|
+
textAlign: "right",
|
|
4120
|
+
fontSize: `var(--one-font-size-sm, ${ONE_THEME_DEFAULTS.fontSizeSm})`,
|
|
4121
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4124
|
+
];
|
|
4125
|
+
function normalizePercent(value) {
|
|
4126
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
4127
|
+
return 0;
|
|
4128
|
+
return Math.min(100, Math.max(0, value));
|
|
4129
|
+
}
|
|
4130
|
+
|
|
4131
|
+
class OneProgress extends Component23 {
|
|
4132
|
+
initState() {
|
|
4133
|
+
return {};
|
|
4134
|
+
}
|
|
4135
|
+
initStyles() {
|
|
4136
|
+
ONE_PROGRESS_STYLES.forEach(({ name, ...style }) => {
|
|
4137
|
+
this.styleManager.addStyle(name, style);
|
|
4138
|
+
});
|
|
4139
|
+
}
|
|
4140
|
+
render() {
|
|
4141
|
+
const percent = normalizePercent(this.props.percent);
|
|
4142
|
+
const rounded = Math.round(percent);
|
|
4143
|
+
const variant = normalizeOneDataDisplayVariant(this.props.variant, "primary");
|
|
4144
|
+
return {
|
|
4145
|
+
tag: "div",
|
|
4146
|
+
props: {
|
|
4147
|
+
className: "one-progress",
|
|
4148
|
+
role: "progressbar",
|
|
4149
|
+
"aria-valuemin": "0",
|
|
4150
|
+
"aria-valuemax": "100",
|
|
4151
|
+
"aria-valuenow": String(rounded),
|
|
4152
|
+
"aria-valuetext": `${rounded}%`,
|
|
4153
|
+
"aria-label": this.props.ariaLabel
|
|
4154
|
+
},
|
|
4155
|
+
children: [
|
|
4156
|
+
{
|
|
4157
|
+
tag: "div",
|
|
4158
|
+
props: { className: "one-progress__track" },
|
|
4159
|
+
children: [
|
|
4160
|
+
{
|
|
4161
|
+
tag: "div",
|
|
4162
|
+
props: {
|
|
4163
|
+
className: `one-progress__bar one-progress__bar--${variant}`,
|
|
4164
|
+
style: { width: `${percent}%` }
|
|
4165
|
+
}
|
|
4166
|
+
}
|
|
4167
|
+
]
|
|
4168
|
+
},
|
|
4169
|
+
...this.props.showText ? [
|
|
4170
|
+
{
|
|
4171
|
+
tag: "span",
|
|
4172
|
+
props: { className: "one-progress__text" },
|
|
4173
|
+
children: [`${rounded}%`]
|
|
4174
|
+
}
|
|
4175
|
+
] : []
|
|
4176
|
+
]
|
|
4177
|
+
};
|
|
4178
|
+
}
|
|
4179
|
+
}
|
|
4180
|
+
// lib/table/OneTable.ts
|
|
4181
|
+
import { Component as Component24 } from "@geektech/tsone";
|
|
4182
|
+
var ONE_TABLE_STYLES = [
|
|
4183
|
+
{
|
|
4184
|
+
name: "one-table-wrap",
|
|
4185
|
+
selector: ".one-table__wrap",
|
|
4186
|
+
properties: {
|
|
4187
|
+
width: "100%",
|
|
4188
|
+
overflowX: "auto",
|
|
4189
|
+
border: oneThemeBorder(),
|
|
4190
|
+
borderRadius: `var(--one-radius-md, ${ONE_THEME_DEFAULTS.radiusMd})`
|
|
2323
4191
|
}
|
|
2324
4192
|
},
|
|
2325
4193
|
{
|
|
2326
|
-
name: "one-
|
|
2327
|
-
selector: ".one-
|
|
4194
|
+
name: "one-table-base",
|
|
4195
|
+
selector: ".one-table",
|
|
2328
4196
|
properties: {
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
4197
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
4198
|
+
width: "100%",
|
|
4199
|
+
borderCollapse: "collapse",
|
|
4200
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
2332
4201
|
}
|
|
2333
4202
|
},
|
|
2334
4203
|
{
|
|
2335
|
-
name: "one-
|
|
2336
|
-
selector: ".one-
|
|
4204
|
+
name: "one-table-head",
|
|
4205
|
+
selector: ".one-table__head",
|
|
2337
4206
|
properties: {
|
|
2338
|
-
padding:
|
|
2339
|
-
|
|
4207
|
+
padding: `${ONE_THEME_DEFAULTS.spaceSm} ${ONE_THEME_DEFAULTS.spaceMd}`,
|
|
4208
|
+
textAlign: "left",
|
|
4209
|
+
borderBottom: `2px solid var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`,
|
|
4210
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
4211
|
+
fontSize: `var(--one-font-size-sm, ${ONE_THEME_DEFAULTS.fontSizeSm})`,
|
|
4212
|
+
fontWeight: "600",
|
|
4213
|
+
whiteSpace: "nowrap"
|
|
2340
4214
|
}
|
|
2341
4215
|
},
|
|
2342
4216
|
{
|
|
2343
|
-
name: "one-
|
|
2344
|
-
selector: ".one-
|
|
4217
|
+
name: "one-table-cell",
|
|
4218
|
+
selector: ".one-table__cell",
|
|
2345
4219
|
properties: {
|
|
2346
|
-
padding:
|
|
2347
|
-
|
|
4220
|
+
padding: `${ONE_THEME_DEFAULTS.spaceSm} ${ONE_THEME_DEFAULTS.spaceMd}`,
|
|
4221
|
+
borderBottom: oneThemeBorder(),
|
|
4222
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`,
|
|
4223
|
+
verticalAlign: "middle"
|
|
2348
4224
|
}
|
|
2349
4225
|
},
|
|
2350
4226
|
{
|
|
2351
|
-
name: "one-
|
|
2352
|
-
selector: ".one-
|
|
4227
|
+
name: "one-table-row-hover",
|
|
4228
|
+
selector: ".one-table--hover tbody tr:hover",
|
|
2353
4229
|
properties: {
|
|
2354
|
-
|
|
2355
|
-
fontSize: `var(--one-font-size-lg, ${ONE_THEME_DEFAULTS.fontSizeLg})`
|
|
4230
|
+
backgroundColor: `var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`
|
|
2356
4231
|
}
|
|
2357
4232
|
},
|
|
2358
4233
|
{
|
|
2359
|
-
name: "one-
|
|
2360
|
-
selector: ".one-
|
|
4234
|
+
name: "one-table-row-striped",
|
|
4235
|
+
selector: ".one-table--striped tbody tr:nth-child(even)",
|
|
2361
4236
|
properties: {
|
|
2362
|
-
|
|
2363
|
-
placeItems: "center",
|
|
2364
|
-
padding: "0",
|
|
2365
|
-
color: "inherit",
|
|
2366
|
-
backgroundColor: "transparent",
|
|
2367
|
-
border: "0",
|
|
2368
|
-
cursor: "pointer",
|
|
2369
|
-
font: "inherit",
|
|
2370
|
-
lineHeight: "1"
|
|
4237
|
+
backgroundColor: `var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`
|
|
2371
4238
|
}
|
|
2372
4239
|
},
|
|
2373
4240
|
{
|
|
2374
|
-
name: "one-
|
|
2375
|
-
selector: ".one-
|
|
4241
|
+
name: "one-table-empty",
|
|
4242
|
+
selector: ".one-table__empty",
|
|
2376
4243
|
properties: {
|
|
2377
|
-
|
|
2378
|
-
|
|
4244
|
+
padding: `${ONE_THEME_DEFAULTS.spaceLg}`,
|
|
4245
|
+
textAlign: "center",
|
|
4246
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`
|
|
2379
4247
|
}
|
|
2380
4248
|
}
|
|
2381
4249
|
];
|
|
4250
|
+
function isVNodeLike(value) {
|
|
4251
|
+
return "tag" in value || "component" in value;
|
|
4252
|
+
}
|
|
2382
4253
|
|
|
2383
|
-
class
|
|
4254
|
+
class OneTable extends Component24 {
|
|
2384
4255
|
initState() {
|
|
2385
|
-
return {
|
|
4256
|
+
return {};
|
|
2386
4257
|
}
|
|
2387
4258
|
initStyles() {
|
|
2388
|
-
|
|
4259
|
+
ONE_TABLE_STYLES.forEach(({ name, ...style }) => {
|
|
2389
4260
|
this.styleManager.addStyle(name, style);
|
|
2390
4261
|
});
|
|
2391
4262
|
}
|
|
2392
4263
|
render() {
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
}
|
|
2399
|
-
const variant = normalizeOneDataDisplayVariant(this.props.variant);
|
|
2400
|
-
const size = normalizeOneSize(this.props.size);
|
|
2401
|
-
return {
|
|
2402
|
-
tag: "span",
|
|
4264
|
+
const data = this.props.data ?? [];
|
|
4265
|
+
const columns = this.resolveColumns(data);
|
|
4266
|
+
const rowKey = this.props.rowKey;
|
|
4267
|
+
const headRows = columns.map((column) => ({
|
|
4268
|
+
tag: "th",
|
|
2403
4269
|
props: {
|
|
2404
|
-
|
|
4270
|
+
scope: "col",
|
|
4271
|
+
className: "one-table__head"
|
|
2405
4272
|
},
|
|
2406
|
-
children: [
|
|
2407
|
-
|
|
2408
|
-
|
|
4273
|
+
children: [column.title ?? column.key]
|
|
4274
|
+
}));
|
|
4275
|
+
const bodyRows = data.map((row, index) => {
|
|
4276
|
+
const keyValue = rowKey ? row[rowKey] : undefined;
|
|
4277
|
+
const key = typeof keyValue === "string" || typeof keyValue === "number" ? String(keyValue) : String(index);
|
|
4278
|
+
return {
|
|
4279
|
+
tag: "tr",
|
|
4280
|
+
key,
|
|
4281
|
+
children: columns.map((column) => ({
|
|
4282
|
+
tag: "td",
|
|
4283
|
+
props: { className: "one-table__cell" },
|
|
4284
|
+
children: [this.renderCell(column, row)]
|
|
4285
|
+
}))
|
|
4286
|
+
};
|
|
4287
|
+
});
|
|
4288
|
+
const body = bodyRows.length > 0 ? bodyRows : [
|
|
4289
|
+
{
|
|
4290
|
+
tag: "tr",
|
|
4291
|
+
children: [
|
|
2409
4292
|
{
|
|
2410
|
-
tag: "
|
|
4293
|
+
tag: "td",
|
|
2411
4294
|
props: {
|
|
2412
|
-
className: "one-
|
|
2413
|
-
|
|
2414
|
-
"aria-label": "关闭标签"
|
|
4295
|
+
className: "one-table__empty",
|
|
4296
|
+
colSpan: Math.max(columns.length, 1)
|
|
2415
4297
|
},
|
|
2416
|
-
|
|
2417
|
-
children: ["×"]
|
|
4298
|
+
children: [this.props.emptyText ?? "暂无数据"]
|
|
2418
4299
|
}
|
|
2419
|
-
]
|
|
4300
|
+
]
|
|
4301
|
+
}
|
|
4302
|
+
];
|
|
4303
|
+
return {
|
|
4304
|
+
tag: "div",
|
|
4305
|
+
props: { className: "one-table__wrap" },
|
|
4306
|
+
children: [
|
|
4307
|
+
{
|
|
4308
|
+
tag: "table",
|
|
4309
|
+
props: {
|
|
4310
|
+
className: [
|
|
4311
|
+
"one-table",
|
|
4312
|
+
...this.props.hover === true ? ["one-table--hover"] : [],
|
|
4313
|
+
...this.props.striped === true ? ["one-table--striped"] : []
|
|
4314
|
+
].join(" "),
|
|
4315
|
+
"aria-label": this.props.ariaLabel
|
|
4316
|
+
},
|
|
4317
|
+
children: [
|
|
4318
|
+
{
|
|
4319
|
+
tag: "thead",
|
|
4320
|
+
children: [
|
|
4321
|
+
{
|
|
4322
|
+
tag: "tr",
|
|
4323
|
+
children: headRows
|
|
4324
|
+
}
|
|
4325
|
+
]
|
|
4326
|
+
},
|
|
4327
|
+
{ tag: "tbody", children: body }
|
|
4328
|
+
]
|
|
4329
|
+
}
|
|
2420
4330
|
]
|
|
2421
4331
|
};
|
|
2422
4332
|
}
|
|
2423
|
-
|
|
2424
|
-
if (
|
|
2425
|
-
return;
|
|
4333
|
+
resolveColumns(data) {
|
|
4334
|
+
if (this.props.columns && this.props.columns.length > 0) {
|
|
4335
|
+
return this.props.columns;
|
|
2426
4336
|
}
|
|
2427
|
-
|
|
2428
|
-
|
|
4337
|
+
const first = data[0];
|
|
4338
|
+
if (!first)
|
|
4339
|
+
return [];
|
|
4340
|
+
return Object.keys(first).map((key) => ({ key }));
|
|
4341
|
+
}
|
|
4342
|
+
renderCell(column, row) {
|
|
4343
|
+
const value = column.render ? column.render(row) : row[column.key];
|
|
4344
|
+
return this.normalizeCell(value);
|
|
4345
|
+
}
|
|
4346
|
+
normalizeCell(value) {
|
|
4347
|
+
if (value == null)
|
|
4348
|
+
return "";
|
|
4349
|
+
if (typeof value === "object") {
|
|
4350
|
+
return isVNodeLike(value) ? value : "";
|
|
4351
|
+
}
|
|
4352
|
+
return String(value);
|
|
2429
4353
|
}
|
|
2430
4354
|
}
|
|
2431
|
-
// lib/
|
|
2432
|
-
import { Component as
|
|
2433
|
-
var
|
|
4355
|
+
// lib/collapse/OneCollapse.ts
|
|
4356
|
+
import { Component as Component25 } from "@geektech/tsone";
|
|
4357
|
+
var ONE_COLLAPSE_STYLES = [
|
|
2434
4358
|
{
|
|
2435
|
-
name: "one-
|
|
2436
|
-
selector: ".one-
|
|
4359
|
+
name: "one-collapse-base",
|
|
4360
|
+
selector: ".one-collapse",
|
|
2437
4361
|
properties: {
|
|
2438
4362
|
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
4363
|
+
border: oneThemeBorder(),
|
|
4364
|
+
borderRadius: `var(--one-radius-md, ${ONE_THEME_DEFAULTS.radiusMd})`,
|
|
4365
|
+
overflow: "hidden",
|
|
4366
|
+
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
4367
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
2442
4368
|
}
|
|
2443
4369
|
},
|
|
2444
4370
|
{
|
|
2445
|
-
name: "one-
|
|
2446
|
-
selector: ".one-
|
|
4371
|
+
name: "one-collapse-item",
|
|
4372
|
+
selector: ".one-collapse__item",
|
|
2447
4373
|
properties: {
|
|
2448
|
-
|
|
2449
|
-
top: "0",
|
|
2450
|
-
right: "0",
|
|
2451
|
-
display: "inline-flex",
|
|
2452
|
-
alignItems: "center",
|
|
2453
|
-
justifyContent: "center",
|
|
2454
|
-
boxSizing: "border-box",
|
|
2455
|
-
minWidth: "18px",
|
|
2456
|
-
height: "18px",
|
|
2457
|
-
padding: "0 5px",
|
|
2458
|
-
borderRadius: "999px",
|
|
2459
|
-
fontFamily: `var(--one-font-family, ${ONE_THEME_DEFAULTS.fontFamily})`,
|
|
2460
|
-
fontSize: `var(--one-font-size-sm, ${ONE_THEME_DEFAULTS.fontSizeSm})`,
|
|
2461
|
-
lineHeight: "1",
|
|
2462
|
-
transform: "translate(50%, -50%)"
|
|
4374
|
+
borderBottom: oneThemeBorder()
|
|
2463
4375
|
}
|
|
2464
4376
|
},
|
|
2465
4377
|
{
|
|
2466
|
-
name: "one-
|
|
2467
|
-
selector: ".one-
|
|
2468
|
-
properties: {
|
|
2469
|
-
position: "static",
|
|
2470
|
-
transform: "none"
|
|
2471
|
-
}
|
|
4378
|
+
name: "one-collapse-item-last",
|
|
4379
|
+
selector: ".one-collapse__item:last-child",
|
|
4380
|
+
properties: { borderBottom: "none" }
|
|
2472
4381
|
},
|
|
2473
4382
|
{
|
|
2474
|
-
name: "one-
|
|
2475
|
-
selector: ".one-
|
|
4383
|
+
name: "one-collapse-header",
|
|
4384
|
+
selector: ".one-collapse__header",
|
|
2476
4385
|
properties: {
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
4386
|
+
display: "flex",
|
|
4387
|
+
width: "100%",
|
|
4388
|
+
alignItems: "center",
|
|
4389
|
+
justifyContent: "space-between",
|
|
4390
|
+
gap: `var(--one-space-sm, ${ONE_THEME_DEFAULTS.spaceSm})`,
|
|
4391
|
+
padding: `${ONE_THEME_DEFAULTS.spaceSm} ${ONE_THEME_DEFAULTS.spaceMd}`,
|
|
4392
|
+
backgroundColor: "transparent",
|
|
4393
|
+
border: "0",
|
|
4394
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`,
|
|
4395
|
+
cursor: "pointer",
|
|
4396
|
+
font: "inherit",
|
|
4397
|
+
textAlign: "left"
|
|
2481
4398
|
}
|
|
2482
4399
|
},
|
|
2483
4400
|
{
|
|
2484
|
-
name: "one-
|
|
2485
|
-
selector: ".one-
|
|
4401
|
+
name: "one-collapse-header-hover",
|
|
4402
|
+
selector: ".one-collapse__header:hover:not(:disabled)",
|
|
2486
4403
|
properties: {
|
|
2487
|
-
color: `var(--one-color-
|
|
2488
|
-
backgroundColor: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
2489
|
-
border: oneThemeBorder()
|
|
4404
|
+
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
2490
4405
|
}
|
|
2491
4406
|
},
|
|
2492
4407
|
{
|
|
2493
|
-
name: "one-
|
|
2494
|
-
selector: ".one-
|
|
4408
|
+
name: "one-collapse-header-icon",
|
|
4409
|
+
selector: ".one-collapse__header-icon",
|
|
2495
4410
|
properties: {
|
|
2496
|
-
|
|
2497
|
-
|
|
4411
|
+
flexShrink: "0",
|
|
4412
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`,
|
|
4413
|
+
transition: "transform 150ms ease"
|
|
2498
4414
|
}
|
|
2499
4415
|
},
|
|
2500
4416
|
{
|
|
2501
|
-
name: "one-
|
|
2502
|
-
selector: ".one-
|
|
2503
|
-
properties: {
|
|
2504
|
-
color: `var(--one-color-surface, ${ONE_THEME_DEFAULTS.colorSurface})`,
|
|
2505
|
-
backgroundColor: `var(--one-color-success, ${ONE_THEME_DEFAULTS.colorSuccess})`
|
|
2506
|
-
}
|
|
4417
|
+
name: "one-collapse-item-open-icon",
|
|
4418
|
+
selector: ".one-collapse__item--open .one-collapse__header-icon",
|
|
4419
|
+
properties: { transform: "rotate(180deg)" }
|
|
2507
4420
|
},
|
|
2508
4421
|
{
|
|
2509
|
-
name: "one-
|
|
2510
|
-
selector: ".one-
|
|
4422
|
+
name: "one-collapse-panel",
|
|
4423
|
+
selector: ".one-collapse__panel",
|
|
2511
4424
|
properties: {
|
|
2512
|
-
|
|
2513
|
-
|
|
4425
|
+
padding: `0 ${ONE_THEME_DEFAULTS.spaceMd} ${ONE_THEME_DEFAULTS.spaceMd}`,
|
|
4426
|
+
borderTop: oneThemeBorder(),
|
|
4427
|
+
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`
|
|
2514
4428
|
}
|
|
2515
4429
|
},
|
|
2516
4430
|
{
|
|
2517
|
-
name: "one-
|
|
2518
|
-
selector: ".one-
|
|
4431
|
+
name: "one-collapse-disabled",
|
|
4432
|
+
selector: ".one-collapse__item--disabled .one-collapse__header",
|
|
2519
4433
|
properties: {
|
|
2520
|
-
|
|
2521
|
-
|
|
4434
|
+
opacity: "0.5",
|
|
4435
|
+
cursor: "not-allowed"
|
|
2522
4436
|
}
|
|
2523
4437
|
}
|
|
2524
4438
|
];
|
|
2525
|
-
function normalizeMax(value) {
|
|
2526
|
-
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : 99;
|
|
2527
|
-
}
|
|
2528
|
-
function displayValue(props) {
|
|
2529
|
-
if (props.dot) {
|
|
2530
|
-
return "";
|
|
2531
|
-
}
|
|
2532
|
-
if (props.value === undefined || props.value === "") {
|
|
2533
|
-
return;
|
|
2534
|
-
}
|
|
2535
|
-
if (props.value === 0 && props.showZero !== true) {
|
|
2536
|
-
return;
|
|
2537
|
-
}
|
|
2538
|
-
if (typeof props.value === "number" && !Number.isFinite(props.value)) {
|
|
2539
|
-
return;
|
|
2540
|
-
}
|
|
2541
|
-
if (typeof props.value === "number") {
|
|
2542
|
-
const max = normalizeMax(props.max);
|
|
2543
|
-
return props.value > max ? `${max}+` : String(props.value);
|
|
2544
|
-
}
|
|
2545
|
-
return props.value;
|
|
2546
|
-
}
|
|
2547
4439
|
|
|
2548
|
-
class
|
|
4440
|
+
class OneCollapse extends Component25 {
|
|
2549
4441
|
initState() {
|
|
2550
|
-
return {};
|
|
4442
|
+
return { internalActive: [...this.props.defaultActive ?? []] };
|
|
2551
4443
|
}
|
|
2552
4444
|
initStyles() {
|
|
2553
|
-
|
|
4445
|
+
ONE_COLLAPSE_STYLES.forEach(({ name, ...style }) => {
|
|
2554
4446
|
this.styleManager.addStyle(name, style);
|
|
2555
4447
|
});
|
|
2556
4448
|
}
|
|
2557
4449
|
render() {
|
|
2558
|
-
const
|
|
2559
|
-
const
|
|
2560
|
-
const variant = normalizeOneDataDisplayVariant(this.props.variant, "primary");
|
|
2561
|
-
const value = displayValue(this.props);
|
|
2562
|
-
const showContent = this.props.dot === true || value !== undefined;
|
|
4450
|
+
const active = this.getActive();
|
|
4451
|
+
const items = this.props.items ?? [];
|
|
2563
4452
|
return {
|
|
2564
|
-
tag: "
|
|
4453
|
+
tag: "div",
|
|
2565
4454
|
props: {
|
|
2566
|
-
className:
|
|
2567
|
-
|
|
2568
|
-
`one-badge--${variant}`,
|
|
2569
|
-
...standalone ? ["one-badge--standalone"] : []
|
|
2570
|
-
].join(" ")
|
|
4455
|
+
className: "one-collapse",
|
|
4456
|
+
"aria-label": this.props.ariaLabel
|
|
2571
4457
|
},
|
|
2572
|
-
children:
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
"
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
4458
|
+
children: items.map((item) => {
|
|
4459
|
+
const open = active.includes(item.value);
|
|
4460
|
+
const disabled = item.disabled === true;
|
|
4461
|
+
const panelId = `one-collapse-panel-${item.value}`;
|
|
4462
|
+
const headerId = `one-collapse-header-${item.value}`;
|
|
4463
|
+
return {
|
|
4464
|
+
tag: "div",
|
|
4465
|
+
props: {
|
|
4466
|
+
className: [
|
|
4467
|
+
"one-collapse__item",
|
|
4468
|
+
...open ? ["one-collapse__item--open"] : [],
|
|
4469
|
+
...disabled ? ["one-collapse__item--disabled"] : []
|
|
4470
|
+
].join(" ")
|
|
4471
|
+
},
|
|
4472
|
+
children: [
|
|
4473
|
+
{
|
|
4474
|
+
tag: "button",
|
|
4475
|
+
props: {
|
|
4476
|
+
type: "button",
|
|
4477
|
+
id: headerId,
|
|
4478
|
+
className: "one-collapse__header",
|
|
4479
|
+
"aria-expanded": open ? "true" : "false",
|
|
4480
|
+
"aria-controls": panelId,
|
|
4481
|
+
disabled: disabled || undefined
|
|
4482
|
+
},
|
|
4483
|
+
listeners: {
|
|
4484
|
+
click: (event) => this.toggle(item.value, event)
|
|
4485
|
+
},
|
|
4486
|
+
children: [
|
|
4487
|
+
{
|
|
4488
|
+
tag: "span",
|
|
4489
|
+
props: { className: "one-collapse__header-title" },
|
|
4490
|
+
children: [item.title]
|
|
4491
|
+
},
|
|
4492
|
+
{
|
|
4493
|
+
tag: "span",
|
|
4494
|
+
props: {
|
|
4495
|
+
className: "one-collapse__header-icon",
|
|
4496
|
+
"aria-hidden": "true"
|
|
4497
|
+
},
|
|
4498
|
+
children: ["▾"]
|
|
4499
|
+
}
|
|
4500
|
+
]
|
|
4501
|
+
},
|
|
4502
|
+
{
|
|
4503
|
+
tag: "section",
|
|
4504
|
+
props: {
|
|
4505
|
+
id: panelId,
|
|
4506
|
+
className: "one-collapse__panel",
|
|
4507
|
+
role: "region",
|
|
4508
|
+
"aria-labelledby": headerId,
|
|
4509
|
+
hidden: open ? undefined : true
|
|
4510
|
+
},
|
|
4511
|
+
children: item.children ?? []
|
|
4512
|
+
}
|
|
4513
|
+
]
|
|
4514
|
+
};
|
|
4515
|
+
})
|
|
2589
4516
|
};
|
|
2590
4517
|
}
|
|
4518
|
+
getActive() {
|
|
4519
|
+
return this.props.active ?? this.state.internalActive;
|
|
4520
|
+
}
|
|
4521
|
+
toggle(value, event) {
|
|
4522
|
+
const item = (this.props.items ?? []).find((candidate) => candidate.value === value);
|
|
4523
|
+
if (item?.disabled === true)
|
|
4524
|
+
return;
|
|
4525
|
+
const current = this.getActive();
|
|
4526
|
+
let next;
|
|
4527
|
+
if (this.props.accordion === true) {
|
|
4528
|
+
next = current.includes(value) ? [] : [value];
|
|
4529
|
+
} else if (current.includes(value)) {
|
|
4530
|
+
next = current.filter((candidate) => candidate !== value);
|
|
4531
|
+
} else {
|
|
4532
|
+
next = [...current, value];
|
|
4533
|
+
}
|
|
4534
|
+
if (this.props.active === undefined) {
|
|
4535
|
+
this.setState({ internalActive: next });
|
|
4536
|
+
}
|
|
4537
|
+
this.emit("change", {
|
|
4538
|
+
value: next,
|
|
4539
|
+
originalEvent: event
|
|
4540
|
+
});
|
|
4541
|
+
}
|
|
2591
4542
|
}
|
|
2592
|
-
// lib/
|
|
2593
|
-
import { Component as
|
|
2594
|
-
var
|
|
4543
|
+
// lib/skeleton/OneSkeleton.ts
|
|
4544
|
+
import { Component as Component26 } from "@geektech/tsone";
|
|
4545
|
+
var ONE_SKELETON_STYLES = [
|
|
2595
4546
|
{
|
|
2596
|
-
name: "one-
|
|
2597
|
-
selector: ".one-
|
|
4547
|
+
name: "one-skeleton-base",
|
|
4548
|
+
selector: ".one-skeleton",
|
|
2598
4549
|
properties: {
|
|
2599
4550
|
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
2600
|
-
display: "
|
|
2601
|
-
|
|
2602
|
-
gap: ONE_THEME_DEFAULTS.
|
|
2603
|
-
|
|
2604
|
-
color: `var(--one-color-text, ${ONE_THEME_DEFAULTS.colorText})`,
|
|
2605
|
-
textAlign: "center"
|
|
4551
|
+
display: "flex",
|
|
4552
|
+
flexDirection: "column",
|
|
4553
|
+
gap: `var(--one-space-sm, ${ONE_THEME_DEFAULTS.spaceSm})`,
|
|
4554
|
+
width: "100%"
|
|
2606
4555
|
}
|
|
2607
4556
|
},
|
|
2608
4557
|
{
|
|
2609
|
-
name: "one-
|
|
2610
|
-
selector: ".one-
|
|
4558
|
+
name: "one-skeleton-avatar",
|
|
4559
|
+
selector: ".one-skeleton__avatar",
|
|
2611
4560
|
properties: {
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
4561
|
+
width: "40px",
|
|
4562
|
+
height: "40px",
|
|
4563
|
+
flexShrink: "0",
|
|
4564
|
+
borderRadius: "50%",
|
|
4565
|
+
backgroundColor: `var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`
|
|
2615
4566
|
}
|
|
2616
4567
|
},
|
|
2617
4568
|
{
|
|
2618
|
-
name: "one-
|
|
2619
|
-
selector: ".one-
|
|
4569
|
+
name: "one-skeleton-title",
|
|
4570
|
+
selector: ".one-skeleton__title",
|
|
2620
4571
|
properties: {
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
backgroundColor: `var(--one-color-
|
|
2625
|
-
border: `2px solid var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`,
|
|
2626
|
-
borderRadius: `var(--one-radius-md, ${ONE_THEME_DEFAULTS.radiusMd})`
|
|
4572
|
+
width: "40%",
|
|
4573
|
+
height: "16px",
|
|
4574
|
+
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`,
|
|
4575
|
+
backgroundColor: `var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`
|
|
2627
4576
|
}
|
|
2628
4577
|
},
|
|
2629
4578
|
{
|
|
2630
|
-
name: "one-
|
|
2631
|
-
selector: ".one-
|
|
4579
|
+
name: "one-skeleton-line",
|
|
4580
|
+
selector: ".one-skeleton__line",
|
|
2632
4581
|
properties: {
|
|
2633
|
-
|
|
2634
|
-
|
|
4582
|
+
height: "12px",
|
|
4583
|
+
borderRadius: `var(--one-radius-sm, ${ONE_THEME_DEFAULTS.radiusSm})`,
|
|
4584
|
+
backgroundColor: `var(--one-color-border, ${ONE_THEME_DEFAULTS.colorBorder})`
|
|
2635
4585
|
}
|
|
2636
4586
|
},
|
|
2637
4587
|
{
|
|
2638
|
-
name: "one-
|
|
2639
|
-
selector: ".one-
|
|
4588
|
+
name: "one-skeleton-line-spacing",
|
|
4589
|
+
selector: ".one-skeleton__line + .one-skeleton__line",
|
|
4590
|
+
properties: { marginTop: `var(--one-space-xs, ${ONE_THEME_DEFAULTS.spaceXs})` }
|
|
4591
|
+
},
|
|
4592
|
+
{
|
|
4593
|
+
name: "one-skeleton-animated",
|
|
4594
|
+
selector: ".one-skeleton--animated .one-skeleton__avatar, .one-skeleton--animated .one-skeleton__title, .one-skeleton--animated .one-skeleton__line",
|
|
2640
4595
|
properties: {
|
|
2641
|
-
|
|
2642
|
-
flexWrap: "wrap",
|
|
2643
|
-
justifyContent: "center",
|
|
2644
|
-
gap: ONE_THEME_DEFAULTS.spaceSm
|
|
4596
|
+
animation: "one-skeleton-pulse 1.5s ease-in-out infinite"
|
|
2645
4597
|
}
|
|
2646
4598
|
}
|
|
2647
4599
|
];
|
|
2648
|
-
function hasNamedSlot2(children, name) {
|
|
2649
|
-
return children.some((child) => typeof child !== "string" && child.slot === name);
|
|
2650
|
-
}
|
|
2651
|
-
function hasDefaultSlot(children) {
|
|
2652
|
-
return children.some((child) => typeof child === "string" || child.slot === undefined);
|
|
2653
|
-
}
|
|
2654
4600
|
|
|
2655
|
-
class
|
|
4601
|
+
class OneSkeleton extends Component26 {
|
|
2656
4602
|
initState() {
|
|
2657
4603
|
return {};
|
|
2658
4604
|
}
|
|
2659
4605
|
initStyles() {
|
|
2660
|
-
|
|
4606
|
+
ONE_SKELETON_STYLES.forEach(({ name, ...style }) => {
|
|
2661
4607
|
this.styleManager.addStyle(name, style);
|
|
2662
4608
|
});
|
|
2663
4609
|
}
|
|
2664
4610
|
render() {
|
|
2665
|
-
const
|
|
2666
|
-
const
|
|
2667
|
-
const
|
|
2668
|
-
const
|
|
4611
|
+
const rows = typeof this.props.rows === "number" && this.props.rows >= 0 ? Math.floor(this.props.rows) : 3;
|
|
4612
|
+
const showTitle = this.props.title !== false;
|
|
4613
|
+
const showAvatar = this.props.avatar === true;
|
|
4614
|
+
const animated = this.props.animated !== false;
|
|
4615
|
+
const widths = this.props.widths ?? ["100%", "92%", "60%"];
|
|
4616
|
+
const decorative = { "aria-hidden": "true" };
|
|
2669
4617
|
return {
|
|
2670
|
-
tag: "
|
|
2671
|
-
props: {
|
|
4618
|
+
tag: "div",
|
|
4619
|
+
props: {
|
|
4620
|
+
className: [
|
|
4621
|
+
"one-skeleton",
|
|
4622
|
+
...animated ? ["one-skeleton--animated"] : []
|
|
4623
|
+
].join(" "),
|
|
4624
|
+
role: "status",
|
|
4625
|
+
"aria-busy": "true",
|
|
4626
|
+
"aria-label": this.props.ariaLabel ?? "加载中"
|
|
4627
|
+
},
|
|
2672
4628
|
children: [
|
|
2673
|
-
|
|
2674
|
-
tag: "div",
|
|
2675
|
-
props: {
|
|
2676
|
-
className: "one-empty__image",
|
|
2677
|
-
"aria-hidden": customImage ? undefined : "true"
|
|
2678
|
-
},
|
|
2679
|
-
children: customImage ? [slot7("image")] : [
|
|
2680
|
-
{
|
|
2681
|
-
tag: "span",
|
|
2682
|
-
props: { className: "one-empty__illustration" }
|
|
2683
|
-
}
|
|
2684
|
-
]
|
|
2685
|
-
},
|
|
2686
|
-
{
|
|
2687
|
-
tag: "div",
|
|
2688
|
-
props: { className: "one-empty__description" },
|
|
2689
|
-
children: customDescription ? [slot7("default")] : [this.props.description ?? "暂无数据"]
|
|
2690
|
-
},
|
|
2691
|
-
...customActions ? [
|
|
4629
|
+
...showAvatar ? [
|
|
2692
4630
|
{
|
|
2693
4631
|
tag: "div",
|
|
2694
|
-
props: { className: "one-
|
|
2695
|
-
|
|
4632
|
+
props: { className: "one-skeleton__avatar", ...decorative }
|
|
4633
|
+
}
|
|
4634
|
+
] : [],
|
|
4635
|
+
...showTitle ? [
|
|
4636
|
+
{
|
|
4637
|
+
tag: "div",
|
|
4638
|
+
props: { className: "one-skeleton__title", ...decorative }
|
|
4639
|
+
}
|
|
4640
|
+
] : [],
|
|
4641
|
+
...rows > 0 ? [
|
|
4642
|
+
{
|
|
4643
|
+
tag: "div",
|
|
4644
|
+
props: { className: "one-skeleton__paragraph", ...decorative },
|
|
4645
|
+
children: Array.from({ length: rows }, (_, index) => ({
|
|
4646
|
+
tag: "div",
|
|
4647
|
+
props: {
|
|
4648
|
+
className: "one-skeleton__line",
|
|
4649
|
+
style: { width: widths[index % widths.length] }
|
|
4650
|
+
}
|
|
4651
|
+
}))
|
|
2696
4652
|
}
|
|
2697
4653
|
] : []
|
|
2698
4654
|
]
|
|
@@ -3053,23 +5009,23 @@ class DomOneOverlayHost {
|
|
|
3053
5009
|
const groupKey = request.group ? `${request.kind}:${request.group}` : undefined;
|
|
3054
5010
|
const parent = groupKey ? this.getOrCreateGroup(entry, groupKey, request.kind, request.group) : entry.element;
|
|
3055
5011
|
const id = `one-${request.kind}-${++this.sequence}`;
|
|
3056
|
-
const
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
parent.appendChild(
|
|
5012
|
+
const slot9 = this.targetDocument.createElement("div");
|
|
5013
|
+
slot9.dataset.oneOverlayId = id;
|
|
5014
|
+
slot9.dataset.oneOverlayKind = request.kind;
|
|
5015
|
+
parent.appendChild(slot9);
|
|
3060
5016
|
const record = {
|
|
3061
5017
|
id,
|
|
3062
5018
|
kind: request.kind,
|
|
3063
5019
|
container,
|
|
3064
5020
|
groupKey,
|
|
3065
|
-
slot:
|
|
5021
|
+
slot: slot9,
|
|
3066
5022
|
closed: false
|
|
3067
5023
|
};
|
|
3068
5024
|
this.records.set(id, record);
|
|
3069
5025
|
try {
|
|
3070
5026
|
record.managed = request.factory({
|
|
3071
5027
|
id,
|
|
3072
|
-
slot:
|
|
5028
|
+
slot: slot9,
|
|
3073
5029
|
requestClose: () => this.close(id),
|
|
3074
5030
|
isTop: () => this.isTop(id)
|
|
3075
5031
|
});
|
|
@@ -3361,7 +5317,7 @@ class OneFloatingPositioner {
|
|
|
3361
5317
|
}
|
|
3362
5318
|
}
|
|
3363
5319
|
// lib/alert/OneAlert.ts
|
|
3364
|
-
import { Component as
|
|
5320
|
+
import { Component as Component27, slot as slot9 } from "@geektech/tsone";
|
|
3365
5321
|
var VARIANTS2 = [
|
|
3366
5322
|
"info",
|
|
3367
5323
|
"success",
|
|
@@ -3479,7 +5435,7 @@ function hasDefaultSlot2(children) {
|
|
|
3479
5435
|
return children.some((child) => typeof child === "string" || child.slot === undefined);
|
|
3480
5436
|
}
|
|
3481
5437
|
|
|
3482
|
-
class OneAlert extends
|
|
5438
|
+
class OneAlert extends Component27 {
|
|
3483
5439
|
initState() {
|
|
3484
5440
|
return { visible: true };
|
|
3485
5441
|
}
|
|
@@ -3510,7 +5466,7 @@ class OneAlert extends Component16 {
|
|
|
3510
5466
|
{
|
|
3511
5467
|
tag: "div",
|
|
3512
5468
|
props: { className: "one-alert__icon", "aria-hidden": "true" },
|
|
3513
|
-
children: customIcon ? [
|
|
5469
|
+
children: customIcon ? [slot9("icon")] : [DEFAULT_ICONS[variant]]
|
|
3514
5470
|
},
|
|
3515
5471
|
{
|
|
3516
5472
|
tag: "div",
|
|
@@ -3527,7 +5483,7 @@ class OneAlert extends Component16 {
|
|
|
3527
5483
|
{
|
|
3528
5484
|
tag: "div",
|
|
3529
5485
|
props: { className: "one-alert__description" },
|
|
3530
|
-
children: customDescription ? [
|
|
5486
|
+
children: customDescription ? [slot9("default")] : [this.props.description ?? ""]
|
|
3531
5487
|
}
|
|
3532
5488
|
] : []
|
|
3533
5489
|
]
|
|
@@ -3541,7 +5497,7 @@ class OneAlert extends Component16 {
|
|
|
3541
5497
|
{
|
|
3542
5498
|
tag: "div",
|
|
3543
5499
|
props: { className: "one-alert__actions" },
|
|
3544
|
-
children: [
|
|
5500
|
+
children: [slot9("actions")]
|
|
3545
5501
|
}
|
|
3546
5502
|
] : [],
|
|
3547
5503
|
...this.props.closable ? [
|
|
@@ -3571,7 +5527,7 @@ class OneAlert extends Component16 {
|
|
|
3571
5527
|
}
|
|
3572
5528
|
}
|
|
3573
5529
|
// lib/message/MessageOverlay.ts
|
|
3574
|
-
import { Component as
|
|
5530
|
+
import { Component as Component28 } from "@geektech/tsone";
|
|
3575
5531
|
|
|
3576
5532
|
// lib/message/timer.ts
|
|
3577
5533
|
var DEFAULT_SCHEDULER = {
|
|
@@ -3749,7 +5705,7 @@ var ONE_MESSAGE_STYLES = [
|
|
|
3749
5705
|
}
|
|
3750
5706
|
];
|
|
3751
5707
|
|
|
3752
|
-
class MessageOverlay extends
|
|
5708
|
+
class MessageOverlay extends Component28 {
|
|
3753
5709
|
timer;
|
|
3754
5710
|
mount(container) {
|
|
3755
5711
|
super.mount(container);
|
|
@@ -3827,7 +5783,7 @@ class MessageOverlay extends Component17 {
|
|
|
3827
5783
|
}
|
|
3828
5784
|
}
|
|
3829
5785
|
// lib/message/OneMessage.ts
|
|
3830
|
-
import { Component as
|
|
5786
|
+
import { Component as Component29 } from "@geektech/tsone";
|
|
3831
5787
|
|
|
3832
5788
|
// lib/message/normalize.ts
|
|
3833
5789
|
var VARIANTS3 = [
|
|
@@ -3854,7 +5810,7 @@ function normalizeOneMessageOptions(options) {
|
|
|
3854
5810
|
}
|
|
3855
5811
|
|
|
3856
5812
|
// lib/message/OneMessage.ts
|
|
3857
|
-
class OneMessage extends
|
|
5813
|
+
class OneMessage extends Component29 {
|
|
3858
5814
|
controller;
|
|
3859
5815
|
viewMounted = false;
|
|
3860
5816
|
initState() {
|
|
@@ -3940,12 +5896,12 @@ class OneMessageService {
|
|
|
3940
5896
|
kind: "message",
|
|
3941
5897
|
group: current.placement,
|
|
3942
5898
|
container: current.container,
|
|
3943
|
-
factory: ({ slot:
|
|
5899
|
+
factory: ({ slot: slot10, requestClose }) => {
|
|
3944
5900
|
const overlay = new MessageOverlay({
|
|
3945
5901
|
...current,
|
|
3946
5902
|
requestClose
|
|
3947
5903
|
});
|
|
3948
|
-
overlay.mount(
|
|
5904
|
+
overlay.mount(slot10);
|
|
3949
5905
|
return {
|
|
3950
5906
|
update: (next) => {
|
|
3951
5907
|
current = normalizeOneMessageOptions({ ...current, ...next });
|
|
@@ -3985,7 +5941,7 @@ function createOneMessageService(host) {
|
|
|
3985
5941
|
}
|
|
3986
5942
|
var oneMessage = createOneMessageService();
|
|
3987
5943
|
// lib/dialog/DialogOverlay.ts
|
|
3988
|
-
import { Component as
|
|
5944
|
+
import { Component as Component30, slot as slot10 } from "@geektech/tsone";
|
|
3989
5945
|
|
|
3990
5946
|
// lib/dialog/focus-manager.ts
|
|
3991
5947
|
var FOCUSABLE_SELECTOR = [
|
|
@@ -4183,7 +6139,7 @@ function hasSlot(children, name) {
|
|
|
4183
6139
|
});
|
|
4184
6140
|
}
|
|
4185
6141
|
|
|
4186
|
-
class DialogOverlay extends
|
|
6142
|
+
class DialogOverlay extends Component30 {
|
|
4187
6143
|
focusManager = new OneDialogFocusManager;
|
|
4188
6144
|
releaseScrollLock;
|
|
4189
6145
|
targetDocument;
|
|
@@ -4254,20 +6210,20 @@ class DialogOverlay extends Component19 {
|
|
|
4254
6210
|
{
|
|
4255
6211
|
tag: "header",
|
|
4256
6212
|
props: { className: "one-dialog__header", id: titleId },
|
|
4257
|
-
children: customHeader ? [
|
|
6213
|
+
children: customHeader ? [slot10("header")] : [this.props.title ?? ""]
|
|
4258
6214
|
}
|
|
4259
6215
|
] : [],
|
|
4260
6216
|
...hasBody ? [
|
|
4261
6217
|
{
|
|
4262
6218
|
tag: "div",
|
|
4263
6219
|
props: { className: "one-dialog__body", id: descriptionId },
|
|
4264
|
-
children: customBody ? [
|
|
6220
|
+
children: customBody ? [slot10("default")] : [this.props.content ?? this.props.description ?? ""]
|
|
4265
6221
|
}
|
|
4266
6222
|
] : [],
|
|
4267
6223
|
{
|
|
4268
6224
|
tag: "footer",
|
|
4269
6225
|
props: { className: "one-dialog__footer" },
|
|
4270
|
-
children: customFooter ? [
|
|
6226
|
+
children: customFooter ? [slot10("footer")] : [
|
|
4271
6227
|
{
|
|
4272
6228
|
tag: "button",
|
|
4273
6229
|
props: {
|
|
@@ -4332,8 +6288,8 @@ class DialogOverlay extends Component19 {
|
|
|
4332
6288
|
}
|
|
4333
6289
|
}
|
|
4334
6290
|
// lib/dialog/OneDialog.ts
|
|
4335
|
-
import { Component as
|
|
4336
|
-
class OneDialog extends
|
|
6291
|
+
import { Component as Component31 } from "@geektech/tsone";
|
|
6292
|
+
class OneDialog extends Component31 {
|
|
4337
6293
|
controller;
|
|
4338
6294
|
lockBody = true;
|
|
4339
6295
|
viewMounted = false;
|
|
@@ -4435,12 +6391,12 @@ class OneDialogService {
|
|
|
4435
6391
|
const hostHandle = host.open({
|
|
4436
6392
|
kind: "dialog",
|
|
4437
6393
|
container: current.container,
|
|
4438
|
-
factory: ({ id, slot:
|
|
4439
|
-
const hostContainer =
|
|
6394
|
+
factory: ({ id, slot: slot11, requestClose, isTop }) => {
|
|
6395
|
+
const hostContainer = slot11.parentElement?.parentElement;
|
|
4440
6396
|
const overlay = new DialogOverlay({
|
|
4441
6397
|
...current,
|
|
4442
6398
|
id,
|
|
4443
|
-
lockBody: hostContainer ===
|
|
6399
|
+
lockBody: hostContainer === slot11.ownerDocument.body,
|
|
4444
6400
|
isTop,
|
|
4445
6401
|
requestClose: (reason) => {
|
|
4446
6402
|
handleClose(reason);
|
|
@@ -4497,7 +6453,7 @@ class OneDialogService {
|
|
|
4497
6453
|
current.onError?.(error);
|
|
4498
6454
|
}
|
|
4499
6455
|
};
|
|
4500
|
-
overlay.mount(
|
|
6456
|
+
overlay.mount(slot11);
|
|
4501
6457
|
return {
|
|
4502
6458
|
update: (next) => {
|
|
4503
6459
|
current = { ...current, ...next };
|
|
@@ -4525,10 +6481,10 @@ function createOneDialogService(host) {
|
|
|
4525
6481
|
}
|
|
4526
6482
|
var oneDialog = createOneDialogService();
|
|
4527
6483
|
// lib/tooltip/OneTooltip.ts
|
|
4528
|
-
import { Component as
|
|
6484
|
+
import { Component as Component33 } from "@geektech/tsone";
|
|
4529
6485
|
|
|
4530
6486
|
// lib/tooltip/TooltipBubble.ts
|
|
4531
|
-
import { Component as
|
|
6487
|
+
import { Component as Component32 } from "@geektech/tsone";
|
|
4532
6488
|
var ONE_TOOLTIP_STYLES = [
|
|
4533
6489
|
{
|
|
4534
6490
|
name: "one-tooltip-bubble",
|
|
@@ -4602,7 +6558,7 @@ var ONE_TOOLTIP_STYLES = [
|
|
|
4602
6558
|
}
|
|
4603
6559
|
];
|
|
4604
6560
|
|
|
4605
|
-
class TooltipBubble extends
|
|
6561
|
+
class TooltipBubble extends Component32 {
|
|
4606
6562
|
stopAutoUpdate;
|
|
4607
6563
|
mount(container) {
|
|
4608
6564
|
super.mount(container);
|
|
@@ -4736,7 +6692,7 @@ var TRIGGERS = [
|
|
|
4736
6692
|
"manual"
|
|
4737
6693
|
];
|
|
4738
6694
|
|
|
4739
|
-
class OneTooltip extends
|
|
6695
|
+
class OneTooltip extends Component33 {
|
|
4740
6696
|
positioner = new OneFloatingPositioner;
|
|
4741
6697
|
controller;
|
|
4742
6698
|
triggerElement;
|
|
@@ -5010,52 +6966,174 @@ function defaultChildren(children) {
|
|
|
5010
6966
|
function normalizeDelay(value, fallback) {
|
|
5011
6967
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
5012
6968
|
}
|
|
6969
|
+
// lib/loading/OneLoading.ts
|
|
6970
|
+
import { Component as Component34 } from "@geektech/tsone";
|
|
6971
|
+
var ONE_LOADING_STYLES = [
|
|
6972
|
+
{
|
|
6973
|
+
name: "one-loading-base",
|
|
6974
|
+
selector: ".one-loading",
|
|
6975
|
+
properties: {
|
|
6976
|
+
...ONE_THEME_TYPOGRAPHY_PROPERTIES,
|
|
6977
|
+
display: "inline-flex",
|
|
6978
|
+
alignItems: "center",
|
|
6979
|
+
gap: `var(--one-space-sm, ${ONE_THEME_DEFAULTS.spaceSm})`,
|
|
6980
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`
|
|
6981
|
+
}
|
|
6982
|
+
},
|
|
6983
|
+
{
|
|
6984
|
+
name: "one-loading-spinner",
|
|
6985
|
+
selector: ".one-loading__spinner",
|
|
6986
|
+
properties: {
|
|
6987
|
+
display: "inline-block",
|
|
6988
|
+
boxSizing: "border-box",
|
|
6989
|
+
borderRadius: "50%",
|
|
6990
|
+
border: "2px solid currentColor",
|
|
6991
|
+
borderTopColor: "transparent"
|
|
6992
|
+
}
|
|
6993
|
+
},
|
|
6994
|
+
{
|
|
6995
|
+
name: "one-loading-spinner-sm",
|
|
6996
|
+
selector: ".one-loading--sm .one-loading__spinner",
|
|
6997
|
+
properties: { width: "16px", height: "16px" }
|
|
6998
|
+
},
|
|
6999
|
+
{
|
|
7000
|
+
name: "one-loading-spinner-md",
|
|
7001
|
+
selector: ".one-loading--md .one-loading__spinner",
|
|
7002
|
+
properties: { width: "20px", height: "20px" }
|
|
7003
|
+
},
|
|
7004
|
+
{
|
|
7005
|
+
name: "one-loading-spinner-lg",
|
|
7006
|
+
selector: ".one-loading--lg .one-loading__spinner",
|
|
7007
|
+
properties: { width: "24px", height: "24px" }
|
|
7008
|
+
},
|
|
7009
|
+
{
|
|
7010
|
+
name: "one-loading-spinner-neutral",
|
|
7011
|
+
selector: ".one-loading__spinner--neutral",
|
|
7012
|
+
properties: {
|
|
7013
|
+
color: `var(--one-color-muted, ${ONE_THEME_DEFAULTS.colorMuted})`
|
|
7014
|
+
}
|
|
7015
|
+
},
|
|
7016
|
+
{
|
|
7017
|
+
name: "one-loading-spinner-primary",
|
|
7018
|
+
selector: ".one-loading__spinner--primary",
|
|
7019
|
+
properties: {
|
|
7020
|
+
color: `var(--one-color-primary, ${ONE_THEME_DEFAULTS.colorPrimary})`
|
|
7021
|
+
}
|
|
7022
|
+
},
|
|
7023
|
+
{
|
|
7024
|
+
name: "one-loading-spinner-success",
|
|
7025
|
+
selector: ".one-loading__spinner--success",
|
|
7026
|
+
properties: {
|
|
7027
|
+
color: `var(--one-color-success, ${ONE_THEME_DEFAULTS.colorSuccess})`
|
|
7028
|
+
}
|
|
7029
|
+
},
|
|
7030
|
+
{
|
|
7031
|
+
name: "one-loading-spinner-warning",
|
|
7032
|
+
selector: ".one-loading__spinner--warning",
|
|
7033
|
+
properties: {
|
|
7034
|
+
color: `var(--one-color-warning, ${ONE_THEME_DEFAULTS.colorWarning})`
|
|
7035
|
+
}
|
|
7036
|
+
},
|
|
7037
|
+
{
|
|
7038
|
+
name: "one-loading-spinner-error",
|
|
7039
|
+
selector: ".one-loading__spinner--error",
|
|
7040
|
+
properties: {
|
|
7041
|
+
color: `var(--one-color-danger, ${ONE_THEME_DEFAULTS.colorDanger})`
|
|
7042
|
+
}
|
|
7043
|
+
}
|
|
7044
|
+
];
|
|
7045
|
+
|
|
7046
|
+
class OneLoading extends Component34 {
|
|
7047
|
+
initState() {
|
|
7048
|
+
return {};
|
|
7049
|
+
}
|
|
7050
|
+
initStyles() {
|
|
7051
|
+
ONE_LOADING_STYLES.forEach(({ name, ...style }) => {
|
|
7052
|
+
this.styleManager.addStyle(name, style);
|
|
7053
|
+
});
|
|
7054
|
+
}
|
|
7055
|
+
render() {
|
|
7056
|
+
const size = normalizeOneSize(this.props.size);
|
|
7057
|
+
const variant = normalizeOneDataDisplayVariant(this.props.variant, "primary");
|
|
7058
|
+
return {
|
|
7059
|
+
tag: "span",
|
|
7060
|
+
props: {
|
|
7061
|
+
className: `one-loading one-loading--${size}`,
|
|
7062
|
+
role: "status",
|
|
7063
|
+
"aria-label": this.props.label ?? "加载中"
|
|
7064
|
+
},
|
|
7065
|
+
children: [
|
|
7066
|
+
{
|
|
7067
|
+
tag: "span",
|
|
7068
|
+
props: {
|
|
7069
|
+
className: `one-loading__spinner one-loading__spinner--${variant}`,
|
|
7070
|
+
"aria-hidden": "true"
|
|
7071
|
+
}
|
|
7072
|
+
},
|
|
7073
|
+
...this.props.children ?? []
|
|
7074
|
+
]
|
|
7075
|
+
};
|
|
7076
|
+
}
|
|
7077
|
+
}
|
|
5013
7078
|
// lib/index.ts
|
|
5014
7079
|
var ONE_NAME = "@geektech/one";
|
|
5015
|
-
var ONE_VERSION = "0.0
|
|
7080
|
+
var ONE_VERSION = "0.2.0";
|
|
5016
7081
|
export {
|
|
5017
|
-
|
|
5018
|
-
oneMessage,
|
|
5019
|
-
oneDialog,
|
|
5020
|
-
createOnePaginationTokens,
|
|
5021
|
-
createOneMessageService,
|
|
5022
|
-
createOneDialogService,
|
|
5023
|
-
OneTooltipTriggerError,
|
|
5024
|
-
OneTooltip,
|
|
5025
|
-
OneThemeNotFoundError,
|
|
5026
|
-
OneThemeEnvironmentError,
|
|
5027
|
-
OneThemeConfigError,
|
|
5028
|
-
OneTag,
|
|
5029
|
-
OneTabs,
|
|
5030
|
-
OneSwitch,
|
|
5031
|
-
OneSelect,
|
|
5032
|
-
OnePagination,
|
|
5033
|
-
OneOverlayEnvironmentError,
|
|
5034
|
-
OneOverlayContainerError,
|
|
5035
|
-
OneMessageService,
|
|
5036
|
-
OneMessage,
|
|
5037
|
-
OneInput,
|
|
5038
|
-
OneFormModel,
|
|
5039
|
-
OneFormItem,
|
|
5040
|
-
OneForm,
|
|
5041
|
-
OneFloatingPositioner,
|
|
5042
|
-
OneEmpty,
|
|
5043
|
-
OneDialogService,
|
|
5044
|
-
OneDialog,
|
|
5045
|
-
OneCheckboxGroup,
|
|
5046
|
-
OneCheckbox,
|
|
5047
|
-
OneCard,
|
|
5048
|
-
OneButton,
|
|
5049
|
-
OneBreadcrumb,
|
|
5050
|
-
OneBadge,
|
|
5051
|
-
OneAlert,
|
|
5052
|
-
ONE_VERSION,
|
|
5053
|
-
ONE_THEME_DEFAULTS,
|
|
5054
|
-
ONE_NAME,
|
|
5055
|
-
ONE_DEFAULT_THEME,
|
|
7082
|
+
DomOneOverlayHost,
|
|
5056
7083
|
ONE_COMPONENT_CATEGORIES,
|
|
5057
|
-
|
|
7084
|
+
ONE_DEFAULT_THEME,
|
|
7085
|
+
ONE_NAME,
|
|
7086
|
+
ONE_THEME_DEFAULTS,
|
|
7087
|
+
ONE_VERSION,
|
|
7088
|
+
OneAlert,
|
|
7089
|
+
OneAvatar,
|
|
7090
|
+
OneBadge,
|
|
7091
|
+
OneBreadcrumb,
|
|
7092
|
+
OneButton,
|
|
7093
|
+
OneCard,
|
|
7094
|
+
OneCheckbox,
|
|
7095
|
+
OneCheckboxGroup,
|
|
7096
|
+
OneCollapse,
|
|
7097
|
+
OneDialog,
|
|
7098
|
+
OneDialogService,
|
|
7099
|
+
OneEmpty,
|
|
7100
|
+
OneFloatingPositioner,
|
|
7101
|
+
OneForm,
|
|
7102
|
+
OneFormItem,
|
|
7103
|
+
OneFormModel,
|
|
7104
|
+
OneInput,
|
|
7105
|
+
OneLoading,
|
|
7106
|
+
OneMessage,
|
|
7107
|
+
OneMessageService,
|
|
7108
|
+
OneOverlayContainerError,
|
|
7109
|
+
OneOverlayEnvironmentError,
|
|
7110
|
+
OnePagination,
|
|
7111
|
+
OneProgress,
|
|
7112
|
+
OneRadio,
|
|
7113
|
+
OneRadioGroup,
|
|
7114
|
+
OneRate,
|
|
7115
|
+
OneSelect,
|
|
7116
|
+
OneSkeleton,
|
|
7117
|
+
OneSlider,
|
|
7118
|
+
OneSwitch,
|
|
7119
|
+
OneTable,
|
|
7120
|
+
OneTabs,
|
|
7121
|
+
OneTag,
|
|
7122
|
+
OneThemeConfigError,
|
|
7123
|
+
OneThemeEnvironmentError,
|
|
7124
|
+
OneThemeNotFoundError,
|
|
7125
|
+
OneTimePicker,
|
|
7126
|
+
OneTooltip,
|
|
7127
|
+
OneTooltipTriggerError,
|
|
7128
|
+
OneUpload,
|
|
7129
|
+
createOneDialogService,
|
|
7130
|
+
createOneMessageService,
|
|
7131
|
+
createOnePaginationTokens,
|
|
7132
|
+
formatOneFileSize,
|
|
7133
|
+
oneDialog,
|
|
7134
|
+
oneMessage,
|
|
7135
|
+
oneTheme
|
|
5058
7136
|
};
|
|
5059
7137
|
|
|
5060
|
-
//# debugId=
|
|
7138
|
+
//# debugId=D47C7BBD3F729A8064756E2164756E21
|
|
5061
7139
|
//# sourceMappingURL=index.js.map
|