@dxos/react-ui-table 0.7.5-main.9d2a38b → 0.7.5-main.ff8607b
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/components/Table/Table.stories.d.ts +1 -4
- package/dist/types/src/components/Table/Table.stories.d.ts.map +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/package.json +35 -35
- package/src/_deprecated/schema/Schema.stories.tsx +1 -1
- package/src/components/Table/Table.stories.tsx +19 -19
- 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
|
@@ -391,7 +391,7 @@ var BUTTON_IDENTIFIERS = {
|
|
|
391
391
|
var createButton = ({ attr, data, disabled = false, icon, testId, type = "primary" }) => {
|
|
392
392
|
const dataAttrs = Object.entries(data).map(([k, v]) => `${k}="${v}"`).join(" ");
|
|
393
393
|
const positionClass = type === "primary" ? "inline-end-2" : "inline-end-9";
|
|
394
|
-
return `<button ${attr} data-testid="${testId}" class="
|
|
394
|
+
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>`;
|
|
395
395
|
};
|
|
396
396
|
var addColumnButton = {
|
|
397
397
|
attr: BUTTON_IDENTIFIERS.newColumn,
|
|
@@ -502,8 +502,8 @@ var CONTROL_IDENTIFIERS = {
|
|
|
502
502
|
switch: "data-table-switch"
|
|
503
503
|
};
|
|
504
504
|
var BASE_CLASSES = {
|
|
505
|
-
checkbox: "absolute inset-block-[.375rem] inline-end-[.375rem]
|
|
506
|
-
switch: "absolute inset-block-[.25rem] inline-end-[.25rem]
|
|
505
|
+
checkbox: "absolute inset-block-[.375rem] inline-end-[.375rem] dx-checkbox",
|
|
506
|
+
switch: "absolute inset-block-[.25rem] inline-end-[.25rem] dx-checkbox--switch"
|
|
507
507
|
};
|
|
508
508
|
var renderAttributes = (data) => {
|
|
509
509
|
return Object.entries(data).map(([k, v]) => `${k}="${v}"`).join(" ");
|
|
@@ -775,6 +775,14 @@ var TableSorting = class {
|
|
|
775
775
|
if (value == null) {
|
|
776
776
|
return value;
|
|
777
777
|
}
|
|
778
|
+
if (format === FormatEnum2.SingleSelect) {
|
|
779
|
+
const options = props.options;
|
|
780
|
+
if (!options) {
|
|
781
|
+
return void 0;
|
|
782
|
+
}
|
|
783
|
+
const option = options.find((option2) => option2.id === value);
|
|
784
|
+
return option ? options.indexOf(option) : void 0;
|
|
785
|
+
}
|
|
778
786
|
if (format === FormatEnum2.Ref && field.referencePath) {
|
|
779
787
|
const refValue = getValue(value.target, field.referencePath);
|
|
780
788
|
return refValue;
|
|
@@ -1192,7 +1200,8 @@ var TablePresentation = class {
|
|
|
1192
1200
|
return "";
|
|
1193
1201
|
}
|
|
1194
1202
|
switch (props.format) {
|
|
1195
|
-
case FormatEnum4.Boolean:
|
|
1203
|
+
case FormatEnum4.Boolean:
|
|
1204
|
+
case FormatEnum4.SingleSelect: {
|
|
1196
1205
|
return "";
|
|
1197
1206
|
}
|
|
1198
1207
|
case FormatEnum4.Ref: {
|
|
@@ -1244,6 +1253,16 @@ var TablePresentation = class {
|
|
|
1244
1253
|
});
|
|
1245
1254
|
cell.readonly = true;
|
|
1246
1255
|
}
|
|
1256
|
+
if (props.format === FormatEnum4.SingleSelect) {
|
|
1257
|
+
const value = getValue3(obj, field.path);
|
|
1258
|
+
const options = this.model.projection.getFieldProjection(field.id).props.options;
|
|
1259
|
+
if (options) {
|
|
1260
|
+
const option = options.find((o) => o.id === value);
|
|
1261
|
+
if (option) {
|
|
1262
|
+
cell.accessoryHtml = `<span class="dx-tag" data-hue="${option.color}">${option.title}</span>`;
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1247
1266
|
const idx = toPlaneCellIndex({
|
|
1248
1267
|
col: colIndex,
|
|
1249
1268
|
row: displayIndex
|