@revisium/schema-toolkit-ui 0.6.4 → 0.6.5
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/index.cjs +12 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -28
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +31 -28
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +12 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10440,13 +10440,15 @@ var CellVM = class {
|
|
|
10440
10440
|
_cellFSM;
|
|
10441
10441
|
_onCommit;
|
|
10442
10442
|
_systemValues;
|
|
10443
|
-
|
|
10443
|
+
_readonly;
|
|
10444
|
+
constructor(rowModel, column, rowId, cellFSM, onCommit, systemValues, readonly) {
|
|
10444
10445
|
this._rowModel = rowModel;
|
|
10445
10446
|
this._column = column;
|
|
10446
10447
|
this._rowId = rowId;
|
|
10447
10448
|
this._cellFSM = cellFSM;
|
|
10448
10449
|
this._onCommit = onCommit ?? null;
|
|
10449
10450
|
this._systemValues = systemValues ?? null;
|
|
10451
|
+
this._readonly = readonly ?? false;
|
|
10450
10452
|
(0, mobx.makeAutoObservable)(this, { selectionEdges: (0, mobx.computed)({ equals: mobx.comparer.structural }) }, { autoBind: true });
|
|
10451
10453
|
}
|
|
10452
10454
|
get field() {
|
|
@@ -10483,6 +10485,7 @@ var CellVM = class {
|
|
|
10483
10485
|
return "";
|
|
10484
10486
|
}
|
|
10485
10487
|
get isReadOnly() {
|
|
10488
|
+
if (this._readonly) return true;
|
|
10486
10489
|
if (this._systemValues) return true;
|
|
10487
10490
|
if (this._column.fieldType === FilterFieldType.File) {
|
|
10488
10491
|
const fileNameNode = this._getFileNameNode();
|
|
@@ -10728,14 +10731,16 @@ var RowVM = class {
|
|
|
10728
10731
|
_selection;
|
|
10729
10732
|
_onCellCommit;
|
|
10730
10733
|
_systemValues;
|
|
10734
|
+
_readonly;
|
|
10731
10735
|
_cellCache = /* @__PURE__ */ new Map();
|
|
10732
|
-
constructor(rowModel, rowId, cellFSM, selection, onCellCommit, systemValues) {
|
|
10736
|
+
constructor(rowModel, rowId, cellFSM, selection, onCellCommit, systemValues, readonly) {
|
|
10733
10737
|
this._rowModel = rowModel;
|
|
10734
10738
|
this._rowId = rowId;
|
|
10735
10739
|
this._cellFSM = cellFSM;
|
|
10736
10740
|
this._selection = selection;
|
|
10737
10741
|
this._onCellCommit = onCellCommit ?? null;
|
|
10738
10742
|
this._systemValues = systemValues ?? {};
|
|
10743
|
+
this._readonly = readonly ?? false;
|
|
10739
10744
|
(0, mobx.makeAutoObservable)(this, {}, { autoBind: true });
|
|
10740
10745
|
}
|
|
10741
10746
|
get rowId() {
|
|
@@ -10753,7 +10758,7 @@ var RowVM = class {
|
|
|
10753
10758
|
getCellVM(column) {
|
|
10754
10759
|
const cached = this._cellCache.get(column.field);
|
|
10755
10760
|
if (cached) return cached;
|
|
10756
|
-
const cell = new CellVM(this._rowModel, column, this._rowId, this._cellFSM, this._onCellCommit ?? void 0, column.isSystem ? this._systemValues : void 0);
|
|
10761
|
+
const cell = new CellVM(this._rowModel, column, this._rowId, this._cellFSM, this._onCellCommit ?? void 0, column.isSystem ? this._systemValues : void 0, this._readonly);
|
|
10757
10762
|
this._cellCache.set(column.field, cell);
|
|
10758
10763
|
return cell;
|
|
10759
10764
|
}
|
|
@@ -13783,6 +13788,7 @@ var TableEditorCore = class {
|
|
|
13783
13788
|
this._dataSource = dataSource;
|
|
13784
13789
|
this._tableId = options.tableId;
|
|
13785
13790
|
this._pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE;
|
|
13791
|
+
this._readonly = options.readonly ?? false;
|
|
13786
13792
|
this._breadcrumbs = options.breadcrumbs ?? [];
|
|
13787
13793
|
this._callbacks = options.callbacks ?? {};
|
|
13788
13794
|
this.columns = new ColumnsModel();
|
|
@@ -13879,8 +13885,8 @@ var TableEditorCore = class {
|
|
|
13879
13885
|
const meta = await this._dataSource.fetchMetadata();
|
|
13880
13886
|
(0, mobx.runInAction)(() => {
|
|
13881
13887
|
this._schemaContext.init(meta.dataSchema, meta.refSchemas);
|
|
13882
|
-
this._readonly = meta.readonly;
|
|
13883
|
-
this.viewBadge.setCanSave(!
|
|
13888
|
+
this._readonly = this._readonly || meta.readonly;
|
|
13889
|
+
this.viewBadge.setCanSave(!this._readonly);
|
|
13884
13890
|
});
|
|
13885
13891
|
this.columns.init(this._schemaContext.allColumns);
|
|
13886
13892
|
this.sorts.init(this._schemaContext.sortableFields);
|
|
@@ -13951,7 +13957,7 @@ var TableEditorCore = class {
|
|
|
13951
13957
|
});
|
|
13952
13958
|
const systemValuesMap = /* @__PURE__ */ new Map();
|
|
13953
13959
|
for (const raw of rawRows) systemValuesMap.set(raw.rowId, this._buildSystemValues(raw));
|
|
13954
|
-
return tableModel.rows.map((rowModel) => new RowVM(rowModel, rowModel.rowId, this.cellFSM, this.selection, (rowId, field, value, previousValue) => this._commitCell(rowId, field, value, previousValue), systemValuesMap.get(rowModel.rowId)));
|
|
13960
|
+
return tableModel.rows.map((rowModel) => new RowVM(rowModel, rowModel.rowId, this.cellFSM, this.selection, (rowId, field, value, previousValue) => this._commitCell(rowId, field, value, previousValue), systemValuesMap.get(rowModel.rowId), this._readonly));
|
|
13955
13961
|
}
|
|
13956
13962
|
_buildSystemValues(rawRow) {
|
|
13957
13963
|
return {
|