@pisell/materials 6.0.7 → 6.0.8

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.
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface PisellViewGridProps {
4
+ columns?: number;
5
+ horizontalGap?: number;
6
+ verticalGap?: number;
7
+ singleRow?: boolean;
8
+ dataSource?: any[];
9
+ renderItem?: (item: any, index: number) => React.ReactNode;
10
+ loading?: boolean;
11
+ children?: React.ReactNode;
12
+ className?: string;
13
+ style?: React.CSSProperties;
14
+ }
15
+ declare const PisellViewGrid: React.FC<PisellViewGridProps>;
16
+ export default PisellViewGrid;
@@ -0,0 +1,66 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import React from 'react';
8
+ import Loading from "../pisellLoading";
9
+ import classNames from 'classnames';
10
+ import "./index.less";
11
+ var PisellViewGrid = function PisellViewGrid(_ref) {
12
+ var _ref$columns = _ref.columns,
13
+ columns = _ref$columns === void 0 ? 3 : _ref$columns,
14
+ _ref$horizontalGap = _ref.horizontalGap,
15
+ horizontalGap = _ref$horizontalGap === void 0 ? 10 : _ref$horizontalGap,
16
+ _ref$verticalGap = _ref.verticalGap,
17
+ verticalGap = _ref$verticalGap === void 0 ? 10 : _ref$verticalGap,
18
+ _ref$singleRow = _ref.singleRow,
19
+ singleRow = _ref$singleRow === void 0 ? false : _ref$singleRow,
20
+ _ref$dataSource = _ref.dataSource,
21
+ dataSource = _ref$dataSource === void 0 ? [] : _ref$dataSource,
22
+ renderItem = _ref.renderItem,
23
+ _ref$loading = _ref.loading,
24
+ loading = _ref$loading === void 0 ? false : _ref$loading,
25
+ children = _ref.children,
26
+ className = _ref.className,
27
+ style = _ref.style;
28
+ var classes = classNames('pisell-view-grid', {
29
+ 'pisell-view-grid-single-row': singleRow
30
+ }, className);
31
+ return /*#__PURE__*/React.createElement(Loading, {
32
+ loading: loading,
33
+ fullscreen: false,
34
+ style: {
35
+ width: '100%'
36
+ }
37
+ }, /*#__PURE__*/React.createElement("div", {
38
+ className: classes,
39
+ style: _objectSpread(_objectSpread({}, style), {}, {
40
+ width: '100%',
41
+ overflow: 'hidden'
42
+ })
43
+ }, /*#__PURE__*/React.createElement("div", {
44
+ className: "pisell-view-grid-content",
45
+ style: !singleRow ? {
46
+ gap: "".concat(verticalGap, "px ").concat(horizontalGap, "px"),
47
+ gridTemplateColumns: "repeat(".concat(columns, ", 1fr)"),
48
+ width: '100%'
49
+ } : {
50
+ display: 'flex',
51
+ flexWrap: 'nowrap',
52
+ overflowX: 'auto',
53
+ width: '100%'
54
+ }
55
+ }, dataSource.map(function (item, index) {
56
+ return /*#__PURE__*/React.createElement("div", {
57
+ key: index,
58
+ className: "pisell-view-grid-item",
59
+ style: {
60
+ minWidth: 0,
61
+ flex: "0 0 calc(100% / ".concat(columns, ")")
62
+ }
63
+ }, renderItem === null || renderItem === void 0 ? void 0 : renderItem(item, index));
64
+ }))));
65
+ };
66
+ export default PisellViewGrid;
@@ -0,0 +1,31 @@
1
+ .pisell-view-grid {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ box-sizing: border-box;
6
+
7
+ &-content {
8
+ display: grid;
9
+ width: 100%;
10
+ // grid-template-columns: repeat(4, 1fr);
11
+ // gap: 10px;
12
+ }
13
+
14
+ &-item {
15
+ width: 100%;
16
+ }
17
+
18
+ &-single-row {
19
+ &::-webkit-scrollbar {
20
+ display: none;
21
+ }
22
+ -ms-overflow-style: none;
23
+ scrollbar-width: none;
24
+ }
25
+
26
+ // &-item {
27
+ // box-sizing: border-box;
28
+ // display: inline-block;
29
+ // vertical-align: top;
30
+ // }
31
+ }
package/es/index.d.ts CHANGED
@@ -131,6 +131,7 @@ export { default as DataSourceWrapper } from './components/dataSourceComponents/
131
131
  export { default as DataSourceTypography } from './components/dataSourceComponents/dataSourceShow/dataSourceTypography';
