@oinone/kunlun-vue-admin-base 6.2.6 → 6.2.8

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.
@@ -1,5 +1,5 @@
1
1
  import { translateValueByKey, RuntimeContextServiceToken, ClientType, RuntimeContextManager, resolveView, createDefaultLayout, baseActionTokenSymbol, SubmitType, RelationUpdateType, QueryService, SubmitRelationValue, CommonPatternMap, SubmitHandler, parseConfigs, getRefreshParameters, translate, ViewActionCache, MultiTabsConfigManager, MultiTabsRuntimeManifestMergedConfigManager, MultiTabsRouter, executeViewAction, RedirectTargetEnum, ModelCache, getRealTtype, ROOT_HANDLE, buildQueryCondition, ActiveRecordsOperator, isRelationField, resolveDynamicExpression, resolveDynamicDomain, isM2MField, SubmitValue, ActiveRecordExtendKeys, getValidatorParameters, OioProvider, isRelatedField, SubmitCacheManager, SubmitRelationHandler, isStaticRelationField, getStaticRelationField, activeRecordsToJSONString, getRelationFieldKey, RequestHelper, isRelation2MField, FunctionMetadata, FunctionCache, FunctionService, initI18n, getDefaultBrowser, RefreshCallChainingScope, getCurrentThemeSize, ColSpanEnum, ViewCache, isRuntimeClientAction, PopupManager, EventKeys as EventKeys$1, genStaticPath, ConfigHelper, queryResourceDateTimeFormat, getLabelFieldList4query, ExpressionExecutor, ExperimentalConfigManager, UnsupportedOperationException, MemoryListSearchCache, isO2MField, GenericFunctionService, isRelation2OField, OioLoginLogoPosition, OioLoginThemeName, getCopyrightStatus, getLoginTheme, systemMajorConfig, CurrentLanguage, OINONE_HOMEPAGE_KEY, BASIC_CONFIG_KEY, getMajorConfig, Dialog, Drawer, MultiTabsManager, StaticMetadata, UpdateOneWithRelationsService, resolveDslDefinition, computeViewMode, isRuntimeViewAction, generatorViewActionQueryParameter, Popup as Popup$1, executeServerAction, ModuleCache, getUrlParamByKey, SideBarThemeColor, SideBarTheme, MultiTabTheme, registerPopupConstructor, MultiTabType, $systemMajorConfig, getReloadMainViewParameters, formateLanguage, useLanguage, FrameworkInitializeSPI, registryLanguage, LanguageType, frameworkFactory, MetadataHelper, FunctionType } from '@oinone/kunlun-engine';
