datastake-daf 0.6.501 → 0.6.503

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.
Files changed (31) hide show
  1. package/dist/layouts/index.css +1 -0
  2. package/dist/layouts/index.js +7137 -0
  3. package/dist/utils/index.js +287 -0
  4. package/package.json +1 -1
  5. package/rollup.config.js +25 -0
  6. package/src/@daf/hooks/usePermissions.js +20 -0
  7. package/src/@daf/layouts/AppLayout/AppLayout.stories.js +532 -0
  8. package/src/@daf/layouts/AppLayout/components/LoginPopup/index.js +116 -0
  9. package/src/@daf/layouts/AppLayout/components/LoginPopup/style.js +26 -0
  10. package/src/@daf/layouts/AppLayout/components/MobileDrawer/index.js +208 -0
  11. package/src/@daf/layouts/AppLayout/components/MobileDrawer/style.js +87 -0
  12. package/src/@daf/layouts/AppLayout/components/Notifications/Notification/index.js +31 -0
  13. package/src/@daf/layouts/AppLayout/components/Notifications/NotificationHistory/index.js +22 -0
  14. package/src/@daf/layouts/AppLayout/components/Notifications/context/index.js +79 -0
  15. package/src/@daf/layouts/AppLayout/components/Notifications/index.js +106 -0
  16. package/src/@daf/layouts/AppLayout/components/Notifications/style.js +61 -0
  17. package/src/@daf/layouts/AppLayout/components/Notifications/useNotifications.js +105 -0
  18. package/src/@daf/layouts/AppLayout/components/Sidenav/index.js +296 -0
  19. package/src/@daf/layouts/AppLayout/components/UserDropdown/UserIcon.js +96 -0
  20. package/src/@daf/layouts/AppLayout/components/UserDropdown/index.js +112 -0
  21. package/src/@daf/layouts/AppLayout/index.jsx +384 -0
  22. package/src/@daf/layouts/AppLayout/index.scss +5 -0
  23. package/src/@daf/layouts/AppLayout/styles/header.scss +257 -0
  24. package/src/@daf/layouts/AppLayout/styles/layout.scss +76 -0
  25. package/src/@daf/layouts/AppLayout/styles/responsive.scss +52 -0
  26. package/src/@daf/layouts/AppLayout/styles/sidebar.scss +79 -0
  27. package/src/@daf/layouts/AppLayout/styles/variables.scss +22 -0
  28. package/src/helpers/theme.js +304 -0
  29. package/src/helpers/user.js +4 -0
  30. package/src/layouts.js +1 -0
  31. package/src/utils.js +4 -2
@@ -7758,6 +7758,9 @@ const userHasInterface = (user, app, intf) => {
7758
7758
  const currentApp = apps.find(a => a.app === app);
7759
7759
  return currentApp && intf.includes(currentApp.interface) ? true : false;
7760
7760
  };
7761
+ const userIsAdmin = user => {
7762
+ return user?.role?.id === 'APP_ADMIN';
7763
+ };
7761
7764
 
