@cloudbase/weda-ui 3.15.8 → 3.17.0
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/configs/components/container.js +0 -3
- package/dist/configs/components/wd-ad.d.ts +4 -0
- package/dist/configs/components/wd-ad.js +23 -0
- package/dist/configs/components/wd-cascader.d.ts +4 -0
- package/dist/configs/components/wd-checkbox.d.ts +4 -0
- package/dist/configs/components/wd-code-editor.d.ts +4 -0
- package/dist/configs/components/wd-date-range.d.ts +4 -0
- package/dist/configs/components/wd-date.d.ts +4 -0
- package/dist/configs/components/wd-department.d.ts +6 -0
- package/dist/configs/components/wd-department.js +1 -1
- package/dist/configs/components/wd-form-arr.d.ts +4 -0
- package/dist/configs/components/wd-form-detail.d.ts +4 -0
- package/dist/configs/components/wd-form-obj.d.ts +4 -0
- package/dist/configs/components/wd-input-email.d.ts +4 -0
- package/dist/configs/components/wd-input-number.d.ts +4 -0
- package/dist/configs/components/wd-input-phone.d.ts +4 -0
- package/dist/configs/components/wd-input-url.d.ts +4 -0
- package/dist/configs/components/wd-input.d.ts +4 -0
- package/dist/configs/components/wd-location.d.ts +4 -0
- package/dist/configs/components/wd-member.d.ts +4 -0
- package/dist/configs/components/wd-radio.d.ts +4 -0
- package/dist/configs/components/wd-rating.d.ts +4 -0
- package/dist/configs/components/wd-region.d.ts +4 -0
- package/dist/configs/components/wd-rich-text.d.ts +4 -0
- package/dist/configs/components/wd-select-multiple.d.ts +17 -8
- package/dist/configs/components/wd-select-multiple.js +43 -10
- package/dist/configs/components/wd-select.d.ts +17 -8
- package/dist/configs/components/wd-select.js +85 -8
- package/dist/configs/components/wd-switch.d.ts +4 -0
- package/dist/configs/components/wd-tag-select.d.ts +4 -0
- package/dist/configs/components/wd-tag.d.ts +4 -0
- package/dist/configs/components/wd-textarea.d.ts +4 -0
- package/dist/configs/components/wd-time.d.ts +4 -0
- package/dist/configs/components/wd-upload-file.d.ts +4 -0
- package/dist/configs/components/wd-upload-image.d.ts +195 -15
- package/dist/configs/components/wd-upload-image.js +125 -6
- package/dist/configs/index.d.ts +536 -20
- package/dist/configs/type-utils/type-form.d.ts +4 -0
- package/dist/configs/type-utils/type-form.js +4 -0
- package/dist/configs/type-utils/x-runtime-default.d.ts +3 -0
- package/dist/configs/type-utils/x-runtime-default.js +3 -0
- package/dist/configs/utils/field.d.ts +1 -0
- package/dist/configs/utils/field.js +95 -0
- package/dist/style/weda-ui.min.css +1 -1
- package/dist/web/components/form/uploader/index.d.ts +1 -0
- package/dist/web/components/form/uploader/index.js +7 -4
- package/dist/web/components/form/uploader/upload/index.d.ts +26 -0
- package/dist/web/components/form/uploader/upload/index.js +200 -0
- package/dist/web/components/form/uploader/uploader.h5.d.ts +6 -1
- package/dist/web/components/form/uploader/uploader.h5.js +26 -94
- package/dist/web/components/form/uploader/uploader.pc.d.ts +1 -1
- package/dist/web/components/form/uploader/uploader.pc.js +30 -100
- package/dist/web/components/form/uploader/util.d.ts +16 -0
- package/dist/web/components/form/uploader/util.js +106 -5
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +3 -5
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +3 -5
- package/dist/web/components/uploaderView/index.js +1 -1
- package/dist/web/components/wd-ad/wd-ad.js +2 -4
- package/dist/web/components/wd-select/relationSelect/relationSelect.js +2 -2
- package/dist/web/components/wd-select/select/index.js +3 -2
- package/dist/web/components/wd-select/select/selectUI.js +3 -3
- package/dist/web/components/wd-select/wd-select.d.ts +2 -0
- package/dist/web/components/wd-select/wd-select.js +9 -3
- package/dist/web/components/wd-select-multiple/wd-select-multiple.d.ts +2 -0
- package/dist/web/components/wd-select-multiple/wd-select-multiple.js +9 -3
- package/dist/web/components/wd-upload-image/wd-upload-image.js +14 -4
- package/package.json +5 -5
- package/dist/web/components/form/uploader/useUploadFile.d.ts +0 -16
- package/dist/web/components/form/uploader/useUploadFile.js +0 -99
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { defineConfig, Type } from '../type-utils';
|
|
2
|
-
import {
|
|
1
|
+
import { defineConfig, Type, Tuple } from '../type-utils';
|
|
2
|
+
import { WD_SELECT_FORMAT } from '../../enum/index';
|
|
3
|
+
import { SINGLE_FOREIGN_FORMATS, X_RUNTIME_DEFAULT } from '../type-utils/x-runtime-default';
|
|
3
4
|
import { FORM_ITEM_DATA, FORM_ITEM_METHODS, FORM_ITEM_META, ItemData, pickWithXCategory, X_CATEGORY, getFormItemDataTitle, } from '../type-utils/type-form';
|
|
4
5
|
import { getClasses } from '../type-utils/classes';
|
|
5
6
|
import { templateInitNameWithId } from './common/init-name-with-id';
|
|
@@ -221,16 +222,41 @@ const data = Type.Partial(Type.Object({
|
|
|
221
222
|
default: '请选择',
|
|
222
223
|
'x-index': 41,
|
|
223
224
|
}),
|
|
225
|
+
searchable: Type.Boolean({
|
|
226
|
+
title: '支持搜索',
|
|
227
|
+
'x-runtime-default': X_RUNTIME_DEFAULT.searchable,
|
|
228
|
+
'x-index': 42,
|
|
229
|
+
'x-category': X_CATEGORY.COMMON,
|
|
230
|
+
'x-linkages': [
|
|
231
|
+
{
|
|
232
|
+
type: 'value:visible',
|
|
233
|
+
target: '*(searchPlaceholder)',
|
|
234
|
+
condition: '{{$self.value}}',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
type: 'value:visible',
|
|
238
|
+
target: '*(filterable)',
|
|
239
|
+
condition: `{{$self.value&&!$form.values.format}}`,
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
}),
|
|
224
243
|
searchPlaceholder: Type.String({
|
|
225
244
|
title: '搜索框占位文字',
|
|
226
245
|
type: 'string',
|
|
227
246
|
default: '搜索选项',
|
|
228
|
-
'x-index':
|
|
247
|
+
'x-index': 43,
|
|
229
248
|
'x-category': X_CATEGORY.COMMON,
|
|
230
|
-
'x-helper-text': 'PC/H5端生效',
|
|
231
249
|
}),
|
|
232
|
-
ignoreCase: Object.assign({}, FORM_ITEM_DATA.ignoreCase, {
|
|
233
|
-
|
|
250
|
+
// ignoreCase: Object.assign({}, FORM_ITEM_DATA.ignoreCase, {
|
|
251
|
+
// 'x-index': 44,
|
|
252
|
+
// display: false,
|
|
253
|
+
// }),
|
|
254
|
+
filterable: Type.Boolean({
|
|
255
|
+
title: '支持远程搜索',
|
|
256
|
+
'x-runtime-default': X_RUNTIME_DEFAULT.filterable,
|
|
257
|
+
'x-index': 44,
|
|
258
|
+
'x-category': X_CATEGORY.COMMON,
|
|
259
|
+
description: '默认根据搜索框输入值进行筛选,开启后屏蔽前端筛选',
|
|
234
260
|
}),
|
|
235
261
|
enableRelationalSetting: FORM_ITEM_DATA.enableRelationalSetting,
|
|
236
262
|
enableRelationalRefresh: FORM_ITEM_DATA.enableRelationalRefresh,
|
|
@@ -238,7 +264,47 @@ const data = Type.Partial(Type.Object({
|
|
|
238
264
|
addRelationButtonText: FORM_ITEM_DATA.addRelationButtonText,
|
|
239
265
|
enableRelationOptionJump: FORM_ITEM_DATA.enableRelationOptionJump,
|
|
240
266
|
enableRelationTag: FORM_ITEM_DATA.enableRelationTag,
|
|
241
|
-
format:
|
|
267
|
+
format: Type.StringEnum({
|
|
268
|
+
type: 'string',
|
|
269
|
+
title: '字段类型',
|
|
270
|
+
enum: Tuple(WD_SELECT_FORMAT),
|
|
271
|
+
'x-linkages': [
|
|
272
|
+
{
|
|
273
|
+
type: 'value:visible',
|
|
274
|
+
target: '*(range,filterable)',
|
|
275
|
+
condition: `{{!${SINGLE_FOREIGN_FORMATS('$self.value', true)}}}`,
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
type: 'value:visible',
|
|
279
|
+
target: '*(selectFieldType,tipBlock,enableRelationalSetting,enableAddRelationButton,enableRelationOptionJump,sorter,ignoreCase)',
|
|
280
|
+
condition: `{{${SINGLE_FOREIGN_FORMATS()}}}`,
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
type: 'value:visible',
|
|
284
|
+
target: '*(enableRelationTag,enableRelationalRefresh)',
|
|
285
|
+
condition: `{{${SINGLE_FOREIGN_FORMATS('$self.value', true)}}}`,
|
|
286
|
+
},
|
|
287
|
+
// where: 升级v2协议前的筛选器
|
|
288
|
+
// queryCondition: 升级v2协议后的筛选器
|
|
289
|
+
// supportManyRelated 用来辅助用户主动升级筛选器
|
|
290
|
+
// 默认未主动选择升级筛选器时,展示升级开关,点击升级后不再展示,一次性操作
|
|
291
|
+
{
|
|
292
|
+
type: 'value:state',
|
|
293
|
+
target: 'supportManyRelated',
|
|
294
|
+
condition: `{{!$form.values.supportManyRelated&&${SINGLE_FOREIGN_FORMATS()}}}`,
|
|
295
|
+
state: {
|
|
296
|
+
display: true,
|
|
297
|
+
},
|
|
298
|
+
otherwise: {
|
|
299
|
+
display: false,
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
display: false,
|
|
304
|
+
'x-platforms': [''],
|
|
305
|
+
'x-category': X_CATEGORY.COMMON,
|
|
306
|
+
'x-index': 50,
|
|
307
|
+
}),
|
|
242
308
|
viewId: FORM_ITEM_DATA.viewId,
|
|
243
309
|
enumName: FORM_ITEM_DATA.enumName,
|
|
244
310
|
primaryField: FORM_ITEM_DATA.primaryField,
|
|
@@ -254,7 +320,7 @@ const data = Type.Partial(Type.Object({
|
|
|
254
320
|
requiredMsg: FORM_ITEM_DATA.requiredMsg,
|
|
255
321
|
requiredFlag: FORM_ITEM_DATA.requiredFlag,
|
|
256
322
|
// 废弃属性
|
|
257
|
-
staticSearchable: FORM_ITEM_DATA.staticSearchable,
|
|
323
|
+
// staticSearchable: FORM_ITEM_DATA.staticSearchable,
|
|
258
324
|
}));
|
|
259
325
|
const properties = Type.Composite([
|
|
260
326
|
Type.Pick(data, ['name', 'value', 'label', 'required']),
|
|
@@ -320,13 +386,24 @@ const config = defineConfig({
|
|
|
320
386
|
}),
|
|
321
387
|
}),
|
|
322
388
|
},
|
|
389
|
+
{
|
|
390
|
+
name: 'focus',
|
|
391
|
+
title: '聚焦',
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
name: 'blur',
|
|
395
|
+
title: '失焦',
|
|
396
|
+
'x-platforms': ['MOBILEWEB', 'PCWEB'],
|
|
397
|
+
},
|
|
323
398
|
{
|
|
324
399
|
name: 'onSettingButtonClick',
|
|
325
400
|
title: '点击设置按钮',
|
|
401
|
+
'x-platforms': ['MOBILEWEB', 'PCWEB'],
|
|
326
402
|
},
|
|
327
403
|
{
|
|
328
404
|
name: 'onAddRelationButtonClick',
|
|
329
405
|
title: '点击新建按钮',
|
|
406
|
+
'x-platforms': ['MOBILEWEB', 'PCWEB'],
|
|
330
407
|
},
|
|
331
408
|
{
|
|
332
409
|
name: 'onRelationTagClick',
|
|
@@ -40,20 +40,55 @@ declare const data: import("@sinclair/typebox").TObject<{
|
|
|
40
40
|
'x-helper-text': string;
|
|
41
41
|
}>;
|
|
42
42
|
value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
43
|
+
template: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
44
|
+
}>;
|
|
45
|
+
declare const previewFileItem: import("@sinclair/typebox").TObject<{
|
|
46
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
47
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
48
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
49
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
50
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
51
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
52
|
+
}>;
|
|
53
|
+
declare const uploadInstance: import("@sinclair/typebox").TObject<{
|
|
54
|
+
config: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
55
|
+
action: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
56
|
+
maxUploadCount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
57
|
+
maxSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
58
|
+
isCompressBeforeUpload: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
59
|
+
compressQuality: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
60
|
+
compressedWidth: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
61
|
+
compressedHeight: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
62
|
+
accepts: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
63
|
+
customUploadPath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
64
|
+
}>>;
|
|
65
|
+
beforeUpload: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{}>>;
|
|
66
|
+
onUploadProgress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TObject<{
|
|
67
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
68
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
69
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
70
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
71
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
72
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
73
|
+
}>], import("@sinclair/typebox").TAny>>;
|
|
74
|
+
onComplete: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
75
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
76
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
77
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
78
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
79
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
80
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
81
|
+
}>>], import("@sinclair/typebox").TAny>>;
|
|
82
|
+
onSuccess: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TObject<{
|
|
83
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
84
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
85
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
86
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
87
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
88
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
89
|
+
}>], import("@sinclair/typebox").TAny>>;
|
|
90
|
+
onFail: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TAny], import("@sinclair/typebox").TAny>>;
|
|
43
91
|
}>;
|
|
44
|
-
export type EventsType = {
|
|
45
|
-
events: Partial<{
|
|
46
|
-
success: (arg: {
|
|
47
|
-
value: unknown;
|
|
48
|
-
file?: File;
|
|
49
|
-
}) => void;
|
|
50
|
-
change: (arg: {
|
|
51
|
-
value: unknown;
|
|
52
|
-
isDelete?: boolean;
|
|
53
|
-
}) => void;
|
|
54
|
-
error: (err: unknown) => void;
|
|
55
|
-
}>;
|
|
56
|
-
};
|
|
57
92
|
declare const config: {
|
|
58
93
|
$schema: "https://comp-public-replace-1303824488-cos.weda.tencent.com/schema/lcds_component.json";
|
|
59
94
|
data: import("@sinclair/typebox").TObject<{
|
|
@@ -92,6 +127,7 @@ declare const config: {
|
|
|
92
127
|
'x-helper-text': string;
|
|
93
128
|
}>;
|
|
94
129
|
value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
130
|
+
template: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
95
131
|
}>;
|
|
96
132
|
properties: import("@sinclair/typebox").TObject<{
|
|
97
133
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString & {
|
|
@@ -103,7 +139,55 @@ declare const config: {
|
|
|
103
139
|
disabled: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
104
140
|
visible: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
105
141
|
readOnly: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
142
|
+
uploadInstance: import("@sinclair/typebox").TObject<{
|
|
143
|
+
config: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
144
|
+
action: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
145
|
+
maxUploadCount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
146
|
+
maxSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
147
|
+
isCompressBeforeUpload: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
148
|
+
compressQuality: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
149
|
+
compressedWidth: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
150
|
+
compressedHeight: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
151
|
+
accepts: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
152
|
+
customUploadPath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
153
|
+
}>>;
|
|
154
|
+
beforeUpload: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{}>>;
|
|
155
|
+
onUploadProgress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TObject<{
|
|
156
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
157
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
158
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
159
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
160
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
161
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
162
|
+
}>], import("@sinclair/typebox").TAny>>;
|
|
163
|
+
onComplete: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
164
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
165
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
166
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
167
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
168
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
169
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
170
|
+
}>>], import("@sinclair/typebox").TAny>>;
|
|
171
|
+
onSuccess: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TObject<{
|
|
172
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
173
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
174
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
175
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
176
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
177
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
178
|
+
}>], import("@sinclair/typebox").TAny>>;
|
|
179
|
+
onFail: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TAny], import("@sinclair/typebox").TAny>>;
|
|
180
|
+
}>;
|
|
181
|
+
previewFile: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
182
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
183
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
184
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
185
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
186
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
187
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
188
|
+
}>>;
|
|
106
189
|
}>;
|
|
190
|
+
isContainer: true;
|
|
107
191
|
classes: ({
|
|
108
192
|
name: string;
|
|
109
193
|
selector: string;
|
|
@@ -114,11 +198,40 @@ declare const config: {
|
|
|
114
198
|
description: string;
|
|
115
199
|
code: string;
|
|
116
200
|
})[];
|
|
117
|
-
methods: {
|
|
201
|
+
methods: ({
|
|
118
202
|
name: string;
|
|
119
203
|
label: string;
|
|
120
204
|
description: string;
|
|
121
|
-
}
|
|
205
|
+
} | {
|
|
206
|
+
name: string;
|
|
207
|
+
label: string;
|
|
208
|
+
params: {
|
|
209
|
+
properties: {
|
|
210
|
+
cloudId: {
|
|
211
|
+
title: string;
|
|
212
|
+
type: string;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
description: string;
|
|
217
|
+
} | {
|
|
218
|
+
name: string;
|
|
219
|
+
label: string;
|
|
220
|
+
params: import("@sinclair/typebox").TObject<{
|
|
221
|
+
config: import("@sinclair/typebox").TObject<{
|
|
222
|
+
action: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
223
|
+
maxUploadCount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
224
|
+
maxSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
225
|
+
isCompressBeforeUpload: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
226
|
+
compressQuality: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
227
|
+
compressedWidth: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
228
|
+
compressedHeight: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
229
|
+
accepts: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
230
|
+
customUploadPath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
231
|
+
}>;
|
|
232
|
+
}>;
|
|
233
|
+
description?: undefined;
|
|
234
|
+
})[];
|
|
122
235
|
events: ({
|
|
123
236
|
name: string;
|
|
124
237
|
title: string;
|
|
@@ -130,6 +243,48 @@ declare const config: {
|
|
|
130
243
|
name: string;
|
|
131
244
|
title: string;
|
|
132
245
|
description: string;
|
|
246
|
+
} | {
|
|
247
|
+
name: string;
|
|
248
|
+
title: string;
|
|
249
|
+
detail: import("@sinclair/typebox").TObject<{
|
|
250
|
+
config: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
251
|
+
action: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
252
|
+
maxUploadCount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
253
|
+
maxSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
254
|
+
isCompressBeforeUpload: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
255
|
+
compressQuality: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
256
|
+
compressedWidth: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
257
|
+
compressedHeight: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
258
|
+
accepts: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
259
|
+
customUploadPath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
260
|
+
}>>;
|
|
261
|
+
beforeUpload: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{}>>;
|
|
262
|
+
onUploadProgress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TObject<{
|
|
263
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
264
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
265
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
266
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
267
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
268
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
269
|
+
}>], import("@sinclair/typebox").TAny>>;
|
|
270
|
+
onComplete: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
271
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
272
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
273
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
274
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
275
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
276
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
277
|
+
}>>], import("@sinclair/typebox").TAny>>;
|
|
278
|
+
onSuccess: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TObject<{
|
|
279
|
+
progress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
280
|
+
loading: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
281
|
+
cloudId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
282
|
+
tempUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
283
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
284
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
285
|
+
}>], import("@sinclair/typebox").TAny>>;
|
|
286
|
+
onFail: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TFunction<[import("@sinclair/typebox").TAny], import("@sinclair/typebox").TAny>>;
|
|
287
|
+
}>;
|
|
133
288
|
})[];
|
|
134
289
|
meta: {
|
|
135
290
|
description: string;
|
|
@@ -146,6 +301,10 @@ declare const config: {
|
|
|
146
301
|
props: string[];
|
|
147
302
|
};
|
|
148
303
|
group: {
|
|
304
|
+
模板: {
|
|
305
|
+
'x-index': number;
|
|
306
|
+
expand: boolean;
|
|
307
|
+
};
|
|
149
308
|
标签项: {
|
|
150
309
|
'x-index': number;
|
|
151
310
|
expand: boolean;
|
|
@@ -221,6 +380,11 @@ declare const config: {
|
|
|
221
380
|
} | {
|
|
222
381
|
body: string;
|
|
223
382
|
when: string;
|
|
383
|
+
to?: undefined;
|
|
384
|
+
} | {
|
|
385
|
+
when: string;
|
|
386
|
+
to: string;
|
|
387
|
+
body: string;
|
|
224
388
|
})[];
|
|
225
389
|
};
|
|
226
390
|
compConfig: {
|
|
@@ -229,3 +393,19 @@ declare const config: {
|
|
|
229
393
|
};
|
|
230
394
|
export default config;
|
|
231
395
|
export type DataType = Simplify<Static<typeof data>>;
|
|
396
|
+
export type UploadInstanceType = Simplify<Static<typeof uploadInstance>>;
|
|
397
|
+
export type PreviewFileItemType = Simplify<Static<typeof previewFileItem>>;
|
|
398
|
+
export type EventsType = {
|
|
399
|
+
events: Partial<{
|
|
400
|
+
success: (arg: {
|
|
401
|
+
value: unknown;
|
|
402
|
+
file?: File;
|
|
403
|
+
}) => void;
|
|
404
|
+
change: (arg: {
|
|
405
|
+
value: unknown;
|
|
406
|
+
isDelete?: boolean;
|
|
407
|
+
}) => void;
|
|
408
|
+
error: (err: unknown) => void;
|
|
409
|
+
onReady: (arg: UploadInstanceType) => void;
|
|
410
|
+
}>;
|
|
411
|
+
};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { defineConfig, Type, Tuple } from '../type-utils';
|
|
2
2
|
import { FORM_ITEM_DATA, FORM_ITEM_EVENTS, FORM_ITEM_METHODS, FORM_ITEM_META, ItemData, pickWithXCategory, X_CATEGORY, getFormItemDataTitle, getFormItemClasses, } from '../type-utils/type-form';
|
|
3
3
|
import { templateInitNameWithId } from './common/init-name-with-id';
|
|
4
|
+
import { $upload_image_template } from '../utils/field';
|
|
5
|
+
const TPL = `
|
|
6
|
+
{{#with $self as |$self|}}
|
|
7
|
+
{{#if (helper_utils '===' $self.attributes.template 'custom')}}
|
|
8
|
+
${$upload_image_template}
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{/with}}
|
|
11
|
+
`;
|
|
4
12
|
// 图片来源
|
|
5
13
|
export const WD_TAG_CAPTURE_TYPE = [
|
|
6
14
|
{ label: '拍照与相册', value: 'both' },
|
|
@@ -16,6 +24,26 @@ const data = Type.Partial(Type.Object({
|
|
|
16
24
|
'x-helper-text': '图片上传后,图片 https 链接默认仅可在微搭应用中访问,有效期 2 小时,可在[云存储权限设置](https://console.cloud.tencent.com/tcb/storage/index?envId=lowcode-3gp1xflvc8844909&rid=4&tabId=auth)中调整访问权限。',
|
|
17
25
|
}),
|
|
18
26
|
value: FORM_ITEM_DATA._valueInUpload,
|
|
27
|
+
template: Type.String({
|
|
28
|
+
enum: Tuple([
|
|
29
|
+
{
|
|
30
|
+
label: '默认图片上传',
|
|
31
|
+
value: 'normal',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: '自定义图片上传',
|
|
35
|
+
value: 'custom',
|
|
36
|
+
},
|
|
37
|
+
]),
|
|
38
|
+
title: '图片上传模板',
|
|
39
|
+
'x-runtime-default': 'normal',
|
|
40
|
+
description: '指定图片上传模板',
|
|
41
|
+
'x-index': 1,
|
|
42
|
+
'x-category': '模板',
|
|
43
|
+
'x-props': {
|
|
44
|
+
'data-hidebind': true,
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
19
47
|
// 标题
|
|
20
48
|
...TITLE,
|
|
21
49
|
// 内容
|
|
@@ -88,7 +116,7 @@ const data = Type.Partial(Type.Object({
|
|
|
88
116
|
'x-platforms': ['WEB', 'MOBILEWEB', 'PCWEB'],
|
|
89
117
|
})),
|
|
90
118
|
tmpFilePaths: Type.Optional(Type.Array(Type.String({
|
|
91
|
-
title: '
|
|
119
|
+
title: '图片临时地址',
|
|
92
120
|
}), { 'x-platforms': ['MP'] })),
|
|
93
121
|
}),
|
|
94
122
|
], Type.Any(), {
|
|
@@ -109,14 +137,63 @@ const paramValueType = Type.Object({
|
|
|
109
137
|
value: Type.Unknown({ title: '值' }),
|
|
110
138
|
isDelete: Type.Optional(Type.Boolean({ title: '是否删除动作' })),
|
|
111
139
|
});
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
140
|
+
const previewFileItem = Type.Partial(Type.Object({
|
|
141
|
+
progress: Type.Number({ title: '加载进度条' }),
|
|
142
|
+
loading: Type.Boolean({ title: '是否loading' }),
|
|
143
|
+
cloudId: Type.String({ title: '云存储id' }),
|
|
144
|
+
tempUrl: Type.String({ title: '临时图片地址' }),
|
|
145
|
+
key: Type.String({ title: 'key' }),
|
|
146
|
+
file: Type.Any({ title: 'web端图片对象' }),
|
|
147
|
+
}, { title: '上传图片预览信息' }));
|
|
148
|
+
const uploadInstanceConfig = Type.Partial(Type.Composite([
|
|
149
|
+
Type.Object({
|
|
150
|
+
accepts: Type.String({ title: '允许上传的图片类型,仅支持web端' }),
|
|
151
|
+
customUploadPath: Type.String({
|
|
152
|
+
title: '自定义上传路径,格式:pathA/pathB,存储在weda-uploader/appName/customUploadPath,customUploadPath默认为空',
|
|
153
|
+
}),
|
|
154
|
+
action: Type.String({
|
|
155
|
+
title: '小程序上传api',
|
|
156
|
+
description: '可选值为chooseMedia,chooseMessageFile,仅小程序端生效',
|
|
157
|
+
default: 'chooseMedia',
|
|
158
|
+
}),
|
|
159
|
+
}),
|
|
160
|
+
Type.Pick(data, [
|
|
161
|
+
'isCompressBeforeUpload',
|
|
162
|
+
'compressQuality',
|
|
163
|
+
'compressedHeight',
|
|
164
|
+
'compressedWidth',
|
|
165
|
+
'maxSize',
|
|
166
|
+
'maxUploadCount',
|
|
167
|
+
]),
|
|
168
|
+
], {
|
|
169
|
+
title: '图片上传配置项',
|
|
170
|
+
}));
|
|
171
|
+
const uploadInstance = Type.Partial(Type.Object({
|
|
172
|
+
config: uploadInstanceConfig,
|
|
173
|
+
beforeUpload: Type.Pick(data, ['callbacks']['beforeUpload']),
|
|
174
|
+
onUploadProgress: Type.Function([previewFileItem], Type.Any(), {
|
|
175
|
+
title: '上传过程中',
|
|
176
|
+
}),
|
|
177
|
+
onComplete: Type.Function([Type.Array(previewFileItem, { title: '上传图片预览列表' })], Type.Any(), {
|
|
178
|
+
title: '上传事件完成',
|
|
179
|
+
required: false,
|
|
180
|
+
}),
|
|
181
|
+
onSuccess: Type.Function([previewFileItem], Type.Any(), {
|
|
182
|
+
title: '上传成功',
|
|
183
|
+
}),
|
|
184
|
+
onFail: Type.Function([Type.Any()], Type.Any(), {
|
|
185
|
+
title: '上传失败',
|
|
186
|
+
}),
|
|
187
|
+
}, {
|
|
188
|
+
title: '图片上传实例',
|
|
189
|
+
}));
|
|
117
190
|
const properties = Type.Composite([
|
|
118
191
|
Type.Pick(data, ['name', 'label', 'value', 'required']),
|
|
119
192
|
Type.Pick(ItemData, ['visible', 'disabled', 'readOnly']),
|
|
193
|
+
Type.Object({
|
|
194
|
+
uploadInstance,
|
|
195
|
+
}, { title: '图片上传实例' }),
|
|
196
|
+
Type.Object({ previewFile: Type.Array(previewFileItem, { title: '图片预览列表' }) }),
|
|
120
197
|
]);
|
|
121
198
|
const classes = [
|
|
122
199
|
...getFormItemClasses('upload-image', { isInput: false }),
|
|
@@ -177,11 +254,22 @@ const classes = [
|
|
|
177
254
|
},
|
|
178
255
|
],
|
|
179
256
|
];
|
|
257
|
+
const events = [
|
|
258
|
+
{ ...{}, ...FORM_ITEM_EVENTS.change, detail: paramValueType },
|
|
259
|
+
FORM_ITEM_EVENTS.success,
|
|
260
|
+
FORM_ITEM_EVENTS.error,
|
|
261
|
+
{
|
|
262
|
+
name: 'onReady',
|
|
263
|
+
title: '上传图片初始化完成',
|
|
264
|
+
detail: uploadInstance,
|
|
265
|
+
},
|
|
266
|
+
];
|
|
180
267
|
// export default
|
|
181
268
|
const config = defineConfig({
|
|
182
269
|
$schema: 'https://comp-public-replace-1303824488-cos.weda.tencent.com/schema/lcds_component.json',
|
|
183
270
|
data,
|
|
184
271
|
properties,
|
|
272
|
+
isContainer: true,
|
|
185
273
|
classes,
|
|
186
274
|
methods: [
|
|
187
275
|
Object.assign({}, FORM_ITEM_METHODS.setValue, { params: paramValueType }),
|
|
@@ -191,6 +279,32 @@ const config = defineConfig({
|
|
|
191
279
|
FORM_ITEM_METHODS.setReadOnly,
|
|
192
280
|
FORM_ITEM_METHODS.handleValidate,
|
|
193
281
|
FORM_ITEM_METHODS.clearValidate,
|
|
282
|
+
{
|
|
283
|
+
name: 'upload',
|
|
284
|
+
label: '上传图片',
|
|
285
|
+
description: '通过 $w.id1.upload() 上传图片,仅在支持选择自定义图片上传模板时使用',
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: 'delete',
|
|
289
|
+
label: '删除单张图片',
|
|
290
|
+
params: {
|
|
291
|
+
properties: {
|
|
292
|
+
cloudId: {
|
|
293
|
+
title: '图片cloudId',
|
|
294
|
+
type: 'string',
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
description: '通过 $w.id1.delete() 删除单个图片,仅在支持选择自定义图片上传模板时使用',
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: 'setConfig',
|
|
302
|
+
label: '更新图片上传配置',
|
|
303
|
+
params: Type.Object({ config: uploadInstanceConfig }, {
|
|
304
|
+
title: '图片上传配置',
|
|
305
|
+
description: '通过 $w.id1.setConfig()更新图片上传配置项,仅在支持选择自定义图片上传模板时使用',
|
|
306
|
+
}),
|
|
307
|
+
},
|
|
194
308
|
],
|
|
195
309
|
events,
|
|
196
310
|
meta: {
|
|
@@ -224,6 +338,11 @@ const config = defineConfig({
|
|
|
224
338
|
`,
|
|
225
339
|
when: '$attached',
|
|
226
340
|
},
|
|
341
|
+
{
|
|
342
|
+
when: 'template',
|
|
343
|
+
to: '$children',
|
|
344
|
+
body: TPL,
|
|
345
|
+
},
|
|
227
346
|
],
|
|
228
347
|
},
|
|
229
348
|
compConfig: {
|