@headless-adminapp/fluent 0.0.17-alpha.53 → 0.0.17-alpha.56
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/App/App.js +11 -7
- package/App/AppHeaderContianer.js +50 -44
- package/App/AppLogo.js +12 -9
- package/App/AppStringContext.js +13 -9
- package/App/AppUI.js +15 -11
- package/App/LayoutProvider.js +16 -24
- package/App/NavigationContainer.js +28 -28
- package/App/QuickActionItem.js +10 -6
- package/App/index.js +5 -1
- package/App/utils.js +7 -5
- package/CommandBar/Button.js +17 -14
- package/CommandBar/Divider.js +9 -6
- package/CommandBar/IconButton.js +16 -13
- package/CommandBar/Label.js +11 -8
- package/CommandBar/MenuButton.js +20 -17
- package/CommandBar/MenuItem.js +19 -16
- package/CommandBar/MenuItems.js +10 -10
- package/CommandBar/MenuList.js +12 -9
- package/CommandBar/Wrapper.js +10 -7
- package/CommandBar/index.js +15 -13
- package/DataForm/SectionControl.js +7 -4
- package/DataGrid/ActionCell.js +14 -11
- package/DataGrid/CommandContainer.js +10 -6
- package/DataGrid/CustomizeColumns/AddColumns.js +61 -59
- package/DataGrid/CustomizeColumns/ColumnItem.js +23 -19
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +41 -36
- package/DataGrid/CustomizeColumns/index.js +5 -1
- package/DataGrid/FormSubgridCommandContainer.js +17 -13
- package/DataGrid/FormSubgridViewSelector.js +21 -21
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +33 -33
- package/DataGrid/GridColumnHeader/FilterForm.js +28 -27
- package/DataGrid/GridColumnHeader/OperatorSelect.js +19 -13
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +35 -31
- package/DataGrid/GridColumnHeader/index.js +5 -1
- package/DataGrid/GridColumnHeader/utils.js +6 -2
- package/DataGrid/GridHeaderContainer.js +8 -4
- package/DataGrid/GridHeaderDesktop.js +28 -28
- package/DataGrid/GridHeaderMobile.js +20 -19
- package/DataGrid/GridListContainer.js +50 -44
- package/DataGrid/GridPaginationContainer.js +16 -13
- package/DataGrid/GridTableContainer.js +98 -89
- package/DataGrid/TableCell/TableCellAction.js +15 -11
- package/DataGrid/TableCell/TableCellBase.js +13 -4
- package/DataGrid/TableCell/TableCellCheckbox.js +11 -8
- package/DataGrid/TableCell/TableCellChoice.js +15 -13
- package/DataGrid/TableCell/TableCellLink.js +14 -11
- package/DataGrid/TableCell/TableCellText.js +10 -7
- package/DataGrid/TableCell/index.js +20 -4
- package/DataGrid/index.js +11 -4
- package/DataGrid/types.js +2 -1
- package/DataGrid/useTableColumns.js +98 -103
- package/DataGrid/utils.js +5 -1
- package/DialogContainer/AlertDialog.js +11 -11
- package/DialogContainer/ConfirmDialog.js +13 -14
- package/DialogContainer/DialogContainer.js +19 -26
- package/DialogContainer/ErrorDialog.js +15 -15
- package/DialogContainer/PromptDialog.js +76 -58
- package/DialogContainer/index.js +5 -1
- package/Insights/CommandBarContainer.js +17 -11
- package/Insights/FilterBarContainer.js +32 -37
- package/Insights/Grid.js +13 -9
- package/Insights/InsightsContainer.js +22 -19
- package/Insights/WidgetChartContainer.js +34 -30
- package/Insights/WidgetDataGridContainer.js +45 -33
- package/Insights/WidgetTableContainer.js +29 -26
- package/Insights/WidgetTileContainer.js +16 -12
- package/Insights/WidgetTitleBar.js +15 -10
- package/Insights/Widgets.js +28 -25
- package/Insights/charts/AreaChart.js +15 -12
- package/Insights/charts/BarChart.js +15 -12
- package/Insights/charts/ComposedChart.js +15 -13
- package/Insights/charts/CustomTooltipContent.js +13 -9
- package/Insights/charts/GaugeChart.js +6 -3
- package/Insights/charts/LineChart.js +15 -12
- package/Insights/charts/OhlcChart.js +46 -40
- package/Insights/charts/PieChart.js +25 -26
- package/Insights/charts/RadarChart.js +19 -17
- package/Insights/charts/ScatterChart.js +26 -28
- package/Insights/charts/constants.js +4 -1
- package/Insights/charts/formatters.js +33 -23
- package/Insights/charts/index.js +2 -1
- package/Insights/charts/renderers.js +36 -26
- package/Insights/hooks/useQueriesData.js +27 -30
- package/Insights/hooks/useWidgetDetail.js +24 -15
- package/OverflowCommandBar/OverflowCommandBar.js +19 -12
- package/OverflowCommandBar/OverflowMenu.js +22 -30
- package/OverflowCommandBar/OverflowMenuDivider.js +10 -6
- package/OverflowCommandBar/index.js +9 -3
- package/OverflowCommandBar/render.js +15 -10
- package/OverflowCommandBar/utils.js +6 -4
- package/PageBoard/BoardColumn.js +8 -5
- package/PageBoard/BoardColumnCard.d.ts +1 -1
- package/PageBoard/BoardColumnCard.js +15 -11
- package/PageBoard/BoardColumnUI.js +45 -46
- package/PageBoard/BoardingColumnCardLoading.js +13 -10
- package/PageBoard/Header.js +23 -28
- package/PageBoard/PageBoard.js +28 -26
- package/PageBoard/index.js +5 -1
- package/PageEntityForm/CommandContainer.js +25 -21
- package/PageEntityForm/FormTabRelated.js +20 -17
- package/PageEntityForm/PageEntityForm.js +20 -16
- package/PageEntityForm/PageEntityFormDesktopContainer.js +77 -70
- package/PageEntityForm/PageEntityFormStringContext.js +9 -5
- package/PageEntityForm/ProcessFlow.js +24 -21
- package/PageEntityForm/RecordCard.js +31 -24
- package/PageEntityForm/RecordCardLoading.js +13 -11
- package/PageEntityForm/RecordSetNavigatorContainer.js +34 -31
- package/PageEntityForm/RelatedViewSelector.js +34 -36
- package/PageEntityForm/SectionContainer.js +35 -31
- package/PageEntityForm/StandardControl.js +84 -76
- package/PageEntityForm/SubgridControl.js +23 -21
- package/PageEntityForm/index.js +5 -1
- package/PageEntityView/FormSubgridContainer.js +26 -22
- package/PageEntityView/PageEntityView.js +19 -15
- package/PageEntityView/PageEntityViewDesktopContainer.js +13 -9
- package/PageEntityView/PageEntityViewDesktopFrame.js +21 -17
- package/PageEntityView/PageEntityViewMobileContainer.js +13 -9
- package/PageEntityView/PageEntityViewStringContext.js +9 -5
- package/PageEntityView/index.js +5 -1
- package/PageInsights/PageInsights.js +13 -9
- package/PageInsights/index.js +6 -1
- package/ProgressIndicatorContainer/index.js +14 -10
- package/ToastNotificationContainer/index.js +18 -15
- package/componentStore.js +5 -2
- package/components/BodyLoading.js +11 -7
- package/components/DialogLogin.js +8 -5
- package/components/DndProvider.d.ts +12 -0
- package/components/DndProvider.js +68 -0
- package/components/LoginForm.js +46 -36
- package/components/PageBroken.js +8 -5
- package/components/PageLoading.js +8 -5
- package/components/PageLogin.js +17 -14
- package/form/FormControl.js +44 -50
- package/form/FormControlLoading.js +8 -4
- package/form/controls/AttachmentControl.js +72 -77
- package/form/controls/AttachmentsControl.js +24 -30
- package/form/controls/CurrencyControl.js +16 -13
- package/form/controls/DateControl.js +24 -18
- package/form/controls/DateRangeControl.js +22 -18
- package/form/controls/DateTimeControl.js +49 -43
- package/form/controls/DecimalControl.js +14 -11
- package/form/controls/DurationControl.js +18 -14
- package/form/controls/EmailControl.js +14 -11
- package/form/controls/IntegerControl.js +11 -8
- package/form/controls/LookupControl.js +58 -56
- package/form/controls/MultiSelectControl.js +12 -9
- package/form/controls/MultiSelectLookupControl.js +55 -53
- package/form/controls/PasswordControl.js +11 -8
- package/form/controls/RichTextControl.js +32 -5
- package/form/controls/SelectControl.js +15 -13
- package/form/controls/SwitchControl.js +7 -4
- package/form/controls/TelephoneControl.js +10 -7
- package/form/controls/TextAreaControl.js +11 -8
- package/form/controls/TextControl.js +12 -9
- package/form/controls/UrlControl.js +10 -7
- package/form/controls/types.js +2 -1
- package/form/controls/useLookupData.js +43 -54
- package/form/layout/FormBody/FormBody.js +10 -6
- package/form/layout/FormBody/index.js +17 -1
- package/form/layout/FormSection/FormSection.js +31 -20
- package/form/layout/FormSection/FormSectionColumn.js +7 -3
- package/form/layout/FormSection/FormSectionLoading.js +5 -1
- package/form/layout/FormSection/index.js +5 -1
- package/form/layout/FormTab/FormTab.js +21 -17
- package/form/layout/FormTab/FormTabColumn.js +9 -5
- package/form/layout/FormTab/index.js +5 -1
- package/form/layout/TabContext.js +5 -2
- package/form/layout/index.js +9 -3
- package/form/types.js +2 -1
- package/package.json +4 -12
- package/types/index.js +2 -1
- package/utils/avatar.js +4 -1
- package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
- package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
- package/form/controls/NumberControl.d.ts +0 -4
- package/form/controls/NumberControl.js +0 -16
- package/form/controls/utils.d.ts +0 -4
- package/form/controls/utils.js +0 -42
|
@@ -1,54 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderXAxis = renderXAxis;
|
|
4
|
+
exports.renderYAxis = renderYAxis;
|
|
5
|
+
exports.renderGrid = renderGrid;
|
|
6
|
+
exports.renderLine = renderLine;
|
|
7
|
+
exports.renderLines = renderLines;
|
|
8
|
+
exports.renderArea = renderArea;
|
|
9
|
+
exports.renderAreas = renderAreas;
|
|
10
|
+
exports.renderBar = renderBar;
|
|
11
|
+
exports.renderBars = renderBars;
|
|
12
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
13
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
14
|
+
const recharts_1 = require("recharts");
|
|
15
|
+
const formatters_1 = require("./formatters");
|
|
16
|
+
function renderXAxis(axis, forceCategory = false) {
|
|
17
|
+
const xAxisFormatter = (0, formatters_1.createAxisFormatter)(axis.tick);
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: axis.dataKey, name: axis.name, tickFormatter: xAxisFormatter, tickLine: false, minTickGap: 10,
|
|
8
19
|
// padding={{ left: 10, right: 10 }}
|
|
9
20
|
padding: "gap", axisLine: {
|
|
10
|
-
stroke: tokens.colorNeutralBackground6,
|
|
11
|
-
}, fontSize: tokens.fontSizeBase100, tick: {
|
|
12
|
-
fill: tokens.colorNeutralForeground1,
|
|
21
|
+
stroke: react_components_1.tokens.colorNeutralBackground6,
|
|
22
|
+
}, fontSize: react_components_1.tokens.fontSizeBase100, tick: {
|
|
23
|
+
fill: react_components_1.tokens.colorNeutralForeground1,
|
|
13
24
|
opacity: 0.5,
|
|
14
25
|
}, scale: !forceCategory && axis.tick.type === 'time' ? 'time' : 'auto', type: forceCategory || axis.tick.type === 'category' ? 'category' : 'number', domain: axis.domain, height: 16 }));
|
|
15
26
|
}
|
|
16
|
-
|
|
17
|
-
const yAxisFormatter = createAxisFormatter(axis.tick);
|
|
18
|
-
return (
|
|
19
|
-
fill: tokens.colorNeutralForeground1,
|
|
27
|
+
function renderYAxis(axis) {
|
|
28
|
+
const yAxisFormatter = (0, formatters_1.createAxisFormatter)(axis.tick);
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.YAxis, { yAxisId: "left", dataKey: axis.dataKey, tickFormatter: yAxisFormatter, name: axis.name, tickLine: false, fontSize: react_components_1.tokens.fontSizeBase100, axisLine: false, tickMargin: 0, minTickGap: 0, accentHeight: 0, width: 40, scale: "auto", type: "number", domain: axis.domain, tick: {
|
|
30
|
+
fill: react_components_1.tokens.colorNeutralForeground1,
|
|
20
31
|
opacity: 0.5,
|
|
21
32
|
} }));
|
|
22
33
|
}
|
|
23
|
-
|
|
24
|
-
return (
|
|
34
|
+
function renderGrid() {
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { strokeDasharray: "8 4", vertical: false, strokeWidth: 0.2, stroke: react_components_1.tokens.colorNeutralBackground6 }));
|
|
25
36
|
}
|
|
26
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return (_jsx(Line, { yAxisId: 'left', type: line.curveType, data: dataset[(_a = line.dataIndex) !== null && _a !== void 0 ? _a : 0], dataKey: line.dataKey, name: line.dataLabel, stroke: line.color, strokeWidth: 2, dot: false, activeDot: {
|
|
38
|
+
function renderLine(line, dataset) {
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.Line, { yAxisId: 'left', type: line.curveType, data: dataset[line.dataIndex ?? 0], dataKey: line.dataKey, name: line.dataLabel, stroke: line.color, strokeWidth: 2, dot: false, activeDot: {
|
|
30
40
|
stroke: line.color,
|
|
31
41
|
} }, line.dataKey));
|
|
32
42
|
}
|
|
33
43
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
-
|
|
44
|
+
function renderLines(lines, dataset) {
|
|
35
45
|
return lines.map((line) => renderLine(line, dataset));
|
|
36
46
|
}
|
|
37
47
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
38
|
-
|
|
39
|
-
return (
|
|
48
|
+
function renderArea(area, dataset) {
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.Area, { yAxisId: 'left', type: area.curveType, dataKey: area.dataKey, name: area.dataLabel, stroke: area.color, fill: area.color, strokeWidth: 1, dot: false, activeDot: {
|
|
40
50
|
stroke: area.color,
|
|
41
51
|
} }, area.dataKey));
|
|
42
52
|
}
|
|
43
53
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
-
|
|
54
|
+
function renderAreas(areas, dataset) {
|
|
45
55
|
return areas.map((area) => renderArea(area, dataset));
|
|
46
56
|
}
|
|
47
57
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
48
|
-
|
|
49
|
-
return (
|
|
58
|
+
function renderBar(bar, dataset) {
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.Bar, { yAxisId: 'left', type: bar.curveType, dataKey: bar.dataKey, name: bar.dataLabel, stroke: bar.color, fill: bar.color, strokeWidth: 1, stackId: bar.stackId }, bar.dataKey));
|
|
50
60
|
}
|
|
51
61
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
-
|
|
62
|
+
function renderBars(bars, dataset) {
|
|
53
63
|
return bars.map((bar) => renderBar(bar, dataset));
|
|
54
64
|
}
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
4
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
const
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useQueriesData = useQueriesData;
|
|
7
|
+
const insights_1 = require("@headless-adminapp/app/insights");
|
|
8
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
9
|
+
const transport_1 = require("@headless-adminapp/app/transport");
|
|
10
|
+
const widget_1 = require("@headless-adminapp/app/widget");
|
|
11
|
+
const transport_2 = require("@headless-adminapp/core/transport");
|
|
12
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
13
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
function useQueriesData(queries) {
|
|
16
|
+
const dataService = (0, transport_1.useDataService)();
|
|
17
|
+
const insightsState = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (state) => state);
|
|
18
|
+
const widgetState = (0, mutable_1.useContextSelector)(widget_1.WidgetContext, (state) => state);
|
|
19
|
+
const resolvedQueries = (0, react_1.useMemo)(() => {
|
|
23
20
|
return queries.map((item) => {
|
|
24
21
|
if (typeof item === 'function') {
|
|
25
22
|
console.log('temp.item', item, item(insightsState, widgetState));
|
|
@@ -28,10 +25,10 @@ export function useQueriesData(queries) {
|
|
|
28
25
|
return item;
|
|
29
26
|
});
|
|
30
27
|
}, [queries, insightsState, widgetState]);
|
|
31
|
-
const result = useQueries({
|
|
28
|
+
const result = (0, react_query_1.useQueries)({
|
|
32
29
|
queries: resolvedQueries.map((item) => ({
|
|
33
30
|
queryKey: ['insights', 'aggregate', item],
|
|
34
|
-
queryFn: () =>
|
|
31
|
+
queryFn: async () => {
|
|
35
32
|
if (item.type === 'constant') {
|
|
36
33
|
return item.value;
|
|
37
34
|
}
|
|
@@ -42,16 +39,16 @@ export function useQueriesData(queries) {
|
|
|
42
39
|
return dataService.customAction(item.value.actionName, item.value.payload);
|
|
43
40
|
}
|
|
44
41
|
const query = item.value;
|
|
45
|
-
const data =
|
|
42
|
+
const data = await dataService.retriveAggregate(query);
|
|
46
43
|
const transformedData = transformAggregateData(data, query);
|
|
47
44
|
return transformedData;
|
|
48
|
-
}
|
|
45
|
+
},
|
|
49
46
|
})),
|
|
50
47
|
});
|
|
51
48
|
const isPending = result.some((r) => r.isPending);
|
|
52
49
|
const isFetching = result.some((r) => r.isFetching);
|
|
53
50
|
const refetch = () => result.map((r) => r.refetch());
|
|
54
|
-
const data = useMemo(() => {
|
|
51
|
+
const data = (0, react_1.useMemo)(() => {
|
|
55
52
|
return result.map((r) => r.data);
|
|
56
53
|
}, [result]);
|
|
57
54
|
return { isPending, isFetching, dataset: data, refetch };
|
|
@@ -72,19 +69,19 @@ function getAttributeValueTransformer(attribute) {
|
|
|
72
69
|
let transformer = undefined;
|
|
73
70
|
if (attribute.type === 'date') {
|
|
74
71
|
if (attribute.format) {
|
|
75
|
-
transformer = (value) =>
|
|
72
|
+
transformer = (value) => (0, dayjs_1.default)(value, attribute.format)
|
|
76
73
|
.toDate()
|
|
77
74
|
.getTime();
|
|
78
75
|
}
|
|
79
76
|
else if (attribute.value.type === 'function') {
|
|
80
|
-
if (attribute.value.value === AggregateAttributeFunction.YearMonth) {
|
|
81
|
-
transformer = (value) =>
|
|
77
|
+
if (attribute.value.value === transport_2.AggregateAttributeFunction.YearMonth) {
|
|
78
|
+
transformer = (value) => (0, dayjs_1.default)(value, 'YYYY-MM')
|
|
82
79
|
.toDate()
|
|
83
80
|
.getTime();
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
83
|
else {
|
|
87
|
-
transformer = (value) =>
|
|
84
|
+
transformer = (value) => (0, dayjs_1.default)(value)
|
|
88
85
|
.toDate()
|
|
89
86
|
.getTime();
|
|
90
87
|
}
|
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useWidgetDetail = useWidgetDetail;
|
|
4
|
+
const command_1 = require("@headless-adminapp/app/command");
|
|
5
|
+
const hooks_1 = require("@headless-adminapp/app/command/hooks");
|
|
6
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
7
|
+
const widget_1 = require("@headless-adminapp/app/widget");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const useQueriesData_1 = require("./useQueriesData");
|
|
10
|
+
function useWidgetDetail(widgetContent) {
|
|
11
|
+
const widgetState = (0, mutable_1.useContextSelector)(widget_1.WidgetContext, (state) => state);
|
|
9
12
|
const widget = widgetState.widget;
|
|
10
|
-
const widgetSetValue = useContextSetValue(WidgetContext);
|
|
11
|
-
const { dataset, isPending, isFetching, refetch } = useQueriesData(widget.dataset);
|
|
12
|
-
const baseCommandHandleContext = useBaseCommandHandlerContext();
|
|
13
|
-
const updateStateValue = useCallback(
|
|
13
|
+
const widgetSetValue = (0, mutable_1.useContextSetValue)(widget_1.WidgetContext);
|
|
14
|
+
const { dataset, isPending, isFetching, refetch } = (0, useQueriesData_1.useQueriesData)(widget.dataset);
|
|
15
|
+
const baseCommandHandleContext = (0, hooks_1.useBaseCommandHandlerContext)();
|
|
16
|
+
const updateStateValue = (0, react_1.useCallback)(
|
|
14
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
18
|
(value) => {
|
|
16
|
-
widgetSetValue((state) => (
|
|
19
|
+
widgetSetValue((state) => ({
|
|
20
|
+
...state,
|
|
21
|
+
data: { ...state.data, ...value },
|
|
22
|
+
}));
|
|
17
23
|
}, [widgetSetValue]);
|
|
18
|
-
const transformedCommands = useCommands([widgetContent.commands],
|
|
24
|
+
const transformedCommands = (0, command_1.useCommands)([widgetContent.commands], {
|
|
25
|
+
...baseCommandHandleContext,
|
|
26
|
+
primaryControl: {
|
|
19
27
|
refresh: refetch,
|
|
20
28
|
updateStateValue,
|
|
21
|
-
}
|
|
29
|
+
},
|
|
30
|
+
});
|
|
22
31
|
return {
|
|
23
32
|
isPending,
|
|
24
33
|
isFetching,
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.OverflowCommandBar = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
9
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const CommandBar_1 = __importDefault(require("../CommandBar"));
|
|
12
|
+
const OverflowMenu_1 = require("./OverflowMenu");
|
|
13
|
+
const render_1 = require("./render");
|
|
14
|
+
const OverflowCommandBar = ({ commands, align = 'start', afterDivider, beforeDivider, }) => {
|
|
15
|
+
const { language } = (0, locale_1.useLocale)();
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Overflow, { children: (0, jsx_runtime_1.jsxs)(CommandBar_1.default.Wrapper, { overflow: "hidden", align: align, children: [beforeDivider && (0, jsx_runtime_1.jsx)(CommandBar_1.default.Divider, {}), commands.map((group, groupIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [groupIndex > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.OverflowDivider, { groupId: String(groupIndex - 1), children: (0, jsx_runtime_1.jsx)(CommandBar_1.default.Divider, {}) })), group.map((item, index) => {
|
|
11
17
|
const commandType = item.type;
|
|
12
18
|
switch (item.type) {
|
|
13
19
|
case 'menu':
|
|
14
20
|
case 'button':
|
|
15
21
|
case 'label':
|
|
16
22
|
case 'icon':
|
|
17
|
-
return (
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.OverflowItem, { id: `${groupIndex}-${index}`, groupId: String(groupIndex), children: (0, render_1.renderCommandItem)(`${groupIndex}-${index}`, item, language) }, `${groupIndex}-${index}`));
|
|
18
24
|
default:
|
|
19
25
|
throw new Error(`Unknown command type: ${commandType}`);
|
|
20
26
|
}
|
|
21
|
-
})] }, groupIndex))),
|
|
27
|
+
})] }, groupIndex))), (0, jsx_runtime_1.jsx)(OverflowMenu_1.OverflowMenu, { items: commands }), afterDivider && (0, jsx_runtime_1.jsx)(CommandBar_1.default.Divider, {})] }) }));
|
|
22
28
|
};
|
|
29
|
+
exports.OverflowCommandBar = OverflowCommandBar;
|
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { Icons } from '@headless-adminapp/icons';
|
|
16
|
-
import { Fragment } from 'react';
|
|
17
|
-
import { MenuItem } from '../CommandBar/MenuItem';
|
|
18
|
-
import { OverflowMenuDivider } from './OverflowMenuDivider';
|
|
19
|
-
import { transformMenuItems } from './utils';
|
|
20
|
-
export const OverflowMenu = ({ items, }) => {
|
|
21
|
-
const { ref, isOverflowing } = useOverflowMenu();
|
|
22
|
-
const { language } = useLocale();
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OverflowMenu = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
7
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const MenuItem_1 = require("../CommandBar/MenuItem");
|
|
10
|
+
const OverflowMenuDivider_1 = require("./OverflowMenuDivider");
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
const OverflowMenu = ({ items, }) => {
|
|
13
|
+
const { ref, isOverflowing } = (0, react_components_1.useOverflowMenu)();
|
|
14
|
+
const { language } = (0, locale_1.useLocale)();
|
|
23
15
|
if (!isOverflowing) {
|
|
24
16
|
return null;
|
|
25
17
|
}
|
|
26
|
-
return (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
? (_b = item.items) === null || _b === void 0 ? void 0 : _b.map((x) => transformMenuItems(x, language))
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "below-end", hasIcons: true, children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.ToolbarButton, { ref: ref, type: "button", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.MoreHorizontal, {}) }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: items.map((group, groupIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [groupIndex > 0 && ((0, jsx_runtime_1.jsx)(OverflowMenuDivider_1.OverflowMenuDivider, { id: String(groupIndex), previousGroupId: String(groupIndex - 1) })), group.map((item, index) => {
|
|
19
|
+
const text = 'text' in item ? item.text ?? '' : '';
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(OverflowMenuItem, { id: `${groupIndex}-${index}`, Icon: item.Icon, onClick: item.type !== 'label' ? item.onClick : undefined, text: text, danger: item.danger, disabled: item.type !== 'label' ? item.disabled : undefined, items: item.type === 'menu'
|
|
21
|
+
? item.items?.map((x) => (0, utils_1.transformMenuItems)(x, language))
|
|
31
22
|
: undefined }, `${groupIndex}-${index}`));
|
|
32
23
|
})] }, groupIndex))) }) })] }));
|
|
33
24
|
};
|
|
25
|
+
exports.OverflowMenu = OverflowMenu;
|
|
34
26
|
const OverflowMenuItem = (props) => {
|
|
35
|
-
const { id
|
|
36
|
-
const isVisible = useIsOverflowItemVisible(id);
|
|
27
|
+
const { id, ...rest } = props;
|
|
28
|
+
const isVisible = (0, react_components_1.useIsOverflowItemVisible)(id);
|
|
37
29
|
if (isVisible) {
|
|
38
30
|
return null;
|
|
39
31
|
}
|
|
40
|
-
return
|
|
32
|
+
return (0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, { ...rest });
|
|
41
33
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OverflowMenuDivider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const OverflowMenuDivider = (props) => {
|
|
7
|
+
const isGroupVisible = (0, react_components_1.useIsOverflowGroupVisible)(props.id);
|
|
8
|
+
const isPreviousGroupVisible = (0, react_components_1.useIsOverflowGroupVisible)(props.previousGroupId);
|
|
6
9
|
if (isGroupVisible !== 'hidden' || isPreviousGroupVisible === 'visible') {
|
|
7
10
|
return null;
|
|
8
11
|
}
|
|
9
|
-
return
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {});
|
|
10
13
|
};
|
|
14
|
+
exports.OverflowMenuDivider = OverflowMenuDivider;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderCommandItem = exports.transformMenuItems = exports.OverflowCommandBar = void 0;
|
|
4
|
+
var OverflowCommandBar_1 = require("./OverflowCommandBar");
|
|
5
|
+
Object.defineProperty(exports, "OverflowCommandBar", { enumerable: true, get: function () { return OverflowCommandBar_1.OverflowCommandBar; } });
|
|
6
|
+
var utils_1 = require("./utils");
|
|
7
|
+
Object.defineProperty(exports, "transformMenuItems", { enumerable: true, get: function () { return utils_1.transformMenuItems; } });
|
|
8
|
+
var render_1 = require("./render");
|
|
9
|
+
Object.defineProperty(exports, "renderCommandItem", { enumerable: true, get: function () { return render_1.renderCommandItem; } });
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.renderCommandItem = renderCommandItem;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const CommandBar_1 = __importDefault(require("../CommandBar"));
|
|
9
|
+
const MenuButton_1 = require("../CommandBar/MenuButton");
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
function renderCommandItem(key, item, language) {
|
|
7
12
|
const commandType = item.type;
|
|
8
13
|
switch (item.type) {
|
|
9
14
|
case 'menu':
|
|
10
|
-
return (
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(MenuButton_1.CommandMenuButton, { Icon: item.Icon, text: item.localizedTexts?.[language] ?? item.text ?? '', danger: item.danger, disabled: item.disabled, onClick: item.onClick, items: item.items?.map((x) => (0, utils_1.transformMenuItems)(x, language)) }, key));
|
|
11
16
|
case 'button':
|
|
12
|
-
return (
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(CommandBar_1.default.Button, { text: item.localizedTexts?.[language] ?? item.text ?? '', Icon: item.Icon, iconPosition: item.iconPosition ?? 'before', danger: item.danger, disabled: item.disabled, onClick: item.onClick }, key));
|
|
13
18
|
case 'label':
|
|
14
|
-
return (
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(CommandBar_1.default.Label, { text: item.localizedTexts?.[language] ?? item.text ?? '', Icon: item.Icon }, key));
|
|
15
20
|
case 'icon':
|
|
16
|
-
return (
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(CommandBar_1.default.IconButton, { Icon: item.Icon, danger: item.danger, disabled: item.disabled, onClick: item.onClick }, key));
|
|
17
22
|
default:
|
|
18
23
|
throw new Error(`Unknown command type: ${commandType}`);
|
|
19
24
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformMenuItems = transformMenuItems;
|
|
1
4
|
function transformMenuItem(item, language) {
|
|
2
|
-
var _a, _b, _c, _d;
|
|
3
5
|
return {
|
|
4
6
|
Icon: item.Icon,
|
|
5
|
-
text:
|
|
7
|
+
text: item.localizedTexts?.[language] ?? item.text ?? '',
|
|
6
8
|
danger: item.danger,
|
|
7
9
|
onClick: item.onClick,
|
|
8
10
|
disabled: item.disabled,
|
|
9
|
-
items:
|
|
11
|
+
items: item.items?.map((x) => transformMenuItems(x, language)),
|
|
10
12
|
};
|
|
11
13
|
}
|
|
12
|
-
|
|
14
|
+
function transformMenuItems(items, language) {
|
|
13
15
|
return items.map((x) => transformMenuItem(x, language));
|
|
14
16
|
}
|
package/PageBoard/BoardColumn.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BoardColumn = BoardColumn;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const BoardColumnProvider_1 = require("@headless-adminapp/app/board/BoardColumnProvider");
|
|
6
|
+
const BoardColumnUI_1 = require("./BoardColumnUI");
|
|
7
|
+
function BoardColumn(props) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(BoardColumnProvider_1.BoardColumnProvider, { config: props.config, children: (0, jsx_runtime_1.jsx)(BoardColumnUI_1.BoardColumnUI, {}) }));
|
|
6
9
|
}
|
|
@@ -8,5 +8,5 @@ interface BoardColumnCardProps {
|
|
|
8
8
|
PreviewComponent: BoardColumnCardPreviewFC;
|
|
9
9
|
schema: Schema;
|
|
10
10
|
}
|
|
11
|
-
export declare function BoardColumnCard({ record, canDrag, columnId, PreviewComponent, schema, }: BoardColumnCardProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function BoardColumnCard({ record, canDrag, columnId, PreviewComponent, schema, }: Readonly<BoardColumnCardProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BoardColumnCard = BoardColumnCard;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const DndProvider_1 = require("../components/DndProvider");
|
|
8
|
+
function BoardColumnCard({ record, canDrag, columnId, PreviewComponent, schema, }) {
|
|
9
|
+
const ref = (0, react_1.useRef)(null);
|
|
10
|
+
const { useDrag } = (0, DndProvider_1.useDndContext)();
|
|
7
11
|
const [{ isDragging }, drag] = useDrag({
|
|
8
12
|
type: columnId,
|
|
9
13
|
canDrag,
|
|
@@ -15,11 +19,11 @@ export function BoardColumnCard({ record, canDrag, columnId, PreviewComponent, s
|
|
|
15
19
|
}),
|
|
16
20
|
});
|
|
17
21
|
drag(ref);
|
|
18
|
-
return (
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, style: {
|
|
19
23
|
display: 'flex',
|
|
20
|
-
background: tokens.colorNeutralBackground1,
|
|
21
|
-
borderRadius: tokens.borderRadiusLarge,
|
|
22
|
-
boxShadow: tokens.shadow4,
|
|
24
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
25
|
+
borderRadius: react_components_1.tokens.borderRadiusLarge,
|
|
26
|
+
boxShadow: react_components_1.tokens.shadow4,
|
|
23
27
|
opacity: isDragging ? 0.5 : 1,
|
|
24
|
-
}, children:
|
|
28
|
+
}, children: (0, jsx_runtime_1.jsx)(PreviewComponent, { record: record }) }));
|
|
25
29
|
}
|