@steedos-widgets/amis-lib 3.6.2-beta.15 → 3.6.2-beta.16

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/index.esm.js CHANGED
@@ -5784,7 +5784,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
5784
5784
  const formSchema = {
5785
5785
  "type": "service",
5786
5786
  "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
5787
- "className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-2 sm:grid-cols-4 mb-2",
5787
+ "className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-4 sm:grid-cols-4 p-2",
5788
5788
  "style":{
5789
5789
  "max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
5790
5790
  },
@@ -6371,7 +6371,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6371
6371
  "className": "slds-filters"
6372
6372
  },
6373
6373
  "size": "xs",
6374
- "className": `border-gray-300 border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
6374
+ "className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
6375
6375
  "visibleOn": "this.showFieldsFilter",
6376
6376
  },
6377
6377
  "className": "bg-white"
@@ -6559,7 +6559,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
6559
6559
  "icon": "fa fa-refresh",
6560
6560
  "actionType": "reload",
6561
6561
  "target": amisListViewId,
6562
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
6562
+ "className": "bg-white p-2 rounded text-gray-500"
6563
6563
  },
6564
6564
  fieldsFilterButtonSchema,
6565
6565
  // {
@@ -6567,7 +6567,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
6567
6567
  // "label": "",
6568
6568
  // "icon": "fa fa-filter",
6569
6569
  // "actionType": "custom",
6570
- // "className": "bg-transparent p-2 rounded border-gray-300 text-gray-500",
6570
+ // "className": "bg-transparent p-2 rounded text-gray-500",
6571
6571
  // "id": "u:c20cb87d96c9",
6572
6572
  // "onEvent": {
6573
6573
  // "click": {
@@ -6615,7 +6615,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
6615
6615
  let headerSchema = [{
6616
6616
  "type": "wrapper",
6617
6617
  "body": body,
6618
- "className": `bg-gray-100 sm:rounded-tl sm:rounded-tr p-4 -mb-4`
6618
+ "className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
6619
6619
  }];
6620
6620
  return headerSchema;
6621
6621
  }
@@ -6750,7 +6750,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
6750
6750
  let body = [
6751
6751
  {
6752
6752
  "type": "wrapper",
6753
- "className": "p-4 bg-gray-100 border-b",
6753
+ "className": "p-4 border-b",
6754
6754
  "body": [
6755
6755
  {
6756
6756
  "type": "grid",
@@ -7876,7 +7876,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
7876
7876
  "icon": "fa fa-cog",
7877
7877
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
7878
7878
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
7879
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
7879
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
7880
7880
  "align": "right",
7881
7881
  "visibleOn": "${!isLookup}",
7882
7882
  "buttons": [
@@ -7921,7 +7921,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
7921
7921
  "icon": "fa fa-table-columns",
7922
7922
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
7923
7923
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
7924
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
7924
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
7925
7925
  "align": "right",
7926
7926
  "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
7927
7927
  "buttons": [
@@ -8114,7 +8114,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
8114
8114
  // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8115
8115
  // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8116
8116
  // "tooltipPlacement": "top",
8117
- // "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
8117
+ // "className": "bg-white p-2 rounded text-gray-500",
8118
8118
  // "label": "",
8119
8119
  // "icon": "fa fa-sync",
8120
8120
  // "visibleOn": "${!showFieldsFilter}",
@@ -8138,7 +8138,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
8138
8138
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8139
8139
  "tooltip":"",
8140
8140
  "tooltipPlacement": "top",
8141
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
8141
+ "className": "bg-white p-2 rounded text-gray-500"
8142
8142
  };
8143
8143
  }
8144
8144
  else {
@@ -8149,7 +8149,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
8149
8149
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8150
8150
  "tooltip":"",
8151
8151
  "tooltipPlacement": "top",
8152
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
8152
+ "className": "bg-white p-2 rounded text-gray-500"
8153
8153
  };
8154
8154
  }
8155
8155
  let toolbarFilter;
@@ -8171,7 +8171,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
8171
8171
  "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
8172
8172
  },
8173
8173
  "align": "right",
8174
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
8174
+ "className": "bg-white p-2 rounded text-gray-500",
8175
8175
  "onEvent": {
8176
8176
  "click": {
8177
8177
  "actions": [
@@ -8498,7 +8498,7 @@ async function getObjectCRUD(objectSchema, fields, options){
8498
8498
  const bodyProps = {
8499
8499
  // toolbar: getToolbar(),
8500
8500
  // headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
8501
- headerToolbarClassName: "px-4 py-2 border-gray-300 bg-gray-100 border-solid border-b",
8501
+ headerToolbarClassName: "px-4 py-2 border-b",
8502
8502
  footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
8503
8503
  ...options,
8504
8504
  disableStatistics: options.queryCount === false
@@ -9232,7 +9232,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
9232
9232
  amisSchema: {
9233
9233
  type: "service",
9234
9234
  id: componentId,
9235
- className: `steedos-record-related-list py-2 first:pt-0 border-b last:border-b-0 ${componentId} ${className}`,
9235
+ className: `steedos-record-related-list py-2 first:pt-0 border-b-0 last:border-b-0 ${componentId} ${className}`,
9236
9236
  data: {
9237
9237
  relatedKey: relatedKey,
9238
9238
  listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
@@ -9978,7 +9978,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
9978
9978
  };
9979
9979
  const content = {
9980
9980
  "type": "tabs",
9981
- "className": "steedos-record-tabs bg-white p-4 m-0 mt-2 border-y",
9981
+ "className": "steedos-record-tabs bg-white p-4 m-0 border-b",
9982
9982
  "contentClassName": "bg-none",
9983
9983
  "tabs": [
9984
9984
  detailed
@@ -10913,6 +10913,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
10913
10913
  }
10914
10914
  });
10915
10915
 
10916
+ let listviewFilter = getListViewFilter(listView);
10917
+ let listviewFiltersFunction = listView && listView._filters;
10918
+
10916
10919
  let sort = "";
10917
10920
  if(listView){
10918
10921
  sort = getListViewSort(listView);
@@ -10959,7 +10962,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
10959
10962
  Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
10960
10963
  }
10961
10964
  const selfData = JSON.parse(JSON.stringify(api.data.$self));
10962
- var filters = [];
10965
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
10963
10966
  var pageSize = api.data.pageSize || 10;
10964
10967
  var pageNo = api.data.pageNo || 1;
10965
10968
  var skip = (pageNo - 1) * pageSize;
@@ -11021,6 +11024,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
11021
11024
  }
11022
11025
 
11023
11026
  const inFilterForm = ${ctx.inFilterForm};
11027
+
11028
+ const listviewFiltersFunction = ${listviewFiltersFunction};
11029
+
11030
+ if(listviewFiltersFunction && !inFilterForm){
11031
+ const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
11032
+ if(_filters0 && _filters0.length){
11033
+ filters.push(_filters0);
11034
+ }
11035
+ }
11036
+
11024
11037
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
11025
11038
 
11026
11039
  if(filtersFunction && !inFilterForm){
@@ -11333,6 +11346,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
11333
11346
  const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
11334
11347
  let listView = getLookupListView(refObjectConfig);
11335
11348
 
11349
+ let listviewFilter = getListViewFilter(listView);
11350
+ let listviewFiltersFunction = listView && listView._filters;
11351
+
11336
11352
  let sort = "";
11337
11353
  if(listView){
11338
11354
  sort = getListViewSort(listView);
@@ -11362,7 +11378,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
11362
11378
  apiInfo.data['rfield'] = `\${object_name}`;
11363
11379
  // [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
11364
11380
  apiInfo.requestAdaptor = `
11365
- var filters = [];
11381
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
11366
11382
  var top = 200;
11367
11383
  if(api.data.$term){
11368
11384
  filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
@@ -11385,6 +11401,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
11385
11401
  }
11386
11402
 
11387
11403
  const inFilterForm = ${ctx.inFilterForm};
11404
+
11405
+ const listviewFiltersFunction = ${listviewFiltersFunction};
11406
+
11407
+ if(listviewFiltersFunction && !inFilterForm){
11408
+ const _filters0 = listviewFiltersFunction(filters, api.data.$);
11409
+ if(_filters0 && _filters0.length){
11410
+ filters.push(_filters0);
11411
+ }
11412
+ }
11413
+
11388
11414
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
11389
11415
 
11390
11416
  if(filtersFunction && !inFilterForm){