2
- import { MessageHub, ILevel, Condition, DefaultComparisonOperator as DefaultComparisonOperator$1, GQL, HttpClient, gql, isFirstResetPasswordError, useMessageHub, isPicCodeError, SystemErrorCode, RequestErrorInterceptor, useSessionPath, isNotPermission, setSessionPath, HttpClientHookToken, getSessionPath } from '@oinone/kunlun-request';
2
+ import { MessageHub, ILevel, Condition, GQL, HttpClient, gql, DefaultComparisonOperator as DefaultComparisonOperator$1, isFirstResetPasswordError, useMessageHub, isPicCodeError, SystemErrorCode, RequestErrorInterceptor, useSessionPath, isNotPermission, setSessionPath, HttpClientHookToken, getSessionPath } from '@oinone/kunlun-request';
3
3
  import { OioNotification, NotificationType, OioFormItem, PropRecordHelper, PageSizeEnum as PageSizeEnum$1, ListPaginationStyle, ListSelectMode, OioMessage, OioButton, OioModal, OioUpload, OioEmpty as OioEmpty$1, OioIcon as OioIcon$1, downloadFile, OioCheckbox, OioInputSearch, OioEmptyData, ButtonType, ConfirmType, PopconfirmPlacement as PopconfirmPlacement$1, OioPopconfirm, StringHelper as StringHelper$1, OioForm, StyleHelper as StyleHelper$1, OioBlock, OioBlockProps, useOioFormLayoutContext, OioCol, OioColProps, FlexColMode, FlexDirection as FlexDirection$1, OioRow, OioRowProps, OioCollapse, OioBaseContainerProps, OioCollapseType, OioCollapseMethod, OioCollapseExpandIconPosition, CastHelper as CastHelper$1, OioGroup, OioTabs, OioTabPosition, OioTabAlign, onTabInvisibleChange, DEFAULT_TAB_TITLE, BooleanHelper as BooleanHelper$1, useTabBar, OioSpin, OioSpinProps, useInjectOioFormContext, useProviderOioFormContext, OioDrawer, OioInnerPopup, SelectMode, WidgetTrigger as WidgetTrigger$1, EmptyStyle, OioTreeSelect, defaultCascaderProperties, OioCascader, CascaderCheckedStrategy, defaultLabelsSeparator, OioInputNumber, NumberHelper as NumberHelper$1, OioSwitch, OioSlider, SliderDirection, OioInput, OioSelect, InputType as InputType$1, OioTooltip, OioInputPassword, OioTextarea, OioDateTimePicker, OioDatePicker, OioTimePicker, OioYearPicker, OioDateRangePicker, OioDateTimeRangePicker, OioTimeRangePicker, OioYearRangePicker, defaultSelectProperties, OioTooltipHelp, OioTree, OioPagination, OioFormProps as OioFormProps$1, DEFAULT_COLS as DEFAULT_COLS$1, FormLayout as FormLayout$1, ValidateTrigger as ValidateTrigger$1, IconPlacement, OioTab, VIDEO_SUFFIX_LIST as VIDEO_SUFFIX_LIST$1, OioInputGroup, OioDropdown, OioDropdownProps, debugConsole as debugConsole$1, createEasyExportTask, getExportWorkBook, OioDropdownPlacement, OioDivider, uniqueKeyGenerator as uniqueKeyGenerator$1, useClick, DEFAULT_CARD_GUTTERS as DEFAULT_CARD_GUTTERS$1, FlexRowJustify as FlexRowJustify$1, OioGallery, getEasyImportTemplate as getEasyImportTemplate$1 } from '@oinone/kunlun-vue-ui-antd';
4
4
  import { get, isNil, isString as isString$1, isPlainObject, toString, isEmpty, toNumber, isBoolean, isFunction as isFunction$2, cloneDeep, set, isObject as isObject$2, ceil, toInteger, isArray as isArray$3, isNaN as isNaN$1, isNumber, isDate, omitBy, isEqual as isEqual$1, debounce, remove, range, delay, find, trim } from 'lodash-es';
5
5
  import { ViewType, ViewClientType, EnumOptionState, ModelFieldType, ViewMode, isValidateEmpty, isEmptyValue, ViewActionTarget, ActionContextType, ModelType, isComplexTtype, SYSTEM_MODULE_NAME, UserBehaviorEventEnum, isNumberTtype, isStringTtype, SystemSource, RuntimeConfig, deepClone, isEmptyKeObject, ActionType, isRelationTtype, GlobalConfig, ModelDefaultActionName, MetadataFragment, SYSTEM_MODULE, PluginsLoader, ModelFieldTypeDisplayName } from '@oinone/kunlun-meta';
