@gobolt/genesis 0.4.5 → 0.4.9
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/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/dist/components/Table/Table.d.ts +2 -1
- package/dist/components/Table/__mocks__/table-mocks.d.ts +12 -0
- package/dist/components/Table/useTable.d.ts +5 -1
- package/dist/components/TableWithControls/TableWithControls.d.ts +3 -1
- package/dist/components/TableWithControls/useTableWithControls.d.ts +6 -3
- package/dist/index.cjs +387 -48
- package/dist/index.js +387 -48
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -60250,6 +60250,9 @@ function FaCircleCheck(props) {
|
|
|
60250
60250
|
function HiClock(props) {
|
|
60251
60251
|
return GenIcon({ "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z", "clipRule": "evenodd" }, "child": [] }] })(props);
|
|
60252
60252
|
}
|
|
60253
|
+
function HiDotsHorizontal(props) {
|
|
60254
|
+
return GenIcon({ "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "d": "M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z" }, "child": [] }] })(props);
|
|
60255
|
+
}
|
|
60253
60256
|
function HiExclamationCircle(props) {
|
|
60254
60257
|
return GenIcon({ "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z", "clipRule": "evenodd" }, "child": [] }] })(props);
|
|
60255
60258
|
}
|
|
@@ -80515,10 +80518,13 @@ const OverflowMenuItem$1 = styled.div`
|
|
|
80515
80518
|
const OverflowMenuItem = ({ children: children2, onClick }) => {
|
|
80516
80519
|
return /* @__PURE__ */ jsxRuntime.jsx(OverflowMenuItem$1, { onClick, children: children2 });
|
|
80517
80520
|
};
|
|
80521
|
+
const DefaultTrigger = () => {
|
|
80522
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button$1, { isIconButton: true, themeType: "secondary", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(HiDotsHorizontal, {}) });
|
|
80523
|
+
};
|
|
80518
80524
|
const OverflowMenu = ({
|
|
80519
80525
|
items,
|
|
80520
80526
|
children: children2,
|
|
80521
|
-
trigger,
|
|
80527
|
+
trigger = /* @__PURE__ */ jsxRuntime.jsx(DefaultTrigger, {}),
|
|
80522
80528
|
isOpen: controlledIsOpen,
|
|
80523
80529
|
onOpenChange,
|
|
80524
80530
|
placement = "bottom",
|
|
@@ -80792,15 +80798,12 @@ const getTextComponent = (firstBarData, secondBarData, stateColor, theme, isText
|
|
|
80792
80798
|
);
|
|
80793
80799
|
};
|
|
80794
80800
|
const getCombinedPercent = (firstBarData, secondBarData) => {
|
|
80795
|
-
if (secondBarData?.value
|
|
80796
|
-
|
|
80797
|
-
}
|
|
80798
|
-
if (firstBarData?.value && secondBarData?.value) {
|
|
80799
|
-
const total = firstBarData?.value + secondBarData?.value;
|
|
80801
|
+
if (firstBarData?.value !== void 0 && secondBarData?.value !== void 0) {
|
|
80802
|
+
const total = firstBarData.value + secondBarData.value;
|
|
80800
80803
|
const dividedBy = total / 2;
|
|
80801
|
-
return dividedBy;
|
|
80804
|
+
return Math.round(dividedBy);
|
|
80802
80805
|
}
|
|
80803
|
-
return 0;
|
|
80806
|
+
return firstBarData?.value || 0;
|
|
80804
80807
|
};
|
|
80805
80808
|
const Progress = ({
|
|
80806
80809
|
firstBarData,
|
|
@@ -80819,6 +80822,7 @@ const Progress = ({
|
|
|
80819
80822
|
strokeColor: theme?.colors?.inputs?.progress?.[secondBarData.status]
|
|
80820
80823
|
} : null;
|
|
80821
80824
|
const stateColor = strokeColor;
|
|
80825
|
+
const percentDisplayWidth = 110;
|
|
80822
80826
|
const gap = 8;
|
|
80823
80827
|
if (isSingleBarOverallSuccess && secondBarData !== null) {
|
|
80824
80828
|
const overallPercent = secondBarData.value;
|
|
@@ -80834,30 +80838,79 @@ const Progress = ({
|
|
|
80834
80838
|
showInfo: false
|
|
80835
80839
|
}
|
|
80836
80840
|
),
|
|
80837
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
80838
|
-
|
|
80839
|
-
|
|
80840
|
-
|
|
80841
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
80842
|
+
"div",
|
|
80843
|
+
{
|
|
80844
|
+
style: {
|
|
80845
|
+
display: "flex",
|
|
80846
|
+
alignItems: "center",
|
|
80847
|
+
width: percentDisplayWidth
|
|
80848
|
+
},
|
|
80849
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: textColor, variant: "digits3", children: [
|
|
80850
|
+
overallPercent,
|
|
80851
|
+
"%"
|
|
80852
|
+
] })
|
|
80853
|
+
}
|
|
80854
|
+
)
|
|
80841
80855
|
] });
|
|
80842
80856
|
}
|
|
80843
80857
|
if (isProgressCombined) {
|
|
80844
80858
|
const combinedPercent = getCombinedPercent(firstBarData, secondBarData);
|
|
80845
80859
|
const textColor = Number(combinedPercent) === 100 ? "green" : "black";
|
|
80860
|
+
const adjustedFirstBar = secondBarData?.value === 100 ? 100 : firstBarData?.value || 0;
|
|
80861
|
+
const firstBarStrokeColor = theme?.colors?.inputs?.progress?.[firstBarData?.status || "info"];
|
|
80862
|
+
const secondBarStrokeColor = secondBarData?.value && secondBarData.value > 0 ? theme?.colors?.inputs?.progress?.[secondBarData.status] : null;
|
|
80863
|
+
secondBarData?.value && secondBarData.value > 0 ? {
|
|
80864
|
+
percent: secondBarData.value
|
|
80865
|
+
} : null;
|
|
80846
80866
|
return /* @__PURE__ */ jsxRuntime.jsxs(Tile, { style: { width, height, alignItems: "center", gap }, isHorizontal: true, children: [
|
|
80867
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", width: "100%" }, children: [
|
|
80868
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
80869
|
+
Progress$1,
|
|
80870
|
+
{
|
|
80871
|
+
"data-testid": "progress",
|
|
80872
|
+
percent: adjustedFirstBar,
|
|
80873
|
+
strokeColor: firstBarStrokeColor,
|
|
80874
|
+
showInfo: false
|
|
80875
|
+
}
|
|
80876
|
+
),
|
|
80877
|
+
secondBarData?.value && secondBarData.value > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
80878
|
+
"div",
|
|
80879
|
+
{
|
|
80880
|
+
style: {
|
|
80881
|
+
position: "absolute",
|
|
80882
|
+
top: 0,
|
|
80883
|
+
left: 0,
|
|
80884
|
+
width: "100%",
|
|
80885
|
+
height: "100%",
|
|
80886
|
+
pointerEvents: "none"
|
|
80887
|
+
},
|
|
80888
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
80889
|
+
Progress$1,
|
|
80890
|
+
{
|
|
80891
|
+
percent: secondBarData.value,
|
|
80892
|
+
strokeColor: secondBarStrokeColor,
|
|
80893
|
+
showInfo: false,
|
|
80894
|
+
style: { background: "transparent" }
|
|
80895
|
+
}
|
|
80896
|
+
)
|
|
80897
|
+
}
|
|
80898
|
+
) : null
|
|
80899
|
+
] }),
|
|
80847
80900
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
80848
|
-
|
|
80901
|
+
"div",
|
|
80849
80902
|
{
|
|
80850
|
-
|
|
80851
|
-
|
|
80852
|
-
|
|
80853
|
-
|
|
80854
|
-
|
|
80903
|
+
style: {
|
|
80904
|
+
display: "flex",
|
|
80905
|
+
alignItems: "center",
|
|
80906
|
+
width: percentDisplayWidth
|
|
80907
|
+
},
|
|
80908
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: textColor, variant: "digits3", children: [
|
|
80909
|
+
combinedPercent,
|
|
80910
|
+
"%"
|
|
80911
|
+
] })
|
|
80855
80912
|
}
|
|
80856
|
-
)
|
|
80857
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", alignItems: "center", width: 80 }, children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: textColor, variant: "digits3", children: [
|
|
80858
|
-
combinedPercent,
|
|
80859
|
-
"%"
|
|
80860
|
-
] }) })
|
|
80913
|
+
)
|
|
80861
80914
|
] });
|
|
80862
80915
|
}
|
|
80863
80916
|
if (isTextBeforeBar) {
|
|
@@ -83922,6 +83975,7 @@ function Table({
|
|
|
83922
83975
|
size = "small",
|
|
83923
83976
|
onChange,
|
|
83924
83977
|
rowSelection,
|
|
83978
|
+
onRowClick,
|
|
83925
83979
|
pagination,
|
|
83926
83980
|
isMainContentCell = false,
|
|
83927
83981
|
isMaterializedView = false,
|
|
@@ -83934,6 +83988,7 @@ function Table({
|
|
|
83934
83988
|
const [dynamicHeight, setDynamicHeight] = React__namespace.useState(
|
|
83935
83989
|
400
|
|
83936
83990
|
);
|
|
83991
|
+
const [selectedRowKeys, setSelectedRowKeys] = React__namespace.useState([]);
|
|
83937
83992
|
const tableRef = React__namespace.useRef(null);
|
|
83938
83993
|
const containerRef = React__namespace.useRef(null);
|
|
83939
83994
|
React__namespace.useEffect(() => {
|
|
@@ -84036,6 +84091,61 @@ function Table({
|
|
|
84036
84091
|
return rest.scroll;
|
|
84037
84092
|
}, [isMaterializedView, materializedViewConfig, dynamicHeight, rest.scroll]);
|
|
84038
84093
|
const tableDataSource = isMaterializedView ? materializedData : dataSource;
|
|
84094
|
+
const handleRowClick = React__namespace.useCallback(
|
|
84095
|
+
(record, index2, event) => {
|
|
84096
|
+
console.log("Row clicked:", record, "index:", index2);
|
|
84097
|
+
const target = event.target;
|
|
84098
|
+
const isInteractiveElement = target.closest(
|
|
84099
|
+
'button, a, input, select, textarea, [role="button"], [onclick]'
|
|
84100
|
+
);
|
|
84101
|
+
console.log("Is interactive element:", isInteractiveElement);
|
|
84102
|
+
if (isInteractiveElement) {
|
|
84103
|
+
console.log("Skipping row selection due to interactive element");
|
|
84104
|
+
return;
|
|
84105
|
+
}
|
|
84106
|
+
if (!rowSelection || !rowSelection.onChange) {
|
|
84107
|
+
console.log("No row selection or onChange handler");
|
|
84108
|
+
return;
|
|
84109
|
+
}
|
|
84110
|
+
if (rowSelection.getCheckboxProps) {
|
|
84111
|
+
const checkboxProps = rowSelection.getCheckboxProps(record);
|
|
84112
|
+
if (checkboxProps.disabled) {
|
|
84113
|
+
console.log("Row is disabled for selection:", record);
|
|
84114
|
+
return;
|
|
84115
|
+
}
|
|
84116
|
+
}
|
|
84117
|
+
const currentSelectedKeys = selectedRowKeys;
|
|
84118
|
+
const recordKey = typeof rowKey === "function" ? rowKey(record) : record[rowKey];
|
|
84119
|
+
console.log("Current selected keys:", currentSelectedKeys);
|
|
84120
|
+
console.log("Record key:", recordKey);
|
|
84121
|
+
const newSelectedKeys = currentSelectedKeys.includes(recordKey) ? currentSelectedKeys.filter((key) => key !== recordKey) : [...currentSelectedKeys, recordKey];
|
|
84122
|
+
console.log("New selected keys:", newSelectedKeys);
|
|
84123
|
+
setSelectedRowKeys(newSelectedKeys);
|
|
84124
|
+
const selectedRows = tableDataSource.filter((record2) => {
|
|
84125
|
+
const key = typeof rowKey === "function" ? rowKey(record2) : record2[rowKey];
|
|
84126
|
+
return newSelectedKeys.includes(key);
|
|
84127
|
+
});
|
|
84128
|
+
console.log("Selected rows:", selectedRows);
|
|
84129
|
+
rowSelection.onChange(newSelectedKeys, selectedRows);
|
|
84130
|
+
},
|
|
84131
|
+
[rowSelection, rowKey, tableDataSource, selectedRowKeys]
|
|
84132
|
+
);
|
|
84133
|
+
const enhancedRowSelection = React__namespace.useMemo(() => {
|
|
84134
|
+
if (!rowSelection) return;
|
|
84135
|
+
return {
|
|
84136
|
+
...rowSelection,
|
|
84137
|
+
selectedRowKeys,
|
|
84138
|
+
// Use internal state
|
|
84139
|
+
// Override the onChange to ensure we get the latest data
|
|
84140
|
+
onChange: (selectedRowKeys2, selectedRows) => {
|
|
84141
|
+
console.log("Row selection changed:", selectedRowKeys2, selectedRows);
|
|
84142
|
+
setSelectedRowKeys(selectedRowKeys2);
|
|
84143
|
+
if (rowSelection.onChange) {
|
|
84144
|
+
rowSelection.onChange(selectedRowKeys2, selectedRows);
|
|
84145
|
+
}
|
|
84146
|
+
}
|
|
84147
|
+
};
|
|
84148
|
+
}, [rowSelection, selectedRowKeys]);
|
|
84039
84149
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
84040
84150
|
Table$1,
|
|
84041
84151
|
{
|
|
@@ -84047,7 +84157,17 @@ function Table({
|
|
|
84047
84157
|
locale: { emptyText: "No Data" },
|
|
84048
84158
|
size,
|
|
84049
84159
|
onChange,
|
|
84050
|
-
rowSelection,
|
|
84160
|
+
rowSelection: enhancedRowSelection,
|
|
84161
|
+
onRow: (record, index2) => {
|
|
84162
|
+
const isDisabled = rowSelection?.getCheckboxProps?.(record)?.disabled ?? false;
|
|
84163
|
+
return {
|
|
84164
|
+
onClick: (event) => handleRowClick(record, index2 ?? 0, event),
|
|
84165
|
+
style: {
|
|
84166
|
+
cursor: rowSelection && !isDisabled ? "pointer" : "default",
|
|
84167
|
+
opacity: isDisabled ? 0.6 : 1
|
|
84168
|
+
}
|
|
84169
|
+
};
|
|
84170
|
+
},
|
|
84051
84171
|
pagination: paginationConfig,
|
|
84052
84172
|
scroll: scrollConfig,
|
|
84053
84173
|
onScroll: isMaterializedView ? handleScroll : void 0,
|
|
@@ -84108,6 +84228,9 @@ const defaultRowSelection = (record) => ({
|
|
|
84108
84228
|
});
|
|
84109
84229
|
const useTable = (useTableConfig) => {
|
|
84110
84230
|
const [isLoading, setLoading] = React.useState(true);
|
|
84231
|
+
const [hasErrored, setHasErrored] = React.useState(false);
|
|
84232
|
+
const hasFetchedRef = React.useRef(false);
|
|
84233
|
+
const isDisabledRef = React.useRef(false);
|
|
84111
84234
|
const {
|
|
84112
84235
|
columns,
|
|
84113
84236
|
filters = null,
|
|
@@ -84134,14 +84257,39 @@ const useTable = (useTableConfig) => {
|
|
|
84134
84257
|
error: null
|
|
84135
84258
|
});
|
|
84136
84259
|
const [selectedRows, setSelectedRows] = React.useState([]);
|
|
84260
|
+
const [selectedRowKeys, setSelectedRowKeys] = React.useState([]);
|
|
84261
|
+
const memoizedFetchOptions = React.useMemo(
|
|
84262
|
+
() => fetchOptions,
|
|
84263
|
+
[fetchOptions.method, fetchOptions.headers, fetchOptions.body]
|
|
84264
|
+
);
|
|
84137
84265
|
React.useEffect(() => {
|
|
84138
|
-
if (disableAutoFetch
|
|
84266
|
+
if (disableAutoFetch) {
|
|
84267
|
+
isDisabledRef.current = true;
|
|
84268
|
+
setLoading(false);
|
|
84269
|
+
return;
|
|
84270
|
+
}
|
|
84271
|
+
if (hasFetchedRef.current || hasErrored || isDisabledRef.current) {
|
|
84139
84272
|
setLoading(false);
|
|
84140
84273
|
return;
|
|
84141
84274
|
}
|
|
84142
84275
|
const fetchData = async () => {
|
|
84143
84276
|
try {
|
|
84144
|
-
|
|
84277
|
+
hasFetchedRef.current = true;
|
|
84278
|
+
const response = await fetch(fetchUrl, memoizedFetchOptions);
|
|
84279
|
+
if (response.status === 404) {
|
|
84280
|
+
console.warn(`Table data not found at ${fetchUrl}, stopping retries`);
|
|
84281
|
+
setHasErrored(true);
|
|
84282
|
+
setData({
|
|
84283
|
+
dataSource: initialDataSource,
|
|
84284
|
+
columns,
|
|
84285
|
+
error: new Error(`Data not found at ${fetchUrl}`)
|
|
84286
|
+
});
|
|
84287
|
+
setLoading(false);
|
|
84288
|
+
return;
|
|
84289
|
+
}
|
|
84290
|
+
if (!response.ok) {
|
|
84291
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
84292
|
+
}
|
|
84145
84293
|
const result = await response.json();
|
|
84146
84294
|
const sourceData = result.data || [];
|
|
84147
84295
|
setOriginalData(sourceData);
|
|
@@ -84150,10 +84298,12 @@ const useTable = (useTableConfig) => {
|
|
|
84150
84298
|
columns,
|
|
84151
84299
|
error: null
|
|
84152
84300
|
});
|
|
84301
|
+
setHasErrored(false);
|
|
84153
84302
|
} catch (error2) {
|
|
84154
84303
|
console.error("Error fetching table data:", error2);
|
|
84304
|
+
setHasErrored(true);
|
|
84155
84305
|
setData({
|
|
84156
|
-
dataSource:
|
|
84306
|
+
dataSource: initialDataSource,
|
|
84157
84307
|
columns,
|
|
84158
84308
|
error: error2 instanceof Error ? error2 : new Error(String(error2))
|
|
84159
84309
|
});
|
|
@@ -84166,11 +84316,19 @@ const useTable = (useTableConfig) => {
|
|
|
84166
84316
|
} else {
|
|
84167
84317
|
fetchData();
|
|
84168
84318
|
}
|
|
84169
|
-
}, [
|
|
84319
|
+
}, [
|
|
84320
|
+
memoizedFetchOptions,
|
|
84321
|
+
disableAutoFetch,
|
|
84322
|
+
hasErrored,
|
|
84323
|
+
fetchUrl,
|
|
84324
|
+
columns,
|
|
84325
|
+
initialDataSource
|
|
84326
|
+
]);
|
|
84170
84327
|
const handleRowSelection = React.useCallback(
|
|
84171
|
-
(
|
|
84172
|
-
console.log("Row Selected:",
|
|
84173
|
-
|
|
84328
|
+
(newSelectedRowKeys, newSelectedRows) => {
|
|
84329
|
+
console.log("Row Selected:", newSelectedRowKeys, newSelectedRows);
|
|
84330
|
+
setSelectedRowKeys(newSelectedRowKeys);
|
|
84331
|
+
setSelectedRows(newSelectedRows);
|
|
84174
84332
|
},
|
|
84175
84333
|
[]
|
|
84176
84334
|
);
|
|
@@ -84181,19 +84339,29 @@ const useTable = (useTableConfig) => {
|
|
|
84181
84339
|
dataSource: newDataSource
|
|
84182
84340
|
}));
|
|
84183
84341
|
}, []);
|
|
84342
|
+
const retry = React.useCallback(() => {
|
|
84343
|
+
setHasErrored(false);
|
|
84344
|
+
hasFetchedRef.current = false;
|
|
84345
|
+
isDisabledRef.current = false;
|
|
84346
|
+
setLoading(true);
|
|
84347
|
+
}, []);
|
|
84184
84348
|
const rowSelection = {
|
|
84185
84349
|
type: selectionType,
|
|
84350
|
+
selectedRowKeys,
|
|
84186
84351
|
onChange: handleRowSelection,
|
|
84187
84352
|
getCheckboxProps: disableRowSelection
|
|
84188
84353
|
};
|
|
84189
84354
|
return {
|
|
84190
84355
|
...data,
|
|
84191
84356
|
isLoading,
|
|
84357
|
+
hasErrored,
|
|
84192
84358
|
rowSelection,
|
|
84193
84359
|
selectedRows,
|
|
84360
|
+
selectedRowKeys,
|
|
84194
84361
|
hasSettings,
|
|
84195
84362
|
hasFilter,
|
|
84196
|
-
updateDataSource
|
|
84363
|
+
updateDataSource,
|
|
84364
|
+
retry
|
|
84197
84365
|
};
|
|
84198
84366
|
};
|
|
84199
84367
|
function HiMiniAdjustmentsVertical(props) {
|
|
@@ -84467,7 +84635,8 @@ const TableControls = ({
|
|
|
84467
84635
|
const TableWithControls = ({
|
|
84468
84636
|
tableData,
|
|
84469
84637
|
tableControlsData: tableControlsData2,
|
|
84470
|
-
onChange
|
|
84638
|
+
onChange,
|
|
84639
|
+
onRowClick
|
|
84471
84640
|
}) => {
|
|
84472
84641
|
const { primaryTableRowData, secondaryTableRowData } = tableControlsData2;
|
|
84473
84642
|
const {
|
|
@@ -84504,6 +84673,7 @@ const TableWithControls = ({
|
|
|
84504
84673
|
columns,
|
|
84505
84674
|
rowSelection,
|
|
84506
84675
|
onChange: onTableChange,
|
|
84676
|
+
onRowClick,
|
|
84507
84677
|
isMaterializedView,
|
|
84508
84678
|
materializedViewConfig
|
|
84509
84679
|
}
|
|
@@ -84567,6 +84737,50 @@ const mockColumns = [
|
|
|
84567
84737
|
state: colorStateMap[jobSubtype]
|
|
84568
84738
|
});
|
|
84569
84739
|
}
|
|
84740
|
+
},
|
|
84741
|
+
{
|
|
84742
|
+
title: "Progress",
|
|
84743
|
+
dataIndex: "progress",
|
|
84744
|
+
render: (progress) => {
|
|
84745
|
+
if (!progress) return null;
|
|
84746
|
+
return React.createElement(Progress, {
|
|
84747
|
+
firstBarData: progress.firstBarData,
|
|
84748
|
+
secondBarData: progress.secondBarData,
|
|
84749
|
+
width: 150,
|
|
84750
|
+
height: 20,
|
|
84751
|
+
isProgressCombined: true
|
|
84752
|
+
});
|
|
84753
|
+
}
|
|
84754
|
+
},
|
|
84755
|
+
{
|
|
84756
|
+
title: "Actions",
|
|
84757
|
+
key: "actions",
|
|
84758
|
+
render: (record) => {
|
|
84759
|
+
const menuItems = [
|
|
84760
|
+
{
|
|
84761
|
+
id: "edit",
|
|
84762
|
+
children: "Edit",
|
|
84763
|
+
onClick: () => {
|
|
84764
|
+
console.log("Edit clicked for record:", record.id);
|
|
84765
|
+
}
|
|
84766
|
+
},
|
|
84767
|
+
{
|
|
84768
|
+
id: "delete",
|
|
84769
|
+
children: "Delete",
|
|
84770
|
+
onClick: () => {
|
|
84771
|
+
console.log("Delete clicked for record:", record.id);
|
|
84772
|
+
}
|
|
84773
|
+
}
|
|
84774
|
+
];
|
|
84775
|
+
return React.createElement(OverflowMenu, {
|
|
84776
|
+
items: menuItems,
|
|
84777
|
+
onItemClick: (item) => {
|
|
84778
|
+
if (item.onClick) {
|
|
84779
|
+
item.onClick();
|
|
84780
|
+
}
|
|
84781
|
+
}
|
|
84782
|
+
});
|
|
84783
|
+
}
|
|
84570
84784
|
}
|
|
84571
84785
|
];
|
|
84572
84786
|
mockColumns.map((column2) => ({
|
|
@@ -84583,7 +84797,19 @@ const mockDataSource = {
|
|
|
84583
84797
|
nickname: "Home",
|
|
84584
84798
|
address: "123 Main St"
|
|
84585
84799
|
},
|
|
84586
|
-
job_subtype: "delivery"
|
|
84800
|
+
job_subtype: "delivery",
|
|
84801
|
+
progress: {
|
|
84802
|
+
firstBarData: {
|
|
84803
|
+
text: "Loading",
|
|
84804
|
+
status: "info",
|
|
84805
|
+
value: 100
|
|
84806
|
+
},
|
|
84807
|
+
secondBarData: {
|
|
84808
|
+
text: "Processing",
|
|
84809
|
+
status: "success",
|
|
84810
|
+
value: 25
|
|
84811
|
+
}
|
|
84812
|
+
}
|
|
84587
84813
|
},
|
|
84588
84814
|
{
|
|
84589
84815
|
id: "2",
|
|
@@ -84594,7 +84820,19 @@ const mockDataSource = {
|
|
|
84594
84820
|
nickname: "Work",
|
|
84595
84821
|
address: "456 Elm St"
|
|
84596
84822
|
},
|
|
84597
|
-
job_subtype: "pickup"
|
|
84823
|
+
job_subtype: "pickup",
|
|
84824
|
+
progress: {
|
|
84825
|
+
firstBarData: {
|
|
84826
|
+
text: "Preparing",
|
|
84827
|
+
status: "info",
|
|
84828
|
+
value: 100
|
|
84829
|
+
},
|
|
84830
|
+
secondBarData: {
|
|
84831
|
+
text: "Final Check",
|
|
84832
|
+
status: "success",
|
|
84833
|
+
value: 0
|
|
84834
|
+
}
|
|
84835
|
+
}
|
|
84598
84836
|
},
|
|
84599
84837
|
{
|
|
84600
84838
|
id: "3",
|
|
@@ -84605,7 +84843,19 @@ const mockDataSource = {
|
|
|
84605
84843
|
nickname: "Store",
|
|
84606
84844
|
address: "789 Oak St"
|
|
84607
84845
|
},
|
|
84608
|
-
job_subtype: "delivery"
|
|
84846
|
+
job_subtype: "delivery",
|
|
84847
|
+
progress: {
|
|
84848
|
+
firstBarData: {
|
|
84849
|
+
text: "Pending",
|
|
84850
|
+
status: "info",
|
|
84851
|
+
value: 0
|
|
84852
|
+
},
|
|
84853
|
+
secondBarData: {
|
|
84854
|
+
text: "Awaiting",
|
|
84855
|
+
status: "success",
|
|
84856
|
+
value: 0
|
|
84857
|
+
}
|
|
84858
|
+
}
|
|
84609
84859
|
},
|
|
84610
84860
|
{
|
|
84611
84861
|
id: "4",
|
|
@@ -84616,7 +84866,19 @@ const mockDataSource = {
|
|
|
84616
84866
|
nickname: "Office",
|
|
84617
84867
|
address: "321 Pine St"
|
|
84618
84868
|
},
|
|
84619
|
-
job_subtype: "pickup"
|
|
84869
|
+
job_subtype: "pickup",
|
|
84870
|
+
progress: {
|
|
84871
|
+
firstBarData: {
|
|
84872
|
+
text: "In Progress",
|
|
84873
|
+
status: "info",
|
|
84874
|
+
value: 100
|
|
84875
|
+
},
|
|
84876
|
+
secondBarData: {
|
|
84877
|
+
text: "Validation",
|
|
84878
|
+
status: "success",
|
|
84879
|
+
value: 30
|
|
84880
|
+
}
|
|
84881
|
+
}
|
|
84620
84882
|
},
|
|
84621
84883
|
{
|
|
84622
84884
|
id: "5",
|
|
@@ -84627,7 +84889,19 @@ const mockDataSource = {
|
|
|
84627
84889
|
nickname: "Library",
|
|
84628
84890
|
address: "555 Book Lane"
|
|
84629
84891
|
},
|
|
84630
|
-
job_subtype: "delivery"
|
|
84892
|
+
job_subtype: "delivery",
|
|
84893
|
+
progress: {
|
|
84894
|
+
firstBarData: {
|
|
84895
|
+
text: "Completed",
|
|
84896
|
+
status: "info",
|
|
84897
|
+
value: 100
|
|
84898
|
+
},
|
|
84899
|
+
secondBarData: {
|
|
84900
|
+
text: "Verified",
|
|
84901
|
+
status: "success",
|
|
84902
|
+
value: 100
|
|
84903
|
+
}
|
|
84904
|
+
}
|
|
84631
84905
|
},
|
|
84632
84906
|
{
|
|
84633
84907
|
id: "6",
|
|
@@ -84638,7 +84912,19 @@ const mockDataSource = {
|
|
|
84638
84912
|
nickname: "Gym",
|
|
84639
84913
|
address: "777 Fitness Ave"
|
|
84640
84914
|
},
|
|
84641
|
-
job_subtype: "pickup"
|
|
84915
|
+
job_subtype: "pickup",
|
|
84916
|
+
progress: {
|
|
84917
|
+
firstBarData: {
|
|
84918
|
+
text: "Phase 1",
|
|
84919
|
+
status: "info",
|
|
84920
|
+
value: 75
|
|
84921
|
+
},
|
|
84922
|
+
secondBarData: {
|
|
84923
|
+
text: "Phase 2",
|
|
84924
|
+
status: "success",
|
|
84925
|
+
value: 50
|
|
84926
|
+
}
|
|
84927
|
+
}
|
|
84642
84928
|
},
|
|
84643
84929
|
{
|
|
84644
84930
|
id: "7",
|
|
@@ -84649,7 +84935,19 @@ const mockDataSource = {
|
|
|
84649
84935
|
nickname: "Mall",
|
|
84650
84936
|
address: "888 Shopping Center"
|
|
84651
84937
|
},
|
|
84652
|
-
job_subtype: "delivery"
|
|
84938
|
+
job_subtype: "delivery",
|
|
84939
|
+
progress: {
|
|
84940
|
+
firstBarData: {
|
|
84941
|
+
text: "Queued",
|
|
84942
|
+
status: "info",
|
|
84943
|
+
value: 0
|
|
84944
|
+
},
|
|
84945
|
+
secondBarData: {
|
|
84946
|
+
text: "Waiting",
|
|
84947
|
+
status: "success",
|
|
84948
|
+
value: 0
|
|
84949
|
+
}
|
|
84950
|
+
}
|
|
84653
84951
|
},
|
|
84654
84952
|
{
|
|
84655
84953
|
id: "8",
|
|
@@ -84660,7 +84958,19 @@ const mockDataSource = {
|
|
|
84660
84958
|
nickname: "School",
|
|
84661
84959
|
address: "999 Education Rd"
|
|
84662
84960
|
},
|
|
84663
|
-
job_subtype: "pickup"
|
|
84961
|
+
job_subtype: "pickup",
|
|
84962
|
+
progress: {
|
|
84963
|
+
firstBarData: {
|
|
84964
|
+
text: "Delivered",
|
|
84965
|
+
status: "info",
|
|
84966
|
+
value: 100
|
|
84967
|
+
},
|
|
84968
|
+
secondBarData: {
|
|
84969
|
+
text: "Confirmed",
|
|
84970
|
+
status: "success",
|
|
84971
|
+
value: 100
|
|
84972
|
+
}
|
|
84973
|
+
}
|
|
84664
84974
|
},
|
|
84665
84975
|
{
|
|
84666
84976
|
id: "9",
|
|
@@ -84671,7 +84981,19 @@ const mockDataSource = {
|
|
|
84671
84981
|
nickname: "Restaurant",
|
|
84672
84982
|
address: "111 Food Court"
|
|
84673
84983
|
},
|
|
84674
|
-
job_subtype: "delivery"
|
|
84984
|
+
job_subtype: "delivery",
|
|
84985
|
+
progress: {
|
|
84986
|
+
firstBarData: {
|
|
84987
|
+
text: "Preparing",
|
|
84988
|
+
status: "info",
|
|
84989
|
+
value: 100
|
|
84990
|
+
},
|
|
84991
|
+
secondBarData: {
|
|
84992
|
+
text: "Quality Check",
|
|
84993
|
+
status: "success",
|
|
84994
|
+
value: 15
|
|
84995
|
+
}
|
|
84996
|
+
}
|
|
84675
84997
|
},
|
|
84676
84998
|
{
|
|
84677
84999
|
id: "10",
|
|
@@ -84682,7 +85004,19 @@ const mockDataSource = {
|
|
|
84682
85004
|
nickname: "Park",
|
|
84683
85005
|
address: "222 Green Ave"
|
|
84684
85006
|
},
|
|
84685
|
-
job_subtype: "pickup"
|
|
85007
|
+
job_subtype: "pickup",
|
|
85008
|
+
progress: {
|
|
85009
|
+
firstBarData: {
|
|
85010
|
+
text: "Processing",
|
|
85011
|
+
status: "info",
|
|
85012
|
+
value: 80
|
|
85013
|
+
},
|
|
85014
|
+
secondBarData: {
|
|
85015
|
+
text: "Review",
|
|
85016
|
+
status: "success",
|
|
85017
|
+
value: 0
|
|
85018
|
+
}
|
|
85019
|
+
}
|
|
84686
85020
|
},
|
|
84687
85021
|
{
|
|
84688
85022
|
id: "11",
|
|
@@ -84856,9 +85190,10 @@ const startingUseTableConfig = {
|
|
|
84856
85190
|
dataSource: []
|
|
84857
85191
|
};
|
|
84858
85192
|
const useTableWithControls = (tableConfig) => {
|
|
84859
|
-
const [useTableConfig, setUseTableConfig] = React.useState(
|
|
84860
|
-
startingUseTableConfig
|
|
84861
|
-
|
|
85193
|
+
const [useTableConfig, setUseTableConfig] = React.useState(() => ({
|
|
85194
|
+
...startingUseTableConfig,
|
|
85195
|
+
...tableConfig
|
|
85196
|
+
}));
|
|
84862
85197
|
const [groups, setGroups] = React.useState(
|
|
84863
85198
|
tableControlsData.secondaryTableRowData.groups
|
|
84864
85199
|
);
|
|
@@ -84869,20 +85204,22 @@ const useTableWithControls = (tableConfig) => {
|
|
|
84869
85204
|
});
|
|
84870
85205
|
const { secondaryTableRowData } = tableControlsData;
|
|
84871
85206
|
const {
|
|
84872
|
-
dataSource,
|
|
85207
|
+
dataSource: hookDataSource,
|
|
84873
85208
|
columns,
|
|
84874
85209
|
rowSelection,
|
|
85210
|
+
selectedRows,
|
|
85211
|
+
selectedRowKeys,
|
|
84875
85212
|
hasSettings,
|
|
84876
85213
|
hasFilter,
|
|
84877
85214
|
updateDataSource
|
|
84878
85215
|
} = useTable(useTableConfig);
|
|
85216
|
+
const dataSource = tableConfig.dataSource || hookDataSource;
|
|
84879
85217
|
const safeDataSource = dataSource || [];
|
|
84880
85218
|
const newSecondaryTableRowData = {
|
|
84881
85219
|
...secondaryTableRowData,
|
|
84882
85220
|
groups,
|
|
84883
85221
|
totalRecords: safeDataSource.length
|
|
84884
85222
|
};
|
|
84885
|
-
if (!dataSource) return null;
|
|
84886
85223
|
const onGroupItemClick = (title, item) => {
|
|
84887
85224
|
const newGroups = { ...groups };
|
|
84888
85225
|
newGroups[title] = newGroups[title].filter((group) => group !== item);
|
|
@@ -84972,6 +85309,8 @@ const useTableWithControls = (tableConfig) => {
|
|
|
84972
85309
|
dataSource: safeDataSource,
|
|
84973
85310
|
columns,
|
|
84974
85311
|
rowSelection,
|
|
85312
|
+
selectedRows,
|
|
85313
|
+
selectedRowKeys,
|
|
84975
85314
|
updateDataSource
|
|
84976
85315
|
};
|
|
84977
85316
|
};
|