@jswork/antd-components 1.0.210 → 1.0.212

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jswork/antd-components",
3
- "version": "1.0.210",
3
+ "version": "1.0.212",
4
4
  "main": "dist/main.cjs.js",
5
5
  "module": "dist/main.esm.js",
6
6
  "types": "dist/main.d.ts",
@@ -0,0 +1,50 @@
1
+ import { Typography } from 'antd';
2
+ import { ValueType } from 'rc-input/lib/interface';
3
+ import React from 'react';
4
+ import { AcInput, AcInputProps } from './input';
5
+
6
+ const CLASS_NAME = 'ac-input-copyable';
7
+
8
+ interface AcInputCopyableState {
9
+ value?: ValueType;
10
+ }
11
+
12
+ export class AcInputCopyable extends React.Component<AcInputProps, AcInputCopyableState> {
13
+ static displayName = CLASS_NAME;
14
+ static formSchema = CLASS_NAME;
15
+ static defaultProps = {};
16
+
17
+ constructor(props) {
18
+ super(props);
19
+ this.state = {
20
+ value: props.value || '',
21
+ };
22
+ }
23
+
24
+ get copyView() {
25
+ const { value } = this.state;
26
+ return <Typography.Text copyable={{ text: String(value) }} />;
27
+ }
28
+
29
+ shouldComponentUpdate(props: Readonly<AcInputProps>): boolean {
30
+ const { value } = props;
31
+ if (value !== this.props.value) this.setState({ value });
32
+ return true;
33
+ }
34
+
35
+ handleInputChange = (e) => {
36
+ const { onChange } = this.props;
37
+ const { value } = e.target;
38
+ this.setState({ value });
39
+ onChange?.(e);
40
+ };
41
+
42
+ render() {
43
+ const { onChange, ...rest } = this.props;
44
+ return <AcInput onChange={this.handleInputChange} {...rest} addonAfter={this.copyView} />;
45
+ }
46
+ }
47
+
48
+ export const AcInputCopyableFc = (props: AcInputProps) => {
49
+ return <AcInputCopyable {...props} />;
50
+ };
package/src/main.ts CHANGED
@@ -1,7 +1,3 @@
1
- import { breadcrumbDefault } from './tpls/breadcrumb';
2
- import { kv, checkboxKv, radioKv, treeKv, selectKv, treeSelectKv } from './tpls/kv';
3
- import { raw, checkboxRaw, radioRaw, selectRaw } from './tpls/raw';
4
- import { transferLabel } from './tpls/transfer';
5
1
  import { AcBreadcrumb } from './lib/breadcrumb';
6
2
  import { AcCheckableDropdown } from './lib/checkable-dropdown';
7
3
  import { AcCheckableTag, AcCheckableTagFc } from './lib/checkable-tag';
@@ -13,6 +9,7 @@ import { AcConfirmButton } from './lib/confirm-button';
13
9
  import { AcDatePicker, AcDatePickerFc } from './lib/date-picker';
14
10
  import { AcEditableTagGroup, AcEditableTagGroupFc } from './lib/editable-tag-group';
15
11
  import { AcInput, AcInputFc } from './lib/input';
12
+ import { AcInputCopyable, AcInputCopyableFc } from './lib/input-copyable';
16
13
  import { AcInputHidden, AcInputHiddenFc } from './lib/input-hidden';
17
14
  import { AcInputNumber, AcInputNumberFc } from './lib/input-number';
18
15
  import { AcInputTags, AcInputTagsFc } from './lib/input-tags';
@@ -32,10 +29,14 @@ import { AcTimePicker, AcTimePickerFc } from './lib/time-picker';
32
29
  import { AcTransfer, AcTransferFc } from './lib/transfer';
33
30
  import { AcTree } from './lib/tree';
34
31
  import { AcTreeSelect, AcTreeSelectFc } from './lib/tree-select';
32
+ import { AcUpload, AcUploadFc } from './lib/upload';
35
33
  import { AcUploadDragger, AcUploadDraggerFc } from './lib/upload-dragger';
36
34
  import { AcUploadPicture, AcUploadPictureFc } from './lib/upload-picture';
37
35
  import { AcUploadPictureCard, AcUploadPictureCardFc } from './lib/upload-picture-card';
38
- import { AcUpload, AcUploadFc } from './lib/upload';
36
+ import { breadcrumbDefault } from './tpls/breadcrumb';
37
+ import { checkboxKv, kv, radioKv, selectKv, treeKv, treeSelectKv } from './tpls/kv';
38
+ import { checkboxRaw, radioRaw, raw, selectRaw } from './tpls/raw';
39
+ import { transferLabel } from './tpls/transfer';
39
40
 
40
41
  import type { AcBreadcrumbProps } from './lib/breadcrumb';
41
42
  import type { AcCheckableDropdownProps } from './lib/checkable-dropdown';
@@ -59,169 +60,166 @@ import type { AcSelectProps } from './lib/select';
59
60
  import type { AcSliderProps } from './lib/slider';
60
61
  import type { AcSliderRangeProps } from './lib/slider-range';
