@gct-paas/design 0.1.6-dev.16 → 0.1.6-dev.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,157 +0,0 @@
1
- @charset "UTF-8";
2
- /* stylelint-disable scss/no-global-function-names */
3
- /* bem('block', 'element', 'modifier') => 'ibiz-block__element--modifier' */
4
- /**
5
- * 定义 Block 块
6
- * @param {String} $block - Block 块名称
7
- * @example
8
- * @include b('button') {
9
- * padding: 10px;
10
- * }
11
- */
12
- /**
13
- * 定义 Element 元素
14
- * @param {String|List} $element - Element 元素名称,支持单个或多个
15
- * @example
16
- * @include b('button') {
17
- * @include e('text') {
18
- * color: #000;
19
- * }
20
- * }
21
- * // 或传入多个元素
22
- * @include b('button') {
23
- * @include e(('text', 'icon')) {
24
- * margin: 5px;
25
- * }
26
- * }
27
- */
28
- /**
29
- * 定义 Modifier 修饰符
30
- * @param {String|List} $modifier - Modifier 修饰符名称,支持单个或多个
31
- * @example
32
- * @include b('button') {
33
- * @include m('primary') {
34
- * background: blue;
35
- * }
36
- * }
37
- * // 或传入多个修饰符
38
- * @include b('button') {
39
- * @include m(('primary', 'large')) {
40
- * background: blue;
41
- * font-size: 16px;
42
- * }
43
- * }
44
- */
45
- /**
46
- * 定义状态选择器
47
- * @param {String} $state - 状态名称
48
- * @example
49
- * @include b('button') {
50
- * @include when('disabled') {
51
- * opacity: 0.5;
52
- * }
53
- * }
54
- */
55
- /**
56
- * 深色主题样式
57
- * @param {String} $block - Block 块名称
58
- * @example
59
- * @include dark('button') {
60
- * background: #333;
61
- * color: #fff;
62
- * }
63
- */
64
- /* stylelint-disable scss/no-global-function-names */
65
- /**
66
- * 设计视图布局组件样式
67
- * 使用 BEM 命名规范
68
- */
69
- .gct-design-view-layout {
70
- position: relative;
71
- width: 100%;
72
- height: 100%;
73
- overflow: hidden;
74
- }
75
- .gct-design-view-layout .gct-modal-name-editor__input .ant-input.ant-input-sm {
76
- color: rgb(26, 29, 35);
77
- }
78
- .gct-design-view-layout__header {
79
- display: flex;
80
- align-items: center;
81
- justify-content: space-between;
82
- width: 100%;
83
- height: 69px;
84
- padding: 0 24px;
85
- background-color: #fff;
86
- border-bottom: 1px solid #E0E3EB;
87
- }
88
-
89
- .gct-design-view-layout__header-back {
90
- display: inline-flex;
91
- align-items: center;
92
- justify-content: center;
93
- width: 20px;
94
- height: 20px;
95
- font-size: 20px;
96
- cursor: pointer;
97
- }
98
-
99
- .gct-design-view-layout__header-info {
100
- display: inline-block;
101
- margin-left: 16px;
102
- }
103
-
104
- .gct-design-view-layout__header-sub-title {
105
- font-size: 12px;
106
- color: rgb(90, 95, 107);
107
- }
108
-
109
- .gct-design-view-layout__header-title {
110
- font-size: 14px;
111
- font-weight: 600;
112
- }
113
-
114
- .gct-design-view-layout__header-left {
115
- display: flex;
116
- align-items: center;
117
- height: 100%;
118
- }
119
-
120
- .gct-design-view-layout__header-center {
121
- position: absolute;
122
- left: 50%;
123
- transform: translateX(-50%);
124
- }
125
-
126
- .gct-design-view-layout__header-right {
127
- display: flex;
128
- align-items: center;
129
- height: 100%;
130
- }
131
-
132
- .gct-design-view-layout__header-actions {
133
- display: flex;
134
- gap: 12px;
135
- align-items: center;
136
- height: 100%;
137
- }
138
-
139
- .gct-design-view-layout__header-action-btn {
140
- display: flex;
141
- align-items: center;
142
- }
143
- .gct-design-view-layout__header-action-btn:focus {
144
- color: rgba(0, 0, 0, 0.85);
145
- border-color: #E0E3EB;
146
- }
147
- .gct-design-view-layout__header-action-btn .gct-iconfont {
148
- margin-right: 6px;
149
- font-size: 14px;
150
- }
151
- .gct-design-view-layout__header-action-btn span {
152
- height: 22px;
153
- }
154
-
155
- .gct-design-view-layout__content {
156
- height: calc(100% - 70px);
157
- }
@@ -1 +0,0 @@
1
- export declare const DesignViewLayout: any;
@@ -1,139 +0,0 @@
1
- import { DesignStepCheck } from "../design-step-check/design-step-check.mjs";
2
- import { ModalNameEditor } from "../modal-name-editor/modal-name-editor.mjs";
3
- import './design-view-layout.css';/* empty css */
4
- import { t, useNamespace } from "@gct-paas/core";
5
- import { Fragment, computed, createVNode, defineComponent, isVNode, mergeProps, ref, resolveComponent, toRefs } from "vue";
6
- //#region src/components/design-view-layout/design-view-layout.tsx
7
- function _isSlot(s) {
8
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
9
- }
10
- var DesignViewLayout = /* @__PURE__ */ defineComponent({
11
- name: "DesignViewLayout",
12
- props: {
13
- name: {
14
- type: String,
15
- default: "未命名"
16
- },
17
- defaultName: {
18
- type: String,
19
- default: "未命名卡片名称"
20
- },
21
- editName: {
22
- type: Boolean,
23
- default: true
24
- },
25
- subTitle: {
26
- type: String,
27
- default: ""
28
- },
29
- step: {
30
- type: String,
31
- default: ""
32
- },
33
- steps: {
34
- type: Array,
35
- default: () => []
36
- },
37
- actions: {
38
- type: Array,
39
- default: () => []
40
- },
41
- save: { type: Function },
42
- next: { type: Function }
43
- },
44
- emits: [
45
- "changeName",
46
- "back",
47
- "stepChange"
48
- ],
49
- setup(props, { slots, emit, expose }) {
50
- const ns = useNamespace("design-view-layout");
51
- const stepCheckRef = ref();
52
- const { name, subTitle, step, steps } = toRefs(props);
53
- const isLoading = ref(false);
54
- const val = computed({
55
- get() {
56
- return name.value;
57
- },
58
- set(val) {
59
- if (name.value !== val) {
60
- name.value = val;
61
- emit("changeName", val);
62
- }
63
- }
64
- });
65
- const isBack = computed(() => {
66
- return history.length > 1 || !!window.$wujie;
67
- });
68
- const isLastStep = computed(() => {
69
- return steps.value.length === 0 || steps.value[steps.value.length - 1]?.tag === step.value;
70
- });
71
- function onBack(e) {
72
- e.stopPropagation();
73
- emit("back", e);
74
- }
75
- async function onNext() {
76
- if (props.next) try {
77
- isLoading.value = true;
78
- await props.next();
79
- } catch (error) {
80
- console.error("DesignViewLayout: next function error", error);
81
- } finally {
82
- isLoading.value = false;
83
- }
84
- }
85
- async function onSave() {
86
- if (props.save) try {
87
- isLoading.value = true;
88
- await props.save();
89
- } catch (error) {
90
- console.error("DesignViewLayout: save function error", error);
91
- } finally {
92
- isLoading.value = false;
93
- }
94
- }
95
- function setStep(stepId) {
96
- if (stepCheckRef.value) stepCheckRef.value.setStep(stepId);
97
- }
98
- expose({ setStep });
99
- return () => {
100
- let _slot, _slot2;
101
- return createVNode("div", { "class": ns.b() }, [createVNode("div", { "class": ns.e("header") }, [
102
- createVNode("div", { "class": ns.e("header-left") }, [isBack.value ? createVNode("div", {
103
- "class": ns.e("header-back"),
104
- "onClick": onBack
105
- }, [createVNode(resolveComponent("assets-svg-icon"), { "src": "/extras-assets/card-design/arrow_back.svg" }, null)]) : null, props.editName ? createVNode("div", { "class": ns.e("header-info") }, [createVNode("div", { "class": ns.e("header-sub-title") }, [subTitle.value]), createVNode("div", { "class": ns.e("header-title") }, [createVNode(ModalNameEditor, {
106
- "value": val.value,
107
- "onUpdate:value": ($event) => val.value = $event,
108
- "defaultName": props.defaultName
109
- }, null)])]) : null]),
110
- createVNode("div", { "class": ns.e("header-center") }, [steps.value.length > 0 ? createVNode(DesignStepCheck, {
111
- "ref": (ref) => stepCheckRef.value = ref,
112
- "steps": steps.value,
113
- "currentStep": step.value,
114
- "onStepChange": (stepId, stepData) => {
115
- emit("stepChange", stepId, stepData);
116
- }
117
- }, null) : null]),
118
- createVNode("div", { "class": ns.e("header-right") }, [slots.headerRight ? slots.headerRight() : null, createVNode("div", { "class": ns.e("header-actions") }, [props.steps.length > 0 ? isLastStep.value ? createVNode(Fragment, null, [
119
- slots.headerActions ? slots.headerActions() : null,
120
- props.actions.map((actionProps) => {
121
- createVNode(resolveComponent("a-button"), mergeProps({ "class": ns.e("header-action-btn") }, actionProps), { default: () => [actionProps.title] });
122
- }),
123
- createVNode(resolveComponent("a-button"), {
124
- "class": ns.e("header-action-btn"),
125
- "type": "primary",
126
- "loading": isLoading.value,
127
- "onClick": onSave,
128
- "icon": createVNode("i", { "class": "gct-iconfont icon-icon_baocun_btn" }, null)
129
- }, _isSlot(_slot = t("sys.saveText")) ? _slot : { default: () => [_slot] })
130
- ]) : createVNode(resolveComponent("a-button"), {
131
- "type": "primary",
132
- "onClick": onNext
133
- }, _isSlot(_slot2 = t("sys.nextStep")) ? _slot2 : { default: () => [_slot2] }) : null])])
134
- ]), createVNode("div", { "class": ns.e("content") }, [slots.default ? slots.default() : null])]);
135
- };
136
- }
137
- });
138
- //#endregion
139
- export { DesignViewLayout };
@@ -1,117 +0,0 @@
1
- @charset "UTF-8";
2
- /* stylelint-disable scss/no-global-function-names */
3
- /* bem('block', 'element', 'modifier') => 'ibiz-block__element--modifier' */
4
- /**
5
- * 定义 Block 块
6
- * @param {String} $block - Block 块名称
7
- * @example
8
- * @include b('button') {
9
- * padding: 10px;
10
- * }
11
- */
12
- /**
13
- * 定义 Element 元素
14
- * @param {String|List} $element - Element 元素名称,支持单个或多个
15
- * @example
16
- * @include b('button') {
17
- * @include e('text') {
18
- * color: #000;
19
- * }
20
- * }
21
- * // 或传入多个元素
22
- * @include b('button') {
23
- * @include e(('text', 'icon')) {
24
- * margin: 5px;
25
- * }
26
- * }
27
- */
28
- /**
29
- * 定义 Modifier 修饰符
30
- * @param {String|List} $modifier - Modifier 修饰符名称,支持单个或多个
31
- * @example
32
- * @include b('button') {
33
- * @include m('primary') {
34
- * background: blue;
35
- * }
36
- * }
37
- * // 或传入多个修饰符
38
- * @include b('button') {
39
- * @include m(('primary', 'large')) {
40
- * background: blue;
41
- * font-size: 16px;
42
- * }
43
- * }
44
- */
45
- /**
46
- * 定义状态选择器
47
- * @param {String} $state - 状态名称
48
- * @example
49
- * @include b('button') {
50
- * @include when('disabled') {
51
- * opacity: 0.5;
52
- * }
53
- * }
54
- */
55
- /**
56
- * 深色主题样式
57
- * @param {String} $block - Block 块名称
58
- * @example
59
- * @include dark('button') {
60
- * background: #333;
61
- * color: #fff;
62
- * }
63
- */
64
- /* stylelint-disable scss/no-global-function-names */
65
- .gct-modal-name-editor__name {
66
- overflow: hidden;
67
- text-overflow: ellipsis;
68
- white-space: nowrap;
69
- max-width: 300px;
70
- }
71
-
72
- .gct-modal-name-editor.is-edit {
73
- cursor: default;
74
- }
75
-
76
- .gct-modal-name-editor__input {
77
- display: flex;
78
- position: relative;
79
- align-items: center;
80
- }
81
- .gct-modal-name-editor__input .anticon-loading {
82
- margin-right: var(--gct-spacing-4);
83
- }
84
- .gct-modal-name-editor__input .ant-input.ant-input-sm {
85
- padding: 0;
86
- color: rgb(var(--gct-color-text-1));
87
- }
88
- .gct-modal-name-editor__input .ant-input.ant-input-sm.ant-input-disabled {
89
- background-color: transparent;
90
- }
91
- .gct-modal-name-editor__input .ant-input[disabled] {
92
- color: rgb(var(--gct-color-text-1));
93
- }
94
-
95
- .gct-modal-name-editor__error-info {
96
- font-size: 12px;
97
- line-height: 16px;
98
- position: absolute;
99
- z-index: 10000;
100
- top: 24px;
101
- padding: var(--gct-padding-2);
102
- border-radius: var(--gct-border-radius-s);
103
- background-color: var(--gct-color-danger-light-hover);
104
- color: var(--gct-color-danger-hover);
105
- }
106
-
107
- .gct-modal-name-editor__edit {
108
- margin-left: var(--gct-spacing-4);
109
- color: rgb(var(--gct-colo-text-1));
110
- }
111
-
112
- .gct-modal-name-editor {
113
- display: flex;
114
- align-items: center;
115
- height: 22px;
116
- cursor: pointer;
117
- }
@@ -1,34 +0,0 @@
1
- export declare const ModalNameEditor: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
- value: {
3
- type: StringConstructor;
4
- default: string;
5
- };
6
- defaultName: {
7
- type: StringConstructor;
8
- default: string;
9
- };
10
- max: {
11
- type: NumberConstructor;
12
- default: number;
13
- };
14
- }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("change" | "update:value")[], "change" | "update:value", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
15
- value: {
16
- type: StringConstructor;
17
- default: string;
18
- };
19
- defaultName: {
20
- type: StringConstructor;
21
- default: string;
22
- };
23
- max: {
24
- type: NumberConstructor;
25
- default: number;
26
- };
27
- }>> & Readonly<{
28
- onChange?: ((...args: any[]) => any) | undefined;
29
- "onUpdate:value"?: ((...args: any[]) => any) | undefined;
30
- }>, {
31
- value: string;
32
- defaultName: string;
33
- max: number;
34
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
@@ -1,124 +0,0 @@
1
- import './modal-name-editor.css';/* empty css */
2
- import { useNamespace } from "@gct-paas/core";
3
- import { computed, createVNode, defineComponent, nextTick, ref, resolveComponent, watch } from "vue";
4
- import { onClickOutside } from "@vueuse/core";
5
- //#region src/components/modal-name-editor/modal-name-editor.tsx
6
- var ModalNameEditor = /* @__PURE__ */ defineComponent({
7
- name: "ModalNameEditor",
8
- props: {
9
- value: {
10
- type: String,
11
- default: "未命名"
12
- },
13
- defaultName: {
14
- type: String,
15
- default: "未命名名称"
16
- },
17
- max: {
18
- type: Number,
19
- default: 100
20
- }
21
- },
22
- emits: ["update:value", "change"],
23
- setup(props, { emit }) {
24
- const ns = useNamespace("modal-name-editor");
25
- const isEdit = ref(false);
26
- const nameInputRef = ref();
27
- const name = ref(props.value);
28
- const displayName = computed(() => {
29
- return name.value || props.defaultName;
30
- });
31
- const isError = computed(() => {
32
- if (displayName.value.length > props.max) return true;
33
- return false;
34
- });
35
- watch(() => props.value, () => {
36
- if (name.value !== props.value) name.value = props.value;
37
- });
38
- const isSaving = ref(false);
39
- const hasUserModified = ref(false);
40
- const val = computed({
41
- get() {
42
- if (isEdit.value && hasUserModified.value) return name.value;
43
- return displayName.value;
44
- },
45
- set(val) {
46
- hasUserModified.value = true;
47
- const trimmedVal = val.trim();
48
- if (name.value !== trimmedVal) {
49
- name.value = trimmedVal;
50
- emit("update:value", trimmedVal);
51
- }
52
- }
53
- });
54
- const onEditName = () => {
55
- isEdit.value = true;
56
- hasUserModified.value = false;
57
- nextTick(() => {
58
- nameInputRef.value.focus();
59
- nameInputRef.value.select();
60
- });
61
- };
62
- const onSaveName = async () => {
63
- if (name.value && name.value.trim()) {
64
- isSaving.value = true;
65
- try {
66
- emit("update:value", name.value);
67
- } finally {
68
- isSaving.value = false;
69
- }
70
- }
71
- isEdit.value = false;
72
- hasUserModified.value = false;
73
- };
74
- const onBlurOrEnter = () => {
75
- if (isEdit.value) {
76
- if (isError.value === true) {
77
- nextTick(() => {
78
- nameInputRef.value.focus();
79
- nameInputRef.value.select();
80
- });
81
- return;
82
- }
83
- onSaveName();
84
- isEdit.value = false;
85
- }
86
- };
87
- onClickOutside(nameInputRef, async () => {
88
- onBlurOrEnter();
89
- });
90
- const onChange = () => {
91
- emit("change");
92
- };
93
- return () => {
94
- return createVNode("div", { "class": ns.b() }, [
95
- createVNode("div", {
96
- "class": [ns.e("name"), ns.is("hidden", isEdit.value)],
97
- "title": val.value,
98
- "onDblclick": onEditName
99
- }, [val.value]),
100
- createVNode("div", { "class": [ns.e("input"), ns.is("hidden", !isEdit.value)] }, [
101
- isSaving.value ? createVNode(resolveComponent("loading-outlined"), null, null) : null,
102
- createVNode(resolveComponent("a-input"), {
103
- "value": val.value,
104
- "onUpdate:value": ($event) => val.value = $event,
105
- "ref": nameInputRef,
106
- "size": "small",
107
- "bordered": false,
108
- "onBlur": onBlurOrEnter,
109
- "onPressEnter": onBlurOrEnter,
110
- "disabled": isSaving.value,
111
- "onChange": onChange
112
- }, null),
113
- createVNode("div", { "class": [ns.e("error-info"), ns.is("hidden", !isError.value)] }, [`最大${props.max}字`])
114
- ]),
115
- createVNode("div", {
116
- "class": [ns.e("edit"), ns.is("hidden", isEdit.value)],
117
- "onClick": onEditName
118
- }, [createVNode("i", { "class": "iconfont icon-bianji" }, null)])
119
- ]);
120
- };
121
- }
122
- });
123
- //#endregion
124
- export { ModalNameEditor };
@@ -1,32 +0,0 @@
1
- /**
2
- * 设计视图步骤接口
3
- *
4
- * @export
5
- * @interface IViewStep
6
- */
7
- export interface IViewStep {
8
- /**
9
- * 步骤标识符
10
- *
11
- * @type {string}
12
- */
13
- tag: string;
14
- /**
15
- * 步骤名称
16
- *
17
- * @type {string}
18
- */
19
- name: string;
20
- /**
21
- * 步骤图标(只支持 svg)
22
- *
23
- * @type {string}
24
- */
25
- icon?: string;
26
- /**
27
- * 步骤描述
28
- *
29
- * @type {string}
30
- */
31
- description?: string;
32
- }