@steedos-widgets/amis-object 1.3.4-beta.10 → 1.3.4-beta.12
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/amis-object.cjs.css +11 -5
- package/dist/amis-object.cjs.js +54 -30
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +11 -5
- package/dist/amis-object.esm.js +54 -30
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +11 -5
- package/dist/amis-object.umd.js +20 -18
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/dist/meta.js +2 -1
- package/package.json +3 -3
package/dist/amis-object.cjs.css
CHANGED
|
@@ -1304,9 +1304,10 @@ fieldset.antd-Collapse > legend{
|
|
|
1304
1304
|
.steedos-object-table .antd-Table-footToolbar {
|
|
1305
1305
|
border-top: 1px solid #e5e7eb;
|
|
1306
1306
|
}
|
|
1307
|
-
.steedos-object-table .antd-Table-footToolbar .antd-Crud-toolbar
|
|
1307
|
+
.steedos-object-table .antd-Table-footToolbar .antd-Crud-toolbar {
|
|
1308
|
+
display: flex;
|
|
1309
|
+
align-items: center;
|
|
1308
1310
|
justify-content: center;
|
|
1309
|
-
width: 100%;
|
|
1310
1311
|
}
|
|
1311
1312
|
.steedos-object-table .antd-Table-footToolbar .antd-Crud-toolbar-item .antd-Pagination-inputGroup-left {
|
|
1312
1313
|
display: none;
|
|
@@ -1528,6 +1529,11 @@ fieldset.antd-Collapse > legend{
|
|
|
1528
1529
|
.sidebar{
|
|
1529
1530
|
padding-bottom: 0px !important;
|
|
1530
1531
|
}
|
|
1532
|
+
|
|
1533
|
+
body.steedos {
|
|
1534
|
+
/*此样式可能造成ios17系统的iphone svg显示不出来,移除就好了*/
|
|
1535
|
+
-webkit-overflow-scrolling: unset;
|
|
1536
|
+
}
|
|
1531
1537
|
.steedos-listview .is-loading .antd-Table-contentWrap {
|
|
1532
1538
|
height: 50px;
|
|
1533
1539
|
}
|
|
@@ -1593,9 +1599,9 @@ fieldset.antd-Collapse > legend{
|
|
|
1593
1599
|
.antd-Select-popover .antd-Select-menu .antd-Select-option .antd-Checkbox--checkbox {
|
|
1594
1600
|
white-space: nowrap;
|
|
1595
1601
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1602
|
+
}
|
|
1603
|
+
.steedos-object-form .steedos-input-rich-text-readonly .antd-RichTextControl {
|
|
1604
|
+
border: 0;
|
|
1599
1605
|
}
|
|
1600
1606
|
|
|
1601
1607
|
@media (max-width: 767px) {
|
package/dist/amis-object.cjs.js
CHANGED
|
@@ -3612,8 +3612,8 @@ function getLookupListView(refObjectConfig) {
|
|
|
3612
3612
|
/*
|
|
3613
3613
|
* @Author: baozhoutao@steedos.com
|
|
3614
3614
|
* @Date: 2022-05-23 09:53:08
|
|
3615
|
-
* @LastEditors:
|
|
3616
|
-
* @LastEditTime: 2023-
|
|
3615
|
+
* @LastEditors: liaodaxue
|
|
3616
|
+
* @LastEditTime: 2023-10-11 17:32:17
|
|
3617
3617
|
* @Description:
|
|
3618
3618
|
*/
|
|
3619
3619
|
|
|
@@ -3674,7 +3674,7 @@ function getSelectMap(selectOptions){
|
|
|
3674
3674
|
if(optionColor){
|
|
3675
3675
|
const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
|
|
3676
3676
|
const color = getContrastColor(background);
|
|
3677
|
-
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
3677
|
+
const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
|
|
3678
3678
|
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
3679
3679
|
}else {
|
|
3680
3680
|
map[optionValue] = option.label;
|
|
@@ -4131,17 +4131,17 @@ async function getFindQuery(object, recordId, fields, options){
|
|
|
4131
4131
|
}
|
|
4132
4132
|
|
|
4133
4133
|
const countQuery = options.count === false ? "" : `,count:${object.name}__count(filters:{__filters})`;
|
|
4134
|
-
const moreQuerie = options.moreQueries?.length ? ("," + options.moreQueries.map(function(item){
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
}).join(",")) : "";
|
|
4134
|
+
// const moreQuerie = options.moreQueries?.length ? ("," + options.moreQueries.map(function(item){
|
|
4135
|
+
// // 把最外层的{}去除
|
|
4136
|
+
// return item.replace(/^{/,"").replace(/}$/,"");
|
|
4137
|
+
// }).join(",")) : "";
|
|
4138
4138
|
|
|
4139
4139
|
return {
|
|
4140
4140
|
orderBy: "${orderBy}",
|
|
4141
4141
|
orderDir: "${orderDir}",
|
|
4142
4142
|
pageNo: "${page}",
|
|
4143
4143
|
pageSize: "${perPage}",
|
|
4144
|
-
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}}${countQuery}
|
|
4144
|
+
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}}${countQuery}}`
|
|
4145
4145
|
}
|
|
4146
4146
|
}
|
|
4147
4147
|
|
|
@@ -8562,6 +8562,7 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
8562
8562
|
]
|
|
8563
8563
|
}else {
|
|
8564
8564
|
return [
|
|
8565
|
+
"statistics",
|
|
8565
8566
|
{
|
|
8566
8567
|
"type": "pagination",
|
|
8567
8568
|
"maxButtons": 5
|
|
@@ -9353,10 +9354,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9353
9354
|
// const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
|
|
9354
9355
|
|
|
9355
9356
|
let apiInfo;
|
|
9356
|
-
|
|
9357
|
+
let defaultValueOptionsQueryData;
|
|
9357
9358
|
if(referenceTo){
|
|
9358
9359
|
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
9359
|
-
|
|
9360
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
9360
9361
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
9361
9362
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
9362
9363
|
], {
|
|
@@ -9369,7 +9370,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9369
9370
|
}, null, [
|
|
9370
9371
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
9371
9372
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
9372
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"
|
|
9373
|
+
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
9373
9374
|
|
|
9374
9375
|
apiInfo.adaptor = `
|
|
9375
9376
|
const data = payload.data;
|
|
@@ -9463,13 +9464,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9463
9464
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
9464
9465
|
var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
|
|
9465
9466
|
if (defaultValue && !api.data.$term) {
|
|
9467
|
+
const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
|
|
9468
|
+
const defaultValueOptionsQuery = defaultValueOptionsQueryData.query.replace(/^{/,"").replace(/}$/,"");
|
|
9466
9469
|
// 字段值单独请求,没值的时候在请求中返回空
|
|
9467
9470
|
optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
|
|
9468
9471
|
if(filters.length > 0){
|
|
9469
9472
|
optionsFilters = [filters, optionsFilters];
|
|
9470
9473
|
}
|
|
9474
|
+
api.data.query = "{"+api.data.query.replace(/^{/,"").replace(/}$/,"")+","+defaultValueOptionsQuery+"}";
|
|
9475
|
+
api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters))
|
|
9471
9476
|
}
|
|
9472
|
-
api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));
|
|
9473
9477
|
return api;
|
|
9474
9478
|
`;
|
|
9475
9479
|
referenceTo ? referenceTo.labelField.name : '';
|
|
@@ -12024,18 +12028,30 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
12024
12028
|
payload.status = 2;
|
|
12025
12029
|
payload.msg = payload.errors[0].message;
|
|
12026
12030
|
}
|
|
12031
|
+
${options && options.initApiAdaptor || ''}
|
|
12027
12032
|
return payload;
|
|
12028
12033
|
`
|
|
12029
12034
|
}
|
|
12030
12035
|
|
|
12031
12036
|
async function getReadonlyFormInitApi(object, recordId, fields, options){
|
|
12037
|
+
let findOneOptions;
|
|
12038
|
+
if (!recordId && options && options.isEditor) {
|
|
12039
|
+
// 设计器中只读表单返回第一条记录
|
|
12040
|
+
findOneOptions = {
|
|
12041
|
+
filters: [],
|
|
12042
|
+
queryOptions: "top: 1"
|
|
12043
|
+
};
|
|
12044
|
+
}
|
|
12032
12045
|
return {
|
|
12033
12046
|
method: "post",
|
|
12034
12047
|
url: getApi$2() + '&objectName=${objectName}' + "&recordId=${recordId}",
|
|
12035
12048
|
cache: API_CACHE,
|
|
12036
|
-
|
|
12049
|
+
requestAdaptor: `
|
|
12050
|
+
${options && options.initApiRequestAdaptor || ''}
|
|
12051
|
+
return api;
|
|
12052
|
+
`,
|
|
12037
12053
|
adaptor: getReadonlyFormAdaptor(object, fields, options),
|
|
12038
|
-
data: await getFindOneQuery$1(object, recordId, fields,
|
|
12054
|
+
data: await getFindOneQuery$1(object, recordId, fields, findOneOptions),
|
|
12039
12055
|
headers: {
|
|
12040
12056
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
12041
12057
|
}
|
|
@@ -13595,7 +13611,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
13595
13611
|
}
|
|
13596
13612
|
|
|
13597
13613
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
13598
|
-
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign
|
|
13614
|
+
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign } = ctx;
|
|
13599
13615
|
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
13600
13616
|
const formFields = getFormFields(objectSchema, ctx);
|
|
13601
13617
|
const serviceId = `service_detail_page`;
|
|
@@ -13604,7 +13620,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
13604
13620
|
name: `page_readonly_${recordId}`,
|
|
13605
13621
|
id: serviceId,
|
|
13606
13622
|
data: {global: getGlobalData('read'), context: {rootUrl: getRootUrl(), tenantId: getTenantId(), authToken: getAuthToken()}},
|
|
13607
|
-
api: await getReadonlyFormInitApi(objectSchema, recordId, fields,
|
|
13623
|
+
api: await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx),
|
|
13608
13624
|
body: [
|
|
13609
13625
|
{
|
|
13610
13626
|
"type": "wrapper", //form 的 hiddenOn 会导致 form onEvent 异常, 使用wrapper包裹一次form,并在wrapper上控制显隐
|
|
@@ -17108,10 +17124,18 @@ const getOpinionFieldStepsName = (field, top_keywords) => {
|
|
|
17108
17124
|
* @Author: baozhoutao@steedos.com
|
|
17109
17125
|
* @Date: 2022-09-09 17:47:37
|
|
17110
17126
|
* @LastEditors: baozhoutao@steedos.com
|
|
17111
|
-
* @LastEditTime: 2023-
|
|
17127
|
+
* @LastEditTime: 2023-10-10 13:57:02
|
|
17112
17128
|
* @Description:
|
|
17113
17129
|
*/
|
|
17114
17130
|
|
|
17131
|
+
const getMoment = ()=>{
|
|
17132
|
+
if(window.amisRequire){
|
|
17133
|
+
return window.amisRequire("moment");
|
|
17134
|
+
}else if(window.moment){
|
|
17135
|
+
return window.moment;
|
|
17136
|
+
}
|
|
17137
|
+
};
|
|
17138
|
+
|
|
17115
17139
|
const getTrace = ({ instance, traceId }) => {
|
|
17116
17140
|
return _$1.find(instance.traces, (trace) => {
|
|
17117
17141
|
return trace._id === traceId;
|
|
@@ -17331,6 +17355,8 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17331
17355
|
method: "get",
|
|
17332
17356
|
});
|
|
17333
17357
|
|
|
17358
|
+
const moment = getMoment();
|
|
17359
|
+
|
|
17334
17360
|
return {
|
|
17335
17361
|
box: box,
|
|
17336
17362
|
_id: instanceId,
|
|
@@ -17341,7 +17367,7 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17341
17367
|
applicant_name: instance.applicant_name,
|
|
17342
17368
|
submitter: instance.submitter,
|
|
17343
17369
|
submit_date: instance.submit_date
|
|
17344
|
-
?
|
|
17370
|
+
? (moment && moment(instance.submit_date).format("YYYY-MM-DD"))
|
|
17345
17371
|
: "",
|
|
17346
17372
|
state: instance.state,
|
|
17347
17373
|
approveValues: values,
|
|
@@ -17381,8 +17407,7 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17381
17407
|
finishDate = approve.is_read ? "已读" : "未处理";
|
|
17382
17408
|
judge = null;
|
|
17383
17409
|
} else {
|
|
17384
|
-
finishDate =
|
|
17385
|
-
amisRequire("moment")(finishDate).format("YYYY-MM-DD HH:mm");
|
|
17410
|
+
finishDate = moment && moment(finishDate).format("YYYY-MM-DD HH:mm");
|
|
17386
17411
|
}
|
|
17387
17412
|
|
|
17388
17413
|
switch (judge) {
|
|
@@ -17991,16 +18016,15 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
17991
18016
|
uiSchema = schema.uiSchema;
|
|
17992
18017
|
return [3 /*break*/, 4];
|
|
17993
18018
|
case 2:
|
|
17994
|
-
|
|
17995
|
-
|
|
17996
|
-
// 设计器中只读表单返回第一条记录
|
|
17997
|
-
options.formInitProps = {
|
|
17998
|
-
filters: [],
|
|
17999
|
-
queryOptions: "top: 1",
|
|
18000
|
-
isEditor: true
|
|
18001
|
-
};
|
|
18019
|
+
if (props.$$editor) {
|
|
18020
|
+
options.isEditor = true;
|
|
18002
18021
|
}
|
|
18003
|
-
return [4 /*yield*/, getViewSchema(objectApiName, recordId, options
|
|
18022
|
+
return [4 /*yield*/, getViewSchema(objectApiName, recordId, Object.assign({}, options, {
|
|
18023
|
+
initApiRequestAdaptor: initApiRequestAdaptor,
|
|
18024
|
+
initApiAdaptor: initApiAdaptor,
|
|
18025
|
+
enableTabs: enableTabs,
|
|
18026
|
+
tabsMode: tabsMode
|
|
18027
|
+
}))];
|
|
18004
18028
|
case 3:
|
|
18005
18029
|
schema = _e.sent();
|
|
18006
18030
|
amisSchema = schema.amisSchema;
|
|
@@ -18941,7 +18965,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
18941
18965
|
schemaApi: {
|
|
18942
18966
|
"method": "get",
|
|
18943
18967
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
18944
|
-
"adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n return groupLength + tab.index;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
|
|
18968
|
+
"adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
|
|
18945
18969
|
"headers": {
|
|
18946
18970
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18947
18971
|
}
|