p-pc-ui 1.2.3 → 1.2.6

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/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { RegisterPPreviewImage } from "./components/p-preview-image/p-preview-image-register"
2
+
3
+ export { RegisterPPreviewImage }
4
+
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "p-pc-ui",
3
- "version": "1.2.3",
3
+ "version": "1.2.6",
4
4
  "type": "module",
5
- "module": "dist/index.ts",
6
- "main": "dist/index.ts",
5
+ "module": "index.ts",
6
+ "main": "index.ts",
7
7
  "files": [
8
- "dist"
8
+ "components",
9
+ "utils",
10
+ "index.ts"
9
11
  ],
10
12
  "peerDependencies": {
11
13
  "vue": "^3.0.0"
@@ -18,17 +20,10 @@
18
20
  "license": "ISC",
19
21
  "description": "",
20
22
  "dependencies": {
21
- "@ant-design/icons-vue": "^7.0.1",
22
- "ant-design-vue": "4.2.6",
23
- "dayjs": "^1.11.13",
24
- "v-viewer": "^3.0.21",
25
- "vue": "3.5.13",
26
- "@wangeditor/editor": "^5.1.23",
27
- "@wangeditor/editor-for-vue": "next"
23
+ "vue": "3.5.13"
28
24
  },
29
25
  "devDependencies": {
30
- "typescript": "5.8.3"
31
- },
32
- "_from": "p-pc-ui@1.1.7",
33
- "_resolved": "https://registry.npmmirror.com/p-pc-ui/-/p-pc-ui-1.1.7.tgz"
34
- }
26
+ "typescript": "5.8.3",
27
+ "@dcloudio/types": "^3.4.8"
28
+ }
29
+ }
@@ -94,9 +94,9 @@ export const set = (obj: object, path: string | string[], value: any) => {
94
94
  }
95
95
 
96
96
 
97
- export const formatTime = (input:any) => {
97
+ export const formatTime = (input: any) => {
98
98
  const date = new Date(input)
99
- const pad = (n:any) => n.toString().padStart(2, '0')
99
+ const pad = (n: any) => n.toString().padStart(2, '0')
100
100
  return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ` +
101
101
  `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
102
102
  }
@@ -108,11 +108,47 @@ export const formatTime = (input:any) => {
108
108
  export const pickBy = (object, predicate) => {
109
109
  const result = {}
110
110
  for (const key in object) {
111
- if (Object.prototype.hasOwnProperty.call(object, key)) {
112
- if (predicate(object[key], key)) {
113
- result[key] = object[key]
114
- }
111
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
112
+ if (predicate(object[key], key)) {
113
+ result[key] = object[key]
115
114
  }
115
+ }
116
116
  }
117
117
  return result
118
- }
118
+ }
119
+
120
+
121
+
122
+ const paramsToString = (params) => {
123
+ let query: string[] = []
124
+ for (const key in params) {
125
+ query.push(`${key}=${params[key]}`)
126
+ }
127
+
128
+ let url = ''
129
+
130
+ if (query.length > 0) {
131
+ url += `?${query.join('&')}`
132
+ }
133
+
134
+ return url
135
+ }
136
+
137
+
138
+ export const navTo = (url, params = {}) => {
139
+ uni.navigateTo({ url: url + paramsToString(params) })
140
+ }
141
+
142
+
143
+ export const dirTo = (url, params = {}) => {
144
+ uni.redirectTo({ url: url + paramsToString(params) })
145
+ }
146
+
147
+ export const switchTo = (url) => {
148
+ uni.switchTab({ url })
149
+ }
150
+
151
+ export const backTo = (delta = 1) => {
152
+ uni.navigateBack({ delta })
153
+ }
154
+
package/utils/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ import * as dataUtils from './dataUtils'
2
+
3
+ export {dataUtils}
@@ -1,118 +0,0 @@
1
- type FieldRule = { msg?: string, required?: boolean, min?: number, max?: number, decimal?: number }
2
-
3
- interface Base {
4
- key: string,
5
- label: string,
6
- default?: any,
7
- placeholder?: string,
8
- fieldType?: 'string' | 'number' | 'array' | 'date',
9
- fieldRules?: FieldRule[];
10
- visibleHook?: Function,
11
- tooltip?: string,
12
- hideLabel?: boolean
13
- colon?: boolean,
14
- labelSpan?: number,
15
- valueSpan?: number,
16
- labelAlign?: 'left' | 'right'
17
- }
18
-
19
-
20
- export interface Input extends Base {
21
- type: 'input',
22
- prefix?: any,
23
- suffix?: any
24
- }
25
-
26
- export interface InputNumber extends Base {
27
- type: 'number',
28
- prefix?: any,
29
- suffix?: any
30
- }
31
-
32
- export interface InputPassword extends Base {
33
- type: 'password',
34
- prefix?: any,
35
- }
36
-
37
- export interface InputCode extends Base {
38
- type: 'code',
39
- interval: number,
40
- codeName: string,
41
- sendNoticeFunc: Function
42
- activityFunc?: Function
43
- prefix?: any,
44
- suffix?: any,
45
- sendStatus?: 'waitSend' | 'sending' | 'end',
46
- }
47
-
48
-
49
-
50
- type LoadOptionsData = () => Promise<{ label: string, value: any }[]>
51
-
52
-
53
- interface SelectBase extends Base {
54
- type: 'select' | 'treeSelect' | 'radio',
55
- fieldNames?: {
56
- label?: string;
57
- value?: string;
58
- };
59
- isMultiple?: boolean
60
- }
61
-
62
- type GetOptionList =
63
- | { optionList: any[]; mapPath?: never; loadDataFunc?: LoadOptionsData }
64
- | { optionList?: any[]; mapPath: string[], loadDataFunc?: LoadOptionsData }
65
- | { optionList?: any[]; mapPath?: string[], loadDataFunc: LoadOptionsData }
66
-
67
- export type Select = SelectBase & GetOptionList;
68
-
69
-
70
- interface UploadBase extends Base {
71
- uploadType: 'pic' | 'file',
72
- maxCount?: number,
73
- }
74
-
75
- export interface UploadOss extends UploadBase {
76
- type: 'uploadOss',
77
- getOssToken: ({file_name}) => Promise<any>,
78
- baseOssUrl: string,
79
- }
80
-
81
-
82
- export interface Upload extends UploadBase {
83
- type: 'upload',
84
- }
85
-
86
- export interface Textarea extends Base {
87
- type: 'textarea',
88
- }
89
-
90
- export interface DatePicker extends Base {
91
- type: 'datePicker',
92
- }
93
-
94
-
95
- export interface Component extends Base {
96
- type: 'component',
97
- component: any
98
- }
99
-
100
- export interface Editor extends Base {
101
- type: 'editor',
102
- getOssToken: ({ file_name: string }) => Promise<any>,
103
- baseOssUrl?: string,
104
- }
105
-
106
-
107
- export type FormDataItem =
108
- | Input
109
- | InputNumber
110
- | InputPassword
111
- | InputCode
112
- | Select
113
- | Upload
114
- | UploadOss
115
- | Textarea
116
- | DatePicker
117
- | Component
118
- | Editor