@steedos-widgets/amis-lib 6.10.13 → 6.10.15
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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +110 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +110 -32
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +15 -11
- package/dist/index.umd.js.map +1 -1
- package/dist/types/workflow/flow.d.ts +2 -7
- package/dist/types/workflow/instance.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -4663,7 +4663,41 @@ async function getMobileTableColumns(fields, options){
|
|
|
4663
4663
|
tpls.push({ field, tpl });
|
|
4664
4664
|
}
|
|
4665
4665
|
}
|
|
4666
|
-
|
|
4666
|
+
function getUrlParams(search = window.location.search) {
|
|
4667
|
+
const params = {};
|
|
4668
|
+
const queryString = search.startsWith('?') ? search.slice(1) : search;
|
|
4669
|
+
|
|
4670
|
+
if (!queryString) return params;
|
|
4671
|
+
|
|
4672
|
+
queryString.split('&').forEach(pair => {
|
|
4673
|
+
const [key, value] = pair.split('=');
|
|
4674
|
+
if (key) {
|
|
4675
|
+
const decodedKey = decodeURIComponent(key);
|
|
4676
|
+
const decodedValue = value ? decodeURIComponent(value.replace(/\+/g, ' ')) : '';
|
|
4677
|
+
|
|
4678
|
+
// 处理数组参数(如:?color=red&color=blue)
|
|
4679
|
+
if (params.hasOwnProperty(decodedKey)) {
|
|
4680
|
+
if (Array.isArray(params[decodedKey])) {
|
|
4681
|
+
params[decodedKey].push(decodedValue);
|
|
4682
|
+
} else {
|
|
4683
|
+
params[decodedKey] = [params[decodedKey], decodedValue];
|
|
4684
|
+
}
|
|
4685
|
+
} else {
|
|
4686
|
+
params[decodedKey] = decodedValue;
|
|
4687
|
+
}
|
|
4688
|
+
}
|
|
4689
|
+
});
|
|
4690
|
+
|
|
4691
|
+
return params;
|
|
4692
|
+
}
|
|
4693
|
+
|
|
4694
|
+
const urlParams = getUrlParams();
|
|
4695
|
+
|
|
4696
|
+
let url = getNameTplUrl(nameField, options);
|
|
4697
|
+
if(options.displayAs === 'split'){
|
|
4698
|
+
const additionalFilters = urlParams['additionalFilters'] || '';
|
|
4699
|
+
url = url + `&additionalFilters=${encodeURIComponent(additionalFilters)}`;
|
|
4700
|
+
}
|
|
4667
4701
|
|
|
4668
4702
|
const columnLines = getMobileLines(tpls);
|
|
4669
4703
|
|
|
@@ -11071,7 +11105,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
11071
11105
|
"name": keywordsSearchBoxName,
|
|
11072
11106
|
"placeholder": i18next.t('frontend_crud_toolbar_quick_search_placeholder'),//"快捷搜索",
|
|
11073
11107
|
"value": crudKeywords,
|
|
11074
|
-
"mini":
|
|
11108
|
+
"mini": false,
|
|
11075
11109
|
"clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
|
|
11076
11110
|
"clearAndSubmit": true,
|
|
11077
11111
|
"searchImediately": false,
|
|
@@ -11148,7 +11182,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11148
11182
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
11149
11183
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
11150
11184
|
"tooltipPlacement": "top",
|
|
11151
|
-
"className":
|
|
11185
|
+
"className": `bg-white p-2 rounded text-gray-500 list-view-btn-reload ${formFactor === 'SMALL' ? 'hidden' : ''}`,
|
|
11152
11186
|
"label": "",
|
|
11153
11187
|
"icon": "fa fa-sync",
|
|
11154
11188
|
// "visibleOn": "${!showFieldsFilter}",
|
|
@@ -11229,7 +11263,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11229
11263
|
// if(toolbarCount){
|
|
11230
11264
|
// toolbars.push(toolbarCount);
|
|
11231
11265
|
// }
|
|
11232
|
-
|
|
11266
|
+
toolbars.push(toolbarReloadButton);
|
|
11233
11267
|
toolbars.push(toolbarDQuickSearchBox);
|
|
11234
11268
|
if(toolbarFilter){
|
|
11235
11269
|
toolbars.push(toolbarFilter);
|
|
@@ -11241,15 +11275,15 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
11241
11275
|
...toolbars,
|
|
11242
11276
|
]
|
|
11243
11277
|
}else {
|
|
11244
|
-
|
|
11278
|
+
if(toolbarFilter){
|
|
11279
|
+
toolbars.push(toolbarFilter);
|
|
11280
|
+
}
|
|
11245
11281
|
toolbars.push(toolbarReloadButton);
|
|
11246
11282
|
toolbars.push(toolbarDisplayAsButton);
|
|
11247
11283
|
if(mainObject?.permissions?.allowCreateListViews){
|
|
11248
11284
|
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
11249
11285
|
}
|
|
11250
|
-
|
|
11251
|
-
toolbars.push(toolbarFilter);
|
|
11252
|
-
}
|
|
11286
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
11253
11287
|
if(toolbarCount){
|
|
11254
11288
|
toolbars.push(toolbarCount);
|
|
11255
11289
|
}
|
|
@@ -11700,7 +11734,6 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11700
11734
|
}, bodyProps);
|
|
11701
11735
|
|
|
11702
11736
|
}
|
|
11703
|
-
|
|
11704
11737
|
body = defaultsDeep({}, listSchema, body);
|
|
11705
11738
|
body = await getCrudSchemaWithDataFilter(body, { crudDataFilter, onCrudDataFilter, amisData, env });
|
|
11706
11739
|
|
|
@@ -19554,12 +19587,25 @@ const getSubmitActions = async (instance, submitEvents) => {
|
|
|
19554
19587
|
expression: "${event.data.instanceFormValidate && event.data.approvalFormValidate}"
|
|
19555
19588
|
},
|
|
19556
19589
|
{
|
|
19557
|
-
|
|
19558
|
-
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19590
|
+
"actionType": "wait",
|
|
19591
|
+
"args": {
|
|
19592
|
+
"time": 300
|
|
19593
|
+
}
|
|
19594
|
+
},
|
|
19595
|
+
{
|
|
19596
|
+
"actionType": "custom",
|
|
19597
|
+
"script": `
|
|
19598
|
+
const appId = context.props.data.appId;
|
|
19599
|
+
const objectName = context.props.data.objectName;
|
|
19600
|
+
const side_listview_id = context.props.data.side_listview_id;
|
|
19601
|
+
const additionalFilters = context.props.data.additionalFilters;
|
|
19602
|
+
if(context.props.data.display === 'split'){
|
|
19603
|
+
window.navigate(\`/app/\${appId}/\${objectName}/view/none?side_object=\${objectName}&side_listview_id=\${side_listview_id}&additionalFilters=\${additionalFilters ? encodeURIComponent(additionalFilters) : ''}\`);
|
|
19604
|
+
window.$(".list-view-btn-reload").click();
|
|
19605
|
+
}else{
|
|
19606
|
+
window.navigate(\`/app/\${appId}/\${objectName}/grid/\${side_listview_id}\`);
|
|
19607
|
+
}
|
|
19608
|
+
`,
|
|
19563
19609
|
expression: "${event.data.instanceFormValidate && event.data.approvalFormValidate}"
|
|
19564
19610
|
},
|
|
19565
19611
|
{
|
|
@@ -20295,11 +20341,11 @@ const getFieldEditTpl = async (field, label)=>{
|
|
|
20295
20341
|
return payload;
|
|
20296
20342
|
`,
|
|
20297
20343
|
requestAdaptor: `
|
|
20298
|
-
const filters =
|
|
20299
|
-
const url =
|
|
20344
|
+
const filters = \`${_.replace(field.filters, /_.pluck/g, '_.map')}\`;
|
|
20345
|
+
const url = \`${field.url}\`;
|
|
20300
20346
|
if(filters){
|
|
20301
20347
|
console.log('filters', filters);
|
|
20302
|
-
const joinKey =
|
|
20348
|
+
const joinKey = url.indexOf('?') > 0 ? '&' : '?';
|
|
20303
20349
|
if(filters.startsWith('function(') || filters.startsWith('function (')){
|
|
20304
20350
|
const argsName = ${JSON.stringify(argsName)};
|
|
20305
20351
|
const fun = eval('_fun='+filters);
|
|
@@ -21026,10 +21072,6 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
21026
21072
|
onEvent: {
|
|
21027
21073
|
"@data.@instanceDetail.changed": {
|
|
21028
21074
|
actions: [
|
|
21029
|
-
{
|
|
21030
|
-
actionType: "custom",
|
|
21031
|
-
script:"debugger;",
|
|
21032
|
-
},
|
|
21033
21075
|
{
|
|
21034
21076
|
componentId:"u:instancePage",
|
|
21035
21077
|
actionType: "reload"
|
|
@@ -21038,6 +21080,10 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
21038
21080
|
},
|
|
21039
21081
|
"inited": {
|
|
21040
21082
|
"actions": [
|
|
21083
|
+
{
|
|
21084
|
+
actionType: 'broadcast',
|
|
21085
|
+
eventName: "recordLoaded"
|
|
21086
|
+
},
|
|
21041
21087
|
{
|
|
21042
21088
|
"actionType": "setValue",
|
|
21043
21089
|
"componentId": "instance_form",
|
|
@@ -21087,6 +21133,9 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
21087
21133
|
};
|
|
21088
21134
|
};
|
|
21089
21135
|
|
|
21136
|
+
const flowVersionCache = new Map();
|
|
21137
|
+
const formVersionCache = new Map();
|
|
21138
|
+
|
|
21090
21139
|
const getMoment = ()=>{
|
|
21091
21140
|
if(window.amisRequire){
|
|
21092
21141
|
return window.amisRequire("moment");
|
|
@@ -21137,17 +21186,29 @@ const getApproveValues = ({ instance, trace, step, approve, box }) => {
|
|
|
21137
21186
|
};
|
|
21138
21187
|
|
|
21139
21188
|
const getFlowVersion = async (instance) => {
|
|
21140
|
-
const
|
|
21141
|
-
|
|
21142
|
-
|
|
21143
|
-
|
|
21189
|
+
const cacheKey = `${instance.flow._id}_${instance.flow_version}`;
|
|
21190
|
+
|
|
21191
|
+
if (!flowVersionCache.has(cacheKey)) {
|
|
21192
|
+
const result = await fetchAPI$1(`/api/workflow/flow/${instance.flow._id}/version/${instance.flow_version}`, {
|
|
21193
|
+
method: "get"
|
|
21194
|
+
});
|
|
21195
|
+
flowVersionCache.set(cacheKey, result);
|
|
21196
|
+
}
|
|
21197
|
+
|
|
21198
|
+
return flowVersionCache.get(cacheKey);
|
|
21144
21199
|
};
|
|
21145
21200
|
|
|
21146
21201
|
const getFormVersion = async (instance) => {
|
|
21147
|
-
const
|
|
21148
|
-
|
|
21149
|
-
|
|
21150
|
-
|
|
21202
|
+
const cacheKey = `${instance.form._id}_${instance.form_version}`;
|
|
21203
|
+
|
|
21204
|
+
if (!formVersionCache.has(cacheKey)) {
|
|
21205
|
+
const result = await fetchAPI$1(`/api/workflow/form/${instance.form._id}/version/${instance.form_version}`, {
|
|
21206
|
+
method: "get"
|
|
21207
|
+
});
|
|
21208
|
+
formVersionCache.set(cacheKey, result);
|
|
21209
|
+
}
|
|
21210
|
+
|
|
21211
|
+
return formVersionCache.get(cacheKey);
|
|
21151
21212
|
};
|
|
21152
21213
|
|
|
21153
21214
|
const getStep = ({ flowVersion, stepId }) => {
|
|
@@ -21204,12 +21265,29 @@ const isNeedToShowSignImage = (is_finished, judge, traceShowSignImage) => {
|
|
|
21204
21265
|
return true;
|
|
21205
21266
|
};
|
|
21206
21267
|
|
|
21268
|
+
// 缓存存储
|
|
21269
|
+
const signCache = new Map();
|
|
21207
21270
|
const getSpaceUserSign = async (space, handler) => {
|
|
21271
|
+
// 生成缓存键
|
|
21272
|
+
const cacheKey = `${space}_${handler}`;
|
|
21273
|
+
|
|
21274
|
+
// 检查缓存
|
|
21275
|
+
if (signCache.has(cacheKey)) {
|
|
21276
|
+
return signCache.get(cacheKey);
|
|
21277
|
+
}
|
|
21278
|
+
|
|
21279
|
+
// 调用API
|
|
21208
21280
|
const result = await fetchAPI$1(`/api/v1/space_user_signs?filters=[["space","=","${space}"],["user","=","${handler}"]]&fields=["sign"]`);
|
|
21281
|
+
|
|
21282
|
+
let sign = null;
|
|
21209
21283
|
if (result?.data?.items && result.data.items.length > 0) {
|
|
21210
|
-
|
|
21284
|
+
sign = result.data.items[0].sign;
|
|
21211
21285
|
}
|
|
21212
|
-
|
|
21286
|
+
|
|
21287
|
+
// 写入缓存
|
|
21288
|
+
signCache.set(cacheKey, sign);
|
|
21289
|
+
|
|
21290
|
+
return sign;
|
|
21213
21291
|
};
|
|
21214
21292
|
|
|
21215
21293
|
const getInstanceInfo = async (props) => {
|