@faasjs/ant-design 0.0.3-beta.65 → 0.0.3-beta.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +55 -44
- package/dist/index.mjs +55 -44
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -360,7 +360,7 @@ type UnionFaasItemInjection<Value = any, Values = any> = {
|
|
|
360
360
|
values?: Values;
|
|
361
361
|
index?: number;
|
|
362
362
|
};
|
|
363
|
-
type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) =>
|
|
363
|
+
type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) => React.ReactNode;
|
|
364
364
|
type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasItemInjection<Value, Values>> | null;
|
|
365
365
|
interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
|
|
366
366
|
children?: UnionFaasItemElement<UnionFaasItemProps<Value, Values>> | null;
|
package/dist/index.js
CHANGED
|
@@ -402,9 +402,13 @@ function DescriptionItemContent(props) {
|
|
|
402
402
|
values: computedProps.values
|
|
403
403
|
});
|
|
404
404
|
if (computedProps.item.descriptionRender)
|
|
405
|
-
return
|
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
406
|
+
children: computedProps.item.descriptionRender(computedProps.value, computedProps.values, 0, "description")
|
|
407
|
+
});
|
|
406
408
|
if (computedProps.item.render)
|
|
407
|
-
return
|
|
409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
410
|
+
children: computedProps.item.render(computedProps.value, computedProps.values, 0, "description")
|
|
411
|
+
});
|
|
408
412
|
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
409
413
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
|
|
410
414
|
switch (computedProps.item.type) {
|
|
@@ -1194,6 +1198,49 @@ function processValue(item, value) {
|
|
|
1194
1198
|
function Table(props) {
|
|
1195
1199
|
const [columns, setColumns] = (0, import_react14.useState)();
|
|
1196
1200
|
const { common: common2 } = useConfigContext();
|
|
1201
|
+
const generateFilterDropdown = (item) => {
|
|
1202
|
+
if (typeof item.filterDropdown !== "undefined")
|
|
1203
|
+
return;
|
|
1204
|
+
if (item.options.length < 11) {
|
|
1205
|
+
if (!item.filters)
|
|
1206
|
+
item.filters = item.options.map((o) => ({
|
|
1207
|
+
text: o.label,
|
|
1208
|
+
value: o.value
|
|
1209
|
+
}));
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
item.filterDropdown = ({
|
|
1213
|
+
setSelectedKeys,
|
|
1214
|
+
selectedKeys,
|
|
1215
|
+
confirm
|
|
1216
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1217
|
+
style: {
|
|
1218
|
+
padding: 8,
|
|
1219
|
+
width: "200px"
|
|
1220
|
+
},
|
|
1221
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1222
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Select, {
|
|
1223
|
+
options: item.options,
|
|
1224
|
+
allowClear: true,
|
|
1225
|
+
showSearch: true,
|
|
1226
|
+
style: { width: "100%" },
|
|
1227
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1228
|
+
value: selectedKeys,
|
|
1229
|
+
onChange: (v) => {
|
|
1230
|
+
setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
|
|
1231
|
+
confirm();
|
|
1232
|
+
},
|
|
1233
|
+
mode: "multiple",
|
|
1234
|
+
filterOption: (input, option) => {
|
|
1235
|
+
if (!input || !option || !option.label)
|
|
1236
|
+
return true;
|
|
1237
|
+
input = input.trim();
|
|
1238
|
+
return option.value === input || option.label.toString().toLowerCase().includes(input.toLowerCase());
|
|
1239
|
+
}
|
|
1240
|
+
})
|
|
1241
|
+
});
|
|
1242
|
+
return item;
|
|
1243
|
+
};
|
|
1197
1244
|
(0, import_react14.useEffect)(() => {
|
|
1198
1245
|
var _a;
|
|
1199
1246
|
for (const item of props.items) {
|
|
@@ -1214,6 +1261,7 @@ function Table(props) {
|
|
|
1214
1261
|
text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
|
|
1215
1262
|
value: null
|
|
1216
1263
|
});
|
|
1264
|
+
generateFilterDropdown(item);
|
|
1217
1265
|
}
|
|
1218
1266
|
if (item.tableChildren === null)
|
|
1219
1267
|
item.render = () => null;
|
|
@@ -1552,53 +1600,16 @@ function Table(props) {
|
|
|
1552
1600
|
return;
|
|
1553
1601
|
for (const column of columns) {
|
|
1554
1602
|
if (column.optionsType === "auto" && !column.options && !column.filters) {
|
|
1555
|
-
const
|
|
1556
|
-
|
|
1603
|
+
const options = (0, import_lodash_es6.uniqBy)(props.dataSource, column.id).map((v) => ({
|
|
1604
|
+
label: v[column.id],
|
|
1557
1605
|
value: v[column.id]
|
|
1558
1606
|
}));
|
|
1559
|
-
if (
|
|
1607
|
+
if (options.length)
|
|
1560
1608
|
setColumns((prev) => {
|
|
1561
1609
|
const newColumns = [...prev];
|
|
1562
1610
|
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
text: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}),
|
|
1566
|
-
value: null
|
|
1567
|
-
});
|
|
1568
|
-
else
|
|
1569
|
-
newColumns[index].filterDropdown = ({
|
|
1570
|
-
setSelectedKeys,
|
|
1571
|
-
selectedKeys,
|
|
1572
|
-
confirm
|
|
1573
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1574
|
-
style: {
|
|
1575
|
-
padding: 8,
|
|
1576
|
-
width: "200px"
|
|
1577
|
-
},
|
|
1578
|
-
onKeyDown: (e) => e.stopPropagation(),
|
|
1579
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Select, {
|
|
1580
|
-
options: filters.map((f) => ({
|
|
1581
|
-
label: f.text,
|
|
1582
|
-
value: f.value
|
|
1583
|
-
})),
|
|
1584
|
-
allowClear: true,
|
|
1585
|
-
showSearch: true,
|
|
1586
|
-
style: { width: "100%" },
|
|
1587
|
-
placeholder: `${common2.search} ${newColumns[index].title}`,
|
|
1588
|
-
value: selectedKeys,
|
|
1589
|
-
onChange: (v) => {
|
|
1590
|
-
setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
|
|
1591
|
-
confirm();
|
|
1592
|
-
},
|
|
1593
|
-
mode: "multiple",
|
|
1594
|
-
filterOption: (input, option) => {
|
|
1595
|
-
if (!input || !option || !option.label)
|
|
1596
|
-
return true;
|
|
1597
|
-
input = input.trim();
|
|
1598
|
-
return option.value === input || option.label.toString().toLowerCase().includes(input.toLowerCase());
|
|
1599
|
-
}
|
|
1600
|
-
})
|
|
1601
|
-
});
|
|
1611
|
+
newColumns[index].options = options;
|
|
1612
|
+
generateFilterDropdown(newColumns[index]);
|
|
1602
1613
|
return newColumns;
|
|
1603
1614
|
});
|
|
1604
1615
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -368,9 +368,13 @@ function DescriptionItemContent(props) {
|
|
|
368
368
|
values: computedProps.values
|
|
369
369
|
});
|
|
370
370
|
if (computedProps.item.descriptionRender)
|
|
371
|
-
return
|
|
371
|
+
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
372
|
+
children: computedProps.item.descriptionRender(computedProps.value, computedProps.values, 0, "description")
|
|
373
|
+
});
|
|
372
374
|
if (computedProps.item.render)
|
|
373
|
-
return
|
|
375
|
+
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
376
|
+
children: computedProps.item.render(computedProps.value, computedProps.values, 0, "description")
|
|
377
|
+
});
|
|
374
378
|
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
375
379
|
return /* @__PURE__ */ jsx8(Blank, {});
|
|
376
380
|
switch (computedProps.item.type) {
|
|
@@ -1202,6 +1206,49 @@ function processValue(item, value) {
|
|
|
1202
1206
|
function Table(props) {
|
|
1203
1207
|
const [columns, setColumns] = useState7();
|
|
1204
1208
|
const { common: common2 } = useConfigContext();
|
|
1209
|
+
const generateFilterDropdown = (item) => {
|
|
1210
|
+
if (typeof item.filterDropdown !== "undefined")
|
|
1211
|
+
return;
|
|
1212
|
+
if (item.options.length < 11) {
|
|
1213
|
+
if (!item.filters)
|
|
1214
|
+
item.filters = item.options.map((o) => ({
|
|
1215
|
+
text: o.label,
|
|
1216
|
+
value: o.value
|
|
1217
|
+
}));
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
item.filterDropdown = ({
|
|
1221
|
+
setSelectedKeys,
|
|
1222
|
+
selectedKeys,
|
|
1223
|
+
confirm
|
|
1224
|
+
}) => /* @__PURE__ */ jsx14("div", {
|
|
1225
|
+
style: {
|
|
1226
|
+
padding: 8,
|
|
1227
|
+
width: "200px"
|
|
1228
|
+
},
|
|
1229
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1230
|
+
children: /* @__PURE__ */ jsx14(Select2, {
|
|
1231
|
+
options: item.options,
|
|
1232
|
+
allowClear: true,
|
|
1233
|
+
showSearch: true,
|
|
1234
|
+
style: { width: "100%" },
|
|
1235
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1236
|
+
value: selectedKeys,
|
|
1237
|
+
onChange: (v) => {
|
|
1238
|
+
setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
|
|
1239
|
+
confirm();
|
|
1240
|
+
},
|
|
1241
|
+
mode: "multiple",
|
|
1242
|
+
filterOption: (input, option) => {
|
|
1243
|
+
if (!input || !option || !option.label)
|
|
1244
|
+
return true;
|
|
1245
|
+
input = input.trim();
|
|
1246
|
+
return option.value === input || option.label.toString().toLowerCase().includes(input.toLowerCase());
|
|
1247
|
+
}
|
|
1248
|
+
})
|
|
1249
|
+
});
|
|
1250
|
+
return item;
|
|
1251
|
+
};
|
|
1205
1252
|
useEffect6(() => {
|
|
1206
1253
|
var _a;
|
|
1207
1254
|
for (const item of props.items) {
|
|
@@ -1222,6 +1269,7 @@ function Table(props) {
|
|
|
1222
1269
|
text: /* @__PURE__ */ jsx14(Blank, {}),
|
|
1223
1270
|
value: null
|
|
1224
1271
|
});
|
|
1272
|
+
generateFilterDropdown(item);
|
|
1225
1273
|
}
|
|
1226
1274
|
if (item.tableChildren === null)
|
|
1227
1275
|
item.render = () => null;
|
|
@@ -1560,53 +1608,16 @@ function Table(props) {
|
|
|
1560
1608
|
return;
|
|
1561
1609
|
for (const column of columns) {
|
|
1562
1610
|
if (column.optionsType === "auto" && !column.options && !column.filters) {
|
|
1563
|
-
const
|
|
1564
|
-
|
|
1611
|
+
const options = uniqBy(props.dataSource, column.id).map((v) => ({
|
|
1612
|
+
label: v[column.id],
|
|
1565
1613
|
value: v[column.id]
|
|
1566
1614
|
}));
|
|
1567
|
-
if (
|
|
1615
|
+
if (options.length)
|
|
1568
1616
|
setColumns((prev) => {
|
|
1569
1617
|
const newColumns = [...prev];
|
|
1570
1618
|
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
text: /* @__PURE__ */ jsx14(Blank, {}),
|
|
1574
|
-
value: null
|
|
1575
|
-
});
|
|
1576
|
-
else
|
|
1577
|
-
newColumns[index].filterDropdown = ({
|
|
1578
|
-
setSelectedKeys,
|
|
1579
|
-
selectedKeys,
|
|
1580
|
-
confirm
|
|
1581
|
-
}) => /* @__PURE__ */ jsx14("div", {
|
|
1582
|
-
style: {
|
|
1583
|
-
padding: 8,
|
|
1584
|
-
width: "200px"
|
|
1585
|
-
},
|
|
1586
|
-
onKeyDown: (e) => e.stopPropagation(),
|
|
1587
|
-
children: /* @__PURE__ */ jsx14(Select2, {
|
|
1588
|
-
options: filters.map((f) => ({
|
|
1589
|
-
label: f.text,
|
|
1590
|
-
value: f.value
|
|
1591
|
-
})),
|
|
1592
|
-
allowClear: true,
|
|
1593
|
-
showSearch: true,
|
|
1594
|
-
style: { width: "100%" },
|
|
1595
|
-
placeholder: `${common2.search} ${newColumns[index].title}`,
|
|
1596
|
-
value: selectedKeys,
|
|
1597
|
-
onChange: (v) => {
|
|
1598
|
-
setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
|
|
1599
|
-
confirm();
|
|
1600
|
-
},
|
|
1601
|
-
mode: "multiple",
|
|
1602
|
-
filterOption: (input, option) => {
|
|
1603
|
-
if (!input || !option || !option.label)
|
|
1604
|
-
return true;
|
|
1605
|
-
input = input.trim();
|
|
1606
|
-
return option.value === input || option.label.toString().toLowerCase().includes(input.toLowerCase());
|
|
1607
|
-
}
|
|
1608
|
-
})
|
|
1609
|
-
});
|
|
1619
|
+
newColumns[index].options = options;
|
|
1620
|
+
generateFilterDropdown(newColumns[index]);
|
|
1610
1621
|
return newColumns;
|
|
1611
1622
|
});
|
|
1612
1623
|
}
|