jrs-react 1.0.22 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.es.js CHANGED
@@ -2807,307 +2807,12 @@ function requireReact () {
2807
2807
  var reactExports = requireReact();
2808
2808
  var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
2809
2809
 
2810
- // import axios from 'axios'
2811
- // import { colonValueString, flexType, po } from './JRUtils'
2812
- // import { displaySpinner } from '../jrx/LoadingBar'
2813
- // import msg from '../jrx/IMessage'
2814
- // import styled from 'styled-components'
2815
-
2816
- // const axiosSubmit = axios.create({
2817
- // authorization: `Bearer ${localStorage.getItem("accessToken")}`
2818
- // ,timeout: 120000
2819
- // ,maxBodyLength: 104857600 //100mb 104857600
2820
- // ,maxContentLength: 104857600 //100mb
2821
- // })
2822
-
2823
- // const StyledCover=styled.div`
2824
- // border:2px solid red;
2825
- // `
2826
- // const Cover=({children})=>{
2827
- // return <StyledCover>{children}</StyledCover>
2828
- // }
2829
-
2830
2810
  class JRSubmit extends React.Component {
2831
2811
  render() {
2832
2812
  return /*#__PURE__*/React.createElement("div", null, "JRSubmit");
2833
2813
  }
2834
2814
  }
2835
2815
 
2836
- // export default class JRSubmit extends React.Component {
2837
- // #methods = ['get', 'post', 'put','patch','delete','download']
2838
-
2839
- // constructor(props) {
2840
- // super(props)
2841
- // if(this.props.value===undefined && this.props.initValue!==undefined ){
2842
- // if(this.props.onChange===undefined){
2843
- // this.state={
2844
- // value:props.initValue
2845
- // ,rawValue:JSON.parse(JSON.stringify(props.initValue))
2846
- // }
2847
- // }
2848
- // }
2849
- // }
2850
- // componentDidMount() {
2851
- // this.#methods
2852
- // .filter((method) => this[method] && this.props[method] && this.props[method].autoRun)
2853
- // .forEach((method) => {
2854
- // this[method]()
2855
- // })
2856
- // }
2857
- // get(_config = {}) {
2858
- // const config = Object.assign(
2859
- // {
2860
- // method:'get'
2861
- // ,updateValue:true
2862
- // // ,updateRawValue:true
2863
- // }
2864
- // ,this.props['get']
2865
- // ,_config
2866
- // )
2867
- // this.submit(config)
2868
- // }
2869
-
2870
- // post(config = {}) {
2871
- // config = Object.assign(
2872
- // {
2873
- // method:'post'
2874
- // ,updateValue:false
2875
- // }
2876
- // ,this.props['post']
2877
- // ,config
2878
- // )
2879
- // this.submit(config)
2880
- // }
2881
-
2882
- // put(config = {}) {
2883
- // config = Object.assign(
2884
- // {
2885
- // method:'put'
2886
- // ,updateValue:false
2887
- // }
2888
- // ,this.props['put']
2889
- // ,config
2890
- // )
2891
- // this.submit(config)
2892
- // }
2893
-
2894
- // delete(config = {}) {
2895
- // config = Object.assign(
2896
- // {
2897
- // method:'delete'
2898
- // ,updateValue:false
2899
- // }
2900
- // ,this.props['delete']
2901
- // ,config
2902
- // )
2903
- // this.submit(config)
2904
- // }
2905
-
2906
- // get from(){
2907
- // return this.props.value===undefined?'state':'props'
2908
- // }
2909
-
2910
- // get isDirty(){
2911
- // return this.state?.isDirty
2912
- // }
2913
- // set isDirty(isDirty){
2914
- // this.setState({isDirty})
2915
- // }
2916
- // get rawValue(){
2917
- // return this.state?.rawValue
2918
- // }
2919
- // setRawValue(rawValue){
2920
- // this.setState({rawValue:JSON.parse(JSON.stringify(rawValue??''))})
2921
- // }
2922
- // reset(){
2923
- // this.setValue(this.rawValue,true)
2924
- // }
2925
- // setValue(value,reset=false){
2926
- // if(this.props.onChange){
2927
- // this.props.onChange(value)
2928
- // }else{
2929
- // this.setState({value})
2930
- // }
2931
-
2932
- // if(reset){
2933
- // this.setRawValue(value)
2934
- // }
2935
- // this.isDirty=!reset
2936
- // }
2937
- // setRes(isSuccess,response,config){
2938
- // if (isSuccess && config.updateValue) {
2939
- // const value=config.formatValue?.bind(this)(response.data)??response.data
2940
- // response.data=value
2941
- // this.setValue(value,true)
2942
- // } else if(config.updateValue){
2943
- // this.setValue(null,true)
2944
- // }
2945
- // }
2946
- // #getValueByName(fullnamList,record){
2947
- // const name=fullnamList.shift()
2948
- // if(fullnamList.length==0){
2949
- // return record?.[name]
2950
- // }else if(record?.[name]!=null){
2951
- // return this.#getValueByName(fullnamList,record[name])
2952
- // }
2953
- // }
2954
-
2955
- // getValue(fullname){
2956
- // if(fullname){
2957
- // const fullnamList=fullname.split('.')
2958
- // return this.#getValueByName(fullnamList,this[this.from]?.value)
2959
- // }else{
2960
- // return flexType(this[this.from]?.value,this,null,null)
2961
- // }
2962
- // }
2963
-
2964
- // getSubmitValue(){
2965
- // return this.getValue()
2966
- // }
2967
-
2968
- // getAxiosParams({url,method,value,extraValue,sendValue,transformValue,...params}){
2969
- // const _extraValue=extraValue?.bind?.(this)() ?? extraValue
2970
- // // let payload=typeof value === 'function'
2971
- // // ?value.bind(this)({
2972
- // // ...this.getSubmitValue()
2973
- // // ,..._extraValue
2974
- // // })
2975
- // // :value==null
2976
- // // ?{
2977
- // // ...this.getSubmitValue()
2978
- // // ,..._extraValue
2979
- // // }
2980
- // // :{
2981
- // // ...value
2982
- // // ,..._extraValue
2983
- // // }
2984
- // let payload=value?.bind?.(this)({
2985
- // ...this.getSubmitValue()
2986
- // ,..._extraValue
2987
- // })
2988
- // ?? value==null
2989
- // ?{
2990
- // ...this.getSubmitValue()
2991
- // ,..._extraValue
2992
- // }
2993
- // :{
2994
- // ...value
2995
- // ,..._extraValue
2996
- // }
2997
-
2998
- // if(transformValue){
2999
- // payload=transformValue.bind(this)(payload)
3000
- // }
3001
- // const headers={
3002
- // authorization: `Bearer ${localStorage.getItem("accessToken")}`
3003
- // }
3004
- // let params1={}
3005
- // const params2={}
3006
- // if(method=='get'){
3007
- // if(sendValue==null || sendValue)params1.params=payload
3008
- // params1.headers=headers
3009
- // }else if(method=='delete'){
3010
- // if(sendValue==null || sendValue)params1.data=payload
3011
- // params1.headers=headers
3012
- // }else{
3013
- // if(sendValue==null || sendValue){
3014
- // params1=payload
3015
- // }else{
3016
- // params1=null
3017
- // }
3018
- // params2.headers=headers
3019
- // }
3020
- // return {
3021
- // url:colonValueString(url,payload)
3022
- // ,method
3023
- // ,params1
3024
- // ,params2
3025
- // ,payload
3026
- // }
3027
- // }
3028
-
3029
- // reload(){
3030
- // po('reload 還沒有做 ')
3031
- // }
3032
-
3033
- // submit(config){
3034
- // const me=this
3035
- // // displaySpinner({mask:config.mask})++++++++++++++
3036
- // this.setState({loading:true})
3037
- // let _payload
3038
- // ;(()=>{
3039
- // if (Array.isArray(config.url)) {
3040
- // _payload=[]
3041
- // return Promise.allSettled(
3042
- // config.url.map((_url) => {
3043
- // const urlParams=typeof _url === 'object'
3044
- // ?_url
3045
- // :{url: _url}
3046
- // const finalConfig=Object.assign(config,urlParams)
3047
- // const {url,method,params1,params2,payload}=this.getAxiosParams(finalConfig)
3048
- // _payload.push(payload)
3049
- // return axiosSubmit[method](url,params1,params2)
3050
- // })
3051
- // )
3052
- // }else{
3053
- // const {url,method,params1,params2,payload}=this.getAxiosParams(config)
3054
- // _payload=payload
3055
- // return axiosSubmit[method](url,params1,params2)
3056
- // }
3057
- // })()
3058
- // .then((res)=>{
3059
- // this.handleResponse(res,_payload,config)
3060
- // })
3061
- // .catch((res)=>{
3062
- // this.handleResponse(res,_payload,config)
3063
- // })
3064
- // .finally(function (a,b,c) {
3065
- // me.setState({loading:false})
3066
- // // displaySpinner({mask:false})+++++++++++++++++++++++
3067
- // })
3068
- // }
3069
-
3070
- // handleResponse=(response,payload,config)=>{
3071
- // if(Array.isArray(response)){
3072
- // response=response.map((re,index)=>{
3073
- // if(re.value){
3074
- // re.value.payload=payload[index]
3075
- // }else if(re.reason){
3076
- // re.reason.payload=payload[index]
3077
- // }
3078
- // return re
3079
- // })
3080
- // }else{
3081
- // response.payload=payload
3082
- // }
3083
-
3084
- // response = config?.response?.bind(this)(response,payload) ?? response
3085
- // const isSuccess = response.status >= 200 && response.status <= 299
3086
-
3087
- // this.setRes(isSuccess,response,config)
3088
- // if (isSuccess) {
3089
- // if (config.successMessage) {
3090
- // // msg.success({ message:config.successMessage });+++++++++++++++++++++
3091
- // }
3092
- // } else {
3093
- // if (config.failedMessage) {
3094
- // // msg.error({ message:config.failedMessage });+++++++++++++++++++++++
3095
- // }
3096
- // }
3097
- // config.callback?.bind(this)(isSuccess,response,payload)
3098
- // }
3099
-
3100
- // renderer(){
3101
- // return
3102
- // }
3103
-
3104
- // render() {
3105
- // return this.props.cover!=null && this.state?.lodaing
3106
- // ?<Cover>{flexType(this.props.cover,this,null,null)}</Cover>
3107
- // :this.renderer()
3108
- // }
3109
- // }
3110
-
3111
2816
  function JRTest() {
3112
2817
  return 'I am JRTest string';
3113
2818
  }
package/build/index.js CHANGED
@@ -2811,307 +2811,12 @@ function requireReact () {
2811
2811
  var reactExports = requireReact();
2812
2812
  var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
2813
2813
 
2814
- // import axios from 'axios'
2815
- // import { colonValueString, flexType, po } from './JRUtils'
2816
- // import { displaySpinner } from '../jrx/LoadingBar'
2817
- // import msg from '../jrx/IMessage'
2818
- // import styled from 'styled-components'
2819
-
2820
- // const axiosSubmit = axios.create({
2821
- // authorization: `Bearer ${localStorage.getItem("accessToken")}`
2822
- // ,timeout: 120000
2823
- // ,maxBodyLength: 104857600 //100mb 104857600
2824
- // ,maxContentLength: 104857600 //100mb
2825
- // })
2826
-
2827
- // const StyledCover=styled.div`
2828
- // border:2px solid red;
2829
- // `
2830
- // const Cover=({children})=>{
2831
- // return <StyledCover>{children}</StyledCover>
2832
- // }
2833
-
2834
2814
  class JRSubmit extends React.Component {
2835
2815
  render() {
2836
2816
  return /*#__PURE__*/React.createElement("div", null, "JRSubmit");
2837
2817
  }
2838
2818
  }
2839
2819
 
2840
- // export default class JRSubmit extends React.Component {
2841
- // #methods = ['get', 'post', 'put','patch','delete','download']
2842
-
2843
- // constructor(props) {
2844
- // super(props)
2845
- // if(this.props.value===undefined && this.props.initValue!==undefined ){
2846
- // if(this.props.onChange===undefined){
2847
- // this.state={
2848
- // value:props.initValue
2849
- // ,rawValue:JSON.parse(JSON.stringify(props.initValue))
2850
- // }
2851
- // }
2852
- // }
2853
- // }
2854
- // componentDidMount() {
2855
- // this.#methods
2856
- // .filter((method) => this[method] && this.props[method] && this.props[method].autoRun)
2857
- // .forEach((method) => {
2858
- // this[method]()
2859
- // })
2860
- // }
2861
- // get(_config = {}) {
2862
- // const config = Object.assign(
2863
- // {
2864
- // method:'get'
2865
- // ,updateValue:true
2866
- // // ,updateRawValue:true
2867
- // }
2868
- // ,this.props['get']
2869
- // ,_config
2870
- // )
2871
- // this.submit(config)
2872
- // }
2873
-
2874
- // post(config = {}) {
2875
- // config = Object.assign(
2876
- // {
2877
- // method:'post'
2878
- // ,updateValue:false
2879
- // }
2880
- // ,this.props['post']
2881
- // ,config
2882
- // )
2883
- // this.submit(config)
2884
- // }
2885
-
2886
- // put(config = {}) {
2887
- // config = Object.assign(
2888
- // {
2889
- // method:'put'
2890
- // ,updateValue:false
2891
- // }
2892
- // ,this.props['put']
2893
- // ,config
2894
- // )
2895
- // this.submit(config)
2896
- // }
2897
-
2898
- // delete(config = {}) {
2899
- // config = Object.assign(
2900
- // {
2901
- // method:'delete'
2902
- // ,updateValue:false
2903
- // }
2904
- // ,this.props['delete']
2905
- // ,config
2906
- // )
2907
- // this.submit(config)
2908
- // }
2909
-
2910
- // get from(){
2911
- // return this.props.value===undefined?'state':'props'
2912
- // }
2913
-
2914
- // get isDirty(){
2915
- // return this.state?.isDirty
2916
- // }
2917
- // set isDirty(isDirty){
2918
- // this.setState({isDirty})
2919
- // }
2920
- // get rawValue(){
2921
- // return this.state?.rawValue
2922
- // }
2923
- // setRawValue(rawValue){
2924
- // this.setState({rawValue:JSON.parse(JSON.stringify(rawValue??''))})
2925
- // }
2926
- // reset(){
2927
- // this.setValue(this.rawValue,true)
2928
- // }
2929
- // setValue(value,reset=false){
2930
- // if(this.props.onChange){
2931
- // this.props.onChange(value)
2932
- // }else{
2933
- // this.setState({value})
2934
- // }
2935
-
2936
- // if(reset){
2937
- // this.setRawValue(value)
2938
- // }
2939
- // this.isDirty=!reset
2940
- // }
2941
- // setRes(isSuccess,response,config){
2942
- // if (isSuccess && config.updateValue) {
2943
- // const value=config.formatValue?.bind(this)(response.data)??response.data
2944
- // response.data=value
2945
- // this.setValue(value,true)
2946
- // } else if(config.updateValue){
2947
- // this.setValue(null,true)
2948
- // }
2949
- // }
2950
- // #getValueByName(fullnamList,record){
2951
- // const name=fullnamList.shift()
2952
- // if(fullnamList.length==0){
2953
- // return record?.[name]
2954
- // }else if(record?.[name]!=null){
2955
- // return this.#getValueByName(fullnamList,record[name])
2956
- // }
2957
- // }
2958
-
2959
- // getValue(fullname){
2960
- // if(fullname){
2961
- // const fullnamList=fullname.split('.')
2962
- // return this.#getValueByName(fullnamList,this[this.from]?.value)
2963
- // }else{
2964
- // return flexType(this[this.from]?.value,this,null,null)
2965
- // }
2966
- // }
2967
-
2968
- // getSubmitValue(){
2969
- // return this.getValue()
2970
- // }
2971
-
2972
- // getAxiosParams({url,method,value,extraValue,sendValue,transformValue,...params}){
2973
- // const _extraValue=extraValue?.bind?.(this)() ?? extraValue
2974
- // // let payload=typeof value === 'function'
2975
- // // ?value.bind(this)({
2976
- // // ...this.getSubmitValue()
2977
- // // ,..._extraValue
2978
- // // })
2979
- // // :value==null
2980
- // // ?{
2981
- // // ...this.getSubmitValue()
2982
- // // ,..._extraValue
2983
- // // }
2984
- // // :{
2985
- // // ...value
2986
- // // ,..._extraValue
2987
- // // }
2988
- // let payload=value?.bind?.(this)({
2989
- // ...this.getSubmitValue()
2990
- // ,..._extraValue
2991
- // })
2992
- // ?? value==null
2993
- // ?{
2994
- // ...this.getSubmitValue()
2995
- // ,..._extraValue
2996
- // }
2997
- // :{
2998
- // ...value
2999
- // ,..._extraValue
3000
- // }
3001
-
3002
- // if(transformValue){
3003
- // payload=transformValue.bind(this)(payload)
3004
- // }
3005
- // const headers={
3006
- // authorization: `Bearer ${localStorage.getItem("accessToken")}`
3007
- // }
3008
- // let params1={}
3009
- // const params2={}
3010
- // if(method=='get'){
3011
- // if(sendValue==null || sendValue)params1.params=payload
3012
- // params1.headers=headers
3013
- // }else if(method=='delete'){
3014
- // if(sendValue==null || sendValue)params1.data=payload
3015
- // params1.headers=headers
3016
- // }else{
3017
- // if(sendValue==null || sendValue){
3018
- // params1=payload
3019
- // }else{
3020
- // params1=null
3021
- // }
3022
- // params2.headers=headers
3023
- // }
3024
- // return {
3025
- // url:colonValueString(url,payload)
3026
- // ,method
3027
- // ,params1
3028
- // ,params2
3029
- // ,payload
3030
- // }
3031
- // }
3032
-
3033
- // reload(){
3034
- // po('reload 還沒有做 ')
3035
- // }
3036
-
3037
- // submit(config){
3038
- // const me=this
3039
- // // displaySpinner({mask:config.mask})++++++++++++++
3040
- // this.setState({loading:true})
3041
- // let _payload
3042
- // ;(()=>{
3043
- // if (Array.isArray(config.url)) {
3044
- // _payload=[]
3045
- // return Promise.allSettled(
3046
- // config.url.map((_url) => {
3047
- // const urlParams=typeof _url === 'object'
3048
- // ?_url
3049
- // :{url: _url}
3050
- // const finalConfig=Object.assign(config,urlParams)
3051
- // const {url,method,params1,params2,payload}=this.getAxiosParams(finalConfig)
3052
- // _payload.push(payload)
3053
- // return axiosSubmit[method](url,params1,params2)
3054
- // })
3055
- // )
3056
- // }else{
3057
- // const {url,method,params1,params2,payload}=this.getAxiosParams(config)
3058
- // _payload=payload
3059
- // return axiosSubmit[method](url,params1,params2)
3060
- // }
3061
- // })()
3062
- // .then((res)=>{
3063
- // this.handleResponse(res,_payload,config)
3064
- // })
3065
- // .catch((res)=>{
3066
- // this.handleResponse(res,_payload,config)
3067
- // })
3068
- // .finally(function (a,b,c) {
3069
- // me.setState({loading:false})
3070
- // // displaySpinner({mask:false})+++++++++++++++++++++++
3071
- // })
3072
- // }
3073
-
3074
- // handleResponse=(response,payload,config)=>{
3075
- // if(Array.isArray(response)){
3076
- // response=response.map((re,index)=>{
3077
- // if(re.value){
3078
- // re.value.payload=payload[index]
3079
- // }else if(re.reason){
3080
- // re.reason.payload=payload[index]
3081
- // }
3082
- // return re
3083
- // })
3084
- // }else{
3085
- // response.payload=payload
3086
- // }
3087
-
3088
- // response = config?.response?.bind(this)(response,payload) ?? response
3089
- // const isSuccess = response.status >= 200 && response.status <= 299
3090
-
3091
- // this.setRes(isSuccess,response,config)
3092
- // if (isSuccess) {
3093
- // if (config.successMessage) {
3094
- // // msg.success({ message:config.successMessage });+++++++++++++++++++++
3095
- // }
3096
- // } else {
3097
- // if (config.failedMessage) {
3098
- // // msg.error({ message:config.failedMessage });+++++++++++++++++++++++
3099
- // }
3100
- // }
3101
- // config.callback?.bind(this)(isSuccess,response,payload)
3102
- // }
3103
-
3104
- // renderer(){
3105
- // return
3106
- // }
3107
-
3108
- // render() {
3109
- // return this.props.cover!=null && this.state?.lodaing
3110
- // ?<Cover>{flexType(this.props.cover,this,null,null)}</Cover>
3111
- // :this.renderer()
3112
- // }
3113
- // }
3114
-
3115
2820
  function JRTest() {
3116
2821
  return 'I am JRTest string';
3117
2822
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jrs-react",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.es.js",
@@ -1,302 +1,7 @@
1
1
  import React from 'react'
2
- // import axios from 'axios'
3
- // import { colonValueString, flexType, po } from './JRUtils'
4
- // import { displaySpinner } from '../jrx/LoadingBar'
5
- // import msg from '../jrx/IMessage'
6
- // import styled from 'styled-components'
7
-
8
-
9
- // const axiosSubmit = axios.create({
10
- // authorization: `Bearer ${localStorage.getItem("accessToken")}`
11
- // ,timeout: 120000
12
- // ,maxBodyLength: 104857600 //100mb 104857600
13
- // ,maxContentLength: 104857600 //100mb
14
- // })
15
-
16
- // const StyledCover=styled.div`
17
- // border:2px solid red;
18
- // `
19
- // const Cover=({children})=>{
20
- // return <StyledCover>{children}</StyledCover>
21
- // }
22
2
 
23
3
  export default class JRSubmit extends React.Component {
24
- render() {
4
+ render(){
25
5
  return <div>JRSubmit</div>
26
6
  }
27
- }
28
-
29
- // export default class JRSubmit extends React.Component {
30
- // #methods = ['get', 'post', 'put','patch','delete','download']
31
-
32
- // constructor(props) {
33
- // super(props)
34
- // if(this.props.value===undefined && this.props.initValue!==undefined ){
35
- // if(this.props.onChange===undefined){
36
- // this.state={
37
- // value:props.initValue
38
- // ,rawValue:JSON.parse(JSON.stringify(props.initValue))
39
- // }
40
- // }
41
- // }
42
- // }
43
- // componentDidMount() {
44
- // this.#methods
45
- // .filter((method) => this[method] && this.props[method] && this.props[method].autoRun)
46
- // .forEach((method) => {
47
- // this[method]()
48
- // })
49
- // }
50
- // get(_config = {}) {
51
- // const config = Object.assign(
52
- // {
53
- // method:'get'
54
- // ,updateValue:true
55
- // // ,updateRawValue:true
56
- // }
57
- // ,this.props['get']
58
- // ,_config
59
- // )
60
- // this.submit(config)
61
- // }
62
-
63
- // post(config = {}) {
64
- // config = Object.assign(
65
- // {
66
- // method:'post'
67
- // ,updateValue:false
68
- // }
69
- // ,this.props['post']
70
- // ,config
71
- // )
72
- // this.submit(config)
73
- // }
74
-
75
- // put(config = {}) {
76
- // config = Object.assign(
77
- // {
78
- // method:'put'
79
- // ,updateValue:false
80
- // }
81
- // ,this.props['put']
82
- // ,config
83
- // )
84
- // this.submit(config)
85
- // }
86
-
87
- // delete(config = {}) {
88
- // config = Object.assign(
89
- // {
90
- // method:'delete'
91
- // ,updateValue:false
92
- // }
93
- // ,this.props['delete']
94
- // ,config
95
- // )
96
- // this.submit(config)
97
- // }
98
-
99
- // get from(){
100
- // return this.props.value===undefined?'state':'props'
101
- // }
102
-
103
- // get isDirty(){
104
- // return this.state?.isDirty
105
- // }
106
- // set isDirty(isDirty){
107
- // this.setState({isDirty})
108
- // }
109
- // get rawValue(){
110
- // return this.state?.rawValue
111
- // }
112
- // setRawValue(rawValue){
113
- // this.setState({rawValue:JSON.parse(JSON.stringify(rawValue??''))})
114
- // }
115
- // reset(){
116
- // this.setValue(this.rawValue,true)
117
- // }
118
- // setValue(value,reset=false){
119
- // if(this.props.onChange){
120
- // this.props.onChange(value)
121
- // }else{
122
- // this.setState({value})
123
- // }
124
-
125
- // if(reset){
126
- // this.setRawValue(value)
127
- // }
128
- // this.isDirty=!reset
129
- // }
130
- // setRes(isSuccess,response,config){
131
- // if (isSuccess && config.updateValue) {
132
- // const value=config.formatValue?.bind(this)(response.data)??response.data
133
- // response.data=value
134
- // this.setValue(value,true)
135
- // } else if(config.updateValue){
136
- // this.setValue(null,true)
137
- // }
138
- // }
139
- // #getValueByName(fullnamList,record){
140
- // const name=fullnamList.shift()
141
- // if(fullnamList.length==0){
142
- // return record?.[name]
143
- // }else if(record?.[name]!=null){
144
- // return this.#getValueByName(fullnamList,record[name])
145
- // }
146
- // }
147
-
148
- // getValue(fullname){
149
- // if(fullname){
150
- // const fullnamList=fullname.split('.')
151
- // return this.#getValueByName(fullnamList,this[this.from]?.value)
152
- // }else{
153
- // return flexType(this[this.from]?.value,this,null,null)
154
- // }
155
- // }
156
-
157
- // getSubmitValue(){
158
- // return this.getValue()
159
- // }
160
-
161
- // getAxiosParams({url,method,value,extraValue,sendValue,transformValue,...params}){
162
- // const _extraValue=extraValue?.bind?.(this)() ?? extraValue
163
- // // let payload=typeof value === 'function'
164
- // // ?value.bind(this)({
165
- // // ...this.getSubmitValue()
166
- // // ,..._extraValue
167
- // // })
168
- // // :value==null
169
- // // ?{
170
- // // ...this.getSubmitValue()
171
- // // ,..._extraValue
172
- // // }
173
- // // :{
174
- // // ...value
175
- // // ,..._extraValue
176
- // // }
177
- // let payload=value?.bind?.(this)({
178
- // ...this.getSubmitValue()
179
- // ,..._extraValue
180
- // })
181
- // ?? value==null
182
- // ?{
183
- // ...this.getSubmitValue()
184
- // ,..._extraValue
185
- // }
186
- // :{
187
- // ...value
188
- // ,..._extraValue
189
- // }
190
-
191
- // if(transformValue){
192
- // payload=transformValue.bind(this)(payload)
193
- // }
194
- // const headers={
195
- // authorization: `Bearer ${localStorage.getItem("accessToken")}`
196
- // }
197
- // let params1={}
198
- // const params2={}
199
- // if(method=='get'){
200
- // if(sendValue==null || sendValue)params1.params=payload
201
- // params1.headers=headers
202
- // }else if(method=='delete'){
203
- // if(sendValue==null || sendValue)params1.data=payload
204
- // params1.headers=headers
205
- // }else{
206
- // if(sendValue==null || sendValue){
207
- // params1=payload
208
- // }else{
209
- // params1=null
210
- // }
211
- // params2.headers=headers
212
- // }
213
- // return {
214
- // url:colonValueString(url,payload)
215
- // ,method
216
- // ,params1
217
- // ,params2
218
- // ,payload
219
- // }
220
- // }
221
-
222
- // reload(){
223
- // po('reload 還沒有做 ')
224
- // }
225
-
226
- // submit(config){
227
- // const me=this
228
- // // displaySpinner({mask:config.mask})++++++++++++++
229
- // this.setState({loading:true})
230
- // let _payload
231
- // ;(()=>{
232
- // if (Array.isArray(config.url)) {
233
- // _payload=[]
234
- // return Promise.allSettled(
235
- // config.url.map((_url) => {
236
- // const urlParams=typeof _url === 'object'
237
- // ?_url
238
- // :{url: _url}
239
- // const finalConfig=Object.assign(config,urlParams)
240
- // const {url,method,params1,params2,payload}=this.getAxiosParams(finalConfig)
241
- // _payload.push(payload)
242
- // return axiosSubmit[method](url,params1,params2)
243
- // })
244
- // )
245
- // }else{
246
- // const {url,method,params1,params2,payload}=this.getAxiosParams(config)
247
- // _payload=payload
248
- // return axiosSubmit[method](url,params1,params2)
249
- // }
250
- // })()
251
- // .then((res)=>{
252
- // this.handleResponse(res,_payload,config)
253
- // })
254
- // .catch((res)=>{
255
- // this.handleResponse(res,_payload,config)
256
- // })
257
- // .finally(function (a,b,c) {
258
- // me.setState({loading:false})
259
- // // displaySpinner({mask:false})+++++++++++++++++++++++
260
- // })
261
- // }
262
-
263
- // handleResponse=(response,payload,config)=>{
264
- // if(Array.isArray(response)){
265
- // response=response.map((re,index)=>{
266
- // if(re.value){
267
- // re.value.payload=payload[index]
268
- // }else if(re.reason){
269
- // re.reason.payload=payload[index]
270
- // }
271
- // return re
272
- // })
273
- // }else{
274
- // response.payload=payload
275
- // }
276
-
277
- // response = config?.response?.bind(this)(response,payload) ?? response
278
- // const isSuccess = response.status >= 200 && response.status <= 299
279
-
280
- // this.setRes(isSuccess,response,config)
281
- // if (isSuccess) {
282
- // if (config.successMessage) {
283
- // // msg.success({ message:config.successMessage });+++++++++++++++++++++
284
- // }
285
- // } else {
286
- // if (config.failedMessage) {
287
- // // msg.error({ message:config.failedMessage });+++++++++++++++++++++++
288
- // }
289
- // }
290
- // config.callback?.bind(this)(isSuccess,response,payload)
291
- // }
292
-
293
- // renderer(){
294
- // return
295
- // }
296
-
297
- // render() {
298
- // return this.props.cover!=null && this.state?.lodaing
299
- // ?<Cover>{flexType(this.props.cover,this,null,null)}</Cover>
300
- // :this.renderer()
301
- // }
302
- // }
7
+ }