132
132
  export { default as DataSourceImage } from './components/dataSourceComponents/dataSourceShow/dataSourceImage';
133
133
  export { default as DataSourceQRCode } from './components/dataSourceComponents/dataSourceShow/dataSourceQRCode';
134
+ export { default as PisellViewGrid } from './components/pisellViewGrid';
134
135
  export { default as PageHeader } from './components/page-header';
135
136
  export { default as OrganizationTenantSwitcher } from './components/organizationTenantSwitcher';
136
137
  export { default as PisellTags } from './components/pisellTags';
package/es/index.js CHANGED
@@ -155,6 +155,7 @@ export { default as DataSourceWrapper } from "./components/dataSourceComponents/
155
155
  export { default as DataSourceTypography } from "./components/dataSourceComponents/dataSourceShow/dataSourceTypography";
156
156
  export { default as DataSourceImage } from "./components/dataSourceComponents/dataSourceShow/dataSourceImage";
157
157
  export { default as DataSourceQRCode } from "./components/dataSourceComponents/dataSourceShow/dataSourceQRCode";
158
+ export { default as PisellViewGrid } from "./components/pisellViewGrid";
158
159
  export { default as PageHeader } from "./components/page-header";
159
160
  export { default as OrganizationTenantSwitcher } from "./components/organizationTenantSwitcher";