61
62
  import type { AcSwitchProps } from './lib/switch';
63
+ import type { AcTableProps } from './lib/table';
62
64
  import type { AcTextareaProps } from './lib/textarea';
63
65
  import type { AcTimePickerProps } from './lib/time-picker';
64
66
  import type { AcTransferProps } from './lib/transfer';
65
67
  import type { AcTreeProps } from './lib/tree';
66
68
  import type { AcTreeSelectProps } from './lib/tree-select';
67
- import type { AcUploadDraggerProps } from './lib/upload-dragger';
68
69
  import type { AcUploadProps } from './lib/upload';
69
- import type { AcTableProps } from './lib/table';
70
+ import type { AcUploadDraggerProps } from './lib/upload-dragger';
70
71
 
71
72
  import '@jswork/next';
72
73
  import './lib/alert';
73
74
 
74
75
  // commands
75
- import useTableCommand from './lib/use-table-command';
76
- import { AcTableLinks } from './lib/table-links';
77
- import type { AcTableLinksProps } from './lib/table-links';
78
- import { AcCardExtras } from './lib/card-extras';
79
76
  import type { AcCardExtrasProps } from './lib/card-extras';
80
- import { initWidgets } from './lib/init-widgets';
81
- import { FormActions } from './lib/form-actions';
82
- import type { FormActionsProps } from './lib/form-actions';
83
- import { AcExtraSearch } from './lib/extra-search';
77
+ import { AcCardExtras } from './lib/card-extras';
84
78
  import type { AcExtraSearchProps } from './lib/extra-search';
85
- import { AcTableStatusSwitcher } from './lib/table-status-switcher';
79
+ import { AcExtraSearch } from './lib/extra-search';
80
+ import type { FormActionsProps } from './lib/form-actions';
81
+ import { FormActions } from './lib/form-actions';
82
+ import { initWidgets } from './lib/init-widgets';
83
+ import type { AcTableLinksProps } from './lib/table-links';
84
+ import { AcTableLinks } from './lib/table-links';
86
85
  import type { AcTableStatusSwitcherProps } from './lib/table-status-switcher';
87
- import { AcTableToggleSwitcher } from './lib/table-toggle-switcher';
86
+ import { AcTableStatusSwitcher } from './lib/table-status-switcher';
88
87
  import type { AcTableToggleSwitcherProps } from './lib/table-toggle-switcher';
88
+ import { AcTableToggleSwitcher } from './lib/table-toggle-switcher';
89
+ import useTableCommand from './lib/use-table-command';
89
90
 
90
91
  export * from './lib/button';
91
92
 
92
93
  // export all templates
