@nokecy/qc-ui 1.1.85 → 1.1.86
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/array-table/index.js +2 -0
- package/dist/cjs/readPretty/controls.js +6 -2
- package/dist/cjs/readPretty/formily.js +6 -2
- package/dist/cjs/readPretty/selectNumberInputTextOnClick.d.ts +3 -0
- package/dist/cjs/readPretty/selectNumberInputTextOnClick.js +14 -0
- package/dist/esm/array-table/index.js +2 -0
- package/dist/esm/readPretty/controls.js +6 -2
- package/dist/esm/readPretty/formily.js +6 -2
- package/dist/esm/readPretty/selectNumberInputTextOnClick.d.ts +3 -0
- package/dist/esm/readPretty/selectNumberInputTextOnClick.js +8 -0
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _agGridReact = require("ag-grid-react");
|
|
9
9
|
var _react2 = require("@formily/react");
|
|
10
10
|
var _uniqueId = _interopRequireDefault(require("lodash/uniqueId"));
|
|
11
|
+
var _locale = require("../ag-grid-plus/locale");
|
|
11
12
|
var _utils = require("./utils");
|
|
12
13
|
var _columnGroup = require("./columnGroup");
|
|
13
14
|
var _indexColumn = require("./indexColumn");
|
|
@@ -364,6 +365,7 @@ var ArrayTableInner = (0, _react2.observer)(function (props) {
|
|
|
364
365
|
}
|
|
365
366
|
}, /*#__PURE__*/_react.default.createElement(_agGridReact.AgGridReact, {
|
|
366
367
|
theme: arrayTableTheme,
|
|
368
|
+
localeText: _locale.localeText,
|
|
367
369
|
context: gridContext,
|
|
368
370
|
onGridReady: function onGridReady(params) {
|
|
369
371
|
params.api.hidePopupMenu();
|
|
@@ -8,6 +8,7 @@ var _antdV = require("@formily/antd-v5");
|
|
|
8
8
|
var _antd = require("antd");
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _hoistStatics = require("./hoistStatics");
|
|
11
|
+
var _selectNumberInputTextOnClick = require("./selectNumberInputTextOnClick");
|
|
11
12
|
var _values = require("./values");
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -16,6 +17,7 @@ var readingControl = function readingControl(Control, Preview) {
|
|
|
16
17
|
var map = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (props) {
|
|
17
18
|
return props;
|
|
18
19
|
};
|
|
20
|
+
var selectNumberOnClick = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
19
21
|
var Component = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
20
22
|
var _props$disabled;
|
|
21
23
|
var _ConfigProvider$useCo = _antd.ConfigProvider.useConfig(),
|
|
@@ -23,7 +25,9 @@ var readingControl = function readingControl(Control, Preview) {
|
|
|
23
25
|
var reading = props.readOnly || ((_props$disabled = props.disabled) !== null && _props$disabled !== void 0 ? _props$disabled : componentDisabled);
|
|
24
26
|
return reading ? /*#__PURE__*/_react.default.createElement(_antdV.PreviewText.Placeholder, {
|
|
25
27
|
value: "\u2014"
|
|
26
|
-
}, /*#__PURE__*/_react.default.createElement(Preview, map(props))) : /*#__PURE__*/_react.default.createElement(Control, _extends({}, props, {
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement(Preview, map(props))) : /*#__PURE__*/_react.default.createElement(Control, _extends({}, props, selectNumberOnClick ? {
|
|
29
|
+
onClick: (0, _selectNumberInputTextOnClick.selectNumberInputTextOnClick)(props.onClick)
|
|
30
|
+
} : {}, {
|
|
27
31
|
ref: ref
|
|
28
32
|
}));
|
|
29
33
|
});
|
|
@@ -53,7 +57,7 @@ var Input = exports.Input = readingControl(_antd.Input, _antdV.PreviewText.Input
|
|
|
53
57
|
Input.TextArea = readingControl(_antd.Input.TextArea, _antdV.PreviewText.Input);
|
|
54
58
|
Input.Password = readingControl(_antd.Input.Password, PasswordPreview);
|
|
55
59
|
Input.Search = readingControl(_antd.Input.Search, _antdV.PreviewText.Input);
|
|
56
|
-
var InputNumber = exports.InputNumber = readingControl(_antd.InputNumber, _antdV.PreviewText.NumberPicker);
|
|
60
|
+
var InputNumber = exports.InputNumber = readingControl(_antd.InputNumber, _antdV.PreviewText.NumberPicker, undefined, true);
|
|
57
61
|
var Select = exports.Select = readingControl(_antd.Select, ChoicePreview);
|
|
58
62
|
var Switch = exports.Switch = readingControl(_antd.Switch, BooleanPreview);
|
|
59
63
|
var Checkbox = exports.Checkbox = readingControl(_antd.Checkbox, BooleanPreview);
|
|
@@ -8,6 +8,7 @@ var _react = require("@formily/react");
|
|
|
8
8
|
var _react2 = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hoistStatics = require("./hoistStatics");
|
|
10
10
|
var Reading = _interopRequireWildcard(require("./controls"));
|
|
11
|
+
var _selectNumberInputTextOnClick = require("./selectNumberInputTextOnClick");
|
|
11
12
|
var _arrayTable = require("./arrayTable");
|
|
12
13
|
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); }
|
|
13
14
|
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; }
|
|
@@ -30,6 +31,7 @@ function withReadingFields(components) {
|
|
|
30
31
|
Password: Reading.Input.Password
|
|
31
32
|
});
|
|
32
33
|
var wrap = function wrap(Control, Preview) {
|
|
34
|
+
var selectNumberOnClick = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
33
35
|
var Component = (0, _react.observer)(function (props) {
|
|
34
36
|
var field = (0, _react.useField)();
|
|
35
37
|
if (props.disabled || props.readOnly || field !== null && field !== void 0 && field.disabled || field !== null && field !== void 0 && field.readOnly) {
|
|
@@ -41,7 +43,9 @@ function withReadingFields(components) {
|
|
|
41
43
|
disabled: true
|
|
42
44
|
}));
|
|
43
45
|
}
|
|
44
|
-
return /*#__PURE__*/_react2.default.createElement(Control, props
|
|
46
|
+
return /*#__PURE__*/_react2.default.createElement(Control, _extends({}, props, selectNumberOnClick ? {
|
|
47
|
+
onClick: (0, _selectNumberInputTextOnClick.selectNumberInputTextOnClick)(props.onClick)
|
|
48
|
+
} : {}));
|
|
45
49
|
});
|
|
46
50
|
var Wrapped = (0, _hoistStatics.hoistStatics)(Component, Control);
|
|
47
51
|
// 嵌套控件同样按字段状态展示,例如Input.TextArea、DatePicker.RangePicker。
|
|
@@ -58,7 +62,7 @@ function withReadingFields(components) {
|
|
|
58
62
|
try {
|
|
59
63
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
60
64
|
var name = _step.value;
|
|
61
|
-
result[name] = wrap(components[name], previews[name]);
|
|
65
|
+
result[name] = wrap(components[name], previews[name], name === 'NumberPicker');
|
|
62
66
|
}
|
|
63
67
|
// ArrayTable 阅读态保留动态列的标题和显隐状态。@author nokecy
|
|
64
68
|
} catch (err) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectNumberInputTextOnClick = void 0;
|
|
7
|
+
/** 数字框点击时全选当前输入文本,便于直接替换数值。@author nokecy */
|
|
8
|
+
var selectNumberInputTextOnClick = exports.selectNumberInputTextOnClick = function selectNumberInputTextOnClick(onClick) {
|
|
9
|
+
return function (event) {
|
|
10
|
+
onClick === null || onClick === void 0 || onClick(event);
|
|
11
|
+
var target = event.target;
|
|
12
|
+
if (target instanceof HTMLInputElement && !target.disabled && !target.readOnly) target.select();
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -17,6 +17,7 @@ import { useField, observer, RecursionField } from "@formily/react";
|
|
|
17
17
|
import { useFieldSchema } from "@formily/react";
|
|
18
18
|
import { connect, mapProps, mapReadPretty } from "@formily/react";
|
|
19
19
|
import uniqueId from "lodash/uniqueId";
|
|
20
|
+
import { localeText } from "../ag-grid-plus/locale";
|
|
20
21
|
import { useAddition, buildArrayTableColumns, useArrayTableSources, useArrayTableActions, isColumnComponent, collectLazyDefaults, applyLazyDefaults } from "./utils";
|
|
21
22
|
import { groupColumnDefs } from "./columnGroup";
|
|
22
23
|
import { ARRAY_TABLE_INDEX_FIELD, hasOwnIndexColumn, makeIndexColumn } from "./indexColumn";
|
|
@@ -360,6 +361,7 @@ var ArrayTableInner = observer(function (props) {
|
|
|
360
361
|
}
|
|
361
362
|
}, /*#__PURE__*/React.createElement(AgGridReact, {
|
|
362
363
|
theme: arrayTableTheme,
|
|
364
|
+
localeText: localeText,
|
|
363
365
|
context: gridContext,
|
|
364
366
|
onGridReady: function onGridReady(params) {
|
|
365
367
|
params.api.hidePopupMenu();
|
|
@@ -3,6 +3,7 @@ import { PreviewText } from '@formily/antd-v5';
|
|
|
3
3
|
import { ConfigProvider, Input as AntInput, InputNumber as AntInputNumber, Select as AntSelect, Switch as AntSwitch, Checkbox as AntCheckbox, Radio as AntRadio, DatePicker as AntDatePicker, TimePicker as AntTimePicker, TreeSelect as AntTreeSelect, Cascader as AntCascader } from 'antd';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { hoistStatics } from "./hoistStatics";
|
|
6
|
+
import { selectNumberInputTextOnClick } from "./selectNumberInputTextOnClick";
|
|
6
7
|
import { flattenOptions, selectedLabels } from "./values";
|
|
7
8
|
|
|
8
9
|
/** 普通表单控件在不可编辑时使用阅读展示,继承整张表单的禁用状态。@author nokecy */
|
|
@@ -10,6 +11,7 @@ var readingControl = function readingControl(Control, Preview) {
|
|
|
10
11
|
var map = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (props) {
|
|
11
12
|
return props;
|
|
12
13
|
};
|
|
14
|
+
var selectNumberOnClick = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
13
15
|
var Component = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
14
16
|
var _props$disabled;
|
|
15
17
|
var _ConfigProvider$useCo = ConfigProvider.useConfig(),
|
|
@@ -17,7 +19,9 @@ var readingControl = function readingControl(Control, Preview) {
|
|
|
17
19
|
var reading = props.readOnly || ((_props$disabled = props.disabled) !== null && _props$disabled !== void 0 ? _props$disabled : componentDisabled);
|
|
18
20
|
return reading ? /*#__PURE__*/React.createElement(PreviewText.Placeholder, {
|
|
19
21
|
value: "\u2014"
|
|
20
|
-
}, /*#__PURE__*/React.createElement(Preview, map(props))) : /*#__PURE__*/React.createElement(Control, _extends({}, props, {
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Preview, map(props))) : /*#__PURE__*/React.createElement(Control, _extends({}, props, selectNumberOnClick ? {
|
|
23
|
+
onClick: selectNumberInputTextOnClick(props.onClick)
|
|
24
|
+
} : {}, {
|
|
21
25
|
ref: ref
|
|
22
26
|
}));
|
|
23
27
|
});
|
|
@@ -47,7 +51,7 @@ export var Input = readingControl(AntInput, PreviewText.Input);
|
|
|
47
51
|
Input.TextArea = readingControl(AntInput.TextArea, PreviewText.Input);
|
|
48
52
|
Input.Password = readingControl(AntInput.Password, PasswordPreview);
|
|
49
53
|
Input.Search = readingControl(AntInput.Search, PreviewText.Input);
|
|
50
|
-
export var InputNumber = readingControl(AntInputNumber, PreviewText.NumberPicker);
|
|
54
|
+
export var InputNumber = readingControl(AntInputNumber, PreviewText.NumberPicker, undefined, true);
|
|
51
55
|
export var Select = readingControl(AntSelect, ChoicePreview);
|
|
52
56
|
export var Switch = readingControl(AntSwitch, BooleanPreview);
|
|
53
57
|
export var Checkbox = readingControl(AntCheckbox, BooleanPreview);
|
|
@@ -12,6 +12,7 @@ import { observer, useField } from '@formily/react';
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { hoistStatics } from "./hoistStatics";
|
|
14
14
|
import * as Reading from "./controls";
|
|
15
|
+
import { selectNumberInputTextOnClick } from "./selectNumberInputTextOnClick";
|
|
15
16
|
import { withReadingArrayTable } from "./arrayTable";
|
|
16
17
|
|
|
17
18
|
/** 动态表单统一入口:禁用/只读的数据控件使用阅读展示,保持字段值和校验模型。@author nokecy */
|
|
@@ -22,6 +23,7 @@ export function withReadingFields(components) {
|
|
|
22
23
|
Password: Reading.Input.Password
|
|
23
24
|
});
|
|
24
25
|
var wrap = function wrap(Control, Preview) {
|
|
26
|
+
var selectNumberOnClick = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
25
27
|
var Component = observer(function (props) {
|
|
26
28
|
var field = useField();
|
|
27
29
|
if (props.disabled || props.readOnly || field !== null && field !== void 0 && field.disabled || field !== null && field !== void 0 && field.readOnly) {
|
|
@@ -33,7 +35,9 @@ export function withReadingFields(components) {
|
|
|
33
35
|
disabled: true
|
|
34
36
|
}));
|
|
35
37
|
}
|
|
36
|
-
return /*#__PURE__*/React.createElement(Control, props
|
|
38
|
+
return /*#__PURE__*/React.createElement(Control, _extends({}, props, selectNumberOnClick ? {
|
|
39
|
+
onClick: selectNumberInputTextOnClick(props.onClick)
|
|
40
|
+
} : {}));
|
|
37
41
|
});
|
|
38
42
|
var Wrapped = hoistStatics(Component, Control);
|
|
39
43
|
// 嵌套控件同样按字段状态展示,例如Input.TextArea、DatePicker.RangePicker。
|
|
@@ -50,7 +54,7 @@ export function withReadingFields(components) {
|
|
|
50
54
|
try {
|
|
51
55
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
52
56
|
var name = _step.value;
|
|
53
|
-
result[name] = wrap(components[name], previews[name]);
|
|
57
|
+
result[name] = wrap(components[name], previews[name], name === 'NumberPicker');
|
|
54
58
|
}
|
|
55
59
|
// ArrayTable 阅读态保留动态列的标题和显隐状态。@author nokecy
|
|
56
60
|
} catch (err) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** 数字框点击时全选当前输入文本,便于直接替换数值。@author nokecy */
|
|
2
|
+
export var selectNumberInputTextOnClick = function selectNumberInputTextOnClick(onClick) {
|
|
3
|
+
return function (event) {
|
|
4
|
+
onClick === null || onClick === void 0 || onClick(event);
|
|
5
|
+
var target = event.target;
|
|
6
|
+
if (target instanceof HTMLInputElement && !target.disabled && !target.readOnly) target.select();
|
|
7
|
+
};
|
|
8
|
+
};
|