@iankibetsh/shframework 0.1.9 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/library.js +345 -271
  2. package/dist/library.mjs +345 -271
  3. package/package.json +1 -1
package/dist/library.mjs CHANGED
@@ -1644,7 +1644,7 @@ var script$5 = {
1644
1644
  components: {
1645
1645
  ShPhone: script$6
1646
1646
  },
1647
- props: ['action', 'classes', 'hasTerms', 'country_code', 'submit_btn_class', 'fields', 'columns', 'placeholders', 'field_permissions', 'retain_data_after_submission', 'current_data', 'action_label', 'fill_selects', 'phones', 'success_callback', 'failed_callback', 'labels'],
1647
+ props: ['action', 'classes', 'hasTerms', 'country_code', 'submit_btn_class', 'fields', 'columns', 'placeholders', 'field_permissions', 'retain_data_after_submission', 'current_data', 'action_label', 'fill_selects', 'phones', 'successCallback', 'failed_callback', 'labels'],
1648
1648
  data: function () {
1649
1649
  return {
1650
1650
  form_elements: {},
@@ -1813,11 +1813,11 @@ var script$5 = {
1813
1813
  Object.keys(this.form_files).forEach(key => {
1814
1814
  this.form_errors[key] = null;
1815
1815
  });
1816
- if (this.success_callback) {
1817
- if (typeof this.success_callback === 'function') {
1818
- this.success_callback(res.data);
1816
+ if (this.successCallback) {
1817
+ if (typeof this.successCallback === 'function') {
1818
+ this.successCallback(res.data);
1819
1819
  } else {
1820
- this.$emit(this.success_callback, res.data);
1820
+ this.$emit(this.successCallback, res.data);
1821
1821
  }
1822
1822
  }
1823
1823
  NProgress.done();
@@ -2813,11 +2813,14 @@ var script$1 = {
2813
2813
  windowWidth: function () {
2814
2814
  return window.innerWidth
2815
2815
  },
2816
+ user () {
2817
+ return null
2818
+ },
2816
2819
  hasDefaultSlot () {
2817
2820
  return !!this.$slots.default
2818
2821
  },
2819
- user () {
2820
- return this.global.state.user
2822
+ hasRecordsSlot () {
2823
+ return !!this.$slots.records
2821
2824
  }
2822
2825
  }
2823
2826
  };
@@ -2847,22 +2850,58 @@ const _hoisted_12 = /*#__PURE__*/createElementVNode("span", { class: "sh-search-
2847
2850
  /*#__PURE__*/createElementVNode("i", { class: "bi bi-search mb-0" })
2848
2851
  ], -1 /* HOISTED */);
2849
2852
  const _hoisted_13 = {
2850
- key: 2,
2853
+ key: 0,
2854
+ class: "text-center"
2855
+ };
2856
+ const _hoisted_14 = /*#__PURE__*/createElementVNode("div", {
2857
+ class: "spinner-border",
2858
+ role: "status"
2859
+ }, [
2860
+ /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
2861
+ ], -1 /* HOISTED */);
2862
+ const _hoisted_15 = [
2863
+ _hoisted_14
2864
+ ];
2865
+ const _hoisted_16 = {
2866
+ key: 1,
2867
+ class: "alert alert-danger"
2868
+ };
2869
+ const _hoisted_17 = { colspan: 2 };
2870
+ const _hoisted_18 = {
2871
+ key: 0,
2872
+ class: "text-center"
2873
+ };
2874
+ const _hoisted_19 = /*#__PURE__*/createElementVNode("div", {
2875
+ class: "spinner-border",
2876
+ role: "status"
2877
+ }, [
2878
+ /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
2879
+ ], -1 /* HOISTED */);
2880
+ const _hoisted_20 = [
2881
+ _hoisted_19
2882
+ ];
2883
+ const _hoisted_21 = {
2884
+ key: 1,
2885
+ class: "alert alert-danger"
2886
+ };
2887
+ const _hoisted_22 = { colspan: 2 };
2888
+ const _hoisted_23 = {
2889
+ key: 4,
2851
2890
  class: "table"
2852
2891
  };
2853
- const _hoisted_14 = ["onClick"];
2854
- const _hoisted_15 = ["onClick"];
2855
- const _hoisted_16 = ["onClick"];
2856
- const _hoisted_17 = {
2892
+ const _hoisted_24 = ["onClick"];
2893
+ const _hoisted_25 = ["onClick"];
2894
+ const _hoisted_26 = ["onClick"];
2895
+ const _hoisted_27 = {
2857
2896
  key: 0,
2858
2897
  class: "text-capitalize"
2859
2898
  };
2860
- const _hoisted_18 = {
2899
+ const _hoisted_28 = {
2861
2900
  key: 0,
2862
2901
  class: "text-center"
2863
2902
  };
2864
- const _hoisted_19 = ["colspan"];
2865
- const _hoisted_20 = /*#__PURE__*/createElementVNode("div", { class: "text-center" }, [
2903
+ const _hoisted_29 = ["colspan"];
2904
+ const _hoisted_30 = /*#__PURE__*/createElementVNode("div", { class: "text-center" }, [
2866
2905
  /*#__PURE__*/createElementVNode("div", {
2867
2906
  class: "spinner-border",
2868
2907
  role: "status"
@@ -2870,46 +2909,46 @@ const _hoisted_20 = /*#__PURE__*/createElementVNode("div", { class: "text-center
2870
2909
  /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
2871
2910
  ])
2872
2911
  ], -1 /* HOISTED */);
2873
- const _hoisted_21 = [
2874
- _hoisted_20
2912
+ const _hoisted_31 = [
2913
+ _hoisted_30
2875
2914
  ];
2876
- const _hoisted_22 = {
2915
+ const _hoisted_32 = {
2877
2916
  key: 1,
2878
2917
  class: "text-center alert alert-danger"
2879
2918
  };
2880
- const _hoisted_23 = ["colspan"];
2881
- const _hoisted_24 = {
2919
+ const _hoisted_33 = ["colspan"];
2920
+ const _hoisted_34 = {
2882
2921
  key: 2,
2883
2922
  class: "text-center alert alert-info no_records"
2884
2923
  };
2885
- const _hoisted_25 = ["colspan"];
2886
- const _hoisted_26 = /*#__PURE__*/createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* HOISTED */);
2887
- const _hoisted_27 = /*#__PURE__*/createTextVNode(" No records found ");
2888
- const _hoisted_28 = [
2889
- _hoisted_26,
2890
- _hoisted_27
2924
+ const _hoisted_35 = ["colspan"];
2925
+ const _hoisted_36 = /*#__PURE__*/createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* HOISTED */);
2926
+ const _hoisted_37 = /*#__PURE__*/createTextVNode(" No records found ");
2927
+ const _hoisted_38 = [
2928
+ _hoisted_36,
2929
+ _hoisted_37
2891
2930
  ];
2892
- const _hoisted_29 = ["onClick"];
2893
- const _hoisted_30 = { key: 1 };
2894
- const _hoisted_31 = {
2931
+ const _hoisted_39 = ["onClick"];
2932
+ const _hoisted_40 = { key: 1 };
2933
+ const _hoisted_41 = {
2895
2934
  key: 2,
2896
2935
  class: "text-success fw-bold"
2897
2936
  };
2898
- const _hoisted_32 = { key: 3 };
2899
- const _hoisted_33 = ["innerHTML"];
2900
- const _hoisted_34 = ["innerHTML"];
2901
- const _hoisted_35 = ["innerHTML"];
2902
- const _hoisted_36 = {
2937
+ const _hoisted_42 = { key: 3 };
2938
+ const _hoisted_43 = ["innerHTML"];
2939
+ const _hoisted_44 = ["innerHTML"];
2940
+ const _hoisted_45 = ["innerHTML"];
2941
+ const _hoisted_46 = {
2903
2942
  key: 0,
2904
2943
  style: {"white-space":"nowrap"}
2905
2944
  };
2906
- const _hoisted_37 = ["title", "onClick"];
2907
- const _hoisted_38 = { key: 3 };
2908
- const _hoisted_39 = {
2945
+ const _hoisted_47 = ["title", "onClick"];
2946
+ const _hoisted_48 = { key: 5 };
2947
+ const _hoisted_49 = {
2909
2948
  key: 0,
2910
2949
  class: "text-center"
2911
2950
  };
2912
- const _hoisted_40 = /*#__PURE__*/createElementVNode("div", { class: "text-center" }, [
2951
+ const _hoisted_50 = /*#__PURE__*/createElementVNode("div", { class: "text-center" }, [
2913
2952
  /*#__PURE__*/createElementVNode("div", {
2914
2953
  class: "spinner-border",
2915
2954
  role: "status"
@@ -2917,38 +2956,38 @@ const _hoisted_40 = /*#__PURE__*/createElementVNode("div", { class: "text-center
2917
2956
  /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
2918
2957
  ])
2919
2958
  ], -1 /* HOISTED */);
2920
- const _hoisted_41 = [
2921
- _hoisted_40
2959
+ const _hoisted_51 = [
2960
+ _hoisted_50
2922
2961
  ];
2923
- const _hoisted_42 = { key: 1 };
2924
- const _hoisted_43 = {
2962
+ const _hoisted_52 = { key: 1 };
2963
+ const _hoisted_53 = {
2925
2964
  key: 2,
2926
2965
  class: "mobile-list-items"
2927
2966
  };
2928
- const _hoisted_44 = ["onClick"];
2929
- const _hoisted_45 = {
2967
+ const _hoisted_54 = ["onClick"];
2968
+ const _hoisted_55 = {
2930
2969
  key: 0,
2931
2970
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
2932
2971
  };
2933
- const _hoisted_46 = {
2972
+ const _hoisted_56 = {
2934
2973
  key: 1,
2935
2974
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
2936
2975
  };
2937
- const _hoisted_47 = {
2976
+ const _hoisted_57 = {
2938
2977
  key: 2,
2939
2978
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
2940
2979
  };
2941
- const _hoisted_48 = { key: 1 };
2942
- const _hoisted_49 = {
2980
+ const _hoisted_58 = { key: 1 };
2981
+ const _hoisted_59 = {
2943
2982
  key: 2,
2944
2983
  class: "text-primary fw-bold"
2945
2984
  };
2946
- const _hoisted_50 = ["innerHTML"];
2947
- const _hoisted_51 = ["innerHTML"];
2948
- const _hoisted_52 = ["innerHTML"];
2949
- const _hoisted_53 = /*#__PURE__*/createElementVNode("hr", { class: "my-2" }, null, -1 /* HOISTED */);
2950
- const _hoisted_54 = { key: 0 };
2951
- const _hoisted_55 = ["title", "onClick"];
2985
+ const _hoisted_60 = ["innerHTML"];
2986
+ const _hoisted_61 = ["innerHTML"];
2987
+ const _hoisted_62 = ["innerHTML"];
2988
+ const _hoisted_63 = /*#__PURE__*/createElementVNode("hr", { class: "my-2" }, null, -1 /* HOISTED */);
2989
+ const _hoisted_64 = { key: 0 };
2990
+ const _hoisted_65 = ["title", "onClick"];
2952
2991
 
2953
2992
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
2954
2993
  const _component_router_link = resolveComponent("router-link");
@@ -2992,169 +3031,103 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
2992
3031
  ])
2993
3032
  ]))
2994
3033
  : createCommentVNode("v-if", true),
2995
- ($options.windowWidth > 700)
2996
- ? (openBlock(), createElementBlock("table", _hoisted_13, [
2997
- createElementVNode("thead", null, [
2998
- createElementVNode("tr", null, [
2999
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (title) => {
3000
- return (openBlock(), createElementBlock("th", {
3001
- key: title[0]
3002
- }, [
3003
- (typeof title === 'string')
3004
- ? (openBlock(), createElementBlock("a", {
3005
- key: 0,
3006
- class: "text-capitalize",
3007
- onClick: $event => ($options.changeKey('order_by',title))
3008
- }, toDisplayString(title.replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_14))
3009
- : (typeof title === 'function')
3034
+ ($options.hasDefaultSlot)
3035
+ ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
3036
+ ($data.loading === 'loading')
3037
+ ? (openBlock(), createElementBlock("div", _hoisted_13, _hoisted_15))
3038
+ : ($data.loading === 'error')
3039
+ ? (openBlock(), createElementBlock("div", _hoisted_16, [
3040
+ createElementVNode("span", _hoisted_17, toDisplayString($data.loading_error), 1 /* TEXT */)
3041
+ ]))
3042
+ : createCommentVNode("v-if", true),
3043
+ ($data.loading === 'done')
3044
+ ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList($data.records, (record) => {
3045
+ return renderSlot(_ctx.$slots, "default", {
3046
+ key: record.id,
3047
+ record: record
3048
+ })
3049
+ }), 128 /* KEYED_FRAGMENT */))
3050
+ : createCommentVNode("v-if", true)
3051
+ ], 64 /* STABLE_FRAGMENT */))
3052
+ : createCommentVNode("v-if", true),
3053
+ ($options.hasRecordsSlot)
3054
+ ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
3055
+ ($data.loading === 'loading')
3056
+ ? (openBlock(), createElementBlock("div", _hoisted_18, _hoisted_20))
3057
+ : ($data.loading === 'error')
3058
+ ? (openBlock(), createElementBlock("div", _hoisted_21, [
3059
+ createElementVNode("span", _hoisted_22, toDisplayString($data.loading_error), 1 /* TEXT */)
3060
+ ]))
3061
+ : createCommentVNode("v-if", true),
3062
+ ($data.loading === 'done')
3063
+ ? renderSlot(_ctx.$slots, "records", {
3064
+ key: 2,
3065
+ records: $data.records
3066
+ })
3067
+ : createCommentVNode("v-if", true)
3068
+ ], 64 /* STABLE_FRAGMENT */))
3069
+ : ($options.windowWidth > 700)
3070
+ ? (openBlock(), createElementBlock("table", _hoisted_23, [
3071
+ createElementVNode("thead", null, [
3072
+ createElementVNode("tr", null, [
3073
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (title) => {
3074
+ return (openBlock(), createElementBlock("th", {
3075
+ key: title[0]
3076
+ }, [
3077
+ (typeof title === 'string')
3010
3078
  ? (openBlock(), createElementBlock("a", {
3011
- key: 1,
3079
+ key: 0,
3012
3080
  class: "text-capitalize",
3013
3081
  onClick: $event => ($options.changeKey('order_by',title))
3014
- }, toDisplayString(title(null).replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_15))
3015
- : (openBlock(), createElementBlock("a", {
3016
- key: 2,
3017
- class: "text-capitalize",
3018
- onClick: $event => ($options.changeKey('order_by',title[0]))
3019
- }, toDisplayString(title[1].replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_16))
3020
- ]))
3021
- }), 128 /* KEYED_FRAGMENT */)),
3022
- ($props.actions)
3023
- ? (openBlock(), createElementBlock("th", _hoisted_17, toDisplayString($props.actions.label), 1 /* TEXT */))
3024
- : createCommentVNode("v-if", true)
3025
- ])
3026
- ]),
3027
- createElementVNode("tbody", null, [
3028
- ($data.loading === 'loading')
3029
- ? (openBlock(), createElementBlock("tr", _hoisted_18, [
3030
- createElementVNode("td", {
3031
- colspan: $props.headers.length
3032
- }, _hoisted_21, 8 /* PROPS */, _hoisted_19)
3033
- ]))
3034
- : ($data.loading === 'error')
3035
- ? (openBlock(), createElementBlock("tr", _hoisted_22, [
3082
+ }, toDisplayString(title.replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_24))
3083
+ : (typeof title === 'function')
3084
+ ? (openBlock(), createElementBlock("a", {
3085
+ key: 1,
3086
+ class: "text-capitalize",
3087
+ onClick: $event => ($options.changeKey('order_by',title))
3088
+ }, toDisplayString(title(null).replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_25))
3089
+ : (openBlock(), createElementBlock("a", {
3090
+ key: 2,
3091
+ class: "text-capitalize",
3092
+ onClick: $event => ($options.changeKey('order_by',title[0]))
3093
+ }, toDisplayString(title[1].replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_26))
3094
+ ]))
3095
+ }), 128 /* KEYED_FRAGMENT */)),
3096
+ ($props.actions)
3097
+ ? (openBlock(), createElementBlock("th", _hoisted_27, toDisplayString($props.actions.label), 1 /* TEXT */))
3098
+ : createCommentVNode("v-if", true)
3099
+ ])
3100
+ ]),
3101
+ createElementVNode("tbody", null, [
3102
+ ($data.loading === 'loading')
3103
+ ? (openBlock(), createElementBlock("tr", _hoisted_28, [
3036
3104
  createElementVNode("td", {
3037
3105
  colspan: $props.headers.length
3038
- }, toDisplayString($data.loading_error), 9 /* TEXT, PROPS */, _hoisted_23)
3106
+ }, _hoisted_31, 8 /* PROPS */, _hoisted_29)
3039
3107
  ]))
3040
- : ($data.records.length === 0)
3041
- ? (openBlock(), createElementBlock("tr", _hoisted_24, [
3108
+ : ($data.loading === 'error')
3109
+ ? (openBlock(), createElementBlock("tr", _hoisted_32, [
3042
3110
  createElementVNode("td", {
3043
- colspan: $props.actions ? $props.headers.length + 1 : $props.headers.length
3044
- }, _hoisted_28, 8 /* PROPS */, _hoisted_25)
3111
+ colspan: $props.headers.length
3112
+ }, toDisplayString($data.loading_error), 9 /* TEXT, PROPS */, _hoisted_33)
3045
3113
  ]))
3046
- : ($data.loading === 'done')
3047
- ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList($data.records, (record, index) => {
3048
- return (openBlock(), createElementBlock("tr", {
3049
- key: record.id,
3050
- class: normalizeClass(record.class),
3051
- onClick: $event => ($options.rowSelected(record))
3052
- }, [
3053
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (key) => {
3054
- return (openBlock(), createElementBlock("td", {
3055
- key: key[0]
3056
- }, [
3057
- (typeof key === 'string' && $props.links && $props.links[key])
3058
- ? (openBlock(), createBlock(_component_router_link, {
3059
- key: 0,
3060
- to: $options.replaceLinkUrl($props.links[key],record),
3061
- class: normalizeClass($options.getLinkClass($props.links[key])),
3062
- innerHTML: record[key]
3063
- }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3064
- : ($options.getFieldType(key) === 'numeric')
3065
- ? (openBlock(), createElementBlock("span", _hoisted_30, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3066
- : ($options.getFieldType(key) === 'money')
3067
- ? (openBlock(), createElementBlock("span", _hoisted_31, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3068
- : ($options.getFieldType(key) === 'date')
3069
- ? (openBlock(), createElementBlock("span", _hoisted_32, toDisplayString($options.formatDate(record[key])), 1 /* TEXT */))
3070
- : (typeof key === 'string')
3071
- ? (openBlock(), createElementBlock("span", {
3072
- key: 4,
3073
- innerHTML: record[key]
3074
- }, null, 8 /* PROPS */, _hoisted_33))
3075
- : (typeof key === 'function')
3076
- ? (openBlock(), createElementBlock("span", {
3077
- key: 5,
3078
- innerHTML: key(record, index)
3079
- }, null, 8 /* PROPS */, _hoisted_34))
3080
- : (openBlock(), createElementBlock("span", {
3081
- key: 6,
3082
- innerHTML: record[key[0]]
3083
- }, null, 8 /* PROPS */, _hoisted_35))
3084
- ]))
3085
- }), 128 /* KEYED_FRAGMENT */)),
3086
- ($props.actions)
3087
- ? (openBlock(), createElementBlock("td", _hoisted_36, [
3088
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.actions.actions, (act) => {
3089
- return (openBlock(), createElementBlock(Fragment, {
3090
- key: act.path
3091
- }, [
3092
- (!act.permission || $options.user.isAllowedTo(act.permission))
3093
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3094
- (!act.validator || act.validator(record))
3095
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3096
- (act.emits)
3097
- ? (openBlock(), createElementBlock("button", {
3098
- key: 0,
3099
- title: act.title,
3100
- class: normalizeClass(act.class ? act.class:'btn btn-default'),
3101
- onClick: $event => ($options.doEmitAction(act.emits,record))
3102
- }, toDisplayString(act.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_37))
3103
- : createCommentVNode("v-if", true),
3104
- (!act.emits)
3105
- ? (openBlock(), createBlock(_component_router_link, {
3106
- key: 1,
3107
- title: act.title,
3108
- to: $options.replaceActionUrl(act.path,record),
3109
- class: normalizeClass(act.class)
3110
- }, {
3111
- default: withCtx(() => [
3112
- createTextVNode(toDisplayString(act.label), 1 /* TEXT */)
3113
- ]),
3114
- _: 2 /* DYNAMIC */
3115
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3116
- : createCommentVNode("v-if", true)
3117
- ], 64 /* STABLE_FRAGMENT */))
3118
- : createCommentVNode("v-if", true)
3119
- ], 64 /* STABLE_FRAGMENT */))
3120
- : createCommentVNode("v-if", true)
3121
- ], 64 /* STABLE_FRAGMENT */))
3122
- }), 128 /* KEYED_FRAGMENT */))
3123
- ]))
3124
- : createCommentVNode("v-if", true)
3125
- ], 10 /* CLASS, PROPS */, _hoisted_29))
3126
- }), 128 /* KEYED_FRAGMENT */))
3127
- : createCommentVNode("v-if", true)
3128
- ])
3129
- ]))
3130
- : (openBlock(), createElementBlock("div", _hoisted_38, [
3131
- ($data.loading === 'loading')
3132
- ? (openBlock(), createElementBlock("div", _hoisted_39, _hoisted_41))
3133
- : ($data.loading === 'error')
3134
- ? (openBlock(), createElementBlock("div", _hoisted_42, [
3135
- createElementVNode("span", null, toDisplayString($data.loading_error), 1 /* TEXT */)
3136
- ]))
3137
- : ($data.loading === 'done')
3138
- ? (openBlock(), createElementBlock("div", _hoisted_43, [
3139
- (openBlock(true), createElementBlock(Fragment, null, renderList($data.records, (record, index) => {
3140
- return (openBlock(), createElementBlock(Fragment, {
3141
- key: record.id
3142
- }, [
3143
- createElementVNode("h3", null, toDisplayString(_ctx.mobile_view), 1 /* TEXT */),
3144
- createElementVNode("div", {
3145
- class: "single-mobile-req bg-light p-3",
3146
- onClick: $event => ($options.rowSelected(record))
3147
- }, [
3148
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (key) => {
3149
- return (openBlock(), createElementBlock(Fragment, {
3150
- key: key[0]
3151
- }, [
3152
- (typeof key === 'string' )
3153
- ? (openBlock(), createElementBlock("p", _hoisted_45, toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
3154
- : (typeof key === 'function')
3155
- ? (openBlock(), createElementBlock("p", _hoisted_46, toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
3156
- : (openBlock(), createElementBlock("p", _hoisted_47, toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
3157
- createElementVNode("span", null, [
3114
+ : ($data.records.length === 0)
3115
+ ? (openBlock(), createElementBlock("tr", _hoisted_34, [
3116
+ createElementVNode("td", {
3117
+ colspan: $props.actions ? $props.headers.length + 1 : $props.headers.length
3118
+ }, _hoisted_38, 8 /* PROPS */, _hoisted_35)
3119
+ ]))
3120
+ : ($data.loading === 'done')
3121
+ ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList($data.records, (record, index) => {
3122
+ return (openBlock(), createElementBlock("tr", {
3123
+ key: record.id,
3124
+ class: normalizeClass(record.class),
3125
+ onClick: $event => ($options.rowSelected(record))
3126
+ }, [
3127
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (key) => {
3128
+ return (openBlock(), createElementBlock("td", {
3129
+ key: key[0]
3130
+ }, [
3158
3131
  (typeof key === 'string' && $props.links && $props.links[key])
3159
3132
  ? (openBlock(), createBlock(_component_router_link, {
3160
3133
  key: 0,
@@ -3163,75 +3136,176 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3163
3136
  innerHTML: record[key]
3164
3137
  }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3165
3138
  : ($options.getFieldType(key) === 'numeric')
3166
- ? (openBlock(), createElementBlock("span", _hoisted_48, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3139
+ ? (openBlock(), createElementBlock("span", _hoisted_40, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3167
3140
  : ($options.getFieldType(key) === 'money')
3168
- ? (openBlock(), createElementBlock("span", _hoisted_49, "KES " + toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3169
- : (typeof key === 'string')
3170
- ? (openBlock(), createElementBlock("span", {
3171
- key: 3,
3172
- innerHTML: record[key]
3173
- }, null, 8 /* PROPS */, _hoisted_50))
3174
- : (typeof key === 'function')
3141
+ ? (openBlock(), createElementBlock("span", _hoisted_41, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3142
+ : ($options.getFieldType(key) === 'date')
3143
+ ? (openBlock(), createElementBlock("span", _hoisted_42, toDisplayString($options.formatDate(record[key])), 1 /* TEXT */))
3144
+ : (typeof key === 'string')
3175
3145
  ? (openBlock(), createElementBlock("span", {
3176
3146
  key: 4,
3177
- innerHTML: key(record, index )
3178
- }, null, 8 /* PROPS */, _hoisted_51))
3179
- : (openBlock(), createElementBlock("span", {
3180
- key: 5,
3181
- innerHTML: record[key[0]]
3182
- }, null, 8 /* PROPS */, _hoisted_52))
3183
- ]),
3184
- _hoisted_53
3185
- ], 64 /* STABLE_FRAGMENT */))
3186
- }), 128 /* KEYED_FRAGMENT */)),
3187
- ($props.actions)
3188
- ? (openBlock(), createElementBlock("div", _hoisted_54, [
3189
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.actions.actions, (act) => {
3190
- return (openBlock(), createElementBlock(Fragment, {
3191
- key: act.path
3192
- }, [
3193
- (!act.permission || $options.user.isAllowedTo(act.permission))
3194
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3195
- (!act.validator || act.validator(record))
3196
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3197
- (act.emits)
3198
- ? (openBlock(), createElementBlock("button", {
3199
- key: 0,
3200
- title: act.title,
3201
- class: normalizeClass(act.class ? act.class:'btn btn-default'),
3202
- onClick: $event => ($options.doEmitAction(act.emits,record))
3203
- }, toDisplayString(act.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_55))
3204
- : createCommentVNode("v-if", true),
3205
- (!act.emits)
3206
- ? (openBlock(), createBlock(_component_router_link, {
3207
- key: 1,
3208
- title: act.title,
3209
- to: $options.replaceActionUrl(act.path,record),
3210
- class: normalizeClass(act.class)
3211
- }, {
3212
- default: withCtx(() => [
3213
- createTextVNode(toDisplayString(act.label), 1 /* TEXT */)
3214
- ]),
3215
- _: 2 /* DYNAMIC */
3216
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3217
- : createCommentVNode("v-if", true)
3218
- ], 64 /* STABLE_FRAGMENT */))
3219
- : createCommentVNode("v-if", true)
3220
- ], 64 /* STABLE_FRAGMENT */))
3221
- : createCommentVNode("v-if", true)
3222
- ], 64 /* STABLE_FRAGMENT */))
3223
- }), 128 /* KEYED_FRAGMENT */))
3147
+ innerHTML: record[key]
3148
+ }, null, 8 /* PROPS */, _hoisted_43))
3149
+ : (typeof key === 'function')
3150
+ ? (openBlock(), createElementBlock("span", {
3151
+ key: 5,
3152
+ innerHTML: key(record, index)
3153
+ }, null, 8 /* PROPS */, _hoisted_44))
3154
+ : (openBlock(), createElementBlock("span", {
3155
+ key: 6,
3156
+ innerHTML: record[key[0]]
3157
+ }, null, 8 /* PROPS */, _hoisted_45))
3224
3158
  ]))
3225
- : createCommentVNode("v-if", true)
3226
- ], 8 /* PROPS */, _hoisted_44)
3227
- ], 64 /* STABLE_FRAGMENT */))
3228
- }), 128 /* KEYED_FRAGMENT */))
3159
+ }), 128 /* KEYED_FRAGMENT */)),
3160
+ ($props.actions)
3161
+ ? (openBlock(), createElementBlock("td", _hoisted_46, [
3162
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.actions.actions, (act) => {
3163
+ return (openBlock(), createElementBlock(Fragment, {
3164
+ key: act.path
3165
+ }, [
3166
+ (!act.permission || $options.user.isAllowedTo(act.permission))
3167
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3168
+ (!act.validator || act.validator(record))
3169
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3170
+ (act.emits)
3171
+ ? (openBlock(), createElementBlock("button", {
3172
+ key: 0,
3173
+ title: act.title,
3174
+ class: normalizeClass(act.class ? act.class:'btn btn-default'),
3175
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3176
+ }, toDisplayString(act.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_47))
3177
+ : createCommentVNode("v-if", true),
3178
+ (!act.emits)
3179
+ ? (openBlock(), createBlock(_component_router_link, {
3180
+ key: 1,
3181
+ title: act.title,
3182
+ to: $options.replaceActionUrl(act.path,record),
3183
+ class: normalizeClass(act.class)
3184
+ }, {
3185
+ default: withCtx(() => [
3186
+ createTextVNode(toDisplayString(act.label), 1 /* TEXT */)
3187
+ ]),
3188
+ _: 2 /* DYNAMIC */
3189
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3190
+ : createCommentVNode("v-if", true)
3191
+ ], 64 /* STABLE_FRAGMENT */))
3192
+ : createCommentVNode("v-if", true)
3193
+ ], 64 /* STABLE_FRAGMENT */))
3194
+ : createCommentVNode("v-if", true)
3195
+ ], 64 /* STABLE_FRAGMENT */))
3196
+ }), 128 /* KEYED_FRAGMENT */))
3197
+ ]))
3198
+ : createCommentVNode("v-if", true)
3199
+ ], 10 /* CLASS, PROPS */, _hoisted_39))
3200
+ }), 128 /* KEYED_FRAGMENT */))
3201
+ : createCommentVNode("v-if", true)
3202
+ ])
3203
+ ]))
3204
+ : (openBlock(), createElementBlock("div", _hoisted_48, [
3205
+ ($data.loading === 'loading')
3206
+ ? (openBlock(), createElementBlock("div", _hoisted_49, _hoisted_51))
3207
+ : ($data.loading === 'error')
3208
+ ? (openBlock(), createElementBlock("div", _hoisted_52, [
3209
+ createElementVNode("span", null, toDisplayString($data.loading_error), 1 /* TEXT */)
3229
3210
  ]))
3230
- : createCommentVNode("v-if", true)
3231
- ])),
3211
+ : ($data.loading === 'done')
3212
+ ? (openBlock(), createElementBlock("div", _hoisted_53, [
3213
+ (openBlock(true), createElementBlock(Fragment, null, renderList($data.records, (record, index) => {
3214
+ return (openBlock(), createElementBlock(Fragment, {
3215
+ key: record.id
3216
+ }, [
3217
+ createElementVNode("h3", null, toDisplayString(_ctx.mobile_view), 1 /* TEXT */),
3218
+ createElementVNode("div", {
3219
+ class: "single-mobile-req bg-light p-3",
3220
+ onClick: $event => ($options.rowSelected(record))
3221
+ }, [
3222
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (key) => {
3223
+ return (openBlock(), createElementBlock(Fragment, {
3224
+ key: key[0]
3225
+ }, [
3226
+ (typeof key === 'string' )
3227
+ ? (openBlock(), createElementBlock("p", _hoisted_55, toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
3228
+ : (typeof key === 'function')
3229
+ ? (openBlock(), createElementBlock("p", _hoisted_56, toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
3230
+ : (openBlock(), createElementBlock("p", _hoisted_57, toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
3231
+ createElementVNode("span", null, [
3232
+ (typeof key === 'string' && $props.links && $props.links[key])
3233
+ ? (openBlock(), createBlock(_component_router_link, {
3234
+ key: 0,
3235
+ to: $options.replaceLinkUrl($props.links[key],record),
3236
+ class: normalizeClass($options.getLinkClass($props.links[key])),
3237
+ innerHTML: record[key]
3238
+ }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3239
+ : ($options.getFieldType(key) === 'numeric')
3240
+ ? (openBlock(), createElementBlock("span", _hoisted_58, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3241
+ : ($options.getFieldType(key) === 'money')
3242
+ ? (openBlock(), createElementBlock("span", _hoisted_59, "KES " + toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3243
+ : (typeof key === 'string')
3244
+ ? (openBlock(), createElementBlock("span", {
3245
+ key: 3,
3246
+ innerHTML: record[key]
3247
+ }, null, 8 /* PROPS */, _hoisted_60))
3248
+ : (typeof key === 'function')
3249
+ ? (openBlock(), createElementBlock("span", {
3250
+ key: 4,
3251
+ innerHTML: key(record, index )
3252
+ }, null, 8 /* PROPS */, _hoisted_61))
3253
+ : (openBlock(), createElementBlock("span", {
3254
+ key: 5,
3255
+ innerHTML: record[key[0]]
3256
+ }, null, 8 /* PROPS */, _hoisted_62))
3257
+ ]),
3258
+ _hoisted_63
3259
+ ], 64 /* STABLE_FRAGMENT */))
3260
+ }), 128 /* KEYED_FRAGMENT */)),
3261
+ ($props.actions)
3262
+ ? (openBlock(), createElementBlock("div", _hoisted_64, [
3263
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.actions.actions, (act) => {
3264
+ return (openBlock(), createElementBlock(Fragment, {
3265
+ key: act.path
3266
+ }, [
3267
+ (!act.permission || $options.user.isAllowedTo(act.permission))
3268
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3269
+ (!act.validator || act.validator(record))
3270
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3271
+ (act.emits)
3272
+ ? (openBlock(), createElementBlock("button", {
3273
+ key: 0,
3274
+ title: act.title,
3275
+ class: normalizeClass(act.class ? act.class:'btn btn-default'),
3276
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3277
+ }, toDisplayString(act.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_65))
3278
+ : createCommentVNode("v-if", true),
3279
+ (!act.emits)
3280
+ ? (openBlock(), createBlock(_component_router_link, {
3281
+ key: 1,
3282
+ title: act.title,
3283
+ to: $options.replaceActionUrl(act.path,record),
3284
+ class: normalizeClass(act.class)
3285
+ }, {
3286
+ default: withCtx(() => [
3287
+ createTextVNode(toDisplayString(act.label), 1 /* TEXT */)
3288
+ ]),
3289
+ _: 2 /* DYNAMIC */
3290
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3291
+ : createCommentVNode("v-if", true)
3292
+ ], 64 /* STABLE_FRAGMENT */))
3293
+ : createCommentVNode("v-if", true)
3294
+ ], 64 /* STABLE_FRAGMENT */))
3295
+ : createCommentVNode("v-if", true)
3296
+ ], 64 /* STABLE_FRAGMENT */))
3297
+ }), 128 /* KEYED_FRAGMENT */))
3298
+ ]))
3299
+ : createCommentVNode("v-if", true)
3300
+ ], 8 /* PROPS */, _hoisted_54)
3301
+ ], 64 /* STABLE_FRAGMENT */))
3302
+ }), 128 /* KEYED_FRAGMENT */))
3303
+ ]))
3304
+ : createCommentVNode("v-if", true)
3305
+ ])),
3232
3306
  ($data.pagination_data)
3233
3307
  ? (openBlock(), createBlock(_component_pagination, {
3234
- key: 4,
3308
+ key: 6,
3235
3309
  onLoadMoreRecords: $options.loadMoreRecords,
3236
3310
  "hide-load-more": $props.hideLoadMore,
3237
3311
  "hide-count": $props.hideCount,