@sdata-plugin-adapter/react 0.0.0-alpha.4 → 0.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.
- package/dist/export-IdFffdaq.js +2 -0
- package/dist/export-IdFffdaq.js.map +1 -0
- package/dist/{index-D8cPmNOG.js → index-BTEOz66V.js} +3 -3
- package/dist/{index-D8cPmNOG.js.map → index-BTEOz66V.js.map} +1 -1
- package/dist/{index-CC9uxwpR.js → index-CPRh7huJ.js} +3 -3
- package/dist/{index-CC9uxwpR.js.map → index-CPRh7huJ.js.map} +1 -1
- package/dist/index-D4XI9Up9.js +9 -0
- package/dist/index-D4XI9Up9.js.map +1 -0
- package/dist/{index-BV9RX_Ka.js → index-DOjL63ZZ.js} +3 -3
- package/dist/{index-BV9RX_Ka.js.map → index-DOjL63ZZ.js.map} +1 -1
- package/dist/{index-CUpP0oMu.js → index-DYH8RTH4.js} +3 -3
- package/dist/{index-CUpP0oMu.js.map → index-DYH8RTH4.js.map} +1 -1
- package/dist/{index-DQLM9I3g.js → index-uvW2tp_u.js} +3 -3
- package/dist/index-uvW2tp_u.js.map +1 -0
- package/dist/index.d.ts +15 -6
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/{start-KvBmIDZs.js → start-rmMDvB0v.js} +157 -148
- package/dist/{start-KvBmIDZs.js.map → start-rmMDvB0v.js.map} +1 -1
- package/package.json +3 -3
- package/dist/export-CuNiopMp.js +0 -2
- package/dist/export-CuNiopMp.js.map +0 -1
- package/dist/index-CqtMUNRo.js +0 -13
- package/dist/index-CqtMUNRo.js.map +0 -1
- package/dist/index-DQLM9I3g.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-IdFffdaq.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { generateUUID as A, setDomAttributes as N } from "@sdata-plugin-adapter/utils";
|
|
2
2
|
import P from "configJson";
|
|
3
|
-
import "./export-
|
|
4
|
-
import { c as D } from "./start-
|
|
3
|
+
import "./export-IdFffdaq.js";
|
|
4
|
+
import { c as D } from "./start-rmMDvB0v.js";
|
|
5
5
|
const R = !0, { "online-development-mode": m, "requirement-number": T } = P ?? {}, y = (n) => {
|
|
6
6
|
var v;
|
|
7
7
|
const { useEffect: d, useRef: b } = window.React, I = !!(m != null && m.open), {
|
|
@@ -56,4 +56,4 @@ export {
|
|
|
56
56
|
j as setAttributes,
|
|
57
57
|
k as start
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=index-
|
|
59
|
+
//# sourceMappingURL=index-BTEOz66V.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
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,E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OAAO,oBAAP,QAAAA,EAAwB;AAAA,QACtBR,IAAS;AAAA,QACT;AAAA,QACAuB,EAAI;AAAA,QACJL,KAA2B,CAAA;AAAA,SAEtB,MAAM;;AACX,SAAAV,IAAA,OAAO,oBAAP,QAAAA,EAAwB,eAAeR,IAAS;AAAA,MAClD;AAAA,IACF,GAAG,CAACO,GAAaY,GAAcF,GAASC,CAAsB,CAAC;AAAA,EACjE,GAEOvB;AACT,GChGa8B,IAAgD,OAAOC,GAAK9B,MAAU;AACjF,EAAA+B,EAAiBD,GAAK9B,GAAOD,CAAY;AAC3C,GAEaiC,IAAQ,OAAOC,MAA8C;AACxE,EAAAC,EAAkD,EAAE,GAAGD,GAAS,eAAAJ,GAAe,SAAAM,GAAS;AAC1F,GAEaA,IAAU,CAACnC,MACfD,EAAaC,CAAK;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { generateUUID as Vf, setDomAttributes as kf } from "@sdata-plugin-adapter/utils";
|
|
2
2
|
import na from "configJson";
|
|
3
|
-
import "./export-
|
|
4
|
-
import { c as ea } from "./start-
|
|
3
|
+
import "./export-IdFffdaq.js";
|
|
4
|
+
import { c as ea } from "./start-rmMDvB0v.js";
|
|
5
5
|
var Oi = typeof global == "object" && global && global.Object === Object && global, ta = typeof self == "object" && self && self.Object === Object && self, H = Oi || ta || Function("return this")(), q = H.Symbol, Li = Object.prototype, ra = Li.hasOwnProperty, ia = Li.toString, ue = q ? q.toStringTag : void 0;
|
|
6
6
|
function ua(n) {
|
|
7
7
|
var e = ra.call(n, ue), t = n[ue];
|
|
@@ -4583,4 +4583,4 @@ export {
|
|
|
4583
4583
|
I$ as setAttributes,
|
|
4584
4584
|
B$ as start
|
|
4585
4585
|
};
|
|
4586
|
-
//# sourceMappingURL=index-
|
|
4586
|
+
//# sourceMappingURL=index-CPRh7huJ.js.map
|