@shival99/z-ui 2.0.44 → 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,96 +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
|
-
const actionKeys = Array.isArray(actionConfig.actions)
|
|
4889
|
-
? actionConfig.actions.map(action => action.key)
|
|
4890
|
-
: ['dynamic'];
|
|
4891
|
-
const schemaKey = JSON.stringify([
|
|
4892
|
-
col.id,
|
|
4893
|
-
col.size,
|
|
4894
|
-
col.minSize,
|
|
4895
|
-
col.maxSize,
|
|
4896
|
-
actionConfig.maxVisible ?? Z_TABLE_DEFAULT_MAX_VISIBLE_ACTIONS,
|
|
4897
|
-
actionKeys,
|
|
4898
|
-
]);
|
|
4899
|
-
return { columnId: col.id, config: actionConfig, schemaKey };
|
|
4900
|
-
}
|
|
4901
|
-
}
|
|
4902
|
-
if (col.columns?.length) {
|
|
4903
|
-
const found = findActionColumn(col.columns);
|
|
4904
|
-
if (found) {
|
|
4905
|
-
return found;
|
|
4906
|
-
}
|
|
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 };
|
|
4907
4885
|
}
|
|
4908
4886
|
}
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
return null;
|
|
4914
|
-
}
|
|
4915
|
-
const previousValue = previous?.value;
|
|
4916
|
-
if (previousValue?.schemaKey === actionCol.schemaKey && (isPending || rows.length === 0)) {
|
|
4917
|
-
return {
|
|
4918
|
-
...previousValue,
|
|
4919
|
-
config: actionCol.config,
|
|
4920
|
-
};
|
|
4921
|
-
}
|
|
4922
|
-
const { config } = actionCol;
|
|
4923
|
-
const maxVisible = config.maxVisible ?? Z_TABLE_DEFAULT_MAX_VISIBLE_ACTIONS;
|
|
4924
|
-
let buttonCount = 0;
|
|
4925
|
-
for (const row of rows) {
|
|
4926
|
-
const actions = typeof config.actions === 'function' ? config.actions(row) : config.actions;
|
|
4927
|
-
const visibleActions = actions.filter(action => {
|
|
4928
|
-
if (typeof action.hidden === 'function') {
|
|
4929
|
-
return !action.hidden(row);
|
|
4887
|
+
if (col.columns?.length) {
|
|
4888
|
+
const found = findActionColumn(col.columns);
|
|
4889
|
+
if (found) {
|
|
4890
|
+
return found;
|
|
4930
4891
|
}
|
|
4931
|
-
return !action.hidden;
|
|
4932
|
-
});
|
|
4933
|
-
const rowButtonCount = visibleActions.length > maxVisible ? 1 : visibleActions.length;
|
|
4934
|
-
buttonCount = Math.max(buttonCount, rowButtonCount);
|
|
4935
|
-
if (buttonCount === maxVisible) {
|
|
4936
|
-
break;
|
|
4937
4892
|
}
|
|
4938
4893
|
}
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
buttonCount = maxVisible;
|
|
4945
|
-
}
|
|
4946
|
-
const buttonWidth = Z_TABLE_DEFAULT_ACTION_BUTTON_WIDTH;
|
|
4947
|
-
const gap = 4;
|
|
4948
|
-
const padding = 16;
|
|
4949
|
-
const width = buttonCount * buttonWidth + Math.max(0, buttonCount - 1) * gap + padding;
|
|
4950
|
-
return {
|
|
4951
|
-
columnId: actionCol.columnId,
|
|
4952
|
-
config: actionCol.config,
|
|
4953
|
-
schemaKey: actionCol.schemaKey,
|
|
4954
|
-
width,
|
|
4955
|
-
};
|
|
4956
|
-
} });
|
|
4957
|
-
_actionColumnRows = computed(() => {
|
|
4958
|
-
const data = this._data();
|
|
4959
|
-
const config = this.zConfig();
|
|
4960
|
-
if (config.mode === 'server' || !config.pagination?.enabled) {
|
|
4961
|
-
return data;
|
|
4894
|
+
return null;
|
|
4895
|
+
};
|
|
4896
|
+
const actionCol = findActionColumn(columns);
|
|
4897
|
+
if (!actionCol) {
|
|
4898
|
+
return null;
|
|
4962
4899
|
}
|
|
4963
|
-
const {
|
|
4964
|
-
const
|
|
4965
|
-
|
|
4966
|
-
|
|
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" }] : []));
|
|
4967
4916
|
_fixedColumnPinning = computed(() => {
|
|
4968
4917
|
const actionColumnId = this.actionColumnInfo()?.columnId;
|
|
4969
4918
|
const configuredColumnIds = new Set();
|