@complex-suite/data
Advanced tools
| import type { LocalePack } from '@complex-suite/utils' | ||
| import type { DataMessages } from './zh' | ||
| /** data 包英文消息 */ | ||
| export const enMessages: DataMessages = { | ||
| 'search.menu.search': 'Search', | ||
| 'search.menu.reset': 'Reset', | ||
| 'search.menu.refresh': 'Refresh', | ||
| 'search.menu.build': 'Add', | ||
| 'search.menu.delete': 'Delete', | ||
| 'search.menu.info': 'Detail', | ||
| 'search.menu.import': 'Import', | ||
| 'search.menu.export': 'Export', | ||
| 'search.error.menuNotFound': (params) => `Menu type "${ | ||
| params.menuName | ||
| }" is not configured in config, menu generation failed!`, | ||
| 'update.notDefined': 'Update function is not defined!', | ||
| 'track.noPoints': 'No track points available, cannot generate track!', | ||
| 'track.insufficientPoints': (params) => | ||
| `Track generation requires at least ${params.minSize} points, current points: ${params.size}, cannot generate track!`, | ||
| 'dictionary.order.beforeNotFound': (params) => | ||
| `Failed to find reference "${params.beforeProp}" for "${params.prop}" in sort order!`, | ||
| 'dictionary.order.afterNotFound': (params) => | ||
| `Failed to find reference "${params.afterProp}" for "${params.prop}" in sort order!`, | ||
| 'dictionary.order.noParam': (params) => | ||
| `No sort parameter specified for "${params.prop}"!`, | ||
| 'dictionary.order.notInPageList': (params) => | ||
| `"${params.prop}" does not exist in PageList!`, | ||
| 'dictionary.order.notInObserveList': (params) => | ||
| `"${params.prop}" does not exist in ObserveList!`, | ||
| 'reset.actionNotFound': (params) => | ||
| `Action "${params.action}" does not exist in from "${params.from}"! Available actions: ${params.actions}`, | ||
| 'reset.fromNotFound': (params) => | ||
| `from "${params.from}" does not exist in resetOption!`, | ||
| 'storage.duplicateModule': (params) => | ||
| `Local storage error: module "${params.prop}" already exists, do not add again!`, | ||
| 'simpleData.extraDataError': 'Extra data initialization failed, extra data init option must be an object!', | ||
| 'defaultData.triggerCreateNoEnv': '$triggerCreate function requires an env parameter', | ||
| 'complexData.updateNotDefined': '$updateData is not defined', | ||
| 'complexData.buildNotDefined': '$buildData is not defined', | ||
| 'complexData.changeNotDefined': '$changeData is not defined', | ||
| 'complexData.editNotDefined': '$editData is not defined', | ||
| 'complexData.deleteNotDefined': '$deleteData is not defined', | ||
| 'complexData.refreshNotDefined': '$refreshData is not defined', | ||
| 'complexData.multipleDeleteNotDefined': '$multipleDeleteData is not defined', | ||
| 'complexData.exportNotDefined': '$exportData is not defined', | ||
| 'complexData.importNotDefined': '$importData is not defined', | ||
| 'complexData.promiseNoUpdateData': (params) => | ||
| `Promise module has no update data (update status: ${params.status})`, | ||
| 'statusData.noInitList': 'Initialization list is not set!', | ||
| 'statusData.loadValueNotExist': (params) => | ||
| `Current load value "${params.value}" does not exist`, | ||
| 'baseData.methodNoPromise': (params) => | ||
| `${params.method} did not return a Promise, $triggerMethodWithStatus failed!`, | ||
| 'baseData.methodNotFunction': (params) => | ||
| `${params.method} is not a function, $triggerMethodWithStatus failed!`, | ||
| 'baseData.methodNotExist': (params) => | ||
| `${params.method} does not exist, $triggerMethodWithStatus failed!`, | ||
| 'baseData.methodInvalidType': (params) => | ||
| `method parameter accepts string, current value is ${params.method}, $triggerMethodWithStatus failed!`, | ||
| 'baseData.statusStrictCheck': (params) => | ||
| `Current ${params.status} status is: ${params.current}, $triggerMethodWithStatus is not allowed to be triggered under strict check!`, | ||
| 'baseData.statusNotExist': (params) => | ||
| `${params.status} status does not exist, $triggerMethodWithStatus failed!`, | ||
| 'baseData.getDataNotDefined': '$getData is not defined', | ||
| 'baseData.promiseNoLoadData': (params) => | ||
| `Promise module has no load data (load status: ${params.status})`, | ||
| 'placeholder.input': (params) => `Please enter ${params.name}`, | ||
| 'placeholder.select': (params) => `Please select ${params.name}`, | ||
| 'placeholder.upload': (params) => `Please upload ${params.name}`, | ||
| 'list.menu.build': 'Add', | ||
| 'list.menu.delete': 'Delete', | ||
| 'dateRange.ruleMessage': 'Please select start and end time correctly', | ||
| 'dateRange.startPlaceholder': 'Start date', | ||
| 'dateRange.endPlaceholder': 'End date', | ||
| 'dictionary.modEditTypeNotExist': (params) => | ||
| `Mod init error: edit type "${params.type}" does not exist, please create DefaultMod instance manually if needed!`, | ||
| 'dictionary.modFormatTypeNotExist': (params) => | ||
| `Mod init error: format type "${params.format}" does not exist, please create DefaultMod instance manually if needed!`, | ||
| 'dictionary.simpleModeNoAssign': 'Current edit is in simple mode, assign function is not accepted!', | ||
| 'dictionary.listEditDataNotArray': (params) => | ||
| `Module "${params.type}" is of ListEdit type, but the data is not an array, please check the input data!`, | ||
| 'form.clearValidateNotDefined': 'clearValidate function is not defined', | ||
| 'form.validateNotDefined': 'validate function is not defined' | ||
| } | ||
| const en: LocalePack<DataMessages> = { | ||
| lang: 'en-US', | ||
| messages: enMessages | ||
| } | ||
| export default en |
| import { Locale } from '@complex-suite/utils' | ||
| import zh from './zh' | ||
| import type { DataMessages } from './zh' | ||
| /** | ||
| * data 包的 dataLocale 单例(以 DataMessages 为类型基准,zh 包直接传入构造函数完成注册+设置)。 | ||
| * data 包内部各模块可直接使用此单例。 | ||
| * | ||
| * 【语言包按需加载/注册】构造时默认仅注册中文包。 | ||
| * 英文包 en 作为独立子路径导出(./locale/en),主入口不加载它,避免无谓的模块求值开销。 | ||
| * 需要英文时显式导入并注册: | ||
| * import en from '@complex-suite/data/locale/en' | ||
| * dataLocale.registerLocale(en) | ||
| */ | ||
| const dataLocale = new Locale<DataMessages>({ pack: zh, name: 'data' }) | ||
| export { | ||
| dataLocale, | ||
| zh | ||
| } | ||
| export type { | ||
| DataMessages | ||
| } |
| import type { LocalePack } from '@complex-suite/utils' | ||
| /** | ||
| * data 包中文消息(铺平格式,key 使用 dot-notation)。 | ||
| * 本文件是 data 包消息 schema 的【唯一类型来源】。 | ||
| */ | ||
| export const zhMessages = { | ||
| 'search.menu.search': '查询', | ||
| 'search.menu.reset': '重置', | ||
| 'search.menu.refresh': '刷新', | ||
| 'search.menu.build': '新增', | ||
| 'search.menu.delete': '删除', | ||
| 'search.menu.info': '详情', | ||
| 'search.menu.import': '导入', | ||
| 'search.menu.export': '导出', | ||
| 'search.error.menuNotFound': (params: { menuName: string }) => `${params.menuName}对应的menu类型未在config中配置,菜单生成失败!`, | ||
| 'update.notDefined': '触发更新函数未定义!', | ||
| 'track.noPoints': '当前无轨迹点,无法生成轨迹!', | ||
| 'track.insufficientPoints': (params: { minSize: number, size: number }) => `轨迹生成至少需要${params.minSize}个点,当前轨迹点仅为${params.size}个,无法生成轨迹!`, | ||
| 'dictionary.order.beforeNotFound': (params: { prop: string, beforeProp: string }) => `${params.prop}在排序中查找对标${params.beforeProp}失败!`, | ||
| 'dictionary.order.afterNotFound': (params: { prop: string, afterProp: string }) => `${params.prop}在排序中查找对标${params.afterProp}失败!`, | ||
| 'dictionary.order.noParam': (params: { prop: string }) => `${params.prop}排序未指定变化参数!`, | ||
| 'dictionary.order.notInPageList': (params: { prop: string }) => `${params.prop}在PageList中不存在!`, | ||
| 'dictionary.order.notInObserveList': (params: { prop: string }) => `${params.prop}在ObserveList中不存在!`, | ||
| 'reset.actionNotFound': (params: { from: string, action: string, actions: string }) => `resetOption中from:${params.from}中不存在action:${params.action}!存在的action如下:${params.actions}`, | ||
| 'reset.fromNotFound': (params: { from: string }) => `resetOption中不存在from:${params.from}!`, | ||
| 'storage.duplicateModule': (params: { prop: string }) => `本地存储报错:模块${params.prop}已存在,请勿重复添加!`, | ||
| 'simpleData.extraDataError': '初始化额外数据出错,额外数据初始化参数必须为对象!', | ||
| 'defaultData.triggerCreateNoEnv': '$triggerCreate函数需要传递env参数', | ||
| 'complexData.updateNotDefined': '$updateData未定义', | ||
| 'complexData.buildNotDefined': '$buildData未定义', | ||
| 'complexData.changeNotDefined': '$changeData未定义', | ||
| 'complexData.editNotDefined': '$editData未定义', | ||
| 'complexData.deleteNotDefined': '$deleteData未定义', | ||
| 'complexData.refreshNotDefined': '$refreshData未定义', | ||
| 'complexData.multipleDeleteNotDefined': '$multipleDeleteData未定义', | ||
| 'complexData.exportNotDefined': '$exportData未定义', | ||
| 'complexData.importNotDefined': '$importData未定义', | ||
| 'complexData.promiseNoUpdateData': (params: { status: string }) => `promise模块无update数据(update状态:${params.status})`, | ||
| 'statusData.noInitList': '未设置初始化列表!', | ||
| 'statusData.loadValueNotExist': (params: { value: string }) => `当前加载判断值${params.value}不存在`, | ||
| 'baseData.methodNoPromise': (params: { method: string }) => `${params.method}未返回Promise,$triggerMethodWithStatus函数触发失败!`, | ||
| 'baseData.methodNotFunction': (params: { method: string }) => `${params.method}不是函数,$triggerMethodWithStatus函数触发失败!`, | ||
| 'baseData.methodNotExist': (params: { method: string }) => `${params.method}不存在,$triggerMethodWithStatus函数触发失败!`, | ||
| 'baseData.methodInvalidType': (params: { method: string }) => `method参数接受string,当前值为${params.method},$triggerMethodWithStatus函数触发失败!`, | ||
| 'baseData.statusStrictCheck': (params: { status: string, current: string }) => `当前${params.status}状态为:${params.current},$triggerMethodWithStatus函数在严格校验下不允许被触发!`, | ||
| 'baseData.statusNotExist': (params: { status: string }) => `${params.status}状态不存在,$triggerMethodWithStatus函数失败!`, | ||
| 'baseData.getDataNotDefined': '$getData未定义', | ||
| 'baseData.promiseNoLoadData': (params: { status: string }) => `promise模块无load数据(load状态:${params.status})`, | ||
| 'placeholder.input': (params: { name: string }) => `请输入${params.name}`, | ||
| 'placeholder.select': (params: { name: string }) => `请选择${params.name}`, | ||
| 'placeholder.upload': (params: { name: string }) => `请上传${params.name}`, | ||
| 'list.menu.build': '新增', | ||
| 'list.menu.delete': '删除', | ||
| 'dateRange.ruleMessage': '请正确选择开始结束时间', | ||
| 'dateRange.startPlaceholder': '开始日期', | ||
| 'dateRange.endPlaceholder': '结束日期', | ||
| 'dictionary.modEditTypeNotExist': (params: { type: string }) => `mod初始化错误,不存在${params.type}的编辑类型,如需特殊构建请自行生成DefaultMod实例!`, | ||
| 'dictionary.modFormatTypeNotExist': (params: { format: string }) => `mod初始化错误,不存在${params.format}的格式化类型,如需特殊构建请自行生成DefaultMod实例!`, | ||
| 'dictionary.simpleModeNoAssign': '当前编辑为简单模式,不接受assign函数!', | ||
| 'dictionary.listEditDataNotArray': (params: { type: string }) => `模块${params.type}为ListEdit类型,但传入数据为非数组类型,请检查传入数据!`, | ||
| 'form.clearValidateNotDefined': '未定义clearValidate函数', | ||
| 'form.validateNotDefined': '未定义validate函数' | ||
| } | ||
| /** data 包消息 schema 类型,基于 zhMessages 推导 */ | ||
| export type DataMessages = typeof zhMessages | ||
| const zh: LocalePack<DataMessages> = { | ||
| lang: 'zh-CN', | ||
| messages: zhMessages | ||
| } | ||
| export default zh |
+1
-0
| import { setComplexProp, setProp } from "@complex-suite/utils" | ||
| import "./src/locale" // 确保 locale 实例在包加载时初始化 | ||
@@ -3,0 +4,0 @@ const dataConfig = { |
+3
-1
@@ -64,2 +64,3 @@ import ComplexInfo, { type ComplexInfoInitOption } from './src/core/ComplexInfo' | ||
| import dataConfig from './dataConfig' | ||
| import { dataLocale } from './src/locale' | ||
@@ -325,3 +326,4 @@ import type { | ||
| dataConfig | ||
| dataConfig, | ||
| dataLocale | ||
| } |
+7
-3
| { | ||
| "name": "@complex-suite/data", | ||
| "version": "5.0.5", | ||
| "version": "5.0.6", | ||
| "description": "a complex data", | ||
| "type": "module", | ||
| "main": "index.ts", | ||
| "exports": { | ||
| ".": "./index.ts", | ||
| "./locale/en": "./src/locale/en.ts" | ||
| }, | ||
| "repository": { | ||
@@ -12,4 +16,4 @@ "type": "git", | ||
| "dependencies": { | ||
| "@complex-suite/utils": "3.0.5", | ||
| "@complex-suite/plugin": "5.0.5" | ||
| "@complex-suite/utils": "3.0.6", | ||
| "@complex-suite/plugin": "5.0.6" | ||
| }, | ||
@@ -16,0 +20,0 @@ "devDependencies": { |
| import { getNum } from "@complex-suite/utils" | ||
| import { notice } from "@complex-suite/plugin" | ||
| import Data from "./../data/Data" | ||
| import { dataLocale } from "../locale" | ||
@@ -395,5 +396,5 @@ export type trackStatus = 'stop' | 'pause' | 'moving' | ||
| if (size === 0) { | ||
| notice.message(`当前无轨迹点,无法生成轨迹!`, 'error') | ||
| notice.message(dataLocale.t('track.noPoints'), 'error') | ||
| } else { | ||
| notice.message(`轨迹生成至少需要${minSize}个点,当前轨迹点仅为${size}个,无法生成轨迹!`, 'error') | ||
| notice.message(dataLocale.t('track.insufficientPoints', { minSize, size }), 'error') | ||
| } | ||
@@ -400,0 +401,0 @@ } |
@@ -11,2 +11,3 @@ import { getComplexProp, isPromise } from '@complex-suite/utils' | ||
| import type { DependDataInitOption } from '../module/DependData' | ||
| import { dataLocale } from '../locale' | ||
| import ModuleData from '../module/ModuleData' | ||
@@ -186,3 +187,3 @@ import type { ModuleDataInitOption } from '../module/ModuleData' | ||
| if (!promise || !isPromise(promise)) { | ||
| this.$exportMsg(`${method}未返回Promise,$triggerMethodWithStatus函数触发失败!`) | ||
| this.$exportMsg(dataLocale.t('baseData.methodNoPromise', { method })) | ||
| return Promise.reject({ status: 'fail', code: 'return error' }) | ||
@@ -193,10 +194,10 @@ } else { | ||
| } else if ((this as unknown as any)[method] !== undefined) { | ||
| this.$exportMsg(`${method}不是函数,$triggerMethodWithStatus函数触发失败!`) | ||
| this.$exportMsg(dataLocale.t('baseData.methodNotFunction', { method })) | ||
| return Promise.reject({ status: 'fail', code: 'type error' }) | ||
| } else { | ||
| this.$exportMsg(`${method}不存在,$triggerMethodWithStatus函数触发失败!`) | ||
| this.$exportMsg(dataLocale.t('baseData.methodNotExist', { method })) | ||
| return Promise.reject({ status: 'fail', code: 'method absent' }) | ||
| } | ||
| } else { | ||
| this.$exportMsg(`method参数接受string,当前值为${method},$triggerMethodWithStatus函数触发失败!`) | ||
| this.$exportMsg(dataLocale.t('baseData.methodInvalidType', { method: String(method) })) | ||
| return Promise.reject({ status: 'fail', code: 'method error' }) | ||
@@ -252,7 +253,7 @@ } | ||
| statusItem.triggerChange('fail', [], option) | ||
| this.$exportMsg(`当前${option.status}状态为:${statusItem.getCurrent()},$triggerMethodWithStatus函数在严格校验下不允许被触发!`) | ||
| this.$exportMsg(dataLocale.t('baseData.statusStrictCheck', { status: option.status, current: statusItem.getCurrent() })) | ||
| return Promise.reject({ status: 'fail', code: 'status clash' }) | ||
| } | ||
| } else { | ||
| this.$exportMsg(`${option.status}状态不存在,$triggerMethodWithStatus函数失败!`) | ||
| this.$exportMsg(dataLocale.t('baseData.statusNotExist', { status: option.status })) | ||
| return Promise.reject({ status: 'fail', code: 'status empty' }) | ||
@@ -271,3 +272,3 @@ } | ||
| $getData(..._args: any[]): Promise<any> { | ||
| return Promise.reject({ status: 'fail', msg: '$getData未定义' }) | ||
| return Promise.reject({ status: 'fail', msg: dataLocale.t('baseData.getDataNotDefined') }) | ||
| } | ||
@@ -333,3 +334,3 @@ protected _triggerLoadData(...args: any[]) { | ||
| } | ||
| const emptyMsg = this._createMsg(`promise模块无load数据(load状态:${loadStatus})`) | ||
| const emptyMsg = this._createMsg(dataLocale.t('baseData.promiseNoLoadData', { status: loadStatus })) | ||
| if (!force.promise) { | ||
@@ -336,0 +337,0 @@ force.promise = { |
+11
-10
@@ -11,2 +11,3 @@ import BaseData from "./BaseData" | ||
| import { StatusValue } from "../module/StatusData" | ||
| import { dataLocale } from '../locale' | ||
| import ChoiceData from "../module/ChoiceData" | ||
@@ -80,27 +81,27 @@ import SortData from "../module/SortData" | ||
| $updateData(..._args: any[]): Promise<any> { | ||
| return Promise.reject({ status: 'fail', msg: '$updateData未定义' }) | ||
| return Promise.reject({ status: 'fail', msg: dataLocale.t('complexData.updateNotDefined') }) | ||
| } | ||
| $buildData(_targetData: Record<PropertyKey, any>, _type?: string, ..._args: unknown[]): Promise<any> { | ||
| return Promise.reject({ status: 'fail', msg: '$buildData未定义' }) | ||
| return Promise.reject({ status: 'fail', msg: dataLocale.t('complexData.buildNotDefined') }) | ||
| } | ||
| $changeData(_targetData: Record<PropertyKey, any>, _originData: Record<PropertyKey, any>, _type: string, ..._args: unknown[]): Promise<any> { | ||
| return Promise.reject({ status: 'fail', msg: '$changeData未定义' }) | ||
| return Promise.reject({ status: 'fail', msg: dataLocale.t('complexData.changeNotDefined') }) | ||
| } | ||
| $editData(_targetData: Record<PropertyKey, any>, _originData: Record<PropertyKey, any>, _type: string, ..._args: unknown[]): Promise<any> { | ||
| return Promise.reject({ status: 'fail', msg: '$editData未定义' }) | ||
| return Promise.reject({ status: 'fail', msg: dataLocale.t('complexData.editNotDefined') }) | ||
| } | ||
| $deleteData(_targetData: Record<PropertyKey, any>, ..._args: unknown[]): Promise<any> { | ||
| return Promise.reject({ status: 'fail', msg: '$deleteData未定义' }) | ||
| return Promise.reject({ status: 'fail', msg: dataLocale.t('complexData.deleteNotDefined') }) | ||
| } | ||
| $refreshData(_targetData: Record<PropertyKey, any>, ..._args: unknown[]): Promise<any> { | ||
| return Promise.resolve({ status: 'success', msg: '$refreshData未定义' }) | ||
| return Promise.resolve({ status: 'success', msg: dataLocale.t('complexData.refreshNotDefined') }) | ||
| } | ||
| $multipleDeleteData(_choiceList: Record<PropertyKey, any>[], ..._args: unknown[]): Promise<any> { | ||
| return Promise.reject({ status: 'fail', msg: '$multipleDeleteData未定义' }) | ||
| return Promise.reject({ status: 'fail', msg: dataLocale.t('complexData.multipleDeleteNotDefined') }) | ||
| } | ||
| $exportData(..._args: any[]): Promise<any> { | ||
| return Promise.reject({ status: 'fail', msg: '$exportData未定义' }) | ||
| return Promise.reject({ status: 'fail', msg: dataLocale.t('complexData.exportNotDefined') }) | ||
| } | ||
| $importData(_file: File, ..._args: unknown[]): Promise<any> { | ||
| return Promise.reject({ status: 'fail', msg: '$importData未定义' }) | ||
| return Promise.reject({ status: 'fail', msg: dataLocale.t('complexData.importNotDefined') }) | ||
| } | ||
@@ -196,3 +197,3 @@ // 更新数据 | ||
| } | ||
| const emptyMsg = this._createMsg(`promise模块无update数据(update状态:${updateStatus})`) | ||
| const emptyMsg = this._createMsg(dataLocale.t('complexData.promiseNoUpdateData', { status: updateStatus })) | ||
| if (!force.promise) { | ||
@@ -199,0 +200,0 @@ force.promise = { |
@@ -9,2 +9,3 @@ import { Life, upperCaseFirstChar } from '@complex-suite/utils' | ||
| import type { DataWithStorage, StorageValueInitOption } from '../lib/StorageValue' | ||
| import { dataLocale } from '../locale' | ||
@@ -60,3 +61,3 @@ export interface DefaultDataInitOption extends SimpleDataInitOption { | ||
| if (!env) { | ||
| this.$exportMsg('$triggerCreate函数需要传递env参数') | ||
| this.$exportMsg(dataLocale.t('defaultData.triggerCreateNoEnv')) | ||
| } | ||
@@ -63,0 +64,0 @@ const lifeName = isCreate ? 'created' : 'beforeCreate' |
| import { getType } from '@complex-suite/utils' | ||
| import Data from './Data' | ||
| import type { BufferType } from './Data' | ||
| import { dataLocale } from '../locale' | ||
@@ -23,3 +24,3 @@ export interface SimpleDataInitOption { | ||
| if (extraType !== 'object' && initOption.extra != undefined) { | ||
| this.$exportMsg('初始化额外数据出错,额外数据初始化参数必须为对象!') | ||
| this.$exportMsg(dataLocale.t('simpleData.extraDataError')) | ||
| } | ||
@@ -26,0 +27,0 @@ } |
| import SimpleDateEdit from "./SimpleDateEdit" | ||
| import type { SimpleDateEditInitOption } from "./SimpleDateEdit" | ||
| import DictionaryValue from "../lib/DictionaryValue" | ||
| import { dataLocale } from '../locale' | ||
@@ -15,8 +16,8 @@ export interface DateRangeEditInitOption extends SimpleDateEditInitOption<true> { | ||
| static $range = true | ||
| static $defaultRuleMessage = '请正确选择开始结束时间' | ||
| static $defaultRuleMessage = dataLocale.t('dateRange.ruleMessage') | ||
| static $defaultPlaceholder = function (_name: string) { | ||
| return `开始日期` | ||
| return dataLocale.t('dateRange.startPlaceholder') | ||
| } | ||
| static $defaultEndPlaceholder = function (_name: string) { | ||
| return `结束日期` | ||
| return dataLocale.t('dateRange.endPlaceholder') | ||
| } | ||
@@ -23,0 +24,0 @@ type: 'dateRange' |
@@ -6,2 +6,3 @@ import { deepCloneData, hasProp, isArray, isComplex } from "@complex-suite/utils" | ||
| import DictionaryValue from "../lib/DictionaryValue" | ||
| import { dataLocale } from '../locale' | ||
@@ -50,3 +51,3 @@ export interface ruleOption { | ||
| static $defaultTrim = false | ||
| static $defaultPlaceholder = (name: string) => `请输入${name}` | ||
| static $defaultPlaceholder = (name: string) => dataLocale.t('placeholder.input', { name }) | ||
| static $defaultRuleMessage = '' | ||
@@ -53,0 +54,0 @@ static $parseRuleList = function($constructor: typeof DefaultEdit<boolean>, target: DefaultEdit<boolean>, formData: Record<PropertyKey, any>, _type?: string) { |
@@ -12,2 +12,3 @@ import PaginationData from "../module/PaginationData" | ||
| import ObserveList from "./ObserveList" | ||
| import { dataLocale } from '../locale' | ||
@@ -25,3 +26,3 @@ export type SelectEditFilterType<C extends PropertyKey | undefined = undefined, D extends (C extends PropertyKey ? CascaderValueType<C> : SelectValueType) = (C extends PropertyKey ? CascaderValueType<C> : SelectValueType)> = (select: C extends undefined ? SelectValue<D> : CascaderValue<C, D>, observe: ObserveList) => D[] | ||
| static $name = 'DefaultSelectEdit' | ||
| static $defaultPlaceholder = (name: string) => `请选择${name}` | ||
| static $defaultPlaceholder = (name: string) => dataLocale.t('placeholder.select', { name }) | ||
| cascader: C | ||
@@ -28,0 +29,0 @@ $select: C extends undefined ? SelectValue<D> : CascaderValue<C, D> |
@@ -5,2 +5,3 @@ import DefaultEdit from "./DefaultEdit" | ||
| import type { fileOption, multipleFileOption } from "../../type" | ||
| import { dataLocale } from '../locale' | ||
@@ -18,3 +19,3 @@ export type FileEditOption<M extends boolean = boolean> = fileOption<M> | ||
| static $defaultPlaceholder = function (name: string) { | ||
| return `请上传${name}` | ||
| return dataLocale.t('placeholder.upload', { name }) | ||
| } | ||
@@ -21,0 +22,0 @@ type: 'file' |
@@ -8,2 +8,3 @@ import DefaultEdit from "./DefaultEdit" | ||
| import FormValue from "../lib/FormValue" | ||
| import { dataLocale } from '../locale' | ||
@@ -29,3 +30,3 @@ export interface ListEditOption { | ||
| { | ||
| name: '新增', | ||
| name: dataLocale.t('list.menu.build'), | ||
| prop: '$build', | ||
@@ -38,3 +39,3 @@ type: 'primary', | ||
| $delete: { | ||
| name: '删除', | ||
| name: dataLocale.t('list.menu.delete'), | ||
| prop: '$delete', | ||
@@ -41,0 +42,0 @@ type: 'danger', |
@@ -7,2 +7,3 @@ import { isArray } from '@complex-suite/utils' | ||
| import type { functionType } from "../lib/DictionaryValue" | ||
| import { dataLocale } from '../locale' | ||
@@ -112,3 +113,3 @@ export type dateConfigValue = { | ||
| static $range = false | ||
| static $defaultPlaceholder = (name: string) => `请选择${name}` | ||
| static $defaultPlaceholder = (name: string) => dataLocale.t('placeholder.select', { name }) | ||
| static $parse: undefined | ((value: undefined | string, format: string) => undefined | any) | ||
@@ -115,0 +116,0 @@ static $collect: undefined | ((value: undefined | any, format: string) => undefined | string) |
@@ -11,2 +11,3 @@ import { isExist, exportMsg, getComplexProp, trimData, isArray } from '@complex-suite/utils' | ||
| import type { DefaultModInitOption } from '../dictionary/DefaultMod' | ||
| import { dataLocale } from '../locale' | ||
| import DefaultList from '../dictionary/DefaultList' | ||
@@ -174,3 +175,3 @@ import type { DefaultListInitOption } from '../dictionary/DefaultList' | ||
| } else { | ||
| exportMsg(`mod初始化错误,不存在${editModInitOption.type}的编辑类型,如需特殊构建请自行生成DefaultMod实例!`) | ||
| exportMsg(dataLocale.t('dictionary.modEditTypeNotExist', { type: String(editModInitOption.type) })) | ||
| } | ||
@@ -197,3 +198,3 @@ } | ||
| } else { | ||
| exportMsg(`mod初始化错误,不存在${$format}的格式化类型,如需特殊构建请自行生成DefaultMod实例!`) | ||
| exportMsg(dataLocale.t('dictionary.modFormatTypeNotExist', { format: String($format) })) | ||
| } | ||
@@ -249,3 +250,3 @@ } | ||
| } else if (initOption.assign) { | ||
| this.$exportMsg('当前编辑为简单模式,不接受assign函数!') | ||
| this.$exportMsg(dataLocale.t('dictionary.simpleModeNoAssign')) | ||
| } | ||
@@ -415,3 +416,3 @@ if (initOption.collect) { | ||
| } else { | ||
| this.$exportMsg(`模块${payload.type}为ListEdit类型,但传入数据为非数组类型,请检查传入数据!`) | ||
| this.$exportMsg(dataLocale.t('dictionary.listEditDataNotArray', { type: payload.type })) | ||
| dataConfig.nonEmptySetProp(payload.targetData, mod.$prop, [], true) | ||
@@ -418,0 +419,0 @@ return Promise.reject({ status: 'fail', code: 'ListEdit value is not Array' }) |
| import { isArray } from "@complex-suite/utils" | ||
| import { dataLocale } from '../locale' | ||
| class FormValue { | ||
| static $name = 'FormValue' | ||
| static clearValidate = function(_formValue: FormValue, ..._args: any[]) { console.error('未定义clearValidate函数') } | ||
| static clearValidate = function(_formValue: FormValue, ..._args: any[]) { console.error(dataLocale.t('form.clearValidateNotDefined')) } | ||
| static validate = function(_formValue: FormValue, ..._args: any[]): Promise<any> { | ||
| console.error('未定义validate函数') | ||
| console.error(dataLocale.t('form.validateNotDefined')) | ||
| return Promise.reject({ status: 'fail', code: 'undefined validate function' }) | ||
@@ -9,0 +10,0 @@ } |
| import { exportMsg, getRandomNum, storage } from '@complex-suite/utils' | ||
| import type { DataWithLife } from '@complex-suite/utils' | ||
| import Data from '../data/Data' | ||
| import { dataLocale } from '../locale' | ||
@@ -79,3 +80,3 @@ export interface StorageValueInitOption { | ||
| } else { | ||
| exportMsg(`本地存储报错:模块${prop}已存在,请勿重复添加!`) | ||
| exportMsg(dataLocale.t('storage.duplicateModule', { prop })) | ||
| } | ||
@@ -82,0 +83,0 @@ } |
@@ -11,2 +11,3 @@ import { Life } from "@complex-suite/utils" | ||
| import type { LayoutParseInitOption } from "../lib/LayoutParse" | ||
| import { dataLocale } from "../locale" | ||
| import FormValue from "../lib/FormValue" | ||
@@ -146,3 +147,3 @@ import type { DefaultModAfterOrder, DefaultModBeforeOrder, DefaultModOrder } from "../dictionary/DefaultMod" | ||
| } else { | ||
| console.warn(`${orderValue.prop}在排序中查找对标${beforeProp}失败!`) | ||
| console.warn(dataLocale.t('dictionary.order.beforeNotFound', { prop: orderValue.prop, beforeProp })) | ||
| } | ||
@@ -163,9 +164,9 @@ } else if ((orderValue.option as DefaultModAfterOrder).after) { | ||
| } else { | ||
| console.warn(`${orderValue.prop}在排序中查找对标${afterProp}失败!`) | ||
| console.warn(dataLocale.t('dictionary.order.afterNotFound', { prop: orderValue.prop, afterProp })) | ||
| } | ||
| } else { | ||
| console.warn(`${orderValue.prop}排序未指定变化参数!`) | ||
| console.warn(dataLocale.t('dictionary.order.noParam', { prop: orderValue.prop })) | ||
| } | ||
| } else { | ||
| console.warn(`${orderValue.prop}在PageList中不存在!`) | ||
| console.warn(dataLocale.t('dictionary.order.notInPageList', { prop: orderValue.prop })) | ||
| } | ||
@@ -197,3 +198,3 @@ }) | ||
| } else { | ||
| console.warn(`${orderValue.prop}在排序中查找对标${beforeProp}失败!`) | ||
| console.warn(dataLocale.t('dictionary.order.beforeNotFound', { prop: orderValue.prop, beforeProp })) | ||
| } | ||
@@ -217,9 +218,9 @@ } else if ((orderValue.option as DefaultModAfterOrder).after) { | ||
| } else { | ||
| console.warn(`${orderValue.prop}在排序中查找对标${afterProp}失败!`) | ||
| console.warn(dataLocale.t('dictionary.order.afterNotFound', { prop: orderValue.prop, afterProp })) | ||
| } | ||
| } else { | ||
| console.warn(`${orderValue.prop}排序未指定变化参数!`) | ||
| console.warn(dataLocale.t('dictionary.order.noParam', { prop: orderValue.prop })) | ||
| } | ||
| } else { | ||
| console.warn(`${orderValue.prop}在ObserveList中不存在!`) | ||
| console.warn(dataLocale.t('dictionary.order.notInObserveList', { prop: orderValue.prop })) | ||
| } | ||
@@ -226,0 +227,0 @@ }) |
@@ -8,2 +8,3 @@ import Data from './../data/Data' | ||
| import type { renderType } from '../../type' | ||
| import { dataLocale } from '../locale' | ||
@@ -77,6 +78,6 @@ type resetType = Record<string, Record<string, boolean>> | ||
| } else { | ||
| this.$exportMsg(`resetOption中from:${from}中不存在action:${action}!存在的action如下:${Object.keys(targetOption)}`) | ||
| this.$exportMsg(dataLocale.t('reset.actionNotFound', { from, action, actions: Object.keys(targetOption).join(',') })) | ||
| } | ||
| } else { | ||
| this.$exportMsg(`resetOption中不存在from:${from}!`) | ||
| this.$exportMsg(dataLocale.t('reset.fromNotFound', { from })) | ||
| } | ||
@@ -83,0 +84,0 @@ return undefined |
@@ -10,2 +10,3 @@ import { deepCloneData, getType } from "@complex-suite/utils" | ||
| import ButtonEdit from "../dictionary/ButtonEdit" | ||
| import { dataLocale } from "../locale" | ||
@@ -39,3 +40,3 @@ export interface resetOption { | ||
| type: 'primary', | ||
| name: '查询', | ||
| name: dataLocale.t('search.menu.search'), | ||
| icon: 'search', | ||
@@ -50,3 +51,3 @@ debounce: 100 | ||
| type: 'primary', | ||
| name: '重置', | ||
| name: dataLocale.t('search.menu.reset'), | ||
| icon: 'reset', | ||
@@ -61,3 +62,3 @@ debounce: 100 | ||
| type: 'primary', | ||
| name: '刷新', | ||
| name: dataLocale.t('search.menu.refresh'), | ||
| icon: 'refresh', | ||
@@ -72,3 +73,3 @@ debounce: 100 | ||
| type: 'primary', | ||
| name: '新增', | ||
| name: dataLocale.t('search.menu.build'), | ||
| icon: 'build', | ||
@@ -83,3 +84,3 @@ debounce: 100 | ||
| type: 'danger', | ||
| name: '删除', | ||
| name: dataLocale.t('search.menu.delete'), | ||
| icon: 'delete', | ||
@@ -101,3 +102,3 @@ debounce: 200, | ||
| type: 'primary', | ||
| name: '详情', | ||
| name: dataLocale.t('search.menu.info'), | ||
| icon: 'info', | ||
@@ -119,3 +120,3 @@ debounce: 100, | ||
| type: 'primary', | ||
| name: '导入', | ||
| name: dataLocale.t('search.menu.import'), | ||
| icon: 'import', | ||
@@ -130,3 +131,3 @@ debounce: 100 | ||
| type: 'primary', | ||
| name: '导出', | ||
| name: dataLocale.t('search.menu.export'), | ||
| icon: 'export', | ||
@@ -152,3 +153,3 @@ debounce: 200 | ||
| } else { | ||
| console.error(`${menuName}对应的menu类型未在config中配置,菜单生成失败!`) | ||
| console.error(dataLocale.t('search.error.menuNotFound', { menuName })) | ||
| } | ||
@@ -155,0 +156,0 @@ } |
| import Data from '../data/Data' | ||
| import { dataLocale } from '../locale' | ||
@@ -114,3 +115,3 @@ export enum StatusValue { | ||
| if (!initOption.list || initOption.list.length === 0) { | ||
| this.$exportMsg('未设置初始化列表!') | ||
| this.$exportMsg(dataLocale.t('statusData.noInitList')) | ||
| } | ||
@@ -144,3 +145,3 @@ if (initOption.type === 'count') { | ||
| } else { | ||
| this.$exportMsg(`当前加载判断值${value}不存在`) | ||
| this.$exportMsg(dataLocale.t('statusData.loadValueNotExist', { value })) | ||
| } | ||
@@ -147,0 +148,0 @@ } |
@@ -5,2 +5,3 @@ import { isPromise } from '@complex-suite/utils' | ||
| import ComplexData from '../data/ComplexData' | ||
| import { dataLocale } from '../locale' | ||
@@ -136,3 +137,3 @@ export type triggerType = (next: UpdateData["next"], index: number) => void | ||
| } else { | ||
| this.$exportMsg('触发更新函数未定义!', 'error') | ||
| this.$exportMsg(dataLocale.t('update.notDefined'), 'error') | ||
| } | ||
@@ -139,0 +140,0 @@ } |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
305247
4.53%70
4.48%7513
2.76%2
100%+ Added
+ Added
- Removed
- Removed
Updated
Updated