@geotab/zenith 3.9.0-beta.0 → 3.9.0-beta.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.
- package/README.md +0 -7
- package/dist/card/card.d.ts +1 -1
- package/dist/card/card.js +1 -1
- package/dist/{title → card/components}/title.d.ts +1 -1
- package/dist/card/components/title.js +26 -0
- package/dist/card/helpers/getIconTypeFromStatus.d.ts +1 -1
- package/dist/commonStyles/typography/typography.less +233 -0
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -5
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +38 -2
- package/dist/index.css +618 -32
- package/dist/index.d.ts +2 -1
- package/dist/index.js +22 -20
- package/dist/table/children/useTableChildren.d.ts +1 -1
- package/dist/table/children/useTableChildren.js +3 -3
- package/dist/table/selectable/useSelectableRows.d.ts +0 -8
- package/dist/table/selectable/useSelectableRows.js +7 -14
- package/dist/table/table.js +7 -1
- package/esm/card/card.d.ts +1 -1
- package/esm/card/card.js +1 -1
- package/esm/{title → card/components}/title.d.ts +1 -1
- package/esm/card/components/title.js +22 -0
- package/esm/card/helpers/getIconTypeFromStatus.d.ts +1 -1
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -5
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +38 -2
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/table/children/useTableChildren.d.ts +1 -1
- package/esm/table/children/useTableChildren.js +3 -3
- package/esm/table/selectable/useSelectableRows.d.ts +0 -8
- package/esm/table/selectable/useSelectableRows.js +7 -14
- package/esm/table/table.js +7 -1
- package/package.json +1 -1
- package/dist/title/title.js +0 -27
- package/esm/title/title.js +0 -23
|
@@ -157,6 +157,7 @@ export const useSelectableRows = (columns, entities, isMobile, selectMode, setSe
|
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
159
|
const newSelections = getCurrentPageSelection(entities, selectable);
|
|
160
|
+
setState(newState);
|
|
160
161
|
const newValue = {
|
|
161
162
|
selected: [...newSelections],
|
|
162
163
|
all: false
|
|
@@ -175,16 +176,8 @@ export const useSelectableRows = (columns, entities, isMobile, selectMode, setSe
|
|
|
175
176
|
return translate("Deselect all");
|
|
176
177
|
}, [selectable, selectableState, state, translate]);
|
|
177
178
|
const isEntityChecked = useCallback((entity, isNested) => isRowChecked(selections, state, selectable === null || selectable === void 0 ? void 0 : selectable.strategy, entity, isNested), [selections, state, selectable === null || selectable === void 0 ? void 0 : selectable.strategy]);
|
|
178
|
-
const hasSelectable = !!selectable;
|
|
179
|
-
const selectableCheckboxSelectsCurrentPage = selectable === null || selectable === void 0 ? void 0 : selectable.checkboxSelectsCurrentPage;
|
|
180
|
-
const selectableTurnOffSelectAll = selectable === null || selectable === void 0 ? void 0 : selectable.turnOffSelectAll;
|
|
181
|
-
const selectableCheckboxInHeader = selectable === null || selectable === void 0 ? void 0 : selectable.checkboxInHeader;
|
|
182
|
-
const selectableSelectionLimit = selectable === null || selectable === void 0 ? void 0 : selectable.selectionLimit;
|
|
183
|
-
const selectableHeader = selectable === null || selectable === void 0 ? void 0 : selectable.header;
|
|
184
|
-
const checkboxEmitsCurrentPage = selectableCheckboxSelectsCurrentPage !== null && selectableCheckboxSelectsCurrentPage !== void 0 ? selectableCheckboxSelectsCurrentPage : selectableTurnOffSelectAll;
|
|
185
|
-
const checkboxInHeaderValue = selectableCheckboxInHeader !== undefined ? selectableCheckboxInHeader : selectableSelectionLimit !== undefined ? false : undefined;
|
|
186
179
|
const wrapper = useMemo(() => {
|
|
187
|
-
if (!
|
|
180
|
+
if (!selectable) {
|
|
188
181
|
return null;
|
|
189
182
|
}
|
|
190
183
|
return {
|
|
@@ -226,23 +219,23 @@ export const useSelectableRows = (columns, entities, isMobile, selectMode, setSe
|
|
|
226
219
|
checked: state === SelectionState.CurrentPage || state === SelectionState.All,
|
|
227
220
|
indeterminate: state === SelectionState.Partial,
|
|
228
221
|
onChange: newValue => {
|
|
229
|
-
const newState = newValue ?
|
|
222
|
+
const newState = newValue ? selectable.turnOffSelectAll ? SelectionState.CurrentPage : SelectionState.All : SelectionState.None;
|
|
230
223
|
setState(newState);
|
|
231
224
|
onChangeSelectionState(newState);
|
|
232
225
|
},
|
|
233
226
|
calculateSelectionState: () => selectableState,
|
|
234
|
-
checkboxInHeader:
|
|
235
|
-
header:
|
|
227
|
+
checkboxInHeader: selectable.checkboxInHeader !== undefined ? selectable.checkboxInHeader : selectable.selectionLimit !== undefined ? false : undefined,
|
|
228
|
+
header: selectable.header,
|
|
236
229
|
onSelect: newState => {
|
|
237
230
|
setState(newState);
|
|
238
231
|
onChangeSelectionState(newState);
|
|
239
232
|
},
|
|
240
|
-
turnOffSelectAll:
|
|
233
|
+
turnOffSelectAll: selectable.turnOffSelectAll
|
|
241
234
|
});
|
|
242
235
|
return cell;
|
|
243
236
|
}
|
|
244
237
|
};
|
|
245
|
-
}, [checkboxDisabled, checkboxTitle, checkboxVisible, headerTitle, onChangeSelectionState, onSelectListener,
|
|
238
|
+
}, [checkboxDisabled, checkboxTitle, checkboxVisible, headerTitle, onChangeSelectionState, onSelectListener, selectable, selectableState, state, isMobile, checkboxPlaceholder, isEntityChecked]);
|
|
246
239
|
const selectableFeedWrapper = useCallback((primaryData, secondaryData, entity, isNested) => {
|
|
247
240
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
248
241
|
if (!entity) {
|
package/esm/table/table.js
CHANGED
|
@@ -175,6 +175,12 @@ const TableInner = ({
|
|
|
175
175
|
selected: []
|
|
176
176
|
});
|
|
177
177
|
}, [selectable]);
|
|
178
|
+
const selectAll = useCallback(() => {
|
|
179
|
+
selectable === null || selectable === void 0 ? void 0 : selectable.onSelect({
|
|
180
|
+
all: true,
|
|
181
|
+
selected: []
|
|
182
|
+
});
|
|
183
|
+
}, [selectable]);
|
|
178
184
|
const [activeIdInternal, setActiveInternal] = useState(undefined);
|
|
179
185
|
const activeId = active !== undefined ? active : activeIdInternal;
|
|
180
186
|
const onClickInternal = useCallback(id => setActiveInternal(id === activeIdInternal ? undefined : id), [activeIdInternal, setActiveInternal]);
|
|
@@ -191,7 +197,7 @@ const TableInner = ({
|
|
|
191
197
|
detailPanel,
|
|
192
198
|
footer,
|
|
193
199
|
other
|
|
194
|
-
} = useTableChildren(children, isMobile, selectionQty, ((_c = selectable === null || selectable === void 0 ? void 0 : selectable.selection) === null || _c === void 0 ? void 0 : _c.all) || false, clearSelection, activeId, gridRef, onCloseDetailPanel);
|
|
200
|
+
} = useTableChildren(children, isMobile, selectionQty, ((_c = selectable === null || selectable === void 0 ? void 0 : selectable.selection) === null || _c === void 0 ? void 0 : _c.all) || false, clearSelection, selectAll, selectable === null || selectable === void 0 ? void 0 : selectable.turnOffSelectAll, activeId, gridRef, onCloseDetailPanel);
|
|
195
201
|
const hasDetailPanel = !!detailPanel;
|
|
196
202
|
const shouldEnableRowClick = hasDetailPanel || !!onClick;
|
|
197
203
|
const activeIdForRow = shouldEnableRowClick ? activeId : undefined;
|
package/package.json
CHANGED
package/dist/title/title.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Title = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
7
|
-
const useDrive_1 = require("../utils/theme/useDrive");
|
|
8
|
-
const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
9
|
-
const iconChevronRightSmall_1 = require("../icons/iconChevronRightSmall");
|
|
10
|
-
const Title = ({ isMobile, link, target, title, id, icon, iconType, className = "", onClick }) => {
|
|
11
|
-
const isDrive = (0, useDrive_1.useDrive)();
|
|
12
|
-
const driveClassName = (0, useDriveClassName_1.useDriveClassName)("zen-title");
|
|
13
|
-
const h3ClassName = (0, classNames_1.classNames)(["zen-title", driveClassName !== null && driveClassName !== void 0 ? driveClassName : ""]);
|
|
14
|
-
const clickableClass = onClick ? "zen-title__clickable" : "";
|
|
15
|
-
const iconClassName = iconType ? `zen-title__icon--${iconType}` : "";
|
|
16
|
-
const iconSize = (0, react_1.useMemo)(() => (isDrive ? "huge" : "large"), [isDrive]);
|
|
17
|
-
const iconElement = (0, react_1.useMemo)(() => (icon ? (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-title__icon", iconClassName]), children: (0, react_1.createElement)(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
|
|
18
|
-
const chevron = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsx)("span", { className: "zen-title__link-chevron", children: (0, jsx_runtime_1.jsx)(iconChevronRightSmall_1.IconChevronRightSmall, { size: iconSize, className: "zen-title__chevron-icon" }) })), [iconSize]);
|
|
19
|
-
if (onClick) {
|
|
20
|
-
return ((0, jsx_runtime_1.jsx)("h3", { className: h3ClassName, children: (0, jsx_runtime_1.jsxs)("button", { type: "button", className: clickableClass, onClick: onClick, children: [iconElement, (0, jsx_runtime_1.jsxs)("span", { title: title, id: id, className: (0, classNames_1.classNames)(["zen-title__text", isMobile && !isDrive ? "zen-title__text--mobile" : "", className]), children: [title, chevron] })] }) }));
|
|
21
|
-
}
|
|
22
|
-
if (link) {
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)("h3", { className: h3ClassName, children: (0, jsx_runtime_1.jsxs)("a", { id: id, className: "zen-title__link", href: link, target: target, children: [iconElement, (0, jsx_runtime_1.jsxs)("span", { title: title, className: (0, classNames_1.classNames)(["zen-title__link-text"]), children: [title, chevron] })] }) }));
|
|
24
|
-
}
|
|
25
|
-
return ((0, jsx_runtime_1.jsxs)("h3", { className: h3ClassName, children: [iconElement, (0, jsx_runtime_1.jsx)("span", { title: title, id: id, className: (0, classNames_1.classNames)(["zen-title__text", isMobile && !isDrive ? "zen-title__text--mobile" : "", className]), children: title })] }));
|
|
26
|
-
};
|
|
27
|
-
exports.Title = Title;
|
package/esm/title/title.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createElement, useMemo } from "react";
|
|
3
|
-
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
4
|
-
import { useDrive } from "../utils/theme/useDrive";
|
|
5
|
-
import { useDriveClassName } from "../utils/theme/useDriveClassName";
|
|
6
|
-
import { IconChevronRightSmall } from "../icons/iconChevronRightSmall";
|
|
7
|
-
export const Title = ({ isMobile, link, target, title, id, icon, iconType, className = "", onClick }) => {
|
|
8
|
-
const isDrive = useDrive();
|
|
9
|
-
const driveClassName = useDriveClassName("zen-title");
|
|
10
|
-
const h3ClassName = classNames(["zen-title", driveClassName !== null && driveClassName !== void 0 ? driveClassName : ""]);
|
|
11
|
-
const clickableClass = onClick ? "zen-title__clickable" : "";
|
|
12
|
-
const iconClassName = iconType ? `zen-title__icon--${iconType}` : "";
|
|
13
|
-
const iconSize = useMemo(() => (isDrive ? "huge" : "large"), [isDrive]);
|
|
14
|
-
const iconElement = useMemo(() => (icon ? _jsx("div", { className: classNames(["zen-title__icon", iconClassName]), children: createElement(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
|
|
15
|
-
const chevron = useMemo(() => (_jsx("span", { className: "zen-title__link-chevron", children: _jsx(IconChevronRightSmall, { size: iconSize, className: "zen-title__chevron-icon" }) })), [iconSize]);
|
|
16
|
-
if (onClick) {
|
|
17
|
-
return (_jsx("h3", { className: h3ClassName, children: _jsxs("button", { type: "button", className: clickableClass, onClick: onClick, children: [iconElement, _jsxs("span", { title: title, id: id, className: classNames(["zen-title__text", isMobile && !isDrive ? "zen-title__text--mobile" : "", className]), children: [title, chevron] })] }) }));
|
|
18
|
-
}
|
|
19
|
-
if (link) {
|
|
20
|
-
return (_jsx("h3", { className: h3ClassName, children: _jsxs("a", { id: id, className: "zen-title__link", href: link, target: target, children: [iconElement, _jsxs("span", { title: title, className: classNames(["zen-title__link-text"]), children: [title, chevron] })] }) }));
|
|
21
|
-
}
|
|
22
|
-
return (_jsxs("h3", { className: h3ClassName, children: [iconElement, _jsx("span", { title: title, id: id, className: classNames(["zen-title__text", isMobile && !isDrive ? "zen-title__text--mobile" : "", className]), children: title })] }));
|
|
23
|
-
};
|