@tachybase/module-hera 2.3.22 → 2.3.23
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/client/index.js
CHANGED
|
@@ -79,4 +79,4 @@
|
|
|
79
79
|
div::-webkit-scrollbar {
|
|
80
80
|
display: none;
|
|
81
81
|
}
|
|
82
|
-
`,children:c?__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(PDFViewer,{file:c,width:i,ref:l}):""})]})};class PluginPDF extends client.Plugin{load(){return T(this,null,function*(){this.app.addScopes({usePDFViewerPrintActionProps}),this.app.addComponents({PDFViewerBlockInitializer,PDFViewerPrintActionInitializer,PDFViewerProvider,PDFViwer:InternalPDFViewer}),this.schemaInitializerManager.add(pdfViewActionInitializer);const e={title:tval("preview block"),name:"previewBlock",type:"itemGroup",children:[]};this.app.schemaInitializerManager.get("popup:common:addBlock").add(e.name,e)})}}const SheetBlockContext=React.createContext({}),InternalSheetBlockProvider=n=>{const e=schema.useField(),s=client.useDataBlockRequest();return s.loading&&!e.loaded?__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Spin,{}):(e.loaded=!0,__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(SheetBlockContext.Provider,{value:{field:e,service:s},children:n.children}))},SheetBlock=()=>{const n=React.useRef();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs("div",{style:{height:"70vh"},children:[__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Button,{onClick:()=>console.log("data",n.current.getData()),children:"显示数据"}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(ExcelSheet,{ref:n})]})},SheetBlockProvider=n=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.DataBlockProvider,I(D({name:"sheet"},n),{children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(InternalSheetBlockProvider,D({},n))})),createSheetBlockSchema=n=>{const{collection:e}=n;return{title:e.title,type:"void","x-acl-action":`${e.name}:list`,"x-decorator":"SheetBlockProvider","x-decorator-props":{collection:e.name},"x-toolbar":"SheetBlockToolbar","x-settings":"sheetBlockSettings","x-component":"CardItem",properties:{[client$1.uid()]:{type:"void","x-component":"SheetBlock"}}}},SheetBlockInitializer=()=>{const{insert:n}=client.useSchemaInitializer(),e=client.useCollectionManager(),s=client.useSchemaInitializerItem();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.DataBlockInitializer,I(D({},s),{icon:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(icons.TableOutlined,{}),onCreateBlockSchema:r=>T(null,[r],function*({item:i}){const o=e.getCollection(i.name);n(createSheetBlockSchema({collection:o}))})}))},sheetBlockSettings=new client.SchemaSettings({name:"sheetBlockSettings",items:[{name:"remove",type:"remove"}]}),SheetBlockToolbar=n=>{const e=schema.useFieldSchema();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaToolbar,D({title:e.title,settings:e["x-settings"]},n))};class PluginSheet extends client.Plugin{load(){return T(this,null,function*(){this.app.addComponents({SheetBlock,SheetBlockInitializer,SheetBlockProvider,SheetBlockToolbar}),this.schemaSettingsManager.add(sheetBlockSettings),this.app.schemaInitializerManager.addItem("page:addBlock","dataBlocks.sheetBlock",{title:tval("Sheet"),Component:"SheetBlockInitializer"})})}}const useGetCustomAssociatedComponents=()=>useCustomComponent(CustomComponentType.CUSTOM_ASSOCIATED_FIELD),useGetCustomComponents=()=>useCustomComponent(CustomComponentType.CUSTOM_FIELD);class ExcelFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="excelField",this.type="json",this.group="advanced",this.order=3,this.title=tval("Excel table"),this.sortable=!0,this.default={interface:"json",type:"json",uiSchema:{type:"object","x-component":"ExcelFile"}},this.availableTypes=["json"],this.hasDefaultValue=!1,this.properties=D({},client.defaultProps)}}class AssociatedFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="associated",this.type="object",this.group="relation",this.order=10,this.title="关联字段",this.description="关联字段",this.isAssociation=!0,this.default={type:"belongsTo",uiSchema:{"x-component":"AssociatedField"}},this.availableTypes=["belongsTo"],this.properties=I(D({},client.defaultProps),{"uiSchema.x-component-props.collection":{type:"string",title:"关联数据表","x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!1},enum:"{{collections}}",required:!0},"uiSchema.x-component-props.sourceCollection":{type:"string",title:"查询数据表","x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!1},enum:"{{collections}}",required:!0},"uiSchema.x-component-props.sourceField":{type:"string",title:"查询数据表到关联数据表的路径","x-component":"Input","x-decorator":"FormItem",required:!0},"uiSchema.x-component-props.fieldExp":{type:"string",title:"关联字段",required:!0,"x-component":"Expression","x-decorator":"FormItem","x-component-props":{useCurrentFields:"{{ useCurrentFields }}"}},"uiSchema.x-component-props.dateFieldExp":{type:"string",title:"关联日期",required:!0,"x-component":"Expression","x-decorator":"FormItem","x-component-props":{useCurrentFields:"{{ useCurrentFields }}"}},target:{type:"string",title:"关联数据表","x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!1},enum:"{{collections}}",required:!0,"x-display":"hidden","x-reactions":[{dependencies:["uiSchema.x-component-props.collection"],fulfill:{state:{value:"{{$deps[0]}}"}}}]},targetKey:{type:"string",title:"关联数据表键",required:!0,default:"id","x-display":"hidden","x-decorator":"FormItem","x-component":"Input"}}),this.filterable={nested:!0,children:[]}}}const{defaultProps:defaultProps$1}=client.interfacesProperties,formulaType=[{dependencies:["dataType"],fulfill:{state:{display:'{{["formula"].includes($deps[0]) ? "visible" : "none"}}'}}}],panelType=[{dependencies:["dataType"],fulfill:{state:{display:'{{["jsCode"].includes($deps[0]) ? "visible" : "none"}}'}}}];class CalcFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="calc2",this.type="object",this.group="advanced",this.title="数据计算(过期)",this.description="数据字段计算",this.sortable=!0,this.default={type:"virtual",uiSchema:{type:"string","x-component":"CalcResult","x-component-props":{formula:"",prefix:"",suffix:"",decimal:"",panel:""},"x-read-pretty":!0}},this.properties=I(D({},defaultProps$1),{dataType:{type:"string",title:"计算类型","x-decorator":"FormItem","x-component":"Select",enum:[{value:"formula",label:"公式"},{value:"jsCode",label:"代码"}],required:!0,default:"formula",description:"公式:使用公式计算,代码:使用js代码计算"},"uiSchema.x-component-props.formula":{type:"string",title:"公式","x-decorator":"FormItem","x-component":"Input",default:"",required:!0,"x-reactions":formulaType},"uiSchema.x-component-props.panel":{type:"string",title:"jsCode","x-decorator":"FormItem","x-component":"Input.TextArea",description:"注意,此内容有值计算操作将以此内容为准,而不是公式,适用于面板中的计算",required:!0,"x-reactions":panelType},"uiSchema.x-component-props.prefix":{type:"string",title:"前缀","x-decorator":"FormItem","x-component":"Input"},"uiSchema.x-component-props.suffix":{type:"string",title:"后缀","x-decorator":"FormItem","x-component":"Input"},"uiSchema.x-component-props.decimal":{type:"string",title:'{{t("Precision")}}',"x-component":"Select","x-decorator":"FormItem",required:!0,default:"0",enum:[{value:"0",label:"1"},{value:"1",label:"1.0"},{value:"2",label:"1.00"},{value:"3",label:"1.000"},{value:"4",label:"1.0000"},{value:"5",label:"1.00000"}],"x-reactions":formulaType}})}}const{defaultProps}=client.interfacesProperties;class CustomFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="custom",this.type="object",this.group="advanced",this.title="组件字段",this.description="组件字段",this.sortable=!0,this.default={type:"virtual",uiSchema:{type:"string","x-component":"CustomField","x-read-pretty":!0}},this.properties=I(D({},defaultProps),{"uiSchema.x-component-props.component":{type:"string",title:"组件","x-decorator":"FormItem","x-component":"Select",enum:" {{ useGetCustomComponents() }} ",required:!0,description:"需要在插件中注册相应的组件后可以使用"}})}}class CustomAssociatedFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="customAssociated",this.type="object",this.group="relation",this.order=10,this.title="自定义关联字段",this.description="自定义关联字段",this.isAssociation=!0,this.default={type:"virtual",uiSchema:{"x-component":"CustomAssociatedField"}},this.availableTypes=["belongsTo"],this.properties=I(D({},client.defaultProps),{"uiSchema.x-component-props.component":{type:"string",title:"组件","x-decorator":"FormItem","x-component":"Select",enum:" {{ useGetCustomAssociatedComponents() }}",required:!0,description:"需要在插件中注册相应的组件后可以使用"},target:{type:"string",title:"关联数据表","x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!1},enum:"{{collections}}",required:!0},targetKey:{type:"string",title:"关联数据表键",required:!0,default:"id","x-display":"hidden","x-decorator":"FormItem","x-component":"Input"}}),this.filterable={nested:!0,children:[]}}}class SignaturePadFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="signatureSchema",this.type="object",this.group="advanced",this.order=2,this.title=tval("Signature input"),this.sortable=!0,this.default={interface:"signature",type:"json",uiSchema:{type:"signature","x-component":"SignatureInput"}},this.availableTypes=["json"],this.hasDefaultValue=!1,this.properties=D({},client.defaultProps)}}class TstzrangeFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="tstzrange",this.type="object",this.group="datetime",this.order=2,this.title=tval("Date range"),this.sortable=!0,this.default={type:"tstzrange",uiSchema:{type:"object","x-component":"DatePicker.RangePicker","x-component-props":{utc:!1,valueType:"range"}}},this.availableTypes=["tstzrange"],this.hasDefaultValue=!1,this.properties=D({},client.defaultProps)}}const SettingBlockInitializer=()=>{const{insert:n}=client.useSchemaInitializer(),{t:e}=useTranslation(),s=React.useContext(schema.SchemaOptionsContext),{theme:i}=client.useGlobalTheme(),r=client.useSchemaInitializerItem(),o=client.useCollectionManager(),l=client.useAPIClient();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.DataBlockInitializer,I(D({},r),{componentType:"FormItem",icon:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(icons.FormOutlined,{}),onCreateBlockSchema:c=>T(null,[c],function*({item:a}){const d=o.getCollection(a.name),u=d.titleField,f=yield client.FormDialog(e("Pick a data entry for viewing and editing"),()=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.APIClientProvider,{apiClient:l,children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaComponentOptions,{scope:s.scope,components:D({},s.components),children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client$1.FormLayout,{layout:"vertical",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaComponent,{schema:{properties:{id:{title:tval("Please select"),required:!0,"x-component":"RemoteSelect","x-component-props":{service:{resource:a.name},fieldNames:{label:u,value:"id"}},"x-decorator":"FormItem"}}}})})})}),i).open({initialValues:{}}),p=client.createFormBlockSchema({dataSource:a.dataSource,collection:d.name,action:"get",filterByTk:f.id,actionInitializers:"editForm:configureActions"});n(p)})}))},usePaginationVisible=()=>{var e;return((e=schema.useFieldSchema()["x-component-props"])==null?void 0:e.mode)==="SubTable"},EditTitle=()=>{var a;const{getCollectionJoinField:n}=client.useCollectionManager_deprecated(),{getField:e}=client.useCollection_deprecated(),s=schema.useField(),i=schema.useFieldSchema(),{t:r}=useTranslation(),{dn:o}=client.useDesignable(),l=e(i.name)||n(i["x-collection-field"]);return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaSettingsModalItem,{title:r("Edit field title"),schema:{type:"object",title:r("Edit field title"),properties:{title:{title:r("Field title"),default:s==null?void 0:s.title,description:`${r("Original field title: ")}${l?(a=l==null?void 0:l.uiSchema)==null?void 0:a.title:i.name}`,"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:({title:c})=>{c&&(s.title=c,i.title=c,o.emit("patch",{schema:{"x-uid":i["x-uid"],title:i.title}})),o.refresh()}},"edit-field-title")},IsTablePageSize=()=>{const{dn:n}=client.useDesignable(),e=schema.useFieldSchema(),{t:s}=useTranslation();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaSettingsSwitchItem,{title:s("Pagination"),checked:e["x-component-props"].pagination,onChange:i=>{e["x-component-props"].pagination||(e["x-component-props"]=I(D({},e["x-component-props"]),{pagination:!1})),e["x-component-props"].pagination=i,n.emit("patch",{schema:{"x-uid":e["x-uid"],"x-component-props":D({},e==null?void 0:e["x-component-props"])}}),n.refresh()}})},SchemaSettingsDatePickerType=()=>{var a,c,d;const n=schema.useFieldSchema(),e=schema.useField(),{dn:s}=client.useDesignable(),{t:i}=useTranslation(),o=client.useCollectionManager().getCollectionField(n==null?void 0:n["x-collection-field"])||{},l=((a=n==null?void 0:n["x-component-props"])==null?void 0:a.picker)||((d=(c=o==null?void 0:o.uiSchema)==null?void 0:c["x-component-props"])==null?void 0:d.picker)||"";return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaSettingsModalItem,{title:i("Date picker type"),schema:{type:"object",properties:{picker:{type:"string",title:tval("Picker type"),"x-component":"Select","x-decorator":"FormItem","x-decorator-props":{},default:l,enum:[{label:i("default"),value:""},{label:i("year"),value:"year"},{label:i("quarter"),value:"quarter"},{label:i("month"),value:"month"},{label:i("week"),value:"week"}]}}},onSubmit:u=>{const f={"x-uid":n["x-uid"]};f["x-component-props"]=n["x-component-props"]||{},n["x-component-props"]=D(D({},n["x-component-props"]||{}),u),f["x-component-props"]=n["x-component-props"],e.componentProps=n["x-component-props"];const p=e.path.entire.split(".");p.pop();const m=p.join(".");e.query(`${m}.*[0:].${n.name}`).forEach(g=>{g.props.name===n.name&&g.setComponentProps(D({},u))}),s.emit("patch",{schema:f}),s.refresh()}})};SchemaSettingsDatePickerType.displayName="SchemaSettingsDatePickerType";const useCustomPresets1=()=>{const n=schema.useFieldSchema(),{t:e}=useTranslation(),s=getDateRanges(),i=[{label:e("This year"),value:s.thisYear},...Array(5).fill(0).map((r,o)=>({label:client$1.dayjs().year()-o-1+e("year"),value:s.year(client$1.dayjs().year()-o-1)})),{label:e("This month"),value:s.thisMonth},{label:e("Last month"),value:s.lastMonth}];return n.name==="presets"?"{{ useCustomPresets1() }}":i},useCustomPresets=n=>"{{ "+n+"() }}",SchemaSettingsDatePresets=()=>{var l,a,c;const n=schema.useFieldSchema(),{dn:e}=client.useDesignable(),{t:s}=useTranslation(),r=client.useCollectionManager().getCollectionField(n==null?void 0:n["x-collection-field"])||{},o=((l=n==null?void 0:n["x-component-props"])==null?void 0:l.presets)||((c=(a=r==null?void 0:r.uiSchema)==null?void 0:a["x-component-props"])==null?void 0:c.presets)||"";return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaSettingsModalItem,{title:s("Date presets"),schema:{type:"object",properties:{presets:{type:"string",title:tval("Date presets"),"x-component":"Select","x-decorator":"FormItem","x-decorator-props":{},default:o,enum:[{label:s("default"),value:""},{label:s("Chuangxing presets"),value:'{{ useCustomPresets("useCustomPresets1") }}'}]}}},onSubmit:d=>{d.presets||(d.presets=void 0);const u={"x-uid":n["x-uid"]};u["x-component-props"]=n["x-component-props"]||{},n["x-component-props"]=D(D({},n["x-component-props"]),d),u["x-component-props"]=n["x-component-props"],e.emit("patch",{schema:u}),e.refresh()}})};SchemaSettingsDatePresets.displayName="SchemaSettingsDatePresets";const getDateRanges=()=>({now:()=>client$1.dayjs().toISOString(),today:()=>[getStart(0,"day"),getEnd(0,"day")],yesterday:()=>[getStart(-1,"day"),getEnd(-1,"day")],tomorrow:()=>[getStart(1,"day"),getEnd(1,"day")],thisWeek:()=>[getStart(0,"isoWeek"),getEnd(0,"isoWeek")],lastWeek:()=>[getStart(-1,"isoWeek"),getEnd(-1,"isoWeek")],nextWeek:()=>[getStart(1,"isoWeek"),getEnd(1,"isoWeek")],year:n=>[getStart(n-client$1.dayjs().year(),"year"),getEnd(n-client$1.dayjs().year(),"year")],thisIsoWeek:()=>[getStart(0,"isoWeek"),getEnd(0,"isoWeek")],lastIsoWeek:()=>[getStart(-1,"isoWeek"),getEnd(-1,"isoWeek")],nextIsoWeek:()=>[getStart(1,"isoWeek"),getEnd(1,"isoWeek")],thisMonth:()=>[getStart(0,"month"),getEnd(0,"month")],lastMonth:()=>[getStart(-1,"month"),getEnd(-1,"month")],nextMonth:()=>[getStart(1,"month"),getEnd(1,"month")],thisQuarter:()=>[getStart(0,"quarter"),getEnd(0,"quarter")],lastQuarter:()=>[getStart(-1,"quarter"),getEnd(-1,"quarter")],nextQuarter:()=>[getStart(1,"quarter"),getEnd(1,"quarter")],thisYear:()=>[getStart(0,"year"),getEnd(0,"year")],lastYear:()=>[getStart(-1,"year"),getEnd(-1,"year")],nextYear:()=>[getStart(1,"year"),getEnd(1,"year")],last7Days:()=>[getStart(-6,"days"),getEnd(0,"days")],next7Days:()=>[getStart(1,"day"),getEnd(7,"days")],last30Days:()=>[getStart(-29,"days"),getEnd(0,"days")],next30Days:()=>[getStart(1,"day"),getEnd(30,"days")],last90Days:()=>[getStart(-89,"days"),getEnd(0,"days")],next90Days:()=>[getStart(1,"day"),getEnd(90,"days")]}),getStart=(n,e)=>client$1.dayjs().add(n,e==="isoWeek"?"week":e).startOf(e),getEnd=(n,e)=>client$1.dayjs().add(n,e==="isoWeek"?"week":e).endOf(e),SchemaSettingsSubmitDataType=()=>{var i;const{dn:n}=client.useDesignable(),{t:e}=useTranslation(),s=schema.useFieldSchema();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaSettingsSwitchItem,{title:e("Select submit data type"),checked:!!((i=s==null?void 0:s["x-action-settings"])!=null&&i.isDeltaChanged),onChange:r=>{s["x-action-settings"].isDeltaChanged=r,n.emit("patch",{schema:{"x-uid":s["x-uid"],"x-action-settings":D({},s["x-action-settings"])}})}})};SchemaSettingsSubmitDataType.displayName="SchemaSettingsSubmitDataType";const LinkManager=()=>{const[n,e]=React.useState(!1),[s,i]=React.useState({}),[r,o]=React.useState([]),{data:l,run:a}=client.useRequest({url:"/link-manage:get"}),{run:c}=client.useRequest({url:"/link-manage:set",params:{id:s.id,link:s.link}});React.useEffect(()=>{l&&o(l.data)},[l]);const d=m=>{i(m),e(!0)},u=()=>{e(!1)},f=()=>{c();const m=r.map(g=>g.id===s.id?s:g);o(m),e(!1),i({})},p=[{title:"名称",dataIndex:"name",key:"name",render:m=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx("a",{children:m})},{title:"链接",dataIndex:"link",key:"link",render:m=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx("a",{children:m})},{title:"Action",key:"action",render:(m,g)=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Space,{size:"middle",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx("a",{onClick:()=>d(g),children:"编辑"})})}];return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment,{children:[r&&__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Table,{columns:p,dataSource:r}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Drawer,{title:"设定链接地址",width:720,onClose:u,open:n,styles:{body:{paddingBottom:80}},extra:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs(antd.Space,{children:[__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Button,{onClick:u,children:"关闭"}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Button,{onClick:f,type:"primary",children:"提交"})]}),children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs(antd.Form,{layout:"vertical",children:[__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{name:"name",label:"Name",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Input,{placeholder:"Please enter Name",defaultValue:s==null?void 0:s.name,disabled:!0})}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{name:"link",label:"Link",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Input,{onChange:m=>i(I(D({},s),{link:m.target.value})),placeholder:"Please enter Link",defaultValue:s==null?void 0:s.link})})]})})]})},TokenConfigurationResourceKey="token-configuration",getSSKey=n=>`TACHYBASE_PLUGIN_TOKEN_CONFIGURATION_${n}`,useMapConfiguration=n=>{const e=React.useMemo(()=>{const i=sessionStorage.getItem(getSSKey(n));return i&&JSON.parse(i)},[n]),{data:s}=client.useRequest({resource:TokenConfigurationResourceKey,action:"get",params:{type:n}},{onSuccess(i){sessionStorage.setItem(getSSKey(n),JSON.stringify(i==null?void 0:i.data))},refreshOnWindowFocus:!1,refreshDeps:[],manual:!!e});return e||(s==null?void 0:s.data)},TokenTypes=[{label:"飞书",value:"feishu"}],BaseConfiguration=({type:n,children:e})=>{const[s,i]=ahooks.useBoolean(!1),r=client.useAPIClient(),[o]=antd.Form.useForm(),l=useMapConfiguration(n);React.useEffect(()=>{l&&(o.setFieldsValue(l),i.toggle())},[l]);const a=React.useMemo(()=>r.resource(TokenConfigurationResourceKey),[r]),c=d=>{a.set(I(D({},d),{type:n})).then(u=>{sessionStorage.removeItem(getSSKey(n)),i.toggle(),antd.message.success("保存成功")}).catch(u=>{antd.message.success("保存失败")})};return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs(antd.Form,{disabled:s,form:o,layout:"vertical",onFinish:c,children:[e,s?__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Button,{disabled:!1,onClick:i.toggle,children:"编辑"}):__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Button,{disabled:!1,type:"primary",htmlType:"submit",children:"保存"})})]})},AMapConfiguration=()=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs(BaseConfiguration,{type:"feishu",children:[__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{required:!0,name:"app_id",label:"App ID",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Input,{})}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{required:!0,name:"app_secret",label:"App Secret",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Input,{})}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{required:!0,name:"chat_id",label:"Chat ID",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Input,{})})]}),components={feishu:AMapConfiguration},tabList=TokenTypes.map(n=>I(D({},n),{component:components[n.value]})),Configuration=()=>{const n=reactRouterDom.useLocation(),e=new URLSearchParams(n.search);return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Card,{bordered:!0,children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Tabs,{type:"card",defaultActiveKey:e.get("tab"),children:tabList.map(s=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Tabs.TabPane,{tab:s.label,children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(s.component,{type:s.value})},s.value))})})};class PluginSettingsHelper{constructor(e){this.app=e}load(){return T(this,null,function*(){this.app.systemSettingsManager.add("system-services.hera",{title:tval("Hera integration"),icon:"HomeOutlined"}),this.app.systemSettingsManager.add("system-services.hera.token",{title:tval("Third-party integration configuration"),icon:"ShareAltOutlined",Component:Configuration,aclSnippet:"pm.system-services.hera.token"}),this.app.systemSettingsManager.add("system-services.hera.linkmanage",{title:tval("Link manager"),icon:"ShareAltOutlined",Component:LinkManager,aclSnippet:"pm.system-services.hera.linkmanage"})})}}class PluginCoreClient extends client.Plugin{afterAdd(){return T(this,null,function*(){yield this.app.pm.add(EmbedPlugin),yield this.app.pm.add(PluginHeraVersion),yield this.app.pm.add(PluginPDF),yield this.app.pm.add(PluginOutbound),yield this.app.pm.add(PluginFieldAppends),yield this.app.pm.add(PluginCustomComponents),yield this.app.pm.add(PluginSheet)})}registerSettings(){return T(this,null,function*(){this.schemaSettingsManager.add(customComponentDispatcherSettings),this.schemaSettingsManager.addItem("fieldSettings:component:DatePicker","datePickerType",{Component:SchemaSettingsDatePickerType}),this.schemaSettingsManager.addItem("fieldSettings:component:DatePicker","datePresets",{Component:SchemaSettingsDatePresets}),this.schemaSettingsManager.addItem("actionSettings:updateSubmit","submitDataType",{Component:SchemaSettingsSubmitDataType}),this.schemaSettingsManager.addItem("FormItemSettings","hera-divider",{type:"divider",useVisible(){const e=client.useFormulaTitleVisible(),s=usePaginationVisible();return e||s}}),this.schemaSettingsManager.addItem("FormItemSettings","isTablePageSize",{Component:IsTablePageSize,useVisible:usePaginationVisible})})}registerScopesAndComponents(){return T(this,null,function*(){this.app.addScopes({useGetCustomAssociatedComponents,useGetCustomComponents,useCustomPresets1,useCustomPresets}),this.app.addComponents({AssociatedField,CalcResult,CodeMirror:client$1.CodeMirror,CustomAssociatedField,CustomComponentDispatcher,CustomComponentStub,CustomField,EditTitle,Expression,SettingBlock:SettingBlockInitializer,SignatureInput,ExcelFile})})}registerRouters(){return T(this,null,function*(){})}registerSchemaInitializer(){return T(this,null,function*(){const e={name:"setting",title:tval("System setting"),Component:"SettingBlock"},s={type:"item",name:"refreshAction",title:tval("Refresh"),Component:"RefreshActionInitializer",schema:{"x-align":"right"}};this.app.schemaInitializerManager.addItem("page:addBlock",e.name,e),this.app.schemaInitializerManager.addItem("kanban:configureActions",s.name,s);const i={name:"addCustomComponent",title:tval("Add custom component"),Component:"BlockItemInitializer",schema:{type:"void","x-editable":!1,"x-decorator":"FormItem","x-settings":"customComponentDispatcherSettings","x-component":"CustomComponentDispatcher","x-component-props":{component:"CustomComponentStub"}}};this.app.schemaInitializerManager.addItem("form:configureFields",i.name,i),this.app.schemaInitializerManager.addItem("details:configureFields",i.name,i)})}registerInterfaces(){return T(this,null,function*(){this.app.dataSourceManager.addFieldInterfaces([AssociatedFieldInterface,CalcFieldInterface,CustomFieldInterface,CustomAssociatedFieldInterface,SignaturePadFieldInterface,ExcelFieldInterface,TstzrangeFieldInterface])})}afterLoad(){return T(this,null,function*(){yield this.registerSchemaInitializer()})}load(){return T(this,null,function*(){this.locale=new Locale(this.app),yield new PluginSettingsHelper(this.app).load(),yield this.registerScopesAndComponents(),yield this.registerSettings(),yield this.registerRouters(),yield this.registerInterfaces()})}}exports.CustomComponentType=CustomComponentType,exports.PluginCoreClient=PluginCoreClient,exports.default=PluginCoreClient,exports.usePDFViewerRef=usePDFViewerRef,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
82
|
+
`,children:c?__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(PDFViewer,{file:c,width:i,ref:l}):""})]})};class PluginPDF extends client.Plugin{load(){return T(this,null,function*(){this.app.addScopes({usePDFViewerPrintActionProps}),this.app.addComponents({PDFViewerBlockInitializer,PDFViewerPrintActionInitializer,PDFViewerProvider,PDFViwer:InternalPDFViewer}),this.schemaInitializerManager.add(pdfViewActionInitializer);const e={title:tval("preview block"),name:"previewBlock",type:"itemGroup",children:[]};this.app.schemaInitializerManager.get("popup:common:addBlock").add(e.name,e)})}}const SheetBlockContext=React.createContext({}),InternalSheetBlockProvider=n=>{const e=schema.useField(),s=client.useDataBlockRequest();return s.loading&&!e.loaded?__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Spin,{}):(e.loaded=!0,__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(SheetBlockContext.Provider,{value:{field:e,service:s},children:n.children}))},SheetBlock=()=>{const n=React.useRef();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs("div",{style:{height:"70vh"},children:[__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Button,{onClick:()=>console.log("data",n.current.getData()),children:"显示数据"}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(ExcelSheet,{ref:n})]})},SheetBlockProvider=n=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.DataBlockProvider,I(D({name:"sheet"},n),{children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(InternalSheetBlockProvider,D({},n))})),createSheetBlockSchema=n=>{const{collection:e}=n;return{title:e.title,type:"void","x-acl-action":`${e.name}:list`,"x-decorator":"SheetBlockProvider","x-decorator-props":{collection:e.name},"x-toolbar":"SheetBlockToolbar","x-settings":"sheetBlockSettings","x-component":"CardItem",properties:{[client$1.uid()]:{type:"void","x-component":"SheetBlock"}}}},SheetBlockInitializer=()=>{const{insert:n}=client.useSchemaInitializer(),e=client.useCollectionManager(),s=client.useSchemaInitializerItem();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.DataBlockInitializer,I(D({},s),{icon:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(icons.TableOutlined,{}),onCreateBlockSchema:r=>T(null,[r],function*({item:i}){const o=e.getCollection(i.name);n(createSheetBlockSchema({collection:o}))})}))},sheetBlockSettings=new client.SchemaSettings({name:"sheetBlockSettings",items:[{name:"remove",type:"remove"}]}),SheetBlockToolbar=n=>{const e=schema.useFieldSchema();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaToolbar,D({title:e.title,settings:e["x-settings"]},n))};class PluginSheet extends client.Plugin{load(){return T(this,null,function*(){this.app.addComponents({SheetBlock,SheetBlockInitializer,SheetBlockProvider,SheetBlockToolbar}),this.schemaSettingsManager.add(sheetBlockSettings),this.app.schemaInitializerManager.addItem("page:addBlock","dataBlocks.sheetBlock",{title:tval("Sheet"),Component:"SheetBlockInitializer"})})}}const useGetCustomAssociatedComponents=()=>useCustomComponent(CustomComponentType.CUSTOM_ASSOCIATED_FIELD),useGetCustomComponents=()=>useCustomComponent(CustomComponentType.CUSTOM_FIELD);class ExcelFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="excelField",this.type="json",this.group="advanced",this.order=3,this.title=tval("Excel table"),this.sortable=!0,this.default={interface:"json",type:"json",uiSchema:{type:"object","x-component":"ExcelFile"}},this.availableTypes=["json"],this.hasDefaultValue=!1,this.properties=D({},client.defaultProps)}}class AssociatedFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="associated",this.type="object",this.group="relation",this.order=10,this.title="关联字段",this.description="关联字段",this.isAssociation=!0,this.default={type:"belongsTo",uiSchema:{"x-component":"AssociatedField"}},this.availableTypes=["belongsTo"],this.properties=I(D({},client.defaultProps),{"uiSchema.x-component-props.collection":{type:"string",title:"关联数据表","x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!1},enum:"{{collections}}",required:!0},"uiSchema.x-component-props.sourceCollection":{type:"string",title:"查询数据表","x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!1},enum:"{{collections}}",required:!0},"uiSchema.x-component-props.sourceField":{type:"string",title:"查询数据表到关联数据表的路径","x-component":"Input","x-decorator":"FormItem",required:!0},"uiSchema.x-component-props.fieldExp":{type:"string",title:"关联字段",required:!0,"x-component":"Expression","x-decorator":"FormItem","x-component-props":{useCurrentFields:"{{ useCurrentFields }}"}},"uiSchema.x-component-props.dateFieldExp":{type:"string",title:"关联日期",required:!0,"x-component":"Expression","x-decorator":"FormItem","x-component-props":{useCurrentFields:"{{ useCurrentFields }}"}},target:{type:"string",title:"关联数据表","x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!1},enum:"{{collections}}",required:!0,"x-display":"hidden","x-reactions":[{dependencies:["uiSchema.x-component-props.collection"],fulfill:{state:{value:"{{$deps[0]}}"}}}]},targetKey:{type:"string",title:"关联数据表键",required:!0,default:"id","x-display":"hidden","x-decorator":"FormItem","x-component":"Input"}}),this.filterable={nested:!0,children:[]}}}const{defaultProps:defaultProps$1}=client.interfacesProperties,formulaType=[{dependencies:["dataType"],fulfill:{state:{display:'{{["formula"].includes($deps[0]) ? "visible" : "none"}}'}}}],panelType=[{dependencies:["dataType"],fulfill:{state:{display:'{{["jsCode"].includes($deps[0]) ? "visible" : "none"}}'}}}];class CalcFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="calc2",this.type="object",this.group="advanced",this.title="数据计算(过期)",this.description="数据字段计算",this.sortable=!0,this.default={type:"virtual",uiSchema:{type:"string","x-component":"CalcResult","x-component-props":{formula:"",prefix:"",suffix:"",decimal:"",panel:""},"x-read-pretty":!0}},this.properties=I(D({},defaultProps$1),{dataType:{type:"string",title:"计算类型","x-decorator":"FormItem","x-component":"Select",enum:[{value:"formula",label:"公式"},{value:"jsCode",label:"代码"}],required:!0,default:"formula",description:"公式:使用公式计算,代码:使用js代码计算"},"uiSchema.x-component-props.formula":{type:"string",title:"公式","x-decorator":"FormItem","x-component":"Input",default:"",required:!0,"x-reactions":formulaType},"uiSchema.x-component-props.panel":{type:"string",title:"jsCode","x-decorator":"FormItem","x-component":"Input.TextArea",description:"注意,此内容有值计算操作将以此内容为准,而不是公式,适用于面板中的计算",required:!0,"x-reactions":panelType},"uiSchema.x-component-props.prefix":{type:"string",title:"前缀","x-decorator":"FormItem","x-component":"Input"},"uiSchema.x-component-props.suffix":{type:"string",title:"后缀","x-decorator":"FormItem","x-component":"Input"},"uiSchema.x-component-props.decimal":{type:"string",title:'{{t("Precision")}}',"x-component":"Select","x-decorator":"FormItem",required:!0,default:"0",enum:[{value:"0",label:"1"},{value:"1",label:"1.0"},{value:"2",label:"1.00"},{value:"3",label:"1.000"},{value:"4",label:"1.0000"},{value:"5",label:"1.00000"}],"x-reactions":formulaType}})}}const{defaultProps}=client.interfacesProperties;class CustomFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="custom",this.type="object",this.group="advanced",this.title="组件字段",this.description="组件字段",this.sortable=!0,this.default={type:"virtual",uiSchema:{type:"string","x-component":"CustomField","x-read-pretty":!0}},this.properties=I(D({},defaultProps),{"uiSchema.x-component-props.component":{type:"string",title:"组件","x-decorator":"FormItem","x-component":"Select",enum:" {{ useGetCustomComponents() }} ",required:!0,description:"需要在插件中注册相应的组件后可以使用"}})}}class CustomAssociatedFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="customAssociated",this.type="object",this.group="relation",this.order=10,this.title="自定义关联字段",this.description="自定义关联字段",this.isAssociation=!0,this.default={type:"virtual",uiSchema:{"x-component":"CustomAssociatedField"}},this.availableTypes=["belongsTo"],this.properties=I(D({},client.defaultProps),{"uiSchema.x-component-props.component":{type:"string",title:"组件","x-decorator":"FormItem","x-component":"Select",enum:" {{ useGetCustomAssociatedComponents() }}",required:!0,description:"需要在插件中注册相应的组件后可以使用"},target:{type:"string",title:"关联数据表","x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!1},enum:"{{collections}}",required:!0},targetKey:{type:"string",title:"关联数据表键",required:!0,default:"id","x-display":"hidden","x-decorator":"FormItem","x-component":"Input"}}),this.filterable={nested:!0,children:[]}}}class SignaturePadFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="signatureSchema",this.type="object",this.group="advanced",this.order=2,this.title=tval("Signature input"),this.sortable=!0,this.default={interface:"signature",type:"json",uiSchema:{type:"signature","x-component":"SignatureInput"}},this.availableTypes=["json"],this.hasDefaultValue=!1,this.properties=D({},client.defaultProps)}}class TstzrangeFieldInterface extends client.CollectionFieldInterface{constructor(){super(...arguments),this.name="tstzrange",this.type="object",this.group="datetime",this.order=2,this.title=tval("Date range"),this.sortable=!0,this.default={type:"tstzrange",uiSchema:{type:"object","x-component":"DatePicker.RangePicker","x-component-props":{utc:!1,valueType:"range"}}},this.availableTypes=["tstzrange"],this.hasDefaultValue=!1,this.properties=D({},client.defaultProps)}}const SettingBlockInitializer=()=>{const{insert:n}=client.useSchemaInitializer(),{t:e}=useTranslation(),s=React.useContext(schema.SchemaOptionsContext),{theme:i}=client.useGlobalTheme(),r=client.useSchemaInitializerItem(),o=client.useCollectionManager(),l=client.useAPIClient();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.DataBlockInitializer,I(D({},r),{componentType:"FormItem",icon:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(icons.FormOutlined,{}),onCreateBlockSchema:c=>T(null,[c],function*({item:a}){const d=o.getCollection(a.name),u=d.titleField,f=yield client.FormDialog(e("Pick a data entry for viewing and editing"),()=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.APIClientProvider,{apiClient:l,children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaComponentOptions,{scope:s.scope,components:D({},s.components),children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client$1.FormLayout,{layout:"vertical",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaComponent,{schema:{properties:{id:{title:tval("Please select"),required:!0,"x-component":"RemoteSelect","x-component-props":{service:{resource:a.name},fieldNames:{label:u,value:"id"}},"x-decorator":"FormItem"}}}})})})}),i).open({initialValues:{}}),p=client.createFormBlockSchema({dataSource:a.dataSource,collection:d.name,action:"get",filterByTk:f.id,actionInitializers:"editForm:configureActions"});n(p)})}))},usePaginationVisible=()=>{var e;return((e=schema.useFieldSchema()["x-component-props"])==null?void 0:e.mode)==="SubTable"},EditTitle=()=>{var a;const{getCollectionJoinField:n}=client.useCollectionManager_deprecated(),{getField:e}=client.useCollection_deprecated(),s=schema.useField(),i=schema.useFieldSchema(),{t:r}=useTranslation(),{dn:o}=client.useDesignable(),l=e(i.name)||n(i["x-collection-field"]);return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaSettingsModalItem,{title:r("Edit field title"),schema:{type:"object",title:r("Edit field title"),properties:{title:{title:r("Field title"),default:s==null?void 0:s.title,description:`${r("Original field title: ")}${l?(a=l==null?void 0:l.uiSchema)==null?void 0:a.title:i.name}`,"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:({title:c})=>{c&&(s.title=c,i.title=c,o.emit("patch",{schema:{"x-uid":i["x-uid"],title:i.title}})),o.refresh()}},"edit-field-title")},IsTablePageSize=()=>{const{dn:n}=client.useDesignable(),e=schema.useFieldSchema(),{t:s}=useTranslation();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaSettingsSwitchItem,{title:s("Pagination"),checked:e["x-component-props"].pagination,onChange:i=>{e["x-component-props"].pagination||(e["x-component-props"]=I(D({},e["x-component-props"]),{pagination:!1})),e["x-component-props"].pagination=i,n.emit("patch",{schema:{"x-uid":e["x-uid"],"x-component-props":D({},e==null?void 0:e["x-component-props"])}}),n.refresh()}})},SchemaSettingsDatePickerType=()=>{var a,c,d;const n=schema.useFieldSchema(),e=schema.useField(),{dn:s}=client.useDesignable(),{t:i}=useTranslation(),o=client.useCollectionManager().getCollectionField(n==null?void 0:n["x-collection-field"])||{},l=((a=n==null?void 0:n["x-component-props"])==null?void 0:a.picker)||((d=(c=o==null?void 0:o.uiSchema)==null?void 0:c["x-component-props"])==null?void 0:d.picker)||"";return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaSettingsModalItem,{title:i("Date picker type"),schema:{type:"object",properties:{picker:{type:"string",title:tval("Picker type"),"x-component":"Select","x-decorator":"FormItem","x-decorator-props":{},default:l,enum:[{label:i("default"),value:""},{label:i("year"),value:"year"},{label:i("quarter"),value:"quarter"},{label:i("month"),value:"month"},{label:i("week"),value:"week"}]}}},onSubmit:u=>{const f={"x-uid":n["x-uid"]};f["x-component-props"]=n["x-component-props"]||{},n["x-component-props"]=D(D({},n["x-component-props"]||{}),u),f["x-component-props"]=n["x-component-props"],e.componentProps=n["x-component-props"];const p=e.path.entire.split(".");p.pop();const m=p.join(".");e.query(`${m}.*[0:].${n.name}`).forEach(g=>{g.props.name===n.name&&g.setComponentProps(D({},u))}),s.emit("patch",{schema:f}),s.refresh()}})};SchemaSettingsDatePickerType.displayName="SchemaSettingsDatePickerType";const useCustomPresets1=()=>{const n=schema.useFieldSchema(),{t:e}=useTranslation(),s=getDateRanges(),i=[{label:e("This year"),value:s.thisYear},...Array(5).fill(0).map((r,o)=>({label:dayjs().year()-o-1+e("year"),value:s.year(dayjs().year()-o-1)})),{label:e("This month"),value:s.thisMonth},{label:e("Last month"),value:s.lastMonth}];return n.name==="presets"?"{{ useCustomPresets1() }}":i},useCustomPresets=n=>"{{ "+n+"() }}",SchemaSettingsDatePresets=()=>{var l,a,c;const n=schema.useFieldSchema(),{dn:e}=client.useDesignable(),{t:s}=useTranslation(),r=client.useCollectionManager().getCollectionField(n==null?void 0:n["x-collection-field"])||{},o=((l=n==null?void 0:n["x-component-props"])==null?void 0:l.presets)||((c=(a=r==null?void 0:r.uiSchema)==null?void 0:a["x-component-props"])==null?void 0:c.presets)||"";return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaSettingsModalItem,{title:s("Date presets"),schema:{type:"object",properties:{presets:{type:"string",title:tval("Date presets"),"x-component":"Select","x-decorator":"FormItem","x-decorator-props":{},default:o,enum:[{label:s("default"),value:""},{label:s("Chuangxing presets"),value:'{{ useCustomPresets("useCustomPresets1") }}'}]}}},onSubmit:d=>{d.presets||(d.presets=void 0);const u={"x-uid":n["x-uid"]};u["x-component-props"]=n["x-component-props"]||{},n["x-component-props"]=D(D({},n["x-component-props"]),d),u["x-component-props"]=n["x-component-props"],e.emit("patch",{schema:u}),e.refresh()}})};SchemaSettingsDatePresets.displayName="SchemaSettingsDatePresets";const getDateRanges=()=>({now:()=>dayjs().toISOString(),today:()=>[getStart(0,"day"),getEnd(0,"day")],yesterday:()=>[getStart(-1,"day"),getEnd(-1,"day")],tomorrow:()=>[getStart(1,"day"),getEnd(1,"day")],thisWeek:()=>[getStart(0,"isoWeek"),getEnd(0,"isoWeek")],lastWeek:()=>[getStart(-1,"isoWeek"),getEnd(-1,"isoWeek")],nextWeek:()=>[getStart(1,"isoWeek"),getEnd(1,"isoWeek")],year:n=>[getStart(n-dayjs().year(),"year"),getEnd(n-dayjs().year(),"year")],thisIsoWeek:()=>[getStart(0,"isoWeek"),getEnd(0,"isoWeek")],lastIsoWeek:()=>[getStart(-1,"isoWeek"),getEnd(-1,"isoWeek")],nextIsoWeek:()=>[getStart(1,"isoWeek"),getEnd(1,"isoWeek")],thisMonth:()=>[getStart(0,"month"),getEnd(0,"month")],lastMonth:()=>[getStart(-1,"month"),getEnd(-1,"month")],nextMonth:()=>[getStart(1,"month"),getEnd(1,"month")],thisQuarter:()=>[getStart(0,"quarter"),getEnd(0,"quarter")],lastQuarter:()=>[getStart(-1,"quarter"),getEnd(-1,"quarter")],nextQuarter:()=>[getStart(1,"quarter"),getEnd(1,"quarter")],thisYear:()=>[getStart(0,"year"),getEnd(0,"year")],lastYear:()=>[getStart(-1,"year"),getEnd(-1,"year")],nextYear:()=>[getStart(1,"year"),getEnd(1,"year")],last7Days:()=>[getStart(-6,"days"),getEnd(0,"days")],next7Days:()=>[getStart(1,"day"),getEnd(7,"days")],last30Days:()=>[getStart(-29,"days"),getEnd(0,"days")],next30Days:()=>[getStart(1,"day"),getEnd(30,"days")],last90Days:()=>[getStart(-89,"days"),getEnd(0,"days")],next90Days:()=>[getStart(1,"day"),getEnd(90,"days")]}),getStart=(n,e)=>dayjs().add(n,e==="isoWeek"?"week":e).startOf(e),getEnd=(n,e)=>dayjs().add(n,e==="isoWeek"?"week":e).endOf(e),SchemaSettingsSubmitDataType=()=>{var i;const{dn:n}=client.useDesignable(),{t:e}=useTranslation(),s=schema.useFieldSchema();return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(client.SchemaSettingsSwitchItem,{title:e("Select submit data type"),checked:!!((i=s==null?void 0:s["x-action-settings"])!=null&&i.isDeltaChanged),onChange:r=>{s["x-action-settings"].isDeltaChanged=r,n.emit("patch",{schema:{"x-uid":s["x-uid"],"x-action-settings":D({},s["x-action-settings"])}})}})};SchemaSettingsSubmitDataType.displayName="SchemaSettingsSubmitDataType";const LinkManager=()=>{const[n,e]=React.useState(!1),[s,i]=React.useState({}),[r,o]=React.useState([]),{data:l,run:a}=client.useRequest({url:"/link-manage:get"}),{run:c}=client.useRequest({url:"/link-manage:set",params:{id:s.id,link:s.link}});React.useEffect(()=>{l&&o(l.data)},[l]);const d=m=>{i(m),e(!0)},u=()=>{e(!1)},f=()=>{c();const m=r.map(g=>g.id===s.id?s:g);o(m),e(!1),i({})},p=[{title:"名称",dataIndex:"name",key:"name",render:m=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx("a",{children:m})},{title:"链接",dataIndex:"link",key:"link",render:m=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx("a",{children:m})},{title:"Action",key:"action",render:(m,g)=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Space,{size:"middle",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx("a",{onClick:()=>d(g),children:"编辑"})})}];return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment,{children:[r&&__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Table,{columns:p,dataSource:r}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Drawer,{title:"设定链接地址",width:720,onClose:u,open:n,styles:{body:{paddingBottom:80}},extra:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs(antd.Space,{children:[__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Button,{onClick:u,children:"关闭"}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Button,{onClick:f,type:"primary",children:"提交"})]}),children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs(antd.Form,{layout:"vertical",children:[__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{name:"name",label:"Name",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Input,{placeholder:"Please enter Name",defaultValue:s==null?void 0:s.name,disabled:!0})}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{name:"link",label:"Link",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Input,{onChange:m=>i(I(D({},s),{link:m.target.value})),placeholder:"Please enter Link",defaultValue:s==null?void 0:s.link})})]})})]})},TokenConfigurationResourceKey="token-configuration",getSSKey=n=>`TACHYBASE_PLUGIN_TOKEN_CONFIGURATION_${n}`,useMapConfiguration=n=>{const e=React.useMemo(()=>{const i=sessionStorage.getItem(getSSKey(n));return i&&JSON.parse(i)},[n]),{data:s}=client.useRequest({resource:TokenConfigurationResourceKey,action:"get",params:{type:n}},{onSuccess(i){sessionStorage.setItem(getSSKey(n),JSON.stringify(i==null?void 0:i.data))},refreshOnWindowFocus:!1,refreshDeps:[],manual:!!e});return e||(s==null?void 0:s.data)},TokenTypes=[{label:"飞书",value:"feishu"}],BaseConfiguration=({type:n,children:e})=>{const[s,i]=ahooks.useBoolean(!1),r=client.useAPIClient(),[o]=antd.Form.useForm(),l=useMapConfiguration(n);React.useEffect(()=>{l&&(o.setFieldsValue(l),i.toggle())},[l]);const a=React.useMemo(()=>r.resource(TokenConfigurationResourceKey),[r]),c=d=>{a.set(I(D({},d),{type:n})).then(u=>{sessionStorage.removeItem(getSSKey(n)),i.toggle(),antd.message.success("保存成功")}).catch(u=>{antd.message.success("保存失败")})};return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs(antd.Form,{disabled:s,form:o,layout:"vertical",onFinish:c,children:[e,s?__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Button,{disabled:!1,onClick:i.toggle,children:"编辑"}):__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Button,{disabled:!1,type:"primary",htmlType:"submit",children:"保存"})})]})},AMapConfiguration=()=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs(BaseConfiguration,{type:"feishu",children:[__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{required:!0,name:"app_id",label:"App ID",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Input,{})}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{required:!0,name:"app_secret",label:"App Secret",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Input,{})}),__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Form.Item,{required:!0,name:"chat_id",label:"Chat ID",children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Input,{})})]}),components={feishu:AMapConfiguration},tabList=TokenTypes.map(n=>I(D({},n),{component:components[n.value]})),Configuration=()=>{const n=reactRouterDom.useLocation(),e=new URLSearchParams(n.search);return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Card,{bordered:!0,children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Tabs,{type:"card",defaultActiveKey:e.get("tab"),children:tabList.map(s=>__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(antd.Tabs.TabPane,{tab:s.label,children:__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx(s.component,{type:s.value})},s.value))})})};class PluginSettingsHelper{constructor(e){this.app=e}load(){return T(this,null,function*(){this.app.systemSettingsManager.add("system-services.hera",{title:tval("Hera integration"),icon:"HomeOutlined"}),this.app.systemSettingsManager.add("system-services.hera.token",{title:tval("Third-party integration configuration"),icon:"ShareAltOutlined",Component:Configuration,aclSnippet:"pm.system-services.hera.token"}),this.app.systemSettingsManager.add("system-services.hera.linkmanage",{title:tval("Link manager"),icon:"ShareAltOutlined",Component:LinkManager,aclSnippet:"pm.system-services.hera.linkmanage"})})}}class PluginCoreClient extends client.Plugin{afterAdd(){return T(this,null,function*(){yield this.app.pm.add(EmbedPlugin),yield this.app.pm.add(PluginHeraVersion),yield this.app.pm.add(PluginPDF),yield this.app.pm.add(PluginOutbound),yield this.app.pm.add(PluginFieldAppends),yield this.app.pm.add(PluginCustomComponents),yield this.app.pm.add(PluginSheet)})}registerSettings(){return T(this,null,function*(){this.schemaSettingsManager.add(customComponentDispatcherSettings),this.schemaSettingsManager.addItem("fieldSettings:component:DatePicker","datePickerType",{Component:SchemaSettingsDatePickerType}),this.schemaSettingsManager.addItem("fieldSettings:component:DatePicker","datePresets",{Component:SchemaSettingsDatePresets}),this.schemaSettingsManager.addItem("actionSettings:updateSubmit","submitDataType",{Component:SchemaSettingsSubmitDataType}),this.schemaSettingsManager.addItem("FormItemSettings","hera-divider",{type:"divider",useVisible(){const e=client.useFormulaTitleVisible(),s=usePaginationVisible();return e||s}}),this.schemaSettingsManager.addItem("FormItemSettings","isTablePageSize",{Component:IsTablePageSize,useVisible:usePaginationVisible})})}registerScopesAndComponents(){return T(this,null,function*(){this.app.addScopes({useGetCustomAssociatedComponents,useGetCustomComponents,useCustomPresets1,useCustomPresets}),this.app.addComponents({AssociatedField,CalcResult,CodeMirror:client$1.CodeMirror,CustomAssociatedField,CustomComponentDispatcher,CustomComponentStub,CustomField,EditTitle,Expression,SettingBlock:SettingBlockInitializer,SignatureInput,ExcelFile})})}registerRouters(){return T(this,null,function*(){})}registerSchemaInitializer(){return T(this,null,function*(){const e={name:"setting",title:tval("System setting"),Component:"SettingBlock"},s={type:"item",name:"refreshAction",title:tval("Refresh"),Component:"RefreshActionInitializer",schema:{"x-align":"right"}};this.app.schemaInitializerManager.addItem("page:addBlock",e.name,e),this.app.schemaInitializerManager.addItem("kanban:configureActions",s.name,s);const i={name:"addCustomComponent",title:tval("Add custom component"),Component:"BlockItemInitializer",schema:{type:"void","x-editable":!1,"x-decorator":"FormItem","x-settings":"customComponentDispatcherSettings","x-component":"CustomComponentDispatcher","x-component-props":{component:"CustomComponentStub"}}};this.app.schemaInitializerManager.addItem("form:configureFields",i.name,i),this.app.schemaInitializerManager.addItem("details:configureFields",i.name,i)})}registerInterfaces(){return T(this,null,function*(){this.app.dataSourceManager.addFieldInterfaces([AssociatedFieldInterface,CalcFieldInterface,CustomFieldInterface,CustomAssociatedFieldInterface,SignaturePadFieldInterface,ExcelFieldInterface,TstzrangeFieldInterface])})}afterLoad(){return T(this,null,function*(){yield this.registerSchemaInitializer()})}load(){return T(this,null,function*(){this.locale=new Locale(this.app),yield new PluginSettingsHelper(this.app).load(),yield this.registerScopesAndComponents(),yield this.registerSettings(),yield this.registerRouters(),yield this.registerInterfaces()})}}exports.CustomComponentType=CustomComponentType,exports.PluginCoreClient=PluginCoreClient,exports.default=PluginCoreClient,exports.usePDFViewerRef=usePDFViewerRef,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@tachybase/client": "1.3.
|
|
3
|
-
"@tego/client": "1.3.
|
|
4
|
-
"@tego/server": "1.3.
|
|
2
|
+
"@tachybase/client": "1.3.23",
|
|
3
|
+
"@tego/client": "1.3.43",
|
|
4
|
+
"@tego/server": "1.3.43",
|
|
5
5
|
"react": "18.3.1",
|
|
6
|
-
"@tachybase/schema": "1.3.
|
|
6
|
+
"@tachybase/schema": "1.3.43",
|
|
7
7
|
"@ant-design/icons": "5.6.1",
|
|
8
8
|
"antd": "5.22.5",
|
|
9
9
|
"lodash": "4.17.21",
|
|
10
|
+
"dayjs": "1.11.13",
|
|
10
11
|
"ahooks": "3.9.0",
|
|
11
12
|
"react-router-dom": "6.28.1",
|
|
12
13
|
"axios": "1.7.7",
|
|
13
|
-
"react-dom": "18.3.1"
|
|
14
|
-
"dayjs": "1.11.13"
|
|
14
|
+
"react-dom": "18.3.1"
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"fs-extra","version":"11.3.0","description":"fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.","engines":{"node":">=14.14"},"homepage":"https://github.com/jprichardson/node-fs-extra","repository":{"type":"git","url":"https://github.com/jprichardson/node-fs-extra"},"keywords":["fs","file","file system","copy","directory","extra","mkdirp","mkdir","mkdirs","recursive","json","read","write","extra","delete","remove","touch","create","text","output","move","promise"],"author":"JP Richardson <jprichardson@gmail.com>","license":"MIT","dependencies":{"graceful-fs":"^4.2.0","jsonfile":"^6.0.1","universalify":"^2.0.0"},"devDependencies":{"klaw":"^2.1.1","klaw-sync":"^3.0.2","minimist":"^1.1.1","mocha":"^10.1.0","nyc":"^15.0.0","proxyquire":"^2.0.1","read-dir-files":"^0.1.1","standard":"^17.0.0"},"main":"./lib/index.js","exports":{".":"./lib/index.js","./esm":"./lib/esm.mjs"},"files":["lib/","!lib/**/__tests__/"],"scripts":{"lint":"standard","test-find":"find ./lib/**/__tests__ -name *.test.js | xargs mocha","test":"npm run lint && npm run unit && npm run unit-esm","unit":"nyc node test.js","unit-esm":"node test.mjs"},"sideEffects":false,"_lastModified":"2025-
|
|
1
|
+
{"name":"fs-extra","version":"11.3.0","description":"fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.","engines":{"node":">=14.14"},"homepage":"https://github.com/jprichardson/node-fs-extra","repository":{"type":"git","url":"https://github.com/jprichardson/node-fs-extra"},"keywords":["fs","file","file system","copy","directory","extra","mkdirp","mkdir","mkdirs","recursive","json","read","write","extra","delete","remove","touch","create","text","output","move","promise"],"author":"JP Richardson <jprichardson@gmail.com>","license":"MIT","dependencies":{"graceful-fs":"^4.2.0","jsonfile":"^6.0.1","universalify":"^2.0.0"},"devDependencies":{"klaw":"^2.1.1","klaw-sync":"^3.0.2","minimist":"^1.1.1","mocha":"^10.1.0","nyc":"^15.0.0","proxyquire":"^2.0.1","read-dir-files":"^0.1.1","standard":"^17.0.0"},"main":"./lib/index.js","exports":{".":"./lib/index.js","./esm":"./lib/esm.mjs"},"files":["lib/","!lib/**/__tests__/"],"scripts":{"lint":"standard","test-find":"find ./lib/**/__tests__ -name *.test.js | xargs mocha","test":"npm run lint && npm run unit && npm run unit-esm","unit":"nyc node test.js","unit-esm":"node test.mjs"},"sideEffects":false,"_lastModified":"2025-08-02T21:30:52.717Z"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/module-hera",
|
|
3
3
|
"displayName": "Hera platform - Deprecated",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.23",
|
|
5
5
|
"description": "Hera platform - Deprecated",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"System management"
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"main": "dist/server/index.js",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@ant-design/icons": "^5.6.1",
|
|
12
|
-
"@tachybase/schema": "^1.3.
|
|
12
|
+
"@tachybase/schema": "^1.3.43",
|
|
13
13
|
"@tachybase/sheet": "1.0.0-alpha.5",
|
|
14
|
-
"@tachybase/test": "^1.3.
|
|
15
|
-
"@tego/client": "^1.3.
|
|
16
|
-
"@tego/server": "^1.3.
|
|
14
|
+
"@tachybase/test": "^1.3.43",
|
|
15
|
+
"@tego/client": "^1.3.43",
|
|
16
|
+
"@tego/server": "^1.3.43",
|
|
17
17
|
"@types/lodash": "^4.17.20",
|
|
18
18
|
"ahooks": "^3.9.0",
|
|
19
19
|
"antd": "5.22.5",
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
"fs-extra": "^11.3.0",
|
|
25
25
|
"lodash": "4.17.21",
|
|
26
26
|
"react": "18.3.1",
|
|
27
|
-
"react-error-boundary": "^
|
|
27
|
+
"react-error-boundary": "^6.0.0",
|
|
28
28
|
"react-router-dom": "6.28.1",
|
|
29
29
|
"redis": "^4.7.0",
|
|
30
30
|
"signature_pad": "4.2.0",
|
|
31
31
|
"throttle-debounce": "^5.0.2",
|
|
32
32
|
"vitest": "^3.2.4",
|
|
33
|
-
"ws": "^8.18.
|
|
34
|
-
"@tachybase/
|
|
35
|
-
"@tachybase/module-
|
|
36
|
-
"@tachybase/
|
|
33
|
+
"ws": "^8.18.3",
|
|
34
|
+
"@tachybase/client": "1.3.23",
|
|
35
|
+
"@tachybase/module-acl": "1.3.23",
|
|
36
|
+
"@tachybase/module-workflow": "1.3.23"
|
|
37
37
|
},
|
|
38
38
|
"description.zh-CN": "赫拉平台(已废弃)",
|
|
39
39
|
"displayName.zh-CN": "赫拉平台",
|