@power-xa/m-ui 0.0.4 → 0.0.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/README.md CHANGED
@@ -23,4 +23,7 @@
23
23
  # 0.0.4
24
24
  1.Tabs修改(子组件内容更新后未重新渲染)
25
25
  2.PageContainer增加footer属性,可自定义底部内容
26
- 3.Filter Children属性修改
26
+ 3.Filter Children属性修改
27
+
28
+ # 0.0.5
29
+ ProFormUpload/ProList 增加文件预览
@@ -1,4 +1,10 @@
1
1
  import { FC } from "react";
2
2
  import "./index.less";
3
- declare const ProFormUpload: FC<ProFormAPI.ProFormItemProps>;
3
+ type ProFormUploadProps = ProFormAPI.ProFormItemProps & {
4
+ module?: string;
5
+ userId?: string;
6
+ userName?: string;
7
+ readonly?: boolean;
8
+ };
9
+ declare const ProFormUpload: FC<ProFormUploadProps>;
4
10
  export default ProFormUpload;
@@ -16,7 +16,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
16
16
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
  import React, { Fragment, useCallback, useEffect, useRef, useState } from "react";
19
- import { chooseImage, chooseVideo, chooseMessageFile, uploadFile, previewImage } from "@tarojs/taro";
19
+ import { chooseImage, chooseVideo, chooseMessageFile, uploadFile, previewImage, navigateTo } from "@tarojs/taro";
20
20
  import { Image, Text, View } from "@tarojs/components";
21
21
  import { clipFileUrl, getFileType, getUUID, Grid, Popup } from "../../..";
22
22
  import { useConfig } from "../../../ConfigProvider";
