@medusajs/loyalty-plugin 0.0.1 → 0.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.
- package/.medusa/server/src/admin/index.js +30214 -0
- package/.medusa/server/src/admin/index.mjs +30193 -0
- package/package.json +14 -9
- package/.medusa/server/src/admin/components/action-menu.js +0 -63
- package/.medusa/server/src/admin/components/chip-group.js +0 -82
- package/.medusa/server/src/admin/components/chip-input.js +0 -157
- package/.medusa/server/src/admin/components/combobox.js +0 -324
- package/.medusa/server/src/admin/components/conditional-tooltip.js +0 -15
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-boolean-cell.js +0 -66
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-cell-container.js +0 -77
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-currency-cell.js +0 -110
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-duplicate-cell.js +0 -16
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-keyboard-shortcut-modal.js +0 -214
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-number-cell.js +0 -77
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-readonly-cell.js +0 -32
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-root.js +0 -743
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-row-error-indicator.js +0 -37
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-skeleton.js +0 -54
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-text-cell.js +0 -66
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-toggleable-number-cell.js +0 -166
- package/.medusa/server/src/admin/components/data-grid/components/index.js +0 -16
- package/.medusa/server/src/admin/components/data-grid/context/data-grid-context.js +0 -7
- package/.medusa/server/src/admin/components/data-grid/context/index.js +0 -6
- package/.medusa/server/src/admin/components/data-grid/context/use-data-grid-context.js +0 -14
- package/.medusa/server/src/admin/components/data-grid/data-grid.js +0 -31
- package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-column-helper.js +0 -28
- package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-price-columns.js +0 -85
- package/.medusa/server/src/admin/components/data-grid/helpers/index.js +0 -6
- package/.medusa/server/src/admin/components/data-grid/hooks/index.js +0 -31
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-error.js +0 -50
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-handlers.js +0 -123
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-metadata.js +0 -52
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-snapshot.js +0 -43
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell.js +0 -191
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-clipboard-events.js +0 -70
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-column-visibility.js +0 -51
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-duplicate-cell.js +0 -15
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-error-highlighting.js +0 -86
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-form-handlers.js +0 -149
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-keydown-event.js +0 -482
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-mouse-up-event.js +0 -64
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-navigation.js +0 -81
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-query-tool.js +0 -14
- package/.medusa/server/src/admin/components/data-grid/index.js +0 -8
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-bulk-update-command.js +0 -27
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-matrix.js +0 -296
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-query-tool.js +0 -62
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-update-command.js +0 -25
- package/.medusa/server/src/admin/components/data-grid/models/index.js +0 -10
- package/.medusa/server/src/admin/components/data-grid/types.js +0 -1
- package/.medusa/server/src/admin/components/data-grid/utils.js +0 -18
- package/.medusa/server/src/admin/components/data-table/components/data-table-status-cell/data-table-status-cell.js +0 -36
- package/.medusa/server/src/admin/components/data-table/data-table.js +0 -271
- package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-columns.js +0 -51
- package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-filters.js +0 -90
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/index.js +0 -10
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-columns.js +0 -48
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.js +0 -19
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-filters.js +0 -30
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-query.js +0 -23
- package/.medusa/server/src/admin/components/data-table/index.js +0 -4
- package/.medusa/server/src/admin/components/data-table.js +0 -249
- package/.medusa/server/src/admin/components/display-id.js +0 -18
- package/.medusa/server/src/admin/components/file-upload.js +0 -116
- package/.medusa/server/src/admin/components/form.js +0 -151
- package/.medusa/server/src/admin/components/handle-input.js +0 -22
- package/.medusa/server/src/admin/components/header.js +0 -41
- package/.medusa/server/src/admin/components/icon-avatar.js +0 -27
- package/.medusa/server/src/admin/components/json-view-section.js +0 -139
- package/.medusa/server/src/admin/components/keybound-form.js +0 -32
- package/.medusa/server/src/admin/components/layouts/single-column.js +0 -7
- package/.medusa/server/src/admin/components/layouts/two-column.js +0 -13
- package/.medusa/server/src/admin/components/listicle.js +0 -20
- package/.medusa/server/src/admin/components/modals/index.js +0 -19
- package/.medusa/server/src/admin/components/modals/route-drawer/index.js +0 -4
- package/.medusa/server/src/admin/components/modals/route-drawer/route-drawer.js +0 -57
- package/.medusa/server/src/admin/components/modals/route-focus-modal/index.js +0 -4
- package/.medusa/server/src/admin/components/modals/route-focus-modal/route-focus-modal.js +0 -71
- package/.medusa/server/src/admin/components/modals/route-modal-form/index.js +0 -4
- package/.medusa/server/src/admin/components/modals/route-modal-form/route-modal-form.js +0 -60
- package/.medusa/server/src/admin/components/modals/route-modal-provider/index.js +0 -6
- package/.medusa/server/src/admin/components/modals/route-modal-provider/route-modal-context.js +0 -5
- package/.medusa/server/src/admin/components/modals/route-modal-provider/route-provider.js +0 -30
- package/.medusa/server/src/admin/components/modals/route-modal-provider/use-route-modal.js +0 -12
- package/.medusa/server/src/admin/components/modals/stacked-drawer/index.js +0 -5
- package/.medusa/server/src/admin/components/modals/stacked-drawer/stacked-drawer.js +0 -55
- package/.medusa/server/src/admin/components/modals/stacked-focus-modal/index.js +0 -5
- package/.medusa/server/src/admin/components/modals/stacked-focus-modal/stacked-focus-modal.js +0 -63
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/index.js +0 -6
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-context.js +0 -5
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-provider.js +0 -47
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/use-stacked-modal.js +0 -14
- package/.medusa/server/src/admin/components/placeholder-cell.js +0 -7
- package/.medusa/server/src/admin/components/product/product-cell/index.js +0 -5
- package/.medusa/server/src/admin/components/product/product-cell/product-cell.js +0 -15
- package/.medusa/server/src/admin/components/product/product-status-cell/index.js +0 -5
- package/.medusa/server/src/admin/components/product/product-status-cell/product-status-cell.js +0 -18
- package/.medusa/server/src/admin/components/product/sales-channels-cell/index.js +0 -5
- package/.medusa/server/src/admin/components/product/sales-channels-cell/sales-channels-cell.js +0 -31
- package/.medusa/server/src/admin/components/product/variant-cell/index.js +0 -5
- package/.medusa/server/src/admin/components/product/variant-cell/variant-cell.js +0 -15
- package/.medusa/server/src/admin/components/section-row.js +0 -32
- package/.medusa/server/src/admin/components/sidebar-link.js +0 -31
- package/.medusa/server/src/admin/components/sortable-list.js +0 -152
- package/.medusa/server/src/admin/components/switch-box.js +0 -43
- package/.medusa/server/src/admin/components/tax-badge.js +0 -18
- package/.medusa/server/src/admin/components/thumbnail.js +0 -28
- package/.medusa/server/src/admin/components/upload-media-form-item.js +0 -83
- package/.medusa/server/src/admin/hooks/api/customers.js +0 -26
- package/.medusa/server/src/admin/hooks/api/gift-cards.js +0 -107
- package/.medusa/server/src/admin/hooks/api/order.js +0 -16
- package/.medusa/server/src/admin/hooks/api/price-preferences.js +0 -19
- package/.medusa/server/src/admin/hooks/api/products.js +0 -127
- package/.medusa/server/src/admin/hooks/api/regions.js +0 -17
- package/.medusa/server/src/admin/hooks/api/sales-channels.js +0 -28
- package/.medusa/server/src/admin/hooks/api/store-credit-accounts.js +0 -41
- package/.medusa/server/src/admin/hooks/api/store.js +0 -31
- package/.medusa/server/src/admin/hooks/api/transaction-groups.js +0 -23
- package/.medusa/server/src/admin/hooks/api/transactions.js +0 -23
- package/.medusa/server/src/admin/hooks/commands/use-command-history.js +0 -45
- package/.medusa/server/src/admin/hooks/common/use-combobox-data.js +0 -59
- package/.medusa/server/src/admin/hooks/common/use-data-table-date-filters.js +0 -89
- package/.medusa/server/src/admin/hooks/common/use-date.js +0 -32
- package/.medusa/server/src/admin/hooks/common/use-debounced-search.js +0 -22
- package/.medusa/server/src/admin/hooks/common/use-query-params.js +0 -14
- package/.medusa/server/src/admin/hooks/query/use-customers-filters.js +0 -30
- package/.medusa/server/src/admin/hooks/query/use-transaction-groups-filters.js +0 -30
- package/.medusa/server/src/admin/hooks/sales-channels/index.js +0 -10
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-columns.js +0 -48
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-empty-state.js +0 -19
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-filters.js +0 -30
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-query.js +0 -23
- package/.medusa/server/src/admin/lib/currencies.js +0 -729
- package/.medusa/server/src/admin/lib/query-key.js +0 -17
- package/.medusa/server/src/admin/lib/sdk.js +0 -10
- package/.medusa/server/src/admin/routes/gift-card-products/@create/page.js +0 -75
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/components/gift-card-product-edit-denominations-form.js +0 -172
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/page.js +0 -30
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/components/gift-card-product-edit-form.js +0 -180
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/page.js +0 -30
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-general-section.js +0 -97
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-media-section.js +0 -162
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-sales-channel-section.js +0 -89
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-variant-section.js +0 -199
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/edit-product-media-form.js +0 -353
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/index.js +0 -5
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/index.js +0 -4
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/product-media-gallery.js +0 -247
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/index.js +0 -4
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view-context.js +0 -5
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view.js +0 -48
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/use-product-media-view.js +0 -14
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/page.js +0 -28
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/page.js +0 -40
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/prices-edit.js +0 -121
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/variant-pricing-form.js +0 -72
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/page.js +0 -23
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/components/edit-sales-channel-form.js +0 -123
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/page.js +0 -23
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/general-form-section.js +0 -1
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-denominations-form.js +0 -98
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-details-form.js +0 -28
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-denominations.js +0 -96
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-general.js +0 -90
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-media.js +0 -288
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize-section.js +0 -111
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize.js +0 -23
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form.js +0 -285
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-sales-channel-stacked-modal.js +0 -124
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/index.js +0 -4
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/schema.js +0 -112
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/types.js +0 -1
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/columns.js +0 -35
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/filters.js +0 -11
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/gift-card-products-table.js +0 -61
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/query.js +0 -23
- package/.medusa/server/src/admin/routes/gift-card-products/page.js +0 -18
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@expiration/page.js +0 -137
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@note/page.js +0 -87
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/components/transfer-icon.js +0 -352
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/page.js +0 -116
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-balance-section.js +0 -49
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-general-section.js +0 -177
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-note-section.js +0 -27
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-order-section.js +0 -33
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-owner-section.js +0 -33
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-transactions-section.js +0 -18
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/columns.js +0 -50
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/query.js +0 -23
- package/.medusa/server/src/admin/routes/gift-cards/_id_/page.js +0 -78
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-card-products-section.js +0 -40
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/columns.js +0 -57
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/filters.js +0 -13
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/gift-cards-table.js +0 -61
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/query.js +0 -23
- package/.medusa/server/src/admin/routes/gift-cards/page.js +0 -27
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/credit-card-icon.js +0 -126
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-balance-section.js +0 -31
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-details-section.js +0 -43
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/columns.js +0 -44
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/filters.js +0 -18
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/query.js +0 -37
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/table.js +0 -58
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/page.js +0 -39
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/columns.js +0 -58
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/filters.js +0 -13
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/query.js +0 -31
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/table.js +0 -56
- package/.medusa/server/src/admin/routes/store-credit-accounts/page.js +0 -19
- package/.medusa/server/src/admin/utils/date-utils.js +0 -27
- package/.medusa/server/src/admin/utils/format-amount.js +0 -9
- package/.medusa/server/src/admin/utils/format-date.js +0 -21
- package/.medusa/server/src/admin/utils/refs.js +0 -20
- package/.medusa/server/src/admin/utils/statuses.js +0 -23
- package/.medusa/server/src/admin/utils/validations.js +0 -71
- package/.medusa/server/src/admin/utils/variants.js +0 -92
- package/.medusa/server/src/admin/widgets/customer-gift-cards-widget.js +0 -67
- package/.medusa/server/src/admin/widgets/customer-store-credit-widget.js +0 -42
- package/.medusa/server/src/admin/widgets/order-gift-cards-widget.js +0 -58
- package/.medusa/server/types/loyalty/module.js +0 -8
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
const useDataGridNavigation = ({
|
|
3
|
-
matrix,
|
|
4
|
-
anchor,
|
|
5
|
-
visibleColumns,
|
|
6
|
-
visibleRows,
|
|
7
|
-
columnVirtualizer,
|
|
8
|
-
rowVirtualizer,
|
|
9
|
-
setColumnVisibility,
|
|
10
|
-
flatColumns,
|
|
11
|
-
queryTool,
|
|
12
|
-
setSingleRange
|
|
13
|
-
}) => {
|
|
14
|
-
const scrollToCoordinates = useCallback(
|
|
15
|
-
(coords, direction) => {
|
|
16
|
-
if (!anchor) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const { row, col } = coords;
|
|
20
|
-
const { row: anchorRow, col: anchorCol } = anchor;
|
|
21
|
-
const rowDirection = row >= anchorRow ? "down" : "up";
|
|
22
|
-
const colDirection = col >= anchorCol ? "right" : "left";
|
|
23
|
-
let toRow = rowDirection === "down" ? row + 1 : row - 1;
|
|
24
|
-
if (visibleRows[toRow] === void 0) {
|
|
25
|
-
toRow = row;
|
|
26
|
-
}
|
|
27
|
-
let toCol = colDirection === "right" ? col + 1 : col - 1;
|
|
28
|
-
if (visibleColumns[toCol] === void 0) {
|
|
29
|
-
toCol = col;
|
|
30
|
-
}
|
|
31
|
-
const scrollOptions = { align: "auto", behavior: "auto" };
|
|
32
|
-
if (direction === "horizontal" || direction === "both") {
|
|
33
|
-
columnVirtualizer.scrollToIndex(toCol, scrollOptions);
|
|
34
|
-
}
|
|
35
|
-
if (direction === "vertical" || direction === "both") {
|
|
36
|
-
rowVirtualizer.scrollToIndex(toRow, scrollOptions);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
[anchor, columnVirtualizer, visibleRows, rowVirtualizer, visibleColumns]
|
|
40
|
-
);
|
|
41
|
-
const navigateToField = useCallback(
|
|
42
|
-
(field) => {
|
|
43
|
-
const coords = matrix.getCoordinatesByField(field);
|
|
44
|
-
if (!coords) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const column = flatColumns[coords.col];
|
|
48
|
-
setColumnVisibility((prev) => {
|
|
49
|
-
return {
|
|
50
|
-
...prev,
|
|
51
|
-
[column.id]: true
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
requestAnimationFrame(() => {
|
|
55
|
-
scrollToCoordinates(coords, "both");
|
|
56
|
-
setSingleRange(coords);
|
|
57
|
-
});
|
|
58
|
-
requestAnimationFrame(() => {
|
|
59
|
-
const input = queryTool == null ? void 0 : queryTool.getInput(coords);
|
|
60
|
-
if (input) {
|
|
61
|
-
input.focus();
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
[
|
|
66
|
-
matrix,
|
|
67
|
-
flatColumns,
|
|
68
|
-
setColumnVisibility,
|
|
69
|
-
scrollToCoordinates,
|
|
70
|
-
setSingleRange,
|
|
71
|
-
queryTool
|
|
72
|
-
]
|
|
73
|
-
);
|
|
74
|
-
return {
|
|
75
|
-
scrollToCoordinates,
|
|
76
|
-
navigateToField
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
export {
|
|
80
|
-
useDataGridNavigation
|
|
81
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect } from "react";
|
|
2
|
-
import { DataGridQueryTool } from "../models/data-grid-query-tool.js";
|
|
3
|
-
const useDataGridQueryTool = (containerRef) => {
|
|
4
|
-
const queryToolRef = useRef(null);
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
if (containerRef.current) {
|
|
7
|
-
queryToolRef.current = new DataGridQueryTool(containerRef.current);
|
|
8
|
-
}
|
|
9
|
-
}, [containerRef]);
|
|
10
|
-
return queryToolRef.current;
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
useDataGridQueryTool
|
|
14
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DataGrid } from "./data-grid.js";
|
|
2
|
-
import { createDataGridHelper } from "./helpers/create-data-grid-column-helper.js";
|
|
3
|
-
import { createDataGridPriceColumns } from "./helpers/create-data-grid-price-columns.js";
|
|
4
|
-
export {
|
|
5
|
-
DataGrid,
|
|
6
|
-
createDataGridHelper,
|
|
7
|
-
createDataGridPriceColumns
|
|
8
|
-
};
|
package/.medusa/server/src/admin/components/data-grid/models/data-grid-bulk-update-command.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
class DataGridBulkUpdateCommand {
|
|
5
|
-
constructor({ fields, prev, next, setter }) {
|
|
6
|
-
__publicField(this, "_fields");
|
|
7
|
-
__publicField(this, "_prev");
|
|
8
|
-
__publicField(this, "_next");
|
|
9
|
-
__publicField(this, "_setter");
|
|
10
|
-
this._fields = fields;
|
|
11
|
-
this._prev = prev;
|
|
12
|
-
this._next = next;
|
|
13
|
-
this._setter = setter;
|
|
14
|
-
}
|
|
15
|
-
execute(redo = false) {
|
|
16
|
-
this._setter(this._fields, this._next, redo);
|
|
17
|
-
}
|
|
18
|
-
undo() {
|
|
19
|
-
this._setter(this._fields, this._prev, true);
|
|
20
|
-
}
|
|
21
|
-
redo() {
|
|
22
|
-
this.execute(true);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
DataGridBulkUpdateCommand
|
|
27
|
-
};
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
class DataGridMatrix {
|
|
5
|
-
constructor(data, columns, multiColumnSelection = false) {
|
|
6
|
-
__publicField(this, "multiColumnSelection");
|
|
7
|
-
__publicField(this, "cells");
|
|
8
|
-
__publicField(this, "rowAccessors", []);
|
|
9
|
-
__publicField(this, "columnAccessors", []);
|
|
10
|
-
this.multiColumnSelection = multiColumnSelection;
|
|
11
|
-
this.cells = this._populateCells(data, columns);
|
|
12
|
-
this.rowAccessors = this._computeRowAccessors();
|
|
13
|
-
this.columnAccessors = this._computeColumnAccessors();
|
|
14
|
-
}
|
|
15
|
-
_computeRowAccessors() {
|
|
16
|
-
return this.cells.map((_, rowIndex) => this.getRowAccessor(rowIndex));
|
|
17
|
-
}
|
|
18
|
-
_computeColumnAccessors() {
|
|
19
|
-
if (this.cells.length === 0) {
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
return this.cells[0].map((_, colIndex) => this.getColumnAccessor(colIndex));
|
|
23
|
-
}
|
|
24
|
-
getFirstNavigableCell() {
|
|
25
|
-
for (let row = 0; row < this.cells.length; row++) {
|
|
26
|
-
for (let col = 0; col < this.cells[0].length; col++) {
|
|
27
|
-
if (this.cells[row][col] !== null) {
|
|
28
|
-
return { row, col };
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
getFieldsInRow(row) {
|
|
35
|
-
const keys = [];
|
|
36
|
-
if (row < 0 || row >= this.cells.length) {
|
|
37
|
-
return keys;
|
|
38
|
-
}
|
|
39
|
-
this.cells[row].forEach((cell) => {
|
|
40
|
-
if (cell !== null) {
|
|
41
|
-
keys.push(cell.field);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return keys;
|
|
45
|
-
}
|
|
46
|
-
getFieldsInSelection(start, end) {
|
|
47
|
-
var _a;
|
|
48
|
-
const keys = [];
|
|
49
|
-
if (!start || !end) {
|
|
50
|
-
return keys;
|
|
51
|
-
}
|
|
52
|
-
if (!this.multiColumnSelection && start.col !== end.col) {
|
|
53
|
-
throw new Error(
|
|
54
|
-
"Selection must be in the same column when multiColumnSelection is disabled"
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
const startRow = Math.min(start.row, end.row);
|
|
58
|
-
const endRow = Math.max(start.row, end.row);
|
|
59
|
-
const startCol = this.multiColumnSelection ? Math.min(start.col, end.col) : start.col;
|
|
60
|
-
const endCol = this.multiColumnSelection ? Math.max(start.col, end.col) : start.col;
|
|
61
|
-
for (let row = startRow; row <= endRow; row++) {
|
|
62
|
-
for (let col = startCol; col <= endCol; col++) {
|
|
63
|
-
if (this._isValidPosition(row, col) && this.cells[row][col] !== null) {
|
|
64
|
-
keys.push((_a = this.cells[row][col]) == null ? void 0 : _a.field);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return keys;
|
|
69
|
-
}
|
|
70
|
-
getCellField(cell) {
|
|
71
|
-
var _a;
|
|
72
|
-
if (this._isValidPosition(cell.row, cell.col)) {
|
|
73
|
-
return ((_a = this.cells[cell.row][cell.col]) == null ? void 0 : _a.field) || null;
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
getCellType(cell) {
|
|
78
|
-
var _a;
|
|
79
|
-
if (this._isValidPosition(cell.row, cell.col)) {
|
|
80
|
-
return ((_a = this.cells[cell.row][cell.col]) == null ? void 0 : _a.type) || null;
|
|
81
|
-
}
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
getIsCellSelected(cell, start, end) {
|
|
85
|
-
if (!cell || !start || !end) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
if (!this.multiColumnSelection && start.col !== end.col) {
|
|
89
|
-
throw new Error(
|
|
90
|
-
"Selection must be in the same column when multiColumnSelection is disabled"
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
const startRow = Math.min(start.row, end.row);
|
|
94
|
-
const endRow = Math.max(start.row, end.row);
|
|
95
|
-
const startCol = this.multiColumnSelection ? Math.min(start.col, end.col) : start.col;
|
|
96
|
-
const endCol = this.multiColumnSelection ? Math.max(start.col, end.col) : start.col;
|
|
97
|
-
return cell.row >= startRow && cell.row <= endRow && cell.col >= startCol && cell.col <= endCol;
|
|
98
|
-
}
|
|
99
|
-
toggleColumn(col, enabled) {
|
|
100
|
-
if (col < 0 || col >= this.cells[0].length) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
this.cells.forEach((row, index) => {
|
|
104
|
-
const cell = row[col];
|
|
105
|
-
if (cell) {
|
|
106
|
-
this.cells[index][col] = {
|
|
107
|
-
...cell,
|
|
108
|
-
enabled
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
toggleRow(row, enabled) {
|
|
114
|
-
if (row < 0 || row >= this.cells.length) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
this.cells[row].forEach((cell, index) => {
|
|
118
|
-
if (cell) {
|
|
119
|
-
this.cells[row][index] = {
|
|
120
|
-
...cell,
|
|
121
|
-
enabled
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
getCoordinatesByField(field) {
|
|
127
|
-
if (this.rowAccessors.length === 1) {
|
|
128
|
-
const col = this.columnAccessors.indexOf(field);
|
|
129
|
-
if (col === -1) {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
return { row: 0, col };
|
|
133
|
-
}
|
|
134
|
-
for (let row = 0; row < this.rowAccessors.length; row++) {
|
|
135
|
-
const rowAccessor = this.rowAccessors[row];
|
|
136
|
-
if (rowAccessor === null) {
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
if (!field.startsWith(rowAccessor)) {
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
for (let column = 0; column < this.columnAccessors.length; column++) {
|
|
143
|
-
const columnAccessor = this.columnAccessors[column];
|
|
144
|
-
if (columnAccessor === null) {
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
const fullFieldPath = `${rowAccessor}.${columnAccessor}`;
|
|
148
|
-
if (fullFieldPath === field) {
|
|
149
|
-
return { row, col: column };
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
getRowAccessor(row) {
|
|
156
|
-
if (row < 0 || row >= this.cells.length) {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
const cells = this.cells[row];
|
|
160
|
-
const nonNullFields = cells.filter((cell) => cell !== null).map((cell) => cell.field.split("."));
|
|
161
|
-
if (nonNullFields.length === 0) {
|
|
162
|
-
return null;
|
|
163
|
-
}
|
|
164
|
-
let commonParts = nonNullFields[0];
|
|
165
|
-
for (const segments of nonNullFields) {
|
|
166
|
-
commonParts = commonParts.filter(
|
|
167
|
-
(part, index) => segments[index] === part
|
|
168
|
-
);
|
|
169
|
-
if (commonParts.length === 0) {
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
const accessor = commonParts.join(".");
|
|
174
|
-
if (!accessor) {
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
return accessor;
|
|
178
|
-
}
|
|
179
|
-
getColumnAccessor(column) {
|
|
180
|
-
if (column < 0 || column >= this.cells[0].length) {
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
const uniqueParts = this.cells.map((row, rowIndex) => {
|
|
184
|
-
const cell = row[column];
|
|
185
|
-
if (!cell) {
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
|
-
const rowAccessor = this.getRowAccessor(rowIndex);
|
|
189
|
-
if (rowAccessor && cell.field.startsWith(rowAccessor + ".")) {
|
|
190
|
-
return cell.field.slice(rowAccessor.length + 1);
|
|
191
|
-
}
|
|
192
|
-
return null;
|
|
193
|
-
}).filter((part) => part !== null);
|
|
194
|
-
if (uniqueParts.length === 0) {
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
const firstPart = uniqueParts[0];
|
|
198
|
-
const isConsistent = uniqueParts.every((part) => part === firstPart);
|
|
199
|
-
return isConsistent ? firstPart : null;
|
|
200
|
-
}
|
|
201
|
-
getValidMovement(row, col, direction, metaKey = false) {
|
|
202
|
-
var _a;
|
|
203
|
-
const [dRow, dCol] = this._getDirectionDeltas(direction);
|
|
204
|
-
if (metaKey) {
|
|
205
|
-
return this._getLastValidCellInDirection(row, col, dRow, dCol);
|
|
206
|
-
} else {
|
|
207
|
-
let newRow = row + dRow;
|
|
208
|
-
let newCol = col + dCol;
|
|
209
|
-
while (this._isValidPosition(newRow, newCol)) {
|
|
210
|
-
if (this.cells[newRow][newCol] !== null && ((_a = this.cells[newRow][newCol]) == null ? void 0 : _a.enabled) !== false) {
|
|
211
|
-
return { row: newRow, col: newCol };
|
|
212
|
-
}
|
|
213
|
-
newRow += dRow;
|
|
214
|
-
newCol += dCol;
|
|
215
|
-
}
|
|
216
|
-
return { row, col };
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
_isValidPosition(row, col, cells) {
|
|
220
|
-
if (!cells) {
|
|
221
|
-
cells = this.cells;
|
|
222
|
-
}
|
|
223
|
-
return row >= 0 && row < cells.length && col >= 0 && col < cells[0].length;
|
|
224
|
-
}
|
|
225
|
-
_getDirectionDeltas(direction) {
|
|
226
|
-
switch (direction) {
|
|
227
|
-
case "ArrowUp":
|
|
228
|
-
return [-1, 0];
|
|
229
|
-
case "ArrowDown":
|
|
230
|
-
return [1, 0];
|
|
231
|
-
case "ArrowLeft":
|
|
232
|
-
return [0, -1];
|
|
233
|
-
case "ArrowRight":
|
|
234
|
-
return [0, 1];
|
|
235
|
-
default:
|
|
236
|
-
return [0, 0];
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
_getLastValidCellInDirection(row, col, dRow, dCol) {
|
|
240
|
-
let newRow = row;
|
|
241
|
-
let newCol = col;
|
|
242
|
-
let lastValidRow = row;
|
|
243
|
-
let lastValidCol = col;
|
|
244
|
-
while (this._isValidPosition(newRow + dRow, newCol + dCol)) {
|
|
245
|
-
newRow += dRow;
|
|
246
|
-
newCol += dCol;
|
|
247
|
-
if (this.cells[newRow][newCol] !== null) {
|
|
248
|
-
lastValidRow = newRow;
|
|
249
|
-
lastValidCol = newCol;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return {
|
|
253
|
-
row: lastValidRow,
|
|
254
|
-
col: lastValidCol
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
_populateCells(rows, columns) {
|
|
258
|
-
const cells = Array.from(
|
|
259
|
-
{ length: rows.length },
|
|
260
|
-
() => Array(columns.length).fill(null)
|
|
261
|
-
);
|
|
262
|
-
rows.forEach((row, rowIndex) => {
|
|
263
|
-
columns.forEach((column, colIndex) => {
|
|
264
|
-
if (!this._isValidPosition(rowIndex, colIndex, cells)) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
const {
|
|
268
|
-
name: _,
|
|
269
|
-
field,
|
|
270
|
-
type,
|
|
271
|
-
...rest
|
|
272
|
-
} = column.meta;
|
|
273
|
-
const context = {
|
|
274
|
-
row,
|
|
275
|
-
column: {
|
|
276
|
-
...column,
|
|
277
|
-
meta: rest
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
const fieldValue = field ? field(context) : null;
|
|
281
|
-
if (!fieldValue || !type) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
cells[rowIndex][colIndex] = {
|
|
285
|
-
field: fieldValue,
|
|
286
|
-
type,
|
|
287
|
-
enabled: true
|
|
288
|
-
};
|
|
289
|
-
});
|
|
290
|
-
});
|
|
291
|
-
return cells;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
export {
|
|
295
|
-
DataGridMatrix
|
|
296
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { generateCellId } from "../utils.js";
|
|
5
|
-
class DataGridQueryTool {
|
|
6
|
-
constructor(container) {
|
|
7
|
-
__publicField(this, "container");
|
|
8
|
-
this.container = container;
|
|
9
|
-
}
|
|
10
|
-
getInput(cell) {
|
|
11
|
-
var _a;
|
|
12
|
-
const id = this._getCellId(cell);
|
|
13
|
-
const input = (_a = this.container) == null ? void 0 : _a.querySelector(`[data-cell-id="${id}"]`);
|
|
14
|
-
if (!input) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return input;
|
|
18
|
-
}
|
|
19
|
-
getInputByField(field) {
|
|
20
|
-
var _a;
|
|
21
|
-
const input = (_a = this.container) == null ? void 0 : _a.querySelector(`[data-field="${field}"]`);
|
|
22
|
-
if (!input) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
return input;
|
|
26
|
-
}
|
|
27
|
-
getCoordinatesByField(field) {
|
|
28
|
-
var _a;
|
|
29
|
-
const cell = (_a = this.container) == null ? void 0 : _a.querySelector(
|
|
30
|
-
`[data-field="${field}"][data-cell-id]`
|
|
31
|
-
);
|
|
32
|
-
if (!cell) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
const cellId = cell.getAttribute("data-cell-id");
|
|
36
|
-
if (!cellId) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
const [row, col] = cellId.split(":").map((n) => parseInt(n, 10));
|
|
40
|
-
if (isNaN(row) || isNaN(col)) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
return { row, col };
|
|
44
|
-
}
|
|
45
|
-
getContainer(cell) {
|
|
46
|
-
var _a;
|
|
47
|
-
const id = this._getCellId(cell);
|
|
48
|
-
const container = (_a = this.container) == null ? void 0 : _a.querySelector(
|
|
49
|
-
`[data-container-id="${id}"]`
|
|
50
|
-
);
|
|
51
|
-
if (!container) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
return container;
|
|
55
|
-
}
|
|
56
|
-
_getCellId(cell) {
|
|
57
|
-
return generateCellId(cell);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export {
|
|
61
|
-
DataGridQueryTool
|
|
62
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
class DataGridUpdateCommand {
|
|
5
|
-
constructor({ prev, next, setter }) {
|
|
6
|
-
__publicField(this, "_prev");
|
|
7
|
-
__publicField(this, "_next");
|
|
8
|
-
__publicField(this, "_setter");
|
|
9
|
-
this._prev = prev;
|
|
10
|
-
this._next = next;
|
|
11
|
-
this._setter = setter;
|
|
12
|
-
}
|
|
13
|
-
execute() {
|
|
14
|
-
this._setter(this._next);
|
|
15
|
-
}
|
|
16
|
-
undo() {
|
|
17
|
-
this._setter(this._prev);
|
|
18
|
-
}
|
|
19
|
-
redo() {
|
|
20
|
-
this.execute();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
DataGridUpdateCommand
|
|
25
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DataGridBulkUpdateCommand } from "./data-grid-bulk-update-command.js";
|
|
2
|
-
import { DataGridMatrix } from "./data-grid-matrix.js";
|
|
3
|
-
import { DataGridQueryTool } from "./data-grid-query-tool.js";
|
|
4
|
-
import { DataGridUpdateCommand } from "./data-grid-update-command.js";
|
|
5
|
-
export {
|
|
6
|
-
DataGridBulkUpdateCommand,
|
|
7
|
-
DataGridMatrix,
|
|
8
|
-
DataGridQueryTool,
|
|
9
|
-
DataGridUpdateCommand
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
function generateCellId(coords) {
|
|
2
|
-
return `${coords.row}:${coords.col}`;
|
|
3
|
-
}
|
|
4
|
-
function isCellMatch(cell, coords) {
|
|
5
|
-
if (!coords) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
return cell.row === coords.row && cell.col === coords.col;
|
|
9
|
-
}
|
|
10
|
-
const SPECIAL_FOCUS_KEYS = [".", ","];
|
|
11
|
-
function isSpecialFocusKey(event) {
|
|
12
|
-
return SPECIAL_FOCUS_KEYS.includes(event.key) && event.ctrlKey && event.altKey;
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
generateCellId,
|
|
16
|
-
isCellMatch,
|
|
17
|
-
isSpecialFocusKey
|
|
18
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { clx } from "@medusajs/ui";
|
|
3
|
-
const DataTableStatusCell = ({
|
|
4
|
-
color,
|
|
5
|
-
children
|
|
6
|
-
}) => {
|
|
7
|
-
return /* @__PURE__ */ jsxs("div", { className: "txt-compact-small text-ui-fg-subtle flex h-full w-full items-center gap-x-2 overflow-hidden", children: [
|
|
8
|
-
/* @__PURE__ */ jsx(
|
|
9
|
-
"div",
|
|
10
|
-
{
|
|
11
|
-
role: "presentation",
|
|
12
|
-
className: "flex h-5 w-2 items-center justify-center",
|
|
13
|
-
children: /* @__PURE__ */ jsx(
|
|
14
|
-
"div",
|
|
15
|
-
{
|
|
16
|
-
className: clx(
|
|
17
|
-
"h-2 w-2 rounded-sm shadow-[0px_0px_0px_1px_rgba(0,0,0,0.12)_inset]",
|
|
18
|
-
{
|
|
19
|
-
"bg-ui-tag-neutral-icon": color === "grey",
|
|
20
|
-
"bg-ui-tag-green-icon": color === "green",
|
|
21
|
-
"bg-ui-tag-red-icon": color === "red",
|
|
22
|
-
"bg-ui-tag-blue-icon": color === "blue",
|
|
23
|
-
"bg-ui-tag-orange-icon": color === "orange",
|
|
24
|
-
"bg-ui-tag-purple-icon": color === "purple"
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
),
|
|
31
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children })
|
|
32
|
-
] });
|
|
33
|
-
};
|
|
34
|
-
export {
|
|
35
|
-
DataTableStatusCell
|
|
36
|
-
};
|