93
94
  export {
94
- // breadcrumb
95
- breadcrumbDefault,
96
- // kv
97
- kv,
98
- checkboxKv,
99
- radioKv,
100
- treeKv,
101
- selectKv,
102
- treeSelectKv,
103
- // raw
104
- raw,
105
- checkboxRaw,
106
- radioRaw,
107
- selectRaw,
108
- // transfer
109
- transferLabel,
110
-
111
95
  // --- components ---
112
96
  AcBreadcrumb,
97
+ // ---- types ----
98
+ AcBreadcrumbProps,
99
+ AcCardExtras,
100
+ AcCardExtrasProps,
113
101
  AcCheckableDropdown,
102
+ AcCheckableDropdownProps,
114
103
  AcCheckableTag,
104
+ // --- fc components ---
105
+ AcCheckableTagFc,
115
106
  AcCheckableTagList,
107
+ AcCheckableTagListFc,
108
+ AcCheckableTagListProps,
109
+ AcCheckableTagProps,
116
110
  AcCheckbox,
111
+ AcCheckboxFc,
117
112
  AcCheckboxGroup,
113
+ AcCheckboxGroupFc,
114
+ AcCheckboxGroupProps,
115
+ AcCheckboxProps,
118
116
  AcCodeFlask,
117
+ AcCodeFlaskFc,
119
118
  AcConfirmButton,
119
+ AcConfirmButtonProps,
120
120
  AcDatePicker,
121
+ AcDatePickerFc,
122
+ AcDatePickerProps,
121
123
  AcEditableTagGroup,
124
+ AcEditableTagGroupFc,
125
+ AcEditableTagGroupProps,
126
+ AcExtraSearch,
127
+ AcExtraSearchProps,
122
128
  AcInput,
129
+ AcInputCopyable,
130
+ AcInputCopyableFc,
131
+ AcInputFc,
123
132
  AcInputHidden,
133
+ AcInputHiddenFc,
124
134
  AcInputNumber,
135
+ AcInputNumberFc,
136
+ AcInputNumberProps,
137
+ AcInputProps,
125
138
  AcInputTags,
139
+ AcInputTagsFc,
140
+ AcInputTagsProps,
126
141
  AcInputToken,
142
+ AcInputTokenFc,
143
+ AcInputTokenProps,
127
144
  AcPreSelect,
145
+ AcPreSelectFc,
146
+ AcPreSelectProps,
128
147
  AcRadioGroup,
148
+ AcRadioGroupFc,
149
+ AcRadioGroupProps,
129
150
  AcRangePicker,
151
+ AcRangePickerFc,
152
+ AcRangePickerProps,
130
153
  AcRate,
154
+ AcRateFc,
155
+ AcRateProps,
131
156
  AcSearch,
157
+ AcSearchFc,
158
+ AcSearchProps,
132
159
  AcSelect,
160
+ AcSelectFc,
161
+ AcSelectProps,
133
162
  AcSlider,
163
+ AcSliderFc,
164
+ AcSliderProps,
134
165
  AcSliderRange,
166
+ AcSliderRangeFc,
167
+ AcSliderRangeProps,
135
168
  AcSwitch,
169
+ AcSwitchFc,
170
+ AcSwitchProps,
136
171
  AcTable,
137
172
  AcTableLinks,
138
- AcCardExtras,
173
+ AcTableLinksProps,
174
+ AcTableProps,
175
+ AcTableStatusSwitcher,
176
+ AcTableStatusSwitcherProps,
177
+ AcTableToggleSwitcher,
178
+ AcTableToggleSwitcherProps,
139
179
  AcTextarea,
180
+ AcTextareaFc,
181
+ AcTextareaProps,
140
182
  AcTimePicker,
183
+ AcTimePickerFc,
184
+ AcTimePickerProps,
141
185
  AcTransfer,
186
+ AcTransferFc,
187
+ AcTransferProps,
142
188
  AcTree,
189
+ AcTreeProps,
143
190
  AcTreeSelect,
191
+ AcTreeSelectFc,
192
+ AcTreeSelectProps,
193
+ AcUpload,
144
194
  AcUploadDragger,
195
+ AcUploadDraggerFc,
196
+ AcUploadDraggerProps,
197
+ AcUploadFc,
145
198
  AcUploadPicture,
146
199
  AcUploadPictureCard,
147
- AcUpload,
148
-
149
- // --- fc components ---
150
- AcCheckableTagFc,
151
- AcCheckableTagListFc,
152
- AcCheckboxFc,
153
- AcCheckboxGroupFc,
154
- AcCodeFlaskFc,
155
- AcDatePickerFc,
156
- AcEditableTagGroupFc,
157
- AcInputFc,
158
- AcInputHiddenFc,
159
- AcInputNumberFc,
160
- AcInputTagsFc,
161
- AcInputTokenFc,
162
- AcPreSelectFc,
163
- AcRadioGroupFc,
164
- AcRangePickerFc,
165
- AcRateFc,
166
- AcSearchFc,
167
- AcSelectFc,
168
- AcSliderFc,
169
- AcSliderRangeFc,
170
- AcSwitchFc,
171
- AcTextareaFc,
172
- AcTimePickerFc,
173
- AcTransferFc,
174
- AcTreeSelectFc,
175
- AcUploadDraggerFc,
176
- AcUploadPictureFc,
177
200
  AcUploadPictureCardFc,
178
- AcUploadFc,
179
- FormActions,
180
- AcExtraSearch,
181
- AcTableStatusSwitcher,
182
- AcTableToggleSwitcher,
183
-
184
- // ---- commands ----
185
- useTableCommand,
186
-
187
- // ---- types ----
188
- AcBreadcrumbProps,
189
- AcCheckableDropdownProps,
190
- AcCheckableTagProps,
191
- AcCheckableTagListProps,
192
- AcCheckboxProps,
193
- AcCheckboxGroupProps,
194
- AcConfirmButtonProps,
195
- AcDatePickerProps,
196
- AcEditableTagGroupProps,
197
- AcInputProps,
198
- AcInputNumberProps,
199
- AcInputTagsProps,
200
- AcInputTokenProps,
201
- AcPreSelectProps,
202
- AcRadioGroupProps,
203
- AcRangePickerProps,
204
- AcRateProps,
205
- AcSearchProps,
206
- AcSelectProps,
207
- AcSliderProps,
208
- AcSliderRangeProps,
209
- AcSwitchProps,
210
- AcTableProps,
211
- AcTableLinksProps,
212
- AcCardExtrasProps,
213
- AcTextareaProps,
214
- AcTimePickerProps,
215
- AcTransferProps,
216
- AcTreeProps,
217
- AcTreeSelectProps,
218
- AcUploadDraggerProps,
201
+ AcUploadPictureFc,
219
202
  AcUploadProps,
203
+ // breadcrumb
204
+ breadcrumbDefault,
205
+ checkboxKv,
206
+ checkboxRaw,
207
+ FormActions,
220
208
  FormActionsProps,
221
- AcExtraSearchProps,
222
- AcTableStatusSwitcherProps,
223
- AcTableToggleSwitcherProps,
224
-
225
209
  // ---- widgets ----
226
210
  initWidgets,
211
+ // kv
212
+ kv,
213
+ radioKv,
214
+ radioRaw,
215
+ // raw
216
+ raw,
217
+ selectKv,
218
+ selectRaw,
219
+ // transfer
220
+ transferLabel,
221
+ treeKv,
222
+ treeSelectKv,
223
+ // ---- commands ----
224
+ useTableCommand,
227
225
  };