plataforma-fundacao-componentes 2.23.21 → 2.23.23
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/index.d.ts +2 -1
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +147 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/models/menus.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -208,6 +208,7 @@ import useTimeElapsed from './hooks/useTimeElapsed/useTimeElapsed';
|
|
|
208
208
|
import useToastManager from './hooks/useToastManager/useToastManager';
|
|
209
209
|
import useValidatedState from './hooks/useValidatedState/useValidatedState';
|
|
210
210
|
import Chip from './components/chip/Chip';
|
|
211
|
+
import usePublicMenuList from './hooks/usePublicMenuList/usePublicMenuList';
|
|
211
212
|
export * from './components/modal/ModalTypes';
|
|
212
213
|
export * from './libraries/ActionCardThemes';
|
|
213
214
|
export * from './libraries/BlobFileTypes';
|
|
@@ -233,5 +234,5 @@ export { Accordion, ActionCard, AdvancedSemiHeader, AssembleiaItem, AssembleiaPa
|
|
|
233
234
|
* @deprecated
|
|
234
235
|
*/
|
|
235
236
|
Title as ModulosTitle, MoneyByMonth, MoneyMonthLineChart, NotaEdit, Notification, HourEvents, Calendar, CalendarEvent, FloatingPanel, InlineMonthPicker, ScrollArrowOverflow, PageSubTitle, PageTitle, Paginator, PreviaVideo, ProgressBar, RadioButton, QRCode, Row, SearchBlocoDeNotas, Select, Switch, Table, TypedTable, TableFileNameAndAction, TableActions, TableWithOverflow, TextEditor, LeftCheckboxWithLabel, ActionsColumn, Tabs, Toast, ToastManager, Tooltip, TooltipManager, TopLoader, VideoItem, VideoPlayer, VideoModal, };
|
|
236
|
-
export { useCallbackedState, useCarouselBehaviour, useControlledTimer, useDraggableContainer, useHTMLShare, useDropOpened, useModalManager, useProgressiveCount, useScreenSize, useStorageState, useTimeElapsed, useToastManager, useValidatedState, };
|
|
237
|
+
export { useCallbackedState, useCarouselBehaviour, useControlledTimer, useDraggableContainer, useHTMLShare, useDropOpened, useModalManager, useProgressiveCount, useScreenSize, useStorageState, useTimeElapsed, useToastManager, useValidatedState, usePublicMenuList, };
|
|
237
238
|
export { AconteceuIcon, ChevronArrowRightIcon, FontIcon, PaymentIcon, AddCircleIcon, CircleArrowLeft, CopyIcon, QRCodeIcon, PrintIcon, FormacaoIcon, PercentLoaderIcon, AddIcon, AddAssemblyIcon, CircleArrowRight, FundacaoLogo, PieChartIcon, AlignCenterIcon, ClockIcon, CalendarCheckIcon, DevicePlusIcon, NotebookIcon, AgencyIcon, FundoSocialIcon, PlayIcon, AlignJustifyIcon, CloseIcon, GlobeIcon, QRCodeWhatsapp, AlignLeftIcon, CloudDownloadIcon, GraduationIcon, RedoIcon, AlignRightIcon, CloudUploadIcon, HamburgerIcon, RefreshIcon, ArrowLeftIcon, ComitesIcon, HandUpIcon, SearchIcon, ArrowRightIcon, ComunidadeIcon, HomeIcon, SettingsIcon, AssembleiasIcon, CreditIcon, InformationIcon, SicrediLogo, ATMIcon, CrescerIcon, InvestimentIcon, PhonePlusIcon, SquaresIcon, BackOfficeIcon, CrescerLogo, ItalicIcon, SustentabilidadeIcon, BarChartIcon, Chip, DownloadIcon, LinkIcon, ThreeDotsLoader, BeeIcon, DraggableIcon, LinksUteisIcon, ThumbsUpIcon, BigPlayIcon, EditIcon, ListDotIcon, TimesCircleIcon, BoldIcon, EvidenciasIcon, ListIcon, TransferenciaIcon, CalendarIcon, ExclamationIcon, LoaderIcon, TrashIcon, CardsIcon, ExitIconArrowLeft, LocalIcon, TrianguloInferior, CataventoVerde, ExitIconArrowRight, LockIcon, TwoFileIcon, CheckCircleIcon, EyeIcon, MessageIcon, UnderlineIcon, CheckIcon, FilePlusIcon, MoneyFileIcon, UndoIcon, ChequeIcon, FilesIcon, NavigatorWithMouse, UserIcon, ChevronArrowDownIcon, FilterIcon, OptionsIcon, WebsiteIcon, ChevronArrowLeftIcon, FontColorIcon, ParticipantesIcon, };
|
package/dist/index.js
CHANGED
|
@@ -40724,6 +40724,152 @@ function Chip(props) {
|
|
|
40724
40724
|
|
|
40725
40725
|
var Chip$1 = React.memo(Chip);
|
|
40726
40726
|
|
|
40727
|
+
var References;
|
|
40728
|
+
|
|
40729
|
+
(function (References) {
|
|
40730
|
+
References[References["FORCE_CLOSE"] = -1] = "FORCE_CLOSE";
|
|
40731
|
+
References[References["OPENED_ACTIVE"] = 0] = "OPENED_ACTIVE";
|
|
40732
|
+
})(References || (References = {}));
|
|
40733
|
+
|
|
40734
|
+
var sortItems = function sortItems(a, b) {
|
|
40735
|
+
return a.ordem - b.ordem;
|
|
40736
|
+
};
|
|
40737
|
+
|
|
40738
|
+
function usePublicMenuList(props) {
|
|
40739
|
+
var hasPermission = React.useCallback(function (need) {
|
|
40740
|
+
var role = !need.roles || !need.roles.length || need.roles.some(function (role) {
|
|
40741
|
+
return props.roles && props.roles.find(function (up) {
|
|
40742
|
+
return up === role;
|
|
40743
|
+
});
|
|
40744
|
+
});
|
|
40745
|
+
var programa = !need.programas || !need.programas.length || need.programas.some(function (prog) {
|
|
40746
|
+
var _props$allProfilesFor;
|
|
40747
|
+
|
|
40748
|
+
return props.allProfilesForProgramas[prog] && ((_props$allProfilesFor = props.allProfilesForProgramas[prog]) === null || _props$allProfilesFor === void 0 ? void 0 : _props$allProfilesFor.some(function (profile) {
|
|
40749
|
+
return props.roles && props.roles.includes(profile);
|
|
40750
|
+
}));
|
|
40751
|
+
});
|
|
40752
|
+
return role && programa;
|
|
40753
|
+
}, [props.allProfilesForProgramas, props.roles]);
|
|
40754
|
+
|
|
40755
|
+
var _useState = React.useState(References.OPENED_ACTIVE),
|
|
40756
|
+
subListReference = _useState[0],
|
|
40757
|
+
setSubListReference = _useState[1];
|
|
40758
|
+
|
|
40759
|
+
var isOpenedByReference = React.useCallback(function (reference) {
|
|
40760
|
+
return reference === subListReference;
|
|
40761
|
+
}, [subListReference]);
|
|
40762
|
+
var setOpenedByReference = React.useCallback(function (reference) {
|
|
40763
|
+
if (isOpenedByReference(reference)) {
|
|
40764
|
+
setSubListReference(References.FORCE_CLOSE);
|
|
40765
|
+
} else {
|
|
40766
|
+
setSubListReference(reference);
|
|
40767
|
+
}
|
|
40768
|
+
}, [isOpenedByReference]);
|
|
40769
|
+
var handleClickLink = React.useCallback(function (url, obj) {
|
|
40770
|
+
var target = obj.novaAba ? '_blank' : '_self';
|
|
40771
|
+
var isPermitted = !obj.permissoes || hasPermission(obj.permissoes);
|
|
40772
|
+
var watchIncongruencia = obj.permissoes && obj.permissoes.incongruencia;
|
|
40773
|
+
|
|
40774
|
+
if (watchIncongruencia && props.incongruencia && typeof props.openModalIncongruencia === 'function') {
|
|
40775
|
+
props.openModalIncongruencia();
|
|
40776
|
+
} else if (isPermitted) {
|
|
40777
|
+
if (obj.internal) {
|
|
40778
|
+
props.history.push(url.replace(window.location.origin, ''));
|
|
40779
|
+
} else {
|
|
40780
|
+
window.open(url, target);
|
|
40781
|
+
}
|
|
40782
|
+
|
|
40783
|
+
setOpenedByReference(References.OPENED_ACTIVE);
|
|
40784
|
+
} else if (obj.permissoes) {
|
|
40785
|
+
var _obj$permissoes$progr, _obj$permissoes$roles;
|
|
40786
|
+
|
|
40787
|
+
var isPrograma = !obj.forcePerfilLabel && obj.permissoes.programas && !!obj.permissoes.programas.length;
|
|
40788
|
+
var plural = isPrograma ? obj.permissoes.programas && obj.permissoes.programas.length > 1 : obj.permissoes.roles && obj.permissoes.roles.length > 1;
|
|
40789
|
+
var label = isPrograma ? (_obj$permissoes$progr = obj.permissoes.programas) === null || _obj$permissoes$progr === void 0 ? void 0 : _obj$permissoes$progr.map(function (prog) {
|
|
40790
|
+
var _props$getProgramaLab;
|
|
40791
|
+
|
|
40792
|
+
return (_props$getProgramaLab = props.getProgramaLabel(prog)) != null ? _props$getProgramaLab : '';
|
|
40793
|
+
}).join(', ') : (_obj$permissoes$roles = obj.permissoes.roles) === null || _obj$permissoes$roles === void 0 ? void 0 : _obj$permissoes$roles.join(', ');
|
|
40794
|
+
props.openModalProfileWarning(label || '', plural, !isPrograma, obj.labelPrograma);
|
|
40795
|
+
setOpenedByReference(References.FORCE_CLOSE);
|
|
40796
|
+
}
|
|
40797
|
+
|
|
40798
|
+
props.closeMenu();
|
|
40799
|
+
}, [hasPermission, props, setOpenedByReference]);
|
|
40800
|
+
var getSubList = React.useCallback(function (itens) {
|
|
40801
|
+
if (!itens || !itens.length) return undefined;
|
|
40802
|
+
return itens.sort(sortItems).filter(function (sub) {
|
|
40803
|
+
if (sub.permissoes && sub.permissoes.hide) {
|
|
40804
|
+
return hasPermission(sub.permissoes);
|
|
40805
|
+
}
|
|
40806
|
+
|
|
40807
|
+
return true;
|
|
40808
|
+
}).map(function (sub) {
|
|
40809
|
+
return {
|
|
40810
|
+
id: sub.id,
|
|
40811
|
+
icon: React__default.createElement(ListDotIcon, null),
|
|
40812
|
+
label: sub.label,
|
|
40813
|
+
active: sub.regex ? props.isRoute(window.location.pathname, new RegExp(sub.regex)) : false,
|
|
40814
|
+
onClick: function onClick() {
|
|
40815
|
+
if (sub.url) handleClickLink(sub.url, {
|
|
40816
|
+
novaAba: sub.novaAba,
|
|
40817
|
+
permissoes: sub.permissoes,
|
|
40818
|
+
internal: Boolean(sub.idFerramenta && sub.idFerramenta === props.idFerramenta),
|
|
40819
|
+
labelPrograma: sub.labelPrograma,
|
|
40820
|
+
forcePerfilLabel: sub.permissoes.forcePerfilLabel
|
|
40821
|
+
});
|
|
40822
|
+
}
|
|
40823
|
+
};
|
|
40824
|
+
});
|
|
40825
|
+
}, [handleClickLink, hasPermission, props]);
|
|
40826
|
+
var menus = React.useMemo(function () {
|
|
40827
|
+
if (!props.menus) return [];
|
|
40828
|
+
return props.menus.sort(sortItems).filter(function (item) {
|
|
40829
|
+
var _item$subItems;
|
|
40830
|
+
|
|
40831
|
+
if (item.permissoes && item.permissoes.hide || (_item$subItems = item.subItems) !== null && _item$subItems !== void 0 && _item$subItems.some(function (s) {
|
|
40832
|
+
return s.permissoes && s.permissoes.hide;
|
|
40833
|
+
})) {
|
|
40834
|
+
var _item$subItems2;
|
|
40835
|
+
|
|
40836
|
+
return !((_item$subItems2 = item.subItems) !== null && _item$subItems2 !== void 0 && _item$subItems2.every(function (s) {
|
|
40837
|
+
return s.permissoes && s.permissoes.hide && !hasPermission(s.permissoes);
|
|
40838
|
+
}));
|
|
40839
|
+
}
|
|
40840
|
+
|
|
40841
|
+
return true;
|
|
40842
|
+
}).map(function (it) {
|
|
40843
|
+
return {
|
|
40844
|
+
icon: stringToReactElement(it.icon, {
|
|
40845
|
+
style: {
|
|
40846
|
+
height: '24px',
|
|
40847
|
+
width: '24px'
|
|
40848
|
+
}
|
|
40849
|
+
}),
|
|
40850
|
+
label: it.label,
|
|
40851
|
+
active: it.regex ? props.isRoute(window.location.pathname, new RegExp(it.regex)) : false,
|
|
40852
|
+
onClick: it.url ? function () {
|
|
40853
|
+
var _it$novaAba;
|
|
40854
|
+
|
|
40855
|
+
return handleClickLink(it.url, {
|
|
40856
|
+
novaAba: (_it$novaAba = it.novaAba) != null ? _it$novaAba : false,
|
|
40857
|
+
permissoes: it.permissoes,
|
|
40858
|
+
internal: Boolean(it.idFerramenta && it.idFerramenta === props.idFerramenta),
|
|
40859
|
+
labelPrograma: it.labelPrograma,
|
|
40860
|
+
forcePerfilLabel: it.permissoes.forcePerfilLabel
|
|
40861
|
+
});
|
|
40862
|
+
} : function () {
|
|
40863
|
+
setOpenedByReference(it.id);
|
|
40864
|
+
},
|
|
40865
|
+
subListOpened: isOpenedByReference(it.id),
|
|
40866
|
+
subList: getSubList(it.subItems)
|
|
40867
|
+
};
|
|
40868
|
+
});
|
|
40869
|
+
}, [isOpenedByReference, props.menus, props.history.location]);
|
|
40870
|
+
return menus;
|
|
40871
|
+
}
|
|
40872
|
+
|
|
40727
40873
|
function AlertModal(props) {
|
|
40728
40874
|
var _useState = React.useState(false),
|
|
40729
40875
|
loading = _useState[0],
|
|
@@ -41091,6 +41237,7 @@ exports.useDropOpened = useDropOpened;
|
|
|
41091
41237
|
exports.useHTMLShare = useHTMLShare;
|
|
41092
41238
|
exports.useModalManager = useModalManager;
|
|
41093
41239
|
exports.useProgressiveCount = useProgressiveCount;
|
|
41240
|
+
exports.usePublicMenuList = usePublicMenuList;
|
|
41094
41241
|
exports.useScreenSize = useScreenSize;
|
|
41095
41242
|
exports.useStorageState = useStorageState;
|
|
41096
41243
|
exports.useTimeElapsed = useTimeElapsed;
|