@farris/cli 2.0.3 → 2.1.0

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 (125) hide show
  1. package/lib/commands/build.js +6 -7
  2. package/lib/commands/build.js.map +1 -1
  3. package/lib/commands/generate/api.js +188 -0
  4. package/lib/commands/generate/api.js.map +1 -0
  5. package/lib/commands/generate/common.js +101 -0
  6. package/lib/commands/generate/common.js.map +1 -0
  7. package/lib/commands/generate/component.js +163 -0
  8. package/lib/commands/generate/component.js.map +1 -0
  9. package/lib/commands/generate/view.js +195 -0
  10. package/lib/commands/generate/view.js.map +1 -0
  11. package/lib/commands/workspace/add-app.js +170 -0
  12. package/lib/commands/workspace/add-app.js.map +1 -0
  13. package/lib/commands/workspace/create.js +310 -0
  14. package/lib/commands/workspace/create.js.map +1 -0
  15. package/lib/commands/workspace/inspect.js +31 -0
  16. package/lib/commands/workspace/inspect.js.map +1 -0
  17. package/lib/commands/workspace/verify.js +39 -0
  18. package/lib/commands/workspace/verify.js.map +1 -0
  19. package/lib/common/constant.js +42 -1
  20. package/lib/common/constant.js.map +1 -1
  21. package/lib/common/get-vite-config.js +66 -9
  22. package/lib/common/get-vite-config.js.map +1 -1
  23. package/lib/common/output.js +93 -0
  24. package/lib/common/output.js.map +1 -0
  25. package/lib/common/safety.js +172 -0
  26. package/lib/common/safety.js.map +1 -0
  27. package/lib/common/template-renderer.js +113 -0
  28. package/lib/common/template-renderer.js.map +1 -0
  29. package/lib/common/transaction.js +84 -0
  30. package/lib/common/transaction.js.map +1 -0
  31. package/lib/common/verifier.js +147 -0
  32. package/lib/common/verifier.js.map +1 -0
  33. package/lib/config/vite-common.js +1 -1
  34. package/lib/config/vite-common.js.map +1 -1
  35. package/lib/index.js +124 -30
  36. package/lib/index.js.map +1 -1
  37. package/package.json +14 -10
  38. package/templates/workspace/app/farris.config.mjs +13 -0
  39. package/templates/{lib → workspace/app}/index.html +12 -12
  40. package/templates/workspace/app/package.json +22 -0
  41. package/templates/workspace/app/src/App.tsx +11 -0
  42. package/templates/workspace/app/src/main.ts +11 -0
  43. package/templates/workspace/app/src/router/index.ts +16 -0
  44. package/templates/workspace/app/src/styles/index.css +0 -0
  45. package/templates/workspace/app/src/styles/index.scss +0 -0
  46. package/templates/workspace/app/src/views/home/composables/use-home.ts +7 -0
  47. package/templates/workspace/app/src/views/home/home.component.tsx +15 -0
  48. package/templates/workspace/app/src/views/home/index.ts +4 -0
  49. package/templates/workspace/app/tsconfig.json +21 -0
  50. package/templates/workspace/root/README.md +28 -0
  51. package/templates/workspace/root/package.json +13 -0
  52. package/templates/workspace/root/pnpm-workspace.yaml +12 -0
  53. package/templates/lib/.eslintrc.cjs +0 -15
  54. package/templates/lib/.prettierrc.json +0 -8
  55. package/templates/lib/components/button/index.ts +0 -7
  56. package/templates/lib/components/button/src/button.component.tsx +0 -84
  57. package/templates/lib/components/button/src/button.props.ts +0 -55
  58. package/templates/lib/components/button/src/button.scss +0 -179
  59. package/templates/lib/components/common/index.ts +0 -6
  60. package/templates/lib/components/common/src/common.scss +0 -4
  61. package/templates/lib/components/common/src/compositions/index.ts +0 -19
  62. package/templates/lib/components/common/src/compositions/types.ts +0 -6
  63. package/templates/lib/components/common/src/compositions/use-bem/index.ts +0 -46
  64. package/templates/lib/components/common/src/compositions/use-click-away/index.ts +0 -40
  65. package/templates/lib/components/common/src/compositions/use-context/use-children-contexts.ts +0 -40
  66. package/templates/lib/components/common/src/compositions/use-context/use-parent-context.ts +0 -24
  67. package/templates/lib/components/common/src/compositions/use-event-listener/index.ts +0 -45
  68. package/templates/lib/components/common/src/compositions/use-expose/index.ts +0 -9
  69. package/templates/lib/components/common/src/compositions/use-lay-render/index.ts +0 -17
  70. package/templates/lib/components/common/src/compositions/use-link/index.ts +0 -14
  71. package/templates/lib/components/common/src/compositions/use-lock-scroll/index.ts +0 -25
  72. package/templates/lib/components/common/src/compositions/use-long-press/index.ts +0 -141
  73. package/templates/lib/components/common/src/compositions/use-momentum/index.ts +0 -82
  74. package/templates/lib/components/common/src/compositions/use-mount-component/index.ts +0 -48
  75. package/templates/lib/components/common/src/compositions/use-rect/index.ts +0 -31
  76. package/templates/lib/components/common/src/compositions/use-refs/index.ts +0 -21
  77. package/templates/lib/components/common/src/compositions/use-resize-observer/index.ts +0 -85
  78. package/templates/lib/components/common/src/compositions/use-resize-observer/utils.ts +0 -37
  79. package/templates/lib/components/common/src/compositions/use-scroll-parent/index.ts +0 -42
  80. package/templates/lib/components/common/src/compositions/use-touch/index.ts +0 -82
  81. package/templates/lib/components/common/src/compositions/use-touch-move/index.ts +0 -120
  82. package/templates/lib/components/common/src/entity/base-property.ts +0 -129
  83. package/templates/lib/components/common/src/entity/entity-schema.ts +0 -274
  84. package/templates/lib/components/common/src/entity/input-base-property.ts +0 -285
  85. package/templates/lib/components/common/src/style/animation/index.scss +0 -150
  86. package/templates/lib/components/common/src/style/base.scss +0 -63
  87. package/templates/lib/components/common/src/style/fonts/farris-mobile-icon.ttf +0 -0
  88. package/templates/lib/components/common/src/style/icon.scss +0 -6
  89. package/templates/lib/components/common/src/style/index.scss +0 -4
  90. package/templates/lib/components/common/src/style/mixins/bem.scss +0 -204
  91. package/templates/lib/components/common/src/style/mixins/border-radius.scss +0 -13
  92. package/templates/lib/components/common/src/style/mixins/ellipsis.scss +0 -15
  93. package/templates/lib/components/common/src/style/mixins/hairline.scss +0 -113
  94. package/templates/lib/components/common/src/style/mixins/index.scss +0 -6
  95. package/templates/lib/components/common/src/style/mixins/margin.scss +0 -10
  96. package/templates/lib/components/common/src/style/mixins/safe-area.scss +0 -9
  97. package/templates/lib/components/common/src/style/variables.scss +0 -113
  98. package/templates/lib/components/common/src/utils/index.ts +0 -15
  99. package/templates/lib/components/common/src/utils/src/common.ts +0 -83
  100. package/templates/lib/components/common/src/utils/src/date.ts +0 -134
  101. package/templates/lib/components/common/src/utils/src/dom/event.ts +0 -37
  102. package/templates/lib/components/common/src/utils/src/hook.ts +0 -18
  103. package/templates/lib/components/common/src/utils/src/number.ts +0 -26
  104. package/templates/lib/components/common/src/utils/src/query-filter.ts +0 -40
  105. package/templates/lib/components/common/src/utils/src/resove-asset.ts +0 -33
  106. package/templates/lib/components/common/src/utils/src/string.ts +0 -18
  107. package/templates/lib/components/common/src/utils/src/throttle.ts +0 -41
  108. package/templates/lib/components/common/src/utils/src/transition.ts +0 -14
  109. package/templates/lib/components/common/src/utils/src/type.ts +0 -105
  110. package/templates/lib/components/common/src/utils/src/use-appearance.ts +0 -33
  111. package/templates/lib/components/common/src/utils/src/with-install.ts +0 -16
  112. package/templates/lib/components/common/src/utils/src/with-register-designer.ts +0 -16
  113. package/templates/lib/components/common/src/utils/src/with-register.ts +0 -16
  114. package/templates/lib/components/common/types.ts +0 -131
  115. package/templates/lib/components/index.scss +0 -2
  116. package/templates/lib/components/index.ts +0 -21
  117. package/templates/lib/farris.config.mjs +0 -56
  118. package/templates/lib/package.json +0 -32
  119. package/templates/lib/src/App.vue +0 -80
  120. package/templates/lib/src/components/TheButton.vue +0 -3
  121. package/templates/lib/src/main.ts +0 -10
  122. package/templates/lib/src/router/index.ts +0 -23
  123. package/templates/lib/src/views/AboutView.vue +0 -15
  124. package/templates/lib/src/views/HomeView.vue +0 -9
  125. package/templates/lib/tsconfig.json +0 -20
