amis 1.9.1-beta.0 → 1.9.1-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/RootRenderer.js +10 -2
- package/lib/RootRenderer.js.map +2 -2
- package/lib/Schema.d.ts +3 -2
- package/lib/Schema.js.map +1 -1
- package/lib/SchemaRenderer.js +6 -9
- package/lib/SchemaRenderer.js.map +2 -2
- package/lib/actions/CmptAction.js +4 -4
- package/lib/actions/CmptAction.js.map +2 -2
- package/lib/components/Button.d.ts +11 -10
- package/lib/components/Button.js +2 -2
- package/lib/components/Button.js.map +2 -2
- package/lib/components/CalendarMobile.d.ts +40 -40
- package/lib/components/Checkbox.js +1 -1
- package/lib/components/Checkbox.js.map +2 -2
- package/lib/components/ContextMenu.d.ts +4 -0
- package/lib/components/ContextMenu.js +23 -7
- package/lib/components/ContextMenu.js.map +2 -2
- package/lib/components/DatePicker.d.ts +40 -40
- package/lib/components/DateRangePicker.d.ts +40 -40
- package/lib/components/Form.d.ts +22 -0
- package/lib/components/Form.js +44 -0
- package/lib/components/Form.js.map +13 -0
- package/lib/components/FormField.d.ts +65 -0
- package/lib/components/FormField.js +48 -0
- package/lib/components/FormField.js.map +13 -0
- package/lib/components/InputBox.d.ts +10 -10
- package/lib/components/InputBox.js +4 -3
- package/lib/components/InputBox.js.map +2 -2
- package/lib/components/InputBoxWithSuggestion.d.ts +280 -0
- package/lib/components/InputBoxWithSuggestion.js +65 -0
- package/lib/components/InputBoxWithSuggestion.js.map +13 -0
- package/lib/components/ListGroup.d.ts +10 -10
- package/lib/components/PickerContainer.d.ts +4 -2
- package/lib/components/PickerContainer.js +28 -5
- package/lib/components/PickerContainer.js.map +2 -2
- package/lib/components/Radios.d.ts +10 -10
- package/lib/components/ResultBox.d.ts +40 -40
- package/lib/components/Select.d.ts +195 -202
- package/lib/components/Select.js +7 -3
- package/lib/components/Select.js.map +2 -2
- package/lib/components/Textarea.d.ts +568 -2
- package/lib/components/Textarea.js +129 -1
- package/lib/components/Textarea.js.map +2 -2
- package/lib/components/Toast.js +11 -9
- package/lib/components/Toast.js.map +2 -2
- package/lib/components/UserSelect.d.ts +500 -0
- package/lib/components/UserSelect.js +559 -0
- package/lib/components/UserSelect.js.map +13 -0
- package/lib/components/UserTabSelect.d.ts +320 -0
- package/lib/components/UserTabSelect.js +163 -0
- package/lib/components/UserTabSelect.js.map +13 -0
- package/lib/components/WithRemoteConfig.d.ts +7 -0
- package/lib/components/WithRemoteConfig.js +22 -13
- package/lib/components/WithRemoteConfig.js.map +2 -2
- package/lib/components/calendar/DaysView.d.ts +26 -1
- package/lib/components/calendar/DaysView.js +60 -19
- package/lib/components/calendar/DaysView.js.map +2 -2
- package/lib/components/calendar/TimeView.d.ts +1 -1
- package/lib/components/calendar/TimeView.js +10 -3
- package/lib/components/calendar/TimeView.js.map +2 -2
- package/lib/components/formula/Picker.js +4 -4
- package/lib/components/formula/Picker.js.map +2 -2
- package/lib/components/icons.d.ts +7 -1
- package/lib/components/icons.js +17 -1
- package/lib/components/icons.js.map +2 -2
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +3 -1
- package/lib/components/index.js.map +2 -2
- package/lib/components/json-schema/Array.d.ts +3 -0
- package/lib/components/json-schema/Array.js +125 -0
- package/lib/components/json-schema/Array.js.map +13 -0
- package/lib/components/json-schema/Item.d.ts +3 -0
- package/lib/components/json-schema/Item.js +34 -0
- package/lib/components/json-schema/Item.js.map +13 -0
- package/lib/components/json-schema/Object.d.ts +3 -0
- package/lib/components/json-schema/Object.js +178 -0
- package/lib/components/json-schema/Object.js.map +13 -0
- package/lib/components/json-schema/index.d.ts +279 -0
- package/lib/components/json-schema/index.js +16 -0
- package/lib/components/json-schema/index.js.map +13 -0
- package/lib/components/schema-editor/Array.js +2 -2
- package/lib/components/schema-editor/Array.js.map +2 -2
- package/lib/components/schema-editor/Common.d.ts +2 -0
- package/lib/components/schema-editor/Common.js +39 -3
- package/lib/components/schema-editor/Common.js.map +2 -2
- package/lib/components/schema-editor/Object.js +2 -2
- package/lib/components/schema-editor/Object.js.map +2 -2
- package/lib/components/schema-editor/index.d.ts +45 -41
- package/lib/components/schema-editor/index.js +5 -5
- package/lib/components/schema-editor/index.js.map +2 -2
- package/lib/components/table/ItemActionsWrapper.d.ts +10 -0
- package/lib/components/table/ItemActionsWrapper.js +25 -0
- package/lib/components/table/ItemActionsWrapper.js.map +13 -0
- package/lib/components/table/index.d.ts +48 -41
- package/lib/components/table/index.js +46 -18
- package/lib/components/table/index.js.map +2 -2
- package/lib/helper.css +125 -124
- package/lib/helper.css.map +1 -1
- package/lib/hooks/use-validation-resolver.d.ts +1 -0
- package/lib/hooks/use-validation-resolver.js +49 -0
- package/lib/hooks/use-validation-resolver.js.map +13 -0
- package/lib/icons/department.js +17 -0
- package/lib/icons/menu.js +9 -0
- package/lib/icons/post.js +15 -0
- package/lib/icons/role.js +14 -0
- package/lib/icons/user-remove.js +12 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/index.js.map +2 -2
- package/lib/locale/de-DE.js +11 -1
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +12 -1
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +14 -3
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Action.js +25 -11
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/CRUD.js +5 -1
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Dialog.js +9 -3
- package/lib/renderers/Dialog.js.map +2 -2
- package/lib/renderers/Drawer.js +5 -1
- package/lib/renderers/Drawer.js.map +2 -2
- package/lib/renderers/Form/InputDate.d.ts +2 -2
- package/lib/renderers/Form/InputDate.js.map +2 -2
- package/lib/renderers/Form/JSONSchema.d.ts +23 -0
- package/lib/renderers/Form/JSONSchema.js +44 -0
- package/lib/renderers/Form/JSONSchema.js.map +13 -0
- package/lib/renderers/Form/JSONSchemaEditor.d.ts +2 -3
- package/lib/renderers/Form/JSONSchemaEditor.js +9 -24
- package/lib/renderers/Form/JSONSchemaEditor.js.map +2 -2
- package/lib/renderers/Form/Options.js +11 -5
- package/lib/renderers/Form/Options.js.map +2 -2
- package/lib/renderers/Form/Textarea.d.ts +1 -8
- package/lib/renderers/Form/Textarea.js +11 -75
- package/lib/renderers/Form/Textarea.js.map +2 -2
- package/lib/renderers/Form/UserSelect.d.ts +54 -0
- package/lib/renderers/Form/UserSelect.js +197 -0
- package/lib/renderers/Form/UserSelect.js.map +13 -0
- package/lib/renderers/Form/index.d.ts +1 -1
- package/lib/renderers/Form/index.js +88 -42
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Form/wrapControl.js.map +2 -2
- package/lib/renderers/Log.d.ts +28 -0
- package/lib/renderers/Log.js +110 -20
- package/lib/renderers/Log.js.map +2 -2
- package/lib/renderers/Page.js +5 -1
- package/lib/renderers/Page.js.map +2 -2
- package/lib/renderers/Service.js +5 -1
- package/lib/renderers/Service.js.map +2 -2
- package/lib/renderers/Table-v2/index.d.ts +14 -2
- package/lib/renderers/Table-v2/index.js +33 -3
- package/lib/renderers/Table-v2/index.js.map +2 -2
- package/lib/renderers/Wizard.js +37 -14
- package/lib/renderers/Wizard.js.map +2 -2
- package/lib/store/form.js +65 -45
- package/lib/store/form.js.map +2 -2
- package/lib/themes/ang-ie11.css +576 -24
- package/lib/themes/ang.css +553 -12
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +576 -24
- package/lib/themes/antd.css +553 -12
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +576 -24
- package/lib/themes/cxd.css +553 -12
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +576 -24
- package/lib/themes/dark.css +553 -12
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default-ie11.css +576 -24
- package/lib/themes/default.css +553 -12
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/api.js +1 -1
- package/lib/utils/api.js.map +2 -2
- package/lib/utils/renderer-event.js.map +2 -2
- package/package.json +2 -1
- package/schema.json +552 -5
- package/scss/_properties.scss +20 -8
- package/scss/components/_input-box.scss +22 -1
- package/scss/components/_json-schema.scss +124 -0
- package/scss/components/_log.scss +37 -5
- package/scss/components/form/_date-range.scss +1 -0
- package/scss/components/form/_select.scss +9 -0
- package/scss/components/form/_transfer.scss +19 -3
- package/scss/components/form/_user-select.scss +422 -0
- package/scss/helper/background/_background-color.scss +125 -124
- package/scss/themes/_common.scss +2 -0
- package/sdk/ang-ie11.css +670 -24
- package/sdk/ang.css +647 -12
- package/sdk/antd-ie11.css +670 -24
- package/sdk/antd.css +647 -12
- package/sdk/barcode.js +51 -51
- package/sdk/charts.js +14 -14
- package/sdk/codemirror.js +7 -7
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +670 -24
- package/sdk/cxd.css +647 -12
- package/sdk/dark-ie11.css +670 -24
- package/sdk/dark.css +647 -12
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css +125 -124
- package/sdk/helper.css.map +1 -1
- package/sdk/locale/de-DE.js +11 -1
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +16 -16
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +670 -24
- package/sdk/sdk.css +647 -12
- package/sdk/sdk.js +1653 -1637
- package/sdk/thirds/hls.js/hls.js +1 -1
- package/sdk/thirds/mpegts.js/mpegts.js +1 -1
- package/sdk/tinymce.js +57 -57
- package/src/RootRenderer.tsx +27 -15
- package/src/Schema.ts +5 -1
- package/src/SchemaRenderer.tsx +1 -4
- package/src/actions/CmptAction.ts +4 -4
- package/src/components/Button.tsx +3 -0
- package/src/components/Checkbox.tsx +2 -1
- package/src/components/ContextMenu.tsx +25 -7
- package/src/components/Form.tsx +70 -0
- package/src/components/FormField.tsx +127 -0
- package/src/components/InputBox.tsx +4 -1
- package/src/components/InputBoxWithSuggestion.tsx +113 -0
- package/src/components/PickerContainer.tsx +20 -5
- package/src/components/Select.tsx +18 -10
- package/src/components/Textarea.tsx +234 -2
- package/src/components/Toast.tsx +19 -18
- package/src/components/UserSelect.tsx +850 -0
- package/src/components/UserTabSelect.tsx +261 -0
- package/src/components/WithRemoteConfig.tsx +35 -11
- package/src/components/calendar/DaysView.tsx +117 -49
- package/src/components/calendar/TimeView.tsx +11 -6
- package/src/components/formula/Picker.tsx +2 -1
- package/src/components/icons.tsx +17 -1
- package/src/components/index.tsx +3 -1
- package/src/components/json-schema/Array.tsx +216 -0
- package/src/components/json-schema/Item.tsx +47 -0
- package/src/components/json-schema/Object.tsx +339 -0
- package/src/components/json-schema/index.tsx +44 -0
- package/src/components/schema-editor/Array.tsx +3 -1
- package/src/components/schema-editor/Common.tsx +61 -4
- package/src/components/schema-editor/Object.tsx +3 -1
- package/src/components/schema-editor/index.tsx +12 -5
- package/src/components/table/ItemActionsWrapper.tsx +32 -0
- package/src/components/table/index.tsx +115 -58
- package/src/hooks/use-validation-resolver.ts +45 -0
- package/src/icons/department.svg +17 -0
- package/src/icons/menu.svg +2 -0
- package/src/icons/post.svg +15 -0
- package/src/icons/role.svg +14 -0
- package/src/icons/user-remove.svg +12 -0
- package/src/index.tsx +2 -0
- package/src/locale/de-DE.ts +11 -1
- package/src/locale/en-US.ts +12 -1
- package/src/locale/zh-CN.ts +14 -3
- package/src/renderers/Action.tsx +10 -9
- package/src/renderers/CRUD.tsx +5 -1
- package/src/renderers/Dialog.tsx +9 -3
- package/src/renderers/Drawer.tsx +5 -1
- package/src/renderers/Form/InputDate.tsx +9 -4
- package/src/renderers/Form/JSONSchema.tsx +56 -0
- package/src/renderers/Form/JSONSchemaEditor.tsx +8 -27
- package/src/renderers/Form/Options.tsx +17 -7
- package/src/renderers/Form/Textarea.tsx +7 -117
- package/src/renderers/Form/UserSelect.tsx +263 -0
- package/src/renderers/Form/index.tsx +28 -18
- package/src/renderers/Form/wrapControl.tsx +0 -1
- package/src/renderers/Log.tsx +213 -19
- package/src/renderers/Page.tsx +6 -1
- package/src/renderers/Service.tsx +5 -1
- package/src/renderers/Table-v2/index.tsx +65 -2
- package/src/renderers/Wizard.tsx +24 -10
- package/src/store/form.ts +24 -17
- package/src/utils/api.ts +1 -1
- package/src/utils/renderer-event.ts +0 -2
@@ -6,8 +6,8 @@
|
|
6
6
|
"/src/renderers/Form/InputDate.tsx"
|
7
7
|
],
|
8
8
|
"names": [],
|
9
|
-
"mappings": ";;;;AAAA,6DAA0B;AAC1B,+BAAmE;AAEnE,uDAIiC;AACjC,+DAA4B;AAC5B,+BAA6B;AAC7B,
|
9
|
+
"mappings": ";;;;AAAA,6DAA0B;AAC1B,+BAAmE;AAEnE,uDAIiC;AACjC,+DAA4B;AAC5B,+BAA6B;AAC7B,qFAEqC;AAErC,6CAAgF;AAgRhF;IAAyC,4CAGxC;IAeC,qBAAY,KAAgB;QAA5B,YACE,kBAAM,KAAK,CAAC,SA+Bb;QA5BG,IAAA,OAAO,GAQL,KAAK,QARA,EACP,OAAO,GAOL,KAAK,QAPA,EACP,KAAK,GAMH,KAAK,MANF,EACL,YAAY,GAKV,KAAK,aALK,EACZ,iBAAiB,GAIf,KAAK,kBAJU,EACjB,IAAI,GAGF,KAAK,KAHH,EACJ,MAAM,GAEJ,KAAK,OAFD,EACN,GAAG,GACD,KAAK,IADJ,CACK;QAEV,IAAI,YAAY,IAAI,KAAK,KAAK,YAAY,EAAE;YAC1C,IAAM,IAAI,GAAG,IAAA,wBAAU,EAAC,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YACpD,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;SACnE;QAED,IAAI,aAAa,GAAG,KAAK,CAAC,SAAS,CAAC;QACpC,IAAI,OAAO,aAAa,KAAK,QAAQ,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,WAAW,EACvB,UAAU,EAAE,EAAE,EACd,QAAQ,EAAE,UAAU,EACpB,aAAa,EAAE,IAAI,IACnB;IATS,sBAAsB;QAHlC,IAAA,eAAQ,EAAC;YACR,IAAI,EAAE,eAAe;SACtB,CAAC;OACW,sBAAsB,CAUlC;IAAD,6BAAC;CAAA,AAVD,CAA4C,WAAW,GAUtD;AAVY,wDAAsB;AAenC;IAAyC,oDAAW;IAApD;;IAUA,CAAC;IATQ,gCAAY,mDACd,WAAW,CAAC,YAAY,KAC3B,WAAW,EAAE,kBAAkB,EAC/B,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,EAAE,EACd,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,IAAI,IACnB;IATS,mBAAmB;QAH/B,IAAA,eAAQ,EAAC;YACR,IAAI,EAAE,YAAY;SACnB,CAAC;OACW,mBAAmB,CAU/B;IAAD,0BAAC;CAAA,AAVD,CAAyC,WAAW,GAUnD;AAVY,kDAAmB",
|
10
10
|
"sourcesContent": [
|
11
|
-
"import React from 'react';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\nimport cx from 'classnames';\nimport {\n filterDate,\n isPureVariable,\n resolveVariableAndFilter\n} from '../../utils/tpl-builtin';\nimport moment from 'moment';\nimport 'moment/locale/zh-cn';\nimport DatePicker, {DatePicker as BaseDatePicker} from '../../components/DatePicker';\nimport {SchemaObject} from '../../Schema';\nimport {createObject, anyChanged, isMobile, autobind} from '../../utils/helper';\nimport {Action} from '../../types';\n\nexport interface InputDateBaseControlSchema extends FormBaseControl {\n /**\n * 指定为日期选择控件\n */\n type:\n | 'input-date'\n | 'input-datetime'\n | 'input-time'\n | 'input-month'\n | 'input-quarter'\n | 'input-year';\n\n /**\n * 是否显示清除按钮\n */\n clearable?: boolean;\n\n /**\n * 日期存储格式\n */\n format?: string;\n\n /**\n * 日期展示格式\n */\n inputFormat?: string;\n\n /**\n * 设定是否存储 utc 时间。\n */\n utc?: boolean;\n\n /**\n * 是否为内联模式?\n */\n emebed?: boolean;\n\n /**\n * 边框模式,全边框,还是半边框,或者没边框。\n */\n borderMode?: 'full' | 'half' | 'none';\n}\n\n/**\n * Date日期选择控件\n * 文档:https://baidu.gitee.io/amis/docs/components/form/date\n */\nexport interface DateControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为日期选择控件\n */\n type: 'input-date';\n\n /**\n * 日期存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 日期展示格式\n * @default YYYY-MM-DD\n */\n inputFormat?: string;\n\n /**\n * 点选日期后是否关闭弹窗\n */\n closeOnSelect?: boolean;\n\n /**\n * 限制最小日期\n */\n minDate?: string;\n\n /**\n * 限制最大日期\n */\n maxDate?: string;\n}\n\n/**\n * Datetime日期时间选择控件\n * 文档:https://baidu.gitee.io/amis/docs/components/form/datetime\n */\nexport interface DateTimeControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为日期时间选择控件\n */\n type: 'input-datetime';\n\n /**\n * 日期存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 日期展示格式\n * @default YYYY-MM-DD HH:mm\n */\n inputFormat?: string;\n\n /**\n * 时间的格式。\n *\n * @default HH:mm\n */\n timeFormat?: string;\n\n /**\n * 限制最小日期\n */\n minDate?: string;\n\n /**\n * 限制最大日期\n */\n maxDate?: string;\n\n /**\n * 不记得了\n */\n timeConstraints?: any;\n}\n\n/**\n * Time 时间选择控件\n * 文档:https://baidu.gitee.io/amis/docs/components/form/time\n */\nexport interface TimeControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为日期时间选择控件\n */\n type: 'input-time';\n\n /**\n * 日期存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 日期展示格式\n * @default YYYY-MM-DD HH:mm\n */\n inputFormat?: string;\n\n /**\n * 时间的格式。\n *\n * @default HH:mm\n */\n timeFormat?: string;\n\n /**\n * 不记得了\n */\n timeConstraints?: any;\n}\n\n/**\n * Month 月份选择控件\n * 文档:https://baidu.gitee.io/amis/docs/components/form/Month\n */\nexport interface MonthControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为月份时间选择控件\n */\n type: 'input-month';\n\n /**\n * 月份存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 月份展示格式\n * @default YYYY-MM\n */\n inputFormat?: string;\n}\n\n/**\n * 季度选择控件\n */\nexport interface QuarterControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为月份时间选择控件\n */\n type: 'input-quarter';\n\n /**\n * 月份存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 月份展示格式\n * @default YYYY-MM\n */\n inputFormat?: string;\n}\n\n/**\n * 年份选择控件\n */\nexport interface YearControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为月份时间选择控件\n */\n type: 'input-year';\n\n /**\n * 月份存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 月份展示格式\n * @default YYYY-MM\n */\n inputFormat?: string;\n}\n\nexport interface DateProps extends FormControlProps {\n inputFormat?: string;\n timeFormat?: string;\n format?: string;\n valueFormat?: string;\n timeConstraints?: {\n hours?: {\n min: number;\n max: number;\n step: number;\n };\n minutes?: {\n min: number;\n max: number;\n step: number;\n };\n seconds: {\n min: number;\n max: number;\n step: number;\n };\n };\n closeOnSelect?: boolean;\n disabled: boolean;\n iconClassName?: string;\n utc?: boolean; // 设定是否存储 utc 时间。\n minDate?: string;\n maxDate?: string;\n}\n\ninterface DateControlState {\n minDate?: moment.Moment;\n maxDate?: moment.Moment;\n schedules?: Array<{\n startTime: Date;\n endTime: Date;\n content: any;\n className?: string;\n }>;\n}\n\nexport default class DateControl extends React.PureComponent<\n DateProps,\n DateControlState\n> {\n static defaultProps = {\n format: 'X',\n viewMode: 'days',\n inputFormat: 'YYYY-MM-DD',\n timeConstraints: {\n minutes: {\n step: 1\n }\n },\n clearable: true\n };\n\n dateRef?: BaseDatePicker;\n\n constructor(props: DateProps) {\n super(props);\n\n const {\n minDate,\n maxDate,\n value,\n defaultValue,\n setPrinstineValue,\n data,\n format,\n utc\n } = props;\n\n if (defaultValue && value === defaultValue) {\n const date = filterDate(defaultValue, data, format);\n setPrinstineValue((utc ? moment.utc(date) : date).format(format));\n }\n\n let schedulesData = props.schedules;\n if (typeof schedulesData === 'string') {\n const resolved = resolveVariableAndFilter(schedulesData, data, '| raw');\n if (Array.isArray(resolved)) {\n schedulesData = resolved;\n }\n }\n\n this.state = {\n minDate: minDate ? filterDate(minDate, data, format) : undefined,\n maxDate: maxDate ? filterDate(maxDate, data, format) : undefined,\n schedules: schedulesData\n };\n }\n\n componentDidUpdate(prevProps: DateProps) {\n const props = this.props;\n\n if (prevProps.defaultValue !== props.defaultValue) {\n const date = filterDate(props.defaultValue, props.data, props.format);\n props.setPrinstineValue(\n (props.utc ? moment.utc(date) : date).format(props.format)\n );\n }\n\n if (\n prevProps.minDate !== props.minDate ||\n prevProps.maxDate !== props.maxDate ||\n prevProps.data !== props.data\n ) {\n this.setState({\n minDate: props.minDate\n ? filterDate(props.minDate, props.data, this.props.format)\n : undefined,\n maxDate: props.maxDate\n ? filterDate(props.maxDate, props.data, this.props.format)\n : undefined\n });\n }\n\n if (\n anyChanged(['schedules', 'data'], prevProps, props) &&\n typeof props.schedules === 'string' &&\n isPureVariable(props.schedules)\n ) {\n const schedulesData = resolveVariableAndFilter(\n props.schedules,\n props.data,\n '| raw'\n );\n const preSchedulesData = resolveVariableAndFilter(\n prevProps.schedules,\n prevProps.data,\n '| raw'\n );\n if (Array.isArray(schedulesData) && preSchedulesData !== schedulesData) {\n this.setState({\n schedules: schedulesData\n });\n }\n }\n }\n\n // 日程点击事件\n onScheduleClick(scheduleData: any) {\n const {scheduleAction, onAction, data, translate: __} = this.props;\n const defaultscheduleAction = {\n actionType: 'dialog',\n dialog: {\n title: __('Schedule'),\n actions: [],\n body: {\n type: 'table',\n columns: [\n {\n name: 'time',\n label: __('Time')\n },\n {\n name: 'content',\n label: __('Content')\n }\n ],\n data: '${scheduleData}'\n }\n }\n };\n\n onAction &&\n onAction(\n null,\n scheduleAction || defaultscheduleAction,\n createObject(data, scheduleData)\n );\n }\n\n @autobind\n getRef(ref: BaseDatePicker) {\n this.dateRef = ref;\n }\n\n // 派发有event的事件\n @autobind\n dispatchEvent(e: React.SyntheticEvent<HTMLElement>) {\n const {dispatchEvent, data} = this.props;\n dispatchEvent(e, data);\n }\n\n // 动作\n doAction(action: Action, data: object, throwErrors: boolean) {\n const {resetValue} = this.props;\n\n if (action.actionType === 'clear') {\n this.dateRef?.clear();\n return;\n }\n\n if (action.actionType === 'reset' && resetValue) {\n this.dateRef?.reset(resetValue);\n }\n }\n\n // 值的变化\n @autobind\n async handleChange(nextValue: any) {\n const {dispatchEvent, data} = this.props;\n const dispatcher = dispatchEvent('change', createObject(data, {value: nextValue}));\n if (dispatcher?.prevented) {\n return;\n }\n this.props.onChange(nextValue);\n }\n\n render() {\n let {\n className,\n defaultValue,\n defaultData,\n classnames: cx,\n minDate,\n maxDate,\n type,\n format,\n timeFormat,\n valueFormat,\n env,\n largeMode,\n render,\n useMobileUI,\n ...rest\n } = this.props;\n const mobileUI = useMobileUI && isMobile();\n\n if (type === 'time' && timeFormat) {\n format = timeFormat;\n }\n\n return (\n <div\n className={cx(\n `DateControl`,\n {\n 'is-date': /date$/.test(type),\n 'is-datetime': /datetime$/.test(type)\n },\n className\n )}\n >\n <DatePicker\n {...rest}\n useMobileUI={useMobileUI}\n popOverContainer={\n mobileUI && env && env.getModalContainer\n ? env.getModalContainer\n : mobileUI\n ? undefined\n : rest.popOverContainer\n }\n timeFormat={timeFormat}\n format={valueFormat || format}\n {...this.state}\n classnames={cx}\n onRef={this.getRef}\n schedules={this.state.schedules}\n largeMode={largeMode}\n onScheduleClick={this.onScheduleClick.bind(this)}\n onChange={this.handleChange}\n onFocus={this.dispatchEvent}\n onBlur={this.dispatchEvent}\n />\n </div>\n );\n }\n}\n\n@FormItem({\n type: 'input-date',\n weight: -150\n})\nexport class DateControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'Date.placeholder',\n dateFormat: 'YYYY-MM-DD',\n timeFormat: '',\n strictMode: false\n };\n}\n\n@FormItem({\n type: 'input-datetime'\n})\nexport class DatetimeControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'DateTime.placeholder',\n inputFormat: 'YYYY-MM-DD HH:mm:ss',\n dateFormat: 'LL',\n timeFormat: 'HH:mm:ss',\n closeOnSelect: false,\n strictMode: false\n };\n}\n\n@FormItem({\n type: 'input-time'\n})\nexport class TimeControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'Time.placeholder',\n inputFormat: 'HH:mm',\n dateFormat: '',\n timeFormat: 'HH:mm',\n viewMode: 'time',\n closeOnSelect: false\n };\n}\n\n@FormItem({\n type: 'input-month'\n})\nexport class MonthControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'Month.placeholder',\n inputFormat: 'YYYY-MM',\n dateFormat: 'MM',\n timeFormat: '',\n viewMode: 'months',\n closeOnSelect: true\n };\n}\n\n@FormItem({\n type: 'input-quarter'\n})\nexport class QuarterControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'Quarter.placeholder',\n inputFormat: 'YYYY [Q]Q',\n dateFormat: 'YYYY [Q]Q',\n timeFormat: '',\n viewMode: 'quarters',\n closeOnSelect: true\n };\n}\n\n@FormItem({\n type: 'input-year'\n})\nexport class YearControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'Year.placeholder',\n inputFormat: 'YYYY',\n dateFormat: 'YYYY',\n timeFormat: '',\n viewMode: 'years',\n closeOnSelect: true\n };\n}\n"
|
11
|
+
"import React from 'react';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\nimport cx from 'classnames';\nimport {\n filterDate,\n isPureVariable,\n resolveVariableAndFilter\n} from '../../utils/tpl-builtin';\nimport moment from 'moment';\nimport 'moment/locale/zh-cn';\nimport DatePicker, {\n DatePicker as BaseDatePicker\n} from '../../components/DatePicker';\nimport {SchemaObject} from '../../Schema';\nimport {createObject, anyChanged, isMobile, autobind} from '../../utils/helper';\nimport {Action} from '../../types';\n\nexport interface InputDateBaseControlSchema extends FormBaseControl {\n /**\n * 指定为日期选择控件\n */\n type:\n | 'input-date'\n | 'input-datetime'\n | 'input-time'\n | 'input-month'\n | 'input-quarter'\n | 'input-year';\n\n /**\n * 是否显示清除按钮\n */\n clearable?: boolean;\n\n /**\n * 日期存储格式\n */\n format?: string;\n\n /**\n * 日期展示格式\n */\n inputFormat?: string;\n\n /**\n * 设定是否存储 utc 时间。\n */\n utc?: boolean;\n\n /**\n * 是否为内联模式?\n */\n emebed?: boolean;\n\n /**\n * 边框模式,全边框,还是半边框,或者没边框。\n */\n borderMode?: 'full' | 'half' | 'none';\n}\n\n/**\n * Date日期选择控件\n * 文档:https://baidu.gitee.io/amis/docs/components/form/date\n */\nexport interface DateControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为日期选择控件\n */\n type: 'input-date';\n\n /**\n * 日期存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 日期展示格式\n * @default YYYY-MM-DD\n */\n inputFormat?: string;\n\n /**\n * 点选日期后是否关闭弹窗\n */\n closeOnSelect?: boolean;\n\n /**\n * 限制最小日期\n */\n minDate?: string;\n\n /**\n * 限制最大日期\n */\n maxDate?: string;\n}\n\n/**\n * Datetime日期时间选择控件\n * 文档:https://baidu.gitee.io/amis/docs/components/form/datetime\n */\nexport interface DateTimeControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为日期时间选择控件\n */\n type: 'input-datetime';\n\n /**\n * 日期存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 日期展示格式\n * @default YYYY-MM-DD HH:mm\n */\n inputFormat?: string;\n\n /**\n * 时间的格式。\n *\n * @default HH:mm\n */\n timeFormat?: string;\n\n /**\n * 限制最小日期\n */\n minDate?: string;\n\n /**\n * 限制最大日期\n */\n maxDate?: string;\n\n /**\n * 时间输入范围限制\n */\n timeConstraints?: any;\n}\n\n/**\n * Time 时间选择控件\n * 文档:https://baidu.gitee.io/amis/docs/components/form/time\n */\nexport interface TimeControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为日期时间选择控件\n */\n type: 'input-time';\n\n /**\n * 日期存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 日期展示格式\n * @default YYYY-MM-DD HH:mm\n */\n inputFormat?: string;\n\n /**\n * 时间的格式。\n *\n * @default HH:mm\n */\n timeFormat?: string;\n\n /**\n * 时间输入范围限制\n */\n timeConstraints?: any;\n}\n\n/**\n * Month 月份选择控件\n * 文档:https://baidu.gitee.io/amis/docs/components/form/Month\n */\nexport interface MonthControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为月份时间选择控件\n */\n type: 'input-month';\n\n /**\n * 月份存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 月份展示格式\n * @default YYYY-MM\n */\n inputFormat?: string;\n}\n\n/**\n * 季度选择控件\n */\nexport interface QuarterControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为月份时间选择控件\n */\n type: 'input-quarter';\n\n /**\n * 月份存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 月份展示格式\n * @default YYYY-MM\n */\n inputFormat?: string;\n}\n\n/**\n * 年份选择控件\n */\nexport interface YearControlSchema extends InputDateBaseControlSchema {\n /**\n * 指定为月份时间选择控件\n */\n type: 'input-year';\n\n /**\n * 月份存储格式\n * @default X\n */\n format?: string;\n\n /**\n * 月份展示格式\n * @default YYYY-MM\n */\n inputFormat?: string;\n}\n\nexport interface DateProps extends FormControlProps {\n inputFormat?: string;\n timeFormat?: string;\n format?: string;\n valueFormat?: string;\n timeConstraints?: {\n hours?: {\n min: number;\n max: number;\n step: number;\n };\n minutes?: {\n min: number;\n max: number;\n step: number;\n };\n seconds: {\n min: number;\n max: number;\n step: number;\n };\n };\n closeOnSelect?: boolean;\n disabled: boolean;\n iconClassName?: string;\n utc?: boolean; // 设定是否存储 utc 时间。\n minDate?: string;\n maxDate?: string;\n}\n\ninterface DateControlState {\n minDate?: moment.Moment;\n maxDate?: moment.Moment;\n schedules?: Array<{\n startTime: Date;\n endTime: Date;\n content: any;\n className?: string;\n }>;\n}\n\nexport default class DateControl extends React.PureComponent<\n DateProps,\n DateControlState\n> {\n static defaultProps = {\n format: 'X',\n viewMode: 'days',\n inputFormat: 'YYYY-MM-DD',\n timeConstraints: {\n minutes: {\n step: 1\n }\n },\n clearable: true\n };\n\n dateRef?: BaseDatePicker;\n\n constructor(props: DateProps) {\n super(props);\n\n const {\n minDate,\n maxDate,\n value,\n defaultValue,\n setPrinstineValue,\n data,\n format,\n utc\n } = props;\n\n if (defaultValue && value === defaultValue) {\n const date = filterDate(defaultValue, data, format);\n setPrinstineValue((utc ? moment.utc(date) : date).format(format));\n }\n\n let schedulesData = props.schedules;\n if (typeof schedulesData === 'string') {\n const resolved = resolveVariableAndFilter(schedulesData, data, '| raw');\n if (Array.isArray(resolved)) {\n schedulesData = resolved;\n }\n }\n\n this.state = {\n minDate: minDate ? filterDate(minDate, data, format) : undefined,\n maxDate: maxDate ? filterDate(maxDate, data, format) : undefined,\n schedules: schedulesData\n };\n }\n\n componentDidUpdate(prevProps: DateProps) {\n const props = this.props;\n\n if (prevProps.defaultValue !== props.defaultValue) {\n const date = filterDate(props.defaultValue, props.data, props.format);\n props.setPrinstineValue(\n (props.utc ? moment.utc(date) : date).format(props.format)\n );\n }\n\n if (\n prevProps.minDate !== props.minDate ||\n prevProps.maxDate !== props.maxDate ||\n prevProps.data !== props.data\n ) {\n this.setState({\n minDate: props.minDate\n ? filterDate(props.minDate, props.data, this.props.format)\n : undefined,\n maxDate: props.maxDate\n ? filterDate(props.maxDate, props.data, this.props.format)\n : undefined\n });\n }\n\n if (\n anyChanged(['schedules', 'data'], prevProps, props) &&\n typeof props.schedules === 'string' &&\n isPureVariable(props.schedules)\n ) {\n const schedulesData = resolveVariableAndFilter(\n props.schedules,\n props.data,\n '| raw'\n );\n const preSchedulesData = resolveVariableAndFilter(\n prevProps.schedules,\n prevProps.data,\n '| raw'\n );\n if (Array.isArray(schedulesData) && preSchedulesData !== schedulesData) {\n this.setState({\n schedules: schedulesData\n });\n }\n }\n }\n\n // 日程点击事件\n onScheduleClick(scheduleData: any) {\n const {scheduleAction, onAction, data, translate: __} = this.props;\n const defaultscheduleAction = {\n actionType: 'dialog',\n dialog: {\n title: __('Schedule'),\n actions: [],\n body: {\n type: 'table',\n columns: [\n {\n name: 'time',\n label: __('Time')\n },\n {\n name: 'content',\n label: __('Content')\n }\n ],\n data: '${scheduleData}'\n }\n }\n };\n\n onAction &&\n onAction(\n null,\n scheduleAction || defaultscheduleAction,\n createObject(data, scheduleData)\n );\n }\n\n @autobind\n getRef(ref: BaseDatePicker) {\n this.dateRef = ref;\n }\n\n // 派发有event的事件\n @autobind\n dispatchEvent(e: React.SyntheticEvent<HTMLElement>) {\n const {dispatchEvent, data} = this.props;\n dispatchEvent(e, data);\n }\n\n // 动作\n doAction(action: Action, data: object, throwErrors: boolean) {\n const {resetValue} = this.props;\n\n if (action.actionType === 'clear') {\n this.dateRef?.clear();\n return;\n }\n\n if (action.actionType === 'reset' && resetValue) {\n this.dateRef?.reset(resetValue);\n }\n }\n\n // 值的变化\n @autobind\n async handleChange(nextValue: any) {\n const {dispatchEvent, data} = this.props;\n const dispatcher = dispatchEvent(\n 'change',\n createObject(data, {value: nextValue})\n );\n if (dispatcher?.prevented) {\n return;\n }\n this.props.onChange(nextValue);\n }\n\n render() {\n let {\n className,\n defaultValue,\n defaultData,\n classnames: cx,\n minDate,\n maxDate,\n type,\n format,\n timeFormat,\n valueFormat,\n env,\n largeMode,\n render,\n useMobileUI,\n ...rest\n } = this.props;\n const mobileUI = useMobileUI && isMobile();\n\n if (type === 'time' && timeFormat) {\n format = timeFormat;\n }\n\n return (\n <div\n className={cx(\n `DateControl`,\n {\n 'is-date': /date$/.test(type),\n 'is-datetime': /datetime$/.test(type)\n },\n className\n )}\n >\n <DatePicker\n {...rest}\n useMobileUI={useMobileUI}\n popOverContainer={\n mobileUI && env && env.getModalContainer\n ? env.getModalContainer\n : mobileUI\n ? undefined\n : rest.popOverContainer\n }\n timeFormat={timeFormat}\n format={valueFormat || format}\n {...this.state}\n classnames={cx}\n onRef={this.getRef}\n schedules={this.state.schedules}\n largeMode={largeMode}\n onScheduleClick={this.onScheduleClick.bind(this)}\n onChange={this.handleChange}\n onFocus={this.dispatchEvent}\n onBlur={this.dispatchEvent}\n />\n </div>\n );\n }\n}\n\n@FormItem({\n type: 'input-date',\n weight: -150\n})\nexport class DateControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'Date.placeholder',\n dateFormat: 'YYYY-MM-DD',\n timeFormat: '',\n strictMode: false\n };\n}\n\n@FormItem({\n type: 'input-datetime'\n})\nexport class DatetimeControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'DateTime.placeholder',\n inputFormat: 'YYYY-MM-DD HH:mm:ss',\n dateFormat: 'LL',\n timeFormat: 'HH:mm:ss',\n closeOnSelect: false,\n strictMode: false\n };\n}\n\n@FormItem({\n type: 'input-time'\n})\nexport class TimeControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'Time.placeholder',\n inputFormat: 'HH:mm',\n dateFormat: '',\n timeFormat: 'HH:mm',\n viewMode: 'time',\n closeOnSelect: false\n };\n}\n\n@FormItem({\n type: 'input-month'\n})\nexport class MonthControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'Month.placeholder',\n inputFormat: 'YYYY-MM',\n dateFormat: 'MM',\n timeFormat: '',\n viewMode: 'months',\n closeOnSelect: true\n };\n}\n\n@FormItem({\n type: 'input-quarter'\n})\nexport class QuarterControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'Quarter.placeholder',\n inputFormat: 'YYYY [Q]Q',\n dateFormat: 'YYYY [Q]Q',\n timeFormat: '',\n viewMode: 'quarters',\n closeOnSelect: true\n };\n}\n\n@FormItem({\n type: 'input-year'\n})\nexport class YearControlRenderer extends DateControl {\n static defaultProps = {\n ...DateControl.defaultProps,\n placeholder: 'Year.placeholder',\n inputFormat: 'YYYY',\n dateFormat: 'YYYY',\n timeFormat: '',\n viewMode: 'years',\n closeOnSelect: true\n };\n}\n"
|
12
12
|
]
|
13
13
|
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { FormControlProps, FormBaseControl } from './Item';
|
3
|
+
/**
|
4
|
+
* JSON Schema
|
5
|
+
* 文档:https://baidu.gitee.io/amis/docs/components/form/json-schema
|
6
|
+
*/
|
7
|
+
export interface JSONSchemaControlSchema extends FormBaseControl {
|
8
|
+
/**
|
9
|
+
* 指定为 JSON Schema
|
10
|
+
*/
|
11
|
+
type: 'json-schema';
|
12
|
+
/**
|
13
|
+
* json-schema 详情,支持关联上下文数据
|
14
|
+
*/
|
15
|
+
schema?: any;
|
16
|
+
}
|
17
|
+
export interface JSONSchemaProps extends FormControlProps, Omit<JSONSchemaControlSchema, 'type' | 'className' | 'descriptionClassName' | 'inputClassName'> {
|
18
|
+
}
|
19
|
+
export default class JSONSchemaControl extends React.PureComponent<JSONSchemaProps> {
|
20
|
+
render(): JSX.Element;
|
21
|
+
}
|
22
|
+
export declare class JSONSchemaRenderer extends JSONSchemaControl {
|
23
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.JSONSchemaRenderer = void 0;
|
4
|
+
var tslib_1 = require("tslib");
|
5
|
+
var react_1 = (0, tslib_1.__importDefault)(require("react"));
|
6
|
+
var Item_1 = require("./Item");
|
7
|
+
var index_1 = (0, tslib_1.__importDefault)(require("../../components/json-schema/index"));
|
8
|
+
var WithRemoteConfig_1 = require("../../components/WithRemoteConfig");
|
9
|
+
var EnhancedInputJSONSchema = (0, WithRemoteConfig_1.withRemoteConfig)({
|
10
|
+
sourceField: 'schema',
|
11
|
+
injectedPropsFilter: function (injectedProps, props) {
|
12
|
+
return {
|
13
|
+
schema: injectedProps.config,
|
14
|
+
loading: injectedProps.loading
|
15
|
+
};
|
16
|
+
}
|
17
|
+
})(index_1.default);
|
18
|
+
var JSONSchemaControl = /** @class */ (function (_super) {
|
19
|
+
(0, tslib_1.__extends)(JSONSchemaControl, _super);
|
20
|
+
function JSONSchemaControl() {
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
22
|
+
}
|
23
|
+
JSONSchemaControl.prototype.render = function () {
|
24
|
+
var rest = (0, tslib_1.__rest)(this.props, []);
|
25
|
+
return react_1.default.createElement(EnhancedInputJSONSchema, (0, tslib_1.__assign)({}, rest));
|
26
|
+
};
|
27
|
+
return JSONSchemaControl;
|
28
|
+
}(react_1.default.PureComponent));
|
29
|
+
exports.default = JSONSchemaControl;
|
30
|
+
var JSONSchemaRenderer = /** @class */ (function (_super) {
|
31
|
+
(0, tslib_1.__extends)(JSONSchemaRenderer, _super);
|
32
|
+
function JSONSchemaRenderer() {
|
33
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
34
|
+
}
|
35
|
+
JSONSchemaRenderer = (0, tslib_1.__decorate)([
|
36
|
+
(0, Item_1.FormItem)({
|
37
|
+
type: 'json-schema',
|
38
|
+
strictMode: false
|
39
|
+
})
|
40
|
+
], JSONSchemaRenderer);
|
41
|
+
return JSONSchemaRenderer;
|
42
|
+
}(JSONSchemaControl));
|
43
|
+
exports.JSONSchemaRenderer = JSONSchemaRenderer;
|
44
|
+
//# sourceMappingURL=./renderers/Form/JSONSchema.js.map
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"file": "JSONSchema.js",
|
4
|
+
"sourceRoot": "",
|
5
|
+
"sources": [
|
6
|
+
"/src/renderers/Form/JSONSchema.tsx"
|
7
|
+
],
|
8
|
+
"names": [],
|
9
|
+
"mappings": ";;;;AAAA,6DAA0B;AAC1B,+BAAmE;AAEnE,0FAAiE;AAMjE,sEAAmE;AAyBnE,IAAM,uBAAuB,GAAG,IAAA,mCAAgB,EAAC;IAC/C,WAAW,EAAE,QAAQ;IACrB,mBAAmB,EAAE,UAAC,aAAa,EAAE,KAAK;QACxC,OAAO;YACL,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,OAAO,EAAE,aAAa,CAAC,OAAO;SAC/B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC,eAAsB,CAAC,CAAC;AAC3B;IAA+C,kDAAoC;IAAnF;;IAMA,CAAC;IALC,kCAAM,GAAN;QACE,IAAU,IAAI,uBAAI,IAAI,CAAC,KAAK,EAAtB,EAAS,CAAa,CAAC;QAE7B,OAAO,8BAAC,uBAAuB,4BAAK,IAAI,EAAI,CAAC;IAC/C,CAAC;IACH,wBAAC;AAAD,CAAC,AAND,CAA+C,eAAK,CAAC,aAAa,GAMjE;;AAMD;IAAwC,mDAAiB;IAAzD;;IAA2D,CAAC;IAA/C,kBAAkB;QAJ9B,IAAA,eAAQ,EAAC;YACR,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE,KAAK;SAClB,CAAC;OACW,kBAAkB,CAA6B;IAAD,yBAAC;CAAA,AAA5D,CAAwC,iBAAiB,GAAG;AAA/C,gDAAkB",
|
10
|
+
"sourcesContent": [
|
11
|
+
"import React from 'react';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\nimport {autobind, isObjectShallowModified} from '../../utils/helper';\nimport InputJSONSchema from '../../components/json-schema/index';\nimport {\n isPureVariable,\n resolveVariableAndFilter\n} from '../../utils/tpl-builtin';\nimport {isApiOutdated, isEffectiveApi} from '../../utils/api';\nimport {withRemoteConfig} from '../../components/WithRemoteConfig';\n\n/**\n * JSON Schema\n * 文档:https://baidu.gitee.io/amis/docs/components/form/json-schema\n */\nexport interface JSONSchemaControlSchema extends FormBaseControl {\n /**\n * 指定为 JSON Schema\n */\n type: 'json-schema';\n\n /**\n * json-schema 详情,支持关联上下文数据\n */\n schema?: any;\n}\n\nexport interface JSONSchemaProps\n extends FormControlProps,\n Omit<\n JSONSchemaControlSchema,\n 'type' | 'className' | 'descriptionClassName' | 'inputClassName'\n > {}\n\nconst EnhancedInputJSONSchema = withRemoteConfig({\n sourceField: 'schema',\n injectedPropsFilter: (injectedProps, props) => {\n return {\n schema: injectedProps.config,\n loading: injectedProps.loading\n };\n }\n})(InputJSONSchema as any);\nexport default class JSONSchemaControl extends React.PureComponent<JSONSchemaProps> {\n render() {\n const {...rest} = this.props;\n\n return <EnhancedInputJSONSchema {...rest} />;\n }\n}\n\n@FormItem({\n type: 'json-schema',\n strictMode: false\n})\nexport class JSONSchemaRenderer extends JSONSchemaControl {}\n"
|
12
|
+
]
|
13
|
+
}
|
@@ -15,7 +15,7 @@ export interface JSONSchemaEditorControlSchema extends FormBaseControl {
|
|
15
15
|
definitions?: {
|
16
16
|
[propName: string]: {
|
17
17
|
title: string;
|
18
|
-
type: 'string' | 'number' | '
|
18
|
+
type: 'string' | 'number' | 'integer' | 'object' | 'array' | 'boolean' | 'null';
|
19
19
|
[propName: string]: any;
|
20
20
|
};
|
21
21
|
};
|
@@ -56,8 +56,7 @@ export default class JSONSchemaEditorControl extends React.PureComponent<JSONSch
|
|
56
56
|
static defaultProps: {
|
57
57
|
enableAdvancedSetting: boolean;
|
58
58
|
};
|
59
|
-
|
60
|
-
renderModalProps({ value, onChange }: any): JSX.Element;
|
59
|
+
renderModalProps(value: any, onChange: (value: any) => void): JSX.Element;
|
61
60
|
render(): JSX.Element;
|
62
61
|
}
|
63
62
|
export declare class JSONSchemaEditorRenderer extends JSONSchemaEditorControl {
|
@@ -9,39 +9,24 @@ var helper_1 = require("../../utils/helper");
|
|
9
9
|
var JSONSchemaEditorControl = /** @class */ (function (_super) {
|
10
10
|
(0, tslib_1.__extends)(JSONSchemaEditorControl, _super);
|
11
11
|
function JSONSchemaEditorControl() {
|
12
|
-
|
13
|
-
// todo 完善这块配置
|
14
|
-
_this.settings = {
|
15
|
-
common: [
|
16
|
-
{
|
17
|
-
type: 'input-text',
|
18
|
-
name: 'title',
|
19
|
-
label: _this.props.translate('JSONSchema.title')
|
20
|
-
},
|
21
|
-
{
|
22
|
-
type: 'textarea',
|
23
|
-
name: 'description',
|
24
|
-
label: _this.props.translate('JSONSchema.description')
|
25
|
-
}
|
26
|
-
]
|
27
|
-
};
|
28
|
-
return _this;
|
12
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
29
13
|
}
|
30
|
-
JSONSchemaEditorControl.prototype.renderModalProps = function (
|
31
|
-
var
|
32
|
-
var
|
14
|
+
JSONSchemaEditorControl.prototype.renderModalProps = function (value, onChange) {
|
15
|
+
var _a = this.props, render = _a.render, advancedSettings = _a.advancedSettings;
|
16
|
+
var fields = (advancedSettings === null || advancedSettings === void 0 ? void 0 : advancedSettings[value === null || value === void 0 ? void 0 : value.type]) || [];
|
33
17
|
return render("modal", {
|
34
18
|
type: 'form',
|
35
19
|
wrapWithPanel: false,
|
36
|
-
body:
|
20
|
+
body: fields,
|
21
|
+
submitOnChange: true
|
37
22
|
}, {
|
38
23
|
data: value,
|
39
|
-
|
24
|
+
onSubmit: function (value) { return onChange(value); }
|
40
25
|
});
|
41
26
|
};
|
42
27
|
JSONSchemaEditorControl.prototype.render = function () {
|
43
28
|
var _a = this.props, enableAdvancedSetting = _a.enableAdvancedSetting, rest = (0, tslib_1.__rest)(_a, ["enableAdvancedSetting"]);
|
44
|
-
return (react_1.default.createElement(index_1.default, (0, tslib_1.__assign)({}, rest, {
|
29
|
+
return (react_1.default.createElement(index_1.default, (0, tslib_1.__assign)({}, rest, { enableAdvancedSetting: enableAdvancedSetting, renderModalProps: this.renderModalProps })));
|
45
30
|
};
|
46
31
|
JSONSchemaEditorControl.defaultProps = {
|
47
32
|
enableAdvancedSetting: false
|
@@ -49,7 +34,7 @@ var JSONSchemaEditorControl = /** @class */ (function (_super) {
|
|
49
34
|
(0, tslib_1.__decorate)([
|
50
35
|
helper_1.autobind,
|
51
36
|
(0, tslib_1.__metadata)("design:type", Function),
|
52
|
-
(0, tslib_1.__metadata)("design:paramtypes", [Object]),
|
37
|
+
(0, tslib_1.__metadata)("design:paramtypes", [Object, Function]),
|
53
38
|
(0, tslib_1.__metadata)("design:returntype", void 0)
|
54
39
|
], JSONSchemaEditorControl.prototype, "renderModalProps", null);
|
55
40
|
return JSONSchemaEditorControl;
|
@@ -6,8 +6,8 @@
|
|
6
6
|
"/src/renderers/Form/JSONSchemaEditor.tsx"
|
7
7
|
],
|
8
8
|
"names": [],
|
9
|
-
"mappings": ";;;;AAAA,6DAA0B;AAC1B,+BAAmE;AACnE,4FAAoE;AACpE,6CAA4C;AAyE5C;IAAqD,wDAA0C;IAA/F
|
9
|
+
"mappings": ";;;;AAAA,6DAA0B;AAC1B,+BAAmE;AACnE,4FAAoE;AACpE,6CAA4C;AAyE5C;IAAqD,wDAA0C;IAA/F;;IAmCA,CAAC;IA7BC,kDAAgB,GAAhB,UAAiB,KAAU,EAAE,QAA8B;QACnD,IAAA,KAA6B,IAAI,CAAC,KAAK,EAAtC,MAAM,YAAA,EAAE,gBAAgB,sBAAc,CAAC;QAC9C,IAAM,MAAM,GAAG,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,KAAI,EAAE,CAAC;QACrD,OAAO,MAAM,CACX,OAAO,EACP;YACE,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,KAAK;YACpB,IAAI,EAAE,MAAM;YACZ,cAAc,EAAE,IAAI;SACrB,EACD;YACE,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,UAAC,KAAU,IAAK,OAAA,QAAQ,CAAC,KAAK,CAAC,EAAf,CAAe;SAC1C,CACF,CAAC;IACJ,CAAC;IAED,wCAAM,GAAN;QACE,IAAM,KAAmC,IAAI,CAAC,KAAK,EAA5C,qBAAqB,2BAAA,EAAK,IAAI,2BAA/B,yBAAgC,CAAa,CAAC;QAEpD,OAAO,CACL,8BAAC,eAAgB,4BACX,IAAI,IACR,qBAAqB,EAAE,qBAAqB,EAC5C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IACvC,CACH,CAAC;IACJ,CAAC;IAjCM,oCAAY,GAAG;QACpB,qBAAqB,EAAE,KAAK;KAC7B,CAAC;IAGF;QADC,iBAAQ;;;;mEAiBR;IAaH,8BAAC;CAAA,AAnCD,CAAqD,eAAK,CAAC,aAAa,GAmCvE;kBAnCoB,uBAAuB;AAwC5C;IAA8C,yDAAuB;IAArE;;IAAuE,CAAC;IAA3D,wBAAwB;QAHpC,IAAA,eAAQ,EAAC;YACR,IAAI,EAAE,oBAAoB;SAC3B,CAAC;OACW,wBAAwB,CAAmC;IAAD,+BAAC;CAAA,AAAxE,CAA8C,uBAAuB,GAAG;AAA3D,4DAAwB",
|
10
10
|
"sourcesContent": [
|
11
|
-
"import React from 'react';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\nimport JSONSchemaEditor from '../../components/schema-editor/index';\nimport {autobind} from '../../utils/helper';\n\n/**\n * JSON Schema Editor\n * 文档:https://baidu.gitee.io/amis/docs/components/form/json-schema-editor\n */\nexport interface JSONSchemaEditorControlSchema extends FormBaseControl {\n /**\n * 指定为 JSON Schema Editor\n */\n type: 'json-schema-editor';\n\n /**\n * 可以理解为类型模板,方便快速定义复杂类型\n */\n definitions?: {\n [propName: string]: {\n title: string;\n type:\n | 'string'\n | 'number'\n | '
|
11
|
+
"import React from 'react';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\nimport JSONSchemaEditor from '../../components/schema-editor/index';\nimport {autobind} from '../../utils/helper';\n\n/**\n * JSON Schema Editor\n * 文档:https://baidu.gitee.io/amis/docs/components/form/json-schema-editor\n */\nexport interface JSONSchemaEditorControlSchema extends FormBaseControl {\n /**\n * 指定为 JSON Schema Editor\n */\n type: 'json-schema-editor';\n\n /**\n * 可以理解为类型模板,方便快速定义复杂类型\n */\n definitions?: {\n [propName: string]: {\n title: string;\n type:\n | 'string'\n | 'number'\n | 'integer'\n | 'object'\n | 'array'\n | 'boolean'\n | 'null';\n [propName: string]: any;\n };\n };\n\n /**\n * 顶层是否允许修改类型\n */\n rootTypeMutable?: boolean;\n\n /**\n * 顶层类型信息是否隐藏\n */\n showRootInfo?: boolean;\n\n /**\n * 禁用类型,默认禁用了 null 类型\n */\n disabledTypes?: Array<string>;\n\n /**\n * 开启详情配置\n */\n enableAdvancedSetting?: boolean;\n\n /**\n * 自定义详情配置面板如:\n *\n * {\n * boolean: [\n * {type: \"input-text\", name: \"aa\", label: \"AA\" }\n * ]\n * }\n *\n * 当配置布尔字段详情时,就会出现以上配置\n */\n advancedSettings?: {\n [propName: string]: any;\n };\n}\n\nexport interface JSONSchemaEditorProps\n extends FormControlProps,\n Omit<\n JSONSchemaEditorControlSchema,\n 'type' | 'className' | 'descriptionClassName' | 'inputClassName'\n > {}\n\nexport default class JSONSchemaEditorControl extends React.PureComponent<JSONSchemaEditorProps> {\n static defaultProps = {\n enableAdvancedSetting: false\n };\n\n @autobind\n renderModalProps(value: any, onChange: (value: any) => void) {\n const {render, advancedSettings} = this.props;\n const fields = advancedSettings?.[value?.type] || [];\n return render(\n `modal`,\n {\n type: 'form',\n wrapWithPanel: false,\n body: fields,\n submitOnChange: true\n },\n {\n data: value,\n onSubmit: (value: any) => onChange(value)\n }\n );\n }\n\n render() {\n const {enableAdvancedSetting, ...rest} = this.props;\n\n return (\n <JSONSchemaEditor\n {...rest}\n enableAdvancedSetting={enableAdvancedSetting}\n renderModalProps={this.renderModalProps}\n />\n );\n }\n}\n\n@FormItem({\n type: 'json-schema-editor'\n})\nexport class JSONSchemaEditorRenderer extends JSONSchemaEditorControl {}\n"
|
12
12
|
]
|
13
13
|
}
|
@@ -260,14 +260,19 @@ function registerOptionsControl(config) {
|
|
260
260
|
var _a = this.props, joinValues = _a.joinValues, extractValue = _a.extractValue, valueField = _a.valueField, delimiter = _a.delimiter, resetValue = _a.resetValue, multiple = _a.multiple;
|
261
261
|
var newValue = '';
|
262
262
|
if (multiple) {
|
263
|
-
|
263
|
+
/** 兼容tree数据结构 */
|
264
|
+
newValue =
|
265
|
+
(0, helper_1.getTreeDepth)(valueArray) > 1 ? (0, helper_1.flattenTree)(valueArray) : valueArray;
|
264
266
|
if (joinValues) {
|
265
267
|
newValue = newValue
|
266
268
|
.map(function (item) { return item[valueField || 'value']; })
|
269
|
+
.filter(function (item) { return item != null; }) /** tree的父节点可能没有value值 */
|
267
270
|
.join(delimiter);
|
268
271
|
}
|
269
272
|
else if (extractValue) {
|
270
|
-
newValue = newValue
|
273
|
+
newValue = newValue
|
274
|
+
.map(function (item) { return item[valueField || 'value']; })
|
275
|
+
.filter(function (item) { return item != null; });
|
271
276
|
}
|
272
277
|
}
|
273
278
|
else {
|
@@ -280,16 +285,17 @@ function registerOptionsControl(config) {
|
|
280
285
|
};
|
281
286
|
FormOptionsItem.prototype.handleToggleAll = function () {
|
282
287
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
283
|
-
var _a, value, onChange, formItem, selectedOptions, valueArray, newValue, isPrevented;
|
288
|
+
var _a, value, onChange, formItem, valueField, selectedOptions, filteredOptions, valueArray, newValue, isPrevented;
|
284
289
|
return (0, tslib_1.__generator)(this, function (_b) {
|
285
290
|
switch (_b.label) {
|
286
291
|
case 0:
|
287
|
-
_a = this.props, value = _a.value, onChange = _a.onChange, formItem = _a.formItem;
|
292
|
+
_a = this.props, value = _a.value, onChange = _a.onChange, formItem = _a.formItem, valueField = _a.valueField;
|
288
293
|
if (!formItem) {
|
289
294
|
return [2 /*return*/];
|
290
295
|
}
|
291
296
|
selectedOptions = formItem.getSelectedOptions(value);
|
292
|
-
|
297
|
+
filteredOptions = (0, helper_1.flattenTree)(formItem.filteredOptions.concat()).filter(function (item) { return item != null && item[valueField || 'value'] != null; });
|
298
|
+
valueArray = selectedOptions.length === filteredOptions.length
|
293
299
|
? []
|
294
300
|
: formItem.filteredOptions.concat();
|
295
301
|
newValue = this.formatValueArray(valueArray);
|