@nokecy/qc-ui 1.1.73 → 1.1.74
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/cjs/adapters/pagedApiAdapter.d.ts +2 -0
- package/dist/cjs/ag-grid-plus/ag-gridPlus.js +5 -3
- package/dist/cjs/ag-grid-plus/interface.d.ts +6 -0
- package/dist/cjs/ag-grid-plus/utils/aggregation.js +8 -14
- package/dist/cjs/ag-grid-plus/utils/columnProcessors.d.ts +2 -1
- package/dist/cjs/ag-grid-plus/utils/columnProcessors.js +5 -2
- package/dist/cjs/ag-grid-plus/utils/valueEnumColor.d.ts +17 -0
- package/dist/cjs/ag-grid-plus/utils/valueEnumColor.js +99 -0
- package/dist/cjs/dialogSelect/index.d.ts +29 -0
- package/dist/cjs/dialogSelect/index.js +152 -103
- package/dist/cjs/dialogSelect/index.less +39 -0
- package/dist/cjs/draggableModal/index.js +12 -8
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +123 -1
- package/dist/cjs/toolBar/index.d.ts +1 -0
- package/dist/cjs/toolBar/index.js +44 -10
- package/dist/cjs/toolBar/index.less +25 -7
- package/dist/cjs/utils/businessDecimal.d.ts +11 -0
- package/dist/cjs/utils/businessDecimal.js +53 -0
- package/dist/cjs/utils/contrast.d.ts +40 -0
- package/dist/cjs/utils/contrast.js +153 -0
- package/dist/esm/adapters/pagedApiAdapter.d.ts +2 -0
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +5 -3
- package/dist/esm/ag-grid-plus/interface.d.ts +6 -0
- package/dist/esm/ag-grid-plus/utils/aggregation.js +1 -5
- package/dist/esm/ag-grid-plus/utils/columnProcessors.d.ts +2 -1
- package/dist/esm/ag-grid-plus/utils/columnProcessors.js +5 -2
- package/dist/esm/ag-grid-plus/utils/valueEnumColor.d.ts +17 -0
- package/dist/esm/ag-grid-plus/utils/valueEnumColor.js +95 -0
- package/dist/esm/dialogSelect/index.d.ts +29 -0
- package/dist/esm/dialogSelect/index.js +155 -105
- package/dist/esm/dialogSelect/index.less +39 -0
- package/dist/esm/draggableModal/index.js +12 -8
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/toolBar/index.d.ts +1 -0
- package/dist/esm/toolBar/index.js +43 -10
- package/dist/esm/toolBar/index.less +25 -7
- package/dist/esm/utils/businessDecimal.d.ts +11 -0
- package/dist/esm/utils/businessDecimal.js +47 -0
- package/dist/esm/utils/contrast.d.ts +40 -0
- package/dist/esm/utils/contrast.js +141 -0
- package/dist/umd/qc-ui.min.css +1 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -12,7 +12,8 @@ var _agGridPlus = require("../ag-grid-plus");
|
|
|
12
12
|
var _ahooks = require("ahooks");
|
|
13
13
|
var _draggableModal = _interopRequireDefault(require("../draggableModal"));
|
|
14
14
|
var _adapters = require("../adapters");
|
|
15
|
-
|
|
15
|
+
require("./index.less");
|
|
16
|
+
var _excluded = ["request", "columnDefs", "value", "labelField", "valueField", "onChangeItem", "hideBtn", "useAutoComplete", "queryFun", "pagedApiAdapter", "modalWidth", "dialogZIndex", "dialogMode", "dialogPageSize", "dialogPageSizeOptions", "dialogGridKey", "dialogDataSource", "dialogIsRowSelectable", "dialogRenderer", "gridComponent"];
|
|
16
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
18
|
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); }
|
|
18
19
|
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; }
|
|
@@ -34,177 +35,225 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
34
35
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
36
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
36
37
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
38
|
+
/** 选择窗口的行选择模式。 */
|
|
39
|
+
|
|
37
40
|
var DialogSelect = function DialogSelect(props) {
|
|
41
|
+
var _selectRows$length;
|
|
42
|
+
// 这些是本组件自己的属性,不能透传给 Select(否则会落到 DOM 上触发未知属性告警)。
|
|
38
43
|
var request = props.request,
|
|
39
44
|
columnDefs = props.columnDefs,
|
|
40
45
|
value = props.value,
|
|
41
46
|
labelField = props.labelField,
|
|
42
47
|
valueField = props.valueField,
|
|
43
48
|
onChangeItem = props.onChangeItem,
|
|
49
|
+
hideBtn = props.hideBtn,
|
|
50
|
+
useAutoComplete = props.useAutoComplete,
|
|
51
|
+
queryFun = props.queryFun,
|
|
52
|
+
pagedApiAdapter = props.pagedApiAdapter,
|
|
53
|
+
_props$modalWidth = props.modalWidth,
|
|
54
|
+
modalWidth = _props$modalWidth === void 0 ? 960 : _props$modalWidth,
|
|
55
|
+
_props$dialogZIndex = props.dialogZIndex,
|
|
56
|
+
dialogZIndex = _props$dialogZIndex === void 0 ? 9999 : _props$dialogZIndex,
|
|
57
|
+
dialogMode = props.dialogMode,
|
|
58
|
+
dialogPageSize = props.dialogPageSize,
|
|
59
|
+
dialogPageSizeOptions = props.dialogPageSizeOptions,
|
|
60
|
+
dialogGridKey = props.dialogGridKey,
|
|
61
|
+
dialogDataSource = props.dialogDataSource,
|
|
62
|
+
dialogIsRowSelectable = props.dialogIsRowSelectable,
|
|
63
|
+
dialogRenderer = props.dialogRenderer,
|
|
64
|
+
gridComponent = props.gridComponent,
|
|
44
65
|
rest = _objectWithoutProperties(props, _excluded);
|
|
66
|
+
var Grid = gridComponent !== null && gridComponent !== void 0 ? gridComponent : _agGridPlus.AgGridPlus;
|
|
45
67
|
var _useControllableValue = (0, _ahooks.useControllableValue)(props),
|
|
46
68
|
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
|
47
69
|
state = _useControllableValue2[0],
|
|
48
70
|
setState = _useControllableValue2[1];
|
|
49
|
-
var _useState = (0, _react.useState)(),
|
|
50
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
-
gridApi = _useState2[0],
|
|
52
|
-
setGridApi = _useState2[1];
|
|
53
71
|
var _useBoolean = (0, _ahooks.useBoolean)(false),
|
|
54
72
|
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
55
73
|
visible = _useBoolean2[0],
|
|
56
74
|
_useBoolean2$ = _useBoolean2[1],
|
|
57
75
|
setTrue = _useBoolean2$.setTrue,
|
|
58
76
|
setFalse = _useBoolean2$.setFalse;
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
selectRows =
|
|
62
|
-
setSelectRows =
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var label = selectRow[labelField !== null && labelField !== void 0 ? labelField : 'name'];
|
|
75
|
-
if (props.mode === 'multiple' || props.mode === 'tags') {
|
|
76
|
-
return labelInValue ? selectRows.map(function (it) {
|
|
77
|
+
var _useState = (0, _react.useState)(undefined),
|
|
78
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
79
|
+
selectRows = _useState2[0],
|
|
80
|
+
setSelectRows = _useState2[1];
|
|
81
|
+
var _theme$useToken = _antd.theme.useToken(),
|
|
82
|
+
token = _theme$useToken.token;
|
|
83
|
+
var isMultipleValue = props.mode === 'multiple' || props.mode === 'tags';
|
|
84
|
+
var selectionMode = dialogMode !== null && dialogMode !== void 0 ? dialogMode : isMultipleValue ? 'multiple' : 'single';
|
|
85
|
+
var key = valueField !== null && valueField !== void 0 ? valueField : 'id';
|
|
86
|
+
var localData = Array.isArray(dialogDataSource);
|
|
87
|
+
var getValue = function getValue(rows) {
|
|
88
|
+
var row = rows[0];
|
|
89
|
+
var labelKey = labelField !== null && labelField !== void 0 ? labelField : 'name';
|
|
90
|
+
if (isMultipleValue) {
|
|
91
|
+
return props.labelInValue ? rows.map(function (it) {
|
|
77
92
|
return {
|
|
78
|
-
value: it[
|
|
79
|
-
label: it[
|
|
93
|
+
value: it[key],
|
|
94
|
+
label: it[labelKey],
|
|
80
95
|
key: it === null || it === void 0 ? void 0 : it.id
|
|
81
96
|
};
|
|
82
|
-
}) :
|
|
83
|
-
return it[
|
|
97
|
+
}) : rows.map(function (it) {
|
|
98
|
+
return it[key];
|
|
84
99
|
});
|
|
85
|
-
} else {
|
|
86
|
-
return labelInValue ? {
|
|
87
|
-
value: value,
|
|
88
|
-
label: label
|
|
89
|
-
} : value;
|
|
90
100
|
}
|
|
101
|
+
return props.labelInValue ? {
|
|
102
|
+
value: row[key],
|
|
103
|
+
label: row[labelKey]
|
|
104
|
+
} : row[key];
|
|
91
105
|
};
|
|
92
|
-
var
|
|
93
|
-
var selectRow = selectRows[0];
|
|
94
|
-
setState(getValue(selectRows));
|
|
106
|
+
var close = function close() {
|
|
95
107
|
setFalse();
|
|
96
|
-
|
|
108
|
+
setSelectRows(undefined);
|
|
109
|
+
};
|
|
110
|
+
var confirmRows = function confirmRows(rows) {
|
|
111
|
+
if (!(rows !== null && rows !== void 0 && rows.length)) return;
|
|
112
|
+
if (dialogIsRowSelectable && rows.some(function (row) {
|
|
113
|
+
return !dialogIsRowSelectable(row);
|
|
114
|
+
})) return;
|
|
115
|
+
setState(getValue(rows));
|
|
116
|
+
close();
|
|
117
|
+
// 回传完整数据行,供调用方回填关联字段。
|
|
118
|
+
onChangeItem === null || onChangeItem === void 0 || onChangeItem(selectionMode === 'multiple' ? rows : rows[0]);
|
|
97
119
|
};
|
|
98
120
|
var onSelectionChanged = function onSelectionChanged(e) {
|
|
99
|
-
|
|
100
|
-
setSelectRows(selectedRows);
|
|
121
|
+
setSelectRows(e.api.getSelectedRows());
|
|
101
122
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
123
|
+
|
|
124
|
+
// 入口做成输入框内的后缀图标:不占右侧宽度,禁用/只读时不出现。@author nokecy
|
|
125
|
+
var canOpen = !props.disabled && !hideBtn;
|
|
126
|
+
var trigger = canOpen ? /*#__PURE__*/_react.default.createElement("span", {
|
|
127
|
+
className: "qc-dialog-select-trigger",
|
|
128
|
+
role: "button",
|
|
129
|
+
"aria-label": "\u6253\u5F00\u9009\u62E9\u7A97\u53E3",
|
|
130
|
+
title: "\u9009\u62E9"
|
|
131
|
+
// 阻止冒泡:点图标只开选择窗口,不展开下拉也不抢走输入框焦点。
|
|
132
|
+
,
|
|
133
|
+
onMouseDown: function onMouseDown(e) {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
e.stopPropagation();
|
|
136
|
+
},
|
|
137
|
+
onClick: function onClick(e) {
|
|
138
|
+
e.stopPropagation();
|
|
139
|
+
setSelectRows(undefined);
|
|
140
|
+
setTrue();
|
|
106
141
|
}
|
|
107
|
-
},
|
|
142
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.SearchOutlined, null)) : undefined;
|
|
143
|
+
var mergedClassName = ['qc-dialog-select', rest.className].filter(Boolean).join(' ');
|
|
144
|
+
var triggerStyle = {
|
|
145
|
+
'--qc-dialog-select-trigger-color': token.colorTextTertiary,
|
|
146
|
+
'--qc-dialog-select-trigger-hover': token.colorPrimary
|
|
147
|
+
};
|
|
148
|
+
var commonProps = _objectSpread(_objectSpread({}, rest), {}, {
|
|
149
|
+
className: mergedClassName,
|
|
108
150
|
value: state,
|
|
109
|
-
style: _objectSpread(_objectSpread({},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
151
|
+
style: _objectSpread(_objectSpread({}, triggerStyle), rest.style || {})
|
|
152
|
+
}, trigger ? {
|
|
153
|
+
suffixIcon: trigger
|
|
154
|
+
} : {});
|
|
155
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, useAutoComplete && !props.labelInValue ? /*#__PURE__*/_react.default.createElement(_antd.AutoComplete, commonProps) : /*#__PURE__*/_react.default.createElement(_antdV.Select, _extends({
|
|
114
156
|
maxTagCount: 'responsive',
|
|
115
157
|
filterOption: false
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
icon: /*#__PURE__*/_react.default.createElement(_icons.DashOutlined, null),
|
|
124
|
-
onClick: function onClick() {
|
|
125
|
-
setTrue();
|
|
126
|
-
},
|
|
127
|
-
disabled: rest.disabled
|
|
128
|
-
}) : null), /*#__PURE__*/_react.default.createElement(_draggableModal.default, {
|
|
129
|
-
width: 960,
|
|
158
|
+
}, commonProps)), dialogRenderer ? dialogRenderer({
|
|
159
|
+
open: visible,
|
|
160
|
+
mode: selectionMode,
|
|
161
|
+
onCancel: close,
|
|
162
|
+
onConfirm: confirmRows
|
|
163
|
+
}) : /*#__PURE__*/_react.default.createElement(_draggableModal.default, {
|
|
164
|
+
width: modalWidth,
|
|
130
165
|
title: "\u9009\u62E9",
|
|
131
|
-
|
|
132
|
-
zIndex: 9999
|
|
133
|
-
},
|
|
166
|
+
zIndex: dialogZIndex,
|
|
134
167
|
destroyOnClose: true,
|
|
135
168
|
open: visible,
|
|
136
|
-
onOk:
|
|
137
|
-
|
|
138
|
-
|
|
169
|
+
onOk: function onOk() {
|
|
170
|
+
return confirmRows(selectRows || []);
|
|
171
|
+
},
|
|
172
|
+
onCancel: close,
|
|
173
|
+
okButtonProps: {
|
|
174
|
+
disabled: !(selectRows !== null && selectRows !== void 0 && selectRows.length)
|
|
175
|
+
}
|
|
176
|
+
}, selectionMode === 'multiple' && /*#__PURE__*/_react.default.createElement("div", {
|
|
177
|
+
style: {
|
|
178
|
+
marginBottom: 8,
|
|
179
|
+
textAlign: 'right'
|
|
180
|
+
}
|
|
181
|
+
}, "\u5DF2\u9009 ", (_selectRows$length = selectRows === null || selectRows === void 0 ? void 0 : selectRows.length) !== null && _selectRows$length !== void 0 ? _selectRows$length : 0, " \u9879"), /*#__PURE__*/_react.default.createElement(Grid, _extends({
|
|
182
|
+
gridKey: dialogGridKey,
|
|
183
|
+
dataSource: dialogDataSource,
|
|
184
|
+
hidePagination: localData
|
|
185
|
+
}, localData ? {
|
|
186
|
+
getRowId: function getRowId(_ref) {
|
|
187
|
+
var data = _ref.data;
|
|
188
|
+
return String(data[key]);
|
|
189
|
+
}
|
|
190
|
+
} : {}, {
|
|
139
191
|
style: {
|
|
140
192
|
height: 450
|
|
141
193
|
},
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
// 多选时重开弹窗要把已经选中的行勾回来,否则用户会以为之前的选择丢了。
|
|
194
|
+
pageSize: dialogPageSize,
|
|
195
|
+
pageSizeOptions: dialogPageSizeOptions,
|
|
196
|
+
onFirstDataRendered: function onFirstDataRendered(_ref2) {
|
|
197
|
+
var api = _ref2.api;
|
|
198
|
+
// 重开弹窗要把已经选中的行勾回来,否则用户会以为之前的选择丢了。
|
|
148
199
|
// 放在首屏数据渲染完成时做:弹窗是 destroyOnClose,打开的那一刻表格还没有数据。@author nokecy
|
|
149
|
-
|
|
150
|
-
var
|
|
151
|
-
var selected = state.map(function (it) {
|
|
200
|
+
var current = Array.isArray(state) ? state : state == null ? [] : [state];
|
|
201
|
+
var selected = current.map(function (it) {
|
|
152
202
|
return it && _typeof(it) === 'object' ? it.value : it;
|
|
153
203
|
});
|
|
204
|
+
if (!selected.length) return;
|
|
154
205
|
api.forEachNode(function (node) {
|
|
155
|
-
if (node.data && selected.includes(node.data[key]))
|
|
156
|
-
node.setSelected(true);
|
|
157
|
-
}
|
|
206
|
+
if (node.data && selected.includes(node.data[key])) node.setSelected(true);
|
|
158
207
|
});
|
|
159
208
|
},
|
|
160
|
-
search: (columnDefs === null || columnDefs === void 0 ? void 0 : columnDefs.filter(function (i) {
|
|
209
|
+
search: !localData && (columnDefs === null || columnDefs === void 0 ? void 0 : columnDefs.filter(function (i) {
|
|
161
210
|
return !i.hideInSearch;
|
|
162
211
|
}).length) !== 0,
|
|
163
212
|
onSelectionChanged: onSelectionChanged,
|
|
164
|
-
rowSelection:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
213
|
+
rowSelection: dialogIsRowSelectable ? {
|
|
214
|
+
mode: selectionMode === 'multiple' ? 'multiRow' : 'singleRow',
|
|
215
|
+
isRowSelectable: function isRowSelectable(node) {
|
|
216
|
+
return !!node.data && dialogIsRowSelectable(node.data);
|
|
217
|
+
}
|
|
218
|
+
} : selectionMode === 'multiple' ? 'multiple' : 'single',
|
|
219
|
+
onRowDoubleClicked: function onRowDoubleClicked(_ref3) {
|
|
220
|
+
var data = _ref3.data;
|
|
221
|
+
if (dialogIsRowSelectable && !dialogIsRowSelectable(data)) return;
|
|
222
|
+
confirmRows([data]);
|
|
172
223
|
},
|
|
173
|
-
request: ( /*#__PURE__*/function () {
|
|
174
|
-
var
|
|
175
|
-
var
|
|
176
|
-
var adapter, data, requestData;
|
|
224
|
+
request: localData ? undefined : ( /*#__PURE__*/function () {
|
|
225
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params, _, record) {
|
|
226
|
+
var adapter, data;
|
|
177
227
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
178
228
|
while (1) switch (_context.prev = _context.next) {
|
|
179
229
|
case 0:
|
|
180
|
-
adapter =
|
|
230
|
+
adapter = pagedApiAdapter !== null && pagedApiAdapter !== void 0 ? pagedApiAdapter : _adapters.abpPagedApiAdapter;
|
|
181
231
|
_context.next = 3;
|
|
182
232
|
return request(adapter.toRequest({
|
|
183
|
-
filter:
|
|
233
|
+
filter: queryFun ? queryFun(params === null || params === void 0 ? void 0 : params.filter) : params === null || params === void 0 ? void 0 : params.filter,
|
|
184
234
|
sorter: params === null || params === void 0 ? void 0 : params.sorter,
|
|
185
235
|
skipCount: params === null || params === void 0 ? void 0 : params.skipCount,
|
|
186
|
-
maxResultCount: params === null || params === void 0 ? void 0 : params.maxResultCount
|
|
236
|
+
maxResultCount: params === null || params === void 0 ? void 0 : params.maxResultCount,
|
|
237
|
+
record: record
|
|
187
238
|
}), record);
|
|
188
239
|
case 3:
|
|
189
240
|
data = _context.sent;
|
|
190
|
-
|
|
241
|
+
return _context.abrupt("return", {
|
|
191
242
|
success: true,
|
|
192
243
|
data: adapter.getItems(data),
|
|
193
244
|
total: adapter.getTotal(data)
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
return _context.abrupt("return", requestData);
|
|
197
|
-
case 7:
|
|
245
|
+
});
|
|
246
|
+
case 5:
|
|
198
247
|
case "end":
|
|
199
248
|
return _context.stop();
|
|
200
249
|
}
|
|
201
250
|
}, _callee);
|
|
202
251
|
}));
|
|
203
252
|
return function (_x, _x2, _x3) {
|
|
204
|
-
return
|
|
253
|
+
return _ref4.apply(this, arguments);
|
|
205
254
|
};
|
|
206
255
|
}()),
|
|
207
256
|
columnDefs: columnDefs
|
|
208
|
-
})));
|
|
257
|
+
}))));
|
|
209
258
|
};
|
|
210
259
|
var _default = exports.default = DialogSelect;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// 选择窗口入口放在输入框内部(后缀图标),不再在右侧另占一个按钮的宽度。@author nokecy
|
|
2
|
+
.qc-dialog-select {
|
|
3
|
+
width: 100%;
|
|
4
|
+
|
|
5
|
+
// 后缀图标可点;antd 默认给后缀 pointer-events: none。
|
|
6
|
+
.qc-dialog-select-trigger {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
pointer-events: auto;
|
|
14
|
+
color: var(--qc-dialog-select-trigger-color, rgba(0, 0, 0, 0.45));
|
|
15
|
+
transition: color 0.2s;
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
color: var(--qc-dialog-select-trigger-hover, #1677ff);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// 悬停时 antd 会把后缀淡出、换成清除图标;这里让入口始终可见,清除图标左移一格并排。
|
|
23
|
+
&.ant-select.ant-select:hover .ant-select-arrow:not(:last-child) {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.ant-select-allow-clear .ant-select-clear {
|
|
28
|
+
inset-inline-end: 31px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.ant-select-allow-clear .ant-select-selection-item,
|
|
32
|
+
&.ant-select-allow-clear .ant-select-selection-placeholder {
|
|
33
|
+
padding-inline-end: 36px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.ant-select-multiple .ant-select-selector {
|
|
37
|
+
padding-inline-end: 38px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -76,14 +76,18 @@ var DraggableModal = function DraggableModal(props) {
|
|
|
76
76
|
// 修复 AgGrid 等组件在 Modal 中高度不展开的问题
|
|
77
77
|
// 当 Modal 打开时触发 window resize 事件
|
|
78
78
|
(0, _react.useEffect)(function () {
|
|
79
|
-
if (open)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
});
|
|
86
|
-
}
|
|
79
|
+
if (!open) return;
|
|
80
|
+
// 使用 requestAnimationFrame 和 setTimeout 确保 DOM 完全渲染;卸载或关闭时取消,避免对已销毁的环境派发事件
|
|
81
|
+
var timer;
|
|
82
|
+
var frame = requestAnimationFrame(function () {
|
|
83
|
+
timer = setTimeout(function () {
|
|
84
|
+
window.dispatchEvent(new Event('resize'));
|
|
85
|
+
}, 100);
|
|
86
|
+
});
|
|
87
|
+
return function () {
|
|
88
|
+
cancelAnimationFrame(frame);
|
|
89
|
+
if (timer !== undefined) clearTimeout(timer);
|
|
90
|
+
};
|
|
87
91
|
}, [open]);
|
|
88
92
|
var _onStart = function onStart(_event, uiData) {
|
|
89
93
|
var _draggleRef$current;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -31,4 +31,9 @@ export type * from "./RuleBuilder";
|
|
|
31
31
|
export type { ColumnConfig } from "./array-table/columnHelper";
|
|
32
32
|
export type { CentralizedColumnScheme, QueryScheme, SchemeStorageAdapter, SchemeSyncDataDto, CurrentSchemeDto, SchemeStorageConfig, LocalStorageAdapterConfig, BackendApiAdapterConfig, UseSchemeManagerConfig, GridPlusContextValue, GlobalConfigPermissions, } from "./ag-grid-plus";
|
|
33
33
|
export * from './adapters';
|
|
34
|
+
export { semanticTextColors, toGridTextColor, gridValueEnum } from "./ag-grid-plus/utils/valueEnumColor";
|
|
35
|
+
export type { SemanticPreset } from "./ag-grid-plus/utils/valueEnumColor";
|
|
36
|
+
export { contrastRatio, relativeLuminance, darkenUntilContrast, lightenUntilContrast, toRgb, toHsl, fromHsl } from "./utils/contrast";
|
|
37
|
+
export { BusinessDecimal, decimal, decimalText, nonNegativeDecimal, roundDecimal, sumDecimals, formatDecimal } from "./utils/businessDecimal";
|
|
38
|
+
export type { DecimalValue } from "./utils/businessDecimal";
|
|
34
39
|
export type { ParseResult as RegexParseResult, ValidationResult as RegexValidationResult, RegexError, ComplexityMetrics, ASTNode, AstRegExp, RegexTemplate, TestResult as RegexTestResult, CodeMirrorWrapperProps, RegexEditorProps, RegexFlags, MatchResult, RegexTesterProps, FlagsSelectorProps, MatchItemProps, RegexRailroadDiagramProps, } from "./components/RegexEditor";
|
package/dist/cjs/index.js
CHANGED
|
@@ -46,7 +46,24 @@ var _exportNames = {
|
|
|
46
46
|
RegexTester: true,
|
|
47
47
|
FlagsSelector: true,
|
|
48
48
|
MatchItem: true,
|
|
49
|
-
RegexRailroadDiagram: true
|
|
49
|
+
RegexRailroadDiagram: true,
|
|
50
|
+
semanticTextColors: true,
|
|
51
|
+
toGridTextColor: true,
|
|
52
|
+
gridValueEnum: true,
|
|
53
|
+
contrastRatio: true,
|
|
54
|
+
relativeLuminance: true,
|
|
55
|
+
darkenUntilContrast: true,
|
|
56
|
+
lightenUntilContrast: true,
|
|
57
|
+
toRgb: true,
|
|
58
|
+
toHsl: true,
|
|
59
|
+
fromHsl: true,
|
|
60
|
+
BusinessDecimal: true,
|
|
61
|
+
decimal: true,
|
|
62
|
+
decimalText: true,
|
|
63
|
+
nonNegativeDecimal: true,
|
|
64
|
+
roundDecimal: true,
|
|
65
|
+
sumDecimals: true,
|
|
66
|
+
formatDecimal: true
|
|
50
67
|
};
|
|
51
68
|
Object.defineProperty(exports, "AgGridColumn", {
|
|
52
69
|
enumerable: true,
|
|
@@ -78,6 +95,12 @@ Object.defineProperty(exports, "BackendApiSchemeAdapter", {
|
|
|
78
95
|
return _agGridPlus.BackendApiSchemeAdapter;
|
|
79
96
|
}
|
|
80
97
|
});
|
|
98
|
+
Object.defineProperty(exports, "BusinessDecimal", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function get() {
|
|
101
|
+
return _businessDecimal.BusinessDecimal;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
81
104
|
Object.defineProperty(exports, "Card", {
|
|
82
105
|
enumerable: true,
|
|
83
106
|
get: function get() {
|
|
@@ -252,6 +275,12 @@ Object.defineProperty(exports, "ToolBar", {
|
|
|
252
275
|
return _toolBar.default;
|
|
253
276
|
}
|
|
254
277
|
});
|
|
278
|
+
Object.defineProperty(exports, "contrastRatio", {
|
|
279
|
+
enumerable: true,
|
|
280
|
+
get: function get() {
|
|
281
|
+
return _contrast.contrastRatio;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
255
284
|
Object.defineProperty(exports, "createCascaderField", {
|
|
256
285
|
enumerable: true,
|
|
257
286
|
get: function get() {
|
|
@@ -264,12 +293,102 @@ Object.defineProperty(exports, "createSelectField", {
|
|
|
264
293
|
return _standardFormDialog.createSelectField;
|
|
265
294
|
}
|
|
266
295
|
});
|
|
296
|
+
Object.defineProperty(exports, "darkenUntilContrast", {
|
|
297
|
+
enumerable: true,
|
|
298
|
+
get: function get() {
|
|
299
|
+
return _contrast.darkenUntilContrast;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
Object.defineProperty(exports, "decimal", {
|
|
303
|
+
enumerable: true,
|
|
304
|
+
get: function get() {
|
|
305
|
+
return _businessDecimal.decimal;
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
Object.defineProperty(exports, "decimalText", {
|
|
309
|
+
enumerable: true,
|
|
310
|
+
get: function get() {
|
|
311
|
+
return _businessDecimal.decimalText;
|
|
312
|
+
}
|
|
313
|
+
});
|
|
267
314
|
Object.defineProperty(exports, "flattenTreeDeep", {
|
|
268
315
|
enumerable: true,
|
|
269
316
|
get: function get() {
|
|
270
317
|
return _agGridPlus.flattenTreeDeep;
|
|
271
318
|
}
|
|
272
319
|
});
|
|
320
|
+
Object.defineProperty(exports, "formatDecimal", {
|
|
321
|
+
enumerable: true,
|
|
322
|
+
get: function get() {
|
|
323
|
+
return _businessDecimal.formatDecimal;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
Object.defineProperty(exports, "fromHsl", {
|
|
327
|
+
enumerable: true,
|
|
328
|
+
get: function get() {
|
|
329
|
+
return _contrast.fromHsl;
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
Object.defineProperty(exports, "gridValueEnum", {
|
|
333
|
+
enumerable: true,
|
|
334
|
+
get: function get() {
|
|
335
|
+
return _valueEnumColor.gridValueEnum;
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
Object.defineProperty(exports, "lightenUntilContrast", {
|
|
339
|
+
enumerable: true,
|
|
340
|
+
get: function get() {
|
|
341
|
+
return _contrast.lightenUntilContrast;
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
Object.defineProperty(exports, "nonNegativeDecimal", {
|
|
345
|
+
enumerable: true,
|
|
346
|
+
get: function get() {
|
|
347
|
+
return _businessDecimal.nonNegativeDecimal;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
Object.defineProperty(exports, "relativeLuminance", {
|
|
351
|
+
enumerable: true,
|
|
352
|
+
get: function get() {
|
|
353
|
+
return _contrast.relativeLuminance;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
Object.defineProperty(exports, "roundDecimal", {
|
|
357
|
+
enumerable: true,
|
|
358
|
+
get: function get() {
|
|
359
|
+
return _businessDecimal.roundDecimal;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
Object.defineProperty(exports, "semanticTextColors", {
|
|
363
|
+
enumerable: true,
|
|
364
|
+
get: function get() {
|
|
365
|
+
return _valueEnumColor.semanticTextColors;
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
Object.defineProperty(exports, "sumDecimals", {
|
|
369
|
+
enumerable: true,
|
|
370
|
+
get: function get() {
|
|
371
|
+
return _businessDecimal.sumDecimals;
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
Object.defineProperty(exports, "toGridTextColor", {
|
|
375
|
+
enumerable: true,
|
|
376
|
+
get: function get() {
|
|
377
|
+
return _valueEnumColor.toGridTextColor;
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
Object.defineProperty(exports, "toHsl", {
|
|
381
|
+
enumerable: true,
|
|
382
|
+
get: function get() {
|
|
383
|
+
return _contrast.toHsl;
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
Object.defineProperty(exports, "toRgb", {
|
|
387
|
+
enumerable: true,
|
|
388
|
+
get: function get() {
|
|
389
|
+
return _contrast.toRgb;
|
|
390
|
+
}
|
|
391
|
+
});
|
|
273
392
|
Object.defineProperty(exports, "useGridPlusColumnState", {
|
|
274
393
|
enumerable: true,
|
|
275
394
|
get: function get() {
|
|
@@ -341,4 +460,7 @@ Object.keys(_adapters).forEach(function (key) {
|
|
|
341
460
|
}
|
|
342
461
|
});
|
|
343
462
|
});
|
|
463
|
+
var _valueEnumColor = require("./ag-grid-plus/utils/valueEnumColor");
|
|
464
|
+
var _contrast = require("./utils/contrast");
|
|
465
|
+
var _businessDecimal = require("./utils/businessDecimal");
|
|
344
466
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|