impact-ui 4.0.1-alpha.28 → 4.0.1-alpha.29

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 (33) hide show
  1. package/dist/_virtual/index13.js +2 -2
  2. package/dist/_virtual/index14.js +2 -2
  3. package/dist/_virtual/index15.js +2 -2
  4. package/dist/_virtual/index4.js +2 -4
  5. package/dist/_virtual/index5.js +3 -3
  6. package/dist/_virtual/index6.js +4 -2
  7. package/dist/components/CommentsPanel/CommentsContext.js +1 -1
  8. package/dist/components/TableV36/AdvanceSortModal.js +297 -0
  9. package/dist/components/TableV36/AgGridHeader.js +799 -0
  10. package/dist/components/TableV36/CommentsPortal.js +362 -0
  11. package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModal.js +282 -0
  12. package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModalItem.js +302 -0
  13. package/dist/components/TableV36/NoComments.js +237 -0
  14. package/dist/components/TableV36/actionBar.js +31 -0
  15. package/dist/components/TableV36/filterUtils.js +478 -0
  16. package/dist/components/TableV36/index.js +1603 -0
  17. package/dist/components/TableV36/tableFunctions.js +1796 -0
  18. package/dist/components/TableV36/tableHeader.js +396 -0
  19. package/dist/components/TableV36/tableMoreOptions.js +324 -0
  20. package/dist/components/TableV36/tablePagination.js +67 -0
  21. package/dist/components/TableV36/tableSettings.js +317 -0
  22. package/dist/components/TableV36/withCommentIcon.js +108 -0
  23. package/dist/components/index.d.ts.map +1 -1
  24. package/dist/mcp-component-registry.json +1 -1
  25. package/dist/node_modules/@mui/material/Modal/useModal.js +1 -1
  26. package/dist/node_modules/@mui/material/Popover/Popover.js +2 -2
  27. package/dist/node_modules/@mui/material/Tabs/Tabs.js +1 -1
  28. package/dist/node_modules/@mui/system/colorManipulator.js +2 -2
  29. package/dist/node_modules/call-bind/index.js +1 -1
  30. package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +1 -1
  31. package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  32. package/dist/node_modules/react-with-styles-interface-css/dist/index.js +1 -1
  33. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- var dist = {};
1
+ var reactIs = { exports: {} };
2
2
  export {
3
- dist as __exports
3
+ reactIs as __module
4
4
  };
