@shival99/z-ui 2.0.43 → 2.0.45
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.
|
@@ -4874,84 +4874,45 @@ class ZTableComponent {
|
|
|
4874
4874
|
}
|
|
4875
4875
|
return !this.hasBodyRowSpan();
|
|
4876
4876
|
}, ...(ngDevMode ? [{ debugName: "isRowDragEnabled" }] : []));
|
|
4877
|
-
actionColumnInfo =
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
if (isBodyConfig(col.body)) {
|
|
4886
|
-
const actionConfig = this._getActionColumnConfig(col.body);
|
|
4887
|
-
if (actionConfig) {
|
|
4888
|
-
return { columnId: col.id, config: actionConfig };
|
|
4889
|
-
}
|
|
4890
|
-
}
|
|
4891
|
-
if (col.columns?.length) {
|
|
4892
|
-
const found = findActionColumn(col.columns);
|
|
4893
|
-
if (found) {
|
|
4894
|
-
return found;
|
|
4895
|
-
}
|
|
4877
|
+
actionColumnInfo = computed(() => {
|
|
4878
|
+
const columns = this.zConfig().columns ?? [];
|
|
4879
|
+
const findActionColumn = (cols) => {
|
|
4880
|
+
for (const col of cols) {
|
|
4881
|
+
if (isBodyConfig(col.body)) {
|
|
4882
|
+
const actionConfig = this._getActionColumnConfig(col.body);
|
|
4883
|
+
if (actionConfig) {
|
|
4884
|
+
return { columnId: col.id, config: actionConfig };
|
|
4896
4885
|
}
|
|
4897
4886
|
}
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
return null;
|
|
4903
|
-
}
|
|
4904
|
-
const previousValue = previous?.value;
|
|
4905
|
-
if (previousValue?.columnId === actionCol.columnId && (isPending || rows.length === 0)) {
|
|
4906
|
-
return {
|
|
4907
|
-
...previousValue,
|
|
4908
|
-
config: actionCol.config,
|
|
4909
|
-
};
|
|
4910
|
-
}
|
|
4911
|
-
const { config } = actionCol;
|
|
4912
|
-
const maxVisible = config.maxVisible ?? Z_TABLE_DEFAULT_MAX_VISIBLE_ACTIONS;
|
|
4913
|
-
let buttonCount = 0;
|
|
4914
|
-
for (const row of rows) {
|
|
4915
|
-
const actions = typeof config.actions === 'function' ? config.actions(row) : config.actions;
|
|
4916
|
-
const visibleActions = actions.filter(action => {
|
|
4917
|
-
if (typeof action.hidden === 'function') {
|
|
4918
|
-
return !action.hidden(row);
|
|
4887
|
+
if (col.columns?.length) {
|
|
4888
|
+
const found = findActionColumn(col.columns);
|
|
4889
|
+
if (found) {
|
|
4890
|
+
return found;
|
|
4919
4891
|
}
|
|
4920
|
-
return !action.hidden;
|
|
4921
|
-
});
|
|
4922
|
-
const rowButtonCount = visibleActions.length > maxVisible ? 1 : visibleActions.length;
|
|
4923
|
-
buttonCount = Math.max(buttonCount, rowButtonCount);
|
|
4924
|
-
if (buttonCount === maxVisible) {
|
|
4925
|
-
break;
|
|
4926
4892
|
}
|
|
4927
4893
|
}
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
buttonCount = maxVisible;
|
|
4934
|
-
}
|
|
4935
|
-
const buttonWidth = Z_TABLE_DEFAULT_ACTION_BUTTON_WIDTH;
|
|
4936
|
-
const gap = 4;
|
|
4937
|
-
const padding = 16;
|
|
4938
|
-
const width = buttonCount * buttonWidth + Math.max(0, buttonCount - 1) * gap + padding;
|
|
4939
|
-
return {
|
|
4940
|
-
columnId: actionCol.columnId,
|
|
4941
|
-
config: actionCol.config,
|
|
4942
|
-
width,
|
|
4943
|
-
};
|
|
4944
|
-
} });
|
|
4945
|
-
_actionColumnRows = computed(() => {
|
|
4946
|
-
const data = this._data();
|
|
4947
|
-
const config = this.zConfig();
|
|
4948
|
-
if (config.mode === 'server' || !config.pagination?.enabled) {
|
|
4949
|
-
return data;
|
|
4894
|
+
return null;
|
|
4895
|
+
};
|
|
4896
|
+
const actionCol = findActionColumn(columns);
|
|
4897
|
+
if (!actionCol) {
|
|
4898
|
+
return null;
|
|
4950
4899
|
}
|
|
4951
|
-
const {
|
|
4952
|
-
const
|
|
4953
|
-
|
|
4954
|
-
|
|
4900
|
+
const { config } = actionCol;
|
|
4901
|
+
const maxVisible = config.maxVisible ?? Z_TABLE_DEFAULT_MAX_VISIBLE_ACTIONS;
|
|
4902
|
+
const possibleActionCount = Array.isArray(config.actions)
|
|
4903
|
+
? config.actions.filter(action => action.hidden !== true).length
|
|
4904
|
+
: maxVisible;
|
|
4905
|
+
const buttonCount = Math.min(possibleActionCount, maxVisible);
|
|
4906
|
+
const buttonWidth = Z_TABLE_DEFAULT_ACTION_BUTTON_WIDTH;
|
|
4907
|
+
const gap = 4;
|
|
4908
|
+
const padding = 16;
|
|
4909
|
+
const width = buttonCount * buttonWidth + Math.max(0, buttonCount - 1) * gap + padding;
|
|
4910
|
+
return {
|
|
4911
|
+
columnId: actionCol.columnId,
|
|
4912
|
+
config: actionCol.config,
|
|
4913
|
+
width,
|
|
4914
|
+
};
|
|
4915
|
+
}, ...(ngDevMode ? [{ debugName: "actionColumnInfo" }] : []));
|
|
4955
4916
|
_fixedColumnPinning = computed(() => {
|
|
4956
4917
|
const actionColumnId = this.actionColumnInfo()?.columnId;
|
|
4957
4918
|
const configuredColumnIds = new Set();
|