@@ -1,134 +0,0 @@
1
- import { isArray, isString } from './type';
2
-
3
- export const getDateRecord = (target: Date) => {
4
- const year = target.getFullYear();
5
- const month = target.getMonth() + 1;
6
- const day = target.getDate();
7
- const hours = target.getHours();
8
- const minutes = target.getMinutes();
9
- const seconds = target.getSeconds();
10
-
11
- return {
12
- year,
13
- month,
14
- day,
15
- hours,
16
- minutes,
17
- seconds
18
- };
19
- };
20
-
21
- export const getTimeRecord = (value: string | number[]) => {
22
- const [hours, minutes, seconds] = isString(value)
23
- ? value.split(':').map((item) => Number(item))
24
- : isArray(value)
25
- ? value
26
- : [0, 0, 0];
27
-
28
- return {
29
- hours,
30
- minutes,
31
- seconds
32
- };
33
- };
34
-
35
- export const isLeap = (year: number) => {
36
- return year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
37
- };
38
-
39
- export const formatTime = (
40
- value: { hours: number; minutes: number; seconds: number },
41
- format: string
42
- ) => {
43
- const { hours, minutes, seconds } = value;
44
- return format
45
- .replace('HH', String(hours).padStart(2, '0'))
46
- .replace('mm', String(minutes).padStart(2, '0'))
47
- .replace('ss', String(seconds).padStart(2, '0'));
48
- };
49
-
50
- export const parseTime = (value: string) => {
51
- const timeRegex = /^(\d{2}):(\d{2}):(\d{2})$/;
52
- const match = value.match(timeRegex);
53
-
54
- if (!match) {
55
- throw new Error('Invalid time format');
56
- }
57
-
58
- const [_, hours, minutes, seconds] = match;
59
-
60
- return new Date(0, 0, 0, parseInt(hours, 10), parseInt(minutes, 10), parseInt(seconds, 10));
61
- };
62
-
63
- export const formatDate = (value: Date, format: string) => {
64
- const { year, month, day, hours, minutes, seconds } = getDateRecord(value);
65
- return format
66
- .replace('YYYY', String(year))
67
- .replace('MM', String(month).padStart(2, '0'))
68
- .replace('DD', String(day).padStart(2, '0'))
69
- .replace('HH', String(hours).padStart(2, '0'))
70
- .replace('mm', String(minutes).padStart(2, '0'))
71
- .replace('ss', String(seconds).padStart(2, '0'));
72
- };
73
-
74
- export const parseDate = (value: string, format: string) => {
75
- const [dateValue, timeValue] = value.split(' ');
76
- const [dateFormat, timeFormat] = format.split(' ');
77
-
78
- const dateRegex = /年|月|日|-|\//g;
79
-
80
- const formatParts = dateFormat.replace(dateRegex, '-').split('-');
81
- const formatMap = formatParts.reduce((map, part, index) => {
82
- map[part] = index;
83
- return map;
84
- }, {} as Record<string, number>);
85
-
86
- const dateValueParts = dateValue
87
- .replace(dateRegex, '-')
88
- .split('-')
89
- .map((item) => Number(item));
90
-
91
- const year = dateValueParts[formatMap.YYYY];
92
- const month = dateValueParts[formatMap.MM] ? dateValueParts[formatMap.MM] - 1 : 0;
93
- const day = dateValueParts[formatMap.DD] || 1;
94
-
95
- const { hours, minutes, seconds } = getTimeRecord(timeValue);
96
-
97
- // 创建Date对象
98
- const parsedDate = new Date(year, month, day, hours, minutes, seconds);
99
-
100
- // 检查是否有效日期
101
- if (isNaN(parsedDate as any)) {
102
- throw new Error('Invalid date format');
103
- }
104
-
105
- return parsedDate;
106
- };
107
-
108
- export const compareDate = (firstDate: Date, secondDate: Date) => {
109
- return firstDate.getTime() - secondDate.getTime();
110
- };
111
-
112
- export const isEqualDate = (firstDate: Date, secondDate: Date) => {
113
- const {
114
- year: firstDateYear,
115
- month: firstDateMonth,
116
- day: firstDateDay
117
- } = getDateRecord(firstDate);
118
- const {
119
- year: secondDateYear,
120
- month: secondDateMonth,
121
- day: secondDateDay
122
- } = getDateRecord(secondDate);
123
-
124
- return (
125
- compareDate(
126
- new Date(firstDateYear, firstDateMonth, firstDateDay),
127
- new Date(secondDateYear, secondDateMonth, secondDateDay)
128
- ) === 0
129
- );
130
- };
131
-
132
- export const isEqualDateTime = (firstDate: Date, secondDate: Date) => {
133
- return compareDate(firstDate, secondDate) === 0;
134
- };
@@ -1,37 +0,0 @@
1
- export function stopPropagation(event: Event) {
2
- event.stopPropagation();
3
- }
4
-
5
- export function preventDefault(event: Event, isStopPropagation?: boolean) {
6
- /* istanbul ignore else */
7
- if (typeof event.cancelable !== 'boolean' || event.cancelable) {
8
- event.preventDefault();
9
- }
10
-
11
- if (isStopPropagation) {
12
- stopPropagation(event);
13
- }
14
- }
15
-
16
- export function trigger(target: Element, type: string) {
17
- const inputEvent = document.createEvent('HTMLEvents');
18
- inputEvent.initEvent(type, true, true);
19
- target.dispatchEvent(inputEvent);
20
- }
21
-
22
- // ios event没有path属性
23
- export const initNodePath = (event: Event) => {
24
- const path: any[] = [];
25
- let currentElem: any = event.target;
26
- while (currentElem) {
27
- path.push(currentElem);
28
- currentElem = currentElem.parentElement;
29
- }
30
- if (path.indexOf(window) === -1 && path.indexOf(document) === -1) {
31
- path.push(document);
32
- }
33
- if (path.indexOf(window) === -1) {
34
- path.push(window);
35
- }
36
- return path;
37
- };
@@ -1,18 +0,0 @@
1
- import { nextTick, onMounted, onActivated } from 'vue';
2
-
3
- export function onMountedOrActivated(hook: () => any) {
4
- let mounted: boolean;
5
-
6
- onMounted(() => {
7
- hook();
8
- nextTick(() => {
9
- mounted = true;
10
- });
11
- });
12
-
13
- onActivated(() => {
14
- if (mounted) {
15
- hook();
16
- }
17
- });
18
- }
@@ -1,26 +0,0 @@
1
- import { trimExtraChar } from './string';
2
- import { isDef } from './type';
3
-
4
- export function formatToNumber(value: string, allowDot: boolean) {
5
- value = isDef(value) ? value : '';
6
- let regExp = /[^-0-9]/g;
7
- value = trimExtraChar(value, '-', /-/g);
8
- if (allowDot) {
9
- value = trimExtraChar(value, '.', /\./g);
10
- regExp = /[^-0-9.]/g;
11
- } else {
12
- value = value.split('.')[0];
13
- }
14
- return value.replace(regExp, '');
15
- }
16
-
17
- export function parseFloat(value: string | number, precision = 0) {
18
- return Number.parseFloat(value ? String(value) : '0').toFixed(precision);
19
- }
20
-
21
- export function range(num: number, min: number, max: number): number {
22
- return Math.min(Math.max(num, min), max);
23
- }
24
- export function random(min: number, max: number) {
25
- return Math.round(Math.random() * (max - min) + min);
26
- }
@@ -1,40 +0,0 @@
1
-
2
- export enum FilterCompareType {
3
- Equal = 0,
4
- NotEqual = 1,
5
- Greater = 2,
6
- GreaterOrEqual = 3,
7
- Less = 4,
8
- LessOrEqual = 5,
9
- Like = 6,
10
- LikeStartWith = 7,
11
- LikeEndWith = 8,
12
- NotLike = 9,
13
- NotLikeStartWith = 10,
14
- NotLikeEndWith = 11,
15
- Is = 12,
16
- IsNot = 13,
17
- In = 14,
18
- NotIn = 15,
19
- }
20
-
21
- export enum FilterRelation {
22
- Empty,
23
- And,
24
- Or,
25
- }
26
-
27
- export enum FilterExpressType {
28
- Value = 0,
29
- Expression = 1,
30
- }
31
-
32
- export interface FilterCondition {
33
- FilterField: string
34
- Compare: FilterCompareType
35
- Value: string
36
- Relation: FilterRelation
37
- Expresstype: FilterExpressType
38
- Lbracket: string
39
- Rbracket: string
40
- }
@@ -1,33 +0,0 @@
1
- const getKebabCase = (str: string) => {
2
- return str.replace(/[A-Z]/g, function (i) {
3
- return "-" + i.toLowerCase();
4
- });
5
- };
6
- const getCamelCase = (str: string) => {
7
- return str.replace(/-([a-z])/g, function (all, i) {
8
- return i.toUpperCase();
9
- });
10
- };
11
-
12
- const hasOwn = (v: object, s: string)=> Object.prototype.hasOwnProperty.call(v, s);
13
-
14
- export function resolveAsset (
15
- assets: Record<string, any>,
16
- id: string
17
- ): any {
18
- /* istanbul ignore if */
19
- if (typeof id !== 'string') {
20
- return;
21
- }
22
- // check local registration variations first
23
- if (hasOwn(assets, id)) {return assets[id];}
24
- const camelizedId = getKebabCase(id);
25
- if (hasOwn(assets, camelizedId)) {return assets[camelizedId];}
26
- const PascalCaseId = getCamelCase(camelizedId);
27
- if (hasOwn(assets, PascalCaseId)) {return assets[PascalCaseId];}
28
-
29
- // fallback to prototype chain
30
- const res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
31
-
32
- return res;
33
- }
@@ -1,18 +0,0 @@
1
- export function trimExtraChar(value: string, char: string, regExp: RegExp) {
2
- const index = value.indexOf(char);
3
-
4
- if (index === -1) {
5
- return value;
6
- }
7
-
8
- if (char === '-' && index !== 0) {
9
- return value.slice(0, index);
10
- }
11
-
12
- return value.slice(0, index + 1) + value.slice(index).replace(regExp, '');
13
- };
14
-
15
- export function camelToKebabCase(camelStr: string) {
16
- // 首字母转小写,其余每个大写字母前加下划线并转小写
17
- return camelStr.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
18
- }
@@ -1,41 +0,0 @@
1
- export const throttle = (
2
- fn: (...args: any)=> any,
3
- wait: number,
4
- options: { leading?: boolean; trailing?: boolean } = {}
5
- ) => {
6
- let timeout: any = null;
7
- let previous = 0;
8
-
9
- const throttled = (...args: any) => {
10
- const nowDate = +new Date();
11
-
12
- if (!previous && options.leading === false) {
13
- previous = nowDate;
14
- }
15
-
16
- const remaining = wait - (nowDate - previous);
17
-
18
- if (remaining <= 0 || remaining > wait) {
19
- if (timeout) {
20
- clearTimeout(timeout);
21
- timeout = null;
22
- }
23
- previous = nowDate;
24
- fn(...args);
25
- } else if (!timeout && options.trailing !== false) {
26
- timeout = setTimeout(() => {
27
- previous = options.leading === false ? 0 : +new Date();
28
- timeout = null;
29
- fn(...args);
30
- }, remaining);
31
- }
32
- };
33
-
34
- // 手动取消
35
- throttled.cancel = function () {
36
- clearTimeout(timeout);
37
- previous = 0;
38
- timeout = null;
39
- };
40
- return throttled;
41
- };
@@ -1,14 +0,0 @@
1
- export const getSlideTransitionName = (position: string | undefined) => {
2
- switch (position) {
3
- case 'bottom':
4
- return 'fm-slide-up';
5
- case 'top':
6
- return 'fm-slide-down';
7
- case 'left':
8
- return 'fm-slide-left';
9
- case 'right':
10
- return 'fm-slide-right';
11
- default:
12
- return 'fm-fade';
13
- }
14
- };
@@ -1,105 +0,0 @@
1
- export const inBrowser = typeof window !== 'undefined';
2
-
3
- export const inIOS = () => /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent);
4
-
5
- export const inAndroid = () => /(Android|Adr)/i.test(navigator.userAgent);
6
-
7
- export function isDef<T>(val: T): val is NonNullable<T> {
8
- return val !== undefined && val !== null;
9
- }
10
-
11
- export function isNull(val: unknown): val is null {
12
- return val === null;
13
- }
14
-
15
- export function isUndefined(val: unknown): val is undefined {
16
- return val === undefined;
17
- }
18
-
19
- export function isString(val: unknown): val is string {
20
- return typeof val === 'string';
21
- }
22
-
23
- export function isNumber(val: unknown): val is number {
24
- return typeof val === 'number';
25
- }
26
-
27
- export function isBoolean(val: unknown): val is null {
28
- return typeof val === 'boolean';
29
- }
30
-
31
- export const { isArray } = Array;
32
-
33
- export function isSymbol(val: unknown): val is symbol {
34
- return typeof val === 'symbol';
35
- }
36
-
37
- export function isFunction(val: unknown): val is FunctionConstructor {
38
- return typeof val === 'function';
39
- }
40
-
41
- export function isObject(val: unknown): val is Record<any, any> {
42
- return val !== null && typeof val === 'object';
43
- }
44
-
45
- export function isPromise<T = any>(val: unknown): val is Promise<T> {
46
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
47
- }
48
-
49
- export function isNumeric(val: string) {
50
- return /^-?\d+(\.\d+)?$/.test(val);
51
- }
52
-
53
- export function isDate(val: unknown): val is Date {
54
- return typeof val === 'object' && val instanceof Date;
55
- }
56
-
57
- export function getType(val: unknown) {
58
- let type: string;
59
- switch (val) {
60
- case isString(val):{
61
- type = 'string';
62
- break;
63
- }
64
- case isNumber(val):{
65
- type = 'number';
66
- break;
67
- }
68
- case isDate(val):{
69
- type = 'date';
70
- break;
71
- }
72
- case isNull(val):{
73
- type = 'null';
74
- break;
75
- }
76
- case isUndefined(val):{
77
- type = 'undefined';
78
- break;
79
- }
80
- case isArray(val):{
81
- type = 'array';
82
- break;
83
- }
84
- case isSymbol(val):{
85
- type = 'symbol';
86
- break;
87
- }
88
- case isFunction(val):{
89
- type = 'function';
90
- break;
91
- }
92
- case isPromise(val):{
93
- type = 'promise';
94
- break;
95
- }
96
- case isObject(val):{
97
- type = 'object';
98
- break;
99
- }
100
- default:
101
- type = typeof val;
102
- break;
103
- }
104
- return type;
105
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * 根据传递过来已有的类对象和自定义类名,构造新的样式对象
3
- * @param classObject
4
- * @param customClass
5
- * @returns
6
- */
7
- export function getCustomClass(classObject: Record<string, any>, customClass: string) {
8
- const customClassArray = customClass?.split(' ') || [];
9
- customClassArray.reduce((result: Record<string, boolean>, classString: string) => {
10
- if (classString) {
11
- result[classString] = true;
12
- }
13
- return result;
14
- }, classObject);
15
- return classObject;
16
- }
17
- /**
18
- * 根据传递过来已有的style对象和自定义style,构造新的style对象
19
- * @param styleObject
20
- * @param customStyle
21
- * @returns
22
- */
23
- export function getCustomStyle(styleObject: Record<string, any>, customStyle: string) {
24
- const styleArray = customStyle?.split(';') || [];
25
- styleArray.reduce((result: Record<string, any>, styleString: string) => {
26
- if (styleString) {
27
- const styles = styleString.split(':');
28
- result[styles[0]] = styles[1];
29
- }
30
- return result;
31
- }, styleObject);
32
- return styleObject;
33
- }
@@ -1,16 +0,0 @@
1
- import type { App, Component } from 'vue';
2
-
3
- export type WithInstall<T> = T & {
4
- install(app: App): void;
5
- };
6
-
7
- export function withInstall<T extends Component>(options: T) {
8
- (options as Record<string, unknown>).install = (app: App) => {
9
- const { name } = options;
10
- if (name) {
11
- app.component(name, options);
12
- }
13
- };
14
-
15
- return options as WithInstall<T>;
16
- }
@@ -1,16 +0,0 @@
1
- import type { App, Component } from 'vue';
2
-
3
- export type WithRegisterDesigner<T> = T & {
4
- registerDesigner(app: App): void;
5
- };
6
-
7
- export function withRegisterDesigner<T extends Component>(component: T, options: { name: string, designerComponent: Component, propsResolver: (schemaValue?: Record<string, any>) => Record<string, any> }) {
8
- const { name, designerComponent, propsResolver } = options;
9
-
10
- (component as Record<string, unknown>).registerDesigner = (componentMap: Record<string, any>, propsResolverMap: Record<string, any>, configResolverMap: Record<string, any>, resolverMap: Record<string, any>) => {
11
- componentMap[name] = designerComponent;
12
- propsResolverMap[name] = propsResolver;
13
- };
14
-
15
- return component as WithRegisterDesigner<T>;
16
- }
@@ -1,16 +0,0 @@
1
- import type { App, Component } from 'vue';
2
-
3
- export type WithRegister<T> = T & {
4
- register(app: App): void;
5
- };
6
-
7
- export function withRegister<T extends Component>(component: T, options: { name: string, propsResolver: (schemaValue?: Record<string, any>) => Record<string, any> }) {
8
- const { name, propsResolver } = options;
9
-
10
- (component as Record<string, unknown>).register = (componentMap: Record<string, any>, propsResolverMap: Record<string, any>, configResolverMap: Record<string, any>, resolverMap: Record<string, any>) => {
11
- componentMap[name] = component;
12
- propsResolverMap[name] = propsResolver;
13
- };
14
-
15
- return component as WithRegister<T>;
16
- }
@@ -1,131 +0,0 @@
1
- import { ComputedRef, Ref } from "vue";
2
-
3
- export interface TextBoxProps {
4
-
5
- customClass: string;
6
-
7
- disabled: boolean;
8
-
9
- editable: boolean;
10
-
11
- enableClear: boolean;
12
-
13
- enableTitle: boolean;
14
-
15
- forcePlaceholder: boolean;
16
-
17
- modelValue: string;
18
-
19
- placeholder: string;
20
-
21
- readonly: boolean;
22
-
23
- textAlign: string;
24
-
25
- showBorder: boolean;
26
-
27
- updateOn: 'blur' | 'change';
28
- }
29
-
30
- export interface UseClear {
31
-
32
- clearButtonClass: ComputedRef<Record<string, boolean>>;
33
-
34
- clearButtonStyle: ComputedRef<Record<string, any>>;
35
-
36
- hasShownClearButton: Ref<boolean>;
37
-
38
- onClearValue: ($event: MouseEvent) => void;
39
-
40
- onMouseEnter: ($event: MouseEvent) => void;
41
-
42
- onMouseLeave: ($event: MouseEvent) => void;
43
-
44
- shouldShowClearButton: ComputedRef<boolean>;
45
- }
46
-
47
- export interface UseTextBox {
48
-
49
- changeTextBoxValue: (newValue: string, shouldEmitChangeEvent: boolean) => void;
50
-
51
- disabled?: Ref<boolean>;
52
-
53
- displayText?: Ref<string>;
54
-
55
- editable?: Ref<boolean>;
56
-
57
- hasFocused?: ComputedRef<boolean>;
58
-
59
- inputGroupClass: ComputedRef<Record<string, boolean>>;
60
-
61
- inputType: Ref<string>;
62
-
63
- isEmpty: ComputedRef<boolean>;
64
-
65
- modelValue?: Ref<string>;
66
-
67
- readonly?: ComputedRef<boolean>;
68
-
69
- onBlur?: (payload: FocusEvent) => boolean;
70
-
71
- onClick?: (payload: MouseEvent) => void;
72
-
73
- onFocus?: (payload: FocusEvent) => void;
74
-
75
- onInput?: (payload: Event) => void;
76
-
77
- onKeydown?: (payload: KeyboardEvent) => void;
78
-
79
- onKeyup?: (payload: KeyboardEvent) => void;
80
-
81
- onMousedown?: (payload: MouseEvent) => void;
82
-
83
- onTextBoxValueChange?: (payload: Event) => void;
84
-
85
- placeholder: ComputedRef<string>;
86
-
87
- textBoxClass: ComputedRef<Record<string, boolean>>;
88
-
89
- textBoxTitle: ComputedRef<string>;
90
-
91
- inputGroupStyle: ComputedRef<string>;
92
- }
93
-
94
- export interface UseDateFormat {
95
- formatTo: (date: string | Date, format: string) => string;
96
- }
97
- export type NumberType = string | number;
98
- export interface NumberOption {
99
- prefix?: string;
100
- suffix?: string;
101
- decimalSeparator?: string;
102
- groupSeparator?: string;
103
- [key: string]: any;
104
- }
105
- export interface UseNumberFormat {
106
- formatTo: (value: NumberType, opts: any) => string;
107
- removeFormat: (value: NumberType | null | undefined, opts: any) => string;
108
- convertCurrency: (money: string) => string;
109
- toFixed: (value: string, precision: number) => string;
110
- toNumber: (value: string) => number;
111
- greaterThan: (firstValue: NumberType, secondValue: NumberType) => boolean;
112
- lessThan: (firstValue: NumberType, secondValue: NumberType) => boolean;
113
- equal: (firstValue: NumberType, secondValue: NumberType) => boolean;
114
- minus: (firstValue: NumberType, secondValue: NumberType) => string;
115
- multiplied: (firstValue: NumberType, secondValue: NumberType) => string;
116
- plus: (firstValue: NumberType, secondValue: NumberType) => string;
117
- average: (total: NumberType, len: number) => string;
118
- sum: (numberArray: NumberType[]) => string;
119
- min: (firstValue: Array<NumberType> | NumberType, secondValue: NumberType | null) => string;
120
- max: (firstValue: Array<NumberType> | NumberType, secondValue: NumberType | null) => string;
121
- }
122
-
123
- export type TimeAgoDate = Date | string | number;
124
- export type TimeAgoOptions = {
125
- // 可能后期有其他属性
126
- /** 相对的日期 */
127
- readonly relativeDate?: TimeAgoDate;
128
- };
129
- export interface UseTimeAgoFormat {
130
- formatTo(date: TimeAgoDate, opts?: TimeAgoOptions): string
131
- }
@@ -1,2 +0,0 @@
1
- @use './button/src/button.scss';
2
-