@bit-sun/business-component 2.4.31-alpha.4 → 2.4.31-alpha.5

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.esm.js CHANGED
@@ -1515,6 +1515,11 @@ var handleJudgeAuthButtons = function handleJudgeAuthButtons(buttonCodeArray) {
1515
1515
  });
1516
1516
  return result;
1517
1517
  };
1518
+ // 判断何时菜单权限和表格权限生效
1519
+ var shouldUseAuth = function shouldUseAuth() {
1520
+ // @ts-ignore
1521
+ return window.__POWERED_BY_WUJIE__ ? true : false;
1522
+ };
1518
1523
 
1519
1524
  var css_248z$1 = ".luckysheet {\n overflow: hidden;\n}\n.luckysheet .luckysheet-work-area.luckysheet-noselected-text {\n display: none;\n}\n.sheet_table_top {\n height: 50px;\n background: #f2f2f2;\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 20px;\n border: 1px solid #d8d8d8;\n}\n.sheet_table_top .menu_item_text {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.sheet_table_footer {\n height: 50px;\n background: #f2f2f2;\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 20px;\n border: 1px solid #d8d8d8;\n}\n.sheet_table_text {\n color: #8f8f8f;\n}\n.sheet_table_dnd_text {\n background: #f2f2f2;\n border: 1px solid #d8d8d8;\n display: inline-block;\n width: 100px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n";
1520
1525
  styleInject(css_248z$1);
