tntd 3.0.66 → 3.0.67

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.
Files changed (78) hide show
  1. package/es/color-picker/ColorPicker.js +3 -2
  2. package/es/color-picker/ColorPicker.js.map +1 -1
  3. package/es/modal/modal.js.map +1 -1
  4. package/es/query-form/Field/Composition/FieldPopover.js +459 -0
  5. package/es/query-form/Field/Composition/FieldPopover.js.map +1 -0
  6. package/es/query-form/Field/Composition/FieldPopover.less +41 -0
  7. package/es/query-form/Field/Composition/Select.js +253 -0
  8. package/es/query-form/Field/Composition/Select.js.map +1 -0
  9. package/es/query-form/Field/Composition/SelectInput.js +111 -0
  10. package/es/query-form/Field/Composition/SelectInput.js.map +1 -0
  11. package/es/query-form/Field/Composition/ValueTag.js +240 -0
  12. package/es/query-form/Field/Composition/ValueTag.js.map +1 -0
  13. package/es/query-form/Field/Composition/index.js +441 -0
  14. package/es/query-form/Field/Composition/index.js.map +1 -0
  15. package/es/query-form/Field/Composition/index.less +167 -0
  16. package/es/query-form/Field/Composition/utils.js +173 -0
  17. package/es/query-form/Field/Composition/utils.js.map +1 -0
  18. package/es/query-form-v2/index.less +133 -0
  19. package/lib/color-picker/ColorPicker.d.ts +2 -1
  20. package/lib/color-picker/ColorPicker.d.ts.map +1 -1
  21. package/lib/color-picker/ColorPicker.js +3 -2
  22. package/lib/color-picker/ColorPicker.js.map +1 -1
  23. package/lib/modal/modal.d.ts.map +1 -1
  24. package/lib/modal/modal.js.map +1 -1
  25. package/lib/query-form/Field/Composition/FieldPopover.d.ts +19 -0
  26. package/lib/query-form/Field/Composition/FieldPopover.d.ts.map +1 -0
  27. package/lib/query-form/Field/Composition/FieldPopover.js +459 -0
  28. package/lib/query-form/Field/Composition/FieldPopover.js.map +1 -0
  29. package/lib/query-form/Field/Composition/FieldPopover.less +41 -0
  30. package/lib/query-form/Field/Composition/Select.d.ts +4 -0
  31. package/lib/query-form/Field/Composition/Select.d.ts.map +1 -0
  32. package/lib/query-form/Field/Composition/Select.js +253 -0
  33. package/lib/query-form/Field/Composition/Select.js.map +1 -0
  34. package/lib/query-form/Field/Composition/SelectInput.d.ts +3 -0
  35. package/lib/query-form/Field/Composition/SelectInput.d.ts.map +1 -0
  36. package/lib/query-form/Field/Composition/SelectInput.js +111 -0
  37. package/lib/query-form/Field/Composition/SelectInput.js.map +1 -0
  38. package/lib/query-form/Field/Composition/ValueTag.d.ts +13 -0
  39. package/lib/query-form/Field/Composition/ValueTag.d.ts.map +1 -0
  40. package/lib/query-form/Field/Composition/ValueTag.js +240 -0
  41. package/lib/query-form/Field/Composition/ValueTag.js.map +1 -0
  42. package/lib/query-form/Field/Composition/index.d.ts +15 -0
  43. package/lib/query-form/Field/Composition/index.d.ts.map +1 -0
  44. package/lib/query-form/Field/Composition/index.js +441 -0
  45. package/lib/query-form/Field/Composition/index.js.map +1 -0
  46. package/lib/query-form/Field/Composition/index.less +167 -0
  47. package/lib/query-form/Field/Composition/utils.d.ts +21 -0
  48. package/lib/query-form/Field/Composition/utils.d.ts.map +1 -0
  49. package/lib/query-form/Field/Composition/utils.js +173 -0
  50. package/lib/query-form/Field/Composition/utils.js.map +1 -0
  51. package/lib/query-form-v2/index.less +133 -0
  52. package/package.json +2 -2
  53. package/es/checkbox/checkbox-group.js +0 -16
  54. package/es/checkbox/checkbox-group.js.map +0 -1
  55. package/es/radio/radio-group.js +0 -16
  56. package/es/radio/radio-group.js.map +0 -1
  57. package/es/steps/stepStyle/small.less +0 -5
  58. package/es/table/total-shower.js +0 -20
  59. package/es/table/total-shower.js.map +0 -1
  60. package/es/utils/simple-template.js +0 -19
  61. package/es/utils/simple-template.js.map +0 -1
  62. package/lib/checkbox/checkbox-group.d.ts +0 -8
  63. package/lib/checkbox/checkbox-group.d.ts.map +0 -1
  64. package/lib/checkbox/checkbox-group.js +0 -16
  65. package/lib/checkbox/checkbox-group.js.map +0 -1
  66. package/lib/radio/radio-group.d.ts +0 -8
  67. package/lib/radio/radio-group.d.ts.map +0 -1
  68. package/lib/radio/radio-group.js +0 -16
  69. package/lib/radio/radio-group.js.map +0 -1
  70. package/lib/steps/stepStyle/small.less +0 -5
  71. package/lib/table/total-shower.d.ts +0 -9
  72. package/lib/table/total-shower.d.ts.map +0 -1
  73. package/lib/table/total-shower.js +0 -20
  74. package/lib/table/total-shower.js.map +0 -1
  75. package/lib/utils/simple-template.d.ts +0 -9
  76. package/lib/utils/simple-template.d.ts.map +0 -1
  77. package/lib/utils/simple-template.js +0 -19
  78. package/lib/utils/simple-template.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/utils.js"],"names":[],"mappings":"AAIA,kEAGC;AAED;;;;;;;QAyBC;AAED,gDAWC;AAED;;;YAgBC;AAED,oDAKC;AAED;;;kDAyDC;AAEM,4CAC6F"}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatLabel = formatLabel;
