@nokecy/qc-ui 1.0.41 → 1.0.42
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.
|
@@ -23,6 +23,7 @@ var _ = require(".");
|
|
|
23
23
|
var _customGroupCellRenderer = _interopRequireDefault(require("./_utils/customGroupCellRenderer"));
|
|
24
24
|
var _processColumnGroups = _interopRequireDefault(require("./_utils/processColumnGroups"));
|
|
25
25
|
var _processFormColumnState = _interopRequireDefault(require("./_utils/processFormColumnState"));
|
|
26
|
+
var _antdV = require("@formily/antd-v5");
|
|
26
27
|
var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children", "defaultSearchExpand", "overlayNoRowsTemplateText", "queryDefaultRows"];
|
|
27
28
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
28
29
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -384,6 +385,50 @@ function AgGridPlus(props) {
|
|
|
384
385
|
var columnDefs = !columnProps ? props.columnDefs ? props.columnDefs : [] : columnProps;
|
|
385
386
|
columnDefs = columnDefs.map(function (col) {
|
|
386
387
|
var dataType = getDataType(data, col.field);
|
|
388
|
+
if (col.valueEnum && Array.isArray(col.valueEnum)) {
|
|
389
|
+
var _defaultItems$0$value, _defaultItems$;
|
|
390
|
+
// 统计默认值
|
|
391
|
+
var defaultItems = col.valueEnum.filter(function (item) {
|
|
392
|
+
return item.default;
|
|
393
|
+
});
|
|
394
|
+
var isMultiple = defaultItems.length > 1;
|
|
395
|
+
var defaultValue = isMultiple ? defaultItems.map(function (item) {
|
|
396
|
+
return item.value;
|
|
397
|
+
}) : (_defaultItems$0$value = (_defaultItems$ = defaultItems[0]) === null || _defaultItems$ === void 0 ? void 0 : _defaultItems$.value) !== null && _defaultItems$0$value !== void 0 ? _defaultItems$0$value : undefined;
|
|
398
|
+
var valueFormatter = function valueFormatter(params) {
|
|
399
|
+
var match = col.valueEnum.find(function (item) {
|
|
400
|
+
return item.value == params.value;
|
|
401
|
+
});
|
|
402
|
+
return match ? match.label : params.value;
|
|
403
|
+
};
|
|
404
|
+
return _objectSpread(_objectSpread(_objectSpread({}, dataType), col), {}, {
|
|
405
|
+
cellRenderer: function cellRenderer(params) {
|
|
406
|
+
var match = col.valueEnum.find(function (item) {
|
|
407
|
+
return item.value == params.value;
|
|
408
|
+
});
|
|
409
|
+
if (match) {
|
|
410
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Tag, {
|
|
411
|
+
color: match.color || "default"
|
|
412
|
+
}, match.label);
|
|
413
|
+
}
|
|
414
|
+
return params.value;
|
|
415
|
+
},
|
|
416
|
+
filterParams: _objectSpread(_objectSpread({}, col.filterParams || {}), {}, {
|
|
417
|
+
valueFormatter: valueFormatter
|
|
418
|
+
}),
|
|
419
|
+
searchComponent: _antdV.Select,
|
|
420
|
+
searchComponentProps: {
|
|
421
|
+
options: col.valueEnum.map(function (item) {
|
|
422
|
+
return {
|
|
423
|
+
label: item.label,
|
|
424
|
+
value: item.value
|
|
425
|
+
};
|
|
426
|
+
}),
|
|
427
|
+
mode: isMultiple ? "multiple" : undefined,
|
|
428
|
+
defaultValue: defaultValue
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
}
|
|
387
432
|
if (col.type || typeof col.cellRenderer == "string") {
|
|
388
433
|
return _objectSpread({}, col);
|
|
389
434
|
}
|
|
@@ -32,6 +32,7 @@ import { useGridPlusColumnState } from '.';
|
|
|
32
32
|
import CustomGroupCellRenderer from "./_utils/customGroupCellRenderer";
|
|
33
33
|
import processColumnGroups from "./_utils/processColumnGroups";
|
|
34
34
|
import flattenColumnState from "./_utils/processFormColumnState";
|
|
35
|
+
import { Select } from '@formily/antd-v5';
|
|
35
36
|
var Paragraph = Typography.Paragraph,
|
|
36
37
|
Text = Typography.Text;
|
|
37
38
|
var getSort = function getSort(columnState) {
|
|
@@ -375,6 +376,50 @@ function AgGridPlus(props) {
|
|
|
375
376
|
var columnDefs = !columnProps ? props.columnDefs ? props.columnDefs : [] : columnProps;
|
|
376
377
|
columnDefs = columnDefs.map(function (col) {
|
|
377
378
|
var dataType = getDataType(data, col.field);
|
|
379
|
+
if (col.valueEnum && Array.isArray(col.valueEnum)) {
|
|
380
|
+
var _defaultItems$0$value, _defaultItems$;
|
|
381
|
+
// 统计默认值
|
|
382
|
+
var defaultItems = col.valueEnum.filter(function (item) {
|
|
383
|
+
return item.default;
|
|
384
|
+
});
|
|
385
|
+
var isMultiple = defaultItems.length > 1;
|
|
386
|
+
var defaultValue = isMultiple ? defaultItems.map(function (item) {
|
|
387
|
+
return item.value;
|
|
388
|
+
}) : (_defaultItems$0$value = (_defaultItems$ = defaultItems[0]) === null || _defaultItems$ === void 0 ? void 0 : _defaultItems$.value) !== null && _defaultItems$0$value !== void 0 ? _defaultItems$0$value : undefined;
|
|
389
|
+
var valueFormatter = function valueFormatter(params) {
|
|
390
|
+
var match = col.valueEnum.find(function (item) {
|
|
391
|
+
return item.value == params.value;
|
|
392
|
+
});
|
|
393
|
+
return match ? match.label : params.value;
|
|
394
|
+
};
|
|
395
|
+
return _objectSpread(_objectSpread(_objectSpread({}, dataType), col), {}, {
|
|
396
|
+
cellRenderer: function cellRenderer(params) {
|
|
397
|
+
var match = col.valueEnum.find(function (item) {
|
|
398
|
+
return item.value == params.value;
|
|
399
|
+
});
|
|
400
|
+
if (match) {
|
|
401
|
+
return /*#__PURE__*/React.createElement(Tag, {
|
|
402
|
+
color: match.color || "default"
|
|
403
|
+
}, match.label);
|
|
404
|
+
}
|
|
405
|
+
return params.value;
|
|
406
|
+
},
|
|
407
|
+
filterParams: _objectSpread(_objectSpread({}, col.filterParams || {}), {}, {
|
|
408
|
+
valueFormatter: valueFormatter
|
|
409
|
+
}),
|
|
410
|
+
searchComponent: Select,
|
|
411
|
+
searchComponentProps: {
|
|
412
|
+
options: col.valueEnum.map(function (item) {
|
|
413
|
+
return {
|
|
414
|
+
label: item.label,
|
|
415
|
+
value: item.value
|
|
416
|
+
};
|
|
417
|
+
}),
|
|
418
|
+
mode: isMultiple ? "multiple" : undefined,
|
|
419
|
+
defaultValue: defaultValue
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
378
423
|
if (col.type || typeof col.cellRenderer == "string") {
|
|
379
424
|
return _objectSpread({}, col);
|
|
380
425
|
}
|