@platox/pivot-table 0.0.41 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../packages/dashboard-workbench/utils/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Layout } from 'react-grid-layout'\nimport dayjs from 'dayjs'\nimport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../packages/dashboard-workbench/utils/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Layout } from 'react-grid-layout'\nimport dayjs from 'dayjs'\nimport { TimeGroupInterval } from '../components/add-module-modal/add-chart-modal/interface'\nimport { FieldItem } from '../types'\n\nexport const getTransformValue = ({\n val,\n field,\n fieldOptions,\n fieldMap,\n timeGroupInterval,\n}: {\n val: any\n field: any\n fieldOptions?: FieldItem[]\n fieldMap?: Record<string, string> //枚举的翻译\n timeGroupInterval?: TimeGroupInterval // 时间汇总 xAxis 是time的时候有效\n}) => {\n const fieldData = fieldOptions?.find(item => item.value === field)\n let newVal = val\n if (fieldData?.type === 'enum' && fieldData?.enum && fieldData?.enum?.length > 0) {\n const label = fieldData?.enum?.find(enumItem => enumItem.value === val)?.label\n newVal = label ? fieldMap?.[label] || label : val\n }\n if (fieldData?.type === 'timestamp') {\n let format = 'YYYY-MM-DD'\n switch (timeGroupInterval) {\n case 'day':\n format = 'YYYY-MM-DD'\n newVal = val ? dayjs(val).format(format) : ''\n break\n case 'week':\n const startDate = val ? dayjs(val).startOf('week').format('YYYY-MM-DD') : ''\n const endDate = val ? dayjs(val).endOf('week').format('YYYY-MM-DD') : ''\n newVal = val ? `${startDate}~${endDate}` : ''\n break\n case 'month':\n format = 'YYYY-MM'\n newVal = val ? dayjs(val).format(format) : ''\n break\n case 'year':\n format = 'YYYY'\n newVal = val ? dayjs(val).format(format) : ''\n break\n default:\n format = 'YYYY-MM-DD'\n newVal = val ? dayjs(val).format(format) : ''\n break\n }\n }\n return newVal\n}\n\nexport const findChangedItems = (newLayout: Layout[], oldLayout: Layout[]) => {\n return newLayout.filter(newItem => {\n const oldItem = oldLayout.find(item => item.i === newItem.i)\n return (\n oldItem &&\n (oldItem.x !== newItem.x ||\n oldItem.y !== newItem.y ||\n oldItem.w !== newItem.w ||\n oldItem.h !== newItem.h)\n )\n })\n}\n"],"names":[],"mappings":";AAMO,MAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAMM;;AACJ,QAAM,YAAY,6CAAc,KAAK,CAAQ,SAAA,KAAK,UAAU;AAC5D,MAAI,SAAS;AACT,OAAA,uCAAW,UAAS,WAAU,uCAAW,WAAQ,4CAAW,SAAX,mBAAiB,UAAS,GAAG;AAC1E,UAAA,SAAQ,kDAAW,SAAX,mBAAiB,KAAK,cAAY,SAAS,UAAU,SAArD,mBAA2D;AACzE,aAAS,SAAQ,qCAAW,WAAU,QAAQ;AAAA,EAAA;AAE5C,OAAA,uCAAW,UAAS,aAAa;AACnC,QAAI,SAAS;AACb,YAAQ,mBAAmB;AAAA,MACzB,KAAK;AACM,iBAAA;AACT,iBAAS,MAAM,MAAM,GAAG,EAAE,OAAO,MAAM,IAAI;AAC3C;AAAA,MACF,KAAK;AACG,cAAA,YAAY,MAAM,MAAM,GAAG,EAAE,QAAQ,MAAM,EAAE,OAAO,YAAY,IAAI;AACpE,cAAA,UAAU,MAAM,MAAM,GAAG,EAAE,MAAM,MAAM,EAAE,OAAO,YAAY,IAAI;AACtE,iBAAS,MAAM,GAAG,SAAS,IAAI,OAAO,KAAK;AAC3C;AAAA,MACF,KAAK;AACM,iBAAA;AACT,iBAAS,MAAM,MAAM,GAAG,EAAE,OAAO,MAAM,IAAI;AAC3C;AAAA,MACF,KAAK;AACM,iBAAA;AACT,iBAAS,MAAM,MAAM,GAAG,EAAE,OAAO,MAAM,IAAI;AAC3C;AAAA,MACF;AACW,iBAAA;AACT,iBAAS,MAAM,MAAM,GAAG,EAAE,OAAO,MAAM,IAAI;AAC3C;AAAA,IAAA;AAAA,EACJ;AAEK,SAAA;AACT;AAEa,MAAA,mBAAmB,CAAC,WAAqB,cAAwB;AACrE,SAAA,UAAU,OAAO,CAAW,YAAA;AACjC,UAAM,UAAU,UAAU,KAAK,UAAQ,KAAK,MAAM,QAAQ,CAAC;AAC3D,WACE,YACC,QAAQ,MAAM,QAAQ,KACrB,QAAQ,MAAM,QAAQ,KACtB,QAAQ,MAAM,QAAQ,KACtB,QAAQ,MAAM,QAAQ;AAAA,EAAA,CAE3B;AACH;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platox/pivot-table",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"@fullcalendar/react": "^6.1.15",
|
|
29
29
|
"ahooks": "^3.8.4",
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
|
-
"dayjs": "^1.11.13",
|
|
32
31
|
"echarts": "^5.5.1",
|
|
33
32
|
"i18next": "^23.16.4",
|
|
34
33
|
"react-grid-layout": "^1.5.0",
|
|
@@ -48,6 +47,7 @@
|
|
|
48
47
|
"@vitejs/plugin-react-swc": "^3.7.2",
|
|
49
48
|
"antd": "^5.21.4",
|
|
50
49
|
"axios": "^1.7.9",
|
|
50
|
+
"dayjs": "^1.11.10",
|
|
51
51
|
"eslint": "^9.11.1",
|
|
52
52
|
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
|
53
53
|
"eslint-plugin-react-refresh": "^0.4.12",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"@types/react": "^18.3.10",
|
|
70
70
|
"@types/react-dom": "^18.3.0",
|
|
71
71
|
"antd": "^5.21.4",
|
|
72
|
+
"dayjs": "^1.11.10",
|
|
72
73
|
"lodash-es": "^4.17.21",
|
|
73
74
|
"react": "^18.3.1",
|
|
74
75
|
"react-dom": "^18.3.1"
|