zaravand-ui 7.1.0 → 7.1.1
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/components/Table/Table.cjs +1 -1
- package/dist/components/Table/Table.interface.d.cts +41 -0
- package/dist/components/Table/Table.interface.d.ts +41 -0
- package/dist/components/Table/Table.js +335 -318
- package/dist/components/Table/Table.utils.cjs +1 -1
- package/dist/components/Table/Table.utils.d.cts +2 -0
- package/dist/components/Table/Table.utils.d.ts +2 -0
- package/dist/components/Table/Table.utils.js +20 -16
- package/dist/components/Table/TableActionsContext.cjs +1 -0
- package/dist/components/Table/TableActionsContext.d.cts +26 -0
- package/dist/components/Table/TableActionsContext.d.ts +26 -0
- package/dist/components/Table/TableActionsContext.js +5 -0
- package/dist/components/Table/TableParts.cjs +1 -1
- package/dist/components/Table/TableParts.js +56 -34
- package/dist/components/Table/TableRowActions.cjs +1 -0
- package/dist/components/Table/TableRowActions.d.cts +14 -0
- package/dist/components/Table/TableRowActions.d.ts +14 -0
- package/dist/components/Table/TableRowActions.js +110 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9 -8
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../services/convertToEnglishDigits/convertToEnglishDigits.cjs`),t=require(`../../services/localizeDigits/localizeDigits.cjs`);var n=96,r=56,i=16,a=/^(\d*\.?\d+)\s*(px|%|rem|em)?$/i;function o(){if(typeof window>`u`||typeof document>`u`)return i;let e=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:i}function s(e){if(typeof e==`number`)return Number.isFinite(e)&&e>0?{kind:`weight`,value:e}:{kind:`weight`,value:n};let t=typeof e==`string`?e.trim().match(a):null,r=t?Number.parseFloat(t[1]):NaN;if(!t||!Number.isFinite(r)||r<=0)return{kind:`weight`,value:n};let i=(t[2]??`px`).toLowerCase();return i===`%`?{kind:`percent`,value:r}:i===`rem`||i===`em`?{kind:`weight`,value:r*o()}:{kind:`weight`,value:r}}function c(e,t,n){let i=n?{width:`112px`,minWidth:`112px`}:void 0;if(e.length===0&&!t)return{rowNumberColumnStyle:void 0,columnStyleByKey:{},actionsColumnStyle:i};let a=t?r:0,o=e.map(e=>s(e.width)),c=o.reduce((e,t)=>t.kind===`percent`?e+t.value:e,0),l=c>100?100/c:1,u=Math.max(0,100-c*l),d=a+o.reduce((e,t)=>t.kind===`weight`?e+t.value:e,0),f=e=>d>0?e/d*u:0,p=e=>({width:`${e.toFixed(4)}%`}),m=Object.fromEntries(e.map((e,t)=>{let n=o[t],r=n.kind===`percent`?n.value*l:f(n.value);return[e.key,p(r)]}));return{rowNumberColumnStyle:t?p(f(a)):void 0,columnStyleByKey:m,actionsColumnStyle:i}}function l(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.min(12,Math.max(1,Math.floor(e))):t>0?Math.min(12,t):6}function u(e,t){let n=t%3;return e.type===`checkbox`?`zui:size-4`:e.type===`number`||e.type===`money`?n===0?`zui:h-4 zui:w-16`:n===1?`zui:h-4 zui:w-12`:`zui:h-4 zui:w-20`:e.type===`date`?n===0?`zui:h-4 zui:w-28`:n===1?`zui:h-4 zui:w-24`:`zui:h-4 zui:w-32`:e.type===`textarea`?n===0?`zui:h-4 zui:w-[92%]`:n===1?`zui:h-4 zui:w-[76%]`:`zui:h-4 zui:w-[84%]`:n===0?`zui:h-4 zui:w-[78%]`:n===1?`zui:h-4 zui:w-[62%]`:`zui:h-4 zui:w-[86%]`}function d(e){return e==null?!0:typeof e==`string`?e.trim().length===0:!1}function f(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`){let t=e.replace(/,/g,``).trim();if(t.length===0)return null;let n=Number(t);return Number.isFinite(n)?n:null}return null}function p(e){return e.toLocaleString(`en-US`)}function m(e){if(e instanceof Date&&!Number.isNaN(e.getTime()))return e;if(typeof e==`string`&&e.trim().length>0){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t}return null}function h(e){return typeof e.placeholder==`string`&&e.placeholder.trim().length>0?e.placeholder:`---`}function g(e){return typeof e.displayPlaceholder==`string`&&e.displayPlaceholder.trim().length>0?e.displayPlaceholder:h(e)}function _(e,t){if(t.type!==`select`&&t.type!==`radio`||!Array.isArray(t.options)||t.options.length===0)return null;let n=String(e).trim();if(n.length===0)return null;let r=t.options.find(e=>e.value.trim()===n);if(r){let e=r.label.trim();return e.length>0?e:null}let i=e=>{let t=e.trim().toLocaleLowerCase();return/^[0-9a-f-]+$/i.test(t)?t.replaceAll(`-`,``):t},a=n.toLocaleLowerCase(),o=t.options.find(e=>e.value.trim().toLocaleLowerCase()===a);if(o){let e=o.label.trim();return e.length>0?e:null}let s=i(n),c=t.options.find(e=>i(e.value)===s);if(!c)return null;let l=c.label.trim();return l.length>0?l:null}var v=new Map;function y(e){let t=v.get(e);return t||(t=new Intl.DateTimeFormat(`${e}-u-ca-persian`,{dateStyle:`medium`}),v.set(e,t)),t}function b(t,n,{messages:r}){if(d(t))return g(n);if(n.type===`checkbox`)return t===!0?r.common.yes:r.common.no;if(n.type===`date`){let i=m(t);return i?e.convertToEnglishDigits({value:y(r.calendar.locale).format(i)}):g(n)}if(n.type===`money`){let e=f(t);return e===null?g(n):p(e)}return typeof t==`string`||typeof t==`number`?_(t,n)||(n.type===`select`&&n.optionsSource?g(n):String(t)):g(n)}function x(e,n,r){return t.localizeDigits(b(e,n,r),r.digits)}function S(e,t,n){if(typeof n!=`function`)return;let r=n(e,t);if(typeof r==`number`)return Number.isFinite(r)?r:void 0;if(typeof r==`string`){let e=r.trim();return e.length>0?e:void 0}}function
|
|
1
|
+
const e=require(`../../services/convertToEnglishDigits/convertToEnglishDigits.cjs`),t=require(`../../services/localizeDigits/localizeDigits.cjs`);var n=96,r=56,i=16,a=/^(\d*\.?\d+)\s*(px|%|rem|em)?$/i;function o(){if(typeof window>`u`||typeof document>`u`)return i;let e=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:i}function s(e){if(typeof e==`number`)return Number.isFinite(e)&&e>0?{kind:`weight`,value:e}:{kind:`weight`,value:n};let t=typeof e==`string`?e.trim().match(a):null,r=t?Number.parseFloat(t[1]):NaN;if(!t||!Number.isFinite(r)||r<=0)return{kind:`weight`,value:n};let i=(t[2]??`px`).toLowerCase();return i===`%`?{kind:`percent`,value:r}:i===`rem`||i===`em`?{kind:`weight`,value:r*o()}:{kind:`weight`,value:r}}function c(e,t,n){let i=n?{width:`112px`,minWidth:`112px`}:void 0;if(e.length===0&&!t)return{rowNumberColumnStyle:void 0,columnStyleByKey:{},actionsColumnStyle:i};let a=t?r:0,o=e.map(e=>s(e.width)),c=o.reduce((e,t)=>t.kind===`percent`?e+t.value:e,0),l=c>100?100/c:1,u=Math.max(0,100-c*l),d=a+o.reduce((e,t)=>t.kind===`weight`?e+t.value:e,0),f=e=>d>0?e/d*u:0,p=e=>({width:`${e.toFixed(4)}%`}),m=Object.fromEntries(e.map((e,t)=>{let n=o[t],r=n.kind===`percent`?n.value*l:f(n.value);return[e.key,p(r)]}));return{rowNumberColumnStyle:t?p(f(a)):void 0,columnStyleByKey:m,actionsColumnStyle:i}}function l(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.min(12,Math.max(1,Math.floor(e))):t>0?Math.min(12,t):6}function u(e,t){let n=t%3;return e.type===`checkbox`?`zui:size-4`:e.type===`number`||e.type===`money`?n===0?`zui:h-4 zui:w-16`:n===1?`zui:h-4 zui:w-12`:`zui:h-4 zui:w-20`:e.type===`date`?n===0?`zui:h-4 zui:w-28`:n===1?`zui:h-4 zui:w-24`:`zui:h-4 zui:w-32`:e.type===`textarea`?n===0?`zui:h-4 zui:w-[92%]`:n===1?`zui:h-4 zui:w-[76%]`:`zui:h-4 zui:w-[84%]`:n===0?`zui:h-4 zui:w-[78%]`:n===1?`zui:h-4 zui:w-[62%]`:`zui:h-4 zui:w-[86%]`}function d(e){return e==null?!0:typeof e==`string`?e.trim().length===0:!1}function f(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`){let t=e.replace(/,/g,``).trim();if(t.length===0)return null;let n=Number(t);return Number.isFinite(n)?n:null}return null}function p(e){return e.toLocaleString(`en-US`)}function m(e){if(e instanceof Date&&!Number.isNaN(e.getTime()))return e;if(typeof e==`string`&&e.trim().length>0){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t}return null}function h(e){return typeof e.placeholder==`string`&&e.placeholder.trim().length>0?e.placeholder:`---`}function g(e){return typeof e.displayPlaceholder==`string`&&e.displayPlaceholder.trim().length>0?e.displayPlaceholder:h(e)}function _(e,t){if(t.type!==`select`&&t.type!==`radio`||!Array.isArray(t.options)||t.options.length===0)return null;let n=String(e).trim();if(n.length===0)return null;let r=t.options.find(e=>e.value.trim()===n);if(r){let e=r.label.trim();return e.length>0?e:null}let i=e=>{let t=e.trim().toLocaleLowerCase();return/^[0-9a-f-]+$/i.test(t)?t.replaceAll(`-`,``):t},a=n.toLocaleLowerCase(),o=t.options.find(e=>e.value.trim().toLocaleLowerCase()===a);if(o){let e=o.label.trim();return e.length>0?e:null}let s=i(n),c=t.options.find(e=>i(e.value)===s);if(!c)return null;let l=c.label.trim();return l.length>0?l:null}var v=new Map;function y(e){let t=v.get(e);return t||(t=new Intl.DateTimeFormat(`${e}-u-ca-persian`,{dateStyle:`medium`}),v.set(e,t)),t}function b(t,n,{messages:r}){if(d(t))return g(n);if(n.type===`checkbox`)return t===!0?r.common.yes:r.common.no;if(n.type===`date`){let i=m(t);return i?e.convertToEnglishDigits({value:y(r.calendar.locale).format(i)}):g(n)}if(n.type===`money`){let e=f(t);return e===null?g(n):p(e)}return typeof t==`string`||typeof t==`number`?_(t,n)||(n.type===`select`&&n.optionsSource?g(n):String(t)):g(n)}function x(e,n,r){return t.localizeDigits(b(e,n,r),r.digits)}function S(e){let t=e.target.closest(`button, a, input, textarea, select, label, [role="button"], [role="combobox"], [role="checkbox"]`);return t!==null&&e.currentTarget.contains(t)}function C(e,t,n){if(typeof n!=`function`)return;let r=n(e,t);if(typeof r==`number`)return Number.isFinite(r)?r:void 0;if(typeof r==`string`){let e=r.trim();return e.length>0?e:void 0}}function w(e,t,n,r){if(n!==void 0&&typeof r==`function`){let t=e.findIndex((e,t)=>C(e,t,r)===n);if(t>=0)return t}return t>=0&&t<e.length?t:-1}function T(e,t){if(d(e))return t.type===`number`||t.type===`money`||t.type===`date`?-1/0:``;if(t.type===`number`||t.type===`money`)return f(e)??-1/0;if(t.type===`date`){let t=m(e);return t?t.getTime():-1/0}return typeof e==`number`?e:String(e)}function E(e,t,n,r){let i=T(e[n.key],n),a=T(t[n.key],n),o=typeof i==`number`&&typeof a==`number`?i-a:String(i).localeCompare(String(a),`fa`);return r===`asc`?o:-o}function D(e,t){return e?.sortKey===t?e.direction===`asc`?{sortKey:t,direction:`desc`}:null:{sortKey:t,direction:`asc`}}function O(e){return e===`asc`?`ascending`:e===`desc`?`descending`:`none`}function k(e,t,n){return t===`asc`?`${n.sortBy} ${e} (${n.sortDescending})`:t===`desc`?`${n.sortClear} ${e} (${n.sortDefault})`:`${n.sortBy} ${e} (${n.sortAscending})`}function A(e,t,n,r,i){let a=w(e,t,n,r);if(a<0)return e;let o=[...e];return o[a]=i,o}function j(e){return e===void 0||e.length===0}function M(e,t){return e.map(e=>t.find(t=>t.value===e)?.label??e).join(`, `)}function N(e,t,n){let r=e[t.key];return n.includes(r==null?``:String(r).trim())}function P(e,t,n){if(Array.isArray(e.options)&&e.options.length>0)return e.options;if(e.optionsSource)return[];let r=new Map;return t.forEach(t=>{let i=t[e.key],a=i==null?``:String(i).trim();a.length>0&&!r.has(a)&&r.set(a,x(i,e,n))}),Array.from(r,([e,t])=>({value:e,label:t})).sort((e,t)=>e.label.localeCompare(t.label,void 0,{numeric:!0}))}exports.compareTableRowsByColumn=E,exports.formatCellValue=x,exports.isEmptyFilterValue=j,exports.isInsideInteractiveControl=S,exports.replaceRowByIdentifier=A,exports.resolveAriaSort=O,exports.resolveColumnWidthPercentages=c,exports.resolveFilterOptions=P,exports.resolveFilterText=M,exports.resolveLoadingCellSkeletonClassName=u,exports.resolveLoadingRowsCount=l,exports.resolveNextSort=D,exports.resolvePlaceholder=h,exports.resolveSafeRowId=C,exports.resolveSortToggleTooltipText=k,exports.rowMatchesColumnFilter=N;
|
|
@@ -21,6 +21,8 @@ export type TableCellFormatOptions = {
|
|
|
21
21
|
messages: ZuiMessages;
|
|
22
22
|
};
|
|
23
23
|
export declare function formatCellValue(value: unknown, column: TableSchemaColumn, options: TableCellFormatOptions): string;
|
|
24
|
+
/** True when a click landed on a control inside the row (a Select cell, a link...), not on the card. */
|
|
25
|
+
export declare function isInsideInteractiveControl(event: React.MouseEvent<HTMLElement>): boolean;
|
|
24
26
|
export declare function resolveSafeRowId(row: DynamicTableRow, index: number, getRowId?: TableRowIdResolver): TableRowId | undefined;
|
|
25
27
|
export declare function findRowIndexByIdentifier(rows: DynamicTableRow[], targetRowIndex: number, targetRowId: TableRowId | undefined, getRowId?: TableRowIdResolver): number;
|
|
26
28
|
export declare function compareTableRowsByColumn(rowA: DynamicTableRow, rowB: DynamicTableRow, column: TableSchemaColumn, direction: TableSortDirection): number;
|
|
@@ -21,6 +21,8 @@ export type TableCellFormatOptions = {
|
|
|
21
21
|
messages: ZuiMessages;
|
|
22
22
|
};
|
|
23
23
|
export declare function formatCellValue(value: unknown, column: TableSchemaColumn, options: TableCellFormatOptions): string;
|
|
24
|
+
/** True when a click landed on a control inside the row (a Select cell, a link...), not on the card. */
|
|
25
|
+
export declare function isInsideInteractiveControl(event: React.MouseEvent<HTMLElement>): boolean;
|
|
24
26
|
export declare function resolveSafeRowId(row: DynamicTableRow, index: number, getRowId?: TableRowIdResolver): TableRowId | undefined;
|
|
25
27
|
export declare function findRowIndexByIdentifier(rows: DynamicTableRow[], targetRowIndex: number, targetRowId: TableRowId | undefined, getRowId?: TableRowIdResolver): number;
|
|
26
28
|
export declare function compareTableRowsByColumn(rowA: DynamicTableRow, rowB: DynamicTableRow, column: TableSchemaColumn, direction: TableSortDirection): number;
|
|
@@ -132,7 +132,11 @@ function b(t, n, { messages: r }) {
|
|
|
132
132
|
function x(e, n, r) {
|
|
133
133
|
return t(b(e, n, r), r.digits);
|
|
134
134
|
}
|
|
135
|
-
function S(e
|
|
135
|
+
function S(e) {
|
|
136
|
+
let t = e.target.closest("button, a, input, textarea, select, label, [role=\"button\"], [role=\"combobox\"], [role=\"checkbox\"]");
|
|
137
|
+
return t !== null && e.currentTarget.contains(t);
|
|
138
|
+
}
|
|
139
|
+
function C(e, t, n) {
|
|
136
140
|
if (typeof n != "function") return;
|
|
137
141
|
let r = n(e, t);
|
|
138
142
|
if (typeof r == "number") return Number.isFinite(r) ? r : void 0;
|
|
@@ -141,14 +145,14 @@ function S(e, t, n) {
|
|
|
141
145
|
return e.length > 0 ? e : void 0;
|
|
142
146
|
}
|
|
143
147
|
}
|
|
144
|
-
function
|
|
148
|
+
function w(e, t, n, r) {
|
|
145
149
|
if (n !== void 0 && typeof r == "function") {
|
|
146
|
-
let t = e.findIndex((e, t) =>
|
|
150
|
+
let t = e.findIndex((e, t) => C(e, t, r) === n);
|
|
147
151
|
if (t >= 0) return t;
|
|
148
152
|
}
|
|
149
153
|
return t >= 0 && t < e.length ? t : -1;
|
|
150
154
|
}
|
|
151
|
-
function
|
|
155
|
+
function T(e, t) {
|
|
152
156
|
if (d(e)) return t.type === "number" || t.type === "money" || t.type === "date" ? -Infinity : "";
|
|
153
157
|
if (t.type === "number" || t.type === "money") return f(e) ?? -Infinity;
|
|
154
158
|
if (t.type === "date") {
|
|
@@ -157,11 +161,11 @@ function w(e, t) {
|
|
|
157
161
|
}
|
|
158
162
|
return typeof e == "number" ? e : String(e);
|
|
159
163
|
}
|
|
160
|
-
function
|
|
161
|
-
let i =
|
|
164
|
+
function E(e, t, n, r) {
|
|
165
|
+
let i = T(e[n.key], n), a = T(t[n.key], n), o = typeof i == "number" && typeof a == "number" ? i - a : String(i).localeCompare(String(a), "fa");
|
|
162
166
|
return r === "asc" ? o : -o;
|
|
163
167
|
}
|
|
164
|
-
function
|
|
168
|
+
function D(e, t) {
|
|
165
169
|
return e?.sortKey === t ? e.direction === "asc" ? {
|
|
166
170
|
sortKey: t,
|
|
167
171
|
direction: "desc"
|
|
@@ -170,29 +174,29 @@ function E(e, t) {
|
|
|
170
174
|
direction: "asc"
|
|
171
175
|
};
|
|
172
176
|
}
|
|
173
|
-
function
|
|
177
|
+
function O(e) {
|
|
174
178
|
return e === "asc" ? "ascending" : e === "desc" ? "descending" : "none";
|
|
175
179
|
}
|
|
176
|
-
function
|
|
180
|
+
function k(e, t, n) {
|
|
177
181
|
return t === "asc" ? `${n.sortBy} ${e} (${n.sortDescending})` : t === "desc" ? `${n.sortClear} ${e} (${n.sortDefault})` : `${n.sortBy} ${e} (${n.sortAscending})`;
|
|
178
182
|
}
|
|
179
|
-
function
|
|
180
|
-
let a =
|
|
183
|
+
function A(e, t, n, r, i) {
|
|
184
|
+
let a = w(e, t, n, r);
|
|
181
185
|
if (a < 0) return e;
|
|
182
186
|
let o = [...e];
|
|
183
187
|
return o[a] = i, o;
|
|
184
188
|
}
|
|
185
|
-
function
|
|
189
|
+
function j(e) {
|
|
186
190
|
return e === void 0 || e.length === 0;
|
|
187
191
|
}
|
|
188
|
-
function
|
|
192
|
+
function M(e, t) {
|
|
189
193
|
return e.map((e) => t.find((t) => t.value === e)?.label ?? e).join(", ");
|
|
190
194
|
}
|
|
191
|
-
function
|
|
195
|
+
function N(e, t, n) {
|
|
192
196
|
let r = e[t.key];
|
|
193
197
|
return n.includes(r == null ? "" : String(r).trim());
|
|
194
198
|
}
|
|
195
|
-
function
|
|
199
|
+
function P(e, t, n) {
|
|
196
200
|
if (Array.isArray(e.options) && e.options.length > 0) return e.options;
|
|
197
201
|
if (e.optionsSource) return [];
|
|
198
202
|
let r = /* @__PURE__ */ new Map();
|
|
@@ -205,4 +209,4 @@ function N(e, t, n) {
|
|
|
205
209
|
})).sort((e, t) => e.label.localeCompare(t.label, void 0, { numeric: !0 }));
|
|
206
210
|
}
|
|
207
211
|
//#endregion
|
|
208
|
-
export {
|
|
212
|
+
export { E as compareTableRowsByColumn, x as formatCellValue, j as isEmptyFilterValue, S as isInsideInteractiveControl, A as replaceRowByIdentifier, O as resolveAriaSort, c as resolveColumnWidthPercentages, P as resolveFilterOptions, M as resolveFilterText, u as resolveLoadingCellSkeletonClassName, l as resolveLoadingRowsCount, D as resolveNextSort, h as resolvePlaceholder, C as resolveSafeRowId, k as resolveSortToggleTooltipText, N as rowMatchesColumnFilter };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../../_virtual/_rolldown/runtime.cjs`);let t=require(`react`);t=e.__toESM(t,1);var n=t.createContext(null),r=t.createContext(null);exports.TableActionsContext=n,exports.TableRowActionsRegistryContext=r;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ActionSheetAction } from "../shared/ActionSheet.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* What a `Table` shares with the row actions placed inside its hand-written rows
|
|
5
|
+
* (`TableRowActions`, `TableActionsHead`), so they behave like the actions of a schema table: one
|
|
6
|
+
* action at a time, nothing clickable while the table is mutating, and on phones the card opens
|
|
7
|
+
* the actions as a sheet.
|
|
8
|
+
*/
|
|
9
|
+
export type TableActionsContextValue = {
|
|
10
|
+
isMobile: boolean;
|
|
11
|
+
/** True while a mutation is running or another action is still pending. */
|
|
12
|
+
isBusy: boolean;
|
|
13
|
+
/** Runs an action under the table's exclusive lock (a no-op while the table is mutating). */
|
|
14
|
+
run: (action: () => unknown) => Promise<void>;
|
|
15
|
+
/** Opens the phone sheet of a row's actions. */
|
|
16
|
+
openRowSheet: (actions: ActionSheetAction[]) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare const TableActionsContext: React.Context<TableActionsContextValue | null>;
|
|
19
|
+
/** Reads the actions of a row lazily, at the moment the card is tapped. */
|
|
20
|
+
export type TableRowActionsGetter = () => ActionSheetAction[];
|
|
21
|
+
export type TableRowActionsRegistry = {
|
|
22
|
+
/** `TableRowActions` hands its row the actions to open on a tap; `null` withdraws them. */
|
|
23
|
+
register: (getter: TableRowActionsGetter | null) => void;
|
|
24
|
+
};
|
|
25
|
+
/** Provided by each `TableRow`, so a `TableRowActions` inside it can reach its row. */
|
|
26
|
+
export declare const TableRowActionsRegistryContext: React.Context<TableRowActionsRegistry | null>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ActionSheetAction } from "../shared/ActionSheet.js";
|
|
3
|
+
/**
|
|
4
|
+
* What a `Table` shares with the row actions placed inside its hand-written rows
|
|
5
|
+
* (`TableRowActions`, `TableActionsHead`), so they behave like the actions of a schema table: one
|
|
6
|
+
* action at a time, nothing clickable while the table is mutating, and on phones the card opens
|
|
7
|
+
* the actions as a sheet.
|
|
8
|
+
*/
|
|
9
|
+
export type TableActionsContextValue = {
|
|
10
|
+
isMobile: boolean;
|
|
11
|
+
/** True while a mutation is running or another action is still pending. */
|
|
12
|
+
isBusy: boolean;
|
|
13
|
+
/** Runs an action under the table's exclusive lock (a no-op while the table is mutating). */
|
|
14
|
+
run: (action: () => unknown) => Promise<void>;
|
|
15
|
+
/** Opens the phone sheet of a row's actions. */
|
|
16
|
+
openRowSheet: (actions: ActionSheetAction[]) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare const TableActionsContext: React.Context<TableActionsContextValue | null>;
|
|
19
|
+
/** Reads the actions of a row lazily, at the moment the card is tapped. */
|
|
20
|
+
export type TableRowActionsGetter = () => ActionSheetAction[];
|
|
21
|
+
export type TableRowActionsRegistry = {
|
|
22
|
+
/** `TableRowActions` hands its row the actions to open on a tap; `null` withdraws them. */
|
|
23
|
+
register: (getter: TableRowActionsGetter | null) => void;
|
|
24
|
+
};
|
|
25
|
+
/** Provided by each `TableRow`, so a `TableRowActions` inside it can reach its row. */
|
|
26
|
+
export declare const TableRowActionsRegistryContext: React.Context<TableRowActionsRegistry | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../lib/utils.cjs`),n=require(`./Table.variant.cjs`);let
|
|
1
|
+
"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../lib/utils.cjs`),n=require(`./TableActionsContext.cjs`),r=require(`./Table.utils.cjs`),i=require(`./Table.variant.cjs`);let a=require(`react`);a=e.__toESM(a,1);let o=require(`react/jsx-runtime`);var s=a.forwardRef(function({className:e,...n},r){return(0,o.jsx)(`thead`,{...n,ref:r,"data-slot":`table-header`,className:t.cn(i.tableHeaderVariants(),e)})}),c=a.forwardRef(function({className:e,...n},r){return(0,o.jsx)(`tbody`,{...n,ref:r,"data-slot":`table-body`,className:t.cn(i.tableBodyVariants(),e)})}),l=a.forwardRef(function({className:e,...n},r){return(0,o.jsx)(`tfoot`,{...n,ref:r,"data-slot":`table-footer`,className:t.cn(i.tableFooterVariants(),e)})}),u=a.forwardRef(function({className:e,state:s,slot:c=`table-row`,onClick:l,onKeyDown:u,...d},f){let p=a.useContext(n.TableActionsContext),m=a.useRef(null),[h,g]=a.useState(!1),_=a.useMemo(()=>({register:e=>{m.current=e,g(e!==null)}}),[]),v=h&&p?.isMobile===!0?{tabIndex:0,"aria-haspopup":`dialog`,"data-actionable":`true`,onClick:e=>{l?.(e),!e.defaultPrevented&&!r.isInsideInteractiveControl(e)&&p?.openRowSheet(m.current?.()??[])},onKeyDown:e=>{u?.(e),!e.defaultPrevented&&e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),p?.openRowSheet(m.current?.()??[]))}}:{onClick:l,onKeyDown:u};return(0,o.jsx)(n.TableRowActionsRegistryContext.Provider,{value:_,children:(0,o.jsx)(`tr`,{...d,...v,ref:f,"data-slot":c,"data-state":s,className:t.cn(i.tableRowVariants(),e)})})}),d=a.forwardRef(function({className:e,align:n,ariaSort:r,...a},s){return(0,o.jsx)(`th`,{"aria-sort":r,...a,ref:s,"data-slot":`table-head`,className:t.cn(i.tableHeadVariants({align:n}),e)})}),f=a.forwardRef(function({className:e,align:n,...r},a){return(0,o.jsx)(`td`,{...r,ref:a,"data-slot":`table-cell`,className:t.cn(i.tableCellVariants({align:n}),e)})});s.displayName=`TableHeader`,c.displayName=`TableBody`,l.displayName=`TableFooter`,u.displayName=`TableRow`,d.displayName=`TableHead`,f.displayName=`TableCell`,exports.TableBody=c,exports.TableCell=f,exports.TableFooter=l,exports.TableHead=d,exports.TableHeader=s,exports.TableRow=u;
|
|
@@ -1,54 +1,76 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../lib/utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
3
|
+
import { TableActionsContext as t, TableRowActionsRegistryContext as n } from "./TableActionsContext.js";
|
|
4
|
+
import { isInsideInteractiveControl as r } from "./Table.utils.js";
|
|
5
|
+
import { tableBodyVariants as i, tableCellVariants as a, tableFooterVariants as o, tableHeadVariants as s, tableHeaderVariants as c, tableRowVariants as l } from "./Table.variant.js";
|
|
6
|
+
import * as u from "react";
|
|
7
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
6
8
|
//#region src/components/Table/TableParts.tsx
|
|
7
|
-
var
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
+
var f = u.forwardRef(function({ className: t, ...n }, r) {
|
|
10
|
+
return /* @__PURE__ */ d("thead", {
|
|
9
11
|
...n,
|
|
10
12
|
ref: r,
|
|
11
13
|
"data-slot": "table-header",
|
|
12
|
-
className: e(
|
|
14
|
+
className: e(c(), t)
|
|
13
15
|
});
|
|
14
|
-
}),
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
...
|
|
17
|
-
ref:
|
|
16
|
+
}), p = u.forwardRef(function({ className: t, ...n }, r) {
|
|
17
|
+
return /* @__PURE__ */ d("tbody", {
|
|
18
|
+
...n,
|
|
19
|
+
ref: r,
|
|
18
20
|
"data-slot": "table-body",
|
|
19
|
-
className: e(
|
|
21
|
+
className: e(i(), t)
|
|
20
22
|
});
|
|
21
|
-
}),
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
+
}), m = u.forwardRef(function({ className: t, ...n }, r) {
|
|
24
|
+
return /* @__PURE__ */ d("tfoot", {
|
|
23
25
|
...n,
|
|
24
|
-
ref:
|
|
26
|
+
ref: r,
|
|
25
27
|
"data-slot": "table-footer",
|
|
26
|
-
className: e(r(), t)
|
|
27
|
-
});
|
|
28
|
-
}), f = s.forwardRef(function({ className: t, state: n, slot: r = "table-row", ...i }, a) {
|
|
29
|
-
return /* @__PURE__ */ c("tr", {
|
|
30
|
-
...i,
|
|
31
|
-
ref: a,
|
|
32
|
-
"data-slot": r,
|
|
33
|
-
"data-state": n,
|
|
34
28
|
className: e(o(), t)
|
|
35
29
|
});
|
|
36
|
-
}),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
30
|
+
}), h = u.forwardRef(function({ className: i, state: a, slot: o = "table-row", onClick: s, onKeyDown: c, ...f }, p) {
|
|
31
|
+
let m = u.useContext(t), h = u.useRef(null), [g, _] = u.useState(!1), v = u.useMemo(() => ({ register: (e) => {
|
|
32
|
+
h.current = e, _(e !== null);
|
|
33
|
+
} }), []), y = g && m?.isMobile === !0 ? {
|
|
34
|
+
tabIndex: 0,
|
|
35
|
+
"aria-haspopup": "dialog",
|
|
36
|
+
"data-actionable": "true",
|
|
37
|
+
onClick: (e) => {
|
|
38
|
+
s?.(e), !e.defaultPrevented && !r(e) && m?.openRowSheet(h.current?.() ?? []);
|
|
39
|
+
},
|
|
40
|
+
onKeyDown: (e) => {
|
|
41
|
+
c?.(e), !e.defaultPrevented && e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), m?.openRowSheet(h.current?.() ?? []));
|
|
42
|
+
}
|
|
43
|
+
} : {
|
|
44
|
+
onClick: s,
|
|
45
|
+
onKeyDown: c
|
|
46
|
+
};
|
|
47
|
+
return /* @__PURE__ */ d(n.Provider, {
|
|
48
|
+
value: v,
|
|
49
|
+
children: /* @__PURE__ */ d("tr", {
|
|
50
|
+
...f,
|
|
51
|
+
...y,
|
|
52
|
+
ref: p,
|
|
53
|
+
"data-slot": o,
|
|
54
|
+
"data-state": a,
|
|
55
|
+
className: e(l(), i)
|
|
56
|
+
})
|
|
43
57
|
});
|
|
44
|
-
}),
|
|
45
|
-
return /* @__PURE__ */
|
|
58
|
+
}), g = u.forwardRef(function({ className: t, align: n, ariaSort: r, ...i }, a) {
|
|
59
|
+
return /* @__PURE__ */ d("th", {
|
|
60
|
+
"aria-sort": r,
|
|
46
61
|
...i,
|
|
47
62
|
ref: a,
|
|
63
|
+
"data-slot": "table-head",
|
|
64
|
+
className: e(s({ align: n }), t)
|
|
65
|
+
});
|
|
66
|
+
}), _ = u.forwardRef(function({ className: t, align: n, ...r }, i) {
|
|
67
|
+
return /* @__PURE__ */ d("td", {
|
|
68
|
+
...r,
|
|
69
|
+
ref: i,
|
|
48
70
|
"data-slot": "table-cell",
|
|
49
|
-
className: e(
|
|
71
|
+
className: e(a({ align: n }), t)
|
|
50
72
|
});
|
|
51
73
|
});
|
|
52
|
-
|
|
74
|
+
f.displayName = "TableHeader", p.displayName = "TableBody", m.displayName = "TableFooter", h.displayName = "TableRow", g.displayName = "TableHead", _.displayName = "TableCell";
|
|
53
75
|
//#endregion
|
|
54
|
-
export {
|
|
76
|
+
export { p as TableBody, _ as TableCell, m as TableFooter, g as TableHead, f as TableHeader, h as TableRow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../config/useZuiConfig.cjs`),n=require(`../../lib/utils.cjs`),r=require(`../shared/FieldClearButton.cjs`),i=require(`../shared/IconActionButton.cjs`),a=require(`./TableActionsContext.cjs`),o=require(`./Table.constants.cjs`),s=require(`./TableParts.cjs`);let c=require(`react`);c=e.__toESM(c,1);let l=require(`react/jsx-runtime`),u=require(`lucide-react`);var d={};function f(e){return(0,l.jsx)(`span`,{className:n.cn(`zui:inline-flex`,r.CLEAR_ICON_CLASS,`zui:[&>svg]:size-full`),children:e})}var p=c.forwardRef(function({row:e=d,rowIndex:r=0,rowId:p,onEdit:m,onDelete:h,editAction:g,deleteAction:_,actions:v,className:y},b){let{messages:x}=t.useZuiConfig(),S=c.useContext(a.TableActionsContext),C=c.useContext(a.TableRowActionsRegistryContext),w=S?.isMobile??!1,T=S?.isBusy??!1,E=[];m&&!g?.hidden&&E.push({key:`edit`,label:g?.tooltip??x.common.edit,icon:g?.icon??(0,l.jsx)(u.Pencil,{className:`zui:size-4`,"aria-hidden":`true`}),className:g?.className,danger:!1,disabled:g?.disabled??!1,onClick:m}),(v??[]).forEach((e,t)=>{e.hidden||E.push({key:`custom-${t}`,label:e.tooltip,icon:e.icon,className:e.className,danger:e.danger??!1,disabled:e.disabled??!1,onClick:e.onClick})}),h&&!_?.hidden&&E.push({key:`delete`,label:_?.tooltip??x.common.delete,icon:_?.icon??(0,l.jsx)(u.Trash2,{className:`zui:size-4`,"aria-hidden":`true`}),className:_?.className,danger:!0,disabled:_?.disabled??!1,onClick:h});let D=t=>{let n={row:e,rowIndex:r,rowId:p},i=()=>t.onClick(n);return S?S.run(i):Promise.resolve(i())},O=()=>E.map(e=>({key:e.key,label:e.label,icon:f(e.icon),danger:e.danger,disabled:e.disabled,onSelect:()=>void D(e)})),k=c.useRef(O);c.useLayoutEffect(()=>{k.current=O});let A=E.length>0;return c.useLayoutEffect(()=>{if(!(!w||!C||!A))return C.register(()=>k.current()),()=>C.register(null)},[A,w,C]),w?null:(0,l.jsx)(s.TableCell,{ref:b,align:`center`,"data-cell":`actions`,className:n.cn(o.actionsColumnClassName,o.actionsColumnStickyClassName,y),children:(0,l.jsx)(`div`,{"data-slot":`table-row-actions`,className:`zui:flex zui:items-center zui:justify-center zui:gap-0.5`,children:E.map(e=>(0,l.jsx)(i.IconActionButton,{"data-slot":e.key===`edit`?`table-action-edit-button`:e.key===`delete`?`table-action-delete-button`:`table-action-custom-button`,label:e.label,icon:e.icon,disabled:T||e.disabled,className:n.cn(o.rowActionButtonClassName,e.danger?`zui:text-[var(--zui-theme-status-danger)]`:`zui:text-[var(--zui-theme-text-primary)]`,e.className),onClick:()=>void D(e)},e.key))})})}),m=c.forwardRef(function({className:e,children:r,...i},u){let{messages:d}=t.useZuiConfig();return c.useContext(a.TableActionsContext)?.isMobile?null:(0,l.jsx)(s.TableHead,{...i,ref:u,align:`center`,className:n.cn(`zui:w-32`,o.actionsColumnClassName,o.actionsColumnStickyClassName,e),children:r??d.table.actions})});p.displayName=`TableRowActions`,m.displayName=`TableActionsHead`,exports.TableActionsHead=m,exports.TableRowActions=p;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { TableActionsHeadProps, TableRowActionsProps } from "./Table.interface.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* The actions cell of a row in a hand-written table (`<Table>` with children): the built-in edit and
|
|
5
|
+
* delete buttons, plus any custom actions with their own icon, tooltip, styling and handler. Place
|
|
6
|
+
* it as the last cell of a `TableRow`, under a `TableActionsHead`. It behaves like the actions
|
|
7
|
+
* column of a schema table: one action runs at a time and all are disabled while the table is
|
|
8
|
+
* mutating. Below the mobile breakpoint it draws nothing; tapping the card opens the same actions
|
|
9
|
+
* as a sheet.
|
|
10
|
+
*/
|
|
11
|
+
declare const TableRowActions: React.ForwardRefExoticComponent<TableRowActionsProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
12
|
+
/** The header cell for a `TableRowActions` column; draws nothing below the mobile breakpoint. */
|
|
13
|
+
declare const TableActionsHead: React.ForwardRefExoticComponent<TableActionsHeadProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
14
|
+
export { TableActionsHead, TableRowActions };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { TableActionsHeadProps, TableRowActionsProps } from "./Table.interface.js";
|
|
3
|
+
/**
|
|
4
|
+
* The actions cell of a row in a hand-written table (`<Table>` with children): the built-in edit and
|
|
5
|
+
* delete buttons, plus any custom actions with their own icon, tooltip, styling and handler. Place
|
|
6
|
+
* it as the last cell of a `TableRow`, under a `TableActionsHead`. It behaves like the actions
|
|
7
|
+
* column of a schema table: one action runs at a time and all are disabled while the table is
|
|
8
|
+
* mutating. Below the mobile breakpoint it draws nothing; tapping the card opens the same actions
|
|
9
|
+
* as a sheet.
|
|
10
|
+
*/
|
|
11
|
+
declare const TableRowActions: React.ForwardRefExoticComponent<TableRowActionsProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
12
|
+
/** The header cell for a `TableRowActions` column; draws nothing below the mobile breakpoint. */
|
|
13
|
+
declare const TableActionsHead: React.ForwardRefExoticComponent<TableActionsHeadProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
14
|
+
export { TableActionsHead, TableRowActions };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useZuiConfig as e } from "../../config/useZuiConfig.js";
|
|
3
|
+
import { cn as t } from "../../lib/utils.js";
|
|
4
|
+
import { CLEAR_ICON_CLASS as n } from "../shared/FieldClearButton.js";
|
|
5
|
+
import { IconActionButton as r } from "../shared/IconActionButton.js";
|
|
6
|
+
import { TableActionsContext as i, TableRowActionsRegistryContext as a } from "./TableActionsContext.js";
|
|
7
|
+
import { actionsColumnClassName as o, actionsColumnStickyClassName as s, rowActionButtonClassName as c } from "./Table.constants.js";
|
|
8
|
+
import { TableCell as l, TableHead as u } from "./TableParts.js";
|
|
9
|
+
import * as d from "react";
|
|
10
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
11
|
+
import { Pencil as p, Trash2 as m } from "lucide-react";
|
|
12
|
+
//#region src/components/Table/TableRowActions.tsx
|
|
13
|
+
var h = {};
|
|
14
|
+
function g(e) {
|
|
15
|
+
return /* @__PURE__ */ f("span", {
|
|
16
|
+
className: t("zui:inline-flex", n, "zui:[&>svg]:size-full"),
|
|
17
|
+
children: e
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
var _ = d.forwardRef(function({ row: n = h, rowIndex: u = 0, rowId: _, onEdit: v, onDelete: y, editAction: b, deleteAction: x, actions: S, className: C }, w) {
|
|
21
|
+
let { messages: T } = e(), E = d.useContext(i), D = d.useContext(a), O = E?.isMobile ?? !1, k = E?.isBusy ?? !1, A = [];
|
|
22
|
+
v && !b?.hidden && A.push({
|
|
23
|
+
key: "edit",
|
|
24
|
+
label: b?.tooltip ?? T.common.edit,
|
|
25
|
+
icon: b?.icon ?? /* @__PURE__ */ f(p, {
|
|
26
|
+
className: "zui:size-4",
|
|
27
|
+
"aria-hidden": "true"
|
|
28
|
+
}),
|
|
29
|
+
className: b?.className,
|
|
30
|
+
danger: !1,
|
|
31
|
+
disabled: b?.disabled ?? !1,
|
|
32
|
+
onClick: v
|
|
33
|
+
}), (S ?? []).forEach((e, t) => {
|
|
34
|
+
e.hidden || A.push({
|
|
35
|
+
key: `custom-${t}`,
|
|
36
|
+
label: e.tooltip,
|
|
37
|
+
icon: e.icon,
|
|
38
|
+
className: e.className,
|
|
39
|
+
danger: e.danger ?? !1,
|
|
40
|
+
disabled: e.disabled ?? !1,
|
|
41
|
+
onClick: e.onClick
|
|
42
|
+
});
|
|
43
|
+
}), y && !x?.hidden && A.push({
|
|
44
|
+
key: "delete",
|
|
45
|
+
label: x?.tooltip ?? T.common.delete,
|
|
46
|
+
icon: x?.icon ?? /* @__PURE__ */ f(m, {
|
|
47
|
+
className: "zui:size-4",
|
|
48
|
+
"aria-hidden": "true"
|
|
49
|
+
}),
|
|
50
|
+
className: x?.className,
|
|
51
|
+
danger: !0,
|
|
52
|
+
disabled: x?.disabled ?? !1,
|
|
53
|
+
onClick: y
|
|
54
|
+
});
|
|
55
|
+
let j = (e) => {
|
|
56
|
+
let t = {
|
|
57
|
+
row: n,
|
|
58
|
+
rowIndex: u,
|
|
59
|
+
rowId: _
|
|
60
|
+
}, r = () => e.onClick(t);
|
|
61
|
+
return E ? E.run(r) : Promise.resolve(r());
|
|
62
|
+
}, M = () => A.map((e) => ({
|
|
63
|
+
key: e.key,
|
|
64
|
+
label: e.label,
|
|
65
|
+
icon: g(e.icon),
|
|
66
|
+
danger: e.danger,
|
|
67
|
+
disabled: e.disabled,
|
|
68
|
+
onSelect: () => void j(e)
|
|
69
|
+
})), N = d.useRef(M);
|
|
70
|
+
d.useLayoutEffect(() => {
|
|
71
|
+
N.current = M;
|
|
72
|
+
});
|
|
73
|
+
let P = A.length > 0;
|
|
74
|
+
return d.useLayoutEffect(() => {
|
|
75
|
+
if (!(!O || !D || !P)) return D.register(() => N.current()), () => D.register(null);
|
|
76
|
+
}, [
|
|
77
|
+
P,
|
|
78
|
+
O,
|
|
79
|
+
D
|
|
80
|
+
]), O ? null : /* @__PURE__ */ f(l, {
|
|
81
|
+
ref: w,
|
|
82
|
+
align: "center",
|
|
83
|
+
"data-cell": "actions",
|
|
84
|
+
className: t(o, s, C),
|
|
85
|
+
children: /* @__PURE__ */ f("div", {
|
|
86
|
+
"data-slot": "table-row-actions",
|
|
87
|
+
className: "zui:flex zui:items-center zui:justify-center zui:gap-0.5",
|
|
88
|
+
children: A.map((e) => /* @__PURE__ */ f(r, {
|
|
89
|
+
"data-slot": e.key === "edit" ? "table-action-edit-button" : e.key === "delete" ? "table-action-delete-button" : "table-action-custom-button",
|
|
90
|
+
label: e.label,
|
|
91
|
+
icon: e.icon,
|
|
92
|
+
disabled: k || e.disabled,
|
|
93
|
+
className: t(c, e.danger ? "zui:text-[var(--zui-theme-status-danger)]" : "zui:text-[var(--zui-theme-text-primary)]", e.className),
|
|
94
|
+
onClick: () => void j(e)
|
|
95
|
+
}, e.key))
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
}), v = d.forwardRef(function({ className: n, children: r, ...a }, c) {
|
|
99
|
+
let { messages: l } = e();
|
|
100
|
+
return d.useContext(i)?.isMobile ? null : /* @__PURE__ */ f(u, {
|
|
101
|
+
...a,
|
|
102
|
+
ref: c,
|
|
103
|
+
align: "center",
|
|
104
|
+
className: t("zui:w-32", o, s, n),
|
|
105
|
+
children: r ?? l.table.actions
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
_.displayName = "TableRowActions", v.displayName = "TableActionsHead";
|
|
109
|
+
//#endregion
|
|
110
|
+
export { v as TableActionsHead, _ as TableRowActions };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});/* empty css */const e=require(`./shared/theme.cjs`),t=require(`./config/messages.cjs`),n=require(`./config/ZuiConfigProvider.cjs`),r=require(`./config/useZuiConfig.cjs`),i=require(`./services/localizeDigits/localizeDigits.cjs`),a=require(`./shared/scale.cjs`),o=require(`./components/Spinner/Spinner.cjs`),s=require(`./components/Button/Button.cjs`),c=require(`./components/Dialog/Dialog.cjs`),l=require(`./components/Tooltip/Tooltip.cjs`),u=require(`./components/Input/Input.cjs`),d=require(`./components/Accordion/Accordion.cjs`),f=require(`./components/Toast/function/showToast.cjs`),p=require(`./components/Avatar/Avatar.cjs`),m=require(`./components/Checkbox/Checkbox.cjs`),h=require(`./components/DatePicker/DatePicker.utils.cjs`),g=require(`./components/DatePicker/DatePicker.cjs`),_=require(`./components/OtpInput/OtpInput.cjs`),v=require(`./components/Pagination/Pagination.cjs`),y=require(`./components/RadioGroup/RadioGroup.cjs`),b=require(`./components/Skeleton/Skeleton.cjs`),x=require(`./components/Tabs/Tabs.cjs`),S=require(`./components/Select/Select.cjs`),C=require(`./components/Sheet/Sheet.cjs`),w=require(`./components/Switch/Switch.cjs`),T=require(`./components/Table/TableColumnFilter.cjs`),E=require(`./components/Table/TableParts.cjs`),D=require(`./components/Table/Table.cjs`),O=require(`./components/VerticalTabs/VerticalTabs.cjs`),
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});/* empty css */const e=require(`./shared/theme.cjs`),t=require(`./config/messages.cjs`),n=require(`./config/ZuiConfigProvider.cjs`),r=require(`./config/useZuiConfig.cjs`),i=require(`./services/localizeDigits/localizeDigits.cjs`),a=require(`./shared/scale.cjs`),o=require(`./components/Spinner/Spinner.cjs`),s=require(`./components/Button/Button.cjs`),c=require(`./components/Dialog/Dialog.cjs`),l=require(`./components/Tooltip/Tooltip.cjs`),u=require(`./components/Input/Input.cjs`),d=require(`./components/Accordion/Accordion.cjs`),f=require(`./components/Toast/function/showToast.cjs`),p=require(`./components/Avatar/Avatar.cjs`),m=require(`./components/Checkbox/Checkbox.cjs`),h=require(`./components/DatePicker/DatePicker.utils.cjs`),g=require(`./components/DatePicker/DatePicker.cjs`),_=require(`./components/OtpInput/OtpInput.cjs`),v=require(`./components/Pagination/Pagination.cjs`),y=require(`./components/RadioGroup/RadioGroup.cjs`),b=require(`./components/Skeleton/Skeleton.cjs`),x=require(`./components/Tabs/Tabs.cjs`),S=require(`./components/Select/Select.cjs`),C=require(`./components/Sheet/Sheet.cjs`),w=require(`./components/Switch/Switch.cjs`),T=require(`./components/Table/TableColumnFilter.cjs`),E=require(`./components/Table/TableParts.cjs`),D=require(`./components/Table/Table.cjs`),O=require(`./components/Table/TableRowActions.cjs`),k=require(`./components/VerticalTabs/VerticalTabs.cjs`),A=require(`./components/Textarea/Textarea.cjs`),j=require(`./components/TimePicker/TimePicker.cjs`),M=require(`./components/Toast/Toast.cjs`),N=require(`./components/Toast/ToastHost.cjs`),P=require(`./components/Toggle/Toggle.cjs`),F=require(`./components/Uploader/Uploader.cjs`);exports.Accordion=d.default,exports.AccordionContent=d.AccordionContent,exports.AccordionItem=d.AccordionItem,exports.AccordionTrigger=d.AccordionTrigger,exports.Avatar=p.default,exports.AvatarGroup=p.AvatarGroup,exports.Button=s.default,exports.Checkbox=m.default,exports.DEFAULT_TOAST_DURATION=f.DEFAULT_TOAST_DURATION,exports.DatePicker=g.default,exports.Dialog=c.default,exports.Input=u.default,exports.OtpInput=_.default,exports.PERSISTENT_DURATION=f.PERSISTENT_DURATION,exports.Pagination=v.default,exports.RadioGroup=y.default,exports.RadioGroupItem=y.RadioGroupItem,exports.Select=S.default,exports.SelectContent=S.SelectContent,exports.SelectGroup=S.SelectGroup,exports.SelectItem=S.SelectItem,exports.SelectLabel=S.SelectLabel,exports.SelectSeparator=S.SelectSeparator,exports.SelectTrigger=S.SelectTrigger,exports.SelectValue=S.SelectValue,exports.Sheet=C.default,exports.Skeleton=b.default,exports.Spinner=o.default,exports.Switch=w.default,exports.Table=D.default,exports.TableActionsHead=O.TableActionsHead,exports.TableBody=E.TableBody,exports.TableCell=E.TableCell,exports.TableColumnFilter=T.default,exports.TableFooter=E.TableFooter,exports.TableHead=E.TableHead,exports.TableHeader=E.TableHeader,exports.TableRow=E.TableRow,exports.TableRowActions=O.TableRowActions,exports.Tabs=x.default,exports.TabsContent=x.TabsContent,exports.TabsList=x.TabsList,exports.TabsTrigger=x.TabsTrigger,exports.Textarea=A.default,exports.TimePicker=j.default,exports.Toast=M.default,exports.ToastAction=M.ToastAction,exports.ToastClose=M.ToastClose,exports.ToastDescription=M.ToastDescription,exports.ToastHost=N.default,exports.ToastProvider=M.ToastProvider,exports.ToastTitle=M.ToastTitle,exports.ToastViewport=M.ToastViewport,exports.Toggle=P.default,exports.Tooltip=l.default,exports.TooltipProvider=l.TooltipProvider,exports.Uploader=F.default,exports.VerticalTabs=k.default,exports.ZUI_SCALE_CSS_VARIABLE=a.ZUI_SCALE_CSS_VARIABLE,exports.ZuiConfigProvider=n.default,exports.applyScale=a.applyScale,exports.applyTheme=e.applyTheme,exports.createThemeCssVariables=e.createThemeCssVariables,exports.enMessages=t.enMessages,exports.faMessages=t.faMessages,exports.formatPersianDate=h.formatPersianDate,exports.formatPersianDateRangeLabel=h.formatPersianDateRangeLabel,exports.hasToastListeners=f.hasToastListeners,exports.localizeDigits=i.localizeDigits,exports.resolveTheme=e.resolveTheme,exports.showToast=f.showToast,exports.subscribeToast=f.subscribeToast,exports.theme=e.theme,exports.themeCssVariables=e.themeCssVariables,exports.useZuiConfig=r.useZuiConfig;
|
package/dist/index.d.cts
CHANGED
|
@@ -46,7 +46,8 @@ export { default as Switch } from "./components/Switch/Switch.cjs";
|
|
|
46
46
|
export type { SwitchProps } from "./components/Switch/Switch.interface.cjs";
|
|
47
47
|
export { default as Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from "./components/Table/Table.cjs";
|
|
48
48
|
export { default as TableColumnFilter } from "./components/Table/TableColumnFilter.cjs";
|
|
49
|
-
export
|
|
49
|
+
export { TableActionsHead, TableRowActions } from "./components/Table/TableRowActions.cjs";
|
|
50
|
+
export type { DynamicTableRow, TableAction, TableActionsHeadProps, TableActiveSort, TableAddRowHandler, TableBodyProps, TableCellProps, TableCellSelectChangeHandler, TableCellSelectChangeHandlerInput, TableColumnAlign, TableColumnFilterProps, TableColumnViewType, TableDefaultActionOptions, TableDeleteRowHandler, TableEditRowHandler, TableFieldType, TableFieldValue, TableFilterValue, TableFilterValues, TableFooterProps, TableHeaderProps, TableHeadProps, TableImportExcelHandler, TableMutationHookResult, TablePagingMode, TablePrintHandler, TablePrintHandlerInput, TableProps, TableRowActionInput, TableRowActionsProps, TableRowId, TableRowIdResolver, TableRowProps, TableRowState, TableSchema, TableSchemaColumn, TableSchemaFilter, TableSchemaPagination, TableSchemaSort, TableSelectOption, TableSelectOptionsSource, TableSortDirection, } from "./components/Table/Table.interface.cjs";
|
|
50
51
|
export { default as VerticalTabs } from "./components/VerticalTabs/VerticalTabs.cjs";
|
|
51
52
|
export type { VerticalTabsBadgeTone, VerticalTabsItem, VerticalTabsProps, VerticalTabsVariant, } from "./components/VerticalTabs/VerticalTabs.interface.cjs";
|
|
52
53
|
export { default as Tabs } from "./components/Tabs/Tabs.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,8 @@ export { default as Switch } from "./components/Switch/Switch.js";
|
|
|
46
46
|
export type { SwitchProps } from "./components/Switch/Switch.interface.js";
|
|
47
47
|
export { default as Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from "./components/Table/Table.js";
|
|
48
48
|
export { default as TableColumnFilter } from "./components/Table/TableColumnFilter.js";
|
|
49
|
-
export
|
|
49
|
+
export { TableActionsHead, TableRowActions } from "./components/Table/TableRowActions.js";
|
|
50
|
+
export type { DynamicTableRow, TableAction, TableActionsHeadProps, TableActiveSort, TableAddRowHandler, TableBodyProps, TableCellProps, TableCellSelectChangeHandler, TableCellSelectChangeHandlerInput, TableColumnAlign, TableColumnFilterProps, TableColumnViewType, TableDefaultActionOptions, TableDeleteRowHandler, TableEditRowHandler, TableFieldType, TableFieldValue, TableFilterValue, TableFilterValues, TableFooterProps, TableHeaderProps, TableHeadProps, TableImportExcelHandler, TableMutationHookResult, TablePagingMode, TablePrintHandler, TablePrintHandlerInput, TableProps, TableRowActionInput, TableRowActionsProps, TableRowId, TableRowIdResolver, TableRowProps, TableRowState, TableSchema, TableSchemaColumn, TableSchemaFilter, TableSchemaPagination, TableSchemaSort, TableSelectOption, TableSelectOptionsSource, TableSortDirection, } from "./components/Table/Table.interface.js";
|
|
50
51
|
export { default as VerticalTabs } from "./components/VerticalTabs/VerticalTabs.js";
|
|
51
52
|
export type { VerticalTabsBadgeTone, VerticalTabsItem, VerticalTabsProps, VerticalTabsVariant, } from "./components/VerticalTabs/VerticalTabs.interface.js";
|
|
52
53
|
export { default as Tabs } from "./components/Tabs/Tabs.js";
|
package/dist/index.js
CHANGED
|
@@ -27,11 +27,12 @@ import Z from "./components/Switch/Switch.js";
|
|
|
27
27
|
import Q from "./components/Table/TableColumnFilter.js";
|
|
28
28
|
import { TableBody as $, TableCell as ee, TableFooter as te, TableHead as ne, TableHeader as re, TableRow as ie } from "./components/Table/TableParts.js";
|
|
29
29
|
import ae from "./components/Table/Table.js";
|
|
30
|
-
import oe from "./components/
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import ge from "./components/Toast/
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
|
|
30
|
+
import { TableActionsHead as oe, TableRowActions as se } from "./components/Table/TableRowActions.js";
|
|
31
|
+
import ce from "./components/VerticalTabs/VerticalTabs.js";
|
|
32
|
+
import le from "./components/Textarea/Textarea.js";
|
|
33
|
+
import ue from "./components/TimePicker/TimePicker.js";
|
|
34
|
+
import de, { ToastAction as fe, ToastClose as pe, ToastDescription as me, ToastProvider as he, ToastTitle as ge, ToastViewport as _e } from "./components/Toast/Toast.js";
|
|
35
|
+
import ve from "./components/Toast/ToastHost.js";
|
|
36
|
+
import ye from "./components/Toggle/Toggle.js";
|
|
37
|
+
import be from "./components/Uploader/Uploader.js";
|
|
38
|
+
export { v as Accordion, y as AccordionContent, b as AccordionItem, x as AccordionTrigger, D as Avatar, O as AvatarGroup, p as Button, k as Checkbox, S as DEFAULT_TOAST_DURATION, M as DatePicker, m as Dialog, _ as Input, N as OtpInput, C as PERSISTENT_DURATION, P as Pagination, F as RadioGroup, I as RadioGroupItem, H as Select, U as SelectContent, W as SelectGroup, G as SelectItem, K as SelectLabel, q as SelectSeparator, J as SelectTrigger, Y as SelectValue, X as Sheet, L as Skeleton, f as Spinner, Z as Switch, ae as Table, oe as TableActionsHead, $ as TableBody, ee as TableCell, Q as TableColumnFilter, te as TableFooter, ne as TableHead, re as TableHeader, ie as TableRow, se as TableRowActions, R as Tabs, z as TabsContent, B as TabsList, V as TabsTrigger, le as Textarea, ue as TimePicker, de as Toast, fe as ToastAction, pe as ToastClose, me as ToastDescription, ve as ToastHost, he as ToastProvider, ge as ToastTitle, _e as ToastViewport, ye as Toggle, h as Tooltip, g as TooltipProvider, be as Uploader, ce as VerticalTabs, u as ZUI_SCALE_CSS_VARIABLE, s as ZuiConfigProvider, d as applyScale, e as applyTheme, t as createThemeCssVariables, a as enMessages, o as faMessages, A as formatPersianDate, j as formatPersianDateRangeLabel, w as hasToastListeners, l as localizeDigits, n as resolveTheme, T as showToast, E as subscribeToast, r as theme, i as themeCssVariables, c as useZuiConfig };
|