@@ -4509,7 +4509,7 @@ class BaseElementListViewWidget extends BaseElementViewWidget {
4509
4509
  if (this.usingSearchCondition || !this.isDataSourceProvider) {
4510
4510
  // 前端搜索
4511
4511
  if (searchCondition) {
4512
- dataSource = RsqlFilterExecutor.filter(dataSource, searchCondition);
4512
+ dataSource = dataSource.filter((v) => RSQLHelper.compute(searchCondition, v));
4513
4513
  }
4514
4514
  }
4515
4515
  if (!this.isDataSourceProvider) {
@@ -4714,7 +4714,7 @@ class BaseElementListViewWidget extends BaseElementViewWidget {
4714
4714
  }
4715
4715
  if (record) {
4716
4716
  if (searchCondition) {
4717
- if (RsqlFilterExecutor.filter([record], searchCondition).length) {
4717
+ if (RSQLHelper.compute(searchCondition, record)) {
4718
4718
  dataSource.push(record);
4719
4719
  }
4720
4720
  else {
@@ -4978,10 +4978,10 @@ class BaseElementListViewWidget extends BaseElementViewWidget {
4978
4978
  if (!rsql || rsql === DEFAULT_LIST_TRUE_CONDITION) {
4979
4979
  return undefined;
4980
4980
  }
4981
- const searchCondition = RSQLHelper.parse({
4981
+ const searchCondition = RSQLHelper.parseRSQL(rsql, {
4982
4982
  model: this.model.model,
4983
- fields: CastHelper.cast((_a = this.seekSearchRuntimeContext()) === null || _a === void 0 ? void 0 : _a.model.modelFields)
4984
- }, rsql);
4983
+ fields: (((_a = this.seekSearchRuntimeContext()) === null || _a === void 0 ? void 0 : _a.model.modelFields) || [])
4984
+ });
4985
4985
  if (!searchCondition) {
4986
4986
  return undefined;
4987
4987
  }
@@ -5398,185 +5398,7 @@ __decorate([
5398
5398
  __metadata("design:type", Function),
5399
5399
  __metadata("design:paramtypes", [Condition]),
5400
5400
  __metadata("design:returntype", Promise)
5401
- ], BaseElementListViewWidget.prototype, "refreshProcess", null);
5402
- class RsqlFilterExecutor {
5403
- static filter(list, root) {
5404
- return this.rsqlNodeToCondition(list, root);
5405
- }
5406
- static rsqlNodeToCondition(list, root) {
5407
- const { children } = root;
5408
- const realChildren = children.filter((child) => { var _a; return (child.children && child.children.length) || ((_a = child.value) === null || _a === void 0 ? void 0 : _a.field); });
5409
- /**
5410
- * 将rsql node tree 转换成正确的数据格式,格式如下。
5411
- *
5412
- * [
5413
- * {
5414
- * code: {
5415
- * value: '110',
5416
- * ttype: 'STRING'
5417
- * operator: '=like='
5418
- * },
5419
- * },
5420
- * {
5421
- * writeDate: {
5422
- * value: '2023-02-28 10:51:04',
5423
- * ttype: 'DATETIME'
5424
- * operator: '=lt='
5425
- * }
5426
- * },
5427
- * {
5428
- * writeDate: {
5429
- * value: '2023-02-28 09:51:04',
5430
- * ttype: 'DATETIME'
5431
- * operator: '=gt='
5432
- * }
5433
- * }
5434
- * ]
5435
- */
5436
- const arr = [];
5437
- realChildren.forEach((child) => {
5438
- var _a, _b;
5439
- if (child.children.length === 0) {
5440
- const { selector, operator, field, args } = child.value;
5441
- /**
5442
- * {value: xxx, operator: 'xxx', ttype: xxx}
5443
- */
5444
- const result = this.buildRsqlToObjectItem({
5445
- value: args[0],
5446
- operator: operator.symbol,
5447
- ttype: field ? field.ttype : null
5448
- });
5449
- arr.push({
5450
- [selector]: result
5451
- });
5452
- }
5453
- else if (((_a = child.value) === null || _a === void 0 ? void 0 : _a.type) === 1) {
5454
- // 如果 type === 1 , 那么是 `or` 的查询条件
5455
- const selector = (_b = child.children[0].value) === null || _b === void 0 ? void 0 : _b.selector;
5456
- /**
5457
- * [{value: xxx, operator: 'xxx', ttype: xxx}, {value: xxx, operator: 'xxx', ttype: xxx}]
5458
- */
5459
- const list = child.children.map((c) => {
5460
- const { operator, field, args } = c.value;
5461
- return this.buildRsqlToObjectItem({
5462
- value: args[0],
5463
- operator: operator.symbol,
5464
- ttype: field ? field.ttype : null
5465
- });
5466
- });
5467
- arr.push({
5468
- [selector]: list
5469
- });
5470
- }
5471
- });
5472
- return this.getFilterResultWithConditionArr(list, arr);
5473
- }
5474
- static buildRsqlToObjectItem({ value, operator, ttype }) {
5475
- return {
5476
- value: this.getValueByTType(value, ttype),
5477
- operator,
5478
- ttype
5479
- };
5480
- }
5481
- static getFilterResultWithConditionArr(list, arr) {
5482
- const filterArr = [];
5483
- arr.forEach((obj) => {
5484
- Object.keys(obj).forEach((key) => {
5485
- filterArr.push((dataSourceItem) => {
5486
- const conditionObject = obj[key];
5487
- /**
5488
- * 如果当前条件是数组,那么是 `or` 查询
5489
- */
5490
- if (Array.isArray(conditionObject)) {
5491
- const [k, relationK] = key.split('.');
5492
- const itemValue = get(dataSourceItem, k, []).map((v) => v[relationK]);
5493
- return itemValue === null ? false : conditionObject.some((v) => this.executeOperator(v, itemValue));
5494
- }
5495
- let itemValue = null;
5496
- if ([ModelFieldType.ManyToMany, ModelFieldType.OneToMany].includes(conditionObject.ttype)) {
5497
- const [k, relationK] = key.split('.');
5498
- itemValue = get(dataSourceItem, k, []).map((v) => v[relationK]);
5499
- }
5500
- else {
5501
- itemValue = get(dataSourceItem, key, null);
5502
- }
5503
- return this.executeOperator(conditionObject, itemValue);
5504
- });
5505
- });
5506
- });
5507
- return filterArr.reduce((pre, next) => {
5508
- return pre === null || pre === void 0 ? void 0 : pre.filter(next);
5509
- }, list);
5510
- }
5511
- /**
5512
- * 通过 `条件` + `table每一行`,执行对应的操作
5513
- */
5514
- static executeOperator(obj, dataSourceItem) {
5515
- if (dataSourceItem === null) {
5516
- return false;
5517
- }
5518
- const realValue = this.getValueByTType(dataSourceItem, obj.ttype);
5519
- if (obj.operator === DefaultComparisonOperator$1.GREATER_THAN) {
5520
- return realValue > obj.value;
5521
- }
5522
- if (obj.operator === DefaultComparisonOperator$1.GREATER_THAN_OR_EQUAL) {
5523
- return realValue >= obj.value;
5524
- }
5525
- if (obj.operator === DefaultComparisonOperator$1.LESS_THAN) {
5526
- return realValue < obj.value;
5527
- }
5528
- if (obj.operator === DefaultComparisonOperator$1.LESS_THAN_OR_EQUAL) {
5529
- return realValue < obj.value;
5530
- }
5531
- if ([ModelFieldType.ManyToMany, ModelFieldType.OneToMany].includes(obj.ttype)) {
5532
- return realValue.includes(obj.value);
5533
- }
5534
- if (obj.operator === DefaultComparisonOperator$1.LIKE) {
5535
- return realValue.indexOf(obj.value) > -1;
5536
- }
5537
- if (obj.operator === DefaultComparisonOperator$1.NOT_LIKE) {
5538
- return realValue.indexOf(obj.value) === -1;
5539
- }
5540
- if (obj.operator === DefaultComparisonOperator$1.STARTS) {
5541
- return realValue.startsWith(obj.value);
5542
- }
5543
- if (obj.operator === DefaultComparisonOperator$1.NOT_STARTS) {
5544
- return !realValue.startsWith(obj.value);
5545
- }
5546
- if (obj.operator === DefaultComparisonOperator$1.ENDS) {
5547
- return realValue.endsWith(obj.value);
5548
- }
5549
- if (obj.operator === DefaultComparisonOperator$1.NOT_ENDS) {
5550
- return !realValue.endsWith(obj.value);
5551
- }
5552
- if (obj.operator === DefaultComparisonOperator$1.IS_NULL) {
5553
- return realValue === null;
5554
- }
5555
- if (obj.operator === DefaultComparisonOperator$1.NOT_NULL) {
5556
- return realValue !== null;
5557
- }
5558
- if (obj.operator === DefaultComparisonOperator$1.EQUAL) {
5559
- return realValue === obj.value;
5560
- }
5561
- if (obj.operator === DefaultComparisonOperator$1.NOT_EQUAL) {
5562
- return realValue !== obj.value;
5563
- }
5564
- throw new TypeError(`搜索失败,不支持${obj.operator}搜索`);
5565
- }
5566
- /**
5567
- * 根据 ttype,将value变成正确的值
5568
- * 时间类型,就要转成时间戳
5569
- */
5570
- static getValueByTType(value, ttype) {
5571
- switch (ttype) {
5572
- case ModelFieldType.Date:
5573
- case ModelFieldType.DateTime:
5574
- return new Date(value).getTime();
5575
- default:
5576
- return value;
5577
- }
5578
- }
5579
- }
5401
+ ], BaseElementListViewWidget.prototype, "refreshProcess", null);
5580
5402
 
5581
5403
  class BaseElementObjectViewWidget extends BaseElementViewWidget {
5582
5404
  constructor() {
@@ -84069,7 +83891,10 @@ function render$d(_ctx, _cache, $props, $setup, $data, $options) {
84069
83891
  createElementVNode("div", _hoisted_22$4, [
84070
83892
  (record.state === _ctx.AppState.INSTALLED)
84071
83893
  ? (openBlock(), createElementBlock("div", _hoisted_23$4, toDisplayString(_ctx.translateValueByKey('已安装')), 1 /* TEXT */))
84072
- : (!record.state || record.state === _ctx.AppState.UNINSTALLED)
83894
+ : (
83895
+ (!record.state || record.state === _ctx.AppState.UNINSTALLED) &&
83896
+ _ctx.actionPermission.hasCreateAppAction
83897
+ )
84073
83898
  ? (openBlock(), createElementBlock("div", _hoisted_24$3, [
84074
83899
  createElementVNode("span", {
84075
83900
  class: "install-action-font",
@@ -84246,8 +84071,8 @@ let AppsGalleryWidget = class AppsGalleryWidget extends BaseElementListViewWidge
84246
84071
  return {
84247
84072
  hasCreateAppAction: !!CreateAppAction && !this.executeInvisibleExpress(CreateAppAction.invisible),
84248
84073
  hasUpdateAppAction: !!UpdateAppAction && !this.executeInvisibleExpress(UpdateAppAction.invisible),
84249
- hasUninstallAction: !!UninstallAction && !this.executeInvisibleExpress(UninstallAction.invisible),
84250
- hasInstallAction: !!InstallAction && !this.executeInvisibleExpress(InstallAction.invisible),
84074
+ hasUninstallAction: !!UninstallAction,
84075
+ hasInstallAction: !!InstallAction,
84251
84076
  hasBindHomepageAction: !!BindHomepageAction && !this.executeInvisibleExpress(BindHomepageAction.invisible),
84252
84077
  hasDetailAction: !!DetailAction && !this.executeInvisibleExpress(DetailAction.invisible),
84253
84078
  hasLikeAction: !!LikeAction && !this.executeInvisibleExpress(LikeAction.invisible),