xrk-components 0.4.2-beta.12 → 0.4.2-beta.14

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/lib/index.esm.js CHANGED
@@ -42722,7 +42722,7 @@ var script$n = /*#__PURE__*/ defineComponent(__assign(__assign({}, __default__$n
42722
42722
  : (openBlock(), createElementBlock("div", {
42723
42723
  key: 1,
42724
42724
  class: normalizeClass(["xrk-custom-image-viewer", { 'hide-close': __props.hideClose }]),
42725
- style: normalizeStyle({ width: __props.style.width, height: __props.style.height })
42725
+ style: normalizeStyle(__props.style ? { width: __props.style.width, height: __props.style.height } : {})
42726
42726
  }, [
42727
42727
  createElementVNode("div", {
42728
42728
  style: { "width": "100%", "height": "100%" },
@@ -44575,6 +44575,7 @@ var script$4 = /*#__PURE__*/ defineComponent(__assign(__assign({}, __default__$4
44575
44575
  }))
44576
44576
  });
44577
44577
  var props = _props;
44578
+ var searchFormRef = ref();
44578
44579
  var columnsToSearchValue = function (columns) {
44579
44580
  return columns.reduce(function (pre, _a) {
44580
44581
  var prop = _a.prop, defaultValue = _a.defaultValue;
@@ -44582,6 +44583,13 @@ var script$4 = /*#__PURE__*/ defineComponent(__assign(__assign({}, __default__$4
44582
44583
  return pre;
44583
44584
  }, {});
44584
44585
  };
44586
+ var columnsToDisabledReset = function (columns) {
44587
+ return columns.reduce(function (pre, _a) {
44588
+ var prop = _a.prop, disabledReset = _a.disabledReset;
44589
+ pre[prop] = disabledReset || false;
44590
+ return pre;
44591
+ }, {});
44592
+ };
44585
44593
  // 将 searchValue 传入 每个搜索项的监听事件
44586
44594
  var proxyColumnListener = function (listener) {
44587
44595
  return Object.keys(listener).reduce(function (pre, cur) {
@@ -44596,6 +44604,7 @@ var script$4 = /*#__PURE__*/ defineComponent(__assign(__assign({}, __default__$4
44596
44604
  }, {});
44597
44605
  };
44598
44606
  var searchValue = reactive(columnsToSearchValue(props.columns));
44607
+ var disabledReset = reactive(columnsToDisabledReset(props.columns));
44599
44608
  var BaseSearchRender = defineComponent({
44600
44609
  name: 'search-render',
44601
44610
  props: {
@@ -44609,48 +44618,52 @@ var script$4 = /*#__PURE__*/ defineComponent(__assign(__assign({}, __default__$4
44609
44618
  });
44610
44619
  var handleSearchClick = function () { return __awaiter(_this, void 0, void 0, function () {
44611
44620
  var _searchValue;
44612
- var _a, _b, _c, _d, _e, _f;
44613
- return __generator(this, function (_g) {
44614
- switch (_g.label) {
44621
+ var _a, _b, _c, _d, _e, _f, _g, _h;
44622
+ return __generator(this, function (_j) {
44623
+ switch (_j.label) {
44615
44624
  case 0:
44616
44625
  _searchValue = base.deepClone(searchValue);
44617
44626
  if (!isFunction((_a = props.searchBtn) === null || _a === void 0 ? void 0 : _a.beforeSearch)) return [3 /*break*/, 2];
44618
44627
  return [4 /*yield*/, ((_c = (_b = props.searchBtn) === null || _b === void 0 ? void 0 : _b.beforeSearch) === null || _c === void 0 ? void 0 : _c.call(_b, _searchValue))];
44619
44628
  case 1:
44620
- _searchValue = _g.sent();
44621
- _g.label = 2;
44622
- case 2:
44623
- emits('search', _searchValue);
44624
- if (!isFunction((_d = props.searchBtn) === null || _d === void 0 ? void 0 : _d.afterSearch)) return [3 /*break*/, 4];
44625
- return [4 /*yield*/, ((_f = (_e = props.searchBtn) === null || _e === void 0 ? void 0 : _e.afterSearch) === null || _f === void 0 ? void 0 : _f.call(_e, _searchValue))];
44629
+ _searchValue = _j.sent();
44630
+ _j.label = 2;
44631
+ case 2: return [4 /*yield*/, ((_e = (_d = searchFormRef.value) === null || _d === void 0 ? void 0 : _d.validate) === null || _e === void 0 ? void 0 : _e.call(_d))];
44626
44632
  case 3:
44627
- _g.sent();
44628
- _g.label = 4;
44629
- case 4: return [2 /*return*/];
44633
+ _j.sent();
44634
+ emits('search', _searchValue);
44635
+ if (!isFunction((_f = props.searchBtn) === null || _f === void 0 ? void 0 : _f.afterSearch)) return [3 /*break*/, 5];
44636
+ return [4 /*yield*/, ((_h = (_g = props.searchBtn) === null || _g === void 0 ? void 0 : _g.afterSearch) === null || _h === void 0 ? void 0 : _h.call(_g, _searchValue))];
44637
+ case 4:
44638
+ _j.sent();
44639
+ _j.label = 5;
44640
+ case 5: return [2 /*return*/];
44630
44641
  }
44631
44642
  });
44632
44643
  }); };
44633
44644
  var handleResetClick = function () { return __awaiter(_this, void 0, void 0, function () {
44634
44645
  var _searchValue;
44635
- var _a, _b, _c, _d, _e, _f;
44636
- return __generator(this, function (_g) {
44637
- switch (_g.label) {
44646
+ var _a, _b, _c, _d, _e, _f, _g, _h;
44647
+ return __generator(this, function (_j) {
44648
+ switch (_j.label) {
44638
44649
  case 0:
44639
- Object.keys(searchValue).forEach(function (searchKey) { return (searchValue[searchKey] = null); });
44650
+ Object.keys(searchValue).forEach(function (searchKey) { return !disabledReset[searchKey] && (searchValue[searchKey] = void 0); });
44640
44651
  _searchValue = base.deepClone(searchValue);
44641
44652
  if (!isFunction((_a = props.resetBtn) === null || _a === void 0 ? void 0 : _a.beforeReset)) return [3 /*break*/, 2];
44642
44653
  return [4 /*yield*/, ((_c = (_b = props.resetBtn) === null || _b === void 0 ? void 0 : _b.beforeReset) === null || _c === void 0 ? void 0 : _c.call(_b, _searchValue))];
44643
44654
  case 1:
44644
- _searchValue = _g.sent();
44645
- _g.label = 2;
44646
- case 2:
44647
- emits('search', _searchValue);
44648
- if (!isFunction((_d = props.resetBtn) === null || _d === void 0 ? void 0 : _d.afterReset)) return [3 /*break*/, 4];
44649
- return [4 /*yield*/, ((_f = (_e = props.resetBtn) === null || _e === void 0 ? void 0 : _e.afterReset) === null || _f === void 0 ? void 0 : _f.call(_e, _searchValue))];
44655
+ _searchValue = _j.sent();
44656
+ _j.label = 2;
44657
+ case 2: return [4 /*yield*/, ((_e = (_d = searchFormRef.value) === null || _d === void 0 ? void 0 : _d.validate) === null || _e === void 0 ? void 0 : _e.call(_d))];
44650
44658
  case 3:
44651
- _g.sent();
44652
- _g.label = 4;
44653
- case 4: return [2 /*return*/];
44659
+ _j.sent();
44660
+ emits('search', _searchValue);
44661
+ if (!isFunction((_f = props.resetBtn) === null || _f === void 0 ? void 0 : _f.afterReset)) return [3 /*break*/, 5];
44662
+ return [4 /*yield*/, ((_h = (_g = props.resetBtn) === null || _g === void 0 ? void 0 : _g.afterReset) === null || _h === void 0 ? void 0 : _h.call(_g, _searchValue))];
44663
+ case 4:
44664
+ _j.sent();
44665
+ _j.label = 5;
44666
+ case 5: return [2 /*return*/];
44654
44667
  }
44655
44668
  });
44656
44669
  }); };
@@ -44675,15 +44688,20 @@ var script$4 = /*#__PURE__*/ defineComponent(__assign(__assign({}, __default__$4
44675
44688
  });
44676
44689
  return function (_ctx, _cache) {
44677
44690
  return (openBlock(), createElementBlock("div", _hoisted_1$3, [
44678
- createVNode(script$7, { model: searchValue }, {
44691
+ createVNode(script$7, {
44692
+ model: searchValue,
44693
+ ref_key: "searchFormRef",
44694
+ ref: searchFormRef
44695
+ }, {
44679
44696
  default: withCtx(function () { return [
44680
44697
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, function (_a) {
44681
- var style = _a.style, label = _a.label, prop = _a.prop, type = _a.type, disabled = _a.disabled, config = _a.config, listener = _a.listener, labelWidth = _a.labelWidth;
44698
+ var style = _a.style, label = _a.label, prop = _a.prop, type = _a.type, disabled = _a.disabled, config = _a.config, listener = _a.listener, labelWidth = _a.labelWidth, rules = _a.rules;
44682
44699
  return (openBlock(), createBlock(script$6, {
44683
44700
  prop: prop,
44684
44701
  label: label,
44685
44702
  labelWidth: labelWidth,
44686
- key: prop
44703
+ key: prop,
44704
+ rules: rules
44687
44705
  }, {
44688
44706
  default: withCtx(function () { return [
44689
44707
  type
@@ -44698,7 +44716,7 @@ var script$4 = /*#__PURE__*/ defineComponent(__assign(__assign({}, __default__$4
44698
44716
  : createCommentVNode("v-if", true)
44699
44717
  ]; }),
44700
44718
  _: 2 /* DYNAMIC */
44701
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["prop", "label", "labelWidth"]));
44719
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["prop", "label", "labelWidth", "rules"]));
44702
44720
  }), 128 /* KEYED_FRAGMENT */)),
44703
44721
  (__props.searchBtn.show)
44704
44722
  ? (openBlock(), createBlock(script$p, {
package/lib/index.umd.js CHANGED
@@ -42725,7 +42725,7 @@ usage: app.provide(ID_INJECTION_KEY, {
42725
42725
  : (vue.openBlock(), vue.createElementBlock("div", {
42726
42726
  key: 1,
42727
42727
  class: vue.normalizeClass(["xrk-custom-image-viewer", { 'hide-close': __props.hideClose }]),
42728
- style: vue.normalizeStyle({ width: __props.style.width, height: __props.style.height })
42728
+ style: vue.normalizeStyle(__props.style ? { width: __props.style.width, height: __props.style.height } : {})
42729
42729
  }, [
42730
42730
  vue.createElementVNode("div", {
42731
42731
  style: { "width": "100%", "height": "100%" },
@@ -44578,6 +44578,7 @@ usage: app.provide(ID_INJECTION_KEY, {
44578
44578
  }))
44579
44579
  });
44580
44580
  var props = _props;
44581
+ var searchFormRef = vue.ref();
44581
44582
  var columnsToSearchValue = function (columns) {
44582
44583
  return columns.reduce(function (pre, _a) {
44583
44584
  var prop = _a.prop, defaultValue = _a.defaultValue;
@@ -44585,6 +44586,13 @@ usage: app.provide(ID_INJECTION_KEY, {
44585
44586
  return pre;
44586
44587
  }, {});
44587
44588
  };
44589
+ var columnsToDisabledReset = function (columns) {
44590
+ return columns.reduce(function (pre, _a) {
44591
+ var prop = _a.prop, disabledReset = _a.disabledReset;
44592
+ pre[prop] = disabledReset || false;
44593
+ return pre;
44594
+ }, {});
44595
+ };
44588
44596
  // 将 searchValue 传入 每个搜索项的监听事件
44589
44597
  var proxyColumnListener = function (listener) {
44590
44598
  return Object.keys(listener).reduce(function (pre, cur) {
@@ -44599,6 +44607,7 @@ usage: app.provide(ID_INJECTION_KEY, {
44599
44607
  }, {});
44600
44608
  };
44601
44609
  var searchValue = vue.reactive(columnsToSearchValue(props.columns));
44610
+ var disabledReset = vue.reactive(columnsToDisabledReset(props.columns));
44602
44611
  var BaseSearchRender = vue.defineComponent({
44603
44612
  name: 'search-render',
44604
44613
  props: {
@@ -44612,48 +44621,52 @@ usage: app.provide(ID_INJECTION_KEY, {
44612
44621
  });
44613
44622
  var handleSearchClick = function () { return __awaiter(_this, void 0, void 0, function () {
44614
44623
  var _searchValue;
44615
- var _a, _b, _c, _d, _e, _f;
44616
- return __generator(this, function (_g) {
44617
- switch (_g.label) {
44624
+ var _a, _b, _c, _d, _e, _f, _g, _h;
44625
+ return __generator(this, function (_j) {
44626
+ switch (_j.label) {
44618
44627
  case 0:
44619
44628
  _searchValue = xrkTools.base.deepClone(searchValue);
44620
44629
  if (!isFunction((_a = props.searchBtn) === null || _a === void 0 ? void 0 : _a.beforeSearch)) return [3 /*break*/, 2];
44621
44630
  return [4 /*yield*/, ((_c = (_b = props.searchBtn) === null || _b === void 0 ? void 0 : _b.beforeSearch) === null || _c === void 0 ? void 0 : _c.call(_b, _searchValue))];
44622
44631
  case 1:
44623
- _searchValue = _g.sent();
44624
- _g.label = 2;
44625
- case 2:
44626
- emits('search', _searchValue);
44627
- if (!isFunction((_d = props.searchBtn) === null || _d === void 0 ? void 0 : _d.afterSearch)) return [3 /*break*/, 4];
44628
- return [4 /*yield*/, ((_f = (_e = props.searchBtn) === null || _e === void 0 ? void 0 : _e.afterSearch) === null || _f === void 0 ? void 0 : _f.call(_e, _searchValue))];
44632
+ _searchValue = _j.sent();
44633
+ _j.label = 2;
44634
+ case 2: return [4 /*yield*/, ((_e = (_d = searchFormRef.value) === null || _d === void 0 ? void 0 : _d.validate) === null || _e === void 0 ? void 0 : _e.call(_d))];
44629
44635
  case 3:
44630
- _g.sent();
44631
- _g.label = 4;
44632
- case 4: return [2 /*return*/];
44636
+ _j.sent();
44637
+ emits('search', _searchValue);
44638
+ if (!isFunction((_f = props.searchBtn) === null || _f === void 0 ? void 0 : _f.afterSearch)) return [3 /*break*/, 5];
44639
+ return [4 /*yield*/, ((_h = (_g = props.searchBtn) === null || _g === void 0 ? void 0 : _g.afterSearch) === null || _h === void 0 ? void 0 : _h.call(_g, _searchValue))];
44640
+ case 4:
44641
+ _j.sent();
44642
+ _j.label = 5;
44643
+ case 5: return [2 /*return*/];
44633
44644
  }
44634
44645
  });
44635
44646
  }); };
44636
44647
  var handleResetClick = function () { return __awaiter(_this, void 0, void 0, function () {
44637
44648
  var _searchValue;
44638
- var _a, _b, _c, _d, _e, _f;
44639
- return __generator(this, function (_g) {
44640
- switch (_g.label) {
44649
+ var _a, _b, _c, _d, _e, _f, _g, _h;
44650
+ return __generator(this, function (_j) {
44651
+ switch (_j.label) {
44641
44652
  case 0:
44642
- Object.keys(searchValue).forEach(function (searchKey) { return (searchValue[searchKey] = null); });
44653
+ Object.keys(searchValue).forEach(function (searchKey) { return !disabledReset[searchKey] && (searchValue[searchKey] = void 0); });
44643
44654
  _searchValue = xrkTools.base.deepClone(searchValue);
44644
44655
  if (!isFunction((_a = props.resetBtn) === null || _a === void 0 ? void 0 : _a.beforeReset)) return [3 /*break*/, 2];
44645
44656
  return [4 /*yield*/, ((_c = (_b = props.resetBtn) === null || _b === void 0 ? void 0 : _b.beforeReset) === null || _c === void 0 ? void 0 : _c.call(_b, _searchValue))];
44646
44657
  case 1:
44647
- _searchValue = _g.sent();
44648
- _g.label = 2;
44649
- case 2:
44650
- emits('search', _searchValue);
44651
- if (!isFunction((_d = props.resetBtn) === null || _d === void 0 ? void 0 : _d.afterReset)) return [3 /*break*/, 4];
44652
- return [4 /*yield*/, ((_f = (_e = props.resetBtn) === null || _e === void 0 ? void 0 : _e.afterReset) === null || _f === void 0 ? void 0 : _f.call(_e, _searchValue))];
44658
+ _searchValue = _j.sent();
44659
+ _j.label = 2;
44660
+ case 2: return [4 /*yield*/, ((_e = (_d = searchFormRef.value) === null || _d === void 0 ? void 0 : _d.validate) === null || _e === void 0 ? void 0 : _e.call(_d))];
44653
44661
  case 3:
44654
- _g.sent();
44655
- _g.label = 4;
44656
- case 4: return [2 /*return*/];
44662
+ _j.sent();
44663
+ emits('search', _searchValue);
44664
+ if (!isFunction((_f = props.resetBtn) === null || _f === void 0 ? void 0 : _f.afterReset)) return [3 /*break*/, 5];
44665
+ return [4 /*yield*/, ((_h = (_g = props.resetBtn) === null || _g === void 0 ? void 0 : _g.afterReset) === null || _h === void 0 ? void 0 : _h.call(_g, _searchValue))];
44666
+ case 4:
44667
+ _j.sent();
44668
+ _j.label = 5;
44669
+ case 5: return [2 /*return*/];
44657
44670
  }
44658
44671
  });
44659
44672
  }); };
@@ -44678,15 +44691,20 @@ usage: app.provide(ID_INJECTION_KEY, {
44678
44691
  });
44679
44692
  return function (_ctx, _cache) {
44680
44693
  return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
44681
- vue.createVNode(script$7, { model: searchValue }, {
44694
+ vue.createVNode(script$7, {
44695
+ model: searchValue,
44696
+ ref_key: "searchFormRef",
44697
+ ref: searchFormRef
44698
+ }, {
44682
44699
  default: vue.withCtx(function () { return [
44683
44700
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.columns, function (_a) {
44684
- var style = _a.style, label = _a.label, prop = _a.prop, type = _a.type, disabled = _a.disabled, config = _a.config, listener = _a.listener, labelWidth = _a.labelWidth;
44701
+ var style = _a.style, label = _a.label, prop = _a.prop, type = _a.type, disabled = _a.disabled, config = _a.config, listener = _a.listener, labelWidth = _a.labelWidth, rules = _a.rules;
44685
44702
  return (vue.openBlock(), vue.createBlock(script$6, {
44686
44703
  prop: prop,
44687
44704
  label: label,
44688
44705
  labelWidth: labelWidth,
44689
- key: prop
44706
+ key: prop,
44707
+ rules: rules
44690
44708
  }, {
44691
44709
  default: vue.withCtx(function () { return [
44692
44710
  type
@@ -44701,7 +44719,7 @@ usage: app.provide(ID_INJECTION_KEY, {
44701
44719
  : vue.createCommentVNode("v-if", true)
44702
44720
  ]; }),
44703
44721
  _: 2 /* DYNAMIC */
44704
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["prop", "label", "labelWidth"]));
44722
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["prop", "label", "labelWidth", "rules"]));
44705
44723
  }), 128 /* KEYED_FRAGMENT */)),
44706
44724
  (__props.searchBtn.show)
44707
44725
  ? (vue.openBlock(), vue.createBlock(script$p, {
@@ -42,6 +42,7 @@ export declare type SerachColumnBaseType<Q extends Record<string, any> = any, T
42
42
  style?: CSSProperties;
43
43
  defaultValue?: Q[keyof Q];
44
44
  rules?: FormItemRule | Array<FormItemRule>;
45
+ disabledReset?: boolean;
45
46
  /**
46
47
  * 是否禁用
47
48
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xrk-components",
3
- "version": "0.4.2-beta.12",
3
+ "version": "0.4.2-beta.14",
4
4
  "description": "",
5
5
  "main": "lib/index.esm.js",
6
6
  "typings": "lib/packages/index.d.ts",