@pdfme/ui 5.3.11-dev.12 → 5.3.11-dev.14
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/index.es.js +170 -146
- package/package.json +1 -1
- package/src/components/AppContextProvider.tsx +8 -2
- package/src/components/Designer/Canvas/Moveable.tsx +8 -4
- package/src/components/Designer/Canvas/Selecto.tsx +4 -1
- package/src/components/Designer/Canvas/index.tsx +20 -20
- package/src/components/Designer/PluginIcon.tsx +10 -9
- package/src/components/Designer/RightSidebar/DetailView/AlignWidget.tsx +74 -63
- package/src/components/Designer/RightSidebar/DetailView/ButtonGroupWidget.tsx +2 -3
- package/src/components/Designer/RightSidebar/DetailView/index.tsx +80 -69
- package/src/components/Designer/RightSidebar/ListView/Item.tsx +89 -91
- package/src/components/Designer/RightSidebar/ListView/SelectableSortableContainer.tsx +18 -17
- package/src/components/Designer/RightSidebar/ListView/SelectableSortableItem.tsx +16 -15
- package/src/components/Designer/index.tsx +1 -1
- package/src/components/Renderer.tsx +2 -2
- package/src/helper.ts +34 -29
@@ -24,34 +24,44 @@ const AlignWidget = (props: PropPanelWidgetProps) => {
|
|
24
24
|
const tgtSize = isVertical ? 'width' : 'height';
|
25
25
|
const isSingle = ass.length === 1;
|
26
26
|
// Access pageSize property safely with proper type assertion
|
27
|
-
const root =
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
const root =
|
28
|
+
pageSize && typeof pageSize === 'object'
|
29
|
+
? tgtSize === 'width'
|
30
|
+
? (pageSize as unknown as { width: number }).width
|
31
|
+
: (pageSize as unknown as { height: number }).height
|
32
|
+
: 0;
|
31
33
|
|
32
34
|
// Access position properties safely with proper type assertion
|
33
|
-
const min = isSingle
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
35
|
+
const min = isSingle
|
36
|
+
? 0
|
37
|
+
: Math.min(
|
38
|
+
...ass.map((as) => {
|
39
|
+
// Safely access position property with proper type assertion
|
40
|
+
const position =
|
41
|
+
as.position && typeof as.position === 'object'
|
42
|
+
? (as.position as unknown as { x: number; y: number })
|
43
|
+
: { x: 0, y: 0 };
|
44
|
+
return tgtPos === 'x' ? position.x : position.y;
|
45
|
+
}),
|
46
|
+
);
|
47
|
+
const max = isSingle
|
48
|
+
? root
|
49
|
+
: Math.max(
|
50
|
+
...ass.map((as) => {
|
51
|
+
// Safely access position and size properties with proper type assertion
|
52
|
+
const position =
|
53
|
+
as.position && typeof as.position === 'object'
|
54
|
+
? (as.position as unknown as { x: number; y: number })
|
55
|
+
: { x: 0, y: 0 };
|
56
|
+
const posValue = tgtPos === 'x' ? position.x : position.y;
|
57
|
+
|
58
|
+
// Safely access width/height with proper type assertion
|
59
|
+
const asWithSize = as as unknown as { width?: number; height?: number };
|
60
|
+
const sizeValue = tgtSize === 'width' ? asWithSize.width || 0 : asWithSize.height || 0;
|
61
|
+
|
62
|
+
return posValue + sizeValue;
|
63
|
+
}),
|
64
|
+
);
|
55
65
|
|
56
66
|
let basePos = min;
|
57
67
|
// Define adjust function with consistent parameter usage
|
@@ -70,10 +80,8 @@ const AlignWidget = (props: PropPanelWidgetProps) => {
|
|
70
80
|
ass.map((as) => {
|
71
81
|
// Safely access size property with proper type assertion
|
72
82
|
const asWithSize = as as unknown as { width?: number; height?: number; id: string };
|
73
|
-
const sizeValue = tgtSize === 'width' ?
|
74
|
-
|
75
|
-
(asWithSize.height || 0);
|
76
|
-
|
83
|
+
const sizeValue = tgtSize === 'width' ? asWithSize.width || 0 : asWithSize.height || 0;
|
84
|
+
|
77
85
|
return {
|
78
86
|
key: `position.${tgtPos}`,
|
79
87
|
value: round(basePos - adjust(sizeValue), 2),
|
@@ -90,30 +98,34 @@ const AlignWidget = (props: PropPanelWidgetProps) => {
|
|
90
98
|
const isVertical = type === 'vertical';
|
91
99
|
const tgtPos = isVertical ? 'y' : 'x';
|
92
100
|
const tgtSize = isVertical ? 'height' : 'width';
|
93
|
-
|
101
|
+
|
94
102
|
// Safely access position property with proper type assertion
|
95
|
-
const min = Math.min(
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
103
|
+
const min = Math.min(
|
104
|
+
...ass.map((as) => {
|
105
|
+
const position =
|
106
|
+
as.position && typeof as.position === 'object'
|
107
|
+
? (as.position as unknown as { x: number; y: number })
|
108
|
+
: { x: 0, y: 0 };
|
109
|
+
return tgtPos === 'x' ? position.x : position.y;
|
110
|
+
}),
|
111
|
+
);
|
112
|
+
|
102
113
|
// Safely access position and size properties with proper type assertion
|
103
|
-
const max = Math.max(
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
114
|
+
const max = Math.max(
|
115
|
+
...ass.map((as) => {
|
116
|
+
const position =
|
117
|
+
as.position && typeof as.position === 'object'
|
118
|
+
? (as.position as unknown as { x: number; y: number })
|
119
|
+
: { x: 0, y: 0 };
|
120
|
+
const posValue = tgtPos === 'x' ? position.x : position.y;
|
121
|
+
|
122
|
+
// Safely access width/height with proper type assertion
|
123
|
+
const asWithSize = as as unknown as { width?: number; height?: number };
|
124
|
+
const sizeValue = tgtSize === 'width' ? asWithSize.width || 0 : asWithSize.height || 0;
|
125
|
+
|
126
|
+
return posValue + sizeValue;
|
127
|
+
}),
|
128
|
+
);
|
117
129
|
|
118
130
|
if (ass.length < 3) return;
|
119
131
|
|
@@ -122,9 +134,7 @@ const AlignWidget = (props: PropPanelWidgetProps) => {
|
|
122
134
|
// Safely access size property with proper type assertion
|
123
135
|
const sum = ass.reduce((acc, cur) => {
|
124
136
|
const curWithSize = cur as unknown as { width?: number; height?: number };
|
125
|
-
const sizeValue = tgtSize === 'width' ?
|
126
|
-
(curWithSize.width || 0) :
|
127
|
-
(curWithSize.height || 0);
|
137
|
+
const sizeValue = tgtSize === 'width' ? curWithSize.width || 0 : curWithSize.height || 0;
|
128
138
|
return acc + sizeValue;
|
129
139
|
}, 0);
|
130
140
|
const remain = boxSize - sum;
|
@@ -134,16 +144,17 @@ const AlignWidget = (props: PropPanelWidgetProps) => {
|
|
134
144
|
changeSchemas(
|
135
145
|
ass.map((as, index) => {
|
136
146
|
// Safely access size property of previous element with proper type assertion
|
137
|
-
const prevSize =
|
138
|
-
|
139
|
-
|
140
|
-
(
|
141
|
-
|
142
|
-
|
143
|
-
|
147
|
+
const prevSize =
|
148
|
+
index === 0
|
149
|
+
? 0
|
150
|
+
: (() => {
|
151
|
+
const prevAs = ass[index - 1] as unknown as { width?: number; height?: number };
|
152
|
+
return tgtSize === 'width' ? prevAs.width || 0 : prevAs.height || 0;
|
153
|
+
})();
|
154
|
+
|
144
155
|
prev += index === 0 ? 0 : prevSize + unit;
|
145
156
|
const value = round(boxPos + prev, 2);
|
146
|
-
|
157
|
+
|
147
158
|
// Safely access id with proper type assertion
|
148
159
|
const asWithId = as as unknown as { id: string };
|
149
160
|
return { key: `position.${tgtPos}`, value, schemaId: asWithId.id };
|
@@ -35,9 +35,8 @@ const ButtonGroupWidget = (props: PropPanelWidgetProps) => {
|
|
35
35
|
ass.forEach((s: SchemaForUI) => {
|
36
36
|
// Cast schema to Record to safely access dynamic properties
|
37
37
|
const schemaRecord = s as Record<string, unknown>;
|
38
|
-
active =
|
39
|
-
? Boolean(schemaRecord[key] ?? false)
|
40
|
-
: schemaRecord[key] === btn.value;
|
38
|
+
active =
|
39
|
+
type === 'boolean' ? Boolean(schemaRecord[key] ?? false) : schemaRecord[key] === btn.value;
|
41
40
|
});
|
42
41
|
return active;
|
43
42
|
};
|
@@ -45,7 +45,7 @@ const DetailView = (props: DetailViewProps) => {
|
|
45
45
|
const i18n = useContext(I18nContext);
|
46
46
|
const pluginsRegistry = useContext(PluginsRegistry);
|
47
47
|
const options = useContext(OptionsContext);
|
48
|
-
|
48
|
+
|
49
49
|
// Define a type-safe i18n function that accepts string keys
|
50
50
|
const typedI18n = (key: string): string => {
|
51
51
|
// Use a type assertion to handle the union type constraint
|
@@ -109,22 +109,17 @@ const DetailView = (props: DetailViewProps) => {
|
|
109
109
|
// Reference to a function that validates schema name uniqueness
|
110
110
|
const uniqueSchemaName = useRef(
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
112
|
-
(_unused: string): boolean => true
|
112
|
+
(_unused: string): boolean => true,
|
113
113
|
);
|
114
114
|
|
115
115
|
// Use proper type for validator function parameter
|
116
|
-
const validateUniqueSchemaName = (
|
117
|
-
|
118
|
-
value: string
|
119
|
-
): boolean => uniqueSchemaName.current(value);
|
116
|
+
const validateUniqueSchemaName = (_: unknown, value: string): boolean =>
|
117
|
+
uniqueSchemaName.current(value);
|
120
118
|
|
121
119
|
// Use explicit type for debounce function that matches the expected signature
|
122
|
-
const handleWatch = debounce(function(...args: unknown[]) {
|
120
|
+
const handleWatch = debounce(function (...args: unknown[]) {
|
123
121
|
const formSchema = args[0] as Record<string, unknown>;
|
124
|
-
const formAndSchemaValuesDiffer = (
|
125
|
-
formValue: unknown,
|
126
|
-
schemaValue: unknown
|
127
|
-
): boolean => {
|
122
|
+
const formAndSchemaValuesDiffer = (formValue: unknown, schemaValue: unknown): boolean => {
|
128
123
|
if (typeof formValue === 'object' && formValue !== null) {
|
129
124
|
return JSON.stringify(formValue) !== JSON.stringify(schemaValue);
|
130
125
|
}
|
@@ -177,18 +172,19 @@ const DetailView = (props: DetailViewProps) => {
|
|
177
172
|
}, 100);
|
178
173
|
|
179
174
|
// Find the active plugin with proper type safety
|
180
|
-
const activePlugin = Object.values(pluginsRegistry).find(
|
181
|
-
(plugin)
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
175
|
+
const activePlugin = Object.values(pluginsRegistry).find((plugin) => {
|
176
|
+
if (!plugin || typeof plugin !== 'object') return false;
|
177
|
+
if (!plugin.propPanel || typeof plugin.propPanel !== 'object') return false;
|
178
|
+
if (!plugin.propPanel.defaultSchema || typeof plugin.propPanel.defaultSchema !== 'object')
|
179
|
+
return false;
|
180
|
+
|
181
|
+
const defaultSchema = plugin.propPanel.defaultSchema as Record<string, unknown>;
|
182
|
+
return (
|
183
|
+
'type' in defaultSchema &&
|
184
|
+
typeof defaultSchema.type === 'string' &&
|
185
|
+
defaultSchema.type === activeSchema.type
|
186
|
+
);
|
187
|
+
});
|
192
188
|
|
193
189
|
// Safely access the propPanel schema
|
194
190
|
const activePropPanelSchema = activePlugin?.propPanel?.schema;
|
@@ -200,7 +196,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
200
196
|
// Create type-safe options for the type dropdown
|
201
197
|
// Create a type-safe options array for the dropdown
|
202
198
|
const typeOptions: Array<{ label: string; value: string | undefined }> = [];
|
203
|
-
|
199
|
+
|
204
200
|
// Safely populate the options array
|
205
201
|
Object.entries(pluginsRegistry).forEach(([label, value]) => {
|
206
202
|
// Skip invalid plugins
|
@@ -208,58 +204,59 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
208
204
|
typeOptions.push({ label, value: undefined });
|
209
205
|
return;
|
210
206
|
}
|
211
|
-
|
212
|
-
if (!('propPanel' in value) ||
|
213
|
-
!value.propPanel ||
|
214
|
-
typeof value.propPanel !== 'object') {
|
207
|
+
|
208
|
+
if (!('propPanel' in value) || !value.propPanel || typeof value.propPanel !== 'object') {
|
215
209
|
typeOptions.push({ label, value: undefined });
|
216
210
|
return;
|
217
211
|
}
|
218
|
-
|
219
|
-
if (
|
220
|
-
|
221
|
-
|
212
|
+
|
213
|
+
if (
|
214
|
+
!('defaultSchema' in value.propPanel) ||
|
215
|
+
!value.propPanel.defaultSchema ||
|
216
|
+
typeof value.propPanel.defaultSchema !== 'object'
|
217
|
+
) {
|
222
218
|
typeOptions.push({ label, value: undefined });
|
223
219
|
return;
|
224
220
|
}
|
225
|
-
|
221
|
+
|
226
222
|
// Safely extract the type
|
227
223
|
const defaultSchema = value.propPanel.defaultSchema as Record<string, unknown>;
|
228
224
|
let schemaType: string | undefined = undefined;
|
229
|
-
|
225
|
+
|
230
226
|
if ('type' in defaultSchema && typeof defaultSchema.type === 'string') {
|
231
227
|
schemaType = defaultSchema.type;
|
232
228
|
}
|
233
|
-
|
229
|
+
|
234
230
|
typeOptions.push({ label, value: schemaType });
|
235
231
|
});
|
236
232
|
// Create a safe empty schema as fallback
|
237
233
|
const emptySchema: Record<string, unknown> = {};
|
238
|
-
|
234
|
+
|
239
235
|
// Safely access the default schema with proper null checking
|
240
|
-
const defaultSchema: Record<string, unknown> =
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
activePlugin.propPanel.defaultSchema === null
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
// Create a safe copy
|
251
|
-
const result: Record<string, unknown> = {};
|
252
|
-
|
253
|
-
// Only copy properties that exist on the object
|
254
|
-
for (const key in activePlugin.propPanel.defaultSchema) {
|
255
|
-
if (Object.prototype.hasOwnProperty.call(activePlugin.propPanel.defaultSchema, key)) {
|
256
|
-
result[key] = (activePlugin.propPanel.defaultSchema as Record<string, unknown>)[key];
|
236
|
+
const defaultSchema: Record<string, unknown> = activePlugin?.propPanel?.defaultSchema
|
237
|
+
? // Create a safe copy of the schema
|
238
|
+
(() => {
|
239
|
+
// First check if the defaultSchema is an object
|
240
|
+
if (
|
241
|
+
typeof activePlugin.propPanel.defaultSchema !== 'object' ||
|
242
|
+
activePlugin.propPanel.defaultSchema === null
|
243
|
+
) {
|
244
|
+
return emptySchema;
|
257
245
|
}
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
246
|
+
|
247
|
+
// Create a safe copy
|
248
|
+
const result: Record<string, unknown> = {};
|
249
|
+
|
250
|
+
// Only copy properties that exist on the object
|
251
|
+
for (const key in activePlugin.propPanel.defaultSchema) {
|
252
|
+
if (Object.prototype.hasOwnProperty.call(activePlugin.propPanel.defaultSchema, key)) {
|
253
|
+
result[key] = (activePlugin.propPanel.defaultSchema as Record<string, unknown>)[key];
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
257
|
+
return result;
|
258
|
+
})()
|
259
|
+
: emptySchema;
|
263
260
|
|
264
261
|
// Create a type-safe schema object
|
265
262
|
const propPanelSchema: PropPanelSchema = {
|
@@ -347,11 +344,20 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
347
344
|
|
348
345
|
// Create a safe copy of the properties
|
349
346
|
const safeProperties = { ...propPanelSchema.properties };
|
350
|
-
|
347
|
+
|
351
348
|
if (typeof activePropPanelSchema === 'function') {
|
352
349
|
// Create a new object without the schemasList property
|
353
|
-
const { size, schemas, pageSize, changeSchemas, activeElements, deselectSchema, activeSchema } =
|
354
|
-
|
350
|
+
const { size, schemas, pageSize, changeSchemas, activeElements, deselectSchema, activeSchema } =
|
351
|
+
props;
|
352
|
+
const propPanelProps = {
|
353
|
+
size,
|
354
|
+
schemas,
|
355
|
+
pageSize,
|
356
|
+
changeSchemas,
|
357
|
+
activeElements,
|
358
|
+
deselectSchema,
|
359
|
+
activeSchema,
|
360
|
+
};
|
355
361
|
|
356
362
|
// Use the typedI18n function to avoid type issues
|
357
363
|
const functionResult = activePropPanelSchema({
|
@@ -360,13 +366,14 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
360
366
|
theme: token,
|
361
367
|
i18n: typedI18n,
|
362
368
|
});
|
363
|
-
|
369
|
+
|
364
370
|
// Safely handle the result
|
365
371
|
const apps = functionResult && typeof functionResult === 'object' ? functionResult : {};
|
366
|
-
|
372
|
+
|
367
373
|
// Create a divider if needed
|
368
|
-
const dividerObj =
|
369
|
-
|
374
|
+
const dividerObj =
|
375
|
+
Object.keys(apps).length === 0 ? {} : { '--': { type: 'void', widget: 'Divider' } };
|
376
|
+
|
370
377
|
// Assign properties safely - use type assertion to satisfy TypeScript
|
371
378
|
propPanelSchema.properties = {
|
372
379
|
...safeProperties,
|
@@ -375,11 +382,15 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
375
382
|
};
|
376
383
|
} else {
|
377
384
|
// Handle non-function case
|
378
|
-
const apps =
|
379
|
-
|
385
|
+
const apps =
|
386
|
+
activePropPanelSchema && typeof activePropPanelSchema === 'object'
|
387
|
+
? activePropPanelSchema
|
388
|
+
: {};
|
389
|
+
|
380
390
|
// Create a divider if needed
|
381
|
-
const dividerObj =
|
382
|
-
|
391
|
+
const dividerObj =
|
392
|
+
Object.keys(apps).length === 0 ? {} : { '--': { type: 'void', widget: 'Divider' } };
|
393
|
+
|
383
394
|
// Assign properties safely - use type assertion to satisfy TypeScript
|
384
395
|
propPanelSchema.properties = {
|
385
396
|
...safeProperties,
|
@@ -47,111 +47,109 @@ interface Props {
|
|
47
47
|
// Using TypeScript interface for prop validation instead of PropTypes
|
48
48
|
const Item = React.memo(
|
49
49
|
/* eslint-disable react/prop-types */
|
50
|
-
React.forwardRef<HTMLLIElement, Props>(
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
) {
|
50
|
+
React.forwardRef<HTMLLIElement, Props>(function Item(
|
51
|
+
{
|
52
|
+
icon,
|
53
|
+
value,
|
54
|
+
status,
|
55
|
+
title,
|
56
|
+
required,
|
57
|
+
readOnly,
|
58
|
+
style,
|
59
|
+
dragOverlay,
|
60
|
+
onClick,
|
61
|
+
onMouseEnter,
|
62
|
+
onMouseLeave,
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
64
|
+
dragging,
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
66
|
+
fadeIn,
|
67
|
+
listeners,
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
69
|
+
sorting,
|
70
|
+
transition,
|
71
|
+
transform,
|
72
|
+
...props
|
73
|
+
},
|
74
|
+
ref,
|
75
|
+
) {
|
77
76
|
/* eslint-enable react/prop-types */
|
78
|
-
|
77
|
+
const i18n = useContext(I18nContext);
|
79
78
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
useEffect(() => {
|
80
|
+
if (!dragOverlay) {
|
81
|
+
return;
|
82
|
+
}
|
84
83
|
|
85
|
-
|
84
|
+
document.body.style.cursor = 'grabbing';
|
86
85
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
86
|
+
return () => {
|
87
|
+
document.body.style.cursor = '';
|
88
|
+
};
|
89
|
+
}, [dragOverlay]);
|
91
90
|
|
92
|
-
|
91
|
+
const { x, y, scaleX, scaleY } = transform || { x: 0, y: 0, scaleX: 1, scaleY: 1 };
|
93
92
|
|
94
|
-
|
95
|
-
|
93
|
+
return (
|
94
|
+
<li
|
95
|
+
style={{
|
96
|
+
marginTop: 10,
|
97
|
+
transition,
|
98
|
+
transform: `translate(${x}px, ${y}px) scale(${scaleX}, ${scaleY})`,
|
99
|
+
}}
|
100
|
+
onMouseEnter={onMouseEnter}
|
101
|
+
onMouseLeave={onMouseLeave}
|
102
|
+
ref={ref}
|
103
|
+
>
|
104
|
+
<div
|
96
105
|
style={{
|
97
|
-
|
98
|
-
|
99
|
-
|
106
|
+
display: 'flex',
|
107
|
+
alignItems: 'center',
|
108
|
+
cursor: 'pointer',
|
109
|
+
gap: '0.5rem',
|
110
|
+
...style,
|
100
111
|
}}
|
101
|
-
|
102
|
-
|
103
|
-
ref={ref}
|
112
|
+
{...props}
|
113
|
+
onClick={() => onClick && onClick()}
|
104
114
|
>
|
105
|
-
<
|
115
|
+
<Button
|
116
|
+
{...listeners}
|
106
117
|
style={{
|
107
118
|
display: 'flex',
|
108
119
|
alignItems: 'center',
|
109
|
-
|
110
|
-
|
111
|
-
|
120
|
+
background: 'none',
|
121
|
+
boxShadow: 'none',
|
122
|
+
border: 'none',
|
123
|
+
paddingLeft: '0.25rem',
|
124
|
+
}}
|
125
|
+
icon={<GripVertical size={15} style={{ cursor: 'grab' }} />}
|
126
|
+
/>
|
127
|
+
{icon}
|
128
|
+
<Text
|
129
|
+
style={{
|
130
|
+
overflow: 'hidden',
|
131
|
+
whiteSpace: 'nowrap',
|
132
|
+
textOverflow: 'ellipsis',
|
133
|
+
width: '100%',
|
112
134
|
}}
|
113
|
-
{
|
114
|
-
onClick={() => onClick && onClick()}
|
135
|
+
title={title || ''}
|
115
136
|
>
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
whiteSpace: 'nowrap',
|
133
|
-
textOverflow: 'ellipsis',
|
134
|
-
width: '100%',
|
135
|
-
}}
|
136
|
-
title={title || ''}
|
137
|
-
>
|
138
|
-
{status === undefined ? (
|
139
|
-
value
|
140
|
-
) : (
|
141
|
-
<span style={{ display: 'flex', alignItems: 'center' }}>
|
142
|
-
<CircleAlert size={15} style={{ marginRight: '0.25rem' }} />
|
143
|
-
{status === 'is-warning' ? i18n('noKeyName') : value}
|
144
|
-
{status === 'is-danger' ? i18n('notUniq') : ''}
|
145
|
-
</span>
|
146
|
-
)}
|
147
|
-
</Text>
|
148
|
-
{readOnly && <Lock size={15} style={{ marginRight: '0.5rem' }} />}
|
149
|
-
{required && <span style={{ color: 'red', marginRight: '0.5rem' }}>*</span>}
|
150
|
-
</div>
|
151
|
-
</li>
|
152
|
-
);
|
153
|
-
},
|
154
|
-
),
|
137
|
+
{status === undefined ? (
|
138
|
+
value
|
139
|
+
) : (
|
140
|
+
<span style={{ display: 'flex', alignItems: 'center' }}>
|
141
|
+
<CircleAlert size={15} style={{ marginRight: '0.25rem' }} />
|
142
|
+
{status === 'is-warning' ? i18n('noKeyName') : value}
|
143
|
+
{status === 'is-danger' ? i18n('notUniq') : ''}
|
144
|
+
</span>
|
145
|
+
)}
|
146
|
+
</Text>
|
147
|
+
{readOnly && <Lock size={15} style={{ marginRight: '0.5rem' }} />}
|
148
|
+
{required && <span style={{ color: 'red', marginRight: '0.5rem' }}>*</span>}
|
149
|
+
</div>
|
150
|
+
</li>
|
151
|
+
);
|
152
|
+
}),
|
155
153
|
);
|
156
154
|
|
157
155
|
// Set display name for debugging
|