@pisell/materials 1.0.554 → 1.0.556

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.
@@ -10,7 +10,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
10
10
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
11
11
  import React, { useMemo, useEffect } from 'react';
12
12
  import { Button, Space } from 'antd';
13
- import { isString } from '@pisell/utils';
13
+ import { isBoolean, isFunction, isString } from '@pisell/utils';
14
14
  import { useMemoizedFn } from 'ahooks';
15
15
  import Filter from "../filter";
16
16
  import usePagination from "./usePagination";
@@ -164,7 +164,8 @@ var useTableProps = function useTableProps(props) {
164
164
  render: function render(_, record) {
165
165
  return /*#__PURE__*/React.createElement(Space, null, items === null || items === void 0 ? void 0 : items.map(function (item) {
166
166
  var label = item.label,
167
- actionType = item.actionType;
167
+ actionType = item.actionType,
168
+ show = item.show;
168
169
  var handleClick = function handleClick() {
169
170
  if (actionType === 'delete') {
170
171
  PisellModal.confirm({
@@ -181,6 +182,16 @@ var useTableProps = function useTableProps(props) {
181
182
  handleOpenDrawer(record, item);
182
183
  }
183
184
  };
185
+ if (isBoolean(show)) {
186
+ if (!show) {
187
+ return null;
188
+ }
189
+ } else if (isFunction(show)) {
190
+ var result = show(record);
191
+ if (!result) {
192
+ return null;
193
+ }
194
+ }
184
195
  return /*#__PURE__*/React.createElement(Button, {
185
196
  onClick: handleClick,
186
197
  type: type === 'link' ? 'link' : 'default',
@@ -6,7 +6,7 @@
6
6
  border: 1px solid var(--pisell-tags-border-color);
7
7
  background: var(--pisell-tags-bg-color);
8
8
  display: inline-flex;
9
- padding: 4px 12px;
9
+ padding: 2px 12px;
10
10
  align-items: center;
11
11
  gap: 6px;
12
12
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  // 左侧区域
9
9
  .saas-login-bg {
10
- flex: 1;
10
+ width: 60vw;
11
11
  display: flex;
12
12
  align-items: center;
13
13
  justify-content: center;
@@ -27,7 +27,7 @@
27
27
 
28
28
  // 右侧区域
29
29
  .saas-login-main {
30
- width: 480px;
30
+ width: 40vw;
31
31
  background: #fff;
32
32
  display: flex;
33
33
  align-items: center;
@@ -147,7 +147,7 @@ var useTableProps = (props) => {
147
147
  type,
148
148
  render: (_, record) => {
149
149
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Space, null, items == null ? void 0 : items.map((item) => {
150
- const { label, actionType } = item;
150
+ const { label, actionType, show: show2 } = item;
151
151
  const handleClick = () => {
152
152
  if (actionType === "delete") {
153
153
  import_pisellModal.default.confirm({
@@ -164,6 +164,16 @@ var useTableProps = (props) => {
164
164
  handleOpenDrawer(record, item);
165
165
  }
166
166
  };
167
+ if ((0, import_utils.isBoolean)(show2)) {
168
+ if (!show2) {
169
+ return null;
170
+ }
171
+ } else if ((0, import_utils.isFunction)(show2)) {
172
+ const result = show2(record);
173
+ if (!result) {
174
+ return null;
175
+ }
176
+ }
167
177
  return /* @__PURE__ */ import_react.default.createElement(
168
178
  import_antd.Button,
169
179
  {
@@ -6,7 +6,7 @@
6
6
  border: 1px solid var(--pisell-tags-border-color);
7
7
  background: var(--pisell-tags-bg-color);
8
8
  display: inline-flex;
9
- padding: 4px 12px;
9
+ padding: 2px 12px;
10
10
  align-items: center;
11
11
  gap: 6px;
12
12
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  // 左侧区域
9
9
  .saas-login-bg {
10
- flex: 1;
10
+ width: 60vw;
11
11
  display: flex;
12
12
  align-items: center;
13
13
  justify-content: center;
@@ -27,7 +27,7 @@
27
27
 
28
28
  // 右侧区域
29
29
  .saas-login-main {
30
- width: 480px;
30
+ width: 40vw;
31
31
  background: #fff;
32
32
  display: flex;
33
33
  align-items: center;
@@ -2632,6 +2632,37 @@ const dataSourceTable = {
2632
2632
  },
2633
2633
  },
2634
2634
  },
2635
+ {
2636
+ name: 'show',
2637
+ title: {
2638
+ label: {
2639
+ type: 'i18n',
2640
+ 'en-US': 'Show',
2641
+ 'zh-CN': '是否展示',
2642
+ },
2643
+ tip: {
2644
+ type: 'i18n',
2645
+ 'en-US': 'Whether to show this operation button',
2646
+ 'zh-CN': '是否展示该操作按钮',
2647
+ },
2648
+ },
2649
+ propType: {
2650
+ type: 'oneOfType',
2651
+ value: ['JSFunction', 'bool',]
2652
+ },
2653
+ setter: [
2654
+ {
2655
+ componentName: 'FunctionSetter',
2656
+ props: {
2657
+ template:
2658
+ "show(record,${extParams}){\n// 校验数据\nreturn true}",
2659
+ },
2660
+ },
2661
+ {
2662
+ componentName: 'BoolSetter'
2663
+ },
2664
+ ],
2665
+ }
2635
2666
  ],
2636
2667
  },
2637
2668
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.554",
3
+ "version": "1.0.556",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",