react-asc 25.10.1 → 25.11.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/index.d.ts +29 -0
- package/index.es.js +104 -4
- package/index.js +104 -4
- package/lib/helpers/index.d.ts +1 -0
- package/lib/helpers/sort.helper.d.ts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/typings/array-extension.d.ts +10 -0
- package/lib/typings/date-extension.d.ts +13 -0
- package/lib/typings/index.d.ts +3 -0
- package/lib/typings/string-extensions.d.ts +6 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React$1, { ReactNode, Component, ComponentProps, ReactElement } from 'react';
|
|
3
3
|
import { UnparseObject, ParseResult } from 'papaparse';
|
|
4
|
+
import { ConfigType, OpUnitType, ManipulateType } from 'dayjs';
|
|
4
5
|
|
|
5
6
|
declare enum COLOR {
|
|
6
7
|
primary = "primary",
|
|
@@ -1087,4 +1088,32 @@ declare class LoggerService implements ILoggerService {
|
|
|
1087
1088
|
}
|
|
1088
1089
|
declare const loggerService: LoggerService;
|
|
1089
1090
|
|
|
1091
|
+
declare global {
|
|
1092
|
+
interface Array<T> {
|
|
1093
|
+
groupBy(valueGetter: (a: T) => string): IDictionary<T[]>;
|
|
1094
|
+
orderBy<T, G>(valueGetter: (a: T) => G, ascending?: boolean): T[];
|
|
1095
|
+
filterBy<G>(key?: string): G[];
|
|
1096
|
+
distinct<T>(comparator?: (obj1: unknown, obj2: unknown) => boolean): T[];
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
declare global {
|
|
1101
|
+
interface Date {
|
|
1102
|
+
isAfter(date: ConfigType, unit?: OpUnitType): boolean;
|
|
1103
|
+
isBefore(date: ConfigType, unit?: OpUnitType): boolean;
|
|
1104
|
+
format(template?: string): string;
|
|
1105
|
+
isValid(): boolean;
|
|
1106
|
+
add(value: number, unit?: ManipulateType): Date;
|
|
1107
|
+
subtract(value: number, unit?: ManipulateType): Date;
|
|
1108
|
+
firstDayOfMonth(): Date;
|
|
1109
|
+
lastDayOfMonth(): Date;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
declare global {
|
|
1114
|
+
interface String {
|
|
1115
|
+
capitalize(): string;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1090
1119
|
export { Alert, AppBar, AppBarTitle, AutoComplete, Backdrop, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonContext, ButtonGroup, COLOR, Card, CardBody, CardFooter, CardImage, CardSubtitle, CardText, CardTitle, CaretDownSolidIcon, CheckSolidIcon, CheckSquareRegularIcon, Checkbox, ChevronDownSolidIcon, ChevronLeftSolidIcon, ChevronRightSolidIcon, ChevronUpSolidIcon, Chip, CircleSolidIcon, Column, ConditionalWrapper, CssTransition, DATEMODE, DatePicker, DateSelect, DaySelect, Dot, Drawer, EmailValidator, ExpansionPanel, ExpansionPanelContent, ExpansionPanelHeader, FileInput, FileService, FloatingActionButton, Form, FormControl, FormError, FormGroup, FormHint, FormInput, FormLabel, GlobalModal, HomeSolidIcon, HourSelect, HtmlBaseProps, HtmlInputProps, IAlertProps, IAppBarProps, IAppBarTitleProps, IAutoCompleteProps, IBackdropProps, IBadgeProps, IBreadcrumbItemProps, IBreadcrumbProps, IButtonContext, IButtonGroupProps, IButtonProps, ICheckboxProps, IChipProps, IContainerProps, IControls, IDatePickerProps, IDateSelectProps, IDaySelectProps, IDictionary, IDot, IDrawerProps, IExpansionPanelContentProps, IExpansionPanelHeaderProps, IExpansionPanelProps, IFileInputProps, IFileUnparseConfig, IFloatingActionButtonProps, IFormAutoCompleteOptions, IFormControlConfig, IFormControlType, IFormInputError, IFormInputEvent, IFormInputOptions, IFormInputProps, IFormProps, IFormSelectOptions, IFormState, IFormTextAreaOptions, IFormValidatorType, IHourProps, IIconButtonProps, IIconProps, IListItemProps, IListProps, ILoadingIndicatorContainerProps, ILoadingIndicatorService, ILoggerService, IMenuBodyProps, IMenuProps, IMilliSecondProps, IMinuteProps, IModalButton, IModalOptions, IModalProps$1 as IModalProps, IModalService, IMonthProps, INumberSelectProps, IPortalProps, IProgressBarProps, ISecondProps, ISelectOption, ISelectProps, ISidebarItem, ISkeletonAvatarProps, ISkeletonFooterProps, ISkeletonImageProps, ISkeletonTextProps, ISnackbarOptions, ISnackbarProps, ISnackbarService, ISpeedDialActionProps, ISpeedDialIconProps, ISpeedDialProps, IStepProps, IStepperActionsProps, IStepperProps, ITabPanelProps, ITabProps, ITableCellProps, ITableProps, ITabsProps, ITextareaProps, ITimeSelectProps, ITooltipProps, ITreeItemProps, ITypographyProps, IUseWindowSize, IWrapperProps, IYearProps, Icon, IconButton, IsEmptyValidator, IsEqualValidator, Link, List, ListItem, ListItemAction, ListItemAvatar, ListItemIcon, ListItemText, LoadingIndicator, LoadingIndicatorContainer, LogType, MODALBUTTONTYPE, MODALTYPE, MaxValidator, Menu, MenuBody, MenuDivider, MenuItem, MenuPosition, MenuToggle, MilliSecondSelect, MinValidator, MinuteSelect, Modal, ModalBody, ModalFooter, ModalHeader, MonthSelect, Nullable, NumberSelect, POSITION, PlusSolidIcon, Portal, ProgressBar, Row, SIZE, STATUS, SecondSelect, Select, Sidebar, SkeletonAvatar, SkeletonFooter, SkeletonImage, SkeletonText, Snackbar, SpeedDial, SpeedDialAction, SpeedDialIcon, SpinnerSolidIcon, SquareRegularIcon, Step, Stepper, StepperActions, TIMEMODE, Tab, TabPanel, Table, TableBody, TableCell, TableHead, TableRow, Tabs, Textarea, TimeSelect, TimesCircleSolidIcon, TimesSolidIcon, Tooltip, TooltipPlacement, TreeItem, TreeView, Typography, VARIANT, YearSelect, clipboardService, fileService, loadingIndicatorService, localService, loggerService, modalService, snackbarService, useButtonContext, useConstructor, useCssClasses, useDebounce, useHover, useMobileDetect, useOnDestroy, usePrevious, useWindowSize };
|
package/index.es.js
CHANGED
|
@@ -2109,7 +2109,7 @@ var root = freeGlobal || freeSelf || Function('return this')();
|
|
|
2109
2109
|
* @param {string} key The key of the property to get.
|
|
2110
2110
|
* @returns {*} Returns the property value.
|
|
2111
2111
|
*/
|
|
2112
|
-
function getValue$
|
|
2112
|
+
function getValue$2(object, key) {
|
|
2113
2113
|
return object == null ? undefined : object[key];
|
|
2114
2114
|
}
|
|
2115
2115
|
|
|
@@ -2534,7 +2534,7 @@ function getMapData(map, key) {
|
|
|
2534
2534
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
2535
2535
|
*/
|
|
2536
2536
|
function getNative(object, key) {
|
|
2537
|
-
var value = getValue$
|
|
2537
|
+
var value = getValue$2(object, key);
|
|
2538
2538
|
return baseIsNative(value) ? value : undefined;
|
|
2539
2539
|
}
|
|
2540
2540
|
|
|
@@ -4631,7 +4631,7 @@ function getValueType(view) {
|
|
|
4631
4631
|
var index = allViews.indexOf(view);
|
|
4632
4632
|
return allValueTypes[index];
|
|
4633
4633
|
}
|
|
4634
|
-
function getValue(value, index) {
|
|
4634
|
+
function getValue$1(value, index) {
|
|
4635
4635
|
var rawValue = Array.isArray(value) ? value[index] : value;
|
|
4636
4636
|
if (!rawValue) {
|
|
4637
4637
|
return null;
|
|
@@ -4644,7 +4644,7 @@ function getValue(value, index) {
|
|
|
4644
4644
|
}
|
|
4645
4645
|
function getDetailValue(_a, index) {
|
|
4646
4646
|
var value = _a.value, minDate = _a.minDate, maxDate = _a.maxDate, maxDetail = _a.maxDetail;
|
|
4647
|
-
var valuePiece = getValue(value, index);
|
|
4647
|
+
var valuePiece = getValue$1(value, index);
|
|
4648
4648
|
if (!valuePiece) {
|
|
4649
4649
|
return null;
|
|
4650
4650
|
}
|
|
@@ -7208,4 +7208,104 @@ class LocalService {
|
|
|
7208
7208
|
}
|
|
7209
7209
|
const localService = new LocalService();
|
|
7210
7210
|
|
|
7211
|
+
var SortOrder;
|
|
7212
|
+
(function (SortOrder) {
|
|
7213
|
+
SortOrder[SortOrder["NONE"] = 0] = "NONE";
|
|
7214
|
+
SortOrder[SortOrder["ASC"] = 1] = "ASC";
|
|
7215
|
+
SortOrder[SortOrder["DESC"] = -1] = "DESC";
|
|
7216
|
+
})(SortOrder || (SortOrder = {}));
|
|
7217
|
+
const compareString = (valA, valB, ascending) => {
|
|
7218
|
+
return valA.localeCompare(valB) * (ascending ? SortOrder.ASC : SortOrder.DESC);
|
|
7219
|
+
};
|
|
7220
|
+
const getSortOrder = (valA, valB) => {
|
|
7221
|
+
return valA < valB ? SortOrder.DESC : valA === valB ? SortOrder.NONE : SortOrder.ASC;
|
|
7222
|
+
};
|
|
7223
|
+
const compareNonString = (valA, valB, ascending) => {
|
|
7224
|
+
return getSortOrder(valA, valB) * (ascending ? SortOrder.ASC : SortOrder.DESC);
|
|
7225
|
+
};
|
|
7226
|
+
const getValue = (valA, valB, ascending) => {
|
|
7227
|
+
let result = 0;
|
|
7228
|
+
if (typeof valA === 'string' && typeof valB === 'string') {
|
|
7229
|
+
result = compareString(valA, valB, ascending);
|
|
7230
|
+
}
|
|
7231
|
+
else {
|
|
7232
|
+
result = compareNonString(valA, valB, ascending);
|
|
7233
|
+
}
|
|
7234
|
+
return result;
|
|
7235
|
+
};
|
|
7236
|
+
const sortHelper = (a, b, valueGetter, ascending) => {
|
|
7237
|
+
const valA = valueGetter(a);
|
|
7238
|
+
const valB = valueGetter(b);
|
|
7239
|
+
return getValue(valA, valB, ascending);
|
|
7240
|
+
};
|
|
7241
|
+
|
|
7242
|
+
Array.prototype.groupBy = function (valueGetter) {
|
|
7243
|
+
return this.reduce((curr, obj) => {
|
|
7244
|
+
const key = valueGetter(obj);
|
|
7245
|
+
(curr[key] = curr[key] || []).push(obj);
|
|
7246
|
+
return curr;
|
|
7247
|
+
}, {});
|
|
7248
|
+
};
|
|
7249
|
+
Array.prototype.orderBy = function (valueGetter, ascending = true) {
|
|
7250
|
+
this?.sort((a, b) => sortHelper(a, b, valueGetter, ascending));
|
|
7251
|
+
return this;
|
|
7252
|
+
};
|
|
7253
|
+
Array.prototype.filterBy = function (key) {
|
|
7254
|
+
return this.filter(a => {
|
|
7255
|
+
let result = false;
|
|
7256
|
+
if (key && a[key]) {
|
|
7257
|
+
result = a[key] === key;
|
|
7258
|
+
}
|
|
7259
|
+
else {
|
|
7260
|
+
result = a === key;
|
|
7261
|
+
}
|
|
7262
|
+
return result;
|
|
7263
|
+
});
|
|
7264
|
+
};
|
|
7265
|
+
Array.prototype.distinct = function (comparator) {
|
|
7266
|
+
const thisAsArray = this;
|
|
7267
|
+
const result = comparator
|
|
7268
|
+
? thisAsArray.filter((value, index, array) => array.findIndex(o => comparator(o, value)) === index)
|
|
7269
|
+
: thisAsArray.filter((value, index, array) => array.indexOf(value) === index);
|
|
7270
|
+
return result;
|
|
7271
|
+
};
|
|
7272
|
+
|
|
7273
|
+
var dayjs_min = createCommonjsModule(function (module, exports) {
|
|
7274
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:O.s(this.$y,4,"0"),M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
|
|
7275
|
+
});
|
|
7276
|
+
|
|
7277
|
+
var localizedFormat = createCommonjsModule(function (module, exports) {
|
|
7278
|
+
!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"};return function(t,o,n){var r=o.prototype,i=r.format;n.en.formats=e,r.format=function(t){void 0===t&&(t="YYYY-MM-DDTHH:mm:ssZ");var o=this.$locale().formats,n=function(t,o){return t.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var i=r&&r.toUpperCase();return n||o[r]||e[r]||o[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,o){return t||o.slice(1)}))}))}(t,void 0===o?{}:o);return i.call(this,n)};}}));
|
|
7279
|
+
});
|
|
7280
|
+
|
|
7281
|
+
dayjs_min.extend(localizedFormat);
|
|
7282
|
+
Date.prototype.isAfter = function (date, unit) {
|
|
7283
|
+
return dayjs_min(this).isAfter(date, unit);
|
|
7284
|
+
};
|
|
7285
|
+
Date.prototype.isBefore = function (date, unit) {
|
|
7286
|
+
return dayjs_min(this).isBefore(date, unit);
|
|
7287
|
+
};
|
|
7288
|
+
Date.prototype.format = function (template) {
|
|
7289
|
+
return dayjs_min(this).format(template);
|
|
7290
|
+
};
|
|
7291
|
+
Date.prototype.isValid = function () {
|
|
7292
|
+
return dayjs_min(this).isValid();
|
|
7293
|
+
};
|
|
7294
|
+
Date.prototype.add = function (value, unit) {
|
|
7295
|
+
return dayjs_min(this).add(value, unit).toDate();
|
|
7296
|
+
};
|
|
7297
|
+
Date.prototype.subtract = function (value, unit) {
|
|
7298
|
+
return dayjs_min(this).subtract(value, unit).toDate();
|
|
7299
|
+
};
|
|
7300
|
+
Date.prototype.firstDayOfMonth = function () {
|
|
7301
|
+
return dayjs_min(this).startOf('month').toDate();
|
|
7302
|
+
};
|
|
7303
|
+
Date.prototype.lastDayOfMonth = function () {
|
|
7304
|
+
return dayjs_min(this).endOf('month').toDate();
|
|
7305
|
+
};
|
|
7306
|
+
|
|
7307
|
+
String.prototype.capitalize = function () {
|
|
7308
|
+
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
7309
|
+
};
|
|
7310
|
+
|
|
7211
7311
|
export { Alert, AppBar, AppBarTitle, AutoComplete, Backdrop, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonContext, ButtonGroup, COLOR, Card, CardBody, CardFooter, CardImage, CardSubtitle, CardText, CardTitle, CaretDownSolidIcon, CheckSolidIcon, CheckSquareRegularIcon, Checkbox, ChevronDownSolidIcon, ChevronLeftSolidIcon, ChevronRightSolidIcon, ChevronUpSolidIcon, Chip, CircleSolidIcon, Column, ConditionalWrapper, CssTransition, DATEMODE, DatePicker, DateSelect, DaySelect, Dot, Drawer, EmailValidator, ExpansionPanel, ExpansionPanelContent, ExpansionPanelHeader, FileInput, FileService, FloatingActionButton, Form, FormControl, FormError, FormGroup, FormHint, FormInput, FormLabel, GlobalModal, HomeSolidIcon, HourSelect, Icon, IconButton, IsEmptyValidator, IsEqualValidator, Link, List, ListItem, ListItemAction, ListItemAvatar, ListItemIcon, ListItemText, LoadingIndicator, LoadingIndicatorContainer, LogType, MODALBUTTONTYPE, MODALTYPE, MaxValidator, Menu, MenuBody, MenuDivider, MenuItem, MenuToggle, MilliSecondSelect, MinValidator, MinuteSelect, Modal, ModalBody, ModalFooter, ModalHeader, MonthSelect, NumberSelect, POSITION, PlusSolidIcon, Portal$1 as Portal, ProgressBar, Row, SIZE, STATUS, SecondSelect, Select, Sidebar, SkeletonAvatar, SkeletonFooter, SkeletonImage, SkeletonText, Snackbar, SpeedDial, SpeedDialAction, SpeedDialIcon, SpinnerSolidIcon, SquareRegularIcon, Step, Stepper, StepperActions, TIMEMODE, Tab, TabPanel, Table, TableBody, TableCell, TableHead, TableRow, Tabs, Textarea, TimeSelect, TimesCircleSolidIcon, TimesSolidIcon, Tooltip, TooltipPlacement, TreeItem, TreeView, Typography, VARIANT, YearSelect, clipboardService, fileService, loadingIndicatorService, localService, loggerService, modalService, snackbarService, useButtonContext, useConstructor, useCssClasses, useDebounce, useHover, useMobileDetect, useOnDestroy, usePrevious, useWindowSize };
|
package/index.js
CHANGED
|
@@ -2111,7 +2111,7 @@ var root = freeGlobal || freeSelf || Function('return this')();
|
|
|
2111
2111
|
* @param {string} key The key of the property to get.
|
|
2112
2112
|
* @returns {*} Returns the property value.
|
|
2113
2113
|
*/
|
|
2114
|
-
function getValue$
|
|
2114
|
+
function getValue$2(object, key) {
|
|
2115
2115
|
return object == null ? undefined : object[key];
|
|
2116
2116
|
}
|
|
2117
2117
|
|
|
@@ -2536,7 +2536,7 @@ function getMapData(map, key) {
|
|
|
2536
2536
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
2537
2537
|
*/
|
|
2538
2538
|
function getNative(object, key) {
|
|
2539
|
-
var value = getValue$
|
|
2539
|
+
var value = getValue$2(object, key);
|
|
2540
2540
|
return baseIsNative(value) ? value : undefined;
|
|
2541
2541
|
}
|
|
2542
2542
|
|
|
@@ -4633,7 +4633,7 @@ function getValueType(view) {
|
|
|
4633
4633
|
var index = allViews.indexOf(view);
|
|
4634
4634
|
return allValueTypes[index];
|
|
4635
4635
|
}
|
|
4636
|
-
function getValue(value, index) {
|
|
4636
|
+
function getValue$1(value, index) {
|
|
4637
4637
|
var rawValue = Array.isArray(value) ? value[index] : value;
|
|
4638
4638
|
if (!rawValue) {
|
|
4639
4639
|
return null;
|
|
@@ -4646,7 +4646,7 @@ function getValue(value, index) {
|
|
|
4646
4646
|
}
|
|
4647
4647
|
function getDetailValue(_a, index) {
|
|
4648
4648
|
var value = _a.value, minDate = _a.minDate, maxDate = _a.maxDate, maxDetail = _a.maxDetail;
|
|
4649
|
-
var valuePiece = getValue(value, index);
|
|
4649
|
+
var valuePiece = getValue$1(value, index);
|
|
4650
4650
|
if (!valuePiece) {
|
|
4651
4651
|
return null;
|
|
4652
4652
|
}
|
|
@@ -7210,6 +7210,106 @@ class LocalService {
|
|
|
7210
7210
|
}
|
|
7211
7211
|
const localService = new LocalService();
|
|
7212
7212
|
|
|
7213
|
+
var SortOrder;
|
|
7214
|
+
(function (SortOrder) {
|
|
7215
|
+
SortOrder[SortOrder["NONE"] = 0] = "NONE";
|
|
7216
|
+
SortOrder[SortOrder["ASC"] = 1] = "ASC";
|
|
7217
|
+
SortOrder[SortOrder["DESC"] = -1] = "DESC";
|
|
7218
|
+
})(SortOrder || (SortOrder = {}));
|
|
7219
|
+
const compareString = (valA, valB, ascending) => {
|
|
7220
|
+
return valA.localeCompare(valB) * (ascending ? SortOrder.ASC : SortOrder.DESC);
|
|
7221
|
+
};
|
|
7222
|
+
const getSortOrder = (valA, valB) => {
|
|
7223
|
+
return valA < valB ? SortOrder.DESC : valA === valB ? SortOrder.NONE : SortOrder.ASC;
|
|
7224
|
+
};
|
|
7225
|
+
const compareNonString = (valA, valB, ascending) => {
|
|
7226
|
+
return getSortOrder(valA, valB) * (ascending ? SortOrder.ASC : SortOrder.DESC);
|
|
7227
|
+
};
|
|
7228
|
+
const getValue = (valA, valB, ascending) => {
|
|
7229
|
+
let result = 0;
|
|
7230
|
+
if (typeof valA === 'string' && typeof valB === 'string') {
|
|
7231
|
+
result = compareString(valA, valB, ascending);
|
|
7232
|
+
}
|
|
7233
|
+
else {
|
|
7234
|
+
result = compareNonString(valA, valB, ascending);
|
|
7235
|
+
}
|
|
7236
|
+
return result;
|
|
7237
|
+
};
|
|
7238
|
+
const sortHelper = (a, b, valueGetter, ascending) => {
|
|
7239
|
+
const valA = valueGetter(a);
|
|
7240
|
+
const valB = valueGetter(b);
|
|
7241
|
+
return getValue(valA, valB, ascending);
|
|
7242
|
+
};
|
|
7243
|
+
|
|
7244
|
+
Array.prototype.groupBy = function (valueGetter) {
|
|
7245
|
+
return this.reduce((curr, obj) => {
|
|
7246
|
+
const key = valueGetter(obj);
|
|
7247
|
+
(curr[key] = curr[key] || []).push(obj);
|
|
7248
|
+
return curr;
|
|
7249
|
+
}, {});
|
|
7250
|
+
};
|
|
7251
|
+
Array.prototype.orderBy = function (valueGetter, ascending = true) {
|
|
7252
|
+
this?.sort((a, b) => sortHelper(a, b, valueGetter, ascending));
|
|
7253
|
+
return this;
|
|
7254
|
+
};
|
|
7255
|
+
Array.prototype.filterBy = function (key) {
|
|
7256
|
+
return this.filter(a => {
|
|
7257
|
+
let result = false;
|
|
7258
|
+
if (key && a[key]) {
|
|
7259
|
+
result = a[key] === key;
|
|
7260
|
+
}
|
|
7261
|
+
else {
|
|
7262
|
+
result = a === key;
|
|
7263
|
+
}
|
|
7264
|
+
return result;
|
|
7265
|
+
});
|
|
7266
|
+
};
|
|
7267
|
+
Array.prototype.distinct = function (comparator) {
|
|
7268
|
+
const thisAsArray = this;
|
|
7269
|
+
const result = comparator
|
|
7270
|
+
? thisAsArray.filter((value, index, array) => array.findIndex(o => comparator(o, value)) === index)
|
|
7271
|
+
: thisAsArray.filter((value, index, array) => array.indexOf(value) === index);
|
|
7272
|
+
return result;
|
|
7273
|
+
};
|
|
7274
|
+
|
|
7275
|
+
var dayjs_min = createCommonjsModule(function (module, exports) {
|
|
7276
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:O.s(this.$y,4,"0"),M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
|
|
7277
|
+
});
|
|
7278
|
+
|
|
7279
|
+
var localizedFormat = createCommonjsModule(function (module, exports) {
|
|
7280
|
+
!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"};return function(t,o,n){var r=o.prototype,i=r.format;n.en.formats=e,r.format=function(t){void 0===t&&(t="YYYY-MM-DDTHH:mm:ssZ");var o=this.$locale().formats,n=function(t,o){return t.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var i=r&&r.toUpperCase();return n||o[r]||e[r]||o[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,o){return t||o.slice(1)}))}))}(t,void 0===o?{}:o);return i.call(this,n)};}}));
|
|
7281
|
+
});
|
|
7282
|
+
|
|
7283
|
+
dayjs_min.extend(localizedFormat);
|
|
7284
|
+
Date.prototype.isAfter = function (date, unit) {
|
|
7285
|
+
return dayjs_min(this).isAfter(date, unit);
|
|
7286
|
+
};
|
|
7287
|
+
Date.prototype.isBefore = function (date, unit) {
|
|
7288
|
+
return dayjs_min(this).isBefore(date, unit);
|
|
7289
|
+
};
|
|
7290
|
+
Date.prototype.format = function (template) {
|
|
7291
|
+
return dayjs_min(this).format(template);
|
|
7292
|
+
};
|
|
7293
|
+
Date.prototype.isValid = function () {
|
|
7294
|
+
return dayjs_min(this).isValid();
|
|
7295
|
+
};
|
|
7296
|
+
Date.prototype.add = function (value, unit) {
|
|
7297
|
+
return dayjs_min(this).add(value, unit).toDate();
|
|
7298
|
+
};
|
|
7299
|
+
Date.prototype.subtract = function (value, unit) {
|
|
7300
|
+
return dayjs_min(this).subtract(value, unit).toDate();
|
|
7301
|
+
};
|
|
7302
|
+
Date.prototype.firstDayOfMonth = function () {
|
|
7303
|
+
return dayjs_min(this).startOf('month').toDate();
|
|
7304
|
+
};
|
|
7305
|
+
Date.prototype.lastDayOfMonth = function () {
|
|
7306
|
+
return dayjs_min(this).endOf('month').toDate();
|
|
7307
|
+
};
|
|
7308
|
+
|
|
7309
|
+
String.prototype.capitalize = function () {
|
|
7310
|
+
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
7311
|
+
};
|
|
7312
|
+
|
|
7213
7313
|
exports.Alert = Alert;
|
|
7214
7314
|
exports.AppBar = AppBar;
|
|
7215
7315
|
exports.AppBarTitle = AppBarTitle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sort.helper';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sortHelper: <T, G>(a: T, b: T, valueGetter: (a: T) => G, ascending?: boolean) => number;
|
package/lib/index.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDictionary } from '../interfaces';
|
|
2
|
+
export {};
|
|
3
|
+
declare global {
|
|
4
|
+
interface Array<T> {
|
|
5
|
+
groupBy(valueGetter: (a: T) => string): IDictionary<T[]>;
|
|
6
|
+
orderBy<T, G>(valueGetter: (a: T) => G, ascending?: boolean): T[];
|
|
7
|
+
filterBy<G>(key?: string): G[];
|
|
8
|
+
distinct<T>(comparator?: (obj1: unknown, obj2: unknown) => boolean): T[];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ConfigType, ManipulateType, OpUnitType } from 'dayjs';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Date {
|
|
4
|
+
isAfter(date: ConfigType, unit?: OpUnitType): boolean;
|
|
5
|
+
isBefore(date: ConfigType, unit?: OpUnitType): boolean;
|
|
6
|
+
format(template?: string): string;
|
|
7
|
+
isValid(): boolean;
|
|
8
|
+
add(value: number, unit?: ManipulateType): Date;
|
|
9
|
+
subtract(value: number, unit?: ManipulateType): Date;
|
|
10
|
+
firstDayOfMonth(): Date;
|
|
11
|
+
lastDayOfMonth(): Date;
|
|
12
|
+
}
|
|
13
|
+
}
|