@dxos/react-ui-table 0.7.5-labs.5f04cf6 → 0.7.5-labs.e27f9b9
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/lib/browser/index.mjs +23 -4
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +23 -4
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +23 -4
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/model/table-presentation.d.ts.map +1 -1
- package/dist/types/src/model/table-sorting.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +35 -35
- package/src/model/table-presentation.ts +13 -1
- package/src/model/table-sorting.ts +14 -0
- package/src/util/table-buttons.ts +1 -1
- package/src/util/table-controls.ts +2 -2
|
@@ -398,7 +398,7 @@ var BUTTON_IDENTIFIERS = {
|
|
|
398
398
|
var createButton = ({ attr, data, disabled = false, icon, testId, type = "primary" }) => {
|
|
399
399
|
const dataAttrs = Object.entries(data).map(([k, v]) => `${k}="${v}"`).join(" ");
|
|
400
400
|
const positionClass = type === "primary" ? "inline-end-2" : "inline-end-9";
|
|
401
|
-
return `<button ${attr} data-testid="${testId}" class="
|
|
401
|
+
return `<button ${attr} data-testid="${testId}" class="dx-button is-6 pli-0.5 min-bs-0 absolute inset-block-1 ${positionClass}" ${dataAttrs} ${disabled ? "disabled" : ""}><svg><use href="/icons.svg#${icon}"/></svg></button>`;
|
|
402
402
|
};
|
|
403
403
|
var addColumnButton = {
|
|
404
404
|
attr: BUTTON_IDENTIFIERS.newColumn,
|
|
@@ -509,8 +509,8 @@ var CONTROL_IDENTIFIERS = {
|
|
|
509
509
|
switch: "data-table-switch"
|
|
510
510
|
};
|
|
511
511
|
var BASE_CLASSES = {
|
|
512
|
-
checkbox: "absolute inset-block-[.375rem] inline-end-[.375rem]
|
|
513
|
-
switch: "absolute inset-block-[.25rem] inline-end-[.25rem]
|
|
512
|
+
checkbox: "absolute inset-block-[.375rem] inline-end-[.375rem] dx-checkbox",
|
|
513
|
+
switch: "absolute inset-block-[.25rem] inline-end-[.25rem] dx-checkbox--switch"
|
|
514
514
|
};
|
|
515
515
|
var renderAttributes = (data) => {
|
|
516
516
|
return Object.entries(data).map(([k, v]) => `${k}="${v}"`).join(" ");
|
|
@@ -782,6 +782,14 @@ var TableSorting = class {
|
|
|
782
782
|
if (value == null) {
|
|
783
783
|
return value;
|
|
784
784
|
}
|
|
785
|
+
if (format === FormatEnum2.SingleSelect) {
|
|
786
|
+
const options = props.options;
|
|
787
|
+
if (!options) {
|
|
788
|
+
return void 0;
|
|
789
|
+
}
|
|
790
|
+
const option = options.find((option2) => option2.id === value);
|
|
791
|
+
return option ? options.indexOf(option) : void 0;
|
|
792
|
+
}
|
|
785
793
|
if (format === FormatEnum2.Ref && field.referencePath) {
|
|
786
794
|
const refValue = getValue(value.target, field.referencePath);
|
|
787
795
|
return refValue;
|
|
@@ -1199,7 +1207,8 @@ var TablePresentation = class {
|
|
|
1199
1207
|
return "";
|
|
1200
1208
|
}
|
|
1201
1209
|
switch (props.format) {
|
|
1202
|
-
case FormatEnum4.Boolean:
|
|
1210
|
+
case FormatEnum4.Boolean:
|
|
1211
|
+
case FormatEnum4.SingleSelect: {
|
|
1203
1212
|
return "";
|
|
1204
1213
|
}
|
|
1205
1214
|
case FormatEnum4.Ref: {
|
|
@@ -1251,6 +1260,16 @@ var TablePresentation = class {
|
|
|
1251
1260
|
});
|
|
1252
1261
|
cell.readonly = true;
|
|
1253
1262
|
}
|
|
1263
|
+
if (props.format === FormatEnum4.SingleSelect) {
|
|
1264
|
+
const value = getValue3(obj, field.path);
|
|
1265
|
+
const options = this.model.projection.getFieldProjection(field.id).props.options;
|
|
1266
|
+
if (options) {
|
|
1267
|
+
const option = options.find((o) => o.id === value);
|
|
1268
|
+
if (option) {
|
|
1269
|
+
cell.accessoryHtml = `<span class="dx-tag" data-hue="${option.color}">${option.title}</span>`;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1254
1273
|
const idx = toPlaneCellIndex({
|
|
1255
1274
|
col: colIndex,
|
|
1256
1275
|
row: displayIndex
|