@gct-paas/design 0.1.6-dev.9 → 6.0.0-dev.2

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.
Files changed (89) hide show
  1. package/README.md +157 -0
  2. package/dist/index.min.css +1 -1
  3. package/dist/loader.esm.min.js +2 -1
  4. package/es/components/field-transfer/components/field-transfer-modal.vue.mjs +2 -2
  5. package/es/components/field-transfer/components/field-transfer-modal.vue_vue_type_style_index_0_scoped_2f34388d_lang.css +8 -0
  6. package/es/components/index.d.ts +0 -4
  7. package/es/components/index.mjs +0 -5
  8. package/es/components/mobile-container/mobile-container.d.ts +2 -2
  9. package/es/components/multi-field/multi-field-display.vue.mjs +2 -2
  10. package/es/components/multi-field/multi-field-display.vue_vue_type_script_setup_true_lang.mjs +1 -1
  11. package/es/components/multi-field/{multi-field-display.vue_vue_type_style_index_0_scoped_802ade7b_lang.css → multi-field-display.vue_vue_type_style_index_0_scoped_83390705_lang.css} +1 -1
  12. package/es/components/user-occupy/index.d.ts +0 -1
  13. package/es/components/user-occupy/index.mjs +0 -1
  14. package/es/components/user-occupy/user-lock.vue.mjs +2 -2
  15. package/es/components/user-occupy/user-lock.vue_vue_type_script_setup_true_lang.mjs +2 -1
  16. package/es/components/user-occupy/user-lock.vue_vue_type_style_index_0_scoped_143659f6_lang.css +29 -0
  17. package/es/components/user-occupy/user-occupy.vue.mjs +2 -2
  18. package/es/components/user-occupy/user-occupy.vue_vue_type_script_setup_true_lang.mjs +2 -1
  19. package/es/components/user-occupy/{user-occupy.vue_vue_type_style_index_0_scoped_9b136922_lang.css → user-occupy.vue_vue_type_style_index_0_scoped_1234af11_lang.css} +6 -6
  20. package/es/constant/index.d.ts +5 -0
  21. package/es/constant/index.mjs +6 -1
  22. package/es/constant/page-designer.d.ts +9 -36
  23. package/es/constant/page-designer.mjs +2 -32
  24. package/es/{components/user-occupy → hooks/design-view/components}/useUserOccupy.d.ts +3 -3
  25. package/es/{components/user-occupy → hooks/design-view/components}/useUserOccupy.mjs +48 -27
  26. package/es/hooks/design-view/design-state.d.ts +91 -1
  27. package/es/hooks/design-view/design-state.mjs +7 -7
  28. package/es/hooks/design-view/designer/useDesignCache.mjs +2 -3
  29. package/es/hooks/design-view/designer/useDesignPreview.mjs +15 -5
  30. package/es/hooks/design-view/designer/useDesignSave.d.ts +2 -2
  31. package/es/hooks/design-view/designer/useDesignSave.mjs +160 -23
  32. package/es/hooks/design-view/layout/useToolkit.d.ts +1 -1
  33. package/es/hooks/design-view/layout/useToolkit.mjs +166 -82
  34. package/es/hooks/design-view/page/usePage.d.ts +17 -7
  35. package/es/hooks/design-view/page/usePage.mjs +205 -9
  36. package/es/hooks/design-view/useDesigner.d.ts +7 -2
  37. package/es/hooks/design-view/useDesigner.mjs +25 -3
  38. package/es/hooks/design-view/widget/useSelectedWidget.mjs +55 -28
  39. package/es/hooks/design-view/widget/useWidget.mjs +2 -1
  40. package/es/hooks/index.d.ts +1 -1
  41. package/es/hooks/index.mjs +1 -1
  42. package/es/index.mjs +9 -12
  43. package/es/interface/index.d.ts +0 -1
  44. package/es/locale/auto-register.d.ts +2 -0
  45. package/es/locale/auto-register.mjs +25 -0
  46. package/es/locale/sys/app.mjs +6 -0
  47. package/es/locale/sys/appDesigner.mjs +9 -0
  48. package/es/locale/sys/cardDesign.d.ts +4 -4
  49. package/es/locale/sys/cardDesign.mjs +17 -0
  50. package/es/locale/sys/component.mjs +21 -0
  51. package/es/locale/sys/model.mjs +10 -0
  52. package/es/locale/sys/pageDesigner.mjs +32 -0
  53. package/es/locale/sys/platform.mjs +11 -0
  54. package/es/locale/sys.d.ts +7 -5
  55. package/es/locale/sys.mjs +26 -0
  56. package/es/register/designer-register/designer-register.d.ts +6 -3
  57. package/es/register/designer-register/designer-register.mjs +20 -14
  58. package/es/register/index.d.ts +1 -0
  59. package/es/register/index.mjs +1 -0
  60. package/es/register/props-editor/props-editor.register.d.ts +24 -0
  61. package/es/register/props-editor/props-editor.register.mjs +30 -0
  62. package/es/schema/begin-drag/begin-drag.mjs +1 -1
  63. package/es/schema/common-config/common-field-editor-config.mjs +7 -3
  64. package/es/schema/common-config/display-editor-config.mjs +2 -2
  65. package/es/schema/field/index.mjs +17 -3
  66. package/es/setup-app.d.ts +2 -1
  67. package/es/setup-app.mjs +3 -1
  68. package/es/types/index.d.ts +2 -1
  69. package/es/utils/design-interceptors/design-interceptors.mjs +1 -1
  70. package/package.json +12 -12
  71. package/es/components/design-save-tip/design-save-tip.css +0 -107
  72. package/es/components/design-save-tip/design-save-tip.d.ts +0 -44
  73. package/es/components/design-save-tip/design-save-tip.mjs +0 -81
  74. package/es/components/design-step-check/design-step-check.css +0 -133
  75. package/es/components/design-step-check/design-step-check.d.ts +0 -30
  76. package/es/components/design-step-check/design-step-check.mjs +0 -96
  77. package/es/components/design-view-layout/design-view-layout.css +0 -157
  78. package/es/components/design-view-layout/design-view-layout.d.ts +0 -1
  79. package/es/components/design-view-layout/design-view-layout.mjs +0 -139
  80. package/es/components/field-transfer/components/field-transfer-modal.vue_vue_type_style_index_0_scoped_711e6992_lang.css +0 -8
  81. package/es/components/modal-name-editor/modal-name-editor.css +0 -117
  82. package/es/components/modal-name-editor/modal-name-editor.d.ts +0 -34
  83. package/es/components/modal-name-editor/modal-name-editor.mjs +0 -124
  84. package/es/components/user-occupy/occupy.const.d.ts +0 -4
  85. package/es/components/user-occupy/occupy.const.mjs +0 -7
  86. package/es/components/user-occupy/user-lock.vue_vue_type_style_index_0_scoped_b40d46ff_lang.css +0 -29
  87. package/es/hooks/develop/useKeyParser.d.ts +0 -16
  88. package/es/hooks/develop/useKeyParser.mjs +0 -79
  89. package/es/interface/i-view-step/i-view-step.d.ts +0 -32
