@tmagic/editor 1.7.8-beta.1 → 1.7.8-beta.3
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/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +8 -6
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +8 -6
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +8 -6
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +9 -8
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +8 -6
- package/dist/es/services/props.js +2 -1
- package/dist/es/utils/data-source/index.js +65 -63
- package/dist/es/utils/dep/worker.js +1 -1
- package/dist/es/utils/props.js +4 -4
- package/dist/tmagic-editor.umd.cjs +120 -107
- package/package.json +7 -7
- package/src/components/CodeBlockEditor.vue +70 -66
- package/src/components/CodeParams.vue +3 -3
- package/src/fields/CodeSelectCol.vue +5 -2
- package/src/fields/DataSourceFieldSelect/Index.vue +10 -3
- package/src/fields/DataSourceFields.vue +4 -1
- package/src/fields/DataSourceMethodSelect.vue +4 -1
- package/src/fields/EventSelect.vue +69 -63
- package/src/fields/StyleSetter/components/BackgroundPosition.vue +2 -2
- package/src/fields/StyleSetter/components/Border.vue +35 -33
- package/src/fields/StyleSetter/pro/Background.vue +4 -4
- package/src/fields/StyleSetter/pro/Border.vue +3 -3
- package/src/fields/StyleSetter/pro/Font.vue +3 -3
- package/src/fields/StyleSetter/pro/Layout.vue +8 -8
- package/src/fields/StyleSetter/pro/Position.vue +3 -3
- package/src/services/props.ts +3 -1
- package/src/utils/data-source/formConfigs/base.ts +2 -2
- package/src/utils/data-source/index.ts +73 -75
- package/src/utils/props.ts +10 -8
- package/types/index.d.ts +179 -175
|
@@ -4659,12 +4659,12 @@
|
|
|
4659
4659
|
*/
|
|
4660
4660
|
var fillConfig = (config = [], { labelWidth = "80px", disabledDataSource = false, disabledCodeBlock = false } = {}) => {
|
|
4661
4661
|
const propsConfig = [];
|
|
4662
|
-
if (!config.find((item) => item.name === "type")) propsConfig.push({
|
|
4662
|
+
if (!config.find((item) => "name" in item && item.name === "type")) propsConfig.push({
|
|
4663
4663
|
text: "type",
|
|
4664
4664
|
name: "type",
|
|
4665
4665
|
type: "hidden"
|
|
4666
4666
|
});
|
|
4667
|
-
if (!config.find((item) => item.name === "id")) propsConfig.push({
|
|
4667
|
+
if (!config.find((item) => "name" in item && item.name === "id")) propsConfig.push({
|
|
4668
4668
|
name: "id",
|
|
4669
4669
|
text: "ID",
|
|
4670
4670
|
type: "text",
|
|
@@ -4681,11 +4681,11 @@
|
|
|
4681
4681
|
}
|
|
4682
4682
|
}
|
|
4683
4683
|
});
|
|
4684
|
-
if (!config.find((item) => item.name === "name")) propsConfig.push({
|
|
4684
|
+
if (!config.find((item) => "name" in item && item.name === "name")) propsConfig.push({
|
|
4685
4685
|
name: "name",
|
|
4686
4686
|
text: "组件名称"
|
|
4687
4687
|
});
|
|
4688
|
-
const noCodeAdvancedTabItems = advancedTabConfig.items.filter((item) => item.type !== "code-select");
|
|
4688
|
+
const noCodeAdvancedTabItems = advancedTabConfig.items.filter((item) => "type" in item && item.type !== "code-select");
|
|
4689
4689
|
if (noCodeAdvancedTabItems.length > 0 && disabledCodeBlock) advancedTabConfig.items = noCodeAdvancedTabItems;
|
|
4690
4690
|
const tabConfig = {
|
|
4691
4691
|
type: "tab",
|
|
@@ -4760,8 +4760,9 @@
|
|
|
4760
4760
|
});
|
|
4761
4761
|
}
|
|
4762
4762
|
async setPropsConfig(type, config) {
|
|
4763
|
-
let c
|
|
4763
|
+
let c;
|
|
4764
4764
|
if (typeof config === "function") c = config({ editorService: editor_default });
|
|
4765
|
+
else c = config;
|
|
4765
4766
|
this.state.propsConfigMap[(0, _tmagic_utils.toLine)(type)] = await this.fillConfig(Array.isArray(c) ? c : [c]);
|
|
4766
4767
|
}
|
|
4767
4768
|
/**
|
|
@@ -6781,72 +6782,73 @@
|
|
|
6781
6782
|
]);
|
|
6782
6783
|
//#endregion
|
|
6783
6784
|
//#region packages/editor/src/utils/data-source/index.ts
|
|
6785
|
+
var dataSourceFormConfig = (0, _tmagic_form.defineFormItem)({
|
|
6786
|
+
type: "tab",
|
|
6787
|
+
items: [
|
|
6788
|
+
{
|
|
6789
|
+
title: "数据定义",
|
|
6790
|
+
items: [{
|
|
6791
|
+
name: "fields",
|
|
6792
|
+
type: "data-source-fields",
|
|
6793
|
+
defaultValue: () => []
|
|
6794
|
+
}]
|
|
6795
|
+
},
|
|
6796
|
+
{
|
|
6797
|
+
title: "方法定义",
|
|
6798
|
+
items: [{
|
|
6799
|
+
name: "methods",
|
|
6800
|
+
type: "data-source-methods",
|
|
6801
|
+
defaultValue: () => []
|
|
6802
|
+
}]
|
|
6803
|
+
},
|
|
6804
|
+
{
|
|
6805
|
+
title: "事件配置",
|
|
6806
|
+
items: [{
|
|
6807
|
+
name: "events",
|
|
6808
|
+
src: "datasource",
|
|
6809
|
+
type: "event-select"
|
|
6810
|
+
}]
|
|
6811
|
+
},
|
|
6812
|
+
{
|
|
6813
|
+
title: "mock数据",
|
|
6814
|
+
items: [{
|
|
6815
|
+
name: "mocks",
|
|
6816
|
+
type: "data-source-mocks",
|
|
6817
|
+
defaultValue: () => []
|
|
6818
|
+
}]
|
|
6819
|
+
},
|
|
6820
|
+
{
|
|
6821
|
+
title: "请求参数裁剪",
|
|
6822
|
+
display: (_formState, { model }) => model.type === "http",
|
|
6823
|
+
items: [{
|
|
6824
|
+
name: "beforeRequest",
|
|
6825
|
+
type: "vs-code",
|
|
6826
|
+
parse: true,
|
|
6827
|
+
autosize: {
|
|
6828
|
+
minRows: 10,
|
|
6829
|
+
maxRows: 30
|
|
6830
|
+
}
|
|
6831
|
+
}]
|
|
6832
|
+
},
|
|
6833
|
+
{
|
|
6834
|
+
title: "响应数据裁剪",
|
|
6835
|
+
display: (_formStat, { model }) => model.type === "http",
|
|
6836
|
+
items: [{
|
|
6837
|
+
name: "afterResponse",
|
|
6838
|
+
type: "vs-code",
|
|
6839
|
+
parse: true,
|
|
6840
|
+
autosize: {
|
|
6841
|
+
minRows: 10,
|
|
6842
|
+
maxRows: 30
|
|
6843
|
+
}
|
|
6844
|
+
}]
|
|
6845
|
+
}
|
|
6846
|
+
]
|
|
6847
|
+
});
|
|
6784
6848
|
var fillConfig$1 = (config) => [
|
|
6785
6849
|
...base_default(),
|
|
6786
6850
|
...config,
|
|
6787
|
-
|
|
6788
|
-
type: "tab",
|
|
6789
|
-
items: [
|
|
6790
|
-
{
|
|
6791
|
-
title: "数据定义",
|
|
6792
|
-
items: [{
|
|
6793
|
-
name: "fields",
|
|
6794
|
-
type: "data-source-fields",
|
|
6795
|
-
defaultValue: () => []
|
|
6796
|
-
}]
|
|
6797
|
-
},
|
|
6798
|
-
{
|
|
6799
|
-
title: "方法定义",
|
|
6800
|
-
items: [{
|
|
6801
|
-
name: "methods",
|
|
6802
|
-
type: "data-source-methods",
|
|
6803
|
-
defaultValue: () => []
|
|
6804
|
-
}]
|
|
6805
|
-
},
|
|
6806
|
-
{
|
|
6807
|
-
title: "事件配置",
|
|
6808
|
-
items: [{
|
|
6809
|
-
name: "events",
|
|
6810
|
-
src: "datasource",
|
|
6811
|
-
type: "event-select"
|
|
6812
|
-
}]
|
|
6813
|
-
},
|
|
6814
|
-
{
|
|
6815
|
-
title: "mock数据",
|
|
6816
|
-
items: [{
|
|
6817
|
-
name: "mocks",
|
|
6818
|
-
type: "data-source-mocks",
|
|
6819
|
-
defaultValue: () => []
|
|
6820
|
-
}]
|
|
6821
|
-
},
|
|
6822
|
-
{
|
|
6823
|
-
title: "请求参数裁剪",
|
|
6824
|
-
display: (_formState, { model }) => model.type === "http",
|
|
6825
|
-
items: [{
|
|
6826
|
-
name: "beforeRequest",
|
|
6827
|
-
type: "vs-code",
|
|
6828
|
-
parse: true,
|
|
6829
|
-
autosize: {
|
|
6830
|
-
minRows: 10,
|
|
6831
|
-
maxRows: 30
|
|
6832
|
-
}
|
|
6833
|
-
}]
|
|
6834
|
-
},
|
|
6835
|
-
{
|
|
6836
|
-
title: "响应数据裁剪",
|
|
6837
|
-
display: (_formState, { model }) => model.type === "http",
|
|
6838
|
-
items: [{
|
|
6839
|
-
name: "afterResponse",
|
|
6840
|
-
type: "vs-code",
|
|
6841
|
-
parse: true,
|
|
6842
|
-
autosize: {
|
|
6843
|
-
minRows: 10,
|
|
6844
|
-
maxRows: 30
|
|
6845
|
-
}
|
|
6846
|
-
}]
|
|
6847
|
-
}
|
|
6848
|
-
]
|
|
6849
|
-
}
|
|
6851
|
+
dataSourceFormConfig
|
|
6850
6852
|
];
|
|
6851
6853
|
var getFormConfig = (type, configs) => {
|
|
6852
6854
|
switch (type) {
|
|
@@ -9031,7 +9033,7 @@
|
|
|
9031
9033
|
formBox.value.form.values.content = magicVsEditorRef.value.getEditorValue();
|
|
9032
9034
|
difVisible.value = false;
|
|
9033
9035
|
};
|
|
9034
|
-
const defaultParamColConfig = {
|
|
9036
|
+
const defaultParamColConfig = (0, _tmagic_form.defineFormItem)({
|
|
9035
9037
|
type: "row",
|
|
9036
9038
|
label: "参数类型",
|
|
9037
9039
|
items: [{
|
|
@@ -9057,8 +9059,8 @@
|
|
|
9057
9059
|
}
|
|
9058
9060
|
]
|
|
9059
9061
|
}]
|
|
9060
|
-
};
|
|
9061
|
-
const functionConfig = (0, vue.computed)(() => [
|
|
9062
|
+
});
|
|
9063
|
+
const functionConfig = (0, vue.computed)(() => (0, _tmagic_form.defineFormConfig)([
|
|
9062
9064
|
{
|
|
9063
9065
|
text: "名称",
|
|
9064
9066
|
name: "name",
|
|
@@ -9128,7 +9130,7 @@
|
|
|
9128
9130
|
minRows: 10,
|
|
9129
9131
|
maxRows: 30
|
|
9130
9132
|
},
|
|
9131
|
-
onChange: (
|
|
9133
|
+
onChange: (_formState, code) => {
|
|
9132
9134
|
try {
|
|
9133
9135
|
getEditorConfig("parseDSL")(code);
|
|
9134
9136
|
return code;
|
|
@@ -9138,7 +9140,7 @@
|
|
|
9138
9140
|
}
|
|
9139
9141
|
}
|
|
9140
9142
|
}
|
|
9141
|
-
]);
|
|
9143
|
+
]));
|
|
9142
9144
|
const parseContent = (content) => {
|
|
9143
9145
|
if (typeof content === "string") return getEditorConfig("parseDSL")(content);
|
|
9144
9146
|
return content;
|
|
@@ -12818,7 +12820,7 @@
|
|
|
12818
12820
|
var dataSource_default = new DataSource();
|
|
12819
12821
|
//#endregion
|
|
12820
12822
|
//#region packages/editor/src/utils/dep/worker.ts?worker&inline
|
|
12821
|
-
var jsContent = "(function() {\n //#region packages/schema/src/index.ts\n const NODE_CONDS_KEY = \"displayConds\";\n const NODE_DISABLE_DATA_SOURCE_KEY = \"_tmagic_node_disabled_data_source\";\n const NODE_DISABLE_CODE_BLOCK_KEY = \"_tmagic_node_disabled_code_block\";\n let HookType = /* @__PURE__ */ function(HookType) {\n /** 代码块钩子标识 */\n HookType[\"CODE\"] = \"code\";\n return HookType;\n }({});\n //#endregion\n //#region packages/utils/src/index.ts\n const isObject = (obj) => Object.prototype.toString.call(obj) === \"[object Object]\";\n const getKeysArray = (keys) => `${keys}`.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\");\n const DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX = \"ds-field::\";\n const dataSourceTemplateRegExp = /\\$\\{([\\s\\S]+?)\\}/g;\n //#endregion\n //#region packages/dep/src/types.ts\n /** 依赖收集的目标类型 */\n let DepTargetType = /* @__PURE__ */ function(DepTargetType) {\n DepTargetType[\"DEFAULT\"] = \"default\";\n /** 代码块 */\n DepTargetType[\"CODE_BLOCK\"] = \"code-block\";\n /** 数据源 */\n DepTargetType[\"DATA_SOURCE\"] = \"data-source\";\n /** 数据源方法 */\n DepTargetType[\"DATA_SOURCE_METHOD\"] = \"data-source-method\";\n /** 数据源条件 */\n DepTargetType[\"DATA_SOURCE_COND\"] = \"data-source-cond\";\n return DepTargetType;\n }({});\n //#endregion\n //#region packages/dep/src/Target.ts\n /**\n * 需要收集依赖的目标\n * 例如:一个代码块可以为一个目标\n */\n var Target = class {\n /**\n * 如何识别目标\n */\n isTarget;\n /**\n * 目标id,不可重复\n * 例如目标是代码块,则为代码块id\n */\n id;\n /**\n * 目标名称,用于显示在依赖列表中\n */\n name;\n /**\n * 不同的目标可以进行分类,例如代码块,数据源可以为两个不同的type\n */\n type = DepTargetType.DEFAULT;\n /**\n * 依赖详情\n * 实例:{ 'node_id': { name: 'node_name', keys: [ created, mounted ] } }\n */\n deps = {};\n /**\n * 是否默认收集,默认为true,当值为false时需要传入type参数给collect方法才会被收集\n */\n isCollectByDefault;\n constructor(options) {\n this.isTarget = options.isTarget;\n this.id = options.id;\n this.name = options.name;\n this.isCollectByDefault = options.isCollectByDefault ?? true;\n if (options.type) this.type = options.type;\n if (options.initialDeps) this.deps = options.initialDeps;\n }\n /**\n * 更新依赖\n * @param option 节点配置\n * @param key 哪个key配置了这个目标的id\n */\n updateDep({ id, name, key, data }) {\n const dep = this.deps[id] || {\n name,\n keys: []\n };\n dep.name = name;\n dep.data = data;\n this.deps[id] = dep;\n if (dep.keys.indexOf(key) === -1) dep.keys.push(key);\n }\n /**\n * 删除依赖\n * @param node 哪个节点的依赖需要移除,如果为空,则移除所有依赖\n * @param key 节点下哪个key需要移除,如果为空,则移除改节点下的所有依赖key\n * @returns void\n */\n removeDep(id, key) {\n if (typeof id === \"undefined\") {\n Object.keys(this.deps).forEach((depKey) => {\n delete this.deps[depKey];\n });\n return;\n }\n const dep = this.deps[id];\n if (!dep) return;\n if (key) {\n const index = dep.keys.indexOf(key);\n dep.keys.splice(index, 1);\n if (dep.keys.length === 0) delete this.deps[id];\n } else delete this.deps[id];\n }\n /**\n * 判断指定节点下的指定key是否存在在依赖列表中\n * @param node 哪个节点\n * @param key 哪个key\n * @returns boolean\n */\n hasDep(id, key) {\n const dep = this.deps[id];\n return Boolean(dep?.keys.find((d) => d === key));\n }\n destroy() {\n this.deps = {};\n }\n };\n //#endregion\n //#region packages/dep/src/utils.ts\n const createCodeBlockTarget = (id, codeBlock, initialDeps = {}) => new Target({\n type: DepTargetType.CODE_BLOCK,\n id,\n initialDeps,\n name: codeBlock.name,\n isTarget: (_key, value) => {\n if (id === value) return true;\n if (value?.hookType === HookType.CODE && Array.isArray(value.hookData)) {\n const index = value.hookData.findIndex((item) => item.codeId === id);\n return Boolean(index > -1);\n }\n return false;\n }\n });\n /**\n * ['array'] ['array', '0'] ['array', '0', 'a'] 这种返回false\n * ['array', 'a'] 这种返回true\n * @param keys\n * @param fields\n * @returns boolean\n */\n const isIncludeArrayField = (keys, fields) => {\n let f = fields;\n return keys.some((key, index) => {\n const field = f.find(({ name }) => name === key);\n f = field?.fields || [];\n return field?.type === \"array\" && /^(?!\\d+$).*$/.test(`${keys[index + 1]}`) && index < keys.length - 1;\n });\n };\n /**\n * 判断模板(value)是不是使用数据源Id(dsId),如:`xxx${dsId.field}xxx${dsId.field}`\n * @param value any\n * @param dsId string | number\n * @param hasArray boolean true: 一定要包含有需要迭代的模板; false: 一定要包含普通模板;\n * @returns boolean\n */\n const isDataSourceTemplate = (value, ds, hasArray = false) => {\n const templates = value.match(dataSourceTemplateRegExp) || [];\n if (templates.length <= 0) return false;\n const arrayFieldTemplates = [];\n const fieldTemplates = [];\n templates.forEach((tpl) => {\n const keys = getKeysArray(tpl.substring(2, tpl.length - 1));\n const dsId = keys.shift();\n if (!dsId || dsId !== ds.id) return;\n if (isIncludeArrayField(keys, ds.fields)) arrayFieldTemplates.push(tpl);\n else fieldTemplates.push(tpl);\n });\n if (hasArray) return arrayFieldTemplates.length > 0;\n return fieldTemplates.length > 0;\n };\n /**\n * 指定数据源的字符串模板,如:{ isBindDataSourceField: true, dataSourceId: 'id', template: `xxx${field}xxx`}\n * @param value any\n * @param dsId string | number\n * @returns boolean\n */\n const isSpecificDataSourceTemplate = (value, dsId) => value?.isBindDataSourceField && value.dataSourceId && value.dataSourceId === dsId && typeof value.template === \"string\";\n /**\n * 关联数据源字段,格式为 [前缀+数据源ID, 字段名]\n * 使用data-source-field-select value: 'value' 可以配置出来\n * @param value any[]\n * @param id string | number\n * @returns boolean\n */\n const isUseDataSourceField = (value, id) => {\n if (!Array.isArray(value) || typeof value[0] !== \"string\") return false;\n const [prefixId] = value;\n const prefixIndex = prefixId.indexOf(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX);\n if (prefixIndex === -1) return false;\n return prefixId.substring(prefixIndex + DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX.length) === id;\n };\n const isDataSourceTarget = (ds, key, value, hasArray = false) => {\n if (!value || ![\"string\", \"object\"].includes(typeof value)) return false;\n if (`${key}`.startsWith(\"displayConds\")) return false;\n if (typeof value === \"string\") return isDataSourceTemplate(value, ds, hasArray);\n if (isObject(value) && value?.isBindDataSource && value.dataSourceId && value.dataSourceId === ds.id) return true;\n if (isSpecificDataSourceTemplate(value, ds.id)) return true;\n if (isUseDataSourceField(value, ds.id)) {\n const [, ...keys] = value;\n const includeArray = isIncludeArrayField(keys, ds.fields);\n if (hasArray) return includeArray;\n return !includeArray;\n }\n return false;\n };\n const isDataSourceCondTarget = (ds, key, value, hasArray = false) => {\n if (!Array.isArray(value) || !ds) return false;\n const [dsId, ...keys] = value;\n if (dsId !== ds.id || !`${key}`.startsWith(\"displayConds\")) return false;\n if (ds.fields?.find((field) => field.name === keys[0])) {\n const includeArray = isIncludeArrayField(keys, ds.fields);\n if (hasArray) return includeArray;\n return !includeArray;\n }\n return false;\n };\n const createDataSourceTarget = (ds, initialDeps = {}) => new Target({\n type: DepTargetType.DATA_SOURCE,\n id: ds.id,\n initialDeps,\n isTarget: (key, value) => isDataSourceTarget(ds, key, value)\n });\n const createDataSourceCondTarget = (ds, initialDeps = {}) => new Target({\n type: DepTargetType.DATA_SOURCE_COND,\n id: ds.id,\n initialDeps,\n isTarget: (key, value) => isDataSourceCondTarget(ds, key, value)\n });\n const createDataSourceMethodTarget = (ds, initialDeps = {}) => new Target({\n type: DepTargetType.DATA_SOURCE_METHOD,\n id: ds.id,\n initialDeps,\n isTarget: (_key, value) => {\n if (!Array.isArray(value)) return false;\n const [dsId, methodName] = value;\n if (!methodName || dsId !== ds.id) return false;\n if (ds.methods?.find((method) => method.name === methodName)) return true;\n if (ds.fields?.find((field) => field.name === methodName)) return false;\n return true;\n }\n });\n const traverseTarget = (targetsList, cb, type) => {\n for (const targets of Object.values(targetsList)) for (const target of Object.values(targets)) {\n if (type && target.type !== type) continue;\n cb(target);\n }\n };\n //#endregion\n //#region packages/dep/src/Watcher.ts\n var Watcher = class {\n targetsList = {};\n childrenProp = \"items\";\n idProp = \"id\";\n nameProp = \"name\";\n constructor(options) {\n if (options?.initialTargets) this.targetsList = options.initialTargets;\n if (options?.childrenProp) this.childrenProp = options.childrenProp;\n }\n getTargetsList() {\n return this.targetsList;\n }\n /**\n * 获取指定类型中的所有target\n * @param type 分类\n * @returns Target[]\n */\n getTargets(type = DepTargetType.DEFAULT) {\n return this.targetsList[type] || {};\n }\n /**\n * 添加新的目标\n * @param target Target\n */\n addTarget(target) {\n const targets = this.getTargets(target.type) || {};\n this.targetsList[target.type] = targets;\n targets[target.id] = target;\n }\n /**\n * 获取指定id的target\n * @param id target id\n * @returns Target\n */\n getTarget(id, type = DepTargetType.DEFAULT) {\n return this.getTargets(type)[id];\n }\n /**\n * 判断是否存在指定id的target\n * @param id target id\n * @returns boolean\n */\n hasTarget(id, type = DepTargetType.DEFAULT) {\n return Boolean(this.getTarget(id, type));\n }\n /**\n * 判断是否存在指定类型的target\n * @param type target type\n * @returns boolean\n */\n hasSpecifiedTypeTarget(type = DepTargetType.DEFAULT) {\n return Object.keys(this.getTargets(type)).length > 0;\n }\n /**\n * 删除指定id的target\n * @param id target id\n */\n removeTarget(id, type = DepTargetType.DEFAULT) {\n const targets = this.getTargets(type);\n if (targets[id]) {\n targets[id].destroy();\n delete targets[id];\n }\n }\n /**\n * 删除指定分类的所有target\n * @param type 分类\n * @returns void\n */\n removeTargets(type = DepTargetType.DEFAULT) {\n const targets = this.targetsList[type];\n if (!targets) return;\n for (const target of Object.values(targets)) target.destroy();\n delete this.targetsList[type];\n }\n /**\n * 删除所有target\n */\n clearTargets() {\n for (const key of Object.keys(this.targetsList)) delete this.targetsList[key];\n }\n /**\n * 收集依赖\n * @param nodes 需要收集的节点\n * @param deep 是否需要收集子节点\n * @param type 强制收集指定类型的依赖\n */\n collect(nodes, depExtendedData = {}, deep = false, type) {\n this.collectByCallback(nodes, type, ({ node, target }) => {\n this.removeTargetDep(target, node);\n this.collectItem(node, target, depExtendedData, deep);\n });\n }\n collectByCallback(nodes, type, cb) {\n traverseTarget(this.targetsList, (target) => {\n if (!type && !target.isCollectByDefault) return;\n for (const node of nodes) cb({\n node,\n target\n });\n }, type);\n }\n /**\n * 清除所有目标的依赖\n * @param nodes 需要清除依赖的节点\n */\n clear(nodes, type) {\n let { targetsList } = this;\n if (type) targetsList = { [type]: this.getTargets(type) };\n const clearedItemsNodeIds = [];\n traverseTarget(targetsList, (target) => {\n if (nodes) for (const node of nodes) {\n target.removeDep(node[this.idProp]);\n if (Array.isArray(node[this.childrenProp]) && node[this.childrenProp].length && !clearedItemsNodeIds.includes(node[this.idProp])) {\n clearedItemsNodeIds.push(node[this.idProp]);\n this.clear(node[this.childrenProp]);\n }\n }\n else target.removeDep();\n });\n }\n /**\n * 清除指定类型的依赖\n * @param type 类型\n * @param nodes 需要清除依赖的节点\n */\n clearByType(type, nodes) {\n this.clear(nodes, type);\n }\n collectItem(node, target, depExtendedData = {}, deep = false) {\n const dataSourceTargetTypes = [\n DepTargetType.DATA_SOURCE,\n DepTargetType.DATA_SOURCE_COND,\n DepTargetType.DATA_SOURCE_METHOD\n ];\n if (node[\"_tmagic_node_disabled_data_source\"] && dataSourceTargetTypes.includes(target.type)) return;\n if (node[\"_tmagic_node_disabled_code_block\"] && target.type === DepTargetType.CODE_BLOCK) return;\n const collectTarget = (config, prop = \"\") => {\n const doCollect = (key, value) => {\n const keyIsItems = key === this.childrenProp;\n const fullKey = prop ? `${prop}.${key}` : key;\n if (target.isTarget(fullKey, value)) target.updateDep({\n id: node[this.idProp],\n name: `${node[this.nameProp] || node[this.idProp]}`,\n data: depExtendedData,\n key: fullKey\n });\n else if (!keyIsItems && Array.isArray(value)) for (let i = 0, l = value.length; i < l; i++) {\n const item = value[i];\n if (isObject(item)) collectTarget(item, `${fullKey}[${i}]`);\n }\n else if (isObject(value)) collectTarget(value, fullKey);\n if (keyIsItems && deep && Array.isArray(value)) for (const child of value) this.collectItem(child, target, depExtendedData, deep);\n };\n for (const [key, value] of Object.entries(config)) {\n if (typeof value === \"undefined\" || value === \"\") continue;\n doCollect(key, value);\n }\n };\n collectTarget(node);\n }\n removeTargetDep(target, node, key) {\n target.removeDep(node[this.idProp], key);\n if (typeof key === \"undefined\" && Array.isArray(node[this.childrenProp]) && node[this.childrenProp].length) for (const item of node[this.childrenProp]) this.removeTargetDep(target, item, key);\n }\n };\n //#endregion\n //#region packages/editor/src/utils/logger.ts\n const error = (...args) => {};\n //#endregion\n //#region packages/editor/src/utils/dep/worker.ts\n onmessage = (e) => {\n const watcher = new Watcher({ initialTargets: {} });\n const { dsl } = e.data;\n try {\n const mApp = eval(`(${dsl})`);\n if (!mApp) postMessage({});\n watcher.clearTargets();\n if (mApp.codeBlocks) for (const [id, code] of Object.entries(mApp.codeBlocks)) watcher.addTarget(createCodeBlockTarget(id, code));\n if (mApp.dataSources) for (const ds of mApp.dataSources) {\n watcher.addTarget(createDataSourceTarget(ds, {}));\n watcher.addTarget(createDataSourceMethodTarget(ds, {}));\n watcher.addTarget(createDataSourceCondTarget(ds, {}));\n }\n watcher.collectByCallback(mApp.items, void 0, ({ node, target }) => {\n watcher.collectItem(node, target, { pageId: node.id }, true);\n });\n const data = {\n [DepTargetType.DATA_SOURCE]: {},\n [DepTargetType.DATA_SOURCE_METHOD]: {},\n [DepTargetType.DATA_SOURCE_COND]: {},\n [DepTargetType.CODE_BLOCK]: {}\n };\n traverseTarget(watcher.getTargetsList(), (target) => {\n data[target.type][target.id] = target.deps;\n });\n postMessage(data);\n } catch (e) {\n postMessage({});\n }\n };\n //#endregion\n})();\n";
|
|
12823
|
+
var jsContent = "(function() {\n //#region packages/schema/src/index.ts\n const NODE_CONDS_KEY = \"displayConds\";\n const NODE_DISABLE_DATA_SOURCE_KEY = \"_tmagic_node_disabled_data_source\";\n const NODE_DISABLE_CODE_BLOCK_KEY = \"_tmagic_node_disabled_code_block\";\n let HookType = /* @__PURE__ */ function(HookType) {\n /** 代码块钩子标识 */\n HookType[\"CODE\"] = \"code\";\n return HookType;\n }({});\n //#endregion\n //#region packages/utils/src/index.ts\n const isObject = (obj) => Object.prototype.toString.call(obj) === \"[object Object]\";\n const getKeysArray = (keys) => `${keys}`.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\");\n const DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX = \"ds-field::\";\n const dataSourceTemplateRegExp = /\\$\\{([\\s\\S]+?)\\}/g;\n //#endregion\n //#region packages/dep/src/types.ts\n /** 依赖收集的目标类型 */\n let DepTargetType = /* @__PURE__ */ function(DepTargetType) {\n DepTargetType[\"DEFAULT\"] = \"default\";\n /** 代码块 */\n DepTargetType[\"CODE_BLOCK\"] = \"code-block\";\n /** 数据源 */\n DepTargetType[\"DATA_SOURCE\"] = \"data-source\";\n /** 数据源方法 */\n DepTargetType[\"DATA_SOURCE_METHOD\"] = \"data-source-method\";\n /** 数据源条件 */\n DepTargetType[\"DATA_SOURCE_COND\"] = \"data-source-cond\";\n return DepTargetType;\n }({});\n //#endregion\n //#region packages/dep/src/Target.ts\n /**\n * 需要收集依赖的目标\n * 例如:一个代码块可以为一个目标\n */\n var Target = class {\n /**\n * 如何识别目标\n */\n isTarget;\n /**\n * 目标id,不可重复\n * 例如目标是代码块,则为代码块id\n */\n id;\n /**\n * 目标名称,用于显示在依赖列表中\n */\n name;\n /**\n * 不同的目标可以进行分类,例如代码块,数据源可以为两个不同的type\n */\n type = DepTargetType.DEFAULT;\n /**\n * 依赖详情\n * 实例:{ 'node_id': { name: 'node_name', keys: [ created, mounted ] } }\n */\n deps = {};\n /**\n * 是否默认收集,默认为true,当值为false时需要传入type参数给collect方法才会被收集\n */\n isCollectByDefault;\n constructor(options) {\n this.isTarget = options.isTarget;\n this.id = options.id;\n this.name = options.name;\n this.isCollectByDefault = options.isCollectByDefault ?? true;\n if (options.type) this.type = options.type;\n if (options.initialDeps) this.deps = options.initialDeps;\n }\n /**\n * 更新依赖\n * @param option 节点配置\n * @param key 哪个key配置了这个目标的id\n */\n updateDep({ id, name, key, data }) {\n const dep = this.deps[id] || {\n name,\n keys: []\n };\n dep.name = name;\n dep.data = data;\n this.deps[id] = dep;\n if (!dep.keys.includes(key)) dep.keys.push(key);\n }\n /**\n * 删除依赖\n * @param node 哪个节点的依赖需要移除,如果为空,则移除所有依赖\n * @param key 节点下哪个key需要移除,如果为空,则移除改节点下的所有依赖key\n * @returns void\n */\n removeDep(id, key) {\n if (typeof id === \"undefined\") {\n Object.keys(this.deps).forEach((depKey) => {\n delete this.deps[depKey];\n });\n return;\n }\n const dep = this.deps[id];\n if (!dep) return;\n if (key) {\n const index = dep.keys.indexOf(key);\n dep.keys.splice(index, 1);\n if (dep.keys.length === 0) delete this.deps[id];\n } else delete this.deps[id];\n }\n /**\n * 判断指定节点下的指定key是否存在在依赖列表中\n * @param node 哪个节点\n * @param key 哪个key\n * @returns boolean\n */\n hasDep(id, key) {\n return this.deps[id]?.keys.includes(key) ?? false;\n }\n destroy() {\n this.deps = {};\n }\n };\n //#endregion\n //#region packages/dep/src/utils.ts\n const INTEGER_REGEXP = /^\\d+$/;\n const createCodeBlockTarget = (id, codeBlock, initialDeps = {}) => new Target({\n type: DepTargetType.CODE_BLOCK,\n id,\n initialDeps,\n name: codeBlock.name,\n isTarget: (_key, value) => {\n if (id === value) return true;\n if (value?.hookType === HookType.CODE && Array.isArray(value.hookData)) return value.hookData.some((item) => item.codeId === id);\n return false;\n }\n });\n /**\n * ['array'] ['array', '0'] ['array', '0', 'a'] 这种返回false\n * ['array', 'a'] 这种返回true\n * @param keys\n * @param fields\n * @returns boolean\n */\n const isIncludeArrayField = (keys, fields) => {\n let f = fields;\n return keys.some((key, index) => {\n const field = f.find(({ name }) => name === key);\n f = field?.fields || [];\n return field?.type === \"array\" && index < keys.length - 1 && !INTEGER_REGEXP.test(keys[index + 1]);\n });\n };\n /**\n * 判断模板(value)是不是使用数据源Id(dsId),如:`xxx${dsId.field}xxx${dsId.field}`\n * @param value any\n * @param dsId string | number\n * @param hasArray boolean true: 一定要包含有需要迭代的模板; false: 一定要包含普通模板;\n * @returns boolean\n */\n const isDataSourceTemplate = (value, ds, hasArray = false) => {\n const templates = value.match(dataSourceTemplateRegExp) || [];\n if (templates.length <= 0) return false;\n for (const tpl of templates) {\n const keys = getKeysArray(tpl.substring(2, tpl.length - 1));\n const dsId = keys.shift();\n if (!dsId || dsId !== ds.id) continue;\n if (hasArray === isIncludeArrayField(keys, ds.fields)) return true;\n }\n return false;\n };\n /**\n * 指定数据源的字符串模板,如:{ isBindDataSourceField: true, dataSourceId: 'id', template: `xxx${field}xxx`}\n * @param value any\n * @param dsId string | number\n * @returns boolean\n */\n const isSpecificDataSourceTemplate = (value, dsId) => value?.isBindDataSourceField && value.dataSourceId && value.dataSourceId === dsId && typeof value.template === \"string\";\n /**\n * 关联数据源字段,格式为 [前缀+数据源ID, 字段名]\n * 使用data-source-field-select value: 'value' 可以配置出来\n * @param value any[]\n * @param id string | number\n * @returns boolean\n */\n const isUseDataSourceField = (value, id) => {\n if (!Array.isArray(value) || typeof value[0] !== \"string\") return false;\n const [prefixId] = value;\n const prefixIndex = prefixId.indexOf(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX);\n if (prefixIndex === -1) return false;\n return prefixId.substring(prefixIndex + DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX.length) === id;\n };\n const isDataSourceTarget = (ds, key, value, hasArray = false) => {\n if (!value) return false;\n const valueType = typeof value;\n if (valueType !== \"string\" && valueType !== \"object\") return false;\n if (`${key}`.startsWith(\"displayConds\")) return false;\n if (valueType === \"string\") return isDataSourceTemplate(value, ds, hasArray);\n if (isObject(value) && value.isBindDataSource && value.dataSourceId === ds.id) return true;\n if (isSpecificDataSourceTemplate(value, ds.id)) return true;\n if (isUseDataSourceField(value, ds.id)) {\n const [, ...keys] = value;\n const includeArray = isIncludeArrayField(keys, ds.fields);\n return hasArray ? includeArray : !includeArray;\n }\n return false;\n };\n const isDataSourceCondTarget = (ds, key, value, hasArray = false) => {\n if (!Array.isArray(value) || !ds) return false;\n const [dsId, ...keys] = value;\n if (dsId !== ds.id || !`${key}`.startsWith(\"displayConds\")) return false;\n if (ds.fields?.some((field) => field.name === keys[0])) {\n const includeArray = isIncludeArrayField(keys, ds.fields);\n return hasArray ? includeArray : !includeArray;\n }\n return false;\n };\n const createDataSourceTarget = (ds, initialDeps = {}) => new Target({\n type: DepTargetType.DATA_SOURCE,\n id: ds.id,\n initialDeps,\n isTarget: (key, value) => isDataSourceTarget(ds, key, value)\n });\n const createDataSourceCondTarget = (ds, initialDeps = {}) => new Target({\n type: DepTargetType.DATA_SOURCE_COND,\n id: ds.id,\n initialDeps,\n isTarget: (key, value) => isDataSourceCondTarget(ds, key, value)\n });\n const createDataSourceMethodTarget = (ds, initialDeps = {}) => new Target({\n type: DepTargetType.DATA_SOURCE_METHOD,\n id: ds.id,\n initialDeps,\n isTarget: (_key, value) => {\n if (!Array.isArray(value)) return false;\n const [dsId, methodName] = value;\n if (!methodName || dsId !== ds.id) return false;\n if (ds.methods?.some((method) => method.name === methodName)) return true;\n if (ds.fields?.some((field) => field.name === methodName)) return false;\n return true;\n }\n });\n const traverseTarget = (targetsList, cb, type) => {\n if (type) {\n const targets = targetsList[type];\n if (targets) for (const target of Object.values(targets)) cb(target);\n return;\n }\n for (const targets of Object.values(targetsList)) for (const target of Object.values(targets)) cb(target);\n };\n //#endregion\n //#region packages/dep/src/Watcher.ts\n const DATA_SOURCE_TARGET_TYPES = new Set([\n DepTargetType.DATA_SOURCE,\n DepTargetType.DATA_SOURCE_COND,\n DepTargetType.DATA_SOURCE_METHOD\n ]);\n var Watcher = class {\n targetsList = {};\n childrenProp = \"items\";\n idProp = \"id\";\n nameProp = \"name\";\n constructor(options) {\n if (options?.initialTargets) this.targetsList = options.initialTargets;\n if (options?.childrenProp) this.childrenProp = options.childrenProp;\n }\n getTargetsList() {\n return this.targetsList;\n }\n /**\n * 获取指定类型中的所有target\n * @param type 分类\n * @returns Target[]\n */\n getTargets(type = DepTargetType.DEFAULT) {\n return this.targetsList[type] || {};\n }\n /**\n * 添加新的目标\n * @param target Target\n */\n addTarget(target) {\n const targets = this.getTargets(target.type) || {};\n this.targetsList[target.type] = targets;\n targets[target.id] = target;\n }\n /**\n * 获取指定id的target\n * @param id target id\n * @returns Target\n */\n getTarget(id, type = DepTargetType.DEFAULT) {\n return this.getTargets(type)[id];\n }\n /**\n * 判断是否存在指定id的target\n * @param id target id\n * @returns boolean\n */\n hasTarget(id, type = DepTargetType.DEFAULT) {\n return Boolean(this.getTarget(id, type));\n }\n /**\n * 判断是否存在指定类型的target\n * @param type target type\n * @returns boolean\n */\n hasSpecifiedTypeTarget(type = DepTargetType.DEFAULT) {\n return Object.keys(this.getTargets(type)).length > 0;\n }\n /**\n * 删除指定id的target\n * @param id target id\n */\n removeTarget(id, type = DepTargetType.DEFAULT) {\n const targets = this.getTargets(type);\n if (targets[id]) {\n targets[id].destroy();\n delete targets[id];\n }\n }\n /**\n * 删除指定分类的所有target\n * @param type 分类\n * @returns void\n */\n removeTargets(type = DepTargetType.DEFAULT) {\n const targets = this.targetsList[type];\n if (!targets) return;\n for (const target of Object.values(targets)) target.destroy();\n delete this.targetsList[type];\n }\n /**\n * 删除所有target\n */\n clearTargets() {\n for (const key of Object.keys(this.targetsList)) delete this.targetsList[key];\n }\n /**\n * 收集依赖\n * @param nodes 需要收集的节点\n * @param deep 是否需要收集子节点\n * @param type 强制收集指定类型的依赖\n */\n collect(nodes, depExtendedData = {}, deep = false, type) {\n this.collectByCallback(nodes, type, ({ node, target }) => {\n this.removeTargetDep(target, node);\n this.collectItem(node, target, depExtendedData, deep);\n });\n }\n collectByCallback(nodes, type, cb) {\n traverseTarget(this.targetsList, (target) => {\n if (!type && !target.isCollectByDefault) return;\n for (const node of nodes) cb({\n node,\n target\n });\n }, type);\n }\n /**\n * 清除所有目标的依赖\n * @param nodes 需要清除依赖的节点\n */\n clear(nodes, type) {\n let { targetsList } = this;\n if (type) targetsList = { [type]: this.getTargets(type) };\n const clearedItemsNodeIds = /* @__PURE__ */ new Set();\n traverseTarget(targetsList, (target) => {\n if (nodes) for (const node of nodes) {\n target.removeDep(node[this.idProp]);\n if (Array.isArray(node[this.childrenProp]) && node[this.childrenProp].length && !clearedItemsNodeIds.has(node[this.idProp])) {\n clearedItemsNodeIds.add(node[this.idProp]);\n this.clear(node[this.childrenProp]);\n }\n }\n else target.removeDep();\n });\n }\n /**\n * 清除指定类型的依赖\n * @param type 类型\n * @param nodes 需要清除依赖的节点\n */\n clearByType(type, nodes) {\n this.clear(nodes, type);\n }\n collectItem(node, target, depExtendedData = {}, deep = false) {\n if (node[\"_tmagic_node_disabled_data_source\"] && DATA_SOURCE_TARGET_TYPES.has(target.type)) return;\n if (node[\"_tmagic_node_disabled_code_block\"] && target.type === DepTargetType.CODE_BLOCK) return;\n const collectTarget = (config, prop = \"\") => {\n const doCollect = (key, value) => {\n const keyIsItems = key === this.childrenProp;\n const fullKey = prop ? `${prop}.${key}` : key;\n if (target.isTarget(fullKey, value)) target.updateDep({\n id: node[this.idProp],\n name: `${node[this.nameProp] || node[this.idProp]}`,\n data: depExtendedData,\n key: fullKey\n });\n else if (!keyIsItems && Array.isArray(value)) for (let i = 0, l = value.length; i < l; i++) {\n const item = value[i];\n if (isObject(item)) collectTarget(item, `${fullKey}[${i}]`);\n }\n else if (isObject(value)) collectTarget(value, fullKey);\n if (keyIsItems && deep && Array.isArray(value)) for (const child of value) this.collectItem(child, target, depExtendedData, deep);\n };\n for (const [key, value] of Object.entries(config)) {\n if (typeof value === \"undefined\" || value === \"\") continue;\n doCollect(key, value);\n }\n };\n collectTarget(node);\n }\n removeTargetDep(target, node, key) {\n target.removeDep(node[this.idProp], key);\n if (typeof key === \"undefined\" && Array.isArray(node[this.childrenProp]) && node[this.childrenProp].length) for (const item of node[this.childrenProp]) this.removeTargetDep(target, item, key);\n }\n };\n //#endregion\n //#region packages/editor/src/utils/logger.ts\n const error = (...args) => {};\n //#endregion\n //#region packages/editor/src/utils/dep/worker.ts\n onmessage = (e) => {\n const watcher = new Watcher({ initialTargets: {} });\n const { dsl } = e.data;\n try {\n const mApp = eval(`(${dsl})`);\n if (!mApp) postMessage({});\n watcher.clearTargets();\n if (mApp.codeBlocks) for (const [id, code] of Object.entries(mApp.codeBlocks)) watcher.addTarget(createCodeBlockTarget(id, code));\n if (mApp.dataSources) for (const ds of mApp.dataSources) {\n watcher.addTarget(createDataSourceTarget(ds, {}));\n watcher.addTarget(createDataSourceMethodTarget(ds, {}));\n watcher.addTarget(createDataSourceCondTarget(ds, {}));\n }\n watcher.collectByCallback(mApp.items, void 0, ({ node, target }) => {\n watcher.collectItem(node, target, { pageId: node.id }, true);\n });\n const data = {\n [DepTargetType.DATA_SOURCE]: {},\n [DepTargetType.DATA_SOURCE_METHOD]: {},\n [DepTargetType.DATA_SOURCE_COND]: {},\n [DepTargetType.CODE_BLOCK]: {}\n };\n traverseTarget(watcher.getTargetsList(), (target) => {\n data[target.type][target.id] = target.deps;\n });\n postMessage(data);\n } catch (e) {\n postMessage({});\n }\n };\n //#endregion\n})();\n";
|
|
12822
12824
|
var blob = typeof self !== "undefined" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", jsContent], { type: "text/javascript;charset=utf-8" });
|
|
12823
12825
|
function WorkerWrapper(options) {
|
|
12824
12826
|
let objURL;
|
|
@@ -14225,7 +14227,7 @@
|
|
|
14225
14227
|
const selectConfig = {
|
|
14226
14228
|
type: "select",
|
|
14227
14229
|
name: props.name,
|
|
14228
|
-
|
|
14230
|
+
disabled: props.disabled,
|
|
14229
14231
|
options: () => {
|
|
14230
14232
|
if (codeDsl.value) return map(codeDsl.value, (value, key) => ({
|
|
14231
14233
|
text: `${value.name}(${key})`,
|
|
@@ -15771,14 +15773,15 @@
|
|
|
15771
15773
|
const dataSources = (0, vue.computed)(() => dataSourceService.get("dataSources") || []);
|
|
15772
15774
|
const disabledDataSource = (0, vue.computed)(() => propsService.getDisabledDataSource());
|
|
15773
15775
|
const type = (0, vue.computed)(() => {
|
|
15774
|
-
|
|
15776
|
+
if (!props.config.fieldConfig) return "";
|
|
15777
|
+
let type = "type" in props.config.fieldConfig ? props.config.fieldConfig.type : "";
|
|
15775
15778
|
if (typeof type === "function") type = type(mForm, { model: props.model });
|
|
15776
15779
|
if (type === "form") return "";
|
|
15777
15780
|
if (type === "container") return "";
|
|
15778
|
-
return type?.replace(/([A-Z])/g, "-$1").toLowerCase() || (props.config.items ? "" : "text");
|
|
15781
|
+
return type?.replace(/([A-Z])/g, "-$1").toLowerCase() || (props.config.fieldConfig && "items" in props.config.fieldConfig ? "" : "text");
|
|
15779
15782
|
});
|
|
15780
15783
|
const tagName = (0, vue.computed)(() => {
|
|
15781
|
-
const component = (0, _tmagic_form.getFormField)(type.value || "container") || (0, vue.resolveComponent)(`m-${props.config.items ? "form" : "fields"}-${type.value}`);
|
|
15784
|
+
const component = (0, _tmagic_form.getFormField)(type.value || "container") || (0, vue.resolveComponent)(`m-${props.config.fieldConfig && "items" in props.config.fieldConfig ? "form" : "fields"}-${type.value}`);
|
|
15782
15785
|
if (typeof component !== "string") return component;
|
|
15783
15786
|
return "m-fields-text";
|
|
15784
15787
|
});
|
|
@@ -16000,8 +16003,8 @@
|
|
|
16000
16003
|
name: "to",
|
|
16001
16004
|
text: "联动组件",
|
|
16002
16005
|
type: "ui-select",
|
|
16003
|
-
display: (
|
|
16004
|
-
onChange: (
|
|
16006
|
+
display: (_mForm, { model }) => model.actionType === _tmagic_core.ActionType.COMP,
|
|
16007
|
+
onChange: (_MForm, _v, { setModel }) => {
|
|
16005
16008
|
setModel("method", "");
|
|
16006
16009
|
},
|
|
16007
16010
|
...props.config.targetCompConfig
|
|
@@ -16068,7 +16071,7 @@
|
|
|
16068
16071
|
...props.config.dataSourceActionConfig
|
|
16069
16072
|
};
|
|
16070
16073
|
});
|
|
16071
|
-
const tableConfig = (0, vue.computed)(() => ({
|
|
16074
|
+
const tableConfig = (0, vue.computed)(() => (0, _tmagic_form.defineFormItem)({
|
|
16072
16075
|
type: "table",
|
|
16073
16076
|
name: "events",
|
|
16074
16077
|
items: [
|
|
@@ -16101,7 +16104,7 @@
|
|
|
16101
16104
|
}
|
|
16102
16105
|
]
|
|
16103
16106
|
}));
|
|
16104
|
-
const actionsConfig = (0, vue.computed)(() => ({
|
|
16107
|
+
const actionsConfig = (0, vue.computed)(() => (0, _tmagic_form.defineFormItem)({
|
|
16105
16108
|
type: "panel",
|
|
16106
16109
|
items: [{
|
|
16107
16110
|
type: "group-list",
|
|
@@ -16868,7 +16871,7 @@
|
|
|
16868
16871
|
emits: ["change"],
|
|
16869
16872
|
setup(__props, { emit: __emit }) {
|
|
16870
16873
|
const emit = __emit;
|
|
16871
|
-
const config = { items: [
|
|
16874
|
+
const config = (0, _tmagic_form.defineFormItem)({ items: [
|
|
16872
16875
|
{
|
|
16873
16876
|
name: "backgroundColor",
|
|
16874
16877
|
text: "背景色",
|
|
@@ -16943,18 +16946,20 @@
|
|
|
16943
16946
|
component: BackgroundPosition_default,
|
|
16944
16947
|
labelWidth: "68px"
|
|
16945
16948
|
}
|
|
16946
|
-
] };
|
|
16949
|
+
] });
|
|
16947
16950
|
const change = (value, eventData) => {
|
|
16948
16951
|
emit("change", value, eventData);
|
|
16949
16952
|
};
|
|
16950
16953
|
return (_ctx, _cache) => {
|
|
16951
|
-
|
|
16952
|
-
|
|
16954
|
+
const _component_MContainer = (0, vue.resolveComponent)("MContainer");
|
|
16955
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(_component_MContainer, {
|
|
16956
|
+
config: (0, vue.unref)(config),
|
|
16953
16957
|
model: __props.values,
|
|
16954
16958
|
size: __props.size,
|
|
16955
16959
|
disabled: __props.disabled,
|
|
16956
16960
|
onChange: change
|
|
16957
16961
|
}, null, 8, [
|
|
16962
|
+
"config",
|
|
16958
16963
|
"model",
|
|
16959
16964
|
"size",
|
|
16960
16965
|
"disabled"
|
|
@@ -17010,7 +17015,7 @@
|
|
|
17010
17015
|
emits: ["change"],
|
|
17011
17016
|
setup(__props, { emit: __emit }) {
|
|
17012
17017
|
const emit = __emit;
|
|
17013
|
-
const config = { items: [
|
|
17018
|
+
const config = (0, _tmagic_form.defineFormItem)({ items: [
|
|
17014
17019
|
{
|
|
17015
17020
|
type: "row",
|
|
17016
17021
|
items: [{
|
|
@@ -17071,18 +17076,20 @@
|
|
|
17071
17076
|
}
|
|
17072
17077
|
]
|
|
17073
17078
|
}
|
|
17074
|
-
] };
|
|
17079
|
+
] });
|
|
17075
17080
|
const change = (value, eventData) => {
|
|
17076
17081
|
emit("change", value, eventData);
|
|
17077
17082
|
};
|
|
17078
17083
|
return (_ctx, _cache) => {
|
|
17079
|
-
|
|
17080
|
-
|
|
17084
|
+
const _component_MContainer = (0, vue.resolveComponent)("MContainer");
|
|
17085
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(_component_MContainer, {
|
|
17086
|
+
config: (0, vue.unref)(config),
|
|
17081
17087
|
model: __props.values,
|
|
17082
17088
|
size: __props.size,
|
|
17083
17089
|
disabled: __props.disabled,
|
|
17084
17090
|
onChange: change
|
|
17085
17091
|
}, null, 8, [
|
|
17092
|
+
"config",
|
|
17086
17093
|
"model",
|
|
17087
17094
|
"size",
|
|
17088
17095
|
"disabled"
|
|
@@ -17341,7 +17348,7 @@
|
|
|
17341
17348
|
emits: ["change"],
|
|
17342
17349
|
setup(__props, { emit: __emit }) {
|
|
17343
17350
|
const emit = __emit;
|
|
17344
|
-
const config = { items: [
|
|
17351
|
+
const config = (0, _tmagic_form.defineFormItem)({ items: [
|
|
17345
17352
|
{
|
|
17346
17353
|
name: "display",
|
|
17347
17354
|
text: "模式",
|
|
@@ -17404,7 +17411,7 @@
|
|
|
17404
17411
|
tooltip: "垂直方向 起点在下沿 column-reverse"
|
|
17405
17412
|
}
|
|
17406
17413
|
],
|
|
17407
|
-
display: (
|
|
17414
|
+
display: (_mForm, { model }) => model.display === "flex"
|
|
17408
17415
|
},
|
|
17409
17416
|
{
|
|
17410
17417
|
name: "justifyContent",
|
|
@@ -17439,7 +17446,7 @@
|
|
|
17439
17446
|
tooltip: "横向平分 space-around"
|
|
17440
17447
|
}
|
|
17441
17448
|
],
|
|
17442
|
-
display: (
|
|
17449
|
+
display: (_mForm, { model }) => model.display === "flex"
|
|
17443
17450
|
},
|
|
17444
17451
|
{
|
|
17445
17452
|
name: "alignItems",
|
|
@@ -17474,7 +17481,7 @@
|
|
|
17474
17481
|
tooltip: "横向平分 space-around"
|
|
17475
17482
|
}
|
|
17476
17483
|
],
|
|
17477
|
-
display: (
|
|
17484
|
+
display: (_mForm, { model }) => model.display === "flex"
|
|
17478
17485
|
},
|
|
17479
17486
|
{
|
|
17480
17487
|
name: "flexWrap",
|
|
@@ -17499,7 +17506,7 @@
|
|
|
17499
17506
|
tooltip: "第一行在下方 wrap-reverse"
|
|
17500
17507
|
}
|
|
17501
17508
|
],
|
|
17502
|
-
display: (
|
|
17509
|
+
display: (_mForm, { model }) => model.display === "flex"
|
|
17503
17510
|
},
|
|
17504
17511
|
{
|
|
17505
17512
|
type: "row",
|
|
@@ -17570,18 +17577,19 @@
|
|
|
17570
17577
|
fieldConfig: { type: "text" }
|
|
17571
17578
|
}]
|
|
17572
17579
|
}
|
|
17573
|
-
] };
|
|
17580
|
+
] });
|
|
17574
17581
|
const change = (value, eventData) => {
|
|
17575
17582
|
emit("change", value, eventData);
|
|
17576
17583
|
};
|
|
17577
17584
|
return (_ctx, _cache) => {
|
|
17578
17585
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, [(0, vue.createVNode)((0, vue.unref)(_tmagic_form.MContainer), {
|
|
17579
|
-
config,
|
|
17586
|
+
config: (0, vue.unref)(config),
|
|
17580
17587
|
model: __props.values,
|
|
17581
17588
|
size: __props.size,
|
|
17582
17589
|
disabled: __props.disabled,
|
|
17583
17590
|
onChange: change
|
|
17584
17591
|
}, null, 8, [
|
|
17592
|
+
"config",
|
|
17585
17593
|
"model",
|
|
17586
17594
|
"size",
|
|
17587
17595
|
"disabled"
|
|
@@ -17621,7 +17629,7 @@
|
|
|
17621
17629
|
fixed: "固定定位",
|
|
17622
17630
|
sticky: "粘性定位"
|
|
17623
17631
|
};
|
|
17624
|
-
const config = { items: [
|
|
17632
|
+
const config = (0, _tmagic_form.defineFormItem)({ items: [
|
|
17625
17633
|
{
|
|
17626
17634
|
name: "position",
|
|
17627
17635
|
text: "定位",
|
|
@@ -17674,18 +17682,20 @@
|
|
|
17674
17682
|
type: "data-source-field-select",
|
|
17675
17683
|
fieldConfig: { type: "text" }
|
|
17676
17684
|
}
|
|
17677
|
-
] };
|
|
17685
|
+
] });
|
|
17678
17686
|
const change = (value, eventData) => {
|
|
17679
17687
|
emit("change", value, eventData);
|
|
17680
17688
|
};
|
|
17681
17689
|
return (_ctx, _cache) => {
|
|
17682
|
-
|
|
17683
|
-
|
|
17690
|
+
const _component_MContainer = (0, vue.resolveComponent)("MContainer");
|
|
17691
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(_component_MContainer, {
|
|
17692
|
+
config: (0, vue.unref)(config),
|
|
17684
17693
|
model: __props.values,
|
|
17685
17694
|
size: __props.size,
|
|
17686
17695
|
disabled: __props.disabled,
|
|
17687
17696
|
onChange: change
|
|
17688
17697
|
}, null, 8, [
|
|
17698
|
+
"config",
|
|
17689
17699
|
"model",
|
|
17690
17700
|
"size",
|
|
17691
17701
|
"disabled"
|
|
@@ -17714,7 +17724,7 @@
|
|
|
17714
17724
|
emits: ["change"],
|
|
17715
17725
|
setup(__props, { emit: __emit }) {
|
|
17716
17726
|
const direction = (0, vue.ref)("");
|
|
17717
|
-
const config = (0, vue.computed)(() => ({ items: [
|
|
17727
|
+
const config = (0, vue.computed)(() => (0, _tmagic_form.defineFormItem)({ items: [
|
|
17718
17728
|
{
|
|
17719
17729
|
name: `border${direction.value}Width`,
|
|
17720
17730
|
text: "边框宽度",
|
|
@@ -17755,6 +17765,7 @@
|
|
|
17755
17765
|
});
|
|
17756
17766
|
};
|
|
17757
17767
|
return (_ctx, _cache) => {
|
|
17768
|
+
const _component_MContainer = (0, vue.resolveComponent)("MContainer");
|
|
17758
17769
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$1, [(0, vue.createElementVNode)("div", _hoisted_2, [
|
|
17759
17770
|
(0, vue.createElementVNode)("div", _hoisted_3, [(0, vue.createElementVNode)("div", {
|
|
17760
17771
|
class: (0, vue.normalizeClass)(["border-icon border-icon-top", { active: direction.value === "Top" }]),
|
|
@@ -17778,7 +17789,7 @@
|
|
|
17778
17789
|
class: (0, vue.normalizeClass)(["border-icon border-icon-bottom", { active: direction.value === "Bottom" }]),
|
|
17779
17790
|
onClick: _cache[4] || (_cache[4] = ($event) => selectDirection("Bottom"))
|
|
17780
17791
|
}, null, 2)])
|
|
17781
|
-
]), (0, vue.createElementVNode)("div", _hoisted_6, [(0, vue.createVNode)(
|
|
17792
|
+
]), (0, vue.createElementVNode)("div", _hoisted_6, [(0, vue.createVNode)(_component_MContainer, {
|
|
17782
17793
|
config: config.value,
|
|
17783
17794
|
model: __props.model,
|
|
17784
17795
|
size: __props.size,
|
|
@@ -17808,24 +17819,26 @@
|
|
|
17808
17819
|
emits: ["change"],
|
|
17809
17820
|
setup(__props, { emit: __emit }) {
|
|
17810
17821
|
const emit = __emit;
|
|
17811
|
-
const config = { items: [{
|
|
17822
|
+
const config = (0, _tmagic_form.defineFormItem)({ items: [{
|
|
17812
17823
|
labelWidth: "68px",
|
|
17813
17824
|
name: "borderRadius",
|
|
17814
17825
|
text: "圆角",
|
|
17815
17826
|
type: "data-source-field-select",
|
|
17816
17827
|
fieldConfig: { type: "text" }
|
|
17817
|
-
}] };
|
|
17828
|
+
}] });
|
|
17818
17829
|
const change = (value, eventData) => {
|
|
17819
17830
|
emit("change", value, eventData);
|
|
17820
17831
|
};
|
|
17821
17832
|
return (_ctx, _cache) => {
|
|
17822
|
-
|
|
17823
|
-
|
|
17833
|
+
const _component_MContainer = (0, vue.resolveComponent)("MContainer");
|
|
17834
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, [(0, vue.createVNode)(_component_MContainer, {
|
|
17835
|
+
config: (0, vue.unref)(config),
|
|
17824
17836
|
model: __props.values,
|
|
17825
17837
|
size: __props.size,
|
|
17826
17838
|
disabled: __props.disabled,
|
|
17827
17839
|
onChange: change
|
|
17828
17840
|
}, null, 8, [
|
|
17841
|
+
"config",
|
|
17829
17842
|
"model",
|
|
17830
17843
|
"size",
|
|
17831
17844
|
"disabled"
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.7.8-beta.
|
|
2
|
+
"version": "1.7.8-beta.3",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"moveable": "^0.53.0",
|
|
59
59
|
"serialize-javascript": "^7.0.0",
|
|
60
60
|
"sortablejs": "^1.15.6",
|
|
61
|
-
"@tmagic/design": "1.7.8-beta.
|
|
62
|
-
"@tmagic/
|
|
63
|
-
"@tmagic/
|
|
64
|
-
"@tmagic/
|
|
65
|
-
"@tmagic/
|
|
61
|
+
"@tmagic/design": "1.7.8-beta.3",
|
|
62
|
+
"@tmagic/table": "1.7.8-beta.3",
|
|
63
|
+
"@tmagic/form": "1.7.8-beta.3",
|
|
64
|
+
"@tmagic/stage": "1.7.8-beta.3",
|
|
65
|
+
"@tmagic/utils": "1.7.8-beta.3"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/events": "^3.0.3",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"type-fest": "^5.2.0",
|
|
77
77
|
"typescript": "^5.9.3",
|
|
78
78
|
"vue": "^3.5.24",
|
|
79
|
-
"@tmagic/core": "1.7.8-beta.
|
|
79
|
+
"@tmagic/core": "1.7.8-beta.3"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|
|
82
82
|
"typescript": {
|