@pisell/materials 6.7.1 → 6.7.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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.js +21 -21
- package/build/lowcode/view.js +22 -22
- package/es/components/batch-editor/index.d.ts +0 -1
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +72 -10
- package/es/components/dataSourceComponents/dataSourceForm/formItem.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +5 -3
- package/es/components/dataSourceComponents/dataSourceForm/serve.js +93 -0
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +66 -28
- package/es/components/dataSourceComponents/dataSourceForm/urlUtils.js +76 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +3 -4
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +4 -4
- package/es/components/dataSourceComponents/dataSourceWrapper/index.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/ColorPicker/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/IconSelect/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Switch/ReadPretty.js +16 -0
- package/es/components/dataSourceComponents/fields/Switch/ReadPretty.less +2 -0
- package/es/components/dataSourceComponents/fields/Switch/WithMode.js +5 -0
- package/es/components/dataSourceComponents/fields/Switch/index.js +8 -0
- package/es/components/dataSourceComponents/fields/Switch/type.js +1 -0
- package/es/components/dataSourceComponents/fields/TimePicker/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Translation/ReadPretty.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Upload/CameraPopover.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +3 -3
- package/es/components/dataSourceComponents/hooks/useActions.js +20 -14
- package/es/components/dataSourceComponents/provider/variables/VariablesContext.d.ts +15 -0
- package/es/components/date-picker/index.d.ts +0 -1
- package/es/components/filter/index.d.ts +0 -1
- package/es/components/iconfont/index.js +1 -1
- package/es/components/page/index.d.ts +0 -1
- package/es/components/pisell-config-provider/index.js +0 -1
- package/es/components/pisellCardList/index.js +5 -1
- package/es/components/pisellDatePicker/index.d.ts +1 -0
- package/es/components/pisellInput/index.d.ts +0 -1
- package/es/components/pisellLoading/index.d.ts +0 -1
- package/es/components/pisellModal/components/IpadModal/index.d.ts +0 -1
- package/es/components/pisellModal/components/MobileModal/index.d.ts +0 -1
- package/es/components/pisellModal/components/index.d.ts +0 -1
- package/es/components/pisellToast/squareToast/methods.d.ts +13 -0
- package/es/components/pisellToast/squareToast/renderImperatively.d.ts +29 -0
- package/es/components/pisellWalletPassCard/index.js +17 -4
- package/es/components/productCard/cartSkuCard/components/AmountFooter/index.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/Note/index.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/discountReason/index.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/packages/index.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/sales/index.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/specs/index.d.ts +1 -0
- package/es/components/productCard/components/MultiDay/index.d.ts +0 -1
- package/es/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +0 -1
- package/es/components/productCard/components/Packages/components/options/index.d.ts +0 -1
- package/es/components/productCard/components/Packages/utils.d.ts +1 -1
- package/es/components/select-time/index.d.ts +1 -0
- package/es/components/table/Actions/component/ColumnsSetting/index.d.ts +0 -1
- package/es/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/es/components/table/Table/SelectField/index.d.ts +0 -1
- package/es/components/table/Table/fields/date/index.d.ts +0 -1
- package/es/components/table/Table/fields/image/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/index.d.ts +2 -3
- package/es/components/table/Table/fields/link/index.d.ts +0 -1
- package/es/components/table/Table/fields/number/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/number/index.d.ts +0 -1
- package/es/components/table/Table/fields/numberRange/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/numberRange/index.d.ts +0 -1
- package/es/components/table/Table/fields/oldRangePicker/index.d.ts +0 -1
- package/es/components/table/Table/fields/pSwitch/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/rangePicker/index.d.ts +0 -1
- package/es/components/table/Table/fields/search/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/search/index.d.ts +0 -1
- package/es/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/fields/select/index.d.ts +0 -1
- package/es/components/table/Table/fields/text/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/text/index.d.ts +0 -1
- package/es/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/fields/treeSelect/index.d.ts +0 -1
- package/es/index.js +1 -0
- package/es/locales/en-US.js +1 -0
- package/es/locales/zh-CN.js +1 -0
- package/es/locales/zh-TW.js +1 -0
- package/es/utils/index.d.ts +1 -1
- package/es/utils/platform.d.ts +1 -1
- package/lib/components/batch-editor/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +41 -3
- package/lib/components/dataSourceComponents/dataSourceForm/formItem.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +5 -3
- package/lib/components/dataSourceComponents/dataSourceForm/serve.js +45 -2
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +23 -2
- package/lib/components/dataSourceComponents/dataSourceForm/urlUtils.js +68 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +3 -3
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +4 -4
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/ColorPicker/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/IconSelect/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Switch/ReadPretty.js +52 -0
- package/lib/components/dataSourceComponents/fields/Switch/ReadPretty.less +2 -0
- package/lib/components/dataSourceComponents/fields/Switch/WithMode.js +39 -0
- package/lib/components/dataSourceComponents/fields/Switch/index.js +42 -0
- package/lib/components/dataSourceComponents/fields/Switch/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/TimePicker/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Translation/ReadPretty.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Upload/CameraPopover.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +3 -3
- package/lib/components/dataSourceComponents/hooks/useActions.js +3 -0
- package/lib/components/dataSourceComponents/provider/variables/VariablesContext.d.ts +15 -0
- package/lib/components/date-picker/index.d.ts +0 -1
- package/lib/components/filter/index.d.ts +0 -1
- package/lib/components/iconfont/index.js +1 -1
- package/lib/components/page/index.d.ts +0 -1
- package/lib/components/pisell-config-provider/index.js +0 -1
- package/lib/components/pisellCardList/index.js +5 -1
- package/lib/components/pisellDatePicker/index.d.ts +1 -0
- package/lib/components/pisellInput/index.d.ts +0 -1
- package/lib/components/pisellLoading/index.d.ts +0 -1
- package/lib/components/pisellModal/components/IpadModal/index.d.ts +0 -1
- package/lib/components/pisellModal/components/MobileModal/index.d.ts +0 -1
- package/lib/components/pisellModal/components/index.d.ts +0 -1
- package/lib/components/pisellToast/squareToast/methods.d.ts +13 -0
- package/lib/components/pisellToast/squareToast/renderImperatively.d.ts +29 -0
- package/lib/components/pisellWalletPassCard/index.js +12 -2
- package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/Note/index.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/discountReason/index.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/packages/index.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/sales/index.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/specs/index.d.ts +1 -0
- package/lib/components/productCard/components/MultiDay/index.d.ts +0 -1
- package/lib/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +0 -1
- package/lib/components/productCard/components/Packages/components/options/index.d.ts +0 -1
- package/lib/components/productCard/components/Packages/utils.d.ts +1 -1
- package/lib/components/select-time/index.d.ts +1 -0
- package/lib/components/table/Actions/component/ColumnsSetting/index.d.ts +0 -1
- package/lib/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/lib/components/table/Table/SelectField/index.d.ts +0 -1
- package/lib/components/table/Table/fields/date/index.d.ts +0 -1
- package/lib/components/table/Table/fields/image/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/index.d.ts +2 -3
- package/lib/components/table/Table/fields/link/index.d.ts +0 -1
- package/lib/components/table/Table/fields/number/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/number/index.d.ts +0 -1
- package/lib/components/table/Table/fields/numberRange/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/numberRange/index.d.ts +0 -1
- package/lib/components/table/Table/fields/oldRangePicker/index.d.ts +0 -1
- package/lib/components/table/Table/fields/pSwitch/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/rangePicker/index.d.ts +0 -1
- package/lib/components/table/Table/fields/search/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/search/index.d.ts +0 -1
- package/lib/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/fields/select/index.d.ts +0 -1
- package/lib/components/table/Table/fields/text/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/text/index.d.ts +0 -1
- package/lib/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/fields/treeSelect/index.d.ts +0 -1
- package/lib/index.js +3 -0
- package/lib/locales/en-US.js +1 -0
- package/lib/locales/zh-CN.js +1 -0
- package/lib/locales/zh-TW.js +1 -0
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/platform.d.ts +1 -1
- package/lowcode/data-source-form/constants.ts +3 -0
- package/lowcode/data-source-form/meta.ts +90 -31
- package/lowcode/data-source-form/utils.ts +132 -19
- package/lowcode/form-item-switch/meta.ts +145 -0
- package/lowcode/form-item-switch/snippets.ts +15 -0
- package/package.json +2 -2
- package/es/components/appVersionControl/index.d.ts +0 -4
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.d.ts +0 -3
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +0 -15
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.d.ts +0 -8
- package/es/components/dataSourceComponents/dataSourceForm/serve.d.ts +0 -149
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +0 -39
- package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +0 -31
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +0 -56
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.d.ts +0 -8
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +0 -84
- package/es/components/dataSourceComponents/hooks/useActions.d.ts +0 -18
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +0 -119
- package/es/components/drag-sort-tree/TreeItem/index.d.ts +0 -18
- package/es/components/drag-sort-tree/index.d.ts +0 -4
- package/es/components/iconfont/index.d.ts +0 -8
- package/es/components/login-and-register/index.d.ts +0 -82
- package/es/components/pisell-config-provider/index.d.ts +0 -13
- package/es/components/pisellAdjustPrice/index.d.ts +0 -4
- package/es/components/pisellCardList/index.d.ts +0 -103
- package/es/components/pisellCheckboxGroup/index.d.ts +0 -40
- package/es/components/pisellEmpty/index.d.ts +0 -19
- package/es/components/pisellText/components/Amount/index.d.ts +0 -20
- package/es/components/pisellText/components/Editable/index.d.ts +0 -29
- package/es/components/pisellText/index.d.ts +0 -9
- package/es/components/pisellToast/index.d.ts +0 -17
- package/es/components/pisellWalletPassCard/index.d.ts +0 -136
- package/es/components/productCard/cartSkuCard/components/packages/utils.d.ts +0 -20
- package/es/components/productCard/components/Header/DeleteButton/index.d.ts +0 -3
- package/es/components/productCard/components/Header/index.d.ts +0 -3
- package/es/components/productCard/components/Sales/index.d.ts +0 -3
- package/es/components/productCard/components/Time/components/SelectHolder/index.d.ts +0 -3
- package/es/components/productCard/components/Time/components/SelectHolderModal/index.d.ts +0 -13
- package/es/components/productCard/components/Time/components/SelectResource/index.d.ts +0 -18
- package/es/components/productCard/components/Time/index.d.ts +0 -3
- package/es/components/sortableList/index.d.ts +0 -11
- package/es/components/table/Gallery/components/GalleryItem/index.d.ts +0 -14
- package/es/components/table/Gallery/index.d.ts +0 -5
- package/es/components/table/Table/AddFieldModal/index.d.ts +0 -4
- package/es/components/table/Table/index.d.ts +0 -4
- package/es/components/table/Table/utils.d.ts +0 -161
- package/es/components/table/hooks/useTableSetting.d.ts +0 -21
- package/es/components/table/hooks/useTransColumns.d.ts +0 -14
- package/es/components/table/hooks/useTransDataSource.d.ts +0 -11
- package/es/components/table/types.d.ts +0 -268
- package/es/components/translation/index.d.ts +0 -14
- package/es/components/versionModal/index.d.ts +0 -23
- package/es/components/virtual-keyboard/Amount/index.d.ts +0 -5
- package/es/components/virtual-keyboard/Amount/types.d.ts +0 -44
- package/es/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +0 -25
- package/es/components/virtual-keyboard/Number/index.d.ts +0 -5
- package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +0 -13
- package/es/components/virtual-keyboard/index.d.ts +0 -25
- package/es/components/virtualInput/index.d.ts +0 -24
- package/es/index.d.ts +0 -145
- package/es/locales/en-US.d.ts +0 -307
- package/es/locales/zh-CN.d.ts +0 -302
- package/es/locales/zh-TW.d.ts +0 -302
- package/lib/components/appVersionControl/index.d.ts +0 -4
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.d.ts +0 -3
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +0 -15
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.d.ts +0 -8
- package/lib/components/dataSourceComponents/dataSourceForm/serve.d.ts +0 -149
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +0 -39
- package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +0 -31
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +0 -56
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.d.ts +0 -8
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +0 -84
- package/lib/components/dataSourceComponents/hooks/useActions.d.ts +0 -18
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +0 -119
- package/lib/components/drag-sort-tree/TreeItem/index.d.ts +0 -18
- package/lib/components/drag-sort-tree/index.d.ts +0 -4
- package/lib/components/iconfont/index.d.ts +0 -8
- package/lib/components/login-and-register/index.d.ts +0 -82
- package/lib/components/pisell-config-provider/index.d.ts +0 -13
- package/lib/components/pisellAdjustPrice/index.d.ts +0 -4
- package/lib/components/pisellCardList/index.d.ts +0 -103
- package/lib/components/pisellCheckboxGroup/index.d.ts +0 -40
- package/lib/components/pisellEmpty/index.d.ts +0 -19
- package/lib/components/pisellText/components/Amount/index.d.ts +0 -20
- package/lib/components/pisellText/components/Editable/index.d.ts +0 -29
- package/lib/components/pisellText/index.d.ts +0 -9
- package/lib/components/pisellToast/index.d.ts +0 -17
- package/lib/components/pisellWalletPassCard/index.d.ts +0 -136
- package/lib/components/productCard/cartSkuCard/components/packages/utils.d.ts +0 -20
- package/lib/components/productCard/components/Header/DeleteButton/index.d.ts +0 -3
- package/lib/components/productCard/components/Header/index.d.ts +0 -3
- package/lib/components/productCard/components/Sales/index.d.ts +0 -3
- package/lib/components/productCard/components/Time/components/SelectHolder/index.d.ts +0 -3
- package/lib/components/productCard/components/Time/components/SelectHolderModal/index.d.ts +0 -13
- package/lib/components/productCard/components/Time/components/SelectResource/index.d.ts +0 -18
- package/lib/components/productCard/components/Time/index.d.ts +0 -3
- package/lib/components/sortableList/index.d.ts +0 -11
- package/lib/components/table/Gallery/components/GalleryItem/index.d.ts +0 -14
- package/lib/components/table/Gallery/index.d.ts +0 -5
- package/lib/components/table/Table/AddFieldModal/index.d.ts +0 -4
- package/lib/components/table/Table/index.d.ts +0 -4
- package/lib/components/table/Table/utils.d.ts +0 -161
- package/lib/components/table/hooks/useTableSetting.d.ts +0 -21
- package/lib/components/table/hooks/useTransColumns.d.ts +0 -14
- package/lib/components/table/hooks/useTransDataSource.d.ts +0 -11
- package/lib/components/table/types.d.ts +0 -268
- package/lib/components/translation/index.d.ts +0 -14
- package/lib/components/versionModal/index.d.ts +0 -23
- package/lib/components/virtual-keyboard/Amount/index.d.ts +0 -5
- package/lib/components/virtual-keyboard/Amount/types.d.ts +0 -44
- package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +0 -25
- package/lib/components/virtual-keyboard/Number/index.d.ts +0 -5
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +0 -13
- package/lib/components/virtual-keyboard/index.d.ts +0 -25
- package/lib/components/virtualInput/index.d.ts +0 -24
- package/lib/index.d.ts +0 -145
- package/lib/locales/en-US.d.ts +0 -307
- package/lib/locales/zh-CN.d.ts +0 -302
- package/lib/locales/zh-TW.d.ts +0 -302
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["title", "description", "dataSource", "showTitle", "showDescription", "groupInfoPosition", "variables", "renderMode", "children", "currentValue", "className", "onDataSourceFinish", "formatSubmitValues", "formatInitialValues", "customSubmit", "leaveConfirmConfig"];
|
|
2
|
+
var _excluded = ["title", "description", "dataSource", "showTitle", "showDescription", "groupInfoPosition", "variables", "renderMode", "children", "currentValue", "className", "onDataSourceFinish", "formatSubmitValues", "formatInitialValues", "customSubmit", "beforeSubmit", "leaveConfirmConfig"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
5
5
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6
6
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
11
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
12
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
14
|
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
@@ -17,7 +22,10 @@ import Form from "../../form";
|
|
|
17
22
|
import FormSettingProvider from "./provider/formSetting/FormSettingProvider";
|
|
18
23
|
import PageHeader from "../../page-header";
|
|
19
24
|
import { transformFormObjToArrayWithUntouched } from "./utils";
|
|
25
|
+
import { getFormSettingMetaData } from "./serve";
|
|
26
|
+
import { getFormSettingParams } from "./urlUtils";
|
|
20
27
|
import "./index.less";
|
|
28
|
+
import { isArr } from "@pisell/utils";
|
|
21
29
|
/**
|
|
22
30
|
* @title: 数据源表单组件
|
|
23
31
|
* @description: 基于数据源动态生成表单,支持编辑、查看、禁用三种模式
|
|
@@ -39,6 +47,7 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
39
47
|
formatSubmitValues = props.formatSubmitValues,
|
|
40
48
|
formatInitialValues = props.formatInitialValues,
|
|
41
49
|
customSubmit = props.customSubmit,
|
|
50
|
+
beforeSubmit = props.beforeSubmit,
|
|
42
51
|
leaveConfirmConfig = props.leaveConfirmConfig,
|
|
43
52
|
others = _objectWithoutProperties(props, _excluded);
|
|
44
53
|
var context = useEngineContext();
|
|
@@ -64,22 +73,74 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
64
73
|
});
|
|
65
74
|
useEffect(function () {
|
|
66
75
|
if (['edit', 'view'].includes(renderMode || '') && dataSource) {
|
|
76
|
+
if (dataSource !== null && dataSource !== void 0 && dataSource.fromSettingMeta) {
|
|
77
|
+
var _dataSource$fields;
|
|
78
|
+
if (props.__designMode === 'design') return;
|
|
79
|
+
// 从URL获取参数
|
|
80
|
+
var _getFormSettingParams = getFormSettingParams(),
|
|
81
|
+
businessCode = _getFormSettingParams.businessCode,
|
|
82
|
+
channelCode = _getFormSettingParams.channelCode,
|
|
83
|
+
isBoard = _getFormSettingParams.isBoard;
|
|
84
|
+
var sectionCodes = Array.from(new Set(dataSource === null || dataSource === void 0 || (_dataSource$fields = dataSource.fields) === null || _dataSource$fields === void 0 ? void 0 : _dataSource$fields.map(function (field) {
|
|
85
|
+
return field.name.split('.').shift();
|
|
86
|
+
})));
|
|
87
|
+
|
|
88
|
+
// 使用API方法获取formSettingMeta数据(必须传入参数)
|
|
89
|
+
getFormSettingMetaData({
|
|
90
|
+
sectionCodes: sectionCodes,
|
|
91
|
+
businessCode: businessCode,
|
|
92
|
+
channelCode: channelCode,
|
|
93
|
+
isBoard: isBoard
|
|
94
|
+
}).then(function (res) {
|
|
95
|
+
var _dataSource$fields2, _formRef$current2;
|
|
96
|
+
var formattedValues = formatInitialValues ? formatInitialValues(res.data) : res.data || {};
|
|
97
|
+
|
|
98
|
+
// 根据 dataSource.fields 筛选 formattedValues
|
|
99
|
+
var fieldNames = new Set((dataSource === null || dataSource === void 0 || (_dataSource$fields2 = dataSource.fields) === null || _dataSource$fields2 === void 0 ? void 0 : _dataSource$fields2.map(function (field) {
|
|
100
|
+
return field.name;
|
|
101
|
+
})) || []);
|
|
102
|
+
var filteredValues = Object.keys(formattedValues).reduce(function (acc, key) {
|
|
103
|
+
if (fieldNames.has(key)) {
|
|
104
|
+
acc[key] = formattedValues[key];
|
|
105
|
+
}
|
|
106
|
+
return acc;
|
|
107
|
+
}, {});
|
|
108
|
+
(_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 || _formRef$current2.setFields(transformFormObjToArrayWithUntouched(_objectSpread({}, filteredValues)));
|
|
109
|
+
}).catch(function (error) {
|
|
110
|
+
console.error('获取formSettingMeta数据失败:', error);
|
|
111
|
+
});
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
67
114
|
get === null || get === void 0 || get.runAsync().then(function (res) {
|
|
68
|
-
var _formRef$
|
|
115
|
+
var _formRef$current3;
|
|
69
116
|
var formattedValues = formatInitialValues ? formatInitialValues(res) : res;
|
|
70
|
-
|
|
117
|
+
var values = formattedValues;
|
|
118
|
+
if (isArr(dataSource === null || dataSource === void 0 ? void 0 : dataSource.fields)) {
|
|
119
|
+
var _dataSource$fields3;
|
|
120
|
+
// 根据 dataSource.fields 筛选 formattedValues
|
|
121
|
+
var fieldNames = new Set((dataSource === null || dataSource === void 0 || (_dataSource$fields3 = dataSource.fields) === null || _dataSource$fields3 === void 0 ? void 0 : _dataSource$fields3.map(function (field) {
|
|
122
|
+
return field.name;
|
|
123
|
+
})) || []);
|
|
124
|
+
values = Object.keys(formattedValues).reduce(function (acc, key) {
|
|
125
|
+
if (fieldNames.has(key)) {
|
|
126
|
+
acc[key] = formattedValues[key];
|
|
127
|
+
}
|
|
128
|
+
return acc;
|
|
129
|
+
}, {});
|
|
130
|
+
}
|
|
131
|
+
(_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 || _formRef$current3.setFields(transformFormObjToArrayWithUntouched(values));
|
|
71
132
|
});
|
|
72
133
|
}
|
|
73
134
|
}, [renderMode, dataSource]);
|
|
74
135
|
|
|
75
136
|
// 检查表单是否可以关闭
|
|
76
137
|
var checkFormClose = useMemoizedFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
77
|
-
var _formRef$
|
|
138
|
+
var _formRef$current4;
|
|
78
139
|
var isFormChanged;
|
|
79
140
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
80
141
|
while (1) switch (_context.prev = _context.next) {
|
|
81
142
|
case 0:
|
|
82
|
-
isFormChanged = (_formRef$
|
|
143
|
+
isFormChanged = (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : _formRef$current4.isFieldsTouched();
|
|
83
144
|
if (!isFormChanged) {
|
|
84
145
|
_context.next = 3;
|
|
85
146
|
break;
|
|
@@ -91,8 +152,8 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
91
152
|
okText: leaveConfirmConfig === null || leaveConfirmConfig === void 0 ? void 0 : leaveConfirmConfig.okText,
|
|
92
153
|
cancelText: leaveConfirmConfig === null || leaveConfirmConfig === void 0 ? void 0 : leaveConfirmConfig.cancelText,
|
|
93
154
|
onOk: function onOk() {
|
|
94
|
-
var _formRef$
|
|
95
|
-
(_formRef$
|
|
155
|
+
var _formRef$current5;
|
|
156
|
+
(_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 || _formRef$current5.resetFields();
|
|
96
157
|
resolve(true);
|
|
97
158
|
},
|
|
98
159
|
onCancel: function onCancel() {
|
|
@@ -118,8 +179,8 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
118
179
|
var _getApp;
|
|
119
180
|
var history = getApp === null || getApp === void 0 || (_getApp = getApp()) === null || _getApp === void 0 || (_getApp = _getApp.history) === null || _getApp === void 0 ? void 0 : _getApp.instance;
|
|
120
181
|
var unblock = history === null || history === void 0 ? void 0 : history.block(function (location, action) {
|
|
121
|
-
var _formRef$
|
|
122
|
-
var isFormChanged = (_formRef$
|
|
182
|
+
var _formRef$current6;
|
|
183
|
+
var isFormChanged = (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : _formRef$current6.isFieldsTouched();
|
|
123
184
|
if (isFormChanged) {
|
|
124
185
|
PisellModal.confirm({
|
|
125
186
|
title: leaveConfirmConfig.title,
|
|
@@ -155,7 +216,8 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
155
216
|
onDataSourceFinish: onDataSourceFinish,
|
|
156
217
|
formatSubmitValues: formatSubmitValues,
|
|
157
218
|
formatInitialValues: formatInitialValues,
|
|
158
|
-
customSubmit: customSubmit
|
|
219
|
+
customSubmit: customSubmit,
|
|
220
|
+
beforeSubmit: beforeSubmit
|
|
159
221
|
}, /*#__PURE__*/React.createElement(Form, _extends({}, others, {
|
|
160
222
|
className: classNames('pisell-lowcode-data-source-form', className),
|
|
161
223
|
ref: formRef,
|
|
@@ -14,7 +14,8 @@ var FormSettingProvider = function FormSettingProvider(props) {
|
|
|
14
14
|
onDataSourceFinish = props.onDataSourceFinish,
|
|
15
15
|
formatSubmitValues = props.formatSubmitValues,
|
|
16
16
|
formatInitialValues = props.formatInitialValues,
|
|
17
|
-
customSubmit = props.customSubmit
|
|
17
|
+
customSubmit = props.customSubmit,
|
|
18
|
+
beforeSubmit = props.beforeSubmit;
|
|
18
19
|
var value = React.useMemo(function () {
|
|
19
20
|
return {
|
|
20
21
|
renderMode: renderMode,
|
|
@@ -24,9 +25,10 @@ var FormSettingProvider = function FormSettingProvider(props) {
|
|
|
24
25
|
onDataSourceFinish: onDataSourceFinish,
|
|
25
26
|
formatSubmitValues: formatSubmitValues,
|
|
26
27
|
formatInitialValues: formatInitialValues,
|
|
27
|
-
customSubmit: customSubmit
|
|
28
|
+
customSubmit: customSubmit,
|
|
29
|
+
beforeSubmit: beforeSubmit
|
|
28
30
|
};
|
|
29
|
-
}, [renderMode, groupInfoPosition, currentValue, size]);
|
|
31
|
+
}, [renderMode, groupInfoPosition, currentValue, size, beforeSubmit]);
|
|
30
32
|
return /*#__PURE__*/React.createElement(FormSettingContext.Provider, {
|
|
31
33
|
value: value
|
|
32
34
|
}, children);
|
|
@@ -267,4 +267,97 @@ export var deleteNocobaseData = /*#__PURE__*/function () {
|
|
|
267
267
|
return function deleteNocobaseData(_x8, _x9, _x10) {
|
|
268
268
|
return _ref12.apply(this, arguments);
|
|
269
269
|
};
|
|
270
|
+
}();
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* 获取formSettingMeta数据
|
|
274
|
+
* @param params 请求参数
|
|
275
|
+
* @param params.sectionCodes 配置段代码数组,如 ['payment']
|
|
276
|
+
* @param params.businessCode 业务代码
|
|
277
|
+
* @param params.channelCode 渠道代码
|
|
278
|
+
* @param params.isBoard 是否包含board_code参数
|
|
279
|
+
* @returns Promise<any> 返回设置元数据
|
|
280
|
+
*/
|
|
281
|
+
export var getFormSettingMetaData = /*#__PURE__*/function () {
|
|
282
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
283
|
+
var sectionCodes, businessCode, channelCode, isBoard, queryParams, url;
|
|
284
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
285
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
286
|
+
case 0:
|
|
287
|
+
console.log('getFormSettingMetaData', params);
|
|
288
|
+
sectionCodes = params.sectionCodes, businessCode = params.businessCode, channelCode = params.channelCode, isBoard = params.isBoard; // 构建查询参数
|
|
289
|
+
queryParams = new URLSearchParams(); // 添加section_code参数(支持多个值)
|
|
290
|
+
sectionCodes.forEach(function (code) {
|
|
291
|
+
queryParams.append('section_code[]', code);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// 添加business_code参数
|
|
295
|
+
if (businessCode) {
|
|
296
|
+
queryParams.append('business_code', businessCode);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// 添加channel_code参数
|
|
300
|
+
if (channelCode) {
|
|
301
|
+
queryParams.append('channel_code', channelCode);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// 当需要包含board_code时,格式为 business_code+channel_code
|
|
305
|
+
if (isBoard && businessCode && channelCode) {
|
|
306
|
+
queryParams.append('board_code', "".concat(businessCode, "+").concat(channelCode));
|
|
307
|
+
}
|
|
308
|
+
url = "/tenant/setting?".concat(queryParams.toString());
|
|
309
|
+
return _context10.abrupt("return", request.getRequest().get(url, {}, {
|
|
310
|
+
headers: {
|
|
311
|
+
'Content-Type': 'application/json'
|
|
312
|
+
}
|
|
313
|
+
}));
|
|
314
|
+
case 9:
|
|
315
|
+
case "end":
|
|
316
|
+
return _context10.stop();
|
|
317
|
+
}
|
|
318
|
+
}, _callee10);
|
|
319
|
+
}));
|
|
320
|
+
return function getFormSettingMetaData(_x11) {
|
|
321
|
+
return _ref13.apply(this, arguments);
|
|
322
|
+
};
|
|
323
|
+
}();
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* 更新租户设置数据
|
|
327
|
+
* @param params 请求参数
|
|
328
|
+
* @param params.businessCode 业务代码
|
|
329
|
+
* @param params.channelCode 渠道代码
|
|
330
|
+
* @param params.boardCode 板块代码
|
|
331
|
+
* @param params.data 要更新的数据对象,如 {"order.prefix":"","order.suffix":"","payment.number":""}
|
|
332
|
+
* @returns Promise<any> 返回更新结果
|
|
333
|
+
*/
|
|
334
|
+
export var updateTenantSetting = /*#__PURE__*/function () {
|
|
335
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
336
|
+
var business_code, channel_code, board_code, data, requestBody, url;
|
|
337
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
338
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
339
|
+
case 0:
|
|
340
|
+
console.log('updateTenantSetting', params);
|
|
341
|
+
business_code = params.business_code, channel_code = params.channel_code, board_code = params.board_code, data = params.data; // 构建请求体,按照 curl 请求的格式
|
|
342
|
+
requestBody = {
|
|
343
|
+
business_code: business_code,
|
|
344
|
+
channel_code: channel_code,
|
|
345
|
+
board_code: board_code,
|
|
346
|
+
data: data
|
|
347
|
+
};
|
|
348
|
+
url = '/tenant/setting';
|
|
349
|
+
return _context11.abrupt("return", request.getRequest().post(url, requestBody, {
|
|
350
|
+
headers: {
|
|
351
|
+
'Content-Type': 'application/json'
|
|
352
|
+
}
|
|
353
|
+
}));
|
|
354
|
+
case 5:
|
|
355
|
+
case "end":
|
|
356
|
+
return _context11.stop();
|
|
357
|
+
}
|
|
358
|
+
}, _callee11);
|
|
359
|
+
}));
|
|
360
|
+
return function updateTenantSetting(_x12) {
|
|
361
|
+
return _ref14.apply(this, arguments);
|
|
362
|
+
};
|
|
270
363
|
}();
|
|
@@ -17,7 +17,9 @@ import useFormSetting from "../provider/hooks/useFormSetting";
|
|
|
17
17
|
import useCtxActions from "../../hooks/useCtxActions";
|
|
18
18
|
import useDataSource from "../../hooks/useDataSource";
|
|
19
19
|
import { filterSystemFields, setFormFieldsUntouched } from "../utils";
|
|
20
|
+
import { getFormSettingParams } from "../urlUtils";
|
|
20
21
|
import "./index.less";
|
|
22
|
+
import { updateTenantSetting } from "../serve";
|
|
21
23
|
// 表单提交按钮
|
|
22
24
|
var SubmitButton = function SubmitButton(props) {
|
|
23
25
|
var children = props.children,
|
|
@@ -43,59 +45,80 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
43
45
|
renderMode = _useFormSetting.renderMode,
|
|
44
46
|
onDataSourceFinish = _useFormSetting.onDataSourceFinish,
|
|
45
47
|
formatSubmitValues = _useFormSetting.formatSubmitValues,
|
|
46
|
-
customSubmit = _useFormSetting.customSubmit
|
|
48
|
+
customSubmit = _useFormSetting.customSubmit,
|
|
49
|
+
beforeSubmit = _useFormSetting.beforeSubmit;
|
|
47
50
|
var _useCtxActions = useCtxActions(),
|
|
48
51
|
setVisible = _useCtxActions.setVisible,
|
|
49
52
|
refreshTableData = _useCtxActions.refreshTableData;
|
|
50
53
|
var _useDataSource = useDataSource(),
|
|
51
54
|
create = _useDataSource.create,
|
|
52
|
-
update = _useDataSource.update
|
|
55
|
+
update = _useDataSource.update,
|
|
56
|
+
dataSource = _useDataSource.dataSource;
|
|
53
57
|
var isDisabled = status === 'disabled';
|
|
54
58
|
var onSubmit = /*#__PURE__*/function () {
|
|
55
59
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
|
|
56
|
-
var res;
|
|
60
|
+
var urlParams, business_code, channel_code, board_code, res;
|
|
57
61
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
58
62
|
while (1) switch (_context.prev = _context.next) {
|
|
59
63
|
case 0:
|
|
60
64
|
setLoading(true);
|
|
61
65
|
_context.prev = 1;
|
|
66
|
+
if (!(dataSource !== null && dataSource !== void 0 && dataSource.fromSettingMeta)) {
|
|
67
|
+
_context.next = 10;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
// 从URL查询字符串获取参数
|
|
71
|
+
urlParams = getFormSettingParams();
|
|
72
|
+
business_code = urlParams.businessCode;
|
|
73
|
+
channel_code = urlParams.channelCode; // 只有当isBoard参数为1时才设置boardCode
|
|
74
|
+
board_code = urlParams.isBoard && business_code && channel_code ? "".concat(business_code, "+").concat(channel_code) : undefined;
|
|
75
|
+
_context.next = 9;
|
|
76
|
+
return updateTenantSetting({
|
|
77
|
+
business_code: business_code,
|
|
78
|
+
channel_code: channel_code,
|
|
79
|
+
board_code: board_code,
|
|
80
|
+
data: values
|
|
81
|
+
});
|
|
82
|
+
case 9:
|
|
83
|
+
return _context.abrupt("return", _context.sent);
|
|
84
|
+
case 10:
|
|
62
85
|
if (!customSubmit) {
|
|
63
|
-
_context.next =
|
|
86
|
+
_context.next = 14;
|
|
64
87
|
break;
|
|
65
88
|
}
|
|
66
|
-
_context.next =
|
|
89
|
+
_context.next = 13;
|
|
67
90
|
return customSubmit(values);
|
|
68
|
-
case
|
|
91
|
+
case 13:
|
|
69
92
|
return _context.abrupt("return", _context.sent);
|
|
70
|
-
case
|
|
93
|
+
case 14:
|
|
71
94
|
if (!(renderMode === 'edit')) {
|
|
72
|
-
_context.next =
|
|
95
|
+
_context.next = 20;
|
|
73
96
|
break;
|
|
74
97
|
}
|
|
75
|
-
_context.next =
|
|
98
|
+
_context.next = 17;
|
|
76
99
|
return update.runAsync(values);
|
|
77
|
-
case
|
|
100
|
+
case 17:
|
|
78
101
|
return _context.abrupt("return", _context.sent);
|
|
79
|
-
case
|
|
102
|
+
case 20:
|
|
80
103
|
if (!(renderMode === 'add')) {
|
|
81
|
-
_context.next =
|
|
104
|
+
_context.next = 26;
|
|
82
105
|
break;
|
|
83
106
|
}
|
|
84
|
-
_context.next =
|
|
107
|
+
_context.next = 23;
|
|
85
108
|
return create.runAsync(values);
|
|
86
|
-
case
|
|
109
|
+
case 23:
|
|
87
110
|
res = _context.sent;
|
|
88
111
|
form === null || form === void 0 || form.resetFields();
|
|
89
112
|
return _context.abrupt("return", res);
|
|
90
|
-
case
|
|
91
|
-
_context.prev =
|
|
113
|
+
case 26:
|
|
114
|
+
_context.prev = 26;
|
|
92
115
|
setLoading(false);
|
|
93
|
-
return _context.finish(
|
|
94
|
-
case
|
|
116
|
+
return _context.finish(26);
|
|
117
|
+
case 29:
|
|
95
118
|
case "end":
|
|
96
119
|
return _context.stop();
|
|
97
120
|
}
|
|
98
|
-
}, _callee, null, [[1,,
|
|
121
|
+
}, _callee, null, [[1,, 26, 29]]);
|
|
99
122
|
}));
|
|
100
123
|
return function onSubmit(_x) {
|
|
101
124
|
return _ref.apply(this, arguments);
|
|
@@ -130,7 +153,7 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
130
153
|
// 验证表单并提交
|
|
131
154
|
var handleValideFieldsSubmit = /*#__PURE__*/function () {
|
|
132
155
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
|
|
133
|
-
var allValues, filteredValues, formattedValues, result, afterSubmitFunc;
|
|
156
|
+
var allValues, filteredValues, formattedValues, canSubmit, result, afterSubmitFunc;
|
|
134
157
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
135
158
|
while (1) switch (_context2.prev = _context2.next) {
|
|
136
159
|
case 0:
|
|
@@ -149,10 +172,24 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
149
172
|
});
|
|
150
173
|
}
|
|
151
174
|
filteredValues = filterSystemFields(allValues); // 格式化提交数据
|
|
152
|
-
formattedValues = formatSubmitValues ? formatSubmitValues(filteredValues) : filteredValues;
|
|
153
|
-
|
|
175
|
+
formattedValues = formatSubmitValues ? formatSubmitValues(filteredValues) : filteredValues; // 提交前校验
|
|
176
|
+
if (!beforeSubmit) {
|
|
177
|
+
_context2.next = 14;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
_context2.next = 11;
|
|
181
|
+
return beforeSubmit(formattedValues);
|
|
182
|
+
case 11:
|
|
183
|
+
canSubmit = _context2.sent;
|
|
184
|
+
if (canSubmit) {
|
|
185
|
+
_context2.next = 14;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
return _context2.abrupt("return");
|
|
189
|
+
case 14:
|
|
190
|
+
_context2.next = 16;
|
|
154
191
|
return onSubmit(formattedValues);
|
|
155
|
-
case
|
|
192
|
+
case 16:
|
|
156
193
|
result = _context2.sent;
|
|
157
194
|
// 数据源提交成功
|
|
158
195
|
if (onDataSourceFinish) {
|
|
@@ -173,19 +210,20 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
173
210
|
}
|
|
174
211
|
}
|
|
175
212
|
setFormFieldsUntouched(form);
|
|
176
|
-
_context2.next =
|
|
213
|
+
_context2.next = 28;
|
|
177
214
|
break;
|
|
178
|
-
case
|
|
179
|
-
_context2.prev =
|
|
215
|
+
case 24:
|
|
216
|
+
_context2.prev = 24;
|
|
180
217
|
_context2.t0 = _context2["catch"](0);
|
|
218
|
+
debugger;
|
|
181
219
|
PisellToast({
|
|
182
220
|
content: "".concat(_context2.t0.message)
|
|
183
221
|
});
|
|
184
|
-
case
|
|
222
|
+
case 28:
|
|
185
223
|
case "end":
|
|
186
224
|
return _context2.stop();
|
|
187
225
|
}
|
|
188
|
-
}, _callee2, null, [[0,
|
|
226
|
+
}, _callee2, null, [[0, 24]]);
|
|
189
227
|
}));
|
|
190
228
|
return function handleValideFieldsSubmit(_x2) {
|
|
191
229
|
return _ref2.apply(this, arguments);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
/**
|
|
6
|
+
* URL参数处理工具方法
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { request } from "../../table/utils";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 从浏览器URL获取查询参数
|
|
13
|
+
* @returns Record<string, string> URL查询参数对象
|
|
14
|
+
*/
|
|
15
|
+
export var getUrlParams = function getUrlParams() {
|
|
16
|
+
var urlSearchParams = new URLSearchParams(window.location.search);
|
|
17
|
+
var urlParams = {};
|
|
18
|
+
urlSearchParams.forEach(function (value, key) {
|
|
19
|
+
urlParams[key] = value;
|
|
20
|
+
});
|
|
21
|
+
return urlParams;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 从URL参数中提取formSettingMeta相关的参数
|
|
26
|
+
* @param urlParams URL查询参数对象,如果不传则自动从浏览器获取
|
|
27
|
+
* @returns 包含business_code、channel_code和isBoard参数的对象
|
|
28
|
+
*/
|
|
29
|
+
export var getFormSettingParams = function getFormSettingParams(urlParams) {
|
|
30
|
+
var params = urlParams || getUrlParams();
|
|
31
|
+
return {
|
|
32
|
+
businessCode: params.businessCode || params.business_code,
|
|
33
|
+
channelCode: params.channelCode || params.channel_code,
|
|
34
|
+
isBoard: params.is_board === '1'
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 根据URL参数更新租户设置数据
|
|
40
|
+
* @param data 要更新的数据对象,如 {"order.prefix":"","order.suffix":"","payment.number":""}
|
|
41
|
+
* @returns Promise<any> 返回更新结果
|
|
42
|
+
*/
|
|
43
|
+
export var updateTenantSettingFromUrl = /*#__PURE__*/function () {
|
|
44
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
45
|
+
var urlParams, businessCode, channelCode, boardCode, requestBody, url;
|
|
46
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
47
|
+
while (1) switch (_context.prev = _context.next) {
|
|
48
|
+
case 0:
|
|
49
|
+
// 从URL获取参数
|
|
50
|
+
debugger;
|
|
51
|
+
urlParams = getFormSettingParams();
|
|
52
|
+
businessCode = urlParams.businessCode;
|
|
53
|
+
channelCode = urlParams.channelCode;
|
|
54
|
+
boardCode = urlParams.isBoard && businessCode && channelCode ? "".concat(businessCode, "+").concat(channelCode) : undefined; // 构建请求体,按照 curl 请求的格式
|
|
55
|
+
requestBody = {
|
|
56
|
+
business_code: businessCode || '',
|
|
57
|
+
channel_code: channelCode || '',
|
|
58
|
+
board_code: boardCode || '',
|
|
59
|
+
data: data
|
|
60
|
+
};
|
|
61
|
+
url = '/tenant/setting';
|
|
62
|
+
return _context.abrupt("return", request.getRequest().post(url, requestBody, {
|
|
63
|
+
headers: {
|
|
64
|
+
'Content-Type': 'application/json'
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
case 8:
|
|
68
|
+
case "end":
|
|
69
|
+
return _context.stop();
|
|
70
|
+
}
|
|
71
|
+
}, _callee);
|
|
72
|
+
}));
|
|
73
|
+
return function updateTenantSettingFromUrl(_x) {
|
|
74
|
+
return _ref.apply(this, arguments);
|
|
75
|
+
};
|
|
76
|
+
}();
|
|
@@ -138,11 +138,10 @@ export var withFormItem = function withFormItem(WrappedComponent, overlayProps)
|
|
|
138
138
|
var renderComponent = useMemo(function () {
|
|
139
139
|
var _overlayProps$innerPr;
|
|
140
140
|
// 使用renderMode属性,避免和组件mode冲突
|
|
141
|
-
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, otherProps, {
|
|
141
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.innerProps, otherProps, {
|
|
142
142
|
mode: propsMode,
|
|
143
|
-
renderMode: effectiveMode
|
|
144
|
-
|
|
145
|
-
style: _objectSpread(_objectSpread({}, innerStyle || {}), (overlayProps === null || overlayProps === void 0 || (_overlayProps$innerPr = overlayProps.innerProps) === null || _overlayProps$innerPr === void 0 ? void 0 : _overlayProps$innerPr.style) || {}),
|
|
143
|
+
renderMode: effectiveMode,
|
|
144
|
+
style: _objectSpread(_objectSpread({}, (overlayProps === null || overlayProps === void 0 || (_overlayProps$innerPr = overlayProps.innerProps) === null || _overlayProps$innerPr === void 0 ? void 0 : _overlayProps$innerPr.style) || {}), innerStyle || {}),
|
|
146
145
|
fieldKey: name,
|
|
147
146
|
isVerification: typeobj === null || typeobj === void 0 ? void 0 : typeobj.enabled,
|
|
148
147
|
size: size
|
|
@@ -89,6 +89,7 @@ var BaseTable = function BaseTable(props, ref) {
|
|
|
89
89
|
}, [dataSourceKey]);
|
|
90
90
|
useEffect(function () {
|
|
91
91
|
if (dataSourceKeyRef.current) {
|
|
92
|
+
if (dataSource !== null && dataSource !== void 0 && dataSource.fromSettingMeta) return;
|
|
92
93
|
list === null || list === void 0 || list.run(queryPageConfig);
|
|
93
94
|
} else {
|
|
94
95
|
list === null || list === void 0 || list.mutate([]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const useDataSourceKey: () => {
|
|
2
|
-
dataSourceKey: string | undefined;
|
|
3
|
-
dataSourceKeyRef: import("react").MutableRefObject<string | undefined>;
|
|
2
|
+
dataSourceKey: string | import("../../provider/dataSource/DataSourceContext").DataSourceType | undefined;
|
|
3
|
+
dataSourceKeyRef: import("react").MutableRefObject<string | import("../../provider/dataSource/DataSourceContext").DataSourceType | undefined>;
|
|
4
4
|
};
|
|
5
5
|
export default useDataSourceKey;
|
|
@@ -8,7 +8,7 @@ declare const useDrawerState: (operationContent?: {
|
|
|
8
8
|
openDrawer: (item: OperationItem) => void;
|
|
9
9
|
closeDrawer: () => void;
|
|
10
10
|
drawerContent: import("react").ReactNode;
|
|
11
|
-
Container: {
|
|
11
|
+
Container: typeof Drawer | {
|
|
12
12
|
(props: import("../../../pisellModal").PisellModalProps): JSX.Element;
|
|
13
13
|
confirm: (props: import("../../../pisellModal/components/functions").PisellModalFuncProps) => {
|
|
14
14
|
destroy: () => void;
|
|
@@ -32,7 +32,7 @@ declare const useDrawerState: (operationContent?: {
|
|
|
32
32
|
update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
|
|
33
33
|
};
|
|
34
34
|
Information: (props: import("../../../pisellModal/components/Information").InformationProps) => JSX.Element;
|
|
35
|
-
}
|
|
35
|
+
};
|
|
36
36
|
containerProps: {};
|
|
37
37
|
};
|
|
38
38
|
export default useDrawerState;
|