160
161
  export { default as PisellTags } from "./components/pisellTags";
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface PisellViewGridProps {
4
+ columns?: number;
5
+ horizontalGap?: number;
6
+ verticalGap?: number;
7
+ singleRow?: boolean;
8
+ dataSource?: any[];
9
+ renderItem?: (item: any, index: number) => React.ReactNode;
10
+ loading?: boolean;
11
+ children?: React.ReactNode;
12
+ className?: string;
13
+ style?: React.CSSProperties;
14
+ }
15
+ declare const PisellViewGrid: React.FC<PisellViewGridProps>;
16
+ export default PisellViewGrid;
@@ -0,0 +1,98 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/pisellViewGrid/index.tsx
30
+ var pisellViewGrid_exports = {};
31
+ __export(pisellViewGrid_exports, {
32
+ default: () => pisellViewGrid_default
33
+ });
34
+ module.exports = __toCommonJS(pisellViewGrid_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_pisellLoading = __toESM(require("../pisellLoading"));
37
+ var import_classnames = __toESM(require("classnames"));
38
+ var import_index = require("./index.less");
39
+ var PisellViewGrid = ({
40
+ columns = 3,
41
+ horizontalGap = 10,
42
+ verticalGap = 10,
43
+ singleRow = false,
44
+ dataSource = [],
45
+ renderItem,
46
+ loading = false,
47
+ children,
48
+ className,
49
+ style
50
+ }) => {
51
+ const classes = (0, import_classnames.default)(
52
+ "pisell-view-grid",
53
+ {
54
+ "pisell-view-grid-single-row": singleRow
55
+ },
56
+ className
57
+ );
58
+ return /* @__PURE__ */ import_react.default.createElement(import_pisellLoading.default, { loading, fullscreen: false, style: { width: "100%" } }, /* @__PURE__ */ import_react.default.createElement(
59
+ "div",
60
+ {
61
+ className: classes,
62
+ style: {
63
+ ...style,
64
+ width: "100%",
65
+ overflow: "hidden"
66
+ }
67
+ },
68
+ /* @__PURE__ */ import_react.default.createElement(
69
+ "div",
70
+ {
71
+ className: "pisell-view-grid-content",
72
+ style: !singleRow ? {
73
+ gap: `${verticalGap}px ${horizontalGap}px`,
74
+ gridTemplateColumns: `repeat(${columns}, 1fr)`,
75
+ width: "100%"
76
+ } : {
77
+ display: "flex",
78
+ flexWrap: "nowrap",
79
+ overflowX: "auto",
80
+ width: "100%"
81
+ }
82
+ },
83
+ dataSource.map((item, index) => /* @__PURE__ */ import_react.default.createElement(
84
+ "div",
85
+ {
86
+ key: index,
87
+ className: "pisell-view-grid-item",
88
+ style: {
89
+ minWidth: 0,
90
+ flex: `0 0 calc(100% / ${columns})`
91
+ }
92
+ },
93
+ renderItem == null ? void 0 : renderItem(item, index)
94
+ ))
95
+ )
96
+ ));
97
+ };
98
+ var pisellViewGrid_default = PisellViewGrid;
@@ -0,0 +1,31 @@
1
+ .pisell-view-grid {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ box-sizing: border-box;
6
+
7
+ &-content {
8
+ display: grid;
9
+ width: 100%;
10
+ // grid-template-columns: repeat(4, 1fr);
11
+ // gap: 10px;
12
+ }
13
+
14
+ &-item {
15
+ width: 100%;
16
+ }
17
+
18
+ &-single-row {
19
+ &::-webkit-scrollbar {
20
+ display: none;
21
+ }
22
+ -ms-overflow-style: none;
23
+ scrollbar-width: none;
24
+ }
25
+
26
+ // &-item {
27
+ // box-sizing: border-box;
28
+ // display: inline-block;
29
+ // vertical-align: top;
30
+ // }
31
+ }
package/lib/index.d.ts CHANGED
@@ -131,6 +131,7 @@ export { default as DataSourceWrapper } from './components/dataSourceComponents/
131
131
  export { default as DataSourceTypography } from './components/dataSourceComponents/dataSourceShow/dataSourceTypography';
132
132
  export { default as DataSourceImage } from './components/dataSourceComponents/dataSourceShow/dataSourceImage';
133
133
  export { default as DataSourceQRCode } from './components/dataSourceComponents/dataSourceShow/dataSourceQRCode';
134
+ export { default as PisellViewGrid } from './components/pisellViewGrid';
134
135
  export { default as PageHeader } from './components/page-header';
135
136
  export { default as OrganizationTenantSwitcher } from './components/organizationTenantSwitcher';
136
137
  export { default as PisellTags } from './components/pisellTags';
package/lib/index.js CHANGED
@@ -122,6 +122,7 @@ __export(src_exports, {
122
122
  PisellToast: () => import_pisellToast.default,
123
123
  PisellTooltip: () => import_pisellTooltip.default,
124
124
  PisellUpload: () => import_pisellUpload.default,
125
+ PisellViewGrid: () => import_pisellViewGrid.default,
125
126
  PisellWalletPassCard: () => import_pisellWalletPassCard.default,
126
127
  Popconfirm: () => import_antd23.Popconfirm,
127
128
  Popover: () => import_antd24.Popover,
@@ -302,6 +303,7 @@ var import_dataSourceWrapper = __toESM(require("./components/dataSourceComponent
302
303
  var import_dataSourceTypography = __toESM(require("./components/dataSourceComponents/dataSourceShow/dataSourceTypography"));
303
304
  var import_dataSourceImage = __toESM(require("./components/dataSourceComponents/dataSourceShow/dataSourceImage"));
304
305
  var import_dataSourceQRCode = __toESM(require("./components/dataSourceComponents/dataSourceShow/dataSourceQRCode"));
306
+ var import_pisellViewGrid = __toESM(require("./components/pisellViewGrid"));
305
307
  var import_page_header = __toESM(require("./components/page-header"));
306
308
  var import_organizationTenantSwitcher = __toESM(require("./components/organizationTenantSwitcher"));
307
309
  var import_pisellTags = __toESM(require("./components/pisellTags"));
@@ -401,6 +403,7 @@ var import_login_and_register = __toESM(require("./components/login-and-register
401
403
  PisellToast,
402
404
  PisellTooltip,
403
405
  PisellUpload,
406
+ PisellViewGrid,
404
407
  PisellWalletPassCard,
405
408
  Popconfirm,
406
409
  Popover,
@@ -0,0 +1,167 @@
1
+ import snippets from "./snippets";
2
+
3
+ export default {
4
+ snippets,
5
+ componentName: "PisellViewGrid",
6
+ title: "栅格视图",
7
+ category: "数据展示",
8
+ docUrl: "",
9
+ screenshot: "",
10
+ devMode: "proCode",
11
+ npm: {
12
+ package: "@pisell/materials",
13
+ version: "1.0.1",
14
+ exportName: "PisellViewGrid",
15
+ main: "src/index.tsx",
16
+ destructuring: true,
17
+ subName: "",
18
+ },
19
+ props: [
20
+ {
21
+ title: '数据源',
22
+ display: 'block',
23
+ type: 'group',
24
+ items: [
25
+ {
26
+ name: 'dataSource',
27
+ title: { label: '列表数据源', tip: 'dataSource | 列表数据源' },
28
+ propType: { type: 'arrayOf', value: 'any' },
29
+ setter: ['JsonSetter', 'VariableSetter'],
30
+ },
31
+ {
32
+ name: 'loading',
33
+ title: {
34
+ label: '是否加载中',
35
+ tip: 'loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位',
36
+ },
37
+ propType: 'bool',
38
+ defaultValue: false,
39
+ setter: ['BoolSetter', 'VariableSetter'],
40
+ },
41
+ {
42
+ name: 'rowKey',
43
+ title: {
44
+ label: '行Key',
45
+ tip: 'rowKey | 当 renderItem 自定义渲染列表项有效时,自定义每一行的 key 的获取方式',
46
+ },
47
+ propType: {
48
+ type: 'oneOfType',
49
+ value: ['string', 'function'],
50
+ },
51
+ defaultValue: 'id',
52
+ setter: [
53
+ 'StringSetter',
54
+ {
55
+ componentName: 'FunctionSetter',
56
+ props: {
57
+ template:
58
+ 'rowKey(item,${extParams}){\n// 自定义每一行的 key\nreturn `key-${item.id}`;\n}',
59
+ },
60
+ },
61
+ 'VariableSetter',
62
+ ],
63
+ },
64
+ ],
65
+ },
66
+ {
67
+ title: '栅格 ',
68
+ display: 'block',
69
+ type: 'group',
70
+ items: [
71
+ {
72
+ name: 'columns',
73
+ title: { label: '列数', tip: 'columns | 列数' },
74
+ propType: 'number',
75
+ setter: 'NumberSetter',
76
+ defaultValue: 3,
77
+ },
78
+ {
79
+ name: 'horizontalGap',
80
+ title: { label: '水平间隔', tip: 'horizontalGap | 栅格水平间隔,单位为像素(px)' },
81
+ propType: 'number',
82
+ setter: {
83
+ componentName: 'NumberSetter', props: {
84
+ min: 0,
85
+ },
86
+ },
87
+ defaultValue: 10,
88
+ },
89
+ {
90
+ name: 'verticalGap',
91
+ title: { label: '垂直间隔', tip: 'verticalGap | 栅格垂直间隔,单位为像素(px)' },
92
+ propType: 'number',
93
+ setter: {
94
+ componentName: 'NumberSetter',
95
+ props: {
96
+ min: 0,
97
+ },
98
+ },
99
+ defaultValue: 10,
100
+ },
101
+ {
102
+ name: 'singleRow',
103
+ title: { label: '一行展示', tip: 'singleRow | 一行展示' },
104
+ propType: 'boolean',
105
+ defaultValue: false,
106
+ setter: 'BoolSetter',
107
+ },
108
+ ]
109
+ },
110
+ {
111
+ title: '扩展',
112
+ display: 'block',
113
+ type: 'group',
114
+ items: [
115
+ {
116
+ name: 'renderItem',
117
+ title: {
118
+ label: '渲染函数',
119
+ tip: 'renderItem | 当使用 dataSource 时,可以用 `renderItem` 自定义渲染列表项',
120
+ },
121
+ propType: 'func',
122
+ setter: [
123
+ {
124
+ componentName: 'SlotSetter',
125
+ title: '渲染函数插槽',
126
+ initialValue: {
127
+ type: 'JSSlot',
128
+ params: ['item'],
129
+ value: [
130
+ {
131
+ componentName: 'List.Item',
132
+ props: {},
133
+ children: {
134
+ componentName: 'Typography.Text',
135
+ props: {
136
+ children: {
137
+ type: 'JSExpression',
138
+ value: 'this.item.text',
139
+ },
140
+ },
141
+ },
142
+ },
143
+ ],
144
+ },
145
+ },
146
+ {
147
+ componentName: 'FunctionSetter',
148
+ props: {
149
+ template: 'renderItem(item,${extParams}){\n// 自定义渲染列表项\nreturn `item`;\n}',
150
+ },
151
+ },
152
+ 'VariableSetter',
153
+ ],
154
+ },
155
+ ],
156
+ },
157
+ ],
158
+ configure: {
159
+ supports: {
160
+ style: true,
161
+ events: [],
162
+ },
163
+ component: {
164
+ isContainer: true,
165
+ },
166
+ },
167
+ };
@@ -0,0 +1,54 @@
1
+ export default [
2
+ {
3
+ title: '栅格视图',
4
+ schema: {
5
+ componentName: 'PisellViewGrid',
6
+ props: {
7
+ dataSource: [
8
+ {
9
+ id: 1,
10
+ text: "Racing car sprays burning fuel into crowd.",
11
+ },
12
+ {
13
+ id: 2,
14
+ text: "Japanese princess to wed commoner.",
15
+ },
16
+ {
17
+ id: 3,
18
+ text: "Australian walks 100km after outback crash.",
19
+ },
20
+ {
21
+ id: 4,
22
+ text: "Man charged over missing wedding girl.",
23
+ },
24
+ {
25
+ id: 5,
26
+ text: "Los Angeles battles huge wildfires.",
27
+ },
28
+ ],
29
+ columns: 3,
30
+ horizontalGap: 10,
31
+ verticalGap: 10,
32
+ renderItem: {
33
+ type: "JSSlot",
34
+ params: ["item"],
35
+ value: [
36
+ {
37
+ componentName: "List.Item",
38
+ props: {},
39
+ children: {
40
+ componentName: "Typography.Text",
41
+ props: {
42
+ children: {
43
+ type: "JSExpression",
44
+ value: "this.item.text",
45
+ },
46
+ },
47
+ },
48
+ },
49
+ ],
50
+ },
51
+ },
52
+ },
53
+ },
54
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "6.0.7",
3
+ "version": "6.0.8",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -65,9 +65,9 @@
65
65
  "react-virtualized-auto-sizer": "^1.0.20",
66
66
  "crypto-js": "^4.2.0",
67
67
  "@zxing/library": "0.21.2",
68
- "@pisell/date-picker": "1.0.100",
68
+ "@pisell/utils": "1.0.42",
69
69
  "@pisell/icon": "0.0.11",
70
- "@pisell/utils": "1.0.42"
70
+ "@pisell/date-picker": "1.0.100"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "react": "^18.0.0",