zzz-pc-view 0.0.1

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 (71) hide show
  1. package/package.json +29 -0
  2. package/src/api/org/list +96 -0
  3. package/src/api/org/type/list +18 -0
  4. package/src/api/own +3831 -0
  5. package/src/decorators/CurdKey/CurdApi.d.ts +221 -0
  6. package/src/decorators/CurdKey/RequestUtil.d.ts +55 -0
  7. package/src/decorators/CurdKey/index.d.ts +752 -0
  8. package/src/decorators/DeclareType.d.ts +35 -0
  9. package/src/decorators/Decorators.d.ts +5 -0
  10. package/src/decorators/FilterKey/index.d.ts +283 -0
  11. package/src/decorators/Loader/index.d.ts +179 -0
  12. package/src/decorators/NameKey/index.d.ts +68 -0
  13. package/src/decorators/PrimaryKey/index.d.ts +68 -0
  14. package/src/decorators/api.d.ts +21 -0
  15. package/src/decorators/decoratorStoreUtil.d.ts +68 -0
  16. package/src/decorators/index.d.ts +6 -0
  17. package/src/decorators/loadStore.d.ts +6 -0
  18. package/src/decorators/loadUtil.d.ts +25 -0
  19. package/src/decorators/util.d.ts +27 -0
  20. package/src/favicon.ico +0 -0
  21. package/src/index-decorators.d.ts +3 -0
  22. package/src/index.d.ts +10 -0
  23. package/src/index.es.js +10035 -0
  24. package/src/index.umd.js +2 -0
  25. package/src/pcViews/components/curd/CurdTableView.vue.d.ts +18 -0
  26. package/src/pcViews/components/curd/CurdView.vue.d.ts +22 -0
  27. package/src/pcViews/components/curd/CurdViewHandler.d.ts +1208 -0
  28. package/src/pcViews/components/curd/FilterView.vue.d.ts +19 -0
  29. package/src/pcViews/components/curd/FilterViewHandler.d.ts +6 -0
  30. package/src/pcViews/components/curd/index.d.ts +2 -0
  31. package/src/pcViews/components/forms/RadioButtonGroupView.vue.d.ts +19 -0
  32. package/src/pcViews/components/forms/SelectView.vue.d.ts +19 -0
  33. package/src/pcViews/components/forms/VModelView.vue.d.ts +20 -0
  34. package/src/pcViews/components/forms/index.d.ts +3 -0
  35. package/src/pcViews/components/index.d.ts +5 -0
  36. package/src/pcViews/components/layout/DataWrapperView.vue.d.ts +23 -0
  37. package/src/pcViews/components/layout/LayoutHeader.vue.d.ts +2 -0
  38. package/src/pcViews/components/layout/LayoutMainView.vue.d.ts +2 -0
  39. package/src/pcViews/components/layout/index.d.ts +2 -0
  40. package/src/pcViews/components/slots/VSlotView.vue.d.ts +20 -0
  41. package/src/pcViews/components/slots/index.d.ts +1 -0
  42. package/src/pcViews/components/utils.d.ts +33 -0
  43. package/src/pcViews/index.d.ts +1 -0
  44. package/src/utils/Date/ZDate.d.ts +557 -0
  45. package/src/utils/DeclareType.d.ts +39 -0
  46. package/src/utils/class/bind.d.ts +43 -0
  47. package/src/utils/class/combine.d.ts +109 -0
  48. package/src/utils/crypto/index.d.ts +44 -0
  49. package/src/utils/empty/index.d.ts +18 -0
  50. package/src/utils/httpRequest/HttpRequestError.d.ts +14 -0
  51. package/src/utils/httpRequest/httpRequestCreator.d.ts +61 -0
  52. package/src/utils/httpRequest/httpRequestUtil.d.ts +24 -0
  53. package/src/utils/httpRequest/index.d.ts +3 -0
  54. package/src/utils/index.d.ts +11 -0
  55. package/src/utils/math/toFixed.d.ts +11 -0
  56. package/src/utils/math/unitConvertor.d.ts +34 -0
  57. package/src/utils/mock/HttpResponse.d.ts +30 -0
  58. package/src/utils/mock/createDataTimes.d.ts +20 -0
  59. package/src/utils/mock/index.d.ts +2 -0
  60. package/src/utils/reduce/completeByDate.d.ts +51 -0
  61. package/src/utils/reduce/index.d.ts +9 -0
  62. package/src/utils/reduce/mappingBuilder.d.ts +69 -0
  63. package/src/utils/reduce/ratio.d.ts +104 -0
  64. package/src/utils/reduce/sort.d.ts +12 -0
  65. package/src/utils/reduce/sumByGroup.d.ts +53 -0
  66. package/src/utils/reduce/toGroup.d.ts +79 -0
  67. package/src/utils/reduce/tree.d.ts +570 -0
  68. package/src/utils/reduce/util.d.ts +14 -0
  69. package/src/utils/reduce/valueConvertor.d.ts +65 -0
  70. package/src/utils/reduce/verticalToHorizontal.d.ts +80 -0
  71. package/src/zzz-frame.css +7 -0
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 根据 enableFourRoundSix 参数决定是否使用四舍六入五成双的函数
3
+ * 如果 enableFourRoundSix 为 true,则使用四舍六入五成双的函数
4
+ * 如果 enableFourRoundSix 为 false,则使用 Number.prototype.toFixed 方法
5
+ * @param enableFourRoundSix - 是否启用四舍六入五成双
6
+ * @returns 返回一个函数,该函数接受一个数字和可选的小数位数,并根据 enableFourRoundSix 的值返回相应的结果
7
+ */
8
+ export declare const getToFixed: (enableFourRoundSix: boolean) => (number: number, fractionDigits?: number) => number;
9
+ /**
10
+ * 创建一个新对象,并将其原型设置为指定对象的原型
11
+ * @param data - 要复制原型的对象
12
+ * @returns 返回一个新对象,其原型与 data 对象相同
13
+ */
14
+ export declare const createPrototype: <T>(data: T) => any;
@@ -0,0 +1,65 @@
1
+ import { KeyMatch } from '../DeclareType';
2
+ import { UnitKey } from '../math/unitConvertor';
3
+ /**
4
+ * 格式化列表中的值,根据配置进行单位转换和四舍六入五成双处理。
5
+ *
6
+ * @template T - 列表中元素的类型。
7
+ * @template U - 单位配置对象的类型。
8
+ * @param {T[]} list - 要格式化的列表。
9
+ * @param {[KeyMatch<T, PropertyKey>, KeyMatch<T, number>]} props - 包含键和值的属性匹配数组。
10
+ * @param {Object} unitConfig - 单位配置对象。
11
+ * @param {Record<PropertyKey, U>} unitConfig.map - 键到单位配置的映射。
12
+ * @param {KeyMatch<U, UnitKey | null>} unitConfig.inputUnitProp - 输入单位的属性匹配。
13
+ * @param {KeyMatch<U, UnitKey | null>} unitConfig.outputUnitProp - 输出单位的属性匹配。
14
+ * @param {KeyMatch<U, number | undefined | null>} [unitConfig.weightProp] - 权重的属性匹配。
15
+ * @param {KeyMatch<U, number | undefined | null>} unitConfig.fractionDigitsProp - 小数位数的属性匹配。
16
+ * @param {number} [unitConfig.mol] - 摩尔数。
17
+ * @param {boolean} [enableFourRoundSix=true] - 是否启用四舍六入五成双。
18
+ * @returns {T[]} - 格式化后的列表。
19
+ *
20
+ * @example
21
+ formatValue(
22
+ [
23
+ { factorId: '1001', value: 10.71523 },
24
+ { factorId: '1002', value: 9}
25
+ ],
26
+ [ 'factorId', 'value' ],
27
+ {
28
+ map: {
29
+ '1001': {
30
+ id: '1001',
31
+ name: 'SO₂',
32
+ unit: 'μg/m³',
33
+ units: ['μg/m³', 'ppb'],
34
+ weight: 64,
35
+ digitalCount: 0
36
+ },
37
+ '1002': {
38
+ id: '1002',
39
+ name: 'NO',
40
+ unit: 'μg/m³',
41
+ units: ['μg/m³', 'ppb'],
42
+ weight: 64,
43
+ digitalCount: 30
44
+ }
45
+ },
46
+ inputUnitProp: 'unit',
47
+ outputUnitProp: 'convertUnit',
48
+ weightProp: 'weight',
49
+ fractionDigitsProp: 'digitalCount'
50
+ }
51
+ )
52
+ * // 输出
53
+ [
54
+ { factorId: '1001', value: 4 },
55
+ { factorId: '1002', value: 3.4382812499999997}
56
+ ]
57
+ */
58
+ export declare const formatValue: <T, U>(list: T[], props: [KeyMatch<T, PropertyKey>, KeyMatch<T, number>], unitConfig: {
59
+ map: Record<PropertyKey, U>;
60
+ inputUnitProp: KeyMatch<U, UnitKey | null>;
61
+ outputUnitProp: KeyMatch<U, UnitKey | null>;
62
+ weightProp?: KeyMatch<U, number | undefined | null>;
63
+ fractionDigitsProp: KeyMatch<U, number | undefined | null>;
64
+ mol?: number;
65
+ }, enableFourRoundSix?: boolean) => T[];
@@ -0,0 +1,80 @@
1
+ import { KeyMatch } from '../DeclareType';
2
+ /**
3
+ * 定义一个类型别名 `DimensionKey<T>`,它表示一个联合类型,包含 `T` 类型中所有属性的键,这些键的类型是 `PropertyKey`。
4
+ * 这个类型别名通常用于表示数据对象中的维度键。
5
+ */
6
+ type DimensionKey<T> = KeyMatch<T, PropertyKey>;
7
+ /**
8
+ * 定义一个类型别名 `OneDimension<T>`,它表示一个数组,数组中包含一个元素,这个元素的类型是 `DimensionKey<T>`。
9
+ * 这个类型别名通常用于表示只有一个维度键的数据对象。
10
+ */
11
+ type OneDimension<T> = [DimensionKey<T>];
12
+ /**
13
+ * 定义一个类型别名 `ThreeDimension<T>`,它表示一个数组,数组中包含三个元素,分别是 `DimensionKey<T>`、`DimensionKey<T>` 和 `keyof T`。
14
+ * 这个类型别名通常用于表示有三个维度键的数据对象。
15
+ */
16
+ type ThreeDimension<T> = [DimensionKey<T>, DimensionKey<T>, keyof T];
17
+ /**
18
+ * 定义一个类型别名 `DimensionKeys<T>`,它表示一个联合类型,包含 `OneDimension<T>` 和 `ThreeDimension<T>`。
19
+ * 这个类型别名通常用于表示数据对象中的维度键,可以是一个或三个。
20
+ */
21
+ type DimensionKeys<T> = OneDimension<T> | ThreeDimension<T>;
22
+ /**
23
+ * 定义一个类型别名 `ResponseData<T, K extends keyof T>`,它表示一个对象类型,包含 `T` 类型中所有 `K` 类型的属性,以及其他任意属性。
24
+ * 这个类型别名通常用于表示转换后的数据对象。
25
+ */
26
+ type ResponseData<T, K extends keyof T> = Pick<T, K> & Record<PropertyKey, any>;
27
+ /**
28
+ * 定义一个类型别名 `Formatter<T, K extends DimensionKeys<T>>`,它表示一个函数类型,根据 `K` 的类型不同,函数的参数和返回值也不同。
29
+ * 这个类型别名通常用于表示格式化函数,用于在转换数据时对数据进行格式化。
30
+ */
31
+ type Formatter<T, K extends DimensionKeys<T>> = K extends ThreeDimension<T> ? (convertData: ResponseData<T, K[0]>, data: T, valueKey: T[K[1]], valueProp: K[2]) => void : (convertData: ResponseData<T, K[0]>, data: T) => void;
32
+ /**
33
+ * 定义一个函数 `verticalToHorizontal`,它接受三个参数:`list`、`keys` 和 `formatter`。
34
+ * 这个函数通常用于将垂直结构的数据转换为水平结构的数据,并返回一个包含转换后数据的数组。
35
+ *
36
+ * @param list - 原始数据数组,类型为 `T[]`。
37
+ * @param keys - 维度键数组,类型为 `K`,`K` 是 `DimensionKeys<T>` 的子类型。
38
+ * @param formatter - 可选的格式化函数,类型为 `Formatter<T, K>`,默认值为 `undefined`。
39
+ * @returns 一个包含转换后数据的数组,类型为 `ResponseData<T, K[0]>[]`。
40
+ *
41
+ * @example
42
+ verticalToHorizontal(
43
+ [
44
+ { dataTime: '2024/01/01 00:00:00', factorId: '1001', value: 12 },
45
+ { dataTime: '2024/01/01 00:00:00', factorId: '1003', value: 10 },
46
+ { dataTime: '2024/01/01 01:00:00', factorId: '1001', value: 3 },
47
+ { dataTime: '2024/01/01 01:00:00', factorId: '1003', value: 20 },
48
+ ],
49
+ ['dataTime', 'factorId', 'value'],
50
+ (convertData, data, valueKey, valueProp) => {
51
+ convertData[valueKey] = data[valueProp]
52
+ convertData.a = 33
53
+ }
54
+ )
55
+ * // 输出
56
+ [
57
+ { dataTime: '2024/01/01 00:00:00', 1001: 12, 1003: 10, a: 33 },
58
+ { dataTime: '2024/01/01 01:00:00', 1001: 3, 1003: 20, a: 33 },
59
+ ]
60
+ * @example
61
+ verticalToHorizontal(
62
+ [
63
+ { dataTime: '2024/01/01 00:00:00', factorId: '1001', value: 12 },
64
+ { dataTime: '2024/01/01 00:00:00', factorId: '1003', value: 10 },
65
+ { dataTime: '2024/01/01 01:00:00', factorId: '1001', value: 3 },
66
+ { dataTime: '2024/01/01 01:00:00', factorId: '1003', value: 20 },
67
+ ],
68
+ ['dataTime'],
69
+ (convertData, data) => {
70
+ convertData[data.factorId] = data.value
71
+ }
72
+ )
73
+ * // 输出
74
+ [
75
+ { dataTime: '2024/01/01 00:00:00', 1001: 12, 1003: 10, a: 33 },
76
+ { dataTime: '2024/01/01 01:00:00', 1001: 3, 1003: 20, a: 33 },
77
+ ]
78
+ */
79
+ export declare const verticalToHorizontal: <T, K extends DimensionKeys<T>>(list: T[], keys: K, formatter?: Formatter<T, K>) => ResponseData<T, K[0]>[];
80
+ export {};