@pisell/materials 1.0.472 → 1.0.473
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 +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +18 -18
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +15 -15
- package/es/components/dataSourceComponents/dataSourceForm/index.less +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/serve.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/serve.js +4 -3
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +41 -17
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +3 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.js +4 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +3 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.js +4 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceTypography/index.d.ts +10 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceTypography/index.js +15 -0
- package/es/components/dataSourceComponents/dataSourceShow/utils.d.ts +6 -0
- package/es/components/dataSourceComponents/dataSourceShow/utils.js +82 -0
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +33 -139
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +25 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +162 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +8 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.js +135 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDesignMode.js +35 -39
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +20 -4
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.js +65 -11
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +17 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +105 -6
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +77 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +245 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +20 -7
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +41 -12
- package/es/components/dataSourceComponents/dataSourceTable/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/index.js +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/index.less +5 -0
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +57 -9
- package/es/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.d.ts +7 -0
- package/es/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.js +23 -0
- package/es/components/dataSourceComponents/dataSourceWrapper/index.d.ts +2 -4
- package/es/components/dataSourceComponents/dataSourceWrapper/index.js +17 -2
- package/es/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +7 -1
- package/es/components/dataSourceComponents/fields/Checkbox/index.js +3 -1
- package/es/components/dataSourceComponents/fields/DatePicker/index.js +5 -1
- package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +7 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/WithMode.js +5 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/index.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/index.js +5 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/index.less +14 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/type.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Input/index.d.ts +6 -1
- package/es/components/dataSourceComponents/fields/Input/index.js +4 -0
- package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +5 -0
- package/es/components/dataSourceComponents/fields/Input.Email/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Input.Email/WithMode.js +17 -0
- package/es/components/dataSourceComponents/fields/Input.Email/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Input.Email/index.js +4 -0
- package/es/components/dataSourceComponents/fields/Input.Email/type.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Input.Email/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Input.Json/ReadPretty.js +2 -2
- package/es/components/dataSourceComponents/fields/Input.Json/WithMode.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/Input.Json/WithMode.js +41 -1
- package/es/components/dataSourceComponents/fields/Input.Json/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +5 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +12 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/index.js +4 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/type.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/type.js +1 -0
- package/es/components/dataSourceComponents/fields/InputNumber/index.js +5 -1
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +46 -5
- package/es/components/dataSourceComponents/fields/index.js +7 -2
- package/es/components/dataSourceComponents/fields/type.d.ts +18 -0
- package/es/components/dataSourceComponents/fields/type.js +1 -0
- package/es/components/dataSourceComponents/fields/utils.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/utils.js +111 -0
- package/es/components/dataSourceComponents/hooks/useActions.js +22 -7
- package/es/components/dataSourceComponents/hooks/useComponentId.d.ts +2 -0
- package/es/components/dataSourceComponents/hooks/useComponentId.js +9 -0
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +19 -2
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.d.ts +1 -1
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +37 -27
- package/es/components/dataSourceComponents/provider/variables/VariablesContext.d.ts +3 -2
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +19 -13
- package/es/components/dataSourceComponents/provider/variables/utils.d.ts +2 -0
- package/es/components/dataSourceComponents/provider/variables/utils.js +9 -0
- package/es/components/filter/components/Dropdown/index.d.ts +1 -0
- package/es/components/filter/components/Dropdown/index.js +6 -2
- package/es/components/filter/components/FilterButton/index.js +5 -3
- package/es/components/filter/components/FilterButton/types.d.ts +2 -0
- package/es/components/table/Actions/index.js +16 -7
- package/es/components/table/Gallery/index.d.ts +3 -3
- package/es/components/table/Gallery/index.js +25 -7
- package/es/components/table/Gallery/index.less +1 -0
- package/es/components/table/Header/index.d.ts +10 -3
- package/es/components/table/Header/index.js +37 -11
- package/es/components/table/Header/index.less +10 -2
- package/es/components/table/Table/utils.js +4 -0
- package/es/components/table/Tabs/index.d.ts +14 -0
- package/es/components/table/Tabs/index.js +37 -0
- package/es/components/table/hooks/useTriggerValuesChange.js +3 -0
- package/es/components/table/index.js +16 -3
- package/es/components/table/types.d.ts +14 -2
- package/es/components/typography/index.d.ts +2 -2
- package/es/components/typography/index.js +4 -3
- package/es/index.d.ts +4 -0
- package/es/index.js +5 -1
- package/es/locales/en-US.d.ts +7 -0
- package/es/locales/en-US.js +16 -1
- package/es/locales/zh-CN.d.ts +7 -0
- package/es/locales/zh-CN.js +16 -1
- package/es/locales/zh-TW.d.ts +7 -0
- package/es/locales/zh-TW.js +16 -1
- package/lib/components/dataSourceComponents/dataSourceForm/index.less +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/serve.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/serve.js +3 -2
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +58 -11
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.js +38 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.js +38 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceTypography/index.d.ts +10 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceTypography/index.js +44 -0
- package/lib/components/dataSourceComponents/dataSourceShow/utils.d.ts +6 -0
- package/lib/components/dataSourceComponents/dataSourceShow/utils.js +95 -0
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +29 -90
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +25 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +176 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +8 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.js +176 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDesignMode.js +24 -37
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +20 -4
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.js +53 -7
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +17 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +73 -3
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +77 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +236 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +20 -7
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +38 -11
- package/lib/components/dataSourceComponents/dataSourceTable/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/index.js +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/index.less +5 -0
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +57 -9
- package/lib/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.d.ts +7 -0
- package/lib/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.js +51 -0
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +2 -4
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.js +14 -2
- package/lib/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +3 -1
- package/lib/components/dataSourceComponents/fields/Checkbox/index.js +3 -1
- package/lib/components/dataSourceComponents/fields/DatePicker/index.js +5 -1
- package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +41 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/WithMode.js +42 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/index.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/index.js +39 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/index.less +14 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/type.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Input/index.d.ts +6 -1
- package/lib/components/dataSourceComponents/fields/Input/index.js +4 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +39 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/WithMode.js +57 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/index.js +38 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/type.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Input.Json/ReadPretty.js +2 -2
- package/lib/components/dataSourceComponents/fields/Input.Json/WithMode.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Input.Json/WithMode.js +30 -2
- package/lib/components/dataSourceComponents/fields/Input.Json/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +39 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +43 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/index.js +38 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/type.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/InputNumber/index.js +5 -1
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +46 -5
- package/lib/components/dataSourceComponents/fields/index.js +6 -1
- package/lib/components/dataSourceComponents/fields/type.d.ts +18 -0
- package/lib/components/dataSourceComponents/fields/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/utils.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/utils.js +134 -0
- package/lib/components/dataSourceComponents/hooks/useActions.js +14 -5
- package/lib/components/dataSourceComponents/hooks/useComponentId.d.ts +2 -0
- package/lib/components/dataSourceComponents/hooks/useComponentId.js +32 -0
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +19 -2
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.d.ts +1 -1
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +29 -16
- package/lib/components/dataSourceComponents/provider/variables/VariablesContext.d.ts +3 -2
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +17 -8
- package/lib/components/dataSourceComponents/provider/variables/utils.d.ts +2 -0
- package/lib/components/dataSourceComponents/provider/variables/utils.js +15 -2
- package/lib/components/filter/components/Dropdown/index.d.ts +1 -0
- package/lib/components/filter/components/Dropdown/index.js +6 -2
- package/lib/components/filter/components/FilterButton/index.js +5 -3
- package/lib/components/filter/components/FilterButton/types.d.ts +2 -0
- package/lib/components/table/Actions/index.js +18 -9
- package/lib/components/table/Gallery/index.d.ts +3 -3
- package/lib/components/table/Gallery/index.js +17 -0
- package/lib/components/table/Gallery/index.less +1 -0
- package/lib/components/table/Header/index.d.ts +10 -3
- package/lib/components/table/Header/index.js +29 -4
- package/lib/components/table/Header/index.less +10 -2
- package/lib/components/table/Table/utils.js +4 -0
- package/lib/components/table/Tabs/index.d.ts +14 -0
- package/lib/components/table/Tabs/index.js +70 -0
- package/lib/components/table/hooks/useTriggerValuesChange.js +3 -0
- package/lib/components/table/index.js +17 -2
- package/lib/components/table/types.d.ts +14 -2
- package/lib/components/typography/index.d.ts +2 -2
- package/lib/components/typography/index.js +4 -3
- package/lib/index.d.ts +4 -0
- package/lib/index.js +12 -0
- package/lib/locales/en-US.d.ts +7 -0
- package/lib/locales/en-US.js +8 -1
- package/lib/locales/zh-CN.d.ts +7 -0
- package/lib/locales/zh-CN.js +8 -1
- package/lib/locales/zh-TW.d.ts +7 -0
- package/lib/locales/zh-TW.js +8 -1
- package/lowcode/_utils/defaultSchema.ts +452 -83
- package/lowcode/_utils/type.ts +5 -0
- package/lowcode/_utils/utils.ts +1 -0
- package/lowcode/button/meta.ts +1 -2
- package/lowcode/data-source-form/constants.ts +5 -0
- package/lowcode/data-source-form/meta.ts +259 -273
- package/lowcode/data-source-form/snippets.ts +9 -0
- package/lowcode/data-source-form/utils.ts +80 -15
- package/lowcode/data-source-image/meta.ts +74 -0
- package/lowcode/data-source-image/snippets.ts +14 -0
- package/lowcode/data-source-qrcode/meta.ts +158 -0
- package/lowcode/data-source-qrcode/snippets.ts +20 -0
- package/lowcode/data-source-table/meta.ts +4577 -2285
- package/lowcode/data-source-table/snippets.ts +10 -4
- package/lowcode/data-source-table/utils.tsx +254 -0
- package/lowcode/data-source-typography/meta.ts +54 -0
- package/lowcode/data-source-typography.text/meta.ts +212 -0
- package/lowcode/data-source-typography.text/snippets.ts +12 -0
- package/lowcode/data-source-wrapper/meta.ts +243 -0
- package/lowcode/data-source-wrapper/snippets.ts +11 -0
- package/lowcode/data-source-wrapper/utils.ts +45 -0
- package/lowcode/form-item-color-picker/snippets.ts +1 -0
- package/lowcode/form-item-input/meta.ts +2 -1
- package/lowcode/form-item-input/snippets.ts +2 -1
- package/lowcode/form-item-input.email/meta.ts +284 -0
- package/lowcode/form-item-input.email/snippets.ts +35 -0
- package/lowcode/form-item-input.phone/meta.ts +295 -0
- package/lowcode/form-item-input.phone/snippets.ts +16 -0
- package/lowcode/form-item-input.text-area/meta.ts +243 -32
- package/lowcode/form-item-input.text-area/snippets.ts +2 -1
- package/lowcode/form-item-input.url/meta.ts +44 -20
- package/lowcode/form-item-input.url/snippets.ts +5 -5
- package/lowcode/table/snippets.ts +6 -0
- package/lowcode/test/meta.ts +1 -2
- package/package.json +2 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/dataSourceComponents/fields/Input.Phone/index.tsx
|
|
30
|
+
var Input_exports = {};
|
|
31
|
+
__export(Input_exports, {
|
|
32
|
+
default: () => Input_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Input_exports);
|
|
35
|
+
var import_utils = require("../../dataSourceForm/utils");
|
|
36
|
+
var import_WithMode = __toESM(require("./WithMode"));
|
|
37
|
+
var Phone = (0, import_utils.withFormItem)(import_WithMode.default);
|
|
38
|
+
var Input_default = Phone;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/components/dataSourceComponents/fields/Input.Phone/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
|
@@ -34,5 +34,9 @@ __export(InputNumber_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(InputNumber_exports);
|
|
35
35
|
var import_utils = require("../../dataSourceForm/utils");
|
|
36
36
|
var import_WithMode = __toESM(require("./WithMode"));
|
|
37
|
-
var InputNumber = (0, import_utils.withFormItem)(import_WithMode.default
|
|
37
|
+
var InputNumber = (0, import_utils.withFormItem)(import_WithMode.default, {
|
|
38
|
+
innerStyle: {
|
|
39
|
+
width: "100%"
|
|
40
|
+
}
|
|
41
|
+
});
|
|
38
42
|
var InputNumber_default = InputNumber;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const SelectWithDataSource: (props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../../dataSourceForm/utils").WithModeProps & import("../../dataSourceForm/utils").WithFormItemProps & {
|
|
3
3
|
options?: any;
|
|
4
|
-
optionSourceType?:
|
|
4
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
5
5
|
labelField: string;
|
|
6
6
|
valueField: string;
|
|
7
7
|
} & {
|
|
@@ -1,23 +1,64 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
declare const formFieldMap: {
|
|
3
|
+
Checkbox: import("react").FC<{}> & {
|
|
4
|
+
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
5
|
+
} & {
|
|
6
|
+
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
7
|
+
};
|
|
8
|
+
ColorPicker: import("react").FC<import("antd").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
9
|
+
DatePicker: import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
10
|
+
Input: import("react").FC<import("./Input/type").InputProps> & {
|
|
11
|
+
JSON: import("react").FC<any>;
|
|
12
|
+
Password: import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
13
|
+
TextArea: import("react").FC<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
14
|
+
URL: import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
15
|
+
Email: import("react").FC<import("antd").InputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
16
|
+
Phone: import("react").FC<import("antd").InputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
17
|
+
};
|
|
18
|
+
Radio: import("react").FC<{}> & {
|
|
19
|
+
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
20
|
+
} & {
|
|
21
|
+
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
22
|
+
};
|
|
23
|
+
Select: (props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
24
|
+
options?: any;
|
|
25
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
26
|
+
labelField: string;
|
|
27
|
+
valueField: string;
|
|
28
|
+
} & {
|
|
29
|
+
dataSource?: any;
|
|
30
|
+
}) => import("react").JSX.Element;
|
|
31
|
+
InputNumber: import("react").FC<any>;
|
|
32
|
+
Percent: import("react").FC<any>;
|
|
33
|
+
TimePicker: import("react").FC<import("antd").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
34
|
+
'Input.JSON': import("react").FC<any>;
|
|
35
|
+
'Input.URL': import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
36
|
+
'Input.Password': import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
37
|
+
'Radio.Group': import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
38
|
+
'Checkbox.Group': import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
39
|
+
DateRangePicker: import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
40
|
+
};
|
|
2
41
|
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<any> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
|
|
3
42
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
4
43
|
} & {
|
|
5
44
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
6
|
-
}) | import("react").FC<import("antd").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").
|
|
7
|
-
JSON: import("react").FC<
|
|
45
|
+
}) | import("react").FC<import("antd").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
|
|
46
|
+
JSON: import("react").FC<any>;
|
|
8
47
|
Password: import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
9
48
|
TextArea: import("react").FC<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
10
49
|
URL: import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
50
|
+
Email: import("react").FC<import("antd").InputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
51
|
+
Phone: import("react").FC<import("antd").InputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
11
52
|
}) | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
|
|
12
53
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
13
54
|
} & {
|
|
14
55
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
15
56
|
}) | ((props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
16
57
|
options?: any;
|
|
17
|
-
optionSourceType?:
|
|
58
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
18
59
|
labelField: string;
|
|
19
60
|
valueField: string;
|
|
20
61
|
} & {
|
|
21
62
|
dataSource?: any;
|
|
22
|
-
}) => import("react").JSX.Element) | import("react").FC<import("antd").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
23
|
-
export { getFieldComponent };
|
|
63
|
+
}) => import("react").JSX.Element) | import("react").FC<import("antd").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
64
|
+
export { getFieldComponent, formFieldMap };
|
|
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/components/dataSourceComponents/fields/index.ts
|
|
30
30
|
var fields_exports = {};
|
|
31
31
|
__export(fields_exports, {
|
|
32
|
+
formFieldMap: () => formFieldMap,
|
|
32
33
|
getFieldComponent: () => getFieldComponent
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(fields_exports);
|
|
@@ -40,6 +41,7 @@ var import_Radio = __toESM(require("./Radio"));
|
|
|
40
41
|
var import_Select = __toESM(require("./Select"));
|
|
41
42
|
var import_InputNumber = __toESM(require("./InputNumber"));
|
|
42
43
|
var import_TimePicker = __toESM(require("./TimePicker"));
|
|
44
|
+
var import_DateRangePicker = __toESM(require("./DateRangePicker"));
|
|
43
45
|
var formFieldMap = {
|
|
44
46
|
Checkbox: import_Checkbox.default,
|
|
45
47
|
ColorPicker: import_ColorPicker.default,
|
|
@@ -48,17 +50,20 @@ var formFieldMap = {
|
|
|
48
50
|
Radio: import_Radio.default,
|
|
49
51
|
Select: import_Select.default,
|
|
50
52
|
InputNumber: import_InputNumber.default,
|
|
53
|
+
Percent: import_InputNumber.default,
|
|
51
54
|
TimePicker: import_TimePicker.default,
|
|
52
55
|
"Input.JSON": import_Input.default.JSON,
|
|
53
56
|
"Input.URL": import_Input.default.URL,
|
|
54
57
|
"Input.Password": import_Input.default.Password,
|
|
55
58
|
"Radio.Group": import_Radio.default.Group,
|
|
56
|
-
"Checkbox.Group": import_Checkbox.default.Group
|
|
59
|
+
"Checkbox.Group": import_Checkbox.default.Group,
|
|
60
|
+
DateRangePicker: import_DateRangePicker.default
|
|
57
61
|
};
|
|
58
62
|
var getFieldComponent = (fieldComponent) => {
|
|
59
63
|
return formFieldMap[fieldComponent];
|
|
60
64
|
};
|
|
61
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
66
|
0 && (module.exports = {
|
|
67
|
+
formFieldMap,
|
|
63
68
|
getFieldComponent
|
|
64
69
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Field } from '../provider/dataSource/DataSourceContext';
|
|
2
|
+
import { formFieldMap } from './index';
|
|
3
|
+
export declare type FormFieldComponentType = keyof typeof formFieldMap;
|
|
4
|
+
export declare type FilterFunctionReturnType = {
|
|
5
|
+
$eq?: any;
|
|
6
|
+
$includes?: string;
|
|
7
|
+
$in?: (string | number)[];
|
|
8
|
+
$anyOf?: (string | number)[];
|
|
9
|
+
$isTruly?: boolean;
|
|
10
|
+
$dateAfter?: string;
|
|
11
|
+
$dateBefore?: string;
|
|
12
|
+
$and?: Array<{
|
|
13
|
+
$dateAfter?: string;
|
|
14
|
+
$dateBefore?: string;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
export declare type FilterFunction = (value: any, field: Field) => FilterFunctionReturnType | null;
|
|
18
|
+
export declare type FormFieldFilterFuncMapType = Record<FormFieldComponentType, FilterFunction>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/components/dataSourceComponents/fields/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/dataSourceComponents/fields/utils.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
formFieldFilterFuncMap: () => formFieldFilterFuncMap
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(utils_exports);
|
|
25
|
+
var import_utils = require("@pisell/utils");
|
|
26
|
+
var formFieldFilterFuncMap = {
|
|
27
|
+
Checkbox: (value) => {
|
|
28
|
+
const key = value ? "$isTruly" : "$isFalsy";
|
|
29
|
+
return {
|
|
30
|
+
[key]: true
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
ColorPicker: (value) => {
|
|
34
|
+
return {
|
|
35
|
+
$eq: value
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
DatePicker: (value) => {
|
|
39
|
+
const [start, end] = value;
|
|
40
|
+
if (!start || !end) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const startDate = (0, import_utils.isString)(start) ? start : start.format("YYYY-MM-DD HH:mm:ss");
|
|
44
|
+
const endDate = (0, import_utils.isString)(end) ? end : end.format("YYYY-MM-DD HH:mm:ss");
|
|
45
|
+
return {
|
|
46
|
+
$and: [
|
|
47
|
+
{
|
|
48
|
+
$dateAfter: startDate
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
$dateBefore: endDate
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
Input: (value) => {
|
|
57
|
+
return {
|
|
58
|
+
$includes: value
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
Radio: (value) => {
|
|
62
|
+
return {
|
|
63
|
+
$eq: value
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
Select: (value, field) => {
|
|
67
|
+
const key = field.type === "string" ? "$in" : "$anyOf";
|
|
68
|
+
const formatValue = Array.isArray(value) ? value : [value];
|
|
69
|
+
return {
|
|
70
|
+
[key]: formatValue
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
Percent: (value) => {
|
|
74
|
+
return {
|
|
75
|
+
$eq: value
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
InputNumber: (value) => {
|
|
79
|
+
return {
|
|
80
|
+
$eq: value
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
TimePicker: (value) => {
|
|
84
|
+
return {
|
|
85
|
+
$eq: value
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
"Input.JSON": (value) => {
|
|
89
|
+
return {
|
|
90
|
+
$includes: value
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
"Input.URL": (value) => {
|
|
94
|
+
return {
|
|
95
|
+
$includes: value
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
"Input.Password": (value) => {
|
|
99
|
+
return {
|
|
100
|
+
$includes: value
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
DateRangePicker: (value) => {
|
|
104
|
+
const [start, end] = value;
|
|
105
|
+
const startDate = (0, import_utils.isString)(start) ? start : start.format("YYYY-MM-DD HH:mm:ss");
|
|
106
|
+
const endDate = (0, import_utils.isString)(end) ? end : end.format("YYYY-MM-DD HH:mm:ss");
|
|
107
|
+
return {
|
|
108
|
+
$and: [
|
|
109
|
+
{
|
|
110
|
+
$dateAfter: startDate
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
$dateBefore: endDate
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
"Radio.Group": (value) => {
|
|
119
|
+
const formatValue = Array.isArray(value) ? value : [value];
|
|
120
|
+
return {
|
|
121
|
+
$in: formatValue
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
"Checkbox.Group": (value) => {
|
|
125
|
+
const formatValue = Array.isArray(value) ? value : [value];
|
|
126
|
+
return {
|
|
127
|
+
$anyOf: formatValue
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
132
|
+
0 && (module.exports = {
|
|
133
|
+
formFieldFilterFuncMap
|
|
134
|
+
});
|
|
@@ -47,16 +47,20 @@ var useActions = ({
|
|
|
47
47
|
const { parseVariable } = (0, import_useVariables.default)();
|
|
48
48
|
const { parseActions } = (0, import_useParseActionsVariable.default)();
|
|
49
49
|
const currentDataSource = propsDataSource || ctxDataSource;
|
|
50
|
-
const currentValue = propsCurrentValue;
|
|
50
|
+
const currentValue = propsCurrentValue || "server";
|
|
51
51
|
const {
|
|
52
52
|
isCustomApi,
|
|
53
53
|
actions: originalActions,
|
|
54
54
|
options,
|
|
55
55
|
headerDataSource,
|
|
56
56
|
name,
|
|
57
|
-
dataSourceKey
|
|
57
|
+
dataSourceKey,
|
|
58
|
+
fields
|
|
58
59
|
} = currentDataSource || {};
|
|
59
|
-
const { formatListResult, formatListParams } = (0, import_useFormat.default)({
|
|
60
|
+
const { formatListResult, formatListParams } = (0, import_useFormat.default)({
|
|
61
|
+
dataSourceKey: dataSourceKey || "",
|
|
62
|
+
fields: fields || []
|
|
63
|
+
});
|
|
60
64
|
const getParsedActions = (0, import_ahooks.useMemoizedFn)(() => {
|
|
61
65
|
return parseActions(originalActions, {});
|
|
62
66
|
});
|
|
@@ -93,6 +97,8 @@ var useActions = ({
|
|
|
93
97
|
const createApi = genCustomApi(actions == null ? void 0 : actions.create);
|
|
94
98
|
return createApi(values);
|
|
95
99
|
} else {
|
|
100
|
+
if (!name)
|
|
101
|
+
return {};
|
|
96
102
|
return (0, import_serve.createNocobaseData)({
|
|
97
103
|
key: name,
|
|
98
104
|
data: values,
|
|
@@ -126,14 +132,15 @@ var useActions = ({
|
|
|
126
132
|
return updateApi(values);
|
|
127
133
|
} else {
|
|
128
134
|
const id = values == null ? void 0 : values.id;
|
|
129
|
-
if (!id) {
|
|
135
|
+
if (!id || !name) {
|
|
130
136
|
import_antd.message.error("请先获取数据");
|
|
131
137
|
return Promise.reject();
|
|
132
138
|
}
|
|
133
139
|
return (0, import_serve.updateNocobaseData)({
|
|
134
140
|
key: name,
|
|
135
141
|
id,
|
|
136
|
-
data: values
|
|
142
|
+
data: values,
|
|
143
|
+
headers: getHeaders()
|
|
137
144
|
});
|
|
138
145
|
}
|
|
139
146
|
});
|
|
@@ -168,6 +175,8 @@ var useActions = ({
|
|
|
168
175
|
const deleteApi = genCustomApi(actions == null ? void 0 : actions.destroy);
|
|
169
176
|
return deleteApi({});
|
|
170
177
|
}
|
|
178
|
+
if (!name)
|
|
179
|
+
return;
|
|
171
180
|
return (0, import_serve.deleteNocobaseData)(name, id, getHeaders());
|
|
172
181
|
});
|
|
173
182
|
return {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/dataSourceComponents/hooks/useComponentId.ts
|
|
20
|
+
var useComponentId_exports = {};
|
|
21
|
+
__export(useComponentId_exports, {
|
|
22
|
+
default: () => useComponentId_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useComponentId_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var useComponentId = (props) => {
|
|
27
|
+
const { __id, componentId } = props;
|
|
28
|
+
return (0, import_react.useMemo)(() => {
|
|
29
|
+
return __id || componentId;
|
|
30
|
+
}, [__id, componentId]);
|
|
31
|
+
};
|
|
32
|
+
var useComponentId_default = useComponentId;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Result } from 'ahooks/es/useRequest/src/types';
|
|
3
3
|
import { ActionsItem } from '../../dataSourceForm/serve';
|
|
4
|
-
interface Field {
|
|
4
|
+
export interface Field {
|
|
5
5
|
name: string;
|
|
6
6
|
type: string;
|
|
7
7
|
allowNull: boolean;
|
|
@@ -57,6 +57,7 @@ export declare type DataSourceType = {
|
|
|
57
57
|
introspected: boolean;
|
|
58
58
|
isCustomApi: boolean;
|
|
59
59
|
key: string;
|
|
60
|
+
tableName: string;
|
|
60
61
|
logging: boolean;
|
|
61
62
|
name: string;
|
|
62
63
|
title: string;
|
|
@@ -72,9 +73,25 @@ export declare type DataSourceContextProps = {
|
|
|
72
73
|
dataSource: DataSourceType;
|
|
73
74
|
children?: React.ReactNode;
|
|
74
75
|
currentValue?: string;
|
|
76
|
+
actions?: {
|
|
77
|
+
list?: () => Promise<any>;
|
|
78
|
+
get?: () => Promise<any>;
|
|
79
|
+
update?: () => Promise<any>;
|
|
80
|
+
create?: () => Promise<any>;
|
|
81
|
+
destroy?: () => Promise<any>;
|
|
82
|
+
};
|
|
83
|
+
overrideData?: {
|
|
84
|
+
list?: any;
|
|
85
|
+
get?: any;
|
|
86
|
+
};
|
|
87
|
+
autoRun?: {
|
|
88
|
+
list?: boolean;
|
|
89
|
+
get?: boolean;
|
|
90
|
+
};
|
|
91
|
+
__id?: string;
|
|
75
92
|
};
|
|
76
93
|
export interface DataSourceContextType {
|
|
77
|
-
dataSource
|
|
94
|
+
dataSource?: DataSourceType;
|
|
78
95
|
list: Result<any, any>;
|
|
79
96
|
destroy: Result<any, any>;
|
|
80
97
|
get: Result<any, any>;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { DataSourceContextProps } from './DataSourceContext';
|
|
3
3
|
/**
|
|
4
4
|
* @title: DataSource Provider
|
|
5
|
-
* @description:
|
|
5
|
+
* @description: 提供页面配置的数据源,支持外部传入Promise接口、自动调用配置和直接数据
|
|
6
6
|
*/
|
|
7
7
|
declare const DataSourceProvider: React.FC<DataSourceContextProps>;
|
|
8
8
|
export default DataSourceProvider;
|
|
@@ -38,29 +38,35 @@ var import_utils = require("@pisell/utils");
|
|
|
38
38
|
var import_DataSourceContext = __toESM(require("./DataSourceContext"));
|
|
39
39
|
var import_useActions = __toESM(require("../../hooks/useActions"));
|
|
40
40
|
var import_useVariables = __toESM(require("../../hooks/useVariables"));
|
|
41
|
-
var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
|
|
42
41
|
var import_useSetRequest = __toESM(require("../../../../hooks/useSetRequest"));
|
|
43
42
|
var DataSourceProvider = (props) => {
|
|
44
|
-
const {
|
|
43
|
+
const {
|
|
44
|
+
children,
|
|
45
|
+
dataSource: propsDataSource,
|
|
46
|
+
currentValue,
|
|
47
|
+
actions: externalActions,
|
|
48
|
+
overrideData,
|
|
49
|
+
autoRun
|
|
50
|
+
} = props;
|
|
45
51
|
(0, import_useSetRequest.default)();
|
|
46
52
|
const { parseVariable } = (0, import_useVariables.default)();
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
global: {
|
|
50
|
-
currentDataSource: ctxDataSource
|
|
51
|
-
}
|
|
52
|
-
}) : propsDataSource;
|
|
53
|
-
const { list, get, update, create, destroy } = (0, import_useActions.default)({
|
|
53
|
+
const dataSource = (0, import_utils.isString)(propsDataSource) ? parseVariable == null ? void 0 : parseVariable(propsDataSource) : propsDataSource;
|
|
54
|
+
const standardActions = (0, import_useActions.default)({
|
|
54
55
|
dataSource,
|
|
55
56
|
currentValue
|
|
56
57
|
});
|
|
58
|
+
const list = (externalActions == null ? void 0 : externalActions.list) || standardActions.list;
|
|
59
|
+
const get = (externalActions == null ? void 0 : externalActions.get) || standardActions.get;
|
|
60
|
+
const update = (externalActions == null ? void 0 : externalActions.update) || standardActions.update;
|
|
61
|
+
const create = (externalActions == null ? void 0 : externalActions.create) || standardActions.create;
|
|
62
|
+
const destroy = (externalActions == null ? void 0 : externalActions.destroy) || standardActions.destroy;
|
|
57
63
|
const listResult = (0, import_ahooks.useRequest)(list, {
|
|
58
|
-
manual: true
|
|
59
|
-
});
|
|
60
|
-
const destroyResult = (0, import_ahooks.useRequest)(destroy, {
|
|
61
|
-
manual: true
|
|
64
|
+
manual: (0, import_utils.isBoolean)(autoRun == null ? void 0 : autoRun.list) ? !(autoRun == null ? void 0 : autoRun.list) : true
|
|
62
65
|
});
|
|
63
66
|
const getResult = (0, import_ahooks.useRequest)(get, {
|
|
67
|
+
manual: (0, import_utils.isBoolean)(autoRun == null ? void 0 : autoRun.get) ? !(autoRun == null ? void 0 : autoRun.get) : true
|
|
68
|
+
});
|
|
69
|
+
const destroyResult = (0, import_ahooks.useRequest)(destroy, {
|
|
64
70
|
manual: true
|
|
65
71
|
});
|
|
66
72
|
const updateResult = (0, import_ahooks.useRequest)(update, {
|
|
@@ -72,9 +78,15 @@ var DataSourceProvider = (props) => {
|
|
|
72
78
|
const value = (0, import_react.useMemo)(() => {
|
|
73
79
|
return {
|
|
74
80
|
dataSource,
|
|
75
|
-
list:
|
|
81
|
+
list: {
|
|
82
|
+
...listResult,
|
|
83
|
+
data: (overrideData == null ? void 0 : overrideData.list) || listResult.data
|
|
84
|
+
},
|
|
85
|
+
get: {
|
|
86
|
+
...getResult,
|
|
87
|
+
data: (overrideData == null ? void 0 : overrideData.get) || getResult.data
|
|
88
|
+
},
|
|
76
89
|
destroy: destroyResult,
|
|
77
|
-
get: getResult,
|
|
78
90
|
update: updateResult,
|
|
79
91
|
create: createResult
|
|
80
92
|
};
|
|
@@ -84,7 +96,8 @@ var DataSourceProvider = (props) => {
|
|
|
84
96
|
destroyResult,
|
|
85
97
|
getResult,
|
|
86
98
|
updateResult,
|
|
87
|
-
createResult
|
|
99
|
+
createResult,
|
|
100
|
+
overrideData
|
|
88
101
|
]);
|
|
89
102
|
return /* @__PURE__ */ import_react.default.createElement(import_DataSourceContext.default.Provider, { value }, children);
|
|
90
103
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface VariablesContextType {
|
|
3
|
+
children?: React.ReactNode;
|
|
3
4
|
variables?: Record<string, any>;
|
|
4
5
|
registerVariable?: (value: Record<string, any>) => void;
|
|
6
|
+
parseVariable?: (str: string, localVariables?: Record<string, any>) => any;
|
|
5
7
|
registerValueVariable?: (componentId: string, value: Record<string, any>) => void;
|
|
6
8
|
registerFunctionVariable?: (componentId: string, value: Record<string, any>) => void;
|
|
7
|
-
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
+
subscribeVariables?: (listener: (allVariables: Record<string, any>, updateVariables: Record<string, any>) => void) => () => void;
|
|
9
10
|
}
|
|
10
11
|
export declare const VariablesContext: import("react").Context<VariablesContextType>;
|
|
11
12
|
export default VariablesContext;
|