7
+ exports.getLabel = getLabel;
8
+ exports.getLabelByValue = getLabelByValue;
9
+ exports.highlightSubstring = highlightSubstring;
10
+ exports.isInput = void 0;
11
+ exports.parseArrayToObject = parseArrayToObject;
12
+ exports.parseObjectToArray = parseObjectToArray;
13
+ var _flatten2 = _interopRequireDefault(require("lodash/flatten"));
14
+ var _isString2 = _interopRequireDefault(require("lodash/isString"));
15
+ var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
16
+ var _react = _interopRequireDefault(require("react"));
17
+ var _moment = _interopRequireDefault(require("moment"));
18
+ function _interopRequireDefault(e) {
19
+ return e && e.__esModule ? e : {
20
+ "default": e
21
+ };
22
+ }
23
+ function highlightSubstring(str, substring) {
24
+ var highlighted = "<span class=\"tnt-highlight\">".concat(substring, "</span>");
25
+ return str.replace(new RegExp(substring, 'g'), highlighted);
26
+ }
27
+ function getLabelByValue(_ref) {
28
+ var value = _ref.value,
29
+ options = _ref.options,
30
+ _ref$fieldNames = _ref.fieldNames,
31
+ fieldNames = _ref$fieldNames === void 0 ? {
32
+ label: 'label',
33
+ value: 'value'
34
+ } : _ref$fieldNames;
35
+ var getLabel = function getLabel(value) {
36
+ var target = options === null || options === void 0 ? void 0 : options.find(function (item) {
37
+ var valueKey = fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value;
38
+ var itemValue = item instanceof Object ? item[valueKey] : item;
39
+ return itemValue === value;
40
+ });
41
+ if (target) {
42
+ return target instanceof Object ? target === null || target === void 0 ? void 0 : target[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label] : target;
43
+ } else {
44
+ return value;
45
+ }
46
+ };
47
+ if ((0, _isArray2["default"])(value)) {
48
+ return value.map(getLabel).join(' | ');
49
+ } else {
50
+ return getLabel(value);
51
+ }
52
+ }
53
+ function formatLabel(reactDom) {
54
+ return (0, _flatten2["default"])(_react["default"].Children.map(reactDom.props.children, function (child) {
55
+ if (_react["default"].isValidElement(child)) {
56
+ return formatLabel(child);
57
+ } else if ((0, _isString2["default"])(child)) {
58
+ return child;
59
+ }
60
+ return '';
61
+ })).join('');
62
+ }
63
+ function parseObjectToArray(value, data) {
64
+ var _a, _b;
65
+ return (_b = (_a = Object.keys(value || {})) === null || _a === void 0 ? void 0 : _a.map(function (key) {
66
+ var target = data === null || data === void 0 ? void 0 : data.find(function (item) {
67
+ var _a, _b;
68
+ return ((_a = item.props) === null || _a === void 0 ? void 0 : _a.name) === key || ((_b = item.props) === null || _b === void 0 ? void 0 : _b.pName) === key;
69
+ });
70
+ if (!target) return null;
71
+ var dataItem = (target === null || target === void 0 ? void 0 : target.props) || {};
72
+ var _ref2 = dataItem || {},
73
+ _ref2$type = _ref2.type,
74
+ type = _ref2$type === void 0 ? 'input' : _ref2$type,
75
+ component = _ref2.component,
76
+ setLabel = _ref2.setLabel;
77
+ if (!type && component && !setLabel) {
78
+ console.error('自定义组件需要传入setLabel()方法');
79
+ }
80
+ return {
81
+ key: key,
82
+ value: value[key]
83
+ };
84
+ })) === null || _b === void 0 ? void 0 : _b.filter(function (item) {
85
+ return !!item;
86
+ });
87
+ }
88
+ function parseArrayToObject(value) {
89
+ return value === null || value === void 0 ? void 0 : value.reduce(function (acc, v) {
90
+ acc[v.key] = v.value;
91
+ return acc;
92
+ }, {});
93
+ }
94
+ function getLabel(_ref3, data, locale) {
95
+ var key = _ref3.key,
96
+ value = _ref3.value;
97
+ var _a, _b, _c, _d;
98
+ var otherTarget = data === null || data === void 0 ? void 0 : data.find(function (item) {
99
+ var _a;
100
+ return ((_a = item.props) === null || _a === void 0 ? void 0 : _a.pName) === key;
101
+ });
102
+ if (otherTarget) {
103
+ // otherInput
104
+ var selectKey = (_a = Object.keys(value || {})) === null || _a === void 0 ? void 0 : _a[0];
105
+ if (!selectKey) {
106
+ // 17. inputSelect组件,初始值{},展示undefined:undefined
107
+ return false;
108
+ }
109
+ var otherTargetObj = data.find(function (item) {
110
+ return item.props.pName === key && item.props.cName === selectKey;
111
+ });
112
+ if (!otherTargetObj) {
113
+ return false;
114
+ }
115
+ return otherTargetObj.props.title + ':' + (value[selectKey] || '');
116
+ }
117
+ var target = data === null || data === void 0 ? void 0 : data.find(function (item) {
118
+ var _a;
119
+ return ((_a = item.props) === null || _a === void 0 ? void 0 : _a.name) === key;
120
+ });
121
+ if (!target) return null;
122
+ var dataItem = (target === null || target === void 0 ? void 0 : target.props) || {};
123
+ var _ref4 = dataItem || {},
124
+ _ref4$type = _ref4.type,
125
+ type = _ref4$type === void 0 ? 'input' : _ref4$type,
126
+ setLabel = _ref4.setLabel,
127
+ fieldProps = _ref4.props,
128
+ propsTitle = _ref4.propsTitle,
129
+ title = _ref4.title,
130
+ name = _ref4.name;
131
+ var _propsTitle = propsTitle || title || name;
132
+ var _ref5 = fieldProps || {},
133
+ options = _ref5.options,
134
+ format = _ref5.format;
135
+ var labelValue = value;
136
+ if (setLabel) {
137
+ // setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制
138
+ labelValue = setLabel(value);
139
+ } else if (options) {
140
+ if (type === 'selectInput') {
141
+ var _selectKey = (_b = Object.keys(value || {})) === null || _b === void 0 ? void 0 : _b[0];
142
+ if (!_selectKey) {
143
+ // 17. inputSelect组件,初始值{},展示undefined:undefined
144
+ return false;
145
+ }
146
+ var inputValue = value[_selectKey];
147
+ var selectLabel = (_c = options === null || options === void 0 ? void 0 : options.find(function (v) {
148
+ return v.value === _selectKey;
149
+ })) === null || _c === void 0 ? void 0 : _c.label;
150
+ return selectLabel + ':' + inputValue;
151
+ }
152
+ labelValue = getLabelByValue({
153
+ value: value,
154
+ options: options,
155
+ fieldNames: ((_d = dataItem === null || dataItem === void 0 ? void 0 : dataItem.props) === null || _d === void 0 ? void 0 : _d.fieldNames) || {
156
+ label: 'label',
157
+ value: 'value'
158
+ }
159
+ });
160
+ } else if (type === 'checkbox') {
161
+ labelValue = value ? locale.yes : locale.no;
162
+ } else if (type === 'dateRange' && format) {
163
+ if (value === null || value === void 0 ? void 0 : value.length) {
164
+ labelValue = [(0, _moment["default"])(value === null || value === void 0 ? void 0 : value[0]).format(format), (0, _moment["default"])(value === null || value === void 0 ? void 0 : value[1]).format(format)].join('~');
165
+ }
166
+ } else if (type === 'date' && format) {
167
+ labelValue = value ? (0, _moment["default"])(value).format(format) : undefined;
168
+ }
169
+ return _propsTitle + ':' + (labelValue === undefined ? '' : labelValue);
170
+ }
171
+ var isInput = exports.isInput = function isInput(type) {
172
+ return ['input', 'string', 'search', 'aloneSearch', 'number', 'inputNumber', 'otherInput'].includes(type);
173
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/utils.js"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,mCAAmD;AACnD,oDAA2B;AAE3B,SAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS;IAC/C,MAAM,WAAW,GAAG,+BAA+B,SAAS,SAAS,CAAA;IACrE,OAAO,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AY,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AADvF,QAAA,OAAO,WACgF","sourcesContent":["import React from 'react'\nimport { isArray, isString, flatten } from 'lodash'\nimport moment from 'moment'\n\nexport function highlightSubstring(str, substring) {\n const highlighted = `<span class=\"tnt-highlight\">${substring}</span>`\n return str.replace(new RegExp(substring, 'g'), highlighted)\n}\n\nexport function getLabelByValue({\n value,\n options,\n fieldNames = {\n label: 'label',\n value: 'value',\n },\n}) {\n const getLabel = (value) => {\n const target = options?.find((item) => {\n const valueKey = fieldNames?.value\n const itemValue = item instanceof Object ? item[valueKey] : item\n return itemValue === value\n })\n if (target) {\n return target instanceof Object ? target?.[fieldNames?.label] : target\n } else {\n return value\n }\n }\n if (isArray(value)) {\n return value.map(getLabel).join(' | ')\n } else {\n return getLabel(value)\n }\n}\n\nexport function formatLabel(reactDom) {\n return flatten(\n React.Children.map(reactDom.props.children, (child) => {\n if (React.isValidElement(child)) {\n return formatLabel(child)\n } else if (isString(child)) {\n return child\n }\n return ''\n })\n ).join('')\n}\n\nexport function parseObjectToArray(value, data) {\n return Object.keys(value || {})\n ?.map((key) => {\n const target = data?.find((item) => item.props?.name === key || item.props?.pName === key)\n if (!target) return null\n const dataItem = target?.props || {}\n const { type = 'input', component, setLabel } = dataItem || {}\n if (!type && component && !setLabel) {\n console.error('自定义组件需要传入setLabel()方法')\n }\n return {\n key,\n value: value[key],\n }\n })\n ?.filter((item) => !!item)\n}\n\nexport function parseArrayToObject(value) {\n return value?.reduce((acc, v) => {\n acc[v.key] = v.value\n return acc\n }, {})\n}\n\nexport function getLabel({ key, value }, data, locale) {\n const otherTarget = data?.find((item) => item.props?.pName === key)\n if (otherTarget) {\n // otherInput\n const selectKey = Object.keys(value || {})?.[0]\n if (!selectKey) {\n // 17. inputSelect组件,初始值{},展示undefined:undefined\n return false\n }\n const otherTargetObj = data.find(\n (item) => item.props.pName === key && item.props.cName === selectKey\n )\n if (!otherTargetObj) {\n return false\n }\n return otherTargetObj.props.title + ':' + (value[selectKey] || '')\n }\n\n const target = data?.find((item) => item.props?.name === key)\n if (!target) return null\n const dataItem = target?.props || {}\n const { type = 'input', setLabel, props: fieldProps, propsTitle, title, name } = dataItem || {}\n const _propsTitle = propsTitle || title || name\n const { options, format } = fieldProps || {}\n let labelValue = value\n if (setLabel) {\n // setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制\n labelValue = setLabel(value)\n } else if (options) {\n if (type === 'selectInput') {\n const selectKey = Object.keys(value || {})?.[0]\n if (!selectKey) {\n // 17. inputSelect组件,初始值{},展示undefined:undefined\n return false\n }\n const inputValue = value[selectKey]\n const selectLabel = options?.find((v) => v.value === selectKey)?.label\n return selectLabel + ':' + inputValue\n }\n labelValue = getLabelByValue({\n value,\n options,\n fieldNames: dataItem?.props?.fieldNames || {\n label: 'label',\n value: 'value',\n },\n })\n } else if (type === 'checkbox') {\n labelValue = value ? locale.yes : locale.no\n } else if (type === 'dateRange' && format) {\n if (value?.length) {\n labelValue = [moment(value?.[0]).format(format), moment(value?.[1]).format(format)].join('~')\n }\n } else if (type === 'date' && format) {\n labelValue = value ? moment(value).format(format) : undefined\n }\n return _propsTitle + ':' + (labelValue === undefined ? '' : labelValue)\n}\n\nexport const isInput = (type) =>\n ['input', 'string', 'search', 'aloneSearch', 'number', 'inputNumber', 'otherInput'].includes(type)\n"]}
@@ -0,0 +1,133 @@
1
+ .tnt-queryform {
2
+ display: flex;
3
+
4
+ &-extra {
5
+ line-height: 32px;
6
+ margin-left: 12px;
7
+ & > * {
8
+ margin-left: 8px;
9
+ }
10
+ }
11
+
12
+ &-actions {
13
+ align-items: center;
14
+ display: inline-block;
15
+ height: 32px;
16
+ line-height: 32px;
17
+
18
+ & > *:not(.expand-link) {
19
+ margin-right: 10px;
20
+ }
21
+ & > .expand-link {
22
+ padding: 0;
23
+ margin-right: 0;
24
+ }
25
+ & > .ant-badge {
26
+ .tnt-icon {
27
+ margin-right: 8px;
28
+ }
29
+ }
30
+ }
31
+
32
+ .ant-form {
33
+ display: inline-block;
34
+ margin-bottom: 12px;
35
+ display: flex;
36
+ flex: 1;
37
+ &.ant-form-inline {
38
+ flex-wrap: unset;
39
+ }
40
+
41
+ & > div:nth-child(1) {
42
+ height: 32px;
43
+ overflow: hidden;
44
+ .ant-form-item-label {
45
+ label {
46
+ // bottom: 4px;
47
+ }
48
+ }
49
+ }
50
+
51
+ &.expanded {
52
+ & > div:nth-child(1) {
53
+ height: auto !important;
54
+ }
55
+ }
56
+
57
+ &.showMore {
58
+ & > div:nth-child(1) {
59
+ .ant-form-item {
60
+ margin-bottom: 12px;
61
+ }
62
+ }
63
+ }
64
+
65
+ & > div:nth-child(2) {
66
+ display: flex;
67
+ }
68
+
69
+ &.ant-form-inline .ant-form-item {
70
+ margin-right: 10px;
71
+ display: inline-block;
72
+ }
73
+
74
+ .ant-form-item-control {
75
+ // min-width: 160px;
76
+ line-height: unset;
77
+ .ant-calendar-picker-input {
78
+ padding: 0 11px;
79
+ }
80
+ .ant-form-item-children {
81
+ & > .ant-input,
82
+ & > .ant-input-affix-wrapper {
83
+ width: 160px;
84
+ // width: 200px;
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ &-drawer {
91
+ margin-top: 50px;
92
+ &.large-size {
93
+ margin-top: 60px;
94
+ }
95
+
96
+ &.ant-drawer.ant-drawer-open {
97
+ .ant-drawer-mask {
98
+ opacity: 0;
99
+ background: unset;
100
+ }
101
+ }
102
+ .ant-drawer-body {
103
+ .ant-form-item {
104
+ display: block;
105
+ margin-right: 0;
106
+ margin-bottom: 20px;
107
+ width: 100%;
108
+ }
109
+ .ant-form-item-label {
110
+ display: block;
111
+ text-align: left;
112
+ line-height: 22px;
113
+ margin-bottom: 10px;
114
+ }
115
+ .ant-form-item-control-wrapper,
116
+ .ant-form-item-control,
117
+ .ant-calendar-picker,
118
+ .ant-input {
119
+ min-width: 100%;
120
+ width: 100%;
121
+ }
122
+
123
+ & > .ant-btn {
124
+ display: block;
125
+ width: 100%;
126
+ margin-bottom: 10px;
127
+ &.ant-btn-primary {
128
+ margin-top: 20px;
129
+ }
130
+ }
131
+ }
132
+ }
133
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tntd",
3
- "version": "3.0.66",
3
+ "version": "3.0.67",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "start": "heft start --storybook",
@@ -113,4 +113,4 @@
113
113
  "main": "lib/index.js",
114
114
  "module": "es/index.js",
115
115
  "typings": "lib/index.d.ts"
116
- }
116
+ }
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- require("react");
8
- var _checkbox = _interopRequireDefault(require("antd/es/checkbox"));
9
- var _connect = require("../connect");
10
- var _previewText = require("../preview-text");
11
- function _interopRequireDefault(e) {
12
- return e && e.__esModule ? e : {
13
- "default": e
14
- };
15
- }
16
- var _default = exports["default"] = (0, _connect.connectReadonlyComponent)(_checkbox["default"].Group, _previewText.PreviewText.Select);
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkbox-group.js","sourceRoot":"","sources":["../../src/checkbox/checkbox-group.tsx"],"names":[],"mappings":"AAAA,OAAkC,OAAO,CAAA;AACzC,OAAO,QAAQ,MAAM,kBAAkB,CAAA;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAM7C,eAAe,wBAAwB,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA","sourcesContent":["import React, { forwardRef } from 'react'\nimport Checkbox from 'antd/es/checkbox'\nimport type { CheckboxGroupProps as AntdCheckboxGroupProps } from 'antd/es/checkbox/Group'\nimport { connectReadonlyComponent } from '../connect'\nimport { PreviewText } from '../preview-text'\n\nexport type CheckboxGroupProps = AntdCheckboxGroupProps & {\n readonly?: boolean\n}\n\nexport default connectReadonlyComponent(Checkbox.Group, PreviewText.Select)\n"]}
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- require("react");
8
- var _radio = _interopRequireDefault(require("antd/es/radio"));
9
- var _connect = require("../connect");
10
- var _previewText = _interopRequireDefault(require("../preview-text"));
11
- function _interopRequireDefault(e) {
12
- return e && e.__esModule ? e : {
13
- "default": e
14
- };
15
- }
16
- var _default = exports["default"] = (0, _connect.connectReadonlyComponent)(_radio["default"].Group, _previewText["default"].Select);
@@ -1 +0,0 @@
1
- {"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../src/radio/radio-group.tsx"],"names":[],"mappings":"AAAA,OAAkB,OAAO,CAAA;AAEzB,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,WAAW,MAAM,iBAAiB,CAAA;AAMzC,eAAe,wBAAwB,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport type { RadioGroupProps as AntdRadioGroupProps } from 'antd/es/radio'\nimport Radio from 'antd/es/radio'\nimport { connectReadonlyComponent } from '../connect'\nimport PreviewText from '../preview-text'\n\nexport type RadioGroupProps = AntdRadioGroupProps & {\n readonly?: boolean\n}\n\nexport default connectReadonlyComponent(Radio.Group, PreviewText.Select)\n"]}
@@ -1,5 +0,0 @@
1
- .@{steps-prefix-cls}-small {
2
- .@{steps-prefix-cls}-item-title {
3
- padding-right: 10px;
4
- }
5
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TotalShower = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _utils = require("../utils");
9
- function _interopRequireDefault(e) {
10
- return e && e.__esModule ? e : {
11
- "default": e
12
- };
13
- }
14
- var TotalShower = exports.TotalShower = function TotalShower(_ref) {
15
- var total = _ref.total,
16
- locale = _ref.locale;
17
- return _react["default"].createElement(_react["default"].Fragment, null, (0, _utils.simpleTemplate)(locale.total, {
18
- total: total
19
- }));
20
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"total-shower.js","sourceRoot":"","sources":["../../src/table/total-shower.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,MAAM,GAMP,EAAE,EAAE;IACH,OAAO,0CAAG,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAI,CAAA;AACvD,CAAC,CAAA","sourcesContent":["import React from 'react'\n\nimport type { TableProps as AntdTableProps } from 'antd/es/table'\nimport { simpleTemplate } from '../utils'\n\nexport const TotalShower = ({\n total,\n locale,\n}: {\n total: number\n locale: AntdTableProps<unknown>['locale'] & {\n total?: string\n }\n}) => {\n return <>{simpleTemplate(locale.total, { total })}</>\n}\n"]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.simpleTemplate = simpleTemplate;
7
- /**
8
- * 简单的模板替换
9
- *
10
- * @param template
11
- * @param data
12
- * @returns
13
- */
14
- function simpleTemplate(template) {
15
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16
- return template === null || template === void 0 ? void 0 : template.replace(/\${(.*?)}/g, function (match, key) {
17
- return data[key.trim()].toString();
18
- });
19
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"simple-template.js","sourceRoot":"","sources":["../../src/utils/simple-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,QAAiB,EAAE,OAAwC,EAAE;IAC1F,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;AACrF,CAAC","sourcesContent":["/**\n * 简单的模板替换\n *\n * @param template\n * @param data\n * @returns\n */\nexport function simpleTemplate(template?: string, data: Record<string, string | number> = {}) {\n return template?.replace(/\\${(.*?)}/g, (match, key) => data[key.trim()].toString())\n}\n"]}
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { CheckboxGroupProps as AntdCheckboxGroupProps } from 'antd/lib/checkbox/Group';
3
- export declare type CheckboxGroupProps = AntdCheckboxGroupProps & {
4
- readonly?: boolean;
5
- };
6
- declare const _default: React.ForwardRefExoticComponent<AntdCheckboxGroupProps & React.RefAttributes<unknown>>;
7
- export default _default;
8
- //# sourceMappingURL=checkbox-group.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../src/checkbox/checkbox-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,kBAAkB,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAI1F,oBAAY,kBAAkB,GAAG,sBAAsB,GAAG;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;;AAED,wBAA2E"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- require("react");
8
- var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
9
- var _connect = require("../connect");
10
- var _previewText = require("../preview-text");
11
- function _interopRequireDefault(e) {
12
- return e && e.__esModule ? e : {
13
- "default": e
14
- };
15
- }
16
- var _default = exports["default"] = (0, _connect.connectReadonlyComponent)(_checkbox["default"].Group, _previewText.PreviewText.Select);
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkbox-group.js","sourceRoot":"","sources":["../../src/checkbox/checkbox-group.tsx"],"names":[],"mappings":";;;;;AAAA,iBAAyC;AACzC,gEAAuC;AAEvC,wCAAqD;AACrD,kDAA6C;AAM7C,kBAAe,IAAA,kCAAwB,EAAC,kBAAQ,CAAC,KAAK,EAAE,0BAAW,CAAC,MAAM,CAAC,CAAA","sourcesContent":["import React, { forwardRef } from 'react'\nimport Checkbox from 'antd/lib/checkbox'\nimport type { CheckboxGroupProps as AntdCheckboxGroupProps } from 'antd/lib/checkbox/Group'\nimport { connectReadonlyComponent } from '../connect'\nimport { PreviewText } from '../preview-text'\n\nexport type CheckboxGroupProps = AntdCheckboxGroupProps & {\n readonly?: boolean\n}\n\nexport default connectReadonlyComponent(Checkbox.Group, PreviewText.Select)\n"]}
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { RadioGroupProps as AntdRadioGroupProps } from 'antd/lib/radio';
3
- export declare type RadioGroupProps = AntdRadioGroupProps & {
4
- readonly?: boolean;
5
- };
6
- declare const _default: React.ForwardRefExoticComponent<AntdRadioGroupProps & React.RefAttributes<unknown>>;
7
- export default _default;
8
- //# sourceMappingURL=radio-group.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../src/radio/radio-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAK3E,oBAAY,eAAe,GAAG,mBAAmB,GAAG;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;;AAED,wBAAwE"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- require("react");
8
- var _radio = _interopRequireDefault(require("antd/lib/radio"));
9
- var _connect = require("../connect");
10
- var _previewText = _interopRequireDefault(require("../preview-text"));
11
- function _interopRequireDefault(e) {
12
- return e && e.__esModule ? e : {
13
- "default": e
14
- };
15
- }
16
- var _default = exports["default"] = (0, _connect.connectReadonlyComponent)(_radio["default"].Group, _previewText["default"].Select);
@@ -1 +0,0 @@
1
- {"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../src/radio/radio-group.tsx"],"names":[],"mappings":";;;;;AAAA,iBAAyB;AAEzB,0DAAiC;AACjC,wCAAqD;AACrD,mEAAyC;AAMzC,kBAAe,IAAA,kCAAwB,EAAC,eAAK,CAAC,KAAK,EAAE,sBAAW,CAAC,MAAM,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport type { RadioGroupProps as AntdRadioGroupProps } from 'antd/lib/radio'\nimport Radio from 'antd/lib/radio'\nimport { connectReadonlyComponent } from '../connect'\nimport PreviewText from '../preview-text'\n\nexport type RadioGroupProps = AntdRadioGroupProps & {\n readonly?: boolean\n}\n\nexport default connectReadonlyComponent(Radio.Group, PreviewText.Select)\n"]}
@@ -1,5 +0,0 @@
1
- .@{steps-prefix-cls}-small {
2
- .@{steps-prefix-cls}-item-title {
3
- padding-right: 10px;
4
- }
5
- }
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import type { TableProps as AntdTableProps } from 'antd/lib/table';
3
- export declare const TotalShower: ({ total, locale, }: {
4
- total: number;
5
- locale: import("antd/lib/table").TableLocale & {
6
- total?: string | undefined;
7
- };
8
- }) => React.JSX.Element;
9
- //# sourceMappingURL=total-shower.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"total-shower.d.ts","sourceRoot":"","sources":["../../src/table/total-shower.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,eAAe,CAAA;AAGjE,eAAO,MAAM,WAAW;WAIf,MAAM;;;;uBAMd,CAAA"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TotalShower = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _utils = require("../utils");
9
- function _interopRequireDefault(e) {
10
- return e && e.__esModule ? e : {
11
- "default": e
12
- };
13
- }
14
- var TotalShower = exports.TotalShower = function TotalShower(_ref) {
15
- var total = _ref.total,
16
- locale = _ref.locale;
17
- return _react["default"].createElement(_react["default"].Fragment, null, (0, _utils.simpleTemplate)(locale.total, {
18
- total: total
19
- }));
20
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"total-shower.js","sourceRoot":"","sources":["../../src/table/total-shower.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAGzB,oCAAyC;AAElC,MAAM,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,MAAM,GAMP,EAAE,EAAE;IACH,OAAO,8DAAG,IAAA,sBAAc,EAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAI,CAAA;AACvD,CAAC,CAAA;AAVY,QAAA,WAAW,eAUvB","sourcesContent":["import React from 'react'\n\nimport type { TableProps as AntdTableProps } from 'antd/lib/table'\nimport { simpleTemplate } from '../utils'\n\nexport const TotalShower = ({\n total,\n locale,\n}: {\n total: number\n locale: AntdTableProps<unknown>['locale'] & {\n total?: string\n }\n}) => {\n return <>{simpleTemplate(locale.total, { total })}</>\n}\n"]}
@@ -1,9 +0,0 @@
1
- /**
2
- * 简单的模板替换
3
- *
4
- * @param template
5
- * @param data
6
- * @returns
7
- */
8
- export declare function simpleTemplate(template?: string, data?: Record<string, string | number>): string | undefined;
9
- //# sourceMappingURL=simple-template.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"simple-template.d.ts","sourceRoot":"","sources":["../../src/utils/simple-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAM,sBAE3F"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.simpleTemplate = simpleTemplate;
7
- /**
8
- * 简单的模板替换
9
- *
10
- * @param template
11
- * @param data
12
- * @returns
13
- */
14
- function simpleTemplate(template) {
15
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16
- return template === null || template === void 0 ? void 0 : template.replace(/\${(.*?)}/g, function (match, key) {
17
- return data[key.trim()].toString();
18
- });
19
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"simple-template.js","sourceRoot":"","sources":["../../src/utils/simple-template.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,QAAiB,EAAE,OAAwC,EAAE;IAC1F,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;AACrF,CAAC;AAFD,wCAEC","sourcesContent":["/**\n * 简单的模板替换\n *\n * @param template\n * @param data\n * @returns\n */\nexport function simpleTemplate(template?: string, data: Record<string, string | number> = {}) {\n return template?.replace(/\\${(.*?)}/g, (match, key) => data[key.trim()].toString())\n}\n"]}