@@ -1,96 +0,0 @@
1
- import './design-step-check.css';/* empty css */
2
- import { useNamespace } from "@gct-paas/core";
3
- import { createVNode, defineComponent, nextTick, onMounted, ref, toRefs, watch } from "vue";
4
- //#region src/components/design-step-check/design-step-check.tsx
5
- /**
6
- * 设计界面步骤选择
7
- */
8
- var DesignStepCheck = /* @__PURE__ */ defineComponent({
9
- name: "DesignStepCheck",
10
- props: {
11
- steps: {
12
- type: Array,
13
- default: () => []
14
- },
15
- currentStep: {
16
- type: [String, Number],
17
- default: ""
18
- }
19
- },
20
- emits: ["update:currentStep", "stepChange"],
21
- setup(props, { emit, expose }) {
22
- const ns = useNamespace("design-step-check");
23
- const { steps, currentStep } = toRefs(props);
24
- const containerRef = ref();
25
- const innerCurrentStep = ref(currentStep.value);
26
- const offsetLeft = ref(0);
27
- const width = ref(0);
28
- const updateIndicatorPosition = async () => {
29
- await new Promise((resolve) => setTimeout(resolve, 100));
30
- await nextTick();
31
- if (!containerRef.value) return;
32
- const selectedIndex = steps.value.findIndex((step) => step.tag === innerCurrentStep.value);
33
- if (selectedIndex === -1) return;
34
- const items = containerRef.value.querySelectorAll(`.${ns.e("item")}`);
35
- const selectedItem = items[selectedIndex];
36
- if (selectedItem) {
37
- offsetLeft.value = 2;
38
- for (let i = 0; i < selectedIndex; i++) {
39
- const item = items[i];
40
- offsetLeft.value += item.offsetWidth;
41
- }
42
- width.value = selectedItem.offsetWidth;
43
- }
44
- };
45
- watch(currentStep, (newValue) => {
46
- innerCurrentStep.value = newValue;
47
- updateIndicatorPosition();
48
- });
49
- watch(steps, (newSteps) => {
50
- if (newSteps.length > 0 && !innerCurrentStep.value) {
51
- innerCurrentStep.value = newSteps[0].tag;
52
- emit("update:currentStep", innerCurrentStep.value);
53
- emit("stepChange", innerCurrentStep.value, newSteps[0]);
54
- }
55
- updateIndicatorPosition();
56
- });
57
- const handleStepClick = (step) => {
58
- innerCurrentStep.value = step.tag;
59
- emit("update:currentStep", step.tag);
60
- emit("stepChange", step.tag, step);
61
- updateIndicatorPosition();
62
- };
63
- onMounted(() => {
64
- updateIndicatorPosition();
65
- });
66
- /**
67
- * 设置当前步骤,用于外部控制,不需要触发事件
68
- *
69
- * @param {string} tag
70
- */
71
- function setStep(tag) {
72
- if (steps.value.some((step) => step.tag === tag)) {
73
- innerCurrentStep.value = tag;
74
- updateIndicatorPosition();
75
- }
76
- }
77
- expose({ setStep });
78
- return () => {
79
- return createVNode("div", {
80
- "ref": containerRef,
81
- "class": ns.b(),
82
- "style": {
83
- "--indicator-display": currentStep.value ? "block" : "none",
84
- "--indicator-left": `${offsetLeft.value || -40}px`,
85
- "--indicator-width": `${width.value || -131}px`
86
- }
87
- }, [props.steps.map((step) => createVNode("div", {
88
- "key": step.tag,
89
- "class": [ns.e("item"), ns.is("selected", step.tag === innerCurrentStep.value)],
90
- "onClick": () => handleStepClick(step)
91
- }, [createVNode("div", { "class": ns.e("item-number") }, [props.steps.findIndex((s) => s.tag === step.tag) + 1]), createVNode("div", { "class": ns.e("item-name") }, [step.name])]))]);
92
- };
93
- }
94
- });
95
- //#endregion
96
- export { DesignStepCheck };
@@ -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,8 +0,0 @@
1
- .field-transfer-container[data-v-711e6992] {
2
- position: relative;
3
- width: 100%;
4
- height: 100%;
5
- }
6
- .field-transfer-container .field-cascader[data-v-711e6992] {
7
- margin-bottom: 8px;
8
- }
@@ -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,4 +0,0 @@
1
- /**
2
- * occupy 的 mqtt 唯一实例的 key 标识
3
- */
4
- export declare const OCCUPY_MQTT_KEY = "occupy_mqtt_key";
@@ -1,7 +0,0 @@
1
- //#region src/components/user-occupy/occupy.const.ts
2
- /**
3
- * occupy 的 mqtt 唯一实例的 key 标识
4
- */
5
- var OCCUPY_MQTT_KEY = "occupy_mqtt_key";
6
- //#endregion
7
- export { OCCUPY_MQTT_KEY };