@@ -308,7 +308,35 @@ var ProFormUpload = function ProFormUpload(props) {
308
308
  return /*#__PURE__*/React.createElement(View, {
309
309
  className: "p-pro-form-item-file",
310
310
  key: "file-" + index,
311
- onTap: function onTap() {}
311
+ onTap: function onTap() {
312
+ if (item.fileType === "Pic") {
313
+ previewImage({
314
+ urls: fileList.filter(function (item) {
315
+ return item.fileType === "Pic";
316
+ }).map(function (item) {
317
+ return item.fullUri;
318
+ }),
319
+ current: item.fullUri
320
+ });
321
+ } else {
322
+ navigateTo({
323
+ url: "/screens/common/preview/index",
324
+ success: function success(result) {
325
+ result.eventChannel.emit("getPreviewParams", {
326
+ fileId: item.id,
327
+ fileName: item.fileName,
328
+ fileType: item.fileType,
329
+ fileUri: item.uri,
330
+ fullUrl: item.fullUri,
331
+ module: props.module,
332
+ userId: props.userId,
333
+ userName: props.userName,
334
+ readonly: props.readonly
335
+ });
336
+ }
337
+ });
338
+ }
339
+ }
312
340
  }, item.fileType === "Pic" && item.fullUri ? /*#__PURE__*/React.createElement(Image, {
313
341
  src: item.fullUri,
314
342
  className: "image",
@@ -45,6 +45,9 @@ export type ProListProps = {
45
45
  })[];
46
46
  fileList?: MetaProps & {
47
47
  type: "swiper" | "list";
48
+ module?: string;
49
+ userId?: string;
50
+ userName?: string;
48
51
  };
49
52
  footer?: {
50
53
  creator?: {
@@ -11,6 +11,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
11
11
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import React, { forwardRef, Fragment, useCallback, useEffect, useImperativeHandle, useState } from "react";
14
+ import { previewImage, navigateTo } from "@tarojs/taro";
14
15
  import { Image, ScrollView, Swiper, SwiperItem, Text, View } from "@tarojs/components";
15
16
  import { getListAssignField, getSimplifyDay, Skeleton } from "./..";
16
17
  import { useDebounceEffect } from "ahooks";
@@ -192,7 +193,7 @@ var ProList = function ProList(_ref, ref) {
192
193
  }, []);
193
194
  var renderListContent = useCallback(function () {
194
195
  return list.map(function (item, index) {
195
- var _meta$tag3, _meta$tag4, _meta$tag5, _meta$fileList5, _meta$fileList$render, _meta$fileList6, _meta$fileList7, _item$meta$fileList$d, _meta$title3, _meta$fileList8, _meta$title4, _meta$fileList9, _meta$subTitle3, _meta$subTitle4, _meta$fileList10, _meta$fileList$render2, _meta$fileList11, _meta$fileList12, _meta$footer$creator, _meta$footer$creator2, _meta$footer$creator3, _meta$footer$extra$re, _meta$footer$extra, _meta$footer$extra2;
196
+ var _meta$tag3, _meta$tag4, _meta$tag5, _meta$fileList5, _meta$fileList$render, _meta$fileList6, _meta$fileList7, _item$meta$fileList$d, _meta$title3, _meta$fileList9, _meta$title4, _meta$fileList10, _meta$subTitle3, _meta$subTitle4, _meta$fileList11, _meta$fileList$render2, _meta$fileList12, _meta$fileList13, _meta$footer$creator, _meta$footer$creator2, _meta$footer$creator3, _meta$footer$extra$re, _meta$footer$extra, _meta$footer$extra2;
196
197
  var dom = /*#__PURE__*/React.createElement(View, {
197
198
  className: "p-pro-list-card-container ".concat(rowClassName),
198
199
  onTap: onItem === null || onItem === void 0 ? void 0 : onItem(item).onTap
@@ -228,12 +229,26 @@ var ProList = function ProList(_ref, ref) {
228
229
  }, /*#__PURE__*/React.createElement(Image, {
229
230
  src: file.fullUri,
230
231
  className: "p-pro-list-card-title-swiper-image",
231
- mode: "aspectFill"
232
+ mode: "aspectFill",
233
+ onTap: function onTap(e) {
234
+ var _meta$fileList8;
235
+ e.stopPropagation();
236
+ if ((_meta$fileList8 = meta.fileList) !== null && _meta$fileList8 !== void 0 && _meta$fileList8.dataIndex) {
237
+ previewImage({
238
+ urls: item[meta.fileList.dataIndex].filter(function (item) {
239
+ return item.fileType === "Pic";
240
+ }).map(function (item) {
241
+ return item.fullUri;
242
+ }),
243
+ current: file.fullUri
244
+ });
245
+ }
246
+ }
232
247
  }));
233
248
  }))), meta !== null && meta !== void 0 && (_meta$title3 = meta.title) !== null && _meta$title3 !== void 0 && _meta$title3.render ? /*#__PURE__*/React.createElement(View, {
234
- className: "p-pro-list-card-title-text ".concat(((_meta$fileList8 = meta.fileList) === null || _meta$fileList8 === void 0 ? void 0 : _meta$fileList8.type) === 'swiper' && item[meta.fileList.dataIndex] ? 'p-pro-list-card-title-swiper-text' : '')
235
- }, meta.title.render(item[meta.title.dataIndex], item, index)) : (meta === null || meta === void 0 || (_meta$title4 = meta.title) === null || _meta$title4 === void 0 ? void 0 : _meta$title4.dataIndex) && /*#__PURE__*/React.createElement(Text, {
236
249
  className: "p-pro-list-card-title-text ".concat(((_meta$fileList9 = meta.fileList) === null || _meta$fileList9 === void 0 ? void 0 : _meta$fileList9.type) === 'swiper' && item[meta.fileList.dataIndex] ? 'p-pro-list-card-title-swiper-text' : '')
250
+ }, meta.title.render(item[meta.title.dataIndex], item, index)) : (meta === null || meta === void 0 || (_meta$title4 = meta.title) === null || _meta$title4 === void 0 ? void 0 : _meta$title4.dataIndex) && /*#__PURE__*/React.createElement(Text, {
251
+ className: "p-pro-list-card-title-text ".concat(((_meta$fileList10 = meta.fileList) === null || _meta$fileList10 === void 0 ? void 0 : _meta$fileList10.type) === 'swiper' && item[meta.fileList.dataIndex] ? 'p-pro-list-card-title-swiper-text' : '')
237
252
  }, item[meta.title.dataIndex])), meta !== null && meta !== void 0 && (_meta$subTitle3 = meta.subTitle) !== null && _meta$subTitle3 !== void 0 && _meta$subTitle3.render ? meta.subTitle.render(item[meta.subTitle.dataIndex], item, index) : (meta === null || meta === void 0 || (_meta$subTitle4 = meta.subTitle) === null || _meta$subTitle4 === void 0 ? void 0 : _meta$subTitle4.dataIndex) && /*#__PURE__*/React.createElement(Text, {
238
253
  className: "p-pro-list-card-sub-title"
239
254
  }, item[meta.subTitle.dataIndex]), (meta === null || meta === void 0 ? void 0 : meta.description) && /*#__PURE__*/React.createElement(View, {
@@ -256,7 +271,7 @@ var ProList = function ProList(_ref, ref) {
256
271
  key: d.dataIndex + '-value-' + i
257
272
  }, item[d.dataIndex] || "-");
258
273
  }))), /* 文件列表 */
259
- (meta === null || meta === void 0 || (_meta$fileList10 = meta.fileList) === null || _meta$fileList10 === void 0 ? void 0 : _meta$fileList10.type) == "list" && (meta.fileList.render ? (_meta$fileList$render2 = (_meta$fileList11 = meta.fileList).render) === null || _meta$fileList$render2 === void 0 ? void 0 : _meta$fileList$render2.call(_meta$fileList11, item[meta.fileList.dataIndex], item, index) : (meta === null || meta === void 0 || (_meta$fileList12 = meta.fileList) === null || _meta$fileList12 === void 0 ? void 0 : _meta$fileList12.dataIndex) && item[meta.fileList.dataIndex] && /*#__PURE__*/React.createElement(Fragment, null, item[meta.fileList.dataIndex].filter(function (item) {
274
+ (meta === null || meta === void 0 || (_meta$fileList11 = meta.fileList) === null || _meta$fileList11 === void 0 ? void 0 : _meta$fileList11.type) == "list" && (meta.fileList.render ? (_meta$fileList$render2 = (_meta$fileList12 = meta.fileList).render) === null || _meta$fileList$render2 === void 0 ? void 0 : _meta$fileList$render2.call(_meta$fileList12, item[meta.fileList.dataIndex], item, index) : (meta === null || meta === void 0 || (_meta$fileList13 = meta.fileList) === null || _meta$fileList13 === void 0 ? void 0 : _meta$fileList13.dataIndex) && item[meta.fileList.dataIndex] && /*#__PURE__*/React.createElement(Fragment, null, item[meta.fileList.dataIndex].filter(function (item) {
260
275
  return item.fileType === "Pic";
261
276
  }).length ? /*#__PURE__*/React.createElement(View, {
262
277
  className: "p-pro-list-card-image-list"
@@ -267,7 +282,21 @@ var ProList = function ProList(_ref, ref) {
267
282
  key: file.id,
268
283
  src: file.fullUri,
269
284
  className: "p-pro-list-card-image",
270
- mode: "aspectFill"
285
+ mode: "aspectFill",
286
+ onTap: function onTap(e) {
287
+ var _meta$fileList14;
288
+ e.stopPropagation();
289
+ if ((_meta$fileList14 = meta.fileList) !== null && _meta$fileList14 !== void 0 && _meta$fileList14.dataIndex) {
290
+ previewImage({
291
+ urls: item[meta.fileList.dataIndex].filter(function (item) {
292
+ return item.fileType === "Pic";
293
+ }).map(function (item) {
294
+ return item.fullUri;
295
+ }),
296
+ current: file.fullUri
297
+ });
298
+ }
299
+ }
271
300
  });
272
301
  })) : null, item[meta.fileList.dataIndex].filter(function (item) {
273
302
  return item.fileType !== "Pic";
@@ -278,7 +307,29 @@ var ProList = function ProList(_ref, ref) {
278
307
  }).map(function (file) {
279
308
  return /*#__PURE__*/React.createElement(View, {
280
309
  className: "p-pro-list-card-file",
281
- key: file.id
310
+ key: file.id,
311
+ onTap: function onTap(e) {
312
+ var _meta$fileList15;
313
+ e.stopPropagation();
314
+ if ((_meta$fileList15 = meta.fileList) !== null && _meta$fileList15 !== void 0 && _meta$fileList15.dataIndex) {
315
+ navigateTo({
316
+ url: "/screens/common/preview/index",
317
+ success: function success(result) {
318
+ var _meta$fileList16, _meta$fileList17, _meta$fileList18;
319
+ result.eventChannel.emit("getPreviewParams", {
320
+ fileId: file.id,
321
+ fileName: file.fileName,
322
+ fileType: file.fileType,
323
+ fileUri: file.uri,
324
+ module: (_meta$fileList16 = meta.fileList) === null || _meta$fileList16 === void 0 ? void 0 : _meta$fileList16.module,
325
+ userId: (_meta$fileList17 = meta.fileList) === null || _meta$fileList17 === void 0 ? void 0 : _meta$fileList17.userId,
326
+ userName: (_meta$fileList18 = meta.fileList) === null || _meta$fileList18 === void 0 ? void 0 : _meta$fileList18.userName,
327
+ readonly: true
328
+ });
329
+ }
330
+ });
331
+ }
332
+ }
282
333
  }, /*#__PURE__*/React.createElement(Image, {
283
334
  className: "p-pro-list-card-file-image",
284
335
  src: "https://dev.p3china.com:7700/psp.web.dev/resources/images/document/icon/".concat(file.fileType.toLowerCase(), ".svg"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@power-xa/m-ui",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "power-mobile系列公共组件库",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",