@sdata-plugin-adapter/react 0.0.0-alpha.3 → 0.0.0-alpha.5
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/export-IdFffdaq.js +2 -0
- package/dist/export-IdFffdaq.js.map +1 -0
- package/dist/index-BTEOz66V.js +59 -0
- package/dist/index-BTEOz66V.js.map +1 -0
- package/dist/index-CPRh7huJ.js +4586 -0
- package/dist/index-CPRh7huJ.js.map +1 -0
- package/dist/index-D4XI9Up9.js +9 -0
- package/dist/index-D4XI9Up9.js.map +1 -0
- package/dist/index-DOjL63ZZ.js +92 -0
- package/dist/index-DOjL63ZZ.js.map +1 -0
- package/dist/index-DYH8RTH4.js +56 -0
- package/dist/index-DYH8RTH4.js.map +1 -0
- package/dist/index-bwVa5yZu.js +24 -0
- package/dist/index-bwVa5yZu.js.map +1 -0
- package/dist/index-uvW2tp_u.js +71 -0
- package/dist/index-uvW2tp_u.js.map +1 -0
- package/dist/index.d.ts +18 -1
- package/dist/index.js +18 -5557
- package/dist/index.js.map +1 -1
- package/dist/start-rmMDvB0v.js +704 -0
- package/dist/start-rmMDvB0v.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-IdFffdaq.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { generateUUID as A, setDomAttributes as N } from "@sdata-plugin-adapter/utils";
|
|
2
|
+
import P from "configJson";
|
|
3
|
+
import "./export-IdFffdaq.js";
|
|
4
|
+
import { c as D } from "./start-rmMDvB0v.js";
|
|
5
|
+
const R = !0, { "online-development-mode": m, "requirement-number": T } = P ?? {}, y = (n) => {
|
|
6
|
+
var v;
|
|
7
|
+
const { useEffect: d, useRef: b } = window.React, I = !!(m != null && m.open), {
|
|
8
|
+
viewId: g,
|
|
9
|
+
pluginId: E,
|
|
10
|
+
type: f,
|
|
11
|
+
allComponentList: i,
|
|
12
|
+
pluginConfig: _,
|
|
13
|
+
configuration: w,
|
|
14
|
+
changeConfiguration: C
|
|
15
|
+
} = n, e = { ...n }, l = e.componentId = E;
|
|
16
|
+
return (R || I) && (e.type = f === "designConfiguration" ? "designConfiguration" : "main", C && (e.changeCustomConfig = C), f === "designConfiguration" ? (e.customConfig = w ? JSON.parse(w) : {}, Array.isArray(i) && (e.columnList = ((v = i == null ? void 0 : i.map) == null ? void 0 : v.call(i, (t) => {
|
|
17
|
+
var c, s, p;
|
|
18
|
+
const o = ((c = t.componentConfig) == null ? void 0 : c.title) || t.showType, r = ((p = (s = window == null ? void 0 : window.appSdk) == null ? void 0 : s.intlGetKey) == null ? void 0 : p.call(s, o)) ?? o;
|
|
19
|
+
return {
|
|
20
|
+
showType: t.showType,
|
|
21
|
+
value: t.id,
|
|
22
|
+
label: r
|
|
23
|
+
};
|
|
24
|
+
})) ?? [])) : e.customConfig = _), e.triggerEvent = (t, o = {}) => {
|
|
25
|
+
var r;
|
|
26
|
+
l && ((r = window.eventCenter) == null || r.triggerEventNew({
|
|
27
|
+
objectId: g,
|
|
28
|
+
componentId: g + ",listLoading",
|
|
29
|
+
type: "viewer",
|
|
30
|
+
event: t,
|
|
31
|
+
payload: o
|
|
32
|
+
}));
|
|
33
|
+
}, e.useRegisterComponent = (t) => {
|
|
34
|
+
const { actions: o = {}, eventActionDefinitions: r } = t, { customConfig: c } = e, s = Object.keys(o).reduce((a, u) => (a[`do_EventCenter_${u}`] = o[u], a), {}) || {};
|
|
35
|
+
let h = b({ Event_Center_getName: () => c.id || T || A(), ...s });
|
|
36
|
+
d(() => {
|
|
37
|
+
var a;
|
|
38
|
+
return (a = window.componentCenter) == null || a.register(
|
|
39
|
+
g + ",listLoading",
|
|
40
|
+
"comp",
|
|
41
|
+
h.current,
|
|
42
|
+
r ?? {}
|
|
43
|
+
), () => {
|
|
44
|
+
var u;
|
|
45
|
+
(u = window.componentCenter) == null || u.removeInstance(g + ",listLoading");
|
|
46
|
+
};
|
|
47
|
+
}, [l, c, o, r]);
|
|
48
|
+
}, e;
|
|
49
|
+
}, j = async (n, d) => {
|
|
50
|
+
N(n, d, y);
|
|
51
|
+
}, k = async (n) => {
|
|
52
|
+
D({ ...n, setAttributes: j, adapter: q });
|
|
53
|
+
}, q = (n) => y(n);
|
|
54
|
+
export {
|
|
55
|
+
q as adapter,
|
|
56
|
+
j as setAttributes,
|
|
57
|
+
k as start
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index-BTEOz66V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BTEOz66V.js","sources":["../src/plugins/dataFormList/adapter.ts","../src/plugins/dataFormList/index.ts"],"sourcesContent":["import { generateUUID } from '@sdata-plugin-adapter/utils';\r\nimport configJson from 'configJson';\r\nimport type {\r\n UseRegisterComponentParams,\r\n BaseDFListProps,\r\n DFListAdapterProps,\r\n ActionsFunction,\r\n EventActionDefinitions,\r\n} from '@sdata-plugin-adapter/types';\r\n\r\nconst isEnvProd = import.meta.env.PROD;\r\n\r\nconst { 'online-development-mode': onlineDevMode, 'requirement-number': requirMNumber } =\r\n configJson ?? {};\r\n\r\nconst adapterProps = (props: BaseDFListProps): DFListAdapterProps => {\r\n const { useEffect, useRef } = window.React;\r\n const onlineDevelopmentMode: boolean = !!onlineDevMode?.open;\r\n const {\r\n viewId,\r\n pluginId,\r\n type,\r\n allComponentList,\r\n pluginConfig,\r\n configuration,\r\n changeConfiguration,\r\n } = props;\r\n // 透传给二开的props\r\n const adapterProps = { ...props } as DFListAdapterProps;\r\n /**\r\n * 扩展 props API: 仅限在宿主环境为smdata平台\r\n */\r\n const componentId = (adapterProps.componentId = pluginId);\r\n if (isEnvProd || onlineDevelopmentMode) {\r\n adapterProps.type = type === 'designConfiguration' ? 'designConfiguration' : 'main';\r\n // 重命名 changeConfiguration\r\n if (changeConfiguration) {\r\n adapterProps.changeCustomConfig = changeConfiguration;\r\n }\r\n\r\n if (type === 'designConfiguration') {\r\n adapterProps.customConfig = configuration ? JSON.parse(configuration) : {};\r\n if (Array.isArray(allComponentList)) {\r\n adapterProps.columnList =\r\n allComponentList?.map?.((item) => {\r\n const labelValue = item.componentConfig?.title || item.showType;\r\n const label = window?.appSdk?.intlGetKey?.(labelValue) ?? labelValue;\r\n return {\r\n showType: item.showType,\r\n value: item.id,\r\n label,\r\n };\r\n }) ?? [];\r\n }\r\n } else {\r\n adapterProps.customConfig = pluginConfig;\r\n }\r\n }\r\n /**\r\n * 逻辑控制通信API\r\n * 1、triggerEvent: 用来触发组件事件\r\n * @param {String} eventName 事件名\r\n * @param {Object} payload 事件传参\r\n * @example\r\n * triggerEvent(\"click\",{value:\"123\"})\r\n *\r\n * 2、useRegisterComponent: 用来注册组件的动作和事件\r\n */\r\n adapterProps.triggerEvent = (eventName: string, payload: Record<string, any> = {}) => {\r\n componentId &&\r\n window.eventCenter?.triggerEventNew({\r\n objectId: viewId,\r\n componentId: viewId + ',listLoading',\r\n type: 'viewer',\r\n event: eventName,\r\n payload,\r\n });\r\n };\r\n adapterProps.useRegisterComponent = (params: UseRegisterComponentParams) => {\r\n const { actions = {}, eventActionDefinitions } = params;\r\n const { customConfig } = adapterProps;\r\n\r\n const _actions =\r\n Object.keys(actions).reduce((acc, key: string) => {\r\n acc[`do_EventCenter_${key}`] = actions[key];\r\n return acc;\r\n }, {} as ActionsFunction) || {};\r\n\r\n const Event_Center_getName = () => {\r\n return customConfig.id || requirMNumber || generateUUID();\r\n };\r\n let ref = useRef({ Event_Center_getName, ..._actions });\r\n useEffect(() => {\r\n window.componentCenter?.register(\r\n viewId + ',listLoading',\r\n 'comp',\r\n ref.current,\r\n eventActionDefinitions ?? ({} as EventActionDefinitions),\r\n );\r\n return () => {\r\n window.componentCenter?.removeInstance(viewId + ',listLoading');\r\n };\r\n }, [componentId, customConfig, actions, eventActionDefinitions]);\r\n };\r\n\r\n return adapterProps;\r\n};\r\n\r\nexport { adapterProps };\r\n","import { setDomAttributes } from '@sdata-plugin-adapter/utils';\r\nimport { adapterProps } from './adapter';\r\nimport { createPlugin } from '@/common/export';\r\nimport type {\r\n BaseDFListProps,\r\n DFListAdapterProps,\r\n SetAttributes,\r\n StartOptions,\r\n} from '@sdata-plugin-adapter/types';\r\n\r\nexport const setAttributes: SetAttributes<BaseDFListProps> = async (dom, props) => {\r\n setDomAttributes(dom, props, adapterProps);\r\n};\r\n\r\nexport const start = async (options: StartOptions<DFListAdapterProps>) => {\r\n createPlugin<BaseDFListProps, DFListAdapterProps>({ ...options, setAttributes, adapter });\r\n};\r\n\r\nexport const adapter = (props: BaseDFListProps) => {\r\n return adapterProps(props);\r\n};\r\n"],"names":["isEnvProd","onlineDevMode","requirMNumber","configJson","adapterProps","props","useEffect","useRef","onlineDevelopmentMode","viewId","pluginId","type","allComponentList","pluginConfig","configuration","changeConfiguration","componentId","_a","item","labelValue","label","_c","_b","eventName","payload","params","actions","eventActionDefinitions","customConfig","_actions","acc","key","ref","generateUUID","setAttributes","dom","setDomAttributes","start","options","createPlugin","adapter"],"mappings":";;;;AAUA,MAAMA,IAAY,IAEZ,EAAE,2BAA2BC,GAAe,sBAAsBC,EAAA,IACtEC,KAAc,CAAA,GAEVC,IAAe,CAACC,MAA+C;;AACnE,QAAM,EAAE,WAAAC,GAAW,QAAAC,EAAA,IAAW,OAAO,OAC/BC,IAAiC,CAAC,EAACP,KAAA,QAAAA,EAAe,OAClD;AAAA,IACJ,QAAAQ;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,eAAAC;AAAA,IACA,qBAAAC;AAAA,EAAA,IACEV,GAEED,IAAe,EAAE,GAAGC,EAAA,GAIpBW,IAAeZ,EAAa,cAAcM;AAChD,UAAIV,KAAaQ,OACfJ,EAAa,OAAOO,MAAS,wBAAwB,wBAAwB,QAEzEI,MACFX,EAAa,qBAAqBW,IAGhCJ,MAAS,yBACXP,EAAa,eAAeU,IAAgB,KAA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