@oinone/kunlun-vue-admin-base 6.2.7 → 6.2.9

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() {
@@ -63390,9 +63212,13 @@ let TableBooleanSelectFieldWidget = class TableBooleanSelectFieldWidget extends
63390
63212
  }
63391
63213
  renderDefaultSlot(context) {
63392
63214
  const value = this.compute(context);
63215
+ let stringValue;
63216
+ if (value != null) {
63217
+ stringValue = toString(value);
63218
+ }
63393
63219
  return [
63394
63220
  createVNode(script$1F, {
63395
- value,
63221
+ value: stringValue,
63396
63222
  currentValue: this.handleValue(value),
63397
63223
  options: this.options,
63398
63224
  optionColor: this.optionColor,
@@ -63445,7 +63271,7 @@ TableBooleanSelectFieldWidget = __decorate([
63445
63271
  SPI.ClassFactory(BaseFieldWidget.Token({
63446
63272
  viewType: ViewType.Table,
63447
63273
  ttype: ModelFieldType.Boolean,
63448
- widget: ['Select', 'radio']
63274
+ widget: ['Select', 'Radio']
63449
63275
  }))
63450
63276
  ], TableBooleanSelectFieldWidget);
63451
63277
  /**
@@ -64213,6 +64039,24 @@ let TableYearFieldWidget = class TableYearFieldWidget extends TableDateTimeField
64213
64039
  this.hasDateFormat = false;
64214
64040
  this.hasTimeFormat = false;
64215
64041
  }
64042
+ renderDefaultSlot(context) {
64043
+ const value = this.compute(context);
64044
+ let cv;
64045
+ if (isNil(value)) {
64046
+ cv = '';
64047
+ }
64048
+ else {
64049
+ let format = DateUtil.fetchDatetimeFormat({ hasDateFormat: this.hasDateFormat, hasTimeFormat: this.hasTimeFormat }, this.format, this.getDateFormat(context), this.getTimeFormat(context), this.convertFormat, this.convertDateFormat, this.convertTimeFormat);
64050
+ if (!format) {
64051
+ format = this.defaultFormat;
64052
+ }
64053
+ const datetimeFormatValue = DateUtil.dateFormat(DateUtil.toDate(value, this.valueFormat), format);
64054
+ if (datetimeFormatValue) {
64055
+ cv = datetimeFormatValue;
64056
+ }
64057
+ }
64058
+ return cv;
64059
+ }
64216
64060
  get defaultFormat() {
64217
64061
  return defaultYearFormat;
64218
64062
  }
@@ -64220,6 +64064,12 @@ let TableYearFieldWidget = class TableYearFieldWidget extends TableDateTimeField
64220
64064
  return defaultYearValueFormat;
64221
64065
  }
64222
64066
  };
64067
+ __decorate([
64068
+ Widget.Method(),
64069
+ __metadata("design:type", Function),
64070
+ __metadata("design:paramtypes", [Object]),
64071
+ __metadata("design:returntype", void 0)
64072
+ ], TableYearFieldWidget.prototype, "renderDefaultSlot", null);
64223
64073
  TableYearFieldWidget = __decorate([
64224
64074
  SPI.ClassFactory(BaseFieldWidget.Token({
64225
64075
  viewType: ViewType.Table,
@@ -65076,7 +64926,6 @@ TableStringUploadWidget = __decorate([
65076
64926
  SPI.ClassFactory(BaseFieldWidget.Token({
65077
64927
  viewType: ViewType.Table,
65078
64928
  ttype: [ModelFieldType.String, ModelFieldType.Text],
65079
- multi: false,
65080
64929
  widget: 'Upload'
65081
64930
  }))
65082
64931
  ], TableStringUploadWidget);
@@ -65164,8 +65013,8 @@ __decorate([
65164
65013
  TableStringUploadImageFieldWidget = __decorate([
65165
65014
  SPI.ClassFactory(BaseFieldWidget.Token({
65166
65015
  viewType: ViewType.Table,
65167
- widget: 'UploadImg',
65168
- ttype: [ModelFieldType.String, ModelFieldType.Text]
65016
+ ttype: [ModelFieldType.String, ModelFieldType.Text],
65017
+ widget: 'UploadImg'
65169
65018
  }))
65170
65019
  ], TableStringUploadImageFieldWidget);
65171
65020
  /**
@@ -68708,12 +68557,14 @@ let TableWidget = class TableWidget extends BaseTableWidget {
68708
68557
  return this;
68709
68558
  }
68710
68559
  get cellWidth() {
68560
+ // fixme @zbh 20250723 请使用语义明确的dsl属性名称
68711
68561
  const { autoColumnWidth } = this.getDsl();
68712
68562
  if (autoColumnWidth) {
68713
68563
  return 'auto';
68714
68564
  }
68715
68565
  }
68716
68566
  get cellMinWidth() {
68567
+ // fixme @zbh 20250723 请使用语义明确的dsl属性名称
68717
68568
  const { minFieldWidth } = this.getDsl();
68718
68569
  if (minFieldWidth) {
68719
68570
  return StyleHelper$1.px(minFieldWidth);
@@ -68749,7 +68600,9 @@ let TableWidget = class TableWidget extends BaseTableWidget {
68749
68600
  * 表格行高是否自适应,默认开启
68750
68601
  */
68751
68602
  get autoLineHeight() {
68752
- const autoLineHeight = Optional.ofNullable(this.getDsl().autoLineHeight).map(BooleanHelper.toBoolean).orElse(true);
68603
+ const autoLineHeight = Optional.ofNullable(this.getDsl().autoLineHeight)
68604
+ .map(BooleanHelper.toBoolean)
68605
+ .orElse(undefined);
68753
68606
  if (typeof autoLineHeight === 'boolean') {
68754
68607
  return autoLineHeight;
68755
68608
  }
@@ -84069,7 +83922,10 @@ function render$d(_ctx, _cache, $props, $setup, $data, $options) {
84069
83922
  createElementVNode("div", _hoisted_22$4, [
84070
83923
  (record.state === _ctx.AppState.INSTALLED)
84071
83924
  ? (openBlock(), createElementBlock("div", _hoisted_23$4, toDisplayString(_ctx.translateValueByKey('已安装')), 1 /* TEXT */))
84072
- : (!record.state || record.state === _ctx.AppState.UNINSTALLED)
83925
+ : (
83926
+ (!record.state || record.state === _ctx.AppState.UNINSTALLED) &&
83927
+ _ctx.actionPermission.hasCreateAppAction
83928
+ )
84073
83929
  ? (openBlock(), createElementBlock("div", _hoisted_24$3, [
84074
83930
  createElementVNode("span", {
84075
83931
  class: "install-action-font",
@@ -84246,8 +84102,8 @@ let AppsGalleryWidget = class AppsGalleryWidget extends BaseElementListViewWidge
84246
84102
  return {
84247
84103
  hasCreateAppAction: !!CreateAppAction && !this.executeInvisibleExpress(CreateAppAction.invisible),
84248
84104
  hasUpdateAppAction: !!UpdateAppAction && !this.executeInvisibleExpress(UpdateAppAction.invisible),
84249
- hasUninstallAction: !!UninstallAction && !this.executeInvisibleExpress(UninstallAction.invisible),
84250
- hasInstallAction: !!InstallAction && !this.executeInvisibleExpress(InstallAction.invisible),
84105
+ hasUninstallAction: !!UninstallAction,
84106
+ hasInstallAction: !!InstallAction,
84251
84107
  hasBindHomepageAction: !!BindHomepageAction && !this.executeInvisibleExpress(BindHomepageAction.invisible),
84252
84108
  hasDetailAction: !!DetailAction && !this.executeInvisibleExpress(DetailAction.invisible),
84253
84109
  hasLikeAction: !!LikeAction && !this.executeInvisibleExpress(LikeAction.invisible),