@raystack/apsara 0.19.0 → 0.20.0
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/calendar/date-picker.d.ts +2 -1
- package/dist/calendar/date-picker.d.ts.map +1 -1
- package/dist/index.cjs +121 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +5 -8
- package/dist/index.js +121 -38
- package/dist/index.js.map +1 -1
- package/dist/table/datatable.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -1067,10 +1067,10 @@ html[data-theme="dark"] {
|
|
|
1067
1067
|
padding: var(--pd-8);
|
|
1068
1068
|
}
|
|
1069
1069
|
|
|
1070
|
-
.inputfield-module_textfield-
|
|
1070
|
+
.inputfield-module_textfield-invalid__XFKPz {
|
|
1071
1071
|
border: 1px solid var(--border-danger);
|
|
1072
1072
|
}
|
|
1073
|
-
.inputfield-module_textfield-
|
|
1073
|
+
.inputfield-module_textfield-invalid__XFKPz:focus {
|
|
1074
1074
|
border: 1px solid var(--border-danger);
|
|
1075
1075
|
}
|
|
1076
1076
|
|
|
@@ -1086,6 +1086,7 @@ html[data-theme="dark"] {
|
|
|
1086
1086
|
.inputfield-module_bold__MzkDx {
|
|
1087
1087
|
font-weight: 500 !important;
|
|
1088
1088
|
}
|
|
1089
|
+
|
|
1089
1090
|
.link-module_link__3Pld2 {
|
|
1090
1091
|
flex-shrink: 0;
|
|
1091
1092
|
outline: 0;
|
|
@@ -1940,10 +1941,6 @@ html[data-theme="dark"] {
|
|
|
1940
1941
|
min-width: max-content;
|
|
1941
1942
|
}
|
|
1942
1943
|
|
|
1943
|
-
.calendar-module_datePickerInput__aOnRQ {
|
|
1944
|
-
cursor: pointer;
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
1944
|
.calendar-module_dropdowns__Wn53e {
|
|
1948
1945
|
display: flex;
|
|
1949
1946
|
align-items: center;
|
|
@@ -2030,10 +2027,10 @@ html[data-theme="dark"] {
|
|
|
2030
2027
|
padding: var(--pd-8);
|
|
2031
2028
|
}
|
|
2032
2029
|
|
|
2033
|
-
.textfield-module_textfield-
|
|
2030
|
+
.textfield-module_textfield-invalid__RtgIy {
|
|
2034
2031
|
outline: 1px solid var(--border-danger);
|
|
2035
2032
|
}
|
|
2036
|
-
.textfield-module_textfield-
|
|
2033
|
+
.textfield-module_textfield-invalid__RtgIy:focus {
|
|
2037
2034
|
outline: 1px solid var(--border-danger);
|
|
2038
2035
|
}
|
|
2039
2036
|
|
package/dist/index.js
CHANGED
|
@@ -4362,7 +4362,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
4362
4362
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
4363
4363
|
PERFORMANCE OF THIS SOFTWARE.
|
|
4364
4364
|
***************************************************************************** */
|
|
4365
|
-
/* global Reflect, Promise
|
|
4365
|
+
/* global Reflect, Promise */
|
|
4366
4366
|
|
|
4367
4367
|
|
|
4368
4368
|
var __assign = function() {
|
|
@@ -4396,12 +4396,7 @@ function __spreadArray(to, from, pack) {
|
|
|
4396
4396
|
}
|
|
4397
4397
|
}
|
|
4398
4398
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
4399
|
-
}
|
|
4400
|
-
|
|
4401
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
4402
|
-
var e = new Error(message);
|
|
4403
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
4404
|
-
};
|
|
4399
|
+
}
|
|
4405
4400
|
|
|
4406
4401
|
var zeroRightClassName = 'right-scroll-bar-position';
|
|
4407
4402
|
var fullWidthClassName = 'width-before-scroll-bar';
|
|
@@ -10173,7 +10168,7 @@ function Image({ alt, children, className, ...props }) {
|
|
|
10173
10168
|
return jsxRuntimeExports.jsx("img", { alt: alt, className: image({ className }), ...props });
|
|
10174
10169
|
}
|
|
10175
10170
|
|
|
10176
|
-
var styles$k = {"textfield":"inputfield-module_textfield__l6K73","textfield-sm":"inputfield-module_textfield-sm__QTt1x","textfield-md":"inputfield-module_textfield-md__pQWpW","textfield-
|
|
10171
|
+
var styles$k = {"textfield":"inputfield-module_textfield__l6K73","textfield-sm":"inputfield-module_textfield-sm__QTt1x","textfield-md":"inputfield-module_textfield-md__pQWpW","textfield-invalid":"inputfield-module_textfield-invalid__XFKPz","textfield-valid":"inputfield-module_textfield-valid__euwnE","bold":"inputfield-module_bold__MzkDx"};
|
|
10177
10172
|
|
|
10178
10173
|
const InputField = ({ label, children, ...props }) => {
|
|
10179
10174
|
return (jsxRuntimeExports.jsxs(Flex, { direction: "column", gap: "extra-small", ...props, children: [label && jsxRuntimeExports.jsx(Label, { className: styles$k.bold, children: label }), children] }));
|
|
@@ -28030,7 +28025,7 @@ function DayPicker(props) {
|
|
|
28030
28025
|
props.footer && (React__default.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)))));
|
|
28031
28026
|
}
|
|
28032
28027
|
|
|
28033
|
-
var styles$6 = {"calendarRoot":"calendar-module_calendarRoot__KnBz-","caption_label":"calendar-module_caption_label__C5Ys7","dropdowns":"calendar-module_dropdowns__Wn53e","dropdown_trigger":"calendar-module_dropdown_trigger__dsyaq","dropdown_item_text":"calendar-module_dropdown_item_text__Tudqv","nav_button":"calendar-module_nav_button__8W5py","nav_button_previous":"calendar-module_nav_button_previous__lWJYm","nav_button_next":"calendar-module_nav_button_next__1MzRT","months":"calendar-module_months__IN75k","nav":"calendar-module_nav__aGeze","month_caption":"calendar-module_month_caption__Ws6Hx","day":"calendar-module_day__rQFGK","disabled":"calendar-module_disabled__jqgRB","outside":"calendar-module_outside__nq5XC","selected":"calendar-module_selected__kiiAZ","range_middle":"calendar-module_range_middle__PmzFi","range_start":"calendar-module_range_start__ZUooG","range_end":"calendar-module_range_end__PKrm7","week":"calendar-module_week__kCvKJ","day_button":"calendar-module_day_button__vCKP1","today":"calendar-module_today__iXQIQ","weekday":"calendar-module_weekday__xzf6F","hidden":"calendar-module_hidden__wqJVo","calendarPopover":"calendar-module_calendarPopover__PY4sa","
|
|
28028
|
+
var styles$6 = {"calendarRoot":"calendar-module_calendarRoot__KnBz-","caption_label":"calendar-module_caption_label__C5Ys7","dropdowns":"calendar-module_dropdowns__Wn53e","dropdown_trigger":"calendar-module_dropdown_trigger__dsyaq","dropdown_item_text":"calendar-module_dropdown_item_text__Tudqv","nav_button":"calendar-module_nav_button__8W5py","nav_button_previous":"calendar-module_nav_button_previous__lWJYm","nav_button_next":"calendar-module_nav_button_next__1MzRT","months":"calendar-module_months__IN75k","nav":"calendar-module_nav__aGeze","month_caption":"calendar-module_month_caption__Ws6Hx","day":"calendar-module_day__rQFGK","disabled":"calendar-module_disabled__jqgRB","outside":"calendar-module_outside__nq5XC","selected":"calendar-module_selected__kiiAZ","range_middle":"calendar-module_range_middle__PmzFi","range_start":"calendar-module_range_start__ZUooG","range_end":"calendar-module_range_end__PKrm7","week":"calendar-module_week__kCvKJ","day_button":"calendar-module_day_button__vCKP1","today":"calendar-module_today__iXQIQ","weekday":"calendar-module_weekday__xzf6F","hidden":"calendar-module_hidden__wqJVo","calendarPopover":"calendar-module_calendarPopover__PY4sa","dropdown_icon":"calendar-module_dropdown_icon__rDTbz","dropdown_content":"calendar-module_dropdown_content__ajJ5V"};
|
|
28034
28029
|
|
|
28035
28030
|
const root$1 = cva(styles$6.calendarRoot);
|
|
28036
28031
|
function DropDown({ options = [], value, onChange, onDropdownOpen, }) {
|
|
@@ -28084,7 +28079,7 @@ const Calendar = function ({ className, classNames, showOutsideDays = true, onDr
|
|
|
28084
28079
|
}, className: root$1({ className }), mode: "single", ...props }));
|
|
28085
28080
|
};
|
|
28086
28081
|
|
|
28087
|
-
var styles$5 = {"textfield":"textfield-module_textfield__u4AGg","textfield-sm":"textfield-module_textfield-sm__OKPic","textfield-md":"textfield-module_textfield-md__e2ayW","textfield-
|
|
28082
|
+
var styles$5 = {"textfield":"textfield-module_textfield__u4AGg","textfield-sm":"textfield-module_textfield-sm__OKPic","textfield-md":"textfield-module_textfield-md__e2ayW","textfield-invalid":"textfield-module_textfield-invalid__RtgIy","textfield-valid":"textfield-module_textfield-valid__6rMM9","textfield-leading":"textfield-module_textfield-leading__AE-ld","textfield-trailing":"textfield-module_textfield-trailing__Hj2jX","leadingIcon":"textfield-module_leadingIcon__u-GJ6","trailingIcon":"textfield-module_trailingIcon__q-49S"};
|
|
28088
28083
|
|
|
28089
28084
|
const textfield = cva(styles$5.textfield, {
|
|
28090
28085
|
variants: {
|
|
@@ -28129,24 +28124,105 @@ var dayjs_min = {exports: {}};
|
|
|
28129
28124
|
var dayjs_minExports = dayjs_min.exports;
|
|
28130
28125
|
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
28131
28126
|
|
|
28132
|
-
|
|
28127
|
+
var customParseFormat$1 = {exports: {}};
|
|
28128
|
+
|
|
28129
|
+
(function (module, exports) {
|
|
28130
|
+
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return (e=+e)+(e>68?1900:2e3)};var a=function(e){return function(t){this[e]=+t;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],h=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},u=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},d={A:[i,function(e){this.afternoon=u(e,!1);}],a:[i,function(e){this.afternoon=u(e,!0);}],S:[/\d/,function(e){this.milliseconds=100*+e;}],SS:[n,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(e){var t=h("months"),n=(h("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(e){var t=h("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(e){this.year=s(e);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=s.length,f=0;f<a;f+=1){var h=s[f],u=d[h],c=u&&u[0],l=u&&u[1];s[f]=l?{regex:c,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,h=e.slice(r),u=o.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,s=e.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],h=!0===s[3],u=f||h,d=s[2];h&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(e,t,n){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var r=c(t)(e),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,h=r.seconds,u=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=h||0,g=u||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(e){return new Date("")}}(t,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,e);};}}));
|
|
28131
|
+
} (customParseFormat$1));
|
|
28132
|
+
|
|
28133
|
+
var customParseFormatExports = customParseFormat$1.exports;
|
|
28134
|
+
var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
|
|
28135
|
+
|
|
28136
|
+
dayjs.extend(customParseFormat);
|
|
28137
|
+
function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", placeholder = "DD/MM/YYYY", textFieldProps, calendarProps, value = new Date(), onSelect = () => { }, }) {
|
|
28138
|
+
const defaultDate = dayjs(value).format(dateFormat);
|
|
28133
28139
|
const [showCalendar, setShowCalendar] = useState(false);
|
|
28134
|
-
const
|
|
28135
|
-
const
|
|
28140
|
+
const [calendarVal, setCalendarVal] = useState(value);
|
|
28141
|
+
const [inputState, setInputState] = useState();
|
|
28142
|
+
const isDropdownOpenRef = useRef(false);
|
|
28143
|
+
const textFieldRef = useRef(null);
|
|
28144
|
+
const contentRef = useRef(null);
|
|
28145
|
+
const isInputFieldFocused = useRef(false);
|
|
28146
|
+
function isElementOutside(el) {
|
|
28147
|
+
return !isDropdownOpenRef.current && // Month and Year dropdown from Date picker
|
|
28148
|
+
!textFieldRef.current?.contains(el) && // TextField
|
|
28149
|
+
!contentRef.current?.contains(el);
|
|
28150
|
+
}
|
|
28151
|
+
const handleMouseDown = useCallback((event) => {
|
|
28152
|
+
const el = (event.target);
|
|
28153
|
+
if (el && isElementOutside(el))
|
|
28154
|
+
removeEventListeners();
|
|
28155
|
+
}, []);
|
|
28156
|
+
function registerEventListeners() {
|
|
28157
|
+
isInputFieldFocused.current = true;
|
|
28158
|
+
document.addEventListener('mouseup', handleMouseDown, true);
|
|
28159
|
+
}
|
|
28160
|
+
function removeEventListeners() {
|
|
28161
|
+
isInputFieldFocused.current = false;
|
|
28162
|
+
setShowCalendar(false);
|
|
28163
|
+
const updatedVal = dayjs(calendarVal).format(dateFormat);
|
|
28164
|
+
if (textFieldRef.current)
|
|
28165
|
+
textFieldRef.current.value = updatedVal;
|
|
28166
|
+
if (inputState === undefined)
|
|
28167
|
+
onSelect(dayjs(updatedVal).toDate());
|
|
28168
|
+
document.removeEventListener('mouseup', handleMouseDown);
|
|
28169
|
+
}
|
|
28136
28170
|
const handleSelect = (day) => {
|
|
28137
28171
|
onSelect(day);
|
|
28138
|
-
|
|
28172
|
+
setCalendarVal(day);
|
|
28173
|
+
setInputState(undefined);
|
|
28174
|
+
removeEventListeners();
|
|
28139
28175
|
};
|
|
28140
28176
|
function onDropdownOpen() {
|
|
28141
|
-
|
|
28177
|
+
isDropdownOpenRef.current = true;
|
|
28142
28178
|
}
|
|
28143
28179
|
function onOpenChange(open) {
|
|
28144
|
-
if (!
|
|
28180
|
+
if (!isDropdownOpenRef.current && !(isInputFieldFocused.current && showCalendar)) {
|
|
28145
28181
|
setShowCalendar(Boolean(open));
|
|
28146
28182
|
}
|
|
28147
|
-
|
|
28183
|
+
isDropdownOpenRef.current = false;
|
|
28184
|
+
}
|
|
28185
|
+
function handleInputFocus() {
|
|
28186
|
+
if (isInputFieldFocused.current)
|
|
28187
|
+
return;
|
|
28188
|
+
if (!showCalendar)
|
|
28189
|
+
setShowCalendar(true);
|
|
28190
|
+
}
|
|
28191
|
+
function handleInputBlur(event) {
|
|
28192
|
+
if (isInputFieldFocused.current) {
|
|
28193
|
+
const el = event.relatedTarget;
|
|
28194
|
+
if (el && isElementOutside(el))
|
|
28195
|
+
removeEventListeners();
|
|
28196
|
+
}
|
|
28197
|
+
else {
|
|
28198
|
+
registerEventListeners();
|
|
28199
|
+
setTimeout(() => textFieldRef.current?.focus());
|
|
28200
|
+
}
|
|
28201
|
+
}
|
|
28202
|
+
function handleKeyUp(event) {
|
|
28203
|
+
if (event.code === 'Enter' && textFieldRef.current) {
|
|
28204
|
+
textFieldRef.current.blur();
|
|
28205
|
+
removeEventListeners();
|
|
28206
|
+
}
|
|
28148
28207
|
}
|
|
28149
|
-
|
|
28208
|
+
function handleInputChange(event) {
|
|
28209
|
+
const { value } = event.target;
|
|
28210
|
+
const format = value.includes("/") ? "DD/MM/YYYY" : value.includes("-") ? "DD-MM-YYYY" : undefined;
|
|
28211
|
+
const date = dayjs(value, format);
|
|
28212
|
+
const isValidDate = date.isValid();
|
|
28213
|
+
const isAfter = calendarProps?.startMonth !== undefined ? dayjs(date).isSameOrAfter(calendarProps.startMonth) : true;
|
|
28214
|
+
const isBefore = calendarProps?.endMonth !== undefined ? dayjs(date).isSameOrBefore(calendarProps.endMonth) : true;
|
|
28215
|
+
const isValid = isValidDate && isAfter && isBefore && dayjs(date).isSameOrBefore(dayjs());
|
|
28216
|
+
if (isValid) {
|
|
28217
|
+
setCalendarVal(date.toDate());
|
|
28218
|
+
if (inputState === 'invalid')
|
|
28219
|
+
setInputState(undefined);
|
|
28220
|
+
}
|
|
28221
|
+
else {
|
|
28222
|
+
setInputState('invalid');
|
|
28223
|
+
}
|
|
28224
|
+
}
|
|
28225
|
+
return (jsxRuntimeExports.jsxs(Popover, { open: showCalendar, onOpenChange: onOpenChange, children: [jsxRuntimeExports.jsx(TextField, { ref: textFieldRef, defaultValue: defaultDate, trailing: jsxRuntimeExports.jsx(Popover.Trigger, { asChild: true, children: jsxRuntimeExports.jsx(CalendarIcon, {}) }), onChange: handleInputChange, onFocus: handleInputFocus, onBlur: handleInputBlur, state: inputState, placeholder: placeholder, onKeyUp: handleKeyUp, ...textFieldProps }), jsxRuntimeExports.jsx(Popover.Content, { side: side, className: styles$6.calendarPopover, ref: contentRef, children: jsxRuntimeExports.jsx(Calendar, { required: true, ...calendarProps, onDropdownOpen: onDropdownOpen, mode: "single", selected: calendarVal, month: calendarVal, onSelect: handleSelect, onMonthChange: setCalendarVal }) })] }));
|
|
28150
28226
|
}
|
|
28151
28227
|
|
|
28152
28228
|
function RangePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps, calendarProps, onSelect = () => { }, value = {
|
|
@@ -32128,6 +32204,31 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32128
32204
|
null;
|
|
32129
32205
|
const [tableState, setTableState] = useState({});
|
|
32130
32206
|
const observerRef = useRef(null);
|
|
32207
|
+
const lastRowRef = useRef(null);
|
|
32208
|
+
useEffect(() => {
|
|
32209
|
+
if (!onLoadMore)
|
|
32210
|
+
return;
|
|
32211
|
+
const observer = new IntersectionObserver((entries) => {
|
|
32212
|
+
if (entries[0].isIntersecting && !isLoading) {
|
|
32213
|
+
onLoadMore();
|
|
32214
|
+
}
|
|
32215
|
+
}, { threshold: 0.1 });
|
|
32216
|
+
observerRef.current = observer;
|
|
32217
|
+
return () => observer.disconnect();
|
|
32218
|
+
}, [onLoadMore]);
|
|
32219
|
+
useEffect(() => {
|
|
32220
|
+
const observer = observerRef.current;
|
|
32221
|
+
const lastRow = lastRowRef.current;
|
|
32222
|
+
if (observer && lastRow) {
|
|
32223
|
+
observer.disconnect();
|
|
32224
|
+
observer.observe(lastRow);
|
|
32225
|
+
}
|
|
32226
|
+
return () => {
|
|
32227
|
+
if (observer && lastRow) {
|
|
32228
|
+
observer.unobserve(lastRow);
|
|
32229
|
+
}
|
|
32230
|
+
};
|
|
32231
|
+
}, [isLoading]);
|
|
32131
32232
|
const getLoader = (loaderRow, columns) => ([...new Array(loaderRow)].map((_, rowIndex) => (jsxRuntimeExports.jsx(Table.Row, { children: columns.map((_, colIndex) => (jsxRuntimeExports.jsx(Table.Cell, { children: jsxRuntimeExports.jsx(Skeleton, { containerClassName: styles$4.flex1, highlightColor: "var(--background-base)", baseColor: "var(--background-base-hover)" }) }, `col_${colIndex}`))) }, `row_${rowIndex}`))));
|
|
32132
32233
|
const { filteredColumns, addFilterColumn, removeFilterColumn, resetColumns } = useTableColumn();
|
|
32133
32234
|
const columnWithCustomFilter = useMemo(() => columns.map((col) => {
|
|
@@ -32167,25 +32268,6 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32167
32268
|
initialState,
|
|
32168
32269
|
state: tableState,
|
|
32169
32270
|
});
|
|
32170
|
-
const lastRowRef = useCallback((node) => {
|
|
32171
|
-
if (isLoading)
|
|
32172
|
-
return;
|
|
32173
|
-
if (observerRef.current)
|
|
32174
|
-
observerRef.current.disconnect();
|
|
32175
|
-
observerRef.current = new IntersectionObserver((entries) => {
|
|
32176
|
-
if (entries[0].isIntersecting && onLoadMore) {
|
|
32177
|
-
onLoadMore();
|
|
32178
|
-
}
|
|
32179
|
-
});
|
|
32180
|
-
if (node)
|
|
32181
|
-
observerRef.current.observe(node);
|
|
32182
|
-
}, [isLoading, onLoadMore]);
|
|
32183
|
-
useEffect(() => {
|
|
32184
|
-
return () => {
|
|
32185
|
-
if (observerRef.current)
|
|
32186
|
-
observerRef.current.disconnect();
|
|
32187
|
-
};
|
|
32188
|
-
}, []);
|
|
32189
32271
|
const tableStyle = {
|
|
32190
32272
|
...(table.getRowModel().rows?.length
|
|
32191
32273
|
? { width: "100%" }
|
|
@@ -32224,7 +32306,8 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoa
|
|
|
32224
32306
|
? lastRowRef
|
|
32225
32307
|
: null, children: row.getVisibleCells().map((cell, index) => (jsxRuntimeExports.jsx(Table.Cell, { style: {
|
|
32226
32308
|
...(cell.column.columnDef?.meta?.style ?? {}),
|
|
32227
|
-
}, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, `${cell.id}_${index}`))) }, row.id)))) : (
|
|
32309
|
+
}, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, `${cell.id}_${index}`))) }, row.id)))) : (!isLoading ?
|
|
32310
|
+
jsxRuntimeExports.jsx(Table.Row, { children: jsxRuntimeExports.jsx(Table.Cell, { colSpan: columns.length, children: emptyState || "No results." }) }) : jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})), isLoading && getLoader(loaderRow, columns)] })] }), detail] })] }), footer] }) }));
|
|
32228
32311
|
}
|
|
32229
32312
|
const DataTable = Object.assign(DataTableRoot, {
|
|
32230
32313
|
Toolbar: DataTableToolbar,
|