@hkyhy/marsun-components-core 0.1.68 → 0.1.69
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/dist/components/FlexBox/FlexBox.d.ts +7 -0
- package/dist/components/FlexBox/FlexBox.js +43 -0
- package/dist/components/FlexBox/FlexBox.js.map +1 -0
- package/dist/components/FlexBox/FlexBoxFetch.d.ts +3 -0
- package/dist/components/FlexBox/FlexBoxFetch.js +92 -0
- package/dist/components/FlexBox/FlexBoxFetch.js.map +1 -0
- package/dist/components/FlexBox/FlexBoxView.d.ts +18 -0
- package/dist/components/FlexBox/FlexBoxView.js +42 -0
- package/dist/components/FlexBox/FlexBoxView.js.map +1 -0
- package/dist/components/FlexBox/defaultColumns.d.ts +7 -0
- package/dist/components/FlexBox/defaultColumns.js +26 -0
- package/dist/components/FlexBox/defaultColumns.js.map +1 -0
- package/dist/components/FlexBox/index.d.ts +79 -0
- package/dist/components/FlexBox/useFlexBox.d.ts +5 -0
- package/dist/components/FlexBox/useFlexBox.js +19 -0
- package/dist/components/FlexBox/useFlexBox.js.map +1 -0
- package/dist/components/Form/FormDataSync.d.ts +3 -0
- package/dist/components/Form/FormDataSync.js +29 -15
- package/dist/components/Form/FormDataSync.js.map +1 -1
- package/dist/components/Form/InputRange.d.ts +19 -0
- package/dist/components/Form/InputRange.js +84 -0
- package/dist/components/Form/InputRange.js.map +1 -0
- package/dist/components/Form/InputRange.module.scss.js +9 -0
- package/dist/components/Form/InputRange.module.scss.js.map +1 -0
- package/dist/components/Form/index.d.ts +4 -0
- package/dist/components/Form/inputRangeRules.d.ts +15 -0
- package/dist/components/Form/inputRangeRules.js +23 -0
- package/dist/components/Form/inputRangeRules.js.map +1 -0
- package/dist/components/Form/kneFormInfo.js +7 -7
- package/dist/components/FormInfo/ErrorTip.d.ts +7 -0
- package/dist/components/FormInfo/ErrorTip.js +89 -0
- package/dist/components/FormInfo/ErrorTip.js.map +1 -0
- package/dist/components/FormInfo/Form.d.ts +7 -0
- package/dist/components/FormInfo/Form.js +23 -0
- package/dist/components/FormInfo/Form.js.map +1 -0
- package/dist/components/FormInfo/FormApiButton.d.ts +7 -0
- package/dist/components/FormInfo/FormApiButton.js +28 -0
- package/dist/components/FormInfo/FormApiButton.js.map +1 -0
- package/dist/components/FormInfo/FormDrawer.d.ts +9 -0
- package/dist/components/FormInfo/FormDrawer.js +42 -0
- package/dist/components/FormInfo/FormDrawer.js.map +1 -0
- package/dist/components/FormInfo/FormInfo.d.ts +4 -0
- package/dist/components/FormInfo/FormInfo.js +61 -0
- package/dist/components/FormInfo/FormInfo.js.map +1 -0
- package/dist/components/FormInfo/FormItem.d.ts +4 -0
- package/dist/components/FormInfo/FormItem.js +10 -0
- package/dist/components/FormInfo/FormItem.js.map +1 -0
- package/dist/components/FormInfo/FormModal.d.ts +11 -0
- package/dist/components/FormInfo/FormModal.js +43 -0
- package/dist/components/FormInfo/FormModal.js.map +1 -0
- package/dist/components/FormInfo/FormSteps.d.ts +9 -0
- package/dist/components/FormInfo/FormSteps.js +96 -0
- package/dist/components/FormInfo/FormSteps.js.map +1 -0
- package/dist/components/FormInfo/FormStepsModal.d.ts +14 -0
- package/dist/components/FormInfo/FormStepsModal.js +96 -0
- package/dist/components/FormInfo/FormStepsModal.js.map +1 -0
- package/dist/components/FormInfo/List.d.ts +6 -0
- package/dist/components/FormInfo/List.js +180 -0
- package/dist/components/FormInfo/List.js.map +1 -0
- package/dist/components/FormInfo/MultiField.d.ts +6 -0
- package/dist/components/FormInfo/MultiField.js +76 -0
- package/dist/components/FormInfo/MultiField.js.map +1 -0
- package/dist/components/FormInfo/Steps.d.ts +26 -0
- package/dist/components/FormInfo/Steps.js +178 -0
- package/dist/components/FormInfo/Steps.js.map +1 -0
- package/dist/components/FormInfo/TableList.d.ts +6 -0
- package/dist/components/FormInfo/TableList.js +216 -0
- package/dist/components/FormInfo/TableList.js.map +1 -0
- package/dist/components/FormInfo/buildFormOverlayProps.d.ts +27 -0
- package/dist/components/FormInfo/buildFormOverlayProps.js +55 -0
- package/dist/components/FormInfo/buildFormOverlayProps.js.map +1 -0
- package/dist/components/FormInfo/fields.d.ts +33 -0
- package/dist/components/FormInfo/fields.js +30 -0
- package/dist/components/FormInfo/fields.js.map +1 -0
- package/dist/components/FormInfo/index.d.ts +21 -0
- package/dist/components/FormInfo/locale/zh-CN.d.ts +16 -0
- package/dist/components/FormInfo/locale/zh-CN.js +17 -0
- package/dist/components/FormInfo/locale/zh-CN.js.map +1 -0
- package/dist/components/FormInfo/nestBlock.d.ts +15 -0
- package/dist/components/FormInfo/nestBlock.js +19 -0
- package/dist/components/FormInfo/nestBlock.js.map +1 -0
- package/dist/components/FormInfo/style.module.scss.js +57 -0
- package/dist/components/FormInfo/style.module.scss.js.map +1 -0
- package/dist/components/FormInfo/types.d.ts +213 -0
- package/dist/components/FormInfo/withLocale.d.ts +14 -0
- package/dist/components/FormInfo/withLocale.js +25 -0
- package/dist/components/FormInfo/withLocale.js.map +1 -0
- package/dist/components/InfoPage/CentralContent/boxComputed.d.ts +2 -0
- package/dist/components/InfoPage/CentralContent/boxComputed.js +15 -0
- package/dist/components/InfoPage/CentralContent/boxComputed.js.map +1 -0
- package/dist/components/InfoPage/CentralContent/index.d.ts +3 -0
- package/dist/components/InfoPage/CentralContent/index.js +102 -0
- package/dist/components/InfoPage/CentralContent/index.js.map +1 -0
- package/dist/components/InfoPage/CentralContent/style.module.scss.js +15 -0
- package/dist/components/InfoPage/CentralContent/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/Content/index.d.ts +16 -0
- package/dist/components/InfoPage/Content/index.js +72 -0
- package/dist/components/InfoPage/Content/index.js.map +1 -0
- package/dist/components/InfoPage/Content/style.module.scss.js +14 -0
- package/dist/components/InfoPage/Content/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/Descriptions/index.d.ts +9 -0
- package/dist/components/InfoPage/Descriptions/index.js +48 -0
- package/dist/components/InfoPage/Descriptions/index.js.map +1 -0
- package/dist/components/InfoPage/Descriptions/style.module.scss.js +11 -0
- package/dist/components/InfoPage/Descriptions/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/Flow/index.d.ts +9 -0
- package/dist/components/InfoPage/Flow/index.js +165 -0
- package/dist/components/InfoPage/Flow/index.js.map +1 -0
- package/dist/components/InfoPage/Flow/style.module.scss.js +19 -0
- package/dist/components/InfoPage/Flow/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/InfoPage/Collapse.d.ts +10 -0
- package/dist/components/InfoPage/InfoPage/Collapse.js +11 -0
- package/dist/components/InfoPage/InfoPage/Collapse.js.map +1 -0
- package/dist/components/InfoPage/InfoPage/index.d.ts +21 -0
- package/dist/components/InfoPage/InfoPage/index.js +35 -0
- package/dist/components/InfoPage/InfoPage/index.js.map +1 -0
- package/dist/components/InfoPage/InfoPage/style.module.scss.js +15 -0
- package/dist/components/InfoPage/InfoPage/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/Report/List.d.ts +6 -0
- package/dist/components/InfoPage/Report/List.js +26 -0
- package/dist/components/InfoPage/Report/List.js.map +1 -0
- package/dist/components/InfoPage/Report/Part.d.ts +6 -0
- package/dist/components/InfoPage/Report/Part.js +42 -0
- package/dist/components/InfoPage/Report/Part.js.map +1 -0
- package/dist/components/InfoPage/Report/PrintPageBreak.d.ts +3 -0
- package/dist/components/InfoPage/Report/PrintPageBreak.js +8 -0
- package/dist/components/InfoPage/Report/PrintPageBreak.js.map +1 -0
- package/dist/components/InfoPage/Report/Result.d.ts +6 -0
- package/dist/components/InfoPage/Report/Result.js +26 -0
- package/dist/components/InfoPage/Report/Result.js.map +1 -0
- package/dist/components/InfoPage/Report/Table.d.ts +6 -0
- package/dist/components/InfoPage/Report/Table.js +125 -0
- package/dist/components/InfoPage/Report/Table.js.map +1 -0
- package/dist/components/InfoPage/Report/index.d.ts +26 -0
- package/dist/components/InfoPage/Report/index.js +61 -0
- package/dist/components/InfoPage/Report/index.js.map +1 -0
- package/dist/components/InfoPage/Report/style.module.scss.js +47 -0
- package/dist/components/InfoPage/Report/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/Score/index.d.ts +8 -0
- package/dist/components/InfoPage/Score/index.js +50 -0
- package/dist/components/InfoPage/Score/index.js.map +1 -0
- package/dist/components/InfoPage/Score/style.module.scss.js +10 -0
- package/dist/components/InfoPage/Score/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/SplitLine/index.d.ts +17 -0
- package/dist/components/InfoPage/SplitLine/index.js +67 -0
- package/dist/components/InfoPage/SplitLine/index.js.map +1 -0
- package/dist/components/InfoPage/SplitLine/style.module.scss.js +8 -0
- package/dist/components/InfoPage/SplitLine/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/computeColumnsValue.d.ts +28 -0
- package/dist/components/InfoPage/computeColumnsValue.js +60 -0
- package/dist/components/InfoPage/computeColumnsValue.js.map +1 -0
- package/dist/components/InfoPage/formatView.d.ts +23 -0
- package/dist/components/InfoPage/formatView.js +119 -0
- package/dist/components/InfoPage/formatView.js.map +1 -0
- package/dist/components/InfoPage/index.d.ts +262 -0
- package/dist/components/ReactModal/ColumnsLayout.d.ts +7 -0
- package/dist/components/ReactModal/ColumnsLayout.js +20 -0
- package/dist/components/ReactModal/ColumnsLayout.js.map +1 -0
- package/dist/components/ReactModal/Drawer.d.ts +73 -0
- package/dist/components/ReactModal/Drawer.js +292 -0
- package/dist/components/ReactModal/Drawer.js.map +1 -0
- package/dist/components/ReactModal/Footer.d.ts +12 -0
- package/dist/components/ReactModal/Footer.js +53 -0
- package/dist/components/ReactModal/Footer.js.map +1 -0
- package/dist/components/ReactModal/Modal.d.ts +14 -0
- package/dist/components/ReactModal/Modal.js +366 -0
- package/dist/components/ReactModal/Modal.js.map +1 -0
- package/dist/components/ReactModal/ScrollRegion.d.ts +7 -0
- package/dist/components/ReactModal/ScrollRegion.js +22 -0
- package/dist/components/ReactModal/ScrollRegion.js.map +1 -0
- package/dist/components/ReactModal/SimpleBar.d.ts +2 -0
- package/dist/components/ReactModal/SimpleBar.js +7 -0
- package/dist/components/ReactModal/SimpleBar.js.map +1 -0
- package/dist/components/ReactModal/TabsLayout.d.ts +6 -0
- package/dist/components/ReactModal/TabsLayout.js +16 -0
- package/dist/components/ReactModal/TabsLayout.js.map +1 -0
- package/dist/components/ReactModal/confirmModal.module.scss.js +30 -0
- package/dist/components/ReactModal/confirmModal.module.scss.js.map +1 -0
- package/dist/components/ReactModal/createDrawerRender.d.ts +2 -0
- package/dist/components/ReactModal/createDrawerRender.js +7 -0
- package/dist/components/ReactModal/createDrawerRender.js.map +1 -0
- package/dist/components/ReactModal/createModalRender.d.ts +2 -0
- package/dist/components/ReactModal/createModalRender.js +7 -0
- package/dist/components/ReactModal/createModalRender.js.map +1 -0
- package/dist/components/ReactModal/drawer.module.scss.js +36 -0
- package/dist/components/ReactModal/drawer.module.scss.js.map +1 -0
- package/dist/components/ReactModal/index.d.ts +57 -0
- package/dist/components/ReactModal/intlStub.d.ts +15 -0
- package/dist/components/ReactModal/intlStub.js +21 -0
- package/dist/components/ReactModal/intlStub.js.map +1 -0
- package/dist/components/ReactModal/layouts.module.scss.js +12 -0
- package/dist/components/ReactModal/layouts.module.scss.js.map +1 -0
- package/dist/components/ReactModal/locale/en-US.d.ts +5 -0
- package/dist/components/ReactModal/locale/zh-CN.d.ts +5 -0
- package/dist/components/ReactModal/locale/zh-CN.js +8 -0
- package/dist/components/ReactModal/locale/zh-CN.js.map +1 -0
- package/dist/components/ReactModal/lockParentScroll.d.ts +3 -0
- package/dist/components/ReactModal/modalClassNames.d.ts +5 -0
- package/dist/components/ReactModal/modalClassNames.js +8 -0
- package/dist/components/ReactModal/modalClassNames.js.map +1 -0
- package/dist/components/ReactModal/style.module.scss.js +38 -0
- package/dist/components/ReactModal/style.module.scss.js.map +1 -0
- package/dist/components/ReactModal/useConfirmModal.d.ts +4 -0
- package/dist/components/ReactModal/useConfirmModal.js +161 -0
- package/dist/components/ReactModal/useConfirmModal.js.map +1 -0
- package/dist/components/ReactModal/useDrawer.d.ts +5 -0
- package/dist/components/ReactModal/useDrawer.js +123 -0
- package/dist/components/ReactModal/useDrawer.js.map +1 -0
- package/dist/components/ReactModal/usePatchElement.d.ts +2 -0
- package/dist/components/ReactModal/usePatchElement.js +11 -0
- package/dist/components/ReactModal/usePatchElement.js.map +1 -0
- package/dist/components/ReactModal/withLocale.d.ts +5 -0
- package/dist/components/ReactModal/withLocale.js +6 -0
- package/dist/components/ReactModal/withLocale.js.map +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/form-info.d.ts +17 -0
- package/dist/form-info.js +68 -0
- package/dist/form-info.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +700 -632
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/utils/date.d.ts +4 -1
- package/dist/utils/date.js +35 -27
- package/dist/utils/date.js.map +1 -1
- package/package.json +16 -2
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import c from "lodash/get";
|
|
2
|
+
import d from "./formatView.js";
|
|
3
|
+
const a = ({
|
|
4
|
+
columns: e,
|
|
5
|
+
emptyIsPlaceholder: s,
|
|
6
|
+
valueIsEmpty: f,
|
|
7
|
+
removeEmpty: p = !0,
|
|
8
|
+
dataSource: l,
|
|
9
|
+
context: o
|
|
10
|
+
}) => ((r) => p ? r.filter((n) => !!n) : r)(
|
|
11
|
+
e.map((r) => {
|
|
12
|
+
const n = typeof r.getValueOf == "function" ? r.getValueOf(l, { column: r, context: o }) : c(l, r.name), m = ((t) => {
|
|
13
|
+
if (typeof r.format == "function")
|
|
14
|
+
return r.format(t, { dataSource: l, column: r, context: o });
|
|
15
|
+
if (typeof r.format == "string") {
|
|
16
|
+
const y = d(t, r.format, { dataSource: l, column: r, context: o });
|
|
17
|
+
if (y)
|
|
18
|
+
return y;
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
})(n), u = (r.valueIsEmpty || f)(n);
|
|
22
|
+
return r.display === !1 || typeof r.display == "function" && r.display(n, {
|
|
23
|
+
dataSource: l,
|
|
24
|
+
column: r,
|
|
25
|
+
context: o
|
|
26
|
+
}) === !1 || !(r.hasOwnProperty("emptyIsPlaceholder") ? r.emptyIsPlaceholder : s) && u ? null : Object.assign({}, r, { isEmpty: u, value: m });
|
|
27
|
+
})
|
|
28
|
+
), i = ({ column: e, dataSource: s, placeholder: f, context: p }) => e.isEmpty ? typeof e.renderPlaceholder == "function" ? e.renderPlaceholder({
|
|
29
|
+
column: e,
|
|
30
|
+
dataSource: s,
|
|
31
|
+
placeholder: f,
|
|
32
|
+
context: p
|
|
33
|
+
}) : e.placeholder || f : typeof e.render == "function" ? e.render(e.value, {
|
|
34
|
+
column: e,
|
|
35
|
+
dataSource: s,
|
|
36
|
+
context: p
|
|
37
|
+
}) : e.value, V = ({
|
|
38
|
+
columns: e,
|
|
39
|
+
emptyIsPlaceholder: s,
|
|
40
|
+
valueIsEmpty: f,
|
|
41
|
+
removeEmpty: p,
|
|
42
|
+
dataSource: l,
|
|
43
|
+
placeholder: o,
|
|
44
|
+
context: r
|
|
45
|
+
}) => a({
|
|
46
|
+
columns: e,
|
|
47
|
+
emptyIsPlaceholder: s,
|
|
48
|
+
valueIsEmpty: f,
|
|
49
|
+
removeEmpty: p,
|
|
50
|
+
dataSource: l,
|
|
51
|
+
context: r
|
|
52
|
+
}).map((n) => i({ column: n, placeholder: o, dataSource: l, context: r }));
|
|
53
|
+
a.computeDisplay = i;
|
|
54
|
+
a.computeColumnsDisplay = V;
|
|
55
|
+
export {
|
|
56
|
+
V as computeColumnsDisplay,
|
|
57
|
+
i as computeDisplay,
|
|
58
|
+
a as default
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=computeColumnsValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeColumnsValue.js","sources":["../../../src/components/InfoPage/computeColumnsValue.js"],"sourcesContent":["// @ts-nocheck\n// Ported from https://github.com/kne-union/info-page/blob/master/src/computeColumnsValue.js\nimport get from 'lodash/get';\nimport formatView from './formatView';\n\nconst computeColumnsValue = ({\n columns,\n emptyIsPlaceholder,\n valueIsEmpty,\n removeEmpty = true,\n dataSource,\n context,\n}) => {\n return ((output) => (removeEmpty ? output.filter((item) => !!item) : output))(\n columns.map((item) => {\n const itemValue =\n typeof item.getValueOf === 'function'\n ? item.getValueOf(dataSource, { column: item, context })\n : get(dataSource, item.name);\n const displayValue = ((value) => {\n if (typeof item.format === 'function') {\n return item.format(value, { dataSource, column: item, context });\n }\n if (typeof item.format === 'string') {\n const formatValue = formatView(value, item.format, { dataSource, column: item, context });\n if (formatValue) {\n return formatValue;\n }\n }\n return value;\n })(itemValue);\n\n const itemIsEmpty = (item.valueIsEmpty || valueIsEmpty)(itemValue);\n\n if (\n item.display === false ||\n (typeof item.display === 'function' &&\n item.display(itemValue, {\n dataSource,\n column: item,\n context,\n }) === false)\n ) {\n return null;\n }\n\n if (\n !(item.hasOwnProperty('emptyIsPlaceholder')\n ? item.emptyIsPlaceholder\n : emptyIsPlaceholder) &&\n itemIsEmpty\n ) {\n return null;\n }\n\n return Object.assign({}, item, { isEmpty: itemIsEmpty, value: displayValue });\n }),\n );\n};\n\nexport const computeDisplay = ({ column, dataSource, placeholder, context }) => {\n return column.isEmpty\n ? typeof column.renderPlaceholder === 'function'\n ? column.renderPlaceholder({\n column: column,\n dataSource,\n placeholder,\n context,\n })\n : column.placeholder || placeholder\n : typeof column.render === 'function'\n ? column.render(column.value, {\n column,\n dataSource,\n context,\n })\n : column.value;\n};\n\nexport const computeColumnsDisplay = ({\n columns,\n emptyIsPlaceholder,\n valueIsEmpty,\n removeEmpty,\n dataSource,\n placeholder,\n context,\n}) => {\n return computeColumnsValue({\n columns,\n emptyIsPlaceholder,\n valueIsEmpty,\n removeEmpty,\n dataSource,\n context,\n }).map((column) => {\n return computeDisplay({ column, placeholder, dataSource, context });\n });\n};\n\ncomputeColumnsValue.computeDisplay = computeDisplay;\ncomputeColumnsValue.computeColumnsDisplay = computeColumnsDisplay;\n\nexport default computeColumnsValue;\n"],"names":["computeColumnsValue","columns","emptyIsPlaceholder","valueIsEmpty","removeEmpty","dataSource","context","output","item","itemValue","get","displayValue","value","formatValue","formatView","itemIsEmpty","computeDisplay","column","placeholder","computeColumnsDisplay"],"mappings":";;AAKK,MAACA,IAAsB,CAAC;AAAA,EAC3B,SAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,YAAAC;AAAA,EACA,SAAAC;AACF,OACU,CAACC,MAAYH,IAAcG,EAAO,OAAO,CAACC,MAAS,CAAC,CAACA,CAAI,IAAID;AAAA,EACnEN,EAAQ,IAAI,CAACO,MAAS;AACpB,UAAMC,IACJ,OAAOD,EAAK,cAAe,aACvBA,EAAK,WAAWH,GAAY,EAAE,QAAQG,GAAM,SAAAF,EAAO,CAAE,IACrDI,EAAIL,GAAYG,EAAK,IAAI,GACzBG,KAAgB,CAACC,MAAU;AAC/B,UAAI,OAAOJ,EAAK,UAAW;AACzB,eAAOA,EAAK,OAAOI,GAAO,EAAE,YAAAP,GAAY,QAAQG,GAAM,SAAAF,GAAS;AAEjE,UAAI,OAAOE,EAAK,UAAW,UAAU;AACnC,cAAMK,IAAcC,EAAWF,GAAOJ,EAAK,QAAQ,EAAE,YAAAH,GAAY,QAAQG,GAAM,SAAAF,GAAS;AACxF,YAAIO;AACF,iBAAOA;AAAA,MAEX;AACA,aAAOD;AAAA,IACT,GAAGH,CAAS,GAENM,KAAeP,EAAK,gBAAgBL,GAAcM,CAAS;AAcjE,WAXED,EAAK,YAAY,MAChB,OAAOA,EAAK,WAAY,cACvBA,EAAK,QAAQC,GAAW;AAAA,MACtB,YAAAJ;AAAA,MACA,QAAQG;AAAA,MACR,SAAAF;AAAA,IACZ,CAAW,MAAM,MAMT,EAAEE,EAAK,eAAe,oBAAoB,IACtCA,EAAK,qBACLN,MACJa,IAEO,OAGF,OAAO,OAAO,CAAA,GAAIP,GAAM,EAAE,SAASO,GAAa,OAAOJ,GAAc;AAAA,EAC9E,CAAC;AACL,GAGaK,IAAiB,CAAC,EAAE,QAAAC,GAAQ,YAAAZ,GAAY,aAAAa,GAAa,SAAAZ,EAAO,MAChEW,EAAO,UACV,OAAOA,EAAO,qBAAsB,aAClCA,EAAO,kBAAkB;AAAA,EACvB,QAAQA;AAAA,EACR,YAAAZ;AAAA,EACA,aAAAa;AAAA,EACA,SAAAZ;AACV,CAAS,IACDW,EAAO,eAAeC,IACxB,OAAOD,EAAO,UAAW,aACvBA,EAAO,OAAOA,EAAO,OAAO;AAAA,EAC1B,QAAAA;AAAA,EACA,YAAAZ;AAAA,EACA,SAAAC;AACV,CAAS,IACDW,EAAO,OAGFE,IAAwB,CAAC;AAAA,EACpC,SAAAlB;AAAA,EACA,oBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAa;AAAA,EACA,SAAAZ;AACF,MACSN,EAAoB;AAAA,EACzB,SAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AACJ,CAAG,EAAE,IAAI,CAACW,MACCD,EAAe,EAAE,QAAAC,GAAQ,aAAAC,GAAa,YAAAb,GAAY,SAAAC,EAAO,CAAE,CACnE;AAGHN,EAAoB,iBAAiBgB;AACrChB,EAAoB,wBAAwBmB;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function calcArgs(args: any, template: any): any;
|
|
2
|
+
export namespace defaultFormat {
|
|
3
|
+
function date(value: any, { args }: {
|
|
4
|
+
args: any;
|
|
5
|
+
}): string;
|
|
6
|
+
function datetime(value: any, { args }: {
|
|
7
|
+
args: any;
|
|
8
|
+
}): string;
|
|
9
|
+
function dateRange(value: any, { args }: {
|
|
10
|
+
args: any;
|
|
11
|
+
}): string;
|
|
12
|
+
function boolean(value: any, { args }: {
|
|
13
|
+
args: any;
|
|
14
|
+
}): "是" | "否";
|
|
15
|
+
function number(value: any, { args }: {
|
|
16
|
+
args: any;
|
|
17
|
+
}): string;
|
|
18
|
+
function money(value: any, { args }: {
|
|
19
|
+
args: any;
|
|
20
|
+
}): string;
|
|
21
|
+
}
|
|
22
|
+
export default formatView;
|
|
23
|
+
declare function formatView(value: any, format: any, context: any): any;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import s from "dayjs";
|
|
2
|
+
import { isEmpty as f } from "@kne/is-empty";
|
|
3
|
+
import y from "lodash/groupBy";
|
|
4
|
+
import b from "lodash/get";
|
|
5
|
+
import V from "lodash/transform";
|
|
6
|
+
const Y = (t, r) => {
|
|
7
|
+
const { attr: e, normal: u } = y(t, (n) => /^.+:.+$/.test(n) ? "attr" : "normal"), o = {}, i = (n, a) => a === "string" ? String(n) : a === "number" ? Number(n) : a === "boolean" ? n === "true" : n;
|
|
8
|
+
return (u || []).forEach((n, a) => {
|
|
9
|
+
const m = Object.assign(
|
|
10
|
+
{},
|
|
11
|
+
{ type: "string", defaultValue: "" },
|
|
12
|
+
b(r, a)
|
|
13
|
+
);
|
|
14
|
+
m.name && n && (o[m.name] = i(n, m.type));
|
|
15
|
+
}), (e || []).forEach((n) => {
|
|
16
|
+
const [a, m] = n.split(":"), l = r.find((d) => d.name === a);
|
|
17
|
+
if (!l)
|
|
18
|
+
return;
|
|
19
|
+
const { name: p, type: g } = Object.assign({}, { type: "string", defaultValue: "" }, l);
|
|
20
|
+
o[p] = i(m, g);
|
|
21
|
+
}), Object.assign(
|
|
22
|
+
{},
|
|
23
|
+
V(
|
|
24
|
+
r,
|
|
25
|
+
(n, a) => {
|
|
26
|
+
a.name && a.hasOwnProperty("defaultValue") && (n[a.name] = a.defaultValue);
|
|
27
|
+
},
|
|
28
|
+
{}
|
|
29
|
+
),
|
|
30
|
+
o
|
|
31
|
+
);
|
|
32
|
+
}, c = {
|
|
33
|
+
date: (t, { args: r }) => {
|
|
34
|
+
const e = r[0] || "YYYY-MM-DD";
|
|
35
|
+
return s(t).format(e);
|
|
36
|
+
},
|
|
37
|
+
datetime: (t, { args: r }) => {
|
|
38
|
+
const e = r[0] || "YYYY-MM-DD HH:mm:ss";
|
|
39
|
+
return s(t).format(e);
|
|
40
|
+
},
|
|
41
|
+
dateRange: (t, { args: r }) => {
|
|
42
|
+
const e = r[0] || "YYYY-MM-DD", u = r[1];
|
|
43
|
+
return !f(t[0]) && !f(t[1]) ? `${s(t[0]).format(e)}~${s(t[1]).format(e)}` : u === "allow" && !f(t[0]) ? `${s(t[0]).format(e)}以后` : u === "allow" && !f(t[1]) ? `${s(t[1]).format(e)}以前` : "";
|
|
44
|
+
},
|
|
45
|
+
boolean: (t, { args: r }) => {
|
|
46
|
+
const e = r[0] || "true";
|
|
47
|
+
return (t || "").toString() === e ? "是" : "否";
|
|
48
|
+
},
|
|
49
|
+
number: (t, { args: r }) => {
|
|
50
|
+
const { style: e, unit: u, maximumFractionDigits: o, useGrouping: i, roundingMode: n, suffix: a } = Y(
|
|
51
|
+
r,
|
|
52
|
+
[
|
|
53
|
+
{
|
|
54
|
+
name: "style",
|
|
55
|
+
type: "string",
|
|
56
|
+
defaultValue: "decimal"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "unit",
|
|
60
|
+
type: "number",
|
|
61
|
+
defaultValue: 1
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "maximumFractionDigits",
|
|
65
|
+
type: "number",
|
|
66
|
+
defaultValue: 2
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "useGrouping",
|
|
70
|
+
type: "boolean",
|
|
71
|
+
defaultValue: !0
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "roundingMode",
|
|
75
|
+
type: "string",
|
|
76
|
+
defaultValue: "halfExpand"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "suffix",
|
|
80
|
+
type: "string",
|
|
81
|
+
defaultValue: ""
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
);
|
|
85
|
+
return new Intl.NumberFormat(
|
|
86
|
+
{},
|
|
87
|
+
{
|
|
88
|
+
style: e,
|
|
89
|
+
maximumFractionDigits: o,
|
|
90
|
+
roundingMode: n,
|
|
91
|
+
useGrouping: i
|
|
92
|
+
}
|
|
93
|
+
).format(t / u) + a;
|
|
94
|
+
},
|
|
95
|
+
money: (t, { args: r }) => {
|
|
96
|
+
const e = r[0] || "元";
|
|
97
|
+
return `${t}${e}`;
|
|
98
|
+
}
|
|
99
|
+
}, h = (t, r, e) => {
|
|
100
|
+
if (!r)
|
|
101
|
+
return t;
|
|
102
|
+
const u = r.split(" ").filter((o) => !!o);
|
|
103
|
+
if (u.length > 0)
|
|
104
|
+
return u.reduce((o, i) => {
|
|
105
|
+
const [n, ...a] = i.split("-");
|
|
106
|
+
return typeof c[n] == "function" ? c[n](
|
|
107
|
+
o,
|
|
108
|
+
Object.assign({}, e, {
|
|
109
|
+
args: a.map((m) => m && m.replace(/\(\)/g, " ").replace(/\(_\)/g, "-"))
|
|
110
|
+
})
|
|
111
|
+
) : o;
|
|
112
|
+
}, t);
|
|
113
|
+
};
|
|
114
|
+
export {
|
|
115
|
+
Y as calcArgs,
|
|
116
|
+
h as default,
|
|
117
|
+
c as defaultFormat
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=formatView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatView.js","sources":["../../../src/components/InfoPage/formatView.js"],"sourcesContent":["// @ts-nocheck\n// Ported from https://github.com/kne-union/info-page/blob/master/src/formatView.js\nimport dayjs from 'dayjs';\nimport { isEmpty } from '@kne/is-empty';\nimport groupBy from 'lodash/groupBy';\nimport get from 'lodash/get';\nimport transform from 'lodash/transform';\n\nexport const calcArgs = (args, template) => {\n const { attr, normal } = groupBy(args, (item) => (/^.+:.+$/.test(item) ? 'attr' : 'normal'));\n const output = {};\n\n const typeTransform = (value, type) => {\n if (type === 'string') {\n return String(value);\n }\n if (type === 'number') {\n return Number(value);\n }\n if (type === 'boolean') {\n return value === 'true';\n }\n return value;\n };\n\n (normal || []).forEach((target, index) => {\n const currentTemplate = Object.assign(\n {},\n { type: 'string', defaultValue: '' },\n get(template, index),\n );\n if (currentTemplate.name && target) {\n output[currentTemplate.name] = typeTransform(target, currentTemplate.type);\n }\n });\n\n (attr || []).forEach((target) => {\n const [key, value] = target.split(':');\n const currentTemplate = template.find((item) => item.name === key);\n if (!currentTemplate) {\n return;\n }\n const { name, type } = Object.assign({}, { type: 'string', defaultValue: '' }, currentTemplate);\n output[name] = typeTransform(value, type);\n });\n\n return Object.assign(\n {},\n transform(\n template,\n (result, value) => {\n if (value.name && value.hasOwnProperty('defaultValue')) {\n result[value.name] = value.defaultValue;\n }\n },\n {},\n ),\n output,\n );\n};\n\nexport const defaultFormat = {\n date: (value, { args }) => {\n const template = args[0] || 'YYYY-MM-DD';\n return dayjs(value).format(template);\n },\n datetime: (value, { args }) => {\n const template = args[0] || 'YYYY-MM-DD HH:mm:ss';\n return dayjs(value).format(template);\n },\n dateRange: (value, { args }) => {\n const template = args[0] || 'YYYY-MM-DD',\n allowNull = args[1];\n if (!isEmpty(value[0]) && !isEmpty(value[1])) {\n return `${dayjs(value[0]).format(template)}~${dayjs(value[1]).format(template)}`;\n }\n if (allowNull === 'allow' && !isEmpty(value[0])) {\n return `${dayjs(value[0]).format(template)}以后`;\n }\n if (allowNull === 'allow' && !isEmpty(value[1])) {\n return `${dayjs(value[1]).format(template)}以前`;\n }\n return '';\n },\n boolean: (value, { args }) => {\n const trueValue = args[0] || 'true';\n if ((value || '').toString() === trueValue) {\n return '是';\n }\n return '否';\n },\n number: (value, { args }) => {\n const { style, unit, maximumFractionDigits, useGrouping, roundingMode, suffix } = calcArgs(\n args,\n [\n {\n name: 'style',\n type: 'string',\n defaultValue: 'decimal',\n },\n {\n name: 'unit',\n type: 'number',\n defaultValue: 1,\n },\n {\n name: 'maximumFractionDigits',\n type: 'number',\n defaultValue: 2,\n },\n {\n name: 'useGrouping',\n type: 'boolean',\n defaultValue: true,\n },\n {\n name: 'roundingMode',\n type: 'string',\n defaultValue: 'halfExpand',\n },\n {\n name: 'suffix',\n type: 'string',\n defaultValue: '',\n },\n ],\n );\n\n return (\n new Intl.NumberFormat(\n {},\n {\n style,\n maximumFractionDigits,\n roundingMode,\n useGrouping,\n },\n ).format(value / unit) + suffix\n );\n },\n money: (value, { args }) => {\n const unit = args[0] || '元';\n return `${value}${unit}`;\n },\n};\n\nconst formatView = (value, format, context) => {\n if (!format) {\n return value;\n }\n const formatList = format.split(' ').filter((item) => !!item);\n if (formatList.length > 0) {\n return formatList.reduce((value, format) => {\n const [name, ...args] = format.split('-');\n if (typeof defaultFormat[name] === 'function') {\n return defaultFormat[name](\n value,\n Object.assign({}, context, {\n args: args.map((item) => {\n return item && item.replace(/\\(\\)/g, ' ').replace(/\\(_\\)/g, '-');\n }),\n }),\n );\n }\n return value;\n }, value);\n }\n};\n\nexport default formatView;\n"],"names":["calcArgs","args","template","attr","normal","groupBy","item","output","typeTransform","value","type","target","index","currentTemplate","get","key","name","transform","result","defaultFormat","dayjs","allowNull","isEmpty","trueValue","style","unit","maximumFractionDigits","useGrouping","roundingMode","suffix","formatView","format","context","formatList"],"mappings":"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"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { ReactNode, ComponentType, FC } from 'react';
|
|
2
|
+
import { StepsProps } from 'antd';
|
|
3
|
+
// 基础类型定义
|
|
4
|
+
export interface BaseComponentProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// InfoPage 组件类型
|
|
11
|
+
export interface InfoPageProps extends BaseComponentProps {
|
|
12
|
+
// InfoPage 特有属性可在此添加
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface InfoPagePartProps extends BaseComponentProps {
|
|
16
|
+
title?: ReactNode;
|
|
17
|
+
subtitle?: ReactNode;
|
|
18
|
+
extra?: ReactNode;
|
|
19
|
+
bordered?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Content 组件类型
|
|
23
|
+
export interface ContentItem {
|
|
24
|
+
label?: ReactNode;
|
|
25
|
+
content?: ReactNode;
|
|
26
|
+
block?: boolean;
|
|
27
|
+
display?: boolean | ((item: ContentItem, list: ContentItem[]) => boolean);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ContentProps extends BaseComponentProps {
|
|
31
|
+
list?: ContentItem[];
|
|
32
|
+
labelAlign?: 'left' | 'right' | 'auto';
|
|
33
|
+
col?: number;
|
|
34
|
+
gutter?: number;
|
|
35
|
+
size?: 'small';
|
|
36
|
+
itemRender?: (component: ReactNode, item: ContentItem & { index: number }) => ReactNode;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Descriptions 组件类型
|
|
40
|
+
export interface DescriptionsItem {
|
|
41
|
+
label: ReactNode;
|
|
42
|
+
content: ReactNode;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface DescriptionsProps extends BaseComponentProps {
|
|
46
|
+
dataSource: DescriptionsItem[][];
|
|
47
|
+
isFull?: boolean;
|
|
48
|
+
itemRender?: (component: ReactNode, item: DescriptionsItem & { index: number }) => ReactNode;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// CentralContent 组件类型
|
|
52
|
+
export interface ColumnDefinition {
|
|
53
|
+
name: string;
|
|
54
|
+
title?: ReactNode;
|
|
55
|
+
format?: string | ((value: any, context: any) => ReactNode);
|
|
56
|
+
render?: (value: any, context: any) => ReactNode;
|
|
57
|
+
span?: number;
|
|
58
|
+
getValueOf?: (dataSource: any, context: any) => any;
|
|
59
|
+
display?: boolean | ((value: any, context: any) => boolean);
|
|
60
|
+
valueIsEmpty?: (value: any) => boolean;
|
|
61
|
+
emptyIsPlaceholder?: boolean;
|
|
62
|
+
placeholder?: ReactNode;
|
|
63
|
+
renderPlaceholder?: (context: any) => ReactNode;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface CentralContentProps extends BaseComponentProps {
|
|
67
|
+
dataSource?: object;
|
|
68
|
+
columns?: ColumnDefinition[];
|
|
69
|
+
col?: number;
|
|
70
|
+
valueIsEmpty?: (value: any) => boolean;
|
|
71
|
+
emptyIsPlaceholder?: boolean;
|
|
72
|
+
placeholder?: ReactNode;
|
|
73
|
+
context?: object;
|
|
74
|
+
/** label 最大宽度;设置后超出该宽度允许换行。数字按 px 处理 */
|
|
75
|
+
labelMaxWidth?: number | string;
|
|
76
|
+
/** label 最小宽度,默认 100 */
|
|
77
|
+
labelMinWidth?: number | string;
|
|
78
|
+
/** content 最小宽度,默认 100 */
|
|
79
|
+
contentMinWidth?: number | string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// TableView 组件类型
|
|
83
|
+
export interface RowSelectionConfig {
|
|
84
|
+
type?: 'checkbox' | 'radio';
|
|
85
|
+
selectedRowKeys?: any[];
|
|
86
|
+
onChange?: (
|
|
87
|
+
selectedRowKeys: any[],
|
|
88
|
+
selectedRow: any,
|
|
89
|
+
context: { context?: any; checked?: boolean },
|
|
90
|
+
) => void;
|
|
91
|
+
isSelectedAll?: boolean;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface TableViewProps extends BaseComponentProps {
|
|
95
|
+
dataSource?: any[];
|
|
96
|
+
columns?: ColumnDefinition[];
|
|
97
|
+
rowKey?: string | ((record: any) => any);
|
|
98
|
+
rowSelection?: RowSelectionConfig;
|
|
99
|
+
valueIsEmpty?: (value: any) => boolean;
|
|
100
|
+
emptyIsPlaceholder?: boolean;
|
|
101
|
+
placeholder?: ReactNode;
|
|
102
|
+
empty?: ReactNode;
|
|
103
|
+
onRowSelect?: (
|
|
104
|
+
record: any,
|
|
105
|
+
context: { columns?: ColumnDefinition[]; dataSource?: any[] },
|
|
106
|
+
) => void;
|
|
107
|
+
render?: (props: {
|
|
108
|
+
header: ReactNode;
|
|
109
|
+
renderBody: (dataSource: any[], context: any) => ReactNode;
|
|
110
|
+
}) => ReactNode;
|
|
111
|
+
context?: object;
|
|
112
|
+
sticky?: boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Flow 组件类型
|
|
116
|
+
export interface FlowActionListItem {
|
|
117
|
+
name?: ReactNode;
|
|
118
|
+
action?: ReactNode;
|
|
119
|
+
options?: ReactNode;
|
|
120
|
+
content?: ReactNode;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface FlowColumnsMap {
|
|
124
|
+
[key: string]: ColumnDefinition & {
|
|
125
|
+
children?: Map<string, ColumnDefinition>;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface FlowProps extends BaseComponentProps {
|
|
130
|
+
dataSource?: any[];
|
|
131
|
+
columns?: ColumnDefinition[];
|
|
132
|
+
size?: 'small' | 'default';
|
|
133
|
+
empty?: ReactNode;
|
|
134
|
+
valueIsEmpty?: (value: any) => boolean;
|
|
135
|
+
placeholder?: ReactNode;
|
|
136
|
+
emptyIsPlaceholder?: boolean;
|
|
137
|
+
progressDot?: boolean;
|
|
138
|
+
labelPlacement?: 'horizontal' | 'vertical';
|
|
139
|
+
direction?: 'horizontal' | 'vertical';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// SplitLine 组件类型
|
|
143
|
+
export interface SplitLineProps extends BaseComponentProps {
|
|
144
|
+
dataSource?: object;
|
|
145
|
+
columns?: ColumnDefinition[];
|
|
146
|
+
valueIsEmpty?: (value: any) => boolean;
|
|
147
|
+
placeholder?: ReactNode;
|
|
148
|
+
emptyIsPlaceholder?: boolean;
|
|
149
|
+
size?: number;
|
|
150
|
+
labelGap?: number;
|
|
151
|
+
labelMode?: 'horizontal' | 'vertical';
|
|
152
|
+
split?: ReactNode;
|
|
153
|
+
context?: object;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Report 组件类型
|
|
157
|
+
export interface ReportProps extends BaseComponentProps {
|
|
158
|
+
title?: ReactNode;
|
|
159
|
+
subtitle?: ReactNode;
|
|
160
|
+
extra?: ReactNode;
|
|
161
|
+
border?: boolean;
|
|
162
|
+
primaryColor?: string;
|
|
163
|
+
primaryColor1?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Score 组件类型
|
|
167
|
+
export interface ScoreProps extends BaseComponentProps {
|
|
168
|
+
value: number;
|
|
169
|
+
gap?: number;
|
|
170
|
+
total?: number;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// formatView 函数类型
|
|
174
|
+
export interface FormatContext {
|
|
175
|
+
dataSource?: any;
|
|
176
|
+
column?: ColumnDefinition;
|
|
177
|
+
target?: any;
|
|
178
|
+
[key: string]: any;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export type FormatFunction = (value: any, context: FormatContext) => ReactNode;
|
|
182
|
+
|
|
183
|
+
export declare const defaultFormat: {
|
|
184
|
+
date: FormatFunction;
|
|
185
|
+
datetime: FormatFunction;
|
|
186
|
+
dateRange: FormatFunction;
|
|
187
|
+
boolean: FormatFunction;
|
|
188
|
+
number: FormatFunction;
|
|
189
|
+
money: FormatFunction;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export declare const formatView: (value: any, format: string, context?: FormatContext) => ReactNode;
|
|
193
|
+
|
|
194
|
+
// computeColumnsValue 函数类型
|
|
195
|
+
export interface ComputeColumnsValueConfig {
|
|
196
|
+
columns: ColumnDefinition[];
|
|
197
|
+
dataSource: object | any[];
|
|
198
|
+
context?: object;
|
|
199
|
+
valueIsEmpty?: (value: any) => boolean;
|
|
200
|
+
emptyIsPlaceholder?: boolean;
|
|
201
|
+
removeEmpty?: boolean;
|
|
202
|
+
placeholder?: ReactNode;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface ComputeDisplayConfig {
|
|
206
|
+
column: ColumnDefinition;
|
|
207
|
+
dataSource?: object;
|
|
208
|
+
placeholder?: ReactNode;
|
|
209
|
+
context?: object;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export declare const computeColumnsValue: {
|
|
213
|
+
(config: ComputeColumnsValueConfig): (ColumnDefinition & { isEmpty?: boolean; value?: any })[];
|
|
214
|
+
computeDisplay: (config: ComputeDisplayConfig) => ReactNode;
|
|
215
|
+
computeColumnsDisplay: (config: ComputeColumnsValueConfig) => ReactNode[];
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
// 组件声明
|
|
219
|
+
export declare const InfoPage: FC<InfoPageProps> & {
|
|
220
|
+
Part: FC<InfoPagePartProps>;
|
|
221
|
+
Collapse: ComponentType<any>;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export declare const Content: FC<ContentProps> & {
|
|
225
|
+
Label: FC<{ className?: string; children: ReactNode; setWidth: (width: number) => void }>;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export declare const Descriptions: FC<DescriptionsProps>;
|
|
229
|
+
|
|
230
|
+
export declare const CentralContent: FC<CentralContentProps>;
|
|
231
|
+
|
|
232
|
+
export declare const TableView: FC<TableViewProps> & {
|
|
233
|
+
Header: ComponentType<any>;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export declare const Flow: FC<FlowProps> & {
|
|
237
|
+
ActionList: FC<FlowActionListItem>;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export declare const SplitLine: FC<SplitLineProps>;
|
|
241
|
+
|
|
242
|
+
export declare const Report: FC<ReportProps> & {
|
|
243
|
+
List: ComponentType<any>;
|
|
244
|
+
Result: ComponentType<any>;
|
|
245
|
+
Table: ComponentType<any>;
|
|
246
|
+
Part: ComponentType<any>;
|
|
247
|
+
Score: FC<ScoreProps>;
|
|
248
|
+
PrintPageBreak: ComponentType<any>;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export declare const Score: FC<ScoreProps>;
|
|
252
|
+
|
|
253
|
+
export declare const InfoList: typeof Content;
|
|
254
|
+
export declare const DetailList: typeof Descriptions;
|
|
255
|
+
export declare const FieldView: typeof CentralContent;
|
|
256
|
+
export declare function formatView(...args: any[]): any;
|
|
257
|
+
export declare const defaultFormat: any;
|
|
258
|
+
export declare function computeDisplay(...args: any[]): any;
|
|
259
|
+
export declare function computeColumnsDisplay(...args: any[]): any;
|
|
260
|
+
|
|
261
|
+
// 默认导出
|
|
262
|
+
export default InfoPage;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Children as c } from "react";
|
|
3
|
+
import i from "classnames";
|
|
4
|
+
import m from "./layouts.module.scss.js";
|
|
5
|
+
const u = (o) => o == null || o === "1fr" ? { flex: "1 1 0%", minWidth: 0 } : { flex: "none", width: o, minWidth: 0 }, v = ({ widths: o, className: s, children: e, ...t }) => {
|
|
6
|
+
const n = c.toArray(e);
|
|
7
|
+
return /* @__PURE__ */ r("div", { className: i(m["modal-columns-layout"], s), ...t, children: n.map((a, l) => /* @__PURE__ */ r(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
className: m["modal-columns-layout__col"],
|
|
11
|
+
style: o ? u(o[l]) : void 0,
|
|
12
|
+
children: a
|
|
13
|
+
},
|
|
14
|
+
l
|
|
15
|
+
)) });
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
v as default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=ColumnsLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnsLayout.js","sources":["../../../src/components/ReactModal/ColumnsLayout.jsx"],"sourcesContent":["// @ts-nocheck\n// Ported from https://github.com/kne-union/react-modal/blob/master/src/ColumnsLayout.js\nimport { Children } from 'react';\nimport classnames from 'classnames';\nimport styles from './layouts.module.scss';\n\nconst resolveColStyle = (width) => {\n if (width == null || width === '1fr') {\n return { flex: '1 1 0%', minWidth: 0 };\n }\n return { flex: 'none', width, minWidth: 0 };\n};\n\nconst ColumnsLayout = ({ widths, className, children, ...props }) => {\n const cols = Children.toArray(children);\n\n return (\n <div className={classnames(styles['modal-columns-layout'], className)} {...props}>\n {cols.map((child, index) => (\n <div\n key={index}\n className={styles['modal-columns-layout__col']}\n style={widths ? resolveColStyle(widths[index]) : undefined}\n >\n {child}\n </div>\n ))}\n </div>\n );\n};\n\nexport default ColumnsLayout;\n"],"names":["resolveColStyle","width","ColumnsLayout","widths","className","children","props","cols","Children","jsx","classnames","styles","child","index"],"mappings":";;;;AAMA,MAAMA,IAAkB,CAACC,MACnBA,KAAS,QAAQA,MAAU,QACtB,EAAE,MAAM,UAAU,UAAU,EAAA,IAE9B,EAAE,MAAM,QAAQ,OAAAA,GAAO,UAAU,EAAA,GAGpCC,IAAgB,CAAC,EAAE,QAAAC,GAAQ,WAAAC,GAAW,UAAAC,GAAU,GAAGC,QAAY;AACnE,QAAMC,IAAOC,EAAS,QAAQH,CAAQ;AAEtC,SACE,gBAAAI,EAAC,OAAA,EAAI,WAAWC,EAAWC,EAAO,sBAAsB,GAAGP,CAAS,GAAI,GAAGE,GACxE,UAAAC,EAAK,IAAI,CAACK,GAAOC,MAChB,gBAAAJ;AAAA,IAAC;AAAA,IAAA;AAAA,MAEC,WAAWE,EAAO,2BAA2B;AAAA,MAC7C,OAAOR,IAASH,EAAgBG,EAAOU,CAAK,CAAC,IAAI;AAAA,MAEhD,UAAAD;AAAA,IAAA;AAAA,IAJIC;AAAA,EAAA,CAMR,GACH;AAEJ;"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export function resolveDrawerGetContainer({ customGetContainer, getPopupContainer, getHostNode, }: {
|
|
2
|
+
customGetContainer: any;
|
|
3
|
+
getPopupContainer: any;
|
|
4
|
+
getHostNode: any;
|
|
5
|
+
}): (triggerNode: any) => any;
|
|
6
|
+
export function lockParentScroll(getScrollElement: any): () => void;
|
|
7
|
+
export function computedDrawerProps({ children, footer, footerButtons, className, size, placement, title, onClose, onConfirm, confirmText, onCancel, cancelText, closable, noPadding, bodyScroll, isMobile, fixedModeClass, rootClassName, classNames: propsClassNames, styles: propsStyles, style: propsStyle, width: propsWidth, height: propsHeight, modalRender, drawerRender, ...props }: {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
children: any;
|
|
10
|
+
footer: any;
|
|
11
|
+
footerButtons: any;
|
|
12
|
+
className: any;
|
|
13
|
+
size?: string | undefined;
|
|
14
|
+
placement?: string | undefined;
|
|
15
|
+
title: any;
|
|
16
|
+
onClose: any;
|
|
17
|
+
onConfirm: any;
|
|
18
|
+
confirmText: any;
|
|
19
|
+
onCancel: any;
|
|
20
|
+
cancelText: any;
|
|
21
|
+
closable: any;
|
|
22
|
+
noPadding: any;
|
|
23
|
+
bodyScroll?: boolean | undefined;
|
|
24
|
+
isMobile: any;
|
|
25
|
+
fixedModeClass: any;
|
|
26
|
+
rootClassName: any;
|
|
27
|
+
classNames: any;
|
|
28
|
+
styles: any;
|
|
29
|
+
style: any;
|
|
30
|
+
width: any;
|
|
31
|
+
height: any;
|
|
32
|
+
modalRender: any;
|
|
33
|
+
drawerRender: any;
|
|
34
|
+
}): {
|
|
35
|
+
title: null;
|
|
36
|
+
maskClosable: any;
|
|
37
|
+
destroyOnHidden: boolean;
|
|
38
|
+
footer: null;
|
|
39
|
+
closable: boolean;
|
|
40
|
+
onClose: any;
|
|
41
|
+
rootClassName: string;
|
|
42
|
+
classNames: any;
|
|
43
|
+
className: string;
|
|
44
|
+
style: any;
|
|
45
|
+
styles: any;
|
|
46
|
+
children: import("react").JSX.Element;
|
|
47
|
+
height: any;
|
|
48
|
+
width?: undefined;
|
|
49
|
+
placement: string;
|
|
50
|
+
drawerRender?: any;
|
|
51
|
+
} | {
|
|
52
|
+
title: null;
|
|
53
|
+
maskClosable: any;
|
|
54
|
+
destroyOnHidden: boolean;
|
|
55
|
+
footer: null;
|
|
56
|
+
closable: boolean;
|
|
57
|
+
onClose: any;
|
|
58
|
+
rootClassName: string;
|
|
59
|
+
classNames: any;
|
|
60
|
+
className: string;
|
|
61
|
+
style: any;
|
|
62
|
+
styles: any;
|
|
63
|
+
children: import("react").JSX.Element;
|
|
64
|
+
width: any;
|
|
65
|
+
height?: undefined;
|
|
66
|
+
placement: string;
|
|
67
|
+
drawerRender?: any;
|
|
68
|
+
};
|
|
69
|
+
export default Drawer;
|
|
70
|
+
declare const Drawer: {
|
|
71
|
+
(props: any): import('react').CElement<any, import('react').Component<any, any, any>>;
|
|
72
|
+
displayName: string;
|
|
73
|
+
};
|