7762
7765
  const en = {
7763
7766
  "No planning required": "No planning required",
@@ -13719,6 +13722,287 @@ const handleInfo = msg => {
13719
13722
  antd.message.info(msg);
13720
13723
  };
13721
13724
 
13725
+ const baseTheme = {
13726
+ // Base
13727
+ white: '#ffffff',
13728
+ colorPrimary: '#E3591E',
13729
+ borderColor: '#EAECF0',
13730
+ // Gray
13731
+ gray50: '#D2D6DB',
13732
+ // Base Gray
13733
+ baseGray10: '#FCFCFD',
13734
+ baseGray20: '#f5f5f5',
13735
+ baseGray30: '#F3F4F6',
13736
+ baseGray40: '#E5E7EB',
13737
+ baseGray50: '#D2D6DB',
13738
+ baseGray60: '#9DA4AE',
13739
+ baseGray70: '#6C737F',
13740
+ baseGray80: '#4D5761',
13741
+ baseGray90: '#384250',
13742
+ baseGray100: '#2B3644',
13743
+ baseGray110: '#1F2A37',
13744
+ // Primary
13745
+ colorPrimary1: '#FFF3EE',
13746
+ colorPrimary2: '#F7CFBD',
13747
+ colorPrimary3: '#F5C2AC',
13748
+ colorPrimary4: '#F2B59A',
13749
+ colorPrimary5: '#F0A888',
13750
+ colorPrimary6: '#EC8D65',
13751
+ colorPrimary7: '#E3591E',
13752
+ colorPrimary8: '#D2521B',
13753
+ colorPrimary9: '#C04B19',
13754
+ colorPrimary10: '#9D3D14',
13755
+ // Success
13756
+ success1: '#F6FEF9',
13757
+ success2: '#ECFDF3',
13758
+ success3: '#D7FBE5',
13759
+ success4: '#B0F3CB',
13760
+ success5: '#6AD99E',
13761
+ success6: '#32D583',
13762
+ success7: '#12B76A',
13763
+ success8: '#039855',
13764
+ success9: '#05603A',
13765
+ success10: '#054F31',
13766
+ // Warning
13767
+ warning1: '#FFFCF5',
13768
+ warning2: '#FFFAEB',
13769
+ warning3: '#FEF0C7',
13770
+ warning4: '#FEDF89',
13771
+ warning5: '#FEC84B',
13772
+ warning6: '#FDB022',
13773
+ warning7: '#F79009',
13774
+ warning8: '#DC6803',
13775
+ warning9: '#B54708',
13776
+ warning10: '#93370D',
13777
+ // Error
13778
+ error1: '#FFFBFA',
13779
+ error2: '#FEF3F2',
13780
+ error3: '#FEE4E2',
13781
+ error4: '#FECDCA',
13782
+ error5: '#FDA29B',
13783
+ error6: '#F97066',
13784
+ error7: '#F04438',
13785
+ error8: '#D92D20',
13786
+ error9: '#B42318',
13787
+ error10: '#912018',
13788
+ // Red
13789
+ red1: '#FFF1F0',
13790
+ red2: '#FFCCC7',
13791
+ red3: '#FFA39E',
13792
+ red4: '#FF7875',
13793
+ red5: '#FF4D4F',
13794
+ red6: '#F5222D',
13795
+ red7: '#CF1322',
13796
+ red8: '#A8071A',
13797
+ red9: '#820014',
13798
+ red10: '#5C0011',
13799
+ // Volcano
13800
+ volcano1: '#FFF2E8',
13801
+ volcano2: '#FFD8BF',
13802
+ volcano3: '#FFBB96',
13803
+ volcano4: '#FF9C6E',
13804
+ volcano5: '#FF7A45',
13805
+ volcano6: '#FA541C',
13806
+ volcano7: '#D4380D',
13807
+ volcano8: '#AD2102',
13808
+ volcano9: '#871400',
13809
+ volcano10: '#610B00',
13810
+ // Orange
13811
+ orange1: '#FFF7E6',
13812
+ orange2: '#FFE7BA',
13813
+ orange3: '#FFD591',
13814
+ orange4: '#FFC069',
13815
+ orange5: '#FFA940',
13816
+ orange6: '#FA8C16',
13817
+ orange7: '#D46B08',
13818
+ orange8: '#AD4E00',
13819
+ orange9: '#873800',
13820
+ orange10: '#612500',
13821
+ // Gold
13822
+ gold1: '#FFFBE6',
13823
+ gold2: '#FFF1B8',
13824
+ gold3: '#FFE58F',
13825
+ gold4: '#FFD666',
13826
+ gold5: '#FFC53D',
13827
+ gold6: '#FAAD14',
13828
+ gold7: '#D48806',
13829
+ gold8: '#AD6800',
13830
+ gold9: '#874D00',
13831
+ gold10: '#613400',
13832
+ // Yellow
13833
+ yellow1: '#feffe6',
13834
+ yellow2: '#ffffb8',
13835
+ yellow3: '#fffb8f',
13836
+ yellow4: '#fff566',
13837
+ yellow5: '#ffec3d',
13838
+ yellow6: '#fadb14',
13839
+ yellow7: '#d4b106',
13840
+ yellow8: '#ad8b00',
13841
+ yellow9: '#876800',
13842
+ yellow10: '#614700',
13843
+ // Lime
13844
+ lime1: '#FCFFE6',
13845
+ lime2: '#F4FFB8',
13846
+ lime3: '#EAFF8F',
13847
+ lime4: '#D3F261',
13848
+ lime5: '#BAE637',
13849
+ lime6: '#A0D911',
13850
+ lime7: '#7CB305',
13851
+ lime8: '#5B8C00',
13852
+ lime9: '#3F6600',
13853
+ lime10: '#254000',
13854
+ // Green
13855
+ green1: '#F6FFED',
13856
+ green2: '#D9F7BE',
13857
+ green3: '#B7EB8F',
13858
+ green4: '#95DE64',
13859
+ green5: '#73D13D',
13860
+ green6: '#52C41A',
13861
+ green7: '#389E0D',
13862
+ green8: '#237804',
13863
+ green9: '#135200',
13864
+ green10: '#092B00',
13865
+ // Cyan
13866
+ cyan1: '#E6FFFB',
13867
+ cyan2: '#B5F5EC',
13868
+ cyan3: '#87E8DE',
13869
+ cyan4: '#5CDBD3',
13870
+ cyan5: '#36CFC9',
13871
+ cyan6: '#13C2C2',
13872
+ cyan7: '#08979C',
13873
+ cyan8: '#006D75',
13874
+ cyan9: '#00474F',
13875
+ cyan10: '#002329',
13876
+ // Blue
13877
+ blue1: '#E6F4FF',
13878
+ blue2: '#BAE0FF',
13879
+ blue3: '#91CAFF',
13880
+ blue4: '#69B1FF',
13881
+ blue5: '#4096FF',
13882
+ blue6: '#1677FF',
13883
+ blue7: '#0958D9',
13884
+ blue8: '#003EB3',
13885
+ blue9: '#002C8C',
13886
+ blue10: '#001D66',
13887
+ // Primary
13888
+ mmtPrimary1: '#F5FAFF',
13889
+ mmtPrimary2: '#EFF8FF',
13890
+ mmtPrimary3: '#D1E9FF',
13891
+ mmtPrimary4: '#B2DDFF',
13892
+ mmtPrimary5: '#84CAFF',
13893
+ mmtPrimary6: '#53B1FD',
13894
+ mmtPrimary7: '#2E90FA',
13895
+ mmtPrimary8: '#1570EF',
13896
+ mmtPrimary9: '#175CD3',
13897
+ mmtPrimary10: '#1849A9',
13898
+ // Purple
13899
+ purple1: '#F9F0FF',
13900
+ purple2: '#EFDBFF',
13901
+ purple3: '#D3ADF7',
13902
+ purple4: '#B37FEB',
13903
+ purple5: '#9254DE',
13904
+ purple6: '#722ED1',
13905
+ purple7: '#531DAB',
13906
+ purple8: '#391085',
13907
+ purple9: '#22075E',
13908
+ purple10: '#120338',
13909
+ // Magenta
13910
+ magenta1: '#FFF0F6',
13911
+ magenta2: '#FFD6E7',
13912
+ magenta3: '#FFADD2',
13913
+ magenta4: '#FF85C0',
13914
+ magenta5: '#F759AB',
13915
+ magenta6: '#EB2F96',
13916
+ magenta7: '#C41D7F',
13917
+ magenta8: '#9E1068',
13918
+ magenta9: '#780650',
13919
+ magenta10: '#520339',
13920
+ // Sizes
13921
+ sizeUnit: 4,
13922
+ size: 16,
13923
+ sizeXXS: 4,
13924
+ sizeXS: 8,
13925
+ sizeSM: 12,
13926
+ sizeMD: 20,
13927
+ sizeLG: 24,
13928
+ sizeXL: 40,
13929
+ sizeXXL: 30,
13930
+ // Padding
13931
+ padding: 16,
13932
+ paddingXXS: 4,
13933
+ paddingXS: 8,
13934
+ paddingSM: 12,
13935
+ paddingMD: 20,
13936
+ paddingLG: 24,
13937
+ paddingXL: 32,
13938
+ paddingXXL: 48,
13939
+ // Margin
13940
+ margin: 16,
13941
+ marginXXS: 4,
13942
+ marginXS: 8,
13943
+ marginSM: 12,
13944
+ marginMD: 16,
13945
+ marginLG: 24,
13946
+ marginXL: 48,
13947
+ // Height
13948
+ controlHeight: 32,
13949
+ controlHeightXS: 16,
13950
+ controlHeightSM: 24,
13951
+ controlHeightLG: 40,
13952
+ // Border Radius
13953
+ borderRadius: 6,
13954
+ borderRadiusXS: 2,
13955
+ borderRadiusSM: 4,
13956
+ borderRadiusLG: 8,
13957
+ // Font Size
13958
+ fontSize: 14,
13959
+ fontSizeSM: 12,
13960
+ fontSizeLG: 16,
13961
+ fontSizeXL: 20,
13962
+ fontSizeHeading1: 38,
13963
+ fontSizeHeading2: 30,
13964
+ fontSizeHeading3: 24,
13965
+ fontSizeHeading4: 20,
13966
+ fontSizeHeading5: 16,
13967
+ // Secondary
13968
+ colorSecondary3: '#683DE5',
13969
+ colorSecondary: '#683DE5'
13970
+ };
13971
+
13972
+ /**
13973
+ * Creates a custom theme by merging base theme with overrides
13974
+ * @param {Object} overrides - Object with theme properties to override
13975
+ * @returns {Object} - Merged theme object
13976
+ *
13977
+ * @example
13978
+ * // Create a custom theme with different primary color
13979
+ * const myTheme = createTheme({ colorPrimary: '#FF0000' });
13980
+ *
13981
+ * @example
13982
+ * // Create a custom theme with multiple overrides
13983
+ * const customTheme = createTheme({
13984
+ * colorPrimary: '#1E90FF',
13985
+ * fontSize: 16,
13986
+ * borderRadius: 8
13987
+ * });
13988
+ */
13989
+ const createTheme = (overrides = {}) => {
13990
+ return {
13991
+ ...baseTheme,
13992
+ ...overrides
13993
+ };
13994
+ };
13995
+ const createAdminTheme = ({
13996
+ appTheme = {},
13997
+ overrides = {}
13998
+ }) => {
13999
+ return {
14000
+ ...baseTheme,
14001
+ ...appTheme,
14002
+ ...overrides
14003
+ };
14004
+ };
14005
+
13722
14006
  exports.ErrorFormat = ErrorFormat;
13723
14007
  exports.MessageTypes = MessageTypes;
13724
14008
  exports.StorageManager = StorageManager;
@@ -13733,8 +14017,10 @@ exports.captureElementsAsImages = captureElementsAsImages;
13733
14017
  exports.changeInputMeta = changeInputMeta;
13734
14018
  exports.cleanJSON = cleanJSON;
13735
14019
  exports.convertUndefinedToNull = convertUndefinedToNull;
14020
+ exports.createAdminTheme = createAdminTheme;
13736
14021
  exports.createDocument = createDocument;
13737
14022
  exports.createErrorHandler = createErrorHandler;
14023
+ exports.createTheme = createTheme;
13738
14024
  exports.defaultFilterKeys = defaultFilterKeys;
13739
14025
  exports.defaultMapConfig = defaultMapConfig;
13740
14026
  exports.defaultTheme = mmtTheme;
@@ -13793,3 +14079,4 @@ exports.tifTheme = tifTheme;
13793
14079
  exports.titleToCamelCase = titleToCamelCase;
13794
14080
  exports.truncateString = truncateString;
13795
14081
  exports.userHasInterface = userHasInterface;
14082
+ exports.userIsAdmin = userIsAdmin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.501",
3
+ "version": "0.6.503",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
package/rollup.config.js CHANGED
@@ -117,6 +117,31 @@ export default [
117
117
  requireReturnsDefault: "auto",
118
118
  }),