@@ -12479,7 +12484,7 @@ var DetailWrapper = /*#__PURE__*/React$1.memo(function (_ref) {
12479
12484
  var renderPageActionList = function renderPageActionList(actionLists) {
12480
12485
  var authButton = localStorage.getItem(getMenuAuthDataKey()) ? JSON.parse(localStorage.getItem(getMenuAuthDataKey())) : [];
12481
12486
  var visibleActions = actionLists.filter(function (action) {
12482
- return (action.visible && action.visible !== 'false' || judgeIsEmpty$1(action.visible)) && (judgeIsEmpty$1(action.code) || authButton.filter(function (item) {
12487
+ return (action.visible && action.visible !== 'false' || judgeIsEmpty$1(action.visible)) && (!shouldUseAuth() || judgeIsEmpty$1(action.code) || authButton.filter(function (item) {
12483
12488
  return item === action.code;
12484
12489
  }));
12485
12490
  });
@@ -14121,7 +14126,7 @@ var BsSulaQueryTable = (function (props) {
14121
14126
  if (Number(item.slice(-1)) >= 1) {
14122
14127
  Item = item.substr(0, item.length - 1);
14123
14128
  }
14124
- if (!authButton.filter(function (itemInner) {
14129
+ if (shouldUseAuth() && !authButton.filter(function (itemInner) {
14125
14130
  return Item === itemInner;
14126
14131
  }).length) {
14127
14132
  resourceCodeArray[item].visible = false;
@@ -14557,7 +14562,7 @@ var setMenuTreeData = function setMenuTreeData(routesData) {
14557
14562
  routesData.splice(i, 1);
14558
14563
  return 0; // continue
14559
14564
  }
14560
- if (routesData[i].code && authButton.every(function (item) {
14565
+ if (shouldUseAuth() && routesData[i].code && authButton.every(function (item) {
14561
14566
  return routesData[i].code != item;
14562
14567
  })) {
14563
14568
  routesData.splice(i, 1);
@@ -15200,9 +15205,7 @@ var GlobalHeaderCom = function GlobalHeaderCom(props) {
15200
15205
  deep(item.routes);
15201
15206
  } else if (!item.hideInMenu && (name ? formatMessage({
15202
15207
  id: "menu.".concat(item.name)
15203
- }).indexOf(name) !== -1 : true) && btnAuth.find(function (d) {
15204
- return d === item.code;
15205
- })) {
15208
+ }).indexOf(name) !== -1 : true)) {
15206
15209
  resultList.push(_objectSpread2(_objectSpread2({}, item), {}, {
15207
15210
  fullPathName: getFullPathName(item.name)
15208
15211
  }));
@@ -32786,4 +32789,4 @@ var index$8 = /*#__PURE__*/forwardRef(function (props, ref) {
32786
32789
  })));
32787
32790
  });
32788
32791
 
32789
- export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, BillEntry, BsCascader, index$6 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$2 as CheckOneUser, ColumnSettingTable, CommodityEntry, DataImport, DataValidation, index$4 as DetailPageWrapper, EllipsisTooltip, ExportIcon, GuideWrapper, index$5 as HomePageWrapper, JsonQueryTable, index$7 as MoreTreeTable, QueryMutipleInput, RuleObjectComponent as RuleComponent, index$8 as RuleSetter, SearchSelect, index$3 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect, authFunc, checkQuantityAccuracy, downloadExcel, formatter, getAccountID, getAccountId, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getEmployeeCode, getEmployeeId, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBssulaColumnsSpecialParams, handleError, handleJudgeAuthButtons, handleRequestAuthHeader, handleRequestUrl, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, memoizeOneFormatter, precisionQuantity, removeCurrentTenantId, removeTenantList, saveCurrentTenantId, saveTenantList, setConfigTableColumns, uuid };
32792
+ export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, BillEntry, BsCascader, index$6 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$2 as CheckOneUser, ColumnSettingTable, CommodityEntry, DataImport, DataValidation, index$4 as DetailPageWrapper, EllipsisTooltip, ExportIcon, GuideWrapper, index$5 as HomePageWrapper, JsonQueryTable, index$7 as MoreTreeTable, QueryMutipleInput, RuleObjectComponent as RuleComponent, index$8 as RuleSetter, SearchSelect, index$3 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect, authFunc, checkQuantityAccuracy, downloadExcel, formatter, getAccountID, getAccountId, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getEmployeeCode, getEmployeeId, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBssulaColumnsSpecialParams, handleError, handleJudgeAuthButtons, handleRequestAuthHeader, handleRequestUrl, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, memoizeOneFormatter, precisionQuantity, removeCurrentTenantId, removeTenantList, saveCurrentTenantId, saveTenantList, setConfigTableColumns, shouldUseAuth, uuid };
package/dist/index.js CHANGED
@@ -1535,6 +1535,11 @@ var handleJudgeAuthButtons = function handleJudgeAuthButtons(buttonCodeArray) {
1535
1535
  });
1536
1536
  return result;
1537
1537
  };
1538
+ // 判断何时菜单权限和表格权限生效
1539
+ var shouldUseAuth = function shouldUseAuth() {
1540
+ // @ts-ignore
1541
+ return window.__POWERED_BY_WUJIE__ ? true : false;
1542
+ };
1538
1543
 
1539
1544
  var css_248z$1 = ".luckysheet {\n overflow: hidden;\n}\n.luckysheet .luckysheet-work-area.luckysheet-noselected-text {\n display: none;\n}\n.sheet_table_top {\n height: 50px;\n background: #f2f2f2;\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 20px;\n border: 1px solid #d8d8d8;\n}\n.sheet_table_top .menu_item_text {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.sheet_table_footer {\n height: 50px;\n background: #f2f2f2;\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 20px;\n border: 1px solid #d8d8d8;\n}\n.sheet_table_text {\n color: #8f8f8f;\n}\n.sheet_table_dnd_text {\n background: #f2f2f2;\n border: 1px solid #d8d8d8;\n display: inline-block;\n width: 100px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n";
1540
1545
  styleInject(css_248z$1);
@@ -12499,7 +12504,7 @@ var DetailWrapper = /*#__PURE__*/React__default['default'].memo(function (_ref)
12499
12504
  var renderPageActionList = function renderPageActionList(actionLists) {
12500
12505
  var authButton = localStorage.getItem(getMenuAuthDataKey()) ? JSON.parse(localStorage.getItem(getMenuAuthDataKey())) : [];
12501
12506
  var visibleActions = actionLists.filter(function (action) {
12502
- return (action.visible && action.visible !== 'false' || judgeIsEmpty$1(action.visible)) && (judgeIsEmpty$1(action.code) || authButton.filter(function (item) {
12507
+ return (action.visible && action.visible !== 'false' || judgeIsEmpty$1(action.visible)) && (!shouldUseAuth() || judgeIsEmpty$1(action.code) || authButton.filter(function (item) {
12503
12508
  return item === action.code;
12504
12509
  }));
12505
12510
  });
@@ -14141,7 +14146,7 @@ var BsSulaQueryTable = (function (props) {
14141
14146
  if (Number(item.slice(-1)) >= 1) {
14142
14147
  Item = item.substr(0, item.length - 1);
14143
14148
  }
14144
- if (!authButton.filter(function (itemInner) {
14149
+ if (shouldUseAuth() && !authButton.filter(function (itemInner) {
14145
14150
  return Item === itemInner;
14146
14151
  }).length) {
14147
14152
  resourceCodeArray[item].visible = false;
@@ -14577,7 +14582,7 @@ var setMenuTreeData = function setMenuTreeData(routesData) {
14577
14582
  routesData.splice(i, 1);
14578
14583
  return 0; // continue
14579
14584
  }
14580
- if (routesData[i].code && authButton.every(function (item) {
14585
+ if (shouldUseAuth() && routesData[i].code && authButton.every(function (item) {
14581
14586
  return routesData[i].code != item;
14582
14587
  })) {
14583
14588
  routesData.splice(i, 1);
@@ -15220,9 +15225,7 @@ var GlobalHeaderCom = function GlobalHeaderCom(props) {
15220
15225
  deep(item.routes);
15221
15226
  } else if (!item.hideInMenu && (name ? umi.formatMessage({
15222
15227
  id: "menu.".concat(item.name)
15223
- }).indexOf(name) !== -1 : true) && btnAuth.find(function (d) {
15224
- return d === item.code;
15225
- })) {
15228
+ }).indexOf(name) !== -1 : true)) {
15226
15229
  resultList.push(_objectSpread2(_objectSpread2({}, item), {}, {
15227
15230
  fullPathName: getFullPathName(item.name)
15228
15231
  }));
@@ -32874,4 +32877,5 @@ exports.removeTenantList = removeTenantList;
32874
32877
  exports.saveCurrentTenantId = saveCurrentTenantId;
32875
32878
  exports.saveTenantList = saveTenantList;
32876
32879
  exports.setConfigTableColumns = setConfigTableColumns;
32880
+ exports.shouldUseAuth = shouldUseAuth;
32877
32881
  exports.uuid = uuid;
@@ -1,2 +1,3 @@
1
1
  export declare const authFunc: (code: string) => any;
2
2
  export declare const handleJudgeAuthButtons: (buttonCodeArray: any[]) => true | boolean[];
3
+ export declare const shouldUseAuth: () => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.4.31-alpha.4",
3
+ "version": "2.4.31-alpha.5",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -50,7 +50,6 @@ const GlobalHeaderCom = (props: any) => {
50
50
  (name
51
51
  ? formatMessage({ id: `menu.${item.name}` }).indexOf(name) !== -1
52
52
  : true)
53
- && btnAuth.find((d: any) => d === item.code)
54
53
  ) {
55
54
  resultList.push({
56
55
  ...item,
@@ -3,6 +3,7 @@ import cloneDeep from 'lodash/cloneDeep';
3
3
  import memoizeOne from 'memoize-one';
4
4
  import { getMenuAuthDataKey } from '@/utils/LocalstorageUtils'
5
5
  import { history } from 'umi';
6
+ import { shouldUseAuth } from '@/utils';
6
7
 
7
8
  const cache = {};
8
9
  const cacheLimit = 10000;
@@ -122,6 +123,7 @@ export const setMenuTreeData = (routesData: Array<any>) => {
122
123
  continue;
123
124
  }
124
125
  if (
126
+ shouldUseAuth() &&
125
127
  routesData[i].code &&
126
128
  authButton.every((item) => {
127
129
  return routesData[i].code != item;
@@ -20,6 +20,7 @@ import ExportIcon from '@/components/Functional/ExportFunctions/ExportIcon';
20
20
  import ENUM from '@/utils/enumConfig';
21
21
  import { handleBssulaColumnsSpecialParams } from '@/utils/utils';
22
22
  import { getMenuAuthDataKey } from '@/utils/LocalstorageUtils';
23
+ import { shouldUseAuth } from '@/utils';
23
24
 
24
25
  const MemoQueryTable = React.memo(QueryTable);
25
26
 
@@ -177,7 +178,7 @@ export default (props: any) => {
177
178
  if (Number(item.slice(-1)) >= 1) {
178
179
  Item = item.substr(0, item.length - 1);
179
180
  }
180
- if (!authButton.filter((itemInner: any) => Item === itemInner).length) {
181
+ if (shouldUseAuth() && !authButton.filter((itemInner: any) => Item === itemInner).length) {
181
182
  resourceCodeArray[item].visible = false;
182
183
  }
183
184
  });
@@ -17,6 +17,7 @@ import moreIcon from '../../../assets/btn-more.svg';
17
17
  import { useLocation, formatMessage } from 'umi';
18
18
  import CommonAlert from '../CommonAlert';
19
19
  import { getMenuAuthDataKey, getLimitMenuDataKey } from '@/utils/LocalstorageUtils';
20
+ import { shouldUseAuth } from '@/utils';
20
21
 
21
22
  interface actionItem {
22
23
  type?: string;
@@ -154,7 +155,7 @@ const DetailWrapper = React.memo(
154
155
  let visibleActions = actionLists.filter(
155
156
  (action) =>
156
157
  ((action.visible && action.visible !== 'false') || judgeIsEmpty(action.visible)) &&
157
- (judgeIsEmpty(action.code) || authButton.filter(item => item === action.code)),
158
+ (!shouldUseAuth() || (judgeIsEmpty(action.code) || authButton.filter(item => item === action.code))),
158
159
  );
159
160
 
160
161
  const renderButton = (item: actionItem, type?: any) => {
package/src/utils/auth.ts CHANGED
@@ -30,3 +30,9 @@ export const handleJudgeAuthButtons = (buttonCodeArray: any[]) => {
30
30
  });
31
31
  return result;
32
32
  };
33
+
34
+ // 判断何时菜单权限和表格权限生效
35
+ export const shouldUseAuth = () => {
36
+ // @ts-ignore
37
+ return window.__POWERED_BY_WUJIE__ ? true : false;
38
+ };