@@ -1,4 +1,4 @@
1
- var callBind = { exports: {} };
1
+ var dist = {};
2
2
  export {
3
- callBind as __module
3
+ dist as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var reactIs = { exports: {} };
1
+ var callBind = { exports: {} };
2
2
  export {
3
- reactIs as __module
3
+ callBind as __module
4
4
  };
@@ -1,6 +1,4 @@
1
- import { getAugmentedNamespace } from "./_commonjsHelpers.js";
2
- import * as index from "../node_modules/@mui/system/node_modules/@mui/utils/esm/formatMuiErrorMessage/index.js";
3
- const require$$1 = /* @__PURE__ */ getAugmentedNamespace(index);
1
+ var reactIs = { exports: {} };
4
2
  export {
5
- require$$1 as default
3
+ reactIs as __module
6
4
  };
@@ -1,6 +1,6 @@
1
1
  import { getAugmentedNamespace } from "./_commonjsHelpers.js";
2
- import * as index from "../node_modules/@mui/system/node_modules/@mui/utils/esm/clamp/index.js";
3
- const require$$2 = /* @__PURE__ */ getAugmentedNamespace(index);
2
+ import * as index from "../node_modules/@mui/system/node_modules/@mui/utils/esm/formatMuiErrorMessage/index.js";
3
+ const require$$1 = /* @__PURE__ */ getAugmentedNamespace(index);
4
4
  export {
5
- require$$2 as default
5
+ require$$1 as default
6
6
  };
@@ -1,4 +1,6 @@
1
- var reactIs = { exports: {} };
1
+ import { getAugmentedNamespace } from "./_commonjsHelpers.js";
2
+ import * as index from "../node_modules/@mui/system/node_modules/@mui/utils/esm/clamp/index.js";
3
+ const require$$2 = /* @__PURE__ */ getAugmentedNamespace(index);
2
4
  export {
3
- reactIs as __module
5
+ require$$2 as default
4
6
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { createContext, useContext, useState, useRef, useEffect, useCallback, useMemo } from "react";
2
+ import { useContext, createContext, useState, useRef, useEffect, useCallback, useMemo } from "react";
3
3
  import { Comment as Comment_default, CheckTickAll as CheckTickAll_default, DeleteBlack as DeleteBlack_default, EditBlack as EditBlack_default } from "../../node_modules/@impactsmartsuite/impact-icons/dist/index.js";
4
4
  import { Menu } from "../Menu/index.js";
5
5
  import { Prompt } from "../Prompt/index.js";
@@ -0,0 +1,297 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState, useRef, useEffect } from "react";
3
+ import default_1 from "../../node_modules/@mui/icons-material/DragIndicator.js";
4
+ import { getAssetUrl } from "../../utils/assetBase.js";
5
+ import { Badge } from "../Badge/index.js";
6
+ import { Button } from "../Button/index.js";
7
+ import { Modal } from "../Modal/index.js";
8
+ import { Select } from "../Select/index.js";
9
+ import { Tooltip } from "../Tooltip/index.js";
10
+ const SaveViewDeleteIcon = (props) => /* @__PURE__ */ jsx("img", { alt: "", src: getAssetUrl("icons/saveViewDeleteIcon.svg"), ...props });
11
+ const AddOutlinedIcon = (props) => /* @__PURE__ */ jsx("img", { alt: "", src: getAssetUrl("icons/plus.svg"), ...props });
12
+ const SORT_ORDER_OPTIONS_TEXT = [
13
+ { label: "Ascending (A To Z)", value: "asc" },
14
+ { label: "Descending (Z To A)", value: "desc" }
15
+ ];
16
+ const SORT_ORDER_OPTIONS_NUMBER = [
17
+ { label: "Smallest to largest", value: "asc" },
18
+ { label: "Largest to smallest", value: "desc" }
19
+ ];
20
+ function getSortOrderOptionsByFilter(filterType) {
21
+ if (filterType === "agNumberColumnFilter") {
22
+ return SORT_ORDER_OPTIONS_NUMBER;
23
+ }
24
+ if (filterType === "agTextColumnFilter") {
25
+ return SORT_ORDER_OPTIONS_TEXT;
26
+ }
27
+ return SORT_ORDER_OPTIONS_TEXT;
28
+ }
29
+ let nextId = 1;
30
+ const generateId = () => `sort-row-${nextId++}`;
31
+ function buildColumnOptions(colDefs) {
32
+ const options = [];
33
+ const collect = (cols) => {
34
+ if (!Array.isArray(cols)) return;
35
+ cols.forEach((col) => {
36
+ if (col.children) {
37
+ collect(col.children);
38
+ } else if (col.field && col.sortable) {
39
+ options.push({
40
+ label: col.headerName || col.field,
41
+ value: col.field,
42
+ filter: col.filter
43
+ });
44
+ }
45
+ });
46
+ };
47
+ collect(colDefs);
48
+ return options;
49
+ }
50
+ function makeEmptyRow() {
51
+ return { id: generateId(), colId: null, order: "null" };
52
+ }
53
+ function SortRow({
54
+ row,
55
+ index,
56
+ availableColumnOptions,
57
+ selectedColumnOption,
58
+ selectedOrderOption,
59
+ selectedColumnFilter,
60
+ onColumnChange,
61
+ onOrderChange,
62
+ onDelete,
63
+ dragHandlers,
64
+ rowsCount
65
+ }) {
66
+ const [columnIsOpen, setColumnIsOpen] = useState(false);
67
+ const [orderIsOpen, setOrderIsOpen] = useState(false);
68
+ const [columnCurrentOptions, setColumnCurrentOptions] = useState(availableColumnOptions);
69
+ const [orderCurrentOptions, setOrderCurrentOptions] = useState(
70
+ getSortOrderOptionsByFilter(selectedColumnFilter)
71
+ );
72
+ useEffect(() => {
73
+ setColumnCurrentOptions(availableColumnOptions);
74
+ }, [availableColumnOptions]);
75
+ useEffect(() => {
76
+ setOrderCurrentOptions(getSortOrderOptionsByFilter(selectedColumnFilter));
77
+ }, [selectedColumnFilter]);
78
+ return /* @__PURE__ */ jsxs(
79
+ "div",
80
+ {
81
+ draggable: true,
82
+ className: "advance-sort-row",
83
+ onDragEnd: dragHandlers.onDragEnd,
84
+ onDragEnter: () => dragHandlers.onDragEnter(index),
85
+ onDragOver: (e) => {
86
+ e.preventDefault();
87
+ },
88
+ onDragStart: () => dragHandlers.onDragStart(index),
89
+ children: [
90
+ /* @__PURE__ */ jsxs("div", { className: "advance-sort-row-content", children: [
91
+ /* @__PURE__ */ jsx(default_1, { className: "advance-sort-drag-indicator" }),
92
+ /* @__PURE__ */ jsxs("div", { className: "advance-sort-field-group", children: [
93
+ /* @__PURE__ */ jsx(
94
+ Select,
95
+ {
96
+ isWithSearch: true,
97
+ withPortal: true,
98
+ currentOptions: columnCurrentOptions,
99
+ handleChange: (val) => onColumnChange(index, val),
100
+ initialOptions: availableColumnOptions,
101
+ isOpen: columnIsOpen,
102
+ label: "Column",
103
+ minWidth: "210px",
104
+ placeholder: "Select column",
105
+ selectedOptions: selectedColumnOption,
106
+ setCurrentOptions: setColumnCurrentOptions,
107
+ setIsOpen: setColumnIsOpen,
108
+ setSelectedOptions: () => {
109
+ }
110
+ }
111
+ ),
112
+ /* @__PURE__ */ jsx(
113
+ Select,
114
+ {
115
+ withPortal: true,
116
+ currentOptions: orderCurrentOptions,
117
+ handleChange: (val) => onOrderChange(index, val),
118
+ initialOptions: getSortOrderOptionsByFilter(selectedColumnFilter),
119
+ isOpen: orderIsOpen,
120
+ label: "Sorting Order",
121
+ minWidth: "210px",
122
+ placeholder: "Select sorting order",
123
+ selectedOptions: selectedOrderOption,
124
+ setCurrentOptions: setOrderCurrentOptions,
125
+ setIsOpen: setOrderIsOpen,
126
+ setSelectedOptions: () => {
127
+ }
128
+ }
129
+ )
130
+ ] })
131
+ ] }),
132
+ /* @__PURE__ */ jsxs("div", { className: "advance-sort-priority-group", children: [
133
+ /* @__PURE__ */ jsx(
134
+ Badge,
135
+ {
136
+ color: "default",
137
+ label: `Priority ${index + 1}`,
138
+ size: "default",
139
+ sx: {
140
+ background: "#F1F3FE !important",
141
+ "& .MuiChip-label": {
142
+ color: "#4259EE !important"
143
+ }
144
+ },
145
+ variant: "filled"
146
+ }
147
+ ),
148
+ /* @__PURE__ */ jsx("div", { className: "divider-line" }),
149
+ /* @__PURE__ */ jsx(Tooltip, { title: "Delete", variant: "tertiary", children: /* @__PURE__ */ jsx("span", { style: { display: "inline-block" }, children: /* @__PURE__ */ jsx(
150
+ Button,
151
+ {
152
+ disabled: rowsCount === 1,
153
+ icon: /* @__PURE__ */ jsx(SaveViewDeleteIcon, {}),
154
+ size: "medium",
155
+ type: "destructive",
156
+ variant: "secondary",
157
+ onClick: () => onDelete(index)
158
+ }
159
+ ) }) })
160
+ ] })
161
+ ]
162
+ }
163
+ );
164
+ }
165
+ function AdvanceSortModal({ open, onClose, colDefs = [], sortState = [], onApply }) {
166
+ const [rows, setRows] = useState([makeEmptyRow()]);
167
+ const dragIndexRef = useRef(null);
168
+ const dragOverIndexRef = useRef(null);
169
+ const columnOptions = buildColumnOptions(colDefs);
170
+ useEffect(() => {
171
+ if (!open) return;
172
+ if (sortState && sortState.length > 0) {
173
+ setRows(
174
+ sortState.map((s) => ({
175
+ id: generateId(),
176
+ colId: s.colId,
177
+ order: s.sort || "asc"
178
+ }))
179
+ );
180
+ } else {
181
+ setRows([makeEmptyRow()]);
182
+ }
183
+ }, [open]);
184
+ const handleColumnChange = (index, option) => {
185
+ setRows(
186
+ (prev) => prev.map((row, i) => i === index ? { ...row, colId: option ? option.value : null } : row)
187
+ );
188
+ };
189
+ const handleOrderChange = (index, option) => {
190
+ setRows(
191
+ (prev) => prev.map((row, i) => i === index ? { ...row, order: option ? option.value : "asc" } : row)
192
+ );
193
+ };
194
+ const handleDeleteRow = (index) => {
195
+ setRows((prev) => {
196
+ const next = prev.filter((_, i) => i !== index);
197
+ return next.length === 0 ? [makeEmptyRow()] : next;
198
+ });
199
+ };
200
+ const handleAddLevel = () => {
201
+ setRows((prev) => [...prev, makeEmptyRow()]);
202
+ };
203
+ const handleClearValues = () => {
204
+ setRows((prev) => prev.map((row, i) => ({ ...row, order: null })));
205
+ };
206
+ const handleClearAll = () => {
207
+ setRows([makeEmptyRow()]);
208
+ };
209
+ const handleApply = () => {
210
+ const validRows = rows.filter((r) => r.colId);
211
+ onApply(validRows);
212
+ };
213
+ const onDragStart = (index) => {
214
+ dragIndexRef.current = index;
215
+ };
216
+ const onDragEnter = (index) => {
217
+ dragOverIndexRef.current = index;
218
+ };
219
+ const onDragEnd = () => {
220
+ const from = dragIndexRef.current;
221
+ const to = dragOverIndexRef.current;
222
+ if (from === null || to === null || from === to) return;
223
+ setRows((prev) => {
224
+ const next = [...prev];
225
+ const [removed] = next.splice(from, 1);
226
+ next.splice(to, 0, removed);
227
+ return next;
228
+ });
229
+ dragIndexRef.current = null;
230
+ dragOverIndexRef.current = null;
231
+ };
232
+ const getSelectedColumnOption = (colId) => columnOptions.find((o) => o.value === colId) || null;
233
+ const getSelectedOrderOption = (order, colId) => {
234
+ var _a;
235
+ const filterType = (_a = getSelectedColumnOption(colId)) == null ? void 0 : _a.filter;
236
+ return getSortOrderOptionsByFilter(filterType).find((o) => o.value === order) || null;
237
+ };
238
+ const usedColIds = rows.map((r) => r.colId).filter(Boolean);
239
+ const getAvailableColumnOptionsForRow = (rowColId) => columnOptions.filter((opt) => opt.value === rowColId || !usedColIds.includes(opt.value));
240
+ return /* @__PURE__ */ jsx(
241
+ Modal,
242
+ {
243
+ className: "advance-sort-modal",
244
+ open,
245
+ primaryButtonLabel: "Apply",
246
+ secondaryButtonLabel: "Cancel",
247
+ size: "medium",
248
+ title: "Advance Sort",
249
+ onClose,
250
+ onPrimaryButtonClick: handleApply,
251
+ onSecondaryButtonClick: onClose,
252
+ children: /* @__PURE__ */ jsxs("div", { className: "advance-sort-modal-body", children: [
253
+ /* @__PURE__ */ jsxs("div", { className: "advance-sort-section-header", children: [
254
+ /* @__PURE__ */ jsx("span", { className: "advance-sort-section-title", children: "Column sort" }),
255
+ /* @__PURE__ */ jsx(Button, { variant: "url", onClick: handleClearAll, children: "Clear All" })
256
+ ] }),
257
+ /* @__PURE__ */ jsx("div", { className: "advance-sort-rows", children: rows.map((row, index) => {
258
+ var _a;
259
+ return /* @__PURE__ */ jsx(
260
+ SortRow,
261
+ {
262
+ availableColumnOptions: getAvailableColumnOptionsForRow(row.colId),
263
+ dragHandlers: { onDragStart, onDragEnter, onDragEnd },
264
+ index,
265
+ row,
266
+ rowsCount: rows.length,
267
+ selectedColumnFilter: (_a = getSelectedColumnOption(row.colId)) == null ? void 0 : _a.filter,
268
+ selectedColumnOption: getSelectedColumnOption(row.colId),
269
+ selectedOrderOption: getSelectedOrderOption(row.order, row.colId),
270
+ onColumnChange: handleColumnChange,
271
+ onDelete: handleDeleteRow,
272
+ onOrderChange: handleOrderChange
273
+ },
274
+ row.id
275
+ );
276
+ }) }),
277
+ /* @__PURE__ */ jsxs("div", { className: "advance-sort-footer-actions", children: [
278
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: handleClearValues, children: "Clear Values" }),
279
+ /* @__PURE__ */ jsx(
280
+ Button,
281
+ {
282
+ className: "advance-sort-add-level-button",
283
+ disabled: columnOptions.length === rows.length,
284
+ icon: /* @__PURE__ */ jsx(AddOutlinedIcon, {}),
285
+ variant: "tertiary",
286
+ onClick: handleAddLevel,
287
+ children: "Add Level"
288
+ }
289
+ )
290
+ ] })
291
+ ] })
292
+ }
293
+ );
294
+ }
295
+ export {
296
+ AdvanceSortModal as default
297
+ };