@farris/cli 1.0.28 → 2.0.0-beta.8
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/bin/index.js +2 -0
- package/lib/commands/build-components.js +40 -0
- package/lib/commands/build-components.js.map +1 -0
- package/lib/commands/build-css.js +39 -0
- package/lib/commands/build-css.js.map +1 -0
- package/lib/commands/build-lib.js +26 -0
- package/lib/commands/build-lib.js.map +1 -0
- package/lib/commands/build.js +16 -0
- package/lib/commands/build.js.map +1 -0
- package/lib/commands/create-app.js +55 -0
- package/lib/commands/create-app.js.map +1 -0
- package/lib/commands/dev-serve.js +19 -0
- package/lib/commands/dev-serve.js.map +1 -0
- package/lib/commands/preview-serve.js +17 -0
- package/lib/commands/preview-serve.js.map +1 -0
- package/lib/common/constant.js +19 -0
- package/lib/common/constant.js.map +1 -0
- package/lib/common/generate-app.js +45 -0
- package/lib/common/generate-app.js.map +1 -0
- package/lib/common/get-dependencies.js +10 -0
- package/lib/common/get-dependencies.js.map +1 -0
- package/lib/common/get-farris-config.js +12 -0
- package/lib/common/get-farris-config.js.map +1 -0
- package/lib/common/get-version.js +7 -0
- package/lib/common/get-version.js.map +1 -0
- package/lib/common/get-vite-config.js +46 -0
- package/lib/common/get-vite-config.js.map +1 -0
- package/lib/config/vite-app.js +14 -0
- package/lib/config/vite-app.js.map +1 -0
- package/lib/config/vite-common.js +21 -0
- package/lib/config/vite-common.js.map +1 -0
- package/lib/config/vite-component.js +30 -0
- package/lib/config/vite-component.js.map +1 -0
- package/lib/config/vite-lib.js +27 -0
- package/lib/config/vite-lib.js.map +1 -0
- package/lib/index.js +76 -0
- package/lib/index.js.map +1 -0
- package/lib/plugins/create-component-style.js +45 -0
- package/lib/plugins/create-component-style.js.map +1 -0
- package/lib/plugins/create-package-json.js +34 -0
- package/lib/plugins/create-package-json.js.map +1 -0
- package/lib/plugins/dts.js +9 -0
- package/lib/plugins/dts.js.map +1 -0
- package/lib/plugins/html-system.js +12 -0
- package/lib/plugins/html-system.js.map +1 -0
- package/lib/plugins/replace.js +14 -0
- package/lib/plugins/replace.js.map +1 -0
- package/lib/plugins/systemjs-bundle.js +16 -0
- package/lib/plugins/systemjs-bundle.js.map +1 -0
- package/package.json +41 -26
- package/templates/lib/.eslintrc.cjs +15 -0
- package/templates/lib/.prettierrc.json +8 -0
- package/templates/lib/components/button/index.ts +7 -0
- package/templates/lib/components/button/src/button.component.tsx +84 -0
- package/templates/lib/components/button/src/button.props.ts +55 -0
- package/templates/lib/components/button/src/button.scss +179 -0
- package/templates/lib/components/common/index.ts +6 -0
- package/templates/lib/components/common/src/common.scss +4 -0
- package/templates/lib/components/common/src/compositions/index.ts +19 -0
- package/templates/lib/components/common/src/compositions/types.ts +6 -0
- package/templates/lib/components/common/src/compositions/use-bem/index.ts +46 -0
- package/templates/lib/components/common/src/compositions/use-click-away/index.ts +40 -0
- package/templates/lib/components/common/src/compositions/use-context/use-children-contexts.ts +40 -0
- package/templates/lib/components/common/src/compositions/use-context/use-parent-context.ts +24 -0
- package/templates/lib/components/common/src/compositions/use-event-listener/index.ts +45 -0
- package/templates/lib/components/common/src/compositions/use-expose/index.ts +9 -0
- package/templates/lib/components/common/src/compositions/use-lay-render/index.ts +17 -0
- package/templates/lib/components/common/src/compositions/use-link/index.ts +14 -0
- package/templates/lib/components/common/src/compositions/use-lock-scroll/index.ts +25 -0
- package/templates/lib/components/common/src/compositions/use-long-press/index.ts +141 -0
- package/templates/lib/components/common/src/compositions/use-momentum/index.ts +82 -0
- package/templates/lib/components/common/src/compositions/use-mount-component/index.ts +48 -0
- package/templates/lib/components/common/src/compositions/use-rect/index.ts +31 -0
- package/templates/lib/components/common/src/compositions/use-refs/index.ts +21 -0
- package/templates/lib/components/common/src/compositions/use-resize-observer/index.ts +85 -0
- package/templates/lib/components/common/src/compositions/use-resize-observer/utils.ts +37 -0
- package/templates/lib/components/common/src/compositions/use-scroll-parent/index.ts +42 -0
- package/templates/lib/components/common/src/compositions/use-touch/index.ts +82 -0
- package/templates/lib/components/common/src/compositions/use-touch-move/index.ts +120 -0
- package/templates/lib/components/common/src/entity/base-property.ts +129 -0
- package/templates/lib/components/common/src/entity/entity-schema.ts +274 -0
- package/templates/lib/components/common/src/entity/input-base-property.ts +285 -0
- package/templates/lib/components/common/src/style/animation/index.scss +150 -0
- package/templates/lib/components/common/src/style/base.scss +63 -0
- package/templates/lib/components/common/src/style/fonts/farris-mobile-icon.ttf +0 -0
- package/templates/lib/components/common/src/style/icon.scss +6 -0
- package/templates/lib/components/common/src/style/index.scss +4 -0
- package/templates/lib/components/common/src/style/mixins/bem.scss +204 -0
- package/templates/lib/components/common/src/style/mixins/border-radius.scss +13 -0
- package/templates/lib/components/common/src/style/mixins/ellipsis.scss +15 -0
- package/templates/lib/components/common/src/style/mixins/hairline.scss +113 -0
- package/templates/lib/components/common/src/style/mixins/index.scss +6 -0
- package/templates/lib/components/common/src/style/mixins/margin.scss +10 -0
- package/templates/lib/components/common/src/style/mixins/safe-area.scss +9 -0
- package/templates/lib/components/common/src/style/variables.scss +113 -0
- package/templates/lib/components/common/src/utils/index.ts +15 -0
- package/templates/lib/components/common/src/utils/src/common.ts +83 -0
- package/templates/lib/components/common/src/utils/src/date.ts +134 -0
- package/templates/lib/components/common/src/utils/src/dom/event.ts +37 -0
- package/templates/lib/components/common/src/utils/src/hook.ts +18 -0
- package/templates/lib/components/common/src/utils/src/number.ts +26 -0
- package/templates/lib/components/common/src/utils/src/query-filter.ts +40 -0
- package/templates/lib/components/common/src/utils/src/resove-asset.ts +33 -0
- package/templates/lib/components/common/src/utils/src/string.ts +18 -0
- package/templates/lib/components/common/src/utils/src/throttle.ts +41 -0
- package/templates/lib/components/common/src/utils/src/transition.ts +14 -0
- package/templates/lib/components/common/src/utils/src/type.ts +105 -0
- package/templates/lib/components/common/src/utils/src/use-appearance.ts +33 -0
- package/templates/lib/components/common/src/utils/src/with-install.ts +16 -0
- package/templates/lib/components/common/src/utils/src/with-register-designer.ts +16 -0
- package/templates/lib/components/common/src/utils/src/with-register.ts +16 -0
- package/templates/lib/components/common/types.ts +131 -0
- package/templates/lib/components/index.ts +0 -0
- package/templates/lib/farris.config.mjs +56 -0
- package/templates/lib/index.html +12 -0
- package/templates/lib/package.json +29 -0
- package/templates/lib/src/App.vue +80 -0
- package/templates/lib/src/components/TheButton.vue +3 -0
- package/templates/lib/src/main.ts +10 -0
- package/templates/lib/src/router/index.ts +23 -0
- package/templates/lib/src/views/AboutView.vue +15 -0
- package/templates/lib/src/views/HomeView.vue +9 -0
- package/templates/lib/tsconfig.json +20 -0
- package/templates/mobile/.eslintrc.cjs +15 -0
- package/templates/mobile/.prettierrc.json +8 -0
- package/templates/mobile/farris.config.mjs +24 -0
- package/templates/mobile/index.html +12 -0
- package/templates/mobile/package.json +29 -0
- package/templates/mobile/src/App.vue +80 -0
- package/templates/mobile/src/components/TheButton.vue +3 -0
- package/templates/mobile/src/main.ts +12 -0
- package/templates/mobile/src/router/index.ts +23 -0
- package/templates/mobile/src/views/AboutView.vue +15 -0
- package/templates/mobile/src/views/HomeView.vue +9 -0
- package/templates/mobile/tsconfig.json +18 -0
- package/templates/web/.eslintrc.cjs +15 -0
- package/templates/web/.prettierrc.json +8 -0
- package/templates/web/farris.config.mjs +24 -0
- package/templates/web/index.html +12 -0
- package/templates/web/package.json +29 -0
- package/templates/web/src/App.vue +80 -0
- package/templates/web/src/components/TheButton.vue +3 -0
- package/templates/web/src/main.ts +10 -0
- package/templates/web/src/router/index.ts +23 -0
- package/templates/web/src/views/AboutView.vue +15 -0
- package/templates/web/src/views/HomeView.vue +9 -0
- package/templates/web/tsconfig.json +18 -0
- package/README.md +0 -2
- package/ci/cli.js +0 -467
@@ -0,0 +1,42 @@
|
|
1
|
+
import { ref, Ref, onMounted } from 'vue';
|
2
|
+
import { inBrowser } from '../../utils';
|
3
|
+
|
4
|
+
type ScrollElement = HTMLElement | Window;
|
5
|
+
|
6
|
+
const overflowScrollReg = /scroll|auto|overlay/i;
|
7
|
+
const defaultRoot = inBrowser ? window : undefined;
|
8
|
+
|
9
|
+
function isElement(node: Element) {
|
10
|
+
const ELEMENT_NODE_TYPE = 1;
|
11
|
+
return (
|
12
|
+
node.tagName !== 'HTML' &&
|
13
|
+
node.tagName !== 'BODY' &&
|
14
|
+
node.nodeType === ELEMENT_NODE_TYPE
|
15
|
+
);
|
16
|
+
}
|
17
|
+
|
18
|
+
export function getScrollParent(el: Element, root: ScrollElement | undefined = defaultRoot) {
|
19
|
+
let node = el;
|
20
|
+
|
21
|
+
while (node && node !== root && isElement(node)) {
|
22
|
+
const { overflowY } = window.getComputedStyle(node);
|
23
|
+
if (overflowScrollReg.test(overflowY)) {
|
24
|
+
return node;
|
25
|
+
}
|
26
|
+
node = node.parentNode as Element;
|
27
|
+
}
|
28
|
+
|
29
|
+
return root;
|
30
|
+
}
|
31
|
+
|
32
|
+
export function useScrollParent(el: Ref<Element | undefined>, root: ScrollElement | undefined = defaultRoot) {
|
33
|
+
const scrollParent = ref<Element | Window>();
|
34
|
+
|
35
|
+
onMounted(() => {
|
36
|
+
if (el.value) {
|
37
|
+
scrollParent.value = getScrollParent(el.value, root);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
return scrollParent;
|
42
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import { ref } from 'vue';
|
2
|
+
|
3
|
+
export const TAP_OFFSET = 5;
|
4
|
+
|
5
|
+
type Direction = '' | 'vertical' | 'horizontal';
|
6
|
+
|
7
|
+
function getDirection(x: number, y: number) {
|
8
|
+
if (x > y) {
|
9
|
+
return 'horizontal';
|
10
|
+
}
|
11
|
+
if (y > x) {
|
12
|
+
return 'vertical';
|
13
|
+
}
|
14
|
+
return '';
|
15
|
+
}
|
16
|
+
|
17
|
+
export function useTouch() {
|
18
|
+
const startX = ref(0);
|
19
|
+
const startY = ref(0);
|
20
|
+
const deltaX = ref(0);
|
21
|
+
const deltaY = ref(0);
|
22
|
+
const offsetX = ref(0);
|
23
|
+
const offsetY = ref(0);
|
24
|
+
const direction = ref<Direction>('');
|
25
|
+
const isTap = ref(true);
|
26
|
+
|
27
|
+
const isVertical = () => direction.value === 'vertical';
|
28
|
+
const isHorizontal = () => direction.value === 'horizontal';
|
29
|
+
|
30
|
+
const reset = () => {
|
31
|
+
deltaX.value = 0;
|
32
|
+
deltaY.value = 0;
|
33
|
+
offsetX.value = 0;
|
34
|
+
offsetY.value = 0;
|
35
|
+
direction.value = '';
|
36
|
+
isTap.value = true;
|
37
|
+
};
|
38
|
+
|
39
|
+
const start = ((event: TouchEvent) => {
|
40
|
+
reset();
|
41
|
+
startX.value = event.touches[0].clientX;
|
42
|
+
startY.value = event.touches[0].clientY;
|
43
|
+
}) as EventListener;
|
44
|
+
|
45
|
+
const move = ((event: TouchEvent) => {
|
46
|
+
const touch = event.touches[0];
|
47
|
+
// safari back will set clientX to negative number
|
48
|
+
deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
|
49
|
+
deltaY.value = touch.clientY - startY.value;
|
50
|
+
offsetX.value = Math.abs(deltaX.value);
|
51
|
+
offsetY.value = Math.abs(deltaY.value);
|
52
|
+
|
53
|
+
// lock direction when distance is greater than a certain value
|
54
|
+
const LOCK_DIRECTION_DISTANCE = 10;
|
55
|
+
if (
|
56
|
+
!direction.value ||
|
57
|
+
(offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE)
|
58
|
+
) {
|
59
|
+
direction.value = getDirection(offsetX.value, offsetY.value);
|
60
|
+
}
|
61
|
+
|
62
|
+
if (isTap.value && (offsetX.value > TAP_OFFSET || offsetY.value > TAP_OFFSET)) {
|
63
|
+
isTap.value = false;
|
64
|
+
}
|
65
|
+
}) as EventListener;
|
66
|
+
|
67
|
+
return {
|
68
|
+
move,
|
69
|
+
start,
|
70
|
+
reset,
|
71
|
+
startX,
|
72
|
+
startY,
|
73
|
+
deltaX,
|
74
|
+
deltaY,
|
75
|
+
offsetX,
|
76
|
+
offsetY,
|
77
|
+
direction,
|
78
|
+
isVertical,
|
79
|
+
isHorizontal,
|
80
|
+
isTap
|
81
|
+
};
|
82
|
+
}
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import { reactive, ref, Ref } from 'vue';
|
2
|
+
import { throttle } from '../../utils';
|
3
|
+
import { useEventListener } from '../use-event-listener';
|
4
|
+
|
5
|
+
const MIN_DISTANCE = 10;
|
6
|
+
|
7
|
+
type TouchDirection = 'horizontal' | 'vertical' | '';
|
8
|
+
|
9
|
+
export type TouchOffset = {
|
10
|
+
startX: number;
|
11
|
+
startY: number;
|
12
|
+
endX: number;
|
13
|
+
endY: number;
|
14
|
+
offsetX: number;
|
15
|
+
offsetY: number;
|
16
|
+
direction: TouchDirection;
|
17
|
+
};
|
18
|
+
|
19
|
+
type TouchListener = {
|
20
|
+
onTouchStart?: (event: Event) => void;
|
21
|
+
onTouchMove?: (event: Event) => void;
|
22
|
+
onTouchEnd?: (event: Event) => void;
|
23
|
+
onTouchCancel?: (event: Event) => void;
|
24
|
+
};
|
25
|
+
|
26
|
+
function getDirection(x: number, y: number): TouchDirection {
|
27
|
+
if (x > y && x > MIN_DISTANCE) {
|
28
|
+
return 'horizontal';
|
29
|
+
}
|
30
|
+
|
31
|
+
if (y > x && y > MIN_DISTANCE) {
|
32
|
+
return 'vertical';
|
33
|
+
}
|
34
|
+
return '';
|
35
|
+
}
|
36
|
+
|
37
|
+
const defaultTouchOffset: () => TouchOffset = () => {
|
38
|
+
return {
|
39
|
+
startX: 0,
|
40
|
+
startY: 0,
|
41
|
+
endX: 0,
|
42
|
+
endY: 0,
|
43
|
+
offsetX: 0,
|
44
|
+
offsetY: 0,
|
45
|
+
direction: ''
|
46
|
+
};
|
47
|
+
};
|
48
|
+
|
49
|
+
export enum DragStatus {
|
50
|
+
NotStarted,
|
51
|
+
Started,
|
52
|
+
Dragging,
|
53
|
+
End
|
54
|
+
}
|
55
|
+
|
56
|
+
export function useTouchMove(
|
57
|
+
target: Ref<EventTarget | undefined>,
|
58
|
+
listener?: TouchListener,
|
59
|
+
wait = 0
|
60
|
+
) {
|
61
|
+
let beginOffset = { offsetX: 0, offsetY: 0 };
|
62
|
+
const offset: TouchOffset = reactive(defaultTouchOffset());
|
63
|
+
const dragStatus = ref(DragStatus.NotStarted);
|
64
|
+
|
65
|
+
const touchStart = (event: any) => {
|
66
|
+
if (!event.touches || !event.touches[0]) {
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
offset.startX = event.touches[0].clientX;
|
70
|
+
offset.startY = event.touches[0].clientY;
|
71
|
+
listener?.onTouchStart && listener.onTouchStart(event);
|
72
|
+
dragStatus.value = DragStatus.Started;
|
73
|
+
};
|
74
|
+
|
75
|
+
const touchMove = (event: any) => {
|
76
|
+
if (!event.touches || !event.touches[0]) {
|
77
|
+
return;
|
78
|
+
}
|
79
|
+
const touch = event.touches[0];
|
80
|
+
offset.offsetX = touch.clientX - offset.startX + beginOffset.offsetX;
|
81
|
+
offset.offsetY = touch.clientY - offset.startY + beginOffset.offsetY;
|
82
|
+
offset.endX = event.touches[0].clientX;
|
83
|
+
offset.endY = event.touches[0].clientY;
|
84
|
+
offset.direction = getDirection(offset.offsetX, offset.offsetY);
|
85
|
+
listener?.onTouchMove && listener.onTouchMove(event);
|
86
|
+
dragStatus.value = DragStatus.Dragging;
|
87
|
+
};
|
88
|
+
|
89
|
+
const touchEnd = (event: Event) => {
|
90
|
+
beginOffset = { offsetX: offset.offsetX, offsetY: offset.offsetY };
|
91
|
+
listener?.onTouchEnd && listener.onTouchEnd(event);
|
92
|
+
listener?.onTouchCancel && listener.onTouchCancel(event);
|
93
|
+
dragStatus.value = DragStatus.End;
|
94
|
+
};
|
95
|
+
|
96
|
+
const resetTouchStatus = () => {
|
97
|
+
offset.endX = 0;
|
98
|
+
offset.endY = 0;
|
99
|
+
offset.offsetX = 0;
|
100
|
+
offset.offsetY = 0;
|
101
|
+
offset.direction = '';
|
102
|
+
beginOffset = { offsetX: 0, offsetY: 0 };
|
103
|
+
dragStatus.value = DragStatus.NotStarted;
|
104
|
+
};
|
105
|
+
|
106
|
+
if (target) {
|
107
|
+
useEventListener('touchstart', touchStart, { target });
|
108
|
+
useEventListener('touchmove', wait > 0 ? throttle(touchMove, wait) : touchMove, {
|
109
|
+
target,
|
110
|
+
passive: false
|
111
|
+
});
|
112
|
+
useEventListener('touchend', touchEnd, { target });
|
113
|
+
}
|
114
|
+
|
115
|
+
return {
|
116
|
+
offset,
|
117
|
+
dragStatus,
|
118
|
+
resetTouchStatus
|
119
|
+
};
|
120
|
+
}
|
@@ -0,0 +1,129 @@
|
|
1
|
+
import { DesignerComponentInstance, DgControl } from "@/components/designer-canvas";
|
2
|
+
import { cloneDeep } from "lodash-es";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* 控件属性基类
|
6
|
+
*/
|
7
|
+
export class BaseControlProperty {
|
8
|
+
public componentId: string;
|
9
|
+
|
10
|
+
public viewModelId: string;
|
11
|
+
|
12
|
+
public eventsEditorUtils: any;
|
13
|
+
|
14
|
+
public formSchemaUtils: any;
|
15
|
+
public formMetadataConverter: any;
|
16
|
+
public designViewModelUtils: any;
|
17
|
+
public designViewModelField: any;
|
18
|
+
public controlCreatorUtils: any;
|
19
|
+
public designerHostService: any;
|
20
|
+
|
21
|
+
schemaService: any = null;
|
22
|
+
|
23
|
+
metadataService: any = null;
|
24
|
+
|
25
|
+
protected propertyConfig = {
|
26
|
+
type: 'object',
|
27
|
+
categories: {}
|
28
|
+
};
|
29
|
+
|
30
|
+
constructor(componentId: string, designerHostService: any) {
|
31
|
+
this.componentId = componentId;
|
32
|
+
this.designerHostService = designerHostService;
|
33
|
+
this.eventsEditorUtils = designerHostService['eventsEditorUtils'];
|
34
|
+
this.formSchemaUtils = designerHostService['formSchemaUtils'];
|
35
|
+
this.formMetadataConverter = designerHostService['formMetadataConverter'];
|
36
|
+
this.viewModelId = this.formSchemaUtils?.getViewModelIdByComponentId(componentId) || '';
|
37
|
+
this.designViewModelUtils = designerHostService['designViewModelUtils'];
|
38
|
+
this.controlCreatorUtils = designerHostService['controlCreatorUtils'];
|
39
|
+
this.metadataService = designerHostService['metadataService'];
|
40
|
+
this.schemaService = designerHostService['schemaService'];
|
41
|
+
}
|
42
|
+
|
43
|
+
getTableInfo() {
|
44
|
+
return this.schemaService?.getTableInfoByViewModelId(this.viewModelId);
|
45
|
+
}
|
46
|
+
|
47
|
+
setDesignViewModelField(propertyData: any) {
|
48
|
+
const bindingFieldId = propertyData.binding && propertyData.binding.type === 'Form' && propertyData.binding.field;
|
49
|
+
// 视图模型中[字段更新时机]属性现在要在控件上维护,所以在控件上复制一份属性值
|
50
|
+
if (bindingFieldId) {
|
51
|
+
if (!this.designViewModelField) {
|
52
|
+
const dgViewModel = this.designViewModelUtils.getDgViewModel(this.viewModelId);
|
53
|
+
this.designViewModelField = dgViewModel.fields.find(f => f.id === bindingFieldId);
|
54
|
+
}
|
55
|
+
propertyData.updateOn = this.designViewModelField?.updateOn;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
getBasicPropConfig(propertyData: any): any {
|
60
|
+
return {
|
61
|
+
description: 'Basic Information',
|
62
|
+
title: '基本信息',
|
63
|
+
properties: {
|
64
|
+
id: {
|
65
|
+
description: '组件标识',
|
66
|
+
title: '标识',
|
67
|
+
type: 'string',
|
68
|
+
readonly: true
|
69
|
+
},
|
70
|
+
type: {
|
71
|
+
description: '组件类型',
|
72
|
+
title: '控件类型',
|
73
|
+
type: 'select',
|
74
|
+
editor: {
|
75
|
+
type: 'combo-list',
|
76
|
+
textField: 'name',
|
77
|
+
valueField: 'value',
|
78
|
+
editable: false,
|
79
|
+
data: [{ value: propertyData.type, name: DgControl[propertyData.type] && DgControl[propertyData.type].name }]
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
};
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
protected getAppearanceConfig(propertyData = null): any {
|
89
|
+
return {
|
90
|
+
title: "外观",
|
91
|
+
description: "Appearance",
|
92
|
+
properties: {
|
93
|
+
class: {
|
94
|
+
title: "class样式",
|
95
|
+
type: "string",
|
96
|
+
description: "组件的CSS样式",
|
97
|
+
$converter: "/converter/appearance.converter"
|
98
|
+
},
|
99
|
+
style: {
|
100
|
+
title: "style样式",
|
101
|
+
type: "string",
|
102
|
+
description: "组件的样式",
|
103
|
+
$converter: "/converter/appearance.converter"
|
104
|
+
}
|
105
|
+
}
|
106
|
+
};
|
107
|
+
}
|
108
|
+
|
109
|
+
/**
|
110
|
+
*
|
111
|
+
* @param propertyId
|
112
|
+
* @param componentInstance
|
113
|
+
* @returns
|
114
|
+
*/
|
115
|
+
public updateElementByParentContainer(propertyId: string, componentInstance: DesignerComponentInstance) {
|
116
|
+
// 1、定位控件父容器
|
117
|
+
const parentContainer = componentInstance && componentInstance.parent && componentInstance.parent['schema'];
|
118
|
+
if (!parentContainer) {
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
const index = parentContainer.contents.findIndex(c => c.id === propertyId);
|
122
|
+
// 通过cloneDeep方式的触发更新
|
123
|
+
const controlSchema = cloneDeep(parentContainer.contents[index]);
|
124
|
+
// 5、替换控件
|
125
|
+
parentContainer.contents.splice(index, 1);
|
126
|
+
parentContainer.contents.splice(index, 0, controlSchema);
|
127
|
+
}
|
128
|
+
|
129
|
+
}
|
@@ -0,0 +1,274 @@
|
|
1
|
+
/* eslint-disable no-use-before-define */
|
2
|
+
export interface FormSchema {
|
3
|
+
sourceUri: string;
|
4
|
+
id: string;
|
5
|
+
code: string;
|
6
|
+
name: string;
|
7
|
+
entities: FormSchemaEntity[];
|
8
|
+
variables: FormSchemaEntityField[];
|
9
|
+
eapiId: string;
|
10
|
+
extendProperties: { enableStdTimeFormat: boolean };
|
11
|
+
eapiCode?: string;
|
12
|
+
eapiName?: string;
|
13
|
+
eapiNameSpace?: string;
|
14
|
+
voPath?: string;
|
15
|
+
voNameSpace?: string;
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* 实体
|
20
|
+
*/
|
21
|
+
export interface FormSchemaEntity {
|
22
|
+
id: string;
|
23
|
+
code: string;
|
24
|
+
name: string;
|
25
|
+
label: string;
|
26
|
+
type: FormSchemaEntityType;
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* 字段类型枚举
|
31
|
+
*/
|
32
|
+
export enum FormSchemaEntityField$Type {
|
33
|
+
/**
|
34
|
+
* 简单类型字段
|
35
|
+
*/
|
36
|
+
SimpleField = "SimpleField",
|
37
|
+
/**
|
38
|
+
* 关联/UDT类型字段
|
39
|
+
*/
|
40
|
+
ComplexField = "ComplexField"
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* 字段编辑器对象
|
44
|
+
*/
|
45
|
+
export interface FormSchemaEntityFieldEditor {
|
46
|
+
$type: string;
|
47
|
+
[propName: string]: any;
|
48
|
+
}
|
49
|
+
export interface DesignViewModelField extends FormSchemaEntityField {
|
50
|
+
valueChanging: string;
|
51
|
+
valueChanged: string;
|
52
|
+
groupId: string;
|
53
|
+
groupName: string;
|
54
|
+
isSchemaRemoved?: boolean;
|
55
|
+
updateOn?: string;
|
56
|
+
}
|
57
|
+
/**
|
58
|
+
* 字段
|
59
|
+
*/
|
60
|
+
export interface FormSchemaEntityField {
|
61
|
+
$type: FormSchemaEntityField$Type;
|
62
|
+
id: string;
|
63
|
+
originalId: string;
|
64
|
+
code: string;
|
65
|
+
label: string;
|
66
|
+
bindingField: string;
|
67
|
+
name: string;
|
68
|
+
defaultValue?: any;
|
69
|
+
require?: boolean;
|
70
|
+
readonly?: boolean;
|
71
|
+
type: FormSchemaEntityFieldType;
|
72
|
+
editor?: FormSchemaEntityFieldEditor;
|
73
|
+
path?: string;
|
74
|
+
bindingPath?: string;
|
75
|
+
multiLanguage?: boolean;
|
76
|
+
expression?: any;
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* 字段类型对象中的类型枚举
|
80
|
+
*/
|
81
|
+
export enum FormSchemaEntityFieldType$Type {
|
82
|
+
/**
|
83
|
+
* 字符串
|
84
|
+
*/
|
85
|
+
StringType = "StringType",
|
86
|
+
/**
|
87
|
+
* 备注
|
88
|
+
*/
|
89
|
+
TextType = "TextType",
|
90
|
+
/**
|
91
|
+
* 数字(整数、浮点数)
|
92
|
+
*/
|
93
|
+
NumericType = "NumericType",
|
94
|
+
/**
|
95
|
+
* 布尔
|
96
|
+
*/
|
97
|
+
BooleanType = "BooleanType",
|
98
|
+
/**
|
99
|
+
* 日期
|
100
|
+
*/
|
101
|
+
DateType = "DateType",
|
102
|
+
/**
|
103
|
+
* 日期时间
|
104
|
+
*/
|
105
|
+
DateTimeType = "DateTimeType",
|
106
|
+
/**
|
107
|
+
* 枚举
|
108
|
+
*/
|
109
|
+
EnumType = "EnumType",
|
110
|
+
/**
|
111
|
+
* 实体类
|
112
|
+
*/
|
113
|
+
EntityType = "EntityType",
|
114
|
+
/**
|
115
|
+
* 分级码
|
116
|
+
*/
|
117
|
+
HierarchyType = "HierarchyType",
|
118
|
+
/**
|
119
|
+
* 对象
|
120
|
+
*/
|
121
|
+
ObjectType = "ObjectType",
|
122
|
+
/**
|
123
|
+
* 数字(大数据)
|
124
|
+
*/
|
125
|
+
BigNumericType = "BigNumericType"
|
126
|
+
}
|
127
|
+
/**
|
128
|
+
* 字段类型中的名称
|
129
|
+
*/
|
130
|
+
export enum FormSchemaEntityFieldTypeName {
|
131
|
+
/**
|
132
|
+
* 简单类型字段
|
133
|
+
*/
|
134
|
+
String = "String",
|
135
|
+
/**
|
136
|
+
* 日期时间
|
137
|
+
*/
|
138
|
+
DateTime = "DateTime",
|
139
|
+
/**
|
140
|
+
* 日期
|
141
|
+
*/
|
142
|
+
Date = "Date",
|
143
|
+
/**
|
144
|
+
* 枚举
|
145
|
+
*/
|
146
|
+
Enum = "Enum",
|
147
|
+
/**
|
148
|
+
* 布尔
|
149
|
+
*/
|
150
|
+
Boolean = "Boolean",
|
151
|
+
/**
|
152
|
+
* 数字
|
153
|
+
*/
|
154
|
+
Number = "Number",
|
155
|
+
/**
|
156
|
+
* 备注
|
157
|
+
*/
|
158
|
+
Text = "Text",
|
159
|
+
/**
|
160
|
+
* 大数字
|
161
|
+
*/
|
162
|
+
BigNumber = "BigNumber"
|
163
|
+
/**
|
164
|
+
* 人员
|
165
|
+
*/
|
166
|
+
}
|
167
|
+
/**
|
168
|
+
* 枚举类型
|
169
|
+
*/
|
170
|
+
export interface EnumData {
|
171
|
+
value: string;
|
172
|
+
name: string;
|
173
|
+
}
|
174
|
+
/**
|
175
|
+
* 实体
|
176
|
+
*/
|
177
|
+
export interface FormSchemaEntity {
|
178
|
+
id: string;
|
179
|
+
code: string;
|
180
|
+
name: string;
|
181
|
+
label: string;
|
182
|
+
type: FormSchemaEntityType;
|
183
|
+
}
|
184
|
+
/**
|
185
|
+
* 实体类型对象
|
186
|
+
*/
|
187
|
+
export interface FormSchemaEntityType {
|
188
|
+
$type: string;
|
189
|
+
name: string;
|
190
|
+
primary: string;
|
191
|
+
fields: FormSchemaEntityField[];
|
192
|
+
entities?: FormSchemaEntity[];
|
193
|
+
displayName?: string;
|
194
|
+
}
|
195
|
+
/**
|
196
|
+
* 字段类型对象
|
197
|
+
*/
|
198
|
+
export interface FormSchemaEntityFieldType {
|
199
|
+
$type: FormSchemaEntityFieldType$Type;
|
200
|
+
name: FormSchemaEntityFieldTypeName | any;
|
201
|
+
length?: number;
|
202
|
+
precision?: number;
|
203
|
+
valueType?: FormSchemaEntityFieldType;
|
204
|
+
enumValues?: EnumData[];
|
205
|
+
fields?: FormSchemaEntityField[];
|
206
|
+
displayName?: string;
|
207
|
+
primary?: string;
|
208
|
+
entities?: FormSchemaEntity[];
|
209
|
+
elementType?: GSPElementDataType;
|
210
|
+
extendProperty?: any;
|
211
|
+
}
|
212
|
+
/**
|
213
|
+
* 字段数据类型
|
214
|
+
*/
|
215
|
+
export enum GSPElementDataType {
|
216
|
+
/**
|
217
|
+
* 文本
|
218
|
+
*/
|
219
|
+
String = "String",
|
220
|
+
/**
|
221
|
+
* 备注
|
222
|
+
*/
|
223
|
+
Text = "Text",
|
224
|
+
/**
|
225
|
+
* 整数
|
226
|
+
*/
|
227
|
+
Integer = "Integer",
|
228
|
+
/**
|
229
|
+
* 浮点数
|
230
|
+
*/
|
231
|
+
Decimal = "Decimal",
|
232
|
+
/**
|
233
|
+
* 布尔型
|
234
|
+
*/
|
235
|
+
Boolean = "Boolean",
|
236
|
+
/**
|
237
|
+
* 日期型
|
238
|
+
*/
|
239
|
+
Date = "Date",
|
240
|
+
/**
|
241
|
+
* 日期时间型
|
242
|
+
*/
|
243
|
+
DateTime = "DateTime",
|
244
|
+
/**
|
245
|
+
* 二进制
|
246
|
+
*/
|
247
|
+
Binary = "Binary"
|
248
|
+
}
|
249
|
+
/**
|
250
|
+
* dom Json ViewModel 节点中states实体
|
251
|
+
*/
|
252
|
+
export interface FormVariable {
|
253
|
+
id: string;
|
254
|
+
code: string;
|
255
|
+
name: string;
|
256
|
+
value?: any;
|
257
|
+
type: string;
|
258
|
+
category: string;
|
259
|
+
fields?: any[];
|
260
|
+
defaultValue?: any;
|
261
|
+
}
|
262
|
+
/**
|
263
|
+
* 表单变量
|
264
|
+
*/
|
265
|
+
export interface DesignFormVariable extends FormVariable {
|
266
|
+
/**
|
267
|
+
* 分组ID
|
268
|
+
*/
|
269
|
+
groupId: string;
|
270
|
+
/**
|
271
|
+
* 分组名称
|
272
|
+
*/
|
273
|
+
groupName: string;
|
274
|
+
}
|