@txgw/payout-components 1.0.0 → 1.0.2
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/{AMIS-D9TLFIT7.js → AMIS-BpATHKnv.js} +1 -1
- package/dist/Action-B0KUcn27.js +1 -0
- package/dist/{Action-D_mwIN-5.js → Action-CzJ_r33l.js} +1 -1
- package/dist/{Alert-UVAjNb7s.js → Alert-DwWdKr12.js} +1 -1
- package/dist/{AnchorNav-BjgLgX6m.js → AnchorNav-DRGjEF5J.js} +1 -1
- package/dist/{App-ncbuqXE2.js → App-DxKgyXV1.js} +1 -1
- package/dist/{Audio-B3lYr3U2.js → Audio-BoaWMJHA.js} +1 -1
- package/dist/{Avatar-XqOgD9ui.js → Avatar-B2lZKPPh.js} +1 -1
- package/dist/{BarCode-Cg3O5s_0.js → BarCode-BnchzdIg.js} +1 -1
- package/dist/{BarCode-B_ISp_TQ.js → BarCode-dEGhm4u6.js} +1 -1
- package/dist/{Breadcrumb-CTA88DWN.js → Breadcrumb-BHzIF2Vg.js} +1 -1
- package/dist/ButtonGroup-BMvNPoKc.js +1 -0
- package/dist/ButtonGroupSelect-BmQIuhWU.js +1 -0
- package/dist/{ButtonGroupSelect-C_qcxdHQ.js → ButtonGroupSelect-CfNu0OBj.js} +1 -1
- package/dist/{ButtonToolbar-CUNT7FK4.js → ButtonToolbar-CYZ0LWsz.js} +1 -1
- package/dist/{CRUD-DRudIc-q.js → CRUD-BDeg8xZI.js} +1 -1
- package/dist/{CRUD2-CYGF0EMp.js → CRUD2-DrE-2JU3.js} +1 -1
- package/dist/{Calendar-BW4diX9T.js → Calendar-DkEUJJQW.js} +1 -1
- package/dist/Card-BVUWwkgm.js +1 -0
- package/dist/{Card-C4m8b89W.js → Card-IZbcizfw.js} +1 -1
- package/dist/{Card2-BXG0mDni.js → Card2-Dyl0FIVL.js} +1 -1
- package/dist/{Cards-ak9W7Ggn.js → Cards-DlMpwNSr.js} +1 -1
- package/dist/{Carousel-CxCXr052.js → Carousel-CXMYZL8H.js} +1 -1
- package/dist/{ChainedSelect-BcWT4XqI.js → ChainedSelect-BQK0j-pA.js} +1 -1
- package/dist/{Chart-BxLGXl9u.js → Chart-uJ8v1OSG.js} +1 -1
- package/dist/{ChartRadios-DstdFZq_.js → ChartRadios-C9Ov2SCd.js} +1 -1
- package/dist/Checkbox-DAq7LXTe.js +1 -0
- package/dist/{Checkbox-C4MOpWIk.js → Checkbox-DbHhD7iK.js} +1 -1
- package/dist/{Checkboxes-DaAz8fEe.js → Checkboxes-wud_gmq3.js} +1 -1
- package/dist/{Code-C7wxKt-Z.js → Code-VjDT2QOS.js} +1 -1
- package/dist/Collapse-CRIu-D5O.js +1 -0
- package/dist/{Collapse-B7DWMzHM.js → Collapse-CknZKNKz.js} +1 -1
- package/dist/{CollapseGroup-C5HPq_8j.js → CollapseGroup-DkMS5MXZ.js} +1 -1
- package/dist/{Color-BpoN5ndM.js → Color-CZV84qNC.js} +1 -1
- package/dist/{ColorPicker-B-eyCI0N.js → ColorPicker-R5D1ZNwb.js} +1 -1
- package/dist/{ColumnToggler-BCOanQf7.js → ColumnToggler-BxHry8EL.js} +1 -1
- package/dist/{ColumnToggler-BNmJdTb9.js → ColumnToggler-D98cb4XS.js} +1 -1
- package/dist/{Combo-DVBtMl-s.js → Combo-BUD7tb8b.js} +1 -1
- package/dist/{ConditionBuilder-bQtsEBIu.js → ConditionBuilder-DFF8QBcW.js} +1 -1
- package/dist/{Container-BCEndXiL.js → Container-f-JHe2WE.js} +1 -1
- package/dist/{Control-DBSbZmLZ.js → Control-dOQnC26j.js} +1 -1
- package/dist/{Custom-CVj3O57n.js → Custom-CqKL8xv_.js} +1 -1
- package/dist/{Date-CuBE2XD8.js → Date-BcRD4sv_.js} +1 -1
- package/dist/{DateRange-Bd9o9Fl_.js → DateRange-BkGu5vJl.js} +1 -1
- package/dist/{Dialog-DzlFCRtq.js → Dialog-CQSNeqgY.js} +1 -1
- package/dist/{DiffEditor-Cccg35Ly.js → DiffEditor-DU9deT5c.js} +1 -1
- package/dist/{Divider-gy0IUviz.js → Divider-CYwXWwc5.js} +1 -1
- package/dist/{Drawer-C37JbURK.js → Drawer-DmUqxMKd.js} +1 -1
- package/dist/{DropDownButton-DO4hK0Kp.js → DropDownButton-C0e2mksC.js} +1 -1
- package/dist/{Each-BfbwJEMb.js → Each-Bnhdfx44.js} +1 -1
- package/dist/FieldSet-BRfWbiPG.js +1 -0
- package/dist/{FieldSet-D3WMli0B.js → FieldSet-f-m_bp4h.js} +1 -1
- package/dist/{Flex-CXooKsRI.js → Flex-C0c49ZMP.js} +1 -1
- package/dist/{Formula-KUisLb0j.js → Formula-C82aVdAD.js} +1 -1
- package/dist/{Grid2D-6cCqZG6j.js → Grid2D-BJPrAz8w.js} +1 -1
- package/dist/{GridNav-Bvueqq-Q.js → GridNav-DCCBgvz1.js} +1 -1
- package/dist/{Group-EswEogaf.js → Group-D_2Fn4zB.js} +1 -1
- package/dist/{HBox-DyS1JJHh.js → HBox-CG3Ad5us.js} +1 -1
- package/dist/HBox-CRrACS8I.js +1 -0
- package/dist/{Hidden-DwrGEKjM.js → Hidden-SaNCTMlZ.js} +1 -1
- package/dist/{IFrame-BT4_03AI.js → IFrame-2LIicqpq.js} +1 -1
- package/dist/{Icon-BNP1oNtQ.js → Icon-3_vNko-P.js} +1 -1
- package/dist/{IconPicker-CIL2Wob5.js → IconPicker-DAMClR_z.js} +1 -1
- package/dist/{IconSelect-D1CPpZAU.js → IconSelect-CHM0oHqd.js} +1 -1
- package/dist/{IconSelectStore-BM_zyU2d.js → IconSelectStore-MNwivoh-.js} +1 -1
- package/dist/Image-Br7JbiAF.js +1 -0
- package/dist/{Image--xtRdgd5.js → Image-hHgZkb5C.js} +1 -1
- package/dist/{Images-zPCUHCyK.js → Images-ZGJfaN-q.js} +1 -1
- package/dist/{InputArray-BnERrQT7.js → InputArray-D3y772RO.js} +1 -1
- package/dist/{InputCity-Bidd_z8i.js → InputCity-CF6mEwuH.js} +1 -1
- package/dist/{InputColor-D0Kf9p1Q.js → InputColor-CYmzXu5I.js} +1 -1
- package/dist/{InputDate-CzCxGUx_.js → InputDate-BldJd84x.js} +1 -1
- package/dist/{InputDateRange-Bp3owFpS.js → InputDateRange-KzSlI2fv.js} +1 -1
- package/dist/{InputExcel-DUdIptAN.js → InputExcel-CJZWvZFT.js} +1 -1
- package/dist/{InputFile-DquJWe_S.js → InputFile-C0FUNeFM.js} +1 -1
- package/dist/InputFile-DFjvYmV3.js +1 -0
- package/dist/{InputFormula-Cu3Oc5xq.js → InputFormula-BKxq41uR.js} +1 -1
- package/dist/{InputGroup-RqgoJFcl.js → InputGroup-wvaymJ-V.js} +1 -1
- package/dist/InputImage-CLuXGhoy.js +1 -0
- package/dist/{InputImage-CdVzSsuR.js → InputImage-DasZBpb-.js} +1 -1
- package/dist/{InputMonthRange-BTR1bISz.js → InputMonthRange-DVRnBZ4I.js} +1 -1
- package/dist/{InputNumber-C0rip8fu.js → InputNumber-BjzsM73z.js} +1 -1
- package/dist/{InputQuarterRange-D1X-Z2tN.js → InputQuarterRange-DQuiFCOb.js} +1 -1
- package/dist/{InputRange-Dq-ePI8S.js → InputRange-C97bKrW6.js} +1 -1
- package/dist/{InputRating-_KtpPZno.js → InputRating-CpFNTZKA.js} +1 -1
- package/dist/{InputRepeat-D3Drjx3I.js → InputRepeat-CN2KxX7g.js} +1 -1
- package/dist/InputRichText-BXjRSQFh.js +1 -0
- package/dist/{InputRichText-CyfWV74o.js → InputRichText-DdyJFH82.js} +1 -1
- package/dist/{InputSignature-CXV7thvH.js → InputSignature-CsxuK757.js} +1 -1
- package/dist/{InputSubForm-CQuaHTe3.js → InputSubForm-Ddweo6dR.js} +1 -1
- package/dist/{InputTable-CJ4Dl3xA.js → InputTable-Bt8U_tyA.js} +1 -1
- package/dist/{InputTag-BAjQnJh1.js → InputTag-kg2v747D.js} +1 -1
- package/dist/{InputText-Ci8XzpKK.js → InputText-bKR0VgA6.js} +1 -1
- package/dist/{InputTree-Coq2YfRD.js → InputTree-DbdS4b2m.js} +1 -1
- package/dist/{InputVerificationCode-CZbzrwa_.js → InputVerificationCode-DcFJRWeR.js} +1 -1
- package/dist/{InputYearRange-CbdR1nuY.js → InputYearRange-ChXlMgCi.js} +1 -1
- package/dist/{JSONSchema-Z9eJulgD.js → JSONSchema-C_VjFVVN.js} +1 -1
- package/dist/{JSONSchemaEditor-qtbO2bWX.js → JSONSchemaEditor-CEgywCvJ.js} +1 -1
- package/dist/{Json-I_TX2D01.js → Json-DqjhkjHF.js} +1 -1
- package/dist/{Link-DoCudSpW.js → Link-9hUnE5FW.js} +1 -1
- package/dist/{List-BItkFb-A.js → List-BBntusL0.js} +1 -1
- package/dist/List-C8nPjG1-.js +1 -0
- package/dist/{ListSelect-f6rDx6N2.js → ListSelect-lX84FGAP.js} +1 -1
- package/dist/{LocationPicker-CZd07tME.js → LocationPicker-DnA8QpYh.js} +1 -1
- package/dist/{Log--rbcIY4g.js → Log-CRxPlj86.js} +1 -1
- package/dist/{Mapping-rpBDdw-o.js → Mapping-X2IRbppi.js} +1 -1
- package/dist/{Markdown-M8qWm8IY.js → Markdown-ByuMaB2P.js} +1 -1
- package/dist/{MatrixCheckboxes-DCnC8NGQ.js → MatrixCheckboxes-BvBU1E-4.js} +1 -1
- package/dist/{MultilineText-CHrvTjY_.js → MultilineText-BmbIytvk.js} +1 -1
- package/dist/{Nav-CDJbX6q3.js → Nav-BxS7kBh9.js} +1 -1
- package/dist/{NestedSelect-Uxvg89Pe.js → NestedSelect-CbWnin5b.js} +1 -1
- package/dist/{Number-tVXWVP4G.js → Number-CGYpvopX.js} +1 -1
- package/dist/{OfficeViewer-Cz447nMa.js → OfficeViewer-DBFFaH5P.js} +1 -1
- package/dist/{Operation-JkWrokFn.js → Operation-j5yIUDkZ.js} +1 -1
- package/dist/{Page-C5qOXz9A.js → Page-CJ2gK3vA.js} +1 -1
- package/dist/{Pagination-DQoNu1Qo.js → Pagination-BDEmomCQ.js} +1 -1
- package/dist/{PaginationWrapper-07h0-dmz.js → PaginationWrapper-Bnsk8oIg.js} +1 -1
- package/dist/{Panel--P2Ov47t.js → Panel-DKpM1Qfc.js} +1 -1
- package/dist/{Password-CF1feQa2.js → Password-CzHAzi8M.js} +1 -1
- package/dist/{Picker-CKV0_5vN.js → Picker-D5WVPGTg.js} +1 -1
- package/dist/{Plain-CnRq3KDS.js → Plain-oyGNzh1N.js} +1 -1
- package/dist/{PopUp-xCiesfUA.js → PopUp-DaheG-Vv.js} +1 -1
- package/dist/{Portlet-Agkkko8B.js → Portlet-dA2P7U6i.js} +1 -1
- package/dist/{Progress-D-JOmIgT.js → Progress-D2LXKzUA.js} +1 -1
- package/dist/{Property-BoNnFGV9.js → Property-CekATdUy.js} +1 -1
- package/dist/{QRCode-BFfhBYxV.js → QRCode-DPoyEXK3.js} +1 -1
- package/dist/{Radio-BRNZ49gi.js → Radio-HhPQKIKk.js} +1 -1
- package/dist/{Radios-0CT3XjKZ.js → Radios-DVzovX2u.js} +1 -1
- package/dist/Remark-CHTOdmdn.js +1 -0
- package/dist/{Remark-XZDS4Z3Y.js → Remark-bXVj7ffU.js} +1 -1
- package/dist/{SearchBox-__1UKInO.js → SearchBox-Jlwq8w3o.js} +1 -1
- package/dist/{Select-D9nj7O4q.js → Select-DCB0i1Ga.js} +1 -1
- package/dist/{Service-fGzhGL0m.js → Service-Bmfl8VSD.js} +1 -1
- package/dist/{Shape-C9r17D5A.js → Shape-5ZBBe1x0.js} +1 -1
- package/dist/{Slider-BryEccA-.js → Slider-pb5I0Xb2.js} +1 -1
- package/dist/{SparkLine-CcOuk0we.js → SparkLine-C4x34-6K.js} +1 -1
- package/dist/{Spinner-qyJRJu1C.js → Spinner-SR1wYU_1.js} +1 -1
- package/dist/{StaticHoc-C0bGgnQS.js → StaticHoc-DVc-5HZA.js} +1 -1
- package/dist/{Status-BPtAA54m.js → Status-7D4DBjk6.js} +1 -1
- package/dist/{Steps-DsmYH15c.js → Steps-Dd_3MM0y.js} +1 -1
- package/dist/{Switch-CMkhfkPn.js → Switch-CZqzJH45.js} +1 -1
- package/dist/{SwitchContainer-BLxuSTyZ.js → SwitchContainer-L7IwrheV.js} +1 -1
- package/dist/Table-CYUuVDxA.js +1 -0
- package/dist/{Table-HvHD2tS0.js → Table-D-9NfAqg.js} +1 -1
- package/dist/{Table2-C4HNs_R1.js → Table2-CIZ93hrj.js} +1 -1
- package/dist/{TableView-zfvmfF6E.js → TableView-CigjcDJc.js} +1 -1
- package/dist/{Tabs-BeQyEedg.js → Tabs-Cljj-nTv.js} +1 -1
- package/dist/{TabsTransfer-BsYcLplM.js → TabsTransfer-BXwrW4NX.js} +1 -1
- package/dist/{TabsTransferPicker-SS6hg5Hc.js → TabsTransferPicker-DB005nER.js} +1 -1
- package/dist/{Tag-IL_v32Aa.js → Tag-CcfwT8FM.js} +1 -1
- package/dist/{Tasks-D6GQavXw.js → Tasks-DeVW2Tdg.js} +1 -1
- package/dist/{Textarea-Ck0rJ3Ff.js → Textarea-zsHcK0rZ.js} +1 -1
- package/dist/{Timeline-BT7aVGPP.js → Timeline-D_3FRzUa.js} +1 -1
- package/dist/{TooltipWrapper-Bx_3339q.js → TooltipWrapper-BElQhX67.js} +1 -1
- package/dist/{Tpl-BiWl-0O_.js → Tpl-OPfW08Kh.js} +1 -1
- package/dist/{Transfer-CldOhDuU.js → Transfer-Cx1Ijzfh.js} +1 -1
- package/dist/Transfer-DboPBh8V.js +1 -0
- package/dist/{TransferPicker-C2cth5_r.js → TransferPicker-xlJfwHxP.js} +1 -1
- package/dist/{TreeSelect-D9-PBXkV.js → TreeSelect-BTKg9Ldf.js} +1 -1
- package/dist/{UUID-R41mBvtB.js → UUID-BkwpeiT9.js} +1 -1
- package/dist/{UserSelect-Cq56ZLkZ.js → UserSelect-CsY5PQp9.js} +1 -1
- package/dist/{VBox-BEdXFwFf.js → VBox-Ca4DBR6-.js} +1 -1
- package/dist/{Video-BIQhs4lA.js → Video-CXzxq3vU.js} +1 -1
- package/dist/{WebComponent-Vzfd9UEy.js → WebComponent-DYxJeu6a.js} +1 -1
- package/dist/{Wizard-BwEpr22M.js → Wizard-fqzq2OCn.js} +1 -1
- package/dist/{Words-C7JrGNdU.js → Words-V70QrARW.js} +1 -1
- package/dist/{Wrapper-DIGr8a29.js → Wrapper-BtFbBBXy.js} +1 -1
- package/dist/{beneficiary-form-_xPce615.js → beneficiary-form-BmmdIRc0.js} +1 -1
- package/dist/{es-Cn6dJrVn.js → es-DY5--nMG.js} +1 -1
- package/dist/esm-BMvKJM5q.js +4 -0
- package/dist/{esm-vG8eylH_.js → esm-BbZME5Ac.js} +1 -1
- package/dist/index.d.ts +216 -0
- package/dist/index.js +1 -1
- package/dist/{objectSpread2-yExSo67O.js → objectSpread2-BCtAXXta.js} +1 -1
- package/dist/{omitBy-CFU0pICA.js → omitBy-NMzUUhXs.js} +1 -1
- package/dist/{xor-ziNg7OgH.js → xor-CSkTraTY.js} +1 -1
- package/package.json +7 -6
- package/dist/Action-B-ZQiXEF.js +0 -1
- package/dist/ButtonGroup-pVY35HQ1.js +0 -1
- package/dist/ButtonGroupSelect-Bt6Jwo5u.js +0 -1
- package/dist/Card-B_1cg_nQ.js +0 -1
- package/dist/Checkbox-nA8maqiS.js +0 -1
- package/dist/Collapse-BW-pXRle.js +0 -1
- package/dist/FieldSet-D8oj-Vb4.js +0 -1
- package/dist/HBox-DGIyZMV6.js +0 -1
- package/dist/Image-BAenzG4k.js +0 -1
- package/dist/InputFile-X4G2zOvt.js +0 -1
- package/dist/InputImage-Cv5FkWaC.js +0 -1
- package/dist/InputRichText-0TZzQzcy.js +0 -1
- package/dist/List-Ccx0hLxM.js +0 -1
- package/dist/Remark-BuTyhR9e.js +0 -1
- package/dist/Table-DsxWjUvF.js +0 -1
- package/dist/Transfer-BwyAe8c8.js +0 -1
- package/dist/esm-CofciBhy.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,t}from"./rolldown-runtime-DcYi-9oA.js";import{t as r}from"./react-BW4ssgUo.js";import{a as n,c as o,i,n as a,r as l,s,t as d}from"./tslib.es6-C2q27PUR.js";import{c,v as u}from"./function-C8ta9DKb.js";import{t as p}from"./isEqual-BxlJ5vH7.js";import{$n as h,Ar as v,Dt as m,Ii as f,Mr as g,Nr as b,Rr as y,Tn as F,Tr as C,Xr as S,Zr as P,an as T,dt as I,fn as A,ft as O,it as k,jn as D,kr as x,kt as w,li as M,mt as R,oa as B,oi as E,pi as Q,qn as L,qr as N,si as q,sn as j,ui as U,ut as _,vi as V,xr as W,yn as H,yr as G}from"./esm-CofciBhy.js";import{t as $}from"./react-dom-DmgFzc6z.js";import{Rt as z,ft as J,mt as K}from"./esm-vG8eylH_.js";import{i as X,n as Y,o as Z,s as ee}from"./PopUp-xCiesfUA.js";import{n as te,t as re}from"./omitBy-CFU0pICA.js";var ne=/* @__PURE__ */t((e,t)=>{var r=Q()(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});t.exports=r}),oe=/* @__PURE__ */e(r()),ie=/* @__PURE__ */e(p()),ae=/* @__PURE__ */e(te()),le=/* @__PURE__ */e(re()),se=/* @__PURE__ */e(ne()),de=/* @__PURE__ */e(w()),ce=/* @__PURE__ */e($()),ue=/* @__PURE__ */e(H()),pe=/* @__PURE__ */e(F()),he=/* @__PURE__ */e(c()),ve=/* @__PURE__ */e(u()),me=["selectedChange","columnSort","columnFilter","columnSearch","columnToggled","orderChange","rowClick","rowDbClick","rowMouseEnter","rowMouseLeave","selected"],fe=function(e){function t(t){var r=e.call(this,t)||this;r.filterOnEvent=(0,ve.default)(function(e){return(0,le.default)(e,function(e,t){return!me.includes(t)})}),r.controlRef=r.controlRef.bind(r),r.handleFilterReset=r.handleFilterReset.bind(r),r.handleFilterSubmit=r.handleFilterSubmit.bind(r),r.handleFilterInit=r.handleFilterInit.bind(r),r.handleAction=r.handleAction.bind(r),r.dispatchEvent=r.dispatchEvent.bind(r),r.handleBulkAction=r.handleBulkAction.bind(r),r.handleChangePage=r.handleChangePage.bind(r),r.handleBulkGo=r.handleBulkGo.bind(r),r.handleDialogConfirm=r.handleDialogConfirm.bind(r),r.handleDialogClose=r.handleDialogClose.bind(r),r.handleItemChange=r.handleItemChange.bind(r),r.handleSave=r.handleSave.bind(r),r.handleSaveOrder=r.handleSaveOrder.bind(r),r.handleSelect=r.handleSelect.bind(r),r.handleChildPopOverOpen=r.handleChildPopOverOpen.bind(r),r.handleChildPopOverClose=r.handleChildPopOverClose.bind(r),r.search=r.search.bind(r),r.silentSearch=r.silentSearch.bind(r),r.handleQuery=r.handleQuery.bind(r),r.renderHeaderToolbar=r.renderHeaderToolbar.bind(r),r.renderFooterToolbar=r.renderFooterToolbar.bind(r),r.clearSelection=r.clearSelection.bind(r),r.filterItemIndex=r.filterItemIndex.bind(r);var n=t.location,o=t.store,i=t.pageField,a=t.perPageField;t.totalField;var l=t.syncLocation;t.loadDataOnce;var s,d=r.getParseQueryOptions(t);return r.mounted=!0,l&&n&&(n.query||n.search)?o.updateQuery(v(n,d),void 0,i,a):l&&!n&&window.location.search&&o.updateQuery(v(window.location,d),void 0,i,a),r.props.store.setFilterTogglable(!!r.props.filterTogglable,r.props.filterDefaultVisible),r.props.api&&r.props.store.updateData({items:[]}),r.props.pickerMode&&(s=h(r.props))&&r.syncSelectedFromPicker(s),r}return i(t,e),t.prototype.componentDidMount=function(){var e=this.props,t=e.store,r=e.autoGenerateFilter,n=e.perPageField;e.columns,this.props.perPage&&!t.query[n||"perPage"]&&t.changePage(t.page,this.props.perPage),(!this.props.filter&&!r||t.filterTogglable&&!t.filterVisible)&&this.handleFilterInit({}),this.parentContainer=this.getClosestParentContainer()},t.prototype.componentDidUpdate=function(e){var t,r,n=this.props,o=e.store;D(["toolbar","headerToolbar","footerToolbar","bulkActions"],e,n)&&(this.renderHeaderToolbar=this.renderHeaderToolbar.bind(this),this.renderFooterToolbar=this.renderFooterToolbar.bind(this)),!this.props.pickerMode||(0,ie.default)(r=h(this.props),h(e))||(0,ie.default)(r,o.selectedItems.concat())||this.syncSelectedFromPicker(r),!!this.props.filterTogglable!=!!e.filterTogglable&&o.setFilterTogglable(!!n.filterTogglable,n.filterDefaultVisible);var i=!1;if(e.syncLocation&&e.location&&e.location.search!==n.location.search&&(o.updateQuery(v(n.location,this.getParseQueryOptions(n)),void 0,n.pageField,n.perPageField),i=!(!n.api||!G(o.query,this.lastQuery,!1))),i);else if(e.api&&n.api&&T(e.api,n.api,o.fetchCtxOf(e.data,{pageField:e.pageField,perPageField:e.perPageField}),o.fetchCtxOf(n.data,{pageField:n.pageField,perPageField:n.perPageField})))i=!0;else if(!n.api&&P(n.source)&&n.data!==e.data){var a=f(n.source,n.data,"| raw");this.lastData&&this.lastData===a||(o.initFromScope(n.data,n.source,{columns:null!==(t=o.columns)&&void 0!==t?t:n.columns,totalField:n.totalField}),this.props.pickerMode&&(r=h(this.props))&&this.syncSelectedFromPicker(r),this.lastData=a)}i&&this.search()},t.prototype.componentWillUnmount=function(){var e,t;this.mounted=!1,clearTimeout(this.timer),null===(t=(e=this.filterOnEvent.cache).clear)||void 0===t||t.call(e)},t.prototype.getParseQueryOptions=function(e){var t,r=e.parsePrimitiveQuery;return{parsePrimitive:!!(U(r)?null==r?void 0:r.enable:r),primitiveTypes:null!==(t=null==r?void 0:r.types)&&void 0!==t?t:["boolean"]}},t.prototype.getClosestParentContainer=function(){var e=(0,ce.findDOMNode)(this);return null==e?void 0:e.closest("[role=dialog]")},t.prototype.controlRef=function(e){for(;e&&e.getWrappedInstance;)e=e.getWrappedInstance();this.control=e},t.prototype.handleAction=function(e,t,r,o,i){var l=this;void 0===o&&(o=!1);var s=this.props,d=s.onAction,c=s.store,u=s.messages,p=s.pickerMode,h=s.env;s.pageField;var v=s.stopAutoRefreshWhenModalIsOpen;if(!c.loading){if("dialog"===t.actionType){c.setCurrentAction(t,this.props.resolveDefinitions);var m=r.index,f=c.items.length;return v&&clearTimeout(this.timer),new Promise(function(e){c.openDialog(r,{hasNext:m<f-1,nextIndex:m+1,hasPrev:m>0,prevIndex:m-1,index:m},function(r,n){var o;null===(o=t.callback)||void 0===o||o.call(t,r,n),e({confirmed:r,value:n})},i||l.context)})}if("ajax"===t.actionType){c.setCurrentAction(t,this.props.resolveDefinitions);var g=r,b=t.redirect&&S(t.redirect,g);if(b&&t.blank&&h.jumpTo(b,t,g),!j(t.api,g))return;return c.saveRemote(t.api,g,{successMessage:t.messages&&t.messages.success||u&&u.saveSuccess,errorMessage:t.messages&&t.messages.failed||u&&u.saveFailed}).then(function(e){return a(l,void 0,void 0,function(){var o,i;return n(this,function(n){switch(n.label){case 0:return o=E(r,e),t.feedback&&W(t.feedback,o)?[4,this.openFeedback(t.feedback,o)]:[3,2];case 1:n.sent(),v&&clearTimeout(this.timer),n.label=2;case 2:return(i=t.redirect&&S(t.redirect,o))&&!t.blank&&h.jumpTo(i,t,o),t.reload?this.reloadTarget(O(t.reload,o),o):i||this.search(void 0,void 0,!0,!0),t.close&&this.closeTarget(t.close),[2]}})})}).catch(function(e){if(o||t.countDown)throw e})}if("reload"!==t.actionType||t.target){if(p&&("confirm"===t.actionType||"submit"===t.actionType))return c.setCurrentAction(t,this.props.resolveDefinitions),Promise.resolve({items:c.selectedItems.concat()});if(t.onClick){c.setCurrentAction(t,this.props.resolveDefinitions);var y=t.onClick;"string"==typeof y&&(y=A(y,"event","props","data")),y&&y(e,this.props,r)}else d(e,t,r,o,i||this.context)}else this.reload()}},t.prototype.handleBulkAction=function(e,t,r,o){var i,l=this,s=this.props,c=s.store,u=s.primaryField,p=s.onAction,h=s.messages,v=s.pageField,m=s.stopAutoRefreshWhenModalIsOpen,f=s.env;if(e.length||!1===o.requireSelected){var g=e.map(function(e){return e.hasOwnProperty(u)?e[u]:null}).filter(function(e){return e}).join(","),b=q([c.mergedData,{event:r},d(d(d({},e[0]),c.eventContext),{currentPageData:((null===(i=c.mergedData)||void 0===i?void 0:i.items)||[]).concat(),rows:e,items:e,ids:g})]),y=function(){if("dialog"===o.actionType)return l.handleAction(r,d(d({},o),{__from:"bulkAction"}),b);"ajax"===o.actionType?j(o.api,b)&&c.saveRemote(o.api,b,{successMessage:o.messages&&o.messages.success||h&&h.saveSuccess,errorMessage:o.messages&&o.messages.failed||h&&h.saveFailed}).then(function(e){return a(l,void 0,void 0,function(){var t,r,i;return n(this,function(n){switch(n.label){case 0:return t=E(b,e),o.feedback&&W(o.feedback,t)?[4,this.openFeedback(o.feedback,t)]:[3,2];case 1:n.sent(),m&&clearTimeout(this.timer),n.label=2;case 2:return o.reload?this.reloadTarget(O(o.reload,t),t):this.search(((i={})[v||"page"]=1,i),void 0,!0,!0),o.close&&this.closeTarget(o.close),(r=o.redirect&&S(o.redirect,t))&&f.jumpTo(r,o,t),[2]}})})}).catch(function(){return null}):p&&p(r,o,b,!1,l.context)},F="";!o.ignoreConfirm&&o.confirmText&&f.confirm&&(F=S(o.confirmText,b))?f.confirm(F,S(o.confirmTitle,b)||void 0).then(function(e){return e&&y()}):y()}},t.prototype.handleItemAction=function(e,t){this.doAction(e,t)},t.prototype.handleFilterInit=function(e){var t,r=this.props,n=r.defaultParams,o=r.columns,i=r.matchFunc,a=r.store,l=r.orderBy,s=r.orderDir,c=r.totalField;r.dispatchEvent;var u=d({},n);l&&(u.orderBy=l,u.orderDir=s||"asc"),this.handleFilterSubmit(d(d(d({},u),e),a.query),!1,!0,!1!==this.props.initFetch,!0),a.setPristineQuery();var p,v=this.props,m=v.pickerMode,f=v.options;m&&(a.initFromScope({items:f||[]},"${items}",{columns:null!==(t=a.columns)&&void 0!==t?t:o,matchFunc:i,totalField:c}),(p=h(this.props))&&this.syncSelectedFromPicker(p))},t.prototype.handleFilterReset=function(e,t){var r=this.props,n=r.store,o=r.syncLocation,i=r.env,a=r.pageField,l=r.perPageField,s={};Object.keys(e).forEach(function(e){return s[e]=""}),n.updateQuery(d(d({},s),n.pristineQuery),o&&i&&i.updateLocation?function(e){return i.updateLocation(e)}:void 0,a,l,!0),this.lastQuery=n.query,(null==t?void 0:t.actionType)&&["reset-and-submit","clear-and-submit","submit"].includes(t.actionType)||this.search()},t.prototype.handleFilterSubmit=function(e,t,r,n,o){var i,a,l;void 0===t&&(t=!0),void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===o&&(o=!1);var s=this.props,c=s.store,u=s.syncLocation,p=s.env,h=s.pageField,v=s.perPageField,m=s.loadDataOnceFetchOnFilter,f=s.parsePrimitiveQuery,y=this.getParseQueryOptions(this.props);e=d(d({},e),(0,ae.default)(null!==(l=null===(a=null==e?void 0:e.__super)||void 0===a?void 0:a.diff)&&void 0!==l?l:{},function(e){return void 0===e})),e=u?g(b(e,void 0,!0)):e,f&&(e=x(e,y)),c.updateQuery(d(d({},e),((i={})[h||"page"]=t?1:c.page,i)),u&&p&&p.updateLocation?function(e){return p.updateLocation(e,r)}:void 0,h,v),this.lastQuery=c.query,n&&this.search(void 0,void 0,void 0,!1!==m,o)},t.prototype.handleBulkGo=function(e,t,r){var n=this,o=this.props.store.selectedAction,i=this.props.env,a="";return o.confirmText&&(a=S(o.confirmText,this.props.store.mergedData))?i.confirm(a).then(function(i){return i&&n.handleBulkAction(e,t,r,o)}):this.handleBulkAction(e,t,r,o)},t.prototype.handleDialogConfirm=function(e,t,r,n){var o,i,a,l,s=this.props,c=s.store,u=s.pageField,p=s.stopAutoRefreshWhenModalIsOpen,h=s.interval,v=s.silentPolling,m=s.env;c.closeDialog(!0,e);var f=c.action;if(p&&h&&(this.timer=setTimeout(v?this.silentSearch:this.search,Math.max(h,1e3))),"next"===t.actionType&&"number"==typeof r.nextIndex&&c.data.items[r.nextIndex])return this.handleAction(void 0,d({},f),E(E(c.data,{index:r.nextIndex}),c.data.items[r.nextIndex]));if("prev"===t.actionType&&"number"==typeof r.prevIndex&&c.data.items[r.prevIndex])return this.handleAction(void 0,d({},f),E(E(c.data,{index:r.prevIndex}),c.data.items[r.prevIndex]));if(e.length){var g=e[0];r=E(r,g);var b=n[0];b&&"form"===b.props.type&&(g&&g.__saved?(null!==(i=t.reload)&&void 0!==i?i:f.reload)||this.search(f.__from?((o={})[u||"page"]=1,o):void 0,void 0,!0,!0):g&&(g.hasOwnProperty("items")&&g.items||g.hasOwnProperty("ids"))&&this.control.bulkUpdate&&this.control.bulkUpdate(g,g.items))}var y=null!==(a=t.reload)&&void 0!==a?a:f.reload;y&&this.reloadTarget(O(y,r),r);var F=null!==(l=t.redirect)&&void 0!==l?l:f.redirect;(F=F&&S(F,r))&&m.jumpTo(F,f,r)},t.prototype.handleDialogClose=function(e){void 0===e&&(e=!1);var t=this.props,r=t.store,n=t.stopAutoRefreshWhenModalIsOpen,o=t.silentPolling,i=t.interval;r.closeDialog(e),n&&i&&(this.timer=setTimeout(o?this.silentSearch:this.search,Math.max(i,1e3)))},t.prototype.openFeedback=function(e,t){var r=this;return new Promise(function(n){var o=r.props.store;o.setCurrentAction({type:"button",actionType:"dialog",dialog:e},r.props.resolveDefinitions),o.openDialog(t,void 0,function(e){n(e)},r.context)})},t.prototype.search=function(e,t,r,o,i){var l,s,c,u,p,v;return void 0===o&&(o=!1),void 0===i&&(i=!1),a(this,void 0,void 0,function(){var a,m,f,g,b,y,F,C,S,P,T,I,O,k,D,x,w,M,R,Q,L,q,U,_,V,W,H,G,$,z,J,K;return n(this,function(n){switch(n.label){case 0:return a=this.props,m=a.store,f=a.api,g=a.messages,b=a.pageField,y=a.perPageField,F=a.totalField,C=a.interval,S=a.stopAutoRefreshWhen,P=a.stopAutoRefreshWhenModalIsOpen,T=a.silentPolling,I=a.syncLocation,O=a.syncResponse2Query,k=a.pickerMode,D=a.env,x=a.loadDataOnce,w=a.loadDataOnceFetchOnFilter,M=a.source,R=a.columns,Q=a.dispatchEvent,L=a.options,r&&!k&&m.resetSelection(),q="",e&&"string"==typeof e.loadDataMode&&(q="load-more",delete e.loadDataMode),clearTimeout(this.timer),e&&m.updateQuery(e,!q&&I&&D&&D.updateLocation?D.updateLocation:void 0,b,y),this.lastQuery=m.query,U=E(m.data,m.query),_=(null===(l=this.props)||void 0===l?void 0:l.matchFunc)&&"string"==typeof this.props.matchFunc?A(this.props.matchFunc,"items","itemsRaw","options"):void 0,j(f,U)?[4,m.fetchInitData(f,U,{successMessage:g&&g.fetchSuccess,errorMessage:g&&g.fetchFailed,autoAppend:!0,forceReload:o,loadDataOnce:x,source:M,silent:t,pageField:b,perPageField:y,totalField:F,loadDataMode:q,syncResponse2Query:O,columns:null!==(s=m.columns)&&void 0!==s?s:R,matchFunc:_,filterOnAllColumns:!1===w,minLoadingTime:null==e?void 0:e.minLoadingTime,dataAppendTo:null==e?void 0:e.dataAppendTo})]:[3,8];case 1:return V=n.sent(),B(m)?(W=m.page,H=m.lastPage,G=m.msg,$=m.error,i?[4,null==Q?void 0:Q("fetchInited",E(this.props.data,{responseData:(null==V?void 0:V.ok)?null!==(c=m.data)&&void 0!==c?c:{}:V,responseStatus:void 0===(null==V?void 0:V.status)?$?1:0:null==V?void 0:V.status,responseMsg:G}))]:[3,3]):[2,V];case 2:return(null==(z=n.sent())?void 0:z.prevented)?[2,m.data]:[3,5];case 3:return[4,null==Q?void 0:Q("research",E(this.props.data,{responseData:(null==V?void 0:V.ok)?null!==(u=m.data)&&void 0!==u?u:{}:V,responseStatus:void 0===(null==V?void 0:V.status)?$?1:0:null==V?void 0:V.status,responseMsg:G}))];case 4:if(null==(z=n.sent())?void 0:z.prevented)return[2,m.data];n.label=5;case 5:return!x&&!m.data.items.length&&!C&&W>1&&H<W?[4,this.search(d(d({},m.query),(K={},K[b||"page"]=H,K)),!1,void 0)]:[3,7];case 6:n.sent(),n.label=7;case 7:return null!=V&&V.ok&&C&&this.mounted&&(!S||!(P&&m.hasModalOpened||N(S,E(m.data,m.query))))&&(this.timer=setTimeout(T?this.silentSearch.bind(this,void 0,void 0,!0):this.search.bind(this,void 0,void 0,void 0,!0),Math.max(C,1e3))),[3,9];case 8:M?m.initFromScope(U,M,{columns:null!==(p=m.columns)&&void 0!==p?p:R,matchFunc:_,totalField:F}):k&&m.initFromScope({items:L||[]},"${items}",{columns:null!==(v=m.columns)&&void 0!==v?v:R,matchFunc:_,totalField:F}),n.label=9;case 9:return this.props.pickerMode&&this.props.onSelect&&(J=h(this.props))&&this.syncSelectedFromPicker(J),[2,m.data]}})})},t.prototype.silentSearch=function(e,t,r){return void 0===r&&(r=!1),this.search(e,!0,t,r)},t.prototype.handleChangePage=function(e,t,r){var o;return a(this,void 0,void 0,function(){var i,a,l,s,d,c,u,p,h,v,m,f,g,b;return n(this,function(n){switch(n.label){case 0:return i=this.props,a=i.store,l=i.syncLocation,s=i.env,d=i.pageField,c=i.perPageField,u=i.pageDirectionField,p=i.autoJumpToTopOnPagerChange,h=i.translate,v=i.api,m=i.loadDataOnce,v&&!m&&(null===(o=this.control)||void 0===o?void 0:o.hasModifiedItems())?[4,z(h("CRUD.confirmLeaveUnSavedPage"))]:[3,2];case 1:if(!n.sent())return[2];n.label=2;case 2:return(b={})[d||"page"]=e,f=b,r&&(f[u||"pageDir"]=r),t&&(f[c||"perPage"]=t),a.updateQuery(f,l&&(null==s?void 0:s.updateLocation)?s.updateLocation:void 0,d,c),this.search(void 0,void 0,void 0),p&&this.control&&(this.control.scrollToTop?this.control.scrollToTop():((0,ce.findDOMNode)(this.control).scrollIntoView(),(g=window.scrollY)&&window.scroll(0,g))),[2]}})})},t.prototype.syncSelectedFromPicker=function(e){var t=this.props,r=t.store,n=t.primaryField,o=t.strictMode,i=e.map(function(e){var t;return(0,he.default)(e)||((t={})[n||"id"]=e,e=t),L(r.items,function(t){return function(e,t){var r=e[n||"id"],i=t[n||"id"];return!!(e===t||r&&(o?r===i:r==i))}(t,e)})||e});this.props.store.setSelectedItems(i)},t.prototype.handleItemChange=function(e,t,r){var n=this.props.store,o="".concat(r).split(".").map(function(e){return parseInt(e,10)}),i=y(n.items,o,1,e);n.replaceItems(i)},t.prototype.handleSave=function(e,t,r,o,i,l){var s=this,d=this.props,c=d.store,u=d.quickSaveApi,p=d.quickSaveItemApi,h=d.primaryField,v=d.env,m=d.messages,f=d.reload,g=d.dispatchEvent;if(Array.isArray(e)){if(!j(u))return void(v&&v.alert("CRUD quickSaveApi is required"));var b=E(c.data,{rows:e,rowsDiff:t,indexes:r,rowsOrigin:i});return e.length&&e[0].hasOwnProperty(h||"id")&&(b.ids=e.map(function(e){return e[h||"id"]}).join(",")),o&&(b.unModifiedItems=o),c.saveRemote(u,b,{successMessage:m&&m.saveFailed,errorMessage:m&&m.saveSuccess}).then(function(e){return a(s,void 0,void 0,function(){var t,r,o;return n(this,function(n){switch(n.label){case 0:return e?[4,null==g?void 0:g("quickSaveSucc",M(b,{result:e}))]:[2];case 1:return(null==(t=n.sent())?void 0:t.prevented)?[2]:[2,(r=null!==(o=null==l?void 0:l.reload)&&void 0!==o?o:f)?this.reloadTarget(O(r,b),b):this.search(void 0,void 0,!0,!0)]}})})}).catch(function(e){return a(s,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,null==g?void 0:g("quickSaveFail",E(this.props.data,{error:e}))];case 1:return t.sent(),[2]}})})})}if(j(p)){var y=E(c.data,{item:e,modified:t,origin:i}),F=E(y,e);return c.saveRemote(p,F).then(function(e){return a(s,void 0,void 0,function(){var t,r,o;return n(this,function(n){switch(n.label){case 0:return e?[4,null==g?void 0:g("quickSaveItemSucc",M(y,{result:e}))]:[2];case 1:return(null==(t=n.sent())?void 0:t.prevented)?[2]:[2,(r=null!==(o=null==l?void 0:l.reload)&&void 0!==o?o:f)?this.reloadTarget(O(r,y),y):this.search(void 0,void 0,!0,!0)]}})})}).catch(function(e){return a(s,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return null!=l&&l.resetOnFailed&&this.control.reset(),[4,null==g?void 0:g("quickSaveItemFail",E(this.props.data,{error:e}))];case 1:return t.sent(),[2]}})})})}v&&v.alert("CRUD quickSaveItemApi is required!")},t.prototype.handleSaveOrder=function(e,t){var r=this,o=this.props,i=o.store,l=o.saveOrderApi,s=o.orderField,d=o.primaryField,c=o.env,u=o.reload,p=o.dispatchEvent;if(l){var h,v,m=E(i.data),f=[],g=d&&t[0]&&t[0].hasOwnProperty(d);if(g||(m.idMap={}),m.insertAfter={},t.forEach(function(r){if(~e.indexOf(r))if(h){var n=g?h[d]:t.indexOf(h);m.insertAfter[n]=m.insertAfter[n]||[],g||(m.idMap[n]=h),m.insertAfter[n].push(g?r[d]:r)}else f.push(r);else h=r,v=v||r}),v&&f.length){var b=g?v[d]:t.indexOf(v);g||(m.idMap[b]=v),m.insertBefore={},m.insertBefore[b]=f.map(function(e){return g?e[d]:e})}else if(f.length){var y=f[0],F=g?y[d]:t.indexOf(y);g||(m.idMap[F]=y),m.insertAfter[F]=f.slice(1).map(function(e){return g?e[d]:e})}if(s){var S=(i.page-1)*i.perPage||0;t=C(t,function(e,t,r){var n;return M(e,((n={})[s]=(1===r?S:0)+t+1,n))})}if(m.rows=t.concat(),g){var P=function(e){return e.map(function(e){return"".concat(e[d]).concat(Array.isArray(e.children)&&e.children.length?"[".concat(P(e.children),"]"):"")}).join(",")};m.ids=P(t),s&&(m.order=C(t,function(e){return(0,de.default)(e,[d,s,"children"])}))}return j(l,m)&&i.saveRemote(l,m).then(function(e){return a(r,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return e?[4,null==p?void 0:p("saveOrderSucc",M(m,{result:e}))]:[2];case 1:return(null==(t=r.sent())?void 0:t.prevented)||(u&&this.reloadTarget(O(u,m),m),this.search(void 0,void 0,!0,!0)),[2]}})})}).catch(function(e){return a(r,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,null==p?void 0:p("saveOrderFail",E(this.props.data,{error:e}))];case 1:return t.sent(),[2]}})})})}c&&c.alert("CRUD saveOrderApi is required!")},t.prototype.handleSelect=function(e,t){var r=this.props,n=r.store,o=r.keepItemSelectionOnPageChange,i=r.primaryField,a=r.multiple,l=r.pickerMode,s=r.strictMode,d=r.onSelect,c=e;if(o&&n.selectedItems.length){var u;u=n.items.length>e.length+t.length?function(e,t){return(e.__pristine||e)===(t.__pristine||t)}:function(e,t){var r=e[i||"id"],n=t[i||"id"];return e===t||r&&(s?r===n:r==n)};var p=e.concat();c=n.selectedItems.map(function(e){var r=p.findIndex(function(t){return u(t,e)});return~r?p.splice(r,1)[0]:L(t,function(t){return u(t,e)})?null:e}).filter(function(e){return e}).concat(p)}var h=n.items.filter(function(e){return!c.find(function(t){return(t.__pristine||t)===e})}).map(function(e){return t.find(function(t){return t.__pristine===e})||e});l&&!1===a&&c.length>1&&h.push.apply(h,c.splice(0,c.length-1)),n.setSelectedItems(c),n.setUnSelectedItems(h),d&&d(c,h)},t.prototype.handleChildPopOverOpen=function(e){this.props.interval&&e&&~["dialog","drawer"].indexOf(e.mode)&&(this.props.stopAutoRefreshWhenModalIsOpen&&clearTimeout(this.timer),this.props.store.setInnerModalOpened(!0))},t.prototype.handleChildPopOverClose=function(e){var t=this.props,r=t.stopAutoRefreshWhenModalIsOpen,n=t.silentPolling,o=t.interval;e&&~["dialog","drawer"].indexOf(e.mode)&&(this.props.store.setInnerModalOpened(!1),r&&o&&(this.timer=setTimeout(n?this.silentSearch:this.search,Math.max(o,1e3))))},t.prototype.handleQuery=function(e,t,r,n,o){var i,a=this.props,l=a.store,s=a.syncLocation,c=a.env,u=a.pageField,p=a.perPageField,h=a.loadDataOnceFetchOnFilter;return l.updateQuery(n?d(((i={})[u||"page"]=1,i),e):e,s&&c&&c.updateLocation?c.updateLocation:void 0,u,p,r),this.search(void 0,void 0,null!=o?o:r,null!=t?t:!0===h)},t.prototype.reload=function(e,t,r,n,o,i){return t?this.receive(t,void 0,o,null==i?void 0:i.resetPage,!0):this.search(void 0,void 0,!0,!0)},t.prototype.receive=function(e,t,r,n,o){return this.handleQuery(e,!0,r,n,o)},t.prototype.reloadTarget=function(e,t){},t.prototype.closeTarget=function(e){},t.prototype.doAction=function(e,t,r,o){var i;return void 0===r&&(r=!1),a(this,void 0,void 0,function(){var a,l,s;return n(this,function(n){switch(n.label){case 0:return a=this.props.store,e.actionType&&["submitQuickEdit","toggleExpanded","setExpanded","initDrag","cancelDrag","selectAll","clearAll"].includes(e.actionType)?[2,null===(i=this.control)||void 0===i?void 0:i.doAction(e,t,r,o)]:[3,1];case 1:return"select"!==e.actionType?[3,3]:[4,R(a.items,t,null==o?void 0:o.index,null==o?void 0:o.condition)];case 2:return l=n.sent(),s=a.items.filter(function(e){return!l.includes(e)}),[2,this.handleSelect(l,s)];case 3:return[2,this.handleAction(void 0,e,t,r)]}})})},t.prototype.dispatchEvent=function(e,t,r,n){if("selectedChange"===e&&this.control===r){var o=this.props.store;t.selectedItems=o.selectedItems.concat(),t.unSelectedItems=o.unSelectedItems.concat()}return this.props.dispatchEvent(e,t,r,n)},t.prototype.unSelectItem=function(e,t){var r=this.props.store,n=r.selectedItems.concat(),o=r.unSelectedItems.concat(),i=n.indexOf(e);~i&&o.push.apply(o,n.splice(i,1)),r.setSelectedItems(n),r.setUnSelectedItems(o)},t.prototype.clearSelection=function(){var e=this.props,t=e.store,r=e.itemCheckableOn,n=s((0,se.default)(t.selectedItems,function(e){return!r||N(r,e)}),2),o=n[0],i=n[1],a=t.unSelectedItems.concat(o);t.setSelectedItems(i),t.setUnSelectedItems(a)},t.prototype.hasBulkActionsToolbar=function(){var e=this.props,t=e.headerToolbar,r=e.footerToolbar;if(!1===e.enableBulkActions)return!1;var n=function(e){return~["bulkActions","bulk-actions"].indexOf(e.type||e)};return Array.isArray(t)&&(0,pe.default)(t,n)||Array.isArray(r)&&(0,pe.default)(r,n)},t.prototype.hasBulkActions=function(){var e=this.props,t=e.bulkActions;e.itemActions;var r=e.store;if(!t||!t.length)return!1;var n=[],o=r.mergedData;return t&&t.length&&(n=t.map(function(e){return d(d({},e),_(e,o))}).filter(function(e){return!e.hidden&&!1!==e.visible})),n.length},t.prototype.renderBulkActions=function(e){var t,r=this,n=this.props,o=n.bulkActions,i=n.itemActions,a=n.store,l=n.render,s=n.classnames,c=n.primaryField,u=n.enableBulkActions;if(!o||!o.length||!1===u)return null;var p=a.selectedItems,h=a.unSelectedItems,v=[],m=[],f=E(a.mergedData,d(d({currentPageData:((null===(t=a.mergedData)||void 0===t?void 0:t.items)||[]).concat()},a.eventContext),{rows:p.concat(),items:p.concat(),ids:p.map(function(e){return e.hasOwnProperty(c)?e[c]:null}).filter(function(e){return e}).join(",")}));o&&o.length&&(!i||!i.length||p.length>1)&&(v=o.map(function(e){return d(d({},e),_(e,f))}).filter(function(e){return!e.hidden&&!1!==e.visible}));var g=E(a.data,p.length?p[0]:{});return i&&p.length<=1&&(m=i.map(function(e){return d(d({},e),_(e,g))}).filter(function(e){return!e.hidden&&!1!==e.visible})),v.length||m.length?oe.createElement("div",{className:s("Crud-actions")},v.map(function(e,t){return l("bulk-action/".concat(t),d(d({},(0,ue.default)(e,["visibleOn","hiddenOn","disabledOn"])),{type:e.type||"button"}),{key:"bulk-".concat(t),data:f,disabled:e.disabled||!1!==e.requireSelected&&!p.length,onAction:r.handleBulkAction.bind(r,p.concat(),h.concat()),ignoreConfirm:!0})}),m.map(function(e,t){return l("bulk-action/".concat(t),d(d({},(0,ue.default)(e,["visibleOn","hiddenOn","disabledOn"])),{type:"button"}),{key:"item-".concat(t),data:g,disabled:e.disabled||1!==p.length,onAction:r.handleItemAction.bind(r,e,g)})})):null},t.prototype.renderPagination=function(e){var t=this.props,r=t.store,n=t.render,o=t.classnames,i=t.alwaysShowPagination,a=t.perPageAvailable,l=t.testIdBuilder,s=r.page,c=r.lastPage;if("simple"!==r.mode&&r.lastPage<2&&!i)return null;var u={};if(Array.isArray(a)&&(u.perPageAvailable=a),"string"!=typeof e){Object.assign(u,e);var p=e.showPageInput;u.showPageInput=!0===p||c>9&&null==p,u.total=f(e.total,r.data)}else u.showPageInput=c>9;return oe.createElement("div",{className:o("Crud-pager")},n("pagination",{type:"pagination",testIdBuilder:null==l?void 0:l.getChild("pagination")},d(d({},u),{activePage:s,lastPage:c,hasNext:r.hasNext,mode:r.mode,perPage:r.perPage,popOverContainer:this.parentContainer,onPageChange:this.handleChangePage})))},t.prototype.renderStatistics=function(){var e=this.props,t=e.store,r=e.classnames,n=e.translate,o=e.alwaysShowPagination;return t.lastPage<=1&&!o?null:oe.createElement("div",{className:r("Crud-statistics")},n("CRUD.stat",{page:t.page,lastPage:t.lastPage,total:t.total}))},t.prototype.renderSwitchPerPage=function(e){var t=this,r=this.props,n=r.mobileUI,o=r.store,i=r.perPageAvailable,a=r.classnames,l=r.classPrefix,s=r.translate,d=r.testIdBuilder;if(!e.items.length)return null;var c=n?(i||[5,10,20,50,100]).map(function(e){return{label:e+" 条/页",value:e+""}}):(i||[5,10,20,50,100]).map(function(e){return{label:e,value:e+""}});return oe.createElement("div",{className:a("Crud-pageSwitch")},n?null:oe.createElement("span",null,s("CRUD.perPage")),oe.createElement(J,{classPrefix:l,searchable:!1,placeholder:s("Select.placeholder"),options:c,value:o.perPage+"",onChange:function(e){return t.handleChangePage(1,e.value)},clearable:!1,popOverContainer:this.parentContainer,testIdBuilder:null==d?void 0:d.getChild("perPage")}))},t.prototype.renderLoadMore=function(){var e=this,t=this.props,r=t.store;t.classPrefix;var n=t.classnames;t.translate,t.testIdBuilder;var o=t.loadMoreProps,i=void 0===o?{}:o,a=r.page,l=r.lastPage,s=i.showIcon,d=void 0===s||s,c=i.showText,u=void 0===c||c,p=i.iconType,h=void 0===p?"loading-outline":p,v=i.contentText,m=void 0===v?{contentdown:"点击加载更多",contentrefresh:"加载中...",contentnomore:"没有更多数据了"}:v,f=i.minLoadingTime,g=i.dataAppendTo,b=i.color,y=r.loading,F=a>=l;return oe.createElement("div",{className:n("Crud-loadMore"),style:b?{"--Spinner-color":b,color:b}:void 0,onClick:function(){y||F||e.search({page:a+1,loadDataMode:"load-more",minLoadingTime:f,dataAppendTo:g})}},d&&oe.createElement(X,{show:y,icon:h,size:"sm"}),u&&oe.createElement("span",null,y?m.contentrefresh:F?m.contentnomore:m.contentdown))},t.prototype.renderFilterToggler=function(){var e,t,r,n=this.props,o=n.store,i=n.classnames,a=n.translate,l=n.filterTogglable;if(!o.filterTogglable)return null;var s=(0,he.default)(l)?d({},l):{};return o.filterVisible&&(s.icon=null!==(e=s.activeIcon)&&void 0!==e?e:s.icon,s.label=null!==(t=s.activeLabel)&&void 0!==t?t:s.label),oe.createElement("button",{onClick:function(){return o.setFilterVisible(!o.filterVisible)},className:i("Button Button--size-default Button--default",{"is-active":o.filterVisible})},s.icon?oe.createElement(ee,{icon:s.icon,className:"icon m-r-xs"}):!1!==(null==s?void 0:s.icon)?oe.createElement(ee,{icon:"filter",className:"icon m-r-xs"}):null,null!==(r=null==s?void 0:s.label)&&void 0!==r?r:a("CRUD.filter"))},t.prototype.renderExportCSV=function(e){var t=this.props,r=t.store,n=t.classPrefix,o=t.translate,i=t.loadDataOnce,a=e.api,l=e.filename;return oe.createElement(Y,{classPrefix:n,onClick:function(){return r.exportAsCSV({loadDataOnce:i,api:a,filename:l,data:r.filterData})}},e.label||o("CRUD.exportCSV"))},t.prototype.renderToolbar=function(e,t,r,n){var o=this;if(void 0===t&&(t=0),void 0===r&&(r={}),!e)return null;var i=this.props,a=i.render,l=i.store,s=i.mobileUI,c=i.translate,u=i.testIdBuilder,p=e.type||e;if("bulkActions"===p||"bulk-actions"===p)return this.renderBulkActions(r);if("pagination"===p)return this.renderPagination(e);if("statistics"===p)return this.renderStatistics();if("switch-per-page"===p)return this.renderSwitchPerPage(r);if("load-more"===p)return this.renderLoadMore();if("filter-toggler"===p)return this.renderFilterToggler();if("export-csv"===p)return this.renderExportCSV(e);if("reload"===p){var h={label:"",icon:"fa fa-sync",tooltip:c("reload"),tooltipPlacement:"top",type:"button"};return"object"==typeof e&&(h=d(d({},h),(0,ue.default)(e,["type","align"]))),a("toolbar/".concat(t),h,{onAction:function(){o.reload()}})}if(Array.isArray(e)){var v=e.filter(function(e){return W(e,l.toolbarData)}).map(function(e,t){return{dom:o.renderToolbar(e,t,r,n),toolbar:e}}).filter(function(e){return e.dom}),m=v.length,f=this.props.classnames;return m?oe.createElement("div",d({className:f("Crud-toolbar"),key:t},null==u?void 0:u.getChild("toolbar").getTestId()),v.map(function(e,t){var r=e.toolbar,n=e.dom,o=r.type||r,i=r.align||("pagination"===o?"right":"left");return oe.createElement("div",{key:r.id||t,className:f("Crud-toolbar-item",i?"Crud-toolbar-item--".concat(i):"",{"is-mobile":s})},n)})):null}var g=n?n(e,t):void 0;if(void 0!==g)return g;var b=r.$$editable;return a("toolbar/".concat(t),e,{data:l.toolbarData,page:l.page,lastPage:l.lastPage,perPage:l.perPage,total:l.total,onQuery:this.handleQuery,onAction:this.handleAction,onChangePage:this.handleChangePage,onBulkAction:this.handleBulkAction,$$editable:b})},t.prototype.renderHeaderToolbar=function(e,t){var r=this.props,n=r.toolbar,o=r.toolbarInline,i=r.headerToolbar;return n&&(i=Array.isArray(i)?o?i.concat(n):[i,n]:i?[i,n]:n),this.renderToolbar(i||[],0,e,t)},t.prototype.renderFooterToolbar=function(e,t){var r=this.props,n=r.toolbar,o=r.toolbarInline,i=r.footerToolbar;return n&&(i=Array.isArray(i)?o?i.concat(n):[i,n]:i?[i,n]:n),this.renderToolbar(i,0,e,t)},t.prototype.renderTag=function(e,t){var r=this.props,n=r.classnames,o=r.labelField,i=r.labelTpl,a=r.primaryField,l=r.valueField;r.translate;var s=r.env,d=r.itemCheckableOn,c=!d||N(d,e);return oe.createElement("div",{key:t,className:n("Crud-value",c?"":"is-disabled")},oe.createElement("span",{className:n("Crud-valueIcon"),onClick:this.unSelectItem.bind(this,e,t)},"×"),oe.createElement("span",{className:n("Crud-valueLabel")},i?oe.createElement(Z,{html:S(i,e),filterHtml:s.filterHtml}):V(e,o||"label")||V(e,l||a||"id")))},t.prototype.renderSelection=function(){var e=this,t=this.props,r=t.store;t.classPrefix;var n=t.classnames;t.labelField,t.labelTpl,t.primaryField,t.valueField;var o=t.translate;t.env;var i=t.popOverContainer,a=t.multiple,l=t.maxTagCount,s=t.overflowTagPopover,c=t.keepItemSelectionOnPageChange;if(!r.selectedItems.length||!c||!1===a)return null;var u=r.selectedItems,p=!1!==a&&"number"==typeof l&&l>0,h=d({offset:[0,-10],tooltipClassName:n("Crud-selection-overflow",null==s?void 0:s.tooltipClassName),title:o("已选项")},(0,ue.default)(s,["children","content","tooltipClassName"]));return oe.createElement("div",{className:n("Crud-selection")},oe.createElement("div",{"data-folder-ignore":!0,className:n("Crud-selectionLabel")},o("CRUD.selected",{total:r.selectedItems.length})),oe.createElement(K,{enabled:!!p,tooltipClassName:n("Crud-selection-overflow-wrapper"),items:u,popOverContainer:i,tooltipOptions:h,maxVisibleCount:l,renderItem:function(t,r,n){return e.renderTag(t,r)}}),oe.createElement("a",{onClick:this.clearSelection,className:n("Crud-selectionClear")},o("clear")))},t.prototype.renderFilter=function(){var e,t=this.props,r=t.store,n=t.render,o=t.classnames,i=t.filter,a=t.translate,l=t.testIdBuilder,s=t.filterCanAccessSuperData,c=void 0===s||s;return!i||r.filterTogglable&&!r.filterVisible?null:n("filter",d(d({title:a("CRUD.filter"),mode:"inline",submitText:a("search")},i),{type:"form",api:null,testIdBuilder:null==l?void 0:l.getChild("filter")}),{key:"filter",panelClassName:o("Crud-filter",i.panelClassName||"Panel--default"),data:r.filterData,onReset:this.handleFilterReset,onSubmit:this.handleFilterSubmit,onInit:this.handleFilterInit,formStore:void 0,canAccessSuperData:null!==(e=null==i?void 0:i.canAccessSuperData)&&void 0!==e?e:c})},t.prototype.filterItemIndex=function(e){var t,r=this.props.store,n="".concat(e).split(".").map(function(e){return parseInt(e,10)});if(!Array.isArray(r.data.items))return e;var o=null===(t=r.data.items)||void 0===t?void 0:t[n[0]];return o&&(n[0]=r.items.findIndex(function(e){return(e.__pristine||e)===(o.__pristine||o)})),n.join(".")},t.prototype.filterBodySchema=function(e){return e},t.prototype.renderBody=function(){var e,t=this.props;t.className,t.style;var r=t.bodyClassName,n=t.filter,i=t.render,a=t.store,l=t.mode;t.syncLocation,t.children;var s=t.bulkActions,c=t.pickerMode,u=t.multiple,p=t.strictMode,h=t.valueField,v=t.primaryField;t.value;var m=t.hideQuickSaveBtn,f=t.itemActions,g=t.classnames,b=t.keepItemSelectionOnPageChange,y=t.maxKeepItemSelectionLength,F=t.maxItemSelectionLength;t.onAction;var C=t.popOverContainer;t.translate,t.onQuery;var S=t.autoGenerateFilter;t.onSelect;var P=t.autoFillHeight,T=t.onEvent;t.onSave,t.onSaveOrder,t.onPopOverOpened,t.onPopOverClosed,t.onSearchableFromReset,t.onSearchableFromSubmit,t.onSearchableFromInit,t.headerToolbarRender,t.footerToolbarRender;var I=t.testIdBuilder,A=t.id,O=t.filterCanAccessSuperData,k=void 0===O||O,D=t.selectable,x=void 0!==D&&D,w=o(t,["className","style","bodyClassName","filter","render","store","mode","syncLocation","children","bulkActions","pickerMode","multiple","strictMode","valueField","primaryField","value","hideQuickSaveBtn","itemActions","classnames","keepItemSelectionOnPageChange","maxKeepItemSelectionLength","maxItemSelectionLength","onAction","popOverContainer","translate","onQuery","autoGenerateFilter","onSelect","autoFillHeight","onEvent","onSave","onSaveOrder","onPopOverOpened","onPopOverClosed","onSearchableFromReset","onSearchableFromSubmit","onSearchableFromInit","headerToolbarRender","footerToolbarRender","testIdBuilder","id","filterCanAccessSuperData","selectable"]);return i("body",d(d({},this.filterBodySchema(w)),{id:A,onEvent:this.filterOnEvent(T),columns:null!==(e=a.columns)&&void 0!==e?e:w.columns,type:l||"table"}),{key:"body",className:g("Crud-body",r),ref:this.controlRef,autoGenerateFilter:!n&&S,filterCanAccessSuperData:k,autoFillHeight:P,selectable:!!(this.hasBulkActionsToolbar()&&this.hasBulkActions()||c||x),itemActions:f,multiple:void 0===u?!!(s&&s.length>0):u,selected:a.selectedItemsAsArray,strictMode:p,keepItemSelectionOnPageChange:b,maxKeepItemSelectionLength:y,maxItemSelectionLength:F,valueField:h||v,primaryField:v,hideQuickSaveBtn:m,items:a.data.items,fullItems:a.itemsAsArray,query:a.query,orderBy:a.query.orderBy,orderDir:a.query.orderDir,popOverContainer:C,onAction:this.handleAction,dispatchEvent:this.dispatchEvent,onItemChange:this.handleItemChange,onSave:this.handleSave,onSaveOrder:this.handleSaveOrder,onQuery:this.handleQuery,onSelect:this.handleSelect,onPopOverOpened:this.handleChildPopOverOpen,onPopOverClosed:this.handleChildPopOverClose,onSearchableFromReset:this.handleFilterReset,onSearchableFromSubmit:this.handleFilterSubmit,onSearchableFromInit:this.handleFilterInit,headerToolbarRender:this.renderHeaderToolbar,footerToolbarRender:this.renderFooterToolbar,data:a.mergedData,loading:a.loading,offset:a.offset,host:this,filterItemIndex:this.filterItemIndex,onDbClick:this.props.rowDbClick,testIdBuilder:null==I?void 0:I.getChild("body")})},t.prototype.render=function(){var e=this.props,t=e.className,r=e.style,n=e.render,o=e.store,i=e.classnames;e.translate;var a=e.testIdBuilder,l=e.id,s=e.mobileUI;return oe.createElement("div",d({className:i("Crud",t,{"is-loading":o.loading,"is-mobile":s}),style:r,"data-id":l,"data-role":"container"},null==a?void 0:a.getChild("wrapper").getTestId()),this.renderFilter(),this.renderSelection(),this.renderBody(),n("dialog",d(d({},o.dialogSchema),{type:"dialog"}),{key:"dialog",data:o.dialogData,onConfirm:this.handleDialogConfirm,onClose:this.handleDialogClose,show:o.dialogOpen}))},t.propsList=["bulkActions","itemActions","mode","orderField","syncLocation","toolbar","toolbarInline","messages","value","options","multiple","valueField","defaultParams","bodyClassName","perPageAvailable","pageField","perPageField","totalField","pageDirectionField","hideQuickSaveBtn","autoJumpToTopOnPagerChange","interval","silentPolling","stopAutoRefreshWhen","stopAutoRefreshWhenModalIsOpen","api","affixHeader","columnsTogglable","placeholder","tableClassName","headerClassName","footerClassName","headerToolbar","footerToolbar","filterTogglable","filterDefaultVisible","autoGenerateFilter","syncResponse2Query","keepItemSelectionOnPageChange","labelTpl","labelField","loadDataOnce","loadDataOnceFetchOnFilter","source","header","columns","size","onChange","onInit","onSaved","onSave","onQuery","formStore","autoFillHeight","maxTagCount","overflowTagPopover","parsePrimitiveQuery","matchFunc","loadMoreProps"],t.defaultProps={toolbarInline:!0,headerToolbar:["bulkActions"],footerToolbar:["statistics","pagination"],primaryField:"id",syncLocation:!0,pageField:"page",perPageField:"perPage",totalField:"total",pageDirectionField:"pageDir",hideQuickSaveBtn:!1,autoJumpToTopOnPagerChange:!0,silentPolling:!1,filterTogglable:!1,filterDefaultVisible:!0,loadDataOnce:!1,autoFillHeight:!1,parsePrimitiveQuery:!0,loadMoreProps:{showIcon:!0,showText:!0,iconType:"loading-outline",contentText:{contentdown:"点击加载更多",contentrefresh:"加载中...",contentnomore:"没有更多数据了"}}},t}(oe.Component),ge=function(e){function t(t,r){var n=e.call(this,t)||this;return r.registerComponent(n),n}return i(t,e),t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this),this.context.unRegisterComponent(this)},t.prototype.reload=function(t,r,n,o,i,a){var l,s=this.context;return(null==a?void 0:a.index)||(null==a?void 0:a.condition)?null===(l=this.control)||void 0===l?void 0:l.reload("",r,n,void 0,void 0,a):t?s.reload(r?"".concat(t,"?").concat(b(r)):t,n):e.prototype.reload.call(this,t,r,n,o,i,a)},t.prototype.receive=function(t,r,o,i,l){return a(this,void 0,void 0,function(){var a;return n(this,function(n){return a=this.context,r?[2,a.send(r,t)]:[2,e.prototype.receive.call(this,t,void 0,o,i,l)]})})},t.prototype.reloadTarget=function(e,t){this.context.reload(e,t)},t.prototype.closeTarget=function(e){this.context.close(e)},t.prototype.setData=function(e,t,r,o){var i,l,s;return a(this,void 0,void 0,function(){var a,c,u;return n(this,function(n){return a=this.props.store,void 0!==r||void 0!==o?[2,null===(l=null===(i=this.control)||void 0===i?void 0:i.setData)||void 0===l?void 0:l.call(i,e,t,r,o)]:(c=(null==e?void 0:e.total)||(null==e?void 0:e.count),u=null!==(s=e.rows)&&void 0!==s?s:e.items,void 0!==c&&a.updateTotal(parseInt(c,10)),[2,a.updateData(d(d({},e),u?{items:u}:{}),void 0,t)])})})},t.prototype.getData=function(){var e=this.props,t=e.store,r=e.data;return t.getData(r)},t.contextType=I,t}(fe),be=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),l([k({type:"crud",storeType:m.name,isolateScope:!0})],t)}(ge);export{be as CRUDRenderer,ge as CRUDRendererBase,fe as default};
|
|
1
|
+
import{o as e,t}from"./rolldown-runtime-DcYi-9oA.js";import{t as r}from"./react-BW4ssgUo.js";import{a as n,c as o,i,n as a,r as l,s,t as d}from"./tslib.es6-C2q27PUR.js";import{c,v as u}from"./function-C8ta9DKb.js";import{t as p}from"./isEqual-BxlJ5vH7.js";import{$n as h,Ar as v,Dt as m,Ii as f,Mr as g,Nr as b,Rr as y,Tn as F,Tr as C,Xr as S,Zr as P,an as T,dt as I,fn as A,ft as O,it as k,jn as D,kr as x,kt as w,li as M,mt as R,oa as B,oi as E,pi as Q,qn as L,qr as N,si as q,sn as j,ui as U,ut as _,vi as V,xr as W,yn as H,yr as G}from"./esm-BMvKJM5q.js";import{t as $}from"./react-dom-DmgFzc6z.js";import{Rt as z,ft as J,mt as K}from"./esm-BbZME5Ac.js";import{i as X,n as Y,o as Z,s as ee}from"./PopUp-DaheG-Vv.js";import{n as te,t as re}from"./omitBy-NMzUUhXs.js";var ne=/* @__PURE__ */t((e,t)=>{var r=Q()(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});t.exports=r}),oe=/* @__PURE__ */e(r()),ie=/* @__PURE__ */e(p()),ae=/* @__PURE__ */e(te()),le=/* @__PURE__ */e(re()),se=/* @__PURE__ */e(ne()),de=/* @__PURE__ */e(w()),ce=/* @__PURE__ */e($()),ue=/* @__PURE__ */e(H()),pe=/* @__PURE__ */e(F()),he=/* @__PURE__ */e(c()),ve=/* @__PURE__ */e(u()),me=["selectedChange","columnSort","columnFilter","columnSearch","columnToggled","orderChange","rowClick","rowDbClick","rowMouseEnter","rowMouseLeave","selected"],fe=function(e){function t(t){var r=e.call(this,t)||this;r.filterOnEvent=(0,ve.default)(function(e){return(0,le.default)(e,function(e,t){return!me.includes(t)})}),r.controlRef=r.controlRef.bind(r),r.handleFilterReset=r.handleFilterReset.bind(r),r.handleFilterSubmit=r.handleFilterSubmit.bind(r),r.handleFilterInit=r.handleFilterInit.bind(r),r.handleAction=r.handleAction.bind(r),r.dispatchEvent=r.dispatchEvent.bind(r),r.handleBulkAction=r.handleBulkAction.bind(r),r.handleChangePage=r.handleChangePage.bind(r),r.handleBulkGo=r.handleBulkGo.bind(r),r.handleDialogConfirm=r.handleDialogConfirm.bind(r),r.handleDialogClose=r.handleDialogClose.bind(r),r.handleItemChange=r.handleItemChange.bind(r),r.handleSave=r.handleSave.bind(r),r.handleSaveOrder=r.handleSaveOrder.bind(r),r.handleSelect=r.handleSelect.bind(r),r.handleChildPopOverOpen=r.handleChildPopOverOpen.bind(r),r.handleChildPopOverClose=r.handleChildPopOverClose.bind(r),r.search=r.search.bind(r),r.silentSearch=r.silentSearch.bind(r),r.handleQuery=r.handleQuery.bind(r),r.renderHeaderToolbar=r.renderHeaderToolbar.bind(r),r.renderFooterToolbar=r.renderFooterToolbar.bind(r),r.clearSelection=r.clearSelection.bind(r),r.filterItemIndex=r.filterItemIndex.bind(r);var n=t.location,o=t.store,i=t.pageField,a=t.perPageField;t.totalField;var l=t.syncLocation;t.loadDataOnce;var s,d=r.getParseQueryOptions(t);return r.mounted=!0,l&&n&&(n.query||n.search)?o.updateQuery(v(n,d),void 0,i,a):l&&!n&&window.location.search&&o.updateQuery(v(window.location,d),void 0,i,a),r.props.store.setFilterTogglable(!!r.props.filterTogglable,r.props.filterDefaultVisible),r.props.api&&r.props.store.updateData({items:[]}),r.props.pickerMode&&(s=h(r.props))&&r.syncSelectedFromPicker(s),r}return i(t,e),t.prototype.componentDidMount=function(){var e=this.props,t=e.store,r=e.autoGenerateFilter,n=e.perPageField;e.columns,this.props.perPage&&!t.query[n||"perPage"]&&t.changePage(t.page,this.props.perPage),(!this.props.filter&&!r||t.filterTogglable&&!t.filterVisible)&&this.handleFilterInit({}),this.parentContainer=this.getClosestParentContainer()},t.prototype.componentDidUpdate=function(e){var t,r,n=this.props,o=e.store;D(["toolbar","headerToolbar","footerToolbar","bulkActions"],e,n)&&(this.renderHeaderToolbar=this.renderHeaderToolbar.bind(this),this.renderFooterToolbar=this.renderFooterToolbar.bind(this)),!this.props.pickerMode||(0,ie.default)(r=h(this.props),h(e))||(0,ie.default)(r,o.selectedItems.concat())||this.syncSelectedFromPicker(r),!!this.props.filterTogglable!=!!e.filterTogglable&&o.setFilterTogglable(!!n.filterTogglable,n.filterDefaultVisible);var i=!1;if(e.syncLocation&&e.location&&e.location.search!==n.location.search&&(o.updateQuery(v(n.location,this.getParseQueryOptions(n)),void 0,n.pageField,n.perPageField),i=!(!n.api||!G(o.query,this.lastQuery,!1))),i);else if(e.api&&n.api&&T(e.api,n.api,o.fetchCtxOf(e.data,{pageField:e.pageField,perPageField:e.perPageField}),o.fetchCtxOf(n.data,{pageField:n.pageField,perPageField:n.perPageField})))i=!0;else if(!n.api&&P(n.source)&&n.data!==e.data){var a=f(n.source,n.data,"| raw");this.lastData&&this.lastData===a||(o.initFromScope(n.data,n.source,{columns:null!==(t=o.columns)&&void 0!==t?t:n.columns,totalField:n.totalField}),this.props.pickerMode&&(r=h(this.props))&&this.syncSelectedFromPicker(r),this.lastData=a)}i&&this.search()},t.prototype.componentWillUnmount=function(){var e,t;this.mounted=!1,clearTimeout(this.timer),null===(t=(e=this.filterOnEvent.cache).clear)||void 0===t||t.call(e)},t.prototype.getParseQueryOptions=function(e){var t,r=e.parsePrimitiveQuery;return{parsePrimitive:!!(U(r)?null==r?void 0:r.enable:r),primitiveTypes:null!==(t=null==r?void 0:r.types)&&void 0!==t?t:["boolean"]}},t.prototype.getClosestParentContainer=function(){var e=(0,ce.findDOMNode)(this);return null==e?void 0:e.closest("[role=dialog]")},t.prototype.controlRef=function(e){for(;e&&e.getWrappedInstance;)e=e.getWrappedInstance();this.control=e},t.prototype.handleAction=function(e,t,r,o,i){var l=this;void 0===o&&(o=!1);var s=this.props,d=s.onAction,c=s.store,u=s.messages,p=s.pickerMode,h=s.env;s.pageField;var v=s.stopAutoRefreshWhenModalIsOpen;if(!c.loading){if("dialog"===t.actionType){c.setCurrentAction(t,this.props.resolveDefinitions);var m=r.index,f=c.items.length;return v&&clearTimeout(this.timer),new Promise(function(e){c.openDialog(r,{hasNext:m<f-1,nextIndex:m+1,hasPrev:m>0,prevIndex:m-1,index:m},function(r,n){var o;null===(o=t.callback)||void 0===o||o.call(t,r,n),e({confirmed:r,value:n})},i||l.context)})}if("ajax"===t.actionType){c.setCurrentAction(t,this.props.resolveDefinitions);var g=r,b=t.redirect&&S(t.redirect,g);if(b&&t.blank&&h.jumpTo(b,t,g),!j(t.api,g))return;return c.saveRemote(t.api,g,{successMessage:t.messages&&t.messages.success||u&&u.saveSuccess,errorMessage:t.messages&&t.messages.failed||u&&u.saveFailed}).then(function(e){return a(l,void 0,void 0,function(){var o,i;return n(this,function(n){switch(n.label){case 0:return o=E(r,e),t.feedback&&W(t.feedback,o)?[4,this.openFeedback(t.feedback,o)]:[3,2];case 1:n.sent(),v&&clearTimeout(this.timer),n.label=2;case 2:return(i=t.redirect&&S(t.redirect,o))&&!t.blank&&h.jumpTo(i,t,o),t.reload?this.reloadTarget(O(t.reload,o),o):i||this.search(void 0,void 0,!0,!0),t.close&&this.closeTarget(t.close),[2]}})})}).catch(function(e){if(o||t.countDown)throw e})}if("reload"!==t.actionType||t.target){if(p&&("confirm"===t.actionType||"submit"===t.actionType))return c.setCurrentAction(t,this.props.resolveDefinitions),Promise.resolve({items:c.selectedItems.concat()});if(t.onClick){c.setCurrentAction(t,this.props.resolveDefinitions);var y=t.onClick;"string"==typeof y&&(y=A(y,"event","props","data")),y&&y(e,this.props,r)}else d(e,t,r,o,i||this.context)}else this.reload()}},t.prototype.handleBulkAction=function(e,t,r,o){var i,l=this,s=this.props,c=s.store,u=s.primaryField,p=s.onAction,h=s.messages,v=s.pageField,m=s.stopAutoRefreshWhenModalIsOpen,f=s.env;if(e.length||!1===o.requireSelected){var g=e.map(function(e){return e.hasOwnProperty(u)?e[u]:null}).filter(function(e){return e}).join(","),b=q([c.mergedData,{event:r},d(d(d({},e[0]),c.eventContext),{currentPageData:((null===(i=c.mergedData)||void 0===i?void 0:i.items)||[]).concat(),rows:e,items:e,ids:g})]),y=function(){if("dialog"===o.actionType)return l.handleAction(r,d(d({},o),{__from:"bulkAction"}),b);"ajax"===o.actionType?j(o.api,b)&&c.saveRemote(o.api,b,{successMessage:o.messages&&o.messages.success||h&&h.saveSuccess,errorMessage:o.messages&&o.messages.failed||h&&h.saveFailed}).then(function(e){return a(l,void 0,void 0,function(){var t,r,i;return n(this,function(n){switch(n.label){case 0:return t=E(b,e),o.feedback&&W(o.feedback,t)?[4,this.openFeedback(o.feedback,t)]:[3,2];case 1:n.sent(),m&&clearTimeout(this.timer),n.label=2;case 2:return o.reload?this.reloadTarget(O(o.reload,t),t):this.search(((i={})[v||"page"]=1,i),void 0,!0,!0),o.close&&this.closeTarget(o.close),(r=o.redirect&&S(o.redirect,t))&&f.jumpTo(r,o,t),[2]}})})}).catch(function(){return null}):p&&p(r,o,b,!1,l.context)},F="";!o.ignoreConfirm&&o.confirmText&&f.confirm&&(F=S(o.confirmText,b))?f.confirm(F,S(o.confirmTitle,b)||void 0).then(function(e){return e&&y()}):y()}},t.prototype.handleItemAction=function(e,t){this.doAction(e,t)},t.prototype.handleFilterInit=function(e){var t,r=this.props,n=r.defaultParams,o=r.columns,i=r.matchFunc,a=r.store,l=r.orderBy,s=r.orderDir,c=r.totalField;r.dispatchEvent;var u=d({},n);l&&(u.orderBy=l,u.orderDir=s||"asc"),this.handleFilterSubmit(d(d(d({},u),e),a.query),!1,!0,!1!==this.props.initFetch,!0),a.setPristineQuery();var p,v=this.props,m=v.pickerMode,f=v.options;m&&(a.initFromScope({items:f||[]},"${items}",{columns:null!==(t=a.columns)&&void 0!==t?t:o,matchFunc:i,totalField:c}),(p=h(this.props))&&this.syncSelectedFromPicker(p))},t.prototype.handleFilterReset=function(e,t){var r=this.props,n=r.store,o=r.syncLocation,i=r.env,a=r.pageField,l=r.perPageField,s={};Object.keys(e).forEach(function(e){return s[e]=""}),n.updateQuery(d(d({},s),n.pristineQuery),o&&i&&i.updateLocation?function(e){return i.updateLocation(e)}:void 0,a,l,!0),this.lastQuery=n.query,(null==t?void 0:t.actionType)&&["reset-and-submit","clear-and-submit","submit"].includes(t.actionType)||this.search()},t.prototype.handleFilterSubmit=function(e,t,r,n,o){var i,a,l;void 0===t&&(t=!0),void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===o&&(o=!1);var s=this.props,c=s.store,u=s.syncLocation,p=s.env,h=s.pageField,v=s.perPageField,m=s.loadDataOnceFetchOnFilter,f=s.parsePrimitiveQuery,y=this.getParseQueryOptions(this.props);e=d(d({},e),(0,ae.default)(null!==(l=null===(a=null==e?void 0:e.__super)||void 0===a?void 0:a.diff)&&void 0!==l?l:{},function(e){return void 0===e})),e=u?g(b(e,void 0,!0)):e,f&&(e=x(e,y)),c.updateQuery(d(d({},e),((i={})[h||"page"]=t?1:c.page,i)),u&&p&&p.updateLocation?function(e){return p.updateLocation(e,r)}:void 0,h,v),this.lastQuery=c.query,n&&this.search(void 0,void 0,void 0,!1!==m,o)},t.prototype.handleBulkGo=function(e,t,r){var n=this,o=this.props.store.selectedAction,i=this.props.env,a="";return o.confirmText&&(a=S(o.confirmText,this.props.store.mergedData))?i.confirm(a).then(function(i){return i&&n.handleBulkAction(e,t,r,o)}):this.handleBulkAction(e,t,r,o)},t.prototype.handleDialogConfirm=function(e,t,r,n){var o,i,a,l,s=this.props,c=s.store,u=s.pageField,p=s.stopAutoRefreshWhenModalIsOpen,h=s.interval,v=s.silentPolling,m=s.env;c.closeDialog(!0,e);var f=c.action;if(p&&h&&(this.timer=setTimeout(v?this.silentSearch:this.search,Math.max(h,1e3))),"next"===t.actionType&&"number"==typeof r.nextIndex&&c.data.items[r.nextIndex])return this.handleAction(void 0,d({},f),E(E(c.data,{index:r.nextIndex}),c.data.items[r.nextIndex]));if("prev"===t.actionType&&"number"==typeof r.prevIndex&&c.data.items[r.prevIndex])return this.handleAction(void 0,d({},f),E(E(c.data,{index:r.prevIndex}),c.data.items[r.prevIndex]));if(e.length){var g=e[0];r=E(r,g);var b=n[0];b&&"form"===b.props.type&&(g&&g.__saved?(null!==(i=t.reload)&&void 0!==i?i:f.reload)||this.search(f.__from?((o={})[u||"page"]=1,o):void 0,void 0,!0,!0):g&&(g.hasOwnProperty("items")&&g.items||g.hasOwnProperty("ids"))&&this.control.bulkUpdate&&this.control.bulkUpdate(g,g.items))}var y=null!==(a=t.reload)&&void 0!==a?a:f.reload;y&&this.reloadTarget(O(y,r),r);var F=null!==(l=t.redirect)&&void 0!==l?l:f.redirect;(F=F&&S(F,r))&&m.jumpTo(F,f,r)},t.prototype.handleDialogClose=function(e){void 0===e&&(e=!1);var t=this.props,r=t.store,n=t.stopAutoRefreshWhenModalIsOpen,o=t.silentPolling,i=t.interval;r.closeDialog(e),n&&i&&(this.timer=setTimeout(o?this.silentSearch:this.search,Math.max(i,1e3)))},t.prototype.openFeedback=function(e,t){var r=this;return new Promise(function(n){var o=r.props.store;o.setCurrentAction({type:"button",actionType:"dialog",dialog:e},r.props.resolveDefinitions),o.openDialog(t,void 0,function(e){n(e)},r.context)})},t.prototype.search=function(e,t,r,o,i){var l,s,c,u,p,v;return void 0===o&&(o=!1),void 0===i&&(i=!1),a(this,void 0,void 0,function(){var a,m,f,g,b,y,F,C,S,P,T,I,O,k,D,x,w,M,R,Q,L,q,U,_,V,W,H,G,$,z,J,K;return n(this,function(n){switch(n.label){case 0:return a=this.props,m=a.store,f=a.api,g=a.messages,b=a.pageField,y=a.perPageField,F=a.totalField,C=a.interval,S=a.stopAutoRefreshWhen,P=a.stopAutoRefreshWhenModalIsOpen,T=a.silentPolling,I=a.syncLocation,O=a.syncResponse2Query,k=a.pickerMode,D=a.env,x=a.loadDataOnce,w=a.loadDataOnceFetchOnFilter,M=a.source,R=a.columns,Q=a.dispatchEvent,L=a.options,r&&!k&&m.resetSelection(),q="",e&&"string"==typeof e.loadDataMode&&(q="load-more",delete e.loadDataMode),clearTimeout(this.timer),e&&m.updateQuery(e,!q&&I&&D&&D.updateLocation?D.updateLocation:void 0,b,y),this.lastQuery=m.query,U=E(m.data,m.query),_=(null===(l=this.props)||void 0===l?void 0:l.matchFunc)&&"string"==typeof this.props.matchFunc?A(this.props.matchFunc,"items","itemsRaw","options"):void 0,j(f,U)?[4,m.fetchInitData(f,U,{successMessage:g&&g.fetchSuccess,errorMessage:g&&g.fetchFailed,autoAppend:!0,forceReload:o,loadDataOnce:x,source:M,silent:t,pageField:b,perPageField:y,totalField:F,loadDataMode:q,syncResponse2Query:O,columns:null!==(s=m.columns)&&void 0!==s?s:R,matchFunc:_,filterOnAllColumns:!1===w,minLoadingTime:null==e?void 0:e.minLoadingTime,dataAppendTo:null==e?void 0:e.dataAppendTo})]:[3,8];case 1:return V=n.sent(),B(m)?(W=m.page,H=m.lastPage,G=m.msg,$=m.error,i?[4,null==Q?void 0:Q("fetchInited",E(this.props.data,{responseData:(null==V?void 0:V.ok)?null!==(c=m.data)&&void 0!==c?c:{}:V,responseStatus:void 0===(null==V?void 0:V.status)?$?1:0:null==V?void 0:V.status,responseMsg:G}))]:[3,3]):[2,V];case 2:return(null==(z=n.sent())?void 0:z.prevented)?[2,m.data]:[3,5];case 3:return[4,null==Q?void 0:Q("research",E(this.props.data,{responseData:(null==V?void 0:V.ok)?null!==(u=m.data)&&void 0!==u?u:{}:V,responseStatus:void 0===(null==V?void 0:V.status)?$?1:0:null==V?void 0:V.status,responseMsg:G}))];case 4:if(null==(z=n.sent())?void 0:z.prevented)return[2,m.data];n.label=5;case 5:return!x&&!m.data.items.length&&!C&&W>1&&H<W?[4,this.search(d(d({},m.query),(K={},K[b||"page"]=H,K)),!1,void 0)]:[3,7];case 6:n.sent(),n.label=7;case 7:return null!=V&&V.ok&&C&&this.mounted&&(!S||!(P&&m.hasModalOpened||N(S,E(m.data,m.query))))&&(this.timer=setTimeout(T?this.silentSearch.bind(this,void 0,void 0,!0):this.search.bind(this,void 0,void 0,void 0,!0),Math.max(C,1e3))),[3,9];case 8:M?m.initFromScope(U,M,{columns:null!==(p=m.columns)&&void 0!==p?p:R,matchFunc:_,totalField:F}):k&&m.initFromScope({items:L||[]},"${items}",{columns:null!==(v=m.columns)&&void 0!==v?v:R,matchFunc:_,totalField:F}),n.label=9;case 9:return this.props.pickerMode&&this.props.onSelect&&(J=h(this.props))&&this.syncSelectedFromPicker(J),[2,m.data]}})})},t.prototype.silentSearch=function(e,t,r){return void 0===r&&(r=!1),this.search(e,!0,t,r)},t.prototype.handleChangePage=function(e,t,r){var o;return a(this,void 0,void 0,function(){var i,a,l,s,d,c,u,p,h,v,m,f,g,b;return n(this,function(n){switch(n.label){case 0:return i=this.props,a=i.store,l=i.syncLocation,s=i.env,d=i.pageField,c=i.perPageField,u=i.pageDirectionField,p=i.autoJumpToTopOnPagerChange,h=i.translate,v=i.api,m=i.loadDataOnce,v&&!m&&(null===(o=this.control)||void 0===o?void 0:o.hasModifiedItems())?[4,z(h("CRUD.confirmLeaveUnSavedPage"))]:[3,2];case 1:if(!n.sent())return[2];n.label=2;case 2:return(b={})[d||"page"]=e,f=b,r&&(f[u||"pageDir"]=r),t&&(f[c||"perPage"]=t),a.updateQuery(f,l&&(null==s?void 0:s.updateLocation)?s.updateLocation:void 0,d,c),this.search(void 0,void 0,void 0),p&&this.control&&(this.control.scrollToTop?this.control.scrollToTop():((0,ce.findDOMNode)(this.control).scrollIntoView(),(g=window.scrollY)&&window.scroll(0,g))),[2]}})})},t.prototype.syncSelectedFromPicker=function(e){var t=this.props,r=t.store,n=t.primaryField,o=t.strictMode,i=e.map(function(e){var t;return(0,he.default)(e)||((t={})[n||"id"]=e,e=t),L(r.items,function(t){return function(e,t){var r=e[n||"id"],i=t[n||"id"];return!!(e===t||r&&(o?r===i:r==i))}(t,e)})||e});this.props.store.setSelectedItems(i)},t.prototype.handleItemChange=function(e,t,r){var n=this.props.store,o="".concat(r).split(".").map(function(e){return parseInt(e,10)}),i=y(n.items,o,1,e);n.replaceItems(i)},t.prototype.handleSave=function(e,t,r,o,i,l){var s=this,d=this.props,c=d.store,u=d.quickSaveApi,p=d.quickSaveItemApi,h=d.primaryField,v=d.env,m=d.messages,f=d.reload,g=d.dispatchEvent;if(Array.isArray(e)){if(!j(u))return void(v&&v.alert("CRUD quickSaveApi is required"));var b=E(c.data,{rows:e,rowsDiff:t,indexes:r,rowsOrigin:i});return e.length&&e[0].hasOwnProperty(h||"id")&&(b.ids=e.map(function(e){return e[h||"id"]}).join(",")),o&&(b.unModifiedItems=o),c.saveRemote(u,b,{successMessage:m&&m.saveFailed,errorMessage:m&&m.saveSuccess}).then(function(e){return a(s,void 0,void 0,function(){var t,r,o;return n(this,function(n){switch(n.label){case 0:return e?[4,null==g?void 0:g("quickSaveSucc",M(b,{result:e}))]:[2];case 1:return(null==(t=n.sent())?void 0:t.prevented)?[2]:[2,(r=null!==(o=null==l?void 0:l.reload)&&void 0!==o?o:f)?this.reloadTarget(O(r,b),b):this.search(void 0,void 0,!0,!0)]}})})}).catch(function(e){return a(s,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,null==g?void 0:g("quickSaveFail",E(this.props.data,{error:e}))];case 1:return t.sent(),[2]}})})})}if(j(p)){var y=E(c.data,{item:e,modified:t,origin:i}),F=E(y,e);return c.saveRemote(p,F).then(function(e){return a(s,void 0,void 0,function(){var t,r,o;return n(this,function(n){switch(n.label){case 0:return e?[4,null==g?void 0:g("quickSaveItemSucc",M(y,{result:e}))]:[2];case 1:return(null==(t=n.sent())?void 0:t.prevented)?[2]:[2,(r=null!==(o=null==l?void 0:l.reload)&&void 0!==o?o:f)?this.reloadTarget(O(r,y),y):this.search(void 0,void 0,!0,!0)]}})})}).catch(function(e){return a(s,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return null!=l&&l.resetOnFailed&&this.control.reset(),[4,null==g?void 0:g("quickSaveItemFail",E(this.props.data,{error:e}))];case 1:return t.sent(),[2]}})})})}v&&v.alert("CRUD quickSaveItemApi is required!")},t.prototype.handleSaveOrder=function(e,t){var r=this,o=this.props,i=o.store,l=o.saveOrderApi,s=o.orderField,d=o.primaryField,c=o.env,u=o.reload,p=o.dispatchEvent;if(l){var h,v,m=E(i.data),f=[],g=d&&t[0]&&t[0].hasOwnProperty(d);if(g||(m.idMap={}),m.insertAfter={},t.forEach(function(r){if(~e.indexOf(r))if(h){var n=g?h[d]:t.indexOf(h);m.insertAfter[n]=m.insertAfter[n]||[],g||(m.idMap[n]=h),m.insertAfter[n].push(g?r[d]:r)}else f.push(r);else h=r,v=v||r}),v&&f.length){var b=g?v[d]:t.indexOf(v);g||(m.idMap[b]=v),m.insertBefore={},m.insertBefore[b]=f.map(function(e){return g?e[d]:e})}else if(f.length){var y=f[0],F=g?y[d]:t.indexOf(y);g||(m.idMap[F]=y),m.insertAfter[F]=f.slice(1).map(function(e){return g?e[d]:e})}if(s){var S=(i.page-1)*i.perPage||0;t=C(t,function(e,t,r){var n;return M(e,((n={})[s]=(1===r?S:0)+t+1,n))})}if(m.rows=t.concat(),g){var P=function(e){return e.map(function(e){return"".concat(e[d]).concat(Array.isArray(e.children)&&e.children.length?"[".concat(P(e.children),"]"):"")}).join(",")};m.ids=P(t),s&&(m.order=C(t,function(e){return(0,de.default)(e,[d,s,"children"])}))}return j(l,m)&&i.saveRemote(l,m).then(function(e){return a(r,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return e?[4,null==p?void 0:p("saveOrderSucc",M(m,{result:e}))]:[2];case 1:return(null==(t=r.sent())?void 0:t.prevented)||(u&&this.reloadTarget(O(u,m),m),this.search(void 0,void 0,!0,!0)),[2]}})})}).catch(function(e){return a(r,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,null==p?void 0:p("saveOrderFail",E(this.props.data,{error:e}))];case 1:return t.sent(),[2]}})})})}c&&c.alert("CRUD saveOrderApi is required!")},t.prototype.handleSelect=function(e,t){var r=this.props,n=r.store,o=r.keepItemSelectionOnPageChange,i=r.primaryField,a=r.multiple,l=r.pickerMode,s=r.strictMode,d=r.onSelect,c=e;if(o&&n.selectedItems.length){var u;u=n.items.length>e.length+t.length?function(e,t){return(e.__pristine||e)===(t.__pristine||t)}:function(e,t){var r=e[i||"id"],n=t[i||"id"];return e===t||r&&(s?r===n:r==n)};var p=e.concat();c=n.selectedItems.map(function(e){var r=p.findIndex(function(t){return u(t,e)});return~r?p.splice(r,1)[0]:L(t,function(t){return u(t,e)})?null:e}).filter(function(e){return e}).concat(p)}var h=n.items.filter(function(e){return!c.find(function(t){return(t.__pristine||t)===e})}).map(function(e){return t.find(function(t){return t.__pristine===e})||e});l&&!1===a&&c.length>1&&h.push.apply(h,c.splice(0,c.length-1)),n.setSelectedItems(c),n.setUnSelectedItems(h),d&&d(c,h)},t.prototype.handleChildPopOverOpen=function(e){this.props.interval&&e&&~["dialog","drawer"].indexOf(e.mode)&&(this.props.stopAutoRefreshWhenModalIsOpen&&clearTimeout(this.timer),this.props.store.setInnerModalOpened(!0))},t.prototype.handleChildPopOverClose=function(e){var t=this.props,r=t.stopAutoRefreshWhenModalIsOpen,n=t.silentPolling,o=t.interval;e&&~["dialog","drawer"].indexOf(e.mode)&&(this.props.store.setInnerModalOpened(!1),r&&o&&(this.timer=setTimeout(n?this.silentSearch:this.search,Math.max(o,1e3))))},t.prototype.handleQuery=function(e,t,r,n,o){var i,a=this.props,l=a.store,s=a.syncLocation,c=a.env,u=a.pageField,p=a.perPageField,h=a.loadDataOnceFetchOnFilter;return l.updateQuery(n?d(((i={})[u||"page"]=1,i),e):e,s&&c&&c.updateLocation?c.updateLocation:void 0,u,p,r),this.search(void 0,void 0,null!=o?o:r,null!=t?t:!0===h)},t.prototype.reload=function(e,t,r,n,o,i){return t?this.receive(t,void 0,o,null==i?void 0:i.resetPage,!0):this.search(void 0,void 0,!0,!0)},t.prototype.receive=function(e,t,r,n,o){return this.handleQuery(e,!0,r,n,o)},t.prototype.reloadTarget=function(e,t){},t.prototype.closeTarget=function(e){},t.prototype.doAction=function(e,t,r,o){var i;return void 0===r&&(r=!1),a(this,void 0,void 0,function(){var a,l,s;return n(this,function(n){switch(n.label){case 0:return a=this.props.store,e.actionType&&["submitQuickEdit","toggleExpanded","setExpanded","initDrag","cancelDrag","selectAll","clearAll"].includes(e.actionType)?[2,null===(i=this.control)||void 0===i?void 0:i.doAction(e,t,r,o)]:[3,1];case 1:return"select"!==e.actionType?[3,3]:[4,R(a.items,t,null==o?void 0:o.index,null==o?void 0:o.condition)];case 2:return l=n.sent(),s=a.items.filter(function(e){return!l.includes(e)}),[2,this.handleSelect(l,s)];case 3:return[2,this.handleAction(void 0,e,t,r)]}})})},t.prototype.dispatchEvent=function(e,t,r,n){if("selectedChange"===e&&this.control===r){var o=this.props.store;t.selectedItems=o.selectedItems.concat(),t.unSelectedItems=o.unSelectedItems.concat()}return this.props.dispatchEvent(e,t,r,n)},t.prototype.unSelectItem=function(e,t){var r=this.props.store,n=r.selectedItems.concat(),o=r.unSelectedItems.concat(),i=n.indexOf(e);~i&&o.push.apply(o,n.splice(i,1)),r.setSelectedItems(n),r.setUnSelectedItems(o)},t.prototype.clearSelection=function(){var e=this.props,t=e.store,r=e.itemCheckableOn,n=s((0,se.default)(t.selectedItems,function(e){return!r||N(r,e)}),2),o=n[0],i=n[1],a=t.unSelectedItems.concat(o);t.setSelectedItems(i),t.setUnSelectedItems(a)},t.prototype.hasBulkActionsToolbar=function(){var e=this.props,t=e.headerToolbar,r=e.footerToolbar;if(!1===e.enableBulkActions)return!1;var n=function(e){return~["bulkActions","bulk-actions"].indexOf(e.type||e)};return Array.isArray(t)&&(0,pe.default)(t,n)||Array.isArray(r)&&(0,pe.default)(r,n)},t.prototype.hasBulkActions=function(){var e=this.props,t=e.bulkActions;e.itemActions;var r=e.store;if(!t||!t.length)return!1;var n=[],o=r.mergedData;return t&&t.length&&(n=t.map(function(e){return d(d({},e),_(e,o))}).filter(function(e){return!e.hidden&&!1!==e.visible})),n.length},t.prototype.renderBulkActions=function(e){var t,r=this,n=this.props,o=n.bulkActions,i=n.itemActions,a=n.store,l=n.render,s=n.classnames,c=n.primaryField,u=n.enableBulkActions;if(!o||!o.length||!1===u)return null;var p=a.selectedItems,h=a.unSelectedItems,v=[],m=[],f=E(a.mergedData,d(d({currentPageData:((null===(t=a.mergedData)||void 0===t?void 0:t.items)||[]).concat()},a.eventContext),{rows:p.concat(),items:p.concat(),ids:p.map(function(e){return e.hasOwnProperty(c)?e[c]:null}).filter(function(e){return e}).join(",")}));o&&o.length&&(!i||!i.length||p.length>1)&&(v=o.map(function(e){return d(d({},e),_(e,f))}).filter(function(e){return!e.hidden&&!1!==e.visible}));var g=E(a.data,p.length?p[0]:{});return i&&p.length<=1&&(m=i.map(function(e){return d(d({},e),_(e,g))}).filter(function(e){return!e.hidden&&!1!==e.visible})),v.length||m.length?oe.createElement("div",{className:s("Crud-actions")},v.map(function(e,t){return l("bulk-action/".concat(t),d(d({},(0,ue.default)(e,["visibleOn","hiddenOn","disabledOn"])),{type:e.type||"button"}),{key:"bulk-".concat(t),data:f,disabled:e.disabled||!1!==e.requireSelected&&!p.length,onAction:r.handleBulkAction.bind(r,p.concat(),h.concat()),ignoreConfirm:!0})}),m.map(function(e,t){return l("bulk-action/".concat(t),d(d({},(0,ue.default)(e,["visibleOn","hiddenOn","disabledOn"])),{type:"button"}),{key:"item-".concat(t),data:g,disabled:e.disabled||1!==p.length,onAction:r.handleItemAction.bind(r,e,g)})})):null},t.prototype.renderPagination=function(e){var t=this.props,r=t.store,n=t.render,o=t.classnames,i=t.alwaysShowPagination,a=t.perPageAvailable,l=t.testIdBuilder,s=r.page,c=r.lastPage;if("simple"!==r.mode&&r.lastPage<2&&!i)return null;var u={};if(Array.isArray(a)&&(u.perPageAvailable=a),"string"!=typeof e){Object.assign(u,e);var p=e.showPageInput;u.showPageInput=!0===p||c>9&&null==p,u.total=f(e.total,r.data)}else u.showPageInput=c>9;return oe.createElement("div",{className:o("Crud-pager")},n("pagination",{type:"pagination",testIdBuilder:null==l?void 0:l.getChild("pagination")},d(d({},u),{activePage:s,lastPage:c,hasNext:r.hasNext,mode:r.mode,perPage:r.perPage,popOverContainer:this.parentContainer,onPageChange:this.handleChangePage})))},t.prototype.renderStatistics=function(){var e=this.props,t=e.store,r=e.classnames,n=e.translate,o=e.alwaysShowPagination;return t.lastPage<=1&&!o?null:oe.createElement("div",{className:r("Crud-statistics")},n("CRUD.stat",{page:t.page,lastPage:t.lastPage,total:t.total}))},t.prototype.renderSwitchPerPage=function(e){var t=this,r=this.props,n=r.mobileUI,o=r.store,i=r.perPageAvailable,a=r.classnames,l=r.classPrefix,s=r.translate,d=r.testIdBuilder;if(!e.items.length)return null;var c=n?(i||[5,10,20,50,100]).map(function(e){return{label:e+" 条/页",value:e+""}}):(i||[5,10,20,50,100]).map(function(e){return{label:e,value:e+""}});return oe.createElement("div",{className:a("Crud-pageSwitch")},n?null:oe.createElement("span",null,s("CRUD.perPage")),oe.createElement(J,{classPrefix:l,searchable:!1,placeholder:s("Select.placeholder"),options:c,value:o.perPage+"",onChange:function(e){return t.handleChangePage(1,e.value)},clearable:!1,popOverContainer:this.parentContainer,testIdBuilder:null==d?void 0:d.getChild("perPage")}))},t.prototype.renderLoadMore=function(){var e=this,t=this.props,r=t.store;t.classPrefix;var n=t.classnames;t.translate,t.testIdBuilder;var o=t.loadMoreProps,i=void 0===o?{}:o,a=r.page,l=r.lastPage,s=i.showIcon,d=void 0===s||s,c=i.showText,u=void 0===c||c,p=i.iconType,h=void 0===p?"loading-outline":p,v=i.contentText,m=void 0===v?{contentdown:"点击加载更多",contentrefresh:"加载中...",contentnomore:"没有更多数据了"}:v,f=i.minLoadingTime,g=i.dataAppendTo,b=i.color,y=r.loading,F=a>=l;return oe.createElement("div",{className:n("Crud-loadMore"),style:b?{"--Spinner-color":b,color:b}:void 0,onClick:function(){y||F||e.search({page:a+1,loadDataMode:"load-more",minLoadingTime:f,dataAppendTo:g})}},d&&oe.createElement(X,{show:y,icon:h,size:"sm"}),u&&oe.createElement("span",null,y?m.contentrefresh:F?m.contentnomore:m.contentdown))},t.prototype.renderFilterToggler=function(){var e,t,r,n=this.props,o=n.store,i=n.classnames,a=n.translate,l=n.filterTogglable;if(!o.filterTogglable)return null;var s=(0,he.default)(l)?d({},l):{};return o.filterVisible&&(s.icon=null!==(e=s.activeIcon)&&void 0!==e?e:s.icon,s.label=null!==(t=s.activeLabel)&&void 0!==t?t:s.label),oe.createElement("button",{onClick:function(){return o.setFilterVisible(!o.filterVisible)},className:i("Button Button--size-default Button--default",{"is-active":o.filterVisible})},s.icon?oe.createElement(ee,{icon:s.icon,className:"icon m-r-xs"}):!1!==(null==s?void 0:s.icon)?oe.createElement(ee,{icon:"filter",className:"icon m-r-xs"}):null,null!==(r=null==s?void 0:s.label)&&void 0!==r?r:a("CRUD.filter"))},t.prototype.renderExportCSV=function(e){var t=this.props,r=t.store,n=t.classPrefix,o=t.translate,i=t.loadDataOnce,a=e.api,l=e.filename;return oe.createElement(Y,{classPrefix:n,onClick:function(){return r.exportAsCSV({loadDataOnce:i,api:a,filename:l,data:r.filterData})}},e.label||o("CRUD.exportCSV"))},t.prototype.renderToolbar=function(e,t,r,n){var o=this;if(void 0===t&&(t=0),void 0===r&&(r={}),!e)return null;var i=this.props,a=i.render,l=i.store,s=i.mobileUI,c=i.translate,u=i.testIdBuilder,p=e.type||e;if("bulkActions"===p||"bulk-actions"===p)return this.renderBulkActions(r);if("pagination"===p)return this.renderPagination(e);if("statistics"===p)return this.renderStatistics();if("switch-per-page"===p)return this.renderSwitchPerPage(r);if("load-more"===p)return this.renderLoadMore();if("filter-toggler"===p)return this.renderFilterToggler();if("export-csv"===p)return this.renderExportCSV(e);if("reload"===p){var h={label:"",icon:"fa fa-sync",tooltip:c("reload"),tooltipPlacement:"top",type:"button"};return"object"==typeof e&&(h=d(d({},h),(0,ue.default)(e,["type","align"]))),a("toolbar/".concat(t),h,{onAction:function(){o.reload()}})}if(Array.isArray(e)){var v=e.filter(function(e){return W(e,l.toolbarData)}).map(function(e,t){return{dom:o.renderToolbar(e,t,r,n),toolbar:e}}).filter(function(e){return e.dom}),m=v.length,f=this.props.classnames;return m?oe.createElement("div",d({className:f("Crud-toolbar"),key:t},null==u?void 0:u.getChild("toolbar").getTestId()),v.map(function(e,t){var r=e.toolbar,n=e.dom,o=r.type||r,i=r.align||("pagination"===o?"right":"left");return oe.createElement("div",{key:r.id||t,className:f("Crud-toolbar-item",i?"Crud-toolbar-item--".concat(i):"",{"is-mobile":s})},n)})):null}var g=n?n(e,t):void 0;if(void 0!==g)return g;var b=r.$$editable;return a("toolbar/".concat(t),e,{data:l.toolbarData,page:l.page,lastPage:l.lastPage,perPage:l.perPage,total:l.total,onQuery:this.handleQuery,onAction:this.handleAction,onChangePage:this.handleChangePage,onBulkAction:this.handleBulkAction,$$editable:b})},t.prototype.renderHeaderToolbar=function(e,t){var r=this.props,n=r.toolbar,o=r.toolbarInline,i=r.headerToolbar;return n&&(i=Array.isArray(i)?o?i.concat(n):[i,n]:i?[i,n]:n),this.renderToolbar(i||[],0,e,t)},t.prototype.renderFooterToolbar=function(e,t){var r=this.props,n=r.toolbar,o=r.toolbarInline,i=r.footerToolbar;return n&&(i=Array.isArray(i)?o?i.concat(n):[i,n]:i?[i,n]:n),this.renderToolbar(i,0,e,t)},t.prototype.renderTag=function(e,t){var r=this.props,n=r.classnames,o=r.labelField,i=r.labelTpl,a=r.primaryField,l=r.valueField;r.translate;var s=r.env,d=r.itemCheckableOn,c=!d||N(d,e);return oe.createElement("div",{key:t,className:n("Crud-value",c?"":"is-disabled")},oe.createElement("span",{className:n("Crud-valueIcon"),onClick:this.unSelectItem.bind(this,e,t)},"×"),oe.createElement("span",{className:n("Crud-valueLabel")},i?oe.createElement(Z,{html:S(i,e),filterHtml:s.filterHtml}):V(e,o||"label")||V(e,l||a||"id")))},t.prototype.renderSelection=function(){var e=this,t=this.props,r=t.store;t.classPrefix;var n=t.classnames;t.labelField,t.labelTpl,t.primaryField,t.valueField;var o=t.translate;t.env;var i=t.popOverContainer,a=t.multiple,l=t.maxTagCount,s=t.overflowTagPopover,c=t.keepItemSelectionOnPageChange;if(!r.selectedItems.length||!c||!1===a)return null;var u=r.selectedItems,p=!1!==a&&"number"==typeof l&&l>0,h=d({offset:[0,-10],tooltipClassName:n("Crud-selection-overflow",null==s?void 0:s.tooltipClassName),title:o("已选项")},(0,ue.default)(s,["children","content","tooltipClassName"]));return oe.createElement("div",{className:n("Crud-selection")},oe.createElement("div",{"data-folder-ignore":!0,className:n("Crud-selectionLabel")},o("CRUD.selected",{total:r.selectedItems.length})),oe.createElement(K,{enabled:!!p,tooltipClassName:n("Crud-selection-overflow-wrapper"),items:u,popOverContainer:i,tooltipOptions:h,maxVisibleCount:l,renderItem:function(t,r,n){return e.renderTag(t,r)}}),oe.createElement("a",{onClick:this.clearSelection,className:n("Crud-selectionClear")},o("clear")))},t.prototype.renderFilter=function(){var e,t=this.props,r=t.store,n=t.render,o=t.classnames,i=t.filter,a=t.translate,l=t.testIdBuilder,s=t.filterCanAccessSuperData,c=void 0===s||s;return!i||r.filterTogglable&&!r.filterVisible?null:n("filter",d(d({title:a("CRUD.filter"),mode:"inline",submitText:a("search")},i),{type:"form",api:null,testIdBuilder:null==l?void 0:l.getChild("filter")}),{key:"filter",panelClassName:o("Crud-filter",i.panelClassName||"Panel--default"),data:r.filterData,onReset:this.handleFilterReset,onSubmit:this.handleFilterSubmit,onInit:this.handleFilterInit,formStore:void 0,canAccessSuperData:null!==(e=null==i?void 0:i.canAccessSuperData)&&void 0!==e?e:c})},t.prototype.filterItemIndex=function(e){var t,r=this.props.store,n="".concat(e).split(".").map(function(e){return parseInt(e,10)});if(!Array.isArray(r.data.items))return e;var o=null===(t=r.data.items)||void 0===t?void 0:t[n[0]];return o&&(n[0]=r.items.findIndex(function(e){return(e.__pristine||e)===(o.__pristine||o)})),n.join(".")},t.prototype.filterBodySchema=function(e){return e},t.prototype.renderBody=function(){var e,t=this.props;t.className,t.style;var r=t.bodyClassName,n=t.filter,i=t.render,a=t.store,l=t.mode;t.syncLocation,t.children;var s=t.bulkActions,c=t.pickerMode,u=t.multiple,p=t.strictMode,h=t.valueField,v=t.primaryField;t.value;var m=t.hideQuickSaveBtn,f=t.itemActions,g=t.classnames,b=t.keepItemSelectionOnPageChange,y=t.maxKeepItemSelectionLength,F=t.maxItemSelectionLength;t.onAction;var C=t.popOverContainer;t.translate,t.onQuery;var S=t.autoGenerateFilter;t.onSelect;var P=t.autoFillHeight,T=t.onEvent;t.onSave,t.onSaveOrder,t.onPopOverOpened,t.onPopOverClosed,t.onSearchableFromReset,t.onSearchableFromSubmit,t.onSearchableFromInit,t.headerToolbarRender,t.footerToolbarRender;var I=t.testIdBuilder,A=t.id,O=t.filterCanAccessSuperData,k=void 0===O||O,D=t.selectable,x=void 0!==D&&D,w=o(t,["className","style","bodyClassName","filter","render","store","mode","syncLocation","children","bulkActions","pickerMode","multiple","strictMode","valueField","primaryField","value","hideQuickSaveBtn","itemActions","classnames","keepItemSelectionOnPageChange","maxKeepItemSelectionLength","maxItemSelectionLength","onAction","popOverContainer","translate","onQuery","autoGenerateFilter","onSelect","autoFillHeight","onEvent","onSave","onSaveOrder","onPopOverOpened","onPopOverClosed","onSearchableFromReset","onSearchableFromSubmit","onSearchableFromInit","headerToolbarRender","footerToolbarRender","testIdBuilder","id","filterCanAccessSuperData","selectable"]);return i("body",d(d({},this.filterBodySchema(w)),{id:A,onEvent:this.filterOnEvent(T),columns:null!==(e=a.columns)&&void 0!==e?e:w.columns,type:l||"table"}),{key:"body",className:g("Crud-body",r),ref:this.controlRef,autoGenerateFilter:!n&&S,filterCanAccessSuperData:k,autoFillHeight:P,selectable:!!(this.hasBulkActionsToolbar()&&this.hasBulkActions()||c||x),itemActions:f,multiple:void 0===u?!!(s&&s.length>0):u,selected:a.selectedItemsAsArray,strictMode:p,keepItemSelectionOnPageChange:b,maxKeepItemSelectionLength:y,maxItemSelectionLength:F,valueField:h||v,primaryField:v,hideQuickSaveBtn:m,items:a.data.items,fullItems:a.itemsAsArray,query:a.query,orderBy:a.query.orderBy,orderDir:a.query.orderDir,popOverContainer:C,onAction:this.handleAction,dispatchEvent:this.dispatchEvent,onItemChange:this.handleItemChange,onSave:this.handleSave,onSaveOrder:this.handleSaveOrder,onQuery:this.handleQuery,onSelect:this.handleSelect,onPopOverOpened:this.handleChildPopOverOpen,onPopOverClosed:this.handleChildPopOverClose,onSearchableFromReset:this.handleFilterReset,onSearchableFromSubmit:this.handleFilterSubmit,onSearchableFromInit:this.handleFilterInit,headerToolbarRender:this.renderHeaderToolbar,footerToolbarRender:this.renderFooterToolbar,data:a.mergedData,loading:a.loading,offset:a.offset,host:this,filterItemIndex:this.filterItemIndex,onDbClick:this.props.rowDbClick,testIdBuilder:null==I?void 0:I.getChild("body")})},t.prototype.render=function(){var e=this.props,t=e.className,r=e.style,n=e.render,o=e.store,i=e.classnames;e.translate;var a=e.testIdBuilder,l=e.id,s=e.mobileUI;return oe.createElement("div",d({className:i("Crud",t,{"is-loading":o.loading,"is-mobile":s}),style:r,"data-id":l,"data-role":"container"},null==a?void 0:a.getChild("wrapper").getTestId()),this.renderFilter(),this.renderSelection(),this.renderBody(),n("dialog",d(d({},o.dialogSchema),{type:"dialog"}),{key:"dialog",data:o.dialogData,onConfirm:this.handleDialogConfirm,onClose:this.handleDialogClose,show:o.dialogOpen}))},t.propsList=["bulkActions","itemActions","mode","orderField","syncLocation","toolbar","toolbarInline","messages","value","options","multiple","valueField","defaultParams","bodyClassName","perPageAvailable","pageField","perPageField","totalField","pageDirectionField","hideQuickSaveBtn","autoJumpToTopOnPagerChange","interval","silentPolling","stopAutoRefreshWhen","stopAutoRefreshWhenModalIsOpen","api","affixHeader","columnsTogglable","placeholder","tableClassName","headerClassName","footerClassName","headerToolbar","footerToolbar","filterTogglable","filterDefaultVisible","autoGenerateFilter","syncResponse2Query","keepItemSelectionOnPageChange","labelTpl","labelField","loadDataOnce","loadDataOnceFetchOnFilter","source","header","columns","size","onChange","onInit","onSaved","onSave","onQuery","formStore","autoFillHeight","maxTagCount","overflowTagPopover","parsePrimitiveQuery","matchFunc","loadMoreProps"],t.defaultProps={toolbarInline:!0,headerToolbar:["bulkActions"],footerToolbar:["statistics","pagination"],primaryField:"id",syncLocation:!0,pageField:"page",perPageField:"perPage",totalField:"total",pageDirectionField:"pageDir",hideQuickSaveBtn:!1,autoJumpToTopOnPagerChange:!0,silentPolling:!1,filterTogglable:!1,filterDefaultVisible:!0,loadDataOnce:!1,autoFillHeight:!1,parsePrimitiveQuery:!0,loadMoreProps:{showIcon:!0,showText:!0,iconType:"loading-outline",contentText:{contentdown:"点击加载更多",contentrefresh:"加载中...",contentnomore:"没有更多数据了"}}},t}(oe.Component),ge=function(e){function t(t,r){var n=e.call(this,t)||this;return r.registerComponent(n),n}return i(t,e),t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this),this.context.unRegisterComponent(this)},t.prototype.reload=function(t,r,n,o,i,a){var l,s=this.context;return(null==a?void 0:a.index)||(null==a?void 0:a.condition)?null===(l=this.control)||void 0===l?void 0:l.reload("",r,n,void 0,void 0,a):t?s.reload(r?"".concat(t,"?").concat(b(r)):t,n):e.prototype.reload.call(this,t,r,n,o,i,a)},t.prototype.receive=function(t,r,o,i,l){return a(this,void 0,void 0,function(){var a;return n(this,function(n){return a=this.context,r?[2,a.send(r,t)]:[2,e.prototype.receive.call(this,t,void 0,o,i,l)]})})},t.prototype.reloadTarget=function(e,t){this.context.reload(e,t)},t.prototype.closeTarget=function(e){this.context.close(e)},t.prototype.setData=function(e,t,r,o){var i,l,s;return a(this,void 0,void 0,function(){var a,c,u;return n(this,function(n){return a=this.props.store,void 0!==r||void 0!==o?[2,null===(l=null===(i=this.control)||void 0===i?void 0:i.setData)||void 0===l?void 0:l.call(i,e,t,r,o)]:(c=(null==e?void 0:e.total)||(null==e?void 0:e.count),u=null!==(s=e.rows)&&void 0!==s?s:e.items,void 0!==c&&a.updateTotal(parseInt(c,10)),[2,a.updateData(d(d({},e),u?{items:u}:{}),void 0,t)])})})},t.prototype.getData=function(){var e=this.props,t=e.store,r=e.data;return t.getData(r)},t.contextType=I,t}(fe),be=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),l([k({type:"crud",storeType:m.name,isolateScope:!0})],t)}(ge);export{be as CRUDRenderer,ge as CRUDRendererBase,fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DcYi-9oA.js";import{t}from"./react-BW4ssgUo.js";import{a as o,c as r,i as n,n as a,o as i,r as s,s as l,t as d,u as c}from"./tslib.es6-C2q27PUR.js";import{c as p,j as u}from"./function-C8ta9DKb.js";import{$n as h,Ar as m,Dt as g,En as y,Ii as f,Mr as v,Nn as b,Nr as T,Qr as P,Xr as S,Zr as C,an as F,dt as A,fr as I,ft as O,it as Q,kn as R,kr as D,kt as x,li as N,oi as k,qr as M,sn as w,ui as E,vi as L,yr as j}from"./esm-CofciBhy.js";import{t as q}from"./react-dom-DmgFzc6z.js";import{H as B}from"./esm-vG8eylH_.js";import{o as U}from"./PopUp-xCiesfUA.js";import{n as H,t as W}from"./omitBy-CFU0pICA.js";var G=/* @__PURE__ */e(t()),J=/* @__PURE__ */e(q()),K=/* @__PURE__ */e(W()),$=/* @__PURE__ */e(x()),_=/* @__PURE__ */e(y()),V=/* @__PURE__ */e(u()),X=/* @__PURE__ */e(H()),Y=/* @__PURE__ */e(p()),Z=/* @__PURE__ */e(P()),z=["selectedChange","columnSort","columnFilter","columnSearch","columnToggled","orderChange","rowClick","rowDbClick","rowMouseEnter","rowMouseLeave","selected"],ee=function(e){function t(t){var o=e.call(this,t)||this;o.stopingAutoRefresh=!1;var r=t.location,n=t.store,a=t.syncLocation,i=t.pageField,s=t.perPageField;t.parsePrimitiveQuery;var l=o.getParseQueryOptions(t);o.mounted=!0,a&&r&&(r.query||r.search)?n.updateQuery(m(r,l),void 0,i,s):a&&!r&&window.location.search&&n.updateQuery(m(window.location,l),void 0,i,s),o.props.api&&o.props.store.updateData({items:[]});var d=t.mode,c=t.columns;return"table2"===d&&c&&n.updateColumns(c),o}return n(t,e),t.prototype.componentDidMount=function(){var e=this.props,t=e.store,o=e.pickerMode,r=e.loadType,n=e.loadDataOnce,a=e.maxLoadNum;if(r&&!n){var i="more"===r?this.props.perPage||10:this.getPaginationPerPage();t.changePage(t.page,i)}else r||t.changePage(1,a||500);if(this.initQuery({}),o){var s=h(this.props);s&&t.setSelectedItems(s)}},t.prototype.componentDidUpdate=function(e){var t,o,r=this.props,n=e.store;r.parsePrimitiveQuery,e.columns!==r.columns&&n.updateColumns(r.columns),this.props.pickerMode&&I(o=h(this.props),h(e))&&n.setSelectedItems(o);var a=!1;if(e.syncLocation&&e.location&&e.location.search!==r.location.search&&(n.updateQuery(m(r.location,this.getParseQueryOptions(r)),void 0,r.pageField,r.perPageField),a=!(!r.api||!j(n.query,this.lastQuery,!1))),a);else if(e.api&&r.api&&F(e.api,r.api,n.fetchCtxOf(e.data,{pageField:e.pageField,perPageField:e.perPageField}),n.fetchCtxOf(r.data,{pageField:r.pageField,perPageField:r.perPageField})))a=!0;else if(!r.api&&C(r.source)){var i=f(r.source,r.data,"| raw");this.lastData&&this.lastData===i||(n.initFromScope(r.data,r.source,{columns:null!==(t=n.columns)&&void 0!==t?t:r.columns}),this.lastData=i)}a&&this.getData()},t.prototype.componentWillUnmount=function(){this.mounted=!1,clearTimeout(this.timer)},t.prototype.getPaginationPerPage=function(){var e=10,t=this.props,o=t.headerToolbar,r=t.footerToolbar;return R({headerToolbar:o,footerToolbar:r},function(t,o,r){"type"!==o||"pagination"!==t||isNaN(null==r?void 0:r.perPage)||(e=+r.perPage)}),e},t.prototype.getParseQueryOptions=function(e){var t,o=e.parsePrimitiveQuery;return{parsePrimitive:!!(E(o)?null==o?void 0:o.enable:o),primitiveTypes:null!==(t=null==o?void 0:o.types)&&void 0!==t?t:["boolean"]}},t.prototype.controlRef=function(e){for(;e&&e.getWrappedInstance;)e=e.getWrappedInstance();this.control=e},t.prototype.initQuery=function(e){var t=this.props,o=t.store,r=t.orderBy,n=t.orderDir,a=t.loadType,i={};r&&(i.orderBy=r,i.orderDir=n||"asc"),this.handleSearch({query:d(d(d({},i),e),o.query),replaceQuery:!1!==this.props.initFetch,loadMore:"more"===a,resetPage:!1}),o.setPristineQuery()},t.prototype.handleLoadMore=function(){var e=this.props,t=e.store,o=e.perPage,r=void 0===o?10:o;t.changePage(t.page+1,r),this.getData(void 0,void 0,void 0,!0)},t.prototype.handleSearch=function(e){var t,o,r=this.props,n=r.store,a=r.syncLocation,i=r.env,s=r.pageField,l=r.perPageField,c=r.parsePrimitiveQuery,p=this.getParseQueryOptions(this.props),u=e||{},h=u.query,m=u.resetQuery,g=u.replaceQuery,y=u.loadMore,f=u.resetPage;h=d(d({},h),(0,X.default)(null!==(o=null===(t=null==h?void 0:h.__super)||void 0===t?void 0:t.diff)&&void 0!==o?o:{},function(e){return void 0===e})),h=a?v(T(h,void 0,!0)):h,c&&(h=D(h,p)),n.updateQuery(m?d(d({},h),this.props.store.pristineQuery):h,a&&i&&i.updateLocation?function(e){return i.updateLocation(e,!0)}:void 0,s,l,g),f&&n.changePage(1),this.lastQuery=n.query,this.getData(void 0,void 0,void 0,null!=y&&y)},t.prototype.handleStopAutoRefresh=function(){this.timer&&clearTimeout(this.timer),this.stopingAutoRefresh=!0},t.prototype.handleStartAutoRefresh=function(){this.stopingAutoRefresh=!1,this.reload()},t.prototype.reloadTarget=function(e,t){},t.prototype.closeTarget=function(e){},t.prototype.updateQuery=function(e){void 0===e&&(e={}),this.props.store},t.prototype.getData=function(e,t,r,n){var i,s,l;return void 0===r&&(r=!1),a(this,void 0,void 0,function(){var a,d,c,p,u,h,m,g,y,f,v,b,T,P,S,C,F,A,I,O,Q,R;return o(this,function(o){switch(o.label){case 0:return a=this.props,d=a.store,c=a.api,p=a.messages,u=a.pageField,h=a.perPageField,m=a.interval,g=a.stopAutoRefreshWhen,y=a.silentPolling,a.syncLocation,f=a.syncResponse2Query,v=a.keepItemSelectionOnPageChange,b=a.stopAutoRefreshWhenModalIsOpen,T=a.pickerMode,a.env,P=a.loadType,S=a.loadDataOnce,C=a.source,F=a.columns,A=a.perPage,I=a.pullRefresh,!n&&v&&t&&!T&&(d.setSelectedItems([]),d.setUnSelectedItems([])),clearTimeout(this.timer),this.lastQuery=d.query,O=null!=n?n:"more"===P,Q=k(d.data,d.query),O&&A&&d.changePerPage(A),w(c,Q)?[4,d.fetchInitData(c,Q,{successMessage:p&&p.fetchSuccess,errorMessage:p&&p.fetchFailed,autoAppend:!0,forceReload:r,loadDataOnce:S,source:C,silent:e,pageField:u,perPageField:h,loadDataMode:O,dataAppendTo:(null==I?void 0:I.dataAppendTo)||"bottom",syncResponse2Query:f,columns:null!==(i=d.columns)&&void 0!==i?i:F,isTable2:!0,minLoadingTime:null==I?void 0:I.minLoadingTime})]:[3,2];case 1:return null!=(R=o.sent())&&R.ok&&m&&!this.stopingAutoRefresh&&this.mounted&&(!g||!g||!M(g,k(d.data,d.query)))&&(!b||!d.dialogOpen&&!(null===(s=null==d?void 0:d.parentStore)||void 0===s?void 0:s.dialogOpen))&&(this.timer=setTimeout(this.getData.bind(this,y,void 0,!0),Math.max(m,1e3))),[3,3];case 2:C&&d.initFromScope(Q,C,{columns:null!==(l=d.columns)&&void 0!==l?l:F}),o.label=3;case 3:return[2,d.data]}})})},t.prototype.handleChangePage=function(e,t){var o,r=this.props,n=r.store,a=r.syncLocation,i=r.env,s=r.pageField,l=r.perPageField,d=r.autoJumpToTopOnPagerChange,c=((o={})[s||"page"]=e,o);if(t&&(c[l||"perPage"]=t),n.updateQuery(c,a&&(null==i?void 0:i.updateLocation)?i.updateLocation:void 0,s,l),n.changePage(e,t),this.getData(),d&&this.control){(0,J.findDOMNode)(this.control).scrollIntoView();var p=window.scrollY;p&&window.scroll(0,p)}},t.prototype.handleSave=function(e,t,o,r,n,a){var i=this,s=this.props,l=s.store,d=s.quickSaveApi,c=s.quickSaveItemApi,p=s.primaryField,u=s.env,h=s.messages,m=s.reload;if(Array.isArray(e)){if(!w(d))return void(u&&u.alert("CRUD quickSaveApi is required"));var g=k(l.data,{rows:e,rowsDiff:t,indexes:o,rowsOrigin:n});e.length&&e[0].hasOwnProperty(p||"id")&&(g.ids=e.map(function(e){return e[p||"id"]}).join(",")),r&&(g.unModifiedItems=r),l.saveRemote(d,g,{successMessage:h&&h.saveFailed,errorMessage:h&&h.saveSuccess}).then(function(){m&&i.reloadTarget(O(m,g),g),i.getData(void 0,void 0,!0)}).catch(function(){})}else{if(!w(c))return void(u&&u.alert("CRUD quickSaveItemApi is required!"));var y=k(l.data,{item:e,modified:t,origin:n}),f=k(y,e);l.saveRemote(c,f).then(function(){m&&i.reloadTarget(O(m,y),y),i.getData(void 0,void 0,!0)}).catch(function(){null!=a&&a.resetOnFailed&&i.control.reset()})}},t.prototype.handleSaveOrder=function(e,t){var o=this,r=this.props,n=r.store,a=r.saveOrderApi,i=r.orderField,s=r.primaryField,l=r.env,d=r.reload;if(a){var c,p,u=k(n.data),h=[],m=s&&t[0]&&t[0].hasOwnProperty(s);if(m||(u.idMap={}),u.insertAfter={},t.forEach(function(o){if(~e.indexOf(o))if(c){var r=m?c[s]:t.indexOf(c);u.insertAfter[r]=u.insertAfter[r]||[],m||(u.idMap[r]=c),u.insertAfter[r].push(m?o[s]:o)}else h.push(o);else c=o,p=p||o}),p&&h.length){var g=m?p[s]:t.indexOf(p);m||(u.idMap[g]=p),u.insertBefore={},u.insertBefore[g]=h.map(function(e){return m?e[s]:e})}else if(h.length){var y=h[0],f=m?y[s]:t.indexOf(y);m||(u.idMap[f]=y),u.insertAfter[f]=h.slice(1).map(function(e){return m?e[s]:e})}if(i){var v=(n.page-1)*n.perPage||0;t=t.map(function(e,t){var o;return N(e,((o={})[i]=v+t+1,o))})}u.rows=t.concat(),m&&(u.ids=t.map(function(e){return e[s]}).join(",")),m&&i&&(u.order=t.map(function(e){return(0,$.default)(e,[s,i])})),w(a,u)&&n.saveRemote(a,u).then(function(){d&&o.reloadTarget(O(d,u),u),o.getData(void 0,void 0,!0)}).catch(function(){})}else l&&l.alert("CRUD saveOrderApi is required!")},t.prototype.handleSelect=function(e,t){var o=this.props,r=o.store,n=o.keepItemSelectionOnPageChange,a=o.primaryField,i=o.multiple,s=o.pickerMode,l=o.onSelect,d=e,c=t;if(I(r.selectedItemsAsArray,d)){if(n&&r.selectedItems.length){var p=r.selectedItems.concat(),u=r.unSelectedItems.concat();e.forEach(function(e){var t=(0,_.default)(p,function(t){return t===e||t[a||"id"]&&t[a||"id"]==e[a||"id"]});~t?p[t]=e:p.push(e);var o=(0,_.default)(u,function(t){return t===e||t[a||"id"]&&t[a||"id"]==e[a||"id"]});~o&&u.splice(o,1)}),t.forEach(function(e){var t=(0,_.default)(u,function(t){return t===e||t[a||"id"]&&t[a||"id"]==e[a||"id"]}),o=(0,_.default)(p,function(t){return t===e||t[a||"id"]&&t[a||"id"]==e[a||"id"]});~t?u[t]=e:u.push(e),!~t&&~o&&p.splice(o,1)}),d=p,c=u}s&&!1===i&&d.length>1&&c.push.apply(c,d.splice(0,d.length-1)),r.setSelectedItems(d),r.setUnSelectedItems(c),l&&l(d)}},t.prototype.handleQuerySearch=function(e,t){var o;void 0===t&&(t=!1);var r=this.props,n=r.store,a=r.syncLocation,i=r.env,s=r.pageField,l=r.perPageField;return n.updateQuery(d(d({},e),((o={})[s||"page"]=1,o)),a&&i&&i.updateLocation?i.updateLocation:void 0,s,l),this.getData(void 0,void 0,t)},t.prototype.reload=function(e,t){return t?this.receive(t):this.getData(void 0,void 0,!0)},t.prototype.receive=function(e){return this.handleQuerySearch(e,!0)},t.prototype.doAction=function(e,t,o){if(void 0===o&&(o=!1),e.actionType&&["stopAutoRefresh","reload","search","startAutoRefresh","loadMore"].includes(e.actionType))return this["handle".concat((0,V.default)(e.actionType))](t)},t.prototype.handleAction=function(e,t,o,r,n){return void 0===r&&(r=!1),["stopAutoRefresh","reload","search","startAutoRefresh","loadMore"].includes(t.actionType)?this.doAction(t,o,r):this.props.onAction(e,t,o,r,n||this.context)},t.prototype.dispatchEvent=function(e,t,o,r){if("selectedChange"===e&&this.control===o){var n=this.props.store;t.selectedItems=n.selectedItems.concat(),t.unSelectedItems=n.unSelectedItems.concat()}return this.props.dispatchEvent(e,t,o,r)},t.prototype.unSelectItem=function(e,t){var o=this.props.store,r=o.selectedItems.concat(),n=o.unSelectedItems.concat(),a=r.indexOf(e);~a&&n.push.apply(n,r.splice(a,1)),o.setSelectedItems(r),o.setUnSelectedItems(n)},t.prototype.clearSelection=function(){var e=this.props.store,t=e.selectedItems.concat(),o=e.unSelectedItems.concat();e.setSelectedItems([]),e.setUnSelectedItems(o.concat(t))},t.prototype.toggleAllColumns=function(e){var t=this.props.store;t.updateColumns(t.columns.map(function(t){return d(d({},t),{toggled:e})}))},t.prototype.toggleToggle=function(e){var t=this.props.store,o=t.columns[e].toggled;t.updateColumns(t.columns.map(function(t,r){return d(d({},t),{toggled:e===r?!o:!1!==t.toggled})}))},t.prototype.handlePullRefresh=function(){return a(this,void 0,void 0,function(){var e,t,r,n;return o(this,function(o){switch(o.label){case 0:return e=this.props,t=e.dispatchEvent,r=e.data,[4,t("pullRefresh",r)];case 1:return(null==(n=o.sent())?void 0:n.prevented)||this.handleLoadMore(),[2]}})})},t.prototype.renderChild=function(e,t,o){void 0===o&&(o={});var r,n=this.props,a=n.render,i=n.store,s=n.primaryField,l=void 0===s?"id":s,c=i.selectedItems,p=i.unSelectedItems,u=i.items;r=/^filter/.test(e)?k(k(i.filterData,i.getData(this.props.data)),{}):k(i.mergedData,{items:u.concat(),selectedItems:c.concat(),unSelectedItems:p.concat(),ids:c.map(function(e){return e.hasOwnProperty(l)?e[l]:null}).filter(function(e){return e}).join(",")});var h={activePage:i.page,lastPage:i.lastPage,perPage:i.perPage,total:i.total,onPageChange:this.handleChangePage,cols:i.columns,toggleAllColumns:this.toggleAllColumns,toggleToggle:this.toggleToggle,onQuery:this.handleQuerySearch};return t.type,a(e,t,d(d({data:r},o),h))},t.prototype.renderToolbar=function(e,t){var o=this;return t?(t=[].concat(t)).map(function(t,r){return o.renderChild("".concat(e,"/").concat(r),t,{key:r+""})}):null},t.prototype.renderFilter=function(e){var t=this;if(!e||Array.isArray(e)&&0===e.length)return null;var o=Array.isArray(e)?e:E(e)&&null!=e.type?[e]:[];return o.length<1?null:o.map(function(e,o){return t.renderChild("filter/".concat(o),e,d({key:o+"filter",data:t.props.store.filterData,onSubmit:function(e){return t.handleSearch({query:e,resetPage:!0})},onReset:function(e){var o={};Object.keys(e).forEach(function(e){return o[e]=""}),t.handleSearch({query:o,resetQuery:!0,replaceQuery:!0,resetPage:!0})}},t.props.mobileUI?{columnCount:1,mode:"normal",collapsible:!0,title:{type:"container",body:[{type:"icon",icon:"column-filter",className:"icon mr-2"},e.title||""]}}:{}))})},t.prototype.renderSelection=function(){var e=this,t=this.props,o=t.store,r=t.classnames,n=t.labelField,a=t.labelTpl,i=t.primaryField,s=t.translate,l=t.env;return o.selectedItems.length?G.createElement("div",{className:r("Crud-selection")},G.createElement("div",{className:r("Crud-selectionLabel")},s("CRUD.selected",{total:o.selectedItems.length})),o.selectedItems.map(function(t,o){return G.createElement("div",{key:o,className:r("Crud-value")},G.createElement("span",{"data-tooltip":s("delete"),"data-position":"bottom",className:r("Crud-valueIcon"),onClick:e.unSelectItem.bind(e,t,o)},"×"),G.createElement("span",{className:r("Crud-valueLabel")},a?G.createElement(U,{html:S(a,t),filterHtml:l.filterHtml}):L(t,n||"label")||L(t,i||"id")))}),G.createElement("a",{onClick:this.clearSelection.bind(this),className:r("Crud-selectionClear")},s("clear"))):null},t.prototype.transformTable2cards=function(){for(var e,t=this.props,o=t.store,r=t.columns,n=t.card,a=[],i=t.mobileMode.fieldCount||4,s=[],p="",u=(null!==(e=o.columns)&&void 0!==e?e:r)||[],h=0;h<u.length;h++){var m=u[h];if((0,Y.default)(m))if("operation"===m.type)s.push.apply(s,c([],l((null==m?void 0:m.buttons)||[]),!1));else if("button"===m.type&&"operation"===m.name)s.push(m);else{if(!m.label&&m.title&&(m.label=m.title),"static-image"===m.type&&!p){p="${".concat(m.name,"}");continue}a.length<i&&("static-image"===m.type&&m.title&&delete m.title,a.push(m))}}return a.length?{columnsCount:1,type:"cards",card:d(d(d({},n),{body:a,actions:s}),p?{media:{type:"image",url:p,position:"right",className:""},mediaActionPosition:"outside"}:{})}:null},t.prototype.transMobileHeaderToolbar=function(e,t){var o=0,r={},n={},a=null;function i(e,t){Array.isArray(e)?e.forEach(function(e){return i(e,t)}):e&&"object"==typeof e&&("button"===e.type?(o++,"新增"===e.label&&(r=e,n=t)):"search-box"===e.type&&(a=e),(e.items||e.body)&&i(e.items||e.body,e))}e.forEach(function(e){i(e)}),1===o&&r&&(r.label="",r.icon="plus",r.className||(r.className=""),r.className+=" is-fixed-right-bottom",n&&(n.className||(n.className=""),n.className+=" is-fixed-right-bottom-wrapper")),a&&(0===o||1===o&&r)&&(0,Z.default)(this.props.filterSchema)&&t()},t.prototype.render=function(){var e,t=this.props,o=t.columns,n=t.className,a=t.style,i=t.bodyClassName,s=t.filter,l=t.render,c=t.store,p=t.mode,u=void 0===p?"table2":p;t.syncLocation,t.children,t.bulkActions;var h=t.pickerMode,m=t.selectable,g=t.multiple;t.valueField;var y=t.primaryField;t.value,t.hideQuickSaveBtn;var f=t.itemActions,v=t.classnames,b=t.keepItemSelectionOnPageChange,T=t.maxKeepItemSelectionLength,P=t.onEvent;t.onAction;var S=t.popOverContainer,C=t.translate;t.onQuery;var F=t.autoGenerateFilter;t.onSelect;var A=t.autoFillHeight,I=t.showSelection,O=t.headerToolbar,Q=t.footerToolbar;t.columnsTogglable;var R,D=t.headerToolbarClassName,x=t.footerToolbarClassName,N=t.id,k=t.testIdBuilder,M=t.mobileMode,w=t.mobileUI,E=t.pullRefresh,L=r(t,["columns","className","style","bodyClassName","filter","render","store","mode","syncLocation","children","bulkActions","pickerMode","selectable","multiple","valueField","primaryField","value","hideQuickSaveBtn","itemActions","classnames","keepItemSelectionOnPageChange","maxKeepItemSelectionLength","onEvent","onAction","popOverContainer","translate","onQuery","autoGenerateFilter","onSelect","autoFillHeight","showSelection","headerToolbar","footerToolbar","columnsTogglable","headerToolbarClassName","footerToolbarClassName","id","testIdBuilder","mobileMode","mobileUI","pullRefresh"]),j=!1,q=null;if(M&&w&&u.includes("table")){var U=this.transformTable2cards();"string"==typeof M&&"cards"===M?U&&(q=U):"object"==typeof M&&(q=d(d(d({},U),M),{card:d(d({},null==U?void 0:U.card),M.card)})),q&&this.transMobileHeaderToolbar(O,function(){j=!0}),q&&!(null==E?void 0:E.disabled)&&(R=d(d({normalText:C("pullRefresh.crud2NormalText"),pullingText:C("pullRefresh.crud2PullingText"),loosingText:C("pullRefresh.crud2LoosingText")},E),{disabled:!1}))}else R=E;var H=l("body",d(d(d({},L),{onEvent:(0,K.default)(P,function(e,t){return!z.includes(t)}),type:u,columns:u.startsWith("table")?c.columns||o:void 0,id:N}),q),{key:"body",className:v("Crud2-body",i),ref:this.controlRef,autoGenerateFilter:!s&&F,autoFillHeight:A,checkAll:!1,selectable:!!(null!=m?m:h),itemActions:f,multiple:g,columnsTogglable:!1,selected:h||b?c.selectedItemsAsArray:void 0,keepItemSelectionOnPageChange:b,maxKeepItemSelectionLength:T,primaryField:y,testIdBuilder:k,items:c.data.items,query:c.query,orderBy:c.query.orderBy,orderDir:c.query.orderDir,popOverContainer:S,onSave:this.handleSave.bind(this),onSaveOrder:this.handleSaveOrder,onSearch:this.handleQuerySearch,onSort:this.handleQuerySearch,onSelect:this.handleSelect,onAction:this.handleAction,dispatchEvent:this.dispatchEvent,data:c.mergedData,loading:c.loading,host:this});return G.createElement("div",d({className:v("Crud2",n,{"is-loading":c.loading,"is-mobile":w,"is-mobile-cards":"cards"===M||"cards"===(null==q?void 0:q.type)}),style:a,"data-id":N,"data-role":"container"},null==k?void 0:k.getTestId()),G.createElement("div",d({className:v("Crud2-filter")},null==k?void 0:k.getChild("filter").getTestId()),this.renderFilter(s)),G.createElement("div",{className:v("Crud2-toolbar","Crud2-header-toolbar",D,{"is-sticky":j})},this.renderToolbar("headerToolbar",O)),I&&b&&!1!==g?this.renderSelection():null,w&&R&&!R.disabled?G.createElement(B,d({},R,{translate:C,onRefresh:this.handlePullRefresh,direction:null!==(e=R.gestureDirection)&&void 0!==e?e:"up",loading:c.loading,completed:!c.loading&&c.lastPage>0&&c.page>=c.lastPage,completedText:c.total>0?void 0:""}),H):G.createElement(G.Fragment,null,H,G.createElement("div",{className:v("Crud2-toolbar","Crud2-footer-toolbar",x)},this.renderToolbar("footerToolbar",Q))))},t.propsList=["mode","syncLocation","value","multiple","valueField","pageField","perPageField","hideQuickSaveBtn","autoJumpToTopOnPagerChange","interval","silentPolling","stopAutoRefreshWhen","stopAutoRefreshWhenModalIsOpen","api","headerToolbar","footerToolbar","autoGenerateFilter","syncResponse2Query","keepItemSelectionOnPageChange","source","onChange","onInit","onSaved","onQuery","autoFillHeight","showSelection","headerToolbarClassName","footerToolbarClassName","primaryField","parsePrimitiveQuery","pullRefresh"],t.defaultProps={toolbarInline:!0,syncLocation:!0,hideQuickSaveBtn:!1,autoJumpToTopOnPagerChange:!0,silentPolling:!1,autoFillHeight:!1,showSelection:!0,primaryField:"id",parsePrimitiveQuery:!0,pullRefresh:{disabled:!1,showIcon:!0,showText:!0,iconType:"auto",color:"#777777",dataAppendTo:"bottom",gestureDirection:"up",minLoadingTime:0,contentText:{normalText:"点击加载更多",pullingText:"加载中...",loosingText:"释放立即刷新",loadingText:"加载中...",successText:"加载成功",completedText:"没有更多数据了"}}},s([b,i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",void 0)],t.prototype,"getPaginationPerPage",null),s([b,i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",void 0)],t.prototype,"controlRef",null),s([b,i("design:type",Function),i("design:paramtypes",[Number,Number]),i("design:returntype",void 0)],t.prototype,"handleChangePage",null),s([b,i("design:type",Function),i("design:paramtypes",[Array,Array]),i("design:returntype",void 0)],t.prototype,"handleSaveOrder",null),s([b,i("design:type",Function),i("design:paramtypes",[Array,Array]),i("design:returntype",void 0)],t.prototype,"handleSelect",null),s([b,i("design:type",Function),i("design:paramtypes",[Object,Boolean]),i("design:returntype",void 0)],t.prototype,"handleQuerySearch",null),s([b,i("design:type",Function),i("design:paramtypes",[Object,Object,Boolean]),i("design:returntype",void 0)],t.prototype,"doAction",null),s([b,i("design:type",Function),i("design:paramtypes",[Object,Object,Object,Boolean,Object]),i("design:returntype",void 0)],t.prototype,"handleAction",null),s([b,i("design:type",Function),i("design:paramtypes",[Object,Object,G.Component,Object]),i("design:returntype",void 0)],t.prototype,"dispatchEvent",null),s([b,i("design:type",Function),i("design:paramtypes",[Boolean]),i("design:returntype",void 0)],t.prototype,"toggleAllColumns",null),s([b,i("design:type",Function),i("design:paramtypes",[Number]),i("design:returntype",void 0)],t.prototype,"toggleToggle",null),s([b,i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",Promise)],t.prototype,"handlePullRefresh",null),s([b,i("design:type",Function),i("design:paramtypes",[String,Object,Object]),i("design:returntype",void 0)],t.prototype,"renderChild",null),t}(G.Component),te=function(e){function t(t,o){var r=e.call(this,t)||this;return o.registerComponent(r),r}return n(t,e),t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this),this.context.unRegisterComponent(this)},t.prototype.reload=function(t,r,n){return a(this,void 0,void 0,function(){var a;return o(this,function(o){return a=this.context,t?[2,a.reload(r?"".concat(t,"?").concat(T(r)):t,n)]:[2,e.prototype.reload.call(this,t,r)]})})},t.prototype.receive=function(t,r){return a(this,void 0,void 0,function(){var n;return o(this,function(o){return n=this.context,r?[2,n.send(r,t)]:[2,e.prototype.receive.call(this,t)]})})},t.prototype.reloadTarget=function(e,t){this.context.reload(e,t)},t.prototype.closeTarget=function(e){this.context.close(e)},t.contextType=A,t}(ee),oe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),s([Q({type:"crud2",storeType:g.name,isolateScope:!0})],t)}(te);export{oe as CRUD2Renderer,te as CRUD2RendererBase,ee as default};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DcYi-9oA.js";import{t}from"./react-BW4ssgUo.js";import{a as o,c as r,i as n,n as a,o as i,r as s,s as l,t as d,u as c}from"./tslib.es6-C2q27PUR.js";import{c as p,j as u}from"./function-C8ta9DKb.js";import{$n as h,Ar as m,Dt as g,En as y,Ii as f,Mr as v,Nn as b,Nr as T,Qr as P,Xr as S,Zr as C,an as F,dt as A,fr as I,ft as O,it as Q,kn as R,kr as D,kt as x,li as N,oi as k,qr as M,sn as w,ui as E,vi as L,yr as j}from"./esm-BMvKJM5q.js";import{t as q}from"./react-dom-DmgFzc6z.js";import{H as B}from"./esm-BbZME5Ac.js";import{o as U}from"./PopUp-DaheG-Vv.js";import{n as H,t as W}from"./omitBy-NMzUUhXs.js";var G=/* @__PURE__ */e(t()),J=/* @__PURE__ */e(q()),K=/* @__PURE__ */e(W()),$=/* @__PURE__ */e(x()),_=/* @__PURE__ */e(y()),V=/* @__PURE__ */e(u()),X=/* @__PURE__ */e(H()),Y=/* @__PURE__ */e(p()),Z=/* @__PURE__ */e(P()),z=["selectedChange","columnSort","columnFilter","columnSearch","columnToggled","orderChange","rowClick","rowDbClick","rowMouseEnter","rowMouseLeave","selected"],ee=function(e){function t(t){var o=e.call(this,t)||this;o.stopingAutoRefresh=!1;var r=t.location,n=t.store,a=t.syncLocation,i=t.pageField,s=t.perPageField;t.parsePrimitiveQuery;var l=o.getParseQueryOptions(t);o.mounted=!0,a&&r&&(r.query||r.search)?n.updateQuery(m(r,l),void 0,i,s):a&&!r&&window.location.search&&n.updateQuery(m(window.location,l),void 0,i,s),o.props.api&&o.props.store.updateData({items:[]});var d=t.mode,c=t.columns;return"table2"===d&&c&&n.updateColumns(c),o}return n(t,e),t.prototype.componentDidMount=function(){var e=this.props,t=e.store,o=e.pickerMode,r=e.loadType,n=e.loadDataOnce,a=e.maxLoadNum;if(r&&!n){var i="more"===r?this.props.perPage||10:this.getPaginationPerPage();t.changePage(t.page,i)}else r||t.changePage(1,a||500);if(this.initQuery({}),o){var s=h(this.props);s&&t.setSelectedItems(s)}},t.prototype.componentDidUpdate=function(e){var t,o,r=this.props,n=e.store;r.parsePrimitiveQuery,e.columns!==r.columns&&n.updateColumns(r.columns),this.props.pickerMode&&I(o=h(this.props),h(e))&&n.setSelectedItems(o);var a=!1;if(e.syncLocation&&e.location&&e.location.search!==r.location.search&&(n.updateQuery(m(r.location,this.getParseQueryOptions(r)),void 0,r.pageField,r.perPageField),a=!(!r.api||!j(n.query,this.lastQuery,!1))),a);else if(e.api&&r.api&&F(e.api,r.api,n.fetchCtxOf(e.data,{pageField:e.pageField,perPageField:e.perPageField}),n.fetchCtxOf(r.data,{pageField:r.pageField,perPageField:r.perPageField})))a=!0;else if(!r.api&&C(r.source)){var i=f(r.source,r.data,"| raw");this.lastData&&this.lastData===i||(n.initFromScope(r.data,r.source,{columns:null!==(t=n.columns)&&void 0!==t?t:r.columns}),this.lastData=i)}a&&this.getData()},t.prototype.componentWillUnmount=function(){this.mounted=!1,clearTimeout(this.timer)},t.prototype.getPaginationPerPage=function(){var e=10,t=this.props,o=t.headerToolbar,r=t.footerToolbar;return R({headerToolbar:o,footerToolbar:r},function(t,o,r){"type"!==o||"pagination"!==t||isNaN(null==r?void 0:r.perPage)||(e=+r.perPage)}),e},t.prototype.getParseQueryOptions=function(e){var t,o=e.parsePrimitiveQuery;return{parsePrimitive:!!(E(o)?null==o?void 0:o.enable:o),primitiveTypes:null!==(t=null==o?void 0:o.types)&&void 0!==t?t:["boolean"]}},t.prototype.controlRef=function(e){for(;e&&e.getWrappedInstance;)e=e.getWrappedInstance();this.control=e},t.prototype.initQuery=function(e){var t=this.props,o=t.store,r=t.orderBy,n=t.orderDir,a=t.loadType,i={};r&&(i.orderBy=r,i.orderDir=n||"asc"),this.handleSearch({query:d(d(d({},i),e),o.query),replaceQuery:!1!==this.props.initFetch,loadMore:"more"===a,resetPage:!1}),o.setPristineQuery()},t.prototype.handleLoadMore=function(){var e=this.props,t=e.store,o=e.perPage,r=void 0===o?10:o;t.changePage(t.page+1,r),this.getData(void 0,void 0,void 0,!0)},t.prototype.handleSearch=function(e){var t,o,r=this.props,n=r.store,a=r.syncLocation,i=r.env,s=r.pageField,l=r.perPageField,c=r.parsePrimitiveQuery,p=this.getParseQueryOptions(this.props),u=e||{},h=u.query,m=u.resetQuery,g=u.replaceQuery,y=u.loadMore,f=u.resetPage;h=d(d({},h),(0,X.default)(null!==(o=null===(t=null==h?void 0:h.__super)||void 0===t?void 0:t.diff)&&void 0!==o?o:{},function(e){return void 0===e})),h=a?v(T(h,void 0,!0)):h,c&&(h=D(h,p)),n.updateQuery(m?d(d({},h),this.props.store.pristineQuery):h,a&&i&&i.updateLocation?function(e){return i.updateLocation(e,!0)}:void 0,s,l,g),f&&n.changePage(1),this.lastQuery=n.query,this.getData(void 0,void 0,void 0,null!=y&&y)},t.prototype.handleStopAutoRefresh=function(){this.timer&&clearTimeout(this.timer),this.stopingAutoRefresh=!0},t.prototype.handleStartAutoRefresh=function(){this.stopingAutoRefresh=!1,this.reload()},t.prototype.reloadTarget=function(e,t){},t.prototype.closeTarget=function(e){},t.prototype.updateQuery=function(e){void 0===e&&(e={}),this.props.store},t.prototype.getData=function(e,t,r,n){var i,s,l;return void 0===r&&(r=!1),a(this,void 0,void 0,function(){var a,d,c,p,u,h,m,g,y,f,v,b,T,P,S,C,F,A,I,O,Q,R;return o(this,function(o){switch(o.label){case 0:return a=this.props,d=a.store,c=a.api,p=a.messages,u=a.pageField,h=a.perPageField,m=a.interval,g=a.stopAutoRefreshWhen,y=a.silentPolling,a.syncLocation,f=a.syncResponse2Query,v=a.keepItemSelectionOnPageChange,b=a.stopAutoRefreshWhenModalIsOpen,T=a.pickerMode,a.env,P=a.loadType,S=a.loadDataOnce,C=a.source,F=a.columns,A=a.perPage,I=a.pullRefresh,!n&&v&&t&&!T&&(d.setSelectedItems([]),d.setUnSelectedItems([])),clearTimeout(this.timer),this.lastQuery=d.query,O=null!=n?n:"more"===P,Q=k(d.data,d.query),O&&A&&d.changePerPage(A),w(c,Q)?[4,d.fetchInitData(c,Q,{successMessage:p&&p.fetchSuccess,errorMessage:p&&p.fetchFailed,autoAppend:!0,forceReload:r,loadDataOnce:S,source:C,silent:e,pageField:u,perPageField:h,loadDataMode:O,dataAppendTo:(null==I?void 0:I.dataAppendTo)||"bottom",syncResponse2Query:f,columns:null!==(i=d.columns)&&void 0!==i?i:F,isTable2:!0,minLoadingTime:null==I?void 0:I.minLoadingTime})]:[3,2];case 1:return null!=(R=o.sent())&&R.ok&&m&&!this.stopingAutoRefresh&&this.mounted&&(!g||!g||!M(g,k(d.data,d.query)))&&(!b||!d.dialogOpen&&!(null===(s=null==d?void 0:d.parentStore)||void 0===s?void 0:s.dialogOpen))&&(this.timer=setTimeout(this.getData.bind(this,y,void 0,!0),Math.max(m,1e3))),[3,3];case 2:C&&d.initFromScope(Q,C,{columns:null!==(l=d.columns)&&void 0!==l?l:F}),o.label=3;case 3:return[2,d.data]}})})},t.prototype.handleChangePage=function(e,t){var o,r=this.props,n=r.store,a=r.syncLocation,i=r.env,s=r.pageField,l=r.perPageField,d=r.autoJumpToTopOnPagerChange,c=((o={})[s||"page"]=e,o);if(t&&(c[l||"perPage"]=t),n.updateQuery(c,a&&(null==i?void 0:i.updateLocation)?i.updateLocation:void 0,s,l),n.changePage(e,t),this.getData(),d&&this.control){(0,J.findDOMNode)(this.control).scrollIntoView();var p=window.scrollY;p&&window.scroll(0,p)}},t.prototype.handleSave=function(e,t,o,r,n,a){var i=this,s=this.props,l=s.store,d=s.quickSaveApi,c=s.quickSaveItemApi,p=s.primaryField,u=s.env,h=s.messages,m=s.reload;if(Array.isArray(e)){if(!w(d))return void(u&&u.alert("CRUD quickSaveApi is required"));var g=k(l.data,{rows:e,rowsDiff:t,indexes:o,rowsOrigin:n});e.length&&e[0].hasOwnProperty(p||"id")&&(g.ids=e.map(function(e){return e[p||"id"]}).join(",")),r&&(g.unModifiedItems=r),l.saveRemote(d,g,{successMessage:h&&h.saveFailed,errorMessage:h&&h.saveSuccess}).then(function(){m&&i.reloadTarget(O(m,g),g),i.getData(void 0,void 0,!0)}).catch(function(){})}else{if(!w(c))return void(u&&u.alert("CRUD quickSaveItemApi is required!"));var y=k(l.data,{item:e,modified:t,origin:n}),f=k(y,e);l.saveRemote(c,f).then(function(){m&&i.reloadTarget(O(m,y),y),i.getData(void 0,void 0,!0)}).catch(function(){null!=a&&a.resetOnFailed&&i.control.reset()})}},t.prototype.handleSaveOrder=function(e,t){var o=this,r=this.props,n=r.store,a=r.saveOrderApi,i=r.orderField,s=r.primaryField,l=r.env,d=r.reload;if(a){var c,p,u=k(n.data),h=[],m=s&&t[0]&&t[0].hasOwnProperty(s);if(m||(u.idMap={}),u.insertAfter={},t.forEach(function(o){if(~e.indexOf(o))if(c){var r=m?c[s]:t.indexOf(c);u.insertAfter[r]=u.insertAfter[r]||[],m||(u.idMap[r]=c),u.insertAfter[r].push(m?o[s]:o)}else h.push(o);else c=o,p=p||o}),p&&h.length){var g=m?p[s]:t.indexOf(p);m||(u.idMap[g]=p),u.insertBefore={},u.insertBefore[g]=h.map(function(e){return m?e[s]:e})}else if(h.length){var y=h[0],f=m?y[s]:t.indexOf(y);m||(u.idMap[f]=y),u.insertAfter[f]=h.slice(1).map(function(e){return m?e[s]:e})}if(i){var v=(n.page-1)*n.perPage||0;t=t.map(function(e,t){var o;return N(e,((o={})[i]=v+t+1,o))})}u.rows=t.concat(),m&&(u.ids=t.map(function(e){return e[s]}).join(",")),m&&i&&(u.order=t.map(function(e){return(0,$.default)(e,[s,i])})),w(a,u)&&n.saveRemote(a,u).then(function(){d&&o.reloadTarget(O(d,u),u),o.getData(void 0,void 0,!0)}).catch(function(){})}else l&&l.alert("CRUD saveOrderApi is required!")},t.prototype.handleSelect=function(e,t){var o=this.props,r=o.store,n=o.keepItemSelectionOnPageChange,a=o.primaryField,i=o.multiple,s=o.pickerMode,l=o.onSelect,d=e,c=t;if(I(r.selectedItemsAsArray,d)){if(n&&r.selectedItems.length){var p=r.selectedItems.concat(),u=r.unSelectedItems.concat();e.forEach(function(e){var t=(0,_.default)(p,function(t){return t===e||t[a||"id"]&&t[a||"id"]==e[a||"id"]});~t?p[t]=e:p.push(e);var o=(0,_.default)(u,function(t){return t===e||t[a||"id"]&&t[a||"id"]==e[a||"id"]});~o&&u.splice(o,1)}),t.forEach(function(e){var t=(0,_.default)(u,function(t){return t===e||t[a||"id"]&&t[a||"id"]==e[a||"id"]}),o=(0,_.default)(p,function(t){return t===e||t[a||"id"]&&t[a||"id"]==e[a||"id"]});~t?u[t]=e:u.push(e),!~t&&~o&&p.splice(o,1)}),d=p,c=u}s&&!1===i&&d.length>1&&c.push.apply(c,d.splice(0,d.length-1)),r.setSelectedItems(d),r.setUnSelectedItems(c),l&&l(d)}},t.prototype.handleQuerySearch=function(e,t){var o;void 0===t&&(t=!1);var r=this.props,n=r.store,a=r.syncLocation,i=r.env,s=r.pageField,l=r.perPageField;return n.updateQuery(d(d({},e),((o={})[s||"page"]=1,o)),a&&i&&i.updateLocation?i.updateLocation:void 0,s,l),this.getData(void 0,void 0,t)},t.prototype.reload=function(e,t){return t?this.receive(t):this.getData(void 0,void 0,!0)},t.prototype.receive=function(e){return this.handleQuerySearch(e,!0)},t.prototype.doAction=function(e,t,o){if(void 0===o&&(o=!1),e.actionType&&["stopAutoRefresh","reload","search","startAutoRefresh","loadMore"].includes(e.actionType))return this["handle".concat((0,V.default)(e.actionType))](t)},t.prototype.handleAction=function(e,t,o,r,n){return void 0===r&&(r=!1),["stopAutoRefresh","reload","search","startAutoRefresh","loadMore"].includes(t.actionType)?this.doAction(t,o,r):this.props.onAction(e,t,o,r,n||this.context)},t.prototype.dispatchEvent=function(e,t,o,r){if("selectedChange"===e&&this.control===o){var n=this.props.store;t.selectedItems=n.selectedItems.concat(),t.unSelectedItems=n.unSelectedItems.concat()}return this.props.dispatchEvent(e,t,o,r)},t.prototype.unSelectItem=function(e,t){var o=this.props.store,r=o.selectedItems.concat(),n=o.unSelectedItems.concat(),a=r.indexOf(e);~a&&n.push.apply(n,r.splice(a,1)),o.setSelectedItems(r),o.setUnSelectedItems(n)},t.prototype.clearSelection=function(){var e=this.props.store,t=e.selectedItems.concat(),o=e.unSelectedItems.concat();e.setSelectedItems([]),e.setUnSelectedItems(o.concat(t))},t.prototype.toggleAllColumns=function(e){var t=this.props.store;t.updateColumns(t.columns.map(function(t){return d(d({},t),{toggled:e})}))},t.prototype.toggleToggle=function(e){var t=this.props.store,o=t.columns[e].toggled;t.updateColumns(t.columns.map(function(t,r){return d(d({},t),{toggled:e===r?!o:!1!==t.toggled})}))},t.prototype.handlePullRefresh=function(){return a(this,void 0,void 0,function(){var e,t,r,n;return o(this,function(o){switch(o.label){case 0:return e=this.props,t=e.dispatchEvent,r=e.data,[4,t("pullRefresh",r)];case 1:return(null==(n=o.sent())?void 0:n.prevented)||this.handleLoadMore(),[2]}})})},t.prototype.renderChild=function(e,t,o){void 0===o&&(o={});var r,n=this.props,a=n.render,i=n.store,s=n.primaryField,l=void 0===s?"id":s,c=i.selectedItems,p=i.unSelectedItems,u=i.items;r=/^filter/.test(e)?k(k(i.filterData,i.getData(this.props.data)),{}):k(i.mergedData,{items:u.concat(),selectedItems:c.concat(),unSelectedItems:p.concat(),ids:c.map(function(e){return e.hasOwnProperty(l)?e[l]:null}).filter(function(e){return e}).join(",")});var h={activePage:i.page,lastPage:i.lastPage,perPage:i.perPage,total:i.total,onPageChange:this.handleChangePage,cols:i.columns,toggleAllColumns:this.toggleAllColumns,toggleToggle:this.toggleToggle,onQuery:this.handleQuerySearch};return t.type,a(e,t,d(d({data:r},o),h))},t.prototype.renderToolbar=function(e,t){var o=this;return t?(t=[].concat(t)).map(function(t,r){return o.renderChild("".concat(e,"/").concat(r),t,{key:r+""})}):null},t.prototype.renderFilter=function(e){var t=this;if(!e||Array.isArray(e)&&0===e.length)return null;var o=Array.isArray(e)?e:E(e)&&null!=e.type?[e]:[];return o.length<1?null:o.map(function(e,o){return t.renderChild("filter/".concat(o),e,d({key:o+"filter",data:t.props.store.filterData,onSubmit:function(e){return t.handleSearch({query:e,resetPage:!0})},onReset:function(e){var o={};Object.keys(e).forEach(function(e){return o[e]=""}),t.handleSearch({query:o,resetQuery:!0,replaceQuery:!0,resetPage:!0})}},t.props.mobileUI?{columnCount:1,mode:"normal",collapsible:!0,title:{type:"container",body:[{type:"icon",icon:"column-filter",className:"icon mr-2"},e.title||""]}}:{}))})},t.prototype.renderSelection=function(){var e=this,t=this.props,o=t.store,r=t.classnames,n=t.labelField,a=t.labelTpl,i=t.primaryField,s=t.translate,l=t.env;return o.selectedItems.length?G.createElement("div",{className:r("Crud-selection")},G.createElement("div",{className:r("Crud-selectionLabel")},s("CRUD.selected",{total:o.selectedItems.length})),o.selectedItems.map(function(t,o){return G.createElement("div",{key:o,className:r("Crud-value")},G.createElement("span",{"data-tooltip":s("delete"),"data-position":"bottom",className:r("Crud-valueIcon"),onClick:e.unSelectItem.bind(e,t,o)},"×"),G.createElement("span",{className:r("Crud-valueLabel")},a?G.createElement(U,{html:S(a,t),filterHtml:l.filterHtml}):L(t,n||"label")||L(t,i||"id")))}),G.createElement("a",{onClick:this.clearSelection.bind(this),className:r("Crud-selectionClear")},s("clear"))):null},t.prototype.transformTable2cards=function(){for(var e,t=this.props,o=t.store,r=t.columns,n=t.card,a=[],i=t.mobileMode.fieldCount||4,s=[],p="",u=(null!==(e=o.columns)&&void 0!==e?e:r)||[],h=0;h<u.length;h++){var m=u[h];if((0,Y.default)(m))if("operation"===m.type)s.push.apply(s,c([],l((null==m?void 0:m.buttons)||[]),!1));else if("button"===m.type&&"operation"===m.name)s.push(m);else{if(!m.label&&m.title&&(m.label=m.title),"static-image"===m.type&&!p){p="${".concat(m.name,"}");continue}a.length<i&&("static-image"===m.type&&m.title&&delete m.title,a.push(m))}}return a.length?{columnsCount:1,type:"cards",card:d(d(d({},n),{body:a,actions:s}),p?{media:{type:"image",url:p,position:"right",className:""},mediaActionPosition:"outside"}:{})}:null},t.prototype.transMobileHeaderToolbar=function(e,t){var o=0,r={},n={},a=null;function i(e,t){Array.isArray(e)?e.forEach(function(e){return i(e,t)}):e&&"object"==typeof e&&("button"===e.type?(o++,"新增"===e.label&&(r=e,n=t)):"search-box"===e.type&&(a=e),(e.items||e.body)&&i(e.items||e.body,e))}e.forEach(function(e){i(e)}),1===o&&r&&(r.label="",r.icon="plus",r.className||(r.className=""),r.className+=" is-fixed-right-bottom",n&&(n.className||(n.className=""),n.className+=" is-fixed-right-bottom-wrapper")),a&&(0===o||1===o&&r)&&(0,Z.default)(this.props.filterSchema)&&t()},t.prototype.render=function(){var e,t=this.props,o=t.columns,n=t.className,a=t.style,i=t.bodyClassName,s=t.filter,l=t.render,c=t.store,p=t.mode,u=void 0===p?"table2":p;t.syncLocation,t.children,t.bulkActions;var h=t.pickerMode,m=t.selectable,g=t.multiple;t.valueField;var y=t.primaryField;t.value,t.hideQuickSaveBtn;var f=t.itemActions,v=t.classnames,b=t.keepItemSelectionOnPageChange,T=t.maxKeepItemSelectionLength,P=t.onEvent;t.onAction;var S=t.popOverContainer,C=t.translate;t.onQuery;var F=t.autoGenerateFilter;t.onSelect;var A=t.autoFillHeight,I=t.showSelection,O=t.headerToolbar,Q=t.footerToolbar;t.columnsTogglable;var R,D=t.headerToolbarClassName,x=t.footerToolbarClassName,N=t.id,k=t.testIdBuilder,M=t.mobileMode,w=t.mobileUI,E=t.pullRefresh,L=r(t,["columns","className","style","bodyClassName","filter","render","store","mode","syncLocation","children","bulkActions","pickerMode","selectable","multiple","valueField","primaryField","value","hideQuickSaveBtn","itemActions","classnames","keepItemSelectionOnPageChange","maxKeepItemSelectionLength","onEvent","onAction","popOverContainer","translate","onQuery","autoGenerateFilter","onSelect","autoFillHeight","showSelection","headerToolbar","footerToolbar","columnsTogglable","headerToolbarClassName","footerToolbarClassName","id","testIdBuilder","mobileMode","mobileUI","pullRefresh"]),j=!1,q=null;if(M&&w&&u.includes("table")){var U=this.transformTable2cards();"string"==typeof M&&"cards"===M?U&&(q=U):"object"==typeof M&&(q=d(d(d({},U),M),{card:d(d({},null==U?void 0:U.card),M.card)})),q&&this.transMobileHeaderToolbar(O,function(){j=!0}),q&&!(null==E?void 0:E.disabled)&&(R=d(d({normalText:C("pullRefresh.crud2NormalText"),pullingText:C("pullRefresh.crud2PullingText"),loosingText:C("pullRefresh.crud2LoosingText")},E),{disabled:!1}))}else R=E;var H=l("body",d(d(d({},L),{onEvent:(0,K.default)(P,function(e,t){return!z.includes(t)}),type:u,columns:u.startsWith("table")?c.columns||o:void 0,id:N}),q),{key:"body",className:v("Crud2-body",i),ref:this.controlRef,autoGenerateFilter:!s&&F,autoFillHeight:A,checkAll:!1,selectable:!!(null!=m?m:h),itemActions:f,multiple:g,columnsTogglable:!1,selected:h||b?c.selectedItemsAsArray:void 0,keepItemSelectionOnPageChange:b,maxKeepItemSelectionLength:T,primaryField:y,testIdBuilder:k,items:c.data.items,query:c.query,orderBy:c.query.orderBy,orderDir:c.query.orderDir,popOverContainer:S,onSave:this.handleSave.bind(this),onSaveOrder:this.handleSaveOrder,onSearch:this.handleQuerySearch,onSort:this.handleQuerySearch,onSelect:this.handleSelect,onAction:this.handleAction,dispatchEvent:this.dispatchEvent,data:c.mergedData,loading:c.loading,host:this});return G.createElement("div",d({className:v("Crud2",n,{"is-loading":c.loading,"is-mobile":w,"is-mobile-cards":"cards"===M||"cards"===(null==q?void 0:q.type)}),style:a,"data-id":N,"data-role":"container"},null==k?void 0:k.getTestId()),G.createElement("div",d({className:v("Crud2-filter")},null==k?void 0:k.getChild("filter").getTestId()),this.renderFilter(s)),G.createElement("div",{className:v("Crud2-toolbar","Crud2-header-toolbar",D,{"is-sticky":j})},this.renderToolbar("headerToolbar",O)),I&&b&&!1!==g?this.renderSelection():null,w&&R&&!R.disabled?G.createElement(B,d({},R,{translate:C,onRefresh:this.handlePullRefresh,direction:null!==(e=R.gestureDirection)&&void 0!==e?e:"up",loading:c.loading,completed:!c.loading&&c.lastPage>0&&c.page>=c.lastPage,completedText:c.total>0?void 0:""}),H):G.createElement(G.Fragment,null,H,G.createElement("div",{className:v("Crud2-toolbar","Crud2-footer-toolbar",x)},this.renderToolbar("footerToolbar",Q))))},t.propsList=["mode","syncLocation","value","multiple","valueField","pageField","perPageField","hideQuickSaveBtn","autoJumpToTopOnPagerChange","interval","silentPolling","stopAutoRefreshWhen","stopAutoRefreshWhenModalIsOpen","api","headerToolbar","footerToolbar","autoGenerateFilter","syncResponse2Query","keepItemSelectionOnPageChange","source","onChange","onInit","onSaved","onQuery","autoFillHeight","showSelection","headerToolbarClassName","footerToolbarClassName","primaryField","parsePrimitiveQuery","pullRefresh"],t.defaultProps={toolbarInline:!0,syncLocation:!0,hideQuickSaveBtn:!1,autoJumpToTopOnPagerChange:!0,silentPolling:!1,autoFillHeight:!1,showSelection:!0,primaryField:"id",parsePrimitiveQuery:!0,pullRefresh:{disabled:!1,showIcon:!0,showText:!0,iconType:"auto",color:"#777777",dataAppendTo:"bottom",gestureDirection:"up",minLoadingTime:0,contentText:{normalText:"点击加载更多",pullingText:"加载中...",loosingText:"释放立即刷新",loadingText:"加载中...",successText:"加载成功",completedText:"没有更多数据了"}}},s([b,i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",void 0)],t.prototype,"getPaginationPerPage",null),s([b,i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",void 0)],t.prototype,"controlRef",null),s([b,i("design:type",Function),i("design:paramtypes",[Number,Number]),i("design:returntype",void 0)],t.prototype,"handleChangePage",null),s([b,i("design:type",Function),i("design:paramtypes",[Array,Array]),i("design:returntype",void 0)],t.prototype,"handleSaveOrder",null),s([b,i("design:type",Function),i("design:paramtypes",[Array,Array]),i("design:returntype",void 0)],t.prototype,"handleSelect",null),s([b,i("design:type",Function),i("design:paramtypes",[Object,Boolean]),i("design:returntype",void 0)],t.prototype,"handleQuerySearch",null),s([b,i("design:type",Function),i("design:paramtypes",[Object,Object,Boolean]),i("design:returntype",void 0)],t.prototype,"doAction",null),s([b,i("design:type",Function),i("design:paramtypes",[Object,Object,Object,Boolean,Object]),i("design:returntype",void 0)],t.prototype,"handleAction",null),s([b,i("design:type",Function),i("design:paramtypes",[Object,Object,G.Component,Object]),i("design:returntype",void 0)],t.prototype,"dispatchEvent",null),s([b,i("design:type",Function),i("design:paramtypes",[Boolean]),i("design:returntype",void 0)],t.prototype,"toggleAllColumns",null),s([b,i("design:type",Function),i("design:paramtypes",[Number]),i("design:returntype",void 0)],t.prototype,"toggleToggle",null),s([b,i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",Promise)],t.prototype,"handlePullRefresh",null),s([b,i("design:type",Function),i("design:paramtypes",[String,Object,Object]),i("design:returntype",void 0)],t.prototype,"renderChild",null),t}(G.Component),te=function(e){function t(t,o){var r=e.call(this,t)||this;return o.registerComponent(r),r}return n(t,e),t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this),this.context.unRegisterComponent(this)},t.prototype.reload=function(t,r,n){return a(this,void 0,void 0,function(){var a;return o(this,function(o){return a=this.context,t?[2,a.reload(r?"".concat(t,"?").concat(T(r)):t,n)]:[2,e.prototype.reload.call(this,t,r)]})})},t.prototype.receive=function(t,r){return a(this,void 0,void 0,function(){var n;return o(this,function(o){return n=this.context,r?[2,n.send(r,t)]:[2,e.prototype.receive.call(this,t)]})})},t.prototype.reloadTarget=function(e,t){this.context.reload(e,t)},t.prototype.closeTarget=function(e){this.context.close(e)},t.contextType=A,t}(ee),oe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),s([Q({type:"crud2",storeType:g.name,isolateScope:!0})],t)}(te);export{oe as CRUD2Renderer,te as CRUD2RendererBase,ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as t,r,t as s}from"./tslib.es6-C2q27PUR.js";import{it as e}from"./esm-
|
|
1
|
+
import{i as t,r,t as s}from"./tslib.es6-C2q27PUR.js";import{it as e}from"./esm-BMvKJM5q.js";import{DateControlRenderer as a}from"./InputDate-BldJd84x.js";var o=function(o){function i(){return null!==o&&o.apply(this,arguments)||this}return t(i,o),i.defaultProps=s(s({},a.defaultProps),{embed:!0}),r([e({type:"calendar"})],i)}(a);export{o as CalendarRenderer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as r,t as a}from"./Card-IZbcizfw.js";export{a as CardItemFieldRenderer,r as CardRenderer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DcYi-9oA.js";import{t as a}from"./react-BW4ssgUo.js";import{c as t,i as r,o as s,r as i,s as n,t as l,u as o}from"./tslib.es6-C2q27PUR.js";import{Ii as d,Or as c,Xr as p,hr as m,it as h,lt as u,qr as C,ur as v,xr as y,yn as N}from"./esm-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DcYi-9oA.js";import{t as a}from"./react-BW4ssgUo.js";import{c as t,i as r,o as s,r as i,s as n,t as l,u as o}from"./tslib.es6-C2q27PUR.js";import{Ii as d,Or as c,Xr as p,hr as m,it as h,lt as u,qr as C,ur as v,xr as y,yn as N}from"./esm-BMvKJM5q.js";import{t as b}from"./react-dom-DmgFzc6z.js";import{Nt as f,y as g}from"./esm-BbZME5Ac.js";import{s as k}from"./PopUp-DaheG-Vv.js";import{a as T,i as x,o as A,s as P}from"./Table-D-9NfAqg.js";var E=/* @__PURE__ */e(a()),O=/* @__PURE__ */e(N()),L=/* @__PURE__ */e(b()),w=function(e){function a(a){var t=e.call(this,a)||this;return t.handleClick=t.handleClick.bind(t),t.handleAction=t.handleAction.bind(t),t.handleCheck=t.handleCheck.bind(t),t.getPopOverContainer=t.getPopOverContainer.bind(t),t.handleQuickChange=t.handleQuickChange.bind(t),t}return r(a,e),a.prototype.isHaveLink=function(){var e=this.props,a=e.href,t=e.itemAction,r=e.onCheck,s=e.checkOnItemClick,i=e.checkable;return a||t||r||s&&i},a.prototype.handleClick=function(e){var a=this.props,t=a.item,r=a.href,s=a.data,i=a.env,n=a.blank,l=a.itemAction,o=a.onAction,d=a.onCheck,c=a.onClick,m=a.selectable,h=a.checkOnItemClick;r?i.jumpTo(p(r,s),{type:"button",actionType:"url",blank:n},s):l?o&&o(e,l,(null==t?void 0:t.data)||s):(m&&h&&(null==d||d(t)),c&&c(t))},a.prototype.handleAction=function(e,a,t){var r=this.props,s=r.onAction,i=r.item;s&&s(e,a,t||i.data)},a.prototype.handleCheck=function(){var e=this.props.item;this.props.onCheck&&this.props.onCheck(e)},a.prototype.getPopOverContainer=function(){return(0,L.findDOMNode)(this)},a.prototype.handleQuickChange=function(e,a,t,r){var s=this.props,i=s.onQuickChange,n=s.item;i&&i(n,e,a,t,r)},a.prototype.renderToolbar=function(){var e=this.props,a=e.selectable,t=e.checkable,r=e.selected,s=e.multiple,i=e.hideCheckToggler,n=e.classnames,o=e.toolbar,d=e.render,c=e.dragging,p=e.data,m=e.header,h=[];if(m){var u=m.highlightClassName,v=m.highlight;("string"==typeof v?C(v,p):v)&&h.push(E.createElement("i",{key:"highlight",className:n("Card-highlight",u)}))}return a&&!i&&h.push(E.createElement(f,{key:"check",className:n("Card-checkbox"),type:!1!==s?"checkbox":"radio",disabled:!t,checked:r,onChange:this.handleCheck})),Array.isArray(o)&&o.forEach(function(e,a){return h.push(d("toolbar/".concat(a),l({type:"button",level:"link",size:"sm"},e),{key:a,onClick:void 0}))}),c&&h.push(E.createElement("div",{className:n("Card-dragBtn")},E.createElement(k,{icon:"drag-bar",className:"icon"}))),h.length?E.createElement("div",{className:n("Card-toolbar")},h):null},a.prototype.renderActions=function(){var e=this,a=this.props,t=a.actions,r=a.render,s=a.dragging,i=a.actionsCount,n=a.data,o=a.classnames;if(Array.isArray(t))return c(t.filter(function(e){return y(e,n)}),i).map(function(a,t){return E.createElement("div",{key:t,className:o("Card-actions")},a.map(function(a,t){var i=a.size||"sm";return r("action/".concat(t),l(l({level:"link",type:"button"},a),{testid:a.testid?p(a.testid,n):t,size:i}),{isMenuItem:!0,key:t,index:t,disabled:s||m(a,n),className:o("Card-action",u(a.className||"".concat(i?"Card-action--".concat(i):""),n),{"is-disabled":m(a,n)}),componentClass:"a",onAction:e.handleAction,onClick:void 0})}))})},a.prototype.renderChild=function(e,a,t){void 0===a&&(a="body"),void 0===t&&(t=0);var r=this.props.render;if("string"==typeof e||"number"==typeof e)return r(a,e,{key:t});var s=e;return"hbox"===s.type||"grid"===s.type?r(a,e,{key:t,itemRender:this.itemRender.bind(this)}):this.renderField(a,s,t,this.props)},a.prototype.itemRender=function(e,a,t){return this.renderField("column/".concat(a),e,a,t)},a.prototype.renderField=function(e,a,t,r){var s=r.render,i=r.classnames,n=r.itemIndex,o=!1!==(null==r?void 0:r.useCardLabel),d=this.props.data;if(a&&y(a,d)){var c=a.$$id?"".concat(a.$$id,"-field"):"";return E.createElement("div",{className:i("Card-field"),key:t},o&&a.label?E.createElement("label",{className:i("Card-fieldLabel",a.labelClassName)},a.label):null,s(e,l(l({},a),{field:a,$$id:c,type:"card-item-field"}),{useCardLabel:o,className:i("Card-fieldValue",u(a.className,d)),rowIndex:n,colIndex:t,popOverContainer:this.getPopOverContainer,onAction:this.handleAction,onQuickChange:this.handleQuickChange}))}},a.prototype.renderBody=function(){var e=this,a=this.props.body;return a?Array.isArray(a)?a.map(function(a,t){return e.renderChild(a,"body/".concat(t),t)}):this.renderChild(a,"body"):null},a.prototype.rederTitle=function(){var e=this.props,a=e.render,t=e.data,r=e.header;if(r){var s=(r||{}).title;return p(s,t)?a("title",s):void 0}},a.prototype.renderSubTitle=function(){var e=this.props,a=e.render,t=e.data,r=e.header;if(r){var s=(r||{}).subTitle;return s?a("sub-title",s,{data:t}):void 0}},a.prototype.renderSubTitlePlaceholder=function(){var e=this.props,a=e.render,t=e.header,r=e.classnames;if(t){var s=(t||{}).subTitlePlaceholder;return s?a("sub-title",s,{className:r("Card-placeholder")}):void 0}},a.prototype.renderDesc=function(){var e=this.props,a=e.render,t=e.data,r=e.header;if(r){var s=r||{},i=s.desc,n=s.description,l=p(n||i,t);return l?a("desc",n||i,{className:l?null:"text-muted"}):void 0}},a.prototype.renderDescPlaceholder=function(){var e=this.props,a=e.render,t=e.header;if(t){var r=t.descriptionPlaceholder||t.descPlaceholder;return r?a("desc",r,{className:r?null:"text-muted"}):void 0}},a.prototype.renderAvatar=function(){var e=this.props,a=e.data,t=e.header;if(t){var r=(t||{}).avatar;return p(r,a,"| raw")||void 0}},a.prototype.renderAvatarText=function(){var e=this.props,a=e.render,t=e.data,r=e.header;if(r){var s=(r||{}).avatarText;return p(s,t)?a("avatarText",s):void 0}},a.prototype.renderSecondary=function(){var e=this.props,a=e.render,t=e.data,r=e.secondary;return p(r,t)?a("secondary",r):void 0},a.prototype.renderAvatarTextStyle=function(){var e=this.props,a=e.header,t=e.data;if(a){var r=a.avatarText,s=a.avatarTextBackground,i=p(r,t),n={};return i&&s&&s.length&&(n.background=s[Math.abs(v(i))%s.length]),n}},a.prototype.renderMedia=function(){var e=this.props,a=e.media,t=e.classnames,r=e.render,s=e.region,i=e.data;if(a){var n=a.type,l=a.url,o=a.className,c=a.autoPlay,p=a.isLive,m=a.poster,h=d(l,i,"| raw");if("image"===n&&h)return E.createElement("img",{className:t("Card-multiMedia-img",o),src:h});if("video"===n&&h)return E.createElement("div",{className:t("Card-multiMedia-video",o)},r(s,{type:n,autoPlay:c,poster:m,src:h,isLive:p}))}},a.prototype.render=function(){var e=this.props,a=e.header,r=e.className,s=e.avatarClassName,i=e.avatarTextClassName,n=e.descClassName,o=e.descriptionClassName,d=e.titleClassName,c=e.subTitleClassName,p=e.bodyClassName,m=e.imageClassName,h=e.headerClassName,C=e.secondaryClassName,v=e.footerClassName;e.mediaClassName;var y=e.media,N=t(e,["header","className","avatarClassName","avatarTextClassName","descClassName","descriptionClassName","titleClassName","subTitleClassName","bodyClassName","imageClassName","headerClassName","secondaryClassName","footerClassName","mediaClassName","media"]),b=this.props.data,f=u(null==a?void 0:a.className,b)||h,k=u(null==a?void 0:a.titleClassName,b)||d,T=u(null==a?void 0:a.subTitleClassName,b)||c,x=u(null==a?void 0:a.descClassName,b)||n,A=u(null==a?void 0:a.descriptionClassName,b)||o||x,P=u(null==a?void 0:a.avatarTextClassName,b)||i,O=u(null==a?void 0:a.avatarClassName,b)||s,L=u(null==a?void 0:a.imageClassName,b)||m,w=null==y?void 0:y.position;return E.createElement(g,l({},N,{title:this.rederTitle(),subTitle:this.renderSubTitle(),subTitlePlaceholder:this.renderSubTitlePlaceholder(),description:this.renderDesc(),descriptionPlaceholder:this.renderDescPlaceholder(),children:this.renderBody(),actions:this.renderActions(),avatar:this.renderAvatar(),avatarText:this.renderAvatarText(),secondary:this.renderSecondary(),toolbar:this.renderToolbar(),avatarClassName:O,avatarTextStyle:this.renderAvatarTextStyle(),avatarTextClassName:P,className:r,titleClassName:k,media:this.renderMedia(),subTitleClassName:T,mediaPosition:w,descriptionClassName:A,imageClassName:L,headerClassName:f,footerClassName:v,secondaryClassName:C,bodyClassName:p,onClick:this.isHaveLink()?this.handleClick:this.handleCheck}))},a.defaultProps={className:"",avatarClassName:"",headerClassName:"",footerClassName:"",secondaryClassName:"",avatarTextClassName:"",bodyClassName:"",actionsCount:4,titleClassName:"",highlightClassName:"",subTitleClassName:"",descClassName:"",descriptionClassName:"",imageClassName:"",highlight:!1,blank:!0,dragging:!1,selectable:!1,checkable:!0,selected:!1,hideCheckToggler:!1,useCardLabel:!0},a.propsList=["avatarClassName","avatarTextClassName","bodyClassName","actionsCount","titleClassName","highlightClassName","subTitleClassName","descClassName","descriptionClassName","imageClassName","hideCheckToggler"],i([h({type:"card"}),s("design:paramtypes",[Object])],a)}(E.Component),j=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return r(a,e),a.prototype.render=function(){var e=this.props;e.type;var a=e.className,r=e.render,s=e.style,i=e.wrapperComponent,n=e.contentsOnly;e.labelClassName;var o=e.value,d=e.data,c=e.children,p=e.width,m=e.innerClassName;e.label;var h=e.tabIndex,u=e.onKeyUp,C=e.field,v=e.useCardLabel,y=t(e,["type","className","render","style","wrapperComponent","contentsOnly","labelClassName","value","data","children","width","innerClassName","label","tabIndex","onKeyUp","field","useCardLabel"]),N=l(l({},C),{renderLabel:!v,className:m,type:C&&C.type||"plain"}),b=c||r("field",N,l(l({},(0,O.default)(y,Object.keys(N))),{value:o,data:d}));return p&&((s=s||{}).width=s.width||p,b=E.createElement("div",{style:{width:/%/.test(String(p))?"":p}},b)),n?b:(i=i||"div",E.createElement(i,{style:s,className:a,tabIndex:h,onKeyUp:u},b))},a.defaultProps=l(l({},x.defaultProps),{wrapperComponent:"div"}),a.propsList=o(["quickEdit","quickEditEnabledOn","popOver","copyable","inline"],n(x.propsList),!1),i([h({type:"card-item-field"}),P(),A(),T()],a)}(x);export{w as n,j as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DcYi-9oA.js";import{t}from"./react-BW4ssgUo.js";import{c as s,i as n,o as r,r as a}from"./tslib.es6-C2q27PUR.js";import{E as o,Nn as c,it as l}from"./esm-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DcYi-9oA.js";import{t}from"./react-BW4ssgUo.js";import{c as s,i as n,o as r,r as a}from"./tslib.es6-C2q27PUR.js";import{E as o,Nn as c,it as l}from"./esm-BMvKJM5q.js";import{Nt as i}from"./esm-BbZME5Ac.js";var p=/* @__PURE__ */e(t()),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.handleClick=function(e){var t=this.props,s=t.checkOnItemClick,n=t.selectable;s&&n&&this.handleCheck()},t.prototype.handleCheck=function(){var e,t;null===(t=(e=this.props).onCheck)||void 0===t||t.call(e)},t.prototype.renderCheckbox=function(){var e=this.props,t=e.selectable,s=e.classnames,n=e.multiple,r=e.disabled,a=e.selected,o=e.hideCheckToggler,c=e.checkOnItemClick,l=e.checkboxClassname;return!t||c&&o?null:p.createElement(i,{className:s("Card2-checkbox",l),type:n?"checkbox":"radio",disabled:r,checked:a,onChange:this.handleCheck})},t.prototype.renderBody=function(){var e=this.props,t=e.body,n=e.render,r=e.classnames,a=e.bodyClassName,o=s(e,["body","render","classnames","bodyClassName"]);return p.createElement("div",{className:r("Card2-body",a),onClick:this.handleClick},t?n("body",t,o):null)},t.prototype.render=function(){var e=this.props,t=e.className,s=e.wrapperComponent,n=e.classnames,r=e.style,a=e.item,c=e.selected,l=e.checkOnItemClick,i=s||"div";return p.createElement(i,{className:n("Card2",t,{checkOnItem:l,"is-checked":c}),style:o(r,a)},this.renderBody(),this.renderCheckbox())},t.propsList=["body","className"],t.defaultProps={className:""},a([c,r("design:type",Function),r("design:paramtypes",[Object]),r("design:returntype",void 0)],t.prototype,"handleClick",null),a([c,r("design:type",Function),r("design:paramtypes",[]),r("design:returntype",void 0)],t.prototype,"handleCheck",null),t}(p.Component),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),a([l({type:"card2"})],t)}(d);export{h as Card2Renderer,d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DcYi-9oA.js";import{t}from"./react-BW4ssgUo.js";import{a as r,i as n,n as a,o,r as i,t as s}from"./tslib.es6-C2q27PUR.js";import{$n as l,Bn as d,E as c,Ii as u,J as p,Tn as h,Tt as m,Xr as g,Z as f,Zr as v,dt as y,it as C,jn as b,lt as k,mt as x,oi as T,zr as A}from"./esm-CofciBhy.js";import{t as E}from"./react-dom-DmgFzc6z.js";import{Ct as N}from"./esm-vG8eylH_.js";import{i as D,n as I,s as S}from"./PopUp-xCiesfUA.js";var O=/* @__PURE__ */e(t()),B=/* @__PURE__ */e(E()),w=/* @__PURE__ */e(h()),R=function(e){function t(r){var n=e.call(this,r)||this;n.handleAction=n.handleAction.bind(n),n.handleCheck=n.handleCheck.bind(n),n.handleClick=n.handleClick.bind(n),n.handleCheckAll=n.handleCheckAll.bind(n),n.handleQuickChange=n.handleQuickChange.bind(n),n.handleSave=n.handleSave.bind(n),n.handleSaveOrder=n.handleSaveOrder.bind(n),n.reset=n.reset.bind(n),n.dragTipRef=n.dragTipRef.bind(n),n.bodyRef=n.bodyRef.bind(n),n.renderToolbar=n.renderToolbar.bind(n);var a=r.store,o=r.selectable,i=r.draggable,s=r.orderBy,l=r.orderDir,d=r.multiple,c=r.hideCheckToggler,u=r.itemCheckableOn,p=r.itemDraggableOn;return a.update({selectable:o,draggable:i,orderBy:s,orderDir:l,multiple:d,hideCheckToggler:c,itemCheckableOn:u,itemDraggableOn:p}),t.syncItems(a,n.props)&&n.syncSelected(),n}return n(t,e),t.syncItems=function(e,t,r){var n=t.source,a=l(t,function(e){return e.items}),o=[],i=!1;if(Array.isArray(a))r&&l(r,function(e){return e.items})===a||(o=a,i=!0);else if("string"==typeof n){var s=u(n,t.data,"| raw");(r?u(n,r.data,"| raw"):null)===s?i=!1:(o=Array.isArray(s)?s:[],i=!0)}return i&&e.initItems(o,t.fullItems,t.selected),Array.isArray(t.selected)&&e.updateSelected(t.selected,t.valueField),i},t.prototype.componentDidUpdate=function(e){var r=this.props,n=r.store;b(["selectable","draggable","orderBy","orderDir","multiple","hideCheckToggler","itemCheckableOn","itemDraggableOn"],e,r)&&n.update({selectable:r.selectable,draggable:r.draggable,orderBy:r.orderBy,orderDir:r.orderDir,multiple:r.multiple,hideCheckToggler:r.hideCheckToggler,itemCheckableOn:r.itemCheckableOn,itemDraggableOn:r.itemDraggableOn}),b(["source","value","items"],e,r)||!r.value&&!r.items&&(r.data!==e.data||"string"==typeof r.source&&v(r.source))?t.syncItems(n,r,e)&&this.syncSelected():e.selected!==r.selected&&n.updateSelected(r.selected||[],r.valueField)},t.prototype.bodyRef=function(e){this.body=e},t.prototype.handleAction=function(e,t,r){var n=this.props.onAction;return null==n?void 0:n(e,t,r)},t.prototype.handleCheck=function(e){e.toggle(),this.syncSelected();var t=this.props,r=t.store;(0,t.dispatchEvent)("selectedChange",T(r.data,s(s({},r.eventContext),{item:e.data})))},t.prototype.handleClick=function(e){var t=this.props,r=t.dispatchEvent,n=t.data;return r("rowClick",T(n,{item:e.data,index:e.index}))},t.prototype.handleCheckAll=function(){this.props.store.toggleAll(),this.syncSelected()},t.prototype.handleSelectAll=function(){this.props.store.selectAll(),this.syncSelected()},t.prototype.handleClearAll=function(){this.props.store.clearAll(),this.syncSelected()},t.prototype.syncSelected=function(){var e=this.props,t=e.store,r=e.onSelect,n=e.dispatchEvent,a=t.selectedItems.map(function(e){return e.data}),o=t.unSelectedItems.map(function(e){return e.data});n("selected",T(t.data,{selectItems:a,unSelectItems:o})),r&&r(a,o)},t.prototype.handleQuickChange=function(e,t,r,n,a){e.change(t,n);var o=this.props,i=o.onSave,s=o.onItemChange,l=o.primaryField;n||(null==s||s(e.data,d(e.data,e.pristine,["id",l]),e.index),r&&r.api?this.props.onAction(null,{actionType:"ajax",api:r.api,reload:null==a?void 0:a.reload},e.locals):r&&i&&i(e.data,d(e.data,e.pristine,["id",l]),e.index,void 0,e.pristine,a))},t.prototype.handleSave=function(){var e=this.props,t=e.store,r=e.onSave,n=e.primaryField;if(r&&t.modifiedItems.length){var a=t.modifiedItems.map(function(e){return e.data}),o=t.modifiedItems.map(function(e){return e.index});r(a,t.modifiedItems.map(function(e){return d(e.data,e.pristine,["id",n])}),o,t.items.filter(function(e){return!e.modified}).map(function(e){return e.data}),t.modifiedItems.map(function(e){return e.pristine}))}},t.prototype.handleSaveOrder=function(){return a(this,void 0,void 0,function(){var e,t,n,a,o,i,s;return r(this,function(r){switch(r.label){case 0:return e=this.props,t=e.store,n=e.onSaveOrder,a=e.data,o=e.dispatchEvent,i=t.movedItems.map(function(e){return e.data}),[4,o("orderChange",T(a,{movedItems:i}))];case 1:return(null==(s=r.sent())?void 0:s.prevented)?[2]:n&&t.movedItems.length?(n(t.movedItems.map(function(e){return e.data}),t.items.map(function(e){return e.data})),[2]):[2]}})})},t.prototype.reset=function(){this.props.store.reset()},t.prototype.bulkUpdate=function(e,t){var r=this.props,n=r.store,a=r.primaryField;if(a&&e.ids){var o=e.ids.split(","),i=n.items.filter(function(e){return(0,w.default)(o,function(t){return t&&t==e.data[a]})}),l=s(s({},e),{ids:void 0});i.forEach(function(e){return e.change(l)})}else Array.isArray(t)&&(i=n.items.filter(function(e){return~t.indexOf(e.pristine)})).forEach(function(t){return t.change(e)})},t.prototype.getSelected=function(){return this.props.store.selectedItems.map(function(e){return e.data})},t.prototype.dragTipRef=function(e){!this.dragTip&&e?this.initDragging():this.dragTip&&!e&&this.destroyDragging(),this.dragTip=e},t.prototype.initDragging=function(){if(!this.sortable){var e=this.props.store,t=(0,B.findDOMNode)(this),r=this.props.classPrefix;this.sortable=new N(t.querySelector(".".concat(r,"Cards-body")),{group:"table",animation:150,handle:".".concat(r,"Card-dragBtn"),ghostClass:"is-dragging",onEnd:function(t){if(t.newIndex!==t.oldIndex){var r=t.to;t.oldIndex<r.childNodes.length-1?r.insertBefore(t.item,r.childNodes[t.oldIndex>t.newIndex?t.oldIndex+1:t.oldIndex]):r.appendChild(t.item),e.exchange(t.oldIndex,t.newIndex)}}})}},t.prototype.destroyDragging=function(){this.sortable&&this.sortable.destroy(),this.sortable=void 0},t.prototype.renderActions=function(e){var t,r=this,n=this.props,a=n.actions,o=n.render,i=n.store,l=n.classnames;return a=Array.isArray(a)?a.concat():[],!~this.renderedToolbars.indexOf("check-all")&&(t=this.renderCheckAll())&&a.unshift({type:"button",children:t}),"header"===e&&!~this.renderedToolbars.indexOf("drag-toggler")&&(t=this.renderDragToggler())&&a.unshift({type:"button",children:t}),Array.isArray(a)&&a.length?O.createElement("div",{className:l("Cards-actions")},a.map(function(e,t){return o("action/".concat(t),s({type:"button"},e),{onAction:r.handleAction,key:t,btnDisabled:i.dragging})})):null},t.prototype.renderHeading=function(){var e=this.props,t=e.title,r=e.store,n=e.hideQuickSaveBtn,a=e.classnames,o=e.data;return t||r.modified&&!n||r.moved?O.createElement("div",{className:a("Cards-heading")},r.modified&&!n?O.createElement("span",null,"当前有 ".concat(r.modified," 条记录修改了内容, 但并没有提交。请选择:"),O.createElement("button",{type:"button",className:a("Button Button--xs Button--success m-l-sm"),onClick:this.handleSave},O.createElement(S,{icon:"check",className:"icon m-r-xs"}),"提交"),O.createElement("button",{type:"button",className:a("Button Button--xs Button--danger m-l-sm"),onClick:this.reset},O.createElement(S,{icon:"close",className:"icon m-r-xs"}),"放弃")):r.moved?O.createElement("span",null,"当前有 ".concat(r.moved," 条记录修改了顺序, 但并没有提交。请选择:"),O.createElement("button",{type:"button",className:a("Button Button--xs Button--success m-l-sm"),onClick:this.handleSaveOrder},O.createElement(S,{icon:"check",className:"icon m-r-xs"}),"提交"),O.createElement("button",{type:"button",className:a("Button Button--xs Button--danger m-l-sm"),onClick:this.reset},O.createElement(S,{icon:"close",className:"icon m-r-xs"}),"放弃")):t?g(t,o):""):null},t.prototype.renderHeader=function(){var e=this.props,t=e.header,r=e.headerClassName;e.headerToolbar;var n=e.headerToolbarRender,a=e.showHeader,o=e.render,i=e.store,l=e.classnames,d=e.translate;if(!1===a)return null;var c=n?n(s(s({},this.props),i.eventContext),this.renderToolbar):null,u=this.renderActions("header"),p=u||c||i.dragging?O.createElement("div",{className:l("Cards-toolbar"),key:"header-toolbar"},u,c,i.dragging?O.createElement("div",{className:l("Cards-dragTip"),ref:this.dragTipRef},d("Card.dragTip")):null):null,h=t?O.createElement("div",{className:l("Cards-header",r),key:"header"},o("header",t)):null;return h&&p?[h,p]:h||p||null},t.prototype.renderFooter=function(){var e=this.props,t=e.footer,r=e.footerClassName;e.footerToolbar;var n=e.footerToolbarRender,a=e.render,o=e.showFooter,i=e.store,l=e.classnames,d=e.affixFooter;if(!1===o)return null;var c=n?n(s(s({},this.props),i.eventContext),this.renderToolbar):null,u=this.renderActions("footer"),p=t?O.createElement("div",{className:l("Cards-footer",r,d?"Cards-footer--affix":""),key:"footer"},a("footer",t)):null,h=u||c?O.createElement("div",{className:l("Cards-toolbar",!p&&d?"Cards-footToolbar--affix":""),key:"footer-toolbar"},u,c):null;return p&&h?[h,p]:p||h||null},t.prototype.renderCheckAll=function(){var e=this.props,t=e.store,r=e.multiple,n=e.selectable,a=e.checkAll;return t.selectable&&r&&n&&!t.dragging&&t.items.length&&a?O.createElement(I,{key:"checkall",tooltip:"切换全选",onClick:this.handleCheckAll,size:"sm",level:t.allChecked?"info":"default"},"全选"):null},t.prototype.renderDragToggler=function(){var e=this,t=this.props,r=t.store;t.multiple,t.selectable;var n=t.popOverContainer,a=t.env,o=t.translate,i=t.dragIcon;return!r.draggable||r.items.length<2?null:O.createElement(I,{iconOnly:!0,key:"dragging-toggle",tooltip:o("Card.toggleDrag"),tooltipContainer:n||(null==a?void 0:a.getModalContainer),size:"sm",active:r.dragging,onClick:function(t){t.preventDefault(),r.toggleDragging(),r.dragging&&r.clear(),r.dragging&&e.initDragging()}},O.isValidElement(i)?i:O.createElement(S,{icon:"exchange",className:"icon r90"}))},t.prototype.renderToolbar=function(e,t){var r=e.type||e;return"drag-toggler"===r?(this.renderedToolbars.push(r),this.renderDragToggler()):"check-all"===r?(this.renderedToolbars.push(r),this.renderCheckAll()):void 0},t.prototype.renderCard=function(e,t,r,n,a){var o=this,i=this.props,l=i.render,d=i.classnames,c=i.store,u=i.multiple,p=i.checkOnItemClick,h=i.hideCheckToggler,m={className:d(k(t&&t.className||"",r.locals),{"is-checked":r.checked,"is-modified":r.modified,"is-moved":r.moved,"is-dragging":c.dragging}),item:r,key:e,itemIndex:r.index,multiple:u,selectable:c.selectable,checkable:r.checkable,draggable:r.draggable,selected:r.checked,dragging:c.dragging,data:r.locals,onAction:this.handleAction,onCheck:this.handleCheck,onClick:this.handleClick,onQuickChange:c.dragging?null:this.handleQuickChange};return"card2"===(null==t?void 0:t.type)&&(m=s(s({},m),{item:r.locals,onCheck:function(){o.handleCheck(r)}})),O.createElement("div",{key:r.index,className:d(n),style:a},l("card/".concat(e),s({type:t.type||"card",hideCheckToggler:h,checkOnItemClick:p},t),m))},t.prototype.render=function(){var e=this,t=this.props,r=t.className,n=t.style,a=t.store,o=t.columnsCount,i=t.itemClassName,l=t.placeholder,d=t.card,u=t.data,h=t.render,m=t.affixHeader,g=t.masonryLayout,v=t.itemsClassName,y=t.classnames,C=t.translate,b=t.loading,k=void 0!==b&&b,x=t.loadingConfig,T=t.env,E=t.id,N=t.wrapperCustomStyle,I=t.themeCss,S=t.mobileUI;this.renderedToolbars=[];var B=function(){if(S&&!g)return i||"";if(g&&o){var e=Math.round(12/o);return"Grid-col--xs".concat(e," Grid-col--sm").concat(e," Grid-col--md").concat(e," Grid-col--lg").concat(e)}return o?"Grid-col--sm".concat(Math.round(12/o)):i||""}(),w=this.renderHeader(),R=this.renderHeading(),j=this.renderFooter(),F="";g&&(F="Cards--masonry "+B.split(/\s/).map(function(e){return/^Grid-col--(xs|sm|md|lg)(\d+)/.test(e)?"Cards--masonry".concat(A(RegExp.$1)).concat(RegExp.$2):e}).join(" "));var G={},Q={};return(null==n?void 0:n.gutterX)>=0&&(G.marginLeft=G.marginRight=-(null==n?void 0:n.gutterX)/2+"px",Q.paddingLeft=Q.paddingRight=(null==n?void 0:n.gutterX)/2+"px"),(null==n?void 0:n.gutterY)>=0&&(Q.marginBottom=(null==n?void 0:n.gutterY)+"px"),O.createElement("div",{ref:this.bodyRef,className:y("Cards",r,{"Cards--unsaved":!!a.modified||!!a.moved},f(s(s({},this.props),{name:"baseControlClassName",id:E,themeCss:I})),f(s(s({},this.props),{name:"wrapperCustomStyle",id:E,themeCss:N}))),style:c(n,u)},m?O.createElement("div",{className:y("Cards-fixedTop")},w,R):O.createElement(O.Fragment,null,w,R),a.items.length?O.createElement("div",{className:y("Cards-body Grid",v,F),style:G},a.items.map(function(t,r){return e.renderCard(r,d,t,B,Q)})):O.createElement("div",{className:y("Cards-placeholder")},h("placeholder",C(l))),j,O.createElement(D,{loadingConfig:x,overlay:!0,show:k}),O.createElement(p,s({},this.props,{config:{wrapperCustomStyle:N,id:E,themeCss:I,classNames:[{key:"baseControlClassName"}]},env:T})))},t.propsList=["header","headerToolbarRender","footer","footerToolbarRender","placeholder","source","selectable","headerClassName","footerClassName","hideQuickSaveBtn","hideCheckToggler","itemCheckableOn","itemDraggableOn","masonryLayout","items","valueField"],t.defaultProps={className:"",placeholder:"placeholder.noData",source:"$items",selectable:!1,headerClassName:"",footerClassName:"",itemClassName:"Grid-col--xs12 Grid-col--sm6 Grid-col--md4 Grid-col--lg3",hideCheckToggler:!1,masonryLayout:!1,affixHeader:!0,itemsClassName:"",checkAll:!0},t}(O.Component),j=function(e){function t(t,r){var n=e.call(this,t)||this;return r.registerComponent(n),n}return n(t,e),t.prototype.componentWillUnmount=function(){var t;null===(t=e.prototype.componentWillUnmount)||void 0===t||t.call(this),this.context.unRegisterComponent(this)},t.prototype.receive=function(e,t){var r,n,a,o,i=this.context;return null===(r=null==i?void 0:i.parent)||void 0===r||r.getComponents(),(null===(n=this.props)||void 0===n?void 0:n.host)?null===(o=(a=this.props.host).receive)||void 0===o?void 0:o.call(a,e,t):t?i.send(t,e):void 0},t.prototype.reload=function(e,t,n,o,i,s){var l,d,c;return a(this,void 0,void 0,function(){var a;return r(this,function(r){return this.props.store,(null==s?void 0:s.index)||(null==s?void 0:s.condition)?[2]:(a=this.context,(null===(l=this.props)||void 0===l?void 0:l.host)?[2,null===(c=(d=this.props.host).reload)||void 0===c?void 0:c.call(d,e,t,n)]:e?[2,a.reload(e,n)]:[2])})})},t.prototype.setData=function(e,t,n,o){var i,s,l;return a(this,void 0,void 0,function(){var a;return r(this,function(r){switch(r.label){case 0:return a=this.props.store,void 0===n&&void 0===o?[3,2]:[4,x(a.items,this.props.data,n,o)];case 1:return r.sent().forEach(function(t){t.updateData(e)}),[3,3];case 2:return(null===(i=this.props)||void 0===i?void 0:i.host)?[2,null===(l=(s=this.props.host).setData)||void 0===l?void 0:l.call(s,e,t,n,o)]:[2,a.updateData(e,void 0,t)];case 3:return[2]}})})},t.prototype.getData=function(){var e=this.props,t=e.store,r=e.data;return t.getData(r)},t.prototype.hasModifiedItems=function(){return this.props.store.modified},t.prototype.doAction=function(e,t,n,o){return a(this,void 0,void 0,function(){var n,a,i,s,l;return r(this,function(r){switch(r.label){case 0:switch(n=this.props,a=n.store,i=n.valueField,s=n.data,null==e?void 0:e.actionType){case"selectAll":return[3,1];case"clearAll":return[3,2];case"select":return[3,3];case"initDrag":return[3,5];case"cancelDrag":return[3,6];case"submitQuickEdit":return[3,7]}return[3,9];case 1:return a.clear(),a.toggleAll(),this.syncSelected(),[3,10];case 2:return a.clear(),this.syncSelected(),[3,10];case 3:return[4,x(a.items,t||this.props.data,o.index,o.condition,o.selected)];case 4:return l=r.sent(),a.updateSelected(l.map(function(e){return e.data}),i),this.syncSelected(),[3,10];case 5:return a.startDragging(),[3,10];case 6:return a.stopDragging(),[3,10];case 7:return[4,this.handleSave()];case 8:return r.sent(),[3,10];case 9:return[2,this.handleAction(void 0,e,s)];case 10:return[2]}})})},t.contextType=y,i([C({name:"cards",type:"cards",storeType:m.name,weight:-100}),o("design:paramtypes",[Object,Object])],t)}(R);export{j as CardsRenderer,R as default};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DcYi-9oA.js";import{t}from"./react-BW4ssgUo.js";import{a as r,i as n,n as a,o,r as i,t as s}from"./tslib.es6-C2q27PUR.js";import{$n as l,Bn as d,E as c,Ii as u,J as p,Tn as h,Tt as m,Xr as g,Z as f,Zr as v,dt as y,it as C,jn as b,lt as k,mt as x,oi as T,zr as A}from"./esm-BMvKJM5q.js";import{t as E}from"./react-dom-DmgFzc6z.js";import{Ct as N}from"./esm-BbZME5Ac.js";import{i as D,n as I,s as S}from"./PopUp-DaheG-Vv.js";var O=/* @__PURE__ */e(t()),B=/* @__PURE__ */e(E()),w=/* @__PURE__ */e(h()),R=function(e){function t(r){var n=e.call(this,r)||this;n.handleAction=n.handleAction.bind(n),n.handleCheck=n.handleCheck.bind(n),n.handleClick=n.handleClick.bind(n),n.handleCheckAll=n.handleCheckAll.bind(n),n.handleQuickChange=n.handleQuickChange.bind(n),n.handleSave=n.handleSave.bind(n),n.handleSaveOrder=n.handleSaveOrder.bind(n),n.reset=n.reset.bind(n),n.dragTipRef=n.dragTipRef.bind(n),n.bodyRef=n.bodyRef.bind(n),n.renderToolbar=n.renderToolbar.bind(n);var a=r.store,o=r.selectable,i=r.draggable,s=r.orderBy,l=r.orderDir,d=r.multiple,c=r.hideCheckToggler,u=r.itemCheckableOn,p=r.itemDraggableOn;return a.update({selectable:o,draggable:i,orderBy:s,orderDir:l,multiple:d,hideCheckToggler:c,itemCheckableOn:u,itemDraggableOn:p}),t.syncItems(a,n.props)&&n.syncSelected(),n}return n(t,e),t.syncItems=function(e,t,r){var n=t.source,a=l(t,function(e){return e.items}),o=[],i=!1;if(Array.isArray(a))r&&l(r,function(e){return e.items})===a||(o=a,i=!0);else if("string"==typeof n){var s=u(n,t.data,"| raw");(r?u(n,r.data,"| raw"):null)===s?i=!1:(o=Array.isArray(s)?s:[],i=!0)}return i&&e.initItems(o,t.fullItems,t.selected),Array.isArray(t.selected)&&e.updateSelected(t.selected,t.valueField),i},t.prototype.componentDidUpdate=function(e){var r=this.props,n=r.store;b(["selectable","draggable","orderBy","orderDir","multiple","hideCheckToggler","itemCheckableOn","itemDraggableOn"],e,r)&&n.update({selectable:r.selectable,draggable:r.draggable,orderBy:r.orderBy,orderDir:r.orderDir,multiple:r.multiple,hideCheckToggler:r.hideCheckToggler,itemCheckableOn:r.itemCheckableOn,itemDraggableOn:r.itemDraggableOn}),b(["source","value","items"],e,r)||!r.value&&!r.items&&(r.data!==e.data||"string"==typeof r.source&&v(r.source))?t.syncItems(n,r,e)&&this.syncSelected():e.selected!==r.selected&&n.updateSelected(r.selected||[],r.valueField)},t.prototype.bodyRef=function(e){this.body=e},t.prototype.handleAction=function(e,t,r){var n=this.props.onAction;return null==n?void 0:n(e,t,r)},t.prototype.handleCheck=function(e){e.toggle(),this.syncSelected();var t=this.props,r=t.store;(0,t.dispatchEvent)("selectedChange",T(r.data,s(s({},r.eventContext),{item:e.data})))},t.prototype.handleClick=function(e){var t=this.props,r=t.dispatchEvent,n=t.data;return r("rowClick",T(n,{item:e.data,index:e.index}))},t.prototype.handleCheckAll=function(){this.props.store.toggleAll(),this.syncSelected()},t.prototype.handleSelectAll=function(){this.props.store.selectAll(),this.syncSelected()},t.prototype.handleClearAll=function(){this.props.store.clearAll(),this.syncSelected()},t.prototype.syncSelected=function(){var e=this.props,t=e.store,r=e.onSelect,n=e.dispatchEvent,a=t.selectedItems.map(function(e){return e.data}),o=t.unSelectedItems.map(function(e){return e.data});n("selected",T(t.data,{selectItems:a,unSelectItems:o})),r&&r(a,o)},t.prototype.handleQuickChange=function(e,t,r,n,a){e.change(t,n);var o=this.props,i=o.onSave,s=o.onItemChange,l=o.primaryField;n||(null==s||s(e.data,d(e.data,e.pristine,["id",l]),e.index),r&&r.api?this.props.onAction(null,{actionType:"ajax",api:r.api,reload:null==a?void 0:a.reload},e.locals):r&&i&&i(e.data,d(e.data,e.pristine,["id",l]),e.index,void 0,e.pristine,a))},t.prototype.handleSave=function(){var e=this.props,t=e.store,r=e.onSave,n=e.primaryField;if(r&&t.modifiedItems.length){var a=t.modifiedItems.map(function(e){return e.data}),o=t.modifiedItems.map(function(e){return e.index});r(a,t.modifiedItems.map(function(e){return d(e.data,e.pristine,["id",n])}),o,t.items.filter(function(e){return!e.modified}).map(function(e){return e.data}),t.modifiedItems.map(function(e){return e.pristine}))}},t.prototype.handleSaveOrder=function(){return a(this,void 0,void 0,function(){var e,t,n,a,o,i,s;return r(this,function(r){switch(r.label){case 0:return e=this.props,t=e.store,n=e.onSaveOrder,a=e.data,o=e.dispatchEvent,i=t.movedItems.map(function(e){return e.data}),[4,o("orderChange",T(a,{movedItems:i}))];case 1:return(null==(s=r.sent())?void 0:s.prevented)?[2]:n&&t.movedItems.length?(n(t.movedItems.map(function(e){return e.data}),t.items.map(function(e){return e.data})),[2]):[2]}})})},t.prototype.reset=function(){this.props.store.reset()},t.prototype.bulkUpdate=function(e,t){var r=this.props,n=r.store,a=r.primaryField;if(a&&e.ids){var o=e.ids.split(","),i=n.items.filter(function(e){return(0,w.default)(o,function(t){return t&&t==e.data[a]})}),l=s(s({},e),{ids:void 0});i.forEach(function(e){return e.change(l)})}else Array.isArray(t)&&(i=n.items.filter(function(e){return~t.indexOf(e.pristine)})).forEach(function(t){return t.change(e)})},t.prototype.getSelected=function(){return this.props.store.selectedItems.map(function(e){return e.data})},t.prototype.dragTipRef=function(e){!this.dragTip&&e?this.initDragging():this.dragTip&&!e&&this.destroyDragging(),this.dragTip=e},t.prototype.initDragging=function(){if(!this.sortable){var e=this.props.store,t=(0,B.findDOMNode)(this),r=this.props.classPrefix;this.sortable=new N(t.querySelector(".".concat(r,"Cards-body")),{group:"table",animation:150,handle:".".concat(r,"Card-dragBtn"),ghostClass:"is-dragging",onEnd:function(t){if(t.newIndex!==t.oldIndex){var r=t.to;t.oldIndex<r.childNodes.length-1?r.insertBefore(t.item,r.childNodes[t.oldIndex>t.newIndex?t.oldIndex+1:t.oldIndex]):r.appendChild(t.item),e.exchange(t.oldIndex,t.newIndex)}}})}},t.prototype.destroyDragging=function(){this.sortable&&this.sortable.destroy(),this.sortable=void 0},t.prototype.renderActions=function(e){var t,r=this,n=this.props,a=n.actions,o=n.render,i=n.store,l=n.classnames;return a=Array.isArray(a)?a.concat():[],!~this.renderedToolbars.indexOf("check-all")&&(t=this.renderCheckAll())&&a.unshift({type:"button",children:t}),"header"===e&&!~this.renderedToolbars.indexOf("drag-toggler")&&(t=this.renderDragToggler())&&a.unshift({type:"button",children:t}),Array.isArray(a)&&a.length?O.createElement("div",{className:l("Cards-actions")},a.map(function(e,t){return o("action/".concat(t),s({type:"button"},e),{onAction:r.handleAction,key:t,btnDisabled:i.dragging})})):null},t.prototype.renderHeading=function(){var e=this.props,t=e.title,r=e.store,n=e.hideQuickSaveBtn,a=e.classnames,o=e.data;return t||r.modified&&!n||r.moved?O.createElement("div",{className:a("Cards-heading")},r.modified&&!n?O.createElement("span",null,"当前有 ".concat(r.modified," 条记录修改了内容, 但并没有提交。请选择:"),O.createElement("button",{type:"button",className:a("Button Button--xs Button--success m-l-sm"),onClick:this.handleSave},O.createElement(S,{icon:"check",className:"icon m-r-xs"}),"提交"),O.createElement("button",{type:"button",className:a("Button Button--xs Button--danger m-l-sm"),onClick:this.reset},O.createElement(S,{icon:"close",className:"icon m-r-xs"}),"放弃")):r.moved?O.createElement("span",null,"当前有 ".concat(r.moved," 条记录修改了顺序, 但并没有提交。请选择:"),O.createElement("button",{type:"button",className:a("Button Button--xs Button--success m-l-sm"),onClick:this.handleSaveOrder},O.createElement(S,{icon:"check",className:"icon m-r-xs"}),"提交"),O.createElement("button",{type:"button",className:a("Button Button--xs Button--danger m-l-sm"),onClick:this.reset},O.createElement(S,{icon:"close",className:"icon m-r-xs"}),"放弃")):t?g(t,o):""):null},t.prototype.renderHeader=function(){var e=this.props,t=e.header,r=e.headerClassName;e.headerToolbar;var n=e.headerToolbarRender,a=e.showHeader,o=e.render,i=e.store,l=e.classnames,d=e.translate;if(!1===a)return null;var c=n?n(s(s({},this.props),i.eventContext),this.renderToolbar):null,u=this.renderActions("header"),p=u||c||i.dragging?O.createElement("div",{className:l("Cards-toolbar"),key:"header-toolbar"},u,c,i.dragging?O.createElement("div",{className:l("Cards-dragTip"),ref:this.dragTipRef},d("Card.dragTip")):null):null,h=t?O.createElement("div",{className:l("Cards-header",r),key:"header"},o("header",t)):null;return h&&p?[h,p]:h||p||null},t.prototype.renderFooter=function(){var e=this.props,t=e.footer,r=e.footerClassName;e.footerToolbar;var n=e.footerToolbarRender,a=e.render,o=e.showFooter,i=e.store,l=e.classnames,d=e.affixFooter;if(!1===o)return null;var c=n?n(s(s({},this.props),i.eventContext),this.renderToolbar):null,u=this.renderActions("footer"),p=t?O.createElement("div",{className:l("Cards-footer",r,d?"Cards-footer--affix":""),key:"footer"},a("footer",t)):null,h=u||c?O.createElement("div",{className:l("Cards-toolbar",!p&&d?"Cards-footToolbar--affix":""),key:"footer-toolbar"},u,c):null;return p&&h?[h,p]:p||h||null},t.prototype.renderCheckAll=function(){var e=this.props,t=e.store,r=e.multiple,n=e.selectable,a=e.checkAll;return t.selectable&&r&&n&&!t.dragging&&t.items.length&&a?O.createElement(I,{key:"checkall",tooltip:"切换全选",onClick:this.handleCheckAll,size:"sm",level:t.allChecked?"info":"default"},"全选"):null},t.prototype.renderDragToggler=function(){var e=this,t=this.props,r=t.store;t.multiple,t.selectable;var n=t.popOverContainer,a=t.env,o=t.translate,i=t.dragIcon;return!r.draggable||r.items.length<2?null:O.createElement(I,{iconOnly:!0,key:"dragging-toggle",tooltip:o("Card.toggleDrag"),tooltipContainer:n||(null==a?void 0:a.getModalContainer),size:"sm",active:r.dragging,onClick:function(t){t.preventDefault(),r.toggleDragging(),r.dragging&&r.clear(),r.dragging&&e.initDragging()}},O.isValidElement(i)?i:O.createElement(S,{icon:"exchange",className:"icon r90"}))},t.prototype.renderToolbar=function(e,t){var r=e.type||e;return"drag-toggler"===r?(this.renderedToolbars.push(r),this.renderDragToggler()):"check-all"===r?(this.renderedToolbars.push(r),this.renderCheckAll()):void 0},t.prototype.renderCard=function(e,t,r,n,a){var o=this,i=this.props,l=i.render,d=i.classnames,c=i.store,u=i.multiple,p=i.checkOnItemClick,h=i.hideCheckToggler,m={className:d(k(t&&t.className||"",r.locals),{"is-checked":r.checked,"is-modified":r.modified,"is-moved":r.moved,"is-dragging":c.dragging}),item:r,key:e,itemIndex:r.index,multiple:u,selectable:c.selectable,checkable:r.checkable,draggable:r.draggable,selected:r.checked,dragging:c.dragging,data:r.locals,onAction:this.handleAction,onCheck:this.handleCheck,onClick:this.handleClick,onQuickChange:c.dragging?null:this.handleQuickChange};return"card2"===(null==t?void 0:t.type)&&(m=s(s({},m),{item:r.locals,onCheck:function(){o.handleCheck(r)}})),O.createElement("div",{key:r.index,className:d(n),style:a},l("card/".concat(e),s({type:t.type||"card",hideCheckToggler:h,checkOnItemClick:p},t),m))},t.prototype.render=function(){var e=this,t=this.props,r=t.className,n=t.style,a=t.store,o=t.columnsCount,i=t.itemClassName,l=t.placeholder,d=t.card,u=t.data,h=t.render,m=t.affixHeader,g=t.masonryLayout,v=t.itemsClassName,y=t.classnames,C=t.translate,b=t.loading,k=void 0!==b&&b,x=t.loadingConfig,T=t.env,E=t.id,N=t.wrapperCustomStyle,I=t.themeCss,S=t.mobileUI;this.renderedToolbars=[];var B=function(){if(S&&!g)return i||"";if(g&&o){var e=Math.round(12/o);return"Grid-col--xs".concat(e," Grid-col--sm").concat(e," Grid-col--md").concat(e," Grid-col--lg").concat(e)}return o?"Grid-col--sm".concat(Math.round(12/o)):i||""}(),w=this.renderHeader(),R=this.renderHeading(),j=this.renderFooter(),F="";g&&(F="Cards--masonry "+B.split(/\s/).map(function(e){return/^Grid-col--(xs|sm|md|lg)(\d+)/.test(e)?"Cards--masonry".concat(A(RegExp.$1)).concat(RegExp.$2):e}).join(" "));var G={},Q={};return(null==n?void 0:n.gutterX)>=0&&(G.marginLeft=G.marginRight=-(null==n?void 0:n.gutterX)/2+"px",Q.paddingLeft=Q.paddingRight=(null==n?void 0:n.gutterX)/2+"px"),(null==n?void 0:n.gutterY)>=0&&(Q.marginBottom=(null==n?void 0:n.gutterY)+"px"),O.createElement("div",{ref:this.bodyRef,className:y("Cards",r,{"Cards--unsaved":!!a.modified||!!a.moved},f(s(s({},this.props),{name:"baseControlClassName",id:E,themeCss:I})),f(s(s({},this.props),{name:"wrapperCustomStyle",id:E,themeCss:N}))),style:c(n,u)},m?O.createElement("div",{className:y("Cards-fixedTop")},w,R):O.createElement(O.Fragment,null,w,R),a.items.length?O.createElement("div",{className:y("Cards-body Grid",v,F),style:G},a.items.map(function(t,r){return e.renderCard(r,d,t,B,Q)})):O.createElement("div",{className:y("Cards-placeholder")},h("placeholder",C(l))),j,O.createElement(D,{loadingConfig:x,overlay:!0,show:k}),O.createElement(p,s({},this.props,{config:{wrapperCustomStyle:N,id:E,themeCss:I,classNames:[{key:"baseControlClassName"}]},env:T})))},t.propsList=["header","headerToolbarRender","footer","footerToolbarRender","placeholder","source","selectable","headerClassName","footerClassName","hideQuickSaveBtn","hideCheckToggler","itemCheckableOn","itemDraggableOn","masonryLayout","items","valueField"],t.defaultProps={className:"",placeholder:"placeholder.noData",source:"$items",selectable:!1,headerClassName:"",footerClassName:"",itemClassName:"Grid-col--xs12 Grid-col--sm6 Grid-col--md4 Grid-col--lg3",hideCheckToggler:!1,masonryLayout:!1,affixHeader:!0,itemsClassName:"",checkAll:!0},t}(O.Component),j=function(e){function t(t,r){var n=e.call(this,t)||this;return r.registerComponent(n),n}return n(t,e),t.prototype.componentWillUnmount=function(){var t;null===(t=e.prototype.componentWillUnmount)||void 0===t||t.call(this),this.context.unRegisterComponent(this)},t.prototype.receive=function(e,t){var r,n,a,o,i=this.context;return null===(r=null==i?void 0:i.parent)||void 0===r||r.getComponents(),(null===(n=this.props)||void 0===n?void 0:n.host)?null===(o=(a=this.props.host).receive)||void 0===o?void 0:o.call(a,e,t):t?i.send(t,e):void 0},t.prototype.reload=function(e,t,n,o,i,s){var l,d,c;return a(this,void 0,void 0,function(){var a;return r(this,function(r){return this.props.store,(null==s?void 0:s.index)||(null==s?void 0:s.condition)?[2]:(a=this.context,(null===(l=this.props)||void 0===l?void 0:l.host)?[2,null===(c=(d=this.props.host).reload)||void 0===c?void 0:c.call(d,e,t,n)]:e?[2,a.reload(e,n)]:[2])})})},t.prototype.setData=function(e,t,n,o){var i,s,l;return a(this,void 0,void 0,function(){var a;return r(this,function(r){switch(r.label){case 0:return a=this.props.store,void 0===n&&void 0===o?[3,2]:[4,x(a.items,this.props.data,n,o)];case 1:return r.sent().forEach(function(t){t.updateData(e)}),[3,3];case 2:return(null===(i=this.props)||void 0===i?void 0:i.host)?[2,null===(l=(s=this.props.host).setData)||void 0===l?void 0:l.call(s,e,t,n,o)]:[2,a.updateData(e,void 0,t)];case 3:return[2]}})})},t.prototype.getData=function(){var e=this.props,t=e.store,r=e.data;return t.getData(r)},t.prototype.hasModifiedItems=function(){return this.props.store.modified},t.prototype.doAction=function(e,t,n,o){return a(this,void 0,void 0,function(){var n,a,i,s,l;return r(this,function(r){switch(r.label){case 0:switch(n=this.props,a=n.store,i=n.valueField,s=n.data,null==e?void 0:e.actionType){case"selectAll":return[3,1];case"clearAll":return[3,2];case"select":return[3,3];case"initDrag":return[3,5];case"cancelDrag":return[3,6];case"submitQuickEdit":return[3,7]}return[3,9];case 1:return a.clear(),a.toggleAll(),this.syncSelected(),[3,10];case 2:return a.clear(),this.syncSelected(),[3,10];case 3:return[4,x(a.items,t||this.props.data,o.index,o.condition,o.selected)];case 4:return l=r.sent(),a.updateSelected(l.map(function(e){return e.data}),i),this.syncSelected(),[3,10];case 5:return a.startDragging(),[3,10];case 6:return a.stopDragging(),[3,10];case 7:return[4,this.handleSave()];case 8:return r.sent(),[3,10];case 9:return[2,this.handleAction(void 0,e,s)];case 10:return[2]}})})},t.contextType=y,i([C({name:"cards",type:"cards",storeType:m.name,weight:-100}),o("design:paramtypes",[Object,Object])],t)}(R);export{j as CardsRenderer,R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DcYi-9oA.js";import{t}from"./react-BW4ssgUo.js";import{a as n,c as r,i as o,n as i,o as s,r as a,s as l,t as u}from"./tslib.es6-C2q27PUR.js";import{$n as p,Ii as c,J as d,Nn as m,Z as h,a as v,c as g,dt as y,fr as f,it as w,l as E,o as S,oi as C,s as M,ui as N}from"./esm-CofciBhy.js";import"./esm-vG8eylH_.js";import{o as A,s as x}from"./PopUp-xCiesfUA.js";import{i as T}from"./Image--xtRdgd5.js";var b,L=/* @__PURE__ */e(t()),F=((b={})[S]="in",b[v]="in",b[g]="out",b),q={component:function(e){var t=e.data||{},n=e.thumbMode,r=e.classnames;return L.createElement(L.Fragment,null,t.hasOwnProperty("image")?L.createElement(T,{src:t.image,title:t.hasOwnProperty("title")?t.title:"",href:t.hasOwnProperty("href")?t.href:"",blank:!!t.hasOwnProperty("blank")&&t.blank,htmlTarget:t.hasOwnProperty("htmlTarget")?t.htmlTarget:"",caption:t.hasOwnProperty("description")?t.description:"",thumbMode:t.hasOwnProperty("thumbMode")?t.thumbMode:null!=n?n:"contain",imageMode:"original",className:r("Carousel-image")}):t.hasOwnProperty("html")?L.createElement(A,{html:t.html,filterHtml:e.env.filterHtml}):t.hasOwnProperty("item")?L.createElement("span",null,t.item):L.createElement("p",null))}},R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.wrapperRef=L.createRef(),t.state={current:0,options:t.props.options||p(t.props)||[],nextAnimation:"",mouseStartLocation:null,isPaused:!1},t.loading=!1,t.marqueeRef=L.createRef(),t.contentRef=L.createRef(),t}return o(t,e),t.prototype.componentDidMount=function(){this.prepareAutoSlide(),"marquee"===this.props.animation&&this.marquee()},t.prototype.componentDidUpdate=function(e){var t=this.props,n=t.options||p(t)||[];f(e.options||p(e)||[],n)&&this.setState({options:n}),"marquee"===this.props.animation&&"marquee"!==e.animation&&this.marquee()},t.prototype.componentWillUnmount=function(){this.clearAutoTimeout(),cancelAnimationFrame(this.marqueeRequestId)},t.prototype.marquee=function(){var e=this;if(this.marqueeRef.current&&this.contentRef.current){var t=0,n=performance.now(),r=this.contentRef.current,o=function(i){var s,a,l=i-n;n=i;var u=null!==(a=null===(s=e.marqueeRef.current)||void 0===s?void 0:s.offsetWidth)&&void 0!==a?a:0;if(!e.state.isPaused){var p=u*(l/e.props.duration);t+=-p;var c=r.scrollWidth/2;Math.abs(t)>=c&&(t=0),r.style.transform="translateX(".concat(t,"px)")}e.marqueeRequestId=requestAnimationFrame(o)};this.marqueeRequestId=requestAnimationFrame(o)}},t.prototype.doAction=function(e,t,n,r){var o=null==e?void 0:e.actionType;~["next","prev"].indexOf(o)?this.autoSlide(o):"goto-image"===o&&this.changeSlide((null==r?void 0:r.activeIndex)-1)},t.prototype.prepareAutoSlide=function(){if(!(this.state.options.length<2)&&(this.clearAutoTimeout(),this.props.auto)){var e=this.props.interval;this.intervalTimeout=setTimeout(this.autoSlide,"string"==typeof e?c(e,this.props.data)||5e3:e)}},t.prototype.autoSlide=function(e){this.clearAutoTimeout();var t=this.props.animation,n=this.state.nextAnimation;"prev"===e?(n="slide"===t?"slideRight":"",this.transitFramesTowards("right",n)):(n="",this.transitFramesTowards("left",n)),this.durationTimeout=setTimeout(this.prepareAutoSlide,this.props.duration)},t.prototype.transitFramesTowards=function(e,t){return i(this,void 0,void 0,function(){var r,o,i,s,a,l;return n(this,function(n){switch(n.label){case 0:if(r=this.state.current,o=r,!1===this.props.loop&&(0===r&&"right"===e||r===this.state.options.length-1&&"left"===e))return[2];switch(e){case"left":r=this.getFrameId("next");break;case"right":r=this.getFrameId("prev")}return i=this.props,s=i.dispatchEvent,a=i.data,[4,s("change",C(a,{activeIndex:r+1,prevIndex:o}))];case 1:return(null==(l=n.sent())?void 0:l.prevented)||this.setState({current:r,nextAnimation:t}),[2]}})})},t.prototype.getFrameId=function(e){var t=this.state,n=t.options,r=t.current,o=n.length;switch(e){case"prev":return(r-1+o)%o;case"next":return(r+1)%o;default:return r}},t.prototype.next=function(){var e=this.props.multiple;this.loading&&e&&e.count>1||this.autoSlide("next")},t.prototype.prev=function(){var e=this.props.multiple;this.loading&&e&&e.count>1||this.autoSlide("prev")},t.prototype.clearAutoTimeout=function(){clearTimeout(this.intervalTimeout),clearTimeout(this.durationTimeout)},t.prototype.changeSlide=function(e){return i(this,void 0,void 0,function(){var t,r,o,i,s,a;return n(this,function(n){switch(n.label){case 0:return t=this.state.current,r=this.props,o=r.dispatchEvent,i=r.data,s=r.multiple,this.loading&&s&&s.count>1?[2]:[4,o("change",C(i,{activeIndex:e,prevIndex:t}))];case 1:return(null==(a=n.sent())?void 0:a.prevented)||this.setState({current:e}),[2]}})})},t.prototype.renderDots=function(){var e=this,t=this.props.classnames,n=this.state,r=n.current,o=n.options;return L.createElement("div",{className:t("Carousel-dotsControl"),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},Array.from({length:o.length}).map(function(n,o){return L.createElement("span",{key:o,onClick:function(){return e.changeSlide(o)},className:t("Carousel-dot",r===o?"is-active":"")})}))},t.prototype.renderArrows=function(){var e=this.props.classnames;return L.createElement("div",{className:e("Carousel-arrowsControl"),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},L.createElement("div",{className:e("Carousel-leftArrow"),onClick:this.prev},L.createElement(x,{icon:"left-arrow",className:"icon"})),L.createElement("div",{className:e("Carousel-rightArrow"),onClick:this.next},L.createElement(x,{icon:"right-arrow",className:"icon"})))},t.prototype.handleMouseEnter=function(){var e=this.props.multiple;e&&e.count>1||this.clearAutoTimeout()},t.prototype.handleMouseLeave=function(){var e=this.props.multiple;e&&e.count>1||this.prepareAutoSlide()},t.prototype.getNewOptions=function(e,t){void 0===t&&(t=1);var n=e;if(Array.isArray(e)&&e.length){n=new Array(e.length);for(var r=0;r<e.length;r++){n[r]=new Array(t);for(var o=0;o<t;o++)n[r][o]=e[(r+o)%e.length]}}return n},t.prototype.getEventScreenXY=function(e){var t,n,r,o,i,s,a,l;return void 0!==e.screenX?(a=e.screenX,l=e.screenY):(null===(t=e.touches)||void 0===t?void 0:t.length)?(a=null===(n=e.touches[0])||void 0===n?void 0:n.screenX,l=null===(r=e.touches[0])||void 0===r?void 0:r.screenY):(null===(o=e.changedTouches)||void 0===o?void 0:o.length)&&(a=null===(i=e.changedTouches[0])||void 0===i?void 0:i.screenX,l=null===(s=e.changedTouches[0])||void 0===s?void 0:s.screenY),{screenX:a,screenY:l}},t.prototype.addMouseDownListener=function(e){var t=this.props.direction,n=this.getEventScreenXY(e),r=n.screenX,o=n.screenY,i="vertical"===t?o:r;void 0!==i&&this.setState({mouseStartLocation:i})},t.prototype.addMouseUpListener=function(e){var t=this.getEventScreenXY(e),n=t.screenX,r=t.screenY,o="vertical"===this.props.direction?r:n;null!==this.state.mouseStartLocation&&void 0!==o&&(o-this.state.mouseStartLocation>20?this.autoSlide("prev"):this.state.mouseStartLocation-o>20&&this.autoSlide(),this.setState({mouseStartLocation:null}))},t.prototype.render=function(){var e,t,n=this,o=this.props,i=o.render,s=o.className,a=o.style,p=o.classnames,c=o.itemSchema,m=o.animation,y=o.width,f=o.height,w=o.controls,A=o.controlsTheme,T=o.placeholder,b=o.data,R=o.name,O=o.duration,I=o.multiple,P=o.alwaysShowArrow,k=o.icons,X=o.id,j=o.wrapperCustomStyle,U=o.env,D=o.themeCss,Y=this.state,W=Y.options,B=Y.current,G=Y.nextAnimation,H=null,J=a?u({},a):{};y&&(isNaN(Number(y))?J.width=y:J.width=y+"px"),f&&(isNaN(Number(f))?J.height=f:J.height=f+"px");var Z=l([w.indexOf("dots")>-1&&"marquee"!==m,w.indexOf("arrows")>-1&&"marquee"!==m],2),$=Z[0],z=Z[1],K=G||m;if(Array.isArray(W)&&W.length){var Q=1;I&&"number"==typeof I.count&&I.count>=2&&(Q=Math.floor(I.count)<W.length?Math.floor(I.count):W.length);var V=this.getNewOptions(W,Q),_=Q>1&&"number"==typeof O?"".concat(O,"ms"):O||"500ms",ee=Q>1&&"number"==typeof O?O:500,te=((e={})[S]=0,e[v]=0,e[g]="slideRight"===K?100/Q:-100/Q,e[M]="slideRight"===K?-100/Q:100/Q,e),ne=Q>1?u({transitionTimingFunction:"linear",transitionDuration:_},"slide"===m?{transform:"translateX(".concat(te[status],"%)")}:{}):{},re=function(e){var t,o=e.itemSchema,s=r(e,["itemSchema"]);return i("".concat(B,"/body"),o||c?o||c:q,{thumbMode:n.props.thumbMode,data:C(b,N(e)?s:(t={item:e},t[R]=e,t))})};H="marquee"===m?L.createElement("div",{ref:this.marqueeRef,className:p("Marquee-container"),onMouseEnter:function(){return n.setState({isPaused:!0})},onMouseLeave:function(){return n.setState({isPaused:!1})},style:{width:"100%",height:f}},L.createElement("div",{className:p("Marquee-content"),ref:this.contentRef},W.concat(W).map(function(e,t){return L.createElement("div",{key:t,className:p("Marquee-item")},1===Q?re(e):null,Q>1?V.concat(V)[t].map(function(e,t){return L.createElement("div",{key:t,style:{width:100/Q+"%",height:"100%",float:"left"}},re(e))}):null)}))):L.createElement("div",{ref:this.wrapperRef,className:p("Carousel-container"),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},W.map(function(e,t){return L.createElement(E,{mountOnEnter:!0,unmountOnExit:!0,in:t===B,timeout:ee,key:t},function(r){return"entering"===r&&n.wrapperRef.current&&n.wrapperRef.current.childNodes.forEach(function(e){return e.offsetHeight}),Q>1&&("entering"!==r&&"exiting"!==r||n.loading?"entered"!==r&&"exited"!==r||!n.loading||(n.loading=!1):n.loading=!0),L.createElement("div",{className:p("Carousel-item",K,F[r]),style:ne},1===Q?re(e):null,Q>1?V[t].map(function(e,t){return L.createElement("div",{key:t,style:{width:100/Q+"%",height:"100%",float:"left"}},re(e))}):null)})}))}return L.createElement("div",{className:p("Carousel Carousel--".concat(A),(t={},t["Carousel-arrow--always"]=!!P,t),s,h(u(u({},this.props),{name:"baseControlClassName",id:X,themeCss:D})),h(u(u({},this.props),{name:"wrapperCustomStyle",id:X,themeCss:j})),{"Carousel-vertical":"vertical"===this.props.direction}),onMouseDown:this.props.mouseEvent?this.addMouseDownListener:void 0,onMouseUp:this.props.mouseEvent?this.addMouseUpListener:void 0,onMouseLeave:this.props.mouseEvent?this.addMouseUpListener:void 0,onTouchStart:this.props.mouseEvent?this.addMouseDownListener:void 0,onTouchEnd:this.props.mouseEvent?this.addMouseUpListener:void 0,style:J},H||T,$?this.renderDots():null,z?L.createElement("div",{className:p("Carousel-leftArrow",h(u(u({},this.props),{name:"galleryControlClassName",id:X,themeCss:D}))),onClick:this.prev},(null==k?void 0:k.prev)?L.createElement("div",{className:"ImageGallery-prevBtn"},L.createElement(x,{icon:k.prev})):L.createElement(x,{icon:"left-arrow",className:"icon",iconContent:"ImageGallery-prevBtn"})):null,z?L.createElement("div",{className:p("Carousel-rightArrow",h(u(u({},this.props),{name:"galleryControlClassName",id:X,themeCss:D}))),onClick:this.next},(null==k?void 0:k.next)?L.createElement("div",{className:"ImageGallery-prevBtn"},L.createElement(x,{icon:k.next})):L.createElement(x,{icon:"right-arrow",className:"icon",iconContent:"ImageGallery-nextBtn"})):null,L.createElement(d,u({},this.props,{config:{wrapperCustomStyle:j,id:X,themeCss:D,classNames:[{key:"baseControlClassName"},{key:"galleryControlClassName",weights:{default:{suf:" svg",important:!0}}}]},env:U})))},t.defaultProps={auto:!0,interval:5e3,duration:500,controlsTheme:"light",animation:"fade",controls:["dots","arrows"],placeholder:"-",multiple:{count:1},alwaysShowArrow:!1},a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"prepareAutoSlide",null),a([m,s("design:type",Function),s("design:paramtypes",[String]),s("design:returntype",void 0)],t.prototype,"autoSlide",null),a([m,s("design:type",Function),s("design:paramtypes",[String,String]),s("design:returntype",Promise)],t.prototype,"transitFramesTowards",null),a([m,s("design:type",Function),s("design:paramtypes",[String]),s("design:returntype",void 0)],t.prototype,"getFrameId",null),a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"next",null),a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"prev",null),a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"clearAutoTimeout",null),a([m,s("design:type",Function),s("design:paramtypes",[Number]),s("design:returntype",Promise)],t.prototype,"changeSlide",null),a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"handleMouseEnter",null),a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"handleMouseLeave",null),a([m,s("design:type",Function),s("design:paramtypes",[Object]),s("design:returntype",void 0)],t.prototype,"addMouseDownListener",null),a([m,s("design:type",Function),s("design:paramtypes",[Object]),s("design:returntype",void 0)],t.prototype,"addMouseUpListener",null),t}(L.Component),O=function(e){function t(t,n){var r=e.call(this,t)||this;return n.registerComponent(r),r}return o(t,e),t.prototype.componentWillUnmount=function(){var t;null===(t=e.prototype.componentWillUnmount)||void 0===t||t.call(this),this.context.unRegisterComponent(this)},t.contextType=y,a([w({type:"carousel"}),s("design:paramtypes",[Object,Object])],t)}(R);export{R as Carousel,O as CarouselRenderer};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DcYi-9oA.js";import{t}from"./react-BW4ssgUo.js";import{a as n,c as r,i as o,n as i,o as s,r as a,s as l,t as u}from"./tslib.es6-C2q27PUR.js";import{$n as p,Ii as c,J as d,Nn as m,Z as h,a as v,c as g,dt as y,fr as f,it as w,l as E,o as S,oi as C,s as M,ui as N}from"./esm-BMvKJM5q.js";import"./esm-BbZME5Ac.js";import{o as A,s as x}from"./PopUp-DaheG-Vv.js";import{i as T}from"./Image-hHgZkb5C.js";var b,L=/* @__PURE__ */e(t()),F=((b={})[S]="in",b[v]="in",b[g]="out",b),q={component:function(e){var t=e.data||{},n=e.thumbMode,r=e.classnames;return L.createElement(L.Fragment,null,t.hasOwnProperty("image")?L.createElement(T,{src:t.image,title:t.hasOwnProperty("title")?t.title:"",href:t.hasOwnProperty("href")?t.href:"",blank:!!t.hasOwnProperty("blank")&&t.blank,htmlTarget:t.hasOwnProperty("htmlTarget")?t.htmlTarget:"",caption:t.hasOwnProperty("description")?t.description:"",thumbMode:t.hasOwnProperty("thumbMode")?t.thumbMode:null!=n?n:"contain",imageMode:"original",className:r("Carousel-image")}):t.hasOwnProperty("html")?L.createElement(A,{html:t.html,filterHtml:e.env.filterHtml}):t.hasOwnProperty("item")?L.createElement("span",null,t.item):L.createElement("p",null))}},R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.wrapperRef=L.createRef(),t.state={current:0,options:t.props.options||p(t.props)||[],nextAnimation:"",mouseStartLocation:null,isPaused:!1},t.loading=!1,t.marqueeRef=L.createRef(),t.contentRef=L.createRef(),t}return o(t,e),t.prototype.componentDidMount=function(){this.prepareAutoSlide(),"marquee"===this.props.animation&&this.marquee()},t.prototype.componentDidUpdate=function(e){var t=this.props,n=t.options||p(t)||[];f(e.options||p(e)||[],n)&&this.setState({options:n}),"marquee"===this.props.animation&&"marquee"!==e.animation&&this.marquee()},t.prototype.componentWillUnmount=function(){this.clearAutoTimeout(),cancelAnimationFrame(this.marqueeRequestId)},t.prototype.marquee=function(){var e=this;if(this.marqueeRef.current&&this.contentRef.current){var t=0,n=performance.now(),r=this.contentRef.current,o=function(i){var s,a,l=i-n;n=i;var u=null!==(a=null===(s=e.marqueeRef.current)||void 0===s?void 0:s.offsetWidth)&&void 0!==a?a:0;if(!e.state.isPaused){var p=u*(l/e.props.duration);t+=-p;var c=r.scrollWidth/2;Math.abs(t)>=c&&(t=0),r.style.transform="translateX(".concat(t,"px)")}e.marqueeRequestId=requestAnimationFrame(o)};this.marqueeRequestId=requestAnimationFrame(o)}},t.prototype.doAction=function(e,t,n,r){var o=null==e?void 0:e.actionType;~["next","prev"].indexOf(o)?this.autoSlide(o):"goto-image"===o&&this.changeSlide((null==r?void 0:r.activeIndex)-1)},t.prototype.prepareAutoSlide=function(){if(!(this.state.options.length<2)&&(this.clearAutoTimeout(),this.props.auto)){var e=this.props.interval;this.intervalTimeout=setTimeout(this.autoSlide,"string"==typeof e?c(e,this.props.data)||5e3:e)}},t.prototype.autoSlide=function(e){this.clearAutoTimeout();var t=this.props.animation,n=this.state.nextAnimation;"prev"===e?(n="slide"===t?"slideRight":"",this.transitFramesTowards("right",n)):(n="",this.transitFramesTowards("left",n)),this.durationTimeout=setTimeout(this.prepareAutoSlide,this.props.duration)},t.prototype.transitFramesTowards=function(e,t){return i(this,void 0,void 0,function(){var r,o,i,s,a,l;return n(this,function(n){switch(n.label){case 0:if(r=this.state.current,o=r,!1===this.props.loop&&(0===r&&"right"===e||r===this.state.options.length-1&&"left"===e))return[2];switch(e){case"left":r=this.getFrameId("next");break;case"right":r=this.getFrameId("prev")}return i=this.props,s=i.dispatchEvent,a=i.data,[4,s("change",C(a,{activeIndex:r+1,prevIndex:o}))];case 1:return(null==(l=n.sent())?void 0:l.prevented)||this.setState({current:r,nextAnimation:t}),[2]}})})},t.prototype.getFrameId=function(e){var t=this.state,n=t.options,r=t.current,o=n.length;switch(e){case"prev":return(r-1+o)%o;case"next":return(r+1)%o;default:return r}},t.prototype.next=function(){var e=this.props.multiple;this.loading&&e&&e.count>1||this.autoSlide("next")},t.prototype.prev=function(){var e=this.props.multiple;this.loading&&e&&e.count>1||this.autoSlide("prev")},t.prototype.clearAutoTimeout=function(){clearTimeout(this.intervalTimeout),clearTimeout(this.durationTimeout)},t.prototype.changeSlide=function(e){return i(this,void 0,void 0,function(){var t,r,o,i,s,a;return n(this,function(n){switch(n.label){case 0:return t=this.state.current,r=this.props,o=r.dispatchEvent,i=r.data,s=r.multiple,this.loading&&s&&s.count>1?[2]:[4,o("change",C(i,{activeIndex:e,prevIndex:t}))];case 1:return(null==(a=n.sent())?void 0:a.prevented)||this.setState({current:e}),[2]}})})},t.prototype.renderDots=function(){var e=this,t=this.props.classnames,n=this.state,r=n.current,o=n.options;return L.createElement("div",{className:t("Carousel-dotsControl"),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},Array.from({length:o.length}).map(function(n,o){return L.createElement("span",{key:o,onClick:function(){return e.changeSlide(o)},className:t("Carousel-dot",r===o?"is-active":"")})}))},t.prototype.renderArrows=function(){var e=this.props.classnames;return L.createElement("div",{className:e("Carousel-arrowsControl"),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},L.createElement("div",{className:e("Carousel-leftArrow"),onClick:this.prev},L.createElement(x,{icon:"left-arrow",className:"icon"})),L.createElement("div",{className:e("Carousel-rightArrow"),onClick:this.next},L.createElement(x,{icon:"right-arrow",className:"icon"})))},t.prototype.handleMouseEnter=function(){var e=this.props.multiple;e&&e.count>1||this.clearAutoTimeout()},t.prototype.handleMouseLeave=function(){var e=this.props.multiple;e&&e.count>1||this.prepareAutoSlide()},t.prototype.getNewOptions=function(e,t){void 0===t&&(t=1);var n=e;if(Array.isArray(e)&&e.length){n=new Array(e.length);for(var r=0;r<e.length;r++){n[r]=new Array(t);for(var o=0;o<t;o++)n[r][o]=e[(r+o)%e.length]}}return n},t.prototype.getEventScreenXY=function(e){var t,n,r,o,i,s,a,l;return void 0!==e.screenX?(a=e.screenX,l=e.screenY):(null===(t=e.touches)||void 0===t?void 0:t.length)?(a=null===(n=e.touches[0])||void 0===n?void 0:n.screenX,l=null===(r=e.touches[0])||void 0===r?void 0:r.screenY):(null===(o=e.changedTouches)||void 0===o?void 0:o.length)&&(a=null===(i=e.changedTouches[0])||void 0===i?void 0:i.screenX,l=null===(s=e.changedTouches[0])||void 0===s?void 0:s.screenY),{screenX:a,screenY:l}},t.prototype.addMouseDownListener=function(e){var t=this.props.direction,n=this.getEventScreenXY(e),r=n.screenX,o=n.screenY,i="vertical"===t?o:r;void 0!==i&&this.setState({mouseStartLocation:i})},t.prototype.addMouseUpListener=function(e){var t=this.getEventScreenXY(e),n=t.screenX,r=t.screenY,o="vertical"===this.props.direction?r:n;null!==this.state.mouseStartLocation&&void 0!==o&&(o-this.state.mouseStartLocation>20?this.autoSlide("prev"):this.state.mouseStartLocation-o>20&&this.autoSlide(),this.setState({mouseStartLocation:null}))},t.prototype.render=function(){var e,t,n=this,o=this.props,i=o.render,s=o.className,a=o.style,p=o.classnames,c=o.itemSchema,m=o.animation,y=o.width,f=o.height,w=o.controls,A=o.controlsTheme,T=o.placeholder,b=o.data,R=o.name,O=o.duration,I=o.multiple,P=o.alwaysShowArrow,k=o.icons,X=o.id,j=o.wrapperCustomStyle,U=o.env,D=o.themeCss,Y=this.state,W=Y.options,B=Y.current,G=Y.nextAnimation,H=null,J=a?u({},a):{};y&&(isNaN(Number(y))?J.width=y:J.width=y+"px"),f&&(isNaN(Number(f))?J.height=f:J.height=f+"px");var Z=l([w.indexOf("dots")>-1&&"marquee"!==m,w.indexOf("arrows")>-1&&"marquee"!==m],2),$=Z[0],z=Z[1],K=G||m;if(Array.isArray(W)&&W.length){var Q=1;I&&"number"==typeof I.count&&I.count>=2&&(Q=Math.floor(I.count)<W.length?Math.floor(I.count):W.length);var V=this.getNewOptions(W,Q),_=Q>1&&"number"==typeof O?"".concat(O,"ms"):O||"500ms",ee=Q>1&&"number"==typeof O?O:500,te=((e={})[S]=0,e[v]=0,e[g]="slideRight"===K?100/Q:-100/Q,e[M]="slideRight"===K?-100/Q:100/Q,e),ne=Q>1?u({transitionTimingFunction:"linear",transitionDuration:_},"slide"===m?{transform:"translateX(".concat(te[status],"%)")}:{}):{},re=function(e){var t,o=e.itemSchema,s=r(e,["itemSchema"]);return i("".concat(B,"/body"),o||c?o||c:q,{thumbMode:n.props.thumbMode,data:C(b,N(e)?s:(t={item:e},t[R]=e,t))})};H="marquee"===m?L.createElement("div",{ref:this.marqueeRef,className:p("Marquee-container"),onMouseEnter:function(){return n.setState({isPaused:!0})},onMouseLeave:function(){return n.setState({isPaused:!1})},style:{width:"100%",height:f}},L.createElement("div",{className:p("Marquee-content"),ref:this.contentRef},W.concat(W).map(function(e,t){return L.createElement("div",{key:t,className:p("Marquee-item")},1===Q?re(e):null,Q>1?V.concat(V)[t].map(function(e,t){return L.createElement("div",{key:t,style:{width:100/Q+"%",height:"100%",float:"left"}},re(e))}):null)}))):L.createElement("div",{ref:this.wrapperRef,className:p("Carousel-container"),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},W.map(function(e,t){return L.createElement(E,{mountOnEnter:!0,unmountOnExit:!0,in:t===B,timeout:ee,key:t},function(r){return"entering"===r&&n.wrapperRef.current&&n.wrapperRef.current.childNodes.forEach(function(e){return e.offsetHeight}),Q>1&&("entering"!==r&&"exiting"!==r||n.loading?"entered"!==r&&"exited"!==r||!n.loading||(n.loading=!1):n.loading=!0),L.createElement("div",{className:p("Carousel-item",K,F[r]),style:ne},1===Q?re(e):null,Q>1?V[t].map(function(e,t){return L.createElement("div",{key:t,style:{width:100/Q+"%",height:"100%",float:"left"}},re(e))}):null)})}))}return L.createElement("div",{className:p("Carousel Carousel--".concat(A),(t={},t["Carousel-arrow--always"]=!!P,t),s,h(u(u({},this.props),{name:"baseControlClassName",id:X,themeCss:D})),h(u(u({},this.props),{name:"wrapperCustomStyle",id:X,themeCss:j})),{"Carousel-vertical":"vertical"===this.props.direction}),onMouseDown:this.props.mouseEvent?this.addMouseDownListener:void 0,onMouseUp:this.props.mouseEvent?this.addMouseUpListener:void 0,onMouseLeave:this.props.mouseEvent?this.addMouseUpListener:void 0,onTouchStart:this.props.mouseEvent?this.addMouseDownListener:void 0,onTouchEnd:this.props.mouseEvent?this.addMouseUpListener:void 0,style:J},H||T,$?this.renderDots():null,z?L.createElement("div",{className:p("Carousel-leftArrow",h(u(u({},this.props),{name:"galleryControlClassName",id:X,themeCss:D}))),onClick:this.prev},(null==k?void 0:k.prev)?L.createElement("div",{className:"ImageGallery-prevBtn"},L.createElement(x,{icon:k.prev})):L.createElement(x,{icon:"left-arrow",className:"icon",iconContent:"ImageGallery-prevBtn"})):null,z?L.createElement("div",{className:p("Carousel-rightArrow",h(u(u({},this.props),{name:"galleryControlClassName",id:X,themeCss:D}))),onClick:this.next},(null==k?void 0:k.next)?L.createElement("div",{className:"ImageGallery-prevBtn"},L.createElement(x,{icon:k.next})):L.createElement(x,{icon:"right-arrow",className:"icon",iconContent:"ImageGallery-nextBtn"})):null,L.createElement(d,u({},this.props,{config:{wrapperCustomStyle:j,id:X,themeCss:D,classNames:[{key:"baseControlClassName"},{key:"galleryControlClassName",weights:{default:{suf:" svg",important:!0}}}]},env:U})))},t.defaultProps={auto:!0,interval:5e3,duration:500,controlsTheme:"light",animation:"fade",controls:["dots","arrows"],placeholder:"-",multiple:{count:1},alwaysShowArrow:!1},a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"prepareAutoSlide",null),a([m,s("design:type",Function),s("design:paramtypes",[String]),s("design:returntype",void 0)],t.prototype,"autoSlide",null),a([m,s("design:type",Function),s("design:paramtypes",[String,String]),s("design:returntype",Promise)],t.prototype,"transitFramesTowards",null),a([m,s("design:type",Function),s("design:paramtypes",[String]),s("design:returntype",void 0)],t.prototype,"getFrameId",null),a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"next",null),a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"prev",null),a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"clearAutoTimeout",null),a([m,s("design:type",Function),s("design:paramtypes",[Number]),s("design:returntype",Promise)],t.prototype,"changeSlide",null),a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"handleMouseEnter",null),a([m,s("design:type",Function),s("design:paramtypes",[]),s("design:returntype",void 0)],t.prototype,"handleMouseLeave",null),a([m,s("design:type",Function),s("design:paramtypes",[Object]),s("design:returntype",void 0)],t.prototype,"addMouseDownListener",null),a([m,s("design:type",Function),s("design:paramtypes",[Object]),s("design:returntype",void 0)],t.prototype,"addMouseUpListener",null),t}(L.Component),O=function(e){function t(t,n){var r=e.call(this,t)||this;return n.registerComponent(r),r}return o(t,e),t.prototype.componentWillUnmount=function(){var t;null===(t=e.prototype.componentWillUnmount)||void 0===t||t.call(this),this.context.unRegisterComponent(this)},t.contextType=y,a([w({type:"carousel"}),s("design:paramtypes",[Object,Object])],t)}(R);export{R as Carousel,O as CarouselRenderer};
|