@mohsinonxrm/pptb-fetchxml-studio 1.0.0 → 1.0.2

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/LICENSE +661 -0
  2. package/README.md +1 -1
  3. package/dist/assets/index-DD9fzkbz.js +232 -0
  4. package/dist/index.html +70 -0
  5. package/index.html +0 -1
  6. package/npm-shrinkwrap.json +6329 -0
  7. package/package.json +95 -51
  8. package/CHANGELOG.md +0 -120
  9. package/eslint.config.js +0 -23
  10. package/public/vite.svg +0 -1
  11. package/src/app/AppShell.tsx +0 -1733
  12. package/src/assets/20px-Microsoft_Office_Excel_(2025/342/200/223present).svg.png +0 -0
  13. package/src/assets/react.svg +0 -1
  14. package/src/features/fetchxml/api/dataverseMetadata.ts +0 -192
  15. package/src/features/fetchxml/api/excelExport.ts +0 -318
  16. package/src/features/fetchxml/api/formattedValues.ts +0 -107
  17. package/src/features/fetchxml/api/pptbClient.ts +0 -2635
  18. package/src/features/fetchxml/model/displaySettings.ts +0 -18
  19. package/src/features/fetchxml/model/fetchxml.ts +0 -346
  20. package/src/features/fetchxml/model/fetchxmlIntellisense.ts +0 -583
  21. package/src/features/fetchxml/model/fetchxmlParser.ts +0 -708
  22. package/src/features/fetchxml/model/layoutxml.ts +0 -372
  23. package/src/features/fetchxml/model/nodes.ts +0 -255
  24. package/src/features/fetchxml/model/operators.ts +0 -624
  25. package/src/features/fetchxml/model/treeUtils.ts +0 -174
  26. package/src/features/fetchxml/state/builderStore.tsx +0 -1160
  27. package/src/features/fetchxml/state/cache.ts +0 -393
  28. package/src/features/fetchxml/ui/Dialogs/BulkDeleteDialog.tsx +0 -352
  29. package/src/features/fetchxml/ui/Dialogs/DeleteConfirmDialog.tsx +0 -396
  30. package/src/features/fetchxml/ui/Dialogs/SaveViewDialog.tsx +0 -612
  31. package/src/features/fetchxml/ui/Dialogs/SolutionPicker.tsx +0 -114
  32. package/src/features/fetchxml/ui/Dialogs/WorkflowPickerDialog.tsx +0 -437
  33. package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/AttributeEditor.tsx +0 -214
  34. package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/ConditionEditor.tsx +0 -533
  35. package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/FetchOptionsEditor.tsx +0 -296
  36. package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/FilterEditor.tsx +0 -106
  37. package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/LinkEntityEditor.tsx +0 -433
  38. package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/OrderEditor.tsx +0 -161
  39. package/src/features/fetchxml/ui/LeftPane/PropertiesPanel/editors/ValueOfPicker.tsx +0 -194
  40. package/src/features/fetchxml/ui/LeftPane/PropertiesPanel.tsx +0 -225
  41. package/src/features/fetchxml/ui/LeftPane/TreeView.tsx +0 -604
  42. package/src/features/fetchxml/ui/RightPane/AddColumnsPanel.tsx +0 -800
  43. package/src/features/fetchxml/ui/RightPane/ColumnConfigDialog.tsx +0 -170
  44. package/src/features/fetchxml/ui/RightPane/DataGridCellRenderers.tsx +0 -356
  45. package/src/features/fetchxml/ui/RightPane/EditColumnsPanel.tsx +0 -372
  46. package/src/features/fetchxml/ui/RightPane/FetchXmlEditor.tsx +0 -399
  47. package/src/features/fetchxml/ui/RightPane/FormattedValueUtils.ts +0 -189
  48. package/src/features/fetchxml/ui/RightPane/LayoutXmlViewer.tsx +0 -171
  49. package/src/features/fetchxml/ui/RightPane/PreviewTabs.tsx +0 -471
  50. package/src/features/fetchxml/ui/RightPane/ResultsCommandBar.tsx +0 -430
  51. package/src/features/fetchxml/ui/RightPane/ResultsGrid.tsx +0 -983
  52. package/src/features/fetchxml/ui/RightPane/XmlTextArea.tsx +0 -65
  53. package/src/features/fetchxml/ui/Settings/SettingsDrawer.tsx +0 -175
  54. package/src/features/fetchxml/ui/Toolbar/EntitySelector.tsx +0 -788
  55. package/src/features/fetchxml/ui/Toolbar/LoadViewPicker.tsx +0 -274
  56. package/src/features/fetchxml/ui/Toolbar/SaveViewButton.tsx +0 -174
  57. package/src/main.tsx +0 -11
  58. package/src/shared/components/AttributePicker.tsx +0 -138
  59. package/src/shared/components/BetweenInputPicker.tsx +0 -120
  60. package/src/shared/components/BooleanValuePicker.tsx +0 -165
  61. package/src/shared/components/DateTimeInputPicker.tsx +0 -170
  62. package/src/shared/components/DynamicValueList.tsx +0 -128
  63. package/src/shared/components/ExcelIcon.tsx +0 -30
  64. package/src/shared/components/MultiValuePicker.tsx +0 -178
  65. package/src/shared/components/NumericInputPicker.tsx +0 -156
  66. package/src/shared/components/OptionSetValuePicker.tsx +0 -150
  67. package/src/shared/components/RelationshipPicker.tsx +0 -268
  68. package/src/shared/contexts/ThemeContext.tsx +0 -19
  69. package/src/shared/hooks/useAccessMode.ts +0 -77
  70. package/src/shared/hooks/useLazyMetadata.ts +0 -132
  71. package/src/shared/hooks/usePptbContext.ts +0 -170
  72. package/src/shared/hooks/usePublisherFilter.ts +0 -214
  73. package/src/shared/hooks/useSolutionFilter.ts +0 -162
  74. package/src/shared/utils/debug.ts +0 -87
  75. package/tsconfig.app.json +0 -28
  76. package/tsconfig.json +0 -7
  77. package/tsconfig.node.json +0 -26
  78. package/vite.config.ts +0 -7
