@tmagic/editor 1.8.0-beta.15 → 1.8.0-beta.17
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/Editor.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/es/editorProps.js +1 -0
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +41 -40
- package/dist/es/hooks/use-stage.js +1 -0
- package/dist/es/index.js +2 -2
- package/dist/es/initService.js +18 -12
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +11 -8
- package/dist/es/layouts/sidebar/ComponentListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/services/dep.js +87 -22
- package/dist/es/style.css +28 -13
- package/dist/es/utils/dep/idle-task.js +3 -0
- package/dist/es/utils/props.js +1 -45
- package/dist/es/utils/type-match-rules.js +1 -1
- package/dist/style.css +28 -13
- package/dist/themes/magic-admin.css +34 -13
- package/dist/tmagic-editor.umd.cjs +174 -108
- package/package.json +7 -7
- package/src/Editor.vue +1 -0
- package/src/editorProps.ts +6 -0
- package/src/fields/EventSelect.vue +8 -3
- package/src/hooks/use-stage.ts +1 -0
- package/src/initService.ts +25 -15
- package/src/layouts/props-panel/FormPanel.vue +12 -8
- package/src/layouts/sidebar/ComponentListPanel.vue +1 -1
- package/src/services/dep.ts +140 -24
- package/src/theme/code-block.scss +2 -2
- package/src/theme/event.scss +11 -7
- package/src/type.ts +5 -0
- package/src/utils/dep/idle-task.ts +6 -0
- package/src/utils/props.ts +1 -98
- package/src/utils/type-match-rules.ts +1 -1
- package/types/index.d.ts +27 -67
package/dist/es/utils/props.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { validateForm } from "@tmagic/form";
|
|
2
1
|
import { tMagicMessage } from "@tmagic/design";
|
|
3
2
|
import { HookType, NODE_CONDS_KEY, NODE_CONDS_RESULT_KEY, NODE_DISABLE_CODE_BLOCK_KEY, NODE_DISABLE_DATA_SOURCE_KEY } from "@tmagic/core";
|
|
4
3
|
//#region packages/editor/src/utils/props.ts
|
|
@@ -314,48 +313,5 @@ var removeStyleDisplayConfig = (formConfig) => formConfig.map((item) => {
|
|
|
314
313
|
})
|
|
315
314
|
};
|
|
316
315
|
});
|
|
317
|
-
/**
|
|
318
|
-
* 对一份「组件属性表单配置 + 值」做一次独立的校验,**不复用也不污染页面上正在展示的表单**。
|
|
319
|
-
*
|
|
320
|
-
* 内部基于 `@tmagic/form` 的 `validateForm` 另建一个独立的 MForm 实例完成校验,并统一处理
|
|
321
|
-
* 编辑器场景所需的上下文注入:将当前组件实例的 provides 合入 appContext,并向 formState 注入
|
|
322
|
-
* stage / services 及外部扩展状态,保证校验规则依赖的上下文可用。
|
|
323
|
-
*
|
|
324
|
-
* 常用于源码编辑器保存后,对最新配置做一次校验,并将校验结果(错误信息)随提交一并抛给上层记录,
|
|
325
|
-
* 使源码保存的错误状态与表单编辑保持一致。
|
|
326
|
-
*
|
|
327
|
-
* @returns 校验通过返回空字符串 `''`,否则返回以 `<br>` 拼接的错误文案。
|
|
328
|
-
* 仅在初始化超时或挂载失败等异常情况下才会 reject。
|
|
329
|
-
*
|
|
330
|
-
* @example
|
|
331
|
-
* ```ts
|
|
332
|
-
* const error = await validatePropsForm({
|
|
333
|
-
* config,
|
|
334
|
-
* values,
|
|
335
|
-
* appContext: getCurrentInstance()?.appContext,
|
|
336
|
-
* services,
|
|
337
|
-
* stage: editorService.get('stage'),
|
|
338
|
-
* extendState,
|
|
339
|
-
* });
|
|
340
|
-
* if (error) {
|
|
341
|
-
* // 配置不合法,error 为错误文案
|
|
342
|
-
* }
|
|
343
|
-
* ```
|
|
344
|
-
*/
|
|
345
|
-
var validatePropsForm = ({ config, values, appContext = null, services, stage, extendState, debug, typeMatchValid }) => validateForm({
|
|
346
|
-
config,
|
|
347
|
-
debug,
|
|
348
|
-
typeMatchValid,
|
|
349
|
-
initValues: values,
|
|
350
|
-
appContext: appContext ? {
|
|
351
|
-
...appContext,
|
|
352
|
-
provides: { services }
|
|
353
|
-
} : null,
|
|
354
|
-
extendState: async (state) => ({
|
|
355
|
-
...await extendState?.(state) || {},
|
|
356
|
-
stage,
|
|
357
|
-
services
|
|
358
|
-
})
|
|
359
|
-
});
|
|
360
316
|
//#endregion
|
|
361
|
-
export { advancedTabConfig, arrayOptions, booleanOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig, getCondOpOptionsByFieldType, numberOptions, removeStyleDisplayConfig, styleTabConfig
|
|
317
|
+
export { advancedTabConfig, arrayOptions, booleanOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig, getCondOpOptionsByFieldType, numberOptions, removeStyleDisplayConfig, styleTabConfig };
|
package/dist/style.css
CHANGED
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
border-radius: 0;
|
|
60
60
|
border-bottom: 0;
|
|
61
61
|
}
|
|
62
|
+
.tmagic-design-card.tmagic-design-card--flat.m-flat-hide-body .el-card__header {
|
|
63
|
+
border-bottom: 0 !important;
|
|
64
|
+
}
|
|
62
65
|
.tmagic-design-card.tmagic-design-card--flat.m-fields-group-list-item {
|
|
63
66
|
margin-bottom: 0;
|
|
64
67
|
}
|
|
@@ -67,18 +70,22 @@
|
|
|
67
70
|
}
|
|
68
71
|
.tmagic-design-card.tmagic-design-card--flat .el-card__header {
|
|
69
72
|
border-bottom: none;
|
|
70
|
-
padding: 16px;
|
|
73
|
+
padding: 8px 16px;
|
|
71
74
|
}
|
|
72
75
|
.tmagic-design-card.tmagic-design-card--flat .el-card__header:hover {
|
|
73
76
|
background: transparent;
|
|
74
77
|
box-shadow: none;
|
|
75
78
|
cursor: default;
|
|
76
79
|
}
|
|
80
|
+
.tmagic-design-card.tmagic-design-card--flat .m-fields-group-list-footer {
|
|
81
|
+
margin-bottom: 4px;
|
|
82
|
+
margin-top: 4px;
|
|
83
|
+
}
|
|
77
84
|
.tmagic-design-card.tmagic-design-card--flat .el-card__body {
|
|
78
85
|
padding: 0 16px 0 16px;
|
|
79
86
|
}
|
|
80
87
|
.tmagic-design-card.tmagic-design-card--flat .el-card__body .tmagic-design-form-item:not(tbody .tmagic-design-form-item) {
|
|
81
|
-
margin-bottom:
|
|
88
|
+
margin-bottom: 8px;
|
|
82
89
|
}
|
|
83
90
|
.tmagic-design-card.tmagic-design-card--flat .el-card__body > .m-container-row {
|
|
84
91
|
overflow-x: hidden;
|
|
@@ -95,7 +102,7 @@
|
|
|
95
102
|
}
|
|
96
103
|
.m-split-title-card-container > .tmagic-design-card.tmagic-design-card--flat > .el-card__body {
|
|
97
104
|
background-color: #fff;
|
|
98
|
-
padding-top:
|
|
105
|
+
padding-top: 8px;
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
.tmagic-design-color-picker-input {
|
|
@@ -434,12 +441,16 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
434
441
|
gap: 8px;
|
|
435
442
|
}
|
|
436
443
|
.m-fields-group-list .m-fields-group-list-footer {
|
|
437
|
-
display: flex;
|
|
438
444
|
justify-content: space-between;
|
|
439
445
|
margin-top: 10px;
|
|
440
446
|
margin-bottom: 16px;
|
|
441
447
|
}
|
|
442
448
|
|
|
449
|
+
/** 最外层的groupList需要每个item需要增加空白区域界限时,增加outer-gorup_list可以实现 */
|
|
450
|
+
.m-container-group-list.outer-gorup_list > .m-fields-group-list > .m-fields-group-list-item {
|
|
451
|
+
margin-bottom: 10px;
|
|
452
|
+
}
|
|
453
|
+
|
|
443
454
|
.m-form-panel .el-card__header:hover {
|
|
444
455
|
background: #f2f6fc;
|
|
445
456
|
}
|
|
@@ -1927,20 +1938,23 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
1927
1938
|
margin-bottom: 18px;
|
|
1928
1939
|
}
|
|
1929
1940
|
.m-fields-code-select .code-select-content > .m-fields-group-list > .tmagic-design-card--flat > .el-card__header {
|
|
1930
|
-
padding:
|
|
1941
|
+
padding: 8px 0;
|
|
1931
1942
|
}
|
|
1932
1943
|
.m-fields-code-select .create-button.fullWidth {
|
|
1933
1944
|
width: 100%;
|
|
1934
|
-
margin: 0 0
|
|
1945
|
+
margin: 0 0 8px 0;
|
|
1935
1946
|
}
|
|
1936
1947
|
|
|
1937
1948
|
.m-fields-event-select {
|
|
1938
1949
|
width: 100%;
|
|
1939
1950
|
}
|
|
1940
1951
|
.m-fields-event-select .fullWidth {
|
|
1941
|
-
width: 100
|
|
1952
|
+
width: calc(100% - 32px);
|
|
1942
1953
|
box-sizing: border-box;
|
|
1943
1954
|
}
|
|
1955
|
+
.m-fields-event-select .fullWidth.create-button {
|
|
1956
|
+
width: 100%;
|
|
1957
|
+
}
|
|
1944
1958
|
.m-fields-event-select .event-select-container {
|
|
1945
1959
|
padding: 0 16px;
|
|
1946
1960
|
}
|
|
@@ -1948,13 +1962,13 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
1948
1962
|
border-bottom: 1px solid #ebeef5;
|
|
1949
1963
|
}
|
|
1950
1964
|
.m-fields-event-select .event-select-container > .el-card.tmagic-design-card--flat > .el-card__body {
|
|
1951
|
-
padding-bottom:
|
|
1965
|
+
padding-bottom: 8px;
|
|
1952
1966
|
}
|
|
1953
1967
|
.m-fields-event-select .event-select-container > .el-card.tmagic-design-card--flat > .el-card__body .m-fields-group-list-footer div {
|
|
1954
1968
|
justify-content: flex-start !important;
|
|
1955
1969
|
}
|
|
1956
1970
|
.m-fields-event-select .event-select-container > .el-card.tmagic-design-card--flat > .el-card__body .el-card.tmagic-design-card--flat > .el-card__header {
|
|
1957
|
-
padding:
|
|
1971
|
+
padding: 8px 0;
|
|
1958
1972
|
}
|
|
1959
1973
|
.m-fields-event-select .event-select-code {
|
|
1960
1974
|
margin-left: 20px;
|
|
@@ -2008,18 +2022,19 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
2008
2022
|
.event-item-header {
|
|
2009
2023
|
position: relative;
|
|
2010
2024
|
width: 100%;
|
|
2025
|
+
display: flex;
|
|
2026
|
+
align-items: center;
|
|
2027
|
+
justify-content: space-between;
|
|
2011
2028
|
}
|
|
2012
2029
|
.event-item-header .event-item-title {
|
|
2013
2030
|
color: #0f1113;
|
|
2014
2031
|
font-size: 16px;
|
|
2015
2032
|
font-weight: 500;
|
|
2016
2033
|
line-height: 24px;
|
|
2017
|
-
margin-bottom:
|
|
2034
|
+
margin-bottom: 8px;
|
|
2018
2035
|
}
|
|
2019
2036
|
.event-item-header .event-item-delete-button {
|
|
2020
|
-
|
|
2021
|
-
right: 0;
|
|
2022
|
-
top: 0;
|
|
2037
|
+
color: #0f1113;
|
|
2023
2038
|
}
|
|
2024
2039
|
.event-item-header .el-form-item .el-form-item.is-error {
|
|
2025
2040
|
margin-bottom: 18px;
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
border-radius: 0;
|
|
60
60
|
border-bottom: 0;
|
|
61
61
|
}
|
|
62
|
+
.tmagic-design-card.tmagic-design-card--flat.m-flat-hide-body .el-card__header {
|
|
63
|
+
border-bottom: 0 !important;
|
|
64
|
+
}
|
|
62
65
|
.tmagic-design-card.tmagic-design-card--flat.m-fields-group-list-item {
|
|
63
66
|
margin-bottom: 0;
|
|
64
67
|
}
|
|
@@ -67,18 +70,22 @@
|
|
|
67
70
|
}
|
|
68
71
|
.tmagic-design-card.tmagic-design-card--flat .el-card__header {
|
|
69
72
|
border-bottom: none;
|
|
70
|
-
padding: 16px;
|
|
73
|
+
padding: 8px 16px;
|
|
71
74
|
}
|
|
72
75
|
.tmagic-design-card.tmagic-design-card--flat .el-card__header:hover {
|
|
73
76
|
background: transparent;
|
|
74
77
|
box-shadow: none;
|
|
75
78
|
cursor: default;
|
|
76
79
|
}
|
|
80
|
+
.tmagic-design-card.tmagic-design-card--flat .m-fields-group-list-footer {
|
|
81
|
+
margin-bottom: 4px;
|
|
82
|
+
margin-top: 4px;
|
|
83
|
+
}
|
|
77
84
|
.tmagic-design-card.tmagic-design-card--flat .el-card__body {
|
|
78
85
|
padding: 0 16px 0 16px;
|
|
79
86
|
}
|
|
80
87
|
.tmagic-design-card.tmagic-design-card--flat .el-card__body .tmagic-design-form-item:not(tbody .tmagic-design-form-item) {
|
|
81
|
-
margin-bottom:
|
|
88
|
+
margin-bottom: 8px;
|
|
82
89
|
}
|
|
83
90
|
.tmagic-design-card.tmagic-design-card--flat .el-card__body > .m-container-row {
|
|
84
91
|
overflow-x: hidden;
|
|
@@ -95,7 +102,7 @@
|
|
|
95
102
|
}
|
|
96
103
|
.m-split-title-card-container > .tmagic-design-card.tmagic-design-card--flat > .el-card__body {
|
|
97
104
|
background-color: #fff;
|
|
98
|
-
padding-top:
|
|
105
|
+
padding-top: 8px;
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
.tmagic-design-color-picker-input {
|
|
@@ -465,12 +472,16 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
465
472
|
gap: 8px;
|
|
466
473
|
}
|
|
467
474
|
.m-fields-group-list .m-fields-group-list-footer {
|
|
468
|
-
display: flex;
|
|
469
475
|
justify-content: space-between;
|
|
470
476
|
margin-top: 10px;
|
|
471
477
|
margin-bottom: 16px;
|
|
472
478
|
}
|
|
473
479
|
|
|
480
|
+
/** 最外层的groupList需要每个item需要增加空白区域界限时,增加outer-gorup_list可以实现 */
|
|
481
|
+
.m-container-group-list.outer-gorup_list > .m-fields-group-list > .m-fields-group-list-item {
|
|
482
|
+
margin-bottom: 10px;
|
|
483
|
+
}
|
|
484
|
+
|
|
474
485
|
.m-form-panel .el-card__header:hover {
|
|
475
486
|
background: #f2f6fc;
|
|
476
487
|
}
|
|
@@ -666,6 +677,12 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
666
677
|
.m-form.m-form--magic-admin .m-form-container .m-form-container-expand {
|
|
667
678
|
text-align: left;
|
|
668
679
|
}
|
|
680
|
+
.m-form.m-form--magic-admin .m-fields-group-list .el-table__empty-block .el-table__empty-text {
|
|
681
|
+
width: 100%;
|
|
682
|
+
background-color: rgba(0, 0, 0, 0.03);
|
|
683
|
+
margin-top: 8px;
|
|
684
|
+
border-radius: 4px;
|
|
685
|
+
}
|
|
669
686
|
|
|
670
687
|
.tmagic-design-input.search-input {
|
|
671
688
|
background: #fff;
|
|
@@ -2011,20 +2028,23 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
2011
2028
|
margin-bottom: 18px;
|
|
2012
2029
|
}
|
|
2013
2030
|
.m-fields-code-select .code-select-content > .m-fields-group-list > .tmagic-design-card--flat > .el-card__header {
|
|
2014
|
-
padding:
|
|
2031
|
+
padding: 8px 0;
|
|
2015
2032
|
}
|
|
2016
2033
|
.m-fields-code-select .create-button.fullWidth {
|
|
2017
2034
|
width: 100%;
|
|
2018
|
-
margin: 0 0
|
|
2035
|
+
margin: 0 0 8px 0;
|
|
2019
2036
|
}
|
|
2020
2037
|
|
|
2021
2038
|
.m-fields-event-select {
|
|
2022
2039
|
width: 100%;
|
|
2023
2040
|
}
|
|
2024
2041
|
.m-fields-event-select .fullWidth {
|
|
2025
|
-
width: 100
|
|
2042
|
+
width: calc(100% - 32px);
|
|
2026
2043
|
box-sizing: border-box;
|
|
2027
2044
|
}
|
|
2045
|
+
.m-fields-event-select .fullWidth.create-button {
|
|
2046
|
+
width: 100%;
|
|
2047
|
+
}
|
|
2028
2048
|
.m-fields-event-select .event-select-container {
|
|
2029
2049
|
padding: 0 16px;
|
|
2030
2050
|
}
|
|
@@ -2032,13 +2052,13 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
2032
2052
|
border-bottom: 1px solid #ebeef5;
|
|
2033
2053
|
}
|
|
2034
2054
|
.m-fields-event-select .event-select-container > .el-card.tmagic-design-card--flat > .el-card__body {
|
|
2035
|
-
padding-bottom:
|
|
2055
|
+
padding-bottom: 8px;
|
|
2036
2056
|
}
|
|
2037
2057
|
.m-fields-event-select .event-select-container > .el-card.tmagic-design-card--flat > .el-card__body .m-fields-group-list-footer div {
|
|
2038
2058
|
justify-content: flex-start !important;
|
|
2039
2059
|
}
|
|
2040
2060
|
.m-fields-event-select .event-select-container > .el-card.tmagic-design-card--flat > .el-card__body .el-card.tmagic-design-card--flat > .el-card__header {
|
|
2041
|
-
padding:
|
|
2061
|
+
padding: 8px 0;
|
|
2042
2062
|
}
|
|
2043
2063
|
.m-fields-event-select .event-select-code {
|
|
2044
2064
|
margin-left: 20px;
|
|
@@ -2092,18 +2112,19 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
2092
2112
|
.event-item-header {
|
|
2093
2113
|
position: relative;
|
|
2094
2114
|
width: 100%;
|
|
2115
|
+
display: flex;
|
|
2116
|
+
align-items: center;
|
|
2117
|
+
justify-content: space-between;
|
|
2095
2118
|
}
|
|
2096
2119
|
.event-item-header .event-item-title {
|
|
2097
2120
|
color: #0f1113;
|
|
2098
2121
|
font-size: 16px;
|
|
2099
2122
|
font-weight: 500;
|
|
2100
2123
|
line-height: 24px;
|
|
2101
|
-
margin-bottom:
|
|
2124
|
+
margin-bottom: 8px;
|
|
2102
2125
|
}
|
|
2103
2126
|
.event-item-header .event-item-delete-button {
|
|
2104
|
-
|
|
2105
|
-
right: 0;
|
|
2106
|
-
top: 0;
|
|
2127
|
+
color: #0f1113;
|
|
2107
2128
|
}
|
|
2108
2129
|
.event-item-header .el-form-item .el-form-item.is-error {
|
|
2109
2130
|
margin-bottom: 18px;
|