119
119
  ],
120
+ },
121
+ {
122
+ input: "src/layouts.js",
123
+ output: [
124
+ {
125
+ file: "dist/layouts/index.js",
126
+ format: "cjs",
127
+ },
128
+ ],
129
+ external,
130
+ plugins: [
131
+ nodePolyfills(),
132
+ resolve({ browser: true }),
133
+ babel({ exclude: "node_modules/**", babelrc: true }),
134
+ peerDep(),
135
+ commonjs({
136
+ include: /node_modules/,
137
+ requireReturnsDefault: "auto",
138
+ }),
139
+ postcss({
140
+ extract: true,
141
+ minimize: true,
142
+ modules: true,
143
+ }),
144
+ ],
120
145
  },
121
146
  {
122
147
  input: "src/hooks.js",
@@ -0,0 +1,20 @@
1
+ import { result } from "lodash";
2
+
3
+ export const checkPermission = ({
4
+ permission = '',
5
+ defaultValue = false,
6
+ permissions = {}
7
+ }) => {
8
+ return result(permissions, permission, defaultValue);
9
+ };
10
+
11
+ export const checkPermissionList = ({
12
+ permissionsList = [],
13
+ defaultValue = false,
14
+ permissions = {}
15
+ }) => {
16
+ return !!permissionsList
17
+ .map((permission) => checkPermission({ permission, defaultValue, permissions }))
18
+ .filter((v) => !!v)
19
+ .length;
20
+ };