@@ -1,372 +0,0 @@
1
- /**
2
- * Edit Columns Panel (Drawer)
3
- * Shows selected columns with reorder/remove options
4
- * Matches Power Apps Model-Driven Apps UX
5
- */
6
-
7
- import { useState, useCallback, useEffect, useRef } from "react";
8
- import {
9
- DrawerBody,
10
- DrawerHeader,
11
- DrawerHeaderTitle,
12
- OverlayDrawer,
13
- Button,
14
- makeStyles,
15
- tokens,
16
- Text,
17
- Toolbar,
18
- ToolbarButton,
19
- } from "@fluentui/react-components";
20
- import {
21
- Dismiss24Regular,
22
- ArrowUp20Regular,
23
- ArrowDown20Regular,
24
- Delete20Regular,
25
- Add20Regular,
26
- ArrowReset20Regular,
27
- ReOrder16Regular,
28
- } from "@fluentui/react-icons";
29
- import type { LayoutColumn } from "../../model/layoutxml";
30
-
31
- const useStyles = makeStyles({
32
- drawer: {
33
- width: "400px",
34
- },
35
- headerActions: {
36
- display: "flex",
37
- gap: tokens.spacingHorizontalS,
38
- },
39
- columnList: {
40
- display: "flex",
41
- flexDirection: "column",
42
- gap: tokens.spacingVerticalXS,
43
- marginTop: tokens.spacingVerticalM,
44
- },
45
- columnItem: {
46
- display: "flex",
47
- alignItems: "center",
48
- gap: tokens.spacingHorizontalS,
49
- padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalM}`,
50
- backgroundColor: tokens.colorNeutralBackground1,
51
- border: `1px solid ${tokens.colorNeutralStroke2}`,
52
- borderRadius: tokens.borderRadiusMedium,
53
- cursor: "grab",
54
- userSelect: "none",
55
- "&:hover": {
56
- backgroundColor: tokens.colorNeutralBackground1Hover,
57
- border: `1px solid ${tokens.colorNeutralStroke1Hover}`,
58
- },
59
- },
60
- columnItemSelected: {
61
- backgroundColor: tokens.colorNeutralBackground1Selected,
62
- border: `1px solid ${tokens.colorBrandStroke1}`,
63
- },
64
- columnItemDragging: {
65
- opacity: 0.5,
66
- cursor: "grabbing",
67
- },
68
- columnItemDragOver: {
69
- borderTop: `2px solid ${tokens.colorBrandStroke1}`,
70
- marginTop: "-2px",
71
- },
72
- dragHandle: {
73
- cursor: "grab",
74
- color: tokens.colorNeutralForeground3,
75
- display: "flex",
76
- alignItems: "center",
77
- },
78
- columnName: {
79
- flex: 1,
80
- overflow: "hidden",
81
- textOverflow: "ellipsis",
82
- whiteSpace: "nowrap",
83
- },
84
- columnActions: {
85
- display: "flex",
86
- gap: tokens.spacingHorizontalXXS,
87
- },
88
- footer: {
89
- display: "flex",
90
- justifyContent: "flex-end",
91
- gap: tokens.spacingHorizontalS,
92
- padding: tokens.spacingVerticalM,
93
- borderTop: `1px solid ${tokens.colorNeutralStroke1}`,
94
- marginTop: "auto",
95
- },
96
- emptyState: {
97
- display: "flex",
98
- flexDirection: "column",
99
- alignItems: "center",
100
- justifyContent: "center",
101
- padding: tokens.spacingVerticalXXL,
102
- color: tokens.colorNeutralForeground3,
103
- textAlign: "center",
104
- },
105
- });
106
-
107
- export interface EditColumnsPanelProps {
108
- /** Whether the panel is open */
109
- open: boolean;
110
- /** Columns to display for editing */
111
- columns: LayoutColumn[];
112
- /** Entity display name for the title */
113
- entityDisplayName?: string;
114
- /** Called when panel is closed */
115
- onClose: () => void;
116
- /** Called when Apply is clicked with the updated columns */
117
- onApply: (columns: LayoutColumn[]) => void;
118
- /** Called when user wants to add columns */
119
- onAddColumns: () => void;
120
- /** Called to reset columns to default */
121
- onResetToDefault?: () => void;
122
- }
123
-
124
- export function EditColumnsPanel({
125
- open,
126
- columns,
127
- entityDisplayName,
128
- onClose,
129
- onApply,
130
- onAddColumns,
131
- onResetToDefault,
132
- }: EditColumnsPanelProps) {
133
- const styles = useStyles();
134
- const [localColumns, setLocalColumns] = useState<LayoutColumn[]>([]);
135
- const [selectedIndex, setSelectedIndex] = useState<number | null>(null);
136
- const [draggedIndex, setDraggedIndex] = useState<number | null>(null);
137
- const [dragOverIndex, setDragOverIndex] = useState<number | null>(null);
138
- const dragNodeRef = useRef<HTMLDivElement | null>(null);
139
-
140
- // Initialize local state when panel opens or columns change
141
- useEffect(() => {
142
- if (open && columns.length > 0) {
143
- setLocalColumns([...columns]);
144
- setSelectedIndex(null);
145
- }
146
- }, [open, columns]);
147
-
148
- // Drag and drop handlers
149
- const handleDragStart = useCallback((e: React.DragEvent<HTMLDivElement>, index: number) => {
150
- setDraggedIndex(index);
151
- dragNodeRef.current = e.currentTarget;
152
- e.dataTransfer.effectAllowed = "move";
153
- e.dataTransfer.setData("text/plain", index.toString());
154
- // Add a slight delay to allow the drag image to be captured
155
- setTimeout(() => {
156
- if (dragNodeRef.current) {
157
- dragNodeRef.current.style.opacity = "0.5";
158
- }
159
- }, 0);
160
- }, []);
161
-
162
- const handleDragEnd = useCallback(() => {
163
- setDraggedIndex(null);
164
- setDragOverIndex(null);
165
- if (dragNodeRef.current) {
166
- dragNodeRef.current.style.opacity = "1";
167
- dragNodeRef.current = null;
168
- }
169
- }, []);
170
-
171
- const handleDragOver = useCallback(
172
- (e: React.DragEvent<HTMLDivElement>, index: number) => {
173
- e.preventDefault();
174
- e.dataTransfer.dropEffect = "move";
175
- if (draggedIndex !== null && draggedIndex !== index) {
176
- setDragOverIndex(index);
177
- }
178
- },
179
- [draggedIndex]
180
- );
181
-
182
- const handleDragLeave = useCallback(() => {
183
- setDragOverIndex(null);
184
- }, []);
185
-
186
- const handleDrop = useCallback(
187
- (e: React.DragEvent<HTMLDivElement>, targetIndex: number) => {
188
- e.preventDefault();
189
- if (draggedIndex === null || draggedIndex === targetIndex) {
190
- setDragOverIndex(null);
191
- return;
192
- }
193
-
194
- setLocalColumns((prev) => {
195
- const newColumns = [...prev];
196
- const [removed] = newColumns.splice(draggedIndex, 1);
197
- // Adjust target index if we removed from before it
198
- const adjustedTarget = draggedIndex < targetIndex ? targetIndex - 1 : targetIndex;
199
- newColumns.splice(adjustedTarget, 0, removed);
200
- return newColumns;
201
- });
202
-
203
- // Update selection to follow the moved item
204
- setSelectedIndex(draggedIndex < targetIndex ? targetIndex - 1 : targetIndex);
205
- setDraggedIndex(null);
206
- setDragOverIndex(null);
207
- },
208
- [draggedIndex]
209
- );
210
-
211
- const moveColumn = useCallback((index: number, direction: "up" | "down") => {
212
- setLocalColumns((prev) => {
213
- const newColumns = [...prev];
214
- const targetIndex = direction === "up" ? index - 1 : index + 1;
215
-
216
- if (targetIndex < 0 || targetIndex >= newColumns.length) {
217
- return prev;
218
- }
219
-
220
- // Swap columns
221
- [newColumns[index], newColumns[targetIndex]] = [newColumns[targetIndex], newColumns[index]];
222
- return newColumns;
223
- });
224
- // Update selection to follow the moved item
225
- setSelectedIndex((prev) =>
226
- prev === index ? (direction === "up" ? index - 1 : index + 1) : prev
227
- );
228
- }, []);
229
-
230
- const removeColumn = useCallback((index: number) => {
231
- setLocalColumns((prev) => prev.filter((_, i) => i !== index));
232
- setSelectedIndex(null);
233
- }, []);
234
-
235
- const handleApply = useCallback(() => {
236
- onApply(localColumns);
237
- }, [localColumns, onApply]);
238
-
239
- const handleColumnClick = useCallback((index: number) => {
240
- setSelectedIndex((prev) => (prev === index ? null : index));
241
- }, []);
242
-
243
- return (
244
- <OverlayDrawer
245
- open={open}
246
- onOpenChange={(_e, data) => !data.open && onClose()}
247
- position="end"
248
- size="medium"
249
- className={styles.drawer}
250
- >
251
- <DrawerHeader>
252
- <DrawerHeaderTitle
253
- action={
254
- <Button
255
- appearance="subtle"
256
- aria-label="Close"
257
- icon={<Dismiss24Regular />}
258
- onClick={onClose}
259
- />
260
- }
261
- >
262
- Edit columns{entityDisplayName ? `: ${entityDisplayName}` : ""}
263
- </DrawerHeaderTitle>
264
- </DrawerHeader>
265
- <DrawerBody>
266
- <Toolbar size="small">
267
- <ToolbarButton icon={<Add20Regular />} onClick={onAddColumns} aria-label="Add columns">
268
- Add columns
269
- </ToolbarButton>
270
- {onResetToDefault && (
271
- <ToolbarButton
272
- icon={<ArrowReset20Regular />}
273
- onClick={onResetToDefault}
274
- aria-label="Reset to default"
275
- >
276
- Reset to default
277
- </ToolbarButton>
278
- )}
279
- </Toolbar>
280
-
281
- {localColumns.length === 0 ? (
282
- <div className={styles.emptyState}>
283
- <Text>No columns selected</Text>
284
- <Text size={200}>Click "Add columns" to add columns to the view</Text>
285
- </div>
286
- ) : (
287
- <div className={styles.columnList}>
288
- {localColumns.map((column, index) => {
289
- const isDragging = draggedIndex === index;
290
- const isDragOver = dragOverIndex === index;
291
- return (
292
- <div
293
- key={column.name}
294
- className={`${styles.columnItem} ${
295
- selectedIndex === index ? styles.columnItemSelected : ""
296
- } ${isDragging ? styles.columnItemDragging : ""} ${
297
- isDragOver ? styles.columnItemDragOver : ""
298
- }`}
299
- onClick={() => handleColumnClick(index)}
300
- role="button"
301
- tabIndex={0}
302
- draggable
303
- onDragStart={(e) => handleDragStart(e, index)}
304
- onDragEnd={handleDragEnd}
305
- onDragOver={(e) => handleDragOver(e, index)}
306
- onDragLeave={handleDragLeave}
307
- onDrop={(e) => handleDrop(e, index)}
308
- onKeyDown={(e) => {
309
- if (e.key === "Enter" || e.key === " ") {
310
- handleColumnClick(index);
311
- }
312
- }}
313
- >
314
- <span className={styles.dragHandle}>
315
- <ReOrder16Regular />
316
- </span>
317
- <span className={styles.columnName}>{column.displayName || column.name}</span>
318
- <div className={styles.columnActions}>
319
- <Button
320
- appearance="subtle"
321
- size="small"
322
- icon={<ArrowUp20Regular />}
323
- disabled={index === 0}
324
- onClick={(e) => {
325
- e.stopPropagation();
326
- moveColumn(index, "up");
327
- }}
328
- title="Move up"
329
- aria-label="Move up"
330
- />
331
- <Button
332
- appearance="subtle"
333
- size="small"
334
- icon={<ArrowDown20Regular />}
335
- disabled={index === localColumns.length - 1}
336
- onClick={(e) => {
337
- e.stopPropagation();
338
- moveColumn(index, "down");
339
- }}
340
- title="Move down"
341
- aria-label="Move down"
342
- />
343
- <Button
344
- appearance="subtle"
345
- size="small"
346
- icon={<Delete20Regular />}
347
- onClick={(e) => {
348
- e.stopPropagation();
349
- removeColumn(index);
350
- }}
351
- title="Remove"
352
- aria-label="Remove column"
353
- />
354
- </div>
355
- </div>
356
- );
357
- })}
358
- </div>
359
- )}
360
-
361
- <div className={styles.footer}>
362
- <Button appearance="secondary" onClick={onClose}>
363
- Cancel
364
- </Button>
365
- <Button appearance="primary" onClick={handleApply}>
366
- Apply
367
- </Button>
368
- </div>
369
- </DrawerBody>
370
- </OverlayDrawer>
371
- );
372
- }